@zaip-ai/cli 4.4.0 → 4.6.0

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 (214) hide show
  1. package/README.md +2 -0
  2. package/dist/services/adapters.d.ts +1 -1
  3. package/dist/services/adapters.js +4 -4
  4. package/dist/services/adapters.js.map +1 -1
  5. package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
  6. package/dist/services/codex-conversation-lifecycle-hook.js +24 -5
  7. package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
  8. package/dist/services/codex-native-tool-authority-template.d.ts.map +1 -1
  9. package/dist/services/codex-native-tool-authority-template.js +188 -9
  10. package/dist/services/codex-native-tool-authority-template.js.map +1 -1
  11. package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
  12. package/dist/services/codex-pre-tool-hook-template.js +50 -128
  13. package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
  14. package/dist/services/codex-pre-tool-hook-template.test.js +4 -0
  15. package/dist/services/codex-pre-tool-hook-template.test.js.map +1 -1
  16. package/dist/services/codex-pre-tool-support-template.d.ts.map +1 -1
  17. package/dist/services/codex-pre-tool-support-template.js +1 -4
  18. package/dist/services/codex-pre-tool-support-template.js.map +1 -1
  19. package/dist/services/codex-stale-git-lock-template.d.ts +2 -0
  20. package/dist/services/codex-stale-git-lock-template.d.ts.map +1 -0
  21. package/dist/services/codex-stale-git-lock-template.js +64 -0
  22. package/dist/services/codex-stale-git-lock-template.js.map +1 -0
  23. package/dist/services/global-codex-config-migration.test.js +1 -4
  24. package/dist/services/global-codex-config-migration.test.js.map +1 -1
  25. package/dist/services/install-template-policy.d.ts.map +1 -1
  26. package/dist/services/install-template-policy.js +2 -0
  27. package/dist/services/install-template-policy.js.map +1 -1
  28. package/dist/services/logger.js +2 -1
  29. package/dist/services/logger.js.map +1 -1
  30. package/dist/services/logger.test.js +71 -0
  31. package/dist/services/logger.test.js.map +1 -1
  32. package/dist/services/runtime-template-test-support.d.ts +3 -0
  33. package/dist/services/runtime-template-test-support.d.ts.map +1 -0
  34. package/dist/services/runtime-template-test-support.js +32 -0
  35. package/dist/services/runtime-template-test-support.js.map +1 -0
  36. package/dist/services/runtime-template.test.js +23 -31
  37. package/dist/services/runtime-template.test.js.map +1 -1
  38. package/package.json +1 -1
  39. package/templates/.agents/README.md +8 -0
  40. package/templates/.agents/config/agents/discovery.json +1 -1
  41. package/templates/.agents/config/deploy-policy.json +5 -0
  42. package/templates/.agents/dashboard/.zaip-managed.json +211 -75
  43. package/templates/.agents/dashboard/README.md +2 -0
  44. package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-f4ZGJRg3.js → CostCalculationGuidePage-BRtiPijr.js} +1 -1
  45. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-CkQ_y8kg.js → DashboardHelpDialog-BR4ZeYpE.js} +99 -10
  46. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-v9zGRTlk.js → PricingSettingsDialog-Dr4QDFmn.js} +1 -1
  47. package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-doIMhei7.js → ProjectSettingsPage-BG0N5dw_.js} +1 -1
  48. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-C_4ftjyB.js → TraceabilityWorkspace-BvoM-YQ0.js} +1 -1
  49. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-fTQhSL85.js +68 -0
  50. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-Cv3WBFIF.js → icons-vendor-Bc6vux5t.js} +1 -1
  51. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-BMfzKaAR.js +2 -0
  52. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DZhppOIk.css +1 -0
  53. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-mHgsmxb6.js → react-vendor-DNJQFov3.js} +1 -1
  54. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-B0CPyEVq.js → traceability-B7tjIB7W.js} +1 -1
  55. package/templates/.agents/dashboard/apps/frontend/dist/index.html +6 -6
  56. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  57. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +6 -34
  58. package/templates/.agents/dashboard/apps/frontend/src/ReconciliationFeedback.dom.test.ts +130 -0
  59. package/templates/.agents/dashboard/apps/frontend/src/ReconciliationFeedback.tsx +226 -0
  60. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-sqlite-view.ts +45 -0
  61. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +15 -0
  62. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +17 -46
  63. package/templates/.agents/dashboard/apps/frontend/src/reconciliation-feedback-fixtures.ts +23 -0
  64. package/templates/.agents/dashboard/apps/frontend/src/reconciliation-feedback-model.test.ts +69 -0
  65. package/templates/.agents/dashboard/apps/frontend/src/reconciliation-feedback-model.ts +59 -0
  66. package/templates/.agents/dashboard/apps/frontend/src/reconciliation-feedback.css +131 -0
  67. package/templates/.agents/dashboard/apps/frontend/src/styles.css +0 -32
  68. package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +2 -2
  69. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  70. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +2 -2
  71. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +1 -1
  72. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  73. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +1 -4
  74. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.navigation.test.ts +236 -0
  75. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +1 -24
  76. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +3 -2
  77. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  78. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  79. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  80. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  81. package/templates/.agents/dashboard/packages/local-runtime/DIAGNOSTICS.md +42 -0
  82. package/templates/.agents/dashboard/packages/local-runtime/dashboard-diagnostics.d.mts +10 -0
  83. package/templates/.agents/dashboard/packages/local-runtime/dashboard-diagnostics.mjs +101 -0
  84. package/templates/.agents/dashboard/packages/local-runtime/dashboard-diagnostics.test.mjs +58 -0
  85. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +232 -217
  86. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +201 -188
  87. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  88. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-dashboard-startup.mjs +233 -0
  89. package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-provider-nonzero.mjs +45 -0
  90. package/templates/.agents/dashboard/packages/local-runtime/scripts/verify-dashboard-executable-startup.mjs +107 -0
  91. package/templates/.agents/dashboard/packages/local-runtime/scripts/verify-dashboard-reconciliation-executable.mjs +271 -0
  92. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +232 -217
  93. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.test.ts +78 -12
  94. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +36 -56
  95. package/templates/.agents/dashboard/packages/local-runtime/src/canonical-source-revision-cache.test.ts +125 -0
  96. package/templates/.agents/dashboard/packages/local-runtime/src/canonical-source-revision-cache.ts +168 -0
  97. package/templates/.agents/dashboard/packages/local-runtime/src/dashboard-diagnostics.test.ts +57 -0
  98. package/templates/.agents/dashboard/packages/local-runtime/src/server-agent-catalog-routes.ts +76 -0
  99. package/templates/.agents/dashboard/packages/local-runtime/src/server-dual-reads-manifest-summaries-without-losing.test.ts +5 -0
  100. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-diagnostics.test.ts +118 -0
  101. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-result.test.ts +35 -6
  102. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-route.ts +105 -0
  103. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +64 -9
  104. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +19 -27
  105. package/templates/.agents/dashboard/packages/local-runtime/src/server-telemetry-command.test.ts +111 -0
  106. package/templates/.agents/dashboard/packages/local-runtime/src/server-telemetry-refresh.test.ts +59 -0
  107. package/templates/.agents/dashboard/packages/local-runtime/src/server-telemetry-refresh.ts +44 -0
  108. package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.test.ts +20 -0
  109. package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.ts +12 -7
  110. package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +48 -6
  111. package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +2 -2
  112. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +126 -134
  113. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.ts +14 -2
  114. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-dashboard-startup.test.ts +163 -0
  115. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-dashboard-startup.ts +78 -0
  116. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-header-timestamp.test.ts +31 -0
  117. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-provider-nonzero.test.ts +271 -0
  118. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-provider-visibility.ts +32 -0
  119. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-operations-duration.ts +58 -0
  120. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-provider-dimension.ts +12 -3
  121. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-view-page.ts +9 -58
  122. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +9 -35
  123. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +10 -8
  124. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +43 -45
  125. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +5 -9
  126. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +5 -1
  127. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-startup-seed.test.ts +87 -0
  128. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-logging.mjs +6 -2
  129. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-server.mjs +7 -1
  130. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +4 -5
  131. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  132. package/templates/.agents/dashboard/packages/ui/src/DashboardHeader.test.mjs +33 -4
  133. package/templates/.agents/dashboard/packages/ui/src/DashboardHeader.tsx +8 -7
  134. package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +46 -3
  135. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  136. package/templates/.agents/dashboard/tests/e2e/qualify-kanban-popup.mjs +56 -0
  137. package/templates/.agents/dashboard/tests/e2e/specs/dashboard-update-label.spec.ts +49 -0
  138. package/templates/.agents/design/.zaip-managed.json +17 -5
  139. package/templates/.agents/design/apps/catalog/dist/assets/index-D3uhpycC.js +72 -0
  140. package/templates/.agents/design/apps/catalog/dist/index.html +1 -1
  141. package/templates/.agents/design/apps/catalog/package.json +1 -1
  142. package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +13 -1
  143. package/templates/.agents/design/apps/catalog/src/specimens/ReconciliationSpecimen.stories.tsx +6 -0
  144. package/templates/.agents/design/apps/catalog/src/specimens/ReconciliationSpecimen.tsx +101 -0
  145. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  146. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  147. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  148. package/templates/.agents/requirements/comparative-audit.md +1 -1
  149. package/templates/.agents/requirements/context-engine.md +1 -1
  150. package/templates/.agents/requirements/cost-observability.md +1 -1
  151. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  152. package/templates/.agents/requirements/data-export.md +1 -1
  153. package/templates/.agents/requirements/design-system.md +1 -1
  154. package/templates/.agents/requirements/execution-engine.md +1 -1
  155. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  156. package/templates/.agents/requirements/model-orchestration.md +21 -6
  157. package/templates/.agents/requirements/public-distribution.md +4 -4
  158. package/templates/.agents/requirements/software-architecture.md +1 -1
  159. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  160. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  161. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  162. package/templates/.agents/rules/core.md +3 -1
  163. package/templates/.agents/rules/workflow.md +3 -2
  164. package/templates/.agents/runtime/VERSION +1 -1
  165. package/templates/.agents/runtime/bin/zaip.mjs +705 -516
  166. package/templates/.agents/runtime/checksums.sha256 +5 -5
  167. package/templates/.agents/runtime/manifest.json +1 -1
  168. package/templates/.agents/runtime/provenance.json +4 -4
  169. package/templates/.agents/runtime/sbom.cdx.json +1 -1
  170. package/templates/.agents/skills/zaip-skill-config/SKILL.md +25 -3
  171. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +4 -0
  172. package/templates/.agents/skills/zaip-skill-execution/references/autonomous-continuation.md +4 -0
  173. package/templates/.agents/skills/zaip-skill-execution/references/candidate-workflow.md +1 -1
  174. package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +2 -2
  175. package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +1 -0
  176. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +36 -48
  177. package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +2 -2
  178. package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +67 -99
  179. package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +33 -30
  180. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +303 -0
  181. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.test.mjs +334 -0
  182. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +41 -28
  183. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/guarded-commits.mjs +212 -0
  184. package/templates/.agents/skills/zaip-skill-lifecycle-closure/SKILL.md +4 -0
  185. package/templates/.agents/skills/zaip-skill-prd/SKILL.md +4 -0
  186. package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +44 -68
  187. package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +91 -44
  188. package/templates/.agents/skills/zaip-skill-send-email/SKILL.md +15 -0
  189. package/templates/.agents/skills/zaip-skill-send-email/agents/openai.yaml +4 -0
  190. package/templates/.agents/skills/zaip-skill-setup/SKILL.md +5 -2
  191. package/templates/.agents/skills/zaip-skill-spec/SKILL.md +4 -0
  192. package/templates/.agents/skills/zaip-skill-task/SKILL.md +4 -0
  193. package/templates/.agents/skills/zaip-skill-testing-strategy/SKILL.md +19 -0
  194. package/templates/.agents/skills/zaip-skill-tool-setup/SKILL.md +2 -0
  195. package/templates/.agents/skills/zaip-skill-use-connectors/SKILL.md +15 -0
  196. package/templates/.agents/skills/zaip-skill-use-connectors/agents/openai.yaml +4 -0
  197. package/templates/.agents/skills/zaip-skill-use-connectors/scripts/connector-guidance.test.mjs +29 -0
  198. package/templates/.agents/skills/zaip-skill-use-connectors/scripts/verify-connector-lock.mjs +30 -0
  199. package/templates/.agents/tools/cloud-runner.integration.test.mjs +3 -0
  200. package/templates/.agents/zaip-aios/VERSION +1 -1
  201. package/templates/.agents/zaip-aios/guides/03-tasks.md +6 -0
  202. package/templates/.agents/zaip-aios/guides/04-specs.md +6 -0
  203. package/templates/.agents/zaip-aios/guides/05-prds.md +4 -0
  204. package/templates/.agents/zaip-aios/guides/06-execucao.md +6 -0
  205. package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +6 -0
  206. package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +4 -0
  207. package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +6 -0
  208. package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +36 -4
  209. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +15 -4
  210. package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +8 -0
  211. package/templates/template-manifest.json +330 -142
  212. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-D7PrDZy9.js +0 -68
  213. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-OBJXZOwe.css +0 -1
  214. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Rbmpz4UO.js +0 -2
