@north-light/crouter 0.3.232 → 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-memory/internal/memory-loading.md +4 -3
- 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.d.ts +1 -1
- package/dist/commands/memory/shared.js +7 -10
- 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.d.ts +1 -0
- package/dist/core/substrate/__tests__/surface-match-pre-command.test.js +92 -0
- package/dist/core/substrate/frontmatter-validation.js +1 -1
- package/dist/core/substrate/injected-store.d.ts +6 -0
- package/dist/core/substrate/injected-store.js +24 -0
- package/dist/core/substrate/on-read.d.ts +17 -1
- package/dist/core/substrate/on-read.js +36 -2
- package/dist/core/substrate/render.js +0 -12
- package/dist/core/substrate/schema.d.ts +3 -3
- package/dist/core/substrate/schema.js +4 -16
- package/dist/core/substrate/surface-match.d.ts +19 -0
- package/dist/core/substrate/surface-match.js +60 -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/__tests__/pre-command-gate.test.d.ts +1 -0
- package/dist/pi-extensions/__tests__/pre-command-gate.test.js +220 -0
- 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.d.ts +14 -0
- package/dist/pi-extensions/canvas-doc-substrate.js +77 -5
- 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
package/dist/api/client.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
//
|
|
10
10
|
// TRANSPORT (spec O-1): `node:http`/`node:https` `request()` — NO `undici`.
|
|
11
11
|
// unix socket via `{ socketPath }`; TCP/remote via a parsed `baseUrl`.
|
|
12
|
+
import { envHomeOverride } from '../shared/env.js';
|
|
12
13
|
import { request as httpRequest } from 'node:http';
|
|
13
14
|
import { request as httpsRequest } from 'node:https';
|
|
14
15
|
import { homedir } from 'node:os';
|
|
@@ -27,7 +28,7 @@ const SOCKET_BASENAME = 'crtrd.sock';
|
|
|
27
28
|
/** Resolve crtrd's default unix socket path the same way `apiSocketPath()` does,
|
|
28
29
|
* via Node built-ins only (no `core/canvas/paths.ts` import). */
|
|
29
30
|
function defaultSocketPath() {
|
|
30
|
-
const override =
|
|
31
|
+
const override = envHomeOverride();
|
|
31
32
|
const home = override !== undefined && override !== ''
|
|
32
33
|
? override
|
|
33
34
|
: join(homedir(), CRTR_DIR_NAME, 'canvas');
|
|
@@ -74,7 +75,7 @@ export class CrtrClient {
|
|
|
74
75
|
static forLocalSocket(opts) {
|
|
75
76
|
return new CrtrClient({ socketPath: defaultSocketPath(), autostart: true, ...opts });
|
|
76
77
|
}
|
|
77
|
-
//
|
|
78
|
+
// Health / status
|
|
78
79
|
healthz() {
|
|
79
80
|
return this.request('GET', routes.healthz());
|
|
80
81
|
}
|
|
@@ -88,7 +89,7 @@ export class CrtrClient {
|
|
|
88
89
|
restartDaemon() {
|
|
89
90
|
return this.request('POST', routes.daemonRestart());
|
|
90
91
|
}
|
|
91
|
-
//
|
|
92
|
+
// Nodes
|
|
92
93
|
createNode(req) {
|
|
93
94
|
return this.request('POST', routes.nodes(), req);
|
|
94
95
|
}
|
|
@@ -178,7 +179,7 @@ export class CrtrClient {
|
|
|
178
179
|
subscribe(id, req) {
|
|
179
180
|
return this.request('POST', routes.nodeSubscriptions(this.nodePath(id)), req);
|
|
180
181
|
}
|
|
181
|
-
//
|
|
182
|
+
// Focuses (viewer registry)
|
|
182
183
|
// The tmux verbs that open/move/close a viewer pane run LOCALLY in the
|
|
183
184
|
// caller's session (placement-tmux); only the canvas.db focus rows route here.
|
|
184
185
|
// Reads GC lazily server-side, so a returned row is always live; a `null` body
|
|
@@ -245,7 +246,7 @@ export class CrtrClient {
|
|
|
245
246
|
ensureAttach(id, req) {
|
|
246
247
|
return this.request('POST', routes.nodeAttach(this.nodePath(id)), req ?? {});
|
|
247
248
|
}
|
|
248
|
-
//
|
|
249
|
+
// Reads / feed
|
|
249
250
|
getReports(id, q) {
|
|
250
251
|
return this.request('GET', withQuery(routes.nodeReports(this.nodePath(id)), q));
|
|
251
252
|
}
|
|
@@ -283,20 +284,20 @@ export class CrtrClient {
|
|
|
283
284
|
getContext(id) {
|
|
284
285
|
return this.request('GET', routes.nodeContext(this.nodePath(id)));
|
|
285
286
|
}
|
|
286
|
-
//
|
|
287
|
+
// Host file read
|
|
287
288
|
/** Read an absolute host path as UTF-8 (capped, `truncated` when clipped) for
|
|
288
289
|
* the browser file-peek panel. */
|
|
289
290
|
peekFile(path) {
|
|
290
291
|
return this.request('GET', withQuery(routes.filePeek(), { path }));
|
|
291
292
|
}
|
|
292
|
-
//
|
|
293
|
+
// Memory documents
|
|
293
294
|
/** Resolve an exact canonical `[[name]]` memory-document link to the winning
|
|
294
295
|
* document's physical origin for the given node — the node's own precedence
|
|
295
296
|
* chain, not this process's. Pair with `peekFile` to render the document. */
|
|
296
297
|
resolveMemoryDoc(name, nodeId) {
|
|
297
298
|
return this.request('GET', withQuery(routes.memoryResolve(), { name, node: nodeId }));
|
|
298
299
|
}
|
|
299
|
-
//
|
|
300
|
+
// Profiles
|
|
300
301
|
/** Create-or-return by name. Supplied `projects` are shape-checked even when
|
|
301
302
|
* the profile already exists; their directories are only required to exist
|
|
302
303
|
* when this call creates the profile. */
|
|
@@ -317,7 +318,7 @@ export class CrtrClient {
|
|
|
317
318
|
deleteProfile(name, req) {
|
|
318
319
|
return this.request('DELETE', routes.profile(name), req);
|
|
319
320
|
}
|
|
320
|
-
//
|
|
321
|
+
// Model auth
|
|
321
322
|
listModelAuth() {
|
|
322
323
|
return this.request('GET', routes.modelAuths());
|
|
323
324
|
}
|
|
@@ -327,7 +328,7 @@ export class CrtrClient {
|
|
|
327
328
|
removeCredential(provider) {
|
|
328
329
|
return this.request('DELETE', routes.modelAuth(provider));
|
|
329
330
|
}
|
|
330
|
-
//
|
|
331
|
+
// Human bridge + completion-handler forwarding (spec §6.5)
|
|
331
332
|
/** Create a terminal `kind:'human'` bridge node with NO broker engine
|
|
332
333
|
* (`spawnNode` server-side). Distinct from `createNode` (which launches a
|
|
333
334
|
* broker) precisely because a human bridge must never have one. */
|
|
@@ -344,7 +345,7 @@ export class CrtrClient {
|
|
|
344
345
|
cancelHumanTicket(ticketId, body) {
|
|
345
346
|
return this.request('POST', routes.humanTicketCancel(this.interactionPath(ticketId)), body);
|
|
346
347
|
}
|
|
347
|
-
//
|
|
348
|
+
// Daemon-owned document reviews and comments
|
|
348
349
|
createReview(req) {
|
|
349
350
|
return this.request('POST', routes.humanReviews(), req);
|
|
350
351
|
}
|
|
@@ -433,7 +434,7 @@ export class CrtrClient {
|
|
|
433
434
|
cancelHumanInboxTicket(ticketId, request) {
|
|
434
435
|
return this.request('POST', routes.humanInboxCancel(this.ticketId(ticketId)), request ?? {});
|
|
435
436
|
}
|
|
436
|
-
//
|
|
437
|
+
// Durable programmatic human requests
|
|
437
438
|
/** Create one durable human request. Its `request_id` is the same opaque id
|
|
438
439
|
* the inbox routes address, so the request and the inbox ticket are one
|
|
439
440
|
* record. An unresolvable `action.name` is rejected before the page is
|
|
@@ -474,7 +475,7 @@ export class CrtrClient {
|
|
|
474
475
|
}
|
|
475
476
|
return this.request('POST', routes.humanInboxFeedbackResolve(this.ticketId(ticketId), commentId), { node_id: nodeId });
|
|
476
477
|
}
|
|
477
|
-
//
|
|
478
|
+
// Canvas reads / maintenance
|
|
478
479
|
/** Composed client-side from `GET /v1/nodes` + `GET /v1/status` (spec §6.3 —
|
|
479
480
|
* the dashboard is absorbed into those two reads; there is no single route).
|
|
480
481
|
* `generated_at` is the client-side capture instant of the composition. */
|
|
@@ -527,7 +528,7 @@ export class CrtrClient {
|
|
|
527
528
|
rebuildIndex() {
|
|
528
529
|
return this.request('POST', routes.canvasRebuildIndex(), {});
|
|
529
530
|
}
|
|
530
|
-
//
|
|
531
|
+
// Escape hatch
|
|
531
532
|
/** Raw request for routes not yet method-wrapped. Applies the same
|
|
532
533
|
* autostart + error-mapping semantics. */
|
|
533
534
|
async request(method, path, body) {
|
|
@@ -549,7 +550,7 @@ export class CrtrClient {
|
|
|
549
550
|
throw toTransportApiError(err);
|
|
550
551
|
}
|
|
551
552
|
}
|
|
552
|
-
//
|
|
553
|
+
// internals
|
|
553
554
|
nodePath(id) {
|
|
554
555
|
if (!isSafeNodeId(id)) {
|
|
555
556
|
throw new ApiError(400, 'invalid_node_id', `invalid node id: ${JSON.stringify(id)}`);
|
|
@@ -9,7 +9,7 @@ surfaces:
|
|
|
9
9
|
|
|
10
10
|
# How memory loads
|
|
11
11
|
|
|
12
|
-
Every memory doc declares its own delivery in frontmatter `surfaces` entries; the runtime never guesses. Delivery is
|
|
12
|
+
Every memory doc declares its own delivery in frontmatter `surfaces` entries; the runtime never guesses. Delivery is six events, one rung per entry, document and entry gates, and structural ordering. The authoring contract (flags, routing-line craft) is `crtr memory write -h`; which scope to write to is `internal/agent-shaping`; physical paths are `internal/storage-tiers`. This doc is the mechanics between those: what actually fires, when, and in what order.
|
|
13
13
|
|
|
14
14
|
## Surfaces entries
|
|
15
15
|
|
|
@@ -19,7 +19,8 @@ A doc with no `surfaces` does exactly one thing: appears in its directory's list
|
|
|
19
19
|
- **workspace-open** — first-message context when cwd/profile mounts the doc's project store. Project stores only.
|
|
20
20
|
- **read** — a `read` tool call returned a matching file: path globs vs the file's absolute path and basename, `./`-anchored globs vs its path relative to the store's owning repo dir, `match-frontmatter` predicates over the read file's own YAML frontmatter.
|
|
21
21
|
- **memory-read** — a `crtr memory read` resolved a matching doc: name globs vs its canonical name, `./` anchored to this doc's canonical routing anchor (a collapsed directory document anchors at its own directory name).
|
|
22
|
-
- **command** — a matching shell command ran: globs vs the whole command string, `*` crossing `/`. Delivery is post-execution — right for "you are now in this territory
|
|
22
|
+
- **command** — a matching shell command ran: globs vs the whole command string, `*` crossing `/`. Delivery is post-execution — right for "you are now in this territory"; when the point is "don't run this at all," use `pre-command` instead.
|
|
23
|
+
- **pre-command** — a matching `bash` command is about to run. When the memory has not been read yet, the command does not execute — the memory comes back as the tool result instead, and the agent re-issues the command, which then runs. Use it to guarantee a memory is seen before a sensitive action is taken. Same globs as `command`, matched at command position; `match` is required. A guardrail against the faithful-but-uninformed action, not an enforcement boundary.
|
|
23
24
|
|
|
24
25
|
Nothing positional fires from where a doc happens to sit on disk — only from its declared entries and its listing.
|
|
25
26
|
|
|
@@ -49,7 +50,7 @@ At boot/first-message assembly the runtime mounts: builtin docs, the user store
|
|
|
49
50
|
|
|
50
51
|
Each project the selected profile has a relationship with carries a `memory` value — `none`, `name`, `preview`, or `content` — and that value is the maximum rung anything in that project's stores delivers at boot and workspace-open, whatever directory the node is working in. It only lowers: an entry authored below the maximum delivers at its authored rung. `none` contributes nothing to either automatic event, so a `none` project cannot shadow a same-named doc from a wider scope — that wider doc becomes the winner. A project store the selected profile has no relationship with delivers exactly what it authored.
|
|
51
52
|
|
|
52
|
-
The maximum reaches those two events and nothing else. Read, memory-read, and command entries fire at their authored rungs; directory listings, `crtr memory read`, `crtr memory find`, config resolution, and plugin discovery all see the full corpus. An explicit `crtr memory read` is itself a content delivery, so reading a capped or document-gated doc returns its whole body and records content — the upgrade path for a doc the automatic events disclosed only by name or preview. Entry gates apply to companion docs routed by the `memory-read` event, not to the deliberate read or its listings.
|
|
53
|
+
The maximum reaches those two events and nothing else. Read, memory-read, command, and pre-command entries fire at their authored rungs; directory listings, `crtr memory read`, `crtr memory find`, config resolution, and plugin discovery all see the full corpus. An explicit `crtr memory read` is itself a content delivery, so reading a capped or document-gated doc returns its whole body and records content — the upgrade path for a doc the automatic events disclosed only by name or preview. Entry gates apply to companion docs routed by the `memory-read` event, not to the deliberate read or its listings.
|
|
53
54
|
|
|
54
55
|
A workspace's front door is an ordinary doc carrying the entry pair `{on: workspace-open, at: content}` + `{on: read, match: "./**", at: content}` — the operating guide loads when that workspace mounts or its files are read, not in every boot catalog. `crtr memory lint` requires exactly one workspace-open content doc per profile-managed project store. Multiple mounted roots render broad-to-specific.
|
|
55
56
|
|
|
@@ -2223,7 +2223,7 @@ test("a concrete model's headerless usage-limit stays turn-local and carries its
|
|
|
2223
2223
|
}
|
|
2224
2224
|
});
|
|
2225
2225
|
|
|
2226
|
-
//
|
|
2226
|
+
// Provider-management removal routing and login coordination
|
|
2227
2227
|
|
|
2228
2228
|
function readAuthRecord(providerId: string): unknown {
|
|
2229
2229
|
const authPath = join(home, ".pi", "agent", "auth.json");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { envProfileId } from '../../../shared/env.js';
|
|
2
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
2
3
|
import {
|
|
3
4
|
readFileSync,
|
|
4
5
|
readdirSync,
|
|
@@ -8,15 +9,14 @@ import {
|
|
|
8
9
|
rmSync,
|
|
9
10
|
writeFileSync,
|
|
10
11
|
realpathSync,
|
|
11
|
-
} from
|
|
12
|
-
import { homedir } from
|
|
13
|
-
import { join, resolve, dirname } from
|
|
14
|
-
import { loadProfileManifest } from
|
|
15
|
-
import { stripMarkdownComments } from
|
|
16
|
-
import { expandShellBlocks, DEFAULT_SHELL_TIMEOUT_MS } from
|
|
17
|
-
import { piShellRunner } from
|
|
18
|
-
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
12
|
+
} from 'node:fs';
|
|
13
|
+
import { homedir } from 'node:os';
|
|
14
|
+
import { join, resolve, dirname } from 'node:path';
|
|
15
|
+
import { loadProfileManifest } from '../../../core/profiles/manifest.js';
|
|
16
|
+
import { stripMarkdownComments } from '../../../core/runtime/command-expansion.js';
|
|
17
|
+
import { expandShellBlocks, DEFAULT_SHELL_TIMEOUT_MS } from '../../../core/runtime/shell-expansion.js';
|
|
18
|
+
import { piShellRunner } from './pi-shell-runner.js';
|
|
19
|
+
|
|
20
20
|
// claude-plugin-commands: surfaces Claude Code commands AND skills as pi slash
|
|
21
21
|
// commands, with Claude's `plugin:command` namespacing AND full runtime
|
|
22
22
|
// behavior: `$1/$ARGUMENTS` argument substitution and `!`cmd` / ```! shell
|
|
@@ -43,7 +43,6 @@ import { piShellRunner } from "./pi-shell-runner.js";
|
|
|
43
43
|
// BEFORE expansion, read the ORIGINAL source file, substitute args, run
|
|
44
44
|
// the embedded shell, and `transform` the input to the resolved text.
|
|
45
45
|
// Shell-execution logic mirrors @juicesharp/rpiv-args.
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
46
|
|
|
48
47
|
const HOME = homedir();
|
|
49
48
|
const CLAUDE = join(HOME, ".claude");
|
|
@@ -67,7 +66,7 @@ type InstallRecord = { installPath?: string };
|
|
|
67
66
|
type InstalledPlugins = { plugins?: Record<string, InstallRecord[]> };
|
|
68
67
|
type Shim = { name: string; target: string; kind: Kind; baseDir: string };
|
|
69
68
|
|
|
70
|
-
//
|
|
69
|
+
// discovery
|
|
71
70
|
|
|
72
71
|
function collectCommands(root: string, prefix: string[], rel: string[], out: Shim[]): void {
|
|
73
72
|
if (!existsSync(root)) return;
|
|
@@ -161,7 +160,7 @@ export function projectClaudeDirs(cwd: string, profileProjectDirs: readonly stri
|
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
function selectedProfileProjects(): string[] {
|
|
164
|
-
const profileId =
|
|
163
|
+
const profileId = envProfileId() ?? "";
|
|
165
164
|
if (profileId === "") return [];
|
|
166
165
|
try {
|
|
167
166
|
return loadProfileManifest(profileId).manifest.projects.map((project) => project.path);
|
|
@@ -289,7 +288,7 @@ function buildShims(cwd: string): string {
|
|
|
289
288
|
return SHIM_DIR;
|
|
290
289
|
}
|
|
291
290
|
|
|
292
|
-
//
|
|
291
|
+
// argument substitution (mirrors pi's prompt-template engine)
|
|
293
292
|
|
|
294
293
|
function parseCommandArgs(s: string): string[] {
|
|
295
294
|
const args: string[] = [];
|
|
@@ -367,7 +366,7 @@ function shellTimeoutMs(fm: string): number {
|
|
|
367
366
|
return v === 0 ? 0 : v * 1000;
|
|
368
367
|
}
|
|
369
368
|
|
|
370
|
-
//
|
|
369
|
+
// shell execution (mirrors @juicesharp/rpiv-args)
|
|
371
370
|
//
|
|
372
371
|
// The `!`cmd`` / ```! grammar and substitution order are shared with every
|
|
373
372
|
// other surface that expands a Markdown body (`core/runtime/shell-expansion`);
|
|
@@ -377,8 +376,6 @@ async function executeShell(body: string, pi: ExtensionAPI, cwd: string, timeout
|
|
|
377
376
|
return expandShellBlocks(body, piShellRunner(pi, cwd, timeoutMs));
|
|
378
377
|
}
|
|
379
378
|
|
|
380
|
-
// ---------------------------------------------------------------------------
|
|
381
|
-
|
|
382
379
|
export default function (pi: ExtensionAPI) {
|
|
383
380
|
pi.on("resources_discover", async (event: { cwd?: string }) => {
|
|
384
381
|
const dir = buildShims(event?.cwd ?? process.cwd());
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { ExtensionAPI } from
|
|
2
|
-
import { execFile } from
|
|
3
|
-
import { promisify } from
|
|
4
|
-
import { readFileSync, existsSync, realpathSync } from
|
|
5
|
-
import { fileURLToPath, pathToFileURL } from
|
|
6
|
-
import { dirname, join } from
|
|
7
|
-
import type { ChatCommandMetadata } from
|
|
1
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { readFileSync, existsSync, realpathSync } from 'node:fs';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
import { dirname, join } from 'node:path';
|
|
7
|
+
import type { ChatCommandMetadata } from '../../../../core/runtime/command-surface.js';
|
|
8
8
|
|
|
9
9
|
const exec = promisify(execFile);
|
|
10
10
|
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
11
|
// crtr-commands: auto-generates a slash command for every node in the crtr
|
|
13
12
|
// CLI tree. `/node:new` runs `crtr node new -h`; `/node:list`
|
|
14
13
|
// runs `crtr node list -h`, and so on.
|
|
@@ -26,7 +25,6 @@ const exec = promisify(execFile);
|
|
|
26
25
|
//
|
|
27
26
|
// Registered handlers still shell out to the real `crtr` binary, but only
|
|
28
27
|
// when the user invokes one — never on the boot path.
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
28
|
|
|
31
29
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
32
30
|
const FILTERS_PATH = join(HERE, "filters.json");
|
|
@@ -76,9 +74,7 @@ export function isAllowed(name: string, filters: Filters): boolean {
|
|
|
76
74
|
return true;
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
// ---------------------------------------------------------------------------
|
|
80
77
|
// Locate + import crtr's real command tree (mirrors crtr-help-gate.ts).
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
78
|
|
|
83
79
|
async function resolveCrtrDist(): Promise<string | null> {
|
|
84
80
|
const dirs = (process.env.PATH ?? "").split(":");
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
* .pi/extensions/. Run `npm install` here once so `yaml` resolves.
|
|
66
66
|
*/
|
|
67
67
|
|
|
68
|
-
import type { ExtensionAPI, ToolResultEvent } from
|
|
69
|
-
import * as fs from
|
|
70
|
-
import * as os from
|
|
71
|
-
import * as path from
|
|
72
|
-
import { parse as parseYaml } from
|
|
73
|
-
import { mergeAutoLoadedContext } from
|
|
68
|
+
import type { ExtensionAPI, ToolResultEvent } from '@earendil-works/pi-coding-agent';
|
|
69
|
+
import * as fs from 'node:fs';
|
|
70
|
+
import * as os from 'node:os';
|
|
71
|
+
import * as path from 'node:path';
|
|
72
|
+
import { parse as parseYaml } from 'yaml';
|
|
73
|
+
import { mergeAutoLoadedContext } from '../../../../pi-extensions/envelope-merge.js';
|
|
74
74
|
|
|
75
75
|
const MARKDOWN_EXTS = new Set([".md", ".mdx", ".markdown"]);
|
|
76
76
|
|
|
@@ -198,7 +198,7 @@ function parseRuleFile(filePath: string): Rule {
|
|
|
198
198
|
return { name, description, when: front.when, body: (m[2] ?? "").trim() };
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
//
|
|
201
|
+
// Condition language
|
|
202
202
|
|
|
203
203
|
function asArray(v: unknown): unknown[] {
|
|
204
204
|
if (Array.isArray(v)) return v;
|
|
@@ -323,7 +323,7 @@ function evalCondition(cond: unknown, fm: Frontmatter): boolean {
|
|
|
323
323
|
return keys.every((k) => matchField(getField(fm, k), c[k]));
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
//
|
|
326
|
+
// Extension
|
|
327
327
|
|
|
328
328
|
export default function frontmatterRules(pi: ExtensionAPI) {
|
|
329
329
|
const seen = new Set<string>();
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { envNodeId } from '../../../shared/env.js';
|
|
2
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
3
|
+
import { createMemoryDocSnapshot, readMemoryDocContent } from '../../../core/memory-resolver.js';
|
|
4
|
+
import { parseSubstrateDoc } from '../../../core/substrate/schema.js';
|
|
4
5
|
import {
|
|
5
6
|
expandDeterministicCommand,
|
|
6
7
|
type DeterministicCommandExpansion,
|
|
7
|
-
} from
|
|
8
|
-
import { expandShellBlocks, hasShellBlocks, DEFAULT_SHELL_TIMEOUT_MS } from
|
|
9
|
-
import type { ChatCommandMetadata } from
|
|
8
|
+
} from '../../../core/runtime/command-expansion.js';
|
|
9
|
+
import { expandShellBlocks, hasShellBlocks, DEFAULT_SHELL_TIMEOUT_MS } from '../../../core/runtime/shell-expansion.js';
|
|
10
|
+
import type { ChatCommandMetadata } from '../../../core/runtime/command-surface.js';
|
|
10
11
|
import {
|
|
11
12
|
exposureTarget,
|
|
12
13
|
loadContextExposureState,
|
|
@@ -14,10 +15,9 @@ import {
|
|
|
14
15
|
registerDocumentExposure,
|
|
15
16
|
saveContextExposureState,
|
|
16
17
|
sharedContextExposureState,
|
|
17
|
-
} from
|
|
18
|
-
import { piShellRunner } from
|
|
18
|
+
} from '../../../core/substrate/injected-store.js';
|
|
19
|
+
import { piShellRunner } from './pi-shell-runner.js';
|
|
19
20
|
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
21
|
// memory-slash-commands: any memory doc frontmatter-flagged `slash: true`
|
|
22
22
|
// becomes an invocable slash command (`/<name>`). This mirrors Hermes Agent's
|
|
23
23
|
// "every skill is automatically a slash command" — /research-alpha injects
|
|
@@ -28,7 +28,6 @@ import { piShellRunner } from "./pi-shell-runner.js";
|
|
|
28
28
|
// resolution. The snapshot already resolves exact canonical identities in
|
|
29
29
|
// source precedence; this file does not walk memory directories or reimplement
|
|
30
30
|
// scope resolution.
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
31
|
|
|
33
32
|
interface MemoryListItem {
|
|
34
33
|
name: string;
|
|
@@ -86,7 +85,7 @@ function defaultReadMemoryDoc(name: string): { path: string; canonicalBody: stri
|
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
function registerSlashExposure(path: string, body: string): void {
|
|
89
|
-
const nodeId =
|
|
88
|
+
const nodeId = envNodeId();
|
|
90
89
|
if (nodeId === undefined || nodeId === "") return;
|
|
91
90
|
const state = sharedContextExposureState(nodeId);
|
|
92
91
|
mergeContextExposureState(state, loadContextExposureState(nodeId));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ExtensionAPI } from
|
|
2
|
-
import { truncateTail, formatSize, DEFAULT_MAX_LINES, DEFAULT_MAX_BYTES } from
|
|
1
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { truncateTail, formatSize, DEFAULT_MAX_LINES, DEFAULT_MAX_BYTES } from '@earendil-works/pi-coding-agent';
|
|
3
3
|
|
|
4
4
|
// The broker-side execution strategy for `core/runtime/shell-expansion`. Every
|
|
5
5
|
// command surface that expands a Markdown body inside a pi engine shares it, so
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from
|
|
2
|
-
import { type AssistantMessageEventStream, type Context, type Model, type SimpleStreamOptions } from
|
|
3
|
-
import { type ManagedProviderId, type SubscriptionCredential } from
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { type AssistantMessageEventStream, type Context, type Model, type SimpleStreamOptions } from '@earendil-works/pi-ai';
|
|
3
|
+
import { type ManagedProviderId, type SubscriptionCredential } from '../../../core/subscription-state.js';
|
|
4
4
|
export interface ProviderRotationOptions {
|
|
5
5
|
modelIntent?: string;
|
|
6
6
|
nodeCwd?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { spawn } from
|
|
2
|
-
import { createAssistantMessageEventStream, } from
|
|
3
|
-
import { streamSimpleAnthropic, streamSimpleOpenAICodexResponses } from
|
|
4
|
-
import { ANTHROPIC_PROVIDER_ID, OPENAI_CODEX_PROVIDER_ID, INVALID_REFRESH_TOKEN_BACKOFF_MS, formatStatusLine, getProviderLabel, isManagedProvider, isInvalidRefreshTokenError, addSubscription, enrichManagedLoginIdentity, markSubscriptionAuthenticationFailed, markSubscriptionRateLimited, markSubscriptionSuccess, parseRetryAfterHeader, promoteSubscription, readRotationConfig, readSubscriptionPool, refreshSubscriptionCredential, removeManagedAccount, resolveProviderCandidates, upsertSubscriptionWithUniqueAccount, } from
|
|
5
|
-
import { readMergedLaunchConfig } from
|
|
6
|
-
import { expandModelCandidates, modelRequestFromConfig, probeRouteAvailability } from
|
|
7
|
-
import { ManagedProviderCoolingError } from
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createAssistantMessageEventStream, } from '@earendil-works/pi-ai';
|
|
3
|
+
import { streamSimpleAnthropic, streamSimpleOpenAICodexResponses } from '@earendil-works/pi-ai/compat';
|
|
4
|
+
import { ANTHROPIC_PROVIDER_ID, OPENAI_CODEX_PROVIDER_ID, INVALID_REFRESH_TOKEN_BACKOFF_MS, formatStatusLine, getProviderLabel, isManagedProvider, isInvalidRefreshTokenError, addSubscription, enrichManagedLoginIdentity, markSubscriptionAuthenticationFailed, markSubscriptionRateLimited, markSubscriptionSuccess, parseRetryAfterHeader, promoteSubscription, readRotationConfig, readSubscriptionPool, refreshSubscriptionCredential, removeManagedAccount, resolveProviderCandidates, upsertSubscriptionWithUniqueAccount, } from '../../../core/subscription-state.js';
|
|
5
|
+
import { readMergedLaunchConfig } from '../../../core/config.js';
|
|
6
|
+
import { expandModelCandidates, modelRequestFromConfig, probeRouteAvailability } from '../../../core/model-routes.js';
|
|
7
|
+
import { ManagedProviderCoolingError } from '../../../core/runtime/managed-provider-cooling.js';
|
|
8
8
|
// A response without Retry-After proves only that THIS attempt was throttled; it
|
|
9
9
|
// does not authorize crouter to invent a five-minute provider-wide outage. Keep
|
|
10
10
|
// a short turn-local probe backoff to avoid an immediate retry loop, then let a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { spawn } from
|
|
2
|
-
import type { ExtensionAPI, ExtensionContext } from
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
3
3
|
import {
|
|
4
4
|
createAssistantMessageEventStream,
|
|
5
5
|
type AssistantMessage,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
type Model,
|
|
12
12
|
type OAuthAuth,
|
|
13
13
|
type SimpleStreamOptions,
|
|
14
|
-
} from
|
|
15
|
-
import { streamSimpleAnthropic, streamSimpleOpenAICodexResponses } from
|
|
14
|
+
} from '@earendil-works/pi-ai';
|
|
15
|
+
import { streamSimpleAnthropic, streamSimpleOpenAICodexResponses } from '@earendil-works/pi-ai/compat';
|
|
16
16
|
import {
|
|
17
17
|
ANTHROPIC_PROVIDER_ID,
|
|
18
18
|
OPENAI_CODEX_PROVIDER_ID,
|
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
upsertSubscriptionWithUniqueAccount,
|
|
37
37
|
type ManagedProviderId,
|
|
38
38
|
type SubscriptionCredential,
|
|
39
|
-
} from
|
|
40
|
-
import { readMergedLaunchConfig } from
|
|
41
|
-
import { expandModelCandidates, modelRequestFromConfig, probeRouteAvailability } from
|
|
42
|
-
import { ManagedProviderCoolingError } from
|
|
39
|
+
} from '../../../core/subscription-state.js';
|
|
40
|
+
import { readMergedLaunchConfig } from '../../../core/config.js';
|
|
41
|
+
import { expandModelCandidates, modelRequestFromConfig, probeRouteAvailability } from '../../../core/model-routes.js';
|
|
42
|
+
import { ManagedProviderCoolingError } from '../../../core/runtime/managed-provider-cooling.js';
|
|
43
43
|
|
|
44
44
|
// A response without Retry-After proves only that THIS attempt was throttled; it
|
|
45
45
|
// does not authorize crouter to invent a five-minute provider-wide outage. Keep
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* navigation and interactive chrome live in crouter's attach viewer.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { execFile } from
|
|
15
|
-
import type { ExtensionAPI } from
|
|
16
|
-
import { CustomEditor, type ExtensionContext } from
|
|
17
|
-
import { truncateToWidth, visibleWidth } from
|
|
14
|
+
import { execFile } from 'node:child_process';
|
|
15
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
16
|
+
import { CustomEditor, type ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
17
|
+
import { truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
|
|
18
18
|
|
|
19
19
|
function lastDir(cwd: string): string {
|
|
20
20
|
const trimmed = cwd.replace(/\/+$/, "");
|
|
@@ -178,7 +178,7 @@ function borderWithBadge(
|
|
|
178
178
|
|
|
179
179
|
export default function (pi: ExtensionAPI) {
|
|
180
180
|
pi.on("session_start", (_event, ctx) => {
|
|
181
|
-
//
|
|
181
|
+
// Statusline (footer): model · [subscription] · tokens · cycle, with cwd/git right-aligned
|
|
182
182
|
ctx.ui.setFooter((tui, theme, footerData) => {
|
|
183
183
|
let gitStatus: GitStatus | null = null;
|
|
184
184
|
|
|
@@ -217,7 +217,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
217
217
|
};
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
//
|
|
220
|
+
// Input bar border: session-name badge with solid background
|
|
221
221
|
// Compose with whatever editor is already installed instead of replacing it:
|
|
222
222
|
// wrap the previous factory in a Proxy that overrides only render
|
|
223
223
|
// (session-name badge on the top border). Other editor decorations keep
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExtensionAPI } from
|
|
2
|
-
import { execFile } from
|
|
3
|
-
import { promisify } from
|
|
1
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
4
|
|
|
5
5
|
const exec = promisify(execFile);
|
|
6
6
|
const CRTR = "crtr";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Provider pool state belongs to crouter core so every human surface and the rotation runtime share one invariant-preserving implementation.
|
|
2
|
-
export * from
|
|
2
|
+
export * from '../../../core/subscription-state.js';
|
|
@@ -145,7 +145,15 @@ export function createTicketPanel(s, hooks) {
|
|
|
145
145
|
reload(entry);
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
let result;
|
|
149
|
+
try {
|
|
150
|
+
result = readTicketResult(entry.dir);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
closeSession(true);
|
|
154
|
+
hooks.setNotice(`ticket result is unreadable: ${error instanceof Error ? error.message : String(error)}`);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
149
157
|
if (result !== null) {
|
|
150
158
|
closeSession(true);
|
|
151
159
|
hooks.setNotice(result.kind === 'canceled' ? 'Ticket was canceled by its requester' : 'Ticket was resolved elsewhere');
|
|
@@ -203,7 +211,12 @@ export function createTicketPanel(s, hooks) {
|
|
|
203
211
|
};
|
|
204
212
|
}
|
|
205
213
|
function resolvedElsewhereNotice(dir) {
|
|
206
|
-
|
|
214
|
+
try {
|
|
215
|
+
return readTicketResult(dir)?.kind === 'canceled' ? 'Ticket was already canceled' : 'Ticket was already resolved';
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
return `ticket result is unreadable: ${error instanceof Error ? error.message : String(error)}`;
|
|
219
|
+
}
|
|
207
220
|
}
|
|
208
221
|
/** The SGR opening the theme's `customMessageBg` — the background the crouter
|
|
209
222
|
* context cards use. pi shares its live theme across module loaders on this
|
|
@@ -203,7 +203,6 @@ export class GraphOverlay {
|
|
|
203
203
|
invalidate() {
|
|
204
204
|
this.refresh();
|
|
205
205
|
}
|
|
206
|
-
// -------------------------------------------------------------------------
|
|
207
206
|
async buildSnapshot() {
|
|
208
207
|
beginFrameTelem();
|
|
209
208
|
const nodes = new Map();
|
|
@@ -444,7 +443,6 @@ export class GraphOverlay {
|
|
|
444
443
|
const fill = Math.max(0, width - 5 - visibleWidth(lbl));
|
|
445
444
|
return `${B(`${lc}─`)} ${lbl} ${B('─'.repeat(fill) + rc)}`;
|
|
446
445
|
}
|
|
447
|
-
// -------------------------------------------------------------------------
|
|
448
446
|
handleInput(data) {
|
|
449
447
|
try {
|
|
450
448
|
this.dispatch(data);
|
|
@@ -611,7 +609,6 @@ export class GraphOverlay {
|
|
|
611
609
|
// Modal: swallow everything else so a stray
|
|
612
610
|
// key never reaches the editor underneath.
|
|
613
611
|
}
|
|
614
|
-
// -------------------------------------------------------------------------
|
|
615
612
|
/** Focus node `id` from the overlay by shelling `crtr surface node focus <id> --pane <here>`.
|
|
616
613
|
* Under the one-viewer-per-node model `--pane` is the ANCHOR to open beside: if
|
|
617
614
|
* `id` has no viewer yet a fresh one splits beside this pane; if it already has
|
|
@@ -147,7 +147,7 @@ function readConfigSource(path, cwd, home) {
|
|
|
147
147
|
}
|
|
148
148
|
return mergeServerMaps(imported, own);
|
|
149
149
|
}
|
|
150
|
-
//
|
|
150
|
+
// configHash recomputation — mirrors pi-mcp-adapter metadata-cache.ts
|
|
151
151
|
function interpolateEnvVars(value) {
|
|
152
152
|
return value
|
|
153
153
|
.replace(/\$\{(\w+)\}/g, (_, name) => process.env[name] ?? '')
|
|
@@ -204,7 +204,6 @@ function computeServerHash(spec) {
|
|
|
204
204
|
};
|
|
205
205
|
return createHash('sha256').update(stableStringify(identity)).digest('hex');
|
|
206
206
|
}
|
|
207
|
-
// ---------------------------------------------------------------------------
|
|
208
207
|
/** Read + merge the adapter's config sources (see file header) and join the
|
|
209
208
|
* tool cache into display rows. Returns [] when nothing is configured. */
|
|
210
209
|
export function readMcpServers(home = homedir(), cwd = process.cwd()) {
|