@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,1142 @@
|
|
|
1
|
+
import { isolateMemoryEntry, validateMemoryEntry } from "./memory-entry-safety";
|
|
2
|
+
// The unified-memory spawn preamble (#1565 P4a, design §4.2/§4.3) — `composeMemoryPreamble`.
|
|
3
|
+
//
|
|
4
|
+
// THE composer that renders `project_entries` into a prompt. It had a sibling —
|
|
5
|
+
// `composeProjectInstructions`, a second render path over the same table for the `project` cell —
|
|
6
|
+
// which #1565 P5.5 retired (§10.5): two paths over one table is how #1601 happened, and one path
|
|
7
|
+
// cannot drift. Three disciplines, unchanged:
|
|
8
|
+
// • DETERMINISTIC — render order comes from `resolveMemoryForIdentity` (kind → cell specificity
|
|
9
|
+
// → own-before-inherited → title → id); overflow admission ranks by value (role, tier, recency;
|
|
10
|
+
// memory-admission-rank.ts, #3090). Both read only stored rows, so the same DB always renders
|
|
11
|
+
// the same block, byte for byte.
|
|
12
|
+
// • SIZE-BOUNDED — a per-scope token budget (§4.3(2), `MEMORY_SCOPE_TOKEN_CAP`) AND a global
|
|
13
|
+
// ceiling on the whole block (`MEMORY_TOTAL_TOKEN_CAP`) with a documented, reproducible drop
|
|
14
|
+
// order. Worst case is the global cap, not `per-scope budget × however many cells exist`.
|
|
15
|
+
// • EMPTY IS "" — nothing resolvable ⇒ empty string ⇒ the caller leaves `systemPromptAppend`
|
|
16
|
+
// untouched ⇒ the spawn stays BYTE-IDENTICAL to a pre-#1565 one.
|
|
17
|
+
//
|
|
18
|
+
// TIERS (§4.3(1)). `inject:'pinned'` renders the full body (a directive that isn't in context
|
|
19
|
+
// doesn't bind); `inject:'indexed'` is on demand, never at startup (#3508): on first touch of a
|
|
20
|
+
// path area it names, else via search. A pinned entry over budget demotes to an `[id] headline · Nt`
|
|
21
|
+
// index line; `inject:'never'` is retrieval-only. `sensitivity:'sensitive'` and expired (`expires_at`)
|
|
22
|
+
// entries are NEVER injected.
|
|
23
|
+
//
|
|
24
|
+
// WHAT MAY BE INJECTED IS NOT DECIDED HERE (#1565 P5.4/P5.5, §10). Audience, tier, sensitivity and
|
|
25
|
+
// TTL all come from the ONE shared predicate
|
|
26
|
+
// `entryInjectability` (src/memory-inject-filter.ts). It lives in its own module because it USED to
|
|
27
|
+
// have two callers that each owned a copy of the checks and drifted, injecting a `sensitive`
|
|
28
|
+
// project entry in full (#1601). Every refusal comes back with a REASON and is reported
|
|
29
|
+
// (`filtered`/`filteredByReason`).
|
|
30
|
+
//
|
|
31
|
+
// PROVIDER-AGNOSTIC BY CONSTRUCTION: the input is an identity record, the output is markdown.
|
|
32
|
+
// No provider handle, no provider branch, nothing that could grow one.
|
|
33
|
+
|
|
34
|
+
import { contextRenderNow, renderedAtLine } from "./context-block-rendered-at";
|
|
35
|
+
import type { MemoryIdentity, ResolvedMemoryEntry } from "./db/memory-resolve";
|
|
36
|
+
import { readMemoryPreambleSnapshot, type MemoryPreambleSnapshot } from "./db/memory-preamble-read";
|
|
37
|
+
import { countInjectionDrops, describeInjectionDrops, emptyDropCounts, type InjectionDrop, type InjectionDropCounts } from "./memory-inject-filter";
|
|
38
|
+
import { errMessage } from "@humwick/sdk";
|
|
39
|
+
import { warnPinnedOverflow } from "./memory-admission-rank";
|
|
40
|
+
import { admitCandidates, type Candidate, type Outcome } from "./memory-preamble-admission";
|
|
41
|
+
import { injectsAtStartup } from "@humwick/sdk/areas";
|
|
42
|
+
import {
|
|
43
|
+
MEMORY_BASE_TOKEN_FLOOR,
|
|
44
|
+
MEMORY_INDEX_TOKEN_CAP,
|
|
45
|
+
MEMORY_INSTRUCTION_TOKEN_CAP,
|
|
46
|
+
MEMORY_MAX_TITLE_CHARS,
|
|
47
|
+
MEMORY_SCOPE_TOKEN_CAP,
|
|
48
|
+
MEMORY_TOTAL_TOKEN_CAP,
|
|
49
|
+
cutToTokens,
|
|
50
|
+
estimateEntryTokens,
|
|
51
|
+
estimateTextTokens,
|
|
52
|
+
} from "./memory-tokens";
|
|
53
|
+
import { renderTemplateReport } from "./prompt-resolver";
|
|
54
|
+
import { MEMORY_SCOPE_CHAIN, type MemoryChainScope, type ProjectEntryKind } from "./types";
|
|
55
|
+
|
|
56
|
+
/** The stable open marker (§4.2). Versioned so a future render shape can be recognized.
|
|
57
|
+
*
|
|
58
|
+
* It makes the block REPLACEABLE, but only where relay owns the bytes: at spawn and restart the
|
|
59
|
+
* prompt is recomposed and `stripMemoryPreamble` removes the previous copy. A `clear`/`compact`
|
|
60
|
+
* does NOT respawn — the system prompt (and its spawn-time block) survives, and the re-injected
|
|
61
|
+
* block lands in the transcript beside it. There, replacement is a STATEMENT, not a deletion:
|
|
62
|
+
* `MEMORY_SUPERSEDE_NOTICE` (#1565 F-REPLACES) is what makes the later copy authoritative. */
|
|
63
|
+
export const MEMORY_PREAMBLE_MARKER = "<!-- relay:memory v1 -->";
|
|
64
|
+
/** The close marker. The design names only the opener; a closer is what makes the strip exact,
|
|
65
|
+
* because the block itself legitimately contains blank lines and `#` headings. */
|
|
66
|
+
export const MEMORY_PREAMBLE_END_MARKER = "<!-- /relay:memory -->";
|
|
67
|
+
|
|
68
|
+
/** Marker-SHAPED comments in entry content. The block boundary is only a boundary if content
|
|
69
|
+
* cannot forge it: a body that quotes the closer (in THIS repo, the likely author of such a
|
|
70
|
+
* body is an agent documenting the memory system) would otherwise orphan the block's tail into
|
|
71
|
+
* the carried-forward prompt, and the next generation would compose a fresh block on top of the
|
|
72
|
+
* residue — stacking once per restart, and keeping content that has since been retracted,
|
|
73
|
+
* expired, or flipped to `sensitive`. Neutralized on render, so a marker never LEAVES here
|
|
74
|
+
* except as one the composer wrote. */
|
|
75
|
+
const MARKER_SHAPED = /<!--\s*\/?\s*relay:memory\b[\s\S]*?-->/g;
|
|
76
|
+
|
|
77
|
+
const KIND_HEADINGS: Record<ProjectEntryKind, string> = {
|
|
78
|
+
rule: "Rules",
|
|
79
|
+
fact: "Facts",
|
|
80
|
+
decision: "Decisions",
|
|
81
|
+
memory: "Memory",
|
|
82
|
+
};
|
|
83
|
+
const INDEX_HEADING = "## Index (bodies on demand — relay_project_read({ ids:[…] }))";
|
|
84
|
+
/** The fetch reflex (#1979 Wave A I7), stated in the block right where the index starts. An index
|
|
85
|
+
* is only worth its tokens if the agent PULLS from it: when a title below looks relevant to the
|
|
86
|
+
* task in hand, retrieving its body by id is one cheap call away. Trains the reflex the charter
|
|
87
|
+
* also carries, at the exact point the agent is looking at the titles.
|
|
88
|
+
*
|
|
89
|
+
* #2154 retired `relay_retrieve_memory`; the ids this index prints are `pe_…` PROJECT entry ids,
|
|
90
|
+
* so `relay_project_read({ ids })` is the by-id fetch that survives. Naming a tool the agent does
|
|
91
|
+
* not have is worse than naming none — a coordinator followed the stale directive into a dead end,
|
|
92
|
+
* which is why `memory-prompt-tool-references.test.ts` now looks every name here up in TOOLS. */
|
|
93
|
+
const INDEX_FETCH_DIRECTIVE = "_When a title below is relevant to your task, pull its full body by id — `relay_project_read({ ids:[…] })`. Cheap; do it rather than guess._";
|
|
94
|
+
/** Index headlines are a *hook*, not the entry. Bounded to the write-time title cap (#1979 I2) so a
|
|
95
|
+
* legacy over-long title cannot bloat a row, and one essay-titled memory cannot eat the index
|
|
96
|
+
* budget through its title alone. */
|
|
97
|
+
const MAX_HEADLINE_CHARS = MEMORY_MAX_TITLE_CHARS;
|
|
98
|
+
/** …and the hook that follows it (§4.2's `headline — hook · Nt`). An index the agent cannot
|
|
99
|
+
* TRIAGE is just a token tax: the title says what the entry is about, the hook says whether it
|
|
100
|
+
* is worth pulling. Bounded for the same reason as the headline. */
|
|
101
|
+
const MAX_HOOK_CHARS = 120;
|
|
102
|
+
|
|
103
|
+
/** The rendered tier of a candidate — `never` never reaches here. */
|
|
104
|
+
export type MemoryPreambleTier = "pinned" | "indexed";
|
|
105
|
+
|
|
106
|
+
/** Why an entry did not RENDER AT ALL — always stated in the block, never only in telemetry
|
|
107
|
+
* (#1979 Wave A I1 narrowed this to a single entry-loss cause).
|
|
108
|
+
* `index` = the index section's own cap (`MEMORY_INDEX_TOKEN_CAP`) was exhausted, so not even a
|
|
109
|
+
* one-line reference fit — the ONLY way an injectable entry is now lost, and a rare one;
|
|
110
|
+
* `instruction` = the block's INSTRUCTION preface overran its own cap and was truncated. The
|
|
111
|
+
* second is deliberately in the same vocabulary but is NOT an entry drop: it never increments
|
|
112
|
+
* `omitted`, because no entry was lost — an instruction can only ever cost itself (§10.1). */
|
|
113
|
+
export type MemoryPreambleOmission = "index" | "instruction";
|
|
114
|
+
|
|
115
|
+
/** Why a `pinned` entry did not get a FULL BODY and was demoted to a one-line index reference
|
|
116
|
+
* instead of dropped (#1979 Wave A I1). It still renders — in the index — so this is a softening,
|
|
117
|
+
* not a loss; the footer names it so the index's growth is explained.
|
|
118
|
+
* `budget` = its own cell's per-scope budget was exhausted; `total` = the whole-block ceiling was. */
|
|
119
|
+
export type MemoryPreambleDemotion = "budget" | "total";
|
|
120
|
+
|
|
121
|
+
/** How an instruction slug resolved (#1565 P5.1, §10.1). Each state is explicit and reported;
|
|
122
|
+
* none of them is an error, and none of them may fall back to friendlier text.
|
|
123
|
+
* - `rendered` — text resolved and fits;
|
|
124
|
+
* - `missing` — the slug is in neither the DB nor the shipped defaults;
|
|
125
|
+
* - `blank` — stored empty/whitespace, i.e. DELIBERATELY DISABLED (the kill switch);
|
|
126
|
+
* - `truncated` — text resolved but overran `MEMORY_INSTRUCTION_TOKEN_CAP`;
|
|
127
|
+
* - `failed` — resolution itself threw. Degrades to no text, never to a failed spawn. */
|
|
128
|
+
export type MemoryInstructionStatus = "rendered" | "missing" | "blank" | "truncated" | "failed";
|
|
129
|
+
|
|
130
|
+
/** Per-slug accounting for the preface — the instruction-side twin of
|
|
131
|
+
* `MemoryPreambleEntryReport`. Every requested slug appears here, rendered or not. */
|
|
132
|
+
export interface MemoryInstructionReport {
|
|
133
|
+
/** The slug that was ASKED for (the profile-agnostic one). */
|
|
134
|
+
slug: string;
|
|
135
|
+
/** The slug that actually supplied the text: `<slug>.<profile>` when that one resolves,
|
|
136
|
+
* else `slug`. Reported so "why is my coordinator seeing different wording" is answerable. */
|
|
137
|
+
resolved: string;
|
|
138
|
+
status: MemoryInstructionStatus;
|
|
139
|
+
/** What this slug contributes to the block as rendered. 0 unless `rendered`/`truncated`. */
|
|
140
|
+
tokens: number;
|
|
141
|
+
/** `{{var}}` names that rendered to "" — a hole, never a crash (§10.1). Omitted when none. */
|
|
142
|
+
emptyVariables?: string[];
|
|
143
|
+
/** Why this slug did not resolve cleanly: the throw behind `status:"failed"`, or the stored-read
|
|
144
|
+
* failure that made a `rendered` slug fall back to the shipped default text. */
|
|
145
|
+
error?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Per-entry accounting. EVERY injectable candidate appears here, rendered or not — the
|
|
149
|
+
* "never silently" half of §4.3's token transparency. */
|
|
150
|
+
export interface MemoryPreambleEntryReport {
|
|
151
|
+
id: string;
|
|
152
|
+
kind: ProjectEntryKind;
|
|
153
|
+
title: string;
|
|
154
|
+
cell: MemoryChainScope;
|
|
155
|
+
/** How the entry actually RENDERED: `pinned` = full body; `indexed` = a one-line reference (its
|
|
156
|
+
* native tier, or a `pinned` entry demoted here — see `demoted`). */
|
|
157
|
+
tier: MemoryPreambleTier;
|
|
158
|
+
/** What this entry costs the prompt AS RENDERED (a pinned body vs. a one-line headline). For an
|
|
159
|
+
* omitted entry, the index line it WOULD have cost. */
|
|
160
|
+
tokens: number;
|
|
161
|
+
/** What the whole entry costs if pulled — the `· Nt` an index line advertises. */
|
|
162
|
+
fullTokens: number;
|
|
163
|
+
rendered: boolean;
|
|
164
|
+
/** A `pinned` entry the full-body budget could not fit, rendered as an index reference instead of
|
|
165
|
+
* being dropped (#1979 I1). Absent for a natively-`indexed` entry, which was never a body. */
|
|
166
|
+
demoted?: boolean;
|
|
167
|
+
/** Why a demoted entry lost its full body — set whenever `demoted` is. */
|
|
168
|
+
demotedReason?: MemoryPreambleDemotion;
|
|
169
|
+
/** Set only when `rendered` is false: the entry was omitted entirely (always `index` now). */
|
|
170
|
+
omittedReason?: MemoryPreambleOmission;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface MemoryPreambleScopeReport {
|
|
174
|
+
cell: MemoryChainScope;
|
|
175
|
+
budget: number;
|
|
176
|
+
candidates: number;
|
|
177
|
+
rendered: number;
|
|
178
|
+
tokens: number;
|
|
179
|
+
omitted: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** The limits this compose actually ran under — reported, not just applied, so a truncated block
|
|
183
|
+
* can be explained without re-deriving the constants (#1602 residual: the ceiling has to be
|
|
184
|
+
* legible to whoever is looking at a short block). */
|
|
185
|
+
export interface MemoryPreambleBudgetReport {
|
|
186
|
+
/** Per-cell cap (`MEMORY_SCOPE_TOKEN_CAP`). */
|
|
187
|
+
scope: number;
|
|
188
|
+
/** Whole-block ceiling (`MEMORY_TOTAL_TOKEN_CAP`) for FULL BODIES. */
|
|
189
|
+
total: number;
|
|
190
|
+
/** The index section's own cap (`MEMORY_INDEX_TOKEN_CAP`) — a SEPARATE allowance, like
|
|
191
|
+
* `instruction`, so a complete index can never evict a full body (#1979 I1). */
|
|
192
|
+
index: number;
|
|
193
|
+
/** Tokens of `total` held back for the `base` cell — never more than base could spend. */
|
|
194
|
+
baseReserved: number;
|
|
195
|
+
/** The preface's own cap (`MEMORY_INSTRUCTION_TOKEN_CAP`) — a SEPARATE allowance, not a slice
|
|
196
|
+
* of `total`, so instruction text can never evict an entry (§10.1). */
|
|
197
|
+
instruction: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface ComposedMemoryPreamble {
|
|
201
|
+
/** The markdown block, or "" when nothing applies. */
|
|
202
|
+
block: string;
|
|
203
|
+
/** Estimated token cost of the block's ENTRIES — the sum of the rendered entries' `tokens`,
|
|
204
|
+
* from the ONE estimator (§4.3(3)), so this number matches what the tools and the dashboard
|
|
205
|
+
* report. The preface is priced separately in `instructionTokens`; the block's own footer
|
|
206
|
+
* states the sum, because that is what the agent actually pays. */
|
|
207
|
+
tokens: number;
|
|
208
|
+
/** What the instruction preface costs (#1565 P5.1) — 0 when every slug is blank/missing. */
|
|
209
|
+
instructionTokens: number;
|
|
210
|
+
/** Per-slug preface accounting, in request order. Every requested slug is here whatever its
|
|
211
|
+
* status, so "the instruction is not showing up" is answerable from the event alone. */
|
|
212
|
+
instructionSlugs: MemoryInstructionReport[];
|
|
213
|
+
entries: MemoryPreambleEntryReport[];
|
|
214
|
+
/** Entries lost ENTIRELY — the index section's cap could not fit even a one-line reference
|
|
215
|
+
* (#1979 I1). Near-zero by design; stated in the block itself, never silent. */
|
|
216
|
+
omitted: number;
|
|
217
|
+
/** `omitted`, split by WHY. Since I1 the only entry-loss cause is `index`; `instruction`
|
|
218
|
+
* rides here for the truncation clause but is never an entry. */
|
|
219
|
+
omittedByReason: Record<MemoryPreambleOmission, number>;
|
|
220
|
+
/** `pinned` entries that could not fit a full body and were rendered as index references instead
|
|
221
|
+
* of dropped (#1979 I1). They ARE in the block (in the index); this is why the index grew. */
|
|
222
|
+
demoted: number;
|
|
223
|
+
/** `demoted`, split by which full-body budget was full — the cell's own vs. the whole-block
|
|
224
|
+
* ceiling. Different levers, so kept apart (the #1602 discipline, applied to demotions). */
|
|
225
|
+
demotedByReason: Record<MemoryPreambleDemotion, number>;
|
|
226
|
+
scopes: MemoryPreambleScopeReport[];
|
|
227
|
+
budgets: MemoryPreambleBudgetReport;
|
|
228
|
+
/**
|
|
229
|
+
* Candidates the SHARED injectability filter refused, itemized with their reason (#1565 P5.4,
|
|
230
|
+
* §10) — audience, TTL, `sensitive`, `inject:'never'`. Kept separate from `omitted`, which is
|
|
231
|
+
* strictly the budget/ceiling drop: the two have completely different fixes, and flattening
|
|
232
|
+
* them is the misattribution #1602 closed one level up.
|
|
233
|
+
*
|
|
234
|
+
* A `sensitive` drop carries `id` + `reason` only — never the title (see `injectionDrop`).
|
|
235
|
+
*/
|
|
236
|
+
filtered: InjectionDrop[];
|
|
237
|
+
filteredByReason: InjectionDropCounts;
|
|
238
|
+
/** #3409/#3508 — injectable entries held out of the startup block: every `indexed` entry and the
|
|
239
|
+
* agent's own project's path-only entries. Not refusals, so never in `filtered`. */
|
|
240
|
+
areaDeferredCount: number;
|
|
241
|
+
/** What `tokens` would be had nothing been deferred: the same admission over every candidate.
|
|
242
|
+
* Equals `tokens` when `areaDeferredCount` is 0. */
|
|
243
|
+
counterfactualTokens: number;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface ComposeMemoryPreambleOptions {
|
|
247
|
+
/** Per-scope token budget (§4.3(2)). Default `MEMORY_SCOPE_TOKEN_CAP` (2048). */
|
|
248
|
+
scopeTokenBudget?: number;
|
|
249
|
+
/**
|
|
250
|
+
* Ceiling on the WHOLE block. Default `MEMORY_TOTAL_TOKEN_CAP`.
|
|
251
|
+
*
|
|
252
|
+
* The per-scope budget alone bounds each cell but not their sum, so the real cost of a spawn
|
|
253
|
+
* would grow with however many cells the chain happens to have. This is the number that
|
|
254
|
+
* actually bounds a prompt. Spent MOST-SPECIFIC-CELL FIRST, so what the ceiling drops is the
|
|
255
|
+
* least specific content — the same drop direction §4.3(2) gives the per-scope budget.
|
|
256
|
+
*/
|
|
257
|
+
totalTokenBudget?: number;
|
|
258
|
+
/**
|
|
259
|
+
* Tokens of `totalTokenBudget` reserved for the `base` cell. Default `MEMORY_BASE_TOKEN_FLOOR`.
|
|
260
|
+
*
|
|
261
|
+
* Without it, the most-specific-first spend order lets a well-stocked `host`/`provider` cell
|
|
262
|
+
* consume the whole ceiling and evict the operator's own base memory — which under #559 had a
|
|
263
|
+
* budget nothing else could touch. The reservation is capped at what base can actually use, so
|
|
264
|
+
* an under-stocked base cell hands its unused share straight back.
|
|
265
|
+
*/
|
|
266
|
+
baseTokenFloor?: number;
|
|
267
|
+
/**
|
|
268
|
+
* Cap on the whole INDEX SECTION (#1979 I1). Default `MEMORY_INDEX_TOKEN_CAP`.
|
|
269
|
+
*
|
|
270
|
+
* A SEPARATE allowance from `scopeTokenBudget`/`totalTokenBudget`, which bound full bodies only.
|
|
271
|
+
* Hooked reference lines spend THIS cap. A `pinned` entry the body budget demoted never gets
|
|
272
|
+
* omitted: past the cap it renders hookless (#3525). Only a natively-`indexed` entry is omitted
|
|
273
|
+
* (reason `index`).
|
|
274
|
+
*/
|
|
275
|
+
indexTokenBudget?: number;
|
|
276
|
+
/** Injected clock for TTL evaluation. Default `Date.now()`. */
|
|
277
|
+
now?: number;
|
|
278
|
+
/**
|
|
279
|
+
* Which chain cells participate. Default: all of `MEMORY_SCOPE_CHAIN`.
|
|
280
|
+
*
|
|
281
|
+
* Lifecycle seams derive this set from the selected profile's Project Instructions cell. When
|
|
282
|
+
* that switch is off, `project` is absent and cannot participate in resolution or overrides.
|
|
283
|
+
*
|
|
284
|
+
* Filtering happens BEFORE resolution, so an excluded cell can never win an override collapse
|
|
285
|
+
* and take the surviving entry down with it. `base` always participates — it is the floor of
|
|
286
|
+
* any identity — and `profile` always applies, because it selects AUDIENCE, not a cell.
|
|
287
|
+
*/
|
|
288
|
+
cells?: readonly MemoryChainScope[];
|
|
289
|
+
/** Provider-native repo instruction filenames. Matching ingested project mirrors are excluded
|
|
290
|
+
* before override collapse and reported as source-policy drops. */
|
|
291
|
+
projectNativeInstructionFiles?: readonly string[];
|
|
292
|
+
/**
|
|
293
|
+
* Which instruction slugs render as the block's preface, in order (#1565 P5.1, §10.1).
|
|
294
|
+
* Default `MEMORY_INSTRUCTION_SLUGS`. Pass `[]` for a block with no instruction at all — the
|
|
295
|
+
* shape a byte-identical-to-pre-P5 prompt has.
|
|
296
|
+
*/
|
|
297
|
+
instructionSlugs?: readonly string[];
|
|
298
|
+
/** Cap on the whole preface. Default `MEMORY_INSTRUCTION_TOKEN_CAP`. */
|
|
299
|
+
instructionTokenBudget?: number;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* The instruction slugs the preface renders, in order (#1565 P5.1, §10.1).
|
|
304
|
+
*
|
|
305
|
+
* `memory.charter` says what relay memory IS and how to use it; `memory.native-off` (seeded
|
|
306
|
+
* BLANK) says it outranks the provider's own store, and is populated only when §10.3.3's rollout
|
|
307
|
+
* reaches Stage 0. The other two `memory.*` slugs are not here on purpose: they are boundary
|
|
308
|
+
* payload text (P5.2), not system-prompt text.
|
|
309
|
+
*/
|
|
310
|
+
export const MEMORY_INSTRUCTION_SLUGS = ["memory.charter", "memory.native-off"] as const;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Resolve the preface (#1565 P5.1, §10.1).
|
|
314
|
+
*
|
|
315
|
+
* Every failure mode is EXPLICIT and reported, and none of them invents friendlier text:
|
|
316
|
+
* - a slug in neither DB nor defaults is `missing` — `renderTemplateReport` returns undefined
|
|
317
|
+
* instead of `renderTemplate`'s throw, because an unknown slug must never fail a spawn;
|
|
318
|
+
* - a stored-blank slug is `blank` — the deliberate disable that K2 depends on, so it has to be
|
|
319
|
+
* a first-class reportable state rather than a reason to fall back to the default text;
|
|
320
|
+
* - a resolution that THROWS is `failed`: no text, the error recorded, the spawn unaffected;
|
|
321
|
+
* - an unknown `{{var}}` is already substituted "" by the renderer — reported by NAME here, so
|
|
322
|
+
* a hole in the prompt is visible rather than merely harmless;
|
|
323
|
+
* - marker-shaped text is neutralized exactly like an entry body. The slug is dashboard-editable,
|
|
324
|
+
* i.e. caller text: a `<!-- relay:memory v1 -->` inside it would forge the block boundary and
|
|
325
|
+
* defeat strip-and-replace (the F2 lesson, applied to a new input).
|
|
326
|
+
*
|
|
327
|
+
* Per-profile specialization is a one-deep fallback chain, `<slug>.<profile>` → `<slug>`, and the
|
|
328
|
+
* probe is SILENT: nobody has a per-profile slug by default, so reporting ten `missing` statuses
|
|
329
|
+
* per spawn would make the report useless. A per-profile slug that exists WINS EVEN WHEN BLANK —
|
|
330
|
+
* it can only exist because somebody created it, so blanking it is a per-profile kill switch, not
|
|
331
|
+
* a hole to paper over with the shared text.
|
|
332
|
+
*/
|
|
333
|
+
function resolveInstructionPreface(
|
|
334
|
+
slugs: readonly string[],
|
|
335
|
+
profile: string | undefined,
|
|
336
|
+
cap: number,
|
|
337
|
+
): { parts: string[]; reports: MemoryInstructionReport[]; tokens: number; truncated: number } {
|
|
338
|
+
const parts: string[] = [];
|
|
339
|
+
const reports: MemoryInstructionReport[] = [];
|
|
340
|
+
let used = 0;
|
|
341
|
+
let truncated = 0;
|
|
342
|
+
const own = profile?.trim();
|
|
343
|
+
for (const slug of slugs) {
|
|
344
|
+
let resolved = slug;
|
|
345
|
+
let rendered;
|
|
346
|
+
try {
|
|
347
|
+
const specific = own ? renderTemplateReport(`${slug}.${own}`) : undefined;
|
|
348
|
+
if (specific) resolved = `${slug}.${own}`;
|
|
349
|
+
rendered = specific ?? renderTemplateReport(slug);
|
|
350
|
+
} catch (error) {
|
|
351
|
+
reports.push({ slug, resolved, status: "failed", tokens: 0, error: errMessage(error) });
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (!rendered) {
|
|
355
|
+
reports.push({ slug, resolved, status: "missing", tokens: 0 });
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
// A stored-lookup failure degraded to the SHIPPED default rather than to nothing (the better
|
|
359
|
+
// outcome — the instruction survives, only the operator's edit is lost). Carried through as
|
|
360
|
+
// `error` so the degradation is reported instead of passing for a healthy render.
|
|
361
|
+
const extra = {
|
|
362
|
+
...(rendered.emptyVariables.length ? { emptyVariables: rendered.emptyVariables } : {}),
|
|
363
|
+
...(rendered.lookupError ? { error: rendered.lookupError } : {}),
|
|
364
|
+
};
|
|
365
|
+
const text = neutralizeMarkers(rendered.text.trim());
|
|
366
|
+
if (!text) {
|
|
367
|
+
reports.push({ slug, resolved, status: "blank", tokens: 0, ...extra });
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
const cost = estimateTextTokens(text);
|
|
371
|
+
if (used + cost <= cap) {
|
|
372
|
+
parts.push(text);
|
|
373
|
+
used += cost;
|
|
374
|
+
reports.push({ slug, resolved, status: "rendered", tokens: cost, ...extra });
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
// Over the cap: cut to what is left, deterministically (chars = the estimator's own chars/4,
|
|
378
|
+
// one reserved for the ellipsis that marks the cut). The scan CONTINUES — a later slug that
|
|
379
|
+
// still fits in the remainder is not punished for an earlier slug's size.
|
|
380
|
+
truncated += 1;
|
|
381
|
+
const cut = cutToTokens(text, cap - used);
|
|
382
|
+
const cutCost = cut ? estimateTextTokens(cut) : 0;
|
|
383
|
+
if (cut) {
|
|
384
|
+
parts.push(cut);
|
|
385
|
+
used += cutCost;
|
|
386
|
+
}
|
|
387
|
+
reports.push({ slug, resolved, status: "truncated", tokens: cutCost, ...extra });
|
|
388
|
+
}
|
|
389
|
+
return { parts, reports, tokens: used, truncated };
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* The preface statuses that are DEFECTS rather than decisions (#1565 P5.1).
|
|
394
|
+
*
|
|
395
|
+
* `blank` is deliberate — an operator disabled the slug, and a disabled instruction reporting
|
|
396
|
+
* itself at every spawn would be noise that trains everyone to ignore the report. Everything else
|
|
397
|
+
* means an instruction the fleet was supposed to have did not arrive, which must be audible even
|
|
398
|
+
* when the block itself is "" and has nowhere to say so.
|
|
399
|
+
*/
|
|
400
|
+
export function memoryInstructionDefects(reports: readonly MemoryInstructionReport[]): MemoryInstructionReport[] {
|
|
401
|
+
return reports.filter((report) => report.status === "missing" || report.status === "failed" || report.status === "truncated" || report.error);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Remove a previously injected memory block (marker to marker), so a restart/re-inject REPLACES
|
|
406
|
+
* it instead of stacking a second copy. Mirrors `stripHumwickIdentitySection`.
|
|
407
|
+
*
|
|
408
|
+
* STRICT, BY CONSTRUCTION (#1565 F2). This runs over text the CALLER wrote — `composeProfileSpawn`
|
|
409
|
+
* applies it to `callerSystemPromptAppend`, which is the raw parent brief — so anything it removes
|
|
410
|
+
* that is not actually a relay block is a caller's own words, silently deleted from every restart
|
|
411
|
+
* of that agent. The markers are also ordinary text: this repo's own design doc carries them, and
|
|
412
|
+
* a review brief quotes them. So only a well-formed pair THE COMPOSER COULD HAVE EMITTED is a
|
|
413
|
+
* block: the opener must start a line and be followed immediately by the block's `# Memory` header
|
|
414
|
+
* line, and the closer must sit alone on its own line (`isComposedOpener`/`isComposedCloser`). A
|
|
415
|
+
* brief that mentions a marker in prose is not a boundary and is left byte-for-byte alone.
|
|
416
|
+
*
|
|
417
|
+
* Within a block, removal runs to the LAST composer-shaped closer BEFORE the next composer-shaped
|
|
418
|
+
* opener. A closer forged inside an entry body can only live ahead of that block's real terminator,
|
|
419
|
+
* so the last one in the region is the real one — and render-side neutralization
|
|
420
|
+
* (`neutralizeMarkers`) means only prompts already in flight from an older generation can contain
|
|
421
|
+
* one at all.
|
|
422
|
+
*
|
|
423
|
+
* An opener with NO closer after it (a block truncated in transit) has only its opener line
|
|
424
|
+
* removed. It deliberately does NOT swallow the following region: the earlier "merge a closer-less
|
|
425
|
+
* region into the next one" rule (#1602 residual 2) rested on truncation being the only way to
|
|
426
|
+
* reach that shape, and that is false — ordinary caller prose reaches it, and the rule then ate
|
|
427
|
+
* everything from the prose mention to the end of the next real block. A one-time cosmetic
|
|
428
|
+
* fragment is a far better outcome than deleting a caller's acceptance criteria; the fragment
|
|
429
|
+
* carries no marker, so nothing stacks on it either way.
|
|
430
|
+
*/
|
|
431
|
+
export function stripMemoryPreamble(value: string): string {
|
|
432
|
+
const spans = memoryPreambleSpans(value);
|
|
433
|
+
if (!spans.length) return value;
|
|
434
|
+
let out = "";
|
|
435
|
+
let last = 0;
|
|
436
|
+
for (const { from, end } of spans) {
|
|
437
|
+
out += value.slice(last, from);
|
|
438
|
+
last = end;
|
|
439
|
+
}
|
|
440
|
+
out += value.slice(last);
|
|
441
|
+
return out.replace(/^\n\n+/, "").replace(/\n\n+$/, "");
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* What the re-injected copy says about the copy already in context (#1565 F-REPLACES).
|
|
446
|
+
*
|
|
447
|
+
* A `clear`/`compact` does not respawn, so the spawn-time block stays in the system prompt while
|
|
448
|
+
* this one arrives in the transcript: two blocks with identical markers and nothing to tell the
|
|
449
|
+
* agent which is current. Without this line, "an entry retracted mid-session is gone at the next
|
|
450
|
+
* boundary" is false for the system-prompt copy — and the delta gate hides it, because the only
|
|
451
|
+
* time a boundary re-injects at all is when the set CHANGED, i.e. exactly when a retraction has to
|
|
452
|
+
* take effect. Prose is the whole mechanism available here: nothing mid-session can rewrite a
|
|
453
|
+
* system prompt.
|
|
454
|
+
*/
|
|
455
|
+
export const MEMORY_SUPERSEDE_NOTICE = "_This block SUPERSEDES any earlier relay memory block in this context (a clear/compact does not rewrite the system prompt, so an older copy may still be above). Where they differ, THIS one is current — anything present there and absent here was retracted, expired, or is no longer injectable._";
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* The same statement WITHOUT the retraction claim, for the case relay cannot stand behind it
|
|
459
|
+
* (#1625).
|
|
460
|
+
*
|
|
461
|
+
* The notice above says a difference between the two copies means a retraction. That is only true
|
|
462
|
+
* if both copies were resolved under the SAME launch-recorded memory identity.
|
|
463
|
+
* When the boundary had to re-derive its seam — an agent whose launch predates the recorded seam,
|
|
464
|
+
* or one that never went through a composing spawn path — agreement is unproven, and the difference
|
|
465
|
+
* could just as easily be a resolution difference (a different host cell, a narrower source set).
|
|
466
|
+
*
|
|
467
|
+
* Claiming retraction there is worse than saying nothing, because the agent ACTS on it: it treats
|
|
468
|
+
* live, still-injectable instruction as withdrawn. So the claim is downgraded to what is actually
|
|
469
|
+
* known. The supersede statement itself is unchanged — the later copy is still the current one.
|
|
470
|
+
*/
|
|
471
|
+
export const MEMORY_SUPERSEDE_NOTICE_UNVERIFIED = "_This block SUPERSEDES any earlier relay memory block in this context (a clear/compact does not rewrite the system prompt, so an older copy may still be above). Where they differ, THIS one is current. Relay could NOT confirm this block resolved under the same launch identity and project-memory selection as the earlier copy, so treat anything present there and absent here as UNVERIFIED rather than retracted._";
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* The block as it is DELIVERED at a boundary: the composed block with the supersede notice on the
|
|
475
|
+
* line after its header, inside the markers so a later strip takes it with the block.
|
|
476
|
+
*
|
|
477
|
+
* The composed block stays the canonical one — it is what gets hashed for the delta gate and what a
|
|
478
|
+
* spawn prompt carries — so adding this line can never make the gate compare two shapes and
|
|
479
|
+
* re-inject forever. "" stays "": there is nothing to supersede with. A boundary that must retract
|
|
480
|
+
* an EARLIER copy with nothing of its own uses {@link memoryRetractionBlock} instead — only that
|
|
481
|
+
* caller knows a stale copy is actually in the prompt.
|
|
482
|
+
*
|
|
483
|
+
* `seamVerified` is required rather than defaulted (#1625): the caller is the only one that knows
|
|
484
|
+
* whether the earlier copy was composed from the same seam, and a default would silently pick the
|
|
485
|
+
* stronger claim exactly where it is least justified.
|
|
486
|
+
*/
|
|
487
|
+
export function withMemorySupersedeNotice(block: string, opts: { seamVerified: boolean }): string {
|
|
488
|
+
if (!block.trim()) return block;
|
|
489
|
+
const lines = block.split("\n");
|
|
490
|
+
// [0] is the opener, [1] the `# Memory — …` header; the notice reads as the block's own subtitle.
|
|
491
|
+
const at = lines.length > 1 ? 2 : 1;
|
|
492
|
+
const notice = opts.seamVerified ? MEMORY_SUPERSEDE_NOTICE : MEMORY_SUPERSEDE_NOTICE_UNVERIFIED;
|
|
493
|
+
return [...lines.slice(0, at), "", notice, ...lines.slice(at)].join("\n");
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* An EMPTY block that still carries the supersede notice — the retraction payload for a boundary
|
|
498
|
+
* that composed nothing while the agent's prompt is still carrying an earlier copy.
|
|
499
|
+
*
|
|
500
|
+
* #2154 made this reachable: with the project cell the only one left, switching Project Instructions
|
|
501
|
+
* off composes to "" once the charter slugs are also blank, and a clear/compact does not rewrite the
|
|
502
|
+
* system prompt. Sending nothing would leave the launched block standing as current forever.
|
|
503
|
+
*
|
|
504
|
+
* Marker-wrapped, so `extractMemoryPreamble`/`stripMemoryPreamble` take it like any other block. It
|
|
505
|
+
* is deliberately HEADER-LESS — there is no cell left to name — which means `isComposedOpener` does
|
|
506
|
+
* NOT recognize it as a composed block. That is inert today (nothing re-composes a delivered
|
|
507
|
+
* retraction), but a header must be added here before anything starts to.
|
|
508
|
+
*/
|
|
509
|
+
export function memoryRetractionBlock(opts: { seamVerified: boolean }): string {
|
|
510
|
+
const notice = opts.seamVerified ? MEMORY_SUPERSEDE_NOTICE : MEMORY_SUPERSEDE_NOTICE_UNVERIFIED;
|
|
511
|
+
return [MEMORY_PREAMBLE_MARKER, "", notice, MEMORY_PREAMBLE_END_MARKER].join("\n");
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* The memory block a prompt CARRIES, marker to marker, or null when it carries none — the read
|
|
516
|
+
* side of the same scan `stripMemoryPreamble` removes with.
|
|
517
|
+
*
|
|
518
|
+
* This is what lets the compact delta-gate ask "what is already in this agent's system prompt?"
|
|
519
|
+
* of the durable spawn command instead of a parallel bookkeeping write: the answer is derived
|
|
520
|
+
* from the bytes that were actually launched, so it cannot drift from them. The LAST block wins —
|
|
521
|
+
* a prompt with more than one is malformed, and the last is the one composed most recently.
|
|
522
|
+
*/
|
|
523
|
+
export function extractMemoryPreamble(value: string): string | null {
|
|
524
|
+
const span = memoryPreambleSpans(value).at(-1);
|
|
525
|
+
return span ? value.slice(span.open, span.end) : null;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
interface MemoryPreambleSpan {
|
|
529
|
+
/** The opener's own index — where the BLOCK starts. */
|
|
530
|
+
open: number;
|
|
531
|
+
/** Where REMOVAL starts: the opener, or the blank line that joined it to what precedes it. */
|
|
532
|
+
from: number;
|
|
533
|
+
end: number;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** The header line the composer ALWAYS writes immediately after the opener (`memoryHeader`). Part
|
|
537
|
+
* of what makes an opener a composer-shaped one rather than a prose mention of the marker. */
|
|
538
|
+
const OPENER_HEADER_LINE = /^\r?\n# Memory\b/;
|
|
539
|
+
|
|
540
|
+
/** An opener the composer could have written: alone at the start of a line, with the block's own
|
|
541
|
+
* `# Memory` header on the next. Anything else is prose that happens to contain the marker. */
|
|
542
|
+
function isComposedOpener(value: string, at: number): boolean {
|
|
543
|
+
if (at > 0 && value[at - 1] !== "\n") return false;
|
|
544
|
+
return OPENER_HEADER_LINE.test(value.slice(at + MEMORY_PREAMBLE_MARKER.length));
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** A closer the composer could have written: alone on its own line (it is pushed as its own line,
|
|
548
|
+
* after the accounting footer). */
|
|
549
|
+
function isComposedCloser(value: string, at: number): boolean {
|
|
550
|
+
if (at > 0 && value[at - 1] !== "\n") return false;
|
|
551
|
+
const after = at + MEMORY_PREAMBLE_END_MARKER.length;
|
|
552
|
+
return after === value.length || value[after] === "\n" || value[after] === "\r";
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function nextComposedOpener(value: string, from: number): number {
|
|
556
|
+
for (let at = value.indexOf(MEMORY_PREAMBLE_MARKER, from); at >= 0; at = value.indexOf(MEMORY_PREAMBLE_MARKER, at + 1)) {
|
|
557
|
+
if (isComposedOpener(value, at)) return at;
|
|
558
|
+
}
|
|
559
|
+
return -1;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/** The LAST composer-shaped closer inside `[from, until)` — a forged one can only sit ahead of the
|
|
563
|
+
* real terminator, so the last is the real one. -1 when the region holds none. */
|
|
564
|
+
function lastComposedCloser(value: string, from: number, until: number): number {
|
|
565
|
+
let found = -1;
|
|
566
|
+
for (let at = value.indexOf(MEMORY_PREAMBLE_END_MARKER, from); at >= 0 && at < until; at = value.indexOf(MEMORY_PREAMBLE_END_MARKER, at + 1)) {
|
|
567
|
+
if (isComposedCloser(value, at)) found = at;
|
|
568
|
+
}
|
|
569
|
+
return found;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function memoryPreambleSpans(value: string): MemoryPreambleSpan[] {
|
|
573
|
+
if (!value.includes(MEMORY_PREAMBLE_MARKER)) return [];
|
|
574
|
+
const spans: MemoryPreambleSpan[] = [];
|
|
575
|
+
let cursor = 0;
|
|
576
|
+
for (;;) {
|
|
577
|
+
const open = nextComposedOpener(value, cursor);
|
|
578
|
+
if (open < 0) break;
|
|
579
|
+
const openEnd = open + MEMORY_PREAMBLE_MARKER.length;
|
|
580
|
+
// One region per block: from this opener to the next composer-shaped opener (or end of input).
|
|
581
|
+
// A closer-less region terminates at the opener line and NOTHING is merged into the region
|
|
582
|
+
// after it — see `stripMemoryPreamble` for why that direction is the safe one.
|
|
583
|
+
const nextOpen = nextComposedOpener(value, openEnd);
|
|
584
|
+
const closeAt = lastComposedCloser(value, openEnd, nextOpen < 0 ? value.length : nextOpen);
|
|
585
|
+
const end = closeAt < 0 ? openEnd : closeAt + MEMORY_PREAMBLE_END_MARKER.length;
|
|
586
|
+
// Swallow the blank line that joined the block to whatever preceded it, so removal does not
|
|
587
|
+
// leave a double separator behind.
|
|
588
|
+
spans.push({ open, from: value.slice(open - 2, open) === "\n\n" ? open - 2 : open, end });
|
|
589
|
+
cursor = end;
|
|
590
|
+
}
|
|
591
|
+
return spans;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/** Defuse any marker-shaped comment in entry content by escaping its opening `<`. The text stays
|
|
595
|
+
* readable ("<!-- /relay:memory -->"), but it is no longer a boundary anything can match. */
|
|
596
|
+
function neutralizeMarkers(text: string): string {
|
|
597
|
+
return text.replace(MARKER_SHAPED, (match) => `<${match.slice(1)}`);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* The same defusing, for text relay did not compose (#1565 F2) — applied to the caller brief AFTER
|
|
602
|
+
* `stripMemoryPreamble` has removed any real block from it.
|
|
603
|
+
*
|
|
604
|
+
* Two things it buys, both about the NEXT generation rather than this one: a caller's marker can
|
|
605
|
+
* never be mistaken for the prompt's memory block by `extractMemoryPreamble` (which the compact
|
|
606
|
+
* delta-gate reads out of the launched prompt), and it can never grow into a boundary that a future
|
|
607
|
+
* strip acts on. Cost is cosmetic and one-way: `<!--` renders as `<!--` in the brief, with every
|
|
608
|
+
* word the caller wrote still there.
|
|
609
|
+
*/
|
|
610
|
+
export function neutralizeMemoryMarkers(text: string): string {
|
|
611
|
+
return neutralizeMarkers(text);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/** A title as one neutralized line, capped at the write-time title limit. */
|
|
615
|
+
export function memoryHeadline(title: string): string {
|
|
616
|
+
const clean = neutralizeMarkers(title.trim()).replace(/\s+/g, " ");
|
|
617
|
+
return clean.length > MAX_HEADLINE_CHARS ? `${clean.slice(0, MAX_HEADLINE_CHARS - 1)}…` : clean;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/** The `— hook` half of an index line: the entry's first paragraph, collapsed and bounded. The
|
|
621
|
+
* headline says what the entry is ABOUT; the hook is what lets an agent decide whether to spend
|
|
622
|
+
* the `· Nt` on pulling it. "" when the entry has no body (the headline is the whole story). */
|
|
623
|
+
function indexHook(body: string | undefined): string {
|
|
624
|
+
const first = body?.trim().split(/\n\s*\n/)[0]?.replace(/\s+/g, " ").trim();
|
|
625
|
+
if (!first) return "";
|
|
626
|
+
const clean = neutralizeMarkers(first);
|
|
627
|
+
return clean.length > MAX_HOOK_CHARS ? `${clean.slice(0, MAX_HOOK_CHARS - 1)}…` : clean;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/** The `headline — hook` text of an index line (§4.2), shared by the renderer and the cost
|
|
631
|
+
* estimate so the price an entry is charged is the text it actually contributes. */
|
|
632
|
+
function indexText(entry: ResolvedMemoryEntry): string {
|
|
633
|
+
const hook = indexHook(entry.body);
|
|
634
|
+
return hook ? `${memoryHeadline(entry.title)} — ${hook}` : memoryHeadline(entry.title);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** The EXACT index line the renderer emits for an entry (§4.2: `- [id] headline — hook · Nt`).
|
|
638
|
+
* ONE source for both the rendered bytes and the price, so the `· Nt` an entry advertises is the
|
|
639
|
+
* cost it is actually charged. */
|
|
640
|
+
function indexLine(entry: ResolvedMemoryEntry, fullTokens: number, bare = false): string {
|
|
641
|
+
return `- [${entry.id}] ${bare ? memoryHeadline(entry.title) : indexText(entry)} · ${fullTokens}t`;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/** What an index reference costs the prompt — the estimator run over the LITERAL line above
|
|
645
|
+
* (#1979 I1, the `renderedCost` overpricing fix).
|
|
646
|
+
*
|
|
647
|
+
* It used to price the line through `estimateEntryTokens`, which adds the 24t per-ENTRY framing
|
|
648
|
+
* overhead (a title bullet, an id, a scope label) that a full row carries — but an index line is
|
|
649
|
+
* not a framed entry, it is one line of prose the composer prints verbatim, so that overhead was
|
|
650
|
+
* pure overcharge (~24t too high on EVERY index line, which is exactly the tax that made a
|
|
651
|
+
* complete index look unaffordable). `estimateTextTokens` is the chars/4 arithmetic WITHOUT the
|
|
652
|
+
* framing — the same estimator the instruction preface (also verbatim prose) is priced by.
|
|
653
|
+
*
|
|
654
|
+
* Capped at the whole entry, still: for a short entry the reference line can out-price the body it
|
|
655
|
+
* stands in for, and an index line advertising "· 47t" while costing 48t tells the agent to spend
|
|
656
|
+
* more to say less. A reference is only ever a saving. */
|
|
657
|
+
function indexRenderedCost(entry: ResolvedMemoryEntry, fullTokens: number, bare = false): number {
|
|
658
|
+
return Math.min(fullTokens, estimateTextTokens(indexLine(entry, fullTokens, bare)));
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Compose the memory block for an identity.
|
|
663
|
+
*
|
|
664
|
+
* The pipeline: narrow the identity to `opts.cells` → resolve (shared-filtered, override-collapsed,
|
|
665
|
+
* deterministically sorted) → admit in TWO passes → render pinned bodies by kind, then the index,
|
|
666
|
+
* then the accounting footer.
|
|
667
|
+
*
|
|
668
|
+
* TWO ADMISSION PASSES (#1979 I1 — "complete index by construction"):
|
|
669
|
+
* 1. FULL BODIES. `pinned` candidates compete per cell (most-specific first) for the per-scope
|
|
670
|
+
* budget and the whole-block ceiling, exactly as before. A pinned entry that does not fit is
|
|
671
|
+
* NOT dropped — it DEMOTES to the index pass, carrying the reason (`budget`/`total`).
|
|
672
|
+
* 2. THE INDEX. Demoted pinned rules come first, most-specific first, hooked while the index cap
|
|
673
|
+
* (`MEMORY_INDEX_TOKEN_CAP`) has room and hookless (title + id) past it, so none is ever
|
|
674
|
+
* omitted (#3525). Natively-`indexed` entries take what the cap has left; only they can be
|
|
675
|
+
* omitted (reason `index`), and the footer says so.
|
|
676
|
+
*
|
|
677
|
+
* DETERMINISTIC AND REPORTED throughout: first-fit in a fixed order, so the block is reproducible
|
|
678
|
+
* byte for byte, and every entry appears in `entries` with its fate — rendered, demoted, or omitted
|
|
679
|
+
* — even when NOTHING renders and the block is "" (the caller still emits the accounting event).
|
|
680
|
+
*/
|
|
681
|
+
export function composeMemoryPreamble(
|
|
682
|
+
identity: MemoryIdentity,
|
|
683
|
+
opts: ComposeMemoryPreambleOptions = {},
|
|
684
|
+
snapshot: MemoryPreambleSnapshot = readMemoryPreambleSnapshot(identity, opts),
|
|
685
|
+
): ComposedMemoryPreamble {
|
|
686
|
+
const budget = opts.scopeTokenBudget ?? MEMORY_SCOPE_TOKEN_CAP;
|
|
687
|
+
const totalBudget = opts.totalTokenBudget ?? MEMORY_TOTAL_TOKEN_CAP;
|
|
688
|
+
// …and never more than HALF the ceiling, so protecting base can never starve the specific cells
|
|
689
|
+
// the ceiling is meant to favour. At the defaults (2048 of 4096) the two halves are equal.
|
|
690
|
+
const baseFloor = Math.max(0, Math.min(opts.baseTokenFloor ?? MEMORY_BASE_TOKEN_FLOOR, budget, Math.floor(totalBudget / 2)));
|
|
691
|
+
const instructionBudget = Math.max(0, opts.instructionTokenBudget ?? MEMORY_INSTRUCTION_TOKEN_CAP);
|
|
692
|
+
const indexBudget = Math.max(0, opts.indexTokenBudget ?? MEMORY_INDEX_TOKEN_CAP);
|
|
693
|
+
|
|
694
|
+
const narrowed = scopedIdentity(identity, opts.cells);
|
|
695
|
+
// ONE shared filter with the project render path (#1565 P5.4) — audience, tier, sensitivity and
|
|
696
|
+
// TTL are decided by `entryInjectability`, and every refusal comes back itemized so no drop is
|
|
697
|
+
// silent. `inject:'never'` is refused THERE now (pre-collapse), not skipped here.
|
|
698
|
+
const { entries: resolved, drops: filtered } = snapshot.memory;
|
|
699
|
+
const filteredByReason = filtered.length ? countInjectionDrops(filtered) : emptyDropCounts();
|
|
700
|
+
// The preface resolves FIRST and unconditionally: its slug statuses are reported even when
|
|
701
|
+
// nothing renders, because "the charter is missing" is exactly the case an operator needs to
|
|
702
|
+
// see and the one with no block to state it in.
|
|
703
|
+
const instruction = resolveInstructionPreface(opts.instructionSlugs ?? MEMORY_INSTRUCTION_SLUGS, narrowed.profile, instructionBudget);
|
|
704
|
+
const budgets: MemoryPreambleBudgetReport = { scope: budget, total: totalBudget, index: indexBudget, baseReserved: 0, instruction: instructionBudget };
|
|
705
|
+
const emptyOmittedByReason = (): Record<MemoryPreambleOmission, number> => ({ index: 0, instruction: instruction.truncated });
|
|
706
|
+
const emptyDemotedByReason = (): Record<MemoryPreambleDemotion, number> => ({ budget: 0, total: 0 });
|
|
707
|
+
const empty: ComposedMemoryPreamble = {
|
|
708
|
+
block: "",
|
|
709
|
+
tokens: 0,
|
|
710
|
+
instructionTokens: 0,
|
|
711
|
+
instructionSlugs: instruction.reports,
|
|
712
|
+
entries: [],
|
|
713
|
+
omitted: 0,
|
|
714
|
+
omittedByReason: emptyOmittedByReason(),
|
|
715
|
+
demoted: 0,
|
|
716
|
+
demotedByReason: emptyDemotedByReason(),
|
|
717
|
+
scopes: [],
|
|
718
|
+
budgets,
|
|
719
|
+
filtered,
|
|
720
|
+
filteredByReason,
|
|
721
|
+
areaDeferredCount: 0,
|
|
722
|
+
counterfactualTokens: 0,
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// An empty `cells` set (Project Instructions off, now that #2154 left the project cell as the only
|
|
726
|
+
// one) still renders the PREFACE, so under shipped config OFF means a CHARTER-ONLY block, not "".
|
|
727
|
+
// Suppressing it was tried and reverted: an agent whose memory is off should still be told the
|
|
728
|
+
// store exists and that its coordinator is the fallback — otherwise the capability is invisible
|
|
729
|
+
// and it silently drops durable facts. (The retraction of an EARLIER block is handled separately,
|
|
730
|
+
// by `memoryRetractionBlock`, so that is no longer the reason.)
|
|
731
|
+
// #3508 — the startup block carries only `pinned` rules. An `indexed` entry is on demand (search,
|
|
732
|
+
// or on-touch when it names a path area) and a path-only entry of the agent's OWN project arrives
|
|
733
|
+
// when it first touches that area (#3409). Ancestor-project pinned entries stay: on-touch delivery
|
|
734
|
+
// serves the agent's own project only. Not a refusal, so it never enters `filtered`.
|
|
735
|
+
const all: Candidate[] = [];
|
|
736
|
+
const candidates: Candidate[] = [];
|
|
737
|
+
let order = 0;
|
|
738
|
+
for (const raw of resolved) {
|
|
739
|
+
isolateMemoryEntry(raw, () => {
|
|
740
|
+
const entry = { ...raw };
|
|
741
|
+
validateMemoryEntry(entry);
|
|
742
|
+
const fullTokens = estimateEntryTokens(entry);
|
|
743
|
+
const candidate: Candidate = {
|
|
744
|
+
entry,
|
|
745
|
+
nativeTier: entry.inject === "pinned" ? "pinned" : "indexed",
|
|
746
|
+
fullTokens,
|
|
747
|
+
indexTokens: indexRenderedCost(entry, fullTokens),
|
|
748
|
+
bareTokens: indexRenderedCost(entry, fullTokens, true),
|
|
749
|
+
order: order++,
|
|
750
|
+
specificity: MEMORY_SCOPE_CHAIN.indexOf(entry.cell),
|
|
751
|
+
};
|
|
752
|
+
all.push(candidate);
|
|
753
|
+
if (injectsAtStartup(entry) || (entry.inject === "pinned" && entry.projectId !== narrowed.projectId)) candidates.push(candidate);
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
const areaDeferredCount = all.length - candidates.length;
|
|
757
|
+
|
|
758
|
+
const limits = { scope: budget, total: totalBudget, index: indexBudget, baseFloor };
|
|
759
|
+
const admission = admitCandidates(candidates, limits, (overflow) => warnPinnedOverflow({
|
|
760
|
+
...overflow,
|
|
761
|
+
...(narrowed.profile ? { profile: narrowed.profile } : {}),
|
|
762
|
+
}));
|
|
763
|
+
const { outcome, byScope, omitted, demotedByReason, pinnedTokens, indexTokens } = admission;
|
|
764
|
+
budgets.baseReserved = admission.baseReserved;
|
|
765
|
+
const omittedByReason = { ...emptyOmittedByReason(), index: omitted };
|
|
766
|
+
const demoted = demotedByReason.budget + demotedByReason.total;
|
|
767
|
+
const tokens = pinnedTokens + indexTokens;
|
|
768
|
+
// What the block would have cost without the deferral: the SAME admission over every candidate,
|
|
769
|
+
// so the demotions and omissions the deferred entries would have caused are priced, not summed.
|
|
770
|
+
const counterfactual = areaDeferredCount ? admitCandidates(all, limits) : admission;
|
|
771
|
+
const counterfactualTokens = counterfactual.pinnedTokens + counterfactual.indexTokens;
|
|
772
|
+
|
|
773
|
+
// Per-cell rollup, from the settled outcomes so it is independent of which pass placed an entry.
|
|
774
|
+
const scopeReports = new Map<MemoryChainScope, MemoryPreambleScopeReport>();
|
|
775
|
+
for (const [cell, cellCandidates] of byScope) {
|
|
776
|
+
let rendered = 0;
|
|
777
|
+
let cellTokens = 0;
|
|
778
|
+
for (const candidate of cellCandidates) {
|
|
779
|
+
const o = outcome.get(candidate.order)!;
|
|
780
|
+
if (o.rendered) { rendered += 1; cellTokens += o.tokens; }
|
|
781
|
+
}
|
|
782
|
+
scopeReports.set(cell, { cell, budget, candidates: cellCandidates.length, rendered, tokens: cellTokens, omitted: cellCandidates.length - rendered });
|
|
783
|
+
}
|
|
784
|
+
const scopes = MEMORY_SCOPE_CHAIN.flatMap((cell) => scopeReports.get(cell) ?? []);
|
|
785
|
+
|
|
786
|
+
const reports: { order: number; report: MemoryPreambleEntryReport }[] = candidates.map((candidate) => ({
|
|
787
|
+
order: candidate.order,
|
|
788
|
+
report: reportFor(candidate, outcome.get(candidate.order)!),
|
|
789
|
+
}));
|
|
790
|
+
|
|
791
|
+
const pinnedRendered = candidates
|
|
792
|
+
.filter((c) => { const o = outcome.get(c.order)!; return o.tier === "pinned" && o.rendered; })
|
|
793
|
+
.sort((a, b) => a.order - b.order);
|
|
794
|
+
const indexRendered = candidates
|
|
795
|
+
.filter((c) => { const o = outcome.get(c.order)!; return o.tier === "indexed" && o.rendered; })
|
|
796
|
+
.sort((a, b) => a.order - b.order);
|
|
797
|
+
|
|
798
|
+
// "Empty templates + empty store ⇒ empty block ⇒ byte-identical spawn" (§10.1). Both halves have
|
|
799
|
+
// to be empty: an instructed agent with an empty store still gets the instruction, and an
|
|
800
|
+
// uninstructed one with entries still gets them. A deferral is content too (#3409): the block is
|
|
801
|
+
// the only place the agent learns those memories exist.
|
|
802
|
+
if (pinnedRendered.length === 0 && indexRendered.length === 0 && instruction.parts.length === 0 && areaDeferredCount === 0) {
|
|
803
|
+
return { ...empty, entries: sortReports(reports), omitted, omittedByReason, demoted, demotedByReason, scopes, budgets, areaDeferredCount, counterfactualTokens };
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// The header describes the identity the block was actually COMPOSED FOR (`narrowed`), not the
|
|
807
|
+
// one the caller holds: naming a project whose cell the walk excluded would advertise knowledge
|
|
808
|
+
// that is not in the block.
|
|
809
|
+
// #3698 — the render time sits right under the header, from the one render clock (`opts.now` is the
|
|
810
|
+
// TTL clock); content hashes strip it (memoryBlockHash).
|
|
811
|
+
const lines: string[] = [MEMORY_PREAMBLE_MARKER, memoryHeader(narrowed, snapshot.project), renderedAtLine(contextRenderNow())];
|
|
812
|
+
// The instruction preface sits between the header and the first `##` section (§10.1): inside the
|
|
813
|
+
// markers, so strip-and-replace already owns it and no second marker/strip rule exists to stack.
|
|
814
|
+
for (const part of instruction.parts) lines.push("", part);
|
|
815
|
+
let lastKind: ProjectEntryKind | null = null;
|
|
816
|
+
for (const candidate of pinnedRendered) {
|
|
817
|
+
// `pinnedRendered` is resolver-ordered and the resolver sorts by kind FIRST, so entries of one
|
|
818
|
+
// kind are contiguous and each `## heading` is emitted exactly once.
|
|
819
|
+
if (candidate.entry.kind !== lastKind) {
|
|
820
|
+
lines.push("", `## ${KIND_HEADINGS[candidate.entry.kind]}`);
|
|
821
|
+
lastKind = candidate.entry.kind;
|
|
822
|
+
}
|
|
823
|
+
// Content is neutralized, never interpolated raw — see `MARKER_SHAPED`.
|
|
824
|
+
const line = isolateMemoryEntry(candidate.entry, () => {
|
|
825
|
+
const title = neutralizeMarkers(candidate.entry.title.trim());
|
|
826
|
+
const body = candidate.entry.body?.trim();
|
|
827
|
+
return body ? `- ${title}: ${neutralizeMarkers(body)}` : `- ${title}`;
|
|
828
|
+
});
|
|
829
|
+
if (line) lines.push(line);
|
|
830
|
+
}
|
|
831
|
+
if (indexRendered.length) {
|
|
832
|
+
lines.push("", INDEX_HEADING, INDEX_FETCH_DIRECTIVE);
|
|
833
|
+
for (const candidate of indexRendered) {
|
|
834
|
+
// §4.2: `headline + hook + id + token cost`. Without the hook an index is a list of
|
|
835
|
+
// titles, and the agent has to spend a retrieval to learn what it declined to read.
|
|
836
|
+
const line = isolateMemoryEntry(candidate.entry, () => indexLine(candidate.entry, candidate.fullTokens, outcome.get(candidate.order)!.bare));
|
|
837
|
+
if (line) lines.push(line);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
lines.push("", accountingFooter(pinnedRendered.length, pinnedTokens, indexRendered.length, indexTokens, tokens, instruction.tokens, omittedByReason, demotedByReason, budgets, filteredByReason, areaDeferredCount), MEMORY_PREAMBLE_END_MARKER);
|
|
841
|
+
|
|
842
|
+
return {
|
|
843
|
+
block: lines.join("\n"),
|
|
844
|
+
tokens,
|
|
845
|
+
instructionTokens: instruction.tokens,
|
|
846
|
+
instructionSlugs: instruction.reports,
|
|
847
|
+
entries: sortReports(reports),
|
|
848
|
+
omitted,
|
|
849
|
+
omittedByReason,
|
|
850
|
+
demoted,
|
|
851
|
+
demotedByReason,
|
|
852
|
+
scopes,
|
|
853
|
+
budgets,
|
|
854
|
+
filtered,
|
|
855
|
+
filteredByReason,
|
|
856
|
+
areaDeferredCount,
|
|
857
|
+
counterfactualTokens,
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** Apply `opts.cells` by narrowing identity-only keys before resolution. `operator` and `profile`
|
|
862
|
+
* survive because they identify the caller and select audience; `ResolveMemoryOptions.cells` is
|
|
863
|
+
* the authoritative cell filter, so retaining them cannot re-enable the legacy base anchor. */
|
|
864
|
+
function scopedIdentity(identity: MemoryIdentity, cells: readonly MemoryChainScope[] | undefined): MemoryIdentity {
|
|
865
|
+
if (!cells) return identity;
|
|
866
|
+
const included = new Set(cells);
|
|
867
|
+
return {
|
|
868
|
+
...(identity.operator ? { operator: identity.operator } : {}),
|
|
869
|
+
...(identity.profile ? { profile: identity.profile } : {}),
|
|
870
|
+
...(included.has("provider") && identity.provider ? { provider: identity.provider } : {}),
|
|
871
|
+
...(included.has("host") && identity.host ? { host: identity.host } : {}),
|
|
872
|
+
...(included.has("project") && identity.projectId ? { projectId: identity.projectId } : {}),
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
function reportFor(candidate: Candidate, outcome: Outcome): MemoryPreambleEntryReport {
|
|
877
|
+
return {
|
|
878
|
+
id: candidate.entry.id,
|
|
879
|
+
kind: candidate.entry.kind,
|
|
880
|
+
title: candidate.entry.title,
|
|
881
|
+
cell: candidate.entry.cell,
|
|
882
|
+
tier: outcome.tier,
|
|
883
|
+
tokens: outcome.tokens,
|
|
884
|
+
fullTokens: candidate.fullTokens,
|
|
885
|
+
rendered: outcome.rendered,
|
|
886
|
+
...(outcome.demoted ? { demoted: true } : {}),
|
|
887
|
+
...(outcome.demotedReason ? { demotedReason: outcome.demotedReason } : {}),
|
|
888
|
+
...(outcome.omittedReason ? { omittedReason: outcome.omittedReason } : {}),
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/** Reports come back in the RESOLVER's order regardless of which pass produced them, so the
|
|
893
|
+
* telemetry a spawn emits is as reproducible as the block itself. */
|
|
894
|
+
function sortReports(reports: { order: number; report: MemoryPreambleEntryReport }[]): MemoryPreambleEntryReport[] {
|
|
895
|
+
return [...reports].sort((a, b) => a.order - b.order).map(({ report }) => report);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/** `# Memory — worker @ wbox-1 · humwick` (§4.2). Built from the identity alone, so it is
|
|
899
|
+
* stable across spawns of the same agent shape. */
|
|
900
|
+
function memoryHeader(identity: MemoryIdentity, project: MemoryPreambleSnapshot["project"]): string {
|
|
901
|
+
const who = [identity.profile?.trim() || "agent", identity.host?.trim() ? `@ ${identity.host.trim()}` : ""]
|
|
902
|
+
.filter(Boolean)
|
|
903
|
+
.join(" ");
|
|
904
|
+
// The SLUG rides beside the title (never instead of it): the fetch directive below tells the
|
|
905
|
+
// agent to call relay_project_read, and a cwd the relay cannot resolve to a project answers
|
|
906
|
+
// "no project: pass `project`" — with nothing in the block to pass. A title is not an accepted
|
|
907
|
+
// ref; the slug is. Omitted when they are the same string, so the common case costs nothing.
|
|
908
|
+
const label = project ? (project.title?.trim() || project.slug) : "";
|
|
909
|
+
const where = project ? ` · ${label}${label === project.slug ? "" : ` (${project.slug})`}` : "";
|
|
910
|
+
// Neutralized like entry content: a profile name / hostname / project title is data too.
|
|
911
|
+
return neutralizeMarkers(`# Memory — ${who}${where}`);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function entriesLabel(count: number): string {
|
|
915
|
+
return `${count} ${count === 1 ? "entry" : "entries"}`;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/** The §4.2 accounting line: what was injected, what it cost, what was dropped, and how to get
|
|
919
|
+
* the rest. This is the agent-facing half of the token transparency the epic asks for. */
|
|
920
|
+
function accountingFooter(
|
|
921
|
+
pinnedCount: number,
|
|
922
|
+
pinnedTokens: number,
|
|
923
|
+
indexCount: number,
|
|
924
|
+
indexTokens: number,
|
|
925
|
+
tokens: number,
|
|
926
|
+
instructionTokens: number,
|
|
927
|
+
omittedByReason: Record<MemoryPreambleOmission, number>,
|
|
928
|
+
demotedByReason: Record<MemoryPreambleDemotion, number>,
|
|
929
|
+
budgets: MemoryPreambleBudgetReport,
|
|
930
|
+
filteredByReason: InjectionDropCounts,
|
|
931
|
+
areaDeferredCount: number,
|
|
932
|
+
): string {
|
|
933
|
+
// The preface is priced beside the entries rather than folded into them: it is charged against a
|
|
934
|
+
// different cap, and an agent reading "= N tokens" is owed the number it actually pays.
|
|
935
|
+
const parts = [
|
|
936
|
+
pinnedCount ? `${entriesLabel(pinnedCount)} pinned (${pinnedTokens}t)` : "",
|
|
937
|
+
indexCount ? `${indexCount} indexed headline${indexCount === 1 ? "" : "s"} (${indexTokens}t)` : "",
|
|
938
|
+
instructionTokens ? `instructions (${instructionTokens}t)` : "",
|
|
939
|
+
].filter(Boolean);
|
|
940
|
+
// Nothing priced is reachable only when every entry was deferred (#3409).
|
|
941
|
+
const cost = parts.length ? `${parts.join(" + ")} = ${tokens + instructionTokens} tokens` : "0 tokens";
|
|
942
|
+
return `_Injected memory: ${cost}.${omissionSentence(omittedByReason, demotedByReason, budgets)}${filterSentence(filteredByReason)}${areaDeferredSentence(areaDeferredCount)} Full list: relay_project_read()._`;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* The filter's drops, stated IN THE BLOCK (#1565 P5.4) — counts and causes only, never a title.
|
|
947
|
+
*
|
|
948
|
+
* An agent that is told "2 entries were not injectable" can ask, or retrieve; one told nothing
|
|
949
|
+
* cannot tell "there is no such rule" from "there is a rule you were not given", which is the
|
|
950
|
+
* difference between a bounded prompt and a misleading one. Counts are safe where content is not:
|
|
951
|
+
* naming a sensitive entry is the leak the refusal exists to prevent.
|
|
952
|
+
*/
|
|
953
|
+
function filterSentence(filteredByReason: InjectionDropCounts): string {
|
|
954
|
+
const described = describeInjectionDrops(filteredByReason);
|
|
955
|
+
if (!described) return "";
|
|
956
|
+
const total = Object.values(filteredByReason).reduce((sum, count) => sum + count, 0);
|
|
957
|
+
return ` ${entriesLabel(total)} not injectable (${described}).`;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/** #3409/#3508 — deferred entries are not refusals, so they get their own sentence. Counts only. */
|
|
961
|
+
function areaDeferredSentence(count: number): string {
|
|
962
|
+
if (!count) return "";
|
|
963
|
+
return ` ${count === 1 ? "1 memory loads" : `${count} memories load`} on demand: when you first touch a file in ${count === 1 ? "its" : "their"} area, or via relay_project_search.`;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* The one true entry loss, with its cause (#1979 I1). Since I1 an injectable entry is dropped ONLY
|
|
968
|
+
* when even a one-line index reference will not fit the index cap — every budget/ceiling miss now
|
|
969
|
+
* DEMOTES to the index instead (see `describeMemoryDemotions`). So this describes the `index` reason
|
|
970
|
+
* alone.
|
|
971
|
+
*
|
|
972
|
+
* Exported so the block's footer and the `relay-injection` event's summary say the same thing — the
|
|
973
|
+
* agent and the operator must not be told different stories about the same drop. `budgets` adds the
|
|
974
|
+
* actual cap; omit it where the line has to stay short.
|
|
975
|
+
*
|
|
976
|
+
* ENTRY drops only. The `instruction` reason is described by `describeInstructionTruncation`,
|
|
977
|
+
* because every caller of this one renders it inside an "N entries omitted (…)" sentence and a
|
|
978
|
+
* truncated instruction slug is not an entry.
|
|
979
|
+
*/
|
|
980
|
+
export function describeMemoryOmissions(
|
|
981
|
+
omittedByReason: Record<MemoryPreambleOmission, number>,
|
|
982
|
+
budgets?: MemoryPreambleBudgetReport,
|
|
983
|
+
): string {
|
|
984
|
+
if (!omittedByReason.index) return "";
|
|
985
|
+
return `${omittedByReason.index} over the ${budgets ? `${budgets.index}t ` : ""}index cap`;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* The DEMOTIONS, with their real cause (#1979 I1 — the softening that replaced the old omission).
|
|
990
|
+
* A `pinned` entry the full-body budget could not fit is not dropped; it is rendered as a one-line
|
|
991
|
+
* index reference, and this names WHY its body did not fit: a cell's own per-scope budget vs. the
|
|
992
|
+
* whole-block ceiling. Different levers (#1602's discipline), so they stay distinct.
|
|
993
|
+
*
|
|
994
|
+
* Exported for the same reason as `describeMemoryOmissions`: the footer and the event must agree.
|
|
995
|
+
*/
|
|
996
|
+
export function describeMemoryDemotions(
|
|
997
|
+
demotedByReason: Record<MemoryPreambleDemotion, number>,
|
|
998
|
+
budgets?: MemoryPreambleBudgetReport,
|
|
999
|
+
): string {
|
|
1000
|
+
// The ceiling a non-base cell actually spent against is the ceiling MINUS base's reservation
|
|
1001
|
+
// (#1565 F4). Naming only the raw ceiling points at a number the demotion did not happen at.
|
|
1002
|
+
const ceiling = budgets
|
|
1003
|
+
? `${budgets.total}t ${budgets.baseReserved > 0 ? `whole-block cap (${budgets.total - budgets.baseReserved}t for cells other than base, which reserves ${budgets.baseReserved}t)` : "whole-block cap"}`
|
|
1004
|
+
: "whole-block cap";
|
|
1005
|
+
return [
|
|
1006
|
+
demotedByReason.budget ? `${demotedByReason.budget} over the ${budgets ? `${budgets.scope}t ` : ""}per-cell budget` : "",
|
|
1007
|
+
demotedByReason.total ? `${demotedByReason.total} over the ${ceiling}` : "",
|
|
1008
|
+
].filter(Boolean).join(", ");
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
function omissionSentence(
|
|
1012
|
+
omittedByReason: Record<MemoryPreambleOmission, number>,
|
|
1013
|
+
demotedByReason: Record<MemoryPreambleDemotion, number>,
|
|
1014
|
+
budgets: MemoryPreambleBudgetReport,
|
|
1015
|
+
): string {
|
|
1016
|
+
const demoted = demotedByReason.budget + demotedByReason.total;
|
|
1017
|
+
// Demotion first (a softening — the entry is still in the block, in the index), then the rare
|
|
1018
|
+
// true omission, then instruction truncation. Each is a separate cause with a separate fix, so
|
|
1019
|
+
// none is folded into another's count (#1602's discipline).
|
|
1020
|
+
const demotionSentence = demoted ? ` ${entriesLabel(demoted)} demoted to the index (${describeMemoryDemotions(demotedByReason, budgets)}).` : "";
|
|
1021
|
+
const omittedSentence = omittedByReason.index ? ` ${entriesLabel(omittedByReason.index)} omitted (${describeMemoryOmissions(omittedByReason, budgets)}; oldest and least role-specific first — relay_project_search finds them).` : "";
|
|
1022
|
+
return `${demotionSentence}${omittedSentence}${describeInstructionTruncation(omittedByReason, budgets)}`;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* The instruction slugs that did not resolve AT ALL — a slug in neither the store nor the shipped
|
|
1027
|
+
* defaults (`missing`), or one whose resolution threw (`failed`). Both mean the preface is quietly
|
|
1028
|
+
* shorter than the operator believes it is.
|
|
1029
|
+
*
|
|
1030
|
+
* `blank` is deliberately NOT a defect: a blanked slug is §10.3.5's K2 kill switch WORKING, and
|
|
1031
|
+
* counting it here would make every deliberately-uninstructed agent report a defect at every
|
|
1032
|
+
* boundary. `truncated` is not here either — it has its own reason (`omittedByReason.instruction`)
|
|
1033
|
+
* and its own clause (`describeInstructionTruncation`), and reporting it twice would double-count
|
|
1034
|
+
* one slug. `rendered` with an `error` is a degraded-to-shipped-default render: text DID reach the
|
|
1035
|
+
* prompt, so it is not this list's business.
|
|
1036
|
+
*/
|
|
1037
|
+
export function unresolvedInstructionSlugs(reports: readonly MemoryInstructionReport[]): MemoryInstructionReport[] {
|
|
1038
|
+
return reports.filter((report) => report.status === "missing" || report.status === "failed");
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/** The instruction-side clause for slugs that did not resolve at all — the twin of
|
|
1042
|
+
* `describeInstructionTruncation`, for the defect that produces NO text rather than short text.
|
|
1043
|
+
* "" when every requested slug resolved (or was deliberately blanked), so callers can splice it
|
|
1044
|
+
* into a sentence unconditionally. */
|
|
1045
|
+
export function describeUnresolvedInstructions(reports: readonly MemoryInstructionReport[]): string {
|
|
1046
|
+
const unresolved = unresolvedInstructionSlugs(reports);
|
|
1047
|
+
if (!unresolved.length) return "";
|
|
1048
|
+
const slugs = unresolved.length === 1 ? "slug" : "slugs";
|
|
1049
|
+
const named = unresolved.map((report) => `${report.resolved}: ${report.status}`).join(", ");
|
|
1050
|
+
return ` ${unresolved.length} instruction ${slugs} did not resolve (${named}).`;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/** The instruction-side omission clause (§10.1's `instruction` reason). Exported so the block's
|
|
1054
|
+
* footer and the `relay-injection` summaries say the same thing about the same truncation. */
|
|
1055
|
+
export function describeInstructionTruncation(
|
|
1056
|
+
omittedByReason: Record<MemoryPreambleOmission, number>,
|
|
1057
|
+
budgets?: MemoryPreambleBudgetReport,
|
|
1058
|
+
): string {
|
|
1059
|
+
if (!omittedByReason.instruction) return "";
|
|
1060
|
+
const cap = budgets ? `${budgets.instruction}t ` : "";
|
|
1061
|
+
const slugs = omittedByReason.instruction === 1 ? "slug" : "slugs";
|
|
1062
|
+
return ` ${omittedByReason.instruction} instruction ${slugs} truncated at the ${cap}instruction cap (charged outside the entry budgets — no entry was dropped for it).`;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// #2097 — a TRANSPORT bound on the spawn memory-injection EVENT detail (NOT the injected block).
|
|
1066
|
+
//
|
|
1067
|
+
// #1979 Wave A (55d4422d) made the index "complete by construction": the composed `entries` and
|
|
1068
|
+
// `filtered` arrays now enumerate EVERY entry — injected, demoted, and every not-injectable one —
|
|
1069
|
+
// each with a title up to 120 chars. Those arrays grow with the whole store, so a large store
|
|
1070
|
+
// pushed the spawn memory event's `detail` past the 64 KiB `cleanParams` payload cap
|
|
1071
|
+
// (src/validation.ts, POST /api/messages). The spawn event is emitted by the RUNNER over HTTP, so
|
|
1072
|
+
// that POST was rejected and the visible "injected memory" timeline entry silently vanished for
|
|
1073
|
+
// large-memory agents — while the block itself still injected via `systemPromptAppend` (a separate
|
|
1074
|
+
// field). The clear/compact re-inject event is emitted server-side (emitRelayInjectionEvent →
|
|
1075
|
+
// sendMessageWithResult) and never goes through that route, so it is deliberately NOT bounded here.
|
|
1076
|
+
//
|
|
1077
|
+
// The bound is by COUNT, not by measuring bytes: per-entry size is already bounded (titles capped at
|
|
1078
|
+
// 120 chars by #1979, ids/cells/reasons short), so a fixed head count gives an arithmetic ceiling
|
|
1079
|
+
// well under 64 KiB regardless of how many entries the store holds. The dashboard cost panel
|
|
1080
|
+
// (MemoryInjectionCost.tsx) reads authoritative `*Total`/`*Count` scalars the caller sets before
|
|
1081
|
+
// bounding, so its headline numbers stay exact even when the arrays are trimmed; it renders a
|
|
1082
|
+
// "N more" tail from the same totals.
|
|
1083
|
+
export const SPAWN_MEMORY_EVENT_MAX_ENTRIES = 50;
|
|
1084
|
+
export const SPAWN_MEMORY_EVENT_MAX_FILTERED = 50;
|
|
1085
|
+
export const SPAWN_MEMORY_EVENT_MAX_CONTENT_CHARS = 16_384;
|
|
1086
|
+
/** Serialized-byte backstop threshold — safely under the 64 KiB (`65_536`) `cleanParams` cap. The
|
|
1087
|
+
* fixed head/char caps above assume per-entry size is bounded (titles ≤120), but that cap is only
|
|
1088
|
+
* enforced at the MCP write boundary: blackboard-promotion, consolidation, imports and legacy
|
|
1089
|
+
* pre-#1979 rows can persist longer titles. So after the head trim we MEASURE the actual payload
|
|
1090
|
+
* and shed further until under this threshold — defending every field, not just title length
|
|
1091
|
+
* (#2097 review GAP-1). */
|
|
1092
|
+
export const SPAWN_MEMORY_EVENT_MAX_DETAIL_BYTES = 60_000;
|
|
1093
|
+
|
|
1094
|
+
const SPAWN_MEMORY_EVENT_CONTENT_TRUNCATED_SUFFIX = "\n\n… (block truncated for the timeline event — the full block is in the agent's context)";
|
|
1095
|
+
|
|
1096
|
+
/** Trim the heavy, store-size-dependent fields of a spawn memory-injection event `detail` so the
|
|
1097
|
+
* POSTed session payload stays comfortably under the 64 KiB `cleanParams` cap regardless of store
|
|
1098
|
+
* size AND regardless of any single field's size. Returns a shallow copy — the input (and the
|
|
1099
|
+
* composed preamble it came from) is untouched. Only `entries`, `filtered` and `content` are
|
|
1100
|
+
* bounded; every scalar/accounting field is preserved verbatim, so the authoritative counts the
|
|
1101
|
+
* caller attached survive (the dashboard renders exact totals + a "N more" tail from them). */
|
|
1102
|
+
export function boundMemoryInjectionEventDetail(detail: Record<string, unknown>): Record<string, unknown> {
|
|
1103
|
+
const out: Record<string, unknown> = { ...detail };
|
|
1104
|
+
// Pass 1 — fixed head/char caps: the common large-store case is bounded in one shot.
|
|
1105
|
+
if (Array.isArray(out.entries) && out.entries.length > SPAWN_MEMORY_EVENT_MAX_ENTRIES) {
|
|
1106
|
+
out.entries = out.entries.slice(0, SPAWN_MEMORY_EVENT_MAX_ENTRIES);
|
|
1107
|
+
}
|
|
1108
|
+
if (Array.isArray(out.filtered) && out.filtered.length > SPAWN_MEMORY_EVENT_MAX_FILTERED) {
|
|
1109
|
+
out.filtered = out.filtered.slice(0, SPAWN_MEMORY_EVENT_MAX_FILTERED);
|
|
1110
|
+
}
|
|
1111
|
+
if (typeof out.content === "string" && out.content.length > SPAWN_MEMORY_EVENT_MAX_CONTENT_CHARS) {
|
|
1112
|
+
out.content = `${out.content.slice(0, SPAWN_MEMORY_EVENT_MAX_CONTENT_CHARS)}${SPAWN_MEMORY_EVENT_CONTENT_TRUNCATED_SUFFIX}`;
|
|
1113
|
+
out.contentTruncated = true;
|
|
1114
|
+
}
|
|
1115
|
+
// Pass 2 — serialized-byte backstop (#2097 GAP-1): if the head-trimmed detail still exceeds the
|
|
1116
|
+
// threshold (e.g. a handful of entries with pathologically long titles that never went through
|
|
1117
|
+
// the ≤120 MCP write cap), shed until under. Content is cut first (the full block is already in
|
|
1118
|
+
// the agent's context), then entries/filtered one at a time from the tail; the authoritative
|
|
1119
|
+
// count scalars are never touched, so the panel's totals + "N more" stay exact. Guaranteed to
|
|
1120
|
+
// terminate: every iteration strictly shrinks a field, and once the arrays are empty and the
|
|
1121
|
+
// content copy is gone only bounded scalars remain (well under the threshold).
|
|
1122
|
+
while (JSON.stringify(out).length > SPAWN_MEMORY_EVENT_MAX_DETAIL_BYTES) {
|
|
1123
|
+
if (typeof out.content === "string" && out.content.length > 2_000) {
|
|
1124
|
+
out.content = `${out.content.slice(0, 2_000)}${SPAWN_MEMORY_EVENT_CONTENT_TRUNCATED_SUFFIX}`;
|
|
1125
|
+
out.contentTruncated = true;
|
|
1126
|
+
continue;
|
|
1127
|
+
}
|
|
1128
|
+
const entries = Array.isArray(out.entries) ? (out.entries as unknown[]) : [];
|
|
1129
|
+
const filtered = Array.isArray(out.filtered) ? (out.filtered as unknown[]) : [];
|
|
1130
|
+
if (entries.length > 0 && entries.length >= filtered.length) {
|
|
1131
|
+
out.entries = entries.slice(0, entries.length - 1);
|
|
1132
|
+
} else if (filtered.length > 0) {
|
|
1133
|
+
out.filtered = filtered.slice(0, filtered.length - 1);
|
|
1134
|
+
} else if (typeof out.content === "string" && out.content.length > 0) {
|
|
1135
|
+
out.content = "… (block omitted for the timeline event — the full block is in the agent's context)";
|
|
1136
|
+
out.contentTruncated = true;
|
|
1137
|
+
} else {
|
|
1138
|
+
break;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
return out;
|
|
1142
|
+
}
|