@yunhozz/arc 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/MANIFEST.sha256 CHANGED
@@ -2,7 +2,7 @@
2
2
  d41edeb8c6631dee30c67c705d4edad977aa1631627ec9de59c013f8990f4018 bin/arc-upgrade.mjs
3
3
  484d9b2002ce542c87589bb719d644d3762706aad28a6ee010024875f8cc00e2 bin/arc.mjs
4
4
  3a4addbe83e8d0c397f16b886b4cf7ba1557707d3dae5dd4db590da58309bd24 claude/agents/arc-implementer.md
5
- 7a9c6979fd6bd88a59eba6cc7418a2dc1c13116f10c244ff3e58e4fb693d9f8e claude/agents/arc-planner.md
5
+ c3e29c5aa92bd3aae558c135c2da195a107b54819674cf2730def7942b22941d claude/agents/arc-planner.md
6
6
  09ed15ff0ace8a9b2868056ef410ab14695c3a7bb09b289b432191de68fd4be1 claude/agents/arc-qa.md
7
7
  d22d12435e4c80e86b849afc2717f55e5a7936cf1168a7479cc7b3eeea0ac37e claude/agents/arc-reviewer.md
8
8
  06eeed719a96622e6f1a470488d03a9ee0ff4eacd53729d8967e39e8599d5a37 claude/agents/arc-scouter.md
@@ -11,12 +11,12 @@ eb4d822246dc78540a79076676919355867bd08114cfdeeca5dd09d1121c515d claude/skill/r
11
11
  2c9ca71f94886f9ca9f4aef055f7cafb3e1a9bdf3aeebf8f4cb547c69405d207 claude/skill/references/brainstorming.md
12
12
  36d51a4723d6f0a3ce5811a0ea3b3a8424f07533947e1355f5d8cb8cce40c55e claude/skill/references/builder-check-prompt.md
13
13
  0c93f6d361708c6ddae20ce2d1b96015713a19bbe4a66244d6e82d84170e84e5 claude/skill/references/commit.md
14
- b26ac7a9dd0d41d08fe16653f91788846657200c530b234d05c7c0ff2f931830 claude/skill/references/coordination.md
14
+ 82f6ffda8a639118a8741a50ed8dcec67744c8781db3610f9ad4f63d2029bb6e claude/skill/references/coordination.md
15
15
  be576fff08d6d8d371444abf0360a2c395cfda0251e4a32a66006933f91d1a1d claude/skill/references/git-recovery.md
16
16
  19ce1a111353eb4b179d91bd57a2d4f1e7aec184f1c3f122647d171c66b8fb58 claude/skill/references/handoff-prep.md
17
17
  5f015a797eabf0d8b1e753840b9d9abba039548b06a3f5d7e8bb63352c9f1443 claude/skill/references/handoff.md
18
18
  4b1891e369abbefc1dd8d7765902dab3771eb948433f8e97dc7e0a9bcd380009 claude/skill/references/limits.md
19
- 038132d4126ec5a73e1753d31c3a74585f23134ca0449b83a42ae86a953d5ce5 claude/skill/references/planning.md
19
+ b96feaf0bf63df0c3268e983adcb567384326ae5646c4259c04249ef3c66a2b8 claude/skill/references/planning.md
20
20
  6a8a4e58bd6a44b904e2e3c57de774481d909204597e1498de53f1b2fecc4c4e claude/skill/references/scripts/frame-template.html
21
21
  43c6d69954a46ec34a2a262bcc62a9a7e83e839c739f199cb72646d397c686e3 claude/skill/references/scripts/helper.js
22
22
  763abf96510e0b892a1141397b31aa82ef900cf87ed34dde94bc8782baf4a7ca claude/skill/references/scripts/server.cjs
@@ -52,7 +52,7 @@ de8559102ce6ac48030503937d73050f4330cd3a57d4ddd94b23072390858308 claude/skill/r
52
52
  824a0efac9bac119d14693c5e02d600ac85febfc70761a436da0f058b0083320 claude/skill/runtime/role-dispatch-policy.mjs
53
53
  bccdfde1699f4614e2cbd5ae1a9b7ddd319b3cfecaae0c2fb7a669b2690456fb claude/skill/runtime/role-dispatch-store.mjs
54
54
  9fdd561ee0c509e4e63ea4c78e4bfa666e37c87d08abb6659f0b250dc6f4d556 claude/skill/runtime/role-observe.mjs
55
- b588fa8fde64deb71fb9b95f2d32d0972bb2889b392cd920e079daff6f6b5a7f claude/skill/runtime/role-policy.json
55
+ 297f68a13a3707afb20c0a770cf4f948ca82a71f3cad331fdb610d2f195fea6d claude/skill/runtime/role-policy.json
56
56
  e50fa25532160a7110c0d9df3cb66ab5a02072febdcd8bff4d3744b1d5360c0f claude/skill/runtime/role-routing-config.mjs
57
57
  2e5d86004328633ec7a7a904bd65e3e8c68974927ef0726d07e853df56222784 claude/skill/runtime/role-routing.mjs
58
58
  0933fa59b8b091be76f789fa595a2e95b6a67276ccf5fac8c6221be82e4b42bb claude/skill/runtime/role-supervisor.mjs
@@ -64,7 +64,7 @@ b29a9f9a9a60836271545e3f75346d51d7d0bf1ac1eccbfa3a624717f78beebb claude/skill/r
64
64
  e4445f3582c55861907e11dfe97ea9e87c69bcc3ff773d3d583914c198f1d024 claude/skill/scripts/apply-models.py
65
65
  a39ef4aa4a3ffa7281f9d48ff751ef710ff27e6267f480b6c11f9fb809e5e1f5 claude/skill/scripts/model_config.py
66
66
  9071c770fa2e585ea059cf16c9295e9979c542b607c37c62a8a86b0f7b7eabbf codex/agents/arc-implementer.toml
67
- fc74039083934620776e102ebc44307eb038eb28812d732de235a9f7aa506136 codex/agents/arc-planner.toml
67
+ 581a387ae8874f98f1c2b7f007a0ea0604cbf208f6894a864239bca7fee3e865 codex/agents/arc-planner.toml
68
68
  677fd2c614db6eb0d93820e2c29a0df7b0866e3d5f1633d5503af16ef26265a3 codex/agents/arc-qa.toml
69
69
  4ce3fea86abb7767a6fdb0a6fe6eb85e7672ba45819858b00eb5925c7e0bbb3f codex/agents/arc-reviewer.toml
70
70
  046971c4710ba29e3b0340fb0c02b2b388563bc80c48635329ac3ae43471beb4 codex/agents/arc-scouter.toml
@@ -73,13 +73,13 @@ baa8806e5cf9ba01ecc56f026449837fbae07b631381657e287ac3834843fba2 codex/skill/SK
73
73
  2c9ca71f94886f9ca9f4aef055f7cafb3e1a9bdf3aeebf8f4cb547c69405d207 codex/skill/references/brainstorming.md
74
74
  36d51a4723d6f0a3ce5811a0ea3b3a8424f07533947e1355f5d8cb8cce40c55e codex/skill/references/builder-check-prompt.md
75
75
  76228f38c0b6c3762e511733fd19c663d2be013a3b7756208101b9fc56a5f7c7 codex/skill/references/commit.md
76
- 6513a520c86be13d144525f6ddff7bfe6ffbcb27da84ea0f85e6c82dae5f7695 codex/skill/references/coordination.md
76
+ 742eded11844d5af70709b73363cd63cbc455f1e3fe145b5cd24d31b83e51af6 codex/skill/references/coordination.md
77
77
  407e98fa69033a13c01368965c370bca03b717ad2b29c3eeac450237b58b4860 codex/skill/references/git-recovery.md
78
78
  35c7418448bf2c7ad874884cb574f373072a1c1bf69d7134bc8fed511bbe0eb0 codex/skill/references/handoff-prep.md
79
79
  68cf61b17c76f577b7d2d8a50383f48b34de3e13cb08eeeb7c7749a4a3f0e088 codex/skill/references/handoff-worktree.md
80
80
  06b7c21779802fde148e5037652b952d82f2d0cb61a913c25abb926fea5de4ff codex/skill/references/handoff.md
81
81
  8da6c938e58fc2f199a6a02f831fc080c4e9220ee4f64ef0be0da5d04e11f4e1 codex/skill/references/limits.md
82
- cc2c7ae658ae94b569051ef08079f27c2258079e19e8b05b0cff40489080e9f9 codex/skill/references/planning.md
82
+ c8e245c2ed5160e9d3d4e58a77bc9f1628805ee407f67ce26da213774083b0b6 codex/skill/references/planning.md
83
83
  6a8a4e58bd6a44b904e2e3c57de774481d909204597e1498de53f1b2fecc4c4e codex/skill/references/scripts/frame-template.html
84
84
  43c6d69954a46ec34a2a262bcc62a9a7e83e839c739f199cb72646d397c686e3 codex/skill/references/scripts/helper.js
85
85
  763abf96510e0b892a1141397b31aa82ef900cf87ed34dde94bc8782baf4a7ca codex/skill/references/scripts/server.cjs
@@ -115,7 +115,7 @@ de8559102ce6ac48030503937d73050f4330cd3a57d4ddd94b23072390858308 codex/skill/ru
115
115
  824a0efac9bac119d14693c5e02d600ac85febfc70761a436da0f058b0083320 codex/skill/runtime/role-dispatch-policy.mjs
116
116
  bccdfde1699f4614e2cbd5ae1a9b7ddd319b3cfecaae0c2fb7a669b2690456fb codex/skill/runtime/role-dispatch-store.mjs
117
117
  9fdd561ee0c509e4e63ea4c78e4bfa666e37c87d08abb6659f0b250dc6f4d556 codex/skill/runtime/role-observe.mjs
118
- b588fa8fde64deb71fb9b95f2d32d0972bb2889b392cd920e079daff6f6b5a7f codex/skill/runtime/role-policy.json
118
+ 297f68a13a3707afb20c0a770cf4f948ca82a71f3cad331fdb610d2f195fea6d codex/skill/runtime/role-policy.json
119
119
  e50fa25532160a7110c0d9df3cb66ab5a02072febdcd8bff4d3744b1d5360c0f codex/skill/runtime/role-routing-config.mjs
120
120
  2e5d86004328633ec7a7a904bd65e3e8c68974927ef0726d07e853df56222784 codex/skill/runtime/role-routing.mjs
121
121
  0933fa59b8b091be76f789fa595a2e95b6a67276ccf5fac8c6221be82e4b42bb codex/skill/runtime/role-supervisor.mjs
@@ -172,9 +172,9 @@ ee81dee01b1623d95dda9b1d195ce2008811dfb54af3da8324a9e538238ac84e lib/npm/proces
172
172
  7039f646fe67cf11e83a7389c5622d53a72736d06c7be563aefd0dd0106ceda4 lib/npm/upgrade.mjs
