synabun 2.4.4 → 2.4.6

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/docs/browser-extension-bridge.md +5 -4
  4. package/docs/whatsapp.md +19 -3
  5. package/hooks/claude-code/session-start.mjs +21 -18
  6. package/lib/claude-global-config.js +214 -0
  7. package/lib/client-config-repair.js +17 -3
  8. package/mcp-server/dist/index.d.ts.map +1 -1
  9. package/mcp-server/dist/index.js +6 -1
  10. package/mcp-server/dist/index.js.map +1 -1
  11. package/mcp-server/dist/services/neural-interface.d.ts +1 -0
  12. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  13. package/mcp-server/dist/services/neural-interface.js +1 -0
  14. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  15. package/mcp-server/dist/services/tool-catalog.js +1 -1
  16. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  17. package/mcp-server/dist/tools/agents.d.ts +18 -3
  18. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  19. package/mcp-server/dist/tools/agents.js +85 -16
  20. package/mcp-server/dist/tools/agents.js.map +1 -1
  21. package/mcp-server/dist/tools/skill-tools.d.ts +24 -5
  22. package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -1
  23. package/mcp-server/dist/tools/skill-tools.js +88 -8
  24. package/mcp-server/dist/tools/skill-tools.js.map +1 -1
  25. package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -1
  26. package/mcp-server/dist/tools/tool-groups.js +19 -4
  27. package/mcp-server/dist/tools/tool-groups.js.map +1 -1
  28. package/mcp-server/package-lock.json +2 -2
  29. package/mcp-server/package.json +1 -1
  30. package/mcp-server/src/index.ts +6 -1
  31. package/mcp-server/src/services/neural-interface.ts +2 -1
  32. package/mcp-server/src/services/tool-catalog.ts +1 -1
  33. package/mcp-server/src/tools/agents.ts +78 -16
  34. package/mcp-server/src/tools/skill-tools.ts +82 -9
  35. package/mcp-server/src/tools/tool-groups.ts +19 -4
  36. package/neural-interface/i18n/en.json +484 -19
  37. package/neural-interface/i18n/pt-BR.json +484 -19
  38. package/neural-interface/lib/agents-studio-api.js +7 -2
  39. package/neural-interface/lib/antigravity/home.js +43 -8
  40. package/neural-interface/lib/antigravity/panel-bridge.js +7 -3
  41. package/neural-interface/lib/antigravity/tool-call.js +14 -0
  42. package/neural-interface/lib/assistant-brains/antigravity.js +4 -2
  43. package/neural-interface/lib/assistant-dispatch.js +15 -1
  44. package/neural-interface/lib/assistant-persona.js +8 -3
  45. package/neural-interface/lib/assistant-route-gate.js +11 -2
  46. package/neural-interface/lib/assistant-runtime.js +95 -13
  47. package/neural-interface/lib/assistant-spilled-output.js +53 -0
  48. package/neural-interface/lib/assistant-user-context.js +7 -3
  49. package/neural-interface/lib/browser-default.js +22 -2
  50. package/neural-interface/lib/browser-extension-bridge.js +50 -3
  51. package/neural-interface/lib/browser-extension-pin.json +7 -7
  52. package/neural-interface/lib/browser-extension-protocol.js +30 -1
  53. package/neural-interface/lib/browser-extension-setup.js +204 -36
  54. package/neural-interface/lib/claude-agent-bridge.js +13 -2
  55. package/neural-interface/lib/codex-thread-history.js +144 -7
  56. package/neural-interface/lib/codex-worker-app-server.js +84 -30
  57. package/neural-interface/lib/db.js +26 -0
  58. package/neural-interface/lib/greeting/sources.js +7 -3
  59. package/neural-interface/lib/jsonl-lines.js +10 -11
  60. package/neural-interface/lib/line-buffer.js +88 -0
  61. package/neural-interface/lib/loop-stall.js +15 -1
  62. package/neural-interface/lib/memory-list-read.js +105 -0
  63. package/neural-interface/lib/memory-timers.js +4 -1
  64. package/neural-interface/lib/native-loop-runtime.js +7 -3
  65. package/neural-interface/lib/provider-panel-api-key-auth.js +33 -6
  66. package/neural-interface/lib/remote-policy.js +24 -7
  67. package/neural-interface/lib/skills/api-v2.js +18 -3
  68. package/neural-interface/lib/skills/bundle.js +2 -2
  69. package/neural-interface/lib/skills/deploy.js +169 -34
  70. package/neural-interface/lib/skills/digest.js +57 -3
  71. package/neural-interface/lib/skills/health.js +55 -1
  72. package/neural-interface/lib/skills/known-bridge-digests.json +12 -0
  73. package/neural-interface/lib/skills/runtime-checks.js +7 -4
  74. package/neural-interface/lib/skills/scan-shell.js +56 -7
  75. package/neural-interface/lib/skills/scan.js +13 -12
  76. package/neural-interface/lib/skills/service.js +7 -2
  77. package/neural-interface/lib/skills/telemetry.js +2 -2
  78. package/neural-interface/lib/teams/README.md +34 -6
  79. package/neural-interface/lib/teams/api.js +94 -10
  80. package/neural-interface/lib/teams/index.js +4 -0
  81. package/neural-interface/lib/teams/landing.js +195 -75
  82. package/neural-interface/lib/teams/recovery.js +68 -0
  83. package/neural-interface/lib/teams/scheduler.js +380 -61
  84. package/neural-interface/lib/teams/worktrees.js +123 -30
  85. package/neural-interface/lib/terminal-token-redaction.js +228 -58
  86. package/neural-interface/lib/terminal-tokens.js +18 -0
  87. package/neural-interface/lib/whatsapp/brain.js +21 -0
  88. package/neural-interface/lib/whatsapp/bridge.js +40 -4
  89. package/neural-interface/package-lock.json +2 -2
  90. package/neural-interface/package.json +1 -1
  91. package/neural-interface/public/extension-setup.html +6 -2
  92. package/neural-interface/public/index.html +117 -37
  93. package/neural-interface/public/shared/agents/studio/ax-api.js +27 -0
  94. package/neural-interface/public/shared/agents/studio/ax-create-view.js +1 -1
  95. package/neural-interface/public/shared/agents/studio/ax-icons.js +1 -0
  96. package/neural-interface/public/shared/agents/studio/ax-library-view.js +3 -2
  97. package/neural-interface/public/shared/agents/studio/ax-main.js +127 -41
  98. package/neural-interface/public/shared/agents/studio/ax-review-view.js +3 -2
  99. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +436 -33
  100. package/neural-interface/public/shared/agents/studio/ax-teams.js +357 -10
  101. package/neural-interface/public/shared/agents/studio/ax-ui.js +31 -0
  102. package/neural-interface/public/shared/agents/studio/ax-views.js +67 -69
  103. package/neural-interface/public/shared/agents/studio/ax-work-answer.js +86 -0
  104. package/neural-interface/public/shared/agents/studio/ax-work-view.js +305 -0
  105. package/neural-interface/public/shared/agents/studio/ax-work.css +74 -0
  106. package/neural-interface/public/shared/agents/studio/ax-work.js +300 -0
  107. package/neural-interface/public/shared/browser-extension-updates.js +3 -1
  108. package/neural-interface/public/shared/cdx/cdx-deferred.js +90 -0
  109. package/neural-interface/public/shared/cdx/cdx-render.js +18 -7
  110. package/neural-interface/public/shared/cdx/cdx-tabs.js +2 -1
  111. package/neural-interface/public/shared/extension-setup/es-page.js +23 -4
  112. package/neural-interface/public/shared/extension-setup/es-view.js +51 -11
  113. package/neural-interface/public/shared/extension-update-view.js +1 -1
  114. package/neural-interface/public/shared/loading-diagnostic-entry.js +16 -1
  115. package/neural-interface/public/shared/settings/settings-ai-browser.js +23 -3
  116. package/neural-interface/public/shared/settings/settings-browser-extension.js +575 -197
  117. package/neural-interface/public/shared/settings/settings-extension-diagrams.js +116 -0
  118. package/neural-interface/public/shared/settings/settings-extension-guide.js +222 -0
  119. package/neural-interface/public/shared/settings/settings-ia.js +2 -2
  120. package/neural-interface/public/shared/settings/settings-shell.js +5 -0
  121. package/neural-interface/public/shared/skills/studio/sx-operations-view.js +5 -0
  122. package/neural-interface/public/shared/skills/studio/sx-plan.js +42 -3
  123. package/neural-interface/public/shared/skills/studio/sx-publish-view.js +20 -4
  124. package/neural-interface/public/shared/styles.css +196 -13
  125. package/neural-interface/public/shared/ui-settings.js +48 -11
  126. package/neural-interface/server.js +336 -253
  127. package/npm-shrinkwrap.json +2 -2
  128. package/package.json +2 -1
  129. package/skills/skill-forge/SKILL.md +7 -3