package/README.md CHANGED
@@ -226,3 +226,5 @@ Run `corepack pnpm verify` from `public-cli` before submitting a change. The pac
226
226
  uses `SEE LICENSE IN LICENSE`; the bundled [LICENSE](LICENSE) carries the proprietary
227
227
  ZAIP-AIOS Commercial License notice. Consult that file for the applicable terms, npm for
228
228
  the published version, and the release evidence for the qualification status.
229
+
230
+ Repository source v4.5 defines a shared writer claim for serial Tasks, limited parallel worktrees, recoverable isolated checkout closure, a current-release manifest and exact-SHA pre-main CI for critical/builder release delivery. The packaged CLI must pass template/runtime parity and installation qualification before those source rules are treated as an installed version.
@@ -1,6 +1,6 @@
1
1
  import { type PublicAgentCatalog } from "./agent-adapters.js";
2
2
  export { isManagedAdapter } from "./managed-adapter.js";
3
- export declare const ADAPTERS_VERSION = "4.4.0";
3
+ export declare const ADAPTERS_VERSION = "4.6.0";
4
4
  export interface AdapterFile {
5
5
  path: string;
6
6
  content: string;
@@ -11,7 +11,7 @@ export { isManagedAdapter } from "./managed-adapter.js";
11
11
  import { CODEX_GITHUB_DEPLOY_RULES, CODEX_SECURITY_RULES } from "./codex-rules.js";
12
12
  import { codexWindowsHookCommand } from "./codex-windows-hook-command.js";
13
13
  import { applyTransactionalChanges, assertSafeDestination } from "./transactional-files.js";
14
- export const ADAPTERS_VERSION = "4.4.0";
14
+ export const ADAPTERS_VERSION = "4.6.0";
15
15
  const ROOT_GUIDANCE = `# ZAIP-AIOS
16
16
 
17
17
  Read \`.agents/config/project.yaml\` first. Apply ZAIP only for literal boolean \`zaip.enabled: true\`, except framework maintenance or \`zaip enable\`. \`AGENTS.md\` is a bootstrap; canonical guidance lives in \`.agents/\`.
@@ -185,9 +185,9 @@ const CLAUDE_SETTINGS = `{
185
185
  `;
186
186
  export function adapterFiles(workspaceRoot, catalog) {
187
187
  const codexConfig = CODEX_CONFIG.replaceAll(CODEX_WORKSPACE_ROOT_PLACEHOLDER, JSON.stringify(resolve(workspaceRoot)))
188
- .replaceAll("__ZAIP_WINDOWS_PRE_TOOL_HOOK__", codexWindowsHookCommand("zaip-pre-tool-use.mjs", workspaceRoot))
189
- .replaceAll("__ZAIP_WINDOWS_CONVERSATION_HOOK__", codexWindowsHookCommand("zaip-conversation-lifecycle.mjs", workspaceRoot))
190
- .replaceAll("__ZAIP_WINDOWS_SUBAGENT_HOOK__", codexWindowsHookCommand("zaip-subagent-lifecycle.mjs", workspaceRoot));
188
+ .replaceAll("__ZAIP_WINDOWS_PRE_TOOL_HOOK__", codexWindowsHookCommand("zaip-pre-tool-use.mjs"))
189
+ .replaceAll("__ZAIP_WINDOWS_CONVERSATION_HOOK__", codexWindowsHookCommand("zaip-conversation-lifecycle.mjs"))
190
+ .replaceAll("__ZAIP_WINDOWS_SUBAGENT_HOOK__", codexWindowsHookCommand("zaip-subagent-lifecycle.mjs"));
191
191
  return [
192
192
  ...(catalog === undefined
193
193
  ? []
@@ -1 +1 @@
1
- {"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/services/adapters.ts"],"names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AC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;IACjF,MAAM,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAC1C,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,IAAY;IAC9C,MAAM,OAAO,GAAG,uBAAuB,CACrC,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,oCAAoC,CAAC,EAAE,MAAM,CAAC,CAC5E,CAAC;IACF,OAAO,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,IAAY,EAAE,MAAc;IACzD,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACpE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"codex-conversation-lifecycle-hook.d.ts","sourceRoot":"","sources":["../../src/services/codex-conversation-lifecycle-hook.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,QAsO7C,CAAC"}
1
+ {"version":3,"file":"codex-conversation-lifecycle-hook.d.ts","sourceRoot":"","sources":["../../src/services/codex-conversation-lifecycle-hook.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,QAyP7C,CAAC"}
@@ -9,8 +9,9 @@ const activation = await import("./zaip-hook-activation.mjs").catch(() => null);
9
9
  let root = hookRoot, local;
10
10
  // The host hook stays below 10s. Explicit CLI recovery runs in the active Codex
11
11
  // tool session and may finish expensive canonical closure within its own bound.
12
- const replay = process.argv.length === 3 && process.argv[2] === "--replay-receipt";
13
- const deadline = Date.now() + (replay ? 45000 : 8000);
12
+ const automatic = process.argv.length === 3 && process.argv[2] === "--recover-previous-turn";
13
+ const replay = automatic || (process.argv.length === 3 && process.argv[2] === "--replay-receipt");
14
+ const deadline = Date.now() + (automatic ? 7000 : replay ? 45000 : 8000);
14
15
  const readChunkBytes = 1024 * 1024, maxLineBytes = 8 * 1024 * 1024, maxReadBytes = 16 * 1024 * 1024;
15
16
  const hash = value => createHash("sha256").update(value).digest("hex");
16
17
  const parse = value => { try { return JSON.parse(value); } catch { return null; } };
@@ -163,10 +164,13 @@ async function selectWorkspace(correlationKey, worktrees) {
163
164
  }
164
165
  try {
165
166
  if (event?.hook_event_name !== "Stop" || !session || !turn || !text(event.cwd)) { reply(); process.exit(0); }
166
- const worktrees = await gitWorktrees();
167
+ // Automatic recovery is already bound to one canonical workspace by intake.
168
+ // Never discover another worktree or manufacture a historical Conversation.
169
+ const worktrees = automatic ? [hookRoot] : await gitWorktrees();
170
+ if (automatic && resolve(event.cwd) !== hookRoot) throw new Error("recovery_workspace_mismatch");
167
171
  if (!worktrees.some(candidate => inside(event.cwd, candidate))) { reply(); process.exit(0); }
168
172
  const correlationKey = hash(JSON.stringify(["codex", session, turn, null, null]));
169
- root = await selectWorkspace(correlationKey, worktrees);
173
+ root = automatic ? hookRoot : await selectWorkspace(correlationKey, worktrees);
170
174
  local = resolve(root, ".local/hooks");
171
175
  const config = await readFile(resolve(root, ".agents/config/project.yaml"), "utf8");
172
176
  if (!/zaip:\s*\r?\n\s*enabled:\s*true\s*(?:\r?\n|$)/.test(config)) { reply(); process.exit(0); }
@@ -175,13 +179,23 @@ try {
175
179
  lease = await acquire(receiptPath + ".lock");
176
180
  if (!lease) { await note("stop_worker_busy"); reply(true); process.exit(0); }
177
181
  const old = parse(await readFile(receiptPath, "utf8").catch(() => ""));
182
+ if (automatic) {
183
+ const info = await lstat(receiptPath);
184
+ const identity = value => process.platform === "win32" ? toNamespacedPath(resolve(value)).toLowerCase() : resolve(value);
185
+ if (!info.isFile() || info.isSymbolicLink() || identity(await realpath(receiptPath)) !== identity(receiptPath) ||
186
+ old?.schema_version !== 1 || old.session_id !== session || old.turn_id !== turn ||
187
+ old.event?.hook_event_name !== "Stop" || old.event.session_id !== session || old.event.turn_id !== turn ||
188
+ typeof old.event.cwd !== "string" || identity(old.event.cwd) !== identity(root) ||
189
+ typeof old.event.transcript_path !== "string" || identity(old.event.transcript_path) !== identity(event.transcript_path) ||
190
+ !["pending", "persisted"].includes(old.state)) throw new Error("recovery_receipt_invalid");
191
+ }
178
192
  receipt = old?.schema_version === 1 && old.session_id === session && old.turn_id === turn ? old : { schema_version: 1, session_id: session, turn_id: turn, state: "pending", attempts: 0 };
179
193
  const transcriptPath = text(event.transcript_path) ?? text(receipt.event?.transcript_path);
180
194
  receipt.event = { hook_event_name: "Stop", cwd: root, session_id: session, turn_id: turn, transcript_path: transcriptPath, stop_hook_active: true };
181
195
  if (receipt.state === "persisted") { reply(); } else {
182
196
  receipt.attempts += 1; receipt.state = "pending"; await save(receiptPath, receipt);
183
197
  let status = null;
184
- for (const delay of [0, 250, 750]) { if (delay) await new Promise(r => setTimeout(r, delay)); status = await terminal(transcriptPath); if (status) break; }
198
+ for (const delay of automatic ? [0] : [0, 250, 750]) { if (delay) await new Promise(r => setTimeout(r, delay)); status = await terminal(transcriptPath); if (status) break; }
185
199
  if (!status) throw new Error("transcript_pending");
186
200
  const cli = resolve(root, ".agents/runtime/bin/zaip.mjs");
187
201
  const correlation = parse(await readFile(resolve(root, ".local/codex-telemetry-spool/v1/correlations", correlationKey + ".json"), "utf8").catch(() => ""));
@@ -189,11 +203,13 @@ try {
189
203
  if (correlation?.schema_version === 1 && correlation.thread_id === session && correlation.turn_id === turn && correlation.agent_path === null && typeof correlation.run_id === "string") {
190
204
  intake = { run: { run_id: correlation.run_id }, task: correlation.task_id === null ? null : { id: correlation.task_id } };
191
205
  } else {
206
+ if (automatic) throw new Error("recovery_correlation_missing");
192
207
  const started = await call(cli, ["conversation", "start", "--intent", "conversation"], transcriptPath);
193
208
  if (started.code !== 0) throw new Error("start_pending");
194
209
  intake = parse(started.out);
195
210
  }
196
211
  const run = intake?.run?.run_id;
212
+ if (automatic && receipt.run_id !== undefined && receipt.run_id !== run) throw new Error("recovery_run_mismatch");
197
213
  if (typeof run !== "string" || (intake.task !== null && typeof intake.task?.id !== "string")) throw new Error("start_pending");
198
214
  receipt.run_id = run; await save(receiptPath, receipt);
199
215
  const result = await call(cli, ["subagent", "reconcile-stop", "--session", session, "--turn", turn], transcriptPath);
@@ -203,6 +219,9 @@ try {
203
219
  ? outcome?.run?.id === run && terminalStates.includes(outcome.run.status) && typeof outcome.run.finished_at === "string"
204
220
  : outcome?.status === "closed" && outcome.parent_run_id === run && outcome.reconciliation?.tasks?.some(task => task.id === intake.task.id && terminalStates.includes(task.status));
205
221
  if (result.code !== 0 || !closed) throw new Error("closure_pending");
222
+ if (automatic && intake.task !== null &&
223
+ (!outcome.finalization_decision || (outcome.finalization_decision.outcome === "completed" && outcome.finalization_barrier?.satisfied !== true)))
224
+ throw new Error("closure_gates_pending");
206
225
  if (intake.task !== null && status === "completed") {
207
226
  const shown = await call(cli, ["task", "recovery-status", intake.task.id], transcriptPath);
208
227
  const recovery = parse(shown.out);
@@ -1 +1 @@
1
- {"version":3,"file":"codex-conversation-lifecycle-hook.js","sourceRoot":"","sources":["../../src/services/codex-conversation-lifecycle-hook.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsO1D,CAAC"}
1
+ {"version":3,"file":"codex-conversation-lifecycle-hook.js","sourceRoot":"","sources":["../../src/services/codex-conversation-lifecycle-hook.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyP1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"codex-native-tool-authority-template.d.ts","sourceRoot":"","sources":["../../src/services/codex-native-tool-authority-template.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gCAAgC,QAsFT,CAAC"}
1
+ {"version":3,"file":"codex-native-tool-authority-template.d.ts","sourceRoot":"","sources":["../../src/services/codex-native-tool-authority-template.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gCAAgC,QA0QT,CAAC"}
@@ -1,7 +1,92 @@
1
1
  import { CODEX_VALIDATION_RUNTIME_SUPPORT } from "./codex-validation-runtime-template.js";
2
- export const CODEX_NATIVE_TOOL_AUTHORITY_HOOK = String.raw `import { createHash } from "node:crypto";
3
- import { lstat, realpath } from "node:fs/promises";
2
+ export const CODEX_NATIVE_TOOL_AUTHORITY_HOOK = String.raw `import { execFileSync } from "node:child_process";
3
+ import { createHash } from "node:crypto";
4
+ import { lstat, readFile, realpath } from "node:fs/promises";
4
5
  import { dirname, isAbsolute, relative, resolve } from "node:path";
6
+ import { pathToFileURL } from "node:url";
7
+ // Run starts remain JSON objects; subsequent canonical v3 events are compact arrays.
8
+ // Decode only identity/terminal fields needed for authority, never infer a Run.
9
+ export function readAuthorityRunRecords(text, id) {
10
+ if (typeof text !== "string" || !text.endsWith("\n")) throw new Error("incomplete_run");
11
+ const types = { f: "run.finished", d: "run.finalization.decided", a: "run.attribution.recovered", m: "model.selection.recorded", p: "provider.invocation.finished", c: "model.call.observed", u: "usage.recorded" };
12
+ const records = text.split(/\r?\n/).filter(Boolean).map((line, index) => {
13
+ const value = JSON.parse(line);
14
+ const record = Array.isArray(value)
15
+ ? value[0] === 3 && Object.hasOwn(types, value[1]) && value.length >= 7
16
+ ? { schema_version: 2, type: types[value[1]], event_id: value[2], sequence: value[3], run_id: id }
17
+ : null
18
+ : value;
19
+ if (!record || record.schema_version !== 2 || record.run_id !== id || record.sequence !== index + 1 ||
20
+ ((Array.isArray(value) || record.event_id !== undefined) && record.event_id !== id + ":" + String(index + 1).padStart(6, "0")) ||
21
+ typeof record.type !== "string" || (index === 0 ? record.type !== "run.started" : record.type === "run.started"))
22
+ throw new Error("invalid_run_identity");
23
+ return record;
24
+ });
25
+ if (!records.length) throw new Error("empty_run");
26
+ return records;
27
+ }
28
+
29
+ export function checkDestructivePatterns(command, patterns, deny) {
30
+ if (/^(?:Write-Output|echo|printf)\s+'(?:[^']|'')*'\s*$/i.test(command)) return;
31
+ for (const entry of patterns) if (entry.pattern.test(command)) deny(entry.reason);
32
+ }
33
+ export async function configuredDeploymentBranches(repositoryRoot, deny) {
34
+ const defaults = { applicationBranches: ["beta"], scopeBranches: { frontend: "beta", backend: "beta" }, productionBranch: "main" };
35
+ let source;
36
+ try {
37
+ source = await readFile(resolve(repositoryRoot, ".agents/config/project.yaml"), "utf8");
38
+ } catch (error) {
39
+ if (error?.code === "ENOENT") return defaults;
40
+ deny("Could not read project.yaml deploy policy.");
41
+ }
42
+ let document;
43
+ try {
44
+ const parser = await import(
45
+ pathToFileURL(
46
+ resolve(repositoryRoot, ".agents/skills/zaip-skill-github-deploy/scripts/yaml-parser.mjs"),
47
+ ).href,
48
+ );
49
+ document = parser.parseDocument(source, { strict: true, uniqueKeys: true });
50
+ } catch {
51
+ deny("Canonical deploy YAML parser is unavailable.");
52
+ }
53
+ if (document.errors.length > 0) deny("project.yaml deploy policy is malformed.");
54
+ const config = document.toJS();
55
+ if (config === null || typeof config !== "object" || Array.isArray(config)) {
56
+ deny("project.yaml must contain a mapping.");
57
+ }
58
+ const deploy = config.deploy;
59
+ if (deploy === undefined) return defaults;
60
+ if (deploy === null || typeof deploy !== "object" || Array.isArray(deploy)) {
61
+ deny("project.yaml deploy must be a mapping.");
62
+ }
63
+ if (!Object.keys(deploy).every((key) => ["branch", "production_branch", "allow_production", "frontend", "backend", "database"].includes(key))) {
64
+ deny("project.yaml deploy has unsupported keys.");
65
+ }
66
+ for (const key of ["frontend", "backend", "database"]) {
67
+ if (deploy[key] !== undefined && (deploy[key] === null || typeof deploy[key] !== "object" || Array.isArray(deploy[key]) || !Object.keys(deploy[key]).every((nested) => nested === "branch"))) deny("project.yaml deploy scope is invalid.");
68
+ }
69
+ const productionBranch = Object.hasOwn(deploy, "production_branch")
70
+ ? deploy.production_branch
71
+ : defaults.productionBranch;
72
+ const frontend = deploy.frontend !== undefined && Object.hasOwn(deploy.frontend, "branch") ? deploy.frontend.branch : "beta";
73
+ const backend = deploy.backend !== undefined && Object.hasOwn(deploy.backend, "branch") ? deploy.backend.branch : "beta";
74
+ const database = deploy.database !== undefined && Object.hasOwn(deploy.database, "branch") ? deploy.database.branch : "beta";
75
+ if (database !== "beta") deny("project.yaml deploy.database.branch must be beta.");
76
+ if (
77
+ !isSafeBranchName(frontend) ||
78
+ !isSafeBranchName(backend) ||
79
+ !isSafeBranchName(productionBranch) ||
80
+ (frontend !== "main" && frontend === productionBranch) ||
81
+ (backend !== "main" && backend === productionBranch)
82
+ ) {
83
+ deny("project.yaml application deploy policy is invalid.");
84
+ }
85
+ return { applicationBranches: [...new Set([frontend, backend])], scopeBranches: { frontend, backend }, productionBranch };
86
+ }
87
+ function isSafeBranchName(branch) {
88
+ return typeof branch === "string" && branch.length <= 255 && /^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(branch) && !branch.includes("..") && !branch.includes("//") && !branch.includes("@{") && !branch.endsWith(".") && !branch.endsWith("/") && !branch.split("/").some((segment) => segment.startsWith(".") || segment.endsWith(".lock"));
89
+ }
5
90
  const inside = (path, root) => { const scoped = relative(root, resolve(path)); return scoped === "" || (!scoped.startsWith("..") && !isAbsolute(scoped)); };
6
91
  const authorityPath = path => /^(?:\.agents\/(?:records|data\/runs)\/|\.local\/(?:codex-hook-|codex-telemetry-spool\/|runs\/))/i.test(path.replaceAll("\\", "/"));
7
92
  /** Inspect existing ancestors too: a missing destination can still traverse a junction. */
@@ -34,13 +119,14 @@ async function canonicalScopes(id, root, boundedRead) {
34
119
  });
35
120
  }
36
121
  /** Validate only this native child's patch scope and its still-active canonical ancestry. */
37
- export async function hasNativeDelegatedPatch(event, repositoryRoot, boundedRead) {
122
+ export async function hasNativeDelegatedPatch(event, repositoryRoot, boundedRead, authorityRoot = repositoryRoot) {
38
123
  if (event.tool_name !== "apply_patch" || typeof event.session_id !== "string" || typeof event.turn_id !== "string") return false;
39
124
  try {
40
125
  const key = createHash("sha256").update(JSON.stringify([event.session_id, event.turn_id])).digest("hex");
41
- const binding = JSON.parse(await boundedRead(resolve(repositoryRoot, ".local/codex-hook-native/v2", key + ".json"), 65536));
126
+ const binding = JSON.parse(await boundedRead(resolve(authorityRoot, ".local/codex-hook-native/v2", key + ".json"), 65536));
42
127
  if (binding.schema_version !== 2 || binding.session_id !== event.session_id || binding.turn_id !== event.turn_id ||
43
- typeof binding.native_session_id !== "string" || ![binding.native_session_id, binding.parent_session_id].includes(event.session_id) ||
128
+ typeof binding.native_session_id !== "string" ||
129
+ ![binding.native_session_id, binding.parent_session_id, binding.host_session_id].includes(event.session_id) ||
44
130
  !Array.isArray(binding.write_scopes) || !binding.write_scopes.length) return false;
45
131
  const readRun = async id => {
46
132
  const match = typeof id === "string" && /^RUN-(\d{4})-(\d{2})-(\d{2})-[A-Z0-9-]+-[A-Z0-9]{2,16}$/.exec(id);
@@ -48,30 +134,42 @@ export async function hasNativeDelegatedPatch(event, repositoryRoot, boundedRead
48
134
  let text;
49
135
  for (const directory of [match[1] + "/" + match[2], match[1] + "/" + match[2] + "/" + match[3]]) {
50
136
  try {
51
- const value = await boundedRead(resolve(repositoryRoot, ".agents/records/runs", directory, id + ".jsonl"), 8388608);
137
+ const value = await boundedRead(resolve(authorityRoot, ".agents/records/runs", directory, id + ".jsonl"), 8388608);
52
138
  if (text !== undefined) throw new Error("ambiguous_run");
53
139
  text = value;
54
140
  } catch (error) { if (error.code !== "ENOENT") throw error; }
55
141
  }
56
142
  if (!text?.endsWith("\n")) throw new Error("incomplete_run");
57
- const records = text.split(/\r?\n/).filter(Boolean).map(JSON.parse);
143
+ const records = readAuthorityRunRecords(text, id);
58
144
  if (records.some((row, i) => row.schema_version !== 2 || row.sequence !== i + 1 || row.run_id !== id ||
59
145
  row.type === "run.finished" || row.type === "run.finalization.decided")) throw new Error("inactive_run");
60
146
  if (records[0]?.type !== "run.started") throw new Error("invalid_run");
61
147
  return records[0];
62
148
  };
63
149
  const child = await readRun(binding.run_id), parent = await readRun(binding.parent_run_id);
150
+ const macro = parent.parent_run_id === null ? null : await readRun(parent.parent_run_id);
151
+ const ownTaskRoot = parent.parent_run_id === null && parent.run_role === "orchestrator";
152
+ const delegatedTaskOrchestrator = macro !== null &&
153
+ parent.run_role === "subagent" && parent.run_purpose === "orchestration" &&
154
+ parent.entrypoint === "task" && typeof parent.spec_id === "string" &&
155
+ macro.agent === "agent-orchestrator" && macro.run_role === "orchestrator" &&
156
+ macro.parent_run_id === null && macro.entrypoint === "spec" &&
157
+ macro.task_id === null && macro.spec_id === parent.spec_id &&
158
+ macro.execution_id === parent.execution_id &&
159
+ child.spec_id === parent.spec_id && child.change_id === parent.change_id;
160
+ if (binding.host_session_id !== undefined &&
161
+ binding.host_session_id !== (macro === null ? parent.client_thread_id : macro.client_thread_id)) return false;
64
162
  if (child.client !== "codex-subagent" || child.run_role !== "subagent" || child.run_purpose !== "execution" ||
65
163
  !child.execution_eligibility?.includes("delivery") || child.parent_run_id !== parent.run_id ||
66
164
  child.client_thread_id !== binding.agent_id || child.client_turn_id !== event.turn_id ||
67
- parent.agent !== "agent-orchestrator" || parent.run_role !== "orchestrator" || parent.parent_run_id !== null ||
165
+ parent.agent !== "agent-orchestrator" || !(ownTaskRoot || delegatedTaskOrchestrator) ||
68
166
  parent.client_thread_id !== binding.parent_session_id ||
69
167
  parent.entrypoint !== "task" || !binding.task_id || !binding.execution_id ||
70
168
  child.task_id !== binding.task_id || parent.task_id !== binding.task_id ||
71
169
  child.execution_id !== binding.execution_id || parent.execution_id !== binding.execution_id) return false;
72
170
  const command = event.tool_input?.command;
73
171
  if (typeof command !== "string") return false;
74
- const scopes = await canonicalScopes(binding.task_id, repositoryRoot, boundedRead);
172
+ const scopes = await canonicalScopes(binding.task_id, authorityRoot, boundedRead);
75
173
  if (JSON.stringify(scopes) !== JSON.stringify(binding.write_scopes)) return false;
76
174
  const paths = [...command.matchAll(/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/gm)].map(match => match[1].trim());
77
175
  for (const path of paths) if (!await isSafePatchPath(resolve(repositoryRoot, path), repositoryRoot)) return false;
@@ -85,5 +183,86 @@ export async function hasNativeDelegatedPatch(event, repositoryRoot, boundedRead
85
183
  });
86
184
  } catch { return false; }
87
185
  }
186
+ export async function hasCurrentTaskOrchestratorRun(event, installedRoot, boundedRead) {
187
+ const threadId = event.session_id, turnId = event.turn_id;
188
+ if (typeof threadId !== "string" || typeof turnId !== "string" || !threadId || !turnId) return false;
189
+ if ((process.env.CODEX_THREAD_ID && threadId !== process.env.CODEX_THREAD_ID) ||
190
+ (process.env.CODEX_TURN_ID && turnId !== process.env.CODEX_TURN_ID)) return false;
191
+ try {
192
+ const digest = createHash("sha256").update(JSON.stringify(["codex", threadId, turnId, null, null])).digest("hex");
193
+ const correlation = JSON.parse(await boundedRead(resolve(installedRoot, ".local/codex-telemetry-spool/v1/correlations", digest + ".json"), 65536, installedRoot));
194
+ const id = correlation.run_id;
195
+ const dated = typeof id === "string" ? /^RUN-(\d{4})-(\d{2})-(\d{2})-[A-Z0-9-]+-[A-Z0-9]{2,16}$/.exec(id) : null;
196
+ if (!dated || correlation.schema_version !== 1 || correlation.thread_id !== threadId || correlation.turn_id !== turnId || correlation.agent_path !== null) return false;
197
+ const candidates = [
198
+ ".agents/records/runs/" + dated[1] + "/" + dated[2] + "/" + id + ".jsonl",
199
+ ".agents/records/runs/" + dated[1] + "/" + dated[2] + "/" + dated[3] + "/" + id + ".jsonl",
200
+ ".agents/data/runs/" + dated[1] + "/" + dated[2] + "/" + dated[3] + "/" + id + ".jsonl",
201
+ ".local/runs/" + dated[1] + "/" + dated[2] + "/" + id + ".jsonl",
202
+ ];
203
+ let selected = null;
204
+ for (const candidate of candidates) {
205
+ try {
206
+ const source = await boundedRead(resolve(installedRoot, candidate), 8388608, installedRoot);
207
+ if (selected !== null) return false;
208
+ selected = source;
209
+ } catch (error) { if (error.code !== "ENOENT") return false; }
210
+ }
211
+ if (selected === null || !selected.endsWith("\n")) return false;
212
+ const records = readAuthorityRunRecords(selected, id), started = records[0];
213
+ if (records.some((record, i) => record.run_id !== id || record.sequence !== i + 1 || record.schema_version !== 2)) return false;
214
+ const valid = started?.type === "run.started" && started.client_thread_id === threadId && started.client_turn_id === turnId &&
215
+ ["codex", "codex-desktop"].includes(started.client) && started.phase === "execution" &&
216
+ typeof started.task_id === "string" && started.task_id.startsWith("TASK-") &&
217
+ typeof started.execution_id === "string" && started.execution_id.startsWith("EXEC-") &&
218
+ started.agent === "agent-orchestrator" && started.run_role === "orchestrator" && started.parent_run_id === null && started.entrypoint === "task" &&
219
+ correlation.task_id === started.task_id && correlation.execution_id === started.execution_id &&
220
+ !records.some(record => record.type === "run.finished" || record.type === "run.finalization.decided");
221
+ return valid ? started : false;
222
+ } catch { return false; }
223
+ }
224
+
225
+ /** A Task's product writer is claimed centrally before any edit. */
226
+ function isolatedGitMatchesClaim(repositoryRoot, authorityRoot, claim) {
227
+ const git = (root, args) => execFileSync("git", ["-C", root, ...args], {
228
+ encoding: "utf8", windowsHide: true, timeout: 15000,
229
+ env: Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(GIT_|NODE_OPTIONS$)/i.test(key))),
230
+ }).trim();
231
+ if (resolve(git(repositoryRoot, ["rev-parse", "--show-toplevel"])) !== resolve(repositoryRoot) ||
232
+ git(repositoryRoot, ["branch", "--show-current"]) !== claim.branch) return false;
233
+ const head = git(repositoryRoot, ["rev-parse", "HEAD"]);
234
+ if (head !== git(authorityRoot, ["rev-parse", claim.branch])) return false;
235
+ return git(authorityRoot, ["worktree", "list", "--porcelain"]).split(/\r?\n\r?\n/).some(block => {
236
+ const lines = block.split(/\r?\n/);
237
+ return lines.some(line => line.startsWith("worktree ") && resolve(line.slice(9)) === resolve(repositoryRoot)) &&
238
+ lines.includes("HEAD " + head) && lines.includes("branch refs/heads/" + claim.branch);
239
+ });
240
+ }
241
+ export async function hasClaimedTaskWriter(event, repositoryRoot, boundedRead, directRun = null, authorityRoot = repositoryRoot) {
242
+ try {
243
+ let runId = directRun?.run_id, taskId = directRun?.task_id, executionId = directRun?.execution_id;
244
+ if (!runId) {
245
+ const key = createHash("sha256").update(JSON.stringify([event.session_id, event.turn_id])).digest("hex");
246
+ const binding = JSON.parse(await boundedRead(resolve(authorityRoot, ".local/codex-hook-native/v2", key + ".json"), 65536));
247
+ if (binding.session_id !== event.session_id || binding.turn_id !== event.turn_id) return false;
248
+ runId = binding.parent_run_id; taskId = binding.task_id; executionId = binding.execution_id;
249
+ }
250
+ if (!/^RUN-[A-Z0-9-]+$/.test(runId ?? "") || !/^TASK-[A-Z0-9-]+$/.test(taskId ?? "") ||
251
+ !/^EXEC-[A-Z0-9-]+$/.test(executionId ?? "")) return false;
252
+ const source = await boundedRead(resolve(authorityRoot, ".local/task-workspaces/shared-writer.json"), 65536).catch(() => null);
253
+ const claim = source === null ? null : JSON.parse(source);
254
+ if (claim?.mode === "shared" && claim.status === "ready" && claim.branch === null &&
255
+ claim.run_id === runId && claim.task_id === taskId && claim.execution_id === executionId &&
256
+ resolve(claim.path) === resolve(authorityRoot) && resolve(repositoryRoot) === resolve(authorityRoot) &&
257
+ resolve(claim.canonical_workspace) === resolve(authorityRoot)) return true;
258
+ const isolated = JSON.parse(await boundedRead(resolve(authorityRoot, ".local/task-workspaces/claims", taskId + ".json"), 65536));
259
+ return isolated.status === "ready" && isolated.mode !== "shared" &&
260
+ isolated.run_id === runId && isolated.task_id === taskId && isolated.execution_id === executionId &&
261
+ typeof isolated.branch === "string" && isolated.branch.startsWith("codex/") &&
262
+ resolve(isolated.path) === resolve(repositoryRoot) &&
263
+ resolve(isolated.canonical_workspace) === resolve(authorityRoot) &&
264
+ isolatedGitMatchesClaim(repositoryRoot, authorityRoot, isolated);
265
+ } catch { return false; }
266
+ }
88
267
  ` + CODEX_VALIDATION_RUNTIME_SUPPORT;
89
268
  //# sourceMappingURL=codex-native-tool-authority-template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codex-native-tool-authority-template.js","sourceRoot":"","sources":["../../src/services/codex-native-tool-authority-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFzD,GAAG,gCAAgC,CAAC"}
1
+ {"version":3,"file":"codex-native-tool-authority-template.js","sourceRoot":"","sources":["../../src/services/codex-native-tool-authority-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,MAAM,CAAC,MAAM,gCAAgC,GAC3C,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyQX,GAAG,gCAAgC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"codex-pre-tool-hook-template.d.ts","sourceRoot":"","sources":["../../src/services/codex-pre-tool-hook-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,QAouB/B,CAAC"}
1
+ {"version":3,"file":"codex-pre-tool-hook-template.d.ts","sourceRoot":"","sources":["../../src/services/codex-pre-tool-hook-template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,QAqpB/B,CAAC"}