diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65d7ac6..3962310 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,6 +78,58 @@ jobs: if-no-files-found: warn # Live Studio UI checks are opt-in; hosted OpenGL 3.3 availability is not assumed. + windows-installer: + # ARK Setup (installer/ArkSetup) with a synthetic payload: no native build, no real registration or shortcuts. + runs-on: windows-2022 + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + - name: Build ARK Setup in the public and self-test configurations + shell: pwsh + run: | + dotnet publish installer/ArkSetup/ArkSetup.csproj -c Release -p:ArkSetupSelfTest=false -o out/installer-ci/public --nologo + if ($LASTEXITCODE -ne 0) { throw 'The public configuration did not build.' } + dotnet publish installer/ArkSetup/ArkSetup.csproj -c Release -p:ArkSetupSelfTest=true -p:ArkTestIsolationId=hosted-ci -o out/installer-ci/self-test --nologo + if ($LASTEXITCODE -ne 0) { throw 'The self-test configuration did not build.' } + - name: Render the setup pages (self-test build, layout only) + shell: pwsh + run: | + $captures = Join-Path $PWD 'out/installer-ci/pages' + $page = Start-Process -FilePath out/installer-ci/self-test/ARK-Setup.exe -ArgumentList @('--screenshot', ('"' + $captures + '"'), '--layout-only') -PassThru + $null = $page.Handle + if (-not $page.WaitForExit(120000)) { $page.Kill(); throw 'The page renderer timed out.' } + $layout = Get-Content -LiteralPath (Join-Path $captures 'layout.txt') -Raw + Write-Output $layout + if ($page.ExitCode -ne 0) { throw "The page renderer returned $($page.ExitCode)." } + foreach ($name in @('welcome','options','installing','done','error','uninstall')) { + if ($layout -notmatch "(?m)^${name}: elements=[1-9][0-9]*; outside=0; overlap=0; clipped=0;") { throw "Page $name failed its layout checks." } + } + - name: Test installer process detection, payload reading and the disk plan + shell: pwsh + run: | + dotnet run --project tests/installer_process_070a -c Release --artifacts-path out/installer-ci/process + if ($LASTEXITCODE -ne 0) { throw 'The installer process, payload or disk plan checks failed.' } + - name: Test the installer engine with a synthetic payload, including a temporary test signature + shell: powershell + run: ./tests/installer_engine_tests.ps1 -OutputDirectory out/installer-ci/engine -Signing + - name: Collect the setup log + if: failure() + shell: pwsh + run: | + $log = Join-Path ([IO.Path]::GetTempPath()) 'ARK-Setup.log' + if (Test-Path -LiteralPath $log) { Copy-Item -LiteralPath $log -Destination out/installer-ci/ARK-Setup.log } + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: windows-installer-logs + path: | + out/installer-ci/ARK-Setup.log + out/installer-ci/pages/layout.txt + if-no-files-found: ignore + linux-native-occt: runs-on: ubuntu-24.04 timeout-minutes: 90 diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml index 8fa7656..98c11be 100644 --- a/.github/workflows/release-package.yml +++ b/.github/workflows/release-package.yml @@ -62,6 +62,13 @@ jobs: out/native-release/native-authoring-corpus-v1.receipt.json out/native-release/drawing-dxf-v1.receipt.json if-no-files-found: warn + - name: Require a clean source tree for distributable artifacts + shell: pwsh + run: | + # package-release.ps1 and build-installer.ps1 refuse a dirty tree as well; this step names the files. + $changes = @(git status --porcelain --untracked-files=normal) + if ($LASTEXITCODE -ne 0) { throw 'git status failed.' } + if ($changes.Count) { $changes | Write-Output; throw 'The build or the tests changed the source tree; release artifacts need a clean tree.' } - name: Prepare portable package and update manifest shell: pwsh run: ./scripts/package-release.ps1 diff --git a/.gitignore b/.gitignore index 89d5d7b..834a5ef 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,9 @@ studio.json # Temporary agent worktrees created by Claude Code; never part of the source. .claude/worktrees/ + +# .NET build output of ARK Setup and its test harness +installer/**/bin/ +installer/**/obj/ +tests/installer_process_070a/bin/ +tests/installer_process_070a/obj/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 5637f17..b8463a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,8 @@ add_test(NAME rubber-dynamics-059c COMMAND ark-rubber-dynamics-tests) set_tests_properties(rubber-dynamics-059c PROPERTIES TIMEOUT 180) add_executable(ark-rubber-runtime-059c-benchmark EXCLUDE_FROM_ALL benchmarks/rubber_runtime_059c.cpp) target_link_libraries(ark-rubber-runtime-059c-benchmark PRIVATE ark) +add_executable(ark-program-binding-cost-benchmark EXCLUDE_FROM_ALL benchmarks/program_binding_cost.cpp) +target_link_libraries(ark-program-binding-cost-benchmark PRIVATE ark) target_link_libraries(ark-inertial-056c-tests PRIVATE ark) add_test(NAME inertial-056c COMMAND ark-inertial-056c-tests) set_tests_properties(inertial-056c PROPERTIES TIMEOUT 180) @@ -434,12 +436,19 @@ if(WIN32) # MSVC Release builds can exceed the standard COFF section count. target_compile_options(ark-studio PRIVATE /bigobj) endif() - # WinMain's frame takes about half of the default 1 MiB main stack, and the UI - # thread also runs document tools. Reserve 8 MiB; pages are committed on demand. + # Explicit 8 MiB stack reserve (address space; pages commit on use). WinMain's + # frame takes about half of a 1 MiB main stack and the UI thread also runs + # document tools (b63e93d). The MSVC + # and llvm-mingw defaults are 1 MiB. Headless self-tests run slow tools on the + # main thread beneath WinMain, and a component configure nests three session + # dispatch frames. Threads created without a size (std::thread) inherit this; + # the session executor requests the same reserve explicitly. + set(ARK_STUDIO_STACK_RESERVE 8388608) + target_compile_definitions(ark-studio PRIVATE ARK_STUDIO_STACK_RESERVE=${ARK_STUDIO_STACK_RESERVE}) if(MSVC) - target_link_options(ark-studio PRIVATE /STACK:8388608) + target_link_options(ark-studio PRIVATE /STACK:${ARK_STUDIO_STACK_RESERVE}) elseif(MINGW) - target_link_options(ark-studio PRIVATE -Wl,--stack,8388608) + target_link_options(ark-studio PRIVATE -Wl,--stack,${ARK_STUDIO_STACK_RESERVE}) endif() target_include_directories(ark-studio PRIVATE assets/ui) find_program(ARK_POWERSHELL NAMES powershell pwsh REQUIRED) @@ -850,6 +859,11 @@ if(WIN32) # 048B Parametric HUD overlay; the selftest also checks a 1100x700 layout. add_test(NAME studio-parametric-hud-ui COMMAND ark-studio --self-test-parametric-hud-ui --settings-file "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/parametric-hud-ui.settings.json" --shot "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/parametric-hud-ui.png" --size 1280 800) set_tests_properties(studio-parametric-hud-ui PROPERTIES TIMEOUT 180 RUN_SERIAL TRUE) + # Program controls in the Parametric HUD (native bookshelf/flange extrusions need OCCT). + if(ARK_WITH_OCCT) + add_test(NAME studio-program-hud-ui COMMAND ark-studio --self-test-program-hud-ui --settings-file "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/program-hud-ui.settings.json" --shot "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/program-hud-ui.png" --size 1280 800) + set_tests_properties(studio-program-hud-ui PROPERTIES TIMEOUT 300 RUN_SERIAL TRUE) + endif() add_test(NAME studio-skeleton-editor COMMAND ark-studio --skeleton-editor-test --settings-file "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/skeleton-editor.settings.json" --shot "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/skeleton-editor.png" --size 1440 900) set_tests_properties(studio-skeleton-editor PROPERTIES TIMEOUT 180 RUN_SERIAL TRUE) foreach(width 1180 1440) @@ -902,6 +916,10 @@ add_executable(ark-sketch-tests tests/sketch_tests.cpp) target_link_libraries(ark-sketch-tests PRIVATE ark) add_test(NAME parametric-sketch COMMAND ark-sketch-tests) set_tests_properties(parametric-sketch PROPERTIES TIMEOUT 60) +if(ARK_WITH_OCCT) + target_compile_definitions(ark-sketch-tests PRIVATE ARK_SKETCH_NATIVE_TESTS=1) + add_dependencies(ark-sketch-tests ark-occt-worker) +endif() add_executable(ark-live-tests tests/live_session_tests.cpp) target_link_libraries(ark-live-tests PRIVATE ark) @@ -945,6 +963,10 @@ endif() add_test(NAME part-agents-052d COMMAND ark-part-agents-tests) set_tests_properties(part-agents-052d PROPERTIES TIMEOUT 60) set_tests_properties(agent-team PROPERTIES TIMEOUT 45) +add_executable(ark-agent-team-reasoning-tests tests/agent_team_reasoning_tests.cpp) +target_link_libraries(ark-agent-team-reasoning-tests PRIVATE ark) +add_test(NAME agent-team-reasoning COMMAND ark-agent-team-reasoning-tests) +set_tests_properties(agent-team-reasoning PROPERTIES TIMEOUT 30) add_executable(ark-agent-tool-layer-042d-tests tests/agent_tool_layer_042d_tests.cpp) target_link_libraries(ark-agent-tool-layer-042d-tests PRIVATE ark) diff --git a/DISTRIBUTION.md b/DISTRIBUTION.md index 8e15766..7bfadb2 100644 --- a/DISTRIBUTION.md +++ b/DISTRIBUTION.md @@ -13,7 +13,7 @@ Build and verify a current package: ./scripts/package-release.ps1 ``` -release.json determines source identity; packaged binaries retain their generated runtime metadata. Existing archives/releases are not overwritten. No user drawings or private settings are included. +release.json determines source identity; packaged binaries retain their generated runtime metadata. Existing archives/releases are not overwritten. No user drawings or private settings are included. A distributable package and a public setup need a committed source tree: package-release.ps1 and build-installer.ps1 refuse uncommitted or untracked, non-ignored files (and build-installer.ps1 a package whose release evidence records dirty=true), and the release workflow stops before packaging if the build or tests changed the tree. -AllowDirtyTree (also on publish-test-build.ps1, never with -Publish) builds a local test artifact anyway; its evidence then records dirty=true and it must not be distributed. To create an optional installer, install the .NET 10 SDK and use the archive matching the current source: @@ -22,7 +22,7 @@ To create an optional installer, install the .NET 10 SDK and use the archive mat ./scripts/test-distribution.ps1 -PackagePath out/releases/ark-windows-x64-VERSION.zip -InstallerPath out/releases/ARK-CODE-windows-x64-setup.exe ``` -Replace VERSION and CODE with the generated identity, not a reused code. The isolated smoke verifies package geometry, STEP, installation receipts and uninstall; it runs the setup with --test-isolated, so the installed ARK's registration and shortcuts are untouched. See docs/WINDOWS_INSTALLER.md. tests/distribution_tests.ps1 covers packaging fixtures; fixture success alone does not qualify a real installer. +Replace VERSION and CODE with the generated identity, not a reused code. The isolated smoke verifies package geometry, STEP, that the public setup has no self-test page renderer, installation receipts and uninstall; it runs the setup with --test-isolated, so the installed ARK's registration and shortcuts are untouched. To sign, pass -SignScript to build-installer.ps1; the signing order (uninstaller stub first, the whole setup after the package is appended) is in docs/WINDOWS_INSTALLER.md. See docs/WINDOWS_INSTALLER.md. tests/distribution_tests.ps1 covers packaging fixtures; fixture success alone does not qualify a real installer. Actions -> Prepare Windows and Linux release packages -> Run workflow builds and tests both platforms. The installer input additionally builds/tests the Windows setup. Publication is explicit, defaults to false and runs only after both platform jobs succeed. It attaches checksums and pinned OCCT source, and refuses an existing version tag. Hosted native results do not establish interactive Studio acceptance on another computer. diff --git a/benchmarks/program_binding_cost.cpp b/benchmarks/program_binding_cost.cpp new file mode 100644 index 0000000..c9f77e2 --- /dev/null +++ b/benchmarks/program_binding_cost.cpp @@ -0,0 +1,63 @@ +// D.02/G.01 synthetic cost of carrying parametric program bindings, with no +// drawing/session input. Eight namespaces each bind one large generated program +// (about 2000 statements, four legacy boxes, ~112 KB source); then one +// unrelated param.set is published repeatedly through doc_apply: +// - "journal": the installing session, whose iteration journal grows by one +// node per run (identical sequence for every executable, so comparable); +// - "bound": a copy of the document without journal, isolating per-apply work; +// - "detached": the same objects after detaching every binding (control). +// Serialization, clone and save/load of the journal-free bound document are +// timed separately. Run baseline and candidate executables alternately on the +// same machine and compare medians; retain every run. +#include "ark/parametric_programs.hpp" +#include "ark/serialize.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace ark; +using V=arkjson::Value; +using Clock=std::chrono::steady_clock; +static V data(const V& r){const auto* e=r.find("isError");if(e&&e->b)throw std::runtime_error(r.dump().substr(0,600));return *r.find("structuredContent");} +static V program(int k){ + std::string body="[";for(int i=0;i<2000;++i)body+="{\"let\":\"v"+std::to_string(i)+"\",\"value\":\"width*"+std::to_string(i%7+1)+"+sin("+std::to_string(i)+")*height/(1+"+std::to_string(i%5)+")\"},"; + body+="{\"for\":\"i\",\"count\":4,\"body\":[{\"emit\":{\"op\":\"feature.add\",\"type\":\"box\",\"name\":\"Block {i+1}\",\"p\":{\"dx\":\"{width}\",\"dy\":\"{height}\",\"dz\":\"{10+i}\"}}}]}]"; + V p;if(!arkjson::parse(R"({"format":"ark.parametric-program.v1","name":"Large )"+std::to_string(k)+R"(","parameters":{"width":{"default":20,"min":1,"max":100},"height":{"default":30,"min":1,"max":100}},"body":)"+body+"}",p))throw std::runtime_error("program JSON");return p; +} +static double ms(Clock::time_point a){return std::chrono::duration(Clock::now()-a).count();} +static std::string stats(std::vector v){std::sort(v.begin(),v.end());double sum=0;for(double x:v)sum+=x;char buf[160];std::snprintf(buf,sizeof buf,"median %.3f ms, mean %.3f ms, min %.3f ms, max %.3f ms (n=%zu)",v[v.size()/2],sum/v.size(),v.front(),v.back(),v.size());return buf;} +static void applyRuns(AgentSession& s,const char* label,int runs){ + std::vector apply; + for(int i=0;i serialize,clone; + for(int i=0;i journalFree(const AgentSession& source){auto s=std::make_unique();s->document=source.document;s->document.iterationHistory=V{};s->revision=source.revision;s->suppressIterationHistory();return s;} +static void run(AgentSession& s,const V& args){V a=args;a.set("expected_revision",V::makeNum((double)s.revision));const auto preview=data(s.call("parametric_program",a));V apply=V::makeObj();apply.set("candidate_id",*preview.find("candidate_id"));apply.set("expected_revision",V::makeNum((double)s.revision));data(s.call("doc_apply",apply));} +int main(int argc,char** argv){try{ + const int runs=argc>1?std::max(5,std::atoi(argv[1])):30;AgentSession s;size_t bytes=0; + auto t=Clock::now(); + for(int k=0;k<8;++k){const auto p=program(k);bytes+=p.dump().size();V a=V::makeObj();a.set("action",V::makeStr("prepare"));a.set("mode",V::makeStr("install"));a.set("namespace",V::makeStr("ns"+std::to_string(k)));a.set("program",p);run(s,a);} + std::cout<<"bindings "< save,load;for(int i=0;i` nodes that own their objects. Programs do not emit assemblies or mates. Assertions are stated design rules, not qualification. Team hosts can add a `ParametricDesigner` role. See [parametric programs](PARAMETRIC_PROGRAMS.md). 061C: read `agent_onboard{topic:"transmission"}` for mechanical mate engineering. `transmission_inspect` uses actual semantic axes and mate expressions; `transmission_design` analyzes and optimizes tooth/module/form choices and returns parameter-bound preview proposals. Declare efficiency, power branches and material factors; no contact/fatigue qualification is inferred. Extended mates use conditional semantic format 54. See [contracts](TRANSMISSIONS_061C.md). diff --git a/docs/AGENT_ACTIVITY.md b/docs/AGENT_ACTIVITY.md index fd1970a..5ea18d6 100644 --- a/docs/AGENT_ACTIVITY.md +++ b/docs/AGENT_ACTIVITY.md @@ -26,16 +26,23 @@ of the action, and optional `issue`, `wished_tool` and `wished_options` text. Utility 1 means unhelpful and 5 effective; difficulty 1 means easy and 5 very difficult. These are subjective self-reports, separate from measured results. The host never supplies scores for production agents. A cancelled/interrupted -agent leaves visible pending records; it does not fabricate feedback. +agent, or a run that ends with feedback still missing, leaves visible pending +records; it does not fabricate feedback. Ratings are immutable, confined to the owning role, and may be submitted in -batches of 64. A changed model within the same role is identified as a -same-role review. Audit tools themselves are excluded to avoid recursive -feedback. No turn or token budget is introduced. The ledger retains up to -4096 actions, then reports an explicit capture gap and increments -`unrecorded_actions`; existing document size limits also apply. These are -storage limits, not agent execution quotas. Scores alone do not qualify -geometry, manufacturing, tool quality or model performance. +batches of 64. A batch is atomic: every item is validated and nothing is +recorded unless all pass. Since 076A a rejection names each offending item by +index and `activity_id` with its reason (not found, another actor, already +rated, repeated in the batch, invalid score or text) and returns +`rejected_ratings`, `already_rated_ids` and the current pending IDs, so the +agent can correct the batch in one retry. Atomic batches are kept because a +team report's ratings must record nothing when any item fails (042D). A changed +model within the same role is identified as a same-role review. Audit tools +themselves are excluded to avoid recursive feedback. No turn or token budget is +introduced. The ledger retains up to 4096 actions, then reports an explicit +capture gap and increments `unrecorded_actions`; existing document size limits +also apply. These are storage limits, not agent execution quotas. Scores alone +do not qualify geometry, manufacturing, tool quality or model performance. Since 042D a team role can put the same rating items in the optional `ratings` field of `team_report_task` or `team_finish_goal` instead of calling @@ -49,6 +56,64 @@ being recorded, the report can still be rejected afterwards; that rejection states that the ratings were recorded. `tool_feedback` remains the route for the single assistant, ACP and external MCP clients. +### Run-scoped completion gate (076A) + +Receipts carry `pending_feedback_ids`, newest first and at most 64, plus the +untruncated `pending_feedback_count` for the calling actor. The Single +assistant uses one actor id (`assistant`) for every conversation and provider, +so this list can include rows that earlier conversations, other providers or +interrupted runs left unrated. Those rows are backlog: they stay pending in the +ledger, can be inspected with `activity_info` and `pending_only`, and may be +rated only by an agent that can describe the actual action. + +The HTTP, ACP and Claude Code connectors gate the end of a run on the activity +IDs that this run's receipts created. Retained history is not replayed into the +gate. The reminder lists exactly the still-unrated actions of this run, +including reads made after an earlier reminder, and states the backlog count. +Verification reads that team tools perform for a role (`revision_verification`, +`initial_checkpoint_verification`) count as actions of its run. +Another reminder follows only when the run's count of unrated actions is lower +than at the previous reminder. Ratings of rows outside the run never lower it +and every new action raises it, so a model that rates the listed IDs and makes +one new read in every round receives a bounded number of reminders; this is a +progress rule, not a turn or token budget. A reminder round that does not lower +the count ends the run without an error: the final reply is accepted and +shown (after the reply that triggered the first reminder, when they differ), +followed by the note *ARK: tool feedback is still pending for N actions of this +run*. A non-error status reports the same count during the run, and Studio's +final Single status reads **Feedback pending** with that count instead of +**Reply ready**. The rows remain pending and nothing is rated by the host. +`AssistantResult::feedback` records the run's action, rated and pending counts, +the pending IDs, the backlog and the number of reminders. A project boundary +(`doc_new`, `doc_load` or a changed project id) removes the earlier IDs from the +gate; they are counted in `run_boundary_dropped` (with up to 64 +`run_boundary_dropped_ids`) and the state is `boundary_dropped`, never +`complete`, so `run_actions` = `run_rated` + `run_pending` + +`run_boundary_dropped`. An `ARK_FEEDBACK_PENDING_V1` developer record keeps +that summary in the conversation; later Single runs treat those rows as backlog. + +A team role is gated only on actions it performed in its own team run. +`team_report_task` and `team_finish_goal` with state `completed` still require +those ratings, as described above; backlog from earlier conversations neither +blocks nor is listed in `unrated_activity_ids`, which now comes with an +untruncated `unrated_activity_count`. A team role's turn that ends with its own +actions unrated is no longer a failed turn. Instead those actions keep blocking: +the role's status and reply say so, its snapshot carries `feedback` (the turn's +outcome) and `pendingFeedback`, the lead's handoff notice counts them, and +`team_finish_goal` with state `completed` is rejected with +`teammate_unrated_feedback` while any idle teammate holds unrated actions of +this team run. A completed goal declared earlier is shown as needing input +while such actions remain. Only the owning role can rate them, through +`tool_feedback` or its report's ratings. The gate adds no turn or token budget. + +Since 076A Studio also declares `actor.run`, a per-run identifier, on the +Single assistant's and each team run's actions. A rating whose rater declares a +run is recorded with provenance `same_actor_other_run` when the rated row comes +from another run or predates the field; ledgers and actors without `run` load +and rate exactly as before (`agent_self_report` or +`same_role_review_with_changed_model`). Such ratings never count as progress of +the current run. + 045A extends the ledger to declared clients (`actor.kind:"client"`), which is how Studio's live MCP bridge identifies every call (`id:"live_mcp"`). For a client, only committed authoring and failed calls are recorded: a rejected diff --git a/docs/AGENT_BENCHMARK.md b/docs/AGENT_BENCHMARK.md index 780d0e6..2489176 100644 --- a/docs/AGENT_BENCHMARK.md +++ b/docs/AGENT_BENCHMARK.md @@ -95,6 +95,23 @@ qualificação de fabrico. D.01 permanece parcial até completar as repetições avaliação humana cega. Uma execução pequena pode revelar falhas e overhead; não demonstra redução de custo nem melhoria de design. +Mudança de semântica em 076A: até 075D, uma tentativa Single cujo agente não +avaliava as próprias ações (`tool_feedback`) depois do lembrete terminava com +erro e nunca era aceite. Desde 076A essa execução termina com a resposta e uma +nota de feedback pendente; pode ser aceite se cumprir os restantes critérios. +Para não alterar silenciosamente as taxas, cada tentativa regista +`tool_feedback_pending` (Single: `tool_feedback.state` igual a `pending`; +equipa: alguma função com ações desta equipa por avaliar, com +`tool_feedback` e `pending_feedback` por função e `team_pending_feedback`). +O resumo e cada linha de `strategy_totals` acrescentam `feedback_pending_count` +e `accepted_with_feedback_pending_count`. Para comparar com iterações +anteriores, use `accepted_count - accepted_with_feedback_pending_count`. +Numa equipa, as ações por avaliar continuam a bloquear `team_finish_goal`, pelo +que essa tentativa não fica concluída. Recibos anteriores sem o campo contam +como não pendentes. O executor deste benchmark não declara `actor`; por isso, +as tentativas atuais não criam registos de atividade e `tool_feedback.state` é +`no_actions`, salvo quando um transporte declara o ator nos argumentos. + D.02 usa as APIs existentes de contexto por objeto/deltas. O lead recebe instruções para resolver um design coerente, agrupar operações relacionadas e delegar apenas missões concretas com IDs, revisão e critérios mensuráveis. diff --git a/docs/AGENT_TEAM_ARCHITECTURE.md b/docs/AGENT_TEAM_ARCHITECTURE.md index 4918fdf..5ba1c3a 100644 --- a/docs/AGENT_TEAM_ARCHITECTURE.md +++ b/docs/AGENT_TEAM_ARCHITECTURE.md @@ -7,7 +7,9 @@ assignment or user goal is complete. `team_report_task{state,summary}` records the role's explicit report (`completed`, `needs_input`, `in_progress`). The lead uses `team_finish_goal{state,summary}` for the entire goal after integration and checks. Completing rejects pending jobs/mail, active peers, unreported assignments -and unresolved tool/worker failures. Summaries are agent declarations; actual +and unresolved tool/worker failures. Since 076A it also rejects while an idle +teammate holds unrated actions of this team run, which previously failed that +teammate's turn; see [AGENT_ACTIVITY.md](AGENT_ACTIVITY.md). Summaries are agent declarations; actual tool receipts remain authoritative and no manufacturing certification is implied. `team_send.kind` distinguishes `assignment`, `message` and `report`. For older diff --git a/docs/ASSISTANT_CONVERSATION.md b/docs/ASSISTANT_CONVERSATION.md index 27a297b..337d862 100644 --- a/docs/ASSISTANT_CONVERSATION.md +++ b/docs/ASSISTANT_CONVERSATION.md @@ -30,14 +30,32 @@ the dock. Within it: - **Rail** (the `»` control) collapses the dock to a 44 px strip with the Assistant icon, a running pulse and an unread count; clicking it restores the dock. The conversation and composer are hidden on the rail. -- **Normal** width is 400 px at 96 dpi (scaled with the window DPI). Dragging the - dock's left edge sets a user width; the viewport always keeps at least 460 px so - its display bar and appearance strip stay usable. +- **Normal** width is 400 px at 96 dpi. Dragging the dock's left edge sets a + user width. - **Expand** / **Restore** (also the `⇔` control) switches to about 48% of the window, within the same viewport limit. +The rail, minimum (340 px) and normal widths are preferences scaled with the +window DPI. The limits that protect the viewport are in physical pixels, +because the sidebar, viewport controls and native header buttons are not +DPI-scaled: + +- When the window has room, the viewport keeps at least 460 px beside the + sidebar and any open tool docks. Its display bar needs 440 px and the + appearance strip 405 px. +- If that reserve would leave less than the scaled minimum, the minimum gives + way first, but the dock never becomes narrower than 340 px. +- A narrow window with open tool docks can therefore leave the viewport below + 460 px. The viewport does not always keep 460 px. + +When Expand would not widen the dock, both Expand controls are visible but +disabled. For example, a 1280 px window at 144 or 192 dpi, or an 1100 px +window at any DPI, leaves no extra room. + Open state, mode (`rail`, `normal`, `expanded`) and the user width are saved in -the Studio settings. Unknown saved values fall back to the defaults. +the Studio settings. The width is stored in 96-dpi units with its fraction, so +a dragged width restores to the same pixel width at any DPI. Unknown saved +values fall back to the defaults. Agent replies carry a collapsed **Reasoning** row. It shows only text the provider returned in readable form (see [ASSISTANT.md](ASSISTANT.md)); a reply @@ -48,7 +66,58 @@ opens that agent's latest reasoning with its role id, label, turn and state, above the messages; extra roles are listed under **+N**. Team cards in **Agents** have a **Reasoning** link that returns to the conversation with that role selected. Reasoning is never added to the transcript copy, the provider history -or the document. +or the document. In an **Error** row the host error text comes first; the +run's reasoning row follows it, so provider reasoning is not read as part of +the error. + +In Team, each reply's reasoning travels with that reply's event. It is the +reasoning the role's provider returned since that role's previous reply in the +same turn. The UI therefore attaches it to the correct reply even when it reads +several replies in one poll. A later reply in the same turn that has none shows +*No new reasoning since the previous message*. A turn that exposed none shows +the not-exposed note. Team reasoning is limited to the mailbox size, 64 KiB by +default, and the conversation view to 256 KiB. Both keep the newest text and +cut it at a UTF-8 character boundary, never inside a multi-byte character. + +When the user or an external client replaces the document (new, load, +iteration restore), Studio clears the reasoning notes and the Single run's +latest reasoning along with the conversation. Source STEP and sheet STEP +imports share one reset: they keep the visible messages, but **Latest +reasoning** no longer shows the cancelled run. + +When the agent cards are collapsed, a Team that is blocked, interrupted or idle +without a completed goal has a **Review blockers** (or **Resume after error**) +chip next to Pause. A goal reported complete with no unresolved tool errors +shows no chip there. The cards keep their own control row unchanged. + +Local verification of this behaviour: + +- `studio-chat-dock-ui` repeats every dock layout check at 96, 144 and 192 dpi, + using a self-test DPI override. Expected widths come from the rule above. + The test also checks the disabled Expand state and that a dragged width + restores exactly after a settings round trip. +- The same test runs a real offline Team whose role replies twice in one turn. + It reads both replies in a single late poll and checks that each reply keeps + its own reasoning. +- It also checks UTF-8-safe truncation and the reset on a new document. It + then creates a sheet, exports it to STEP and imports it back. The sheet + STEP import must clear the run's reasoning and keep the visible messages. + The source STEP import uses the same reset but is not run by a test: no + test fixture is accepted by its tube importer. +- `agent-team-reasoning` covers emission order, the no-new-reasoning flag, a new + turn and bounded UTF-8 reasoning. +- `studio-team-blockers-ui` and its compact variant click Review blockers with + the cards collapsed. They also check that the chip disappears for a completed + goal. +- `studio-assistant-chat-ui` checks that the disabled Expand, at its 1100 px + layout, is still painted and is disabled only when the dock cannot widen. + +The local display ran at 144 dpi. 192 dpi was exercised only through the +override, not on a physical display. Real providers were not used. The +blocker tests and `studio-parametric-graph-ui`, listed as failing in the older +evidence below, pass on the local llvm-mingw build with this change. The +parametric graph overflow was recorded on MSVC builds, which were not run here +(see [COMPUTE_ARCHITECTURE.md](COMPUTE_ARCHITECTURE.md)). Local evidence for this change (milestones **A.02 / D.02**, still **Parcial**): `studio-chat-dock-ui` renders rail, normal and expanded docks at 1280×800 and @@ -92,6 +161,15 @@ Status labels distinguish: - **Reply ready**: Single has returned a reply, without asserting that the goal or the project is complete. Team completion is labelled **Goal reported complete** only when it has been explicitly declared. +- **Feedback pending** (amber): Single has returned a reply, but required tool + feedback is still missing because a reminder round did not lower the run's + count of unrated actions. The detail reads *Reply ready* with the pending + count, the reply ends with an ARK note giving the same count, and the status + line reads *Response finished / feedback pending for N actions*. The work + and activity records are retained and the state is not **Interrupted** (see + [AGENT_ACTIVITY.md](AGENT_ACTIVITY.md)). In a team, **Stopped / feedback + pending** means an idle role still holds unrated actions of this team run; + goal completion stays blocked until that role rates them. The UI self-test covers the status lifecycle, native selection, paragraph and goal copying, long replies, history beyond 200 entries, bounded native controls, diff --git a/docs/CLAUDE_CODE_CONNECT_044B.md b/docs/CLAUDE_CODE_CONNECT_044B.md index 3917872..acc1b3a 100644 --- a/docs/CLAUDE_CODE_CONNECT_044B.md +++ b/docs/CLAUDE_CODE_CONNECT_044B.md @@ -106,6 +106,14 @@ ARK starts the CLI with these arguments: - **Continuation.** Within one run, later host input such as tool-feedback reminders, completion-check issues or steering is sent as new turns of the same CLI session. +- **Tool feedback (076A).** Reminders list only the still-unrated actions of + the current run, never rows that earlier conversations left under the + `assistant` actor id. A further reminder follows only when the run's count of + unrated actions fell since the previous one. A reminder turn that does not + lower it ends the run with the final reply, the reply that triggered the + first reminder and a pending-feedback note, not with an Interrupted error; + the rows stay pending. See + [AGENT_ACTIVITY.md](AGENT_ACTIVITY.md). - **Steering.** User steering sends an `interrupt` and then a new turn. A tool call that belongs to the interrupted turn is refused by the host. - **Cancellation.** Cancellation terminates the process. Completed commits diff --git a/docs/COMPUTE_ARCHITECTURE.md b/docs/COMPUTE_ARCHITECTURE.md index f067a2a..bd36bfa 100644 --- a/docs/COMPUTE_ARCHITECTURE.md +++ b/docs/COMPUTE_ARCHITECTURE.md @@ -19,6 +19,47 @@ loading overlay. Other tools wait in the queue; edits resume after completion. Closing is deferred until the worker joins. The overlay does not invent a percentage or claim that an uninterruptible kernel call has been cancelled. +Studio's main thread and session worker have an explicit 8 MiB stack reserve +(`ARK_STUDIO_STACK_RESERVE` in CMake). This is address space; pages are +committed only when used. The linker default is 1 MiB with MSVC, and the +local llvm-mingw executable header showed the same value. The main thread gets +the reserve from the link flag, and threads created without a size (such as +`std::thread`) inherit it. The session worker requests the same reserve +explicitly, because `std::thread` cannot choose one. + +The reserve is needed because session tools nest. For example, configuring +a component through the parametric graph calls `AgentSession::dispatch` three +times: the component tool, its feature preview, then the component command +that serializes the document. Headless self-tests run that chain on the main +thread beneath `WinMain`. Interactive Studio runs it on the session worker, +which previously had the same 1 MiB default. + +The `studio-parametric-graph-ui` stack overflow was recorded on MSVC 14.44 +builds; no MSVC toolchain was available for this change, so MSVC frame sizes +were not measured. On a local llvm-mingw Release build: + +- The unmodified 1 MiB build passes the test. +- With the executable's reserve patched to 320 KiB, the test overflowed + (`0xC00000FD`). With 384 KiB it completed its UI checks. +- The debugger trace at the overflow contained no recursion, only the fixed + dispatch chain above. +- The largest frames were `WinMain` (about 81 KiB, because many self-tests are + inlined into it) and `AgentSession::dispatch` (about 50 KiB each, three + times). + +The test now reports the main thread's committed high-water mark. It fails if +either thread has less than the configured reserve, or if the high-water mark +exceeds half of the reserve. A build with larger frames therefore reports its +measured depth instead of passing close to an overflow. With the 8 MiB +reserve, the same build reported a 368 KiB high-water mark. Whether an MSVC +build stays within that limit has not been verified. + +`WinMain` still contains most Studio self-tests inline. Its frame therefore +sits under every chain that a headless test runs on the main thread, and under +the tools that interactive Studio runs on the main thread. In the llvm-mingw +build that frame is about 23% of the measured 368 KiB, and the three dispatch +frames are about 41%. + Native tessellation now uses OCCT's parallel mesher with a bounded thread pool. The default is up to eight logical threads; `ARK_NATIVE_THREADS=1` selects the serial control and values through 64 can explicitly set a budget. diff --git a/docs/CONTEXT_GRAPHS_034D.md b/docs/CONTEXT_GRAPHS_034D.md index aa06d3b..d1e6df6 100644 --- a/docs/CONTEXT_GRAPHS_034D.md +++ b/docs/CONTEXT_GRAPHS_034D.md @@ -19,7 +19,11 @@ retain geometric authority. `context_graph{query:"suspension",depth:1,limit:12,history_limit:3}` returns matching nodes and a bounded neighborhood. Use exact `keys:["feature:42"]` after discovery, instead of `query`, to retain the intended target. Nodes cover features, -parameters, sketches, planes, materials, assembly nodes and mates. Directed links +parameters, sketches, planes, materials, assembly nodes and mates. Installed +[parametric program](PARAMETRIC_PROGRAMS.md) bindings are `program:` +nodes with the program name, `namespace`, `program_sha256` and resolved `values`, +and `owns` links to their uniquely named owned features, sketches, datums and +materials; their values are not scanned as document parameter names. Directed links come from explicit selectors or expression identifiers; both dependencies and backlinks can be traversed. This is not complete evaluator dependency analysis. A repeated read in the same session reuses the index when an authoring stamp @@ -34,6 +38,8 @@ counter; independent sessions keep their own cache, while a host must still serialize calls to the same session. The stamp scans saved fields and serializes some subobjects, so avoiding the full JSON is not constant-time or a measured provider-token saving. Future persistent fields must join the stamp contract. +Program bindings and saved design variants are part of the stamp, so a detach, +which changes only the binding, or a variant edit rebuilds the index. The response includes project `scope`, observed `revision`, saved-authoring `source_sha256`, node fingerprints and explicit `partial` status. Depth is 0..2, diff --git a/docs/DESIGN_QUALITY_INVESTIGATION.md b/docs/DESIGN_QUALITY_INVESTIGATION.md index dc783f3..6f6f9d7 100644 --- a/docs/DESIGN_QUALITY_INVESTIGATION.md +++ b/docs/DESIGN_QUALITY_INVESTIGATION.md @@ -66,6 +66,107 @@ they cannot establish model reasoning, reconstruction fidelity or restoration of historical design quality. The causal regression and matched live quality comparison remain unresolved. +## Faceted display and curved authoring + +This source follow-up examined why agent-made geometry looked faceted or +"octagonal" and why bold curved shapes were rare. It changes display and +guidance mechanisms only. It does not claim that agents now design better: no +live model run, instruction ablation or blind review was performed. + +A cross-binary probe (051A, 055D, 056C, 066D and the 075D source) found identical +native geometry and display meshes. Thirteen probe bodies (cylinder, sphere, +filleted box, legacy and native circle extrusions, arc slot, closed spline, +legacy and exact revolves, loft and a 1 m cylinder) gave the same triangle and +B-rep face counts and volumes on every binary. The public airplane example gave +257,664 triangles and a byte-identical snapshot on 066D and 075D. The +mechanisms below are older than these binaries, not a 051A-to-075D regression. +Fillet, loft, sweep, revolve and extrude gained no new default-path rejection +between 066D and 075D. + +**Drawn edge outlines.** Curved B-rep edges were drawn from chord deviation only. +With the 043A size-relative deflection, a r=6 round on a 1.2 m body was drawn +with 22.5-degree chords. At the 0.5 mm cap (bodies of about 5 m and larger) a +r=6 hole outline had eight chords, an octagon over a 0.25 rad shaded bore. +Outlines are now also split until each chord turns no more than the surface +angular deflection. This is best effort within the existing 16,384-point bound +and never rejects; cusps of C0 curves stop at short chords. The 5 m hole +outline now has 32 chords. `native-solid` checks the turn per chord on 0.2 m +and 1.2 m filleted plates and the chord count of a hole in a 5 m plate. With +the split disabled, the same checks failed (0.17 and 0.39 rad turns; polygonal +hole). On eight public synthetic shapes, old and new display meshing at the +current settings (median of five runs, same machine) produced identical +triangles. Drawn edge points rose, for example from 336 to +528 on the 1.2 m plate, 100 to 192 on a 1 m r=10 cylinder and 282 to 354 on a +torus. Meshing time differences stayed within run-to-run variation. + +**Shaded surfaces.** The 043A parameters are unchanged. On straight r=6 rounds, +the widest shaded triangle spans 3.3 degrees (0.12 rad, up to 250 mm) and +6.9 degrees (0.25 rad, 1.2 m plate), at least twelve facets per quarter round. +The investigation's "about six chords" matched the drawn outline, not the +shaded faces. Restoring 0.12 rad for all sizes was measured on public synthetic +shapes, same machine and build, median of three runs. The 1.2 m plate went +from 1,716 to 6,628 triangles. A R=500/r=4 torus went from 18,360 to 37,800 +triangles and from 190 to 780 ms. A r=2 tube swept along a 1 m spline went from +56,354 to 210,972 triangles and from 0.76 to 3.4 s. The 043A measurement used a +private document that is not re-run here, so the surface parameters were kept. + +**Agent snapshot shading.** The software `snapshot` lit each triangle with its +own normal, so curved display meshes showed facet bands. Agents review their own +work with this image. It now interpolates the display mesh's vertex normals, as +Studio does for exact bodies. Planar triangles keep identical pixels. Bodies +Studio draws as hard surfaces stay faceted: legacy `extrude`/`sketch_cut`, +whose walls are sampled facets, and `notched_tube`, whose welded planar mesh +would otherwise bend flat faces. Receipts report `shading`, and +`appearance_scope` no longer claims flat lighting. `snapshot-032d` compares +flat and smooth renders of a 24-sided cylinder and of welded and unwelded cubes. +Through the tool, a 1 m exact rod shows no facet steps, while a flat render of +its own display mesh shows three. A notched tube's tool pixels equal a flat +render of its display mesh, which a smooth render does not. See +[032D](SNAPSHOTS_032D.md). + +**Sampled authoring paths.** Legacy `extrude`, `revolve` and `sketch_cut` +build mesh solids whose curves are chords at the sketch tolerance. The +preloaded sketch guide's only worked example used legacy `extrude` for a +closed spline. It now uses `native_solid` `extrude`, which keeps six exact +spline side faces, and its follow-up hole uses a native circle cutter. The +guide states what the legacy types build and gives the exact +`native_solid`/`revolve_surface` syntax. `equation2d` is an authored +polyline. Its native extrusion exceeds the 512-name topology registry, and the +unchanged rejection now names the exact recipes instead of implying that fewer +samples help. The preloaded solids guide names `revolve_surface`, `loft` and +`sweep` syntax for designs that need them, without making curves a +requirement. The preloaded pack grows by about 1.2 k characters. The guides were +not deduplicated: `onboarding-current-075d` requires `geometry_extensions` in +every audited topic. `parametric-sketch` asserts the solids rule and the sketch +rules, and executes the follow-up hole parsed from the guide's own `next_step` +text, so a changed or incomplete cutter fails the test. + +The programs topic had two straight-extrusion examples. A third, `turned_knob`, +revolves a line/cubic/arc profile into one exact solid. Its native volume matches +an independent integral of the authored profile (`parametric-programs`). + +Not changed: Studio still draws legacy `extrude`/`sketch_cut` as hard +surfaces for every profile. Their closed meshes share vertices across the cap +rim, so smooth curved walls would need crease-split normals and a Studio GPU +check, not run here. Legacy sampling density is unchanged because it defines +existing mesh-authority volumes. The curved-design effect of these changes +remains unmeasured. It needs the matched live comparison above, plus an +open-ended curved benchmark case with machine checks (valid B-rep, curved +operations, curved face counts) and a separate human review. + +This follow-up was verified on a local MinGW/OCCT 8.0.1 test build of the +source, without Studio. 34 CTest suites passed, including `native-solid`, +`snapshot-032d`, `media-044b`, `parametric-sketch`, `sketch-entities`, +`parametric-programs`, `onboarding-current-075d`, `assistant-connector`, +`associative-drawings`, `modeling-workflow`, `bend-workspace` and +`exploded-view-048b`. With `notched_tube` removed from the hard-surface set, +`snapshot-032d` failed on the notched-tube pixel check; with a guide hole +lacking `depth`, `parametric-sketch` failed on the cutter fields. A build +without OCCT passed `parametric-sketch`, `snapshot-032d`, +`onboarding-current-075d` and `media-044b`. That build exercises the same +sketch through legacy `extrude`. No installer, Studio capture or live provider +run was produced. + ## Local verification Six existing suites passed: `onboarding-current-075d`, `assistant-connector`, diff --git a/docs/DESIGN_VARIANTS_067G.md b/docs/DESIGN_VARIANTS_067G.md index 5a050e1..899558a 100644 --- a/docs/DESIGN_VARIANTS_067G.md +++ b/docs/DESIGN_VARIANTS_067G.md @@ -56,6 +56,16 @@ Save/remove/prepare return a `doc_preview` candidate; the caller explicitly send "constraints":{"height_mm":{"max":1900}},"objective":"volume_mm3"} ``` +Values and axes follow the program's [parameter kinds](PARAMETRIC_PROGRAMS.md#parameter-kinds): +numbers, `true`/`false` or `0`/`1` for a boolean, and only a listed choice, +including choice text, for example +`"axes":{"finish":["Oak","Pine"],"rail":[false,true]}`. An unlisted value is a +retained failed trial. Results and saved variants store resolved values: `1`/`0` +for a boolean and the listed text for a text choice. A saved text value requires +semantic version 60; numeric-only variants keep version 56. Studio's +**Edit value** and **Explore values** stage numbers only, so text choices are +compared and saved through the tool. + `ranked_indices` indexes `results` in objective order and includes only feasible rows with the requested metric available. `mass_kg` is absent and cannot be ranked when density is missing. `valid` means compilation and exact terminal-solid diff --git a/docs/FORMATS.md b/docs/FORMATS.md index 28eb4ca..66e65f7 100644 --- a/docs/FORMATS.md +++ b/docs/FORMATS.md @@ -1,4 +1,18 @@ -# Current source semantics — conditional format 59 +# Current source semantics — conditional format 60 + +Source60 is selected only when an embedded parametric program binding declares +a boolean (`"boolean":true`) or `choices` parameter, or a saved design variant +stores a text value. Bindings store a boolean as `1`/`0` and a choice as the +listed number or text; text choices are inserted into emitted templates with +`{@name}`. Numeric-only bindings keep source55 and numeric-only variants +source56. A document relabelled below 60 rejects on load, and earlier runtimes +reject source60 as a future format rather than ignoring the new fields. History +snapshots are read with the same rules. See +[parametric programs](PARAMETRIC_PROGRAMS.md#parameter-kinds). The `.arkprog` +program file (`ark.parametric-program-file.v1`) is a separate exchange file and +does not change the `.ark` format. Physical container v1/v2/v3 remains independent. + +## Geometry source semantics — conditional format 59 074B selects source59 for explicit region arrangements, multibody retention, all-argument Boolean operations, native thin offsets/joins, contour radius laws, diff --git a/docs/MEDIA_TEXTURES_044B.md b/docs/MEDIA_TEXTURES_044B.md index fdd33dd..2465b4e 100644 --- a/docs/MEDIA_TEXTURES_044B.md +++ b/docs/MEDIA_TEXTURES_044B.md @@ -102,9 +102,10 @@ the GIF/video frame through the same playback position. `visual_evidence` reports `textures_and_stamps:true`, `media_time_s`, `appearance_scope` and `appearance_surfaces` (`textured_surfaces`, `patterned_surfaces`, `stamps_drawn`, `media` rows with status, frame/position or error, -`missing_textures`, `stamps_skipped`). Lighting stays the flat diffuse model of -[032D](SNAPSHOTS_032D.md); output is deterministic for a given document and -time. +`missing_textures`, `stamps_skipped`). Lighting is the simple diffuse model of +[032D](SNAPSHOTS_032D.md), with the per-body vertex-normal shading reported in +`visual_evidence.shading`; `appearance_scope` does not describe lighting. +Output is deterministic for a given document and time. ## Local evidence (044B branch, Windows 11, MSVC 14.44) diff --git a/docs/PARAMETRIC_COMPONENTS_053B.md b/docs/PARAMETRIC_COMPONENTS_053B.md index 2e02e67..7c872a2 100644 --- a/docs/PARAMETRIC_COMPONENTS_053B.md +++ b/docs/PARAMETRIC_COMPONENTS_053B.md @@ -58,6 +58,8 @@ The graph uses the same local authored relation index as `context_graph`: - Select a part or occurrence to select its geometry in Studio. Selecting a parameter highlights known dependants; the inspector shows authored facts. + Ownership links (`owned_by_definition`, program `owns`) are metadata, not + dependants. - Double-click a part or group to fold/unfold its detail. Search includes direct neighbours; Focus limits the map around the selected object. - Drag nodes to arrange the view, drag the background to pan, use the wheel to diff --git a/docs/PARAMETRIC_HUD_048B.md b/docs/PARAMETRIC_HUD_048B.md index b4a0e1d..6d29e80 100644 --- a/docs/PARAMETRIC_HUD_048B.md +++ b/docs/PARAMETRIC_HUD_048B.md @@ -125,6 +125,17 @@ a native dialog with Label, Minimum, Maximum, Step, Unit, Group, Order and a offers *Show a parameter...*, which uses the same dialog with a parameter choice. +**Programs.** When the document has installed +[parametric programs](PARAMETRIC_PROGRAMS.md#studio), a **Parameters / +Programs** switch appears under the header. The HUD opens on Programs when no +parameter is exposed. The Programs view uses the same rows, staging and +clamping for each program parameter. **Apply** publishes a revision-checked +`parametric_program` configure candidate instead of `param.set`. **Detach** and +**Remove** ask for confirmation first. A value typed, or a Detach or Remove +confirmed, while another writer changed the model is not used; the HUD reads +the bindings again and asks for review. The Programs view has no Auto mode; +each **Apply** prepares and publishes one candidate. + The overlay uses the existing OpenGL panel primitives at physical pixels, like the viewport dock and the Baked Motions panel. Widths derive from the viewport (270..340 px) and labels are fitted with the renderer's glyph advances, so diff --git a/docs/PARAMETRIC_PROGRAMS.md b/docs/PARAMETRIC_PROGRAMS.md index 979b4ae..27d0146 100644 --- a/docs/PARAMETRIC_PROGRAMS.md +++ b/docs/PARAMETRIC_PROGRAMS.md @@ -49,12 +49,46 @@ external programs or network requests. } ``` -The complete bookshelf and a bolted flange are returned by +The complete bookshelf, a bolted flange and a turned knob are returned by `parametric_program{action:"examples"}` and by `agent_onboard{topic:"programs"}`. +The first two are straight extrusions. The knob revolves one half profile (lines, +two cubic wire spans and a quarter arc) with `revolve_surface` `p.solid:1` into +one exact solid with curved faces. Examples show the language; they do not +prescribe the form of a design. + +Parameters are immutable. `default` is required, and every public value is +validated against its parameter's kind before every run. Program variables are +numbers only. + +### Parameter kinds + +| Kind | Declaration | Accepted values | Stored value | In expressions | +| --- | --- | --- | --- | --- | +| Number | `{"default":800, "min":300, "max":2000, "integer":false, "unit":"mm"}` | A finite number within `min`/`max`, integral when `integer` is true | The number | The number | +| Boolean | `{"boolean":true, "default":false}` | `true`, `false`, `0` or `1` | `1` or `0` | `1` or `0` | +| Choice | `{"choices":[6,8,10], "default":8, "unit":"mm"}` | One listed number | The listed number | The number | +| Text choice | `{"choices":["Oak","Pine"], "default":"Oak"}` | One listed text, matched exactly | The listed text | Its 0-based index | + +`choices` lists 1..64 distinct values, either all finite numbers or all text +of 1..64 bytes without braces or control characters. A typed parameter fixes +its own domain, so `min`, `max` and `integer` reject with `boolean` or +`choices`; a boolean or text choice has no `unit`. A text choice is a number in +expressions (`finish==1` selects `"Pine"` above) and is inserted as text in +emitted templates with `{@finish}`, so a program can choose a material, a +name or another text field: -Parameters are immutable finite numbers. `default` is required; `min`, `max` -and `integer` bound the public values, which are validated before every run. -Program variables are numbers only. +```json +{"emit": {"op": "feature.add", "type": "native_solid", "name": "Panel {@finish}", + "material": "{@finish}", "native": {"op": "box"}, + "p": {"width": "{width}", "depth": 18, "height": "{rail ? 40 : 20}"}}} +``` + +`{@name}` accepts only a text-choice parameter and is checked statically like +other names, including in branches that do not run; `{@width}` on a number or +a function argument rejects `PROGRAM_TEMPLATE`. A text that is not a +program-local name refers to an existing project object, as for any other +emitted reference. `validate`, `inspect` and the compilation report list +`parameter_kinds`. ### Statements @@ -62,14 +96,24 @@ Each statement is an object with exactly one keyword: | Statement | Meaning | | --- | --- | -| `{let:x, value:expr}` | Binds `x` in the current block. A parameter name cannot be rebound. | -| `{set:x, value:expr}` | Updates the nearest earlier `let`, for example an accumulator. | +| `{let:x, value:expr}` | Binds `x` in the current block, after its value is evaluated. A parameter name cannot be rebound. | +| `{set:x, value:expr}` | Updates the nearest earlier `let` in scope, for example an accumulator. Parameters, `for` variables and function arguments are read-only. | | `{for:i, count:expr, body:[...]}` | Runs `i = 0..count-1`; the count is an integer 0..1024. | | `{if:expr, then:[...], else?:[...]}` | Nonzero is true. | | `{assert:expr, message}` | Rejects the run with the message when false. | -| `{call:fn, args:{param:expr}}` | Runs a function. It sees the parameters and its own arguments only, and every declared argument must be passed. | +| `{call:fn, args:{param:expr}}` | Runs a function. It sees the parameters, its own arguments and its own `let`s only, and every declared argument must be passed. Calls nest to 16, and the blocks of the body and all active calls to 64; a deeper run rejects `PROGRAM_RECURSION`. | | `{emit:command}` | Outputs one native command after template expansion. | +Names are lexical, as at run time. A `let` is visible to the later statements +of its block and to their nested blocks; a `for` variable inside its body; a +`$for` variable inside its `item`; a function body sees the parameters, its +arguments and its own `let`s, not the caller's. Compilation (`validate`, +`prepare` and `program.bind`) resolves every identifier in expressions and +`{...}` placeholders, every function call and its argument count, and every +`set` target before anything runs, including branches that the current values +do not take. A typo rejects with its path, for example +`PROGRAM_EXPRESSION: body[0].then[0].value: unknown identifier 'widht'`. + ### Expressions Program expressions support `+ - * / % ^`, comparisons `< <= > >= == !=` @@ -78,7 +122,24 @@ Program expressions support `+ - * / % ^`, comparisons `< <= > >= == !=` sqrt abs floor ceil round trunc sign exp log log10 hypot pow mod min max clamp lerp deg`. Trigonometry uses radians and `deg(x)` converts degrees to radians, as in document expressions. `%` and `mod` return a result with the sign of the -divisor. A non-finite result rejects the run. +divisor. + +`cond ? a : b` evaluates only the selected branch, `a && b` skips `b` when `a` +is 0, and `a || b` skips `b` when `a` is nonzero, so guards such as +`x!=0 ? 1/x : 0` and `n>0 && total/n>2` work for every value. Skipped operands +are still checked for syntax, names and argument counts. + +Every value computed while a program runs must be finite. Division or modulo +by zero, overflow such as `10^400` or `exp(1000)`, a literal such as `1e999` and +a function outside its domain such as `sqrt(-1)` or `log(0)` reject +`PROGRAM_NONFINITE` with the statement path and the expression. This holds +inside comparisons, `&&`, `||`, `!`, conditions, assertions, loop counts and +function arguments, so `1/(a-b) > 0` or `min(1/0, 3)` cannot turn an infinity +into a truth value or a finite number. Code that is not run, for example the +untaken branch of an `if`, is checked for syntax and names only. + +Parentheses, function arguments, `?:` and chains of unary `- + !` or `^` share +one nesting limit of 64 levels; deeper text rejects `PROGRAM_EXPRESSION`. ### Templates @@ -91,6 +152,8 @@ Inside an emitted command: literal sketch coordinates as text (`"0"`) to drive them exactly as well. - Other text with placeholders interpolates the shortest round-trip number, for example `"Shelf {i+1}"`. `{{` and `}}` are literal braces. +- `{@name}` inserts the chosen text of a text-choice parameter, for example + `"material":"{@finish}"`. A string containing it is always text. - A string without braces is passed unchanged. A document parameter expression such as `"thickness*2"` therefore stays associative with the document. - Inside an emitted array, `{"$for":"k","count":expr,"item":{...}}` splices @@ -112,21 +175,28 @@ References to program-local names are rewritten by field meaning: feature and `curve`, plane `parent` and `support`, and `material`. Names that are not program-local refer to existing project objects unchanged, so a program can build on `XY` or on a datum the user owns. Numeric feature IDs, `id` fields and -`owner_feature` sketches reject: IDs are not stable program identities. +`owner_feature` sketches reject: IDs are not stable program identities. A key +that accepts a sketch or a feature (`sections`, `section`, `guides`, `path`, +`profile`, `curve`) rejects `PROGRAM_REFERENCE` when the program emits both a +sketch and a feature with that local name; give them distinct names. Objects in a program namespace belong to that program. A namespace cannot reuse the prefix of an existing object or a parametric component. ## Tool and publication -`parametric_program` has four actions: +`parametric_program` has five actions: | Action | Effect | | --- | --- | -| `validate{program, values?, namespace?}` | Compiles without the document. Returns the commands, owned names, resolved values, passed assertions and steps. Read-only. | +| `validate{program or program_path, values?, namespace?}` | Compiles without the document. Returns the commands, owned names, resolved values, `parameter_kinds`, passed assertions and steps. Read-only. | | `examples{}` | Returns the built-in example programs. Read-only. | -| `inspect{namespace?, include_program?}` | Lists bindings with values, owned names and `local_edits`. Read-only. | -| `prepare{mode, namespace, program?, values?, expected_revision}` | Evaluates one isolated exact candidate with `doc_preview`. | +| `inspect{namespace?, include_program?}` | Lists bindings with values, `parameter_kinds`, owned names and `local_edits`. Read-only. | +| `prepare{mode, namespace, program or program_path?, values?, expected_revision}` | Evaluates one isolated exact candidate with `doc_preview`. | +| `export{namespace, path, expected_revision, overwrite?}` | Writes the installed source to a `.arkprog` file. The document is unchanged. | + +`values` maps parameter names to numbers, booleans or choice text, according +to each parameter's kind. Prepare modes: @@ -139,9 +209,24 @@ Prepare modes: | `detach` | `program.detach`: keeps the objects as ordinary editable source and drops the binding. | Publish the returned candidate with `doc_apply{candidate_id, expected_revision}`. -A stale candidate rejects. The `program.*` operations are also ordinary +A stale candidate rejects; program candidates do not support `refresh_candidate` +and must be prepared again. The `program.*` operations are also ordinary `doc_apply` commands and always require `expected_revision`. +A `program.bind` publishes exactly its compiled source. In the same batch it +must be immediately preceded by the commands its program, values and namespace +compile to (canonical JSON, same order), optionally after one `program.clear` +of that namespace. No other command of the batch may create, edit, rename or +remove an object in that namespace, a namespace is bound at most once per +batch, and a compiled object must not reuse the name of an existing row that +the cleared binding did not own, since an upsert would merge into it. A later command that +edits an owned object by numeric ID is caught by the next evaluation of the +batch, including the intermediate evaluations that `assembly.drive`, +`component.*`, `motion.graph.set`, `motion.bake` and `drag_chain.set` run. +Violations reject `PROGRAM_PROVENANCE` and leave the document unchanged. The +`prepare` candidate (`[program.clear?, compiled commands, program.bind]`) and +the exact `validate` output followed by its bind satisfy this contract. + ```json {"tool":"parametric_program","arguments":{"action":"prepare","mode":"configure","namespace":"shelf","values":{"shelves":4},"expected_revision":12}} {"tool":"doc_apply","arguments":{"candidate_id":"","expected_revision":12}} @@ -149,12 +234,49 @@ A stale candidate rejects. The `program.*` operations are also ordinary `agent_onboard{topic:"commands",query:"program"}` also offers the `program_configure` recipe, which prepares the same call without executing it. +Its `values` take numbers, `true`/`false` and choice text of 1..64 bytes, as +the tool does; the program's declarations still decide which value is valid. + +## Program files (`.arkprog`) + +A `.arkprog` file exchanges program source between projects. It is canonical +JSON (sorted keys, no whitespace) of at most 256 KiB: + +```json +{"format":"ark.parametric-program-file.v1","program":{...},"program_sha256":"<64 hex>"} +``` + +`export{namespace, path, expected_revision}` writes the installed program and +its SHA-256 to `path`, which must be absolute and end in `.arkprog`. The bytes +go to a staged file in the destination directory and are published by one +rename. An existing file is never replaced unless `overwrite:true` is passed, +and the check is part of the rename, so a file created concurrently is not +replaced either. The result reports `program_sha256`, the file's own +`file_sha256`, `bytes` and `replaced`; the document and its revision do not +change. + +`validate` and `prepare` accept `program_path` instead of `program`. The file +must be a regular `.arkprog` file of at most 256 KiB with the expected format, +only the three fields above and a `program_sha256` matching its program; +otherwise it rejects `PROGRAM_FILE`, `PROGRAM_CAPACITY`, `PROGRAM_FORMAT`, +`PROGRAM_SYNTAX` or `PROGRAM_HASH`. The source is then validated, compiled +and evaluated exactly like an inline program, and the reviewed candidate +binds the same digest. The file carries no values; pass `values` as usual. +Bound values, owned objects and baselines stay in the project. + +Only the `parametric_program` tool reads or writes these files, and only at +the explicit path. Program code still never reads files, runs scripts or +external programs, or uses the network. ## Ownership, local edits and dependants `program.bind` re-compiles the reviewed source from its digest, checks that every owned object exists exactly once, and stores a fingerprint of each owned -row as the binding baseline. The baseline is resealed after the evaluated batch. +row as the binding baseline. Before each evaluation in the batch, the rows must +still match the baseline (`PROGRAM_PROVENANCE` otherwise); each evaluation then +reseals it, and the batch keeps checking its bindings until `doc_apply` +publishes it. `local_edits:false` therefore means the owned rows are the +evaluated compiled output. Edits in later batches are ordinary local edits. A re-run or removal: @@ -163,29 +285,132 @@ A re-run or removal: - rejects `PROGRAM_DEPENDANTS` when unrelated source still names or numbers an owned object: feature inputs, assembly occurrences, scoped sketches, datum supports, materials, drawings or Skeleton source text. Remove or retarget the - dependency, or detach. + dependency, or detach. The Skeleton check is a conservative text search: an + owned name anywhere in the Skeleton source, including comments and JSON + escaped quoted names such as `"q / Post \u0022A\u0022"`, blocks the run. - rejects `PROGRAM_STALE_PROGRAM` when the installed source changed after the candidate was prepared. There is no silent rebase, tolerance widening or discarded geometry. A failed emitted feature rejects the whole candidate with the evaluator's error. +`context_graph` indexes each binding as node `program:` of kind +`program`, with the program name and facts `namespace`, `program_sha256` and +resolved `values`, and `owns` links to the owned features, sketches, datums +and materials that currently exist under a unique name. Configuring or +updating the program changes the node's fingerprint; detaching it removes the +node. The graph is navigation only: `parametric_program{action:"inspect"}` +remains the authority for `local_edits`. Studio's Parametric graph shows the +same nodes; `owns` is ownership metadata, so selecting an owned object does +not highlight its binding as an impacted dependant. + +Programs cannot emit assembly occurrences or mates. Mates have no name, only +document-assigned numeric IDs, while program ownership, baselines and +reference rewriting are name-based, and the dependants check follows names +and feature IDs, not the occurrence IDs that mates, cable endpoints, exploded +views, motion and configurations use. Place generated parts in an assembly +with ordinary `assembly.add`/`mate.add` commands; such references make a +re-run reject `PROGRAM_DEPENDANTS` until they are removed, or the program is +detached. + +## Studio + +Installed programs are configured in the [Parametric HUD](PARAMETRIC_HUD_048B.md) +(**HUD** in the Model or Manage ribbon). When the document has a binding, +the HUD shows a **Parameters / Programs** switch under its header. It opens on +**Programs** when no document parameter is exposed. The +[Design variants](DESIGN_VARIANTS_067G.md) window (**Manage > Variants** or +**All tools > Parametric configurator**) remains the place for named +configurations, comparison and exploration; the HUD's **Variants** button opens +it on the same namespace. + +- **Bindings.** After each revision the view reads + `parametric_program{action:"inspect"}`: namespace and name, owned objects and + `local_edits` (shown in amber). **<** and **>** step through the installed + programs. Studio runs this inspect on a private session that holds only the + bindings and their owned objects. Each owned row is serialized from its own + object, so the rows and `local_edits` are the same as the live inspect. The + rest of the drawing, such as imported meshes, is not serialized on the UI + thread. If that session cannot answer, the live session does. +- **Values.** Each declared parameter has a row with its value and `unit`, the + range, **-**/**+** and a value box for typed entry. Typed entry accepts a + number or an expression of document parameters, evaluated once. Integer + parameters step by 1 and are rounded. Other bounded parameters step by a power + of ten near a twentieth of the range. The HUD clamps to `min`/`max` and names + the limit; agents are rejected instead. Units are labels only. A value that is + not a number is shown read-only. +- **Apply.** Changes are staged in amber with `was `. **Apply (n)** sends + `prepare{mode:"configure",namespace,values,expected_revision}`, then + `doc_apply{candidate_id,expected_revision}` with + `actor:{kind:"human",id:"studio"}`. Both calls run on Studio's CAD worker + path, so the viewport keeps painting. The result line shows the new revision + and the measured prepare and publish times. +- **Stale values.** Values belong to the revision of the rows they were staged + from. A value typed while another writer changed the model (for example from + the Design variants window) is not staged: the rows are read again and the + HUD asks for the value again. Values staged at an older revision are not + published. The first **Apply** reports the revision change, and whether the + program source changed. A second **Apply** prepares them on the current + model; **Reset** discards them. +- **Rejections.** A rejection keeps the document, the revision and the staged + values. The HUD shows the code and message: `PROGRAM_LOCAL_EDITS`, + `PROGRAM_DEPENDANTS`, `PROGRAM_STALE_PROGRAM`, `PROGRAM_ASSERT` with the + author's message, `PROGRAM_VALUES`, or the evaluator error of a failed + candidate. A staged value outside a range that updated source narrowed is + marked `outside range`. +- **Detach and Remove.** Both first show a confirmation with the binding, its + owned objects and its local edits. **Cancel** changes nothing. If the model + changes while the confirmation is open, nothing is sent. Otherwise the HUD + prepares `detach` or `remove` and publishes it with `doc_apply` as one + revision. Undo restores the binding. + +Studio does not edit program source. New source is installed or updated through +the tool, an agent, or **New family** in Design variants. + ## Persistence Bindings are stored in the `.ark` source as `parametric_programs`: namespace, name, the full program, its SHA-256, resolved values, owned names and baselines. They require conditional semantic document version **55**. Documents without a binding keep their earlier required version; removing the last binding returns -the document to its earlier version. A tampered digest, incomplete values or +the document to its earlier version. A binding whose program declares a +boolean or `choices` parameter, or a saved design variant with a text value, +requires version **60**; documents without them keep their earlier required +version, and applications before version 60 reject such a document as a +future format instead of ignoring the new fields. A document relabelled below +60 rejects on load. Stored values must already be canonical (`1`/`0` for a +boolean, a listed choice otherwise). A tampered digest, incomplete values or overlapping ownership reject on load without replacing the open document. +Loading and saving check each stored program's structure and expression +syntax, including the nesting limit, but not name resolution, so a document +saved before the name checks still opens and saves. Configuring such a program +or evaluating its variants rejects with the unresolved name; update it with +corrected source, remove it or detach it. + +Bindings are validated in full (source, digest, values and ownership) where +they enter a document: on load, including undo, redo and iteration restores, on +`program.bind`, and again when the document is saved. Clear and detach only remove +bindings and sealing only replaces baseline digests. In-memory snapshots and +the `doc_apply` working copy reuse the validated bindings instead of +re-validating and re-hashing every program on each serialization. Scoped design-container checkouts and component exports do not carry bindings; the owning project keeps them. The physical container version does not change. ## Team role `AgentTeamDiscipline::ParametricDesigner` ("Parametric designer") writes only -batches that carry a `program.*` operation, plus the four creation operations a -program compiles to. Its instructions load the `programs` topic, validate, +batches that carry a `program.*` or `variant.*` operation. `feature.add`, +`sketch.set`, `plane.set` and `material.set` are upserts, so the role may send +them only as compiled output of a `program.bind` in the same step: each name +must lie in a namespace that step binds, and `doc_apply` provenance then +requires the exact compiled commands. A `program.clear`, `program.detach` or +variant operation authorizes no other edit; for example, a detach cannot carry +a material density of another role. Steps of only `program.clear` or +`program.detach` stay allowed. `variant.set` and `variant.remove` stay allowed: +they store or remove named parameter maps of a program namespace and never +edit source objects; `variant.set` requires the installed program digest. The +team configuration does not assign namespaces to roles, so the role is not +restricted to one namespace. Its instructions load the `programs` topic, validate, prepare in the assigned namespace, publish its own candidate with `team_apply_step`, inspect native geometry and report namespace, values, owned names and assertions to the orchestrator. A lead in the same team is told to @@ -207,27 +432,91 @@ Connector, Settings and Reasoning, and it starts with the `overview` and | Limit | Value | | --- | --- | | Source size | 256 KiB | -| Statements | 8192; blocks nest to 32 | +| Statements | 8192; blocks nest to 32 in a body | | Evaluation steps | 50000 per run | | Loop count | 1024 per loop or `$for` | -| Nested calls | 16 | +| Nested calls | 16; blocks of all active calls nest to 64 | | Emitted commands | 126 per run, at most 2 MiB | | Parameters, functions | 64 each; 16 arguments per function | +| Choices | 64 per parameter; choice text 1..64 bytes | +| `.arkprog` file | 256 KiB | | Bindings | 64 per document | -| Expression text | 2048 bytes | +| Expression text | 2048 bytes; nesting to 64 levels | ## Evidence and limits The local `parametric-programs` CTest covers the language (precedence, logic, -accumulators, templates, `$for` splices and typed rejections), namespacing and +accumulators, templates, `$for` splices and typed rejections), the expression +nesting limit on unary, power, parenthesis and call chains (also in a stored +binding on load), the deepest block/call/expression nesting the limits allow, +the block budget shared by active calls (also for tool arguments at the JSON +nesting limit), non-finite rejection in assertions, conditions, logic, loop +counts and functions, lazy `?:`/`&&`/`||` guards, static name and `set` checks in untaken +branches and functions, namespacing and reference rewriting, install/configure/update/remove/detach candidates, stale candidates, local edits and dependants, undo/redo, save/reopen at version 55, -downgrade and digest rejection, tool discovery and onboarding examples. A -generated shelf is checked against an independent exact volume. The local +downgrade and digest rejection, tool discovery and onboarding examples. It also +covers provenance: exact hand-written compiled batches bind cleanly; altered, +missing or reordered compiled commands, namespace edits before or after the +bind (by name and by numeric ID, also after or between intermediate +`assembly.drive` evaluations), merges into existing rows, a non-adjacent +clear and a double bind reject `PROGRAM_PROVENANCE`; ambiguous sketch/feature +references and JSON-escaped Skeleton mentions are rejected. The `agent-team` +CTest covers the role scope: an exact compiled step, its own prepared configure +candidate, variant-only and detach-only steps commit, while a variant or detach +carrying an outside upsert and tampered namespaced output reject. It also +covers boolean, numeric-choice and text-choice declarations, values and +`{@name}` checks; a typed binding installed, configured, saved and reopened at +version 60 (byte-identical re-save), rejected at 59 and 61, and a return to 55 +after its removal; and `.arkprog` export, no-clobber and explicit overwrite, +path/format/digest/size rejections and installing from `program_path` with the +same digest, using temporary files. The `design_variants` CTest explores and +saves boolean/text values on exact boxes, and `context-graph-034d` checks the +binding node, ownership links, fingerprint changes and index invalidation. A +generated shelf is checked against an independent exact volume. The knob's +native volume matches an independent numerical integral of its authored +profile within a relative 1e-6, and a parameter change re-runs it. The local `studio-parametric-role-ui` check publishes a two-post program from an offline Focused team through Studio's tool queue and measures both solids natively. +The optional `ark-program-binding-cost-benchmark` target (not built by default) +binds eight generated programs of about 112 KB each and times an unrelated +`param.set` through `doc_apply` with and without the iteration journal, a +detached control, serialization, the `doc_apply` clone and save/load. Compare +executables alternately on the same machine; timings are local evidence only. + +Studio `--self-test-program-hud-ui` (CTest `studio-program-hud-ui`, OCCT +builds, 1280x800 plus a 1100x700 pass) installs the built-in bookshelf through +the tool path and opens the HUD on Programs. It covers: + +- the inspect listing, rows for every declared parameter, and staging that + leaves the document unchanged; +- **+** on `shelves` and **Apply**: one revision, `shelves` 6 in the binding, + six shelf solids, a human `doc_apply` in the journal, busy frames painted + during the worker calls, and the sixth shelf's native volume; +- typed values rounded to an integer and clamped to `max`; +- a value typed while a configure from another writer commits during the edit: + not staged, rows re-read at the new revision; +- `PROGRAM_ASSERT`, stale staging after an agent commit, `PROGRAM_VALUES` after + an agent update narrowed `max`, `PROGRAM_LOCAL_EDITS` and + `PROGRAM_DEPENDANTS`, each with the document and revision unchanged + (`PROGRAM_STALE_PROGRAM` uses the same display path but is not produced by + this test); +- Detach cancelled and confirmed, Remove withheld after a commit during its + confirmation, Remove and Undo, the Variants link, and viewport bounds; +- the HUD's binding rows byte-identical to the live inspect after install, + after a local edit, and with four imported meshes in the drawing. + +Captures are written next to `--shot` (`.program-hud-open.png`, `-staged`, +`-applied`, `-rejected`, `-typed-race`, `-values`, `-local-edits`, +`-detach-dialog`, `-detached`, `-dependants`, `-remove-dialog` and `-narrow`). +In one local run with the four meshes (1.57 MB of authored source), the HUD's +inspect took 2.6 ms and the live inspect 135 ms. This is a single +measurement, not a benchmark. + Assertions and bounds encode the design rules stated by the author. They are not manufacturing, structural or fit qualification. No measured agent quality, -time or token benefit is claimed. The `.arkprog` file exchange, Studio editing -controls and context-graph nodes for bindings are not implemented. +time or token benefit is claimed. Editing program source in Studio is not +implemented. Studio's Design variants window stages numeric values only and the +Parametric HUD shows text values read-only, so text choices are configured +through the tools. Program assembly output is not implemented (see above). diff --git a/docs/RENDER_MATERIALS.md b/docs/RENDER_MATERIALS.md index ae43785..2739bbb 100644 --- a/docs/RENDER_MATERIALS.md +++ b/docs/RENDER_MATERIALS.md @@ -59,7 +59,8 @@ and `assembly_info` accept `gravity_m_s2` (default 9.80665) and return `mass_g`, This is a viewport improvement, not a ray-traced renderer or a claim of Fusion rendering parity. Screen-space occlusion cannot see off-screen geometry, and sorted transparency does not model refraction or arbitrary intersecting glass. -The MCP `snapshot` tool is a flat-lit software preview: since 044B it draws +The MCP `snapshot` tool is a simply lit software preview (display-mesh vertex +normals; see [032D](SNAPSHOTS_032D.md)): since 044B it draws triplanar textures, pattern colors and surface stamps, but not PBR response or bump relief; use Studio captures to review materials. Exact STEP geometry is independent of appearance. Material density does not establish structural strength or simulate dynamics. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index f27c910..0657d5f 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -1,5 +1,14 @@ # ARK roadmap A–G +076A (**A.02/A.03/B.02/D.02/F.05 — Verificado no escopo local**): parametric programs +reject deep or non-finite expressions and unbound names, bind only their exact +compiled output, gain typed parameters, `.arkprog` exchange and a Studio HUD view. +The assistant feedback gate covers only the current run and ends without a false +interruption. Chat dock widths hold at 96-192 dpi in self-tests, Review blockers +shows with collapsed cards, curved edges and agent snapshots are smoother, and ARK +Setup tolerates signing, locks uninstall and refuses unsafe folders. No live +provider or trusted signing certificate was exercised; the new ARK Setup CI job passed on a hosted runner. See [076A evidence and limits](iterations/076A.md). + Source follow-up (**A.03/D.02 — Em curso**): shared guidance for developing concepts to the requested result and preserving design intent after rejected operations. Historical quality regression and matched live comparisons remain @@ -455,8 +464,8 @@ Goal: work for days without lost work, ambiguous identity or unverifiable regres | ID | Milestone | Status | Acceptance still governing the work | |---|---|---|---| | A.01 | Iteration identity and release records | Verificado no escopo | Validate `release.json`; expose one consistent identity in application, MCP, onboarding and packages. Preserve global sequence and runtime/document separation. [001A evidence](iterations/001A.md) [019B source identity](iterations/019B.md). [022B identity and compatibility](iterations/022B.md). | -| A.02 | Recovery and work protection | Parcial | Crash during save/modeling/update, disk-full and truncation tests preserve the last intact revision; recoverable autosave cannot replace the original silently. [029B local recovery and injected persistence failures](TRUST_FOUNDATION.md) retain explicit recovery choices; real power-loss qualification remains open. [045A save capacity and journal visibility](iterations/045A.md) keep an over-capacity saved-geometry cache from failing the save. [049A derived bakes](DERIVED_BAKES_049A.md) keep baked motion frames out of authoring and the journal, with an explicit backed-up journal migration. [051A archived compaction](HISTORY_COMPACTION_051A.md) preserves a verified complete archive, bounded undo and explicitly retained branch states. [072A growing edits](GROWABLE_EDITING_072A.md) prepares complete history retention and atomic capacity-schema upgrades with resource-guarded loading; verification is pending. | -| A.03 | Regression corpus and release chain | Parcial | Authorized reproducible positives/negatives with seeds/hashes; native, UI, persistence and OTA suites; receipts for distributed artifacts; actual hosted CI execution. [019B hosted native/portable checks and relocated Linux package](iterations/019B.md) establish that scope, with broader release qualification still open. [022B native, persistence, consumer and viewport regression](iterations/022B.md) adds local evidence; hosted CI and user acceptance remain separate gates. [051A native evidence](NATIVE_GEOMETRY_051A.md) verifies the frozen OCCT patches with a supported LLVM-MinGW build route and unchanged regression oracles. [072A persistence/resource fixtures](GROWABLE_EDITING_072A.md) add large-source, legacy-format, expansion and atomic migration cases; execution evidence is pending. | +| A.02 | Recovery and work protection | Parcial | Crash during save/modeling/update, disk-full and truncation tests preserve the last intact revision; recoverable autosave cannot replace the original silently. [029B local recovery and injected persistence failures](TRUST_FOUNDATION.md) retain explicit recovery choices; real power-loss qualification remains open. [045A save capacity and journal visibility](iterations/045A.md) keep an over-capacity saved-geometry cache from failing the save. [049A derived bakes](DERIVED_BAKES_049A.md) keep baked motion frames out of authoring and the journal, with an explicit backed-up journal migration. [051A archived compaction](HISTORY_COMPACTION_051A.md) preserves a verified complete archive, bounded undo and explicitly retained branch states. [072A growing edits](GROWABLE_EDITING_072A.md) prepares complete history retention and atomic capacity-schema upgrades with resource-guarded loading; verification is pending. [076A](iterations/076A.md) rejects deep program expressions on load and tool input instead of crashing, and keeps program bindings atomic with exact provenance. | +| A.03 | Regression corpus and release chain | Parcial | Authorized reproducible positives/negatives with seeds/hashes; native, UI, persistence and OTA suites; receipts for distributed artifacts; actual hosted CI execution. [019B hosted native/portable checks and relocated Linux package](iterations/019B.md) establish that scope, with broader release qualification still open. [022B native, persistence, consumer and viewport regression](iterations/022B.md) adds local evidence; hosted CI and user acceptance remain separate gates. [051A native evidence](NATIVE_GEOMETRY_051A.md) verifies the frozen OCCT patches with a supported LLVM-MinGW build route and unchanged regression oracles. [072A persistence/resource fixtures](GROWABLE_EDITING_072A.md) add large-source, legacy-format, expansion and atomic migration cases; execution evidence is pending. [076A](iterations/076A.md) adds red/green regressions for programs, feedback gating, dock DPI and installer recovery, refuses dirty-tree packages and adds an ARK Setup CI job that passed on a hosted `windows-2022` runner. | | A.04 | Observable performance | Parcial | Measure cold/warm open, incremental save, p95 interaction and recompute at three project sizes against the same machine/baseline. [012D scope](iterations/012D.md) [022B source audit and equivalent synthetic measurements](PERFORMANCE_AUDIT_022B.md) distinguish native evaluation, pending gesture handlers, prepared commit and display work; three-size project p95 qualification remains open. 029B adds native viewport reuse and a matched native three-size control benchmark; see [029B performance](PERFORMANCE_029B.md). [043A opening/rebuild](iterations/043A.md) measures one large freeform document before and after. [046B background exact reads](ASYNC_EXACT_046B.md) keep the Studio viewport live during allow-listed exact reads on one synthetic fixture; write preparation was outside that scope. [051A background authoring](ASYNC_AUTHORING_051A.md) extends live navigation to ordinary geometry-changing doc_apply through private preparation, cancellation and revision/epoch-bound publication; other write paths and broad p95 qualification remain separate. [072A candidate retention](GROWABLE_EDITING_072A.md) replaces a fixed per-edit rejection with an observable adaptive soft cache target; no general speedup is claimed. | | A.05 | Security, licensing and dependencies | Parcial | Apache-2.0 source license and dependency notices are adopted; source/publication inventory, software SBOM, binary provenance, signing and vulnerability handling need evidence. Never package credentials or user designs. [019B portable image decoder provenance and notices](iterations/019B.md). | @@ -467,7 +476,7 @@ Goal: create and revise a complete product with clear, reliable interactions. | ID | Milestone | Status | Acceptance still governing the work | |---|---|---|---| | B.01 | Readable navigation and editing | Parcial | Stable cube/axes, free orbit, selection/Spotlight, shortcuts and DPI; no clipped controls at supported resolutions. Measurement and display units have [013B evidence](iterations/013B.md); BOM layout has [015B evidence](iterations/015B.md). [017B scoped evidence](iterations/017B.md). [018B editable authoring and coordination](iterations/018B.md). [019B native/mesh pointer selection, hover and visual authoring](iterations/019B.md). [020B exact extrusion gestures and source dimensions](iterations/020B.md). [021B direct handle and snapshot feedback](iterations/021B.md). [022B existing-solid resize, asynchronous previews, exact vertex tools and integrated sheets](iterations/022B.md). 029B adds accessible native fields, visible focus and dynamic DPI/work-area reflow; [sketch/accessibility evidence](SKETCH_ASSISTANCE_029B.md). [048B](iterations/048B.md) adds the Studio parametric HUD overlay with staged Rebuild/Auto. [053B native graph](PARAMETRIC_COMPONENTS_053B.md) connects authored relationships, geometry selection and local navigation. [065F](iterations/065F.md) unifies the Studio palette, ribbon grouping and one outline-icon family, with a floating sidebar on every tab. [072A storage visibility](GROWABLE_EDITING_072A.md) replaces discontinued quota percentages with actual retained counts/bytes and explicit resource errors; UI verification is pending. | -| B.02 | Everyday sketches and feature history | Parcial | Actionable constraint diagnostics, valid reorder, suppress/rollback and visible dependencies; rejection leaves the document intact. Arcs/snaps/expressions have scoped 005B/008D evidence. [017B scoped evidence](iterations/017B.md). [018B editable authoring and coordination](iterations/018B.md). [019B visual and parametric authoring](iterations/019B.md). [020B exact extrusion gestures and source dimensions](iterations/020B.md). [021B associative extrusion source](iterations/021B.md). [022B source-preserving edits, opaque validated preview handoff and version-37 journal checks](iterations/022B.md). 029B adds equilibrated QR solving and source/revision-bound reviewed conflict alternatives; [sketch assistance](SKETCH_ASSISTANCE_029B.md). [046B profile regions](PROFILE_REGIONS_046B.md) make multi-loop sketches with holes one extrude/revolve profile, with typed loop rejections and an optional region selection. [048B parametric HUD](PARAMETRIC_HUD_048B.md) exposes ranged named parameters and a sampled flex check. [051A scoped sketches](SCOPED_SKETCHES_051A.md) add definition ownership, explicit references and guarded per-scope capacity. [Parametric programs](PARAMETRIC_PROGRAMS.md) compile code-defined families into namespaced native features, with atomic re-runs that reject local edits and outside dependants (local CTest only). [072A growing history](GROWABLE_EDITING_072A.md) removes fixed history/node/replay ceilings without pruning or changing authoring semantics; local persistence and UI validation passed. | +| B.02 | Everyday sketches and feature history | Parcial | Actionable constraint diagnostics, valid reorder, suppress/rollback and visible dependencies; rejection leaves the document intact. Arcs/snaps/expressions have scoped 005B/008D evidence. [017B scoped evidence](iterations/017B.md). [018B editable authoring and coordination](iterations/018B.md). [019B visual and parametric authoring](iterations/019B.md). [020B exact extrusion gestures and source dimensions](iterations/020B.md). [021B associative extrusion source](iterations/021B.md). [022B source-preserving edits, opaque validated preview handoff and version-37 journal checks](iterations/022B.md). 029B adds equilibrated QR solving and source/revision-bound reviewed conflict alternatives; [sketch assistance](SKETCH_ASSISTANCE_029B.md). [046B profile regions](PROFILE_REGIONS_046B.md) make multi-loop sketches with holes one extrude/revolve profile, with typed loop rejections and an optional region selection. [048B parametric HUD](PARAMETRIC_HUD_048B.md) exposes ranged named parameters and a sampled flex check. [051A scoped sketches](SCOPED_SKETCHES_051A.md) add definition ownership, explicit references and guarded per-scope capacity. [Parametric programs](PARAMETRIC_PROGRAMS.md) compile code-defined families into namespaced native features, with atomic re-runs that reject local edits and outside dependants (local CTest only). [072A growing history](GROWABLE_EDITING_072A.md) removes fixed history/node/replay ceilings without pruning or changing authoring semantics; local persistence and UI validation passed. [076A](iterations/076A.md) hardens program expressions and provenance, adds boolean/choice/text parameters (conditional format 60), `.arkprog` exchange and Studio HUD program controls; programs still emit no assembly. | | B.03 | Advanced solids and surfaces | Parcial | Difficult loft/sweep/guide/patch/trim/thicken corpus, measured continuity and explicit repair; no mesh fallback concealing exact failures. [017B scoped evidence](iterations/017B.md). [018B editable authoring and coordination](iterations/018B.md). [019B visual and parametric authoring](iterations/019B.md). [020B exact sketch extrusion](iterations/020B.md). [021B bounded face/extrusion geometry](iterations/021B.md). [022B exact polyhedral vertex pull](NATIVE_VERTEX_PULL_022B.md) adds a bounded faceted-solid domain with input/output validity and selfinterference checks. 029B adds bounded exact orientation repair and a difficult geometry corpus; [repair evidence](SURFACE_REPAIR_029B.md). [046B hollow sweep sections](PROFILE_REGIONS_046B.md) sweep inner loops with one shared placement and a volume-conservation check. [051A native regression evidence](NATIVE_GEOMETRY_051A.md) covers shallow C0 offset classification and translated analytic C2 lofts with unchanged tolerances. | | B.04 | Large, configurable assemblies | Parcial | Subassemblies, reused instances, configurations, external references and selective loading; editing one definition updates all occurrences. Supported mechanisms are locally scoped. [022B source-linked component patterns](SPECIALIZED_PATTERNS_022B.md) cover inheritance, planar/spatial points, exact curve stations, chain alternation, skips and actual occurrence consumers; large configuration/loading qualification remains open. 029B adds semantic loading, measured derived-buffer/external-I/O reduction and scoped v2 configuration/pin ownership; [assembly evidence](ASSEMBLY_SCALING_029B.md). [048B exploded views](EXPLODED_VISUALIZE_048B.md) are display-only, revision-neutral and drivable by baked motions. [051A definition-owned sketches](SCOPED_SKETCHES_051A.md) are shared across occurrences and remapped with component checkout/merge. [053B reusable recipes](PARAMETRIC_COMPONENTS_053B.md) embed parts/assemblies with public overrides and explicit pinned revision updates. | | B.05 | Technical drawings and exchange | Parcial | Local 022B binds part definitions, exact occurrences and root/group assemblies to source-linked views, isometric projections, planar sections/hatches, semantic dimensions and declared tolerances in the same CAD viewport. Agents author drawings only on explicit user request. 029B adds bounded exact DXF export with local readback and source metadata. Broader drafting standards, GD&T qualification, independent recipient interoperability and physical qualification remain open. [067G](DRAWING_LIBRARY_067G.md) adds local multipage vector PDF presentation and caller-declared named geometric tolerance frames. [Drawing contract](DRAWINGS.md) [022B viewport evidence](DRAWING_VIEWPORT_022B.md) [029B evidence](VERIFICATION_029B.md). [048B Visualize](EXPLODED_VISUALIZE_048B.md) renders exploded assembly images with balloons and a BOM table on explicit request. | @@ -502,7 +511,7 @@ remain **Parcial**; primitive success does not establish general design quality. | ID | Milestone | Status | Acceptance still governing the work | |---|---|---|---| | D.01 | Quality/time/cost benchmark | Parcial | At least 30 versioned briefs, three repeats per initial configuration and blind human evaluation; cost per accepted design includes failures and coordination. Harness exists; 008D pilots were 0/9 and 4/9, 009B closed at 1/9. These results prove no savings. [051A outcome receipts](AGENT_OUTCOMES_051A.md) separate completion, postconditions and verified persistence, and account for failed attempts with explicit tariff provenance; live-model comparisons remain unmeasured. | -| D.02 | Responsible engineer and adaptive team | Parcial | Compare Single/Focused/Parallel; give specialists concrete useful assignments and choose concurrency by measured benefit. No default turn/token budgets. Context, completion, feedback and retained DFM proposal handoffs have scoped evidence; general quality/cost benefit remains unproven. [019B scope](iterations/019B.md) [021B proposal scope](iterations/021B.md). [022B contract/onboarding and independent performance audit](iterations/022B.md) preserve Focused defaults and explicit-request-only drawing work. [045A](iterations/045A.md) records live MCP bridge commits and failures for client feedback. [047D](iterations/047D.md) removes a CLI stdio deadlock and supersedes rejected reads of removed features. [048B](iterations/048B.md) gives agents the HUD protocol and the explicit-request explode/render rule. [051A task outcomes](AGENT_OUTCOMES_051A.md) add parametric edits, assembly changes and recovery after atomic rejection to the existing Single/Focused/Parallel harness. [065F](iterations/065F.md) shows provider-readable reasoning per reply and per Parallel role in the right assistant dock. A `ParametricDesigner` discipline and the `programs` onboarding topic let a team delegate rule-driven families as [parametric programs](PARAMETRIC_PROGRAMS.md); Studio offers it as an optional role from **Agents** in Focused and Parallel within the eight-role limit, and its default roles are unchanged. Evidence is scripted and offline: `studio-parametric-role-ui` takes a Focused team through Studio's tool queue to one published program, exact native volumes and a reported goal. No real provider run or quality, time or token benefit is claimed. [072A large edits](GROWABLE_EDITING_072A.md) preserves reviewed candidate/revision custody while allowing retained work to grow; no new turn/token budget or automatic replay is introduced. | +| D.02 | Responsible engineer and adaptive team | Parcial | Compare Single/Focused/Parallel; give specialists concrete useful assignments and choose concurrency by measured benefit. No default turn/token budgets. Context, completion, feedback and retained DFM proposal handoffs have scoped evidence; general quality/cost benefit remains unproven. [019B scope](iterations/019B.md) [021B proposal scope](iterations/021B.md). [022B contract/onboarding and independent performance audit](iterations/022B.md) preserve Focused defaults and explicit-request-only drawing work. [045A](iterations/045A.md) records live MCP bridge commits and failures for client feedback. [047D](iterations/047D.md) removes a CLI stdio deadlock and supersedes rejected reads of removed features. [048B](iterations/048B.md) gives agents the HUD protocol and the explicit-request explode/render rule. [051A task outcomes](AGENT_OUTCOMES_051A.md) add parametric edits, assembly changes and recovery after atomic rejection to the existing Single/Focused/Parallel harness. [065F](iterations/065F.md) shows provider-readable reasoning per reply and per Parallel role in the right assistant dock. A `ParametricDesigner` discipline and the `programs` onboarding topic let a team delegate rule-driven families as [parametric programs](PARAMETRIC_PROGRAMS.md); Studio offers it as an optional role from **Agents** in Focused and Parallel within the eight-role limit, and its default roles are unchanged. Evidence is scripted and offline: `studio-parametric-role-ui` takes a Focused team through Studio's tool queue to one published program, exact native volumes and a reported goal. No real provider run or quality, time or token benefit is claimed. [072A large edits](GROWABLE_EDITING_072A.md) preserves reviewed candidate/revision custody while allowing retained work to grow; no new turn/token budget or automatic replay is introduced. [076A](iterations/076A.md) scopes required tool feedback to the current run, ends a run without a false interruption, keeps team completion blocked on unrated teammate actions and attributes team reasoning per event; offline scripted evidence only. | | D.03 | Isolated part workspaces | Parcial | [023B design containers](DESIGN_CONTAINERS_023B.md) provide assembly-group checkout, explicit editable/read-only closure and atomic merge bound to parent source/revision and reviewed child digest. Conflicting ownership, unsupported cross-boundary references and stale source reject without silent rebase. Large-project scaling and general distributed collaboration remain unqualified. | | D.04 | Multimodal feedback and correction | Parcial | Shared author/reviewer diagnostics, revision-bound previews and intent-preserving correction remain the acceptance scope. 021B adds Z-up/custom snapshot cameras and guarded Studio viewport readback. [032D authored body/face colors and steady emission](SNAPSHOTS_032D.md) and [pattern-copy sampled native clearance](ASSEMBLY_MOTION_032D.md) have local checked scope; textures/stamps, continuous collision and general correction quality remain separate. [020B scope](iterations/020B.md) [021B scope](iterations/021B.md). [022B drawing curve origins, alternate-copy identities and guarded direct previews](iterations/022B.md). [046B Baked Motions clearance markers](MOTION_CLEARANCE_046B.md) show interference, below-threshold and uncertified intervals bound to the measured revision. [047D](iterations/047D.md) sends user images through the Claude Code route. [048B](iterations/048B.md) `visualize_render` returns rendered assembly images to agents. | | D.05 | Concept alternatives and reusable knowledge | Parcial | Compare alternatives against requirements, mass, process/cost and human preference using validated examples. A proposal must not be reported as a created part. | @@ -532,7 +541,7 @@ Goal: make ARK understandable, installable, updateable and supportable. | F.02 | Licensing and distribution guidance | Parcial | Apache-2.0 and attribution are published. Keep source, dependency and package terms discoverable; complete the distribution audit under A.05. [Public guidance](COMMERCIAL_STRATEGY.md) | | F.03 | Onboarding and initial library | Parcial | English README/handbook, branch/PR guidance, a [first-part walkthrough](FIRST_TRY.md), structured experience reports and [launch materials](launch/README.md) are available. Clean-machine setup and five guided workflows still need observed first-valid-part time and abandonment evidence. Fabricable templates need their own qualification. | | F.04 | Support and operational quality | Parcial | Contribution templates and security guidance support reporting; opt-in redacted crash reports, diagnostic export, migrations, hardware matrix and support policy need operational evidence. | -| F.05 | Public distribution and user pilot | Parcial | Public Apache-2.0 repository and Windows/Linux-headless prerelease packages are published. Download links, feedback forms and launch materials are available. A real-user cohort, clean-install qualification and measured adoption outcomes remain separate gates. [065F ARK Setup](iterations/065F.md) installs through the update layout and replaces Inno; clean-machine and signing qualification remain open. | +| F.05 | Public distribution and user pilot | Parcial | Public Apache-2.0 repository and Windows/Linux-headless prerelease packages are published. Download links, feedback forms and launch materials are available. A real-user cohort, clean-install qualification and measured adoption outcomes remain separate gates. [065F ARK Setup](iterations/065F.md) installs through the update layout and replaces Inno; clean-machine and signing qualification remain open. [076A](iterations/076A.md) makes ARK Setup payload discovery tolerate Authenticode signing (self-signed test only), locks uninstall, repairs reinstall and refuses unsafe folders. | The public repository and prerelease were verified on 2026-10-12. The active main-branch ruleset requires PRs, resolved review threads and configured CI checks, diff --git a/docs/SKETCH_ENTITY_AUTHORING.md b/docs/SKETCH_ENTITY_AUTHORING.md index 5af8cc9..7566eed 100644 --- a/docs/SKETCH_ENTITY_AUTHORING.md +++ b/docs/SKETCH_ENTITY_AUTHORING.md @@ -153,7 +153,12 @@ error is not a mathematical global bound or manufacturing qualification. `equation2d` uses the same source evaluator to create an explicit native polyline with observed chord-deviation evidence at seven stations per interval. This source approximation is independent of viewport tessellation. Its inspection -authority is `authored_adaptive_polyline`. +authority is `authored_adaptive_polyline`. In a solid, every segment becomes +its own flat face and edges, so a native extrusion of a dense one exceeds the +512-name semantic topology registry and rejects atomically. The rejection names +the exact alternatives (`ellipse`, `conic`, `parabola`, `style_spline`, +splines, arcs). Fewer samples would only make a coarser faceted prism; the +limit is not raised. For supported exact cases, select a typed `analytic` source instead of generic `x`/`y`/`z` expression fields: diff --git a/docs/SNAPSHOTS_032D.md b/docs/SNAPSHOTS_032D.md index 8f419ce..49d0821 100644 --- a/docs/SNAPSHOTS_032D.md +++ b/docs/SNAPSHOTS_032D.md @@ -22,6 +22,18 @@ remains `display_mesh` evidence; snapshot pixels never certify exact geometry or manufacturing suitability. Existing unstyled rendering callers retain their neutral display API. +Lighting interpolates the display mesh's vertex normals, as Studio does for exact +bodies. Previously every triangle was lit with its own normal, so curved display +meshes showed facet bands that are not in the B-rep. A corner normal more than +30 degrees from its triangle keeps the triangle normal, planar triangles keep +their flat pixels and back-face culling stays geometric. Bodies that Studio +draws as hard surfaces stay faceted: legacy `extrude` and `sketch_cut`, whose +sampled curve walls are mesh facets, and `notched_tube`, a welded planar mesh +whose averaged normals would bend its flat faces. The receipt states this as +`shading:"smooth_vertex_normals_except_legacy_extrude_sketch_cut_notched_tube"`; +`appearance_scope` lists only textures, patterns and stamps and no longer +describes lighting. Shading is display only; it changes no geometry or authority. + Synthetic verification covers authored material inheritance and feature overrides, colored pixels, emission, transparency and material/triangle mismatch. Integrated/native face checks passed, and front/isometric captures were visually diff --git a/docs/UPDATES.md b/docs/UPDATES.md index 80a9833..6616b42 100644 --- a/docs/UPDATES.md +++ b/docs/UPDATES.md @@ -39,6 +39,11 @@ applies to application initialization; loading a large user document happens aft the acknowledgement and does not cause a rollback. An interrupted activation also restores the previous pointer on the next launch. Use **Previous version** for a manual rollback after a confirmed update. +In a folder installed by ARK Setup, activation, a failed activation and a rollback +also set the version shown in Installed apps (the entry named in `ark-setup.json`, +only when its `InstallLocation` is that folder) to the version the launcher selects. +This is best effort and never fails a launch; a launcher module retained from an +older ARK does this only after a newer local package refreshes it. New unsaved drawings start in **Documents\ARK**, outside immutable version folders. Settings remain in the existing `%LOCALAPPDATA%\ARK` location. Updates never copy diff --git a/docs/WINDOWS_INSTALLER.md b/docs/WINDOWS_INSTALLER.md index 6c1f036..26606e1 100644 --- a/docs/WINDOWS_INSTALLER.md +++ b/docs/WINDOWS_INSTALLER.md @@ -17,29 +17,78 @@ window, is driven by WPF's animation clock at 30 frames per second, and stays st when Windows animations are turned off. At rest the two layers reproduce the rendered frame; see [third-party notices](THIRD_PARTY_NOTICES.md) for its provenance. -The setup does not lay out ARK itself. It extracts the packaged runtime to a -temporary folder and runs that package's own `Install-ARK.ps1` (the same +The setup does not lay out ARK itself. It checks the package against the SHA-256 +stamped into it at build time (the check and the extraction read the setup +through one handle that it holds open without write sharing), extracts it to its +own temporary folder +(`%TEMP%\ark-setup-`, removed afterwards; folders left by a killed run are +removed by the next run) and runs that package's own `Install-ARK.ps1` (the same `Initialize-ArkInstall` used by the portable ZIP), which creates `versions`, `launcher`, `ARK.cmd`, `current.json` and `update.lock`. A newer setup therefore preserves the selected runtime and prepares the newer one for the next launch; the launcher keeps startup acknowledgement and rollback ([updates](UPDATES.md)). The setup only installs and uninstalls: ARK updates itself in the app. +Before writing anything Setup reads `current.json`. **Reinstall** (the folder +already has this version) verifies `versions\` against its receipt and, +when it is damaged, moves it aside and copies it again from the package, under +`update.lock`; the selection is kept. When the launcher selects this version but +its folder is missing, Reinstall copies it again. The damaged copy is deleted only +after the new copy has passed verification. If the repair fails or is stopped +part-way, Setup moves the damaged copy back when `versions\` is missing, +and otherwise leaves it as `stage-` (uninstall removes it). A folder whose +launcher selects or has +prepared a **newer** version is refused (exit code 8) unless `--allow-downgrade` +is given, which installs this version and selects it, keeping the version the +launcher would have started (the prepared one if any, else the current one) as +`previous` for ARK's own rollback. An activation that is still in progress is +refused (exit code 3) until ARK has been opened once. The disk check covers the +folder's drive and the `%TEMP%` drive, and both needs at once when they are the +same drive. It counts a full runtime copy on the folder's drive even when this +version is already there, because a repair keeps the damaged copy until the new +one is verified. + Setup adds `uninstall.exe`, `uninstall-notices.txt`, `ark-setup.json`, the shortcuts (PowerShell running `launcher\ark-launch.ps1`, working folder -Documents) and the per-user entry `MeshSphere.ARK` in Installed apps. When an -Inno Setup entry (`MeshSphere.ARK_is1`) owns the same folder, Setup removes it -and Inno's `unins000` files, so Windows lists one ARK. Uninstall removes the -runtime layout, those additions and leftovers of an interrupted update; the -folder goes only when it is then empty. Drawings, settings and everything else -under `%LOCALAPPDATA%\ARK` and Documents stay. Keep drawings outside the -immutable `versions` directory. - -Command line: `--silent [--dir X] [--no-desktop] [--no-startmenu]` installs -without UI; `uninstall.exe --uninstall [--quiet]` uninstalls. Exit codes: 0 ok, -1 failure, 2 arguments or folder refused, 3 ARK is running from that folder, -4 no package in the setup, 5 not an ARK folder, 6 another setup is running, -7 `Install-ARK.ps1` failed, 10 cancelled. The log is `%TEMP%\ARK-Setup.log`. +Documents) and the per-user entry `MeshSphere.ARK` in Installed apps. Its icon is +`uninstall.exe,0` and its version is the one `current.json` selects; the launcher +keeps that version current after in-app activations and rollbacks. The entry is +written before an Inno Setup entry (`MeshSphere.ARK_is1`) that owns the same +folder is removed with Inno's `unins000` files, so Windows lists one ARK and a +failed write never leaves none. A folder typed in the folder box or passed with +`--dir` is used as given (only the folder picker adds `ARK`), so Setup refuses a +non-empty folder unless it is an ARK install (`current.json` or `ark-setup.json`, +or the folder the Inno Setup entry names). Uninstall first takes `update.lock` +exclusively, as `Enter-ArkUpdateLock` does, and fails at once while a launch or an +update holds it or an ARK program runs from the folder; it then removes the +runtime layout, those additions and leftovers of an interrupted update; the folder +goes only when it is then empty. Drawings, settings and everything else under +`%LOCALAPPDATA%\ARK` and Documents stay. Keep drawings outside the immutable +`versions` directory. + +Command line: `--silent [--dir X] [--no-desktop] [--no-startmenu] +[--allow-downgrade]` installs without UI; `uninstall.exe --uninstall [--quiet]` +uninstalls. `--name=value` and `/name` forms are accepted. Scripts written for the +old Inno Setup installer keep working: `/SILENT` and `/VERYSILENT` install without +UI (run on `uninstall.exe` they uninstall quietly), `/DIR=X`, `/NOICONS` (no Start +menu shortcut), `/LANG=english|portuguese`, `/LOG` and `/LOG=FILE` (a copy of the +log), `/SUPPRESSMSGBOXES`, `/CURRENTUSER`, and `/NORESTART`, `/SP-`, `/NOCANCEL` +and the `/...APPLICATIONS` switches, which need nothing (Setup never restarts +Windows and refuses rather than closes a running ARK). `/ALLUSERS` is refused: ARK +installs per user. With any silent or message-box switch Setup never shows a +dialog; errors go to the log and the exit code. `--dir` needs a full path without +quotes or wildcards; `"C:\Apps\"` (a backslash right before the closing quote +makes Windows join the following arguments into the folder) is refused with that +explanation. Exit codes: 0 ok, 1 failure, 2 arguments or folder refused, 3 ARK is +running from that folder or holds `update.lock`, 4 no package in the setup or the +package failed its checksum, 5 not an ARK folder, 6 another setup is running, +7 `Install-ARK.ps1` failed, 8 a newer version is installed, 9 not enough disk +space, 10 cancelled. The log is `%TEMP%\ARK-Setup.log`. + +The installer respects the Windows animation setting (page transitions, the done +badge, the window fade and the sphere), names its icon buttons, folder box and +progress for screen readers, closes with Esc when nothing is running, and scales +to the work area of the monitor it opens on. ## Build and verify @@ -50,12 +99,71 @@ powershell -NoProfile -File scripts/build-installer.ps1 ` -PackagePath out/releases/ark-windows-x64-.zip ``` -`dotnet publish` produces a self-contained single-file `ARK-Setup.exe`; the -script appends the unchanged ZIP and a 24-byte footer (`ARKPAYLD`, offset, -length) and writes `ARK--windows-x64-setup.exe`. The package is validated -with `Expand-ArkPackage` first. Source and payload identity must agree, and the -code and version shown come from `release.json` (or the runtime identity with -`-UseRuntimeIdentity`). Existing installer filenames are never overwritten. +`dotnet publish` produces a self-contained single-file `ARK-Setup.exe` with the +package's SHA-256 stamped into its assembly metadata (`-p:ArkPayloadSha256`); the +script appends the unchanged ZIP and a 40-byte footer and writes +`ARK--windows-x64-setup.exe`. The footer is `ARKPAYL2`, payload offset and +length (int64), then the stub's PE CheckSum, certificate table offset and size +(uint32) and a zero uint32, little endian (`installer/ArkSetup/Core/Payload.cs`, +`scripts/Ark.SetupPayload.psm1`). The package is validated with +`Expand-ArkPackage` first and read back from the finished setup the way Setup +reads it. Source and payload identity must agree, and the code and version shown +come from `release.json` (or the runtime identity with `-UseRuntimeIdentity`). +Existing installer filenames are never overwritten. A public setup is a +distributable artifact: the script refuses it when the source tree has +uncommitted changes or the package's release evidence records a dirty tree; +`-AllowDirtyTree` builds one anyway for a local test that is not distributed. + +### Signing + +Authenticode appends a certificate table to the end of the file and points the PE +security directory at it, so Setup looks for the footer right before that table +(after up to 7 zero bytes of alignment) when the directory is set, and refuses +data after it. Sign in this order, which `-SignScript