@@ -41,6 +41,12 @@ export const RUN_EVENT_KINDS = [
41
41
  /** One title limit for agent_route planned_split.slices and agent_team slices[].title (= TEAM_LIMITS.title in neural-interface/lib/teams/schema.js). */
42
42
  export const SLICE_TITLE_MAX = 80;
43
43
 
44
+ /** agent_list's page: newest first, AGENT_LIST_DEFAULT runs unless the brain asks for more. */
45
+ export const AGENT_LIST_DEFAULT = 20;
46
+ export const AGENT_LIST_MAX = 100;
47
+ /** How much of a run's result summary a roster row or a dispatch answer keeps (agent_read has the whole result). */
48
+ const RUN_SUMMARY_CHARS = 400;
49
+
44
50
  const runIdField = (purpose: string) => z.string().min(1).max(200).describe(purpose);
45
51
  const optionalId = (purpose: string) => z.string().min(1).max(200).optional().describe(purpose);
46
52
 
@@ -111,6 +117,9 @@ export const agentListSchema = {
111
117
  ),
112
118
  assistant_session_id: optionalId('Restrict to runs dispatched by this assistant session (your ASSISTANT_SESSION_ID).'),
113
119
  workflow_id: optionalId('Restrict to one workflow (the workflow_id passed to agent_dispatch).'),
120
+ limit: z.number().int().min(1).max(AGENT_LIST_MAX).optional().describe(
121
+ `How many runs, newest first (default ${AGENT_LIST_DEFAULT}, at most ${AGENT_LIST_MAX}).`
122
+ ),
114
123
  };
115
124
 
