@north-light/crouter 0.3.311 → 0.3.313
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/dist/api/client.d.ts +27 -30
- package/dist/api/client.js +80 -67
- package/dist/api/dto/broker-ops.d.ts +10 -20
- package/dist/api/dto/canvas.d.ts +1 -10
- package/dist/api/dto/health.d.ts +113 -0
- package/dist/api/dto/human-requests.d.ts +14 -3
- package/dist/api/dto/human.d.ts +2 -48
- package/dist/api/dto/human.js +3 -2
- package/dist/api/dto/inbox.d.ts +14 -0
- package/dist/api/dto/mail.d.ts +43 -0
- package/dist/api/dto/nodes.d.ts +11 -8
- package/dist/api/dto/recovery.d.ts +96 -0
- package/dist/api/dto/reviews.d.ts +2 -2
- package/dist/api/routes.d.ts +9 -6
- package/dist/api/routes.js +11 -11
- package/dist/build-root.d.ts +4 -0
- package/dist/build-root.js +11 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/integration/provider-rotation.test.ts +35 -47
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.d.ts +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.js +12 -5
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +12 -5
- package/dist/cli.js +10 -1
- package/dist/clients/__tests__/helpers/human-daemon.d.ts +11 -0
- package/dist/clients/__tests__/helpers/human-daemon.js +60 -0
- package/dist/clients/attach/chrome/canvas-panels.js +1 -1
- package/dist/clients/attach/chrome/inbox-strip.d.ts +3 -3
- package/dist/clients/attach/chrome/inbox-strip.js +17 -9
- package/dist/clients/attach/chrome/ticket-panel.d.ts +2 -2
- package/dist/clients/attach/chrome/ticket-panel.js +77 -46
- package/dist/clients/attach/overlays/graph.js +6 -9
- package/dist/clients/attach/render/chat-view.d.ts +5 -4
- package/dist/clients/attach/render/chat-view.js +22 -13
- package/dist/clients/attach/render/page-block.d.ts +11 -7
- package/dist/clients/attach/render/page-block.js +64 -55
- package/dist/clients/attach/viewer.js +746 -735
- package/dist/clients/inbox/__tests__/integration/inbox-controller.test.js +56 -56
- package/dist/clients/inbox/__tests__/integration/stale-row-activation.test.js +45 -32
- package/dist/clients/inbox/controller.d.ts +42 -14
- package/dist/clients/inbox/controller.js +240 -124
- package/dist/clients/inbox/dto-adapt.d.ts +28 -0
- package/dist/clients/inbox/dto-adapt.js +93 -0
- package/dist/clients/inbox/page-adapter.d.ts +5 -4
- package/dist/clients/inbox/page-adapter.js +12 -12
- package/dist/clients/inbox/resolve.d.ts +10 -5
- package/dist/clients/inbox/resolve.js +13 -12
- package/dist/clients/inbox/review/review-client.d.ts +0 -1
- package/dist/clients/inbox/review/review-client.js +0 -4
- package/dist/clients/inbox/review-adapter.d.ts +2 -1
- package/dist/clients/inbox/review-adapter.js +3 -5
- package/dist/clients/inbox/surface.d.ts +2 -2
- package/dist/clients/inbox/surface.js +19 -8
- package/dist/clients/inbox/tui.d.ts +3 -3
- package/dist/commands/__tests__/human.test.js +31 -15
- package/dist/commands/__tests__/integration/dashboard-snapshot.test.js +36 -11
- package/dist/commands/{sys/__tests__ → __tests__/integration}/migrate.test.js +142 -36
- package/dist/commands/__tests__/revive-now-gate.test.js +2 -0
- package/dist/commands/api-client.d.ts +5 -4
- package/dist/commands/api-client.js +13 -7
- package/dist/commands/canvas-history/shared.js +1 -1
- package/dist/commands/canvas-history.js +1 -1
- package/dist/commands/canvas-roster.js +1 -1
- package/dist/commands/canvas.js +1 -2
- package/dist/commands/human/feedback.js +20 -17
- package/dist/commands/human/prompts.js +45 -36
- package/dist/commands/human/queue.js +73 -123
- package/dist/commands/human/review.js +6 -16
- package/dist/commands/memory/__tests__/command-selector-and-mutation-guards.test.js +2 -0
- package/dist/commands/memory/__tests__/memory-list-and-lint-ignore.test.js +2 -0
- package/dist/commands/memory/__tests__/repository-root-lint.test.js +2 -0
- package/dist/commands/node-inspect-artifacts.js +1 -1
- package/dist/commands/node-lifecycle-revive.d.ts +2 -2
- package/dist/commands/node-lifecycle-revive.js +9 -19
- package/dist/commands/pkg/plugin-manage.js +0 -1
- package/dist/commands/profile/show.js +4 -12
- package/dist/commands/surface-tmux-spread.js +1 -5
- package/dist/commands/sys/__tests__/config-model-ladders.test.js +23 -30
- package/dist/commands/sys/__tests__/sync-project-guidance.test.js +37 -11
- package/dist/commands/sys/branch.d.ts +2 -0
- package/dist/commands/sys/branch.js +19 -0
- package/dist/commands/sys/config.js +106 -33
- package/dist/commands/sys/daemon.d.ts +2 -0
- package/dist/commands/sys/daemon.js +130 -7
- package/dist/commands/sys/doctor.js +5 -15
- package/dist/commands/sys/migrate.js +21 -92
- package/dist/commands/sys/setup-settings-runner.js +4 -2
- package/dist/commands/sys.js +2 -15
- package/dist/core/__tests__/boot-fault-attempt.test.js +23 -1
- package/dist/core/__tests__/boot.test.js +32 -25
- package/dist/core/__tests__/broker-launch-candidates.test.js +49 -0
- package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +149 -176
- package/dist/core/__tests__/canvas-inbox-watcher-naming.test.js +59 -10
- package/dist/core/__tests__/canvas-inbox-watcher.test.js +76 -20
- package/dist/core/__tests__/canvas.test.js +18 -47
- package/dist/core/__tests__/child-death-wake.test.js +29 -7
- package/dist/core/__tests__/cli-help-contract.test.js +2 -0
- package/dist/core/__tests__/close.test.js +29 -10
- package/dist/core/__tests__/collectible.test.js +2 -1
- package/dist/core/__tests__/config-change-delta.test.js +2 -0
- package/dist/core/__tests__/context-intro.test.js +17 -5
- package/dist/core/__tests__/cron-armed-context-failure.test.js +17 -12
- package/dist/core/__tests__/cron-held-settlement.test.js +21 -3
- package/dist/core/__tests__/cron-node-sink-parked-root.test.js +29 -10
- package/dist/core/__tests__/cron-self-cancel-delivery.test.js +14 -2
- package/dist/core/__tests__/cron-timeout-descendants.test.js +13 -1
- package/dist/core/__tests__/daemon-boot.test.js +51 -14
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +1 -1
- package/dist/core/__tests__/fixtures/fake-engine.js +8 -3
- package/dist/core/__tests__/focuses.test.js +10 -5
- package/dist/core/__tests__/helpers/harness.js +50 -18
- package/dist/core/__tests__/history-inbox.test.js +12 -16
- package/dist/core/__tests__/human-action-delivery.test.js +48 -28
- package/dist/core/__tests__/human-actions.test.js +7 -3
- package/dist/core/__tests__/inline-memory-refs.test.js +7 -2
- package/dist/core/__tests__/integration/broker-fork-seam.test.js +37 -10
- package/dist/core/__tests__/integration/broker-sdk-wiring.test.js +42 -0
- package/dist/core/__tests__/integration/broker-snapshot-history.test.js +42 -29
- package/dist/core/__tests__/integration/broker-wedge-supervision.test.js +36 -35
- package/dist/core/__tests__/integration/command-plugins.test.js +15 -6
- package/dist/core/__tests__/integration/deferred-no-wake.test.js +113 -92
- package/dist/core/__tests__/integration/host-teardown-process-group.test.js +9 -5
- package/dist/core/__tests__/integration/lifecycle-hooks.test.js +312 -1
- package/dist/core/__tests__/integration/plugin-revalidate.test.js +4 -0
- package/dist/core/__tests__/integration/profile-pause.test.js +4 -4
- package/dist/core/__tests__/integration/refresh-stall-recycle.test.js +9 -12
- package/dist/core/__tests__/integration/revive.test.js +67 -21
- package/dist/core/__tests__/integration/spawn-root.test.js +62 -19
- package/dist/core/__tests__/integration/subscription-delivery.test.js +33 -21
- package/dist/core/__tests__/integration/worktree-land.test.js +5 -2
- package/dist/core/__tests__/integration/worktree-reap.test.js +15 -1
- package/dist/core/__tests__/kickoff.test.js +36 -39
- package/dist/core/__tests__/lifecycle-terminal-reasons.test.js +2 -1
- package/dist/core/__tests__/lifecycle.test.js +2 -1
- package/dist/core/__tests__/live-lifecycle-prompt.test.js +13 -1
- package/dist/core/__tests__/memory-resolver-precedence.test.js +2 -0
- package/dist/core/__tests__/migration.test.js +145 -31
- package/dist/core/__tests__/model-pin-durability.test.js +4 -1
- package/dist/core/__tests__/model-routes-config.test.js +13 -5
- package/dist/core/__tests__/node-outcome.test.js +93 -26
- package/dist/core/__tests__/on-read-crouter-home-fence.test.js +4 -3
- package/dist/core/__tests__/on-read-dedup-resume.test.js +8 -7
- package/dist/core/__tests__/on-read-nested-store.test.js +8 -7
- package/dist/core/__tests__/passive-subscription.test.js +50 -157
- package/dist/core/__tests__/plugin-kinds.test.js +6 -4
- package/dist/core/__tests__/plugin-link-symlinked-scope-root.test.js +6 -1
- package/dist/core/__tests__/plugin-page-components.test.js +6 -4
- package/dist/core/__tests__/preview-registry-sync.test.js +2 -0
- package/dist/core/__tests__/profile-project-memory-delivery.test.js +35 -32
- package/dist/core/__tests__/prune.test.js +11 -5
- package/dist/core/__tests__/push-final-guard.test.js +14 -7
- package/dist/core/__tests__/relaunch-root.test.js +30 -2
- package/dist/core/__tests__/remote-canvas-target.test.js +7 -1
- package/dist/core/__tests__/repository-root-identity.test.js +4 -0
- package/dist/core/__tests__/review-model-floor.test.js +6 -3
- package/dist/core/__tests__/revive-all.test.js +13 -3
- package/dist/core/__tests__/revive-capacity.test.js +26 -4
- package/dist/core/__tests__/revive-parked-fresh.test.js +31 -8
- package/dist/core/__tests__/seam/broker-attach-stream.test.js +1 -1
- package/dist/core/__tests__/seam/broker-cap-freeze.test.js +4 -3
- package/dist/core/__tests__/seam/broker-crash-teardown.test.js +11 -14
- package/dist/core/__tests__/seam/broker-provider-retry.test.js +85 -71
- package/dist/core/__tests__/seam/dormancy-release.test.js +33 -19
- package/dist/core/__tests__/seam/held-deferred-human-prompt.test.js +7 -5
- package/dist/core/__tests__/seam/inbox-reference-guidance.test.js +20 -6
- package/dist/core/__tests__/seam/node-outcome-delivery.test.js +27 -3
- package/dist/core/__tests__/spawn-worktree-id-conflict.test.js +5 -4
- package/dist/core/__tests__/stop-guard.test.js +2 -1
- package/dist/core/__tests__/subscription-pool-credential-guard.test.js +4 -3
- package/dist/core/__tests__/warm-claim-preference-snapshot.test.js +19 -5
- package/dist/core/__tests__/yield-ensures-daemon.test.js +2 -1
- package/dist/core/bootstrap.js +2 -0
- package/dist/core/broker-client/__tests__/transport-socket.test.js +51 -6
- package/dist/core/broker-client/transport-socket.d.ts +1 -0
- package/dist/core/broker-client/transport-socket.js +13 -5
- package/dist/core/canvas/__tests__/attention.test.js +29 -35
- package/dist/core/canvas/__tests__/history-transcript.test.js +6 -6
- package/dist/core/canvas/__tests__/render-remote.test.js +25 -9
- package/dist/core/canvas/attention.d.ts +2 -5
- package/dist/core/canvas/attention.js +15 -64
- package/dist/core/canvas/boot.d.ts +6 -7
- package/dist/core/canvas/boot.js +5 -9
- package/dist/core/canvas/canvas.d.ts +13 -109
- package/dist/core/canvas/canvas.js +140 -401
- package/dist/core/canvas/crons.d.ts +2 -0
- package/dist/core/canvas/crons.js +16 -15
- package/dist/core/canvas/daemon-owner.js +10 -0
- package/dist/core/canvas/db.d.ts +2 -2
- package/dist/core/canvas/db.js +2 -18
- package/dist/core/canvas/deliveries.d.ts +104 -0
- package/dist/core/canvas/deliveries.js +354 -0
- package/dist/core/canvas/executions.d.ts +29 -0
- package/dist/core/canvas/executions.js +68 -0
- package/dist/core/canvas/history.js +35 -35
- package/dist/core/canvas/index.d.ts +3 -1
- package/dist/core/canvas/index.js +3 -1
- package/dist/core/canvas/migrations.js +20 -12
- package/dist/core/canvas/nav-model.js +1 -3
- package/dist/core/canvas/nav-render.d.ts +4 -4
- package/dist/core/canvas/nav-render.js +11 -21
- package/dist/core/canvas/node-sql-migration.d.ts +3 -0
- package/dist/core/canvas/node-sql-migration.js +261 -0
- package/dist/core/canvas/paths.d.ts +2 -16
- package/dist/core/canvas/paths.js +2 -31
- package/dist/core/canvas/recovery.d.ts +76 -0
- package/dist/core/canvas/recovery.js +588 -0
- package/dist/core/canvas/remote-canvas-source.js +4 -0
- package/dist/core/canvas/render-source.d.ts +16 -27
- package/dist/core/canvas/render-source.js +16 -45
- package/dist/core/canvas/sessions.d.ts +33 -0
- package/dist/core/canvas/sessions.js +78 -0
- package/dist/core/canvas/types.d.ts +33 -33
- package/dist/core/canvas/types.js +2 -5
- package/dist/core/canvas/waits.d.ts +18 -0
- package/dist/core/canvas/waits.js +70 -0
- package/dist/core/canvas/worktrees.d.ts +40 -0
- package/dist/core/canvas/worktrees.js +93 -0
- package/dist/core/command-hooks/artifact.d.ts +6 -0
- package/dist/core/command-hooks/artifact.js +22 -6
- package/dist/core/command-hooks/discovery.d.ts +2 -0
- package/dist/core/command-hooks/discovery.js +2 -0
- package/dist/core/command-hooks/lifecycle-catalog.d.ts +20 -2
- package/dist/core/command-hooks/lifecycle-catalog.js +7 -2
- package/dist/core/command-hooks/lifecycle-create.d.ts +4 -0
- package/dist/core/command-hooks/lifecycle-create.js +51 -0
- package/dist/core/command-hooks/schema.d.ts +2 -2
- package/dist/core/command-hooks/schema.js +5 -4
- package/dist/core/command-hooks/transport/exec-invoke.js +3 -1
- package/dist/core/command-hooks/transport/exec-lifecycle.d.ts +18 -8
- package/dist/core/command-hooks/transport/exec-lifecycle.js +89 -30
- package/dist/core/config.d.ts +17 -12
- package/dist/core/config.js +106 -155
- package/dist/core/errors.d.ts +1 -0
- package/dist/core/errors.js +4 -0
- package/dist/core/feed/__tests__/inbox-migrate.test.js +27 -31
- package/dist/core/feed/feed.d.ts +0 -6
- package/dist/core/feed/feed.js +68 -56
- package/dist/core/feed/inbox.d.ts +7 -81
- package/dist/core/feed/inbox.js +46 -378
- package/dist/core/feed/messages.d.ts +58 -0
- package/dist/core/feed/messages.js +217 -0
- package/dist/core/fs-utils.d.ts +4 -0
- package/dist/core/fs-utils.js +21 -1
- package/dist/core/human/answer.d.ts +1 -1
- package/dist/core/human/answer.js +1 -1
- package/dist/core/human/claim.d.ts +1 -1
- package/dist/core/human/claim.js +2 -4
- package/dist/core/human/component-docs.js +1 -1
- package/dist/core/human/feedback-companion.js +4 -3
- package/dist/core/human/feedback.d.ts +5 -8
- package/dist/core/human/feedback.js +57 -85
- package/dist/core/human/page-authoring.d.ts +30 -0
- package/dist/core/human/page-authoring.js +19 -0
- package/dist/core/human/requests.d.ts +136 -0
- package/dist/core/human/requests.js +515 -0
- package/dist/core/human/root.d.ts +0 -7
- package/dist/core/human/root.js +0 -17
- package/dist/core/human/scan.d.ts +2 -7
- package/dist/core/human/scan.js +48 -132
- package/dist/core/human/summary.d.ts +1 -1
- package/dist/core/human/summary.js +1 -1
- package/dist/core/human/tickets.d.ts +23 -83
- package/dist/core/human/tickets.js +92 -243
- package/dist/core/human/types.d.ts +5 -1
- package/dist/core/installed-plugins.js +8 -3
- package/dist/core/keybindings/__tests__/resolve.test.js +19 -17
- package/dist/core/locked-file.d.ts +6 -3
- package/dist/core/locked-file.js +36 -9
- package/dist/core/memory/extensions.js +2 -0
- package/dist/core/preview-registry.js +0 -1
- package/dist/core/profiles/__tests__/env-store.test.js +2 -0
- package/dist/core/profiles/default-binding.d.ts +0 -4
- package/dist/core/profiles/default-binding.js +12 -58
- package/dist/core/profiles/env-store.js +8 -3
- package/dist/core/profiles/manifest.d.ts +2 -37
- package/dist/core/profiles/manifest.js +35 -161
- package/dist/core/profiles/select.js +3 -0
- package/dist/core/review/__tests__/capture-origin.test.js +13 -2
- package/dist/core/review/__tests__/comments.test.js +28 -10
- package/dist/core/review/__tests__/remap.test.js +28 -10
- package/dist/core/review/__tests__/stage-identity.test.js +17 -7
- package/dist/core/review/birth.d.ts +1 -1
- package/dist/core/review/birth.js +34 -5
- package/dist/core/review/comments.js +1 -1
- package/dist/core/review/companion.d.ts +1 -1
- package/dist/core/review/companion.js +2 -2
- package/dist/core/review/document.js +1 -1
- package/dist/core/review/project.d.ts +5 -1
- package/dist/core/review/project.js +14 -36
- package/dist/core/review/realize.d.ts +3 -6
- package/dist/core/review/realize.js +51 -168
- package/dist/core/review/remap.js +1 -1
- package/dist/core/review/stage.d.ts +3 -2
- package/dist/core/review/stage.js +2 -3
- package/dist/core/review/store.d.ts +3 -21
- package/dist/core/review/store.js +140 -186
- package/dist/core/review/types.d.ts +0 -1
- package/dist/core/runtime/__tests__/install-id-cache-scoping.test.js +9 -5
- package/dist/core/runtime/__tests__/spawn-env.test.js +8 -9
- package/dist/core/runtime/broker/auth-reload.js +9 -10
- package/dist/core/runtime/broker/daemon-ops.d.ts +25 -8
- package/dist/core/runtime/broker/daemon-ops.js +42 -9
- package/dist/core/runtime/broker/extension-abort.d.ts +3 -0
- package/dist/core/runtime/broker/extension-abort.js +11 -0
- package/dist/core/runtime/broker/fault-retry.d.ts +15 -6
- package/dist/core/runtime/broker/fault-retry.js +142 -95
- package/dist/core/runtime/broker/inbox.d.ts +4 -32
- package/dist/core/runtime/broker/inbox.js +4 -92
- package/dist/core/runtime/broker/rebind.d.ts +1 -0
- package/dist/core/runtime/broker/rebind.js +21 -12
- package/dist/core/runtime/broker-persona-guidance.d.ts +1 -1
- package/dist/core/runtime/broker-persona-guidance.js +2 -13
- package/dist/core/runtime/broker.js +28 -22
- package/dist/core/runtime/close.d.ts +3 -9
- package/dist/core/runtime/close.js +16 -27
- package/dist/core/runtime/fault.d.ts +3 -93
- package/dist/core/runtime/fault.js +9 -419
- package/dist/core/runtime/kickoff.d.ts +3 -6
- package/dist/core/runtime/kickoff.js +12 -18
- package/dist/core/runtime/launch.js +1 -1
- package/dist/core/runtime/lifecycle.js +40 -7
- package/dist/core/runtime/nodes.d.ts +5 -1
- package/dist/core/runtime/nodes.js +26 -11
- package/dist/core/runtime/placement.js +2 -2
- package/dist/core/runtime/recycle.js +24 -14
- package/dist/core/runtime/reset.js +26 -7
- package/dist/core/runtime/revive.js +226 -217
- package/dist/core/runtime/spawn.d.ts +4 -1
- package/dist/core/runtime/spawn.js +43 -5
- package/dist/core/runtime/warm-pool.d.ts +2 -2
- package/dist/core/runtime/warm-pool.js +23 -3
- package/dist/core/scoped-state/db.d.ts +7 -0
- package/dist/core/scoped-state/db.js +92 -0
- package/dist/core/scoped-state/migrate.d.ts +11 -0
- package/dist/core/scoped-state/migrate.js +198 -0
- package/dist/core/scoped-state/paths.d.ts +9 -0
- package/dist/core/scoped-state/paths.js +27 -0
- package/dist/core/scoped-state/profiles.d.ts +12 -0
- package/dist/core/scoped-state/profiles.js +62 -0
- package/dist/core/scoped-state/providers.d.ts +16 -0
- package/dist/core/scoped-state/providers.js +8 -0
- package/dist/core/scoped-state/schema.d.ts +3 -0
- package/dist/core/scoped-state/schema.js +26 -0
- package/dist/core/scoped-state/settings.d.ts +28 -0
- package/dist/core/scoped-state/settings.js +82 -0
- package/dist/core/subscription-state.d.ts +29 -48
- package/dist/core/subscription-state.js +176 -712
- package/dist/core/worktree-close.js +4 -4
- package/dist/core/worktree-mutation-async.js +2 -2
- package/dist/core/worktree-sweep.js +11 -16
- package/dist/core/worktree.js +6 -12
- package/dist/daemon/__tests__/autostart-storm.test.js +1 -39
- package/dist/daemon/__tests__/helpers/source-daemon.d.ts +2 -2
- package/dist/daemon/__tests__/helpers/source-daemon.js +7 -6
- package/dist/daemon/__tests__/integration/migration-startup.test.js +59 -26
- package/dist/daemon/__tests__/node-deadline-lane.test.js +2 -1
- package/dist/daemon/__tests__/node-outcome-birth-invariants.test.js +41 -17
- package/dist/daemon/__tests__/node-outcome-delivery.test.js +39 -10
- package/dist/daemon/__tests__/reconciler-signature.test.js +2 -2
- package/dist/daemon/__tests__/subtree-filter-freshness.test.js +2 -2
- package/dist/daemon/api/__tests__/broker-settle-park.test.js +17 -12
- package/dist/daemon/api/__tests__/canvas-snapshot-fields.test.js +27 -5
- package/dist/daemon/api/__tests__/model-config.test.js +8 -8
- package/dist/daemon/api/__tests__/node-create-description.test.js +22 -5
- package/dist/daemon/api/__tests__/node-model-validation.test.js +21 -1
- package/dist/daemon/api/__tests__/nodes-activity-query.test.js +10 -12
- package/dist/daemon/api/__tests__/profile-launch-gates.test.js +6 -3
- package/dist/daemon/api/__tests__/profile-metadata-route.test.js +4 -1
- package/dist/daemon/api/__tests__/reopen-delivery.test.js +26 -8
- package/dist/daemon/api/__tests__/seam/api-server.test.js +24 -32
- package/dist/daemon/api/__tests__/seam/b10-attach-modelauth.test.js +4 -1
- package/dist/daemon/api/__tests__/seam/leaf-api-parity.test.js +5 -4
- package/dist/daemon/api/__tests__/seam/profile-delete.test.js +29 -43
- package/dist/daemon/api/__tests__/submit-result.test.js +3 -2
- package/dist/daemon/api/bridge.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +6 -7
- package/dist/daemon/api/handlers/broker-ops.js +47 -84
- package/dist/daemon/api/handlers/broker-recovery.d.ts +4 -0
- package/dist/daemon/api/handlers/broker-recovery.js +251 -0
- package/dist/daemon/api/handlers/canvas.js +2 -44
- package/dist/daemon/api/handlers/daemon.js +41 -0
- package/dist/daemon/api/handlers/feedback-comments.js +2 -2
- package/dist/daemon/api/handlers/health.js +10 -5
- package/dist/daemon/api/handlers/human-requests.js +168 -188
- package/dist/daemon/api/handlers/human.js +3 -148
- package/dist/daemon/api/handlers/inbox-page.d.ts +4 -0
- package/dist/daemon/api/handlers/inbox-page.js +89 -0
- package/dist/daemon/api/handlers/inbox.js +21 -120
- package/dist/daemon/api/handlers/messages.d.ts +1 -0
- package/dist/daemon/api/handlers/messages.js +73 -15
- package/dist/daemon/api/handlers/node-outcomes.js +58 -13
- package/dist/daemon/api/handlers/nodes.d.ts +1 -0
- package/dist/daemon/api/handlers/nodes.js +41 -42
- package/dist/daemon/api/handlers/reviews.js +4 -29
- package/dist/daemon/api/map.d.ts +25 -3
- package/dist/daemon/api/map.js +84 -14
- package/dist/daemon/api/server.js +68 -9
- package/dist/daemon/control.d.ts +18 -0
- package/dist/daemon/cron/disposition.d.ts +2 -0
- package/dist/daemon/cron/disposition.js +8 -5
- package/dist/daemon/cron/settle.js +37 -13
- package/dist/daemon/cron/sinks.d.ts +18 -1
- package/dist/daemon/cron/sinks.js +47 -93
- package/dist/daemon/crtrd-cli.js +4 -19
- package/dist/daemon/crtrd.d.ts +2 -0
- package/dist/daemon/crtrd.js +206 -81
- package/dist/daemon/fleet.js +5 -6
- package/dist/daemon/human/finish.d.ts +12 -24
- package/dist/daemon/human/finish.js +88 -285
- package/dist/daemon/human/settle.d.ts +40 -0
- package/dist/daemon/human/settle.js +89 -0
- package/dist/daemon/human/sweep.d.ts +20 -5
- package/dist/daemon/human/sweep.js +56 -60
- package/dist/daemon/manage.d.ts +21 -16
- package/dist/daemon/manage.js +85 -51
- package/dist/daemon/messaging/node-message.d.ts +1 -1
- package/dist/daemon/messaging/node-message.js +9 -12
- package/dist/daemon/park-activity.js +3 -3
- package/dist/daemon/reconcilers/bash-deadline.js +6 -7
- package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
- package/dist/daemon/reconcilers/broker-supervision.js +41 -19
- package/dist/daemon/reconcilers/controller-death.js +6 -18
- package/dist/daemon/reconcilers/delivery-lane.d.ts +9 -0
- package/dist/daemon/reconcilers/delivery-lane.js +130 -0
- package/dist/daemon/reconcilers/live-obligation.js +3 -3
- package/dist/daemon/reconcilers/node-deadline.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +10 -12
- package/dist/daemon/reconcilers/node-lifecycle/tick.js +5 -5
- package/dist/daemon/reconcilers/node-lifecycle/wants-execution.js +1 -1
- package/dist/daemon/reconcilers/pending-review-submit.js +3 -3
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +2 -8
- package/dist/daemon/reconcilers/storage-maintenance.js +13 -43
- package/dist/daemon/review/companion.js +5 -11
- package/dist/daemon/review/deliver.d.ts +1 -5
- package/dist/daemon/review/deliver.js +3 -52
- package/dist/daemon/review/finish.d.ts +2 -27
- package/dist/daemon/review/finish.js +79 -263
- package/dist/daemon/review/sweep.d.ts +3 -10
- package/dist/daemon/review/sweep.js +13 -131
- package/dist/daemon/startup-policy.d.ts +0 -5
- package/dist/daemon/startup-policy.js +0 -5
- package/dist/hook-authoring.d.ts +28 -2
- package/dist/hook-authoring.js +53 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/migrations/__tests__/activation-concurrency.test.js +3 -2
- package/dist/migrations/__tests__/activation.test.js +9 -6
- package/dist/migrations/activation.d.ts +3 -2
- package/dist/migrations/activation.js +2 -4
- package/dist/migrations/corpus.d.ts +2 -5
- package/dist/migrations/corpus.js +9 -20
- package/dist/migrations/runner.d.ts +3 -1
- package/dist/migrations/runner.js +6 -2
- package/dist/pi-extensions/__tests__/canvas-context-intro.test.js +21 -89
- package/dist/pi-extensions/__tests__/canvas-goal-capture-envelope.test.js +4 -2
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +51 -33
- package/dist/pi-extensions/__tests__/canvas-stophook-context-nudge.test.js +16 -2
- package/dist/pi-extensions/__tests__/pre-command-gate.test.js +13 -1
- package/dist/pi-extensions/canvas-inbox-watcher.js +98 -244
- package/dist/pi-extensions/canvas-passive-context.d.ts +4 -8
- package/dist/pi-extensions/canvas-passive-context.js +85 -37
- package/dist/pi-extensions/canvas-stophook.js +47 -31
- package/dist/shared/env.d.ts +1 -0
- package/dist/shared/env.js +3 -0
- package/package.json +1 -1
- package/runtime.lock.json +5 -5
- package/dist/clients/attach/__tests__/page-block.test.js +0 -54
- package/dist/clients/inbox/review-visibility.d.ts +0 -5
- package/dist/clients/inbox/review-visibility.js +0 -19
- package/dist/commands/canvas-rebuild-index.d.ts +0 -2
- package/dist/commands/canvas-rebuild-index.js +0 -46
- package/dist/core/__tests__/human-cancel-guard.test.js +0 -110
- package/dist/core/__tests__/human-deliver.test.d.ts +0 -1
- package/dist/core/__tests__/human-deliver.test.js +0 -256
- package/dist/core/__tests__/human-node-not-supervised.test.d.ts +0 -1
- package/dist/core/__tests__/human-node-not-supervised.test.js +0 -89
- package/dist/core/__tests__/integration/human-deliver-e2e.test.d.ts +0 -1
- package/dist/core/__tests__/integration/human-deliver-e2e.test.js +0 -131
- package/dist/core/__tests__/phase4-review-store.test.d.ts +0 -1
- package/dist/core/__tests__/phase4-review-store.test.js +0 -144
- package/dist/core/__tests__/watchdog-abort-arms-retry.test.d.ts +0 -1
- package/dist/core/__tests__/watchdog-abort-arms-retry.test.js +0 -110
- package/dist/core/canvas/human-deliveries.d.ts +0 -39
- package/dist/core/canvas/human-deliveries.js +0 -75
- package/dist/core/canvas/node-outcome-deliveries.d.ts +0 -64
- package/dist/core/canvas/node-outcome-deliveries.js +0 -159
- package/dist/core/feed/passive.d.ts +0 -3
- package/dist/core/feed/passive.js +0 -53
- package/dist/core/human/__tests__/inbox-cancel-worker.d.ts +0 -1
- package/dist/core/human/__tests__/inbox-cancel-worker.js +0 -7
- package/dist/core/human/__tests__/inbox-claim-worker.d.ts +0 -1
- package/dist/core/human/__tests__/inbox-claim-worker.js +0 -17
- package/dist/core/human/__tests__/inbox-stale-claim-worker.d.ts +0 -1
- package/dist/core/human/__tests__/inbox-stale-claim-worker.js +0 -8
- package/dist/core/human/__tests__/integration/inbox-core.test.d.ts +0 -1
- package/dist/core/human/__tests__/integration/inbox-core.test.js +0 -145
- package/dist/core/human/__tests__/page-tickets.test.d.ts +0 -1
- package/dist/core/human/__tests__/page-tickets.test.js +0 -161
- package/dist/core/review/ticket-filter.d.ts +0 -17
- package/dist/core/review/ticket-filter.js +0 -21
- package/dist/core/runtime/broker/passive.d.ts +0 -17
- package/dist/core/runtime/broker/passive.js +0 -44
- package/dist/core/runtime/busy.d.ts +0 -46
- package/dist/core/runtime/busy.js +0 -150
- package/dist/daemon/__tests__/startup-block-marker.test.d.ts +0 -1
- package/dist/daemon/__tests__/startup-block-marker.test.js +0 -86
- package/dist/daemon/api/__tests__/review-terminal-conflict.test.d.ts +0 -1
- package/dist/daemon/api/__tests__/review-terminal-conflict.test.js +0 -98
- package/dist/daemon/human/deliver-action.d.ts +0 -3
- package/dist/daemon/human/deliver-action.js +0 -9
- package/dist/daemon/node-outcome/deliver-outcome.d.ts +0 -3
- package/dist/daemon/node-outcome/deliver-outcome.js +0 -9
- package/dist/daemon/reconcilers/human-delivery-lane.d.ts +0 -10
- package/dist/daemon/reconcilers/human-delivery-lane.js +0 -41
- package/dist/daemon/reconcilers/node-outcome-delivery-lane.d.ts +0 -10
- package/dist/daemon/reconcilers/node-outcome-delivery-lane.js +0 -41
- package/dist/daemon/startup-block-marker.d.ts +0 -25
- package/dist/daemon/startup-block-marker.js +0 -99
- /package/dist/{clients/attach/__tests__/page-block.test.d.ts → api/dto/mail.js} +0 -0
- /package/dist/{commands/sys/__tests__/migrate.test.d.ts → api/dto/recovery.js} +0 -0
- /package/dist/{core/__tests__/human-cancel-guard.test.d.ts → commands/__tests__/integration/migrate.test.d.ts} +0 -0
package/dist/api/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DaemonRestartDTO, HealthDTO, StatusDTO } from './dto/health.js';
|
|
1
|
+
import type { DaemonAdmitDTO, DaemonRestartDTO, HealthDTO, MigrateStateDTO, MigrateStateRequest, StatusDTO } from './dto/health.js';
|
|
2
2
|
import type { BashJobStatusDTO, BashJobStopResultDTO } from './dto/bash-jobs.js';
|
|
3
3
|
import type { ArtifactListDTO, ArtifactsQuery, ContextListDTO, CreateNodeRequest, ListNodesQuery, NodeDetailDTO, NodeMessagesPageDTO, NodeMessagesQuery, NodeSessionDTO, NodeSnapshotDTO, NodeSubjectDTO, NodeSummaryDTO, TranscriptDTO, TranscriptQuery } from './dto/nodes.js';
|
|
4
4
|
import type { NodeOutcomeResponseDTO, OutcomeDeliveryDTO, RegisterOutcomeDeliveryRequest } from './dto/node-outcomes.js';
|
|
@@ -15,14 +15,15 @@ import type { FilePeekDTO } from './dto/files.js';
|
|
|
15
15
|
import type { MemoryDocRefDTO } from './dto/memory.js';
|
|
16
16
|
import type { ChatInventoryDTO, ProspectiveChatInventoryDTO, ProspectiveChatInventoryQuery } from './dto/chat-inventory.js';
|
|
17
17
|
import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, ModelAuthListDTO } from './dto/modelauth.js';
|
|
18
|
-
import type { CreateHumanBridgeRequest, HumanBridgeResultDTO, HumanCancelRequest, HumanCancelResultDTO, HumanResolveRequest, HumanResolveResultDTO } from './dto/human.js';
|
|
19
18
|
import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
|
|
20
19
|
import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
|
|
21
20
|
import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, InboxPageDTO, InboxPageHistoryDTO, InboxPageResponseDTO, InboxTicketIdDTO, PageFeedbackResolutionDTO, PageResponsesDTO, PageTicketResultDTO, RespondInboxPageRequest } from './dto/inbox.js';
|
|
22
21
|
import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest } from './dto/human-requests.js';
|
|
23
|
-
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO,
|
|
22
|
+
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
24
23
|
import type { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO, QuarantinedWorktreeDTO } from './dto/worktree.js';
|
|
25
|
-
import type { BrokerExtensionStateDTO, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO,
|
|
24
|
+
import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest } from './dto/broker-ops.js';
|
|
25
|
+
import type { AcknowledgeMailRequest, AcknowledgeMailResultDTO, ClaimMailRequest, ClaimMailResultDTO } from './dto/mail.js';
|
|
26
|
+
import type { BrokerFaultInputDTO, BrokerFaultRequest, BrokerFaultResultDTO, BrokerProviderRetryRequest, BrokerProviderRetryResultDTO, BrokerTurnRequest, BrokerTurnResultDTO, NodeFaultClearResultDTO, RecoveryStateDTO } from './dto/recovery.js';
|
|
26
27
|
export interface CrtrClientOptions {
|
|
27
28
|
/** Unix socket path (default local transport). Exactly one of socketPath|baseUrl. */
|
|
28
29
|
socketPath?: string;
|
|
@@ -51,9 +52,6 @@ export interface CrtrClientOptions {
|
|
|
51
52
|
* socket or interrupted response. Each probe is capped to the remaining
|
|
52
53
|
* budget. Defaults to `HEALTHZ_POLL_WINDOW_MS`. */
|
|
53
54
|
coldStartPollWindowMs?: number;
|
|
54
|
-
/** Injected check for a standing startup block. After an attempted spawn,
|
|
55
|
-
* its result supplements the observed transport failure with the known repair. */
|
|
56
|
-
coldStartAbort?: () => string | null;
|
|
57
55
|
}
|
|
58
56
|
/** One strict wall-clock availability window shared by local API clients and
|
|
59
57
|
* daemon management. Each probe gets only the budget remaining at its start. */
|
|
@@ -75,7 +73,6 @@ export declare class CrtrClient {
|
|
|
75
73
|
private readonly onColdSocket?;
|
|
76
74
|
private readonly coldStartDiagnostic?;
|
|
77
75
|
private readonly coldStartPollWindowMs;
|
|
78
|
-
private readonly coldStartAbort?;
|
|
79
76
|
/** Guards against invoking the daemon-start hook more than once per client. */
|
|
80
77
|
private coldStartAttempted;
|
|
81
78
|
constructor(opts: CrtrClientOptions);
|
|
@@ -93,6 +90,8 @@ export declare class CrtrClient {
|
|
|
93
90
|
* caller living inside a node the handover will tear down still gets a
|
|
94
91
|
* settled result. */
|
|
95
92
|
restartDaemon(): Promise<DaemonRestartDTO>;
|
|
93
|
+
admitDaemon(): Promise<DaemonAdmitDTO>;
|
|
94
|
+
migrateState(req: MigrateStateRequest): Promise<MigrateStateDTO>;
|
|
96
95
|
createNode(req: CreateNodeRequest): Promise<NodeDetailDTO>;
|
|
97
96
|
/** List canvas nodes with composable row filters. `include: 'activity'` adds
|
|
98
97
|
* latest/canonical reports and pending-human counts in the same response. */
|
|
@@ -123,8 +122,18 @@ export declare class CrtrClient {
|
|
|
123
122
|
bindBrokerSession(id: string, req: BrokerSessionBoundRequest): Promise<BrokerSessionBoundResultDTO>;
|
|
124
123
|
settleBroker(id: string, req: BrokerSettleRequest): Promise<BrokerSettleDirective>;
|
|
125
124
|
completeBrokerPark(id: string, req: BrokerParkCompleteRequest): Promise<BrokerSettleDirective>;
|
|
126
|
-
recordBrokerParkActivity(id: string): Promise<BrokerParkActivityResultDTO>;
|
|
127
|
-
|
|
125
|
+
recordBrokerParkActivity(id: string, req: BrokerExecutionRequest): Promise<BrokerParkActivityResultDTO>;
|
|
126
|
+
claimNodeMail(id: string, req: ClaimMailRequest): Promise<ClaimMailResultDTO>;
|
|
127
|
+
acknowledgeNodeMail(id: string, req: AcknowledgeMailRequest): Promise<AcknowledgeMailResultDTO>;
|
|
128
|
+
recordBrokerTurn(id: string, req: BrokerTurnRequest): Promise<BrokerTurnResultDTO>;
|
|
129
|
+
mutateBrokerProviderRetry(id: string, req: BrokerProviderRetryRequest): Promise<BrokerProviderRetryResultDTO>;
|
|
130
|
+
mutateBrokerFault(id: string, req: BrokerFaultRequest): Promise<BrokerFaultResultDTO>;
|
|
131
|
+
getBrokerRecovery(id: string, expectedExecutionId: string): Promise<RecoveryStateDTO>;
|
|
132
|
+
recordNodeFault(id: string, req: BrokerFaultInputDTO): Promise<BrokerFaultResultDTO>;
|
|
133
|
+
clearNodeFault(id: string, opts?: {
|
|
134
|
+
link?: BrokerFaultInputDTO['link'];
|
|
135
|
+
preserve_episode?: boolean;
|
|
136
|
+
}): Promise<NodeFaultClearResultDTO>;
|
|
128
137
|
commitBrokerModel(id: string, req: BrokerModelCommitRequest): Promise<BrokerModelCommitResultDTO>;
|
|
129
138
|
brokerExtensionState(id: string): Promise<BrokerExtensionStateDTO>;
|
|
130
139
|
commitBrokerGeneratedName(id: string, req: BrokerGeneratedNameRequest): Promise<BrokerGeneratedNameResultDTO>;
|
|
@@ -212,20 +221,9 @@ export declare class CrtrClient {
|
|
|
212
221
|
listModelAuth(): Promise<ModelAuthListDTO>;
|
|
213
222
|
installCredential(provider: string, req: InstallCredentialRequest): Promise<CredentialResultDTO>;
|
|
214
223
|
removeCredential(provider: string): Promise<CredentialRemovalResultDTO>;
|
|
215
|
-
/** Create a terminal `kind:'human'` bridge node with NO broker engine
|
|
216
|
-
* (`spawnNode` server-side). Distinct from `createNode` (which launches a
|
|
217
|
-
* broker) precisely because a human bridge must never have one. */
|
|
218
|
-
createHumanBridge(req: CreateHumanBridgeRequest): Promise<HumanBridgeResultDTO>;
|
|
219
|
-
/** Resolve a page ticket answer. crtrd claims the ticket (taking over a live
|
|
220
|
-
* inbox claim where one exists), publishes the canonical result, and follows
|
|
221
|
-
* its optional reply route before this resolves. */
|
|
222
|
-
resolveHumanTicket(ticketId: string, body: HumanResolveRequest): Promise<HumanResolveResultDTO>;
|
|
223
|
-
/** Cancel a pending ticket and retire its optional reply bridge. */
|
|
224
|
-
cancelHumanTicket(ticketId: string, body: HumanCancelRequest): Promise<HumanCancelResultDTO>;
|
|
225
224
|
createReview(req: CreateReviewRequest): Promise<ReviewDTO>;
|
|
226
225
|
listReviews(query?: ListReviewsQuery): Promise<ReviewListDTO>;
|
|
227
226
|
getReview(reviewId: string): Promise<ReviewDTO>;
|
|
228
|
-
getReviewByBridge(bridgeNodeId: string): Promise<ReviewDTO>;
|
|
229
227
|
submitReview(reviewId: string): Promise<ReviewSubmitResultDTO>;
|
|
230
228
|
cancelReview(reviewId: string, req?: CancelReviewRequest): Promise<ReviewCancelResultDTO>;
|
|
231
229
|
getReviewDocumentBase(reviewId: string): Promise<ReviewDocumentBaseDTO>;
|
|
@@ -255,10 +253,10 @@ export declare class CrtrClient {
|
|
|
255
253
|
getInboxResponse(ticketId: InboxTicketIdDTO): Promise<InboxPageResponseDTO>;
|
|
256
254
|
/** Cancel a ticket (terminal response, never deletion). */
|
|
257
255
|
cancelHumanInboxTicket(ticketId: InboxTicketIdDTO, request?: CancelInboxTicketRequest): Promise<CanceledTicketResultDTO>;
|
|
258
|
-
/** Create one durable human request.
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
256
|
+
/** Create one durable human request. The minted `request_id` identifies the
|
|
257
|
+
* request; inbox presentation has its own ticket id. An unresolvable
|
|
258
|
+
* `action.name` is rejected before the page is published, leaving no inbox
|
|
259
|
+
* row behind. */
|
|
262
260
|
createHumanRequest(request: CreateHumanRequestRequest): Promise<CreateHumanRequestDTO>;
|
|
263
261
|
/** Read one request: its current state, its answer when answered, and the
|
|
264
262
|
* delivery state of its completion action when it bound one. */
|
|
@@ -310,7 +308,6 @@ export declare class CrtrClient {
|
|
|
310
308
|
* enriched on-demand view. */
|
|
311
309
|
canvasRoster(): Promise<RosterDTO>;
|
|
312
310
|
prune(req: PruneRequest): Promise<PruneResultDTO>;
|
|
313
|
-
rebuildIndex(): Promise<RebuildIndexResultDTO>;
|
|
314
311
|
/** Raw request for routes not yet method-wrapped. Applies the same
|
|
315
312
|
* autostart + error-mapping semantics. */
|
|
316
313
|
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
@@ -318,10 +315,6 @@ export declare class CrtrClient {
|
|
|
318
315
|
* JSON parse. Every wrapper goes through here; only non-JSON routes call it directly. */
|
|
319
316
|
private send;
|
|
320
317
|
private nodePath;
|
|
321
|
-
/** Validate a human interaction id before route construction. Reply-bearing
|
|
322
|
-
* tickets use bridge ids and standalone pages use page ids; both obey the
|
|
323
|
-
* safe node-id segment contract. */
|
|
324
|
-
private interactionPath;
|
|
325
318
|
/** Validate a background job id before route construction. Job ids arrive
|
|
326
319
|
* from the daemon's file-backed roster and must remain one path segment. */
|
|
327
320
|
private jobPath;
|
|
@@ -329,6 +322,10 @@ export declare class CrtrClient {
|
|
|
329
322
|
* it raw, so a value carrying `/`, whitespace or `?` would corrupt the
|
|
330
323
|
* request line rather than 404 cleanly. Mirrors `nodePath`. */
|
|
331
324
|
private cronPath;
|
|
325
|
+
/** Validate a request id before route construction. Requests use the daemon's
|
|
326
|
+
* node-id-shaped identifiers, while inbox presentation uses a separate ticket
|
|
327
|
+
* id. A malformed request id is a server-rejectable request. */
|
|
328
|
+
private requestPath;
|
|
332
329
|
/** Validate an opaque inbox ticket id before route construction. A local
|
|
333
330
|
* shape violation is a caller bug, not a server-rejectable request — throws
|
|
334
331
|
* `TypeError` (matching the existing safe-segment discipline of a local
|
package/dist/api/client.js
CHANGED
|
@@ -72,7 +72,6 @@ export class CrtrClient {
|
|
|
72
72
|
onColdSocket;
|
|
73
73
|
coldStartDiagnostic;
|
|
74
74
|
coldStartPollWindowMs;
|
|
75
|
-
coldStartAbort;
|
|
76
75
|
/** Guards against invoking the daemon-start hook more than once per client. */
|
|
77
76
|
coldStartAttempted = false;
|
|
78
77
|
constructor(opts) {
|
|
@@ -92,8 +91,6 @@ export class CrtrClient {
|
|
|
92
91
|
this.onColdSocket = opts.onColdSocket;
|
|
93
92
|
if (opts.coldStartDiagnostic !== undefined)
|
|
94
93
|
this.coldStartDiagnostic = opts.coldStartDiagnostic;
|
|
95
|
-
if (opts.coldStartAbort !== undefined)
|
|
96
|
-
this.coldStartAbort = opts.coldStartAbort;
|
|
97
94
|
this.coldStartPollWindowMs = opts.coldStartPollWindowMs ?? HEALTHZ_POLL_WINDOW_MS;
|
|
98
95
|
}
|
|
99
96
|
/** Construct a client bound to the default local socket with autostart on. Pass
|
|
@@ -109,7 +106,21 @@ export class CrtrClient {
|
|
|
109
106
|
/** One `/healthz` observation without cold-socket recovery. Availability
|
|
110
107
|
* waiters own retry policy and pass their remaining wall-clock budget here. */
|
|
111
108
|
async probeHealthz(timeoutMs) {
|
|
112
|
-
|
|
109
|
+
const response = await this.transport('GET', routes.healthz(), undefined, undefined, timeoutMs);
|
|
110
|
+
// A restricted daemon is alive and deliberately answers its health DTO with
|
|
111
|
+
// 503. Preserve that state for daemon startup management instead of treating
|
|
112
|
+
// the expected non-2xx status as a generic API failure.
|
|
113
|
+
if (response.status === 503) {
|
|
114
|
+
try {
|
|
115
|
+
const health = JSON.parse(response.text);
|
|
116
|
+
if (typeof health.startup_blocked === 'string')
|
|
117
|
+
return health;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// `parse` below reports malformed/non-health 503 responses normally.
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return parse(response);
|
|
113
124
|
}
|
|
114
125
|
status() {
|
|
115
126
|
return this.request('GET', routes.status());
|
|
@@ -121,6 +132,12 @@ export class CrtrClient {
|
|
|
121
132
|
restartDaemon() {
|
|
122
133
|
return this.request('POST', routes.daemonRestart());
|
|
123
134
|
}
|
|
135
|
+
admitDaemon() {
|
|
136
|
+
return this.request('POST', routes.daemonAdmit());
|
|
137
|
+
}
|
|
138
|
+
migrateState(req) {
|
|
139
|
+
return this.request('POST', routes.daemonMigrate(), req);
|
|
140
|
+
}
|
|
124
141
|
// Nodes
|
|
125
142
|
createNode(req) {
|
|
126
143
|
return this.request('POST', routes.nodes(), req);
|
|
@@ -191,11 +208,38 @@ export class CrtrClient {
|
|
|
191
208
|
completeBrokerPark(id, req) {
|
|
192
209
|
return this.request('POST', routes.nodeBrokerParkComplete(this.nodePath(id)), req);
|
|
193
210
|
}
|
|
194
|
-
recordBrokerParkActivity(id) {
|
|
195
|
-
return this.request('POST', routes.nodeBrokerParkActivity(this.nodePath(id)),
|
|
211
|
+
recordBrokerParkActivity(id, req) {
|
|
212
|
+
return this.request('POST', routes.nodeBrokerParkActivity(this.nodePath(id)), req);
|
|
213
|
+
}
|
|
214
|
+
claimNodeMail(id, req) {
|
|
215
|
+
return this.request('POST', routes.nodeMailClaim(this.nodePath(id)), req);
|
|
216
|
+
}
|
|
217
|
+
acknowledgeNodeMail(id, req) {
|
|
218
|
+
return this.request('POST', routes.nodeMailAcknowledge(this.nodePath(id)), req);
|
|
219
|
+
}
|
|
220
|
+
recordBrokerTurn(id, req) {
|
|
221
|
+
return this.request('POST', routes.brokerTurn(this.nodePath(id)), req);
|
|
222
|
+
}
|
|
223
|
+
mutateBrokerProviderRetry(id, req) {
|
|
224
|
+
return this.request('POST', routes.brokerProviderRetry(this.nodePath(id)), req);
|
|
196
225
|
}
|
|
197
|
-
|
|
198
|
-
return this.request('POST', routes.
|
|
226
|
+
mutateBrokerFault(id, req) {
|
|
227
|
+
return this.request('POST', routes.brokerFault(this.nodePath(id)), req);
|
|
228
|
+
}
|
|
229
|
+
getBrokerRecovery(id, expectedExecutionId) {
|
|
230
|
+
return this.request('GET', `${routes.brokerRecovery(this.nodePath(id))}?expected_execution_id=${encodeURIComponent(expectedExecutionId)}`);
|
|
231
|
+
}
|
|
232
|
+
recordNodeFault(id, req) {
|
|
233
|
+
return this.request('POST', routes.nodeFault(this.nodePath(id)), req);
|
|
234
|
+
}
|
|
235
|
+
clearNodeFault(id, opts = {}) {
|
|
236
|
+
const query = new URLSearchParams();
|
|
237
|
+
if (opts.link !== undefined)
|
|
238
|
+
query.set('link', opts.link);
|
|
239
|
+
if (opts.preserve_episode !== undefined)
|
|
240
|
+
query.set('preserve_episode', String(opts.preserve_episode));
|
|
241
|
+
const suffix = query.size === 0 ? '' : `?${query.toString()}`;
|
|
242
|
+
return this.request('DELETE', `${routes.nodeFault(this.nodePath(id))}${suffix}`);
|
|
199
243
|
}
|
|
200
244
|
commitBrokerModel(id, req) {
|
|
201
245
|
return this.request('POST', routes.nodeBrokerModel(this.nodePath(id)), req);
|
|
@@ -400,23 +444,6 @@ export class CrtrClient {
|
|
|
400
444
|
removeCredential(provider) {
|
|
401
445
|
return this.request('DELETE', routes.modelAuth(provider));
|
|
402
446
|
}
|
|
403
|
-
// Human bridge + completion-handler forwarding (spec §6.5)
|
|
404
|
-
/** Create a terminal `kind:'human'` bridge node with NO broker engine
|
|
405
|
-
* (`spawnNode` server-side). Distinct from `createNode` (which launches a
|
|
406
|
-
* broker) precisely because a human bridge must never have one. */
|
|
407
|
-
createHumanBridge(req) {
|
|
408
|
-
return this.request('POST', routes.humanBridge(), req);
|
|
409
|
-
}
|
|
410
|
-
/** Resolve a page ticket answer. crtrd claims the ticket (taking over a live
|
|
411
|
-
* inbox claim where one exists), publishes the canonical result, and follows
|
|
412
|
-
* its optional reply route before this resolves. */
|
|
413
|
-
resolveHumanTicket(ticketId, body) {
|
|
414
|
-
return this.request('POST', routes.humanTicketResolve(this.interactionPath(ticketId)), body);
|
|
415
|
-
}
|
|
416
|
-
/** Cancel a pending ticket and retire its optional reply bridge. */
|
|
417
|
-
cancelHumanTicket(ticketId, body) {
|
|
418
|
-
return this.request('POST', routes.humanTicketCancel(this.interactionPath(ticketId)), body);
|
|
419
|
-
}
|
|
420
447
|
// Daemon-owned document reviews and comments
|
|
421
448
|
createReview(req) {
|
|
422
449
|
return this.request('POST', routes.humanReviews(), req);
|
|
@@ -427,9 +454,6 @@ export class CrtrClient {
|
|
|
427
454
|
getReview(reviewId) {
|
|
428
455
|
return this.request('GET', routes.humanReview(this.reviewPath(reviewId)));
|
|
429
456
|
}
|
|
430
|
-
getReviewByBridge(bridgeNodeId) {
|
|
431
|
-
return this.request('GET', routes.humanReviewByBridge(this.nodePath(bridgeNodeId)));
|
|
432
|
-
}
|
|
433
457
|
submitReview(reviewId) {
|
|
434
458
|
return this.request('POST', routes.humanReviewSubmit(this.reviewPath(reviewId)), {});
|
|
435
459
|
}
|
|
@@ -507,35 +531,35 @@ export class CrtrClient {
|
|
|
507
531
|
return this.request('POST', routes.humanInboxCancel(this.ticketId(ticketId)), request ?? {});
|
|
508
532
|
}
|
|
509
533
|
// Durable programmatic human requests
|
|
510
|
-
/** Create one durable human request.
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
534
|
+
/** Create one durable human request. The minted `request_id` identifies the
|
|
535
|
+
* request; inbox presentation has its own ticket id. An unresolvable
|
|
536
|
+
* `action.name` is rejected before the page is published, leaving no inbox
|
|
537
|
+
* row behind. */
|
|
514
538
|
createHumanRequest(request) {
|
|
515
539
|
return this.request('POST', routes.humanRequests(), request);
|
|
516
540
|
}
|
|
517
541
|
/** Read one request: its current state, its answer when answered, and the
|
|
518
542
|
* delivery state of its completion action when it bound one. */
|
|
519
543
|
getHumanRequest(requestId) {
|
|
520
|
-
return this.request('GET', routes.humanRequest(this.
|
|
544
|
+
return this.request('GET', routes.humanRequest(this.requestPath(requestId)));
|
|
521
545
|
}
|
|
522
546
|
/** Revise a pending request's page in place. Identity, provenance, and the
|
|
523
547
|
* frozen action binding are preserved; a settled request refuses. */
|
|
524
548
|
replaceHumanRequest(requestId, request) {
|
|
525
|
-
return this.request('POST', routes.humanRequestReplace(this.
|
|
549
|
+
return this.request('POST', routes.humanRequestReplace(this.requestPath(requestId)), request);
|
|
526
550
|
}
|
|
527
551
|
/** Settle a request `answered` programmatically. Races a human answer to the
|
|
528
552
|
* same first-writer-wins result. */
|
|
529
553
|
respondHumanRequest(requestId, request) {
|
|
530
|
-
return this.request('POST', routes.humanRequestRespond(this.
|
|
554
|
+
return this.request('POST', routes.humanRequestRespond(this.requestPath(requestId)), request);
|
|
531
555
|
}
|
|
532
556
|
/** The recipient surface closing a request without answering. */
|
|
533
557
|
dismissHumanRequest(requestId, request = {}) {
|
|
534
|
-
return this.request('POST', routes.humanRequestDismiss(this.
|
|
558
|
+
return this.request('POST', routes.humanRequestDismiss(this.requestPath(requestId)), request);
|
|
535
559
|
}
|
|
536
560
|
/** The requester withdrawing its own request. */
|
|
537
561
|
cancelHumanRequest(requestId, request = {}) {
|
|
538
|
-
return this.request('POST', routes.humanRequestCancel(this.
|
|
562
|
+
return this.request('POST', routes.humanRequestCancel(this.requestPath(requestId)), request);
|
|
539
563
|
}
|
|
540
564
|
/** Resolve one page feedback comment — the bound companion's report that it
|
|
541
565
|
* has been dealt with. `nodeId` names the caller; the daemon refuses any
|
|
@@ -603,9 +627,6 @@ export class CrtrClient {
|
|
|
603
627
|
prune(req) {
|
|
604
628
|
return this.request('POST', routes.canvasPrune(), req);
|
|
605
629
|
}
|
|
606
|
-
rebuildIndex() {
|
|
607
|
-
return this.request('POST', routes.canvasRebuildIndex(), {});
|
|
608
|
-
}
|
|
609
630
|
// Escape hatch
|
|
610
631
|
/** Raw request for routes not yet method-wrapped. Applies the same
|
|
611
632
|
* autostart + error-mapping semantics. */
|
|
@@ -640,15 +661,6 @@ export class CrtrClient {
|
|
|
640
661
|
}
|
|
641
662
|
return id;
|
|
642
663
|
}
|
|
643
|
-
/** Validate a human interaction id before route construction. Reply-bearing
|
|
644
|
-
* tickets use bridge ids and standalone pages use page ids; both obey the
|
|
645
|
-
* safe node-id segment contract. */
|
|
646
|
-
interactionPath(id) {
|
|
647
|
-
if (!isSafeNodeId(id)) {
|
|
648
|
-
throw new ApiError(400, 'invalid_ticket_id', `invalid interaction ticket id: ${JSON.stringify(id)}`);
|
|
649
|
-
}
|
|
650
|
-
return id;
|
|
651
|
-
}
|
|
652
664
|
/** Validate a background job id before route construction. Job ids arrive
|
|
653
665
|
* from the daemon's file-backed roster and must remain one path segment. */
|
|
654
666
|
jobPath(id) {
|
|
@@ -666,6 +678,15 @@ export class CrtrClient {
|
|
|
666
678
|
}
|
|
667
679
|
return id;
|
|
668
680
|
}
|
|
681
|
+
/** Validate a request id before route construction. Requests use the daemon's
|
|
682
|
+
* node-id-shaped identifiers, while inbox presentation uses a separate ticket
|
|
683
|
+
* id. A malformed request id is a server-rejectable request. */
|
|
684
|
+
requestPath(id) {
|
|
685
|
+
if (!isSafeNodeId(id)) {
|
|
686
|
+
throw new ApiError(400, 'invalid_request_id', `invalid request id: ${JSON.stringify(id)}`);
|
|
687
|
+
}
|
|
688
|
+
return id;
|
|
689
|
+
}
|
|
669
690
|
/** Validate an opaque inbox ticket id before route construction. A local
|
|
670
691
|
* shape violation is a caller bug, not a server-rejectable request — throws
|
|
671
692
|
* `TypeError` (matching the existing safe-segment discipline of a local
|
|
@@ -784,9 +805,17 @@ export class CrtrClient {
|
|
|
784
805
|
initialError,
|
|
785
806
|
probe: async (timeoutMs) => {
|
|
786
807
|
const response = await this.transport('GET', routes.healthz(), undefined, undefined, timeoutMs);
|
|
787
|
-
if (response.status
|
|
788
|
-
|
|
808
|
+
if (response.status >= 200 && response.status < 300)
|
|
809
|
+
return;
|
|
810
|
+
try {
|
|
811
|
+
const health = JSON.parse(response.text);
|
|
812
|
+
if (typeof health.startup_blocked === 'string')
|
|
813
|
+
return;
|
|
789
814
|
}
|
|
815
|
+
catch {
|
|
816
|
+
// The normal unavailable error below carries the response body.
|
|
817
|
+
}
|
|
818
|
+
throw new ApiError(response.status, 'daemon_health_unavailable', `crtrd health check returned HTTP ${response.status}: ${response.text.slice(0, 500)}`);
|
|
790
819
|
},
|
|
791
820
|
});
|
|
792
821
|
}
|
|
@@ -804,9 +833,6 @@ export class CrtrClient {
|
|
|
804
833
|
}
|
|
805
834
|
catch (error) {
|
|
806
835
|
if (startedHere) {
|
|
807
|
-
const standingBlock = safeColdStartAbort(this.coldStartAbort);
|
|
808
|
-
if (standingBlock !== null)
|
|
809
|
-
throw new ApiError(503, 'daemon_unavailable', `crtrd cannot start: ${standingBlock}`);
|
|
810
836
|
const diagnostic = safeColdStartDiagnostic(this.coldStartDiagnostic);
|
|
811
837
|
if (diagnostic !== undefined) {
|
|
812
838
|
const transportError = toTransportApiError(error);
|
|
@@ -874,19 +900,6 @@ function toTransportApiError(err) {
|
|
|
874
900
|
function sleepMs(ms) {
|
|
875
901
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
876
902
|
}
|
|
877
|
-
/** Invoke the injected `coldStartDiagnostic` hook, treating a THROW the same
|
|
878
|
-
* as an absent/undefined result — the contract `CrtrClientOptions` documents
|
|
879
|
-
* ("a thrown/undefined result is treated as 'no diagnostic'"). */
|
|
880
|
-
function safeColdStartAbort(hook) {
|
|
881
|
-
if (hook === undefined)
|
|
882
|
-
return null;
|
|
883
|
-
try {
|
|
884
|
-
return hook();
|
|
885
|
-
}
|
|
886
|
-
catch {
|
|
887
|
-
return null;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
903
|
export function safeColdStartDiagnostic(hook) {
|
|
891
904
|
if (hook === undefined)
|
|
892
905
|
return undefined;
|
|
@@ -6,6 +6,7 @@ import type { NodeSubjectDTO } from './nodes.js';
|
|
|
6
6
|
* review markers visible in Pi's current branch; crtrd owns the node binding
|
|
7
7
|
* used to decide whether that branch is valid. */
|
|
8
8
|
export interface BrokerSessionBoundRequest {
|
|
9
|
+
executionId: string;
|
|
9
10
|
piSessionId: string;
|
|
10
11
|
sessionFile: string | null;
|
|
11
12
|
pid: number;
|
|
@@ -20,7 +21,10 @@ export interface BrokerSessionBoundResultDTO {
|
|
|
20
21
|
/** `POST /v1/nodes/{id}/broker/settle` body. These are the facts only Pi can
|
|
21
22
|
* know at its settlement boundary; crtrd reads all current canvas state and
|
|
22
23
|
* selects the durable consequence. */
|
|
23
|
-
export interface
|
|
24
|
+
export interface BrokerExecutionRequest {
|
|
25
|
+
expected_execution_id: string;
|
|
26
|
+
}
|
|
27
|
+
export interface BrokerSettleRequest extends BrokerExecutionRequest {
|
|
24
28
|
stopReason: string;
|
|
25
29
|
backgroundJobsRunning: boolean;
|
|
26
30
|
pushedFinal: boolean;
|
|
@@ -44,25 +48,11 @@ export interface BrokerParkActivityResultDTO {
|
|
|
44
48
|
}
|
|
45
49
|
/** `POST /v1/nodes/{id}/broker/park-complete` body. The isolated parking turn
|
|
46
50
|
* has ended; crtrd alone decides whether its pending park still applies. */
|
|
47
|
-
export interface BrokerParkCompleteRequest {
|
|
51
|
+
export interface BrokerParkCompleteRequest extends BrokerExecutionRequest {
|
|
48
52
|
outcome: 'completed' | 'failed';
|
|
49
53
|
}
|
|
50
|
-
/** `POST /v1/nodes/{id}/broker/inbox-cursor` body. The watcher advances this
|
|
51
|
-
* only after Pi has settled every handoff through the supplied physical entry.
|
|
52
|
-
* `brokerPid` binds the commit to the broker generation crtrd currently owns. */
|
|
53
|
-
export interface BrokerInboxCursorRequest {
|
|
54
|
-
throughEntryId: string;
|
|
55
|
-
brokerPid: number;
|
|
56
|
-
}
|
|
57
|
-
/** crtrd either commits the durable cursor or preserves it while a refresh
|
|
58
|
-
* discards the current Pi conversation, so the next broker replays the entry. */
|
|
59
|
-
export type BrokerInboxCursorDirective = {
|
|
60
|
-
action: 'advanced';
|
|
61
|
-
} | {
|
|
62
|
-
action: 'hold_refresh';
|
|
63
|
-
};
|
|
64
54
|
/** Durable model recipe selected by the live broker after Pi accepts a model or thinking change. */
|
|
65
|
-
export interface BrokerModelCommitRequest {
|
|
55
|
+
export interface BrokerModelCommitRequest extends BrokerExecutionRequest {
|
|
66
56
|
spec: string;
|
|
67
57
|
pinnedOverride?: boolean;
|
|
68
58
|
userSelected: boolean;
|
|
@@ -133,7 +123,7 @@ export interface BrokerExtensionStateDTO {
|
|
|
133
123
|
/** Guarded generated-label update. `initial` can only fill a blank generated
|
|
134
124
|
* description; `recap` additionally compares the exact automatic-name snapshot
|
|
135
125
|
* captured before the headless naming call. */
|
|
136
|
-
export type BrokerGeneratedNameRequest = {
|
|
126
|
+
export type BrokerGeneratedNameRequest = BrokerExecutionRequest & ({
|
|
137
127
|
kind: 'initial';
|
|
138
128
|
description: string;
|
|
139
129
|
title: string;
|
|
@@ -150,7 +140,7 @@ export type BrokerGeneratedNameRequest = {
|
|
|
150
140
|
icon: string;
|
|
151
141
|
kind: string;
|
|
152
142
|
};
|
|
153
|
-
};
|
|
143
|
+
});
|
|
154
144
|
/** A daemon-selected Pi editor-label directive. No handler calls a broker.
|
|
155
145
|
* `description`/`title`/`icon` are the values as STORED (an empty title or icon
|
|
156
146
|
* is left unset), so the broker announces what the node now carries rather than
|
|
@@ -162,7 +152,7 @@ export interface BrokerGeneratedNameResultDTO {
|
|
|
162
152
|
title?: string;
|
|
163
153
|
icon?: string;
|
|
164
154
|
}
|
|
165
|
-
export interface BrokerPersonaAckRequest {
|
|
155
|
+
export interface BrokerPersonaAckRequest extends BrokerExecutionRequest {
|
|
166
156
|
from: {
|
|
167
157
|
kind: string;
|
|
168
158
|
mode: 'base' | 'orchestrator';
|
package/dist/api/dto/canvas.d.ts
CHANGED
|
@@ -242,8 +242,7 @@ export interface SnapshotDTO {
|
|
|
242
242
|
subscriptions: Record<string, NodeIdDTO[]>;
|
|
243
243
|
}
|
|
244
244
|
/** One node row in the lean roster (`GET /v1/canvas/roster`). Carries only
|
|
245
|
-
*
|
|
246
|
-
* process-liveness probe. `attention_count`/`last_activity`/`ctx_tokens`/
|
|
245
|
+
* stored node fields, without a process-liveness probe. `attention_count`/`last_activity`/`ctx_tokens`/
|
|
247
246
|
* `streaming`/`hanging`/`viewed` stay on `SnapshotNodeDTO`; a roster consumer
|
|
248
247
|
* that needs attention counts fetches them separately via the existing
|
|
249
248
|
* `POST /v1/canvas/attention/counts` (already scoped to exactly the ids it
|
|
@@ -313,11 +312,3 @@ export interface PruneResultDTO {
|
|
|
313
312
|
dry_run: boolean;
|
|
314
313
|
ttl_days: number;
|
|
315
314
|
}
|
|
316
|
-
/** `POST /v1/canvas/rebuild-index` result. Fails loud server-side when metas
|
|
317
|
-
* exist on disk but the rebuild yields zero rows (a corrupt/empty index). */
|
|
318
|
-
export interface RebuildIndexResultDTO {
|
|
319
|
-
/** How many `nodes/<id>/meta.json` files were found on disk. */
|
|
320
|
-
metas: number;
|
|
321
|
-
/** How many node rows exist in canvas.db after the rebuild. */
|
|
322
|
-
rows: number;
|
|
323
|
-
}
|
package/dist/api/dto/health.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { NodeStatusDTO } from './common.js';
|
|
2
|
+
/** Ephemeral daemon lifecycle phase reported by health and status. */
|
|
3
|
+
export type StartupPhaseDTO = 'initializing' | 'blocked' | 'prepared' | 'recovering' | 'ready';
|
|
2
4
|
/** `GET /healthz` — substrate readiness probe. Versions are informational, never
|
|
3
5
|
* a gate. Used by the provisioning ladder. */
|
|
4
6
|
export interface HealthDTO {
|
|
@@ -6,6 +8,10 @@ export interface HealthDTO {
|
|
|
6
8
|
daemon_up: boolean;
|
|
7
9
|
store_accessible: boolean;
|
|
8
10
|
brokers_reconciled: boolean;
|
|
11
|
+
/** Present while corpus migration or normal daemon startup is incomplete. */
|
|
12
|
+
startup_blocked?: string;
|
|
13
|
+
/** Always present; only `ready` admits normal daemon work. */
|
|
14
|
+
startup_phase: StartupPhaseDTO;
|
|
9
15
|
}
|
|
10
16
|
/** `GET /v1/status` — daemon status snapshot. Backs `crtr sys daemon status`
|
|
11
17
|
* state and the `crtr canvas dashboard` header. `runtime_version` is also
|
|
@@ -24,6 +30,8 @@ export interface StatusDTO {
|
|
|
24
30
|
};
|
|
25
31
|
runtime_version: string;
|
|
26
32
|
api_version: string;
|
|
33
|
+
/** Always present; only `ready` admits normal daemon work. */
|
|
34
|
+
startup_phase: StartupPhaseDTO;
|
|
27
35
|
}
|
|
28
36
|
/** `POST /v1/daemon/restart` — the ack for a daemon-owned handover.
|
|
29
37
|
*
|
|
@@ -33,6 +41,111 @@ export interface StatusDTO {
|
|
|
33
41
|
* `accepted` is therefore a promise about the future, not a completed action —
|
|
34
42
|
* the successor daemon is spawned after `grace_ms`, and every node the
|
|
35
43
|
* teardown interrupts is resumed by it. */
|
|
44
|
+
export interface MigrateStateRequest {
|
|
45
|
+
dry_run?: boolean;
|
|
46
|
+
dirs?: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface MigrateStateDTO {
|
|
49
|
+
profiles: number;
|
|
50
|
+
stores: number;
|
|
51
|
+
changed: number;
|
|
52
|
+
applied: {
|
|
53
|
+
store: string;
|
|
54
|
+
lane: string;
|
|
55
|
+
migration: string;
|
|
56
|
+
files: string[];
|
|
57
|
+
}[];
|
|
58
|
+
skipped: {
|
|
59
|
+
store: string;
|
|
60
|
+
relPath: string;
|
|
61
|
+
error: string;
|
|
62
|
+
}[];
|
|
63
|
+
blockers: {
|
|
64
|
+
kind: string;
|
|
65
|
+
message: string;
|
|
66
|
+
store?: string;
|
|
67
|
+
target?: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
paths?: readonly string[];
|
|
71
|
+
}[];
|
|
72
|
+
discovery_roots: {
|
|
73
|
+
reason: string;
|
|
74
|
+
root: string;
|
|
75
|
+
boundary: string;
|
|
76
|
+
detail?: string;
|
|
77
|
+
}[];
|
|
78
|
+
discovered_stores: {
|
|
79
|
+
store: string;
|
|
80
|
+
scope: string;
|
|
81
|
+
namespace: string;
|
|
82
|
+
mount_status: string;
|
|
83
|
+
writable: boolean;
|
|
84
|
+
reasons: string[];
|
|
85
|
+
targets: readonly string[];
|
|
86
|
+
docs: number;
|
|
87
|
+
}[];
|
|
88
|
+
discovered_targets: {
|
|
89
|
+
id: string;
|
|
90
|
+
kind: string;
|
|
91
|
+
origin: string;
|
|
92
|
+
cwd: string;
|
|
93
|
+
profile_id: string | null;
|
|
94
|
+
node_id: string | null;
|
|
95
|
+
stores: readonly string[];
|
|
96
|
+
}[];
|
|
97
|
+
repository_namespaces: {
|
|
98
|
+
repository_root: string;
|
|
99
|
+
repository_key: string;
|
|
100
|
+
declaration_path: string;
|
|
101
|
+
namespace: string;
|
|
102
|
+
source: string;
|
|
103
|
+
action: string;
|
|
104
|
+
}[];
|
|
105
|
+
store_prefixes: {
|
|
106
|
+
store_root: string;
|
|
107
|
+
owner_dir: string;
|
|
108
|
+
repository_root: string;
|
|
109
|
+
owner_relative_path: string;
|
|
110
|
+
old_prefix: string;
|
|
111
|
+
old_rule: string;
|
|
112
|
+
effective_prefix: string;
|
|
113
|
+
nested_declaration_action: string;
|
|
114
|
+
front_door_action: string;
|
|
115
|
+
}[];
|
|
116
|
+
renames: {
|
|
117
|
+
store_root: string;
|
|
118
|
+
path: string;
|
|
119
|
+
from: string;
|
|
120
|
+
to: string;
|
|
121
|
+
}[];
|
|
122
|
+
references: {
|
|
123
|
+
store_root: string;
|
|
124
|
+
path: string;
|
|
125
|
+
kind: string;
|
|
126
|
+
from: string;
|
|
127
|
+
to: string;
|
|
128
|
+
}[];
|
|
129
|
+
dryRun: boolean;
|
|
130
|
+
blocked: boolean;
|
|
131
|
+
corpus_phase: 'not-started' | 'planned' | 'written';
|
|
132
|
+
wrote: {
|
|
133
|
+
profile_manifests: string[];
|
|
134
|
+
documents: string[];
|
|
135
|
+
corpus_consumers: string[];
|
|
136
|
+
corpus_identities: string[];
|
|
137
|
+
};
|
|
138
|
+
resumed: boolean;
|
|
139
|
+
resume_error?: string;
|
|
140
|
+
}
|
|
141
|
+
/** `POST /v1/daemon/admit` — opens normal daemon work after preparation. */
|
|
142
|
+
export interface DaemonAdmitDTO {
|
|
143
|
+
/** True only for the request that began admission. */
|
|
144
|
+
admitted: boolean;
|
|
145
|
+
/** True when another request had already begun or completed admission. */
|
|
146
|
+
already_admitted: boolean;
|
|
147
|
+
startup_phase: StartupPhaseDTO;
|
|
148
|
+
}
|
|
36
149
|
export interface DaemonRestartDTO {
|
|
37
150
|
accepted: boolean;
|
|
38
151
|
/** The daemon that took the request and is about to hand over. */
|