@humwick/server 0.0.0-stage → 0.130.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.
- package/CLA.md +66 -0
- package/CONTRIBUTING.md +144 -0
- package/LICENSE +167 -0
- package/README.md +511 -2
- package/SECURITY.md +67 -0
- package/THIRD_PARTY_NOTICES.md +144 -0
- package/bundled/prompts/README.md +10 -0
- package/bundled/prompts/context.advisory.compact.md +1 -0
- package/bundled/prompts/context.advisory.warn.md +1 -0
- package/bundled/prompts/continuation.envelope.md +18 -0
- package/bundled/prompts/manifest.json +838 -0
- package/bundled/prompts/memory.capture.boundary.post.md +1 -0
- package/bundled/prompts/memory.capture.boundary.pre.md +1 -0
- package/bundled/prompts/memory.charter.md +3 -0
- package/bundled/prompts/memory.native-off.md +0 -0
- package/bundled/prompts/notify.agent.exited.md +1 -0
- package/bundled/prompts/notify.agent.never-ready.md +1 -0
- package/bundled/prompts/notify.agent.ready.md +1 -0
- package/bundled/prompts/notify.automation.budget-warning.md +1 -0
- package/bundled/prompts/notify.land.failure.md +1 -0
- package/bundled/prompts/notify.land.steward-taken.coordinator.md +1 -0
- package/bundled/prompts/notify.land.steward-taken.md +1 -0
- package/bundled/prompts/notify.land.success.md +1 -0
- package/bundled/prompts/notify.routing.policy-changed.md +2 -0
- package/bundled/prompts/notify.spawn.failed.md +1 -0
- package/bundled/prompts/notify.spawn.queued.md +1 -0
- package/bundled/prompts/notify.spawn.recovered.md +1 -0
- package/bundled/prompts/notify.spawn.unconfirmed.md +1 -0
- package/bundled/prompts/profile.coordinator.charter.md +17 -0
- package/bundled/prompts/profile.debugger.system.md +12 -0
- package/bundled/prompts/profile.device-qa.system.md +10 -0
- package/bundled/prompts/profile.image-gen.append.0.md +2 -0
- package/bundled/prompts/profile.image-gen.system.md +4 -0
- package/bundled/prompts/profile.ops-assistant.brief.md +4 -0
- package/bundled/prompts/profile.probe.system.md +5 -0
- package/bundled/prompts/profile.qa.system.md +10 -0
- package/bundled/prompts/profile.sec-ops.system.md +14 -0
- package/bundled/prompts/profile.social-media.system.md +7 -0
- package/bundled/prompts/profile.software-design.system.md +26 -0
- package/bundled/prompts/profile.sub-coordinator.charter.md +2 -0
- package/bundled/prompts/profile.worker-gui.system.md +7 -0
- package/bundled/prompts/profile.worker.system.md +2 -0
- package/bundled/prompts/relay.agent-core.delivery.md +13 -0
- package/bundled/prompts/relay.agent-core.engineering.md +13 -0
- package/bundled/prompts/relay.agent-core.md +22 -0
- package/bundled/prompts/relay.context.claude.md +1 -0
- package/bundled/prompts/relay.context.claude.readonly.md +3 -0
- package/bundled/prompts/relay.context.codex.md +1 -0
- package/bundled/prompts/relay.context.opencode.md +1 -0
- package/bundled/prompts/relay.manual.claude.md +8 -0
- package/bundled/prompts/relay.search.fff.md +1 -0
- package/bundled/prompts/relay.temp-dir.md +1 -0
- package/bundled/prompts/relay.web.brave.md +1 -0
- package/bundled/prompts/relay.web.fetch.md +1 -0
- package/bundled/prompts/skill.device-lane.md +20 -0
- package/bundled/prompts/skill.security-code-review.md +10 -0
- package/bundled/prompts/skill.security-hardening.md +10 -0
- package/bundled/prompts/skill.security-host-audit.md +11 -0
- package/bundled/prompts/spawn.primer.md +6 -0
- package/bundled/prompts/spawn.reportup.child.md +3 -0
- package/bundled/prompts/spawn.reportup.coordinator.md +2 -0
- package/bundled/prompts/spawn.reportup.workflow-step.md +4 -0
- package/bundled/prompts/spawn.validation.delivery.md +1 -0
- package/bundled/prompts/spawn.validation.iterate.generic.md +1 -0
- package/bundled/prompts/spawn.validation.iterate.imperative.md +1 -0
- package/bundled/prompts/spawn.validation.landgates.header.md +1 -0
- package/bundled/prompts/steward.merge-stall.md +1 -0
- package/bundled/prompts/steward.prompt.md +20 -0
- package/bundled/prompts/steward.wake.md +1 -0
- package/bundled/prompts/task.claim.instruction.md +1 -0
- package/bundled/prompts/task.hydration.md +23 -0
- package/bundled/prompts/user.response.brief.md +1 -0
- package/bundled/prompts/user.response.normal.md +1 -0
- package/bundled/prompts/user.style.neutral.md +1 -0
- package/bundled/prompts/user.style.warm.md +1 -0
- package/bundled/prompts/workspace.deps.command.md +1 -0
- package/bundled/prompts/workspace.deps.none.md +1 -0
- package/bundled/prompts/workspace.deps.symlink.md +1 -0
- package/bundled/prompts/workspace.lifecycle.md +4 -0
- package/bundled/prompts/workspace.mcp.instructions.md +7 -0
- package/bundled/prompts/workspace.phase.abandoned.headline.md +1 -0
- package/bundled/prompts/workspace.phase.abandoned.hint.md +1 -0
- package/bundled/prompts/workspace.phase.active.headline.md +1 -0
- package/bundled/prompts/workspace.phase.active.hint.md +1 -0
- package/bundled/prompts/workspace.phase.conflict.headline.md +1 -0
- package/bundled/prompts/workspace.phase.conflict.hint.md +1 -0
- package/bundled/prompts/workspace.phase.merge-planned.headline.md +1 -0
- package/bundled/prompts/workspace.phase.merge-planned.hint.md +1 -0
- package/bundled/prompts/workspace.phase.merged.headline.md +1 -0
- package/bundled/prompts/workspace.phase.merged.hint.md +1 -0
- package/bundled/prompts/workspace.phase.ready.headline.md +1 -0
- package/bundled/prompts/workspace.phase.ready.hint.md +1 -0
- package/bundled/prompts/workspace.ready.contract.md +6 -0
- package/bundled/prompts/workspace.symlinks.md +1 -0
- package/bundled/roles/builder.md +18 -0
- package/bundled/roles/design-reviewer.md +13 -0
- package/bundled/roles/designer.md +11 -0
- package/bundled/roles/plan-auditor.md +29 -0
- package/bundled/roles/reviewer.md +36 -0
- package/bundled/roles/slice-qa.md +13 -0
- package/bundled/roles/verifier.md +13 -0
- package/bundled/skills/agent-browser/SKILL.md +72 -0
- package/bundled/skills/test-audit/SKILL.md +75 -0
- package/bundled/workflows/build-review.yaml +8 -0
- package/bundled/workflows/design-review.yaml +60 -0
- package/bundled/workflows/plan-conformance.yaml +5 -0
- package/bundled/workflows/slice-proof.yaml +85 -0
- package/bundled/workflows/verify-deployed.yaml +140 -0
- package/docs/guides/sub-coordinators.md +114 -0
- package/docs/guides/tools-administration.md +83 -0
- package/docs/guides/tools-agents.md +137 -0
- package/docs/guides/tools-coordination.md +228 -0
- package/docs/guides/tools-execution.md +48 -0
- package/docs/guides/tools-issues.md +69 -0
- package/docs/guides/tools-memory.md +150 -0
- package/docs/guides/tools-messages.md +192 -0
- package/docs/guides/tools-operations.md +133 -0
- package/docs/guides/tools-tasks.md +235 -0
- package/docs/guides/workflows.md +324 -0
- package/docs/license-faq.md +37 -0
- package/docs/openapi.json +18531 -0
- package/examples/integrations/github-issue.ts +48 -0
- package/examples/integrations/ops-alert.sh +27 -0
- package/examples/integrations/prometheus-alertmanager.ts +55 -0
- package/examples/integrations/support-ticket.sh +28 -0
- package/node_modules/@humwick/kernel/LICENSE +167 -0
- package/node_modules/@humwick/kernel/async-entity-persistence.ts +344 -0
- package/node_modules/@humwick/kernel/async-event-log.ts +107 -0
- package/node_modules/@humwick/kernel/automations.pilot.ts +147 -0
- package/node_modules/@humwick/kernel/config.ts +111 -0
- package/node_modules/@humwick/kernel/contract.ts +572 -0
- package/node_modules/@humwick/kernel/control-authz.ts +281 -0
- package/node_modules/@humwick/kernel/control.ts +645 -0
- package/node_modules/@humwick/kernel/effects.ts +493 -0
- package/node_modules/@humwick/kernel/event-log.ts +319 -0
- package/node_modules/@humwick/kernel/http-transport.ts +384 -0
- package/node_modules/@humwick/kernel/identity-grammar.ts +20 -0
- package/node_modules/@humwick/kernel/identity.ts +248 -0
- package/node_modules/@humwick/kernel/index.ts +28 -0
- package/node_modules/@humwick/kernel/kernel-persistence.ts +181 -0
- package/node_modules/@humwick/kernel/landing-incident.ts +306 -0
- package/node_modules/@humwick/kernel/landing.ts +953 -0
- package/node_modules/@humwick/kernel/manifest-validation.ts +460 -0
- package/node_modules/@humwick/kernel/mcp-transport.ts +109 -0
- package/node_modules/@humwick/kernel/message-authority-chaos-worker.ts +200 -0
- package/node_modules/@humwick/kernel/message-authority.ts +281 -0
- package/node_modules/@humwick/kernel/module-host.ts +722 -0
- package/node_modules/@humwick/kernel/openapi-init.ts +14 -0
- package/node_modules/@humwick/kernel/package.json +47 -0
- package/node_modules/@humwick/kernel/persistence-schema.ts +248 -0
- package/node_modules/@humwick/kernel/persistence.ts +510 -0
- package/node_modules/@humwick/kernel/registry.ts +60 -0
- package/node_modules/@humwick/kernel/sqlite-kernel-persistence.ts +499 -0
- package/node_modules/@humwick/kernel/sqlite-module-host.ts +87 -0
- package/node_modules/@humwick/kernel/timers-chaos-worker.ts +186 -0
- package/node_modules/@humwick/kernel/timers.pilot.ts +1411 -0
- package/node_modules/@humwick/kernel/workflow-activation.ts +25 -0
- package/node_modules/@humwick/kernel/workflow-backstop.ts +40 -0
- package/node_modules/@humwick/kernel/workflow-cancel-tree.ts +20 -0
- package/node_modules/@humwick/kernel/workflow-chaos-worker.ts +213 -0
- package/node_modules/@humwick/kernel/workflow-composition.ts +231 -0
- package/node_modules/@humwick/kernel/workflow-container.ts +72 -0
- package/node_modules/@humwick/kernel/workflow-control.test-fixture.ts +42 -0
- package/node_modules/@humwick/kernel/workflow-control.ts +178 -0
- package/node_modules/@humwick/kernel/workflow-definition.ts +507 -0
- package/node_modules/@humwick/kernel/workflow-dispatch.ts +60 -0
- package/node_modules/@humwick/kernel/workflow-foreach.ts +167 -0
- package/node_modules/@humwick/kernel/workflow-journal-codec.ts +339 -0
- package/node_modules/@humwick/kernel/workflow-journal.ts +922 -0
- package/node_modules/@humwick/kernel/workflow-lane.ts +48 -0
- package/node_modules/@humwick/kernel/workflow-lease-owner.ts +60 -0
- package/node_modules/@humwick/kernel/workflow-recovery.test-fixture.ts +19 -0
- package/node_modules/@humwick/kernel/workflow-runtime.ts +938 -0
- package/node_modules/@humwick/kernel/workflow-script.ts +11 -0
- package/node_modules/@humwick/kernel/workflow-state.ts +299 -0
- package/node_modules/@humwick/kernel/workflow-step-commit.ts +195 -0
- package/node_modules/@humwick/kernel/workflow-transitions.ts +317 -0
- package/node_modules/@humwick/kernel/workflow-values.ts +153 -0
- package/node_modules/@humwick/kernel/workflow.pilot.ts +376 -0
- package/node_modules/@humwick/offload/LICENSE +167 -0
- package/node_modules/@humwick/offload/README.md +57 -0
- package/node_modules/@humwick/offload/dist/async-runner.d.ts +18 -0
- package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/async-runner.js +158 -0
- package/node_modules/@humwick/offload/dist/async-runner.js.map +1 -0
- package/node_modules/@humwick/offload/dist/envelope.d.ts +25 -0
- package/node_modules/@humwick/offload/dist/envelope.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/envelope.js +80 -0
- package/node_modules/@humwick/offload/dist/envelope.js.map +1 -0
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +10 -0
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +59 -0
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +1 -0
- package/node_modules/@humwick/offload/dist/index.d.ts +5 -0
- package/node_modules/@humwick/offload/dist/index.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/index.js +5 -0
- package/node_modules/@humwick/offload/dist/index.js.map +1 -0
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +62 -0
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/subprocess-runner.js +295 -0
- package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +1 -0
- package/node_modules/@humwick/offload/dist/types.d.ts +111 -0
- package/node_modules/@humwick/offload/dist/types.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/types.js +176 -0
- package/node_modules/@humwick/offload/dist/types.js.map +1 -0
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts +23 -0
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/worker-pool.js +435 -0
- package/node_modules/@humwick/offload/dist/worker-pool.js.map +1 -0
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +2 -0
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/worker-runtime.js +27 -0
- package/node_modules/@humwick/offload/dist/worker-runtime.js.map +1 -0
- package/node_modules/@humwick/offload/dist/worker.d.ts +5 -0
- package/node_modules/@humwick/offload/dist/worker.d.ts.map +1 -0
- package/node_modules/@humwick/offload/dist/worker.js +1 -0
- package/node_modules/@humwick/offload/dist/worker.js.map +1 -0
- package/node_modules/@humwick/offload/package.json +46 -0
- package/node_modules/@humwick/offload/src/async-runner.ts +170 -0
- package/node_modules/@humwick/offload/src/envelope.ts +92 -0
- package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +49 -0
- package/node_modules/@humwick/offload/src/index.ts +4 -0
- package/node_modules/@humwick/offload/src/subprocess-runner.ts +334 -0
- package/node_modules/@humwick/offload/src/types.ts +235 -0
- package/node_modules/@humwick/offload/src/worker-pool.ts +463 -0
- package/node_modules/@humwick/offload/src/worker-runtime.ts +32 -0
- package/node_modules/@humwick/offload/src/worker.ts +5 -0
- package/package.json +229 -4
- package/public/assets/MessageBubble-BWpoBjl4.js +4 -0
- package/public/assets/PlanGraphPanel-C0auck3n.js +2 -0
- package/public/assets/TraceView-DBnOx7AQ.js +5 -0
- package/public/assets/VaultDecisionCard-0kp2oNBC.js +2 -0
- package/public/assets/activity-TMzFOdh2.js +2 -0
- package/public/assets/activity-yLztXEBt.js +2 -0
- package/public/assets/agent-lineage-BbJDR1dW.js +2 -0
- package/public/assets/agent-liveness-DyqxfB-t.js +2 -0
- package/public/assets/agent-name-CTZBrSD9.js +2 -0
- package/public/assets/agent-profiles-BpI_jTxq.js +2 -0
- package/public/assets/agent-project-badge-9TqzUUYE.js +2 -0
- package/public/assets/agent-tools-D4n40pn8.js +2 -0
- package/public/assets/agent-type-icon-D6FUarOf.js +2 -0
- package/public/assets/agents-BYDslkJc.js +2 -0
- package/public/assets/analytics-B-XSbEMC.js +910 -0
- package/public/assets/andromeeda-vGVdxbeo.js +2 -0
- package/public/assets/angular-html-BVBpGdXr.js +2 -0
- package/public/assets/angular-ts-BfdufMKP.js +2 -0
- package/public/assets/api-CIIVBtAV.js +10 -0
- package/public/assets/archive-CIuPSvmx.js +2 -0
- package/public/assets/arrow-right-vFsRqG8V.js +2 -0
- package/public/assets/arrow-up-a-z-CKC2RCjD.js +2 -0
- package/public/assets/artifact-viewer-DdWIfV6M.js +2 -0
- package/public/assets/artifacts-DPN1q4pA.js +2 -0
- package/public/assets/artifacts-oBOqks-2.js +2 -0
- package/public/assets/astro-JKRPP03v.js +2 -0
- package/public/assets/aurora-x-CDeNXAV0.js +2 -0
- package/public/assets/automation-4KcRFXEu.js +2 -0
- package/public/assets/ayu-dark-DluEY0Gj.js +2 -0
- package/public/assets/ayu-light-C3h-C4tm.js +2 -0
- package/public/assets/ayu-mirage-Bqwy1Gya.js +2 -0
- package/public/assets/backlog-Cw9xPTCF.js +2 -0
- package/public/assets/badge-DqJRtj_p.js +2 -0
- package/public/assets/bell-_Yzbxxrt.js +2 -0
- package/public/assets/blade-DA8yMPsw.js +2 -0
- package/public/assets/bot-B0NpDNhr.js +2 -0
- package/public/assets/boxes-Cv7Wq3h4.js +2 -0
- package/public/assets/braces-BOks9SsY.js +2 -0
- package/public/assets/brain-CagXMEKE.js +2 -0
- package/public/assets/brain-circuit-CpQeSmp3.js +2 -0
- package/public/assets/bundle-web-ifbJd0t-.js +14 -0
- package/public/assets/busy-health-CTu32MZt.js +2 -0
- package/public/assets/button-Do6Z3vvn.js +2 -0
- package/public/assets/c-Wt1voDr2.js +2 -0
- package/public/assets/calendar-QJjoZ1JU.js +2 -0
- package/public/assets/calendar-clock-CDG_KBhx.js +2 -0
- package/public/assets/card-C4QJ4hCW.js +2 -0
- package/public/assets/catppuccin-frappe-3VR1Za6u.js +2 -0
- package/public/assets/catppuccin-latte-DwIHMF0Q.js +2 -0
- package/public/assets/catppuccin-macchiato-DYnBP6_5.js +2 -0
- package/public/assets/catppuccin-mocha-DYhrFGRu.js +2 -0
- package/public/assets/channels-BiXzg1G9.js +2 -0
- package/public/assets/chart-column-S02ZGfTR.js +2 -0
- package/public/assets/chat-Ctk2qwvA.js +6 -0
- package/public/assets/check-B3M9Ug1P.js +2 -0
- package/public/assets/chevron-down-BoG3JCZn.js +2 -0
- package/public/assets/chevron-right-iljytE0x.js +2 -0
- package/public/assets/chevron-up-Bv3yC5ma.js +2 -0
- package/public/assets/circle-UESLMi2-.js +2 -0
- package/public/assets/circle-alert-CryagaZd.js +2 -0
- package/public/assets/circle-arrow-up-B432r0Kk.js +2 -0
- package/public/assets/circle-check-CkUkN96J.js +2 -0
- package/public/assets/circle-x-CZ0erS7Q.js +2 -0
- package/public/assets/clipboard-list-W2YeUsxT.js +2 -0
- package/public/assets/clock-3-BH47318N.js +2 -0
- package/public/assets/clock-BWPPBh1_.js +2 -0
- package/public/assets/code-preview-Bm1wWqAp.js +3 -0
- package/public/assets/coffee-CThvmt4R.js +2 -0
- package/public/assets/connectors-C36ax4Vw.js +2 -0
- package/public/assets/copy-DFxhHRtV.js +2 -0
- package/public/assets/copy-button-CjOj4HEf.js +2 -0
- package/public/assets/cosmos-Dn8XrlnS.css +1 -0
- package/public/assets/cosmos-Jj9LK2Wf.js +3993 -0
- package/public/assets/cpp-C5WNSHb9.js +2 -0
- package/public/assets/cpu-Dndy84IU.js +2 -0
- package/public/assets/crate-agent-H6S7-B9T.js +2 -0
- package/public/assets/css-DJp_X0uY.js +2 -0
- package/public/assets/csv-Dx-8-gkx.js +2 -0
- package/public/assets/dark-plus-Cs2F2srj.js +2 -0
- package/public/assets/dependency-graph-Cd1E23wa.js +2 -0
- package/public/assets/deploys-Bwfq146q.js +2 -0
- package/public/assets/dialog-uuJ9_geR.js +6 -0
- package/public/assets/display-CfO7rTuF.js +3 -0
- package/public/assets/dist-B2h2GeWt.js +2 -0
- package/public/assets/dist-BeVYU67E.js +2 -0
- package/public/assets/dist-Bmm-RKub.js +2 -0
- package/public/assets/dist-C1xmD7qJ.js +2 -0
- package/public/assets/dist-C2J943E6.js +2 -0
- package/public/assets/dist-C6lpJDoA.js +2 -0
- package/public/assets/dist-CoWL6B0c.js +2 -0
- package/public/assets/dist-D93SmTNC.js +2 -0
- package/public/assets/dist-Da7HrHNA.js +2 -0
- package/public/assets/dist-DeW2Y1R5.js +2 -0
- package/public/assets/dist-DwBdqQ6H.js +2 -0
- package/public/assets/dist-Dz182zaW.js +2 -0
- package/public/assets/dist-H3DLHJ0C.js +2 -0
- package/public/assets/dist-RrY9C4SI.js +2 -0
- package/public/assets/download-KgtpDbt5.js +2 -0
- package/public/assets/dracula-BHWKrbxM.js +2 -0
- package/public/assets/dracula-soft-5eyTD99u.js +2 -0
- package/public/assets/dropdown-menu-BXiNephE.js +2 -0
- package/public/assets/es2015-DMmZ8vbD.js +42 -0
- package/public/assets/esm-ZSuD7QuY.js +2 -0
- package/public/assets/everforest-dark-sB-x3p7T.js +2 -0
- package/public/assets/everforest-light-Df2xbC6M.js +2 -0
- package/public/assets/external-link-BRfu-fHG.js +2 -0
- package/public/assets/eye-BAP6fHrX.js +2 -0
- package/public/assets/file-code-corner-CXhIR1vB.js +2 -0
- package/public/assets/file-pen-Crunre5f.js +2 -0
- package/public/assets/file-text-CKuoMR2U.js +2 -0
- package/public/assets/files-DhhZI2Ih.js +3 -0
- package/public/assets/flag-CnEG9PH-.js +2 -0
- package/public/assets/flame-CxBuz46L.js +2 -0
- package/public/assets/fleet-BL4UXS_k.js +2 -0
- package/public/assets/fleet-metrics-BkHP-P3R.js +2 -0
- package/public/assets/folder-git-2-CJOmTT06.js +2 -0
- package/public/assets/folder-open-CBUCMSlu.js +2 -0
- package/public/assets/folder-tree-BG3Y9nqH.js +2 -0
- package/public/assets/formatted-body-Cm1RrzmN.js +3 -0
- package/public/assets/formatted-body-impl-DQiOuOD1.js +3 -0
- package/public/assets/gauge-BIODY-BQ.js +2 -0
- package/public/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/public/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/public/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/public/assets/git-branch-yxhV0m8E.js +2 -0
- package/public/assets/git-commit-horizontal-DS1pJ_SS.js +2 -0
- package/public/assets/git-merge-C7eIG425.js +2 -0
- package/public/assets/github-dark-C-LZuMrd.js +2 -0
- package/public/assets/github-dark-default-DXG-b-1a.js +2 -0
- package/public/assets/github-dark-dimmed-Bx1FflLF.js +2 -0
- package/public/assets/github-dark-high-contrast-B_tTalzw.js +2 -0
- package/public/assets/github-light-EUqPIrTm.js +2 -0
- package/public/assets/github-light-default-BXViO-2h.js +2 -0
- package/public/assets/github-light-high-contrast-B68TUdTA.js +2 -0
- package/public/assets/globe-Cl5fXtqs.js +2 -0
- package/public/assets/glsl-Dv5r7kPw.js +2 -0
- package/public/assets/graphql-CcFwQwm0.js +2 -0
- package/public/assets/gruvbox-dark-hard-C820rvS2.js +2 -0
- package/public/assets/gruvbox-dark-medium-BPjhmG05.js +2 -0
- package/public/assets/gruvbox-dark-soft-MrdJrrXF.js +2 -0
- package/public/assets/gruvbox-light-hard-BC_s9l72.js +2 -0
- package/public/assets/gruvbox-light-medium-BAWPOn9u.js +2 -0
- package/public/assets/gruvbox-light-soft-BSMLrYjP.js +2 -0
- package/public/assets/haml-Bg4I2hiD.js +2 -0
- package/public/assets/handlebars-DnwbnL5R.js +2 -0
- package/public/assets/hash-CbtKih3g.js +2 -0
- package/public/assets/horizon-CE9ld1lL.js +2 -0
- package/public/assets/horizon-bright-DSNQnXHK.js +2 -0
- package/public/assets/host-mTgRw7xh.js +2 -0
- package/public/assets/host-providers-dialog-CHqwXTov.js +2 -0
- package/public/assets/hourglass-txu4ax6n.js +2 -0
- package/public/assets/houston-CsvMBhTu.js +2 -0
- package/public/assets/html-C8UlPnhE.js +2 -0
- package/public/assets/html-derivative-CY6NRz-J.js +2 -0
- package/public/assets/http-CoW620Fi.js +2 -0
- package/public/assets/humwick-lockup-on-dark-Ds44Y7BK.svg +19 -0
- package/public/assets/humwick-lockup-on-light-ClALZAHt.svg +19 -0
- package/public/assets/hurl-CSSETujw.js +2 -0
- package/public/assets/imba-DsUTQ-LC.js +2 -0
- package/public/assets/inbox-Dfwk3Gt8.js +2 -0
- package/public/assets/index-B7ZerHLY.css +2 -0
- package/public/assets/index-BK0WV6hF.js +15 -0
- package/public/assets/input-CsTB6jIx.js +2 -0
- package/public/assets/insights-fH1EL-qZ.js +2 -0
- package/public/assets/integrations-C5Oix6ng.js +2 -0
- package/public/assets/issue-ref-chip-ODyondIa.js +3 -0
- package/public/assets/java-CGc3VwQr.js +2 -0
- package/public/assets/javascript-CUt1pgmJ.js +2 -0
- package/public/assets/jinja-CD-Z-FLd.js +2 -0
- package/public/assets/jison-imPNup1l.js +2 -0
- package/public/assets/json-qhed-kSA.js +2 -0
- package/public/assets/json5-BR5RXkoi.js +2 -0
- package/public/assets/jsonc-CYpm1nAK.js +2 -0
- package/public/assets/jsonl-CmCQp5Yx.js +2 -0
- package/public/assets/jsx-CY6oMTks.js +2 -0
- package/public/assets/julia-CjffhBEM.js +2 -0
- package/public/assets/kanagawa-dragon-CXtmUGW6.js +2 -0
- package/public/assets/kanagawa-lotus-BN08jTvb.js +2 -0
- package/public/assets/kanagawa-wave-CTweb8Dz.js +2 -0
- package/public/assets/kernel-Bqr0CZGv.js +2 -0
- package/public/assets/key-round-CcSxl5qr.js +2 -0
- package/public/assets/keyboard-DcmEulph.js +2 -0
- package/public/assets/label-BPBzm9FJ.js +2 -0
- package/public/assets/laserwave-C_8bwKvT.js +2 -0
- package/public/assets/layers-DEfClY-v.js +2 -0
- package/public/assets/legacy-storage-carry-C-tBSxRA.js +2 -0
- package/public/assets/less-DVTAwKKz.js +2 -0
- package/public/assets/lib-D7DTGM1F.js +2 -0
- package/public/assets/lib-G-25QXXf.js +30 -0
- package/public/assets/light-plus-DVQuIRkW.js +2 -0
- package/public/assets/lightbulb-RDhZ4p-D.js +2 -0
- package/public/assets/link-2-off-DfRF9Hwb.js +2 -0
- package/public/assets/link-6RR7Hy3-.js +2 -0
- package/public/assets/list-checks-CwnS3hly.js +2 -0
- package/public/assets/list-ordered-D8nCM7rT.js +2 -0
- package/public/assets/list-todo-9qT0fgxZ.js +2 -0
- package/public/assets/loader-circle-BfPd4kOD.js +2 -0
- package/public/assets/lock-BW8MPKw_.js +2 -0
- package/public/assets/log-viewer-Cvfy6PW7.js +4 -0
- package/public/assets/mail-DyaDmwfY.js +2 -0
- package/public/assets/maintenance-D8CDH5wZ.js +2 -0
- package/public/assets/managed-agents-egllbpij.js +4 -0
- package/public/assets/markdown-BYOwaDjH.js +2 -0
- package/public/assets/markdown-preview-CYSFgVgK.js +3 -0
- package/public/assets/markdown-preview-impl-BteVIjX4.js +2 -0
- package/public/assets/marko-DvhNOisQ.js +2 -0
- package/public/assets/material-theme-Bm3Qr25_.js +2 -0
- package/public/assets/material-theme-darker-2IIEA8gg.js +2 -0
- package/public/assets/material-theme-lighter-uhdI0v04.js +2 -0
- package/public/assets/material-theme-ocean-CHQ94UKr.js +2 -0
- package/public/assets/material-theme-palenight-B5W6OYN7.js +2 -0
- package/public/assets/mdc-CazklSAj.js +2 -0
- package/public/assets/mdx-DQZ5AkYe.js +2 -0
- package/public/assets/memory-C8WmXsyr.js +2 -0
- package/public/assets/message-circle-wjztgHBe.js +2 -0
- package/public/assets/message-square-C-1G8dMM.js +2 -0
- package/public/assets/message-square-reply-B9Z4cbQx.js +2 -0
- package/public/assets/messages-BzQdqlO6.js +2 -0
- package/public/assets/messages-square-DVM1ZtcI.js +2 -0
- package/public/assets/min-dark-BSWPekZh.js +2 -0
- package/public/assets/min-light-DDpmG2fV.js +2 -0
- package/public/assets/minimize-2-BkK6XoMP.js +2 -0
- package/public/assets/monokai-CdkpiU2Y.js +2 -0
- package/public/assets/night-owl-DhmEMT88.js +2 -0
- package/public/assets/night-owl-light-eJ-hLW7d.js +2 -0
- package/public/assets/nord-Cb4Vim4T.js +2 -0
- package/public/assets/octagon-x-B5lnUY-8.js +2 -0
- package/public/assets/one-dark-pro-CLwyXe_n.js +2 -0
- package/public/assets/one-light-D7Lr4KcI.js +2 -0
- package/public/assets/orchestrators-B1HxzkNw.js +2 -0
- package/public/assets/overview-DCUnI4Z7.js +2 -0
- package/public/assets/package-open-ckPgcjpv.js +2 -0
- package/public/assets/package-plus-C1AKMjsl.js +2 -0
- package/public/assets/pairs-ftCd2XcD.js +2 -0
- package/public/assets/paperclip-CNpKZKum.js +2 -0
- package/public/assets/pause-DttnHD4c.js +2 -0
- package/public/assets/pencil-B1Hf2V_J.js +2 -0
- package/public/assets/php-CBqsN0ai.js +2 -0
- package/public/assets/pin-DcsKeXxr.js +2 -0
- package/public/assets/plastic-DQwYfKfQ.js +2 -0
- package/public/assets/play-BbT8m7A0.js +2 -0
- package/public/assets/plug-vIyO9_P8.js +2 -0
- package/public/assets/plug-zap-V0wMDJ-G.js +2 -0
- package/public/assets/plus-D5Ek4e2S.js +2 -0
- package/public/assets/poimandres-DRFjx7u4.js +2 -0
- package/public/assets/popover-8w1TWKMG.js +2 -0
- package/public/assets/postcss-BXeXVLqQ.js +2 -0
- package/public/assets/power-6tZOhYPg.js +2 -0
- package/public/assets/preload-helper-HclGiUj8.js +1 -0
- package/public/assets/profile-icon-B2zH8DMH.js +2 -0
- package/public/assets/projects-B_lmcqfO.js +2 -0
- package/public/assets/prompt-settings-Bftq9czX.js +2 -0
- package/public/assets/provider-brand-icon-_67JR7Zh.js +2 -0
- package/public/assets/provider-display-DbLWpP3j.js +2 -0
- package/public/assets/pug-C5hz5LQ7.js +2 -0
- package/public/assets/python-gzcpVVnB.js +2 -0
- package/public/assets/r-Dzep-lPg.js +2 -0
- package/public/assets/radio-Bn0_qc0G.js +2 -0
- package/public/assets/react-dom-DSFxiC7T.js +2 -0
- package/public/assets/red-CJ3rzSJv.js +2 -0
- package/public/assets/refresh-cw-CfpvQcUn.js +2 -0
- package/public/assets/regexp-Omp9DhTb.js +2 -0
- package/public/assets/registry-DWCU5c8q.js +4 -0
- package/public/assets/repeat-hl4p_Klo.js +2 -0
- package/public/assets/rocket-BmO1qSu-.js +2 -0
- package/public/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/public/assets/rose-pine-BthvhNj6.js +2 -0
- package/public/assets/rose-pine-dawn-Dg85fqjY.js +2 -0
- package/public/assets/rose-pine-moon-hon4tzzS.js +2 -0
- package/public/assets/rotate-ccw-CtD77qkX.js +2 -0
- package/public/assets/rotate-cw-FPtkDewA.js +2 -0
- package/public/assets/run-card-CO_bguQf.js +2 -0
- package/public/assets/sass-DXrisJhu.js +2 -0
- package/public/assets/save-B_PGqSm4.js +2 -0
- package/public/assets/scroll-area-CIN4KQse.js +2 -0
- package/public/assets/scss-DdSxiZKl.js +2 -0
- package/public/assets/search-DjzbnTbf.js +2 -0
- package/public/assets/secrets-C7GIUATz.js +2 -0
- package/public/assets/security-BUFau5-N.js +3 -0
- package/public/assets/select-DTQMP4Dk.js +2 -0
- package/public/assets/separator-t1cLZErD.js +2 -0
- package/public/assets/server-CZIRjFyY.js +2 -0
- package/public/assets/service-access-settings-C3aujqTG.js +2 -0
- package/public/assets/settings-C6sZ9eBa.js +6 -0
- package/public/assets/shellscript-CLZ0U2zV.js +2 -0
- package/public/assets/shield-CtXNUA0i.js +2 -0
- package/public/assets/shield-alert-B9jCWcKW.js +2 -0
- package/public/assets/shipping-Bu8p1gEw.js +2 -0
- package/public/assets/shipping-stats-BiMTsA4A.js +2 -0
- package/public/assets/slack-dark-DnToyrRv.js +2 -0
- package/public/assets/slack-ochin-B2OO5cIa.js +2 -0
- package/public/assets/smile-plus-q6EQBXHZ.js +2 -0
- package/public/assets/snazzy-light-4G7pJPwS.js +2 -0
- package/public/assets/solarized-dark-DV17i1UV.js +2 -0
- package/public/assets/solarized-light-DSh2HLQt.js +2 -0
- package/public/assets/sparkles-CzwR10ZU.js +2 -0
- package/public/assets/sql-DNssxck8.js +2 -0
- package/public/assets/square-Bqly37YM.js +2 -0
- package/public/assets/stats-V9Z-GxUd.js +2 -0
- package/public/assets/status-dot-CVv0iGHL.js +2 -0
- package/public/assets/stethoscope-SCBrnQQ8.js +2 -0
- package/public/assets/store-BvtFdlGX.js +9 -0
- package/public/assets/stylus-B6D30XZt.js +2 -0
- package/public/assets/svelte-DOdLCIlh.js +2 -0
- package/public/assets/switch-DuCA7mrB.js +2 -0
- package/public/assets/synthwave-84-nFMaYfgc.js +2 -0
- package/public/assets/tabs-jZgNvNHr.js +2 -0
- package/public/assets/task-chip-CYj0mpoL.js +2 -0
- package/public/assets/tasks-BIyeAaPC.js +2 -0
- package/public/assets/tasks-CXU75HRF.js +11 -0
- package/public/assets/teams-BPf976zb.js +2 -0
- package/public/assets/terminal-Bl2u7KxT.js +2 -0
- package/public/assets/terminal-viewer-DE9BOe-8.js +3 -0
- package/public/assets/terminal-viewer-impl-BrP-ENHg.css +1 -0
- package/public/assets/terminal-viewer-impl-D04pjmGh.js +143 -0
- package/public/assets/textarea-hs6Mpyfl.js +2 -0
- package/public/assets/themes-G5j9m1Ji.js +2 -0
- package/public/assets/tokyo-night-oM2G3aXe.js +2 -0
- package/public/assets/trash-2-FbcSq927.js +2 -0
- package/public/assets/triangle-alert-BBNhfgMi.js +2 -0
- package/public/assets/ts-tags-Ca73dJJY.js +2 -0
- package/public/assets/tsx-5Eka4NBX.js +2 -0
- package/public/assets/typescript-DOu2WMV5.js +2 -0
- package/public/assets/use-agent-terminal-B1yR456R.js +2 -0
- package/public/assets/use-decisions-D-S4tpDf.js +2 -0
- package/public/assets/use-project-list-B-T2Bnnn.js +2 -0
- package/public/assets/use-selectors-CnrAk2YP.js +6 -0
- package/public/assets/user-avatar-nBFIcR4M.js +2 -0
- package/public/assets/user-cog-CKcouW1J.js +2 -0
- package/public/assets/user-plus-D9749q73.js +2 -0
- package/public/assets/users-C7B3u9jv.js +2 -0
- package/public/assets/versioned-prompt-editor-Diu8BIaM.js +8 -0
- package/public/assets/vesper-DdrHHSXu.js +2 -0
- package/public/assets/vitesse-black-fwtXNY1n.js +2 -0
- package/public/assets/vitesse-dark-BZCL-v6S.js +2 -0
- package/public/assets/vitesse-light-VbXTXTou.js +2 -0
- package/public/assets/volume-2-XrcRKD9Z.js +2 -0
- package/public/assets/vue-Bfx0ffIq.js +2 -0
- package/public/assets/vue-html-BeluIYX0.js +2 -0
- package/public/assets/vue-vine-DGUAbOCX.js +2 -0
- package/public/assets/warehouse-BanzOanY.js +2 -0
- package/public/assets/wasm-BnjxR4X6.js +2 -0
- package/public/assets/wasm-ByWQv1Qj.js +2 -0
- package/public/assets/waypoints-CIzINtLT.js +2 -0
- package/public/assets/wgsl-BsKzXJz4.js +2 -0
- package/public/assets/wit-DdvCle-K.js +2 -0
- package/public/assets/work-queue-TCjJxeT-.js +2 -0
- package/public/assets/workflow-marker-Cf3Hf2fN.js +2 -0
- package/public/assets/workflows-CXQX20Qj.js +6 -0
- package/public/assets/workspaces-qSYzKYMA.js +3 -0
- package/public/assets/wrench-C7-4CgnY.js +2 -0
- package/public/assets/x-Bge17hWJ.js +2 -0
- package/public/assets/xml-DIqSwXR3.js +2 -0
- package/public/assets/yaml-rwi0_p6S.js +2 -0
- package/public/assets/zap-DGuDTw4w.js +2 -0
- package/public/assets/zoom-in-Bs8Qv8VL.js +2 -0
- package/public/assets/zoomable-image-B3Og53nj.js +2 -0
- package/public/cosmos/audio/README.md +50 -0
- package/public/cosmos/audio/alert.mp3 +0 -0
- package/public/cosmos/audio/ambient-bed.mp3 +0 -0
- package/public/cosmos/audio/comet.mp3 +0 -0
- package/public/cosmos/audio/cross-galaxy.mp3 +0 -0
- package/public/cosmos/audio/deploy.mp3 +0 -0
- package/public/cosmos/audio/galaxy-dissipate.mp3 +0 -0
- package/public/cosmos/audio/galaxy-form.mp3 +0 -0
- package/public/cosmos/audio/land.mp3 +0 -0
- package/public/cosmos/audio/reap.mp3 +0 -0
- package/public/cosmos/audio/spawn.mp3 +0 -0
- package/public/cosmos.html +34 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +10 -0
- package/public/icons/apple-touch-icon.png +0 -0
- package/public/icons/humwick-192.png +0 -0
- package/public/icons/humwick-512.png +0 -0
- package/public/icons/humwick.svg +19 -0
- package/public/index.html +188 -0
- package/public/manifest.webmanifest +45 -0
- package/public/sw.js +160 -0
- package/recipes/code-review.yaml +26 -0
- package/recipes/debug.yaml +20 -0
- package/recipes/feature.yaml +26 -0
- package/recipes/refactor.yaml +20 -0
- package/recipes/test.yaml +20 -0
- package/runner/LICENSE +167 -0
- package/runner/agent-bin/agent-relay-browser +10 -0
- package/runner/agent-bin/humwick +10 -0
- package/runner/hooks/fff-search-redirect/fff-search-redirect.cjs +161 -0
- package/runner/hooks/fff-search-redirect/hooks.json +13 -0
- package/runner/hooks/rg-r-guard/hooks.json +18 -0
- package/runner/hooks/rg-r-guard/rg-r-guard.cjs +144 -0
- package/runner/hooks/web-tools-redirect/hooks.json +13 -0
- package/runner/hooks/web-tools-redirect/web-tools-redirect.cjs +84 -0
- package/runner/plugins/browser/skills/playwright-cli/SKILL.md +53 -0
- package/runner/plugins/claude/.claude-plugin/plugin.json +8 -0
- package/runner/plugins/claude/claude-statusline-probe.cjs +144 -0
- package/runner/plugins/claude/hooks/gate-run-guard.provisioned.mjs +914 -0
- package/runner/plugins/claude/hooks/gate-run-guard.sh +9 -0
- package/runner/plugins/claude/hooks/gate-run-guard.ts +237 -0
- package/runner/plugins/claude/hooks/hooks.json +158 -0
- package/runner/plugins/claude/hooks/kill-guard.provisioned.mjs +7027 -0
- package/runner/plugins/claude/hooks/kill-guard.sh +341 -0
- package/runner/plugins/claude/hooks/kill-guard.ts +337 -0
- package/runner/plugins/claude/hooks/permission-request.sh +22 -0
- package/runner/plugins/claude/hooks/post-compact.sh +10 -0
- package/runner/plugins/claude/hooks/post-tool-use.sh +8 -0
- package/runner/plugins/claude/hooks/pre-compact.sh +12 -0
- package/runner/plugins/claude/hooks/read-only-bash-guard.sh +587 -0
- package/runner/plugins/claude/hooks/relay-status.sh +373 -0
- package/runner/plugins/claude/hooks/session-end.sh +26 -0
- package/runner/plugins/claude/hooks/session-start.sh +31 -0
- package/runner/plugins/claude/hooks/shell-trust.ts +28 -0
- package/runner/plugins/claude/hooks/stop-failure.sh +47 -0
- package/runner/plugins/claude/hooks/stop.sh +48 -0
- package/runner/plugins/claude/hooks/subagent-guard.cjs +26 -0
- package/runner/plugins/claude/hooks/subagent-skill-policy.cjs +160 -0
- package/runner/plugins/claude/hooks/subagent-start.sh +13 -0
- package/runner/plugins/claude/hooks/subagent-stop.sh +19 -0
- package/runner/plugins/claude/hooks/user-prompt-submit.sh +18 -0
- package/runner/plugins/claude/hooks/wait-loop-guard.ts +120 -0
- package/runner/plugins/claude/monitors/monitors.json +7 -0
- package/runner/plugins/claude/monitors/relay-monitor.provisioned.mjs +786 -0
- package/runner/plugins/claude/monitors/relay-monitor.ts +58 -0
- package/runner/plugins/claude/skills/disconnect/SKILL.md +16 -0
- package/runner/plugins/claude/skills/label/SKILL.md +23 -0
- package/runner/plugins/claude/skills/message/SKILL.md +40 -0
- package/runner/plugins/claude/skills/pair/SKILL.md +30 -0
- package/runner/plugins/claude/skills/react/SKILL.md +18 -0
- package/runner/plugins/claude/skills/read-message/SKILL.md +24 -0
- package/runner/plugins/claude/skills/reply/SKILL.md +44 -0
- package/runner/plugins/claude/skills/send-claimable/SKILL.md +39 -0
- package/runner/plugins/claude/skills/slice-first/SKILL.md +32 -0
- package/runner/plugins/claude/skills/slice-first/references/plan-recipe.md +46 -0
- package/runner/plugins/claude/skills/status/SKILL.md +16 -0
- package/runner/plugins/claude/skills/tags/SKILL.md +25 -0
- package/runner/plugins/claude/skills/task/SKILL.md +28 -0
- package/runner/plugins/claude-output-style/.claude-plugin/plugin.json +5 -0
- package/runner/plugins/claude-output-style/output-styles/agent-relay.md +5 -0
- package/runner/plugins/codex/skills/disconnect/SKILL.md +15 -0
- package/runner/plugins/codex/skills/guide/SKILL.md +15 -0
- package/runner/plugins/codex/skills/label/SKILL.md +22 -0
- package/runner/plugins/codex/skills/message/SKILL.md +40 -0
- package/runner/plugins/codex/skills/pair/SKILL.md +29 -0
- package/runner/plugins/codex/skills/react/SKILL.md +17 -0
- package/runner/plugins/codex/skills/read-message/SKILL.md +23 -0
- package/runner/plugins/codex/skills/reply/SKILL.md +44 -0
- package/runner/plugins/codex/skills/send-claimable/SKILL.md +39 -0
- package/runner/plugins/codex/skills/slice-first/SKILL.md +32 -0
- package/runner/plugins/codex/skills/slice-first/references/plan-recipe.md +46 -0
- package/runner/plugins/codex/skills/status/SKILL.md +15 -0
- package/runner/plugins/codex/skills/tags/SKILL.md +24 -0
- package/runner/plugins/codex/skills/task/SKILL.md +28 -0
- package/runner/src/adapter.ts +1061 -0
- package/runner/src/adapters/__fixtures__/codex-app-server.ts +47 -0
- package/runner/src/adapters/claude-api.ts +243 -0
- package/runner/src/adapters/claude-context-command.ts +16 -0
- package/runner/src/adapters/claude-credentials.ts +22 -0
- package/runner/src/adapters/claude-delivery-lanes.ts +28 -0
- package/runner/src/adapters/claude-delivery.ts +166 -0
- package/runner/src/adapters/claude-effort.ts +94 -0
- package/runner/src/adapters/claude-exit.ts +290 -0
- package/runner/src/adapters/claude-headless-mirror.ts +88 -0
- package/runner/src/adapters/claude-headless-refusal.ts +51 -0
- package/runner/src/adapters/claude-headless.ts +617 -0
- package/runner/src/adapters/claude-monitor-delivery-plan.ts +317 -0
- package/runner/src/adapters/claude-permission.ts +243 -0
- package/runner/src/adapters/claude-prompt-gates.ts +269 -0
- package/runner/src/adapters/claude-prompt-hook.ts +145 -0
- package/runner/src/adapters/claude-session-capture.ts +293 -0
- package/runner/src/adapters/claude-session-probe.ts +414 -0
- package/runner/src/adapters/claude-shutdown.ts +190 -0
- package/runner/src/adapters/claude-status-detectors.ts +426 -0
- package/runner/src/adapters/claude-subagents.ts +93 -0
- package/runner/src/adapters/claude-submit-confirmation.ts +287 -0
- package/runner/src/adapters/claude-tmux.ts +548 -0
- package/runner/src/adapters/claude-token-usage-capture.ts +253 -0
- package/runner/src/adapters/claude-tool-policy.ts +165 -0
- package/runner/src/adapters/claude-transcript-tail.ts +193 -0
- package/runner/src/adapters/claude-transcript.ts +812 -0
- package/runner/src/adapters/claude.ts +1097 -0
- package/runner/src/adapters/codex-agent-message-capture.ts +189 -0
- package/runner/src/adapters/codex-app-server.ts +70 -0
- package/runner/src/adapters/codex-client.ts +362 -0
- package/runner/src/adapters/codex-effective-config.ts +87 -0
- package/runner/src/adapters/codex-launch-config.ts +153 -0
- package/runner/src/adapters/codex-rollout-context.ts +272 -0
- package/runner/src/adapters/codex-skill-discovery.ts +18 -0
- package/runner/src/adapters/codex-token-usage-capture.ts +163 -0
- package/runner/src/adapters/codex-tool-output.ts +53 -0
- package/runner/src/adapters/codex-turn-outcome.ts +27 -0
- package/runner/src/adapters/codex-version.ts +64 -0
- package/runner/src/adapters/codex.ts +1442 -0
- package/runner/src/adapters/incremental-file.ts +110 -0
- package/runner/src/adapters/opencode-api.ts +71 -0
- package/runner/src/adapters/opencode-context.ts +277 -0
- package/runner/src/adapters/opencode-model-registry.ts +126 -0
- package/runner/src/adapters/opencode-provider.ts +169 -0
- package/runner/src/adapters/opencode-server-retry.ts +50 -0
- package/runner/src/adapters/opencode-soft-steer.ts +302 -0
- package/runner/src/adapters/opencode-spawn.ts +145 -0
- package/runner/src/adapters/opencode-subscribe.ts +62 -0
- package/runner/src/adapters/opencode-token-usage-capture.ts +187 -0
- package/runner/src/adapters/opencode-tool-events.ts +302 -0
- package/runner/src/adapters/opencode-tools-config.ts +17 -0
- package/runner/src/adapters/opencode.ts +2264 -0
- package/runner/src/adapters/project-shell.ts +80 -0
- package/runner/src/adapters/provider-launch-config.ts +21 -0
- package/runner/src/adapters/provider-quota-harvest.ts +127 -0
- package/runner/src/adapters/service-access.ts +153 -0
- package/runner/src/adapters/tmux-offload.ts +207 -0
- package/runner/src/adapters/tool-summary.ts +214 -0
- package/runner/src/agent-redact.ts +75 -0
- package/runner/src/agent-runner/commands/dispatch.ts +185 -0
- package/runner/src/agent-runner/commands/lifecycle.ts +84 -0
- package/runner/src/agent-runner/commands/prompt.ts +284 -0
- package/runner/src/agent-runner/credentials.ts +208 -0
- package/runner/src/agent-runner/http-liveness.ts +85 -0
- package/runner/src/agent-runner/lifecycle-milestones.ts +207 -0
- package/runner/src/agent-runner/lifecycle-phase.ts +80 -0
- package/runner/src/agent-runner/registration.ts +163 -0
- package/runner/src/agent-runner/runner-context.ts +158 -0
- package/runner/src/agent-runner/session-mirror.ts +278 -0
- package/runner/src/agent-runner/task-claims.ts +116 -0
- package/runner/src/agent-runner/token-usage-coverage.ts +54 -0
- package/runner/src/agent-runner/turn-report.ts +269 -0
- package/runner/src/api-budget-accounting.ts +91 -0
- package/runner/src/area-memory.ts +255 -0
- package/runner/src/artifact-path-materialize.ts +52 -0
- package/runner/src/async-guard.ts +35 -0
- package/runner/src/attachment-cache-sweep.ts +31 -0
- package/runner/src/attachment-cache.ts +195 -0
- package/runner/src/background-script-reconcile.ts +106 -0
- package/runner/src/bounded-log.ts +59 -0
- package/runner/src/bounded-spawn-sync.ts +18 -0
- package/runner/src/busy-reconciler.ts +282 -0
- package/runner/src/claim-tracker.ts +140 -0
- package/runner/src/claude-settings.ts +167 -0
- package/runner/src/claude-workspace-trust.ts +289 -0
- package/runner/src/config.ts +547 -0
- package/runner/src/context-boundary.ts +101 -0
- package/runner/src/context-command.ts +151 -0
- package/runner/src/context-probe-state.ts +6 -0
- package/runner/src/continuation-archive.ts +179 -0
- package/runner/src/control-server.ts +730 -0
- package/runner/src/delivery-policy.ts +9 -0
- package/runner/src/delivery-result.ts +24 -0
- package/runner/src/effort-command.ts +125 -0
- package/runner/src/empty-turn.ts +816 -0
- package/runner/src/free-port.ts +25 -0
- package/runner/src/fs-offload.ts +26 -0
- package/runner/src/gate-run-config.ts +35 -0
- package/runner/src/gate-run-lease-probe.ts +38 -0
- package/runner/src/host-asset-plan.ts +450 -0
- package/runner/src/host-claude-config-worker.ts +34 -0
- package/runner/src/host-sources.ts +40 -0
- package/runner/src/inbox-carrier.ts +7 -0
- package/runner/src/index.ts +386 -0
- package/runner/src/launch-assembly.ts +955 -0
- package/runner/src/liveness.ts +105 -0
- package/runner/src/logger.ts +108 -0
- package/runner/src/mcp-outbox.ts +204 -0
- package/runner/src/mcp-preflight.ts +86 -0
- package/runner/src/mcp-source-selection.ts +54 -0
- package/runner/src/mcp-tool-deferral.ts +35 -0
- package/runner/src/mcp-vault-env.ts +25 -0
- package/runner/src/message-body-config/config.ts +16 -0
- package/runner/src/message-body-config.ts +1 -0
- package/runner/src/mid-turn-delivery.ts +43 -0
- package/runner/src/native-memory-lever.ts +329 -0
- package/runner/src/native-self-resume.ts +244 -0
- package/runner/src/outbox.ts +453 -0
- package/runner/src/park-post.ts +17 -0
- package/runner/src/pending-permission-store.ts +148 -0
- package/runner/src/process-meta.ts +9 -0
- package/runner/src/profile-home.ts +419 -0
- package/runner/src/profile-projection.ts +411 -0
- package/runner/src/project-hooks.ts +65 -0
- package/runner/src/project-instructions.ts +119 -0
- package/runner/src/provider-double.ts +59 -0
- package/runner/src/provider-hold.ts +228 -0
- package/runner/src/provider-home-marker.ts +3 -0
- package/runner/src/provider-home-tombstone.ts +4 -0
- package/runner/src/provider-input-queue.ts +134 -0
- package/runner/src/provider-integration.ts +93 -0
- package/runner/src/provider-processes.ts +17 -0
- package/runner/src/provider-submit-failure.ts +15 -0
- package/runner/src/providers.ts +35 -0
- package/runner/src/provisioning.ts +703 -0
- package/runner/src/question-decision.ts +18 -0
- package/runner/src/quota.ts +22 -0
- package/runner/src/rate-limit.ts +351 -0
- package/runner/src/refused-prompt-store.ts +36 -0
- package/runner/src/relay-injection-events.ts +161 -0
- package/runner/src/relay-instructions.ts +107 -0
- package/runner/src/relay-mcp-proxy.long-turn-e2e.ts +183 -0
- package/runner/src/relay-mcp-proxy.ts +704 -0
- package/runner/src/relay-mcp.ts +583 -0
- package/runner/src/reply-obligation-cache.ts +211 -0
- package/runner/src/response-capture-report.ts +111 -0
- package/runner/src/response-routing.ts +6 -0
- package/runner/src/runner-core.ts +2955 -0
- package/runner/src/runner-exit.ts +12 -0
- package/runner/src/runner-helpers.ts +582 -0
- package/runner/src/runner-insights.ts +105 -0
- package/runner/src/runner-mcp-proxy.ts +46 -0
- package/runner/src/runner-spawn-config.ts +68 -0
- package/runner/src/runner-stale-scratch-sweep.ts +21 -0
- package/runner/src/runner.ts +9 -0
- package/runner/src/runtime-token-file.ts +45 -0
- package/runner/src/runtime-token-remint.ts +56 -0
- package/runner/src/service-access.ts +88 -0
- package/runner/src/session-destroy.ts +27 -0
- package/runner/src/session-insights.ts +118 -0
- package/runner/src/session-scratch.ts +296 -0
- package/runner/src/spawn-input.ts +147 -0
- package/runner/src/startup-config-fetch.ts +48 -0
- package/runner/src/subreaper.ts +113 -0
- package/runner/src/template-resolver.ts +29 -0
- package/runner/src/test-run-dedup.ts +435 -0
- package/runner/src/transcript-context.ts +99 -0
- package/runner/src/transport-errors.ts +48 -0
- package/runner/src/turn-opener.ts +55 -0
- package/runner/src/turn-reconcile-event.ts +88 -0
- package/runner/src/vault-proxy-hop.ts +99 -0
- package/runner/src/version.ts +44 -0
- package/runner/src/web-tool-call-proxy.ts +128 -0
- package/runner/src/web-tools.ts +59 -0
- package/runner/test-support/codex-web-config-proof.ts +149 -0
- package/runner/test-support/effective-launch.ts +189 -0
- package/runner/test-support/native-context-sources.ts +77 -0
- package/runner/test-support/provisioning-context.ts +55 -0
- package/runner/test-support/recorder-double.ts +130 -0
- package/runner/test-support/recording-provider.ts +242 -0
- package/runner/test-support/runner-harness.ts +249 -0
- package/runner/test-support/service-access-fixture.ts +12 -0
- package/scripts/agent-vault/bootstrap.py +87 -0
- package/scripts/agent-vault/install.py +200 -0
- package/scripts/agent-vault/install_refresh.py +98 -0
- package/scripts/agent-vault/refresh.py +116 -0
- package/scripts/agent-vault/refresh_provision.py +109 -0
- package/scripts/agent-vault/refresh_store.py +54 -0
- package/scripts/agent-vault/runtime.py +253 -0
- package/scripts/agent-vault/sec-ops-activation.json +23 -0
- package/scripts/artifact-checkout-gc.ts +51 -0
- package/scripts/cd-config.ts +224 -0
- package/scripts/cd-deploy-debounce.ts +94 -0
- package/scripts/cd-deploy-worktree-gc.ts +235 -0
- package/scripts/cd-fleet-membership.ts +48 -0
- package/scripts/cd-host-epochs.ts +101 -0
- package/scripts/cd-hub-wake.ts +40 -0
- package/scripts/cd-land-boundary.ts +49 -0
- package/scripts/cd-watcher.ts +985 -0
- package/scripts/dashboard-build-marker.ts +71 -0
- package/scripts/fleet-sha-coverage.ts +66 -0
- package/scripts/gate-run-lease.ts +329 -0
- package/scripts/gate-slot +9 -0
- package/scripts/gate-slot-fleet-health.ts +60 -0
- package/scripts/gate.sh +6 -0
- package/scripts/install-bin-shim.cjs +149 -0
- package/scripts/orchestrator-spawn-smoke.ts +398 -0
- package/scripts/provisioning-matrix.ts +72 -0
- package/scripts/release-cd-stamp.ts +146 -0
- package/scripts/release-health.ts +133 -0
- package/scripts/release-report.ts +102 -0
- package/scripts/release-upgrade.ts +1296 -0
- package/scripts/steward-policy-cleanup.ts +73 -0
- package/scripts/wait-for-deploy.ts +43 -0
- package/src/agent-authz.ts +219 -0
- package/src/agent-branch-state.ts +45 -0
- package/src/agent-busy-health.ts +158 -0
- package/src/agent-card-projection.ts +86 -0
- package/src/agent-channel-binding.ts +49 -0
- package/src/agent-command-activity.ts +39 -0
- package/src/agent-core.ts +29 -0
- package/src/agent-death-diagnosis.ts +314 -0
- package/src/agent-drive-arbiter.ts +112 -0
- package/src/agent-exit-alarm.ts +10 -0
- package/src/agent-exit-cleanup-async.ts +69 -0
- package/src/agent-exit-cleanup.ts +99 -0
- package/src/agent-exit-report.ts +28 -0
- package/src/agent-issue-repo.ts +53 -0
- package/src/agent-launch-shape-redaction.ts +72 -0
- package/src/agent-lifecycle-events.ts +428 -0
- package/src/agent-principal.ts +14 -0
- package/src/agent-profile-catalog.ts +188 -0
- package/src/agent-ref.ts +340 -0
- package/src/agent-spawn.ts +45 -0
- package/src/agent-status-events.ts +41 -0
- package/src/agent-system-tags.ts +38 -0
- package/src/artifact-media.ts +34 -0
- package/src/artifact-storage.ts +245 -0
- package/src/artifact-text.ts +31 -0
- package/src/async-deadline.ts +59 -0
- package/src/auth/admin-routes.ts +36 -0
- package/src/auth/index.ts +23 -0
- package/src/auth/login-rate-limiter.ts +153 -0
- package/src/auth/password.ts +142 -0
- package/src/auth/provider.ts +60 -0
- package/src/auth/role-scopes.ts +15 -0
- package/src/auth/session-cookie.ts +35 -0
- package/src/auth/session-refresh.ts +61 -0
- package/src/auth/session.test-fixture.ts +10 -0
- package/src/auth/session.ts +107 -0
- package/src/authority-audit.ts +56 -0
- package/src/authz-meta-keys.ts +64 -0
- package/src/auto-spawn-dispatch.ts +154 -0
- package/src/automations/constants.ts +14 -0
- package/src/automations/cron.ts +129 -0
- package/src/automations/crud.ts +129 -0
- package/src/automations/dispatch.ts +299 -0
- package/src/automations/index.ts +5 -0
- package/src/automations/precheck.ts +124 -0
- package/src/automations/reconcile.ts +314 -0
- package/src/automations/storage.ts +200 -0
- package/src/automations/types.ts +16 -0
- package/src/automations/validation.ts +216 -0
- package/src/automations.ts +1 -0
- package/src/branch-landed.ts +761 -0
- package/src/browser-authz.ts +18 -0
- package/src/browser-config.ts +31 -0
- package/src/bundled-workflows.ts +48 -0
- package/src/bus-outbox-async.ts +16 -0
- package/src/bus-outbox.ts +265 -0
- package/src/bus-resume-commands.ts +18 -0
- package/src/bus.ts +792 -0
- package/src/canonical-repo-root.ts +131 -0
- package/src/cd-deploy-notify.ts +59 -0
- package/src/cd-host-deferrals.ts +23 -0
- package/src/cd-host-lag-notify.ts +36 -0
- package/src/cd-repository.ts +49 -0
- package/src/channel-output-control.ts +43 -0
- package/src/channel-output-validation.ts +11 -0
- package/src/channel-policy-health.ts +20 -0
- package/src/channel-target.ts +40 -0
- package/src/channels-host-service.ts +219 -0
- package/src/ci/bun-test-log.ts +41 -0
- package/src/ci/failed-test-files.ts +52 -0
- package/src/ci/gate-history.ts +66 -0
- package/src/ci/github-actions.ts +145 -0
- package/src/ci/incidents.ts +175 -0
- package/src/ci/index.ts +6 -0
- package/src/ci/job-verdict.ts +27 -0
- package/src/ci/land-boundary-ci.ts +104 -0
- package/src/ci/monitor.ts +528 -0
- package/src/ci/not-triggered.ts +116 -0
- package/src/ci/notifications.ts +234 -0
- package/src/ci/provider.ts +87 -0
- package/src/ci/root-missing.ts +35 -0
- package/src/ci/transition-notify.ts +279 -0
- package/src/ci-monitor.ts +7 -0
- package/src/claude-api-budget-async.ts +11 -0
- package/src/claude-api-budget-config.ts +23 -0
- package/src/claude-api-expiry.ts +70 -0
- package/src/claude-api-overflow.ts +146 -0
- package/src/claude-app/config.ts +13 -0
- package/src/claude-app/oauth-http.ts +127 -0
- package/src/claude-app/oauth-provider.ts +136 -0
- package/src/claude-app/passphrase.ts +14 -0
- package/src/claude-app-auth.ts +65 -0
- package/src/claude-app-gateway.ts +68 -0
- package/src/cli/_shared.ts +136 -0
- package/src/cli/agent-detect.ts +175 -0
- package/src/cli/agent-guide.ts +152 -0
- package/src/cli/agent-keep.ts +37 -0
- package/src/cli/agent-meta.ts +111 -0
- package/src/cli/artifact.ts +154 -0
- package/src/cli/browser.ts +56 -0
- package/src/cli/channel-output.ts +17 -0
- package/src/cli/channels-host.ts +13 -0
- package/src/cli/channels.ts +16 -0
- package/src/cli/claude-api-budget.ts +41 -0
- package/src/cli/context-probe.ts +90 -0
- package/src/cli/credentials.ts +1 -0
- package/src/cli/daemon.ts +125 -0
- package/src/cli/dev.ts +185 -0
- package/src/cli/ephemeral.ts +159 -0
- package/src/cli/hosts.ts +41 -0
- package/src/cli/index.ts +442 -0
- package/src/cli/introspect.ts +74 -0
- package/src/cli/maintenance.ts +24 -0
- package/src/cli/merges.ts +78 -0
- package/src/cli/message.ts +229 -0
- package/src/cli/orchestrator.ts +384 -0
- package/src/cli/pair.ts +135 -0
- package/src/cli/profile.ts +35 -0
- package/src/cli/project.ts +52 -0
- package/src/cli/prompts.ts +23 -0
- package/src/cli/provider-enablement.ts +42 -0
- package/src/cli/provider.ts +230 -0
- package/src/cli/recipe.ts +110 -0
- package/src/cli/reply.ts +130 -0
- package/src/cli/roles.ts +60 -0
- package/src/cli/routing-policy.ts +20 -0
- package/src/cli/run.ts +96 -0
- package/src/cli/secrets-backup.ts +85 -0
- package/src/cli/secrets.ts +55 -0
- package/src/cli/service-access.ts +23 -0
- package/src/cli/setup.ts +57 -0
- package/src/cli/shutdown.ts +16 -0
- package/src/cli/spawn.ts +31 -0
- package/src/cli/state.ts +73 -0
- package/src/cli/steward.ts +58 -0
- package/src/cli/task.ts +151 -0
- package/src/cli/team.ts +18 -0
- package/src/cli/timers.ts +53 -0
- package/src/cli/token.ts +72 -0
- package/src/cli/upgrade.ts +200 -0
- package/src/cli/web-tool-calls.ts +17 -0
- package/src/cli/workflow.ts +46 -0
- package/src/cli/workspace.ts +544 -0
- package/src/cli.ts +4 -0
- package/src/codex-reset-consume.ts +274 -0
- package/src/codex-wham-quota.ts +177 -0
- package/src/command-events.ts +69 -0
- package/src/command-secrets.ts +198 -0
- package/src/command-ttl.ts +63 -0
- package/src/commands-db.ts +1196 -0
- package/src/commands-landing-async.ts +166 -0
- package/src/commands-write.ts +160 -0
- package/src/comment-blocks.ts +84 -0
- package/src/compaction-watch.ts +259 -0
- package/src/config-model-selection.ts +14 -0
- package/src/config-store-write.ts +39 -0
- package/src/config-store.ts +1253 -0
- package/src/config.ts +939 -0
- package/src/connector-boot-health.ts +27 -0
- package/src/connector-paths.ts +47 -0
- package/src/connectors.ts +547 -0
- package/src/content-security.ts +12 -0
- package/src/context-advisory.ts +279 -0
- package/src/context-block-rendered-at.ts +33 -0
- package/src/context-injection-channel.ts +49 -0
- package/src/context-router.ts +121 -0
- package/src/context-threshold-config.ts +52 -0
- package/src/continuation-replay-edge.ts +30 -0
- package/src/continuity-working-state.ts +107 -0
- package/src/contracts.ts +109 -0
- package/src/coordinator-authority.ts +100 -0
- package/src/coordinator-digest-config.ts +20 -0
- package/src/cosmos-events.ts +164 -0
- package/src/daemon.ts +570 -0
- package/src/dashboard-notifications.ts +169 -0
- package/src/dashboard-presence.ts +86 -0
- package/src/db/activity-async.ts +58 -0
- package/src/db/activity-read-ops.ts +42 -0
- package/src/db/activity-write-ops.ts +43 -0
- package/src/db/activity.ts +454 -0
- package/src/db/agent-card-read.ts +98 -0
- package/src/db/agent-effort-state.ts +146 -0
- package/src/db/agent-exit-cleanup.ts +94 -0
- package/src/db/agent-exit-report.ts +33 -0
- package/src/db/agent-gate-runs-write-ops.ts +7 -0
- package/src/db/agent-gate-runs.ts +96 -0
- package/src/db/agent-identity-archive.test-fixture.ts +12 -0
- package/src/db/agent-identity-archive.ts +75 -0
- package/src/db/agent-keep.ts +21 -0
- package/src/db/agent-lifecycle-write-ops.ts +92 -0
- package/src/db/agent-meta.ts +74 -0
- package/src/db/agent-outstanding-work.ts +154 -0
- package/src/db/agent-ownership-async.ts +45 -0
- package/src/db/agent-ownership-read-ops.ts +12 -0
- package/src/db/agent-ownership-write-ops.ts +50 -0
- package/src/db/agent-ownership.ts +200 -0
- package/src/db/agent-predicates.ts +64 -0
- package/src/db/agent-read.ts +39 -0
- package/src/db/agent-search-async.ts +21 -0
- package/src/db/agent-search-read-ops.ts +8 -0
- package/src/db/agent-search.ts +162 -0
- package/src/db/agent-shutdown-in-flight.ts +21 -0
- package/src/db/agents-async.ts +333 -0
- package/src/db/agents-prune-write-op.ts +37 -0
- package/src/db/agents-read-ops.ts +33 -0
- package/src/db/agents-write-ops.ts +174 -0
- package/src/db/agents.ts +1284 -0
- package/src/db/api-budget-schema.ts +144 -0
- package/src/db/api-budget-usage-migration.ts +31 -0
- package/src/db/api-budget-usage.ts +40 -0
- package/src/db/artifact-browse.ts +145 -0
- package/src/db/artifact-retention.ts +115 -0
- package/src/db/artifacts-async.ts +81 -0
- package/src/db/artifacts-read-ops.ts +24 -0
- package/src/db/artifacts-write-ops.ts +46 -0
- package/src/db/artifacts.ts +307 -0
- package/src/db/auth-identities.ts +128 -0
- package/src/db/backlog.ts +172 -0
- package/src/db/blackboard.ts +171 -0
- package/src/db/broadcast-scope.ts +63 -0
- package/src/db/broker-memory-migration.ts +71 -0
- package/src/db/browser-sessions.ts +89 -0
- package/src/db/budget-lineage.ts +26 -0
- package/src/db/bus-outbox-read-ops.ts +29 -0
- package/src/db/bus-outbox-write-ops.ts +57 -0
- package/src/db/bus-prune-async.ts +16 -0
- package/src/db/busy-regression.worker.ts +48 -0
- package/src/db/caller-lifecycle.ts +24 -0
- package/src/db/carry-pending-marker.ts +129 -0
- package/src/db/carry-pending.ts +145 -0
- package/src/db/channel-binding-delete.ts +15 -0
- package/src/db/channel-egress-allowlist.ts +200 -0
- package/src/db/channel-identity.ts +38 -0
- package/src/db/channel-runtime.ts +19 -0
- package/src/db/channels-async.ts +55 -0
- package/src/db/channels-read-ops.ts +13 -0
- package/src/db/channels-session-fence.ts +18 -0
- package/src/db/channels-write-ops.ts +42 -0
- package/src/db/channels.ts +654 -0
- package/src/db/checkout-refresh.ts +36 -0
- package/src/db/ci-gate-runs.ts +92 -0
- package/src/db/ci-incidents-async.ts +76 -0
- package/src/db/ci-incidents-read-ops.ts +15 -0
- package/src/db/ci-incidents-write-ops.ts +57 -0
- package/src/db/ci-incidents.ts +667 -0
- package/src/db/ci-sha-observations-schema.ts +33 -0
- package/src/db/claim-sql.ts +44 -0
- package/src/db/claude-api-budget-ops.ts +15 -0
- package/src/db/claude-api-budget-reconcile.ts +39 -0
- package/src/db/claude-api-budget.ts +198 -0
- package/src/db/claude-app-oauth.ts +74 -0
- package/src/db/claude-catalog-reconcile.ts +27 -0
- package/src/db/codex-reset-consumes-async.ts +9 -0
- package/src/db/codex-reset-consumes-read-ops.ts +5 -0
- package/src/db/codex-reset-consumes-write-ops.ts +19 -0
- package/src/db/codex-reset-consumes.ts +122 -0
- package/src/db/command-agent-profiles.ts +58 -0
- package/src/db/command-row.ts +88 -0
- package/src/db/command-terminal-status.ts +33 -0
- package/src/db/command-vault-pruning.ts +30 -0
- package/src/db/commands-cancel-write.ts +45 -0
- package/src/db/commands-claim-admission.ts +144 -0
- package/src/db/commands-effort-read.ts +58 -0
- package/src/db/commands-host-land-admission.ts +106 -0
- package/src/db/commands-kernel-landing.ts +268 -0
- package/src/db/commands-land-occupancy.ts +40 -0
- package/src/db/commands-land-wait.ts +38 -0
- package/src/db/commands-landing-completeness.ts +66 -0
- package/src/db/commands-landing-tuples.ts +22 -0
- package/src/db/commands-landing.ts +1046 -0
- package/src/db/commands-leaseless-sweep.ts +72 -0
- package/src/db/commands-list-query.ts +47 -0
- package/src/db/commands-planner-stats.test-fixture.ts +97 -0
- package/src/db/commands-read-ops.ts +49 -0
- package/src/db/commands-scheduler-recovery.ts +71 -0
- package/src/db/commands-spawn-read.ts +33 -0
- package/src/db/commands-write-ops.ts +286 -0
- package/src/db/config-store-write-ops.ts +58 -0
- package/src/db/connection-instrumentation.ts +76 -0
- package/src/db/connection.ts +532 -0
- package/src/db/context-reset-carry.ts +144 -0
- package/src/db/continuation-archive-purge.ts +48 -0
- package/src/db/continuation-archive-search.ts +249 -0
- package/src/db/continuation-archives-async.ts +59 -0
- package/src/db/continuation-archives-read-ops.ts +10 -0
- package/src/db/continuation-archives-write-ops.ts +15 -0
- package/src/db/continuation-archives.ts +158 -0
- package/src/db/continuations.ts +201 -0
- package/src/db/coordinator-delivery.ts +10 -0
- package/src/db/coordinator-digest-async.ts +13 -0
- package/src/db/coordinator-digest-flush.ts +6 -0
- package/src/db/coordinator-digest.ts +145 -0
- package/src/db/coordinator-seat.ts +130 -0
- package/src/db/crash-reports.ts +115 -0
- package/src/db/db-error-registry.ts +290 -0
- package/src/db/db-reader-worker.ts +91 -0
- package/src/db/db-writer-worker.ts +66 -0
- package/src/db/deferred-lineage-report-queries.ts +28 -0
- package/src/db/deferred-lineage-reports.ts +44 -0
- package/src/db/delivery-async.ts +102 -0
- package/src/db/delivery-expiration-health.ts +97 -0
- package/src/db/delivery-expiration.ts +52 -0
- package/src/db/delivery-quality-async.ts +23 -0
- package/src/db/delivery-quality.ts +116 -0
- package/src/db/delivery-read-ops.ts +26 -0
- package/src/db/delivery-report-echo.ts +53 -0
- package/src/db/delivery-write-ops.ts +72 -0
- package/src/db/delivery.ts +545 -0
- package/src/db/deploy-events-async.ts +66 -0
- package/src/db/deploy-events-read-ops.ts +25 -0
- package/src/db/deploy-events-write-ops.ts +81 -0
- package/src/db/deploy-events.ts +554 -0
- package/src/db/deploy-task-completion.ts +48 -0
- package/src/db/drive-leases.ts +165 -0
- package/src/db/durable-payloads.ts +92 -0
- package/src/db/fixtures/writer-shutdown.ts +28 -0
- package/src/db/fts-query.ts +8 -0
- package/src/db/gate-policy.ts +27 -0
- package/src/db/gate-runs.ts +181 -0
- package/src/db/gateway.ts +513 -0
- package/src/db/generation-launch.ts +82 -0
- package/src/db/guides-search.ts +18 -0
- package/src/db/history-delivery-settle.ts +57 -0
- package/src/db/hosts-async.ts +150 -0
- package/src/db/hosts-backfill.ts +91 -0
- package/src/db/hosts-read-ops.ts +21 -0
- package/src/db/hosts-registration.ts +452 -0
- package/src/db/hosts-views.ts +259 -0
- package/src/db/hosts-write-ops.ts +94 -0
- package/src/db/hosts.ts +251 -0
- package/src/db/human-address.ts +6 -0
- package/src/db/idle-digest.ts +54 -0
- package/src/db/idle-self-care.ts +100 -0
- package/src/db/inbox-async.ts +29 -0
- package/src/db/inbox-read-ops.ts +8 -0
- package/src/db/inbox-write-ops.ts +25 -0
- package/src/db/inbox.ts +197 -0
- package/src/db/index.ts +147 -0
- package/src/db/injection-attempts.ts +41 -0
- package/src/db/insights-read-ops.ts +12 -0
- package/src/db/insights-write-ops.ts +15 -0
- package/src/db/integrations.ts +297 -0
- package/src/db/issue-associations.ts +136 -0
- package/src/db/issue-lifecycle.ts +199 -0
- package/src/db/issue-refs.ts +312 -0
- package/src/db/kernel-event-log-schema.ts +14 -0
- package/src/db/kernel-landing-admission.ts +15 -0
- package/src/db/kernel-landing-command-authority.ts +222 -0
- package/src/db/kernel-persistence-async.ts +48 -0
- package/src/db/kernel-persistence-read-ops.ts +24 -0
- package/src/db/kernel-persistence-write-ops.ts +43 -0
- package/src/db/land-boundaries.ts +138 -0
- package/src/db/land-executing.ts +147 -0
- package/src/db/land-gate-attestations.ts +161 -0
- package/src/db/land-incident-eligibility.ts +44 -0
- package/src/db/land-queue-trace.ts +28 -0
- package/src/db/land-stack.ts +80 -0
- package/src/db/land-telemetry-schema.ts +50 -0
- package/src/db/land-telemetry-write-ops.ts +16 -0
- package/src/db/land-telemetry.ts +114 -0
- package/src/db/land-withdrawal-state.ts +26 -0
- package/src/db/landed-merge-evidence.ts +72 -0
- package/src/db/landed-task-attribution.ts +23 -0
- package/src/db/landing-audit.ts +18 -0
- package/src/db/landing-controllers.ts +67 -0
- package/src/db/landing-ingress-async.ts +102 -0
- package/src/db/landing-ingress-read-ops.ts +8 -0
- package/src/db/landing-ingress-write-ops.ts +42 -0
- package/src/db/landing-ingress.ts +380 -0
- package/src/db/landing-read-ops.ts +18 -0
- package/src/db/landing-receipts.ts +206 -0
- package/src/db/landing-schema.ts +479 -0
- package/src/db/launch-facts.ts +60 -0
- package/src/db/legacy-landing-publication.ts +103 -0
- package/src/db/legacy-message-backfill.ts +90 -0
- package/src/db/lifecycle-seq.ts +127 -0
- package/src/db/lifecycle-write-window.ts +216 -0
- package/src/db/lineage-pair-dedupe-sql.ts +80 -0
- package/src/db/lineage-startup-captures.ts +43 -0
- package/src/db/long-running-work-async.ts +12 -0
- package/src/db/long-running-work-write-ops.ts +8 -0
- package/src/db/long-running-work.ts +78 -0
- package/src/db/macos-privacy.ts +72 -0
- package/src/db/main-connection-writes.ts +44 -0
- package/src/db/main-thread-state.ts +38 -0
- package/src/db/maintenance-health.ts +560 -0
- package/src/db/maintenance-indexes.ts +37 -0
- package/src/db/maintenance-job-runs-async.ts +15 -0
- package/src/db/maintenance-job-runs.ts +62 -0
- package/src/db/maintenance-job-write-ops.ts +10 -0
- package/src/db/maintenance-pauses.ts +224 -0
- package/src/db/maintenance-worker.ts +111 -0
- package/src/db/mappers.ts +422 -0
- package/src/db/memory-preamble-read.ts +13 -0
- package/src/db/memory-resolve.ts +209 -0
- package/src/db/memory-retirement-plan.ts +31 -0
- package/src/db/memory-retirement.ts +15 -0
- package/src/db/merge-drain-async.ts +8 -0
- package/src/db/merge-lease.ts +225 -0
- package/src/db/message-claims.ts +16 -0
- package/src/db/message-queries.ts +16 -0
- package/src/db/message-read-mark.ts +32 -0
- package/src/db/message-reads-async.ts +46 -0
- package/src/db/message-reads-read-ops.ts +35 -0
- package/src/db/message-reads-write-ops.ts +24 -0
- package/src/db/message-reads.ts +553 -0
- package/src/db/message-send-suppression.ts +58 -0
- package/src/db/message-send.ts +76 -0
- package/src/db/message-thread.ts +15 -0
- package/src/db/message-write-ops.ts +96 -0
- package/src/db/messages-async.ts +31 -0
- package/src/db/messages-read-ops.ts +14 -0
- package/src/db/messages.ts +1201 -0
- package/src/db/migration-marker.ts +13 -0
- package/src/db/migrations.ts +1761 -0
- package/src/db/notification-subscriptions.ts +282 -0
- package/src/db/on-loop-write-transaction.ts +34 -0
- package/src/db/operator-actions-schema.ts +10 -0
- package/src/db/operator-decisions.ts +180 -0
- package/src/db/orchestrators-async.ts +57 -0
- package/src/db/orchestrators-read-ops.ts +7 -0
- package/src/db/orchestrators-write-ops.ts +52 -0
- package/src/db/orchestrators.ts +485 -0
- package/src/db/outbox-codec.ts +16 -0
- package/src/db/pair-maintenance.ts +9 -0
- package/src/db/pairs-async.ts +10 -0
- package/src/db/pairs-write-ops.ts +8 -0
- package/src/db/pairs.ts +264 -0
- package/src/db/pending-relay-runs.ts +73 -0
- package/src/db/plan-blurb-migration.ts +158 -0
- package/src/db/plan-ci-blocks.ts +28 -0
- package/src/db/plan-completion.ts +55 -0
- package/src/db/plan-conformance.ts +104 -0
- package/src/db/plan-dispatch-schema.ts +17 -0
- package/src/db/plan-dispatch-store.ts +112 -0
- package/src/db/plan-external.ts +79 -0
- package/src/db/plan-graph-async.ts +23 -0
- package/src/db/plan-graph-read-ops.ts +16 -0
- package/src/db/plan-graph-write-ops.ts +37 -0
- package/src/db/plan-graph.ts +403 -0
- package/src/db/plan-import-schema.ts +19 -0
- package/src/db/plan-import.ts +211 -0
- package/src/db/plan-task-create.ts +44 -0
- package/src/db/planner-stats.ts +123 -0
- package/src/db/plans-async.ts +22 -0
- package/src/db/plans-read-ops.ts +11 -0
- package/src/db/plans-write-ops.ts +9 -0
- package/src/db/plans.ts +385 -0
- package/src/db/policy-runtime.ts +14 -0
- package/src/db/presence-buffer.ts +111 -0
- package/src/db/presence-loop.ts +58 -0
- package/src/db/presence-write-ops.ts +28 -0
- package/src/db/presence-write.ts +38 -0
- package/src/db/profile-artifact-backfill-migration.ts +32 -0
- package/src/db/profile-host-sources-migration.ts +150 -0
- package/src/db/profile-legacy-project-instructions-migration.ts +41 -0
- package/src/db/profile-name-case-migration.ts +46 -0
- package/src/db/profile-override-migration.ts +200 -0
- package/src/db/profile-project-ack-migration.ts +55 -0
- package/src/db/profile-slim-migration.ts +125 -0
- package/src/db/profile-slim-plan.ts +190 -0
- package/src/db/project-entries-async.ts +18 -0
- package/src/db/project-entries-read-ops.ts +28 -0
- package/src/db/project-entries.ts +514 -0
- package/src/db/project-entry-search.ts +63 -0
- package/src/db/project-identity.ts +16 -0
- package/src/db/project-journal.ts +256 -0
- package/src/db/project-lifecycle.ts +80 -0
- package/src/db/project-memory-group-migration.ts +76 -0
- package/src/db/project-phantom-merge.ts +228 -0
- package/src/db/project-root-schema.ts +30 -0
- package/src/db/project-trust-approvals.ts +98 -0
- package/src/db/projects-async.ts +50 -0
- package/src/db/projects-read-ops.ts +59 -0
- package/src/db/projects-write-ops.ts +74 -0
- package/src/db/projects.ts +629 -0
- package/src/db/prompt-templates-schema.ts +23 -0
- package/src/db/prompt-templates.ts +138 -0
- package/src/db/prompt-version-migration.ts +115 -0
- package/src/db/prompt-versions-ops.ts +16 -0
- package/src/db/prompt-versions.ts +167 -0
- package/src/db/provider-catalog-async.ts +31 -0
- package/src/db/provider-catalog-read-ops.ts +8 -0
- package/src/db/provider-catalog-write-ops.ts +16 -0
- package/src/db/provider-config-history.ts +49 -0
- package/src/db/provider-config-secrets.ts +117 -0
- package/src/db/provider-flap-messages-async.ts +6 -0
- package/src/db/provider-flap-messages-write-ops.ts +12 -0
- package/src/db/provider-flap-messages.ts +19 -0
- package/src/db/provider-quota-advisory-types.ts +39 -0
- package/src/db/provider-quota-burn.ts +322 -0
- package/src/db/provider-quota-effect-occurrences.ts +13 -0
- package/src/db/provider-quota-lease-write-ops.ts +23 -0
- package/src/db/provider-quota-leases-async.ts +35 -0
- package/src/db/provider-quota-leases.ts +174 -0
- package/src/db/provider-quota-matrix-cache.ts +85 -0
- package/src/db/provider-quota-matrix-fetch.ts +85 -0
- package/src/db/provider-quota-merge.ts +90 -0
- package/src/db/provider-quota-notification-write.ts +98 -0
- package/src/db/provider-quota-prune.ts +35 -0
- package/src/db/provider-quota-read-async.ts +77 -0
- package/src/db/provider-quota-read-ops.ts +56 -0
- package/src/db/provider-quota-recipients.ts +38 -0
- package/src/db/provider-quota-state.ts +139 -0
- package/src/db/provider-quota-visibility.ts +22 -0
- package/src/db/provider-quota-write-ops.ts +69 -0
- package/src/db/provider-quotas.ts +726 -0
- package/src/db/provider-secret-scrub.ts +64 -0
- package/src/db/provisioning-assets-migration.ts +85 -0
- package/src/db/provisioning-async.ts +116 -0
- package/src/db/provisioning-callmux.ts +184 -0
- package/src/db/provisioning-github-api.ts +16 -0
- package/src/db/provisioning-github-import-target.ts +29 -0
- package/src/db/provisioning-mcp-validation.ts +103 -0
- package/src/db/provisioning-read-ops.ts +23 -0
- package/src/db/provisioning-registry.ts +1122 -0
- package/src/db/provisioning-resolve.ts +321 -0
- package/src/db/provisioning-write-ops.ts +43 -0
- package/src/db/qa-skill-seed.ts +27 -0
- package/src/db/quota-lease-busy.worker.ts +62 -0
- package/src/db/read-op-marshaling-fixtures.ts +724 -0
- package/src/db/read-ops.ts +266 -0
- package/src/db/reader-pool.ts +252 -0
- package/src/db/recipe-read-ops.ts +15 -0
- package/src/db/recipe-write-ops.ts +68 -0
- package/src/db/reply-obligations.ts +265 -0
- package/src/db/report-suppression.ts +126 -0
- package/src/db/restart-epoch-admin-async.ts +14 -0
- package/src/db/restart-epoch-admin.ts +67 -0
- package/src/db/restart-epoch-admission.ts +114 -0
- package/src/db/restart-epoch-async.ts +80 -0
- package/src/db/restart-epoch-begin.ts +177 -0
- package/src/db/restart-epoch-read-ops.ts +40 -0
- package/src/db/restart-epoch-release.ts +248 -0
- package/src/db/restart-epoch-write-ops.ts +117 -0
- package/src/db/restart-epoch.test-fixture.ts +37 -0
- package/src/db/restart-epoch.ts +623 -0
- package/src/db/restart-sensitive.ts +81 -0
- package/src/db/retention.ts +423 -0
- package/src/db/review-ref-cleanups.ts +306 -0
- package/src/db/routing-policy.ts +64 -0
- package/src/db/scheduled-timer-projection.ts +123 -0
- package/src/db/scheduled-timer-quota-chaos-worker.ts +84 -0
- package/src/db/scheduled-timers.ts +521 -0
- package/src/db/schema.ts +1472 -0
- package/src/db/scoped-message-reads.ts +31 -0
- package/src/db/secrets-broker-async.ts +31 -0
- package/src/db/secrets-broker-read-ops.ts +8 -0
- package/src/db/secrets-broker-write-ops.ts +23 -0
- package/src/db/secrets-broker.ts +221 -0
- package/src/db/secrets-vault-import.ts +37 -0
- package/src/db/secrets-vault-key-lifecycle.ts +64 -0
- package/src/db/secrets-vault-metadata.ts +37 -0
- package/src/db/secrets-vault-migration.ts +53 -0
- package/src/db/secrets-vault-write.ts +97 -0
- package/src/db/secrets-vault.ts +69 -0
- package/src/db/self-effort-permissions.ts +50 -0
- package/src/db/service-access-read-ops.ts +10 -0
- package/src/db/services-async.ts +29 -0
- package/src/db/services-read-ops.ts +134 -0
- package/src/db/services-write-ops.ts +71 -0
- package/src/db/shared.ts +7 -0
- package/src/db/shipping-board-async.ts +6 -0
- package/src/db/shipping-board.ts +319 -0
- package/src/db/shipping-stats-async.ts +24 -0
- package/src/db/shipping-stats-histogram.ts +45 -0
- package/src/db/shipping-stats-schema.ts +8 -0
- package/src/db/shipping-stats.ts +265 -0
- package/src/db/snapshot-ledger-prune.ts +53 -0
- package/src/db/spawn-budget.ts +145 -0
- package/src/db/spawn-command-busy.worker.ts +71 -0
- package/src/db/spawn-delegation-state.ts +124 -0
- package/src/db/spawn-delegation.ts +114 -0
- package/src/db/spawn-host-cap.ts +29 -0
- package/src/db/spawn-in-flight-count.ts +37 -0
- package/src/db/spawn-in-flight.ts +15 -0
- package/src/db/spawn-process-evidence.ts +68 -0
- package/src/db/spawn-project-target.ts +57 -0
- package/src/db/spawn-registration-confirmed-backfill.ts +71 -0
- package/src/db/spawn-request-id-migration.ts +36 -0
- package/src/db/spawn-request-id.ts +35 -0
- package/src/db/spawn-request-reuse.ts +28 -0
- package/src/db/spawn-tree-cleanup.ts +89 -0
- package/src/db/spawn-tree.ts +29 -0
- package/src/db/sql-audit-indexes.ts +77 -0
- package/src/db/stalled-message-delivery.ts +52 -0
- package/src/db/startup-write-lock.ts +36 -0
- package/src/db/stats-async.ts +235 -0
- package/src/db/stats-health-read-model.ts +225 -0
- package/src/db/stats-read-ops.ts +25 -0
- package/src/db/stats.ts +633 -0
- package/src/db/target-host.ts +25 -0
- package/src/db/task-async.ts +165 -0
- package/src/db/task-comment-through-async.ts +14 -0
- package/src/db/task-comment-through-read-ops.ts +4 -0
- package/src/db/task-comment-through-write-ops.ts +7 -0
- package/src/db/task-comment-through.ts +123 -0
- package/src/db/task-core.ts +44 -0
- package/src/db/task-deliverables-async.ts +60 -0
- package/src/db/task-deliverables-read-ops.ts +4 -0
- package/src/db/task-deliverables-write-ops.ts +37 -0
- package/src/db/task-deliverables.ts +387 -0
- package/src/db/task-dependency-cycle.worker.ts +43 -0
- package/src/db/task-detail-projection.ts +91 -0
- package/src/db/task-entity-async.ts +252 -0
- package/src/db/task-entity-read-ops.ts +51 -0
- package/src/db/task-entity-write-ops.ts +197 -0
- package/src/db/task-entity.ts +1143 -0
- package/src/db/task-execution.ts +20 -0
- package/src/db/task-issue-relation.ts +23 -0
- package/src/db/task-issue-source.ts +46 -0
- package/src/db/task-land-withdraw-async.ts +10 -0
- package/src/db/task-land-withdraw-read-ops.ts +13 -0
- package/src/db/task-land-withdraw-read.ts +47 -0
- package/src/db/task-land-withdraw-write-ops.ts +31 -0
- package/src/db/task-land-withdraw.ts +423 -0
- package/src/db/task-list.ts +113 -0
- package/src/db/task-maintenance.ts +25 -0
- package/src/db/task-memory-async.ts +19 -0
- package/src/db/task-memory-read-ops.ts +9 -0
- package/src/db/task-memory-write-ops.ts +23 -0
- package/src/db/task-memory.ts +170 -0
- package/src/db/task-owner.ts +126 -0
- package/src/db/task-read-ops.ts +44 -0
- package/src/db/task-review-hold-async.ts +20 -0
- package/src/db/task-review-hold-delivery.ts +58 -0
- package/src/db/task-review-hold-write-ops.ts +26 -0
- package/src/db/task-review-hold.ts +615 -0
- package/src/db/task-state-reconcile-async.ts +12 -0
- package/src/db/task-state-reconcile.ts +163 -0
- package/src/db/task-validation.ts +71 -0
- package/src/db/task-write-ops.ts +145 -0
- package/src/db/tasks.ts +528 -0
- package/src/db/team-epics.ts +37 -0
- package/src/db/team-idle.ts +35 -0
- package/src/db/team-project.ts +69 -0
- package/src/db/team-spawn-delegation-read.ts +36 -0
- package/src/db/team-spawn-delegation.ts +49 -0
- package/src/db/teams-async.ts +58 -0
- package/src/db/teams-read-ops.ts +27 -0
- package/src/db/teams-write-ops.ts +17 -0
- package/src/db/teams.ts +504 -0
- package/src/db/terminal-events.ts +113 -0
- package/src/db/timer-async.ts +523 -0
- package/src/db/timer-cutover-core.ts +545 -0
- package/src/db/timer-cutover-report-read-ops.ts +211 -0
- package/src/db/timer-cutover-write-ops.ts +275 -0
- package/src/db/timer-ingress-payload.ts +160 -0
- package/src/db/timer-ingress-read-ops.ts +39 -0
- package/src/db/timer-ingress-request-keys.ts +282 -0
- package/src/db/timer-ingress-write-ops.ts +145 -0
- package/src/db/timer-ingress.ts +515 -0
- package/src/db/timer-message-cutover.ts +322 -0
- package/src/db/timer-message-fire-deadletter.ts +136 -0
- package/src/db/timer-message-fire.ts +209 -0
- package/src/db/timer-message-flip-chaos-worker.ts +89 -0
- package/src/db/timer-message-flip-consistency.ts +147 -0
- package/src/db/timer-message-flip.ts +676 -0
- package/src/db/timer-message-participant.ts +138 -0
- package/src/db/timer-migrate-input.ts +92 -0
- package/src/db/timer-operator-async.ts +177 -0
- package/src/db/timer-operator-read-ops.ts +21 -0
- package/src/db/timer-operator-stage10.ts +119 -0
- package/src/db/timer-operator-write-ops.ts +102 -0
- package/src/db/timer-operator.ts +393 -0
- package/src/db/timer-read-ops.ts +147 -0
- package/src/db/timer-transfer-errors.ts +10 -0
- package/src/db/timer-transfer-write-ops.ts +39 -0
- package/src/db/timer-verifier-schema.ts +29 -0
- package/src/db/timer-verifier.ts +379 -0
- package/src/db/timer-write-ops.ts +277 -0
- package/src/db/token-db-write-ops.ts +92 -0
- package/src/db/token-standing.ts +84 -0
- package/src/db/token-usage-read-ops.ts +8 -0
- package/src/db/token-usage-write-ops.ts +35 -0
- package/src/db/token-usage.ts +338 -0
- package/src/db/tool-groups-empty-migration.ts +59 -0
- package/src/db/urgent-intake.ts +30 -0
- package/src/db/user-invites.ts +107 -0
- package/src/db/user-settings-read-ops.ts +19 -0
- package/src/db/user-settings-write-ops.ts +42 -0
- package/src/db/users.ts +173 -0
- package/src/db/vault-backup.ts +59 -0
- package/src/db/vault-expiry.ts +71 -0
- package/src/db/vault-health.ts +99 -0
- package/src/db/vault-token-launch.ts +77 -0
- package/src/db/vault-token-ops.ts +14 -0
- package/src/db/vault-tokens.ts +101 -0
- package/src/db/viewer-scope.ts +117 -0
- package/src/db/wal-checkpointer-worker.ts +48 -0
- package/src/db/wal-checkpointer.ts +107 -0
- package/src/db/wal-index.ts +53 -0
- package/src/db/wal-live-log.ts +68 -0
- package/src/db/wal-reclaim-async.ts +45 -0
- package/src/db/wal-reclaim.ts +140 -0
- package/src/db/web-tool-call-ops.ts +15 -0
- package/src/db/web-tool-calls.ts +87 -0
- package/src/db/withdraw-land-error.ts +18 -0
- package/src/db/work-evidence.ts +43 -0
- package/src/db/workflow-budget.ts +44 -0
- package/src/db/workflow-contact.ts +173 -0
- package/src/db/workflow-execution.ts +10 -0
- package/src/db/workflow-journal-async.ts +64 -0
- package/src/db/workflow-journal-prune.ts +71 -0
- package/src/db/workflow-journal-read-ops.ts +21 -0
- package/src/db/workflow-journal-schema.ts +9 -0
- package/src/db/workflow-journal-write-ops.ts +33 -0
- package/src/db/workflow-journal.ts +324 -0
- package/src/db/workflow-spawn-quota.ts +57 -0
- package/src/db/workflow-stats-read-ops.ts +177 -0
- package/src/db/workflow-step-tasks.ts +74 -0
- package/src/db/workflow-task-read-ops.ts +187 -0
- package/src/db/workspace-land-state.ts +65 -0
- package/src/db/workspace-merge-hold.ts +28 -0
- package/src/db/workspace-persistence.ts +77 -0
- package/src/db/workspace-rekey-write-ops.ts +11 -0
- package/src/db/workspace-rekey.ts +148 -0
- package/src/db/workspace-steward-cancel.ts +85 -0
- package/src/db/workspace-steward-fence.ts +30 -0
- package/src/db/workspace-write-ops.ts +26 -0
- package/src/db/workspace-writes-async.ts +46 -0
- package/src/db/workspace-writes.ts +196 -0
- package/src/db/workspaces.ts +617 -0
- package/src/db/write-ops.ts +594 -0
- package/src/db/writer-drain.ts +27 -0
- package/src/db/writer-fault-seam.ts +101 -0
- package/src/db/writer-gateway.ts +840 -0
- package/src/db/writer-ledger.ts +56 -0
- package/src/db.ts +4 -0
- package/src/deploy-executor.ts +139 -0
- package/src/dev.ts +541 -0
- package/src/dispatch-availability.ts +55 -0
- package/src/dispatch-match.ts +21 -0
- package/src/ephemeral/host-landing-slots-proof-worker.ts +45 -0
- package/src/ephemeral/index.ts +58 -0
- package/src/ephemeral/instance.ts +832 -0
- package/src/ephemeral/landing-ingress-proof-worker.ts +30 -0
- package/src/ephemeral/ports.ts +40 -0
- package/src/ephemeral/profile.ts +323 -0
- package/src/ephemeral/rehearsal-stamps.ts +149 -0
- package/src/ephemeral/rehearsal.ts +213 -0
- package/src/ephemeral/snapshot-kernel.ts +41 -0
- package/src/ephemeral/snapshot.ts +753 -0
- package/src/ephemeral/sweep.ts +40 -0
- package/src/event-loop-lag.ts +584 -0
- package/src/event-loop-yield.ts +27 -0
- package/src/events.ts +140 -0
- package/src/execution-mode.ts +63 -0
- package/src/fleet-convergence.ts +123 -0
- package/src/gate-resolver.ts +151 -0
- package/src/gate-run-capture.ts +71 -0
- package/src/git-sha.ts +58 -0
- package/src/guides.ts +73 -0
- package/src/host/capacity.ts +79 -0
- package/src/host/gate-capacity-alert.ts +90 -0
- package/src/host/identity.ts +128 -0
- package/src/host/presentation.ts +234 -0
- package/src/host/pressure-details.ts +89 -0
- package/src/host/pressure.ts +216 -0
- package/src/host/state.ts +132 -0
- package/src/host/utilization-buffer.ts +71 -0
- package/src/host-awareness.ts +57 -0
- package/src/host-identity.ts +39 -0
- package/src/host-provider-enablement.ts +75 -0
- package/src/host-provider-store.ts +102 -0
- package/src/host-tools.ts +39 -0
- package/src/http-body.ts +49 -0
- package/src/http-compression.ts +16 -0
- package/src/hub-metrics-report.ts +67 -0
- package/src/hub-metrics.ts +166 -0
- package/src/idle-digest-config.ts +40 -0
- package/src/idle-self-care.ts +58 -0
- package/src/index.ts +35 -0
- package/src/injection-sweep-pacing.ts +24 -0
- package/src/insights-async.ts +16 -0
- package/src/insights-db.ts +188 -0
- package/src/internal-spawn-model.ts +18 -0
- package/src/invite-link.ts +11 -0
- package/src/issue-tracker/adapter.ts +58 -0
- package/src/issue-tracker/github.ts +342 -0
- package/src/issue-tracker/index.ts +12 -0
- package/src/issue-tracker/registry.ts +26 -0
- package/src/journal-preamble.ts +350 -0
- package/src/kernel-correlation.ts +28 -0
- package/src/land-authorization.ts +73 -0
- package/src/land-block.ts +59 -0
- package/src/land-failure-event-key.ts +8 -0
- package/src/land-gate-failure-routing.ts +69 -0
- package/src/land-gate-notifications.ts +173 -0
- package/src/land-gate-queue-progress.ts +54 -0
- package/src/land-gates-source.ts +126 -0
- package/src/land-gates.ts +29 -0
- package/src/land-lifecycle-drives.ts +15 -0
- package/src/land-settle-dispatch.ts +134 -0
- package/src/land-stack-depth.ts +11 -0
- package/src/land-telemetry.ts +40 -0
- package/src/landing-base-ref.ts +3 -0
- package/src/landing-host-safety.ts +38 -0
- package/src/landing-lane-key.ts +74 -0
- package/src/launch-mode-support.ts +11 -0
- package/src/launch-mode.ts +58 -0
- package/src/legacy-landing.test-fixture.ts +56 -0
- package/src/lifecycle-context-pressure.ts +134 -0
- package/src/lifecycle-manager.ts +831 -0
- package/src/lifecycle-signal-registry.ts +87 -0
- package/src/live-runs-section.ts +38 -0
- package/src/loop-block-attribution.ts +442 -0
- package/src/loop-block-regression-alarm.ts +156 -0
- package/src/loop-task-stamps.ts +62 -0
- package/src/main-thread-clock.ts +95 -0
- package/src/maintenance/agent-identity-archive-job.ts +15 -0
- package/src/maintenance/artifact-checkout-gc-job.ts +14 -0
- package/src/maintenance/artifact-checkout-gc.ts +33 -0
- package/src/maintenance/artifact-sweep.ts +23 -0
- package/src/maintenance/breaker.ts +200 -0
- package/src/maintenance/cd-watcher.ts +176 -0
- package/src/maintenance/checkout-refresh.ts +83 -0
- package/src/maintenance/ci-monitor.ts +14 -0
- package/src/maintenance/claude-api-budget-job.ts +16 -0
- package/src/maintenance/constants.ts +134 -0
- package/src/maintenance/continuation-archive-search-job.ts +27 -0
- package/src/maintenance/critical-job-watchdog.ts +252 -0
- package/src/maintenance/db-planner-stats-job.ts +19 -0
- package/src/maintenance/db-wal-reclaim-job.ts +82 -0
- package/src/maintenance/events.ts +28 -0
- package/src/maintenance/gate-capacity-sample-job.ts +16 -0
- package/src/maintenance/index.ts +10 -0
- package/src/maintenance/jobs.ts +857 -0
- package/src/maintenance/long-running-work.ts +41 -0
- package/src/maintenance/orphaned-sessions.ts +126 -0
- package/src/maintenance/pauses.ts +174 -0
- package/src/maintenance/provider-secret-scrub-job.ts +16 -0
- package/src/maintenance/queued-message-expiration.ts +23 -0
- package/src/maintenance/red-main-controller-job.ts +22 -0
- package/src/maintenance/reply-obligation-parity-job.ts +27 -0
- package/src/maintenance/restart-epoch-hold-health.ts +62 -0
- package/src/maintenance/run-registry.ts +194 -0
- package/src/maintenance/scheduler.ts +778 -0
- package/src/maintenance/service-access-job.ts +31 -0
- package/src/maintenance/shipping-stats-rollup-job.ts +23 -0
- package/src/maintenance/snapshot-ledger-prune-job.ts +17 -0
- package/src/maintenance/stalled-delivery-pager.ts +125 -0
- package/src/maintenance/steward-handback.ts +11 -0
- package/src/maintenance/task-state-reconcile-job.ts +22 -0
- package/src/maintenance/teams.ts +426 -0
- package/src/maintenance/types.ts +124 -0
- package/src/maintenance/vault-backup-job.ts +34 -0
- package/src/maintenance/vault-expiry-job.ts +29 -0
- package/src/maintenance/web-tool-call-prune-job.ts +13 -0
- package/src/maintenance/workflow-backstop-job.ts +12 -0
- package/src/maintenance/workflow-journal-prune-job.ts +29 -0
- package/src/maintenance/workspaces.ts +784 -0
- package/src/maintenance.ts +1 -0
- package/src/managed-policy-escalation.ts +123 -0
- package/src/managed-policy.ts +236 -0
- package/src/managed-provider-gate.ts +27 -0
- package/src/managed-spawn-reservation.ts +23 -0
- package/src/markdown-frontmatter.ts +14 -0
- package/src/mcp/activity-output.ts +57 -0
- package/src/mcp/artifact-upload.ts +53 -0
- package/src/mcp/context-output.ts +73 -0
- package/src/mcp/dispatch-shape-schema.ts +13 -0
- package/src/mcp/guides.ts +33 -0
- package/src/mcp/http.ts +27 -0
- package/src/mcp/identity-projection.ts +121 -0
- package/src/mcp/identity.ts +235 -0
- package/src/mcp/index.ts +355 -0
- package/src/mcp/issue-selector-schema.ts +12 -0
- package/src/mcp/message-read.ts +87 -0
- package/src/mcp/output-descriptions.ts +72 -0
- package/src/mcp/output-levels.ts +71 -0
- package/src/mcp/output-projection.ts +88 -0
- package/src/mcp/plan-presentation.ts +166 -0
- package/src/mcp/presentation-values.ts +11 -0
- package/src/mcp/presentation.ts +653 -0
- package/src/mcp/project-entry-search-schema.ts +7 -0
- package/src/mcp/prompts.ts +36 -0
- package/src/mcp/runtime-output.ts +84 -0
- package/src/mcp/schema-budget.ts +28 -0
- package/src/mcp/self-care-visibility.ts +23 -0
- package/src/mcp/service-access.ts +18 -0
- package/src/mcp/spawn-targets-matrix.ts +68 -0
- package/src/mcp/spawn-targets.test-fixture.ts +21 -0
- package/src/mcp/task-validation-presentation.ts +19 -0
- package/src/mcp/tool-generation.ts +8 -0
- package/src/mcp/tool-groups.ts +136 -0
- package/src/mcp/tools-artifacts.ts +82 -0
- package/src/mcp/tools-messaging.ts +541 -0
- package/src/mcp/tools-permission.ts +88 -0
- package/src/mcp/tools-run.ts +73 -0
- package/src/mcp/tools-scheduler.ts +156 -0
- package/src/mcp/tools-spawn.ts +418 -0
- package/src/mcp/tools-web-tool-calls.ts +28 -0
- package/src/mcp/tools-workspace.ts +260 -0
- package/src/mcp/types.ts +68 -0
- package/src/mcp/validation.ts +66 -0
- package/src/mcp-agent-action.ts +96 -0
- package/src/mcp-agent-keep.ts +37 -0
- package/src/mcp-backlog-tools.ts +137 -0
- package/src/mcp-blackboard-tools.ts +131 -0
- package/src/mcp-channel-binding-tools.ts +27 -0
- package/src/mcp-claude-api-budget.ts +35 -0
- package/src/mcp-codex-reset.ts +43 -0
- package/src/mcp-decision-tools.ts +96 -0
- package/src/mcp-dispatch-tools.ts +142 -0
- package/src/mcp-egress-tools.ts +168 -0
- package/src/mcp-errors.ts +7 -0
- package/src/mcp-host-tools.ts +61 -0
- package/src/mcp-interrupt-agent.ts +47 -0
- package/src/mcp-issue-activity-tools.ts +114 -0
- package/src/mcp-issue-association-tools.ts +103 -0
- package/src/mcp-issue-lifecycle-tools.ts +49 -0
- package/src/mcp-issue-ref-tools.ts +214 -0
- package/src/mcp-maintenance-tools.ts +113 -0
- package/src/mcp-merge-tools.ts +66 -0
- package/src/mcp-notification-subscription-tools.ts +297 -0
- package/src/mcp-output-levels.test-fixture.ts +95 -0
- package/src/mcp-plan-tools.ts +347 -0
- package/src/mcp-profile-trust-tools.ts +47 -0
- package/src/mcp-project-journal-tools.ts +160 -0
- package/src/mcp-project-tools.ts +420 -0
- package/src/mcp-provider-catalog.ts +9 -0
- package/src/mcp-release-tools.ts +33 -0
- package/src/mcp-routing-policy-tools.ts +35 -0
- package/src/mcp-secrets-tools.ts +87 -0
- package/src/mcp-task-deliver-tools.ts +166 -0
- package/src/mcp-task-land-withdraw-tools.ts +49 -0
- package/src/mcp-task-memory-tools.ts +119 -0
- package/src/mcp-task-review-hold-tools.ts +57 -0
- package/src/mcp-task-tools.ts +342 -0
- package/src/mcp-task-validation-tools.ts +30 -0
- package/src/mcp-task-weave-tools.ts +63 -0
- package/src/mcp-team-template-tools.ts +141 -0
- package/src/mcp-team-tools.ts +197 -0
- package/src/mcp-tool-allowlist.ts +88 -0
- package/src/mcp-workflow-tools.ts +158 -0
- package/src/mcp.ts +1 -0
- package/src/memory-admission-rank.ts +55 -0
- package/src/memory-area-injection.ts +216 -0
- package/src/memory-boundary-capture.ts +206 -0
- package/src/memory-entry-safety.ts +28 -0
- package/src/memory-inject-filter.ts +190 -0
- package/src/memory-injection.ts +954 -0
- package/src/memory-preamble-admission.ts +158 -0
- package/src/memory-preamble-async.ts +13 -0
- package/src/memory-preamble.ts +1142 -0
- package/src/memory-retirement.ts +11 -0
- package/src/memory-seam.ts +273 -0
- package/src/memory-tokens.ts +91 -0
- package/src/merge-drain.ts +101 -0
- package/src/merge-pause-maintenance.ts +19 -0
- package/src/message-visibility.ts +50 -0
- package/src/messaging-policy.ts +94 -0
- package/src/native-memory.ts +59 -0
- package/src/notification-prefs.ts +25 -0
- package/src/notification-role-policy.ts +14 -0
- package/src/notification-router.ts +329 -0
- package/src/notification-rules.ts +390 -0
- package/src/notification-settings-store.ts +47 -0
- package/src/notification-settings.ts +166 -0
- package/src/notification-subscription-rules.ts +11 -0
- package/src/notification-types.ts +312 -0
- package/src/notify.ts +55 -0
- package/src/observed-reset-boundary.ts +23 -0
- package/src/observed-reset-refresh.ts +21 -0
- package/src/operator-alarm.ts +41 -0
- package/src/operator-decisions-section.ts +29 -0
- package/src/orchestrator-lookup.ts +29 -0
- package/src/orchestrator-self-report-authz.ts +34 -0
- package/src/package-pack.ts +246 -0
- package/src/post-bind-startup.ts +58 -0
- package/src/process-guard.ts +31 -0
- package/src/profile-cells.ts +305 -0
- package/src/profile-effective-survey.ts +121 -0
- package/src/profile-host-sources.ts +73 -0
- package/src/profile-instruction-blocks.ts +11 -0
- package/src/profile-project-validation.ts +23 -0
- package/src/profile-provider-options.ts +59 -0
- package/src/profile-role-templates.ts +26 -0
- package/src/profile-workflow-policy.ts +14 -0
- package/src/project-claudemd-sweep.ts +176 -0
- package/src/project-file-source.ts +54 -0
- package/src/project-ingest.ts +195 -0
- package/src/project-instructions.ts +700 -0
- package/src/project-mcp.ts +18 -0
- package/src/project-role-assets.ts +109 -0
- package/src/project-roles-validate.ts +53 -0
- package/src/project-roles.ts +364 -0
- package/src/project-settings.ts +5 -0
- package/src/project-skills.ts +5 -0
- package/src/project-toolchain.ts +58 -0
- package/src/project-trust-fingerprint.ts +174 -0
- package/src/project-trust.ts +262 -0
- package/src/project-workflows.ts +185 -0
- package/src/prompt-resolver.ts +697 -0
- package/src/prompt-template-fallback.ts +15 -0
- package/src/prompt-version-errors.ts +13 -0
- package/src/provider-catalog-store.ts +393 -0
- package/src/provider-config-store.ts +308 -0
- package/src/provider-enablement.ts +36 -0
- package/src/provider-home-gc.ts +58 -0
- package/src/provider-model-seed.ts +18 -0
- package/src/provider-quota-async.ts +152 -0
- package/src/provider-quota-config-store.ts +60 -0
- package/src/provider-secrets.test-fixture.ts +34 -0
- package/src/provider-state.ts +93 -0
- package/src/provider-timeline-event.ts +76 -0
- package/src/quota-advisory.ts +359 -0
- package/src/quota-band-delivery.ts +13 -0
- package/src/quota-band-projection.ts +149 -0
- package/src/quota-band-transition.ts +316 -0
- package/src/quota-pacing.ts +46 -0
- package/src/quota-threshold-config.ts +46 -0
- package/src/quota.ts +61 -0
- package/src/ratchet-files.ts +202 -0
- package/src/recipe-async.ts +50 -0
- package/src/recipe-db.ts +260 -0
- package/src/recipe-loader.ts +132 -0
- package/src/recipe-runner.ts +259 -0
- package/src/recipe-validator.ts +107 -0
- package/src/relay-event-drain.ts +39 -0
- package/src/relay-host-locality.ts +20 -0
- package/src/relay-run-lease.ts +17 -0
- package/src/repo-config-source.ts +209 -0
- package/src/report-verbosity.ts +5 -0
- package/src/restart-epoch-deploy-hold.ts +221 -0
- package/src/retention-config-store.ts +32 -0
- package/src/retention-config.ts +70 -0
- package/src/reviewer-pipeline.ts +238 -0
- package/src/routes/_route.ts +70 -0
- package/src/routes/_shared.ts +513 -0
- package/src/routes/activity.ts +70 -0
- package/src/routes/agent-effort.ts +69 -0
- package/src/routes/agent-keep.ts +27 -0
- package/src/routes/agent-profiles.ts +169 -0
- package/src/routes/agent-reporting.ts +19 -0
- package/src/routes/agent-self-effort.ts +51 -0
- package/src/routes/agent-sessions.ts +650 -0
- package/src/routes/agent-sharing.ts +23 -0
- package/src/routes/agents-spawn.ts +258 -0
- package/src/routes/agents.ts +452 -0
- package/src/routes/artifacts.ts +340 -0
- package/src/routes/auth.ts +123 -0
- package/src/routes/authority-audit.ts +14 -0
- package/src/routes/automations.ts +83 -0
- package/src/routes/backlog.ts +112 -0
- package/src/routes/blackboard.ts +54 -0
- package/src/routes/browser.ts +73 -0
- package/src/routes/channel-binding-delete.ts +21 -0
- package/src/routes/channel-output.ts +17 -0
- package/src/routes/claude-api-budget.ts +65 -0
- package/src/routes/commands-listing.ts +50 -0
- package/src/routes/commands.ts +586 -0
- package/src/routes/config.ts +75 -0
- package/src/routes/connectors.ts +108 -0
- package/src/routes/context-resets.ts +35 -0
- package/src/routes/continuation-archives.ts +37 -0
- package/src/routes/coordinator-teams.ts +14 -0
- package/src/routes/decisions.ts +82 -0
- package/src/routes/deploys.ts +15 -0
- package/src/routes/fleet-convergence.ts +5 -0
- package/src/routes/guides.ts +13 -0
- package/src/routes/host-providers.ts +73 -0
- package/src/routes/host-resource-control.ts +45 -0
- package/src/routes/host-secret-files.ts +38 -0
- package/src/routes/hosts.ts +240 -0
- package/src/routes/inbox.ts +151 -0
- package/src/routes/index.ts +614 -0
- package/src/routes/insights.ts +86 -0
- package/src/routes/integrations.ts +636 -0
- package/src/routes/issue-activity.ts +78 -0
- package/src/routes/issue-associations.ts +76 -0
- package/src/routes/issue-lifecycle.ts +34 -0
- package/src/routes/issue-refs.ts +163 -0
- package/src/routes/kernel-timers-operator.ts +57 -0
- package/src/routes/memory.ts +25 -0
- package/src/routes/merges.ts +109 -0
- package/src/routes/message-viewer.ts +4 -0
- package/src/routes/messages.ts +621 -0
- package/src/routes/notifications.ts +36 -0
- package/src/routes/orchestrator-bootstrap.ts +101 -0
- package/src/routes/orchestrator-host-registration.ts +125 -0
- package/src/routes/orchestrator-host-utilization.ts +255 -0
- package/src/routes/orchestrator-proxy.ts +174 -0
- package/src/routes/orchestrator.ts +699 -0
- package/src/routes/pairs.ts +214 -0
- package/src/routes/plans.ts +98 -0
- package/src/routes/project-onboarding.ts +56 -0
- package/src/routes/project-trust.ts +73 -0
- package/src/routes/projects.ts +296 -0
- package/src/routes/prompt-templates.ts +106 -0
- package/src/routes/provider-config.ts +232 -0
- package/src/routes/provider-quota-config.ts +48 -0
- package/src/routes/provider-quotas.ts +312 -0
- package/src/routes/provisioning-registry.ts +192 -0
- package/src/routes/recipes.ts +129 -0
- package/src/routes/restart-epochs.ts +98 -0
- package/src/routes/routing-policy.ts +30 -0
- package/src/routes/run-command.ts +25 -0
- package/src/routes/secrets-backup.ts +53 -0
- package/src/routes/secrets-import.ts +32 -0
- package/src/routes/secrets-page.ts +98 -0
- package/src/routes/secrets-vault.ts +121 -0
- package/src/routes/secrets.ts +165 -0
- package/src/routes/service-access.ts +57 -0
- package/src/routes/settings.ts +191 -0
- package/src/routes/shipping.ts +56 -0
- package/src/routes/spawn-policy.ts +299 -0
- package/src/routes/spec.ts +58 -0
- package/src/routes/sse.ts +18 -0
- package/src/routes/stats.ts +159 -0
- package/src/routes/steward.ts +49 -0
- package/src/routes/task-graph.ts +30 -0
- package/src/routes/task-http.ts +27 -0
- package/src/routes/task-issues.ts +81 -0
- package/src/routes/task-reads.ts +139 -0
- package/src/routes/task-validation.ts +22 -0
- package/src/routes/tasks.ts +553 -0
- package/src/routes/team-templates.ts +65 -0
- package/src/routes/teams-config.ts +15 -0
- package/src/routes/teams.ts +141 -0
- package/src/routes/token-usage.ts +167 -0
- package/src/routes/tokens.ts +393 -0
- package/src/routes/users.ts +248 -0
- package/src/routes/viewer-read.ts +27 -0
- package/src/routes/web-tool-calls.ts +38 -0
- package/src/routes/workflows.ts +142 -0
- package/src/routes/workspaces.ts +642 -0
- package/src/routes.ts +3 -0
- package/src/routing-eligibility.ts +42 -0
- package/src/routing-model-aliases.ts +21 -0
- package/src/routing-policy-normalize.ts +412 -0
- package/src/routing-policy-push.ts +154 -0
- package/src/routing-policy-service.ts +19 -0
- package/src/routing-policy-store.ts +16 -0
- package/src/routing-preferences.ts +82 -0
- package/src/routing-step-defaults.ts +31 -0
- package/src/runtime-grant.ts +164 -0
- package/src/runtime-prefix.ts +8 -0
- package/src/runtime-tokens.ts +395 -0
- package/src/search-query.ts +10 -0
- package/src/secret-keys.ts +24 -0
- package/src/secrets-broker/config.ts +53 -0
- package/src/secrets-broker/error.ts +8 -0
- package/src/secrets-broker/infisical.ts +259 -0
- package/src/secrets-broker/reader-infisical.ts +41 -0
- package/src/secrets-broker/reader.ts +101 -0
- package/src/secrets-broker/service.ts +242 -0
- package/src/secrets-broker/tool-credentials.ts +9 -0
- package/src/secrets-vault/backend-conformance.ts +26 -0
- package/src/secrets-vault/backend.ts +102 -0
- package/src/secrets-vault/backup.ts +103 -0
- package/src/secrets-vault/config.ts +7 -0
- package/src/secrets-vault/expiry.ts +10 -0
- package/src/secrets-vault/identity.ts +27 -0
- package/src/secrets-vault/import.ts +90 -0
- package/src/secrets-vault/key-files.ts +91 -0
- package/src/secrets-vault/keys.ts +79 -0
- package/src/secrets-vault/metadata.ts +51 -0
- package/src/secrets-vault/provider-env.ts +25 -0
- package/src/secrets-vault/resolve.ts +101 -0
- package/src/secrets-vault/restore.ts +57 -0
- package/src/secrets-vault/scope.ts +25 -0
- package/src/secrets-vault/service.ts +192 -0
- package/src/secrets-vault/shared.ts +10 -0
- package/src/security.ts +772 -0
- package/src/self-effort-rule.ts +36 -0
- package/src/self-resume-carry.ts +131 -0
- package/src/self-resume-command.ts +24 -0
- package/src/self-resume-config.ts +54 -0
- package/src/self-resume-identity.ts +40 -0
- package/src/self-resume-supersede.ts +19 -0
- package/src/self-resume.ts +884 -0
- package/src/server-background.ts +24 -0
- package/src/server.ts +726 -0
- package/src/service-access/config.ts +3 -0
- package/src/service-access/health.ts +151 -0
- package/src/service-access/host-health.ts +62 -0
- package/src/service-access/host.ts +63 -0
- package/src/service-access/operations.ts +21 -0
- package/src/service-access/policy.ts +30 -0
- package/src/service-access/probe.ts +62 -0
- package/src/service-access/request-logs.ts +93 -0
- package/src/service-access/scope.ts +7 -0
- package/src/service-access/service.ts +185 -0
- package/src/service-access/tokens.ts +174 -0
- package/src/service-access/validation.ts +75 -0
- package/src/service-access/vault.ts +59 -0
- package/src/services/agent-action.ts +238 -0
- package/src/services/agent-control-host.ts +74 -0
- package/src/services/agent-effort.ts +60 -0
- package/src/services/agent-hang-watchdog-job.ts +513 -0
- package/src/services/agent-hang-watchdog-wiring.ts +487 -0
- package/src/services/agent-hang-watchdog.ts +395 -0
- package/src/services/agent-keep.ts +72 -0
- package/src/services/agent-message-fanout.ts +91 -0
- package/src/services/agent-outstanding-work.ts +66 -0
- package/src/services/agent-reporting.ts +27 -0
- package/src/services/artifact-access.ts +39 -0
- package/src/services/artifact-multipart.ts +70 -0
- package/src/services/artifact-path-host.ts +55 -0
- package/src/services/artifact-read.ts +88 -0
- package/src/services/artifact-write.ts +25 -0
- package/src/services/auth-context.ts +117 -0
- package/src/services/automatic-disposal.ts +33 -0
- package/src/services/backlog.ts +149 -0
- package/src/services/browser-inventory.ts +52 -0
- package/src/services/browser-session-state.ts +41 -0
- package/src/services/browser-session.ts +167 -0
- package/src/services/bus-command-update.ts +84 -0
- package/src/services/bus-expiration-death.ts +57 -0
- package/src/services/canonical-root.ts +284 -0
- package/src/services/captured-delivery-gate.ts +12 -0
- package/src/services/carry-pending.ts +5 -0
- package/src/services/channel-binding-delete.ts +20 -0
- package/src/services/channel-suppression-receipt.ts +28 -0
- package/src/services/checkout-refresh-state.ts +18 -0
- package/src/services/checkout-refresh.test-fixture.ts +12 -0
- package/src/services/child-work-evidence.ts +77 -0
- package/src/services/claude-app.ts +91 -0
- package/src/services/command-claim-rejection.ts +23 -0
- package/src/services/command-host.ts +42 -0
- package/src/services/coordinator-digest.ts +30 -0
- package/src/services/decision-audience.ts +26 -0
- package/src/services/delivery-gate-policy.ts +98 -0
- package/src/services/delivery-tip.test-fixture.ts +25 -0
- package/src/services/diff-gate.ts +110 -0
- package/src/services/dispatch-command.ts +388 -0
- package/src/services/effective-launch-driver.ts +240 -0
- package/src/services/effective-launch-harness.ts +257 -0
- package/src/services/errors.ts +31 -0
- package/src/services/git-process.ts +176 -0
- package/src/services/git-remote.ts +100 -0
- package/src/services/harness-subagents.ts +12 -0
- package/src/services/host-changed-paths.test-fixture.ts +134 -0
- package/src/services/host-landing-placement.ts +65 -0
- package/src/services/host-project-readiness.ts +49 -0
- package/src/services/host-providers.ts +114 -0
- package/src/services/host-utilization.ts +70 -0
- package/src/services/idle-agent-digest.ts +318 -0
- package/src/services/idle-epics.ts +105 -0
- package/src/services/idle-self-care.ts +47 -0
- package/src/services/interrupt-agent.ts +146 -0
- package/src/services/isolated-workspace-placement.ts +258 -0
- package/src/services/issue-activity.ts +23 -0
- package/src/services/issue-associations.ts +72 -0
- package/src/services/issue-completion-drain.ts +24 -0
- package/src/services/issue-completion.ts +24 -0
- package/src/services/issue-lifecycle-comments.ts +12 -0
- package/src/services/issue-lifecycle.ts +620 -0
- package/src/services/issue-refs.ts +65 -0
- package/src/services/kernel-command-bridge.ts +219 -0
- package/src/services/kernel-control-host.ts +78 -0
- package/src/services/kernel-control-http.ts +119 -0
- package/src/services/kernel-control-mcp.ts +193 -0
- package/src/services/kernel-landing-command.ts +28 -0
- package/src/services/kernel-landing-ingress.ts +65 -0
- package/src/services/kernel-timers-authoritative-ingress.ts +48 -0
- package/src/services/kernel-timers-authz.ts +229 -0
- package/src/services/kernel-timers-command.ts +182 -0
- package/src/services/kernel-timers-cutover-chaos-worker.ts +209 -0
- package/src/services/kernel-timers-cutover.ts +39 -0
- package/src/services/kernel-timers-ingress-apply.ts +39 -0
- package/src/services/kernel-timers-ingress-chaos-worker.ts +312 -0
- package/src/services/kernel-timers-ingress.ts +702 -0
- package/src/services/kernel-timers-message-authority-chaos-worker.ts +97 -0
- package/src/services/kernel-timers-migrate.ts +158 -0
- package/src/services/kernel-timers-operator-chaos-worker.ts +259 -0
- package/src/services/kernel-timers-operator-preflight.ts +18 -0
- package/src/services/kernel-timers-operator.ts +424 -0
- package/src/services/kernel-timers-outbox.ts +138 -0
- package/src/services/kernel-timers-request-key-migration-chaos-worker.ts +77 -0
- package/src/services/kernel-timers-stage10-operator.ts +210 -0
- package/src/services/kernel-timers-stage10.ts +85 -0
- package/src/services/kernel-timers-stage9.ts +57 -0
- package/src/services/kernel-timers-transfer-chaos-worker.ts +118 -0
- package/src/services/kernel-timers-transfer.ts +525 -0
- package/src/services/kernel-timers-verifier.ts +39 -0
- package/src/services/kernel-timers.ts +247 -0
- package/src/services/land-boundary-settle.ts +32 -0
- package/src/services/land-gate-placement.ts +60 -0
- package/src/services/land-issue-relations.ts +46 -0
- package/src/services/land-restart-retry.ts +77 -0
- package/src/services/landed-ancestry.ts +417 -0
- package/src/services/landed-task-attribution.ts +14 -0
- package/src/services/landing-terminal-report.ts +119 -0
- package/src/services/legacy-landing-backfill.ts +159 -0
- package/src/services/legacy-landing-host.ts +291 -0
- package/src/services/legacy-landing-publication.ts +35 -0
- package/src/services/legacy-landing-recovery.ts +111 -0
- package/src/services/macos-privacy.ts +34 -0
- package/src/services/managed-running.ts +189 -0
- package/src/services/memory-areas.ts +172 -0
- package/src/services/memory-identity.ts +162 -0
- package/src/services/merge-pause.ts +37 -0
- package/src/services/message-delivery-actions.ts +11 -0
- package/src/services/operator-decisions.ts +260 -0
- package/src/services/orchestrator-landing-recovery.ts +55 -0
- package/src/services/orchestrator-registration-recovery.ts +12 -0
- package/src/services/orchestrator-upgrade.ts +83 -0
- package/src/services/parity-harness.ts +141 -0
- package/src/services/permission-decision.ts +129 -0
- package/src/services/plan-ci-recovery.ts +76 -0
- package/src/services/plan-conformance.ts +105 -0
- package/src/services/plan-dispatch-policy.ts +79 -0
- package/src/services/plan-dispatch.ts +372 -0
- package/src/services/plan-external-view.ts +7 -0
- package/src/services/plan-frontier.ts +34 -0
- package/src/services/plan-graph.ts +703 -0
- package/src/services/plan-import.ts +66 -0
- package/src/services/plan-live-bindings.ts +139 -0
- package/src/services/plan-task-create.ts +80 -0
- package/src/services/plan-terminal-refs.ts +83 -0
- package/src/services/plan-wake-digest.ts +88 -0
- package/src/services/plan-wake-policy.ts +12 -0
- package/src/services/profile-trust.ts +54 -0
- package/src/services/project-checkout-binding.ts +65 -0
- package/src/services/project-checkout-enrollment.ts +27 -0
- package/src/services/project-cwd.ts +41 -0
- package/src/services/project-onboarding.ts +165 -0
- package/src/services/project-repo-create.ts +27 -0
- package/src/services/project-role.test-fixture.ts +74 -0
- package/src/services/project.ts +191 -0
- package/src/services/prompt-templates.ts +46 -0
- package/src/services/prompt-version-writer.ts +42 -0
- package/src/services/provider-catalog.ts +7 -0
- package/src/services/provider-hold-flap.ts +130 -0
- package/src/services/provider-hold-nudge.ts +191 -0
- package/src/services/provider-hold-record.ts +137 -0
- package/src/services/provider-state-audit.ts +214 -0
- package/src/services/provisioning-harness/analyze.ts +285 -0
- package/src/services/provisioning-harness/budget-baseline.json +391 -0
- package/src/services/provisioning-harness/capture.ts +197 -0
- package/src/services/provisioning-harness/config.ts +55 -0
- package/src/services/provisioning-harness/context-sources.ts +85 -0
- package/src/services/provisioning-harness/driver.ts +156 -0
- package/src/services/provisioning-harness/expect.ts +81 -0
- package/src/services/provisioning-harness/fixture-matrix.ts +38 -0
- package/src/services/provisioning-harness/fixtures/project/.agent-relay/land-gates.json +1 -0
- package/src/services/provisioning-harness/fixtures/project/.claude/skills/harness-skill/SKILL.md +6 -0
- package/src/services/provisioning-harness/fixtures/project/.mcp.json +1 -0
- package/src/services/provisioning-harness/fixtures/project/AGENTS.md +1 -0
- package/src/services/provisioning-harness/fixtures/project/CLAUDE.md +1 -0
- package/src/services/provisioning-harness/fixtures/project/mcp-server.ts +33 -0
- package/src/services/provisioning-harness/fixtures/provider-home/AGENTS.md +1 -0
- package/src/services/provisioning-harness/fixtures/provider-home/CLAUDE.md +1 -0
- package/src/services/provisioning-harness/host-fixtures.ts +25 -0
- package/src/services/provisioning-harness/index.ts +4 -0
- package/src/services/provisioning-harness/inventory-types.ts +8 -0
- package/src/services/provisioning-harness/inventory.ts +33 -0
- package/src/services/provisioning-harness/lifecycle.ts +193 -0
- package/src/services/provisioning-harness/live.ts +61 -0
- package/src/services/provisioning-harness/manifests.ts +118 -0
- package/src/services/provisioning-harness/prepare.ts +113 -0
- package/src/services/provisioning-harness/redundancy-report.ts +32 -0
- package/src/services/provisioning-harness/redundancy.ts +137 -0
- package/src/services/provisioning-harness/report.ts +129 -0
- package/src/services/provisioning-harness/types.ts +174 -0
- package/src/services/provisioning-registry.ts +15 -0
- package/src/services/rate-limit-resume.ts +220 -0
- package/src/services/reap-verdict.ts +52 -0
- package/src/services/red-main-auto-revert.ts +103 -0
- package/src/services/red-main-controller-deps.ts +80 -0
- package/src/services/red-main-controller.ts +262 -0
- package/src/services/red-main-incident.ts +44 -0
- package/src/services/red-main-quarantine.ts +92 -0
- package/src/services/register-agent.ts +447 -0
- package/src/services/release-readiness.ts +219 -0
- package/src/services/reported-exit-death.ts +29 -0
- package/src/services/response-report-admission.ts +17 -0
- package/src/services/restart-epoch-driver.ts +290 -0
- package/src/services/restart-epoch-reconciler.ts +326 -0
- package/src/services/restart-epoch-stale-command-recovery.ts +133 -0
- package/src/services/restart-instructions.ts +86 -0
- package/src/services/restart-project-role.ts +74 -0
- package/src/services/restart-secret-refs.ts +14 -0
- package/src/services/restart-spawn.ts +510 -0
- package/src/services/review-publish.ts +76 -0
- package/src/services/review-ref-reconcile.ts +337 -0
- package/src/services/run-command-input.ts +22 -0
- package/src/services/run-command.ts +510 -0
- package/src/services/run-completion-message.ts +70 -0
- package/src/services/run-log.ts +212 -0
- package/src/services/run-queue.ts +63 -0
- package/src/services/scheduler-command-cancel.ts +49 -0
- package/src/services/scheduler-command.ts +590 -0
- package/src/services/scheduler-create.ts +25 -0
- package/src/services/scheduler-plan.ts +202 -0
- package/src/services/scheduler-recovery.ts +31 -0
- package/src/services/scheduler.ts +406 -0
- package/src/services/self-care-state.ts +10 -0
- package/src/services/self-effort-grant.ts +93 -0
- package/src/services/self-effort.ts +152 -0
- package/src/services/send-message.ts +548 -0
- package/src/services/server-credentials.ts +53 -0
- package/src/services/shipping-board.ts +111 -0
- package/src/services/shipping-project-config.ts +86 -0
- package/src/services/shipping-stats.ts +86 -0
- package/src/services/shutdown-agent.ts +463 -0
- package/src/services/shutdown-watchdog.ts +119 -0
- package/src/services/spawn-agent.ts +967 -0
- package/src/services/spawn-approval.ts +26 -0
- package/src/services/spawn-brief.ts +39 -0
- package/src/services/spawn-chain-inspector.ts +286 -0
- package/src/services/spawn-cwd-placement.ts +250 -0
- package/src/services/spawn-identity.ts +127 -0
- package/src/services/spawn-instruction-inputs.ts +114 -0
- package/src/services/spawn-issue-activity.ts +102 -0
- package/src/services/spawn-launch-decision.ts +32 -0
- package/src/services/spawn-launch.ts +116 -0
- package/src/services/spawn-loss-escalation.ts +253 -0
- package/src/services/spawn-placement.test-fixture.ts +30 -0
- package/src/services/spawn-project-role.ts +133 -0
- package/src/services/spawn-registration-watchdog.ts +352 -0
- package/src/services/spawn-replay.ts +61 -0
- package/src/services/spawn-repo-probe.ts +118 -0
- package/src/services/spawn-tree-cleanup.ts +37 -0
- package/src/services/spawn-warnings.ts +13 -0
- package/src/services/steward-reaper.ts +244 -0
- package/src/services/task-context-hydration.ts +413 -0
- package/src/services/task-delivery-close.ts +26 -0
- package/src/services/task-delivery-event.ts +11 -0
- package/src/services/task-delivery-land-policy.ts +35 -0
- package/src/services/task-delivery-summary.ts +38 -0
- package/src/services/task-delivery.ts +762 -0
- package/src/services/task-dependency-graph.ts +116 -0
- package/src/services/task-dispatch.ts +178 -0
- package/src/services/task-done-when.ts +45 -0
- package/src/services/task-entity.ts +758 -0
- package/src/services/task-from-issue.ts +80 -0
- package/src/services/task-issue-digest.ts +45 -0
- package/src/services/task-issue-link.ts +158 -0
- package/src/services/task-issue-weave.ts +570 -0
- package/src/services/task-land-withdraw.ts +462 -0
- package/src/services/task-lifecycle.ts +668 -0
- package/src/services/task-nothing-to-land.ts +37 -0
- package/src/services/task-plan-view.ts +172 -0
- package/src/services/task-review-hold.ts +244 -0
- package/src/services/task-semantic-events.ts +396 -0
- package/src/services/task-stage-wake.ts +15 -0
- package/src/services/task-state-reconcile.ts +169 -0
- package/src/services/task-validation.ts +42 -0
- package/src/services/team-claim-race.worker.ts +72 -0
- package/src/services/team-spawn-delegation.ts +30 -0
- package/src/services/team-templates.ts +172 -0
- package/src/services/team.ts +320 -0
- package/src/services/terminal-provider-exit.ts +57 -0
- package/src/services/timer-message-fire-chaos-worker.ts +29 -0
- package/src/services/timer-message-fire-outbox.ts +184 -0
- package/src/services/transient-agent-reaper.ts +412 -0
- package/src/services/turn-reconcile-audit.ts +236 -0
- package/src/services/user-onboarding.ts +98 -0
- package/src/services/user-profile.ts +57 -0
- package/src/services/web-search.ts +83 -0
- package/src/services/web-tool-calls.ts +65 -0
- package/src/services/withdraw-steward.ts +57 -0
- package/src/services/work-finality.ts +34 -0
- package/src/services/workflow-agent-obligation.ts +35 -0
- package/src/services/workflow-auto-start.ts +126 -0
- package/src/services/workflow-backstop.ts +38 -0
- package/src/services/workflow-budget.test-fixture.ts +10 -0
- package/src/services/workflow-caller.ts +32 -0
- package/src/services/workflow-catalog.ts +43 -0
- package/src/services/workflow-child-proof-worker.ts +76 -0
- package/src/services/workflow-child.test-fixture.ts +51 -0
- package/src/services/workflow-ci-main.ts +93 -0
- package/src/services/workflow-control-proof-worker.ts +149 -0
- package/src/services/workflow-coordinator-decision-proof-worker.ts +123 -0
- package/src/services/workflow-coordinator.ts +8 -0
- package/src/services/workflow-decision-answer.ts +18 -0
- package/src/services/workflow-decision-proof-worker.ts +92 -0
- package/src/services/workflow-decision.test-fixture.ts +58 -0
- package/src/services/workflow-decisions.ts +107 -0
- package/src/services/workflow-deferred-cleanup.ts +40 -0
- package/src/services/workflow-dispatch-result.ts +20 -0
- package/src/services/workflow-effect-driver.ts +165 -0
- package/src/services/workflow-effects.ts +544 -0
- package/src/services/workflow-foreach-proof-worker.ts +209 -0
- package/src/services/workflow-land-notice.ts +18 -0
- package/src/services/workflow-land.ts +105 -0
- package/src/services/workflow-notice.ts +32 -0
- package/src/services/workflow-overdue-notice.ts +19 -0
- package/src/services/workflow-pins.ts +162 -0
- package/src/services/workflow-reconcile.ts +210 -0
- package/src/services/workflow-resume-pins.ts +30 -0
- package/src/services/workflow-run-chaos-worker.ts +67 -0
- package/src/services/workflow-run-view.ts +71 -0
- package/src/services/workflow-run.test-fixture.ts +165 -0
- package/src/services/workflow-runs.ts +370 -0
- package/src/services/workflow-scripts.ts +100 -0
- package/src/services/workflow-slice-proof.ts +14 -0
- package/src/services/workflow-stats.ts +208 -0
- package/src/services/workflow-supervisor-state.ts +117 -0
- package/src/services/workflow-supervisor.ts +122 -0
- package/src/services/workflow-verification.ts +68 -0
- package/src/services/workspace-recovery.ts +168 -0
- package/src/services/workspace-task-binding.ts +22 -0
- package/src/settings/modules.ts +149 -0
- package/src/settings/registry.ts +629 -0
- package/src/settings/user-settings.ts +81 -0
- package/src/setup.ts +199 -0
- package/src/shared-mcp.ts +87 -0
- package/src/shutdown.ts +33 -0
- package/src/spawn-admission.ts +48 -0
- package/src/spawn-budget.ts +18 -0
- package/src/spawn-command.ts +373 -0
- package/src/spawn-env.ts +27 -0
- package/src/spawn-intent.ts +17 -0
- package/src/spawn-lease.ts +41 -0
- package/src/spawn-models.ts +22 -0
- package/src/spawn-placement.ts +348 -0
- package/src/spawn-profile-errors.ts +9 -0
- package/src/spawn-quota.ts +15 -0
- package/src/spawn-targets.ts +679 -0
- package/src/sse-agent-status.ts +35 -0
- package/src/sse-outbox-cursor.ts +28 -0
- package/src/sse-visibility.ts +36 -0
- package/src/sse.ts +684 -0
- package/src/startup-context-injection.ts +518 -0
- package/src/startup-timing.ts +30 -0
- package/src/state-adoption/artifacts.ts +27 -0
- package/src/state-adoption/cd-cutover.ts +125 -0
- package/src/state-adoption/files.ts +31 -0
- package/src/state-adoption/index.ts +166 -0
- package/src/state-adoption/linux-plan.ts +67 -0
- package/src/state-adoption/linux.ts +104 -0
- package/src/state-adoption/macos-plan.ts +58 -0
- package/src/state-adoption/macos.ts +112 -0
- package/src/steward-claim-release.ts +38 -0
- package/src/steward-handoff.ts +28 -0
- package/src/steward-identity.ts +54 -0
- package/src/steward-policy-cleanup.ts +222 -0
- package/src/steward-policy-model-reconcile.ts +33 -0
- package/src/steward-policy-name.ts +13 -0
- package/src/steward-provenance.ts +59 -0
- package/src/steward-queue.ts +85 -0
- package/src/steward-slot-recovery.ts +34 -0
- package/src/steward-spawn-guard.ts +344 -0
- package/src/steward.test-fixture.ts +11 -0
- package/src/steward.ts +199 -0
- package/src/stream-proxy.ts +84 -0
- package/src/task-authz.ts +40 -0
- package/src/task-completion.ts +39 -0
- package/src/task-dispatch-live.ts +70 -0
- package/src/task-dispatcher-ranking.ts +136 -0
- package/src/task-dispatcher.ts +841 -0
- package/src/task-owner-notices.ts +35 -0
- package/src/task-owner.ts +63 -0
- package/src/task-plan-status.ts +21 -0
- package/src/task-verification.ts +35 -0
- package/src/team-idle-tracker.ts +39 -0
- package/src/team-template-config.ts +100 -0
- package/src/teams-config-store.ts +22 -0
- package/src/terminal-authz.ts +49 -0
- package/src/token-db-write.ts +44 -0
- package/src/token-db.ts +487 -0
- package/src/token-usage-async.ts +40 -0
- package/src/transport-subscriptions.ts +57 -0
- package/src/types.ts +1 -0
- package/src/upgrade-install-verify.ts +179 -0
- package/src/upgrade-local-id.ts +3 -0
- package/src/upgrade-services.ts +125 -0
- package/src/upgrade.ts +1006 -0
- package/src/user-awaiting-reply.ts +42 -0
- package/src/user-path.ts +246 -0
- package/src/user-settings-async.ts +33 -0
- package/src/user-settings-store.ts +106 -0
- package/src/user-style.ts +83 -0
- package/src/utils.ts +42 -0
- package/src/validation.ts +324 -0
- package/src/vault-backup-config.ts +28 -0
- package/src/vault-expiry-config.ts +12 -0
- package/src/versioned-prompts.ts +57 -0
- package/src/workflow-capabilities.ts +10 -0
- package/src/workflow-prompt-templates.ts +20 -0
- package/src/workspace-action-audit.ts +42 -0
- package/src/workspace-actions.ts +689 -0
- package/src/workspace-auto-merge.ts +1055 -0
- package/src/workspace-changed-paths-client.ts +97 -0
- package/src/workspace-claim.ts +45 -0
- package/src/workspace-cleanup-settle.ts +51 -0
- package/src/workspace-cleanup-stale.ts +231 -0
- package/src/workspace-command-settle.ts +589 -0
- package/src/workspace-config.ts +7 -0
- package/src/workspace-conflict-resolver.ts +182 -0
- package/src/workspace-dead-owner-recovery.ts +19 -0
- package/src/workspace-delivery-tip.ts +51 -0
- package/src/workspace-escalation.ts +107 -0
- package/src/workspace-git-state-client.ts +42 -0
- package/src/workspace-host-client.ts +86 -0
- package/src/workspace-host-target.ts +5 -0
- package/src/workspace-host.ts +61 -0
- package/src/workspace-human-escalation.ts +70 -0
- package/src/workspace-land-gate-watchdog.ts +76 -0
- package/src/workspace-land-gate.ts +99 -0
- package/src/workspace-land-result.ts +12 -0
- package/src/workspace-land-retry.ts +82 -0
- package/src/workspace-land-stopped.ts +57 -0
- package/src/workspace-merge-dispatch.ts +27 -0
- package/src/workspace-merge-progress.ts +369 -0
- package/src/workspace-merge-retry-policy.ts +59 -0
- package/src/workspace-merge.ts +614 -0
- package/src/workspace-nothing-to-land-notice.ts +27 -0
- package/src/workspace-orphans.ts +927 -0
- package/src/workspace-phase.ts +507 -0
- package/src/workspace-pr-completion.ts +285 -0
- package/src/workspace-probe.ts +212 -0
- package/src/workspace-recorded-land.ts +47 -0
- package/src/workspace-recovery-authz.ts +88 -0
- package/src/workspace-rekey.ts +106 -0
- package/src/workspace-steward-authority.ts +16 -0
- package/src/workspace-steward-failure.ts +42 -0
- package/src/workspace-steward-wake.ts +150 -0
- package/src/workspace-steward-watchdog.ts +240 -0
|
@@ -0,0 +1,1442 @@
|
|
|
1
|
+
import { writeChildEnv } from "@humwick/sdk/env";
|
|
2
|
+
import { terminateProviderProcesses } from "../provider-processes";
|
|
3
|
+
import { type InteractivePrompt, type LivenessSignal, type Message, type MessageTurnEndReason, type ProviderState, type ToolCallCategory, sanitizeLaunchBoundary, sanitizeLaunchText, errMessage, isRecord, stringValue, HARNESS_SUBAGENTS_DISABLED, harnessSubagentsEnabled } from "@humwick/sdk";
|
|
4
|
+
import { codexEndedByFrom, codexTurnFailure } from "./codex-turn-outcome";
|
|
5
|
+
import { processTreePidsFromTable } from "@humwick/sdk/process-utils";
|
|
6
|
+
import { providerMessageText, type ManagedProcess, type PromptOfferOptions, type ProviderAdapter, type ProviderConfig, type ProviderDeliverContext, type ProviderInputObserver, type ProviderPermissionDecisionInput, type ProviderSessionEvent, type ProviderStatusUpdate, type ProviderTokenUsageReporter, type RunnerSpawnConfig, type ShutdownOutcome, type SpawnArgs, type TerminalAttachSpec } from "../adapter";
|
|
7
|
+
import { launchProvisionedMcpServers } from "../provisioning";
|
|
8
|
+
import { resolveRelayContext, workspaceDepsNoteFromEnv } from "../relay-instructions";
|
|
9
|
+
import { allocateLoopbackPort } from "../free-port";
|
|
10
|
+
import { midTurnClientUserId, partitionMidTurnDelivery, resolveActiveTurnMessageDelivery } from "../mid-turn-delivery";
|
|
11
|
+
import { CODEX_TURN_IN_PROGRESS_MESSAGE } from "../runner-helpers";
|
|
12
|
+
|
|
13
|
+
import { assembleLaunch, bundledCodexSkillDirs, bundledSkillConfigArgs, codexSkillRoots, materializeLaunchAssembly } from "../launch-assembly";
|
|
14
|
+
import { logger } from "../logger";
|
|
15
|
+
import { freshContextState } from "../transcript-context";
|
|
16
|
+
import type { SessionEvent } from "../session-insights";
|
|
17
|
+
import { CodexAgentMessageCapture } from "./codex-agent-message-capture";
|
|
18
|
+
import { absoluteToolPaths, clipToolSummary, codexReadPaths, oneLineText, redactAndCapParams } from "./tool-summary";
|
|
19
|
+
import { codexTokenUsageContext, isContextState, latestCodexContext } from "./codex-rollout-context";
|
|
20
|
+
import { reportCodexTokenUsage } from "./codex-token-usage-capture";
|
|
21
|
+
import { computeLivenessSignal, type LivenessInputs } from "../liveness";
|
|
22
|
+
import { CodexAppClient, CodexRpcError, type ClientEvent } from "./codex-client";
|
|
23
|
+
import { registerCodexSkillRoots } from "./codex-skill-discovery";
|
|
24
|
+
import { spawnCodexAppServer } from "./codex-app-server";
|
|
25
|
+
import { codexWebToolsConfigArgs, launchWebTools } from "../web-tools";
|
|
26
|
+
import { codexMcpOutputRedactor } from "./codex-tool-output";
|
|
27
|
+
|
|
28
|
+
/** Relay context prepended to a Codex agent's first turn: the standard relay
|
|
29
|
+
* blurb plus, when running in an isolated workspace, the deps caveat (#159). */
|
|
30
|
+
function codexRelayContextBlock(process: ManagedProcess): string {
|
|
31
|
+
const config = process.meta?.config as RunnerSpawnConfig | undefined;
|
|
32
|
+
return [resolveRelayContext({
|
|
33
|
+
slug: "relay.context.codex", config,
|
|
34
|
+
mcpServers: config ? launchProvisionedMcpServers(config) : undefined,
|
|
35
|
+
webTools: config ? { names: launchWebTools(config), claude: false } : undefined,
|
|
36
|
+
}).text, workspaceDepsNoteFromEnv()].filter(Boolean).join("\n\n");
|
|
37
|
+
}
|
|
38
|
+
import { prepareCodexProfileHome } from "../profile-home";
|
|
39
|
+
import { buildCodexTuiSpawnArgs, codexApprovalConfigArgs, codexAppServerConfigArgs, codexHarnessConfigArgs, codexManagedConfigArgs, codexModelConfigArgs, codexToolOutputTokenLimitConfigArgs, isCodexCliCommand, resolveRealCodexCommand } from "./codex-launch-config";
|
|
40
|
+
import { codexProjectShellConfigArgs } from "./project-shell";
|
|
41
|
+
|
|
42
|
+
export { processTreePidsFromTable };
|
|
43
|
+
// Launch/config-arg construction lives in ./codex-launch-config; re-exported so
|
|
44
|
+
// codex.ts consumers + tests keep their import path.
|
|
45
|
+
export {
|
|
46
|
+
codexApprovalConfigArgs,
|
|
47
|
+
codexAppServerConfigArgs,
|
|
48
|
+
codexManagedConfigArgs,
|
|
49
|
+
codexModelConfigArgs,
|
|
50
|
+
codexToolOutputTokenLimitConfigArgs,
|
|
51
|
+
DEFAULT_CODEX_TOOL_OUTPUT_TOKEN_LIMIT,
|
|
52
|
+
isCodexCliCommand,
|
|
53
|
+
resolveRealCodexCommand,
|
|
54
|
+
} from "./codex-launch-config";
|
|
55
|
+
|
|
56
|
+
type PendingCodexApproval = {
|
|
57
|
+
id: string;
|
|
58
|
+
requestId: string | number;
|
|
59
|
+
method: string;
|
|
60
|
+
params: Record<string, unknown>;
|
|
61
|
+
view: InteractivePrompt;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type PendingCodexCompact = {
|
|
65
|
+
threadId: string;
|
|
66
|
+
timeout: ReturnType<typeof setTimeout>;
|
|
67
|
+
resolve: () => void;
|
|
68
|
+
reject: (error: Error) => void;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const CODEX_COMPACT_TIMEOUT_MS = 10 * 60 * 1000;
|
|
72
|
+
|
|
73
|
+
// #2539 Phase A — bounded memory of clientUserMessageIds POSITIVELY accepted by the app-server
|
|
74
|
+
// (observed via the userMessage item echo). Insertion-ordered, oldest evicted; the reconcile
|
|
75
|
+
// path only needs recent turns' ids.
|
|
76
|
+
const CODEX_STEER_ACCEPTED_CLIENT_CAP = 128;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* #2539 Phase A — classify a rejected `turn/steer` RPC so the fallback matches the refusal.
|
|
80
|
+
* The app-server refuses steer against a turn that cannot take additive input (review/compact)
|
|
81
|
+
* and against a turn id that is no longer active (ended under us / expected-id mismatch); both
|
|
82
|
+
* are expected flow control, distinct from transport faults (socket, 30s timeout — an AMBIGUOUS
|
|
83
|
+
* outcome: the steer may still have been accepted, so the caller must not assume either way).
|
|
84
|
+
* Any OTHER structured JSON-RPC error is still a definitive refusal (the input was not
|
|
85
|
+
* accepted) — classified "unknown-refusal" so the caller defers instead of rethrowing into a
|
|
86
|
+
* ~1s refused-RPC hot loop. Pure + exported so the classification table is unit-testable.
|
|
87
|
+
*
|
|
88
|
+
* Spellings verified live-fire against codex-cli 0.153.3 app-server (2026-09-11), all code
|
|
89
|
+
* -32600, `data` undefined on the wire:
|
|
90
|
+
* - `no active turn to steer` → stale-turn
|
|
91
|
+
* - `expected active turn id \`X\` but found \`Y\`` → stale-turn (expected-id mismatch)
|
|
92
|
+
* - `cannot steer a compact turn` → not-steerable (a compact runs AS an active turn; review
|
|
93
|
+
* is the parallel construction; upstream CodexErrorInfo names the kind
|
|
94
|
+
* activeTurnNotSteerable{turnKind: "review"|"compact"} — checked first when `data` carries it)
|
|
95
|
+
*/
|
|
96
|
+
export function classifyTurnSteerRejection(error: unknown): "not-steerable" | "stale-turn" | "unknown-refusal" | undefined {
|
|
97
|
+
if (!(error instanceof CodexRpcError)) return undefined;
|
|
98
|
+
const message = error.message.toLowerCase();
|
|
99
|
+
const data = isRecord(error.data) ? error.data : undefined;
|
|
100
|
+
const dataKind = stringValue(data?.kind) ?? stringValue(data?.reason) ?? stringValue(data?.type);
|
|
101
|
+
if (dataKind === "review" || dataKind === "compact") return "not-steerable";
|
|
102
|
+
if (message.includes("not steerable") || message.includes("notsteerable")) return "not-steerable";
|
|
103
|
+
if (/cannot steer a (review|compact) turn/.test(message)) return "not-steerable";
|
|
104
|
+
if (dataKind === "stale-turn" || /no active turn|expected active turn id|turn (id )?mismatch|expected turn|unknown turn|turn not (found|active)/.test(message)) return "stale-turn";
|
|
105
|
+
return "unknown-refusal";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export class CodexAdapter implements ProviderAdapter {
|
|
109
|
+
mcpToolResponseRedactor = codexMcpOutputRedactor;
|
|
110
|
+
readonly provider = "codex";
|
|
111
|
+
readonly reportsContextResets = true;
|
|
112
|
+
readonly supportsMidTurnSteer = true;
|
|
113
|
+
// #2569 — clearContext starts a FRESH thread and compact rewrites the current one, both via an
|
|
114
|
+
// awaited app-server handshake. That await confirms the new generation is ready but does NOT
|
|
115
|
+
// settle the predecessor turn (the model calls relay_compact_and_resume from within its own live
|
|
116
|
+
// turn). Without a fence, that turn keeps writing the worktree on the old thread while the
|
|
117
|
+
// successor generation writes on the new one. The runner therefore interrupts + settles the
|
|
118
|
+
// predecessor turn before compact/clearContext (interrupt-then-settle, via the primitives below).
|
|
119
|
+
readonly interruptsTurnBeforeContextCommand = true;
|
|
120
|
+
private statusCb: (status: ProviderStatusUpdate) => void = () => {};
|
|
121
|
+
private sessionEventCb: (event: ProviderSessionEvent) => void = () => {};
|
|
122
|
+
private readonly subagentThreads = new Map<string, { label?: string; role?: string; parentId?: string }>();
|
|
123
|
+
private readonly pendingApprovals = new Map<string, PendingCodexApproval>();
|
|
124
|
+
private pendingCompact?: PendingCodexCompact;
|
|
125
|
+
// Active turn id for the main thread, captured from turn/started so an interrupt
|
|
126
|
+
// can target the in-flight turn. Cleared on turn/completed.
|
|
127
|
+
private activeTurnId?: string;
|
|
128
|
+
private lastCompactionKey?: string;
|
|
129
|
+
private turnFailure?: ReturnType<typeof codexTurnFailure>;
|
|
130
|
+
// #1339: the turn id we last logged a delivery-deferral for, so the once-per-turn "held
|
|
131
|
+
// behind active turn" notice isn't repeated on every ~1s runner retry during that turn.
|
|
132
|
+
private deferredForTurnId?: string;
|
|
133
|
+
// #2539 Phase A — the turn id whose steer the app-server REJECTED as not steerable
|
|
134
|
+
// (review/compact). Once set for a turn id, mid-turn offers silently defer until the turn id
|
|
135
|
+
// changes, instead of re-attempting the RPC on every ~1s drain only to be refused again.
|
|
136
|
+
private steerDeniedForTurnId?: string;
|
|
137
|
+
// #2539 Phase A — clientUserMessageIds POSITIVELY accepted by the app-server (the userMessage
|
|
138
|
+
// item echoes the steered input's clientId). The reconcile path reads this to settle an
|
|
139
|
+
// accepted-but-response-lost steer instead of re-steering (which could duplicate the input).
|
|
140
|
+
private readonly acceptedSteerClientIds = new Set<string>();
|
|
141
|
+
// #653: monotonic id for a turn we synthesize from live item activity when a real
|
|
142
|
+
// turn/started never reached us — so a working Codex agent isn't reported `idle`.
|
|
143
|
+
private syntheticTurnSeq = 0;
|
|
144
|
+
// #2543: monotonic clientUserMessageId sequence for prompt injections steered into a live
|
|
145
|
+
// turn — per-attempt unique (the app-server echoes it back; no reconcile reads it).
|
|
146
|
+
private injectionSteerSeq = 0;
|
|
147
|
+
private tokenUsageReporter?: ProviderTokenUsageReporter;
|
|
148
|
+
private readonly agentMessageCapture = new CodexAgentMessageCapture();
|
|
149
|
+
private readonly itemTextBuffers = new Map<string, string>();
|
|
150
|
+
private readonly itemTextBufferTypes = new Map<string, string>();
|
|
151
|
+
// #183/#184: the normalized session-event log for the current process lifetime, fed
|
|
152
|
+
// from the same completed-item stream that drives the chat mirror. The runner slices
|
|
153
|
+
// this per-segment (since the last compact/clear/restart) via its own cursor, so we
|
|
154
|
+
// accumulate and never clear mid-session; spawn() resets it for a fresh process. Soft
|
|
155
|
+
// cap below keeps a runaway session from growing memory unbounded.
|
|
156
|
+
private sessionEvents: SessionEvent[] = [];
|
|
157
|
+
private static readonly SESSION_EVENTS_CAP = 50_000;
|
|
158
|
+
// #3411 — the session cwd a fileChange's relative paths resolve against.
|
|
159
|
+
private sessionCwd?: string;
|
|
160
|
+
|
|
161
|
+
onStatusChange(cb: (status: ProviderStatusUpdate) => void): void {
|
|
162
|
+
this.statusCb = cb;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// §4.1 contract verdict (#746). Codex reference (#724): a Codex provider-turn can wedge
|
|
166
|
+
// while a long-running subprocess child (a `bun test` / build gate) is still alive and
|
|
167
|
+
// making real progress. That subprocess is tracked as a non-`provider-turn` work-kind, so
|
|
168
|
+
// `hasLiveWork` stays true and the turn is never mis-read as stuck; app-server item events
|
|
169
|
+
// also refresh `lastProviderEventAt` → lastProgressAt. The fold is shared; this override
|
|
170
|
+
// documents and owns Codex's progress sources behind the contract.
|
|
171
|
+
liveness(inputs: LivenessInputs): LivenessSignal {
|
|
172
|
+
return computeLivenessSignal(inputs);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
onSessionEvent(cb: (event: ProviderSessionEvent) => void): void {
|
|
176
|
+
this.sessionEventCb = cb;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private resetProcessState(): void {
|
|
180
|
+
this.resetThreadState();
|
|
181
|
+
this.sessionEvents = []; // fresh process -> fresh segment cursor (#184)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private resetThreadState(): void {
|
|
185
|
+
this.cancelPendingCompact(new Error("Codex compact canceled by thread reset"));
|
|
186
|
+
this.subagentThreads.clear();
|
|
187
|
+
this.pendingApprovals.clear();
|
|
188
|
+
this.activeTurnId = undefined;
|
|
189
|
+
this.turnFailure = undefined;
|
|
190
|
+
this.steerDeniedForTurnId = undefined;
|
|
191
|
+
this.acceptedSteerClientIds.clear();
|
|
192
|
+
this.agentMessageCapture.reset();
|
|
193
|
+
this.itemTextBuffers.clear();
|
|
194
|
+
this.itemTextBufferTypes.clear();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async interrupt(process: ManagedProcess): Promise<Record<string, unknown>> {
|
|
198
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
199
|
+
if (!client) throw new Error("Codex App Server client is unavailable");
|
|
200
|
+
const threadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : "";
|
|
201
|
+
if (!threadId) throw new Error("Codex thread is not ready");
|
|
202
|
+
if (!this.activeTurnId) throw new Error("no active Codex turn to interrupt");
|
|
203
|
+
await client.turnInterrupt(threadId, this.activeTurnId);
|
|
204
|
+
return { method: "turn-interrupt", turnId: this.activeTurnId };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async probeActivity(process: ManagedProcess): Promise<"busy" | "idle" | "unknown"> {
|
|
208
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
209
|
+
if (!client?.isConnected()) return "unknown";
|
|
210
|
+
const threadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : "";
|
|
211
|
+
// #651: when no local activeTurnId, don't short-circuit to idle — query the app-server.
|
|
212
|
+
// turn/started can arrive after processing begins (or be missed entirely); a stale-idle
|
|
213
|
+
// probe would make a busy agent appear idle to the coordinator. Same fallback as #653's
|
|
214
|
+
// ensureMainTurnActive path, but for the pull (probe) direction, not the push (event) one.
|
|
215
|
+
if (!this.activeTurnId) {
|
|
216
|
+
if (!threadId) return "idle";
|
|
217
|
+
try {
|
|
218
|
+
const read = await client.threadRead(threadId, true);
|
|
219
|
+
const thread = isRecord(read.thread) ? read.thread : undefined;
|
|
220
|
+
const turns = Array.isArray(thread?.turns) ? thread.turns : [];
|
|
221
|
+
const inProgressTurn = turns.find((t) => isRecord(t) && stringValue(t.status) === "inProgress");
|
|
222
|
+
if (inProgressTurn) {
|
|
223
|
+
// Synthesize the active turn (same path as ensureMainTurnActive on item events).
|
|
224
|
+
this.ensureMainTurnActive(stringValue(inProgressTurn.id));
|
|
225
|
+
return "busy";
|
|
226
|
+
}
|
|
227
|
+
const threadStatus = statusType(thread?.status);
|
|
228
|
+
if (threadStatus === "active") return "busy";
|
|
229
|
+
return "idle";
|
|
230
|
+
} catch {
|
|
231
|
+
return "unknown";
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (!threadId) return "busy";
|
|
235
|
+
try {
|
|
236
|
+
const read = await client.threadRead(threadId, true);
|
|
237
|
+
const thread = isRecord(read.thread) ? read.thread : undefined;
|
|
238
|
+
const turns = Array.isArray(thread?.turns) ? thread.turns : [];
|
|
239
|
+
const activeTurn = turns.find((turn) => isRecord(turn) && stringValue(turn.id) === this.activeTurnId);
|
|
240
|
+
const turnStatus = isRecord(activeTurn) ? stringValue(activeTurn.status) : undefined;
|
|
241
|
+
if (turnStatus === "inProgress") return "busy";
|
|
242
|
+
if (turnStatus === "completed" || turnStatus === "interrupted" || turnStatus === "failed") {
|
|
243
|
+
this.finishMainTurn(codexEndedByFrom(turnStatus), isRecord(activeTurn) ? activeTurn.error : undefined);
|
|
244
|
+
return "idle";
|
|
245
|
+
}
|
|
246
|
+
const threadStatus = statusType(thread?.status);
|
|
247
|
+
if (threadStatus === "active") return "busy";
|
|
248
|
+
if (threadStatus === "idle" || threadStatus === "notLoaded" || threadStatus === "systemError") {
|
|
249
|
+
this.finishMainTurn(codexEndedByFrom(threadStatus));
|
|
250
|
+
return "idle";
|
|
251
|
+
}
|
|
252
|
+
} catch {
|
|
253
|
+
return "unknown";
|
|
254
|
+
}
|
|
255
|
+
return "busy";
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// The Codex app-server is headless and has no tmux session, but an unexpected
|
|
259
|
+
// exit should still be restarted with backoff rather than resolved as a final exit.
|
|
260
|
+
supportsUnexpectedExitRestart(): boolean {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async spawn(config: RunnerSpawnConfig): Promise<ManagedProcess> {
|
|
265
|
+
this.resetProcessState();
|
|
266
|
+
this.sessionCwd = config.cwd;
|
|
267
|
+
const args = this.buildSpawnArgs(config, config.providerConfig as ProviderConfig);
|
|
268
|
+
const { appServer, appServerUrl, client } = await spawnCodexAppServer(args);
|
|
269
|
+
if (client) {
|
|
270
|
+
await client.initialize().catch(() => undefined);
|
|
271
|
+
await registerCodexSkillRoots(client, codexSkillRoots(config), (message) => logger.warn("codex", message));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const tuiArgs = buildCodexTuiSpawnArgs(config, config.providerConfig, appServerUrl, args.env);
|
|
275
|
+
const tui = tuiArgs
|
|
276
|
+
? Bun.spawn([tuiArgs.command, ...tuiArgs.args], {
|
|
277
|
+
cwd: tuiArgs.cwd,
|
|
278
|
+
env: tuiArgs.env,
|
|
279
|
+
stdin: "inherit",
|
|
280
|
+
stdout: "inherit",
|
|
281
|
+
stderr: "inherit",
|
|
282
|
+
})
|
|
283
|
+
: undefined;
|
|
284
|
+
|
|
285
|
+
// app-server and tui exit independently; the first exit defines the agent's
|
|
286
|
+
// fate. Latch so a trailing second exit can't fire a duplicate terminal event.
|
|
287
|
+
let exitReported = false;
|
|
288
|
+
const reportExit = (status: ProviderStatusUpdate): void => {
|
|
289
|
+
if (exitReported) return;
|
|
290
|
+
exitReported = true;
|
|
291
|
+
this.statusCb(status);
|
|
292
|
+
};
|
|
293
|
+
void appServer.exited.then((code) => reportExit(code === 0 ? "offline" : "error")).catch(() => reportExit("error")).catch(() => {});
|
|
294
|
+
if (tui) void tui.exited.then((code) => reportExit(code === 0 ? "idle" : "error")).catch(() => reportExit("error")).catch(() => {});
|
|
295
|
+
const process: ManagedProcess = {
|
|
296
|
+
pid: tui?.pid ?? appServer.pid,
|
|
297
|
+
process: appServer,
|
|
298
|
+
meta: {
|
|
299
|
+
client,
|
|
300
|
+
cwd: config.cwd,
|
|
301
|
+
appServer,
|
|
302
|
+
appServerUrl,
|
|
303
|
+
tui,
|
|
304
|
+
config,
|
|
305
|
+
attachCommand: resolveRealCodexCommand(config.providerConfig.command, args.env.PATH),
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
process.meta = { ...process.meta, getContext: () => latestCodexContext(process) };
|
|
309
|
+
if (client) client.onEvent((event) => this.handleCodexEvent(event, process));
|
|
310
|
+
return process;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
async shutdown(process: ManagedProcess, opts: { graceful: boolean; timeoutMs: number }): Promise<ShutdownOutcome> {
|
|
314
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
315
|
+
client?.close();
|
|
316
|
+
return terminateProviderProcesses([process.meta?.tui, process.meta?.appServer, process.process].filter(Boolean) as Bun.Subprocess[], opts);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async compact(process: ManagedProcess): Promise<Record<string, unknown>> {
|
|
320
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
321
|
+
if (!client) throw new Error("Codex App Server client is unavailable");
|
|
322
|
+
const threadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : "";
|
|
323
|
+
if (!threadId) throw new Error("Codex thread is not ready");
|
|
324
|
+
this.statusCb({ status: "busy", reason: "provider-turn", timeline: { status: "compacting", timestamp: Date.now() } });
|
|
325
|
+
const currentContext = isContextState(process.meta?.context) ? process.meta.context : undefined;
|
|
326
|
+
if (currentContext) {
|
|
327
|
+
process.meta = {
|
|
328
|
+
...(process.meta ?? {}),
|
|
329
|
+
context: { ...currentContext, lifecycleState: "compacting", lastUpdatedAt: Date.now() },
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const completion = this.waitForPendingCompact(threadId);
|
|
333
|
+
try {
|
|
334
|
+
await client.threadCompactStart(threadId);
|
|
335
|
+
await completion;
|
|
336
|
+
} catch (error) {
|
|
337
|
+
this.clearPendingCompact(threadId);
|
|
338
|
+
this.statusCb({ status: "idle", reason: "provider-turn" });
|
|
339
|
+
throw error;
|
|
340
|
+
}
|
|
341
|
+
return { threadId };
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** #3398 — every compaction of the main thread is a context reset, whether or not compact() still waits for it. */
|
|
345
|
+
private onThreadCompacted(process: ManagedProcess, threadId: string, turnId: string | undefined, compactTrigger: "manual" | "auto"): void {
|
|
346
|
+
if (threadId !== process.meta?.threadId) return;
|
|
347
|
+
// thread/compacted and the compaction item report the same compaction.
|
|
348
|
+
const key = turnId ? `${threadId}:${turnId}` : undefined;
|
|
349
|
+
if (key && key === this.lastCompactionKey) return;
|
|
350
|
+
this.lastCompactionKey = key;
|
|
351
|
+
const compactedAt = Date.now();
|
|
352
|
+
if (isContextState(process.meta?.context)) {
|
|
353
|
+
process.meta = { ...(process.meta ?? {}), context: { ...process.meta.context, lifecycleState: "cooling", tasksSinceCompact: 0, lastCompactedAt: compactedAt, lastUpdatedAt: compactedAt } };
|
|
354
|
+
}
|
|
355
|
+
const timeline = { status: "compacted", timestamp: compactedAt };
|
|
356
|
+
const metadata = { compactTrigger };
|
|
357
|
+
this.statusCb(this.activeTurnId ? { status: "busy", reason: "provider-turn", id: this.activeTurnId, timeline, metadata } : { status: "idle", reason: "provider-turn", timeline, metadata });
|
|
358
|
+
this.completePendingCompact(threadId);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
async clearContext(process: ManagedProcess): Promise<Record<string, unknown>> {
|
|
362
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
363
|
+
if (!client) throw new Error("Codex App Server client is unavailable");
|
|
364
|
+
const previousThreadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : undefined;
|
|
365
|
+
this.statusCb({ status: "busy", reason: "provider-turn", timeline: { status: "clearing-context", timestamp: Date.now() } });
|
|
366
|
+
let started: Awaited<ReturnType<CodexAppClient["threadStart"]>>;
|
|
367
|
+
try {
|
|
368
|
+
started = await client.threadStart({ cwd: typeof process.meta?.cwd === "string" ? process.meta.cwd : globalThis.process.cwd() });
|
|
369
|
+
} catch (error) {
|
|
370
|
+
this.statusCb({ status: "idle", reason: "provider-turn" });
|
|
371
|
+
throw error;
|
|
372
|
+
}
|
|
373
|
+
const clearedAt = Date.now();
|
|
374
|
+
this.resetThreadState();
|
|
375
|
+
process.meta = {
|
|
376
|
+
...(process.meta ?? {}),
|
|
377
|
+
threadId: started.thread.id,
|
|
378
|
+
relayContextSent: false,
|
|
379
|
+
context: freshContextState(clearedAt),
|
|
380
|
+
};
|
|
381
|
+
this.statusCb({ status: "idle", reason: "provider-turn", clear: ["subagent"], timeline: { status: "context-cleared", timestamp: clearedAt } });
|
|
382
|
+
return { previousThreadId, threadId: started.thread.id };
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
async terminalAttachSpec(process: ManagedProcess): Promise<TerminalAttachSpec> {
|
|
386
|
+
const threadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : "";
|
|
387
|
+
if (!threadId) throw new Error("Codex thread is not ready");
|
|
388
|
+
const appServerUrl = typeof process.meta?.appServerUrl === "string" ? process.meta.appServerUrl : "";
|
|
389
|
+
if (!appServerUrl) throw new Error("Codex app-server URL is unavailable");
|
|
390
|
+
const command = typeof process.meta?.attachCommand === "string" && process.meta.attachCommand
|
|
391
|
+
? process.meta.attachCommand
|
|
392
|
+
: resolveRealCodexCommand("codex");
|
|
393
|
+
return {
|
|
394
|
+
mode: "guest",
|
|
395
|
+
provider: "codex",
|
|
396
|
+
cwd: typeof process.meta?.cwd === "string" ? process.meta.cwd : globalThis.process.cwd(),
|
|
397
|
+
command: [command, ...codexManagedConfigArgs(), "resume", threadId, "--remote", appServerUrl],
|
|
398
|
+
title: `Codex ${threadId.slice(0, 8)}`,
|
|
399
|
+
ttlMs: 60 * 60 * 1000,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
async deliverInitialPrompt(process: ManagedProcess, prompt: string, options?: PromptOfferOptions): Promise<void> {
|
|
404
|
+
const text = sanitizeLaunchText(prompt, "initial prompt").trim(); // options.readyTimeoutMs (#329) is a Claude-TUI concern; ignored here
|
|
405
|
+
if (!text) return;
|
|
406
|
+
const threadId = await ensureCodexThread(process);
|
|
407
|
+
// #1228: only a genuine first turn gets the initial-prompt label — a mid-session
|
|
408
|
+
// dashboard continue/injection (isInitial: false) is delivered as a plain turn.
|
|
409
|
+
const isInitial = options?.isInitial !== false;
|
|
410
|
+
// #2543 — the last provider-input path without an active-turn guard: a non-initial injection
|
|
411
|
+
// (dashboard continue/hard-redirect, AskUserQuestion answer, empty-turn nudge) offered while
|
|
412
|
+
// a turn is ACTIVE must never issue turn/start (#1339: the app-server silently drops it).
|
|
413
|
+
// Fold it into the live turn via the same additive turn/steer channel deliverMidTurn uses; a
|
|
414
|
+
// refusal defers by throwing the shared turn-in-progress signal, which the runner's injection
|
|
415
|
+
// paths translate into a bounded wait-for-turn-clear + re-offer. A genuine initial prompt
|
|
416
|
+
// (isInitial: true) keeps the start path — its process was just spawned, there is no live turn.
|
|
417
|
+
if (!isInitial && this.activeTurnId !== undefined) {
|
|
418
|
+
await this.steerInjectionIntoActiveTurn(process, threadId, this.activeTurnId, text, options?.inputObserver);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
let input = [
|
|
422
|
+
codexLaunchContext(process),
|
|
423
|
+
...(isInitial ? ["[agent-relay initial prompt from dashboard]"] : []),
|
|
424
|
+
text,
|
|
425
|
+
].filter(Boolean).join("\n\n");
|
|
426
|
+
// #2542 — transactional first-delivery context (#2539 design C applied to this start path):
|
|
427
|
+
// stage the relay-context block but commit relayContextSent ONLY after turn/start is
|
|
428
|
+
// positively accepted, so a failed first turn/start (ready-signal retry, spawn retry) still
|
|
429
|
+
// carries the context instead of silently losing it.
|
|
430
|
+
let relayContextPending = false;
|
|
431
|
+
if (codexRelayContextEnabled(process) && !process.meta?.relayContextSent) {
|
|
432
|
+
input = codexRelayContextBlock(process) + "\n\n" + input;
|
|
433
|
+
relayContextPending = true;
|
|
434
|
+
}
|
|
435
|
+
logger.info("codex", `starting Codex initial prompt in thread ${threadId}`);
|
|
436
|
+
const client = process.meta?.client as CodexAppClient;
|
|
437
|
+
options?.inputObserver?.offered(Date.now(), true);
|
|
438
|
+
const started = await client.turnStart(threadId, input);
|
|
439
|
+
options?.inputObserver?.consumed();
|
|
440
|
+
if (relayContextPending) process.meta = { ...(process.meta ?? {}), relayContextSent: true };
|
|
441
|
+
// #1565 F1 — claim the turn from the RESPONSE, the same hardening deliver() has: without it,
|
|
442
|
+
// a second input in the notification lag read activeTurnId as undefined and issued a
|
|
443
|
+
// concurrent turn/start the app-server silently dropped. A later turn/started overwrites
|
|
444
|
+
// this id; the completion/interrupt/probeActivity paths clear it, so it cannot wedge.
|
|
445
|
+
this.ensureMainTurnActive(stringValue(isRecord(started?.turn) ? started.turn.id : undefined));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* #2543 — fold a non-initial prompt injection into the ACTIVE turn via the additive
|
|
450
|
+
* `turn/steer` channel (the #2539 Phase A channel, shared with deliverMidTurn). The relay
|
|
451
|
+
* context is not re-prepended: an active turn can only exist if its own accepted start already
|
|
452
|
+
* carried (and committed) the first-delivery context. Refusals DEFER — the shared
|
|
453
|
+
* turn-in-progress signal makes the runner's injection paths wait for the turn to clear and
|
|
454
|
+
* re-offer on the idle path — while transport faults stay AMBIGUOUS and rethrow (the command
|
|
455
|
+
* fails visibly; never a silent drop, never an automatic re-steer against a possibly-accepted
|
|
456
|
+
* steer). Unlike deliverMidTurn there is no accepted-clientId reconcile: injections are
|
|
457
|
+
* one-shot user actions with no relay-id settlement and no automatic re-offer of the same
|
|
458
|
+
* payload, so a lost steer response simply fails the command.
|
|
459
|
+
*/
|
|
460
|
+
private async steerInjectionIntoActiveTurn(process: ManagedProcess, threadId: string, steerTurnId: string, text: string, inputObserver?: ProviderInputObserver): Promise<void> {
|
|
461
|
+
const client = process.meta?.client as CodexAppClient;
|
|
462
|
+
const clientId = `relay-inject-${++this.injectionSteerSeq}`;
|
|
463
|
+
try {
|
|
464
|
+
inputObserver?.offered(Date.now(), true);
|
|
465
|
+
await client.turnSteer(threadId, steerTurnId, text, clientId);
|
|
466
|
+
inputObserver?.consumed();
|
|
467
|
+
} catch (error) {
|
|
468
|
+
const rejection = classifyTurnSteerRejection(error);
|
|
469
|
+
if (rejection === undefined) throw error;
|
|
470
|
+
if (rejection === "stale-turn") {
|
|
471
|
+
// The turn ended under us: zero ack. The runner's defer waits for the cleared turn and
|
|
472
|
+
// re-offers; the re-offer then observes no activeTurnId and takes the start path.
|
|
473
|
+
logger.info("codex", `injection steer rejected against Codex turn ${steerTurnId} (no longer active); deferring until the provider is idle`);
|
|
474
|
+
} else {
|
|
475
|
+
// not-steerable (review/compact) or an unrecognized structured refusal: this turn cannot
|
|
476
|
+
// take additive input. Remember it so MESSAGE offers defer silently too (the same memory
|
|
477
|
+
// deliverMidTurn keeps), and defer this injection until the turn ends.
|
|
478
|
+
this.steerDeniedForTurnId = steerTurnId;
|
|
479
|
+
logger.info("codex", `active Codex turn ${steerTurnId} refused an injection steer (${rejection}); deferring until it ends`);
|
|
480
|
+
}
|
|
481
|
+
throw new Error(CODEX_TURN_IN_PROGRESS_MESSAGE);
|
|
482
|
+
}
|
|
483
|
+
logger.info("codex", `steered relay prompt injection (${text.length} chars) into active Codex turn ${steerTurnId}`);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
async deliver(process: ManagedProcess, messages: Message[], ctx?: ProviderDeliverContext): Promise<void | number[]> {
|
|
487
|
+
const threadId = await ensureCodexThread(process);
|
|
488
|
+
// #2539 Phase A — a mid-turn offer goes through the adapter-owned steer contract: the
|
|
489
|
+
// steerable subset folds into the in-flight turn (soft-steer is the codex default), while
|
|
490
|
+
// boundary-only classes stay un-acked for the runner to requeue toward turn-end. An idle
|
|
491
|
+
// offer takes the WHOLE ordered batch as one fresh turn/start — NEVER turn/start while a
|
|
492
|
+
// turn is active (#1339: the app-server would drop it).
|
|
493
|
+
if (this.activeTurnId !== undefined) {
|
|
494
|
+
return this.deliverMidTurn(process, messages, ctx);
|
|
495
|
+
}
|
|
496
|
+
const client = process.meta?.client as CodexAppClient;
|
|
497
|
+
// #2542 — transactional formatting state on the IDLE turn/start path (#2539 design C, the
|
|
498
|
+
// same fix deliverMidTurn already has): stage the first-delivery
|
|
499
|
+
// relay context, and commit BOTH only after turn/start is positively accepted — a failed
|
|
500
|
+
// start must not consume the first-delivery context, so the runner's requeue re-offers WITH
|
|
501
|
+
// it instead of silently losing it.
|
|
502
|
+
let text = [codexLaunchContext(process), providerMessageText(messages)].filter(Boolean).join("\n\n");
|
|
503
|
+
let relayContextPending = false;
|
|
504
|
+
if (codexRelayContextEnabled(process) && !process.meta?.relayContextSent) {
|
|
505
|
+
text = codexRelayContextBlock(process) + "\n\n" + text;
|
|
506
|
+
relayContextPending = true;
|
|
507
|
+
}
|
|
508
|
+
logger.info("codex", codexDeliveryNotice(messages, threadId));
|
|
509
|
+
ctx?.inputObserver?.offered(Date.now(), true);
|
|
510
|
+
const started = await client.turnStart(threadId, text);
|
|
511
|
+
ctx?.inputObserver?.consumed();
|
|
512
|
+
if (relayContextPending) process.meta = { ...(process.meta ?? {}), relayContextSent: true };
|
|
513
|
+
// #1565 F1 — claim the turn from the RESPONSE, not from the later `turn/started` notification.
|
|
514
|
+
// The guard above is only as good as the state it reads: with the turn id arriving a few ms
|
|
515
|
+
// later over the event stream, a second delivery in that window passed the guard and issued a
|
|
516
|
+
// concurrent turn/start on the same thread, which the app-server silently drops — while its
|
|
517
|
+
// command still reported success, so nothing retried it. Claiming it here closes the window:
|
|
518
|
+
// the second payload is DEFERRED (the runner re-offers it when this turn ends) instead of
|
|
519
|
+
// being lost. A later `turn/started` overwrites this id; `turn/completed`, `turn/failed`,
|
|
520
|
+
// `turn/interrupted` and the 4s probeActivity sweep all clear it, so it cannot wedge.
|
|
521
|
+
this.ensureMainTurnActive(stringValue(isRecord(started?.turn) ? started.turn.id : undefined));
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* #2539 Phase A — the codex implementation of the shared mid-turn steer contract (see
|
|
526
|
+
* {@link ProviderAdapter.deliverMidTurn}). Steerable messages fold into the in-flight turn via
|
|
527
|
+
* the ADDITIVE app-server `turn/steer`: the running tool/response step finishes untouched, and
|
|
528
|
+
* the injected input is drained before the next model request — never an abort, never a
|
|
529
|
+
* concurrent turn/start. Guards, per the authoritative design:
|
|
530
|
+
*
|
|
531
|
+
* - Boundary-only partition (shared `partitionMidTurnDelivery`): synthetic memory/self-resume/context injections, and claimable/task assignments
|
|
532
|
+
* keep the turn-end path — left un-acked so the runner requeues them.
|
|
533
|
+
* - Kill switch: `ProviderConfig.activeTurnMessageDelivery === "defer"` restricts the steerable
|
|
534
|
+
* set to empty, deferring messages until the turn ends.
|
|
535
|
+
* - Not-steerable turns (review/compact) defer silently for the WHOLE turn id — remembered
|
|
536
|
+
* once, no ~1s hot loop of refused RPCs.
|
|
537
|
+
* - Transactional formatting state: relayContextSent commit ONLY on positive
|
|
538
|
+
* acceptance, so a rejected steer never consumes the first-delivery relay context.
|
|
539
|
+
* - Acceptance correlation: the steer carries a stable clientUserMessageId; its echo settles
|
|
540
|
+
* an accepted-but-response-lost steer by correlation. At-least-once with EXPLICIT ambiguity —
|
|
541
|
+
* a timeout is never assumed accepted, and a re-steer after a true in-flight loss may
|
|
542
|
+
* duplicate (correlation is not idempotent dedupe upstream). The reconcile assumes
|
|
543
|
+
* echo ⇒ eventual consumption: if the turn is interrupted/aborted AFTER the clientId echo
|
|
544
|
+
* but BEFORE the pending input is consumed, a re-offer settles by correlation and the
|
|
545
|
+
* content never reached the model — inside this documented ambiguity envelope.
|
|
546
|
+
* - Unrecognized structured refusals defer (see {@link classifyTurnSteerRejection}); ONLY
|
|
547
|
+
* transport faults (socket, 30s timeout — genuinely ambiguous) rethrow into re-steer.
|
|
548
|
+
*/
|
|
549
|
+
async deliverMidTurn(process: ManagedProcess, messages: Message[], ctx?: ProviderDeliverContext): Promise<void | number[]> {
|
|
550
|
+
const steerTurnId = this.activeTurnId;
|
|
551
|
+
if (steerTurnId === undefined) throw new Error(CODEX_TURN_IN_PROGRESS_MESSAGE);
|
|
552
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
553
|
+
const threadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : "";
|
|
554
|
+
if (!client || !threadId) throw new Error(CODEX_TURN_IN_PROGRESS_MESSAGE);
|
|
555
|
+
// Codex's own default is STEER (the app-server `turn/steer` is additive); the config kill
|
|
556
|
+
// switch ("defer") waits until the turn ends. The default lives HERE, in the
|
|
557
|
+
// owning adapter — never a provider-name table (lint:provider-contract).
|
|
558
|
+
const softSteer = resolveActiveTurnMessageDelivery(this.spawnProviderConfig(process), "steer") === "steer";
|
|
559
|
+
const { steerable } = partitionMidTurnDelivery(messages);
|
|
560
|
+
const eligible = softSteer ? steerable : [];
|
|
561
|
+
// Nothing steerable (or this turn already refused steer): defer the whole batch. The once-
|
|
562
|
+
// per-turn notice keeps the ~1s runner retries from spamming the log.
|
|
563
|
+
if (eligible.length === 0 || this.steerDeniedForTurnId === steerTurnId) {
|
|
564
|
+
if (this.deferredForTurnId !== steerTurnId) {
|
|
565
|
+
this.deferredForTurnId = steerTurnId;
|
|
566
|
+
logger.info("codex", `holding ${messages.length} relay message${messages.length === 1 ? "" : "s"} behind active turn ${steerTurnId}; will deliver after it completes`);
|
|
567
|
+
}
|
|
568
|
+
throw new Error(CODEX_TURN_IN_PROGRESS_MESSAGE);
|
|
569
|
+
}
|
|
570
|
+
const clientUserMessageId = midTurnClientUserId(eligible);
|
|
571
|
+
// Acceptance reconcile: an earlier steer of this EXACT composition was positively accepted
|
|
572
|
+
// (the userMessage echo) but its response was lost — settle by correlation instead of
|
|
573
|
+
// re-steering a possible duplicate.
|
|
574
|
+
if (this.acceptedSteerClientIds.has(clientUserMessageId)) {
|
|
575
|
+
ctx?.inputObserver?.offered(Date.now(), true);
|
|
576
|
+
ctx?.inputObserver?.consumed();
|
|
577
|
+
logger.info("codex", `steer for Codex turn ${steerTurnId} was already accepted (clientId ${clientUserMessageId}); settling ${eligible.length} message${eligible.length === 1 ? "" : "s"} without re-steering`);
|
|
578
|
+
return eligible.map((message) => message.id);
|
|
579
|
+
}
|
|
580
|
+
// Transactional formatting state (#2539 design C): prepare the Relay context, send,
|
|
581
|
+
// and commit it ONLY on positive acceptance.
|
|
582
|
+
let steerText = [codexLaunchContext(process), providerMessageText(eligible)].filter(Boolean).join("\n\n");
|
|
583
|
+
let relayContextPending = false;
|
|
584
|
+
if (codexRelayContextEnabled(process) && !process.meta?.relayContextSent) {
|
|
585
|
+
steerText = codexRelayContextBlock(process) + "\n\n" + steerText;
|
|
586
|
+
relayContextPending = true;
|
|
587
|
+
}
|
|
588
|
+
logger.info("codex", `steering ${eligible.length} relay message${eligible.length === 1 ? "" : "s"} into active Codex turn ${steerTurnId}`);
|
|
589
|
+
try {
|
|
590
|
+
ctx?.inputObserver?.offered(Date.now(), true);
|
|
591
|
+
await client.turnSteer(threadId, steerTurnId, steerText, clientUserMessageId);
|
|
592
|
+
ctx?.inputObserver?.consumed();
|
|
593
|
+
} catch (error) {
|
|
594
|
+
const rejection = classifyTurnSteerRejection(error);
|
|
595
|
+
if (rejection === "not-steerable") {
|
|
596
|
+
// Review/compact turn: remember it for this turn id so later drains defer SILENTLY
|
|
597
|
+
// (no per-second refused RPC) and the batch delivers normally once the turn ends.
|
|
598
|
+
this.steerDeniedForTurnId = steerTurnId;
|
|
599
|
+
logger.info("codex", `active Codex turn ${steerTurnId} is not steerable (review/compact); deferring ${eligible.length} message${eligible.length === 1 ? "" : "s"} until it ends`);
|
|
600
|
+
} else if (rejection === "stale-turn") {
|
|
601
|
+
// The turn ended under us (or the id never matched): zero ack. The runner requeues the
|
|
602
|
+
// whole batch; once the cleared activeTurnId is observed, the offer takes turn/start.
|
|
603
|
+
logger.info("codex", `steer rejected against Codex turn ${steerTurnId} (no longer active); deferring until the provider is idle`);
|
|
604
|
+
} else if (rejection === "unknown-refusal") {
|
|
605
|
+
// Structured refusal we don't recognize (a future upstream kind, version skew): the
|
|
606
|
+
// app-server definitively REFUSED this steer, so the input was NOT accepted. Remember
|
|
607
|
+
// the turn id and defer — same shape as review/compact — instead of rethrowing into a
|
|
608
|
+
// ~1s refused-RPC hot loop for the rest of the turn. Delivers normally once it ends.
|
|
609
|
+
this.steerDeniedForTurnId = steerTurnId;
|
|
610
|
+
logger.warn("codex", `Codex turn ${steerTurnId} refused steer (unrecognized app-server rejection: ${errMessage(error)}); deferring ${eligible.length} message${eligible.length === 1 ? "" : "s"} until it ends`);
|
|
611
|
+
} else {
|
|
612
|
+
// Transport fault or 30s timeout — AMBIGUOUS acceptance. Zero ack; the runner requeues
|
|
613
|
+
// and the re-offer re-steers with the SAME clientId, reconciled by the echo if it lands.
|
|
614
|
+
throw error;
|
|
615
|
+
}
|
|
616
|
+
throw new Error(CODEX_TURN_IN_PROGRESS_MESSAGE);
|
|
617
|
+
}
|
|
618
|
+
if (relayContextPending) process.meta = { ...(process.meta ?? {}), relayContextSent: true };
|
|
619
|
+
this.rememberAcceptedSteerClient(clientUserMessageId);
|
|
620
|
+
return eligible.map((message) => message.id);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// The spawn config the adapter was launched with (meta.config is the RunnerSpawnConfig handed
|
|
624
|
+
// to spawn()); the steer policy reads its providerConfig — never a provider-name branch.
|
|
625
|
+
private spawnProviderConfig(process: ManagedProcess): ProviderConfig | undefined {
|
|
626
|
+
const config = process.meta?.config as { providerConfig?: ProviderConfig } | undefined;
|
|
627
|
+
return config?.providerConfig;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
private rememberAcceptedSteerClient(clientId: string): void {
|
|
631
|
+
// Re-insert to refresh recency, then evict oldest-first past the cap.
|
|
632
|
+
this.acceptedSteerClientIds.delete(clientId);
|
|
633
|
+
this.acceptedSteerClientIds.add(clientId);
|
|
634
|
+
while (this.acceptedSteerClientIds.size > CODEX_STEER_ACCEPTED_CLIENT_CAP) {
|
|
635
|
+
const oldest = this.acceptedSteerClientIds.values().next().value;
|
|
636
|
+
if (oldest === undefined) break;
|
|
637
|
+
this.acceptedSteerClientIds.delete(oldest);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
async respondToPermissionDecision(process: ManagedProcess, input: ProviderPermissionDecisionInput): Promise<Record<string, unknown>> {
|
|
642
|
+
const pending = this.pendingApprovals.get(input.approvalId);
|
|
643
|
+
if (!pending) throw new Error("approval request not found or already resolved");
|
|
644
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
645
|
+
if (!client) throw new Error("Codex App Server client is unavailable");
|
|
646
|
+
const response = codexApprovalResponse(pending.method, pending.params, input.decision);
|
|
647
|
+
// Always drop the pending entry: a failed send means the request is dead on
|
|
648
|
+
// the Codex side too, so a stale entry would only mislead later lookups.
|
|
649
|
+
try {
|
|
650
|
+
client.respondToServerRequest(pending.requestId, response);
|
|
651
|
+
} finally {
|
|
652
|
+
this.pendingApprovals.delete(input.approvalId);
|
|
653
|
+
}
|
|
654
|
+
this.statusCb({
|
|
655
|
+
status: "busy",
|
|
656
|
+
reason: "provider-turn",
|
|
657
|
+
providerState: {
|
|
658
|
+
state: "active",
|
|
659
|
+
reason: "permissionResolved",
|
|
660
|
+
label: "Codex approval resolved",
|
|
661
|
+
source: "codex",
|
|
662
|
+
updatedAt: Date.now(),
|
|
663
|
+
},
|
|
664
|
+
});
|
|
665
|
+
return { approvalId: input.approvalId, decision: input.decision, provider: "codex" };
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
configureTokenUsageReporter(reporter: ProviderTokenUsageReporter): void {
|
|
669
|
+
this.tokenUsageReporter = reporter;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
buildSpawnArgs(config: RunnerSpawnConfig, providerConfig: ProviderConfig): SpawnArgs {
|
|
673
|
+
// #2719 — the fallback listen port is allocated, never derived: `controlPort + 1000`
|
|
674
|
+
// overflowed 65535 on a high ephemeral control port (macOS), which the app-server does not
|
|
675
|
+
// report as a bad port — it binds elsewhere and the client then polls a dead URL.
|
|
676
|
+
const appServerUrl = String(config.appServerUrl || process.env.CODEX_APP_SERVER_URL || `ws://127.0.0.1:${allocateLoopbackPort()}`);
|
|
677
|
+
// Create + bootstrap the isolated CODEX_HOME (no-op for host base) so the assembler's
|
|
678
|
+
// materialize step has somewhere to write the provisioned skills.
|
|
679
|
+
prepareCodexProfileHome(config);
|
|
680
|
+
// #557 — ONE assembler owns the provisioning/vanilla surface (skills.config, relay +
|
|
681
|
+
// provisioned -c mcp_servers.*, project_doc_max_bytes); profile-projection describes the
|
|
682
|
+
// SAME assembled result, so report == launch. The adapter only adds core launch config the
|
|
683
|
+
// assembler does not own: app-server wiring, model/approval/tool-output, managed flags, --listen.
|
|
684
|
+
const assembled = assembleLaunch("codex", config, providerConfig);
|
|
685
|
+
materializeLaunchAssembly("codex", config);
|
|
686
|
+
const defaultArgs = assembled.hostDefaultArgs;
|
|
687
|
+
const args = isCodexCliCommand(providerConfig.command)
|
|
688
|
+
? [
|
|
689
|
+
"app-server",
|
|
690
|
+
...codexAppServerConfigArgs(defaultArgs, config.providerArgs),
|
|
691
|
+
...codexModelConfigArgs(config.model, config.effort),
|
|
692
|
+
...codexApprovalConfigArgs(config.approvalMode),
|
|
693
|
+
...codexToolOutputTokenLimitConfigArgs(config), ...codexHarnessConfigArgs(config), ...codexWebToolsConfigArgs(config),
|
|
694
|
+
...assembled.args,
|
|
695
|
+
...codexManagedConfigArgs(),
|
|
696
|
+
...codexProjectShellConfigArgs(config.env, codexAppServerConfigArgs(defaultArgs, config.providerArgs), assembled.env.CODEX_HOME ?? config.env.CODEX_HOME),
|
|
697
|
+
"--listen",
|
|
698
|
+
appServerUrl,
|
|
699
|
+
]
|
|
700
|
+
: [...defaultArgs, ...config.providerArgs];
|
|
701
|
+
return sanitizeLaunchBoundary({
|
|
702
|
+
command: providerConfig.command,
|
|
703
|
+
args,
|
|
704
|
+
cwd: config.cwd,
|
|
705
|
+
env: writeChildEnv({}, {
|
|
706
|
+
...config.env,
|
|
707
|
+
// #557 — the assembler owns the isolated config-home env (CODEX_HOME).
|
|
708
|
+
...assembled.env,
|
|
709
|
+
CODEX_APP_SERVER_URL: appServerUrl,
|
|
710
|
+
AGENT_RELAY_PROVIDER: "codex",
|
|
711
|
+
}),
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
private handleCodexEvent(event: ClientEvent, process?: ManagedProcess): void {
|
|
716
|
+
if (event.type === "server-request" && process) {
|
|
717
|
+
const approval = codexApprovalFromServerRequest(event.message);
|
|
718
|
+
if (approval) {
|
|
719
|
+
// #435/#723 ordering invariant: mirror every reasoning/narrative step of the turn
|
|
720
|
+
// BEFORE the approval form surfaces — the same guarantee Claude makes by pre-flushing
|
|
721
|
+
// the transcript at its hook seam, here enforced from the Codex app-server mechanism.
|
|
722
|
+
// approval.view.reasoningSettled === true asserts this flush has run.
|
|
723
|
+
this.agentMessageCapture.closeSegment((body) => this.emitAgentNarration(body));
|
|
724
|
+
this.flushBufferedReasoning();
|
|
725
|
+
this.pendingApprovals.set(approval.pending.id, approval.pending);
|
|
726
|
+
this.statusCb({
|
|
727
|
+
status: "busy",
|
|
728
|
+
reason: "provider-turn",
|
|
729
|
+
providerState: {
|
|
730
|
+
state: "blocked",
|
|
731
|
+
reason: "permissionRequest",
|
|
732
|
+
label: approval.view.title,
|
|
733
|
+
recommendedAction: "Review the permission request in Agent Relay.",
|
|
734
|
+
source: "codex",
|
|
735
|
+
pendingApproval: approval.view,
|
|
736
|
+
updatedAt: Date.now(),
|
|
737
|
+
},
|
|
738
|
+
});
|
|
739
|
+
} else if (event.message.method === CODEX_MCP_ELICITATION_METHOD && isCodexHeadless(process)) {
|
|
740
|
+
// Codex routes per-MCP-tool-call approval through the MCP elicitation channel
|
|
741
|
+
// (request_id `mcp_tool_call_approval_*`): even with `approval_policy="never"`, a
|
|
742
|
+
// downstream server's elicitation — or codex's own per-call approval gate — is
|
|
743
|
+
// forwarded to the app-server client as `mcpServer/elicitation/request`. A headless
|
|
744
|
+
// managed agent has no human to answer it; the old -32601 reject makes codex resolve
|
|
745
|
+
// the elicitation as `Decline`, so the MCP tool call dies with "user rejected MCP tool
|
|
746
|
+
// call" — stranding read-only recon/reviewer workers with no egress to report back
|
|
747
|
+
// over the bus (#395). The agent is already bounded by its scoped relay token + the
|
|
748
|
+
// codex sandbox, so auto-accept (spec-compliant `{ action: "accept" }`, not codex's
|
|
749
|
+
// legacy `{ decision: "approved" }`) so the agent's reporting/recon MCP tools run.
|
|
750
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
751
|
+
const serverName = isRecord(event.message.params) ? stringValue(event.message.params.serverName) : undefined;
|
|
752
|
+
logger.info("codex", `auto-accepting headless MCP elicitation from ${serverName ?? "unknown server"} so the agent's MCP tools can run (#395)`);
|
|
753
|
+
client?.respondToServerRequest(event.message.id, codexHeadlessElicitationResponse());
|
|
754
|
+
} else {
|
|
755
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
756
|
+
logger.warn("codex", `rejecting unknown Codex server-request method: ${event.message.method}`);
|
|
757
|
+
client?.rejectServerRequest(event.message.id, -32601, `Method not found: ${event.message.method}`, {
|
|
758
|
+
method: event.message.method,
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const method = event.type === "notification" ? event.message.method : "";
|
|
765
|
+
const params = event.type === "notification" ? event.message.params : undefined;
|
|
766
|
+
const thread = isRecord(params?.thread) ? params.thread : undefined;
|
|
767
|
+
const threadId = stringValue(params?.threadId) ?? stringValue(thread?.id);
|
|
768
|
+
const isSubagent = Boolean(threadId && this.subagentThreads.has(threadId)) || isSubagentThread(thread, params);
|
|
769
|
+
|
|
770
|
+
// clearContext has already installed a fresh thread id before late notifications from the
|
|
771
|
+
// discarded thread can arrive. Those old turn/status events must never clear or re-block the
|
|
772
|
+
// fresh session: doing so reopens the continuation-first race after the runner fenced it.
|
|
773
|
+
// A thread-less notification is still accepted because the app-server emits a few global
|
|
774
|
+
// lifecycle signals without a thread id.
|
|
775
|
+
const activeMainThreadId = process && typeof process.meta?.threadId === "string" ? process.meta.threadId : undefined;
|
|
776
|
+
if (threadId && activeMainThreadId && threadId !== activeMainThreadId && !isSubagent) return;
|
|
777
|
+
|
|
778
|
+
if (threadId && process && !isSubagent) {
|
|
779
|
+
const threadPath = stringValue(thread?.path) ?? stringValue(params?.path);
|
|
780
|
+
process.meta = {
|
|
781
|
+
...(process.meta ?? {}),
|
|
782
|
+
threadId,
|
|
783
|
+
...(threadPath ? { threadPath } : {}),
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
if (method.includes("thread/tokenUsage/updated") || method.includes("thread.tokenUsage.updated") || method.includes("thread/token_usage/updated") || method.includes("thread.token_usage.updated")) {
|
|
788
|
+
const context = codexTokenUsageContext(params);
|
|
789
|
+
if (context && process) process.meta = { ...(process.meta ?? {}), context };
|
|
790
|
+
reportCodexTokenUsage(params, threadId, process, this.tokenUsageReporter);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
if ((method.includes("thread/started") || method.includes("thread.started")) && threadId && isSubagent) {
|
|
794
|
+
const details = subagentThreadDetails(thread, params);
|
|
795
|
+
this.subagentThreads.set(threadId, details);
|
|
796
|
+
this.statusCb({ status: "busy", reason: "subagent", id: threadId, ...details });
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (method.includes("turn/started") || method.includes("turn.started")) {
|
|
801
|
+
if (threadId && this.subagentThreads.has(threadId)) {
|
|
802
|
+
this.statusCb({ status: "busy", reason: "subagent", id: threadId, ...this.subagentThreads.get(threadId) });
|
|
803
|
+
} else {
|
|
804
|
+
const turn = isRecord(params?.turn) ? params.turn : undefined;
|
|
805
|
+
this.activeTurnId = stringValue(turn?.id);
|
|
806
|
+
this.turnFailure = undefined;
|
|
807
|
+
this.agentMessageCapture.reset();
|
|
808
|
+
this.itemTextBuffers.clear();
|
|
809
|
+
this.itemTextBufferTypes.clear();
|
|
810
|
+
this.statusCb({ status: "busy", reason: "provider-turn", id: this.activeTurnId });
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (method.includes("turn/completed") || method.includes("turn.completed") || method.includes("turn/failed") || method.includes("turn.failed") || method.includes("turn/interrupted") || method.includes("turn.interrupted")) {
|
|
814
|
+
if (threadId && this.subagentThreads.has(threadId)) {
|
|
815
|
+
this.statusCb({ status: "idle", reason: "subagent", id: threadId, ...this.subagentThreads.get(threadId) });
|
|
816
|
+
} else {
|
|
817
|
+
const turn = isRecord(params?.turn) ? params.turn : undefined;
|
|
818
|
+
this.finishMainTurn(codexEndedByFrom(stringValue(turn?.status) ?? method), turn?.error ?? params?.error);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (method === "error" && !isSubagent && params?.willRetry === false) this.finishMainTurn("failed", params.error);
|
|
822
|
+
if ((method.includes("thread/compacted") || method.includes("thread.compacted")) && threadId && process) {
|
|
823
|
+
this.onThreadCompacted(process, threadId, stringValue(params?.turnId), "manual");
|
|
824
|
+
}
|
|
825
|
+
if ((method.includes("item/completed") || method.includes("item.completed")) && !isSubagent) {
|
|
826
|
+
const item = isRecord(params?.item) ? params.item : undefined;
|
|
827
|
+
this.handleCodexItem(item);
|
|
828
|
+
// Codex compacts by itself only inside a live turn; a requested compaction runs with none.
|
|
829
|
+
if (codexItemIsCompactionComplete(item) && threadId && process) this.onThreadCompacted(process, threadId, stringValue(params?.turnId), this.pendingCompact || !this.activeTurnId ? "manual" : "auto");
|
|
830
|
+
}
|
|
831
|
+
if (!isSubagent) this.handleCodexItemDelta(method, params);
|
|
832
|
+
if (method.includes("thread/status") || method.includes("thread.status")) {
|
|
833
|
+
const status = statusType(params?.status);
|
|
834
|
+
if (threadId && this.subagentThreads.has(threadId)) {
|
|
835
|
+
if (status === "active") this.statusCb({ status: "busy", reason: "subagent", id: threadId, ...this.subagentThreads.get(threadId) });
|
|
836
|
+
if (status === "idle" || status === "notLoaded") this.statusCb({ status: "idle", reason: "subagent", id: threadId, ...this.subagentThreads.get(threadId) });
|
|
837
|
+
} else {
|
|
838
|
+
if (status === "active") this.statusCb({ status: "busy", reason: "provider-turn", providerState: this.providerStateFromThreadStatus(params?.status, params) });
|
|
839
|
+
if (status === "idle" || status === "notLoaded" || status === "systemError") this.finishMainTurn(codexEndedByFrom(status));
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// Turn one completed Codex thread item into a session-mirror event. agentMessage text is
|
|
845
|
+
// mirrored as narration as it lands; the captured turn-final response repeats only the
|
|
846
|
+
// TRAILING agentMessage run — the segment after the last tool/file-change/reasoning
|
|
847
|
+
// boundary (design #1079 §3.2) — never earlier mid-work narration, which was already
|
|
848
|
+
// mirrored live. The rest (user prompt echo, reasoning, tool steps) is surfaced as it lands.
|
|
849
|
+
private handleCodexItem(item: Record<string, unknown> | undefined): void {
|
|
850
|
+
if (!item) return;
|
|
851
|
+
const type = stringValue(item.type);
|
|
852
|
+
const turnId = this.activeTurnId;
|
|
853
|
+
const itemId = codexItemId(item);
|
|
854
|
+
if (type !== "agentMessage") this.agentMessageCapture.closeSegment((body) => this.emitAgentNarration(body));
|
|
855
|
+
// A completed non-reasoning item ends the reasoning segment that preceded it — flush the
|
|
856
|
+
// buffered reasoning first so it lands in transcript order, ahead of this tool/message.
|
|
857
|
+
if (type !== "reasoning") this.flushBufferedReasoning();
|
|
858
|
+
if (type === "agentMessage") {
|
|
859
|
+
this.agentMessageCapture.completeItem(itemId, stringValue(item.text), (body) => this.emitAgentNarration(body), { phase: item.phase });
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
if (type === "userMessage") {
|
|
863
|
+
// #2539 Phase A — the app-server echoes a steered input's clientUserMessageId as the
|
|
864
|
+
// item's clientId. Observing it is the POSITIVE acceptance evidence that reconciles an
|
|
865
|
+
// accepted-but-response-lost steer: the next offer of the same composition settles by
|
|
866
|
+
// correlation instead of re-steering.
|
|
867
|
+
const clientId = stringValue(item.clientId);
|
|
868
|
+
if (clientId) this.rememberAcceptedSteerClient(clientId);
|
|
869
|
+
const text = codexUserMessageText(item.content);
|
|
870
|
+
if (text) {
|
|
871
|
+
this.recordInsightEvent({ type: "user_prompt" });
|
|
872
|
+
this.sessionEventCb({ type: "prompt", origin: "terminal", body: text, ...(turnId ? { turnId } : {}) });
|
|
873
|
+
}
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (type === "reasoning") {
|
|
877
|
+
// Codex has no reliable reasoning item/completed carrying text — the stream IS the deltas.
|
|
878
|
+
// Keep the longer of (accumulated deltas, item.content) in the buffer and emit at the next
|
|
879
|
+
// boundary (next item / turn end), the same coarse signal the Claude reasoning tail uses.
|
|
880
|
+
const fromItem = codexReasoningText(item);
|
|
881
|
+
if (itemId && fromItem) {
|
|
882
|
+
const existing = this.itemTextBuffers.get(itemId) ?? "";
|
|
883
|
+
if (fromItem.length >= existing.length) this.itemTextBuffers.set(itemId, fromItem);
|
|
884
|
+
this.itemTextBufferTypes.set(itemId, "reasoning");
|
|
885
|
+
}
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
const tool = codexToolSummary(type, item, this.sessionCwd);
|
|
889
|
+
if (tool) {
|
|
890
|
+
this.recordInsightEvent({ type: "tool", name: codexInsightToolName(type, item) });
|
|
891
|
+
if (codexItemFailed(item)) this.recordInsightEvent({ type: "tool_error" });
|
|
892
|
+
// stepId = the app-server item id: the server upserts the running step emitted on
|
|
893
|
+
// item/started into this terminal state IN PLACE, so the tool persists as ONE row.
|
|
894
|
+
// #2354 — a FAILED item was previously hardcoded to status:"completed", so a tool that
|
|
895
|
+
// errored rendered identical to one that succeeded. `codexItemFailed` is the same
|
|
896
|
+
// failed-outcome predicate used for the insight proxy above; map it through to the shared
|
|
897
|
+
// `failed` status so every provider agrees on the contract.
|
|
898
|
+
this.sessionEventCb({ type: "tool", origin: "provider", body: tool.body, label: tool.label, category: codexToolCategory(type, item), status: codexItemFailed(item) ? "failed" : "completed", ...(turnId ? { turnId } : {}), ...(itemId ? { stepId: itemId } : {}), ...(tool.params !== undefined ? { params: tool.params } : {}) , ...(tool.paths ? { paths: tool.paths } : {}) });
|
|
899
|
+
}
|
|
900
|
+
if (itemId) this.itemTextBuffers.delete(itemId);
|
|
901
|
+
if (itemId) this.itemTextBufferTypes.delete(itemId);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
private emitAgentNarration(body: string): void {
|
|
905
|
+
this.recordInsightEvent({ type: "turn" }); // a substantive assistant turn
|
|
906
|
+
// Stream the assistant text into the trace as narration (Claude parity). The closing
|
|
907
|
+
// response bubble at turn end repeats the final block; the dashboard suppresses the
|
|
908
|
+
// matching narration so it isn't shown twice.
|
|
909
|
+
this.sessionEventCb({ type: "narration", origin: "provider", body, ...(this.activeTurnId ? { turnId: this.activeTurnId } : {}) });
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// Emit any buffered reasoning as discrete trace blocks (appended, in transcript order). Codex
|
|
913
|
+
// streams reasoning as deltas with no reliable completion event, so we flush coarsely at item
|
|
914
|
+
// and turn boundaries — the signal the Claude reasoning tail uses — never a codex-only timer.
|
|
915
|
+
private flushBufferedReasoning(): void {
|
|
916
|
+
const turnId = this.activeTurnId;
|
|
917
|
+
for (const [itemId, text] of [...this.itemTextBuffers.entries()]) {
|
|
918
|
+
if (this.itemTextBufferTypes.get(itemId) !== "reasoning") continue;
|
|
919
|
+
this.itemTextBuffers.delete(itemId);
|
|
920
|
+
this.itemTextBufferTypes.delete(itemId);
|
|
921
|
+
const body = text.trim();
|
|
922
|
+
if (body) this.sessionEventCb({ type: "reasoning", origin: "provider", body, ...(turnId ? { turnId } : {}) });
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// #183/#184: append to the session-event log with a soft cap. On overflow we drop the
|
|
927
|
+
// oldest half; the runner detects the resulting length shrink and resets its segment
|
|
928
|
+
// cursor (worst case: one slightly-truncated datapoint on a pathologically long session).
|
|
929
|
+
private recordInsightEvent(event: SessionEvent): void {
|
|
930
|
+
this.sessionEvents.push(event);
|
|
931
|
+
if (this.sessionEvents.length > CodexAdapter.SESSION_EVENTS_CAP) {
|
|
932
|
+
this.sessionEvents = this.sessionEvents.slice(this.sessionEvents.length >> 1);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// Whole-session event stream for the Insights context-ratio signal (#184). Codex learns
|
|
937
|
+
// about activity through app-server item events, not a transcript, so we replay the log
|
|
938
|
+
// accumulated since this process started. The runner owns per-segment slicing.
|
|
939
|
+
async collectSessionEvents(): Promise<SessionEvent[] | null> {
|
|
940
|
+
return [...this.sessionEvents];
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// #653: Codex busy-state normally flips on turn/started, but the app-server can stream
|
|
944
|
+
// item activity (which already drives the dashboard chat mirror) before — or without —
|
|
945
|
+
// a turn/started reaching us, leaving a visibly-working agent reported `idle` (a reap
|
|
946
|
+
// hazard). Derive busy from that SAME live activity: any in-flight item event with no
|
|
947
|
+
// active turn means a turn IS running we missed, so synthesize one and report busy.
|
|
948
|
+
// turn/completed → finishMainTurn clears it; we never synthesize on a closing
|
|
949
|
+
// item.completed, so a legitimately ended turn is not re-flipped to busy.
|
|
950
|
+
private ensureMainTurnActive(turnId?: string): void {
|
|
951
|
+
if (this.activeTurnId) return;
|
|
952
|
+
this.turnFailure = undefined;
|
|
953
|
+
this.activeTurnId = turnId ?? `codex-synth-turn-${++this.syntheticTurnSeq}`;
|
|
954
|
+
this.statusCb({ status: "busy", reason: "provider-turn", id: this.activeTurnId });
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
private handleCodexItemDelta(method: string, params: Record<string, unknown> | undefined): void {
|
|
958
|
+
if (!method.includes("item/") && !method.includes("item.")) return;
|
|
959
|
+
// Live item stream (start/delta/progress) = a turn in flight. A closing
|
|
960
|
+
// item.completed is handled by handleCodexItem and must not synthesize a turn.
|
|
961
|
+
if (!method.includes("/completed") && !method.includes(".completed")) {
|
|
962
|
+
this.ensureMainTurnActive(stringValue(params?.turnId));
|
|
963
|
+
}
|
|
964
|
+
const item = isRecord(params?.item) ? params.item : undefined;
|
|
965
|
+
const itemId = codexItemId(params) ?? codexItemId(item);
|
|
966
|
+
const type = codexItemTypeFromMethod(method) ?? stringValue(item?.type);
|
|
967
|
+
const turnId = this.activeTurnId;
|
|
968
|
+
|
|
969
|
+
if (method.includes("/started") || method.includes(".started")) {
|
|
970
|
+
if (type !== "agentMessage") this.agentMessageCapture.closeSegment((body) => this.emitAgentNarration(body));
|
|
971
|
+
// A new item starting ends the prior reasoning segment — flush it ahead of this step.
|
|
972
|
+
this.flushBufferedReasoning();
|
|
973
|
+
const tool = codexToolSummary(type, item ?? params ?? {}, this.sessionCwd);
|
|
974
|
+
// stepId = item id so the server upserts this running step → completed IN PLACE (one row).
|
|
975
|
+
if (tool) this.sessionEventCb({ type: "tool", origin: "provider", body: tool.body, label: tool.label, category: codexToolCategory(type, item ?? params ?? {}), status: "running", streaming: true, ...(turnId ? { turnId } : {}), ...(itemId ? { stepId: itemId } : {}), ...(tool.params !== undefined ? { params: tool.params } : {}) , ...(tool.paths ? { paths: tool.paths } : {}) });
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
if (type === "agentMessage") {
|
|
980
|
+
const delta = codexDeltaText(params);
|
|
981
|
+
if (delta) this.agentMessageCapture.appendDelta(itemId, delta);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (type === "reasoning" || type === "plan") {
|
|
986
|
+
this.agentMessageCapture.closeSegment((body) => this.emitAgentNarration(body));
|
|
987
|
+
const delta = codexDeltaText(params);
|
|
988
|
+
if (delta && itemId) {
|
|
989
|
+
this.itemTextBuffers.set(itemId, `${this.itemTextBuffers.get(itemId) ?? ""}${delta}`);
|
|
990
|
+
if (type) this.itemTextBufferTypes.set(itemId, type);
|
|
991
|
+
}
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// Raw stdout/stderr deltas can be huge. Surface the tool lifecycle via started/completed
|
|
996
|
+
// summaries only; never persist raw process output into the chat mirror.
|
|
997
|
+
if (method.includes("outputDelta") || method.includes("output_delta") || method.includes("progress")) return;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// A turn-final capture is emitted ONLY for a genuine `completed` turn (design #1079 §3.2):
|
|
1001
|
+
// failed/interrupted turns must never produce a turn-final. Every "response"-type
|
|
1002
|
+
// ProviderSessionEvent is unconditionally dual-stamped turnFinal/final downstream
|
|
1003
|
+
// (publishCapturedResponse's provider-agnostic stamp), so the only way to keep a
|
|
1004
|
+
// failed/interrupted partial OUT of D's work-final ring is to never emit it as a
|
|
1005
|
+
// "response" event at all (#1083 Finding 1). The partial text was already mirrored live
|
|
1006
|
+
// as narration by the `emit` callback inside agentMessageCapture.finish(), so it's still
|
|
1007
|
+
// visible in the dashboard.
|
|
1008
|
+
private flushTurnResponse(endedBy: MessageTurnEndReason): void {
|
|
1009
|
+
const text = this.agentMessageCapture.finish((body) => this.emitAgentNarration(body));
|
|
1010
|
+
if (!text || endedBy !== "completed") return;
|
|
1011
|
+
this.sessionEventCb({ type: "response", origin: "provider", body: text, final: true, confidence: "definitive", endedBy, ...(this.activeTurnId ? { turnId: this.activeTurnId } : {}) });
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
private finishMainTurn(endedBy: MessageTurnEndReason, error?: unknown): void {
|
|
1015
|
+
if (endedBy === "failed" && (!this.turnFailure || error)) this.turnFailure = codexTurnFailure(error, this.activeTurnId);
|
|
1016
|
+
this.flushBufferedReasoning(); // surface any trailing reasoning before the closing response
|
|
1017
|
+
this.flushTurnResponse(endedBy);
|
|
1018
|
+
const turnId = this.activeTurnId;
|
|
1019
|
+
this.activeTurnId = undefined;
|
|
1020
|
+
this.pendingApprovals.clear();
|
|
1021
|
+
this.itemTextBuffers.clear();
|
|
1022
|
+
this.itemTextBufferTypes.clear();
|
|
1023
|
+
this.agentMessageCapture.reset();
|
|
1024
|
+
this.statusCb(this.turnFailure ?? { status: "idle", reason: "provider-turn", id: turnId });
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
private waitForPendingCompact(threadId: string): Promise<void> {
|
|
1028
|
+
if (this.pendingCompact) throw new Error("Codex compact is already in progress");
|
|
1029
|
+
return new Promise<void>((resolve, reject) => {
|
|
1030
|
+
const pending: PendingCodexCompact = {
|
|
1031
|
+
threadId,
|
|
1032
|
+
resolve,
|
|
1033
|
+
reject,
|
|
1034
|
+
timeout: setTimeout(() => {
|
|
1035
|
+
if (this.pendingCompact !== pending) return;
|
|
1036
|
+
this.pendingCompact = undefined;
|
|
1037
|
+
reject(new Error(`Codex compact timed out after ${Math.round(CODEX_COMPACT_TIMEOUT_MS / 1000)}s`));
|
|
1038
|
+
}, CODEX_COMPACT_TIMEOUT_MS),
|
|
1039
|
+
};
|
|
1040
|
+
this.pendingCompact = pending;
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
private completePendingCompact(threadId: string): boolean {
|
|
1045
|
+
const pending = this.pendingCompact;
|
|
1046
|
+
if (!pending || pending.threadId !== threadId) return false;
|
|
1047
|
+
clearTimeout(pending.timeout);
|
|
1048
|
+
this.pendingCompact = undefined;
|
|
1049
|
+
pending.resolve();
|
|
1050
|
+
return true;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
private clearPendingCompact(threadId?: string): void {
|
|
1054
|
+
const pending = this.pendingCompact;
|
|
1055
|
+
if (!pending || (threadId && pending.threadId !== threadId)) return;
|
|
1056
|
+
clearTimeout(pending.timeout);
|
|
1057
|
+
this.pendingCompact = undefined;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
private cancelPendingCompact(error: Error): void {
|
|
1061
|
+
const pending = this.pendingCompact;
|
|
1062
|
+
if (!pending) return;
|
|
1063
|
+
clearTimeout(pending.timeout);
|
|
1064
|
+
this.pendingCompact = undefined;
|
|
1065
|
+
pending.reject(error);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
private providerStateFromThreadStatus(status: unknown, params?: Record<string, unknown>): ProviderState | undefined {
|
|
1069
|
+
const state = codexProviderStateFromThreadStatus(status, params);
|
|
1070
|
+
if (state?.state !== "blocked" || state.reason !== "waitingOnApproval" || state.pendingApproval) return state;
|
|
1071
|
+
const pending = [...this.pendingApprovals.values()].at(-1);
|
|
1072
|
+
return pending ? { ...state, pendingApproval: pending.view } : state;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
function codexItemId(item: Record<string, unknown> | undefined): string | undefined {
|
|
1077
|
+
return stringValue(item?.itemId) ?? stringValue(item?.id);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
function codexItemIsCompactionComplete(item: Record<string, unknown> | undefined): boolean {
|
|
1081
|
+
const type = stringValue(item?.type);
|
|
1082
|
+
return type === "context_compaction" || type === "contextCompaction" || type === "compaction";
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
function codexDeltaText(params: Record<string, unknown> | undefined): string {
|
|
1086
|
+
const delta = params?.delta;
|
|
1087
|
+
if (typeof delta === "string") return delta;
|
|
1088
|
+
if (isRecord(delta)) {
|
|
1089
|
+
const text = stringValue(delta.text) ?? stringValue(delta.value) ?? stringValue(delta.content);
|
|
1090
|
+
if (text) return text;
|
|
1091
|
+
}
|
|
1092
|
+
return stringValue(params?.text) ?? stringValue(params?.chunk) ?? stringValue(params?.content) ?? "";
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
function codexItemTypeFromMethod(method: string): string | undefined {
|
|
1096
|
+
const match = method.match(/item[/.]([^/.]+)[/.]/);
|
|
1097
|
+
return match?.[1];
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// Codex forwards MCP elicitation (incl. its per-tool-call approval gate) to the app-server
|
|
1101
|
+
// client under this server-request method (#395). See handleCodexEvent for why a headless
|
|
1102
|
+
// agent must answer it instead of rejecting it.
|
|
1103
|
+
export const CODEX_MCP_ELICITATION_METHOD = "mcpServer/elicitation/request";
|
|
1104
|
+
|
|
1105
|
+
// A managed agent with no attended TUI (the spawn intent, `config.headless`) has no human to
|
|
1106
|
+
// resolve an elicitation. Such agents are the #395 case; interactive (TUI) sessions leave the
|
|
1107
|
+
// elicitation to the human in the attached terminal.
|
|
1108
|
+
function isCodexHeadless(process: ManagedProcess): boolean {
|
|
1109
|
+
return (process.meta?.config as RunnerSpawnConfig | undefined)?.headless === true;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// Spec-compliant auto-accept for a headless agent's MCP elicitation. `action` (not codex's
|
|
1113
|
+
// legacy `decision`) is the load-bearing field; `content: {}` approves codex's per-tool-call
|
|
1114
|
+
// gate and any no-required-field form without fabricating runtime field values for the agent.
|
|
1115
|
+
export function codexHeadlessElicitationResponse(): Record<string, unknown> {
|
|
1116
|
+
return { action: "accept", content: {}, _meta: null };
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
function codexApprovalFromServerRequest(message: { id: string | number; method: string; params?: unknown }): { pending: PendingCodexApproval; view: InteractivePrompt } | null {
|
|
1120
|
+
if (!isRecord(message.params)) return null;
|
|
1121
|
+
const method = message.method;
|
|
1122
|
+
if (!codexApprovalMethod(method)) return null;
|
|
1123
|
+
const id = `${method}:${String(message.id)}`;
|
|
1124
|
+
const view = codexApprovalView(id, method, message.params);
|
|
1125
|
+
return {
|
|
1126
|
+
pending: { id, requestId: message.id, method, params: message.params, view },
|
|
1127
|
+
view,
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/** Extract the human text from a Codex userMessage item's content (UserInput[]). */
|
|
1132
|
+
export function codexUserMessageText(content: unknown): string {
|
|
1133
|
+
if (typeof content === "string") return content.trim();
|
|
1134
|
+
if (!Array.isArray(content)) return "";
|
|
1135
|
+
return content
|
|
1136
|
+
.filter(isRecord)
|
|
1137
|
+
.filter((part) => part.type === "text" || part.type === "input_text" || part.type === "output_text")
|
|
1138
|
+
.map((part) => (typeof part.text === "string" ? part.text : ""))
|
|
1139
|
+
.filter(Boolean)
|
|
1140
|
+
.join("")
|
|
1141
|
+
.trim();
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/** Extract reasoning text from a Codex reasoning item (content[] preferred, summary[] fallback). */
|
|
1145
|
+
export function codexReasoningText(item: Record<string, unknown>): string {
|
|
1146
|
+
const stringsOf = (value: unknown): string[] =>
|
|
1147
|
+
Array.isArray(value) ? value.filter((v): v is string => typeof v === "string" && v.trim().length > 0) : [];
|
|
1148
|
+
const content = stringsOf(item.content);
|
|
1149
|
+
const text = (content.length ? content : stringsOf(item.summary)).join("\n\n").trim();
|
|
1150
|
+
return text;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/** Build a compact { label, body } activity summary for a Codex tool item. */
|
|
1154
|
+
// Canonical tool name for the #184 gathering/action classifier. Codex item types map to
|
|
1155
|
+
// names the shared classifier already understands: commandExecution executes (→ Bash, an
|
|
1156
|
+
// action), fileChange mutates (→ Edit), webSearch gathers (→ WebSearch, in the set), and
|
|
1157
|
+
// MCP/dynamic calls carry their real tool name so name-shape classification applies.
|
|
1158
|
+
export function codexInsightToolName(type: string | undefined, item: Record<string, unknown>): string {
|
|
1159
|
+
switch (type) {
|
|
1160
|
+
case "commandExecution": return "Bash";
|
|
1161
|
+
case "fileChange": return "Edit";
|
|
1162
|
+
case "webSearch": return "WebSearch";
|
|
1163
|
+
case "mcpToolCall":
|
|
1164
|
+
case "dynamicToolCall":
|
|
1165
|
+
case "collabAgentToolCall":
|
|
1166
|
+
return stringValue(item.tool) ?? type ?? "tool";
|
|
1167
|
+
default: return type ?? "tool";
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// #1498: Codex app-server item types → the provider-independent category taxonomy. Codex has
|
|
1172
|
+
// no MCP-tool-search or native read/ask-user-question item, so it simply never emits those
|
|
1173
|
+
// categories; webSearch and any other/future item type fall to "generic" rather than being
|
|
1174
|
+
// force-fit — the fallback exists precisely so nothing is hidden from the activity trace.
|
|
1175
|
+
// dynamicToolCall is a distinct client-provided dynamic tool (not MCP) so it falls to the
|
|
1176
|
+
// default generic case; collabAgentToolCall covers several collab ops (sendInput, resumeAgent,
|
|
1177
|
+
// wait, closeAgent, ...) and only the spawnAgent op is actually an agent spawn.
|
|
1178
|
+
export function codexToolCategory(type: string | undefined, item: Record<string, unknown>): ToolCallCategory {
|
|
1179
|
+
switch (type) {
|
|
1180
|
+
case "commandExecution": return "cli-bash";
|
|
1181
|
+
case "fileChange": return "edit";
|
|
1182
|
+
case "mcpToolCall": return "mcp-tool-call";
|
|
1183
|
+
case "collabAgentToolCall": return stringValue(item.tool) === "spawnAgent" ? "agent-spawn" : "generic";
|
|
1184
|
+
case "plan": return "plan";
|
|
1185
|
+
default: return "generic";
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
// Did a completed tool item fail? Mirrors Claude's tool_result is_error outcome proxy.
|
|
1190
|
+
export function codexItemFailed(item: Record<string, unknown>): boolean {
|
|
1191
|
+
if (stringValue(item.status) === "failed") return true;
|
|
1192
|
+
if (item.error != null && item.error !== false) return true;
|
|
1193
|
+
const exitCode = item.exitCode ?? item.exit_code;
|
|
1194
|
+
return typeof exitCode === "number" && exitCode !== 0;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
export function codexToolSummary(type: string | undefined, item: Record<string, unknown>, cwd?: string): { label: string; body: string; params?: unknown; paths?: string[] } | null {
|
|
1198
|
+
// One-line + redact + clip is the shared `tool-summary.ts` primitive (Claude/OpenCode parity);
|
|
1199
|
+
// only Codex's per-item-type field mapping lives here. `params` (#2437) reuses the same raw
|
|
1200
|
+
// field each branch already extracted for its one-line body, redacted+capped separately for
|
|
1201
|
+
// the trace's expandable detail — the one-line label stays exactly as it was.
|
|
1202
|
+
const oneLine = oneLineText, clip = clipToolSummary, params = redactAndCapParams;
|
|
1203
|
+
if (type === "commandExecution") {
|
|
1204
|
+
const command = oneLine(item.command), paths = codexReadPaths(item, cwd);
|
|
1205
|
+
return { label: "Shell", body: clip(command || "command"), params: params(item.command), ...(paths ? { paths } : {}) };
|
|
1206
|
+
}
|
|
1207
|
+
if (type === "fileChange") {
|
|
1208
|
+
const changes = Array.isArray(item.changes) ? item.changes.filter(isRecord) : [];
|
|
1209
|
+
const files = changes.map((c) => stringValue(c.path) ?? stringValue(c.file) ?? "").filter(Boolean);
|
|
1210
|
+
const paths = absoluteToolPaths(files, cwd); // #3411 — from the raw changes, never the capped params
|
|
1211
|
+
return { label: "Edit", body: clip(files.length ? files.join(", ") : "file changes"), params: params(item.changes), ...(paths ? { paths } : {}) };
|
|
1212
|
+
}
|
|
1213
|
+
if (type === "mcpToolCall" || type === "dynamicToolCall") {
|
|
1214
|
+
const tool = stringValue(item.tool) ?? "tool";
|
|
1215
|
+
const server = stringValue(item.server) ?? stringValue(item.namespace);
|
|
1216
|
+
return { label: server ? `${server}/${tool}` : tool, body: clip(oneLine(JSON.stringify(item.arguments ?? {})) || tool), params: params(item.arguments) };
|
|
1217
|
+
}
|
|
1218
|
+
if (type === "webSearch") {
|
|
1219
|
+
return { label: "Search", body: clip(oneLine(item.query) || "web search"), params: params(item.query) };
|
|
1220
|
+
}
|
|
1221
|
+
if (type === "plan") {
|
|
1222
|
+
return { label: "Plan", body: clip(oneLine(item.text) || "updated plan"), params: params(item.text) };
|
|
1223
|
+
}
|
|
1224
|
+
if (type === "collabAgentToolCall") {
|
|
1225
|
+
const tool = stringValue(item.tool) ?? "collab";
|
|
1226
|
+
const prompt = oneLine(item.prompt);
|
|
1227
|
+
const targets = Array.isArray(item.receiverThreadIds)
|
|
1228
|
+
? item.receiverThreadIds.filter((t): t is string => typeof t === "string").length
|
|
1229
|
+
: 0;
|
|
1230
|
+
const detail = prompt || (targets ? `${targets} agent${targets === 1 ? "" : "s"}` : tool);
|
|
1231
|
+
return { label: `Collab/${tool}`, body: clip(detail), params: params(item.prompt) };
|
|
1232
|
+
}
|
|
1233
|
+
// reasoning/agentMessage/userMessage are handled earlier in the event stream and never reach
|
|
1234
|
+
// here as a "tool" item — those genuinely aren't tool activity, so they stay null.
|
|
1235
|
+
if (type === "reasoning" || type === "agentMessage" || type === "userMessage") return null;
|
|
1236
|
+
// Any other/future Codex tool item type still gets a minimal summary rather than being
|
|
1237
|
+
// dropped — the "nothing dropped, unknown→generic" guarantee must hold even here.
|
|
1238
|
+
return { label: type ?? "Tool", body: clip(type ?? "tool") };
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
function codexApprovalMethod(method: string): boolean {
|
|
1242
|
+
return method === "execCommandApproval" ||
|
|
1243
|
+
method === "applyPatchApproval" ||
|
|
1244
|
+
method === "item/commandExecution/requestApproval" ||
|
|
1245
|
+
method === "item/fileChange/requestApproval" ||
|
|
1246
|
+
method === "item/permissions/requestApproval";
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
// Build the normalized InteractivePrompt for a Codex app-server approval request.
|
|
1250
|
+
// reasoningSettled is stamped `true` because handleCodexEvent flushes buffered reasoning +
|
|
1251
|
+
// any open narration segment BEFORE this view is emitted as pendingApproval (#435/#723). No
|
|
1252
|
+
// `provider` tag — the server reads the typed contract, not provider identity.
|
|
1253
|
+
function codexApprovalView(id: string, method: string, params: Record<string, unknown>): InteractivePrompt {
|
|
1254
|
+
const command = typeof params.command === "string" ? params.command
|
|
1255
|
+
: Array.isArray(params.command) ? params.command.filter((v): v is string => typeof v === "string").join(" ")
|
|
1256
|
+
: "";
|
|
1257
|
+
const cwd = stringValue(params.cwd) ?? stringValue(params.conversationId) ?? stringValue(params.threadId);
|
|
1258
|
+
const reason = stringValue(params.reason);
|
|
1259
|
+
const grantRoot = stringValue(params.grantRoot);
|
|
1260
|
+
const fileChanges = isRecord(params.fileChanges) ? Object.keys(params.fileChanges) : [];
|
|
1261
|
+
const permissions = isRecord(params.permissions) ? params.permissions : undefined;
|
|
1262
|
+
const body = [
|
|
1263
|
+
command,
|
|
1264
|
+
grantRoot ? `Grant write access: ${grantRoot}` : "",
|
|
1265
|
+
fileChanges.length ? `Files: ${fileChanges.join(", ")}` : "",
|
|
1266
|
+
permissions ? `Permissions: ${JSON.stringify(permissions)}` : "",
|
|
1267
|
+
reason ? `Reason: ${reason}` : "",
|
|
1268
|
+
cwd ? `Context: ${cwd}` : "",
|
|
1269
|
+
].filter(Boolean).join("\n");
|
|
1270
|
+
const isSessionCapable = method !== "item/permissions/requestApproval";
|
|
1271
|
+
return {
|
|
1272
|
+
id,
|
|
1273
|
+
kind: method.includes("file") || method === "applyPatchApproval" ? "file-change" : method.includes("permission") ? "permission" : "command",
|
|
1274
|
+
title: method.includes("file") || method === "applyPatchApproval"
|
|
1275
|
+
? "Approve file changes"
|
|
1276
|
+
: method.includes("permission")
|
|
1277
|
+
? "Approve extra permissions"
|
|
1278
|
+
: "Approve command",
|
|
1279
|
+
body: body || "Codex is requesting permission.",
|
|
1280
|
+
choices: [
|
|
1281
|
+
{ id: "approve", label: method.includes("permission") ? "Allow this turn" : "Approve" },
|
|
1282
|
+
...(isSessionCapable ? [{ id: "approve-session", label: "Approve session" }] : [{ id: "approve-session", label: "Allow session" }]),
|
|
1283
|
+
{ id: "deny", label: "Deny" },
|
|
1284
|
+
],
|
|
1285
|
+
reasoningSettled: true,
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
function codexApprovalResponse(method: string, params: Record<string, unknown>, decision: ProviderPermissionDecisionInput["decision"]): Record<string, unknown> {
|
|
1290
|
+
if (method === "item/commandExecution/requestApproval") {
|
|
1291
|
+
return { decision: decision === "approve-session" ? "acceptForSession" : decision === "deny" ? "decline" : decision === "abort" ? "cancel" : "accept" };
|
|
1292
|
+
}
|
|
1293
|
+
if (method === "item/fileChange/requestApproval") {
|
|
1294
|
+
return { decision: decision === "approve-session" ? "acceptForSession" : decision === "deny" ? "decline" : decision === "abort" ? "cancel" : "accept" };
|
|
1295
|
+
}
|
|
1296
|
+
if (method === "item/permissions/requestApproval") {
|
|
1297
|
+
const permissions = decision === "deny" || decision === "abort" ? {} : isRecord(params.permissions) ? params.permissions : {};
|
|
1298
|
+
return { permissions, scope: decision === "approve-session" ? "session" : "turn" };
|
|
1299
|
+
}
|
|
1300
|
+
return { decision: decision === "approve-session" ? "approved_for_session" : decision === "deny" ? "denied" : decision === "abort" ? "abort" : "approved" };
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
async function ensureCodexThread(process: ManagedProcess): Promise<string> {
|
|
1304
|
+
const client = process.meta?.client as CodexAppClient | undefined;
|
|
1305
|
+
if (!client) throw new Error("Codex App Server client is unavailable");
|
|
1306
|
+
const threadId = typeof process.meta?.threadId === "string" ? process.meta.threadId : "";
|
|
1307
|
+
if (threadId) return threadId;
|
|
1308
|
+
// Memoize the in-flight start so concurrent deliveries don't create two threads
|
|
1309
|
+
// and orphan the first turn's context.
|
|
1310
|
+
const pending = process.meta?.threadStartPromise as Promise<string> | undefined;
|
|
1311
|
+
if (pending) return pending;
|
|
1312
|
+
const startPromise = client
|
|
1313
|
+
.threadStart({ cwd: typeof process.meta?.cwd === "string" ? process.meta.cwd : globalThis.process.cwd() })
|
|
1314
|
+
.then((started) => {
|
|
1315
|
+
process.meta = { ...(process.meta ?? {}), threadId: started.thread.id, threadStartPromise: undefined };
|
|
1316
|
+
return started.thread.id;
|
|
1317
|
+
})
|
|
1318
|
+
.catch((error) => {
|
|
1319
|
+
if (process.meta) process.meta.threadStartPromise = undefined;
|
|
1320
|
+
throw error;
|
|
1321
|
+
});
|
|
1322
|
+
process.meta = { ...(process.meta ?? {}), threadStartPromise: startPromise };
|
|
1323
|
+
return startPromise;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
export function codexDeliveryNotice(messages: Message[], threadId: string): string {
|
|
1327
|
+
const ids = messages.map((message) => `#${message.id}`).join(", ");
|
|
1328
|
+
const senders = [...new Set(messages.map((message) => message.from))].join(", ");
|
|
1329
|
+
return `[agent-relay] received ${messages.length} relay message${messages.length === 1 ? "" : "s"} ${ids} from ${senders}; injecting into Codex thread ${threadId}`;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
export function codexProviderStateFromThreadStatus(status: unknown, params?: Record<string, unknown>, now = Date.now()): ProviderState | undefined {
|
|
1333
|
+
const type = statusType(status);
|
|
1334
|
+
const flags = activeFlags(status);
|
|
1335
|
+
const threadId = stringValue(params?.threadId) ?? (isRecord(params?.thread) ? stringValue(params.thread.id) : undefined);
|
|
1336
|
+
const raw = { ...(threadId ? { threadId } : {}), status: isRecord(status) ? status : { type } };
|
|
1337
|
+
const reason = flags[0] ?? type;
|
|
1338
|
+
|
|
1339
|
+
if (type === "active" && flags.some((flag) => flag.toLowerCase() === "waitingonapproval")) {
|
|
1340
|
+
return {
|
|
1341
|
+
state: "blocked",
|
|
1342
|
+
reason: "waitingOnApproval",
|
|
1343
|
+
label: "waiting for Codex approval",
|
|
1344
|
+
recommendedAction: "Open the attached TUI to approve, or restart with non-interactive approval.",
|
|
1345
|
+
source: "codex",
|
|
1346
|
+
raw,
|
|
1347
|
+
updatedAt: now,
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
if (type === "active" && flags.some((flag) => flag.toLowerCase().includes("auth"))) {
|
|
1352
|
+
return {
|
|
1353
|
+
state: "blocked",
|
|
1354
|
+
reason: "authRequired",
|
|
1355
|
+
label: "Codex authentication required",
|
|
1356
|
+
recommendedAction: "Open the provider session and complete authentication, then retry.",
|
|
1357
|
+
source: "codex",
|
|
1358
|
+
raw,
|
|
1359
|
+
updatedAt: now,
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
if (type === "systemError") {
|
|
1364
|
+
return {
|
|
1365
|
+
state: "blocked",
|
|
1366
|
+
reason: "systemError",
|
|
1367
|
+
label: "Codex system error",
|
|
1368
|
+
recommendedAction: "View provider logs, then restart the provider if the error is not transient.",
|
|
1369
|
+
source: "codex",
|
|
1370
|
+
raw,
|
|
1371
|
+
updatedAt: now,
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
if (type === "active") {
|
|
1376
|
+
return {
|
|
1377
|
+
state: "active",
|
|
1378
|
+
reason,
|
|
1379
|
+
label: flags.length ? `Codex active: ${flags.join(", ")}` : "Codex turn active",
|
|
1380
|
+
source: "codex",
|
|
1381
|
+
raw,
|
|
1382
|
+
updatedAt: now,
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
return undefined;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
function isSubagentThread(thread: Record<string, unknown> | undefined, params: Record<string, unknown> | undefined): boolean {
|
|
1390
|
+
if (thread?.threadSource === "subagent" || params?.threadSource === "subagent") return true;
|
|
1391
|
+
const source = isRecord(thread?.sessionSource) ? thread.sessionSource : isRecord(params?.sessionSource) ? params.sessionSource : undefined;
|
|
1392
|
+
return isRecord(source?.subagent);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
function subagentThreadDetails(thread: Record<string, unknown> | undefined, params: Record<string, unknown> | undefined): { label?: string; role?: string; parentId?: string } {
|
|
1396
|
+
const source = isRecord(thread?.sessionSource) ? thread.sessionSource : isRecord(params?.sessionSource) ? params.sessionSource : undefined;
|
|
1397
|
+
const subagent = isRecord(source?.subagent) ? source.subagent : undefined;
|
|
1398
|
+
const threadSpawn = isRecord(subagent?.thread_spawn) ? subagent.thread_spawn : undefined;
|
|
1399
|
+
return {
|
|
1400
|
+
label: stringValue(thread?.agentNickname) ?? stringValue(params?.agentNickname) ?? stringValue(threadSpawn?.agent_nickname),
|
|
1401
|
+
role: stringValue(thread?.agentRole) ?? stringValue(params?.agentRole) ?? stringValue(threadSpawn?.agent_role),
|
|
1402
|
+
parentId: stringValue(threadSpawn?.parent_thread_id) ?? stringValue(params?.parentThreadId),
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
function statusType(value: unknown): string | undefined {
|
|
1407
|
+
if (typeof value === "string") return value;
|
|
1408
|
+
return isRecord(value) ? stringValue(value.type) : undefined;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
function activeFlags(value: unknown): string[] {
|
|
1412
|
+
if (!isRecord(value) || !Array.isArray(value.activeFlags)) return [];
|
|
1413
|
+
return value.activeFlags.filter((flag): flag is string => typeof flag === "string" && flag.length > 0);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// #557 — bundledCodexSkillDirs + bundledSkillConfigArgs now live in ../launch-assembly
|
|
1417
|
+
// (the single launch-arg home, shared with the assembler); re-exported so existing
|
|
1418
|
+
// codex.ts consumers + tests keep their import path. tomlString likewise from ../relay-mcp.
|
|
1419
|
+
export { bundledCodexSkillDirs, bundledSkillConfigArgs };
|
|
1420
|
+
// Rollout/token-usage context parsing lives in ./codex-rollout-context; re-exported
|
|
1421
|
+
// so codex.ts consumers + tests keep their import path.
|
|
1422
|
+
export { codexTokenUsageContext, codexRolloutContextFromText } from "./codex-rollout-context";
|
|
1423
|
+
|
|
1424
|
+
function codexRelayContextEnabled(process: ManagedProcess): boolean {
|
|
1425
|
+
const config = process.meta?.config as RunnerSpawnConfig | undefined;
|
|
1426
|
+
return resolveRelayContext({ slug: "relay.context.codex", config }).available;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// Exported for integration coverage (#462): Codex has no `--append-system-prompt`
|
|
1430
|
+
// flag — the composed systemPromptAppend rides in as the launch-context message
|
|
1431
|
+
// prepended to the first turn. This is the Codex twin of Claude's append arg.
|
|
1432
|
+
export function codexLaunchContext(process: ManagedProcess): string | undefined {
|
|
1433
|
+
const config = process.meta?.config as RunnerSpawnConfig | undefined;
|
|
1434
|
+
const text = [config?.systemPromptAppend && sanitizeLaunchText(config.systemPromptAppend, "systemPromptAppend").trim(), ...(config && !harnessSubagentsEnabled(config) ? [HARNESS_SUBAGENTS_DISABLED] : [])].filter(Boolean).join("\n\n");
|
|
1435
|
+
if (!text || process.meta?.systemPromptAppendSent) return undefined;
|
|
1436
|
+
process.meta = { ...(process.meta ?? {}), systemPromptAppendSent: true };
|
|
1437
|
+
return [
|
|
1438
|
+
"[agent-relay launch context]",
|
|
1439
|
+
"The following context was attached when this provider session was launched. Treat it as background context, not as a user request and not as your own prior actions.",
|
|
1440
|
+
text,
|
|
1441
|
+
].join("\n");
|
|
1442
|
+
}
|