116
125
  export const agentDispatchSchema = {
@@ -282,13 +291,13 @@ export const agentClarifyDescription =
282
291
  'Ask the user 1-3 targeted questions BEFORE routing a new request that is materially ambiguous: two plausible readings with different results, an unclear target (project, feature, files, audience), destructive or irreversible scope, spend, or memories that conflict with it. Not for clear requests, details a sensible default covers, anything the request, memory or the project answers, or the model (agent_route asks that). Each question gets 2-4 options (recommended first; the user can always type their own); add constraints (what the request fixes) and assumptions (what you will assume for the rest). The card waits briefly. Follow the returned status and next: answered → route, then agent_dispatch with the brief_id (SynaBun adds the user\'s original words, their answers, the constraints and assumptions to the worker\'s context); declined → proceed on your assumptions; pending → end your turn, the answers arrive as a [SynaBun Mailbox] clarify_answered event or as the user\'s next message, and dependent routes and dispatches wait until then. Returns JSON.';
283
292
 
284
293
  export const agentListDescription =
285
- 'List dispatched worker runs with status, state, provider/model, the agent a run runs as (agentRef, agentRevision; absent for a plain worker), title, elapsed time, work time left (workLeftMs), cost and resumes (how often a server restart cut the run off and it was resumed). Use it before dispatching more work, to recover run ids, or after a mailbox event. Filter with active_only, assistant_session_id (your own session) or workflow_id. Returns JSON.';
294
+ 'List dispatched worker runs with status, state, provider/model, the agent a run runs as (agentRef, agentRevision; absent for a plain worker), title, elapsed time, work time left (workLeftMs), cost and resumes (how often a server restart cut the run off and it was resumed). Use it before dispatching more work, to recover run ids, or after a mailbox event. Filter with active_only, assistant_session_id (your own session) or workflow_id; limit sets how many (newest first, default 20). Each run is compact: the task, context and turn texts are counted, not repeated (agent_read and agent_status have them). Returns JSON.';
286
295
 
287
296
  export const agentDispatchDescription =
288
297
  'Dispatch a task to a worker agent (Claude Code, Codex or OpenCode). Route it first with agent_route and pass the approved route_id (the server applies that provider/model/effort); without one, the dispatch may be held until the user picks a model (awaitingRoute:true — do not dispatch it again; if the user picks "here" instead, the run never starts and a route_decided mailbox event asks you to do the task yourself). A route_id the user decided to keep here is refused (ROUTE_IS_DIRECT): do that task yourself. After agent_clarify, pass its brief_id: the worker gets the user\'s own words and answers; while its questions are open a dependent dispatch is refused (CLARIFICATION_PENDING). The run attaches as a live automation tab in the matching sidepanel without stealing focus. Write a self-contained task that ends with a ## Result block, pass the absolute cwd and your assistant_session_id. Defaults: permission_policy "auto", capability "full", 45 minutes of work time (max_minutes, at least 20), no per-run dollar ceiling (with a budget the run draws from its provider\'s share; a provider whose share is used up and cannot get more is refused with BUDGET_SHARE_EXHAUSTED: route again). Use "ask" only for sensitive scopes (Codex cannot ask: use "restricted"). uses_computer:true for desktop work (one at a time, vision model). uses_browser:true with morelogin_profile (a profile id or name) opens the worker\'s browser tab in that MoreLogin profile for this run only, next to runs in the default or other profiles (only a profile the owner allowed agents to choose; MORELOGIN_PROFILE_NOT_ALLOWED otherwise: tell the user to switch it on in Settings). An image_gen / video_gen run makes the asset with its model\'s own generation tool; SynaBun collects the files into the run\'s result (media: path + url); with no model that generates the medium an un-routed dispatch is refused (NO_CAPABLE_MODEL), and a route_id approved for other work is refused for image_gen / video_gen / design (and the other way round: ROUTE_CLASS_MISMATCH; route the task again with its own class). A design run gets SynaBun\'s design rules and the project\'s style guide, defaults to capability "workspace", uses_browser true, browser, styleguide and image groups, and 60 minutes of work time (explicit values win), runs only on a model confirmed to see (MODEL_CANNOT_SEE otherwise), and its screenshots land in the result\'s media. The class agent applies automatically; agent_ref "none" opts out. An explicit agent_ref runs the worker as one of the owner\'s approved agents (agent_catalog agents): its definition fills what you leave out and its instructions become the worker\'s role, the run carries agentRef and agentRevision, and corrections list what the definition was held to. Group fan-outs with workflow_id, chain with parent_run_id, retry safely with idempotency_key. Over-limit dispatches are queued (queued:true, position). After dispatching, block with agent_wait rather than polling. Returns JSON.';
289
298
 
290
299
  export const agentStatusDescription =
291
- 'Get one run\'s current descriptor: status (queued, starting, running, completed, failed, stopped, interrupted), state (the detail: also idle, awaiting_permission, and suspended / resuming while a SynaBun server restart cuts a Claude Code worker off and the next start resumes it as the same run, its Claude session and its tab; resumes counts that, at most 3; a run that could not be resumed ends interrupted, with why in notes), turnState (running, idle, awaiting_permission), provider/model/account, the agent it runs as (agentRef, agentRevision, agentPin with what its definition was held to; absent for a plain worker), elapsed time (elapsedMs, wall clock), work time used and left of max_minutes (workMs, workLeftMs), cost, the last parsed result summary and any pending permission or question requests. Cheap; use it between agent_wait calls or before agent_send / agent_stop. Returns JSON.';
300
+ 'Get one run\'s current descriptor: status (queued, starting, running, completed, failed, stopped, interrupted), state (the detail: also idle, awaiting_permission, and suspended / resuming while a SynaBun server restart cuts a Claude Code worker off and the next start resumes it as the same run, its Claude session and its tab; resumes counts that, at most 3; a run that could not be resumed ends interrupted, with why in notes), turnState (running, idle, awaiting_permission), provider/model/account, the agent it runs as (agentRef, agentRevision, agentPin with what its definition was held to; absent for a plain worker), elapsed time (elapsedMs, wall clock), work time used and left of max_minutes (workMs, workLeftMs), cost, the last parsed result summary and any pending permission or question requests. The task, context and turn texts are counted, not repeated (agent_read has the texts). Cheap; use it between agent_wait calls or before agent_send / agent_stop. Returns JSON.';
292
301
 
293
302
  export const agentReadDescription =
294
303
  'Read a run\'s output. format "result" (default) returns the parsed ## Result contract (status, summary, changes, follow_ups, question, json, and media: the images / videos an image_gen or video_gen run generated or a design run captured, each { kind, path, url, mime, bytes } — show one with ![](url) plus its path); "tail" returns the last transcript events (also after the run ended or the server restarted); "text" the worker\'s assistant text; "files" the files it reported. Call after agent_wait reports idle or terminal; keep max_chars small. A text longer than max_chars is read in pages: the answer carries totalChars, offset and nextOffset; pass offset (0 for the start, then each nextOffset) to read the rest. Returns JSON.';
@@ -297,7 +306,7 @@ export const agentSendDescription =
297
306
  'Continue a worker\'s conversation. text sends a follow-up turn (queue:true enqueues it while the worker is still running, or while it is suspended / resuming after a server restart: it goes to the worker once resumed; queued follow-ups keep their order, survive a restart, and at most 20 wait per run). reply answers a pending permission or question request: decision allow/deny for tools, answer (with answers) for questions, note as an optional message. Obtain request ids from agent_status or agent_wait until="event". A follow-up to a run whose work time (max_minutes) is used up is refused with TIME_CAP: dispatch a new run with its result as context. steer:true with text redirects a run that is still working: its current turn is cut, its context kept, and the change follows at once (use it on the one run the user\'s change concerns, never to stop other runs). Returns JSON.';
298
307
 
299
308
  export const agentWaitDescription =
300
- 'Blocking barrier for orchestration. Waits up to timeout_seconds (max 120) for one run (run_id), several runs (run_ids with mode all/any) or a whole workflow to reach until="idle" (turn finished; default), "terminal" (completed, failed, stopped, interrupted) or "event" (typed events: by default a result, a question, a permission request, a failure, a stall, a stop; narrow with kinds). An "event" answer lists the events with their seq and a cursor: pass it back as after_seq to go on from there. A workflow wait follows runs added to the workflow while it waits. A run suspended or resuming after a SynaBun server restart is still working: keep waiting (a wait cut off by the restart is simply called again, with the same after_seq). Returns the run descriptors and whether the wait timed out; call again to keep waiting. Prefer this over polling agent_status. Returns JSON.';
309
+ 'Blocking barrier for orchestration. Waits up to timeout_seconds (max 120) for one run (run_id), several runs (run_ids with mode all/any) or a whole workflow to reach until="idle" (turn finished; default), "terminal" (completed, failed, stopped, interrupted) or "event" (typed events: by default a result, a question, a permission request, a failure, a stall, a stop; narrow with kinds). An "event" answer lists the events with their seq and a cursor: pass it back as after_seq to go on from there. A workflow wait follows runs added to the workflow while it waits. A run suspended or resuming after a SynaBun server restart is still working: keep waiting (a wait cut off by the restart is simply called again, with the same after_seq). Returns compact run descriptors (task, context and turn texts counted, not repeated; questions, permission requests and events whole) and whether the wait timed out; call again to keep waiting. Prefer this over polling agent_status. Returns JSON.';
301
310
 
302
311
  export const agentStopDescription =
303
312
  'Stop work. run_id stops one run; all:true with your assistant_session_id stops every run of this assistant session, workflow_id every run of a workflow (kill-all). Use when the user cancels, a worker misbehaves, or a time/budget rail is at risk. Returns JSON.';
@@ -327,7 +336,7 @@ const teamSliceSchema = z.object({
327
336
 
328
337
  export const agentTeamSchema = {
329
338
  action: z.enum(AGENT_TEAM_ACTIONS).describe(
330
- 'plan: check a plan (density, overlapping files, dependency cycles) and return it normalized; creates nothing. start: create the worktrees and dispatch the workers. status: slices, runs, claims, the integration branch, the last events. assign: give unowned paths to a slice. set_test_command: correct the test command before the first join attempt. integrate: try again after a needs_attention. land: the integration branch into the user\'s branch. cleanup: after successful land and the user\'s yes, delete finished team worktrees/branches. discard: give the team up. list: this session\'s teams.'
339
+ 'plan: check a plan (density, overlapping files, dependency cycles) and return it normalized; creates nothing. start: create the worktrees and dispatch the workers. status: slices, runs, claims, the integration branch, the landing as it stands (landing.preview), the last events. assign: give unowned paths to a slice. set_test_command: correct the test command before the first join attempt. integrate: try again after a needs_attention. land: the integration branch into the user\'s branch. cleanup: after successful land and the user\'s yes, delete finished team worktrees/branches. discard: give the team up. list: this session\'s teams.'
331
340
  ),
332
341
  assistant_session_id: optionalId('Your ASSISTANT_SESSION_ID (plan, start, list).'),
333
342
  team_id: z.string().min(1).max(40).optional().describe('Required for status, assign, set_test_command, integrate, land, cleanup and discard. For start, use the team_id from plan or let the server generate one.'),
@@ -352,7 +361,9 @@ export const agentTeamSchema = {
352
361
  brief_id: optionalId('start: the brief_id of a clarification, so every worker gets the user\'s own words and answers.'),
353
362
  slice_id: z.string().min(1).max(40).optional().describe('assign: the slice receiving the paths. integrate: retry only this slice (omitted: every slice that is not joined).'),
354
363
  paths: z.array(z.string().min(1).max(300)).min(1).max(64).optional().describe('assign: unowned project-relative paths or patterns to add to this slice, using the plan’s ownership rules.'),
355
- target_branch: z.string().min(1).max(200).optional().describe('land: the branch that receives the work (default: the branch checked out in the project).'),
364
+ target_branch: z.string().min(1).max(200).optional().describe('land: the branch that receives the work (default: the team\'s recorded base branch, the branch the project was on when the team was created; never the branch that happens to be checked out). status shows it as landing.preview.targetBranch.'),
365
+ expected_target_head: z.string().min(40).max(64).optional().describe('land: the full commit id status gave as landing.preview.targetHead. If the target branch is elsewhere when the landing runs, nothing moves and the answer is LANDING_PREVIEW_STALE with the fresh preview.'),
366
+ expected_integration_head: z.string().min(40).max(64).optional().describe('land: the full commit id status gave as landing.preview.integrationHead. If the integration branch is elsewhere when the landing runs, nothing moves and the answer is LANDING_PREVIEW_STALE with the fresh preview.'),
356
367
  mode: z.enum(['ff', 'merge']).optional().describe('land: "ff" (default) moves the branch forward to the integration branch; "merge" makes a merge commit.'),
357
368
  user_confirmed: z.boolean().optional().describe('cleanup: true only after the user says yes to deleting the landed team worktrees and branches; otherwise refused locally.'),
358
369
  reason: z.string().max(240).optional().describe('discard: why.'),
@@ -363,7 +374,8 @@ export const agentTeamDescription =
363
374
  'Flow: agent_route the task once → action "plan" (returns the normalized plan with its team_id and base_commit, the density check and any errors; creates nothing) → action "start" with that plan and the approved route_id (returns workflow_id) → agent_wait on the workflow_id → a team_ready mailbox event → action "status" → action "land", or ask the user. ' +
364
375
  'For a request_change on an unowned path, use "assign" with team_id, slice_id and paths. The worker receives the new scope. Use "set_test_command" to correct the verification command before the first join attempt. ' +
365
376
  'SynaBun commits each finished slice\'s own files, joins them on synabun/<team>/integration in dependency order and runs test_command on that exact commit; a conflict or failed tests go back to the slice\'s worker with the report (twice), then a needs_attention event reaches you: read "status", help with agent_send, then "integrate", or "discard". ' +
366
- 'Landing rule: land yourself only when you judge the work ready, the integration tests passed, the user\'s branch has not moved and no file with local changes is touched; land returns SynaBun\'s refusal report unchanged (TESTS_NOT_PASSED, NOT_FAST_FORWARD, OWNER_BRANCH_MOVED, DIRTY_FILES_AFFECTED, TEAM_NOT_READY…). On a refusal do not retry or work around it: ask the user. ' +
377
+ 'Landing rule: land yourself only when you judge the work ready, the integration tests passed, the user\'s branch has not moved and no file with local changes is touched; land returns SynaBun\'s refusal report unchanged (TESTS_NOT_PASSED, NOT_FAST_FORWARD, OWNER_BRANCH_MOVED, DIRTY_FILES_AFFECTED, TEAM_NOT_READY, NOTHING_TO_LAND…). On a refusal do not retry or work around it: ask the user. ' +
378
+ 'What a landing would do is status → landing.preview: { targetBranch, targetHead, integrationHead, testCommand, testsPassedOnHead, canLand, code, reason }. targetBranch is the team\'s recorded base branch, the default target of land, whatever branch is checked out now; canLand false comes with the refusal code land would answer and why. Pass its targetHead and integrationHead to land as expected_target_head and expected_integration_head: if either branch moved in between, nothing is landed and LANDING_PREVIEW_STALE returns the fresh preview; read it and decide again, or ask the user. ' +
367
379
  'Cleanup: successful land returns cleanup (worktrees, branches). When the task is fully finished, suggest deleting them with a synabun-followups confirm card. Only after the user says yes call cleanup with team_id and user_confirmed:true. The server requires a landed team, every run ended done, every branch merged into the target and every worktree clean. Refusals CLEANUP_NOT_CONFIRMED, TEAM_NOT_LANDED, TEAM_RUNS_ACTIVE, BRANCH_NOT_MERGED, BRANCH_MOVED (a branch moved after the check), WORKTREE_DIRTY remove nothing: keep them and tell the user which check failed. Never delete team worktrees or branches with git directly. Returns JSON.';
368
380
 
369
381
  export type AgentTeamArgs = z.infer<z.ZodObject<typeof agentTeamSchema>>;
@@ -435,12 +447,58 @@ export function handleAgentClarify(args: AgentClarifyArgs): Promise<ToolResult>
435
447
  })));
436
448
  }
