@sentropic/h2a 0.98.6 → 0.98.7-rc.10

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 (253) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +2 -1
  3. package/dist/bin-routing.d.ts.map +1 -1
  4. package/dist/bin-routing.js +23 -3
  5. package/dist/bin-routing.js.map +1 -1
  6. package/dist/bin.js +51 -4
  7. package/dist/bin.js.map +1 -1
  8. package/dist/cli-command-map.d.ts.map +1 -1
  9. package/dist/cli-command-map.js +1 -0
  10. package/dist/cli-command-map.js.map +1 -1
  11. package/dist/cli-contract.js +2 -2
  12. package/dist/cli-contract.js.map +1 -1
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +270 -45
  15. package/dist/cli.js.map +1 -1
  16. package/dist/focus-build.d.ts +10 -0
  17. package/dist/focus-build.d.ts.map +1 -0
  18. package/dist/focus-build.js +202 -0
  19. package/dist/focus-build.js.map +1 -0
  20. package/dist/focus-feedback.d.ts +30 -0
  21. package/dist/focus-feedback.d.ts.map +1 -0
  22. package/dist/focus-feedback.js +133 -0
  23. package/dist/focus-feedback.js.map +1 -0
  24. package/dist/hosts/agy.js +1 -1
  25. package/dist/hosts/agy.js.map +1 -1
  26. package/dist/hosts/installation-doctor.d.ts +1 -0
  27. package/dist/hosts/installation-doctor.d.ts.map +1 -1
  28. package/dist/hosts/installation-doctor.js +1 -1
  29. package/dist/hosts/installation-doctor.js.map +1 -1
  30. package/dist/hosts/muse.d.ts.map +1 -1
  31. package/dist/hosts/muse.js +2 -4
  32. package/dist/hosts/muse.js.map +1 -1
  33. package/dist/hosts/native-artifacts.d.ts +33 -0
  34. package/dist/hosts/native-artifacts.d.ts.map +1 -0
  35. package/dist/hosts/native-artifacts.js +104 -0
  36. package/dist/hosts/native-artifacts.js.map +1 -0
  37. package/dist/hosts/native-catalog.d.ts +19 -0
  38. package/dist/hosts/native-catalog.d.ts.map +1 -0
  39. package/dist/hosts/native-catalog.js +14 -0
  40. package/dist/hosts/native-catalog.js.map +1 -0
  41. package/dist/hosts/native-convergence.d.ts +169 -0
  42. package/dist/hosts/native-convergence.d.ts.map +1 -0
  43. package/dist/hosts/native-convergence.js +152 -0
  44. package/dist/hosts/native-convergence.js.map +1 -0
  45. package/dist/hosts/native-files.d.ts +46 -0
  46. package/dist/hosts/native-files.d.ts.map +1 -0
  47. package/dist/hosts/native-files.js +136 -0
  48. package/dist/hosts/native-files.js.map +1 -0
  49. package/dist/hosts/native-inspection.d.ts +31 -0
  50. package/dist/hosts/native-inspection.d.ts.map +1 -0
  51. package/dist/hosts/native-inspection.js +79 -0
  52. package/dist/hosts/native-inspection.js.map +1 -0
  53. package/dist/hosts/native-paths.d.ts +11 -0
  54. package/dist/hosts/native-paths.d.ts.map +1 -0
  55. package/dist/hosts/native-paths.js +21 -0
  56. package/dist/hosts/native-paths.js.map +1 -0
  57. package/dist/hosts/native-proof.d.ts +32 -0
  58. package/dist/hosts/native-proof.d.ts.map +1 -0
  59. package/dist/hosts/native-proof.js +31 -0
  60. package/dist/hosts/native-proof.js.map +1 -0
  61. package/dist/hosts/native-questions.d.ts +2 -0
  62. package/dist/hosts/native-questions.d.ts.map +1 -0
  63. package/dist/hosts/native-questions.js +22 -0
  64. package/dist/hosts/native-questions.js.map +1 -0
  65. package/dist/hosts/native-runtime-record.d.ts +3 -0
  66. package/dist/hosts/native-runtime-record.d.ts.map +1 -0
  67. package/dist/hosts/native-runtime-record.js +60 -0
  68. package/dist/hosts/native-runtime-record.js.map +1 -0
  69. package/dist/hosts/native-skills.d.ts +24 -0
  70. package/dist/hosts/native-skills.d.ts.map +1 -0
  71. package/dist/hosts/native-skills.js +56 -0
  72. package/dist/hosts/native-skills.js.map +1 -0
  73. package/dist/hosts/native-toml.d.ts +18 -0
  74. package/dist/hosts/native-toml.d.ts.map +1 -0
  75. package/dist/hosts/native-toml.js +93 -0
  76. package/dist/hosts/native-toml.js.map +1 -0
  77. package/dist/hosts/operator-notices.d.ts +3 -0
  78. package/dist/hosts/operator-notices.d.ts.map +1 -0
  79. package/dist/hosts/operator-notices.js +31 -0
  80. package/dist/hosts/operator-notices.js.map +1 -0
  81. package/dist/hosts/plugin.d.ts +30 -0
  82. package/dist/hosts/plugin.d.ts.map +1 -1
  83. package/dist/hosts/plugin.js +56 -4
  84. package/dist/hosts/plugin.js.map +1 -1
  85. package/dist/hosts/upgrade-equipment.d.ts +42 -0
  86. package/dist/hosts/upgrade-equipment.d.ts.map +1 -0
  87. package/dist/hosts/upgrade-equipment.js +26 -0
  88. package/dist/hosts/upgrade-equipment.js.map +1 -0
  89. package/dist/hosts/vibe-discovery.d.ts +12 -0
  90. package/dist/hosts/vibe-discovery.d.ts.map +1 -0
  91. package/dist/hosts/vibe-discovery.js +33 -0
  92. package/dist/hosts/vibe-discovery.js.map +1 -0
  93. package/dist/hosts/vibe-equipment.d.ts +73 -0
  94. package/dist/hosts/vibe-equipment.d.ts.map +1 -0
  95. package/dist/hosts/vibe-equipment.js +179 -0
  96. package/dist/hosts/vibe-equipment.js.map +1 -0
  97. package/dist/hosts/vibe-mcp.d.ts +32 -0
  98. package/dist/hosts/vibe-mcp.d.ts.map +1 -0
  99. package/dist/hosts/vibe-mcp.js +210 -0
  100. package/dist/hosts/vibe-mcp.js.map +1 -0
  101. package/dist/hosts/vibe.d.ts +12 -3
  102. package/dist/hosts/vibe.d.ts.map +1 -1
  103. package/dist/hosts/vibe.js +15 -7
  104. package/dist/hosts/vibe.js.map +1 -1
  105. package/dist/identity-operator-break.d.ts +31 -0
  106. package/dist/identity-operator-break.d.ts.map +1 -0
  107. package/dist/identity-operator-break.js +77 -0
  108. package/dist/identity-operator-break.js.map +1 -0
  109. package/dist/index.d.ts +1 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +1 -1
  112. package/dist/index.js.map +1 -1
  113. package/dist/runtime/agy-claude.d.ts +42 -0
  114. package/dist/runtime/agy-claude.d.ts.map +1 -0
  115. package/dist/runtime/agy-claude.js +140 -0
  116. package/dist/runtime/agy-claude.js.map +1 -0
  117. package/dist/runtime/focus/edit-receipts.d.ts +22 -0
  118. package/dist/runtime/focus/edit-receipts.d.ts.map +1 -0
  119. package/dist/runtime/focus/edit-receipts.js +46 -0
  120. package/dist/runtime/focus/edit-receipts.js.map +1 -0
  121. package/dist/runtime/live/contracts.d.ts +55 -0
  122. package/dist/runtime/live/contracts.d.ts.map +1 -0
  123. package/dist/runtime/live/contracts.js +59 -0
  124. package/dist/runtime/live/contracts.js.map +1 -0
  125. package/dist/runtime/local-files/identity-fence.d.ts.map +1 -1
  126. package/dist/runtime/local-files/identity-fence.js +2 -0
  127. package/dist/runtime/local-files/identity-fence.js.map +1 -1
  128. package/dist/runtime/local-files/orphan-gc.d.ts +3 -0
  129. package/dist/runtime/local-files/orphan-gc.d.ts.map +1 -0
  130. package/dist/runtime/local-files/orphan-gc.js +69 -0
  131. package/dist/runtime/local-files/orphan-gc.js.map +1 -0
  132. package/dist/runtime/local-files/presence.d.ts +5 -2
  133. package/dist/runtime/local-files/presence.d.ts.map +1 -1
  134. package/dist/runtime/local-files/presence.js +32 -29
  135. package/dist/runtime/local-files/presence.js.map +1 -1
  136. package/dist/runtime/local-files/recipient-hints.d.ts +10 -0
  137. package/dist/runtime/local-files/recipient-hints.d.ts.map +1 -0
  138. package/dist/runtime/local-files/recipient-hints.js +156 -0
  139. package/dist/runtime/local-files/recipient-hints.js.map +1 -0
  140. package/dist/runtime/local-files/store.d.ts.map +1 -1
  141. package/dist/runtime/local-files/store.js +22 -2
  142. package/dist/runtime/local-files/store.js.map +1 -1
  143. package/dist/runtime/loop/engine/adapters.d.ts.map +1 -1
  144. package/dist/runtime/loop/engine/adapters.js +7 -1
  145. package/dist/runtime/loop/engine/adapters.js.map +1 -1
  146. package/dist/runtime/mcp/agent-launch.d.ts +3 -0
  147. package/dist/runtime/mcp/agent-launch.d.ts.map +1 -1
  148. package/dist/runtime/mcp/agent-launch.js +93 -8
  149. package/dist/runtime/mcp/agent-launch.js.map +1 -1
  150. package/dist/runtime/mcp/handlers.d.ts +1 -0
  151. package/dist/runtime/mcp/handlers.d.ts.map +1 -1
  152. package/dist/runtime/mcp/handlers.js +7 -4
  153. package/dist/runtime/mcp/handlers.js.map +1 -1
  154. package/dist/runtime/mcp/notifications.d.ts +2 -1
  155. package/dist/runtime/mcp/notifications.d.ts.map +1 -1
  156. package/dist/runtime/mcp/notifications.js +16 -2
  157. package/dist/runtime/mcp/notifications.js.map +1 -1
  158. package/dist/runtime/mcp/server.d.ts +3 -0
  159. package/dist/runtime/mcp/server.d.ts.map +1 -1
  160. package/dist/runtime/mcp/server.js +19 -6
  161. package/dist/runtime/mcp/server.js.map +1 -1
  162. package/dist/runtime/mcp/sessions.d.ts +6 -6
  163. package/dist/runtime/mcp/sessions.d.ts.map +1 -1
  164. package/dist/runtime/mcp/sessions.js +18 -6
  165. package/dist/runtime/mcp/sessions.js.map +1 -1
  166. package/dist/runtime/mcp/stdio.d.ts.map +1 -1
  167. package/dist/runtime/mcp/stdio.js +11 -0
  168. package/dist/runtime/mcp/stdio.js.map +1 -1
  169. package/dist/runtime/mcp/tools.d.ts.map +1 -1
  170. package/dist/runtime/mcp/tools.js +11 -7
  171. package/dist/runtime/mcp/tools.js.map +1 -1
  172. package/dist/runtime/send.d.ts +10 -0
  173. package/dist/runtime/send.d.ts.map +1 -1
  174. package/dist/runtime/send.js +80 -5
  175. package/dist/runtime/send.js.map +1 -1
  176. package/dist/runtime/upgrade/index.d.ts +1 -0
  177. package/dist/runtime/upgrade/index.d.ts.map +1 -1
  178. package/dist/runtime/upgrade/index.js +1 -0
  179. package/dist/runtime/upgrade/index.js.map +1 -1
  180. package/dist/vendor/engram-live/contracts.d.ts +825 -0
  181. package/dist/vendor/engram-live/contracts.js +1734 -0
  182. package/fixtures/native-host-catalog.json +1 -0
  183. package/fixtures/native-host-history.json +1261 -0
  184. package/fixtures/native-host-renderers.json +1 -0
  185. package/focus-app/client/_app/immutable/chunks/{unQroC_0.js → BXS4ok-I.js} +2 -2
  186. package/focus-app/client/_app/immutable/chunks/BXS4ok-I.js.br +0 -0
  187. package/focus-app/client/_app/immutable/chunks/BXS4ok-I.js.gz +0 -0
  188. package/focus-app/client/_app/immutable/entry/{app.75Uzo4oj.js → app.BJwKYx8S.js} +2 -2
  189. package/focus-app/client/_app/immutable/entry/app.BJwKYx8S.js.br +0 -0
  190. package/focus-app/client/_app/immutable/entry/app.BJwKYx8S.js.gz +0 -0
  191. package/focus-app/client/_app/immutable/entry/start.to_m_bSO.js +1 -0
  192. package/focus-app/client/_app/immutable/entry/start.to_m_bSO.js.br +2 -0
  193. package/focus-app/client/_app/immutable/entry/start.to_m_bSO.js.gz +0 -0
  194. package/focus-app/client/_app/immutable/nodes/{1.hqfmE-jM.js → 1.CvN150m3.js} +1 -1
  195. package/focus-app/client/_app/immutable/nodes/1.CvN150m3.js.br +3 -0
  196. package/focus-app/client/_app/immutable/nodes/1.CvN150m3.js.gz +0 -0
  197. package/focus-app/client/_app/version.json +1 -1
  198. package/focus-app/client/_app/version.json.br +0 -0
  199. package/focus-app/client/_app/version.json.gz +0 -0
  200. package/focus-app/h2a-focus.json +29 -29
  201. package/focus-app/handler.js +4 -4
  202. package/focus-app/index.js +4 -4
  203. package/focus-app/server/chunks/chunks/{internal.js-vq85iWAx.js → internal.js-BORbEOh-.js} +2 -2
  204. package/focus-app/server/chunks/chunks/{internal.js-vq85iWAx.js.map → internal.js-BORbEOh-.js.map} +1 -1
  205. package/focus-app/server/chunks/{handler-f-0S9j72.js → handler-Ccwb0eyC.js} +3 -3
  206. package/focus-app/server/chunks/{handler-f-0S9j72.js.map → handler-Ccwb0eyC.js.map} +1 -1
  207. package/focus-app/server/chunks/{index.js-DlbaFcic.js → index.js-CzPOZLjV.js} +2 -2
  208. package/focus-app/server/chunks/{index.js-DlbaFcic.js.map → index.js-CzPOZLjV.js.map} +1 -1
  209. package/focus-app/server/chunks/{manifest.js-CxrShg-z.js → manifest.js-E-BEcOes.js} +3 -3
  210. package/focus-app/server/chunks/{manifest.js-CxrShg-z.js.map → manifest.js-E-BEcOes.js.map} +1 -1
  211. package/focus-app/server/chunks/nodes/{1.js-O2SZgyXK.js → 1.js-BJ_PpMI-.js} +2 -2
  212. package/focus-app/server/chunks/nodes/{1.js-O2SZgyXK.js.map → 1.js-BJ_PpMI-.js.map} +1 -1
  213. package/focus-kit/dossier.evidence.template.json +206 -0
  214. package/focus-kit/dossier.schema.json +193 -0
  215. package/focus-kit/dossier.template.json +39 -0
  216. package/focus-kit/dossier.v2.schema.json +925 -0
  217. package/focus-kit/ecosystem.json +853 -0
  218. package/focus-kit/renderer-manifest.json +48 -0
  219. package/focus-kit/renderer.html +278 -0
  220. package/focus-kit/validator.mjs +1128 -0
  221. package/hooks/deny-manual-h2a-cli.mjs +38 -0
  222. package/hooks/hooks.json +17 -0
  223. package/hooks/vibe-post-agent.mjs +29 -0
  224. package/hooks/vibe-pre-tool.mjs +40 -0
  225. package/hooks/workspace-scope-grant.mjs +22 -0
  226. package/hooks/workspace-scope-guard.mjs +277 -0
  227. package/hooks/workspace-scope-shell.mjs +564 -0
  228. package/hooks/workspace-scope-state.mjs +71 -0
  229. package/hooks/workspace-scope.opt-in.json +17 -0
  230. package/package.json +24 -8
  231. package/scripts/qualification-budget.mjs +56 -0
  232. package/scripts/qualification-cleanup.mjs +15 -0
  233. package/scripts/qualification-oracles.mjs +44 -0
  234. package/scripts/qualification-patch.mjs +21 -0
  235. package/scripts/qualification-poll-hosts.mjs +19 -0
  236. package/scripts/qualification-probe.mjs +63 -0
  237. package/scripts/qualification-rpc.mjs +59 -0
  238. package/scripts/qualification-vibe.mjs +159 -0
  239. package/scripts/qualify-host.mjs +143 -0
  240. package/skills/h2a/SKILL.md +25 -2
  241. package/skills/h2a-run/SKILL.md +20 -1
  242. package/skills/harness/SKILL.md +19 -0
  243. package/skills/harness/track-report/SKILL.md +78 -5
  244. package/skills/harness/using-harness/SKILL.md +19 -0
  245. package/focus-app/client/_app/immutable/chunks/unQroC_0.js.br +0 -0
  246. package/focus-app/client/_app/immutable/chunks/unQroC_0.js.gz +0 -0
  247. package/focus-app/client/_app/immutable/entry/app.75Uzo4oj.js.br +0 -0
  248. package/focus-app/client/_app/immutable/entry/app.75Uzo4oj.js.gz +0 -0
  249. package/focus-app/client/_app/immutable/entry/start.BmwiFFoe.js +0 -1
  250. package/focus-app/client/_app/immutable/entry/start.BmwiFFoe.js.br +0 -2
  251. package/focus-app/client/_app/immutable/entry/start.BmwiFFoe.js.gz +0 -0
  252. package/focus-app/client/_app/immutable/nodes/1.hqfmE-jM.js.br +0 -3
  253. package/focus-app/client/_app/immutable/nodes/1.hqfmE-jM.js.gz +0 -0
