@north-light/crouter 0.3.233 → 0.3.234
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.js +16 -15
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/integration/provider-rotation.test.ts +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +14 -17
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crtr-commands/index.ts +7 -11
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/frontmatter-rules/index.ts +8 -8
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +10 -11
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/pi-shell-runner.ts +2 -2
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.d.ts +3 -3
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.js +7 -7
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +8 -8
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/statusline.ts +6 -6
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/sysprompt-window.ts +3 -3
- package/dist/builtin-pi-packages/pi-crtr-extensions/lib/subscription-state.ts +1 -1
- package/dist/clients/attach/chrome/ticket-panel.js +15 -2
- package/dist/clients/attach/overlays/graph.js +0 -3
- package/dist/clients/attach/overlays/mcp.js +1 -2
- package/dist/clients/attach/render/chat-view.js +0 -12
- package/dist/clients/attach/render/crtr-output.js +0 -2
- package/dist/clients/attach/render/tool-calls.js +0 -6
- package/dist/clients/attach/slash/dispatch.js +8 -11
- package/dist/clients/attach/viewer.js +532 -534
- package/dist/clients/conversation/projection.js +0 -2
- package/dist/clients/inbox/controller.js +22 -3
- package/dist/clients/inbox/review/companion-pane.js +0 -4
- package/dist/clients/inbox/review-adapter.js +0 -7
- package/dist/clients/inbox/tui/slots.d.ts +3 -3
- package/dist/clients/inbox/tui/types.d.ts +2 -2
- package/dist/commands/api-client.js +0 -8
- package/dist/commands/attention.js +0 -8
- package/dist/commands/canvas-browse.js +2 -1
- package/dist/commands/canvas-config.js +0 -10
- package/dist/commands/canvas-history.js +2 -1
- package/dist/commands/cron.js +5 -18
- package/dist/commands/dashboard.js +0 -2
- package/dist/commands/human/feedback.js +2 -1
- package/dist/commands/human/prompts.js +2 -5
- package/dist/commands/human/queue.js +2 -7
- package/dist/commands/human/request.js +0 -14
- package/dist/commands/human/review.js +2 -1
- package/dist/commands/memory/__tests__/command-selector-and-mutation-guards.test.js +4 -4
- package/dist/commands/memory/find.js +2 -2
- package/dist/commands/memory/lint.js +2 -1
- package/dist/commands/memory/read.d.ts +2 -7
- package/dist/commands/memory/read.js +5 -16
- package/dist/commands/memory/shared.js +4 -7
- package/dist/commands/memory/write.js +4 -3
- package/dist/commands/node/bash.js +2 -1
- package/dist/commands/node/create.js +2 -1
- package/dist/commands/node/inspect.js +0 -6
- package/dist/commands/node/lifecycle.js +4 -13
- package/dist/commands/node/message.js +3 -2
- package/dist/commands/node/subscription.js +2 -1
- package/dist/commands/node/wait.js +4 -3
- package/dist/commands/node-context.js +2 -1
- package/dist/commands/node-lifecycle-revive.js +0 -2
- package/dist/commands/node-worktree.js +2 -1
- package/dist/commands/pkg/browse/actions.d.ts +1 -1
- package/dist/commands/pkg/browse/actions.js +4 -4
- package/dist/commands/pkg/browse/catalog.d.ts +1 -1
- package/dist/commands/pkg/browse/catalog.js +15 -15
- package/dist/commands/pkg/browse/command-view.d.ts +1 -1
- package/dist/commands/pkg/browse/command-view.js +3 -3
- package/dist/commands/pkg/browse/detail-panel.d.ts +1 -1
- package/dist/commands/pkg/browse/detail-panel.js +8 -8
- package/dist/commands/pkg/browse/doc-view.d.ts +1 -1
- package/dist/commands/pkg/browse/doc-view.js +3 -3
- package/dist/commands/pkg/browse/list-panel.d.ts +1 -1
- package/dist/commands/pkg/browse/list-panel.js +3 -3
- package/dist/commands/pkg/browse/model.d.ts +3 -3
- package/dist/commands/pkg/browse/shell.d.ts +2 -2
- package/dist/commands/pkg/browse/shell.js +13 -13
- package/dist/commands/pkg/plugin-manage.js +2 -1
- package/dist/commands/pkg/shared.js +0 -2
- package/dist/commands/profile/delete.js +2 -1
- package/dist/commands/push.js +2 -3
- package/dist/commands/revive.js +0 -2
- package/dist/commands/surface/node/placement.js +2 -1
- package/dist/commands/surface-edit.js +2 -1
- package/dist/commands/sys/config.js +0 -4
- package/dist/commands/sys/daemon.js +0 -10
- package/dist/commands/sys/doctor.js +3 -2
- package/dist/commands/sys/panels/broker-limits-panel.d.ts +2 -2
- package/dist/commands/sys/panels/broker-limits-panel.js +4 -4
- package/dist/commands/sys/panels/dependencies-panel.d.ts +2 -2
- package/dist/commands/sys/panels/dependencies-panel.js +2 -2
- package/dist/commands/sys/panels/keybindings-panel.d.ts +1 -1
- package/dist/commands/sys/panels/keybindings-panel.js +5 -5
- package/dist/commands/sys/panels/models-panel.d.ts +4 -4
- package/dist/commands/sys/panels/models-panel.js +11 -10
- package/dist/commands/sys/panels/plugins-panel.d.ts +2 -2
- package/dist/commands/sys/panels/plugins-panel.js +2 -2
- package/dist/commands/sys/panels/prefs-panel.d.ts +2 -2
- package/dist/commands/sys/panels/prefs-panel.js +4 -4
- package/dist/commands/sys/panels/profiles-panel.d.ts +1 -1
- package/dist/commands/sys/panels/profiles-panel.js +14 -13
- package/dist/commands/sys/panels/provider-panel.d.ts +3 -3
- package/dist/commands/sys/panels/provider-panel.js +8 -8
- package/dist/commands/sys/settings-shell.d.ts +3 -3
- package/dist/commands/sys/settings-shell.js +15 -15
- package/dist/commands/sys/setup-settings-runner.d.ts +3 -3
- package/dist/commands/sys/setup-settings-runner.js +5 -5
- package/dist/commands/sys/setup-wizard.d.ts +4 -4
- package/dist/commands/sys/setup-wizard.js +8 -8
- package/dist/commands/sys/support/prepare.js +4 -4
- package/dist/commands/sys/support/submit.js +2 -2
- package/dist/commands/sys/sync-deps.js +0 -2
- package/dist/commands/sys/sync-project-guidance.js +2 -1
- package/dist/commands/sys/sysprompt.js +2 -1
- package/dist/core/__tests__/boot.test.js +0 -8
- package/dist/core/__tests__/broker-extension-canvas-db-boundary.test.js +23 -1
- package/dist/core/__tests__/canvas-db-boundary.test.d.ts +1 -0
- package/dist/core/__tests__/canvas-db-boundary.test.js +46 -0
- package/dist/core/__tests__/canvas.test.js +1 -1
- package/dist/core/__tests__/child-death-wake.test.js +0 -2
- package/dist/core/__tests__/cron-armed-context-failure.test.d.ts +1 -0
- package/dist/core/__tests__/cron-armed-context-failure.test.js +145 -0
- package/dist/core/__tests__/daemon-wedge.test.js +0 -4
- package/dist/core/__tests__/dead-node-policy-table.test.js +0 -4
- package/dist/core/__tests__/fixtures/fake-engine.js +4 -14
- package/dist/core/__tests__/fixtures/fake-pi-host.js +5 -5
- package/dist/core/__tests__/focuses.test.js +0 -6
- package/dist/core/__tests__/fs-utils.test.d.ts +1 -0
- package/dist/core/__tests__/fs-utils.test.js +50 -0
- package/dist/core/__tests__/helpers/harness.js +1 -1
- package/dist/core/__tests__/inline-memory-refs.test.js +0 -2
- package/dist/core/__tests__/integration/broker-fork-seam.test.js +0 -2
- package/dist/core/__tests__/integration/broker-sdk-wiring.test.js +3 -16
- package/dist/core/__tests__/integration/command-plugins.test.js +0 -24
- package/dist/core/__tests__/integration/deferred-no-wake.test.js +0 -6
- package/dist/core/__tests__/integration/flagship-lifecycle.test.js +0 -26
- package/dist/core/__tests__/integration/live-mutation-verbs.test.js +0 -4
- package/dist/core/__tests__/integration/live-mutation.test.js +1 -5
- package/dist/core/__tests__/integration/refresh-stall-recycle.test.js +1 -5
- package/dist/core/__tests__/integration/revive.test.js +0 -12
- package/dist/core/__tests__/integration/subscription-delivery.test.js +0 -6
- package/dist/core/__tests__/integration/tmux-surface.test.js +24 -8
- package/dist/core/__tests__/integration/worktree-reap.test.js +0 -6
- package/dist/core/__tests__/lifecycle.test.js +0 -18
- package/dist/core/__tests__/memory-resolver-precedence.test.js +1 -1
- package/dist/core/__tests__/migration.test.js +2 -2
- package/dist/core/__tests__/on-read-dedup-resume.test.js +3 -3
- package/dist/core/__tests__/pid-identity-match.test.js +1 -1
- package/dist/core/__tests__/plugin-kinds.test.js +1 -1
- package/dist/core/__tests__/plugin-page-components.test.js +1 -1
- package/dist/core/__tests__/preview-registry-sync.test.js +42 -1
- package/dist/core/__tests__/respawn-throttle.test.js +0 -4
- package/dist/core/__tests__/revive-all.test.js +5 -5
- package/dist/core/__tests__/revive-parked-fresh.test.js +62 -11
- package/dist/core/__tests__/seam/broker-attach-multiclient.test.js +0 -8
- package/dist/core/__tests__/seam/broker-attach-stream.test.js +0 -8
- package/dist/core/__tests__/seam/broker-crash-teardown.test.js +0 -2
- package/dist/core/__tests__/tmux-driver-boundary.test.d.ts +1 -0
- package/dist/core/__tests__/tmux-driver-boundary.test.js +50 -0
- package/dist/core/activity-signal.d.ts +7 -0
- package/dist/core/activity-signal.js +38 -0
- package/dist/core/auto-update.js +2 -1
- package/dist/core/bootstrap.js +2 -1
- package/dist/core/canvas/__tests__/remote-canvas-source.test.js +1 -1
- package/dist/core/canvas/__tests__/remote-transport.test.js +1 -1
- package/dist/core/canvas/__tests__/render-remote.test.js +1 -1
- package/dist/core/canvas/browse/app.js +3 -2
- package/dist/core/canvas/browse/model.d.ts +1 -1
- package/dist/core/canvas/browse/model.js +0 -4
- package/dist/core/canvas/canvas.d.ts +22 -0
- package/dist/core/canvas/canvas.js +50 -18
- package/dist/core/canvas/crons.js +0 -6
- package/dist/core/canvas/db.d.ts +14 -20
- package/dist/core/canvas/db.js +30 -1332
- package/dist/core/canvas/focuses.js +0 -4
- package/dist/core/canvas/history.js +2 -1
- package/dist/core/canvas/migrations.d.ts +20 -0
- package/dist/core/canvas/migrations.js +1339 -0
- package/dist/core/canvas/nav-model.js +1 -11
- package/dist/core/canvas/nav-render.js +0 -8
- package/dist/core/canvas/remote-canvas-source.js +0 -2
- package/dist/core/canvas/render-source.js +31 -13
- package/dist/core/command-manifests/manifest.js +0 -10
- package/dist/core/command-manifests/schema.js +0 -4
- package/dist/core/command-plugins/transport/http-invoke.js +0 -14
- package/dist/core/command.js +0 -4
- package/dist/core/config.js +2 -1
- package/dist/core/feed/inbox.d.ts +10 -0
- package/dist/core/feed/inbox.js +18 -12
- package/dist/core/fs-utils.d.ts +9 -2
- package/dist/core/fs-utils.js +7 -15
- package/dist/core/help.js +0 -8
- package/dist/core/host-exports/export.d.ts +2 -2
- package/dist/core/host-exports/export.js +9 -12
- package/dist/core/human/answer.d.ts +2 -2
- package/dist/core/human/convention.d.ts +2 -5
- package/dist/core/human/convention.js +3 -13
- package/dist/core/human/page-schema.d.ts +2 -2
- package/dist/core/human/page-schema.js +2 -2
- package/dist/core/human/root.js +6 -23
- package/dist/core/human/scan.js +24 -7
- package/dist/core/human/tickets.d.ts +4 -1
- package/dist/core/human/tickets.js +20 -6
- package/dist/core/io.js +0 -12
- package/dist/core/memory/identity.js +0 -4
- package/dist/core/memory/inline-ref-inventory.js +3 -2
- package/dist/core/memory/lint.js +3 -6
- package/dist/core/memory-resolver.d.ts +5 -0
- package/dist/core/memory-resolver.js +14 -12
- package/dist/core/pagination.js +0 -2
- package/dist/core/preview-registry.d.ts +14 -0
- package/dist/core/preview-registry.js +2 -4
- package/dist/core/preview-result-path.js +2 -1
- package/dist/core/profiles/manifest.d.ts +37 -5
- package/dist/core/profiles/manifest.js +44 -24
- package/dist/core/profiles/select.js +0 -4
- package/dist/core/review/signal.js +4 -23
- package/dist/core/review/ticket-filter.d.ts +3 -3
- package/dist/core/review/ticket-filter.js +4 -9
- package/dist/core/runtime/__tests__/engine-route.test.js +1 -1
- package/dist/core/runtime/__tests__/spawn-env.test.js +0 -8
- package/dist/core/runtime/bearings-render.d.ts +56 -0
- package/dist/core/runtime/bearings-render.js +241 -0
- package/dist/core/runtime/bearings.d.ts +2 -17
- package/dist/core/runtime/bearings.js +12 -198
- package/dist/core/runtime/broker/auth-reload.d.ts +39 -0
- package/dist/core/runtime/broker/auth-reload.js +149 -0
- package/dist/core/runtime/broker/engine-drive.d.ts +26 -0
- package/dist/core/runtime/broker/engine-drive.js +257 -0
- package/dist/core/runtime/broker/engine-routing.d.ts +143 -0
- package/dist/core/runtime/broker/engine-routing.js +211 -0
- package/dist/core/runtime/broker/event-projection.js +3 -2
- package/dist/core/runtime/broker/fault-retry.js +5 -4
- package/dist/core/runtime/broker/frame-client.d.ts +38 -0
- package/dist/core/runtime/broker/frame-client.js +129 -0
- package/dist/core/runtime/broker/frame-dispatch.d.ts +12 -189
- package/dist/core/runtime/broker/frame-dispatch.js +89 -1476
- package/dist/core/runtime/broker/frame-engine-control.d.ts +20 -0
- package/dist/core/runtime/broker/frame-engine-control.js +231 -0
- package/dist/core/runtime/broker/frame-memory-refs.d.ts +19 -0
- package/dist/core/runtime/broker/frame-memory-refs.js +41 -0
- package/dist/core/runtime/broker/frame-model-query.d.ts +13 -0
- package/dist/core/runtime/broker/frame-model-query.js +69 -0
- package/dist/core/runtime/broker/frame-read.d.ts +19 -0
- package/dist/core/runtime/broker/frame-read.js +116 -0
- package/dist/core/runtime/broker/frame-replies.d.ts +24 -0
- package/dist/core/runtime/broker/frame-replies.js +64 -0
- package/dist/core/runtime/broker/frame-session.d.ts +34 -0
- package/dist/core/runtime/broker/frame-session.js +203 -0
- package/dist/core/runtime/broker/turn-ignition.d.ts +42 -0
- package/dist/core/runtime/broker/turn-ignition.js +74 -0
- package/dist/core/runtime/broker-extension-render.js +9 -85
- package/dist/core/runtime/broker-protocol.js +0 -4
- package/dist/core/runtime/broker-sdk.js +2 -1
- package/dist/core/runtime/broker.d.ts +1 -1
- package/dist/core/runtime/broker.js +5 -23
- package/dist/core/runtime/fault.js +3 -2
- package/dist/core/runtime/headless-pi.js +3 -2
- package/dist/core/runtime/host.js +2 -3
- package/dist/core/runtime/kickoff.js +0 -4
- package/dist/core/runtime/launch-target.js +2 -1
- package/dist/core/runtime/launch.js +3 -6
- package/dist/core/runtime/lifecycle.js +17 -26
- package/dist/core/runtime/managed-provider-cooling.d.ts +1 -1
- package/dist/core/runtime/naming.js +0 -2
- package/dist/core/runtime/nodes.js +2 -1
- package/dist/core/runtime/persona.js +0 -6
- package/dist/core/runtime/placement-tmux.js +2 -5
- package/dist/core/runtime/placement.js +4 -11
- package/dist/core/runtime/recap.js +4 -3
- package/dist/core/runtime/reopen.js +4 -7
- package/dist/core/runtime/reset.js +0 -4
- package/dist/core/runtime/resume-root.js +0 -2
- package/dist/core/runtime/revive.js +17 -13
- package/dist/core/runtime/session-list-cache.js +2 -2
- package/dist/core/runtime/shell-expansion.js +0 -2
- package/dist/core/runtime/spawn.js +0 -2
- package/dist/core/runtime/stream-watchdog.d.ts +0 -1
- package/dist/core/runtime/stream-watchdog.js +13 -18
- package/dist/core/runtime/tmux-bindings.js +0 -2
- package/dist/core/runtime/tmux-driver.d.ts +12 -0
- package/dist/core/runtime/tmux-driver.js +18 -13
- package/dist/core/runtime/warm-pool.js +0 -4
- package/dist/core/scope.js +4 -3
- package/dist/core/spawn.js +2 -3
- package/dist/core/subscription-state.js +10 -17
- package/dist/core/substrate/__tests__/surface-match-pre-command.test.js +3 -3
- package/dist/core/substrate/render.js +0 -12
- package/dist/core/substrate/schema.js +0 -12
- package/dist/core/substrate/surface-match.js +0 -2
- package/dist/core/termrender/display.js +2 -1
- package/dist/core/tui/page-host.d.ts +3 -3
- package/dist/core/tui/page-host.js +4 -4
- package/dist/core/tui/panel.js +3 -3
- package/dist/core/wake.js +0 -12
- package/dist/core/worktree.js +0 -2
- package/dist/daemon/__tests__/reconciler-signature.test.d.ts +1 -0
- package/dist/daemon/__tests__/reconciler-signature.test.js +36 -0
- package/dist/daemon/api/__tests__/seam/api-server.test.js +2 -16
- package/dist/daemon/api/__tests__/seam/b10-attach-modelauth.test.js +3 -11
- package/dist/daemon/api/__tests__/seam/leaf-api-parity.test.js +0 -6
- package/dist/daemon/api/handlers/attach.js +2 -1
- package/dist/daemon/api/handlers/broker-ops.js +3 -6
- package/dist/daemon/api/handlers/canvas.js +12 -18
- package/dist/daemon/api/handlers/feedback-comments.js +0 -8
- package/dist/daemon/api/handlers/health.js +3 -2
- package/dist/daemon/api/handlers/human-requests.js +0 -10
- package/dist/daemon/api/handlers/human.js +1 -5
- package/dist/daemon/api/handlers/inbox.js +0 -18
- package/dist/daemon/api/handlers/memory.js +1 -1
- package/dist/daemon/api/handlers/messages.js +4 -8
- package/dist/daemon/api/handlers/nodes.js +10 -21
- package/dist/daemon/api/handlers/reports.js +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -6
- package/dist/daemon/api/map.js +0 -6
- package/dist/daemon/api/router.js +0 -4
- package/dist/daemon/api/server.js +2 -5
- package/dist/daemon/boot-migrations.d.ts +14 -0
- package/dist/daemon/boot-migrations.js +31 -0
- package/dist/daemon/cron/armed-context.d.ts +21 -0
- package/dist/daemon/cron/armed-context.js +100 -0
- package/dist/daemon/cron/capture.d.ts +20 -0
- package/dist/daemon/cron/capture.js +45 -0
- package/dist/daemon/cron/disposition.d.ts +19 -0
- package/dist/daemon/cron/disposition.js +52 -0
- package/dist/daemon/cron/escalation.d.ts +12 -0
- package/dist/daemon/cron/escalation.js +124 -0
- package/dist/daemon/cron/held.d.ts +4 -0
- package/dist/daemon/cron/held.js +20 -0
- package/dist/daemon/cron/lease-recovery.d.ts +3 -0
- package/dist/daemon/cron/lease-recovery.js +119 -0
- package/dist/daemon/cron/live-runs.d.ts +11 -0
- package/dist/daemon/cron/live-runs.js +23 -0
- package/dist/daemon/cron/passes.d.ts +11 -0
- package/dist/daemon/cron/passes.js +78 -0
- package/dist/daemon/cron/settle.d.ts +28 -0
- package/dist/daemon/cron/settle.js +37 -0
- package/dist/daemon/cron/sinks.d.ts +2 -0
- package/dist/daemon/cron/sinks.js +100 -0
- package/dist/daemon/cron-run.d.ts +5 -41
- package/dist/daemon/cron-run.js +193 -882
- package/dist/daemon/crtrd-cli.js +2 -1
- package/dist/daemon/crtrd.js +22 -22
- package/dist/daemon/fleet.js +0 -4
- package/dist/daemon/human/deliver-action.js +2 -1
- package/dist/daemon/human/sweep.js +15 -4
- package/dist/daemon/manage.d.ts +2 -2
- package/dist/daemon/manage.js +4 -13
- package/dist/daemon/pidfile.js +2 -2
- package/dist/daemon/reconcilers/broker-supervision.js +26 -29
- package/dist/daemon/reconcilers/dormant-inbox.d.ts +1 -1
- package/dist/daemon/reconcilers/dormant-inbox.js +2 -1
- package/dist/daemon/reconcilers/live-obligation.js +2 -2
- package/dist/daemon/reconcilers/pending-review-submit.d.ts +1 -1
- package/dist/daemon/reconcilers/pending-review-submit.js +2 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +2 -1
- package/dist/daemon/reconcilers/storage-maintenance.js +2 -1
- package/dist/daemon/review/companion.js +2 -2
- package/dist/daemon/review/sweep.js +8 -3
- package/dist/migrations/001-surfaces-frontmatter.js +0 -6
- package/dist/migrations/corpus.js +2 -5
- package/dist/migrations/registry.js +15 -2
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +0 -4
- package/dist/pi-extensions/broker-local.js +2 -1
- package/dist/pi-extensions/canvas-bash-valve.js +3 -17
- package/dist/pi-extensions/canvas-context-intro.js +2 -7
- package/dist/pi-extensions/canvas-doc-substrate.js +2 -3
- package/dist/pi-extensions/canvas-goal-capture.js +2 -1
- package/dist/pi-extensions/canvas-inbox-watcher.js +5 -12
- package/dist/pi-extensions/canvas-passive-context.js +2 -5
- package/dist/pi-extensions/canvas-preview-result.js +2 -1
- package/dist/pi-extensions/canvas-prompt-scrub.js +2 -1
- package/dist/pi-extensions/canvas-recap.js +3 -16
- package/dist/pi-extensions/canvas-review-boundary.js +2 -5
- package/dist/pi-extensions/canvas-stophook.js +2 -26
- package/dist/pi-extensions/canvas-structured-output.js +2 -1
- package/dist/pi-extensions/canvas-tool-guide.js +2 -1
- package/dist/shared/__tests__/env-boundary.test.d.ts +1 -0
- package/dist/shared/__tests__/env-boundary.test.js +93 -0
- package/dist/shared/env.d.ts +68 -0
- package/dist/shared/env.js +171 -0
- package/package.json +3 -1
- package/runtime.lock.json +2 -2
- package/dist/core/canvas/render.d.ts +0 -47
- package/dist/core/canvas/render.js +0 -245
|
@@ -164,12 +164,10 @@ export function applyToolGroupSummary(state, key, summary) {
|
|
|
164
164
|
function roleOf(m) {
|
|
165
165
|
return m.role ?? '';
|
|
166
166
|
}
|
|
167
|
-
// ---------------------------------------------------------------------------
|
|
168
167
|
// `!` bash execution (broker bash_start/bash_output/bash_end frames). These are
|
|
169
168
|
// broker control frames, NOT AgentSessionEvents, so the hook routes them here
|
|
170
169
|
// explicitly. They build a synthetic `bashExecution` message in the transcript
|
|
171
170
|
// that mirrors the one pi persists to context — rendered by MessageView.
|
|
172
|
-
// ---------------------------------------------------------------------------
|
|
173
171
|
/** Index of the most recent bashExecution message (the active `!` run), or null. */
|
|
174
172
|
function lastBashIndex(state) {
|
|
175
173
|
for (let i = state.messages.length - 1; i >= 0; i--) {
|
|
@@ -66,7 +66,7 @@ export class InboxController {
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
if (this.adapter !== undefined && priorDir !== undefined) {
|
|
69
|
-
const canceled =
|
|
69
|
+
const canceled = readTicketResultOrNull(priorDir)?.kind === 'canceled';
|
|
70
70
|
if (canceled)
|
|
71
71
|
clearProgress(priorDir);
|
|
72
72
|
// Suppress the "resolved elsewhere" banner when WE are the ones resolving
|
|
@@ -213,7 +213,7 @@ export class InboxController {
|
|
|
213
213
|
}
|
|
214
214
|
catch (error) {
|
|
215
215
|
this.status = resolveFailureKind(error) === 'already_resolved'
|
|
216
|
-
?
|
|
216
|
+
? safeCanonicalResultStatus(item.dir)
|
|
217
217
|
: daemonErrorMessage(error);
|
|
218
218
|
}
|
|
219
219
|
finally {
|
|
@@ -352,7 +352,7 @@ export class InboxController {
|
|
|
352
352
|
return;
|
|
353
353
|
}
|
|
354
354
|
if (failure === 'already_resolved')
|
|
355
|
-
this.status =
|
|
355
|
+
this.status = safeCanonicalResultStatus(claim.dir);
|
|
356
356
|
this.leaveDetail(false);
|
|
357
357
|
this.rescan();
|
|
358
358
|
this.markDirty();
|
|
@@ -537,3 +537,22 @@ function canonicalResultStatus(result) {
|
|
|
537
537
|
return 'ticket was already resolved: page submitted';
|
|
538
538
|
return 'ticket was already canceled';
|
|
539
539
|
}
|
|
540
|
+
/** `readTicketResult` throws on a corrupt result file. In this long-lived TUI
|
|
541
|
+
* process there is no top-level catch, so a corrupt file must surface as a
|
|
542
|
+
* status line rather than crash the inbox. */
|
|
543
|
+
function readTicketResultOrNull(dir) {
|
|
544
|
+
try {
|
|
545
|
+
return readTicketResult(dir);
|
|
546
|
+
}
|
|
547
|
+
catch {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function safeCanonicalResultStatus(dir) {
|
|
552
|
+
try {
|
|
553
|
+
return canonicalResultStatus(readTicketResult(dir));
|
|
554
|
+
}
|
|
555
|
+
catch (error) {
|
|
556
|
+
return `ticket result is unreadable: ${error instanceof Error ? error.message : String(error)}`;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
@@ -4,17 +4,13 @@
|
|
|
4
4
|
// review knowledge beyond the ids it is handed.
|
|
5
5
|
import { inTmux, liveViewerPanes, paneRunning, paneSize, splitWindow, paneExists, getPaneOption, closePane, } from '../../../core/runtime/placement-tmux.js';
|
|
6
6
|
import { viewerEnv } from '../../../commands/surface/node/placement.js';
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
7
|
// Constants
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
8
|
export const SPLIT_MIN_COLS = 99;
|
|
11
9
|
export const MIN_COMPANION_COLS = 40;
|
|
12
10
|
export const MIN_COMPANION_ROWS = 12;
|
|
13
11
|
export const COMPANION_WIDTH_RATIO = 0.42;
|
|
14
12
|
export const COMPANION_HEIGHT_RATIO = 0.40;
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
13
|
// Pane lifecycle
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
14
|
/** Open or adopt a companion pane for a review. Adoption succeeds only when
|
|
19
15
|
* an existing validated-live companion viewer pane exists; otherwise, a
|
|
20
16
|
* fresh pane is split beside the caller. */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { basename } from 'node:path';
|
|
2
|
-
import { ApiError } from '../../api/errors.js';
|
|
3
2
|
import { openReviewWindow } from './review/launch.js';
|
|
4
3
|
import { createReviewClient, ReviewTerminalError, terminalRefusalNotice } from './review/review-client.js';
|
|
5
4
|
/** Resolve a durable review ticket and open it in its own tmux window. */
|
|
@@ -42,11 +41,5 @@ export class ReviewAdapter {
|
|
|
42
41
|
function noticeForBridgeFailure(error) {
|
|
43
42
|
if (error instanceof ReviewTerminalError)
|
|
44
43
|
return terminalRefusalNotice(error);
|
|
45
|
-
if (isReviewPredatesSystem(error)) {
|
|
46
|
-
return 'This review predates canonical review records — cancel it and re-file the review.';
|
|
47
|
-
}
|
|
48
44
|
return error instanceof Error ? error.message : String(error);
|
|
49
45
|
}
|
|
50
|
-
function isReviewPredatesSystem(error) {
|
|
51
|
-
return error instanceof ApiError && error.status === 409 && error.code === 'review_predates_system';
|
|
52
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PageCommentAnchor, PageSlot, SlotResponse, TableConfig } from '../../../core/human/page-schema.js';
|
|
2
2
|
import type { TuiState } from './types.js';
|
|
3
3
|
export type SelectGroup = 'option' | 'card' | 'row' | 'column';
|
|
4
4
|
export type ActionRow = {
|
|
@@ -28,6 +28,6 @@ export declare function tableMarkdown(config: TableConfig): string;
|
|
|
28
28
|
export declare function responseAnswers(state: Pick<TuiState, 'manifest'>, slot: PageSlot, response: SlotResponse): boolean;
|
|
29
29
|
export declare function slotAnswered(state: TuiState, slot: PageSlot): boolean;
|
|
30
30
|
export declare function pageComplete(state: Pick<TuiState, 'manifest' | 'responses'>): boolean;
|
|
31
|
-
export declare function commentIdFor(anchor:
|
|
31
|
+
export declare function commentIdFor(anchor: PageCommentAnchor): string;
|
|
32
32
|
/** The response-comment anchors this component may author: options take per-option, tables take rows only. */
|
|
33
|
-
export declare function commentAnchors(slot: PageSlot):
|
|
33
|
+
export declare function commentAnchors(slot: PageSlot): PageCommentAnchor[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Key } from './keys.js';
|
|
2
2
|
import type { ProductPageComponents } from '../../../types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PageCommentAnchor, PageManifest, PageResponses, PageSlot, SlotResponse } from '../../../core/human/page-schema.js';
|
|
4
4
|
export type Phase = 'overview' | 'item-review' | 'final';
|
|
5
5
|
export type InputMode = null | {
|
|
6
6
|
kind: 'comment';
|
|
7
7
|
buffer: string;
|
|
8
8
|
cursor: number;
|
|
9
|
-
anchor:
|
|
9
|
+
anchor: PageCommentAnchor;
|
|
10
10
|
} | {
|
|
11
11
|
kind: 'freetext';
|
|
12
12
|
buffer: string;
|
|
@@ -24,9 +24,7 @@ import { readState } from '../core/config.js';
|
|
|
24
24
|
import { resolveRemoteCanvasTarget } from '../core/remote-canvas-target.js';
|
|
25
25
|
import { RemoteCanvasSource } from '../core/canvas/remote-canvas-source.js';
|
|
26
26
|
import { crtrHome } from '../core/canvas/paths.js';
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
27
|
// Error translation
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
28
|
/** Rethrow an `ApiError` as the clean structured CLI error agents parse
|
|
31
29
|
* (`core/io` `handle`) — instead of the generic "internal bug" stderr path a
|
|
32
30
|
* raw non-`CrtrError` throw would take. The mapping itself lives in ONE place
|
|
@@ -57,9 +55,7 @@ export async function getNodeOrNull(nodeId) {
|
|
|
57
55
|
rethrowAsCliError(err);
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
58
|
// cliClient — the one place the CLI constructs a daemon client
|
|
62
|
-
// ---------------------------------------------------------------------------
|
|
63
59
|
/** Bounded tail of crtrd.err surfaced on a cold-start `/healthz` timeout.
|
|
64
60
|
* Large enough to catch a real startup failure/stack trace,
|
|
65
61
|
* small enough that a runaway daemon log can never leak unbounded into a CLI
|
|
@@ -133,9 +129,7 @@ export function cliClient(opts) {
|
|
|
133
129
|
coldStartPollWindowMs: DAEMON_STARTUP_WINDOW_MS,
|
|
134
130
|
});
|
|
135
131
|
}
|
|
136
|
-
// ---------------------------------------------------------------------------
|
|
137
132
|
// ApiCanvasSource — a read CanvasSource backed entirely by the crtrd API
|
|
138
|
-
// ---------------------------------------------------------------------------
|
|
139
133
|
// NodeSummaryDTO now carries every NodeRow field and NodeDetailDTO extends it,
|
|
140
134
|
// so the viewer adapter returns the daemon's typed projections directly. It
|
|
141
135
|
// performs no lossy legacy reconstruction or invented local-presence values.
|
|
@@ -268,9 +262,7 @@ export class ApiCanvasSource {
|
|
|
268
262
|
return false;
|
|
269
263
|
}
|
|
270
264
|
}
|
|
271
|
-
// ---------------------------------------------------------------------------
|
|
272
265
|
// cliCanvasSource — the source selector (mirrors resolveCanvasSource)
|
|
273
|
-
// ---------------------------------------------------------------------------
|
|
274
266
|
/** The active read source for a CLI command. Mirrors `resolveCanvasSource`'s
|
|
275
267
|
* selection WITHOUT importing `core/canvas/source.ts` (which pulls
|
|
276
268
|
* `LocalCanvasSource` → `openDb`, failing the Stage-C import checker): an
|
|
@@ -13,9 +13,7 @@ import { cliClient, cliCanvasSource } from './api-client.js';
|
|
|
13
13
|
async function viewNodeSet(source, viewId) {
|
|
14
14
|
return new Set([viewId, ...(await source.view(viewId))]);
|
|
15
15
|
}
|
|
16
|
-
// ---------------------------------------------------------------------------
|
|
17
16
|
// attention count
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
17
|
const attentionCount = defineLeaf({
|
|
20
18
|
name: 'count',
|
|
21
19
|
description: 'total pending human-ticket count (machine-parseable stdout.count)',
|
|
@@ -87,9 +85,7 @@ const attentionCount = defineLeaf({
|
|
|
87
85
|
return { count: items.reduce((s, e) => s + e.count, 0) };
|
|
88
86
|
},
|
|
89
87
|
});
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
88
|
// attention list
|
|
92
|
-
// ---------------------------------------------------------------------------
|
|
93
89
|
const attentionList = defineLeaf({
|
|
94
90
|
name: 'list',
|
|
95
91
|
description: 'itemised list of cwds with pending human tickets',
|
|
@@ -137,9 +133,7 @@ const attentionList = defineLeaf({
|
|
|
137
133
|
return { items, total };
|
|
138
134
|
},
|
|
139
135
|
});
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
136
|
// attention map
|
|
142
|
-
// ---------------------------------------------------------------------------
|
|
143
137
|
const attentionMap = defineLeaf({
|
|
144
138
|
name: 'map',
|
|
145
139
|
description: 'per-node ticket counts for a visible set, batched in one pass',
|
|
@@ -207,9 +201,7 @@ const attentionMap = defineLeaf({
|
|
|
207
201
|
return { counts: counts.counts };
|
|
208
202
|
},
|
|
209
203
|
});
|
|
210
|
-
// ---------------------------------------------------------------------------
|
|
211
204
|
// Export — mounted under `crtr canvas`
|
|
212
|
-
// ---------------------------------------------------------------------------
|
|
213
205
|
export const attentionBranch = defineBranch({
|
|
214
206
|
name: 'attention',
|
|
215
207
|
description: 'count/list pending human tickets across the graph',
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// `crtr surface node focus` (the ONLY sanctioned open — reviveNode, never `pi --session`).
|
|
6
6
|
// Owns the screen, so it returns void and writes nothing to stdout itself.
|
|
7
7
|
// Outside a TTY it prints the static forest and exits 0 (see runBrowse).
|
|
8
|
+
import { envProfileId } from '../shared/env.js';
|
|
8
9
|
import { defineLeaf } from '../core/command.js';
|
|
9
10
|
import { runBrowse } from '../core/canvas/browse/app.js';
|
|
10
11
|
import { ApiCanvasSource, cliClient } from './api-client.js';
|
|
@@ -50,7 +51,7 @@ export const browseLeaf = defineLeaf({
|
|
|
50
51
|
run: async (input) => {
|
|
51
52
|
const cwd = input['cwd'] ?? process.cwd();
|
|
52
53
|
const profileId = input['profileId'] ??
|
|
53
|
-
|
|
54
|
+
envProfileId() ??
|
|
54
55
|
getDefaultProfileId(cwd) ??
|
|
55
56
|
undefined;
|
|
56
57
|
const source = new ApiCanvasSource();
|
|
@@ -25,9 +25,7 @@ function maskedTarget(name, target, secrets) {
|
|
|
25
25
|
...(token !== undefined && token !== '' ? { fingerprint: fingerprint(token) } : {}),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
28
|
// canvas config add
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
29
|
const canvasConfigAdd = defineLeaf({
|
|
32
30
|
name: 'add',
|
|
33
31
|
description: 'register a remote canvas target (preview endpoint + relay token)',
|
|
@@ -76,9 +74,7 @@ const canvasConfigAdd = defineLeaf({
|
|
|
76
74
|
},
|
|
77
75
|
render: () => 'Registered remote canvas target (token stored).',
|
|
78
76
|
});
|
|
79
|
-
// ---------------------------------------------------------------------------
|
|
80
77
|
// canvas config list
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
78
|
const canvasConfigList = defineLeaf({
|
|
83
79
|
name: 'list',
|
|
84
80
|
description: 'list registered remote canvas targets',
|
|
@@ -112,9 +108,7 @@ const canvasConfigList = defineLeaf({
|
|
|
112
108
|
.join('\n');
|
|
113
109
|
},
|
|
114
110
|
});
|
|
115
|
-
// ---------------------------------------------------------------------------
|
|
116
111
|
// canvas config show
|
|
117
|
-
// ---------------------------------------------------------------------------
|
|
118
112
|
const canvasConfigShow = defineLeaf({
|
|
119
113
|
name: 'show',
|
|
120
114
|
description: 'show one registered remote canvas target',
|
|
@@ -150,9 +144,7 @@ const canvasConfigShow = defineLeaf({
|
|
|
150
144
|
},
|
|
151
145
|
render: (r) => `${r['name']} — ${r['previewEndpoint']} (${r['tokenStored'] ? `token ${r['fingerprint']}` : 'no token stored'})`,
|
|
152
146
|
});
|
|
153
|
-
// ---------------------------------------------------------------------------
|
|
154
147
|
// canvas config remove
|
|
155
|
-
// ---------------------------------------------------------------------------
|
|
156
148
|
const canvasConfigRemove = defineLeaf({
|
|
157
149
|
name: 'remove',
|
|
158
150
|
description: 'remove a registered remote canvas target and its stored token',
|
|
@@ -186,9 +178,7 @@ const canvasConfigRemove = defineLeaf({
|
|
|
186
178
|
},
|
|
187
179
|
render: () => 'Removed remote canvas target.'
|
|
188
180
|
});
|
|
189
|
-
// ---------------------------------------------------------------------------
|
|
190
181
|
// Export — mounted under `crtr canvas`
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
182
|
export const canvasConfigBranch = defineBranch({
|
|
193
183
|
name: 'config',
|
|
194
184
|
description: 'register/list/inspect/remove remote canvas targets',
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// memory`, which is curated semantic knowledge held independent of any episode.
|
|
6
6
|
// This branch owns CONTENT; it never duplicates the graph (use `node lifecycle
|
|
7
7
|
// revive` to reopen a found node, `node inspect show` for its topology).
|
|
8
|
+
import { envNodeCwd } from '../shared/env.js';
|
|
8
9
|
import { defineBranch } from '../core/command.js';
|
|
9
10
|
import { searchLeaf } from './canvas-history/search.js';
|
|
10
11
|
import { grepLeaf } from './canvas-history/grep.js';
|
|
@@ -13,7 +14,7 @@ import { readLeaf } from './canvas-history/read.js';
|
|
|
13
14
|
* anchor the help text without scanning nodes or files. Uses only the injected
|
|
14
15
|
* node cwd env (or the process cwd outside a node), so help stays cheap. */
|
|
15
16
|
function corpusBlock() {
|
|
16
|
-
const cwd =
|
|
17
|
+
const cwd = envNodeCwd() ?? process.cwd();
|
|
17
18
|
return `<corpus cwd="${cwd}"/>`;
|
|
18
19
|
}
|
|
19
20
|
export const historyBranch = defineBranch({
|
package/dist/commands/cron.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// resolves the time grammar client-side (parseWhen/parseCadence) and sends the
|
|
14
14
|
// settled fire_at/recur/tz through
|
|
15
15
|
// the crtrd API; this file reaches ZERO canvas state-store code (V-1).
|
|
16
|
+
import { envNodeId, envProfileId } from '../shared/env.js';
|
|
16
17
|
import { existsSync, statSync } from 'node:fs';
|
|
17
18
|
import { resolve as resolvePath } from 'node:path';
|
|
18
19
|
import { defineBranch, defineLeaf } from '../core/command.js';
|
|
@@ -67,7 +68,7 @@ function parseRunTimeout(raw) {
|
|
|
67
68
|
* canvas-home-wide. Outside a profile there is no scope to narrow to, so the
|
|
68
69
|
* caller sees the whole canvas home. */
|
|
69
70
|
function scopeQuery() {
|
|
70
|
-
const p =
|
|
71
|
+
const p = envProfileId();
|
|
71
72
|
return p !== undefined && p.trim() !== '' ? { profile: canonicalProfileId(p) } : undefined;
|
|
72
73
|
}
|
|
73
74
|
/** Resolve the chosen-else-inherited cwd, and refuse one that is not a
|
|
@@ -120,9 +121,7 @@ function renderRun(r) {
|
|
|
120
121
|
const dur = r.duration_ms !== null ? `${r.duration_ms}ms` : '—';
|
|
121
122
|
return `- ${r.started} — ${exit}, ${dur} — ${r.delivered ?? '(no disposition recorded)'}`;
|
|
122
123
|
}
|
|
123
|
-
// ---------------------------------------------------------------------------
|
|
124
124
|
// cron add
|
|
125
|
-
// ---------------------------------------------------------------------------
|
|
126
125
|
const addLeaf = defineLeaf({
|
|
127
126
|
name: 'add',
|
|
128
127
|
description: 'arm a scheduled command (bash on stdin; one of --at / --every)',
|
|
@@ -216,7 +215,7 @@ const addLeaf = defineLeaf({
|
|
|
216
215
|
}
|
|
217
216
|
let anchorNode = anchorFlag ?? null;
|
|
218
217
|
if (anchorSelf) {
|
|
219
|
-
const self =
|
|
218
|
+
const self = envNodeId();
|
|
220
219
|
if (self === undefined || self === '') {
|
|
221
220
|
throw new InputError({ error: 'no_self_node', message: '--anchor-self requires a calling node ($CRTR_NODE_ID is unset)', next: 'Run from inside a node, or pass --anchor <node-id> explicitly.' });
|
|
222
221
|
}
|
|
@@ -232,7 +231,7 @@ const addLeaf = defineLeaf({
|
|
|
232
231
|
const cwd = resolveCwd(typeof input['cwd'] === 'string' && input['cwd'] !== '' ? input['cwd'] : undefined);
|
|
233
232
|
const envJson = resolveEnvJson(input['env']);
|
|
234
233
|
const profileFlag = typeof input['profile'] === 'string' && input['profile'] !== '' ? input['profile'] : undefined;
|
|
235
|
-
const inherited =
|
|
234
|
+
const inherited = envProfileId();
|
|
236
235
|
const profile = profileFlag !== undefined
|
|
237
236
|
? canonicalProfileId(profileFlag)
|
|
238
237
|
: inherited !== undefined && inherited.trim() !== ''
|
|
@@ -243,7 +242,7 @@ const addLeaf = defineLeaf({
|
|
|
243
242
|
if (scope === 'profile' && profile === undefined) {
|
|
244
243
|
throw new InputError({ error: 'scope_needs_profile', message: '--scope profile names the profile this cron lists and cancels within, but no profile is resolved', field: 'profile', next: 'Pass --profile <id>, or use --scope global for a canvas-home-wide cron.' });
|
|
245
244
|
}
|
|
246
|
-
const createdBy =
|
|
245
|
+
const createdBy = envNodeId();
|
|
247
246
|
const dto = await cliClient()
|
|
248
247
|
.armCron({
|
|
249
248
|
name,
|
|
@@ -274,9 +273,7 @@ const addLeaf = defineLeaf({
|
|
|
274
273
|
return `Cron armed — ${String(r['cron_id'])}.\n\n- next fire: ${String(r['fire_at'])}\n- cadence: ${cadence}\n\nIt runs daemon-side; nothing more to do here. Inspect it with \`crtr cron show ${String(r['cron_id'])}\`; cancel any time with \`crtr cron cancel ${String(r['cron_id'])}\`.`;
|
|
275
274
|
},
|
|
276
275
|
});
|
|
277
|
-
// ---------------------------------------------------------------------------
|
|
278
276
|
// cron list
|
|
279
|
-
// ---------------------------------------------------------------------------
|
|
280
277
|
const listLeaf = defineLeaf({
|
|
281
278
|
name: 'list',
|
|
282
279
|
description: 'what is scheduled, with next fire and recent health',
|
|
@@ -336,9 +333,7 @@ const listLeaf = defineLeaf({
|
|
|
336
333
|
return `${crons.length} cron(s):\n\n${lines.join('\n')}`;
|
|
337
334
|
},
|
|
338
335
|
});
|
|
339
|
-
// ---------------------------------------------------------------------------
|
|
340
336
|
// cron show
|
|
341
|
-
// ---------------------------------------------------------------------------
|
|
342
337
|
const showLeaf = defineLeaf({
|
|
343
338
|
name: 'show',
|
|
344
339
|
description: 'one cron: full config plus its run history',
|
|
@@ -396,9 +391,7 @@ const showLeaf = defineLeaf({
|
|
|
396
391
|
return lines.join('\n');
|
|
397
392
|
},
|
|
398
393
|
});
|
|
399
|
-
// ---------------------------------------------------------------------------
|
|
400
394
|
// cron run
|
|
401
|
-
// ---------------------------------------------------------------------------
|
|
402
395
|
const runLeaf = defineLeaf({
|
|
403
396
|
name: 'run',
|
|
404
397
|
description: 'execute now, out of band — does not advance the schedule',
|
|
@@ -446,9 +439,7 @@ const runLeaf = defineLeaf({
|
|
|
446
439
|
return lines.join('\n');
|
|
447
440
|
},
|
|
448
441
|
});
|
|
449
|
-
// ---------------------------------------------------------------------------
|
|
450
442
|
// cron pause / resume
|
|
451
|
-
// ---------------------------------------------------------------------------
|
|
452
443
|
const pauseLeaf = defineLeaf({
|
|
453
444
|
name: 'pause',
|
|
454
445
|
description: 'stop firing without losing config or history',
|
|
@@ -493,9 +484,7 @@ const resumeLeaf = defineLeaf({
|
|
|
493
484
|
},
|
|
494
485
|
render: (r) => `Cron resumed — next fire ${String(r['fire_at'])} (if that is already past, it fires on the next tick).`,
|
|
495
486
|
});
|
|
496
|
-
// ---------------------------------------------------------------------------
|
|
497
487
|
// cron cancel
|
|
498
|
-
// ---------------------------------------------------------------------------
|
|
499
488
|
const cancelLeaf = defineLeaf({
|
|
500
489
|
name: 'cancel',
|
|
501
490
|
description: 'remove one cron (idempotent)',
|
|
@@ -523,9 +512,7 @@ const cancelLeaf = defineLeaf({
|
|
|
523
512
|
},
|
|
524
513
|
render: () => 'Cron canceled.'
|
|
525
514
|
});
|
|
526
|
-
// ---------------------------------------------------------------------------
|
|
527
515
|
// Registration
|
|
528
|
-
// ---------------------------------------------------------------------------
|
|
529
516
|
export function registerCron() {
|
|
530
517
|
return defineBranch({
|
|
531
518
|
name: 'cron',
|
|
@@ -9,9 +9,7 @@ import { defineLeaf } from '../core/command.js';
|
|
|
9
9
|
import { InputError } from '../core/io.js';
|
|
10
10
|
import { cliClient, cliCanvasSource } from './api-client.js';
|
|
11
11
|
import { renderTreeFromSource, renderForestFromSource, dashboardRowsFromSource, dashboardRowsAllFromSource, enrichRowsFromSource, } from '../core/canvas/render-source.js';
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
12
|
// dashboard show — the main leaf
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
13
|
export const dashboardLeaf = defineLeaf({
|
|
16
14
|
name: 'dashboard',
|
|
17
15
|
description: 'render the canvas as a subscription tree',
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// the companion's terminal report that an open item has been dealt with.
|
|
4
4
|
// Creating comments is the person's channel (the page surface); no agent
|
|
5
5
|
// authors, edits, or deletes them.
|
|
6
|
+
import { envNodeId } from '../../shared/env.js';
|
|
6
7
|
import { existsSync } from 'node:fs';
|
|
7
8
|
import { ApiError } from '../../api/index.js';
|
|
8
9
|
import { defineBranch, defineLeaf } from '../../core/command.js';
|
|
@@ -71,7 +72,7 @@ const humanFeedbackResolve = defineLeaf({
|
|
|
71
72
|
},
|
|
72
73
|
run: async (input) => {
|
|
73
74
|
const commentId = input['comment_id'];
|
|
74
|
-
const callerNodeId =
|
|
75
|
+
const callerNodeId = envNodeId();
|
|
75
76
|
if (callerNodeId === undefined || callerNodeId === '') {
|
|
76
77
|
throw new InputError({ error: 'no_node', message: 'resolve runs inside the ticket\u2019s feedback companion (CRTR_NODE_ID unset)', next: 'Run this from the companion conversation bound to the ticket.' });
|
|
77
78
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { envNodeId } from '../../shared/env.js';
|
|
1
2
|
import { defineLeaf } from '../../core/command.js';
|
|
2
3
|
import { InputError } from '../../core/io.js';
|
|
3
4
|
import { cliClient } from '../api-client.js';
|
|
@@ -21,7 +22,7 @@ import { pageHelpText, resolveMaxPanes } from './shared.js';
|
|
|
21
22
|
const PAGE_HINT = pageHelpText().pageHint;
|
|
22
23
|
/** The asking node's id, or null when run from a bare shell (no parent to route to). */
|
|
23
24
|
function askingNode() {
|
|
24
|
-
return
|
|
25
|
+
return envNodeId() ?? null;
|
|
25
26
|
}
|
|
26
27
|
/** Provenance for crouter tickets. Ticket *identity* comes from the bridge node
|
|
27
28
|
* directory, never ticket data; `nodeId` carries the originating node so a
|
|
@@ -159,9 +160,7 @@ function pageInput(input) {
|
|
|
159
160
|
function queuedFollowUp() {
|
|
160
161
|
return 'Queued for the user. Their answer is pushed to your inbox and wakes you when they respond — never poll, verify it opened, or block.';
|
|
161
162
|
}
|
|
162
|
-
// ---------------------------------------------------------------------------
|
|
163
163
|
// send
|
|
164
|
-
// ---------------------------------------------------------------------------
|
|
165
164
|
export function humanSend(pageSurface = false) {
|
|
166
165
|
const pageHelp = pageHelpText(pageSurface);
|
|
167
166
|
return defineLeaf({
|
|
@@ -281,11 +280,9 @@ export function humanSend(pageSurface = false) {
|
|
|
281
280
|
},
|
|
282
281
|
});
|
|
283
282
|
}
|
|
284
|
-
// ---------------------------------------------------------------------------
|
|
285
283
|
// show (no job, non-blocking passthrough) — passive live document display, NOT
|
|
286
284
|
// a ticket surface. `display()` puts a file live in a watch pane and never
|
|
287
285
|
// enqueues anything.
|
|
288
|
-
// ---------------------------------------------------------------------------
|
|
289
286
|
export const humanShow = defineLeaf({
|
|
290
287
|
name: 'show',
|
|
291
288
|
description: "put a file live on the user's screen",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { envNodeId } from '../../shared/env.js';
|
|
1
2
|
import { existsSync } from 'node:fs';
|
|
2
3
|
import { ApiError } from '../../api/index.js';
|
|
3
4
|
import { defineLeaf } from '../../core/command.js';
|
|
@@ -88,9 +89,7 @@ function isTerminalBridge(status) {
|
|
|
88
89
|
function isAlreadyResolvedConflict(error) {
|
|
89
90
|
return error instanceof ApiError && error.status === 409 && error.code === 'ticket_already_resolved';
|
|
90
91
|
}
|
|
91
|
-
// ---------------------------------------------------------------------------
|
|
92
92
|
// list (read-only, paginated)
|
|
93
|
-
// ---------------------------------------------------------------------------
|
|
94
93
|
export const humanList = defineLeaf({
|
|
95
94
|
name: 'list',
|
|
96
95
|
description: 'enumerate pending interactions',
|
|
@@ -137,9 +136,7 @@ export const humanList = defineLeaf({
|
|
|
137
136
|
return { items: page.items, next_cursor: page.next_cursor, total: page.total };
|
|
138
137
|
},
|
|
139
138
|
});
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
139
|
// resolve — non-interactive human answer
|
|
142
|
-
// ---------------------------------------------------------------------------
|
|
143
140
|
/** Decode the stdin envelope only; the daemon validates every response against the page manifest. */
|
|
144
141
|
function parseResolveBody(raw) {
|
|
145
142
|
let parsed;
|
|
@@ -201,9 +198,7 @@ export const humanResolve = defineLeaf({
|
|
|
201
198
|
return { resolved: true, ticket_id: ticketId };
|
|
202
199
|
},
|
|
203
200
|
});
|
|
204
|
-
// ---------------------------------------------------------------------------
|
|
205
201
|
// cancel — retract a pending page/review
|
|
206
|
-
// ---------------------------------------------------------------------------
|
|
207
202
|
export const humanCancel = defineLeaf({
|
|
208
203
|
name: 'cancel',
|
|
209
204
|
description: 'retract a pending page/review',
|
|
@@ -229,7 +224,7 @@ export const humanCancel = defineLeaf({
|
|
|
229
224
|
run: async (input) => {
|
|
230
225
|
const ticketId = input['ticket_id'];
|
|
231
226
|
const reason = input['reason'];
|
|
232
|
-
const actor =
|
|
227
|
+
const actor = envNodeId() ?? 'human';
|
|
233
228
|
try {
|
|
234
229
|
await cliClient().cancelHumanTicket(ticketId, { ...(reason !== undefined && reason !== '' ? { reason } : {}), actor });
|
|
235
230
|
}
|
|
@@ -8,9 +8,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
8
8
|
import { defineBranch, defineLeaf } from '../../core/command.js';
|
|
9
9
|
import { InputError } from '../../core/io.js';
|
|
10
10
|
import { cliClient, rethrowAsCliError } from '../api-client.js';
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
11
|
// shared input helpers
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
12
|
function readJsonFile(path, field, shape) {
|
|
15
13
|
if (!existsSync(path)) {
|
|
16
14
|
throw new InputError({ error: 'not_found', message: `no such file: ${path}`, field, next: `Pass --${field} PATH pointing at a JSON file holding ${shape}.` });
|
|
@@ -88,9 +86,7 @@ const RECORD_OUTPUT = [
|
|
|
88
86
|
{ name: 'request_id', type: 'string', required: true, constraint: 'The request — the same 64-hex id the human inbox lists it under.' },
|
|
89
87
|
...REQUEST_RESULT_OUTPUT,
|
|
90
88
|
];
|
|
91
|
-
// ---------------------------------------------------------------------------
|
|
92
89
|
// create
|
|
93
|
-
// ---------------------------------------------------------------------------
|
|
94
90
|
const createLeaf = defineLeaf({
|
|
95
91
|
name: 'create',
|
|
96
92
|
description: 'create a durable request from a JSON request file',
|
|
@@ -135,9 +131,7 @@ const createLeaf = defineLeaf({
|
|
|
135
131
|
}
|
|
136
132
|
},
|
|
137
133
|
});
|
|
138
|
-
// ---------------------------------------------------------------------------
|
|
139
134
|
// get
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
135
|
const getLeaf = defineLeaf({
|
|
142
136
|
name: 'get',
|
|
143
137
|
description: 'read one request, its terminal result, and its delivery state',
|
|
@@ -159,9 +153,7 @@ const getLeaf = defineLeaf({
|
|
|
159
153
|
}
|
|
160
154
|
},
|
|
161
155
|
});
|
|
162
|
-
// ---------------------------------------------------------------------------
|
|
163
156
|
// replace
|
|
164
|
-
// ---------------------------------------------------------------------------
|
|
165
157
|
const replaceLeaf = defineLeaf({
|
|
166
158
|
name: 'replace',
|
|
167
159
|
description: 'revise a pending request\'s page in place',
|
|
@@ -192,9 +184,7 @@ const replaceLeaf = defineLeaf({
|
|
|
192
184
|
}
|
|
193
185
|
},
|
|
194
186
|
});
|
|
195
|
-
// ---------------------------------------------------------------------------
|
|
196
187
|
// respond
|
|
197
|
-
// ---------------------------------------------------------------------------
|
|
198
188
|
const respondLeaf = defineLeaf({
|
|
199
189
|
name: 'respond',
|
|
200
190
|
description: 'settle a pending request with typed answers',
|
|
@@ -231,9 +221,7 @@ const respondLeaf = defineLeaf({
|
|
|
231
221
|
}
|
|
232
222
|
},
|
|
233
223
|
});
|
|
234
|
-
// ---------------------------------------------------------------------------
|
|
235
224
|
// cancel
|
|
236
|
-
// ---------------------------------------------------------------------------
|
|
237
225
|
const cancelLeaf = defineLeaf({
|
|
238
226
|
name: 'cancel',
|
|
239
227
|
description: 'withdraw a pending request',
|
|
@@ -264,9 +252,7 @@ const cancelLeaf = defineLeaf({
|
|
|
264
252
|
}
|
|
265
253
|
},
|
|
266
254
|
});
|
|
267
|
-
// ---------------------------------------------------------------------------
|
|
268
255
|
// Registration
|
|
269
|
-
// ---------------------------------------------------------------------------
|
|
270
256
|
export const humanRequestBranch = defineBranch({
|
|
271
257
|
name: 'request',
|
|
272
258
|
description: 'durable requests that outlive the process that made them',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { envNodeId } from '../../shared/env.js';
|
|
1
2
|
import { randomUUID } from 'node:crypto';
|
|
2
3
|
import { join, resolve } from 'node:path';
|
|
3
4
|
import { defineBranch, defineLeaf } from '../../core/command.js';
|
|
@@ -5,7 +6,7 @@ import { InputError } from '../../core/io.js';
|
|
|
5
6
|
import { ticketDir } from '../../core/human/root.js';
|
|
6
7
|
import { cliClient } from '../api-client.js';
|
|
7
8
|
function nodeActor() {
|
|
8
|
-
const nodeId =
|
|
9
|
+
const nodeId = envNodeId();
|
|
9
10
|
return nodeId === undefined || nodeId === '' ? null : nodeId;
|
|
10
11
|
}
|
|
11
12
|
function requireOriginNode() {
|
|
@@ -82,7 +82,7 @@ beforeEach(() => {
|
|
|
82
82
|
mkdirSync(child, { recursive: true });
|
|
83
83
|
mkdirSync(nestedWrite, { recursive: true });
|
|
84
84
|
mkdirSync(nestedEmpty, { recursive: true });
|
|
85
|
-
//
|
|
85
|
+
// repository root, declaring the namespace for every nested store
|
|
86
86
|
writeDoc(join(storeDir(root), 'INDEX.md'), 'kind: knowledge\nnamespace: acme\nwhen-and-why-to-read: "When the root acme store is addressed, this knowledge should be read because it names what the store holds."', 'ROOT STORE INDEX');
|
|
87
87
|
writeDoc(join(storeDir(root), 'foo.md'), 'kind: knowledge', 'ROOT FOO BODY');
|
|
88
88
|
writeDoc(join(storeDir(root), 'linker.md'), 'kind: knowledge', 'ROOT LINKER BODY linking [[acme/foo]] once.');
|
|
@@ -91,17 +91,17 @@ beforeEach(() => {
|
|
|
91
91
|
// A `name:` pin on a file whose own path already derives a different identity.
|
|
92
92
|
writeDoc(join(storeDir(root), 'x.md'), 'kind: knowledge\nname: y', 'ROOT PINNED BODY');
|
|
93
93
|
appendHistoryRecord(join(storeDir(root), '.history', 'x.jsonl'), buildHistoryRecord({ op: 'create', before: '', after: 'ROOT PINNED BODY' }));
|
|
94
|
-
//
|
|
94
|
+
// child: a nested store deriving `acme/child`; cwd lives here
|
|
95
95
|
writeDoc(join(storeDir(child), 'INDEX.md'), 'kind: knowledge\nwhen-and-why-to-read: "When the child guide is addressed, this knowledge should be read because it names what the nested store holds."', 'CHILD STORE INDEX');
|
|
96
96
|
writeDoc(join(storeDir(child), 'foo.md'), 'kind: knowledge', 'CHILD FOO BODY');
|
|
97
97
|
// This nested store has content but no guide, so a write at its exact prefix
|
|
98
98
|
// must create metadata-free INDEX.md rather than a second declaration.
|
|
99
99
|
writeDoc(join(storeDir(nestedWrite), 'topic.md'), 'kind: knowledge', 'NESTED WRITE TOPIC');
|
|
100
|
-
//
|
|
100
|
+
// lint fixtures
|
|
101
101
|
writeDoc(join(storeDir(badns), 'INDEX.md'), 'kind: knowledge\nnamespace: 42', 'BADNS STORE INDEX');
|
|
102
102
|
writeDoc(join(storeDir(dangling), 'INDEX.md'), 'kind: knowledge\nnamespace: dang\nwhen-and-why-to-read: "When the dang store is addressed, this knowledge should be read because it names what the store holds."', 'DANG STORE INDEX');
|
|
103
103
|
writeDoc(join(storeDir(dangling), 'broken.md'), 'kind: knowledge', 'Links [[dang/nowhere]], which no document answers to.');
|
|
104
|
-
//
|
|
104
|
+
// two profiles, both holding the SAME canonical name
|
|
105
105
|
const a = createProfile('memcmd-a');
|
|
106
106
|
const b = createProfile('memcmd-b');
|
|
107
107
|
profileB = profileMemoryDir(b.profileId);
|