437
449
 
450
+ /**
451
+ * A run as a roster row or a dispatch answer shows it. The server's view carries the whole run: the task and context
452
+ * the brain wrote itself, the last text and up to 50 turns (each up to 20 KB of text, and its parsed result with the
453
+ * worker's whole final message as `raw`). Those are what agent_read serves; here they are counted, not repeated, so an
454
+ * answer stays small enough for every host (Antigravity spills an output above about 10 KB into a file).
455
+ */
456
+ export function compactRunView(run: unknown, { keepResult = false }: { keepResult?: boolean } = {}): unknown {
457
+ if (!run || typeof run !== 'object' || Array.isArray(run)) return run;
458
+ const { task, context, lastText, turns, lastResult, ...rest } = run as Record<string, unknown>;
459
+ const out: Record<string, unknown> = { ...rest };
460
+ if (typeof task === 'string') out.taskChars = task.length;
461
+ if (typeof context === 'string' && context) out.contextChars = context.length;
462
+ if (typeof lastText === 'string' && lastText) out.lastTextChars = lastText.length;
463
+ if (Array.isArray(turns) && typeof out.turnCount !== 'number') out.turnCount = turns.length;
464
+ if (keepResult && lastResult && typeof lastResult === 'object') {
465
+ // agent_status / agent_wait: the parsed result whole (changes, files, follow-ups, media, question), the
466
+ // worker's whole final message (`raw`) aside.
467
+ const { raw: _raw, ...result } = lastResult as Record<string, unknown>;
468
+ out.lastResult = result;
469
+ } else if (lastResult && typeof lastResult === 'object') {
470
+ const result = lastResult as Record<string, unknown>;
471
+ const summary = typeof result.summary === 'string' ? result.summary : '';
472
+ out.lastResult = {
473
+ status: result.status ?? null,
474
+ summary: summary.length > RUN_SUMMARY_CHARS ? `${summary.slice(0, RUN_SUMMARY_CHARS)}…` : summary,
475
+ ...(typeof result.question === 'string' && result.question ? { question: result.question } : {}),
476
+ };
477
+ } else if (lastResult !== undefined) out.lastResult = lastResult;
478
+ return out;
479
+ }
480
+
481
+ /**
482
+ * An answer whose runs are compacted (compactRunView): `run`, `runs`, and agent_wait's `done` / `pending`.
483
+ * Everything else as it came: a wait's `needsInput`, `permissions` and `events` (the questions and permission
484
+ * requests to answer) and a run's own `pending` requests stay whole.
485
+ */
486
+ function withCompactRuns(answer: unknown, options: { keepResult?: boolean } = {}): unknown {
487
+ if (!answer || typeof answer !== 'object' || Array.isArray(answer)) return answer;
488
+ const out: Record<string, unknown> = { ...(answer as Record<string, unknown>) };
489
+ const compact = (run: unknown) => compactRunView(run, options);
490
+ for (const key of ['runs', 'done', 'pending']) if (Array.isArray(out[key])) out[key] = (out[key] as unknown[]).map(compact);
491
+ if (out.run && typeof out.run === 'object') out.run = compact(out.run);
492
+ return out;
493
+ }
494
+
438
495
  export function handleAgentList(args: AgentListArgs): Promise<ToolResult> {
439
- return guarded(async () => json(await ni.assistantListRuns({
496
+ return guarded(async () => json(withCompactRuns(await ni.assistantListRuns({
440
497
  activeOnly: args.active_only === true,
441
498
  assistantSessionId: args.assistant_session_id,
442
499
  workflowId: args.workflow_id,
443
- })));
500
+ limit: args.limit ?? AGENT_LIST_DEFAULT,
501
+ }))));
444
502
  }