173
173
  79f5824a3b1b44ab0cd0e95243ed418c3fa15881927bb4d1789047b480747939 lib/policy/placement.mjs
174
174
  b4889e2aaeab49c31769304ff2cfc8cbbd378ad49720150a5c2cba31851b822f lib/policy/render.mjs
175
- b588fa8fde64deb71fb9b95f2d32d0972bb2889b392cd920e079daff6f6b5a7f lib/policy/role-policy.json
176
- 4d0ef7db08fad1bcdc357accc75c2c7bb11cc9963f6b749f08995cdc36036d7a lib/prompts/agent-fragments.json
177
- 1785a1de8d8c038fad2c5431a9a5b204701d3b616921eb843b66996f00596398 lib/prompts/render.mjs
175
+ 297f68a13a3707afb20c0a770cf4f948ca82a71f3cad331fdb610d2f195fea6d lib/policy/role-policy.json
176
+ 6070ba620ce18dc5d74ba0eb44b275edcbfb16d43809c46af21fde58d9bee097 lib/prompts/agent-fragments.json
177
+ c7f5f3144ae2e6218a9546fdcacbd59f987dcf86fd5b034fd32cd98acdffb602 lib/prompts/render.mjs
178
178
  6816acd10da3ab8db1276d7ae2712b99e0c97111f57ba2d547a2cc5c3f9e165b lib/release/artifact.mjs
179
179
  f9b4caf6a97d02f2bc4e2d72c2434a3c668db57961975a9cad57b1ed6a475db8 lib/runtime/acceptance.mjs
180
180
  99a2edbbb4993307f99adc4a606fd965398eb312f01bbd49a616d2f232a7213e lib/runtime/adapters/claude.mjs
@@ -209,11 +209,11 @@ b29a9f9a9a60836271545e3f75346d51d7d0bf1ac1eccbfa3a624717f78beebb lib/runtime/ta
209
209
  5b14c4ffdff116a005601b737e94484e9eebdea746ec0e296ca7a34be2b7ea4a lib/runtime/verification.mjs
210
210
  7e75d9bb51eac4bd1a6fccf45fb195c526bb3bc43cf0b04398b85ff7723f8689 lib/safe-fs/index.mjs
211
211
  4174dfcfcd4d69a5486b91108ec03279cfd50644109c7457aa87f9ac877fb1ac lib/safe-fs/native.mjs
212
- 87285e61035037dd45ba5bcab4555e1e203b3ef63dadc0c4f8ce4fa212d9c067 lib/tui/app.mjs
213
- 5d5cb000510079570cb8e7407604b588beb7acd397f6b801d27f81dd048cf070 lib/tui/custom-preset.mjs
214
- 6126430f0c07b7816a0058bb5d0cd04362195f59476794d77a5696c04eff4145 lib/tui/render.mjs
215
- 3ccb2b382afbf6a68c25bd073e932c0d9c68b3f8c184358933b5858da64184a4 lib/tui/setup.mjs
216
- 57f841f9cbbfb9c2ad3ffb5294f943602c88f6d6f939647adf1835fca44cb571 lib/tui/terminal.mjs
212
+ 5b6f7a0093cb75b494dafcf11dbd9690d60df6b1be3a29619daa6cef9144fa56 lib/tui/app.mjs
213
+ 5e9ff0259e4e810b935bd2b51ddd97812d35bce636078c15a38de9143b5c5ab4 lib/tui/custom-preset.mjs
214
+ 718e0052a9387b58d6ce04e05e7c152f045a5aefe678701efa8374a3bb258874 lib/tui/render.mjs
215
+ c35ab2affcc64d05b00011c7a00840faa481e594b7d95f53b322dfe6bd2e1110 lib/tui/setup.mjs
216
+ 133a0a0370aaa5d48213bd8f7e523803c750b99e9afc20f27a1e28150d2c3241 lib/tui/terminal.mjs
217
217
  4d6c292344fbc16f2961635d8264d6cb854f759a6a870c4345524e67138372d9 lib/watch/args.mjs
218
218
  52c7a20bbef0452635a3196e838dc4eb3c2d0420d448bbb679d3cb32d6642566 lib/watch/discover-claude.mjs
219
219
  05d087b85cd08a9207d8ae36abe00651a94c7a2f3af67140bdd3740acb914f2b lib/watch/discover-codex.mjs
@@ -225,13 +225,13 @@ fb2b985c2e33726a5fd98b835b365c7b67b438fdeb6e03d6cf4f000089ead0fe lib/watch/git.
225
225
  c34cffcf6ef380019a11b14bcfc95ce971e60b12811f0242738dbe8285a5195f lib/watch/normalize-claude.mjs
226
226
  e7a15f5de9d5c33a235e87d8065e543d28616a30e548419c51964b46d61b60b1 lib/watch/normalize-codex.mjs
227
227
  4037619af1c19c058179d8567d301ce1cdba4ac82c79f63436fb17de4fe7f45d lib/watch/policy.mjs
228
- 31facc690e2dd7fd27cb67699974616f19227b343720d5ae7aa8742bdfcfdd76 lib/watch/render.mjs
228
+ daf4b51582436e16162e5360f0103bd5014ca63191cbcd4675f1f4f5163e12a3 lib/watch/render.mjs
229
229
  69df107b5d685137fb1632e6b5946810016891660230ed45b3a927b95a7e9b42 lib/watch/scope.mjs
230
230
  23f4aaa18d1492de117d3d24fa755e3c5486d72e9d0f8c4834736095de53e078 lib/watch/tail.mjs
231
231
  ce287a9991d012d42dbfa4fdf79e4f7004973c6c9fe7294c99926d64e6ffbe5f lib/watch/watcher.mjs
232
232
  ff9c33c8b3c2bd466d54ffbe4c7139ccd87c79c7de34a6c4cde92e9f6e9b42d2 native/binding.c
233
233
  205bedc1dee1a9ffa58124c6e21256a1f0cbe24f06f7c8d7cb0b99524cfab9d0 native/binding.gyp
234
- ad3a0a0c6815bb8ede7ad12faeb153136a06d10bd8c59fb8735130f8ba6c0d00 package.json
234
+ ff9e9c639b85d2aea3ad02ebd0a271010ca149f2915082776fd9a8feae198f6e package.json
235
235
  208c65cfde244d39ce45c3cf1b0acb128f04d21199b6b3fb5466e62db5b64af9 prebuilds/darwin-arm64/arc_safe_fs.node
236
236
  572887ac794d10a8b921d8168ea2328e31f05b45987611ff02c83114dba901af prebuilds/darwin-x64/arc_safe_fs.node
237
237
  2bb9443021f9d873712b26321de733eddd6794c45f0bc79e2d5dc98669196635 prebuilds/index.json
@@ -29,6 +29,8 @@ Do not execute commands. Return visualization/execution needs beyond available t
29
29
 
30
30
  {{ARC_AGENT_FRAGMENT:planner.workflow-contract}}
31
31
 
32
+ {{ARC_AGENT_FRAGMENT:planner.exploration-density}}
33
+
32
34
  {{ARC_AGENT_FRAGMENT:planner.task-shape}}
33
35
 
34
36
  {{ARC_AGENT_FRAGMENT:planner.commit-boundary}}