package/dist/cli.js CHANGED
@@ -37,6 +37,7 @@
37
37
  * (`H2A_CLI_VERB_CONTRACTS`). Human-readable reference: `docs/cli-contract.md`.
38
38
  */
39
39
  import { execFileSync, spawn, spawnSync } from "node:child_process";
40
+ import { readAgyClaudeQuotaStatus } from "./runtime/agy-claude.js";
40
41
  import { generateKeyPairSync } from "node:crypto";
41
42
  import { once } from "node:events";
42
43
  import { chmodSync, copyFileSync, existsSync, mkdirSync, readdirSync, realpathSync, readFileSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
@@ -62,6 +63,14 @@ import { runHarnessCli, HARNESS_SKILLS } from "./vendor/harness/index.js";
62
63
  import { buildLaunchIndex } from "./runtime/local-files/launch-index.js";
63
64
  import { renderCommandMap } from "./cli-command-map.js";
64
65
  import { resolveHostConfigRoot } from "./runtime/host-config-root.js";
66
+ import { isNativeHost, NATIVE_HOSTS, REGISTRY_WAITING, stateRoot, vibeHome } from "./hosts/native-paths.js";
67
+ import { convergeNativeHost } from "./hosts/native-convergence.js";
68
+ import { nativeSkillArtifacts } from "./hosts/native-skills.js";
69
+ import { NATIVE_QUESTION_GUIDANCE } from "./hosts/native-questions.js";
70
+ import { assertNativePath, atomicNativeWrite, snapshot as snapshotNativeFile } from "./hosts/native-files.js";
71
+ import { clearVibeDirectRemoved, editVibeMcpServers, setVibeDirectRemoved, VIBE_MCP_NAME } from "./hosts/vibe-mcp.js";
72
+ import { convergeAfterExplicitUpgrade } from "./hosts/upgrade-equipment.js";
73
+ import { captureHostOperatorNotices } from "./hosts/operator-notices.js";
65
74
  import { H2A_ATTESTER_COMPREHENSION_RIGHT, H2A_COMPREHENSION_ATTESTATION_BODY_KIND, H2A_DECLARATION_INTERET_BODY_KIND, H2A_ORG_MANIFEST_FILENAME, H2A_ORG_PROPOSAL_BODY_KIND, H2A_ORG_RATIFIED_BODY_KIND, H2A_ROLES, H2A_WORK_STATUSES, auditNhiPosture, buildComprehensionAttestation, canAttestComprehension, checkEnvelopeFreshness, computeHash, createEnvelope, deriveWorkspaceId, diffOrgManifest, effectiveOrgInstances, isComprehensionAttestation, nhiAttestationEnvelope, nhiInventory, deriveConnectionConfidence, nhiTrustBundle, orgAssignmentEnvelope, parseOrgManifest, signCanonical, signEnvelope, subagentAddress, validateOrgManifest, verifyComprehensionAttestation } from "@sentropic/h2a";
66
75
  import { H2A_CLAUDE_HOST } from "./hosts/claude.js";
67
76
  import { H2A_CODEX_HOST } from "./hosts/codex.js";
@@ -73,7 +82,7 @@ import { H2A_MUSE_HOST } from "./hosts/muse.js";
73
82
  import { H2A_VIBE_HOST } from "./hosts/vibe.js";
74
83
  import { doctorHostInstallations, findLiveSessionsPredatingHostConfig, inspectLegacyAccountArtifacts } from "./hosts/installation-doctor.js";
75
84
  import { H2A_CLI_MCP_TOOL_NAMES } from "./mcp.js";
76
- import { renderStopHook, claudeStopHookEntry, claudeDriveReceiveHookEntry, isH2ADriveReceiveHook, isH2ARecordHook, codexPluginManifest, codexMarketplaceManifest, codexPluginTrustCommands, H2A_CODEX_PLUGIN_NAME, H2A_HOST_PLUGIN_HOSTS } from "./hosts/plugin.js";
85
+ import { renderStopHook, claudeStopHookEntry, renderWorkspaceScope, agyWorkspaceScopeDefinition, withoutWorkspaceScopeGuardHooks, claudeDriveReceiveHookEntry, isH2ADriveReceiveHook, isH2ARecordHook, codexPluginManifest, codexMarketplaceManifest, codexPluginTrustCommands, H2A_CODEX_PLUGIN_NAME, H2A_HOST_PLUGIN_HOSTS } from "./hosts/plugin.js";
77
86
  import { H2A_STORE_SCHEMA_VERSION, assertHostQualifiedAddress, canonicalAddress, createLocalStore, listPresence, reapAllDeadPresence, reapDeadInstancePresence, readPresence, resolveRecipient, safePathSegment, sanitizeStorePaths, writePresence } from "./runtime/local-files/index.js";
78
87
  import { messageBackend, sendMessage } from "./runtime/send.js";
79
88
  import { getActiveMcpTrace, H2A_MCP_READY_FILE_ENV, H2A_MCP_READY_NONCE_ENV, runMcpStdio } from "./runtime/mcp/index.js";
@@ -263,9 +272,9 @@ export function renderCliHelp() {
263
272
  " h2a drumbeat escalations [--root <path>]",
264
273
  " h2a drumbeat relance-inbox [--instance <id>] [--relauncher logging|local-tmux|headless|auto] [--root <path>]",
265
274
  " h2a drumbeat watch [--interval-ms <n>] [--max-relances <n>] [--relauncher logging|local-tmux|remote|headless|auto] [--instance <signer> --private-key <pem>] [--decider logging|<command>] [--decider-after <k>] [--decider-enforce] [--root <path>]",
266
- " h2a host setup --host <codex|claude|gemini|agy|hermes|opencode|muse|vibe> [--endpoint local|remote] [--url <https://…/mcp>] [--root <path>] [--print | --write <file>] [--force] [--no-wake] (selects exactly one h2a endpoint; local renders mcp-serve --auto-open --auto-upgrade --wake auto by default)",
275
+ " h2a host setup --host <codex|claude|gemini|agy|hermes|opencode|muse|vibe> [--endpoint local|remote] [--url <https://…/mcp>] [--root <path>] [--print | --write <file>] [--force] [--no-wake] (selects one endpoint; Muse/agy render nonrecommended historical direct paths pending registry bootstrap; Vibe --write installs the interim direct entry pending registry bootstrap (--remove clears it for migration))",
267
276
  " h2a host status [--host <name>]",
268
- " h2a host plugin --host <codex|claude|gemini|agy|hermes|opencode|muse|vibe> --instance <id> [--status <work-status>] [--root <path>] [--write <settings.json> [--force]] [--scaffold <dir>] (--write installs the Stop hook for claude|gemini|codex|hermes|opencode; --scaffold writes codex's full local marketplace + trust step; vibe records via a post_agent hook in ~/.vibe/hooks.toml; agy and muse are poll-only)",
277
+ " h2a host plugin --host <codex|claude|gemini|agy|hermes|opencode|muse|vibe> --instance <id> [--status <work-status>] [--root <path>] [--write <settings.json|hooks.toml> [--force]] [--scaffold <dir>] [--workspace-scope on|off] (--write installs the Stop hook for claude|gemini|codex|hermes|opencode; --scaffold writes codex's full local marketplace + trust step; vibe writes its explicit parent-only wrapper to VIBE_HOME/hooks.toml; workspace scope is off by default and requires isolated lab qualification before opt-in)",
269
278
  " h2a store migrate [--from <v>] [--to <v>] [--sanitize-paths] [--dry-run] [--root <path>]",
270
279
  " h2a store index-launch --root <absolute-path> (derived indexes; original logs retained)",
271
280
  "",
@@ -274,7 +283,7 @@ export function renderCliHelp() {
274
283
  " h2a conductor [--workspace <id|path>] [--root <path>] (who is the live conductor/owner of a workspace — derived from presence; conductor=role CONDUCTOR if set, else null; candidates=in-workspace live agents)",
275
284
  " h2a conductor-launch-check [--workspace <id|path>] [--root <path>] [--idle-ms <ms>] (DRY-RUN: polls track workspace-activity; recommends launching a conductor if work is stalled and none is live — h2a does NOT spawn; launch parked pending spawn policy + remote)",
276
285
  " h2a conductor-launch --workspace <id|path> [--root <path>] [--idle-ms <ms>] [--confirm] [--remote <instance>] [--instance <self>] (D3 EMIT: if stalled+no conductor, emits a launch-REQUEST envelope to a live remote agent — gated by --confirm + 1/30min/workspace cap; h2a NEVER spawns; remote does the actual spawn)",
277
- " h2a doctor [--root <path>] [--scan <dir>] [--prune] [--repair] [--dry-run] (--repair converges Claude/Codex plugin installs; --repair --dry-run reports host findings/actions without changing them; --prune deletes host-less/phantom/orphan inbox dirs + stray buses; dry-run by default)",
286
+ " h2a doctor [--root <path>] [--scan <dir>] [--prune] [--repair] [--dry-run] [--host <name>] [--skip-hosts] [--guard on|off] [--lifecycle on|off] [--workspace-scope on|off] (--repair converges detected host components; --repair --dry-run reports host findings/actions without changing them; --prune deletes host-less/phantom/orphan inbox dirs + stray buses; dry-run by default)",
278
287
  " h2a keepalive [--root <path>] [--interval <ms>] [--once] (external keepalive prober — refreshes presence for agents whose tmux pane is still alive)",
279
288
  " h2a rename --instance <id> --name <name> [--root <path>] (set a live session's display name so peers can find it via discover --name)",
280
289
  " h2a status [--root <path>] [--scope <s>] [--instance <i>]",
@@ -294,7 +303,7 @@ export function renderCliHelp() {
294
303
  " h2a blockage list [--scope <s>] [--active] [--root <path>]",
295
304
  " h2a blockage resolve --instance <id> [--by <id>] [--root <path>]",
296
305
  " h2a sysml verify --json <envelope> --public-key <pem-file> [--by <id>] [--content-integrity --api-base <url> [--auth <token>]]",
297
- " h2a install-skills --host <claude|codex|gemini|agy|muse|vibe> [--scope user|project] [--force]",
306
+ " h2a install-skills --host <claude|codex|gemini|agy|muse|vibe> [--scope user|project] [--force] [--workspace-scope on|off] (native workspace scope guard: opt-in, off by default)",
298
307
  " h2a deploy k8s-sidecar [--instance <id>] [--host <h>] [--root <path>] [--image <ref>] [--cli-version <ver>] [--write <file>]",
299
308
  " h2a deploy k8s-tenant [--namespace <ns>] [--root <path>] [--replicas <n>] [--storage <size>] [--storage-class <sc>] [--lease-ms <ms>] [--image <ref>] [--cli-version <ver>] [--write <file>]",
300
309
  " h2a loop create --name <n> --goal <text> [--auto-tick] [--repo <path[:role]>] [--track <json>] [--agent <host:role:placement> [--launch-stdin]] [--root <path>]",
@@ -314,6 +323,9 @@ export function renderCliHelp() {
314
323
  " h2a report-context --workspace-root <absolute-path> [--root <h2a-store>]",
315
324
  "",
316
325
  "Focus Web (packaged production app):",
326
+ " h2a focus build <dossier.json> -o <file.html> (validated portable DS dossier; offline)",
327
+ " h2a focus feedback retain|apply … --state <dir> (manual edit returns; explicit retained baseline)",
328
+ " h2a focus template -o <dossier.json> (editable DecisionDossierDocument example)",
317
329
  " h2a focus serve [--repo <path>] [--track-events <path>] [--host <host>] [--port <0-65535>]",
318
330
  " h2a focus web [--repo <path>] [--track-events <path>] [--host <host>] [--port <0-65535>] (exact alias)",
319
331
  " (defaults to the nearest tracked repo and 127.0.0.1:5178; bare `h2a focus …` remains the Track facade)",
@@ -1486,19 +1498,20 @@ export function cmdUpgrade(flags, streams, runtime) {
1486
1498
  // the boot auto-upgrade (bounded — no infinite terminal wait). No cachePath is
1487
1499
  // passed, so it always checks fresh and is never throttled for an explicit run.
1488
1500
  const result = performAutoUpgrade(current, { ...(runtime ? { runtime } : {}) });
1501
+ const hosts = convergeAfterExplicitUpgrade(result, flags);
1489
1502
  if (result.outcome === "upgraded") {
1490
- streams.stdout.write(`${JSON.stringify({ ok: true, current, latest: result.target, upgraded: true, verified: result.verifiedVersion, package: H2A_CLI_PACKAGE, ...(result.logPath ? { log: result.logPath } : {}) }, null, 2)}\n`);
1503
+ streams.stdout.write(`${JSON.stringify({ ok: true, current, latest: result.target, upgraded: true, verified: result.verifiedVersion, package: H2A_CLI_PACKAGE, hosts, ...(result.logPath ? { log: result.logPath } : {}) }, null, 2)}\n`);
1491
1504
  return 0;
1492
1505
  }
1493
1506
  if (result.outcome === "already-current") {
1494
- streams.stdout.write(`${JSON.stringify({ ok: true, current, latest: result.target ?? current, upgraded: false, reason: "already current or registry unreachable" }, null, 2)}\n`);
1507
+ streams.stdout.write(`${JSON.stringify({ ok: true, current, latest: result.target ?? current, upgraded: false, hosts, reason: "already current or registry unreachable" }, null, 2)}\n`);
1495
1508
  return 0;
1496
1509
  }
1497
1510
  // The target is published but not yet installable (propagation delay). A full
1498
1511
  // `npm i -g` would hit the same registry and fail too, so we do not force it;
1499
1512
  // the staged path retries on a later run. Nothing was mutated.
1500
1513
  if (result.outcome === "deferred-propagation") {
1501
- streams.stdout.write(`${JSON.stringify({ ok: true, current, latest: result.target, upgraded: false, reason: "update published but not yet installable; retry later", ...(result.logPath ? { log: result.logPath } : {}) }, null, 2)}\n`);
1514
+ streams.stdout.write(`${JSON.stringify({ ok: true, current, latest: result.target, upgraded: false, hosts, reason: "update published but not yet installable; retry later", ...(result.logPath ? { log: result.logPath } : {}) }, null, 2)}\n`);
1502
1515
  return 0;
1503
1516
  }
1504
1517
  // skipped-locked / failed.
@@ -3625,6 +3638,105 @@ function driveLineFromHookInput(raw) {
3625
3638
  }
3626
3639
  return driveLineFromText(raw);
3627
3640
  }
3641
+ function resolveVibeSetupTarget(flags) {
3642
+ if (flags.write && flags.write !== "true")
3643
+ return flags.write;
3644
+ return join(vibeHome(), "config.toml");
3645
+ }
3646
+ function vibeWantedEntry(snippet) {
3647
+ const incoming = snippet.config.mcpServers.h2a;
3648
+ if (typeof incoming.url === "string")
3649
+ return { name: VIBE_MCP_NAME, transport: "streamable-http", url: incoming.url };
3650
+ return { name: VIBE_MCP_NAME, transport: "stdio", command: incoming.command ?? "h2a", args: [...(incoming.args ?? ["mcp-serve"])] };
3651
+ }
3652
+ function vibeStateForTarget(targetPath) {
3653
+ return stateRoot("vibe", dirname(resolvePath(targetPath)));
3654
+ }
3655
+ function cmdVibeSetupWrite(flags, streams, snippet, endpoint) {
3656
+ const targetPath = resolveVibeSetupTarget(flags);
3657
+ if (!targetPath.toLowerCase().endsWith(".toml")) {
3658
+ streams.stderr.write(`h2a host setup: --write for Vibe MCP supports TOML only and will not rewrite ${targetPath}. Use the default <VIBE_HOME>/config.toml.\n`);
3659
+ return 1;
3660
+ }
3661
+ const wanted = vibeWantedEntry(snippet);
3662
+ let original;
3663
+ try {
3664
+ if (!existsSync(targetPath))
3665
+ original = "";
3666
+ else
3667
+ original = readFileSync(targetPath, "utf8");
3668
+ }
3669
+ catch (error) {
3670
+ streams.stderr.write(`h2a host setup: cannot read ${targetPath} (${error.message})\n`);
3671
+ return 3;
3672
+ }
3673
+ let edited;
3674
+ try {
3675
+ edited = editVibeMcpServers(original, wanted);
3676
+ }
3677
+ catch (error) {
3678
+ streams.stderr.write(`h2a host setup: ${targetPath} refused (${error.message}); invalid or incompatible TOML is never overwritten, even with --force.\n`);
3679
+ return 2;
3680
+ }
3681
+ if (!edited.changed) {
3682
+ clearVibeDirectRemoved(vibeStateForTarget(targetPath));
3683
+ streams.stdout.write(`${JSON.stringify({ ok: true, host: "vibe", endpoint, path: targetPath, merged: false, replacedH2a: false, removedH2aMcpServers: [], migration: "voie directe — non migrée" }, null, 2)}\n`);
3684
+ return 0;
3685
+ }
3686
+ try {
3687
+ atomicNativeWrite(targetPath, edited.text, { state: vibeStateForTarget(targetPath), expected: snapshotNativeFile(targetPath) });
3688
+ }
3689
+ catch (error) {
3690
+ streams.stderr.write(`h2a host setup: cannot write ${targetPath} (${error.message})\n`);
3691
+ return 3;
3692
+ }
3693
+ clearVibeDirectRemoved(vibeStateForTarget(targetPath));
3694
+ streams.stdout.write(`${JSON.stringify({ ok: true, host: "vibe", endpoint, path: targetPath, merged: true, replacedH2a: edited.replacedH2a, removedH2aMcpServers: edited.removed, migration: "voie directe — non migrée" }, null, 2)}\n`);
3695
+ streams.stderr.write(`# wrote the interim direct mcp_servers.h2a endpoint for host=vibe to ${targetPath} (owner 16/10, derogation O7.2; migration R5/R7: h2a host setup --host vibe --remove)\n# disabled duplicate h2a MCP entries: ${edited.removed.join(", ") || "none"}\n# ${snippet.path.hint}\n`);
3696
+ return 0;
3697
+ }
3698
+ function cmdVibeSetupRemove(flags, streams) {
3699
+ const targetPath = resolveVibeSetupTarget(flags);
3700
+ if (!targetPath.toLowerCase().endsWith(".toml")) {
3701
+ streams.stderr.write(`h2a host setup: --remove for Vibe MCP supports TOML only and will not rewrite ${targetPath}. Use the default <VIBE_HOME>/config.toml.\n`);
3702
+ return 1;
3703
+ }
3704
+ let original;
3705
+ try {
3706
+ if (!existsSync(targetPath))
3707
+ original = "";
3708
+ else
3709
+ original = readFileSync(targetPath, "utf8");
3710
+ }
3711
+ catch (error) {
3712
+ streams.stderr.write(`h2a host setup: cannot read ${targetPath} (${error.message})\n`);
3713
+ return 3;
3714
+ }
3715
+ let edited;
3716
+ try {
3717
+ edited = editVibeMcpServers(original, null);
3718
+ }
3719
+ catch (error) {
3720
+ streams.stderr.write(`h2a host setup: ${targetPath} refused (${error.message}); invalid or incompatible TOML is never overwritten, even with --force.\n`);
3721
+ return 2;
3722
+ }
3723
+ if (!edited.changed) {
3724
+ setVibeDirectRemoved(vibeStateForTarget(targetPath));
3725
+ streams.stdout.write(`${JSON.stringify({ ok: true, host: "vibe", path: targetPath, removed: false, migration: REGISTRY_WAITING }, null, 2)}\n`);
3726
+ return 0;
3727
+ }
3728
+ try {
3729
+ atomicNativeWrite(targetPath, edited.text, { state: vibeStateForTarget(targetPath), expected: snapshotNativeFile(targetPath) });
3730
+ }
3731
+ catch (error) {
3732
+ streams.stderr.write(`h2a host setup: cannot write ${targetPath} (${error.message})\n`);
3733
+ return 3;
3734
+ }
3735
+ setVibeDirectRemoved(vibeStateForTarget(targetPath));
3736
+ streams.stdout.write(`${JSON.stringify({ ok: true, host: "vibe", path: targetPath, removed: true, removedH2aMcpServers: edited.removed, migration: REGISTRY_WAITING }, null, 2)}\n`);
3737
+ streams.stderr.write(`# removed the interim direct mcp_servers.h2a endpoint for host=vibe from ${targetPath}; registry bootstrap expected.\n`);
3738
+ return 0;
3739
+ }
3628
3740
  function cmdHostSetup(flags, streams, options) {
3629
3741
  const host = flags.host;
3630
3742
  if (!host) {
@@ -3714,9 +3826,16 @@ function cmdHostSetup(flags, streams, options) {
3714
3826
  }
3715
3827
  const targetPath = flags.write;
3716
3828
  const printMode = flags.print === "true" || !targetPath;
3829
+ if (host === "vibe" && flags.remove === "true") {
3830
+ return cmdVibeSetupRemove(flags, streams);
3831
+ }
3832
+ if (host === "vibe" && targetPath) {
3833
+ return cmdVibeSetupWrite(flags, streams, snippet, endpoint);
3834
+ }
3717
3835
  if (printMode && !targetPath) {
3718
- streams.stdout.write(`${JSON.stringify(snippet.config, null, 2)}\n`);
3719
- streams.stderr.write(`# ${host} — selected ${endpoint} h2a endpoint; paste this snippet under \`mcpServers\` in:\n# ${snippet.path.hint}\n# example path: ${snippet.path.example}\n`);
3836
+ streams.stdout.write(`${JSON.stringify(isNativeHost(host) ? { ...snippet.config, migration: REGISTRY_WAITING, hint: snippet.path.hint } : snippet.config, null, 2)}\n`);
3837
+ streams.stderr.write(isNativeHost(host) ? `# ${host}: rendu historique non recommandé; ${REGISTRY_WAITING}.\n# ${snippet.path.hint}\n` :
3838
+ `# ${host} — selected ${endpoint} h2a endpoint; paste this snippet under \`mcpServers\` in:\n# ${snippet.path.hint}\n# example path: ${snippet.path.example}\n`);
3720
3839
  return reportHostSetupCoherence(host, streams, options) ? 0 : 2;
3721
3840
  }
3722
3841
  if (isUnsupportedHostWritePath(host, targetPath)) {
@@ -3803,6 +3922,7 @@ function cmdHostSetup(flags, streams, options) {
3803
3922
  replacedH2a,
3804
3923
  removedH2aMcpServers,
3805
3924
  removedTrackMcpServers,
3925
+ ...(isNativeHost(host) ? { migration: "voie directe — non migrée" } : {}),
3806
3926
  ...(coherent ? {} : { next: "h2a doctor --repair" })
3807
3927
  }, null, 2)}\n`);
3808
3928
  streams.stderr.write(`# wrote the selected ${endpoint} mcpServers.h2a endpoint for host=${host} to ${targetPath}\n# disabled duplicate h2a MCP entries: ${removedH2aMcpServers.join(", ") || "none"}\n# disabled standalone Track MCP entries: ${removedTrackMcpServers.join(", ") || "none"}\n# ${snippet.path.hint}\n`);
@@ -3865,7 +3985,17 @@ function cmdHostStatus(flags, streams) {
3865
3985
  mcpAdapterShipped,
3866
3986
  hostSetupShipped,
3867
3987
  hostScenarioShipped,
3868
- summary
3988
+ summary: hostScenarioShipped ? summary.replace('scenario shipped', 'rendu testé') : summary,
3989
+ ...(isNativeHost(descriptor.host) ? { native: (() => {
3990
+ try {
3991
+ return nativeHostReport(descriptor.host, flags, false, false, undefined, streams.cwd?.());
3992
+ }
3993
+ catch (error) {
3994
+ return { ok: false, installation: 'inspection impossible', error: error.message };
3995
+ }
3996
+ })() } : {
3997
+ convergence: ['claude', 'codex'].includes(descriptor.host) ? 'historical doctor convergence; native parity unverified; registry non migré' : 'non couvert'
3998
+ })
3869
3999
  };
3870
4000
  });
3871
4001
  streams.stdout.write(`${JSON.stringify({ ok: true, hosts }, null, 2)}\n`);
@@ -3877,6 +4007,10 @@ function cmdHostStatus(flags, streams) {
3877
4007
  * relance. Mirrors `host setup` (h2a renders, the host runtime places it).
3878
4008
  */
3879
4009
  function cmdHostPlugin(flags, streams) {
4010
+ if (flags['workspace-scope'] !== undefined && !['on', 'off'].includes(flags['workspace-scope'])) {
4011
+ streams.stderr.write('h2a host plugin: workspace-scope must be on or off\n');
4012
+ return 1;
4013
+ }
3880
4014
  if (!flags.host) {
3881
4015
  streams.stderr.write(`h2a host plugin: --host <${H2A_HOST_PLUGIN_HOSTS.join("|")}> is required\n`);
3882
4016
  return 1;
@@ -3885,6 +4019,24 @@ function cmdHostPlugin(flags, streams) {
3885
4019
  streams.stderr.write("h2a host plugin: --instance <id> is required\n");
3886
4020
  return 1;
3887
4021
  }
4022
+ if (flags.host === 'vibe') {
4023
+ try {
4024
+ if (flags.instance === 'auto')
4025
+ throw new Error('non disponible — interface B non livrée');
4026
+ if (flags.write && resolvePath(flags.write) !== join(vibeHome(), 'hooks.toml')) {
4027
+ streams.stderr.write('h2a host plugin: this target is not available for vibe; post_agent requires the effective <VIBE_HOME>/hooks.toml TOML file.\n');
4028
+ return 1;
4029
+ }
4030
+ const result = nativeHostReport('vibe', flags, !!flags.write, false, undefined, streams.cwd?.());
4031
+ streams.stdout.write(`${JSON.stringify({ ...result, push: true, mechanism: 'vibe-hooks', record: 'rendered' in result ? result.rendered : '',
4032
+ receive: 'N-A', hint: 'post_agent in <VIBE_HOME>/hooks.toml; ' + ('lifecycleScope' in result ? result.lifecycleScope : 'hôte absent') }, null, 2)}\n`);
4033
+ return result.ok ? 0 : 2;
4034
+ }
4035
+ catch (error) {
4036
+ streams.stderr.write(`h2a host plugin: ${error.message}\n`);
4037
+ return 2;
4038
+ }
4039
+ }
3888
4040
  const render = renderStopHook(flags.host, {
3889
4041
  instance: flags.instance,
3890
4042
  ...(flags.root ? { root: flags.root } : {}),
@@ -3894,6 +4046,8 @@ function cmdHostPlugin(flags, streams) {
3894
4046
  streams.stderr.write(`h2a host plugin: unknown --host "${flags.host}". Supported: ${H2A_HOST_PLUGIN_HOSTS.join(", ")}.\n`);
3895
4047
  return 1;
3896
4048
  }
4049
+ const workspaceScope = renderWorkspaceScope(flags.host, flags.workspace ?? streams.cwd?.() ?? process.cwd(), flags.instance, flags['owner-key'], flags['workspace-scope'] === 'on');
4050
+ const scopeCommand = workspaceScope.supported ? workspaceScope.command : undefined;
3897
4051
  // DEC-113 (D6 done): --scaffold <dir> writes codex's FULL local marketplace —
3898
4052
  // verified live, codex installs a plugin only from a marketplace dir, NOT a
3899
4053
  // bare plugin dir. Layout mirrors codex's own openai-curated marketplace:
@@ -3915,7 +4069,7 @@ function cmdHostPlugin(flags, streams) {
3915
4069
  const manifestPath = join(pluginDir, ".codex-plugin", "plugin.json");
3916
4070
  const marketplacePath = join(marketplaceDir, ".agents", "plugins", "marketplace.json");
3917
4071
  // The hooks.json is the same idempotent Claude-format merge as --write.
3918
- const hooksMerge = mergeStopHooksFile(hooksPath, render.record, render.receive, flags.force === "true", streams);
4072
+ const hooksMerge = mergeStopHooksFile(hooksPath, render.record, render.receive, flags.force === "true", streams, scopeCommand, flags.host);
3919
4073
  if (typeof hooksMerge === "number")
3920
4074
  return hooksMerge;
3921
4075
  // Manifests are stable identities — rewriting them is idempotent (same bytes).
@@ -3954,8 +4108,8 @@ function cmdHostPlugin(flags, streams) {
3954
4108
  // entry for the three hosts that accept it — **claude** + **gemini** (single
3955
4109
  // settings.json; gemini via `gemini hooks migrate --from-claude`) and **codex**
3956
4110
  // (its plugin `hooks.json` uses the identical Claude-format hooks object;
3957
- // verified against `~/.codex/.../hooks/hooks.json`). agy is poll-only (no
3958
- // daemon), so --write is refused for it and the rendered hook + hint surface.
4111
+ // verified against `~/.codex/.../hooks/hooks.json`). agy and Muse install
4112
+ // only their pre-action scope hook; their lifecycle still uses polling.
3959
4113
  if (flags.write) {
3960
4114
  // Vibe's hook file is `~/.vibe/hooks.toml` — TOML, and the JSON hook merger
3961
4115
  // is deliberately format-strict (same refusal as `host setup --write` for
@@ -3966,13 +4120,8 @@ function cmdHostPlugin(flags, streams) {
3966
4120
  `Register the rendered record command as a post_agent hook; --print carries the TOML translation.\n`);
3967
4121
  return 1;
3968
4122
  }
3969
- if (flags.host === "agy" || flags.host === "muse") {
3970
- streams.stderr.write(`h2a host plugin: --write is not available for ${flags.host} (poll-only, no verified stop-hook surface). ` +
3971
- `Use the poll path: ${render.poll}\n`);
3972
- return 1;
3973
- }
3974
4123
  const targetPath = flags.write;
3975
- const merge = mergeStopHooksFile(targetPath, render.record, render.receive, flags.force === "true", streams);
4124
+ const merge = mergeStopHooksFile(targetPath, ['agy', 'muse'].includes(flags.host) ? '' : render.record, ['agy', 'muse'].includes(flags.host) ? '' : render.receive, flags.force === "true", streams, scopeCommand, flags.host);
3976
4125
  if (typeof merge === "number")
3977
4126
  return merge;
3978
4127
  streams.stdout.write(`${JSON.stringify({
@@ -3980,7 +4129,8 @@ function cmdHostPlugin(flags, streams) {
3980
4129
  host: flags.host,
3981
4130
  written: targetPath,
3982
4131
  mechanism: render.mechanism,
3983
- hook: "hooks.Stop + hooks.UserPromptSubmit",
4132
+ hook: ['agy', 'muse'].includes(flags.host) ? (scopeCommand ? "hooks.PreToolUse" : "none") :
4133
+ "hooks.Stop + hooks.UserPromptSubmit" + (scopeCommand ? " + hooks.PreToolUse" : ""),
3984
4134
  // codex loads hooks via a plugin (manifest → ./hooks/hooks.json); the
3985
4135
  // file written above is a valid codex hooks.json, but codex still
3986
4136
  // needs the manifest + trust. `--scaffold <dir>` does the full job;
@@ -3995,7 +4145,7 @@ function cmdHostPlugin(flags, streams) {
3995
4145
  }, null, 2)}\n`);
3996
4146
  return 0;
3997
4147
  }
3998
- streams.stdout.write(`${JSON.stringify(render, null, 2)}\n`);
4148
+ streams.stdout.write(`${JSON.stringify({ ...render, workspaceScope }, null, 2)}\n`);
3999
4149
  return 0;
4000
4150
  }
4001
4151
  /**
@@ -4006,7 +4156,7 @@ function cmdHostPlugin(flags, streams) {
4006
4156
  * code on failure, or `undefined` on success.
4007
4157
  * DEC-102/103/104; reused by `--scaffold` (DEC-113).
4008
4158
  */
4009
- function mergeStopHooksFile(targetPath, record, receive, force, streams) {
4159
+ function mergeStopHooksFile(targetPath, record, receive, force, streams, scopeCommand, scopeHost) {
4010
4160
  let existing = {};
4011
4161
  if (existsSync(targetPath)) {
4012
4162
  let raw;
@@ -4047,12 +4197,27 @@ function mergeStopHooksFile(targetPath, record, receive, force, streams) {
4047
4197
  ...withoutDriveReceive,
4048
4198
  claudeDriveReceiveHookEntry(receive)
4049
4199
  ];
4050
- const merged = {
4051
- ...existing,
4200
+ // Remove the former default scope hooks unless this invocation opts in.
4201
+ // Keep unrelated hooks, including deny-manual-h2a-cli, unchanged.
4202
+ const retainedHooks = { ...existingHooks };
4203
+ for (const event of ['SessionStart', 'PreToolUse']) {
4204
+ if (Array.isArray(retainedHooks[event]))
4205
+ retainedHooks[event] = withoutWorkspaceScopeGuardHooks(retainedHooks[event]);
4206
+ }
4207
+ const retained = { ...existing };
4208
+ delete retained['sentropic-h2a-workspace-scope'];
4209
+ const merged = scopeHost === 'agy' && scopeCommand ? {
4210
+ ...retained, 'sentropic-h2a-workspace-scope': agyWorkspaceScopeDefinition(scopeCommand, true)
4211
+ } : {
4212
+ ...retained,
4052
4213
  hooks: {
4053
- ...existingHooks,
4054
- Stop: mergedStop,
4055
- UserPromptSubmit: mergedUserPromptSubmit
4214
+ ...retainedHooks,
4215
+ ...(scopeCommand ? { PreToolUse: [
4216
+ ...(Array.isArray(retainedHooks.PreToolUse) ? retainedHooks.PreToolUse : []),
4217
+ { matcher: '.*', hooks: [{ type: 'command', command: scopeCommand, timeout: 15 }] }
4218
+ ] } : {}),
4219
+ ...(record ? { Stop: mergedStop } : {}),
4220
+ ...(receive ? { UserPromptSubmit: mergedUserPromptSubmit } : {})
4056
4221
  }
4057
4222
  };
4058
4223
  try {
@@ -4715,10 +4880,19 @@ export function cmdConductorLaunch(argv, streams, opts) {
4715
4880
  return 0;
4716
4881
  }
4717
4882
  function cmdDoctor(flags, streams, options = {}) {
4883
+ if (flags.host && !isNativeHost(flags.host) && !['claude', 'codex'].includes(flags.host)) {
4884
+ streams.stderr.write('h2a doctor: --host must be claude|codex|vibe|muse|agy\n');
4885
+ return 1;
4886
+ }
4887
+ if ((flags.guard || flags.lifecycle) && flags.host !== 'vibe') {
4888
+ streams.stderr.write('h2a doctor: --guard/--lifecycle require --host vibe\n');
4889
+ return 1;
4890
+ }
4718
4891
  const cwd = streams.cwd ?? (() => process.cwd());
4719
4892
  const root = resolveRoot(flags, cwd);
4720
4893
  const report = {
4721
4894
  ok: true,
4895
+ agyClaudeQuota: readAgyClaudeQuotaStatus(),
4722
4896
  root,
4723
4897
  warnings: [],
4724
4898
  checks: {}
@@ -4793,9 +4967,10 @@ function cmdDoctor(flags, streams, options = {}) {
4793
4967
  // is allowed to touch host configuration/caches and invoke native host CLIs.
4794
4968
  // That keeps an ordinary isolated-bus probe independent of the operator's
4795
4969
  // personal Claude/Codex setup while retaining a fail-closed repair surface.
4796
- if (flags.repair === "true") {
4970
+ if (flags.repair === "true" && (!flags.host || ['claude', 'codex'].includes(flags.host))) {
4797
4971
  const dryRun = flags["dry-run"] === "true";
4798
- const hostInstallations = (options.doctorHostInstallations ?? doctorHostInstallations)({ repair: true, dryRun });
4972
+ const hostInstallations = (options.doctorHostInstallations ?? doctorHostInstallations)({ repair: true, dryRun,
4973
+ ...(flags.host ? { hosts: [flags.host] } : {}) });
4799
4974
  checks.hostInstallations = hostInstallations;
4800
4975
  if (!hostInstallations.ok) {
4801
4976
  report.ok = false;
@@ -4844,6 +5019,21 @@ function cmdDoctor(flags, streams, options = {}) {
4844
5019
  message: "pass --repair to detect and converge Claude/Codex host installation drift"
4845
5020
  };
4846
5021
  }
5022
+ if (flags['skip-hosts'] !== 'true') {
5023
+ const selection = flags.host ? isNativeHost(flags.host) ? [flags.host] : [] : NATIVE_HOSTS;
5024
+ const hosts = selection.map(host => {
5025
+ try {
5026
+ const { instance, ...nativeFlags } = flags;
5027
+ return nativeHostReport(host, nativeFlags, flags.repair === 'true', false, undefined, cwd());
5028
+ }
5029
+ catch (error) {
5030
+ return { host, ok: false, installation: 'inspection impossible', error: error.message };
5031
+ }
5032
+ });
5033
+ checks.nativeHostInstallations = { ok: hosts.every(host => host.ok), hosts };
5034
+ if (!hosts.every(host => host.ok))
5035
+ report.ok = false;
5036
+ }
4847
5037
  // ── Warning checks (do NOT flip report.ok) ──────────────────────────────
4848
5038
  // (a) rootSource: record where the root came from
4849
5039
  const rootInfo = resolveRootInfo(flags, cwd);
@@ -5453,7 +5643,9 @@ function cmdConnect(flags, streams) {
5453
5643
  const followUp = [
5454
5644
  flags.host === "remote"
5455
5645
  ? "Use the bridge-provided environment in the remote session Pod"
5456
- : `Merge the snippet above under \`mcpServers\` in ${steps[1].pathExample}`,
5646
+ : flags.host === "vibe" ? `Entrée directe intérimaire (décision owner 16/10, dérogation O7.2) : h2a host setup --host vibe --write ; migration registre R5/R7 : h2a host setup --host vibe --remove puis bootstrap.`
5647
+ : isNativeHost(flags.host) ? `Rendu historique non recommandé — ${REGISTRY_WAITING}; installation et activation par l’intégrateur registre.`
5648
+ : `Merge the snippet above under \`mcpServers\` in ${steps[1].pathExample}`,
5457
5649
  identity.privateKeyPath
5458
5650
  ? `keypair ready: ${identity.privateKeyPath}`
5459
5651
  : `legacy override: run h2a keys generate --instance ${instance} --root ${root} if needed`,
@@ -5565,7 +5757,7 @@ function targetSpecFor(host, cwd) {
5565
5757
  // installed skills are listed at session open.
5566
5758
  return {
5567
5759
  host: "vibe",
5568
- userBase: join(homedir(), ".vibe", "skills"),
5760
+ userBase: join(vibeHome(), "skills"),
5569
5761
  projectBase: join(cwd, ".vibe", "skills"),
5570
5762
  extension: "SKILL.md",
5571
5763
  write: (base, skillName, _parsed, raw) => {
@@ -5704,7 +5896,7 @@ function readSkillFrom(srcDir, dirName, source, renameTo) {
5704
5896
  raw = raw.replace(/^(name:[ \t]*).*$/m, `$1${installName}`);
5705
5897
  parsed = { ...parsed, name: installName };
5706
5898
  }
5707
- return { kind: "skill", skill: { installName, parsed, raw, source } };
5899
+ return { kind: "skill", skill: { installName, parsed, raw, source, resourceDir: join(srcDir, dirName) } };
5708
5900
  }
5709
5901
  /**
5710
5902
  * Resolve the on-disk `skills/` directory of an installed dependency package
@@ -5812,6 +6004,15 @@ function collectInstallableSkills() {
5812
6004
  return { skills, sources, error: harnessRes.error };
5813
6005
  return { skills, sources };
5814
6006
  }
6007
+ function nativeHostReport(host, flags, repair, explicitInstall = false, root, cwd) {
6008
+ const collection = collectInstallableSkills();
6009
+ if (collection.error)
6010
+ throw new Error(collection.error.message);
6011
+ return convergeNativeHost({ host, root, cwd, version: currentCliVersion(), skills: collection.skills, renderGemini: renderSkillAsGeminiToml,
6012
+ sourcesComplete: collection.sources.every(s => s.dir !== null && s.count > 0), repair, explicitInstall,
6013
+ dryRun: flags['dry-run'] === 'true', force: flags.force === 'true', guard: flags.guard, lifecycle: flags.lifecycle,
6014
+ instance: flags.instance, busRoot: flags.root, status: flags.status, ownerKey: flags['owner-key'], workspaceScope: flags['workspace-scope'] });
6015
+ }
5815
6016
  function cmdInstallSkills(flags, streams) {
5816
6017
  const host = flags.host;
5817
6018
  if (!host) {
@@ -5841,27 +6042,46 @@ function cmdInstallSkills(flags, streams) {
5841
6042
  return collection.error.exit;
5842
6043
  }
5843
6044
  const targetBase = scope === "user" ? spec.userBase : spec.projectBase;
6045
+ if (scope === 'user' && (isNativeHost(host) || host === 'gemini')) {
6046
+ try {
6047
+ const result = nativeHostReport(host, flags, true, true, dirname(targetBase), cwd());
6048
+ streams.stdout.write(`${JSON.stringify({ ...result, scope, targetBase, nativeQuestionHint: NATIVE_QUESTION_GUIDANCE, installed: 'changed' in result ? result.changed : [], sources: collection.sources,
6049
+ prunedLegacy: [], skipped: 'conflicts' in result ? result.conflicts.map(path => ({ path, reason: 'customized or unknown provenance; preserved' })) : [],
6050
+ ...(host === 'muse' ? { verifyHint: 'muse skills list # project scope requires workspace trust' } : {}),
6051
+ ...(host === 'vibe' ? { verifyHint: 'vibe # skills load at session open; nouvelle session ou reprise propre' } : {}),
6052
+ ...(host === 'agy' ? { importHint: 'agy plugin import gemini # then: agy plugin enable h2a' } : {}) }, null, 2)}\n`);
6053
+ return result.ok ? 0 : 2;
6054
+ }
6055
+ catch (error) {
6056
+ streams.stderr.write(`h2a install-skills: ${error.message}\n`);
6057
+ return 3;
6058
+ }
6059
+ }
5844
6060
  // DEC-057: prune the pre-consolidation skill names if they linger on disk.
5845
- const prunedLegacy = pruneLegacy(spec, targetBase);
6061
+ const prunedLegacy = isNativeHost(host) || host === 'gemini' ? [] : pruneLegacy(spec, targetBase);
5846
6062
  const installed = [];
5847
6063
  const skipped = [];
5848
6064
  for (const skill of collection.skills) {
5849
6065
  const skillName = skill.installName;
5850
- // Probe the would-be target file before writing so existing files are
5851
- // surfaced as skipped (mirrors the previous Claude-only behavior).
6066
+ // Keep existing entrypoints protected, while installing missing resources.
5852
6067
  const probeTarget = spec.host === "gemini" || spec.host === "agy"
5853
6068
  ? join(targetBase, `${skillName}.toml`)
5854
6069
  : join(targetBase, skillName, "SKILL.md");
5855
- if (existsSync(probeTarget) && flags.force !== "true") {
5856
- skipped.push({
5857
- name: skillName,
5858
- reason: `${probeTarget} already exists (use --force to overwrite)`
5859
- });
5860
- continue;
5861
- }
5862
6070
  try {
5863
- const targetPath = spec.write(targetBase, skillName, skill.parsed, skill.raw);
5864
- installed.push(targetPath);
6071
+ // Every host needs referenced resources, including the native-question
6072
+ // instructions used by present-decision. Keep both scopes on one renderer.
6073
+ const artifacts = nativeSkillArtifacts({ host, root: dirname(targetBase), project: scope === 'project', version: currentCliVersion(), skills: [skill], renderGemini: renderSkillAsGeminiToml, historicalHashes: () => [] });
6074
+ for (const artifact of artifacts) {
6075
+ assertNativePath(artifact.path);
6076
+ if (existsSync(artifact.path) && flags.force !== "true") {
6077
+ // The guard applies to every artifact, even with no SKILL.md/.toml.
6078
+ skipped.push({ name: skillName, reason: `${artifact.path} already exists (use --force to overwrite)` });
6079
+ continue;
6080
+ }
6081
+ mkdirSync(dirname(artifact.path), { recursive: true });
6082
+ writeFileSync(artifact.path, artifact.bytes);
6083
+ installed.push(artifact.path);
6084
+ }
5865
6085
  }
5866
6086
  catch (error) {
5867
6087
  streams.stderr.write(`h2a install-skills: failed to write ${probeTarget} (${error.message})\n`);
@@ -5873,6 +6093,7 @@ function cmdInstallSkills(flags, streams) {
5873
6093
  host,
5874
6094
  scope,
5875
6095
  targetBase,
6096
+ nativeQuestionHint: NATIVE_QUESTION_GUIDANCE,
5876
6097
  installed,
5877
6098
  skipped,
5878
6099
  prunedLegacy,
@@ -6268,6 +6489,10 @@ export function runCli(argv = process.argv.slice(2), streams = {
6268
6489
  stderr: process.stderr
6269
6490
  }, options = {}) {
6270
6491
  const { command, flags } = parseFlags(argv);
6492
+ if (streams.stderr === process.stderr && process.stderr.isTTY) {
6493
+ for (const notice of captureHostOperatorNotices())
6494
+ streams.stderr.write(`${notice}\n`);
6495
+ }
6271
6496
  if (command && TRACK_FACADE_VERBS.has(command)) {
6272
6497
  // ④: read-only + sync-write verbs run in-process; `focus` (async) keeps
6273
6498
  // shelling out. Same `.track`, same lock. A native WRITE never falls back to