445
503
 
446
504
  export function handleAgentDispatch(args: AgentDispatchArgs): Promise<ToolResult> {
@@ -451,7 +509,8 @@ export function handleAgentDispatch(args: AgentDispatchArgs): Promise<ToolResult
451
509
  if (!args.provider && !args.route_id && !args.task_class && (!args.agent_ref || args.agent_ref === 'none')) return invalid('Provide provider, task_class, the route_id of an approved agent_route, or a named agent_ref.');
452
510
  const selection = resolveToolList(args.tools, { source: 'dispatch', provider: args.provider, usesBrowser: args.uses_browser, taskClass: args.task_class });
453
511
  if (!selection.ok) return { ...json(selection), isError: true };
454
- return json(await ni.assistantDispatch({
512
+ // The answer's run is compacted (compactRunView): the brain wrote the task and context it would echo.
513
+ return json(withCompactRuns(await ni.assistantDispatch({
455
514
  provider: args.provider,
456
515
  task: args.task,
457
516
  cwd: args.cwd,
@@ -488,12 +547,12 @@ export function handleAgentDispatch(args: AgentDispatchArgs): Promise<ToolResult
488
547
  idempotencyKey: args.idempotency_key,
489
548
  briefId: args.brief_id,
490
549
  independent: args.independent,
491
- }));
550
+ })));
492
551
  });
493
552
  }
494
553
 
495
554
  export function handleAgentStatus(args: AgentStatusArgs): Promise<ToolResult> {
496
- return guarded(async () => json(await ni.assistantRun(args.run_id)));
555
+ return guarded(async () => json(withCompactRuns(await ni.assistantRun(args.run_id), { keepResult: true })));
497
556
  }
498
557
 
499
558
  export function handleAgentRead(args: AgentReadArgs): Promise<ToolResult> {
@@ -536,10 +595,10 @@ export function handleAgentWait(args: AgentWaitArgs): Promise<ToolResult> {
536
595
  const multi = runIds.length > 0 || !!args.workflow_id;
537
596
  if (!multi) {
538
597
  if (!args.run_id) return invalid('Provide run_id, run_ids or workflow_id.');
539
- return json(await ni.assistantWaitRun(args.run_id, { until, timeoutMs, afterSeq: args.after_seq, kinds: args.kinds }));
598
+ return json(withCompactRuns(await ni.assistantWaitRun(args.run_id, { until, timeoutMs, afterSeq: args.after_seq, kinds: args.kinds }), { keepResult: true }));
540
599
  }
541
600
  if (args.run_id && !runIds.includes(args.run_id)) runIds.unshift(args.run_id);
542
- return json(await ni.assistantWaitMany({
601
+ return json(withCompactRuns(await ni.assistantWaitMany({
543
602
  runIds: runIds.length ? runIds : undefined,
544
603
  workflowId: args.workflow_id,
545
604
  mode: args.mode || (until === 'event' ? 'any' : 'all'),
@@ -547,7 +606,7 @@ export function handleAgentWait(args: AgentWaitArgs): Promise<ToolResult> {
547
606
  timeoutMs,
548
607
  afterSeq: args.after_seq,
549
608
  kinds: args.kinds,
550
- }));
609
+ }), { keepResult: true }));
551
610
  });
552
611
  }
553
612
 