@@ -89,7 +89,7 @@ The [task envelope](handoff.md#orchestrator-direct-path-for-small-tasks) fits th
89
89
 
90
90
  ## Planner dispatch efficiency
91
91
 
92
- Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Orchestrator can read a few already identified files; route material research and broad static exploration to Scouter. Reuse relevant Planner context across stages only while role, source and context remain valid. Follow-up briefs cite an accessible prior brief for unchanged fields.
92
+ Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Orchestrator can read a few already identified files; route material research and broad static exploration to Scouter. Planner briefs carry path/line-verified evidence and a Read/Grep exploration budget (default about 15 for Bounded and about 30 for Architectural when no task-specific number is set; state a number before depth is chosen or for Spike work); additional broad exploration goes to Scouter, not Planner. Never reuse a Planner across stages. Within the design/brainstorming stage one Planner handles the initial draft, its consolidated correction and any eligible further call; within a spec or plan stage, that stage's Planner is reused only for a budget-hold delta. After design approval, the spec stage and the plan stage each use a fresh Planner whose brief contains every required field plus saved document paths and approved versions; cite a prior brief only when it is an accessible file. A Planner return that stops at the budget with a Scouter request is an input hold, not a missing or failed draft: after Scouter evidence arrives, resend that stage's brief as a delta to the same stage Planner, which counts as new input. In the design stage, a resend after a return without a draft uses the consolidated-correction opportunity; later further calls still need new input. Orchestrator may set a handback size limit in the brief.
93
93
 
94
94
  <a id="models"></a>
95
95
  ## Models
@@ -37,8 +37,8 @@ Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded pl
37
37
 
38
38
  1. Preflight relevant policy/references/profiles/tests/parity/manifest/conflicts. Apply formal-target and coordination provenance/input/local-skill gates, including required paths, approved bounded read alternatives and return conditions. Missing inputs/conflicts hold drafting. Read recovery grants no preparation/check/write/approval authority.
39
39
  2. Maintain a compact ledger of original requirements/IDs, approved/open decisions, exclusions and scope deltas. Consolidate intervening user changes into one brief delta. Separate approvals, path/line-verified facts, assumptions and open decisions.
40
- 3. Reuse a relevant Planner instance across related stages when role, context and source remain valid. Send one complete stage-specific initial brief. Include verified source/HEAD/ownership, selected target intent and planned paths (or prepared target for later stages), and scope/exclusions/depth/dependencies/shared contracts/criteria/checks/evidence/holds. Include preceding approved versions and paths, current behavior and connected source/generated/runtime/installer/docs, policy conflicts/resolution direction and exact deliverable. Visual work includes approved sources/versions/criteria/open interpretations. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields; inaccessible conversations or hashes alone cannot replace required inputs. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose, approval scope and accessible context. When source, target or scope changed, reconfirm affected inputs.
41
- 4. Planner returns the complete proportional first draft and self-review. Orchestrator saves and reviews it against the fixed checklist: scope/evidence; targets/ownership/paths; policy/conflicts; task boundaries/dependencies/criteria; checks/evidence/holds; roles/approval/commit boundaries; completeness. For spec or plan, Orchestrator directly revises the same document, including substantive omissions, before requesting approval. New product decisions outside approved scope require user input first; Orchestrator then revises the document. Missing or failed first drafts stop the stage and do not transfer initial authorship.
40
+ 3. Never reuse a Planner instance across stages. Within the design/brainstorming stage, reuse one Planner instance for the initial draft, its consolidated correction and any eligible further call while role, context and source remain valid; within a spec or plan stage, reuse that stage's Planner only for a budget-hold delta. After design approval, the spec stage and the plan stage each use a fresh Planner; its initial brief contains every required field plus saved document paths and approved versions, and cites a prior brief only when that brief is an accessible file. Send one complete stage-specific initial brief. Include verified source/HEAD/ownership, selected target intent and planned paths (or prepared target for later stages), and scope/exclusions/depth/dependencies/shared contracts/criteria/checks/evidence/holds. Include preceding approved versions and paths, current behavior and connected source/generated/runtime/installer/docs, policy conflicts/resolution direction and exact deliverable. Visual work includes approved sources/versions/criteria/open interpretations. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields; inaccessible conversations or hashes alone cannot replace required inputs. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose, approval scope and accessible context. When source, target or scope changed, reconfirm affected inputs.
41
+ 4. Planner returns the complete proportional first draft and self-review. Bounded plan density follows the Planner profile's ARC adaptation (per task ID/title, goal/scope/files, predecessors, criteria and required checks; short self-review checklist), while Architectural plans keep full writing-plans.md density. Briefs carry the Read/Grep exploration budget and may set a handback size limit. A return that stops at the exploration budget with a Scouter request is an input hold, not a missing or failed first draft; resend the stage brief as a delta with the Scouter evidence to the same stage Planner. In the design stage, a resend after a return without a draft uses the consolidated-correction opportunity. Orchestrator saves and reviews it against the fixed checklist: scope/evidence; targets/ownership/paths; policy/conflicts; task boundaries/dependencies/criteria; checks/evidence/holds; roles/approval/commit boundaries; completeness. For spec or plan, Orchestrator directly revises the same document, including substantive omissions, before requesting approval. New product decisions outside approved scope require user input first; Orchestrator then revises the document. Missing or failed first drafts stop the stage and do not transfer initial authorship.
42
42
  5. For design and brainstorming, finish the checklist before one consolidated correction covering every substantive omission with criterion/defect/evidence/expected fix. Use deltas/`unchanged`; never split by omission. Further calls after correction need approved material scope/evidence changes or concrete unmet checklist items plus meaningful new input/criterion progress. State changed input/target criterion/expected artifact/progress. Existing-scope omissions need no renewed scope approval. Repeated unmet criteria without new input/evidence/progress hold the stage; report criterion/observation/exact unblock decision. Do not repeat resolved questions or count rewording/agent replacement as progress.
43
43
 
44
44
  For design and brainstorming, allow initial draft and one consolidated correction. Orchestrator handles reformatting, re-expression, save and patch errors without Planner calls. Separate substantive work uses normal gates. Design/spec/plan stages remain separately ordered; spec approval precedes dependent planning. Add no fixed call cap/profile count condition or incomplete-draft acceptance.
@@ -149,7 +149,7 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
149
149
  - [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
150
150
  - [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
151
151
  - [planning.plan-amend] Task progress records preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit, without amending the original planning-document commit, creating history mappings or making a separate docs/fixup commit for them; record classification, reason and actual time as applicable. Spec/plan content changes other than task progress records require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval and preparation before affected work. For these content changes Orchestrator MUST amend the original planning-document commit at a safe boundary; never create a separate docs or fixup commit. For these non-progress content amendments, preserve actual approval chronology, recoverable old/new content, hashes, versions and old→new SHA mappings; never authorize past work retroactively. For these amendments rewrite only unpublished, unshared local linear history with clear ownership and no merges. Unknown publication/ownership, unexpected state or replay conflicts stop rewriting; no force push or fallback document commit. Preserve implementation task boundaries and revalidate affected evidence. This obligation does not authorize amending implementation commits or rewriting history generally. Follow planning, handoff-prep, commit and verification for the full contract.
152
- - [planning.planner-brief] Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance across related stages when its role, context and source remain valid. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.
152
+ - [planning.planner-brief] Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.
153
153
  - [platform.claude] Existing per-role tool allowlists reduce available tools; Bash and role contracts are not a filesystem sandbox. ARC supplies no native observer hook or Bash Git guard; Git restrictions remain prompt-level role contracts.
154
154
  [ARC role policy: contract end]
155
155
 
@@ -374,7 +374,7 @@
374
374
  "preceding-approval"
375
375
  ],
376
376
  "authority": "orchestrator",
377
- "text": "Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance across related stages when its role, context and source remain valid. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
377
+ "text": "Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
378
378
  "controls": {
379
379
  "codex": "prompt",
380
380
  "claude": "prompt"
@@ -25,6 +25,8 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
25
25
 
26
26
  {{ARC_AGENT_FRAGMENT:planner.workflow-contract}}
27
27
 
28
+ {{ARC_AGENT_FRAGMENT:planner.exploration-density}}
29
+
28
30
  {{ARC_AGENT_FRAGMENT:planner.task-shape}}
29
31
 
30
32
  {{ARC_AGENT_FRAGMENT:planner.commit-boundary}}
@@ -87,7 +87,7 @@ The [task envelope](handoff.md#orchestrator-direct-path-for-small-tasks) fits th
87
87
 
88
88
  ## Planner dispatch efficiency
89
89
 
90
- Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Orchestrator can read a few already identified files; route material research and broad static exploration to Scouter. Reuse relevant Planner context across stages only while role, source and context remain valid. Follow-up briefs cite an accessible prior brief for unchanged fields.
90
+ Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Orchestrator can read a few already identified files; route material research and broad static exploration to Scouter. Planner briefs carry path/line-verified evidence and a Read/Grep exploration budget (default about 15 for Bounded and about 30 for Architectural when no task-specific number is set; state a number before depth is chosen or for Spike work); additional broad exploration goes to Scouter, not Planner. Never reuse a Planner across stages. Within the design/brainstorming stage one Planner handles the initial draft, its consolidated correction and any eligible further call; within a spec or plan stage, that stage's Planner is reused only for a budget-hold delta. After design approval, the spec stage and the plan stage each use a fresh Planner whose brief contains every required field plus saved document paths and approved versions; cite a prior brief only when it is an accessible file. A Planner return that stops at the budget with a Scouter request is an input hold, not a missing or failed draft: after Scouter evidence arrives, resend that stage's brief as a delta to the same stage Planner, which counts as new input. In the design stage, a resend after a return without a draft uses the consolidated-correction opportunity; later further calls still need new input. Orchestrator may set a handback size limit in the brief.
91
91
 
92
92
  <a id="models"></a>
93
93
  ## Models
@@ -39,8 +39,8 @@ Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded pl
39
39
 
40
40
  1. Preflight relevant policy/references/profiles/tests/parity/manifest/conflicts. Apply formal-target and coordination provenance/input/local-skill gates, including required paths, approved bounded read alternatives and return conditions. Missing inputs/conflicts hold drafting. Read recovery grants no preparation/check/write/approval authority.
41
41
  2. Maintain a compact ledger of original requirements/IDs, approved/open decisions, exclusions and scope deltas. Consolidate intervening user changes into one brief delta. Separate approvals, path/line-verified facts, assumptions and open decisions.
42
- 3. Reuse a relevant Planner instance across related stages when role, context and source remain valid. Send one complete stage-specific initial brief. Include verified source/HEAD/ownership, selected target intent and planned paths (or prepared target for later stages), and scope/exclusions/depth/dependencies/shared contracts/criteria/checks/evidence/holds. Include preceding approved versions and paths, current behavior and connected source/generated/runtime/installer/docs, policy conflicts/resolution direction and exact deliverable. Visual work includes approved sources/versions/criteria/open interpretations. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields; inaccessible conversations or hashes alone cannot replace required inputs. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose, approval scope and accessible context. When source, target or scope changed, reconfirm affected inputs.
43
- 4. Planner returns the complete proportional first draft and self-review. Orchestrator saves and reviews it against the fixed checklist: scope/evidence; targets/ownership/paths; policy/conflicts; task boundaries/dependencies/criteria; checks/evidence/holds; roles/approval/commit boundaries; completeness. For spec or plan, Orchestrator directly revises the same document, including substantive omissions, before requesting approval. New product decisions outside approved scope require user input first; Orchestrator then revises the document. Missing or failed first drafts stop the stage and do not transfer initial authorship.
42
+ 3. Never reuse a Planner instance across stages. Within the design/brainstorming stage, reuse one Planner instance for the initial draft, its consolidated correction and any eligible further call while role, context and source remain valid; within a spec or plan stage, reuse that stage's Planner only for a budget-hold delta. After design approval, the spec stage and the plan stage each use a fresh Planner; its initial brief contains every required field plus saved document paths and approved versions, and cites a prior brief only when that brief is an accessible file. Send one complete stage-specific initial brief. Include verified source/HEAD/ownership, selected target intent and planned paths (or prepared target for later stages), and scope/exclusions/depth/dependencies/shared contracts/criteria/checks/evidence/holds. Include preceding approved versions and paths, current behavior and connected source/generated/runtime/installer/docs, policy conflicts/resolution direction and exact deliverable. Visual work includes approved sources/versions/criteria/open interpretations. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields; inaccessible conversations or hashes alone cannot replace required inputs. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose, approval scope and accessible context. When source, target or scope changed, reconfirm affected inputs.
43
+ 4. Planner returns the complete proportional first draft and self-review. Bounded plan density follows the Planner profile's ARC adaptation (per task ID/title, goal/scope/files, predecessors, criteria and required checks; short self-review checklist), while Architectural plans keep full writing-plans.md density. Briefs carry the Read/Grep exploration budget and may set a handback size limit. A return that stops at the exploration budget with a Scouter request is an input hold, not a missing or failed first draft; resend the stage brief as a delta with the Scouter evidence to the same stage Planner. In the design stage, a resend after a return without a draft uses the consolidated-correction opportunity. Orchestrator saves and reviews it against the fixed checklist: scope/evidence; targets/ownership/paths; policy/conflicts; task boundaries/dependencies/criteria; checks/evidence/holds; roles/approval/commit boundaries; completeness. For spec or plan, Orchestrator directly revises the same document, including substantive omissions, before requesting approval. New product decisions outside approved scope require user input first; Orchestrator then revises the document. Missing or failed first drafts stop the stage and do not transfer initial authorship.
44
44
  5. For design and brainstorming, finish the checklist before one consolidated correction covering every substantive omission with criterion/defect/evidence/expected fix. Use deltas/`unchanged`; never split by omission. Further calls after correction need approved material scope/evidence changes or concrete unmet checklist items plus meaningful new input/criterion progress. State changed input/target criterion/expected artifact/progress. Existing-scope omissions need no renewed scope approval. Repeated unmet criteria without new input/evidence/progress hold the stage; report criterion/observation/exact unblock decision. Do not repeat resolved questions or count rewording/agent replacement as progress.
45
45
 
46
46
  For design and brainstorming, allow initial draft and one consolidated correction. Orchestrator handles reformatting, re-expression, save and patch errors without Planner calls. Separate substantive work uses normal gates. Design/spec/plan stages remain separately ordered; spec approval precedes dependent planning. Add no fixed call cap/profile count condition or incomplete-draft acceptance.
@@ -157,7 +157,7 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
157
157
  - [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
158
158
  - [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
159
159
  - [planning.plan-amend] Task progress records preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit, without amending the original planning-document commit, creating history mappings or making a separate docs/fixup commit for them; record classification, reason and actual time as applicable. Spec/plan content changes other than task progress records require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval and preparation before affected work. For these content changes Orchestrator MUST amend the original planning-document commit at a safe boundary; never create a separate docs or fixup commit. For these non-progress content amendments, preserve actual approval chronology, recoverable old/new content, hashes, versions and old→new SHA mappings; never authorize past work retroactively. For these amendments rewrite only unpublished, unshared local linear history with clear ownership and no merges. Unknown publication/ownership, unexpected state or replay conflicts stop rewriting; no force push or fallback document commit. Preserve implementation task boundaries and revalidate affected evidence. This obligation does not authorize amending implementation commits or rewriting history generally. Follow planning, handoff-prep, commit and verification for the full contract.
160
- - [planning.planner-brief] Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance across related stages when its role, context and source remain valid. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.
160
+ - [planning.planner-brief] Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.
161
161
  - [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. ARC supplies no native observer hook or role-specific Git guard. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Implementer and QA need shell for approved checks.
162
162
  [ARC role policy: contract end]
163
163
 
@@ -374,7 +374,7 @@
374
374
  "preceding-approval"
375
375
  ],
376
376
  "authority": "orchestrator",
377
- "text": "Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance across related stages when its role, context and source remain valid. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
377
+ "text": "Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
378
378
  "controls": {
379
379
  "codex": "prompt",
380
380
  "claude": "prompt"
@@ -374,7 +374,7 @@
374
374
  "preceding-approval"
375
375
  ],
376
376
  "authority": "orchestrator",
377
- "text": "Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance across related stages when its role, context and source remain valid. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
377
+ "text": "Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. Do not split omissions, repeat resolved items or count rewording/agent replacement as progress. Do not invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and never accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
378
378
  "controls": {
379
379
  "codex": "prompt",
380
380
  "claude": "prompt"
@@ -69,6 +69,10 @@
69
69
  "id": "planner.workflow-contract",
70
70
  "text": "- Draft only designs/specs/plans for Orchestrator. Do not implement, verify, review or save documents. Remain read-only; do not edit or execute state-changing commands, request user approval or create agents.\n- Use supplied brief/prior evidence. Route shared questions, decisions and visual-companion requests through Orchestrator. Wait at applicable gates for required answers/decisions. Orchestrator owns development approval and completion.\n- For assigned feature/design/behavior work, read brief-cited `references/brainstorming.md`. Return context, Spike/Bounded/Architectural path, designs/options, tradeoffs, criteria, assumptions and focused questions. Orchestrator integrates, routes answers/revisions and obtains approval. After architectural design approval, return a complete spec and self-review; Orchestrator saves/reviews and directly revises the same spec when needed, then obtains written-spec approval.\n- After written-spec approval, Architectural work always reads brief-cited `references/writing-plans.md`, regardless of size, locality or risk. Bounded work follows Orchestrator's separate depth assessment. Skip planning only for one local change, no dependent stages/cross-component shared state/lifecycle/integration-order concerns and one focused verification path.\n- When needed, return the complete proportional plan, dependencies, assumptions/open decisions, verification needs and self-review. Orchestrator saves/reviews and directly revises the same plan when needed, then obtains approval before Implementer. Bounded/no-plan labels waive nothing.\n- If a skill requires writing, approval or implementation, return the draft and next actions instead. Skills add no agents. Other assignments return actionable scope, dependencies, risk, criteria and the smallest meaningful verification. Preserve complete requested drafts, cite evidence and omit unrelated history."
71
71
  },
72
+ {
73
+ "id": "planner.exploration-density",
74
+ "text": "- Use brief evidence first. For broad additional facts, return a Scouter lookup request to Orchestrator instead of exploring yourself. Read only what is needed to pin edit locations; do not reread unchanged files already in context.\n- Follow the brief's Read/Grep budget; without one, use about 15 for Bounded and about 30 for Architectural. If more is needed, stop and return what is missing. Before depth is chosen or for Spike work, expect a number in the brief; if none is given, use about 15. Upstream brainstorming's \"Look Before You Ask\" reading is satisfied within brief evidence and this budget. The exploration budget is not a Planner call-count limit.\n- When the brief's depth is Bounded, include per task ID/title, goal/scope/files, predecessors, criteria and required checks/evidence. Exact signatures, per-step test code, Review Focus and the four-part self-review may be omitted in favor of a short self-review checklist. Architectural keeps full `writing-plans.md` density. This ARC adaptation takes precedence over `writing-plans.md` density for Bounded only; upstream text is unchanged. This density adaptation waives no approvals, required checks, QA or Reviewer obligations.\n- Orchestrator may set a handback size limit in the brief."
75
+ },
72
76
  {
73
77
  "id": "qa.contract-intro",
74
78
  "text": "This profile is the complete QA contract. "
@@ -128,6 +132,7 @@
128
132
  "claude.profile-guidance",
129
133
  "planner.target-evidence",
130
134
  "planner.workflow-contract",
135
+ "planner.exploration-density",
131
136
  "planner.task-shape",
132
137
  "planner.commit-boundary",
133
138
  "planner.visual-question",
@@ -202,6 +207,7 @@
202
207
  "common.resume-gates",
203
208
  "planner.target-evidence",
204
209
  "planner.workflow-contract",
210
+ "planner.exploration-density",
205
211
  "planner.task-shape",
206
212
  "planner.commit-boundary",
207
213
  "planner.visual-question",
@@ -20,6 +20,7 @@ const EXPECTED = {
20
20
  "claude.profile-guidance",
21
21
  "planner.target-evidence",
22
22
  "planner.workflow-contract",
23
+ "planner.exploration-density",
23
24
  "planner.task-shape",
24
25
  "planner.commit-boundary",
25
26
  "planner.visual-question",
@@ -79,6 +80,7 @@ const EXPECTED = {
79
80
  "common.resume-gates",
80
81
  "planner.target-evidence",
81
82
  "planner.workflow-contract",
83
+ "planner.exploration-density",
82
84
  "planner.task-shape",
83
85
  "planner.commit-boundary",
84
86
  "planner.visual-question",
package/lib/tui/app.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {readFileSync} from 'node:fs';
2
2
  import {createTerminalSession} from './terminal.mjs';
3
- import {escapeTerminalText,navigationHint,wrapDetailRows} from './render.mjs';
3
+ import {escapeTerminalText,navigationHint,statusSpans,wrapDetailRows,wordmarkRows} from './render.mjs';
4
4
  import {createManagementContext,prepareOperation,executeOperation,readCompositeConfig,currentInstallMode} from '../management/operations.mjs';
5
5
  import {collectStatus} from '../management/status.mjs';
6
6
  import {runSetup,loadRoleDefaults} from './setup.mjs';
@@ -11,18 +11,23 @@ function goHome(){throw Object.assign(Error('Return home'),{code:'ARC_TUI_HOME'}
11
11
  function interrupted(){return Object.assign(Error('Session interrupted'),{code:'ARC_CANCELLED'});}
12
12
  export function createTuiInterface(session,{input,controller}={}){
13
13
  async function event(){const e=await session.nextEvent();if(e.name==='interrupt')throw interrupted();if(e.name==='eof')throw Object.assign(Error('Session closed'),{code:'ARC_TUI_EOF'});if(e.name==='error')throw e.error;return e;}
14
- async function menu(title,rows,{selected=0,info=[],separatorBefore,backRow=false,backLabel='back',wordmark=false,version,renderBody,onHorizontal,refreshMs}={}){
14
+ async function menu(title,rows,{selected=0,info=[],infoTones,backRow=false,backLabel='back',wordmark=false,version,renderBody,onHorizontal,refreshMs}={}){
15
15
  const actions=backRow?[...rows,'Back']:rows;
16
16
  selected=actions.length?Math.max(0,Math.min(selected,actions.length-1)):0;
17
- let pending,timer,blink=true;
17
+ const animate=wordmark&&session.frameMs>0,tickMs=animate?session.frameMs:refreshMs;
18
+ let pending,settled,wake,timer,blink=true,frame=0,repainting=false;
18
19
  try{while(true){
19
- const viewport=session.viewport(),display=actions.flatMap((row,index)=>(index===separatorBefore||backRow&&index===rows.length)?['',row]:[row]),displayIndex=selected+(Number.isInteger(separatorBefore)&&selected>=separatorBefore?1:0)+(backRow&&selected===rows.length?1:0),information=wrapDetailRows(typeof info==='function'?info({selected,...viewport}):info,viewport.columns);
20
- if(wordmark&&information.length)information.push('');
21
- const capacity=Math.max(1,viewport.rows-(wordmark?6:1)-information.length-4),offset=Math.max(0,Math.min(displayIndex-capacity+1,display.length-capacity)),visible=display.slice(offset,offset+capacity);
22
- const screen={title,wordmark,version,rows:[...information,...visible],selected:actions.length?information.length+displayIndex-offset:undefined,hint:navigationHint('menu',{backLabel}),...(display.length>capacity?{position:(offset+1)+'-'+Math.min(offset+capacity,display.length)+'/'+display.length}:{})};
23
- const body=renderBody?.({selected,blink,...viewport});if(body){screen.rows=body.rows;screen.selected=body.selected;screen.showSelection=body.showSelection;screen.compactFooter=body.compactFooter;if(Object.hasOwn(body,'position'))screen.position=body.position;}
24
- const rendered=session.render(screen);pending??=event();
25
- let e;if(refreshMs>0){e=await Promise.race([pending,new Promise(resolve=>{timer=setTimeout(()=>resolve(null),refreshMs);})]);clearTimeout(timer);timer=undefined;if(e===null){blink=!blink;continue;}}else e=await pending;pending=undefined;
20
+ const viewport=session.viewport(),display=actions,displayIndex=selected,information=[],tones=[],spans=[];
21
+ const details=typeof info==='function'?info({selected,...viewport}):info;
22
+ for(const [index,row] of details.entries()){const wrapped=wrapDetailRows([row],viewport.columns),tone=infoTones?.[index],states=tone==='status'?statusSpans(row):[];let offset=0;for(const [line,text] of wrapped.entries()){const end=offset+[...text].length;information.push(text);tones.push(line&&tone==='diagnostic'?'diagnostic-cont':tone);spans.push(states.filter(span=>span.from<end&&span.to>offset).map(span=>({...span,from:Math.max(span.from,offset)-offset,to:Math.min(span.to,end)-offset})));offset=end;}}
23
+ while(information.at(-1)===''){information.pop();tones.pop();}if(information.length){information.push('');tones.push(undefined);}
24
+ const capacity=Math.max(1,viewport.rows-(wordmark?wordmarkRows(viewport):1)-information.length-4),offset=Math.max(0,Math.min(displayIndex-capacity+1,display.length-capacity)),visible=display.slice(offset,offset+capacity);
25
+ const screen={title,wordmark,version,frame,rows:[...information,...visible],selected:actions.length?information.length+displayIndex-offset:undefined,hint:navigationHint('menu',{backLabel}),...(display.length>capacity?{position:(offset+1)+'-'+Math.min(offset+capacity,display.length)+'/'+display.length}:{})};
26
+ if(infoTones){screen.rowTones=[...tones,...visible.map(()=>undefined)];screen.rowStatusSpans=spans;}
27
+ const body=renderBody?.({selected,blink,...viewport});if(body){delete screen.rowTones;delete screen.rowStatusSpans;screen.rows=body.rows;screen.selected=body.selected;screen.showSelection=body.showSelection;screen.compactFooter=body.compactFooter;if(Object.hasOwn(body,'position'))screen.position=body.position;}
28
+ const rendered=(repainting?(session.repaint??session.render):session.render).call(session,screen);pending??=event().then(e=>{settled={e};wake?.();},error=>{settled={error};wake?.();});
29
+ if(tickMs>0){if(!settled)await new Promise(resolve=>{wake=resolve;timer=setTimeout(resolve,tickMs);});clearTimeout(timer);timer=undefined;wake=undefined;if(!settled){if(animate)frame++;else blink=!blink;repainting=true;continue;}}else await pending;
30
+ if(Object.hasOwn(settled,'error'))throw settled.error;const e=settled.e;pending=undefined;settled=undefined;repainting=false;
26
31
  if(e.name==='up'&&actions.length)selected=(selected+actions.length-1)%actions.length;else if(e.name==='down'&&actions.length)selected=(selected+1)%actions.length;else if((e.name==='left'||e.name==='right')&&onHorizontal)onHorizontal({direction:e.name,selected,...viewport});else if(e.name==='escape'){if(backLabel==='exit')return null;goHome();}else if(e.name==='enter'&&actions.length&&rendered.selectionEnabled!==false)return backRow&&selected===rows.length?null:selected;
27
32
  }}finally{if(timer!==undefined)clearTimeout(timer);}
28
33
  }
@@ -35,7 +40,7 @@ export function createTuiInterface(session,{input,controller}={}){
35
40
  if(e.name==='down')offset=Math.min(last,offset+1);else if(e.name==='up')offset=Math.max(0,offset-1);else if(e.name==='escape')goHome();else if(e.name==='enter')return true;
36
41
  }
37
42
  }
38
- async function busy(action){session.render({title:'Working',mode:'busy',rows:[],hint:navigationHint('busy')});session.setBusy(true);const wasFlowing=input?.readableFlowing;const abort=()=>{if(!controller?.signal.aborted)controller?.abort();},onData=chunk=>{if(String(chunk).includes('\x03')||String(chunk).includes('\x04'))abort();};input?.on('data',onData);input?.prependListener('end',abort);input?.prependListener('close',abort);try{if(input?.readableEnded||input?.destroyed){abort();throw interrupted();}if(controller?.signal.aborted)throw interrupted();const result=await action();if(controller?.signal.aborted){if(typeof result?.code!=='number')throw interrupted();return{...result,code:130,interrupted:true};}return result;}catch(error){if(controller?.signal.aborted&&(['ARC_CANCELLED','ARC_NPM_CANCELLED','ARC_ACQUISITION_CANCELLED','ARC_INSTALL_CANCELLED','ABORT_ERR'].includes(error?.code)||error?.name==='AbortError'))throw interrupted();throw error;}finally{input?.removeListener('data',onData);input?.removeListener('end',abort);input?.removeListener('close',abort);if(wasFlowing!==true)input?.pause?.();session.setBusy(false);session.discardInput();}}
43
+ async function busy(action){let frame=0,timer;const screen={title:'Working',mode:'busy',rows:[],hint:navigationHint('busy'),frame};session.render(screen);session.setBusy(true);const wasFlowing=input?.readableFlowing;const abort=()=>{if(!controller?.signal.aborted)controller?.abort();},onData=chunk=>{if(String(chunk).includes('\x03')||String(chunk).includes('\x04'))abort();};input?.on('data',onData);input?.prependListener('end',abort);input?.prependListener('close',abort);try{if(input?.readableEnded||input?.destroyed){abort();throw interrupted();}if(controller?.signal.aborted)throw interrupted();if(session.frameMs>0)timer=setInterval(()=>{try{(session.repaint??session.render).call(session,{...screen,frame:++frame});}catch{clearInterval(timer);}},session.frameMs);const result=await (session.frameMs>0?Promise.resolve().then(action):action());if(controller?.signal.aborted){if(typeof result?.code!=='number')throw interrupted();return{...result,code:130,interrupted:true};}return result;}catch(error){if(controller?.signal.aborted&&(['ARC_CANCELLED','ARC_NPM_CANCELLED','ARC_ACQUISITION_CANCELLED','ARC_INSTALL_CANCELLED','ABORT_ERR'].includes(error?.code)||error?.name==='AbortError'))throw interrupted();throw error;}finally{clearInterval(timer);input?.removeListener('data',onData);input?.removeListener('end',abort);input?.removeListener('close',abort);if(wasFlowing!==true)input?.pause?.();session.setBusy(false);session.discardInput();}}
39
44
  return{menu,text,page,busy};
40
45
  }
41
46
  export function resultRows(result){
@@ -70,7 +75,7 @@ export async function runTui(options={}){
70
75
  while(true){const statuses=await api.collectStatus(context),ordered=[...statuses].sort((a,b)=>({claude:0,codex:1}[a.platform]??2)-({claude:0,codex:1}[b.platform]??2));
71
76
  const label=status=>({codex:'Codex',claude:'Claude'}[status.platform]??status.platform),state=status=>status.state!=='installed'?({absent:'Not Available',incomplete:'Incomplete'}[status.state]??status.state):status.authentication?.reason==='cli_not_found'?'Not Available':status.authentication?.authStatus==='unauthorized'?'Unauthorized':status.authentication?.authStatus==='unknown'?'Incomplete':'Available';
72
77
  const compositeAvailable=ordered.some(status=>status.platform==='claude'&&state(status)==='Available')&&ordered.some(status=>status.platform==='codex'&&state(status)==='Available')&&await loadInstallMode()==='composite';
73
- const info=ordered.length?[compositeAvailable?'Claude & Codex: Available':ordered.map(status=>label(status)+': '+state(status)).join(' / '),...ordered.flatMap(status=>[...(status.diagnostics??[]).map(error=>label(status)+': '+error.message),...(status.authentication?.authStatus==='unknown'&&status.authentication.reason?[label(status)+': '+status.authentication.reason]:[])])]:[];const choice=await ui.menu('ARC',home,{selected,info,backLabel:'exit',wordmark:true,version:packageVersion});if(choice===null||choice===4)return code;selected=choice;
78
+ const info=ordered.length?[compositeAvailable?'Claude & Codex: Available':ordered.map(status=>label(status)+': '+state(status)).join(' / '),...ordered.flatMap(status=>[...(status.diagnostics??[]).map(error=>label(status)+': '+error.message),...(status.authentication?.authStatus==='unknown'&&status.authentication.reason?[label(status)+': '+status.authentication.reason]:[])])]:[];const choice=await ui.menu('ARC',home,{selected,info,infoTones:info.map((_,index)=>index===0?'status':'diagnostic'),backLabel:'exit',wordmark:true,version:packageVersion});if(choice===null||choice===4)return code;selected=choice;
74
79
  try{
75
80
  let prepared;
76
81
  if(choice===0||choice===1){const kind=choice===0?'install':'preset';prepared=await runSetup({ui,statuses,draft,kind,loadRoleDefaults:target=>loadRoleDefaults({context,statuses,target}),loadInstallMode,loadCompositeConfig:()=>api.readCompositeConfig?api.readCompositeConfig(context):readCompositeConfig(context),loadCatalog:target=>api.loadCatalog?api.loadCatalog(target):loadStaticModelCatalog(target,{signal:controller.signal}),prepare:settings=>ui.busy(()=>api.prepareOperation(context,settings))});}
@@ -53,8 +53,8 @@ function compactMenu(state, items, details, page) {
53
53
  const offset = Math.max(0, Math.min(focus - capacity + 1, items.length - capacity));
54
54
  const visible = items.slice(offset, offset + capacity).map(row => compactRow(row, state.columns));
55
55
  return {
56
- rows: [...information, `←/→: Details ${detailPage + 1}/${detailPages}`, ...visible, '', 'Back'],
57
- selected: selected === items.length ? information.length + visible.length + 2 : information.length + selected - offset + 1,
56
+ rows: [...information, `←/→: Details ${detailPage + 1}/${detailPages}`, '', ...visible, 'Back'],
57
+ selected: selected === items.length ? information.length + visible.length + 2 : information.length + selected - offset + 2,
58
58
  position: items.length > capacity ? `${offset + 1}-${offset + visible.length}/${items.length}` : null,
59
59
  compactFooter, detailPage, detailPages,
60
60
  };
@@ -94,13 +94,12 @@ export async function selectCatalogPair({ ui, catalog, current, roleName }) {
94
94
  if (guarded) return modelPager.render(state, rows, compactDetails);
95
95
  const information = wrapDetailRows(info(state), state.columns), items = [...rows, 'Back'], display = [], starts = [], lengths = [];
96
96
  for (let index = 0; index < items.length; index++) {
97
- if (index === rows.length) display.push('');
98
97
  starts[index] = display.length;
99
98
  const block = wrapDetailRows([items[index]], state.columns);
100
99
  lengths[index] = block.length;
101
100
  display.push(...block);
102
101
  }
103
- const selected = Math.max(0, Math.min(state.selected, items.length - 1)), commonCapacity = Math.max(1, state.rows - information.length - 5), positionNeeded = rows.length + 2 > commonCapacity, reservedRows = positionNeeded ? 5 : 4, requiredRows = information.length + lengths[selected] + reservedRows;
102
+ const selected = Math.max(0, Math.min(state.selected, items.length - 1)), commonCapacity = Math.max(1, state.rows - information.length - 5), positionNeeded = rows.length + 1 > commonCapacity, reservedRows = positionNeeded ? 5 : 4, requiredRows = information.length + lengths[selected] + reservedRows;
104
103
  if (state.rows < requiredRows) return modelPager.render(state, rows, compactDetails);
105
104
  const capacity = Math.max(1, state.rows - information.length - reservedRows), maxOffset = Math.max(0, display.length - capacity);
106
105
  const offset = Math.max(0, Math.min(maxOffset, starts[selected] + lengths[selected] - capacity));
@@ -136,7 +135,7 @@ function editorBody(values, controls) {
136
135
  if (diagram.length === 1 || diagram.length + controls.length + 6 > rows) {
137
136
  if (columns < 40 || rows < 16) return viewportGuard({columns, rows});
138
137
  const summary = presetPreviewRows(values, {columns, rows, compact: true}).slice(0, ROLES.length).map(row => compactRow(row, columns));
139
- return {rows: [...summary, '', ...controls, 'Back'], selected: selected < ROLES.length ? selected : selected + 1, position: null};
138
+ return {rows: [...summary, ...controls, 'Back'], selected: selected, position: null};
140
139
  }
141
140
  return {rows: [...diagram, '', ...controls, 'Back'], selected: selected < 3 ? 1 : selected < ROLES.length ? 9 : diagram.length + 1 + selected - ROLES.length, showSelection: selected >= ROLES.length};
142
141
  };
@@ -149,7 +148,7 @@ export async function editPlatformRoles({ui, title, platform, initialRoles, cata
149
148
  while (true) {
150
149
  const values = ROLES.map((role, index) => ({role: names[index] + (!available.has(pairKey(roles[role].model, roles[role][field])) ? ' !' : ''), model: roles[role].model, effort: roles[role][field]}));
151
150
  const labels = values.map(value => `${value.role}: ${escapeTerminalText(value.model)} / ${escapeTerminalText(value.effort)}`), controls = [...(settingsRow ? ['Settings'] : []), 'Apply'];
152
- const selected = await ui.menu(title, [...labels, ...controls], {selected: selectedRole, backRow: true, separatorBefore: labels.length, refreshMs: 600, renderBody: editorBody(values, controls)});
151
+ const selected = await ui.menu(title, [...labels, ...controls], {selected: selectedRole, backRow: true, refreshMs: 600, renderBody: editorBody(values, controls)});
153
152
  if (selected === null) return null;
154
153
  selectedRole = selected;
155
154
  if (settingsRow && selected === ROLES.length) return {action: 'settings', roles};
@@ -172,7 +171,7 @@ export async function editCompositeRoles({ui, initialRoles, catalogs, settingsRo
172
171
  return {role: names[index] + (missing ? ' !' : ''), ...current};
173
172
  });
174
173
  const labels = values.map(value => `${value.role}: ${value.platform === 'codex' ? 'Codex' : 'Claude'} / ${escapeTerminalText(value.model)} / ${escapeTerminalText(value.effort)}`), controls = [...(settingsRow ? ['Settings'] : []), 'Apply'];
175
- const selected = await ui.menu('Claude & Codex', [...labels, ...controls], {selected: selectedRole, backRow: true, separatorBefore: labels.length, refreshMs: 600, renderBody: editorBody(values, controls)});
174
+ const selected = await ui.menu('Claude & Codex', [...labels, ...controls], {selected: selectedRole, backRow: true, refreshMs: 600, renderBody: editorBody(values, controls)});
176
175
  if (selected === null) return null;
177
176
  selectedRole = selected;
178
177
  if (settingsRow && selected === ROLES.length) return {action: 'settings', roles};
@@ -4,8 +4,8 @@ export function escapeTerminalText(value=''){
4
4
  const code=character.codePointAt(0);return code<=255?'\\x'+code.toString(16).padStart(2,'0'):'\\u{'+code.toString(16)+'}';
5
5
  });
6
6
  }
7
- function width(character){return /[\p{Mark}]/u.test(character)?0:/[\u2190-\u2193\u2500-\u257f\u2588]/u.test(character)?1:character.codePointAt(0)>=0x1100?2:1;}
8
- function fit(text,columns){let used=0,result='';for(const character of text){const size=width(character);if(used+size>columns)return{text:result,complete:false};result+=character;used+=size;}return{text:result,complete:true};}
7
+ export function cellWidth(character){return /[\p{Mark}]/u.test(character)?0:/[←-↓─-▟✦✧⠀-⣿]/u.test(character)?1:character.codePointAt(0)>=0x1100?2:1;}
8
+ function fit(text,columns){let used=0,result='';for(const character of text){const size=cellWidth(character);if(used+size>columns)return{text:result,complete:false};result+=character;used+=size;}return{text:result,complete:true};}
9
9
  export function navigationHint(mode='menu',{backLabel='back'}={}){
10
10
  if(mode==='text')return'↑/↓: Select · Type/Paste Input · Backspace Delete · Enter Continue · Esc Home';
11
11
  if(mode==='busy')return'Ctrl+C Interrupt';
@@ -14,30 +14,67 @@ export function navigationHint(mode='menu',{backLabel='back'}={}){
14
14
  }
15
15
  export function wrapDetailRows(rows,columns){
16
16
  const available=Math.max(2,Math.floor(Number(columns)||80)-3),result=[];
17
- for(const row of rows){const escaped=escapeTerminalText(row);let line='',used=0;for(const character of escaped){const size=width(character);if(used+size>available){result.push(line);line='';used=0;}line+=character;used+=size;}result.push(line);}
17
+ for(const row of rows){const escaped=escapeTerminalText(row);let line='',used=0;for(const character of escaped){const size=cellWidth(character);if(used+size>available){result.push(line);line='';used=0;}line+=character;used+=size;}result.push(line);}
18
18
  return result;
19
19
  }
20
- const wordmark=[' █████ ███████ ███████ ','██ ██ ██ ██ ██ ','█████████ ███████ ██ ','██ ██ ██ ██ ██ ','██ ██ ██ ██ ███████ '];
21
- const logoStart=Math.min(...wordmark.map(row=>row.indexOf('█'))),logoEnd=Math.max(...wordmark.map(row=>row.lastIndexOf('█')));
22
- const logoStops=[[183,228,199],[116,198,157],[64,145,108]];
23
- function logoColor(column){const position=(column-logoStart)/(logoEnd-logoStart)*2,segment=Math.min(1,Math.floor(position)),fraction=position-segment;return logoStops[segment].map((value,index)=>Math.round(value+(logoStops[segment+1][index]-value)*fraction));}
20
+ const wordmark=[' █████╗ ██████╗ ██████╗','██╔══██╗██╔══██╗██╔════╝','███████║██████╔╝██║ ','██╔══██║██╔══██╗██║ ','██║ ██║██║ ██║╚██████╗','╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝'];
21
+ const STATUS_TONES=Object.freeze({'Available':'ok','Not Available':'muted','Unauthorized':'error','Incomplete':'warn'});
22
+ export function statusSpans(row){
23
+ const spans=[];let start=0;for(const segment of escapeTerminalText(row).split(' / ')){const match=/^(.+?): (.+)$/.exec(segment);if(match)spans.push({from:start+[...match[1]].length+2,to:start+[...segment].length,role:Object.hasOwn(STATUS_TONES,match[2])?STATUS_TONES[match[2]]:'warn'});start+=[...segment].length+3;}return spans;
24
+ }
25
+ const TONE_FG={ok:[52,211,153],muted:[128,128,128],error:[248,113,113],warn:[251,191,36]};
26
+ const PANEL=38,STOPS=[[178,245,214],[110,231,183],[52,211,153],[16,185,129]];
27
+ const mix=(from,to,t)=>from.map((value,index)=>Math.round(value+(to[index]-value)*t));
28
+ export function gradientAt(t){const position=Math.max(0,Math.min(1,Number(t)||0))*3,segment=Math.min(2,Math.floor(position));return mix(STOPS[segment],STOPS[segment+1],position-segment);}
29
+ export function shimmerIntensity(column,row,frame){const f=frame%36;if(f>=18)return 0;const c=-4+f*33.5/17,p=column+0.5*row;return Math.max(0,1-Math.abs(p-c)/3)**2;}
30
+ export function wordmarkRows({columns=80,rows=24}={}){return columns-1>=24&&rows>=18?8:2;}
24
31
 
25
32
  export function renderScreen(screen={}, {columns=80,rows=24}={}){
26
33
  // Leave the last column unused to avoid terminal autowrap at the right edge.
27
34
  columns=Math.max(1,Math.floor(Number(columns)||80)-1);rows=Math.max(1,Math.floor(Number(rows)||24));
28
- const entries=screen.rows??[],hint=screen.hint??navigationHint('menu');
29
- const logo=[...wordmark];let divider='─'.repeat(Math.min(columns,34));if(screen.wordmark&&screen.version){const version='ver '+escapeTerminalText(screen.version),inline=logo[logo.length-1]+' '+version;if(fit(inline,columns).complete)logo[logo.length-1]=inline;else divider=version;}
30
- const heading=screen.wordmark?[...logo,divider]:[escapeTerminalText(screen.title)],position=screen.position?[escapeTerminalText(screen.position)]:[];
35
+ const entries=screen.rows??[],hint=screen.hint??navigationHint('menu'),full=wordmarkRows({columns:columns+1,rows})===8;
36
+ const version=screen.version?'ver '+escapeTerminalText(screen.version):'',tagline=' ✦ agent role coordination';
37
+ const fullTag=tagline+(version?' '+version:''),tag=version&&!fit(fullTag,columns).complete?' ✦ '+version:fullTag;
38
+ const frame=screen.frame??0,f=frame%36,sparkleFrame=f>=18?0:f,spinner='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'[frame%10];
39
+ const heading=screen.wordmark?[...(full?[...wordmark,tag]:['ARC ✦'+(version?' '+version:'')]),'─'.repeat(Math.min(columns,PANEL))]:[(screen.mode==='busy'?spinner+' ':'')+escapeTerminalText(screen.title)],position=screen.position?[escapeTerminalText(screen.position)]:[];
31
40
  const footer=screen.compactFooter?[]:screen.mode==='busy'||screen.hint==='Session ended'?[escapeTerminalText(hint)]:[...(screen.mode==='text'||screen.mode==='page'?[]:['']),'─'.repeat(columns),escapeTerminalText(hint)];
32
- const showSelection=screen.showSelection!==false;
33
- const lines=[...heading,...entries.map((row,index)=>(index===screen.selected&&showSelection?'> ':' ')+escapeTerminalText(row)),...position,...footer];
34
- const fitted=lines.map(line=>fit(line,columns));
35
- const bodySize=Math.max(0,rows-footer.length),visible=[...fitted.slice(0,Math.min(lines.length-footer.length,bodySize)),...(footer.length?fitted.slice(-Math.min(rows,footer.length)):[])].map(line=>line.text);
36
- const styles=[];
37
- if(screen.wordmark){for(let index=0;index<Math.min(wordmark.length,visible.length);index++){if(visible[index]===fitted[index].text)styles.push({line:index,color:'logo',cells:[...visible[index]].flatMap((character,column)=>character==='█'?[{column,rgb:logoColor(column)}]:[])});}if(visible.length>wordmark.length&&visible[wordmark.length]===fitted[wordmark.length].text)styles.push({line:wordmark.length,color:'green'});}
41
+ const showSelection=screen.showSelection!==false,lines=[...heading,...entries.map((row,index)=>(index===screen.selected&&showSelection?'> ':' ')+escapeTerminalText(row)),...position,...footer];
42
+ const fitted=lines.map(line=>fit(line,columns)),bodySize=Math.max(0,rows-footer.length),bodyEnd=Math.min(lines.length-footer.length,bodySize);
43
+ const indices=[...Array.from({length:bodyEnd},(_,index)=>index),...(footer.length?Array.from({length:Math.min(rows,footer.length)},(_,index)=>lines.length-Math.min(rows,footer.length)+index):[])],visible=indices.map(index=>fitted[index].text),styles=[];
38
44
  const selectedLine=heading.length+screen.selected;
39
- if(showSelection&&Number.isInteger(screen.selected)&&screen.selected>=0&&screen.selected<entries.length&&selectedLine<Math.min(bodySize,lines.length-footer.length)){const used=[...visible[selectedLine]].reduce((sum,character)=>sum+width(character),0);visible[selectedLine]+=' '.repeat(Math.max(0,Math.min(columns,34)-used));styles.push({line:selectedLine,color:'selected'});}
40
-
45
+ for(let line=0;line<visible.length;line++){
46
+ const source=indices[line],runs=[];
47
+ function add(from,to,role,fg,bg,bold){
48
+ to=Math.min(to,[...visible[line]].length);if(from>=to)return;
49
+ const run={from,to,role,...(fg?{fg}:{}),...(bg?{bg}:{}),...(bold?{bold}: {})},last=runs.at(-1);
50
+ if(last&&last.to===from&&last.role===role&&JSON.stringify(last.fg)===JSON.stringify(fg)&&JSON.stringify(last.bg)===JSON.stringify(bg)&&last.bold===run.bold)last.to=to;else runs.push(run);
51
+ }
52
+ const length=[...visible[line]].length;
53
+ if(screen.wordmark&&full&&source<6){for(const [col,character] of [...visible[line]].entries()){if(character===' ')continue;const color=gradientAt((col+0.75*source)/26.75);const intensity=shimmerIntensity(col,source,frame);add(col,col+1,character==='█'?'logo':'shadow',character==='█'?mix(color,[240,255,248],0.7*intensity):mix(color.map(value=>Math.round(value*0.55)),[150,230,200],0.5*intensity));}}
54
+ else if(screen.wordmark&&source===(full?6:0)){
55
+ if(!full)for(let col=0;col<3;col++)add(col,col+1,'logo',mix(gradientAt(col/2),[240,255,248],0.7*shimmerIntensity(col,0,frame)));
56
+ const text=lines[source],sparkle=[...text].indexOf('✦'),versionAt=text.indexOf('ver '),tagAt=text.indexOf('agent role coordination');
57
+ if(sparkle>=0)add(sparkle,sparkle+1,'sparkle',mix([110,231,183],[240,255,248],0.25*(1+Math.sin(2*Math.PI*sparkleFrame/36))));
58
+ if(tagAt>=0)add(tagAt,tagAt+'agent role coordination'.length,'tagline',[134,176,158]);
59
+ if(versionAt>=0)add(versionAt,length,'version',[52,211,153]);
60
+ }
61
+ else if(screen.wordmark&&source===heading.length-1){for(let i=0;i<length;i++){let color=gradientAt(i/(length-1||1));if(i>=0.75*length)color=mix(color,[24,52,42],(i-0.75*length)/(0.25*length));add(i,i+1,'rule',color);}}
62
+ else if(!screen.wordmark&&source===0){if(screen.mode==='busy')add(0,1,'spinner',[52,211,153]);add(screen.mode==='busy'?2:0,length,'title',[110,231,183],undefined,true);}
63
+ else if(source===selectedLine&&showSelection&&Number.isInteger(screen.selected)&&screen.selected>=0&&screen.selected<entries.length&&source<bodyEnd){
64
+ const used=[...visible[line]].reduce((sum,character)=>sum+cellWidth(character),0),padding=Math.max(0,Math.min(columns,PANEL)-used);visible[line]+=' '.repeat(padding);
65
+ add(0,length,'selected',[236,253,245],[6,95,70],true);add(length,length+padding,'selectedPad',undefined,[9,70,53]);
66
+ }
67
+ else if(source>=heading.length&&source<heading.length+entries.length&&screen.rowTones?.[source-heading.length]){
68
+ const tone=screen.rowTones[source-heading.length],text=visible[line].slice(2);
69
+ if(tone==='status')for(const {from,to,role} of screen.rowStatusSpans?.[source-heading.length]??statusSpans(entries[source-heading.length]))add(from+2,to+2,role,TONE_FG[role]);
70
+ else if(tone==='diagnostic'){const separator=text.indexOf(': ');if(separator>=0)add(2+[...text.slice(0,separator+2)].length,length,'warn',TONE_FG.warn);}
71
+ else if(tone==='diagnostic-cont')add(2,length,'warn',TONE_FG.warn);
72
+ }
73
+ else if(position.length&&source===heading.length+entries.length)add(0,length,'position',[110,130,120]);
74
+ else if(footer.length&&source===lines.length-1){let start=0;for(const segment of visible[line].split(/( · )/)){const end=start+[...segment].length;add(start,end,segment===' · '?'hintSep':'hint',segment===' · '?[70,95,85]:[150,170,160]);start=end;}}
75
+ else if(footer.length>1&&source===lines.length-2)add(0,length,'rule',[36,140,106]);
76
+ if(runs.length)styles.push({line,runs});
77
+ }
41
78
  const selectionEnabled=Number.isInteger(screen.selected)&&screen.selected>=0&&screen.selected<entries.length&&selectedLine<rows-footer.length-position.length&&fitted[selectedLine].complete;
42
79
  return{text:visible.join('\n'),selectionEnabled,styles};
43
80
  }
package/lib/tui/setup.mjs CHANGED
@@ -2,7 +2,7 @@ import {parsePositiveLimit} from '../limits.mjs';
2
2
  import {readFileSync} from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import {loadModelConfig,resolveModelSettings,ModelValidationError} from '../models/index.mjs';
5
- import {escapeTerminalText} from './render.mjs';
5
+ import {escapeTerminalText,cellWidth} from './render.mjs';
6
6
  import {editPlatformRoles,editCompositeRoles} from './custom-preset.mjs';
7
7
  import {assertCatalogRoles} from '../models/catalog.mjs';
8
8
  import {ROLES,effortField,validateRoles} from '../models/config.mjs';
@@ -19,7 +19,7 @@ export function loadRoleDefaults({context,statuses,target,readText=filename=>rea
19
19
  }
20
20
  export function presetPreviewRows(roleRows,{columns=80,rows=24,selectedRole,blink=true,compact=false}={}){
21
21
  const values=roleRows.map(({role,model,effort,platform})=>({role:escapeTerminalText(role),model:escapeTerminalText(model),effort:escapeTerminalText(effort),platform:{codex:'Codex',claude:'Claude'}[platform]}));
22
- const cells=value=>[...value].reduce((total,character)=>total+(/[\p{Mark}]/u.test(character)?0:/[\u2190-\u2193\u2500-\u257f\u2588]/u.test(character)?1:character.codePointAt(0)>=0x1100?2:1),0);
22
+ const cells=value=>[...value].reduce((total,character)=>total+cellWidth(character),0);
23
23
  const width=Math.max(20,...values.flatMap(value=>[cells(value.role)+2,cells(value.model),cells('effort: '+value.effort)])),boxWidth=width+4,total=boxWidth*3+4,requiredRows=24;
24
24
  if(columns<total+3||rows<requiredRows){
25
25
  if(compact){
@@ -49,7 +49,7 @@ export function setupOptions(draft,target,verifiedCatalog,kind) {
49
49
  async function editSettings(ui,target,settings) {
50
50
  let selected=0;
51
51
  while(true){
52
- const choice=await ui.menu('Settings — '+label(target),['Language: '+languageLabel(settings.language),'Total subagents: '+settings.maxTotalSubagents,'Concurrent subagents: '+settings.maxConcurrentSubagents,'Global config: '+(settings.skipGlobal?'Off':'On'),'Back'],{selected,separatorBefore:4});
52
+ const choice=await ui.menu('Settings — '+label(target),['Language: '+languageLabel(settings.language),'Total subagents: '+settings.maxTotalSubagents,'Concurrent subagents: '+settings.maxConcurrentSubagents,'Global config: '+(settings.skipGlobal?'Off':'On'),'Back'],{selected});
53
53
  if(choice===null||choice===4)return;selected=choice;
54
54
  if(choice===0){const value=await ui.menu('Language',['EN','KR'],{backRow:true,selected:settings.language==='ko'?1:0});if(value!==null)settings.language=['en','ko'][value];}
55
55
  else if(choice===1||choice===2){
@@ -1,6 +1,23 @@
1
1
  import {StringDecoder} from 'node:string_decoder';
2
2
  import {renderScreen} from './render.mjs';
3
3
 
4
+ const BASIC={logo:'92',shadow:'32',sparkle:'92',tagline:'32',version:'32',rule:'32',title:'1;92',spinner:'32',selected:'42;30',selectedPad:'42',hint:'2',hintSep:'2',position:'2',ok:'32',muted:'2',error:'31',warn:'33'};
5
+ const rgb=color=>[0,1,2].map(index=>Math.max(0,Math.min(255,Math.round(Number(color[index])||0))));
6
+ export function toAnsi256(color){const [r,g,b]=rgb(color);return 16+36*Math.round(r/51)+6*Math.round(g/51)+Math.round(b/51);}
7
+ export function formatLine(line,style,depth){
8
+ if(depth==='none'||!style?.runs?.length)return line;
9
+ const characters=[...line];let result='',end=0,painted=false;
10
+ for(const run of style.runs){
11
+ if(!Object.hasOwn(BASIC,run.role))continue;
12
+ const from=Math.max(end,Math.min(characters.length,run.from)),to=Math.min(characters.length,run.to);if(from>=to)continue;
13
+ if(from>end){if(painted){result+='\x1b[0m';painted=false;}result+=characters.slice(end,from).join('');}
14
+ let params=BASIC[run.role];if(depth!=='16'){const values=run.bold?['1']:[];for(const [key,code] of [['fg',38],['bg',48]])if(run[key])values.push(depth==='truecolor'?code+';2;'+rgb(run[key]).join(';'):code+';5;'+toAnsi256(run[key]));params=values.join(';');}
15
+ if(params){if(painted!==params)result+='\x1b[0;'+params+'m';painted=params;}else if(painted){result+='\x1b[0m';painted=false;}
16
+ result+=characters.slice(from,to).join('');end=to;
17
+ }
18
+ if(painted)result+='\x1b[0m';return result+characters.slice(end).join('');
19
+ }
20
+
4
21
  /** Events are {name, sequence, ...detail}. Names: up/down/left/right, enter,
5
22
  * escape, backspace, text/paste (text), resize (columns,rows), blocked, eof, interrupt
6
23
  * (signal), error (error). Every data chunk gets a sequence; paste is one event.
@@ -15,7 +32,8 @@ export function createTerminalSession({input=process.stdin,output=process.stdout
15
32
  const wasRaw=Boolean(input.isRaw),wasFlowing=input.readableFlowing;
16
33
  const colorEnabled=env.NO_COLOR===undefined&&env.TERM!=='dumb';
17
34
  const truecolor=colorEnabled&&(/^(truecolor|24bit)$/i.test(env.COLORTERM??'')||/^(ghostty|cmux)$/i.test(env.TERM_PROGRAM??'')||/-direct$/.test(env.TERM??'')||(output.getColorDepth?.()??0)>=24);
18
- let disposed=false,busy=false,parsing=false,pending='',paste=null,sequence=0,escapeTimer,waiter,queue=[],screen,lastLines=0,enterEnabled=true;
35
+ const colorDepth=!colorEnabled?'none':truecolor?'truecolor':/256color/i.test(env.TERM??'')||(output.getColorDepth?.()??0)>=8?'256':'16';
36
+ let disposed=false,busy=false,parsing=false,pending='',paste=null,sequence=0,escapeTimer,waiter,queue=[],screen,lastLines=0,lastFrame,enterEnabled=true;
19
37
  let decoder=new StringDecoder('utf8'),lastWasCR=false;
20
38
  const clearTimer=()=>{clearTimeout(escapeTimer);escapeTimer=undefined;};
21
39
  function deliver(name,detail={}){
@@ -37,24 +55,19 @@ export function createTerminalSession({input=process.stdin,output=process.stdout
37
55
  function onError(error){if(!disposed)finish('error',{error});}
38
56
  function onSigint(){if(!disposed)finish('interrupt',{signal:'SIGINT'});}
39
57
  function onSigterm(){if(!disposed)finish('interrupt',{signal:'SIGTERM'});}
40
- function draw(){
58
+ function draw(repaint=false){
41
59
  const result=renderScreen(screen,{columns:output.columns,rows:output.rows});enterEnabled=screen?.mode==='page'||result.selectionEnabled;
42
- if(lastLines)output.write(`\x1b[${lastLines}A\r`);
43
- const lines=result.text.split('\n');
44
- for(let index=0;index<Math.max(lastLines,lines.length);index++){
45
- let line=lines[index]??'';const style=result.styles.find(style=>style.line===index);
46
- if(style&&colorEnabled){
47
- if(style.color==='logo'&&truecolor){const cells=new Map(style.cells.map(cell=>[cell.column,cell.rgb]));line=[...line].map((character,column)=>cells.has(column)?'\x1b[38;2;'+cells.get(column).join(';')+'m'+character+'\x1b[0m':character).join('');}
48
- else{const color=style.color==='logo'?'\x1b[92m':style.color==='selected'?(truecolor?'\x1b[48;2;16;55;26m\x1b[38;2;220;245;224m':'\x1b[42;30m'):'\x1b[32m';line=color+line+'\x1b[0m';}
49
- }
50
- output.write('\x1b[2K'+line+'\n');
51
- }
52
-
53
- if(lastLines>lines.length)output.write(`\x1b[${lastLines-lines.length}A\r`);
54
- lastLines=lines.length;return result;
60
+ const lines=result.text.split('\n'),frame=lines.map((line,index)=>'\x1b[2K'+formatLine(line,result.styles.find(style=>style.line===index),colorDepth)+'\n').join('');
61
+ if(repaint&&lastFrame===frame&&lastLines===lines.length)return result;
62
+ let outputFrame=lastLines?`\x1b[${lastLines}A\r`:'';
63
+ outputFrame+=frame+'\x1b[2K\n'.repeat(Math.max(0,lastLines-lines.length));
64
+ if(lastLines>lines.length)outputFrame+=`\x1b[${lastLines-lines.length}A\r`;
65
+ output.write('\x1b[?2026h'+outputFrame+'\x1b[?2026l');
66
+ lastFrame=frame;lastLines=lines.length;return result;
55
67
  }
56
68
  function render(value){if(disposed)return{selectionEnabled:false,text:''};discardInput();screen=value;try{return draw();}catch(error){dispose();throw error;}}
57
- function onResize(){if(disposed)return;discardInput();try{if(screen)draw();deliver('resize',{columns:output.columns,rows:output.rows});}catch(error){onError(error);}}
69
+ function repaint(value){if(disposed)return{selectionEnabled:false,text:''};screen=value;try{return draw(true);}catch(error){dispose();throw error;}}
70
+ function onResize(){if(disposed)return;lastFrame=undefined;discardInput();try{if(screen)draw();deliver('resize',{columns:output.columns,rows:output.rows});}catch(error){onError(error);}}
58
71
  function parse(){
59
72
  while(pending&&!disposed){
60
73
  if(paste!==null){const end=pending.indexOf('\x1b[201~');if(end<0){const tail=pending.lastIndexOf('\x1b');if(tail<0){paste+=pending;pending='';}else{paste+=pending.slice(0,tail);pending=pending.slice(tail);}return;}paste+=pending.slice(0,end);pending=pending.slice(end+6);deliver('paste',{text:paste});paste=null;continue;}
@@ -77,5 +90,5 @@ export function createTerminalSession({input=process.stdin,output=process.stdout
77
90
  function onData(chunk){if(disposed||busy)return;sequence++;clearTimer();pending+=typeof chunk==='string'?chunk:decoder.write(chunk);parsing=true;try{parse();}finally{parsing=false;if(waiter&&queue.length){const resolve=waiter;waiter=undefined;resolve(queue.shift());}}}
78
91
  input.on('data',onData);input.on('end',onEnd);input.on('close',onEnd);input.on('error',onError);output.on('resize',onResize);output.on('error',onError);signals.on('SIGINT',onSigint);signals.on('SIGTERM',onSigterm);
79
92
  try{input.setRawMode?.(true);input.resume();output.write('\x1b[?25l\x1b[?2004h');}catch(error){dispose();throw error;}
80
- return{render,discardInput,dispose,viewport(){return{columns:output.columns??80,rows:output.rows??24};},setBusy(value){busy=Boolean(value);discardInput();},nextEvent(){if(queue.length)return Promise.resolve(queue.shift());if(disposed)return Promise.resolve({name:'eof',sequence});if(waiter)return Promise.reject(Error('Only one terminal event reader is allowed.'));return new Promise(resolve=>{waiter=resolve;});}};
93
+ return{render,repaint,frameMs:env.TERM==='dumb'?0:80,discardInput,dispose,viewport(){return{columns:output.columns??80,rows:output.rows??24};},setBusy(value){busy=Boolean(value);discardInput();},nextEvent(){if(queue.length)return Promise.resolve(queue.shift());if(disposed)return Promise.resolve({name:'eof',sequence});if(waiter)return Promise.reject(Error('Only one terminal event reader is allowed.'));return new Promise(resolve=>{waiter=resolve;});}};
81
94
  }
@@ -5,10 +5,15 @@ export const PLATFORM_COLORS = Object.freeze({codex:'36', claude:'38;5;208', oth
5
5
 
6
6
  export function tagColor(event) {
7
7
  if (event.kind === 'command') return event.exitCode == null || event.exitCode === 0 ? '38;5;242' : '31';
8
- return ({user:'1;35', agent:'32', file_change:'33', tool:'38;5;250', spawn:'38;5;141',
8
+ return ({user:'1;35', agent:'32', file_change:'33', tool:'2', spawn:'38;5;141',
9
9
  dispatch:'38;5;137', approval:'1;4', turn_failed:'31', error:'31', tool_failed:'31'})[event.kind] ?? '2';
10
10
  }
11
11
 
12
+ export function bodyColor(event) {
13
+ const code = tagColor(event);
14
+ return code.startsWith('38;5;') ? code : code.split(';').filter(value => value !== '1' && value !== '4').join(';');
15
+ }
16
+
12
17
  export function kindTag(event) {
13
18
  if (event.kind === 'agent') {
14
19
  const name = event.role || (event.source === 'subagent' && event.label?.includes('/') ? event.label.split('/').at(-1) : '');
@@ -47,14 +52,16 @@ export function renderHuman(event, {width, color, verbose}) {
47
52
  const messageBody = text.split('\n').map((line, i) => !line ? '' : (i ? ' '.repeat([...prefix].length) : '') + line).join('\n');
48
53
  const plain = message ? (text ? prefix + messageBody : prefix.trimEnd()) : clipCodePoints(prefix + text, width).text;
49
54
  if (!color || (!message && [...prefix].length > width)) return plain;
50
- const failure = ['turn_failed','tool_failed','error'].includes(event.kind) || (event.kind === 'command' && event.exitCode != null && event.exitCode !== 0);
55
+ const code = bodyColor(event);
51
56
  const paint = (value, code) => `\x1b[${code}m${value}\x1b[0m`;
52
57
  const platformColor = event.source === 'watch' ? PLATFORM_COLORS.other : PLATFORM_COLORS[event.platform] ?? PLATFORM_COLORS.other;
53
58
  const paintedTag = paint(tag.trimEnd(), tagColor(event));
54
59
  const padding = tag.slice(tag.trimEnd().length);
55
60
  const clippedText = message ? messageBody : [...plain].slice([...prefix].length).join('');
56
61
  if (message && !text) return `${time} ${paint(platform, platformColor)} ${paintedTag}`;
57
- return `${time} ${paint(platform, platformColor)} ${paintedTag}${padding} ${failure && clippedText ? paint(clippedText, 31) : clippedText}`;
62
+ const body = message ? text.split('\n').map((line, i) => !line ? '' : (i ? ' '.repeat([...prefix].length) : '') + (code ? paint(line, code) : line)).join('\n')
63
+ : code && clippedText ? paint(clippedText, code) : clippedText;
64
+ return `${time} ${paint(platform, platformColor)} ${paintedTag}${padding} ${body}`;
58
65
  }
59
66
 
60
67
  export function renderJson(event) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yunhozz/arc",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"