@@ -707,8 +766,11 @@ export function handleAgentTeam(args: AgentTeamArgs): Promise<ToolResult> {
707
766
  return json(await ni.assistantTeamSetTestCommand(args.team_id, args.test_command));
708
767
  case 'integrate':
709
768
  return needTeam() ?? json(await ni.assistantTeamIntegrate(args.team_id as string, { sliceId: args.slice_id }));
710
- case 'land':
711
- return needTeam() ?? json(await ni.assistantTeamLand(args.team_id as string, { targetBranch: args.target_branch, mode: args.mode }));
769
+ case 'land': {
770
+ // The heads the landing was decided on (status → landing.preview): the server refuses when they moved.
771
+ const landing = { targetBranch: args.target_branch, mode: args.mode, expectedTargetHead: args.expected_target_head, expectedIntegrationHead: args.expected_integration_head };
772
+ return needTeam() ?? json(await ni.assistantTeamLand(args.team_id as string, landing));
773
+ }
712
774
  case 'cleanup':
713
775
  if (args.user_confirmed !== true) return json({ ok: false, code: 'CLEANUP_NOT_CONFIRMED', message: 'Cleanup requires the user to confirm deleting the team worktrees and branches.' });
714
776
  return needTeam() ?? json(await ni.assistantTeamCleanup(args.team_id as string, { targetBranch: args.target_branch, mode: args.mode, user_confirmed: true }));
@@ -11,7 +11,8 @@ import { text } from './response.js';
11
11
  // the catalog of every runtime's skill folders, the managed library (complete folders as immutable revisions), drafts,
12
12
  // the checks (lint per runtime profile, the local scan), AI drafting from sources (`create`: one confined Claude Code
13
13
  // worker writes the package, the server checks it), the skill-forge guide, install plans, the Review queue, and what
14
- // the owner installed (`installations`, read-only). Every call carries the brain's launch credential (skillsV2): the
14
+ // the owner installed (`installations`, read-only; `verify` runs an installation's static check again, which writes
15
+ // only its stored check, never a file or an install). Every call carries the brain's launch credential (skillsV2): the
15
16
  // server knows the Assistant by it, never by the role header alone. It never
16
17
  // installs and never
17
18
  // approves: what the Assistant makes goes to the owner's Review queue, and the owner installs it from Skills
@@ -27,7 +28,7 @@ export const SKILL_ACTIONS = [
27
28
  'draft_create', 'draft_patch', 'snapshot', 'lint', 'scan',
28
29
  'create', 'create_status', 'create_cancel',
29
30
  'eval_start', 'eval_status', 'eval_cancel', 'eval_report',
30
- 'install_plan', 'review_submit', 'review_list', 'review_comment', 'withdraw', 'installations',
31
+ 'install_plan', 'review_submit', 'review_list', 'review_comment', 'withdraw', 'installations', 'verify',
31
32
  ] as const;
32
33
  const EVAL_PROVIDERS = ['claude-code', 'codex', 'opencode'] as const;
33
34
  const SOURCE_KINDS = ['conversation', 'url', 'repo', 'memory', 'import'] as const;
@@ -60,7 +61,8 @@ export const skillSchema = {
60
61
  + 'Evaluate (its evals/evals.json): "eval_start" (revisionId, or skillId for its latest version [+ purpose evals|final|optimise, kinds, runtimes, baseline, repetitions, caseIds, budgetUsd, maxMinutes]): task cases with the skill and without it, trigger cases (does the runtime pick the skill?), every run confined to its own folder with a copy of the skill (nothing is installed), graded by code and an independent grader, within a spend ceiling (default $3); Codex runs (or grades) a version only after the owner allows Codex for it in the Test tab (its shell can read files on the computer): ask the owner, never pick Codex by default; "final" runs only the held-out cases, once; "optimise" proposes a better description as a candidate version (never applied). The results are the owner\'s too, in Skills Studio\'s Test tab. "eval_status" (evalRunId [, waitSeconds, since]), "eval_cancel" (evalRunId), "eval_report" (evalRunId [, trialId]): the results per runtime and case. '
61
62
  + 'Maintenance: usage (minimal local evidence), health (latest checks and proposal-only triage), discover (cached enabled sources only), package_preview / export (revisionId, format; checked local download, never remote publication). External access and maintenance settings are owner-only. '
62
63
  + 'Deploy: "install_plan" (revisionId, targets): what an install would write where, with its checks; it installs nothing. Review: "review_submit" (revisionId, targets, releaseNotes, assumptions): the owner reviews and installs it; "review_list", "review_comment" (reviewId, body), "withdraw" (reviewId). '
63
- + 'After the owner installed it: "installations" (skillId | installationId): where it went, whether the bytes on disk are the approved ones, whether each runtime can find and use it, and what a running session needs to see it (read-only; the owner re-checks from Skills Studio).'
64
+ + 'After the owner installed it: "installations" (skillId | installationId): where it went, whether the bytes on disk are the approved ones, whether each runtime can find it (discoverable) and may use it (eligibility per runtime, from its settings), whether a runtime was asked, and what a running session needs to see it (read-only; SynaBun checks every install statically by itself right after writing it). '
65
+ + '"verify" (installationId | skillId: each active installation of it [+ probe]): runs that static check again now (the bytes, the folder rules, each runtime\'s settings; nothing is started) and answers as "installations" does; it changes no skill folder, setting or install, only the stored check. probe:true also asks Codex and OpenCode whether they list it (a short Codex app-server; OpenCode only while SynaBun\'s serve runs); Claude Code and Antigravity have no listing and can never be probed. Probe only when you must confirm that Codex or OpenCode sees it.'
64
66
  ),
65
67
  format: z.enum(['bundle', 'skill', 'portable', 'claude-upload', 'claude-plugin', 'claude-api', 'github']).optional().describe('package_preview / export: a checked immutable revision package; default bundle. No remote publication.'),
66
68
  q: z.string().max(200).optional().describe('catalog: text to look for in names and descriptions.'),
@@ -129,7 +131,8 @@ export const skillSchema = {
129
131
  creationId: z.string().max(40).optional().describe('create_status / create_cancel: the creation (crt_…).'),
130
132
  waitSeconds: z.number().int().min(0).max(MAX_WAIT_SECONDS).optional().describe(`create_status / eval_status: wait up to this many seconds for a change (0: answer now; at most ${MAX_WAIT_SECONDS}).`),
131
133
  since: z.number().int().min(-1).optional().describe('create_status / eval_status: the version you last saw (a wait returns when it changes).'),
132
- installationId: z.string().max(40).optional().describe('installations: one installation (ins_…).'),
134
+ installationId: z.string().max(40).optional().describe('installations / verify: one installation (ins_…).'),
135
+ probe: z.boolean().optional().describe('verify: also ask Codex and OpenCode whether they list the skill (default false: the static check only, nothing is started). Claude Code and Antigravity have no listing.'),
133
136
  evalRunId: z.string().max(40).optional().describe('eval_status / eval_cancel / eval_report: the evaluation (evr_…).'),
134
137
  trialId: z.string().max(10).optional().describe('eval_report: one trial of it (t001…): its answer, its grades, its trigger reading.'),
135
138
  purpose: z.enum(['evals', 'final', 'optimise']).optional().describe('eval_start: "evals" (default: the train and validation cases), "final" (only the held-out cases, once, before a publish), "optimise" (rewrite the description on the trigger cases; the best becomes a candidate version).'),
@@ -290,30 +293,80 @@ type Installation = {
290
293
  target?: { runtime?: string; scope?: string; accountId?: string; projectPath?: string | null } | null;
291
294
  destination?: { path?: string; affectedRuntimes?: string[] } | null;
292
295
  state?: { written?: boolean; writtenCheck?: string; verifiedDigest?: string | null; discoverable?: boolean | null; eligibility?: string;
293
- eligibilityByRuntime?: Record<string, string>; discovered?: Record<string, { discovered?: boolean | null }> | null;
296
+ eligibilityByRuntime?: Record<string, string>; eligibilityReasons?: Record<string, { kind?: string; file?: string; rule?: string; key?: string; pattern?: string; message?: string } | null>;
297
+ eligibilityNotChecked?: string[]; discovered?: Record<string, { discovered?: boolean | null; code?: string } | boolean | null> | null;
298
+ staticCheck?: { state?: string; trigger?: string; error?: string; at?: string } | null; probedAt?: string;
294
299
  refresh?: Array<{ runtime?: string; kind?: string; message?: string }>; checks?: Array<{ ok?: boolean; message?: string }>; checkedAt?: string } | null;
295
300
  };
296
301
 
302
+ /** Runtimes with a listing SynaBun can ask (neural-interface/lib/skills/deploy.js PROBEABLE_RUNTIMES). */
303
+ const PROBEABLE = new Set(['codex', 'opencode']);
304
+ const RUNTIME_NAME: Record<string, string> = { claude: 'Claude Code', codex: 'Codex', opencode: 'OpenCode', antigravity: 'Antigravity' };
305
+
306
+ /** Why a runtime's settings say what they say, in a few words (runtime-checks.js eligibilityDetail reasons). */
307
+ function reasonWords(runtime: string, r: NonNullable<NonNullable<Installation['state']>['eligibilityReasons']>[string]): string {
308
+ if (!r?.kind) return '';
309
+ switch (r.kind) {
310
+ case 'not-read': return `SynaBun does not read ${RUNTIME_NAME[runtime] || runtime}'s settings`;
311
+ case 'codex-config': return `turned off in ${r.file} ([[skills.config]] enabled = false)`;
312
+ case 'claude-override': return `turned off in ${r.file} (skillOverrides "${r.key}": "off")`;
313
+ case 'claude-deny': return `denied in ${r.file} (permissions.deny "${r.rule}")`;
314
+ case 'opencode-permission': return `denied in ${r.file} (skill rule "${r.pattern}")`;
315
+ case 'unreadable': return `${r.file} could not be read`;
316
+ case 'invalid-json': return `${r.file} is not valid JSON`;
317
+ case 'error': return `the check failed: ${r.message || 'error'}`;
318
+ default: return r.kind;
319
+ }
320
+ }
321
+
322
+ /** Per runtime: what asking it said, or why it was not asked (deploy.js probeStates, the same rules). */
323
+ function probeWords(runtimes: string[], discovered: NonNullable<Installation['state']>['discovered']): string {
324
+ const d = discovered && typeof discovered === 'object' ? discovered : {};
325
+ return runtimes.map((r) => {
326
+ const v = d[r];
327
+ const answer = v && typeof v === 'object' ? v.discovered : (typeof v === 'boolean' ? v : undefined);
328
+ const code = v && typeof v === 'object' ? v.code : undefined;
329
+ if (answer === true) return `${r} lists it`;
330
+ if (answer === false) return `${r} does not list it`;
331
+ if (!PROBEABLE.has(r) || code === 'no-list') return `${r} cannot be probed (no listing; its folder rules were checked)`;
332
+ if (code === 'terminal-only') return `${r} cannot be probed here (only an OpenCode in a terminal reads this folder)`;
333
+ if (v && typeof v === 'object') return `${r} was asked but did not answer (${code || 'no-answer'})`;
334
+ return `${r} not probed yet (verify probe:true asks it)`;
335
+ }).join('; ');
336
+ }
337
+
297
338
  /**
298
339
  * What the owner installed, as skill-forge's check after a publish reads it (the plan's §5.1.7): exact bytes (the
299
- * digest on disk at the last check against the one approved), whether each runtime can find and use it, and the
300
- * refresh a running session needs. The re-check itself is the owner's (Skills Studio): this only reads.
340
+ * digest on disk at the last check against the one approved), whether each runtime can find it and may use it (per
341
+ * runtime, with the runtimes SynaBun did not check named), whether each runtime was or can be asked, and the
342
+ * refresh a running session needs. A record from before the per-runtime fields reads as before.
301
343
  */
302
344
  export function installationsText(list: Installation[]): string {
303
345
  if (!list.length) return 'Not installed anywhere yet: the owner installs it from Skills Studio after approving the review.';
304
346
  return list.map((i) => {
305
347
  const t = i.target || {};
306
348
  const st = i.state || {};
349
+ const runtimes = Array.isArray(i.destination?.affectedRuntimes) && i.destination.affectedRuntimes.length ? i.destination.affectedRuntimes : (t.runtime ? [t.runtime] : []);
307
350
  const where = `${t.runtime || '?'} ${t.scope === 'project' ? `project ${t.projectPath}` : `user${t.accountId && t.accountId !== 'default' ? ` (account ${t.accountId})` : ''}`}`;
308
351
  const bytes = st.writtenCheck === 'verified' || (st.writtenCheck === undefined && st.written && st.verifiedDigest && st.verifiedDigest === i.export?.artifactDigest)
309
352
  ? 'the approved bytes'
310
353
  : st.writtenCheck === 'changed' ? 'CHANGED since the install (not the approved bytes)' : st.writtenCheck === 'missing' ? 'MISSING from its folder' : 'not checked yet';
311
- const found = st.discovered ? Object.entries(st.discovered).map(([r, d]) => `${r} ${d?.discovered === true ? 'found it' : d?.discovered === false ? 'did not find it' : 'unknown'}`).join(', ') : 'not probed';
354
+ const byRuntime = st.eligibilityByRuntime && typeof st.eligibilityByRuntime === 'object' ? st.eligibilityByRuntime : null;
355
+ const notChecked = Array.isArray(st.eligibilityNotChecked) ? st.eligibilityNotChecked : (byRuntime ? Object.keys(byRuntime).filter((r) => byRuntime[r] === 'not-checked') : []);
356
+ const aggregate = `${st.eligibility || 'unknown'}${notChecked.length && byRuntime && Object.keys(byRuntime).length > notChecked.length ? ` (over the runtimes checked; not checked: ${notChecked.join(', ')})` : ''}`;
357
+ const settings = byRuntime
358
+ ? Object.entries(byRuntime).map(([r, v]) => { const why = reasonWords(r, st.eligibilityReasons?.[r] || null); return `${r} ${v === 'not-checked' ? 'not checked' : v}${why ? ` (${why})` : ''}`; }).join('; ')
359
+ : '';
360
+ const checked = st.staticCheck?.state === 'ok' || st.discoverable === true || st.discoverable === false;
312
361
  const refresh = (st.refresh || []).map((r) => r.message).filter(Boolean).join(' ');
313
362
  const problems = (st.checks || []).filter((c) => c.ok === false).map((c) => c.message).filter(Boolean);
314
363
  return [
315
364
  `- ${i.installationId}${i.active === false ? ' (replaced)' : ''}: ${where} → ${i.destination?.path || '?'}, revision ${i.sourceRevisionId}`,
316
- ` bytes: ${bytes}; discoverable: ${st.discoverable === true ? 'yes' : st.discoverable === false ? 'no' : 'unknown'}; eligibility: ${st.eligibility || 'unknown'}; runtimes: ${found}${st.checkedAt ? `; checked ${st.checkedAt}` : ''}`,
365
+ ` bytes: ${bytes}; discoverable: ${st.discoverable === true ? 'yes' : st.discoverable === false ? 'no' : 'unknown'}; eligibility: ${aggregate}${checked && st.checkedAt ? `; checked ${st.checkedAt}` : ''}`,
366
+ ...(settings ? [` settings: ${settings}`] : []),
367
+ ...(runtimes.length ? [` runtimes: ${probeWords(runtimes, st.discovered)}${st.probedAt ? `; probed ${st.probedAt}` : ''}`] : []),
368
+ ...(st.staticCheck?.state === 'error' ? [` check after install failed: ${st.staticCheck.error || 'error'} (the install itself is in place; skill verify runs the check again)`] : []),
369
+ ...(!checked && st.staticCheck?.state !== 'error' ? [` not checked yet: skill verify installationId ${i.installationId} runs the static check`] : []),
317
370
  ...(problems.length ? [` problems: ${problems.slice(0, 4).join(' / ')}`] : []),
318
371
  ...(refresh ? [` refresh: ${refresh}`] : []),
319
372
  ].join('\n');
@@ -579,6 +632,26 @@ async function run(args: Args): Promise<Result> {
579
632
  const list = (args.installationId ? [res.installation] : (res.installations as Installation[] | undefined) || []) as Installation[];
580
633
  return text(cap(installationsText(list)));
581
634
  }
635
+ case 'verify': {
636
+ // The static check (or, with probe, Codex / OpenCode asked too) of one installation, or of every active one of
637
+ // a skill. Writes only the stored check (POST /installations/:id/check).
638
+ const body = { probe: args.probe === true };
639
+ let ids: string[];
640
+ if (args.installationId) ids = [args.installationId];
641
+ else if (args.skillId) {
642
+ res = await ni.skillsV2('GET', `/installations${qs({ skillId: args.skillId, active: 'true' })}`);
643
+ if (res.error) return failure(action, res);
644
+ ids = ((res.installations as Installation[] | undefined) || []).map((i) => i.installationId).slice(0, 20);
645
+ if (!ids.length) return text(installationsText([]));
646
+ } else return text('skill verify needs skillId or installationId.');
647
+ const checked: Installation[] = [];
648
+ for (const id of ids) {
649
+ res = await ni.skillsV2('POST', `/installations/${encodeURIComponent(id)}/check`, body);
650
+ if (res.error) return failure(action, res);
651
+ checked.push(res.installation as Installation);
652
+ }
653
+ return text(cap(`Checked ${checked.length === 1 ? '1 installation' : `${checked.length} installations`}${body.probe ? ' (Codex and OpenCode asked where they read the folder)' : ' statically (nothing was started)'}; no file or install was changed.\n${installationsText(checked)}`));
654
+ }
582
655
  default:
583
656
  return text(`Unknown skill action "${String(action)}".`);
584
657
  }
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod/v3';
2
2
  import { text } from './response.js';
3
3
  import { isBrowserV2Enabled, reportRuntimeTools, type RuntimeToolsReport } from '../services/neural-interface.js';
4
- import { ALWAYS_ON_TOOLS, GATED_GROUP_IDS, TOOL_GROUPS, sortGroups, toolsOfGroup } from '../services/tool-catalog.js';
5
- import { resolveToolList, type AddedGroup } from '../services/tool-list.js';
4
+ import { ALWAYS_ON_TOOLS, GATED_GROUP_IDS, TOOL_GROUPS, groupOfTool, sortGroups, toolGroup, toolsOfGroup } from '../services/tool-catalog.js';
5
+ import { describeToolListProblems, resolveToolList, type AddedGroup, type ToolListProblem } from '../services/tool-list.js';
6
6
  import { legacyProfileValue, persistRuntimeTools, runtimeToolsWithExternalRefs, type ToolApplyResult, type ToolRuntime } from '../services/tool-runtime.js';
7
7
 
8
8
  export const toolGroupsSchema = {
@@ -90,6 +90,20 @@ function changeNote(change: RuntimeToolsChange): string {
90
90
  return 'Loaded; continue after the refresh.';
91
91
  }
92
92
 
93
+ /**
94
+ * agents-p4: a `team` item (the group or its tool) asked of this runtime, said as what is true here: the team tool
95
+ * comes with a team slice and never with a list, so a runtime without team context is told it is for team workers
96
+ * only (not that it should have it), and one that has it is told it is there already.
97
+ */
98
+ function runtimeTeamProblem(problem: ToolListProblem, runtime: ToolRuntime): ToolListProblem {
99
+ const group = toolGroup(problem.item)?.gate ? problem.item : groupOfTool(problem.item);
100
+ if (problem.reason !== 'gated' || !group || toolGroup(group)?.gate !== 'context:team') return problem;
101
+ const hint = runtime.getActiveGroups().has(group)
102
+ ? `${group} is already in this runtime: this run works a team slice, so call the ${group} tool; no list adds or removes it`
103
+ : `the ${group} tool is for workers of a team slice only, and this runtime has no team context: SynaBun gives it to a team's worker by itself from its first turn, and no tool list or tool_groups call adds it`;
104
+ return { ...problem, hint };
105
+ }
106
+
93
107
  /** Keep what the runtime added before for the groups it still has, then what this change added. */
94
108
  function mergeAdded(previous: readonly AddedGroup[], next: readonly AddedGroup[], groups: readonly string[]): AddedGroup[] {
95
109
  const merged = new Map<string, AddedGroup>();
@@ -139,11 +153,12 @@ export async function handleToolGroups(runtime: ToolRuntime, args: { action: str
139
153
  if (args.groups.some(item => item.startsWith('mcp:'))) return text(JSON.stringify({ ok: false, code: 'TOOLS_INVALID', message: 'External MCP servers are fixed for this run; dispatch again with those refs in tools.' }));
140
154
  const resolved = resolveToolList(args.groups, { source: 'runtime' });
141
155
  if (!resolved.ok) {
156
+ const problems = resolved.problems.map((problem) => runtimeTeamProblem(problem, runtime));
142
157
  return text(JSON.stringify({
143
158
  ok: false,
144
159
  code: resolved.code,
145
- problems: resolved.problems,
146
- message: `${resolved.message}. Call tool_groups action="get" for the catalog.`,
160
+ problems,
161
+ message: `${describeToolListProblems(resolved.code, problems)}. Call tool_groups action="get" for the catalog.`,
147
162
  }, null, 2));
148
163
  }
149
164
  const groups = args.action === 'add' ? sortGroups([...runtime.getGroups(), ...resolved.groups]) : resolved.groups;