@north-light/crouter 0.3.349 → 0.3.350
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/bin/crtr-launcher +4 -0
- package/bin/runtime-generation-manifest.mjs +12 -2
- package/dist/api/client.d.ts +50 -7
- package/dist/api/client.js +2 -2
- package/dist/api/dto/analytics.d.ts +184 -0
- package/dist/api/dto/analytics.js +0 -0
- package/dist/api/dto/broker-ops.d.ts +43 -1
- package/dist/api/dto/config.d.ts +11 -0
- package/dist/api/dto/grants.d.ts +14 -0
- package/dist/api/dto/grants.js +0 -0
- package/dist/api/dto/human-requests.d.ts +14 -0
- package/dist/api/dto/memory.d.ts +6 -0
- package/dist/api/dto/modelauth.d.ts +35 -0
- package/dist/api/dto/node-records.d.ts +35 -0
- package/dist/api/dto/node-records.js +0 -0
- package/dist/api/dto/nodes.d.ts +5 -0
- package/dist/api/dto/profiles.d.ts +38 -3
- package/dist/api/dto/worktree.d.ts +11 -0
- package/dist/api/errors.d.ts +23 -1
- package/dist/api/errors.js +1 -1
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +1 -1
- package/dist/api/node-transport.js +1 -1
- package/dist/api/routes.d.ts +22 -0
- package/dist/api/routes.js +1 -1
- package/dist/build-root.d.ts +6 -1
- package/dist/build-root.js +1 -1
- package/dist/builtin-memory/crouter-sdk/client.md +34 -0
- package/dist/builtin-memory/crouter-sdk/errors.md +2 -0
- package/dist/builtin-memory/crouter-sdk/memory.md +2 -2
- package/dist/builtin-memory/crouter-sdk/streaming.md +21 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +8 -4
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +39 -118
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.d.ts +6 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.js +41 -27
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +52 -29
- package/dist/cli.js +9 -8
- package/dist/clients/attach/chrome/inbox-strip.js +1 -1
- package/dist/clients/attach/chrome/roster.js +1 -1
- package/dist/clients/attach/config.js +1 -1
- package/dist/clients/attach/overlays/auth.js +2 -2
- package/dist/clients/attach/overlays/graph.js +1 -1
- package/dist/clients/attach/render/tool-calls.js +3 -3
- package/dist/clients/attach/session/connection.js +1 -1
- package/dist/clients/attach/session/profile-files.js +1 -1
- package/dist/clients/attach/viewer.js +1569 -816
- package/dist/commands/api-client.js +3 -3
- package/dist/commands/broker-permissions.d.ts +2 -0
- package/dist/commands/broker-permissions.js +1 -0
- package/dist/commands/canvas-analytics/chart.d.ts +52 -0
- package/dist/commands/canvas-analytics/chart.js +1 -0
- package/dist/commands/canvas-analytics/drilldown.d.ts +34 -0
- package/dist/commands/canvas-analytics/drilldown.js +1 -0
- package/dist/commands/canvas-analytics/format.d.ts +29 -0
- package/dist/commands/canvas-analytics/format.js +1 -0
- package/dist/commands/canvas-analytics/graph-detail.d.ts +2 -0
- package/dist/commands/canvas-analytics/graph-detail.js +2 -0
- package/dist/commands/canvas-analytics/graphs.d.ts +9 -0
- package/dist/commands/canvas-analytics/graphs.js +1 -0
- package/dist/commands/canvas-analytics/memory.d.ts +2 -0
- package/dist/commands/canvas-analytics/memory.js +1 -0
- package/dist/commands/canvas-analytics/overview.d.ts +2 -0
- package/dist/commands/canvas-analytics/overview.js +1 -0
- package/dist/commands/canvas-analytics/shell.d.ts +60 -0
- package/dist/commands/canvas-analytics/shell.js +2 -0
- package/dist/commands/canvas-analytics/time.d.ts +2 -0
- package/dist/commands/canvas-analytics/time.js +1 -0
- package/dist/commands/canvas-analytics/usage.d.ts +2 -0
- package/dist/commands/canvas-analytics/usage.js +1 -0
- package/dist/commands/canvas-analytics/view.d.ts +85 -0
- package/dist/commands/canvas-analytics/view.js +1 -0
- package/dist/commands/canvas-analytics.d.ts +2 -0
- package/dist/commands/canvas-analytics.js +1 -0
- package/dist/commands/canvas-prune.js +1 -1
- package/dist/commands/canvas.js +1 -1
- package/dist/commands/cron.js +5 -5
- package/dist/commands/human/components.d.ts +2 -0
- package/dist/commands/human/components.js +2 -2
- package/dist/commands/human/prompts.js +1 -1
- package/dist/commands/human/queue.js +1 -1
- package/dist/commands/memory/client.d.ts +11 -0
- package/dist/commands/memory/client.js +1 -0
- package/dist/commands/memory/delete.js +1 -1
- package/dist/commands/memory/edit.js +3 -3
- package/dist/commands/memory/find.js +1 -1
- package/dist/commands/memory/history.js +4 -4
- package/dist/commands/memory/lint.js +1 -1
- package/dist/commands/memory/list.d.ts +0 -2
- package/dist/commands/memory/list.js +1 -1
- package/dist/commands/memory/move.js +1 -1
- package/dist/commands/memory/origin.js +1 -1
- package/dist/commands/memory/read.d.ts +0 -5
- package/dist/commands/memory/read.js +3 -3
- package/dist/commands/memory/shared.d.ts +0 -178
- package/dist/commands/memory/shared.js +1 -12
- package/dist/commands/memory/write.js +5 -5
- package/dist/commands/node/bash.js +5 -5
- package/dist/commands/node/create.d.ts +0 -17
- package/dist/commands/node/create.js +2 -3
- package/dist/commands/node/inspect.js +6 -6
- package/dist/commands/node/lifecycle.js +2 -2
- package/dist/commands/node-context.js +2 -2
- package/dist/commands/node-inspect-artifacts.js +6 -6
- package/dist/commands/pkg/browse/catalog.js +1 -1
- package/dist/commands/pkg/browse/model.d.ts +1 -1
- package/dist/commands/pkg/market-manage.js +1 -1
- package/dist/commands/pkg/plugin-manage.js +10 -10
- package/dist/commands/profile/daemon-profiles.d.ts +13 -0
- package/dist/commands/profile/daemon-profiles.js +4 -0
- package/dist/commands/profile/delete.js +1 -1
- package/dist/commands/profile/env.d.ts +6 -0
- package/dist/commands/profile/env.js +2 -2
- package/dist/commands/profile/kind.js +1 -2
- package/dist/commands/profile/list.js +1 -1
- package/dist/commands/profile/meta.js +1 -1
- package/dist/commands/profile/new.js +1 -1
- package/dist/commands/profile/pause.js +1 -1
- package/dist/commands/profile/project.js +1 -1
- package/dist/commands/profile/rename.js +1 -1
- package/dist/commands/profile/show.js +1 -1
- package/dist/commands/profile.js +1 -1
- package/dist/commands/push.js +3 -3
- package/dist/commands/surface-inspect.js +1 -1
- package/dist/commands/sys/branch.js +1 -1
- package/dist/commands/sys/config.js +1 -1
- package/dist/commands/sys/connect.js +3 -3
- package/dist/commands/sys/context/admin/actions.js +1 -1
- package/dist/commands/sys/context/admin/model.d.ts +1 -0
- package/dist/commands/sys/context/admin/model.js +1 -1
- package/dist/commands/sys/context/admin.js +1 -1
- package/dist/commands/sys/context/expose.js +2 -1
- package/dist/commands/sys/context/prompt-review.js +2 -2
- package/dist/commands/sys/context/resolve.js +7 -7
- package/dist/commands/sys/context/sysprompt.js +1 -1
- package/dist/commands/sys/join.d.ts +1 -0
- package/dist/commands/sys/join.js +1 -0
- package/dist/commands/sys/migrate.js +1 -1
- package/dist/commands/sys/panels/models-panel.js +1 -1
- package/dist/commands/sys/panels/profiles-panel.d.ts +0 -1
- package/dist/commands/sys/panels/profiles-panel.js +1 -1
- package/dist/commands/sys/provider-login.js +6 -6
- package/dist/commands/sys/setup-core.d.ts +1 -1
- package/dist/commands/sys/setup-core.js +6 -6
- package/dist/commands/sys/setup-settings-runner.js +1 -1
- package/dist/commands/sys/setup.js +1 -1
- package/dist/commands/sys/spaces.d.ts +1 -0
- package/dist/commands/sys/spaces.js +2 -0
- package/dist/commands/sys/sync-deps.js +2 -2
- package/dist/commands/sys/sync-project-guidance.js +4 -4
- package/dist/commands/sys/sync-skills.js +2 -2
- package/dist/commands/sys/worktrees.d.ts +1 -0
- package/dist/commands/sys/worktrees.js +1 -1
- package/dist/commands/sys.js +1 -1
- package/dist/core/auth-file.js +2 -2
- package/dist/core/bash-job-supervisor.d.ts +6 -0
- package/dist/core/bash-job-supervisor.js +4 -0
- package/dist/core/bash-jobs.d.ts +13 -6
- package/dist/core/bash-jobs.js +8 -7
- package/dist/core/broker-client/transport-relay.d.ts +6 -3
- package/dist/core/broker-client/transport-relay.js +1 -1
- package/dist/core/broker-client/transport-socket.d.ts +6 -1
- package/dist/core/broker-client/transport-socket.js +1 -1
- package/dist/core/canvas/canvas.d.ts +39 -18
- package/dist/core/canvas/canvas.js +21 -20
- package/dist/core/canvas/context-strip.d.ts +20 -0
- package/dist/core/canvas/context-strip.js +5 -0
- package/dist/core/canvas/crons.d.ts +12 -20
- package/dist/core/canvas/crons.js +15 -13
- package/dist/core/canvas/db.js +2 -2
- package/dist/core/canvas/deliveries.d.ts +4 -1
- package/dist/core/canvas/deliveries.js +1 -1
- package/dist/core/canvas/executions.js +1 -1
- package/dist/core/canvas/history.d.ts +2 -1
- package/dist/core/canvas/history.js +17 -18
- package/dist/core/canvas/memory-reads.d.ts +19 -0
- package/dist/core/canvas/memory-reads.js +1 -0
- package/dist/core/canvas/migrations.d.ts +0 -4
- package/dist/core/canvas/migrations.js +99 -32
- package/dist/core/canvas/nav-render.js +1 -1
- package/dist/core/canvas/node-agent-paths.d.ts +8 -0
- package/dist/core/canvas/node-agent-paths.js +1 -0
- package/dist/core/canvas/node-recap.d.ts +2 -2
- package/dist/core/canvas/node-recap.js +2 -2
- package/dist/core/canvas/node-tokens.d.ts +24 -0
- package/dist/core/canvas/node-tokens.js +5 -0
- package/dist/core/canvas/paths.d.ts +16 -19
- package/dist/core/canvas/paths.js +1 -1
- package/dist/core/canvas/render-source.d.ts +2 -2
- package/dist/core/canvas/render-source.js +6 -9
- package/dist/core/canvas/sessions.d.ts +18 -0
- package/dist/core/canvas/sessions.js +4 -1
- package/dist/core/canvas/types.d.ts +22 -6
- package/dist/core/command-hooks/compose.js +1 -1
- package/dist/core/command-hooks/discovery.d.ts +15 -1
- package/dist/core/command-hooks/discovery.js +1 -1
- package/dist/core/command-hooks/help.d.ts +2 -2
- package/dist/core/command-hooks/lifecycle-create.d.ts +1 -1
- package/dist/core/command-hooks/lifecycle-create.js +1 -1
- package/dist/core/command-hooks/transport/exec-invoke.d.ts +2 -0
- package/dist/core/command-hooks/transport/exec-invoke.js +1 -1
- package/dist/core/command-hooks/transport/exec-lifecycle.d.ts +1 -0
- package/dist/core/command-hooks/transport/exec-lifecycle.js +1 -1
- package/dist/core/command-hooks/transport/plan.d.ts +3 -0
- package/dist/core/command-hooks/transport/plan.js +1 -0
- package/dist/core/command-plugins/discovery.js +1 -1
- package/dist/core/command.d.ts +6 -2
- package/dist/core/command.js +6 -6
- package/dist/core/config.d.ts +8 -5
- package/dist/core/config.js +1 -1
- package/dist/core/conversation-store/client-worker.d.ts +1 -0
- package/dist/core/conversation-store/client-worker.js +1 -0
- package/dist/core/conversation-store/client.d.ts +2 -0
- package/dist/core/conversation-store/client.js +2 -0
- package/dist/core/conversation-store/file-store.d.ts +37 -0
- package/dist/core/conversation-store/file-store.js +9 -0
- package/dist/core/conversation-store/index.d.ts +50 -0
- package/dist/core/conversation-store/index.js +1 -0
- package/dist/core/conversation-store/listener.d.ts +4 -0
- package/dist/core/conversation-store/listener.js +3 -0
- package/dist/core/conversation-store/patch.d.ts +1 -0
- package/dist/core/conversation-store/patch.js +1 -0
- package/dist/core/directory/join.d.ts +27 -0
- package/dist/core/directory/join.js +1 -0
- package/dist/core/disk-usage.d.ts +4 -0
- package/dist/core/disk-usage.js +1 -0
- package/dist/core/events/emit.d.ts +2 -0
- package/dist/core/events/emit.js +3 -1
- package/dist/core/feed/feed.js +4 -4
- package/dist/core/feed/messages.d.ts +3 -0
- package/dist/core/feed/messages.js +6 -6
- package/dist/core/fs-utils.d.ts +2 -0
- package/dist/core/fs-utils.js +3 -3
- package/dist/core/grants/local.d.ts +4 -0
- package/dist/core/grants/local.js +1 -0
- package/dist/core/grants/mirror.d.ts +44 -0
- package/dist/core/grants/mirror.js +4 -0
- package/dist/core/grants/on-sync.d.ts +22 -0
- package/dist/core/grants/on-sync.js +1 -0
- package/dist/core/grants/remove.d.ts +7 -0
- package/dist/core/grants/remove.js +1 -0
- package/dist/core/grants/sandboxes.d.ts +7 -0
- package/dist/core/grants/sandboxes.js +1 -0
- package/dist/core/grants/sync.d.ts +12 -0
- package/dist/core/grants/sync.js +1 -0
- package/dist/core/help/memory-extensions.d.ts +3 -0
- package/dist/core/help/memory-extensions.js +2 -0
- package/dist/core/help.d.ts +14 -0
- package/dist/core/help.js +7 -7
- package/dist/core/host-exports/builtins.js +3 -3
- package/dist/core/host-exports/export.js +3 -3
- package/dist/core/human/action-binding.d.ts +2 -0
- package/dist/core/human/action-binding.js +1 -1
- package/dist/core/human/feedback-companion.d.ts +0 -1
- package/dist/core/human/feedback-companion.js +1 -1
- package/dist/core/human/page-schema.d.ts +1 -1
- package/dist/core/inspector/core.d.ts +2 -0
- package/dist/core/inspector/core.js +1 -1
- package/dist/core/inspector/tui.js +2 -2
- package/dist/core/installed-plugins.js +1 -1
- package/dist/core/io.js +6 -6
- package/dist/core/keybindings/catalog.d.ts +1 -1
- package/dist/core/keybindings/catalog.js +1 -1
- package/dist/core/layout-migrate/index.d.ts +15 -0
- package/dist/core/layout-migrate/index.js +4 -0
- package/dist/core/layout-migrate/paths.d.ts +26 -0
- package/dist/core/layout-migrate/paths.js +1 -0
- package/dist/core/layout-migrate/stored-paths.d.ts +2 -0
- package/dist/core/layout-migrate/stored-paths.js +11 -0
- package/dist/core/layout-migrate/stores.d.ts +17 -0
- package/dist/core/layout-migrate/stores.js +4 -0
- package/dist/core/layout.d.ts +26 -0
- package/dist/core/layout.js +2 -0
- package/dist/core/llm/run.d.ts +60 -0
- package/dist/core/llm/run.js +4 -0
- package/dist/core/memory/cli-selector.d.ts +13 -0
- package/dist/core/memory/cli-selector.js +1 -0
- package/dist/core/memory/history.d.ts +5 -4
- package/dist/core/memory/history.js +6 -6
- package/dist/core/memory/inline-ref-inventory.d.ts +2 -1
- package/dist/core/memory/inline-ref-inventory.js +1 -1
- package/dist/core/memory/lint.js +2 -2
- package/dist/core/memory/mutation-domain.d.ts +2 -2
- package/dist/core/memory/mutation-domain.js +8 -7
- package/dist/core/memory/mutations.js +1 -1
- package/dist/core/memory/service.d.ts +5 -0
- package/dist/core/memory/service.js +2 -2
- package/dist/core/memory-resolver.d.ts +11 -7
- package/dist/core/memory-resolver.js +2 -2
- package/dist/core/model-auth/daemon-login.d.ts +13 -0
- package/dist/core/model-auth/daemon-login.js +1 -0
- package/dist/core/model-auth/flows.d.ts +45 -0
- package/dist/core/model-auth/flows.js +1 -0
- package/dist/core/model-auth/handoff-jti.d.ts +4 -0
- package/dist/core/model-auth/handoff-jti.js +1 -0
- package/dist/core/model-routes.js +1 -1
- package/dist/core/nested-stores.d.ts +2 -1
- package/dist/core/nested-stores.js +1 -2
- package/dist/core/preview-registry.js +2 -2
- package/dist/core/profiles/env-store.js +2 -2
- package/dist/core/profiles/manifest.d.ts +16 -5
- package/dist/core/profiles/manifest.js +1 -1
- package/dist/core/provider-management.js +1 -1
- package/dist/core/review/birth.js +1 -1
- package/dist/core/review/companion.d.ts +0 -2
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/fork.js +2 -2
- package/dist/core/review/realize.js +1 -1
- package/dist/core/review/stage.d.ts +1 -1
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/types.d.ts +1 -1
- package/dist/core/runs/events.d.ts +34 -0
- package/dist/core/runs/events.js +1 -0
- package/dist/core/runs/operations.d.ts +43 -0
- package/dist/core/runs/operations.js +12 -0
- package/dist/core/runtime/bearings-render.d.ts +2 -2
- package/dist/core/runtime/bearings-render.js +11 -11
- package/dist/core/runtime/bearings.js +2 -2
- package/dist/core/runtime/broker/cli-relay.d.ts +5 -0
- package/dist/core/runtime/broker/cli-relay.js +1 -0
- package/dist/core/runtime/broker/client-registry.d.ts +0 -5
- package/dist/core/runtime/broker/client-registry.js +1 -1
- package/dist/core/runtime/broker/daemon-ops.d.ts +28 -1
- package/dist/core/runtime/broker/daemon-ops.js +1 -1
- package/dist/core/runtime/broker/engine-drive.d.ts +0 -2
- package/dist/core/runtime/broker/engine-drive.js +1 -1
- package/dist/core/runtime/broker/fault-retry.d.ts +9 -0
- package/dist/core/runtime/broker/fault-retry.js +1 -1
- package/dist/core/runtime/broker/frame-dispatch.d.ts +5 -9
- package/dist/core/runtime/broker/frame-dispatch.js +1 -1
- package/dist/core/runtime/broker/frame-engine-control.d.ts +3 -2
- package/dist/core/runtime/broker/frame-engine-control.js +1 -1
- package/dist/core/runtime/broker/frame-memory-refs.d.ts +4 -3
- package/dist/core/runtime/broker/frame-memory-refs.js +1 -1
- package/dist/core/runtime/broker/frame-read.js +1 -1
- package/dist/core/runtime/broker/frame-session.js +1 -1
- package/dist/core/runtime/broker/held-deferred-inbox.d.ts +3 -1
- package/dist/core/runtime/broker/held-deferred-inbox.js +1 -1
- package/dist/core/runtime/broker/inbox.d.ts +1 -2
- package/dist/core/runtime/broker/inbox.js +7 -10
- package/dist/core/runtime/broker/model-adapter.d.ts +9 -0
- package/dist/core/runtime/broker/model-adapter.js +2 -0
- package/dist/core/runtime/broker/node-token.d.ts +3 -0
- package/dist/core/runtime/broker/node-token.js +1 -0
- package/dist/core/runtime/broker/read-ops.js +1 -1
- package/dist/core/runtime/broker/rebind.d.ts +2 -0
- package/dist/core/runtime/broker/rebind.js +1 -1
- package/dist/core/runtime/broker/tool-groups.js +1 -1
- package/dist/core/runtime/broker/turn-ignition.d.ts +3 -3
- package/dist/core/runtime/broker/turn-ignition.js +1 -1
- package/dist/core/runtime/broker-cli.js +3 -3
- package/dist/core/runtime/broker-extension-render.d.ts +2 -5
- package/dist/core/runtime/broker-extension-render.js +4 -4
- package/dist/core/runtime/broker-persona-guidance.js +3 -3
- package/dist/core/runtime/broker-protocol.d.ts +7 -8
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/canvas-extensions.d.ts +1 -0
- package/dist/core/runtime/canvas-extensions.js +1 -1
- package/dist/core/runtime/close.d.ts +9 -0
- package/dist/core/runtime/close.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/fleet.d.ts +1 -1
- package/dist/core/runtime/front-door-login.js +1 -1
- package/dist/core/runtime/front-door.js +2 -2
- package/dist/core/runtime/headless-pi.d.ts +1 -1
- package/dist/core/runtime/headless-pi.js +1 -1
- package/dist/core/runtime/host.d.ts +1 -1
- package/dist/core/runtime/host.js +3 -1
- package/dist/core/runtime/invocation.d.ts +3 -0
- package/dist/core/runtime/kickoff.d.ts +1 -0
- package/dist/core/runtime/kickoff.js +16 -16
- package/dist/core/runtime/launch-target.d.ts +1 -1
- package/dist/core/runtime/launch-target.js +1 -1
- package/dist/core/runtime/launch.d.ts +10 -35
- package/dist/core/runtime/launch.js +1 -1
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/memory.d.ts +1 -1
- package/dist/core/runtime/memory.js +1 -1
- package/dist/core/runtime/model-registry.js +1 -1
- package/dist/core/runtime/model-swap.d.ts +17 -19
- package/dist/core/runtime/model-swap.js +1 -1
- package/dist/core/runtime/node-read.js +3 -2
- package/dist/core/runtime/nodes.d.ts +7 -0
- package/dist/core/runtime/nodes.js +1 -1
- package/dist/core/runtime/outcome-document.js +1 -1
- package/dist/core/runtime/package-health.js +2 -2
- package/dist/core/runtime/persona.js +2 -2
- package/dist/core/runtime/pi-vendored.js +1 -1
- package/dist/core/runtime/placement-tmux.d.ts +1 -1
- package/dist/core/runtime/placement-tmux.js +1 -1
- package/dist/core/runtime/placement.js +1 -1
- package/dist/core/runtime/promote.js +1 -1
- package/dist/core/runtime/provider-credential-gate.js +2 -2
- package/dist/core/runtime/recovery-hold.d.ts +2 -0
- package/dist/core/runtime/recovery-hold.js +1 -0
- package/dist/core/runtime/recycle.js +1 -1
- package/dist/core/runtime/reopen.js +1 -1
- package/dist/core/runtime/reset.js +1 -1
- package/dist/core/runtime/revive.d.ts +1 -1
- package/dist/core/runtime/revive.js +2 -3
- package/dist/core/runtime/roadmap.js +4 -4
- package/dist/core/runtime/run-command.d.ts +6 -0
- package/dist/core/runtime/run-command.js +1 -1
- package/dist/core/runtime/session-branch.d.ts +2 -8
- package/dist/core/runtime/session-branch.js +1 -1
- package/dist/core/runtime/session-list-cache.d.ts +6 -22
- package/dist/core/runtime/session-list-cache.js +1 -1
- package/dist/core/runtime/situational-context.js +2 -2
- package/dist/core/runtime/spawn-env.d.ts +6 -6
- package/dist/core/runtime/spawn-env.js +1 -1
- package/dist/core/runtime/spawn.d.ts +5 -0
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/runtime/stop-guard.js +2 -2
- package/dist/core/runtime/stop-signals.d.ts +2 -2
- package/dist/core/runtime/stop-signals.js +1 -1
- package/dist/core/runtime/structured-output.d.ts +10 -4
- package/dist/core/runtime/structured-output.js +4 -4
- package/dist/core/runtime/tmux-bindings.js +3 -3
- package/dist/core/runtime/tmux-driver.d.ts +4 -0
- package/dist/core/runtime/tmux-driver.js +7 -7
- package/dist/core/runtime/view-socket.d.ts +9 -2
- package/dist/core/runtime/view-socket.js +1 -1
- package/dist/core/runtime/warm-pool.js +1 -1
- package/dist/core/scope.d.ts +3 -2
- package/dist/core/scope.js +1 -1
- package/dist/core/scoped-state/db.js +1 -1
- package/dist/core/scoped-state/migrate.js +3 -3
- package/dist/core/scoped-state/profiles.d.ts +2 -1
- package/dist/core/scoped-state/profiles.js +1 -1
- package/dist/core/scoped-state/schema.d.ts +2 -1
- package/dist/core/scoped-state/schema.js +4 -4
- package/dist/core/scopes.d.ts +2 -2
- package/dist/core/scopes.js +1 -1
- package/dist/core/secrets.d.ts +1 -0
- package/dist/core/secrets.js +2 -2
- package/dist/core/spaces/mounts.d.ts +32 -0
- package/dist/core/spaces/mounts.js +1 -0
- package/dist/core/spaces/open-beneath.d.ts +71 -0
- package/dist/core/spaces/open-beneath.js +1 -0
- package/dist/core/spaces/permissions.d.ts +46 -0
- package/dist/core/spaces/permissions.js +1 -0
- package/dist/core/spaces/process.d.ts +27 -0
- package/dist/core/spaces/process.js +1 -0
- package/dist/core/spaces/space.d.ts +8 -0
- package/dist/core/spaces/space.js +2 -0
- package/dist/core/spaces/stop.d.ts +8 -0
- package/dist/core/spaces/stop.js +2 -0
- package/dist/core/spaces/users.d.ts +19 -0
- package/dist/core/spaces/users.js +1 -0
- package/dist/core/subscription-state.d.ts +2 -0
- package/dist/core/subscription-state.js +3 -3
- package/dist/core/substrate/frontmatter-validation.js +1 -1
- package/dist/core/substrate/injected-store.d.ts +28 -3
- package/dist/core/substrate/injected-store.js +2 -1
- package/dist/core/substrate/listings.js +1 -1
- package/dist/core/substrate/memory-events.d.ts +6 -0
- package/dist/core/substrate/memory-events.js +1 -0
- package/dist/core/substrate/on-read-node.js +1 -1
- package/dist/core/substrate/on-read.d.ts +6 -6
- package/dist/core/substrate/on-read.js +5 -5
- package/dist/core/substrate/plan.js +1 -1
- package/dist/core/substrate/render-node.js +1 -1
- package/dist/core/substrate/render.d.ts +4 -3
- package/dist/core/substrate/render.js +38 -38
- package/dist/core/substrate/schema.d.ts +6 -0
- package/dist/core/substrate/schema.js +1 -1
- package/dist/core/tui/panel.js +1 -1
- package/dist/core/user-settings.d.ts +12 -0
- package/dist/core/user-settings.js +1 -1
- package/dist/core/worktree-mutation-async.js +5 -5
- package/dist/core/worktree-quarantine.js +1 -1
- package/dist/core/worktree-remove.d.ts +15 -0
- package/dist/core/worktree-remove.js +1 -0
- package/dist/core/worktree-sweep.js +6 -6
- package/dist/daemon/analytics/compute.d.ts +37 -0
- package/dist/daemon/analytics/compute.js +1 -0
- package/dist/daemon/analytics/scan-worker.d.ts +1 -0
- package/dist/daemon/analytics/scan-worker.js +2 -0
- package/dist/daemon/analytics/scan.d.ts +37 -0
- package/dist/daemon/analytics/scan.js +1 -0
- package/dist/daemon/api/app-listener.d.ts +11 -0
- package/dist/daemon/api/app-listener.js +21 -0
- package/dist/daemon/api/bridge.js +5 -5
- package/dist/daemon/api/handlers/analytics.d.ts +2 -0
- package/dist/daemon/api/handlers/analytics.js +1 -0
- package/dist/daemon/api/handlers/attach.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +2 -2
- package/dist/daemon/api/handlers/bash.js +1 -1
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/canvas.d.ts +1 -1
- package/dist/daemon/api/handlers/canvas.js +6 -6
- package/dist/daemon/api/handlers/crons.js +1 -1
- package/dist/daemon/api/handlers/files.d.ts +1 -1
- package/dist/daemon/api/handlers/files.js +1 -1
- package/dist/daemon/api/handlers/health.js +2 -2
- package/dist/daemon/api/handlers/hook-exec.d.ts +2 -0
- package/dist/daemon/api/handlers/hook-exec.js +1 -0
- package/dist/daemon/api/handlers/human-requests.js +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/llm.d.ts +2 -0
- package/dist/daemon/api/handlers/llm.js +3 -0
- package/dist/daemon/api/handlers/memory-reads.d.ts +4 -0
- package/dist/daemon/api/handlers/memory-reads.js +1 -0
- package/dist/daemon/api/handlers/memory.js +5 -1
- package/dist/daemon/api/handlers/messages.js +2 -2
- package/dist/daemon/api/handlers/modelauth.js +1 -1
- package/dist/daemon/api/handlers/node-outcomes.js +1 -1
- package/dist/daemon/api/handlers/node-records.d.ts +2 -0
- package/dist/daemon/api/handlers/node-records.js +3 -0
- package/dist/daemon/api/handlers/nodes.d.ts +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/profiles.d.ts +4 -1
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/api/handlers/reports.js +5 -3
- package/dist/daemon/api/handlers/reviews.d.ts +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/handlers/run-routes.d.ts +2 -0
- package/dist/daemon/api/handlers/run-routes.js +1 -0
- package/dist/daemon/api/handlers/runs.d.ts +9 -0
- package/dist/daemon/api/handlers/runs.js +1 -0
- package/dist/daemon/api/handlers/subscriptions.js +1 -1
- package/dist/daemon/api/handlers/worktree.js +1 -1
- package/dist/daemon/api/map.d.ts +10 -4
- package/dist/daemon/api/map.js +2 -2
- package/dist/daemon/api/operations.d.ts +18 -0
- package/dist/daemon/api/operations.js +1 -0
- package/dist/daemon/api/principal.d.ts +42 -0
- package/dist/daemon/api/principal.js +1 -0
- package/dist/daemon/api/router.d.ts +27 -3
- package/dist/daemon/api/router.js +1 -1
- package/dist/daemon/api/server.d.ts +4 -0
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/api/vendor-signin.d.ts +7 -0
- package/dist/daemon/api/vendor-signin.js +77 -0
- package/dist/daemon/api/viewer-presence.d.ts +3 -0
- package/dist/daemon/api/viewer-presence.js +1 -0
- package/dist/daemon/cron/armed-context.d.ts +4 -0
- package/dist/daemon/cron/armed-context.js +1 -1
- package/dist/daemon/cron/escalation.js +3 -3
- package/dist/daemon/cron/lease-recovery.js +1 -1
- package/dist/daemon/cron/sinks.js +2 -2
- package/dist/daemon/cron-run.d.ts +5 -5
- package/dist/daemon/cron-run.js +1 -1
- package/dist/daemon/crtrd.js +8 -7
- package/dist/daemon/delivery/run-delivery.d.ts +4 -0
- package/dist/daemon/delivery/run-delivery.js +1 -1
- package/dist/daemon/fleet.d.ts +1 -1
- package/dist/daemon/fleet.js +6 -6
- package/dist/daemon/human/finish.js +7 -7
- package/dist/daemon/joined-owner.d.ts +5 -0
- package/dist/daemon/joined-owner.js +1 -0
- package/dist/daemon/manage.js +2 -2
- package/dist/daemon/messaging/node-message.js +1 -1
- package/dist/daemon/park-activity.js +1 -1
- package/dist/daemon/reconcilers/bash-deadline.js +1 -1
- package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
- package/dist/daemon/reconcilers/broker-supervision.js +4 -4
- package/dist/daemon/reconcilers/delivery-lane.js +1 -1
- package/dist/daemon/reconcilers/live-obligation.d.ts +7 -0
- package/dist/daemon/reconcilers/live-obligation.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +20 -1
- package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
- package/dist/daemon/runs/append-section.d.ts +6 -0
- package/dist/daemon/runs/append-section.js +2 -0
- package/dist/daemon/runs/observer.d.ts +5 -0
- package/dist/daemon/runs/observer.js +4 -0
- package/dist/launcher/bwrap.d.ts +4 -0
- package/dist/launcher/bwrap.js +2 -0
- package/dist/launcher/client.d.ts +2 -0
- package/dist/launcher/client.js +3 -0
- package/dist/launcher/main.d.ts +1 -0
- package/dist/launcher/main.js +3 -0
- package/dist/launcher/netrule.d.ts +1 -0
- package/dist/launcher/netrule.js +1 -0
- package/dist/launcher/seccomp.d.ts +1 -0
- package/dist/launcher/seccomp.js +1 -0
- package/dist/launcher/spec.d.ts +88 -0
- package/dist/launcher/spec.js +1 -0
- package/dist/launcher/users.d.ts +18 -0
- package/dist/launcher/users.js +7 -0
- package/dist/launcher/validate.d.ts +22 -0
- package/dist/launcher/validate.js +1 -0
- package/dist/migrations/corpus.js +3 -3
- package/dist/migrations/runner.js +1 -1
- package/dist/native/linux/addon.node +0 -0
- package/dist/native/linux.d.ts +29 -0
- package/dist/native/linux.js +1 -0
- package/dist/pi-extensions/broker-local.js +2 -2
- package/dist/pi-extensions/canvas-bash-valve.d.ts +1 -3
- package/dist/pi-extensions/canvas-bash-valve.js +4 -7
- package/dist/pi-extensions/canvas-context-intro.d.ts +1 -2
- package/dist/pi-extensions/canvas-context-intro.js +2 -2
- package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
- package/dist/pi-extensions/canvas-inbox-watcher.d.ts +2 -1
- package/dist/pi-extensions/canvas-inbox-watcher.js +2 -1
- package/dist/pi-extensions/canvas-passive-context.d.ts +1 -1
- package/dist/pi-extensions/canvas-passive-context.js +11 -11
- package/dist/pi-extensions/canvas-recap.js +6 -6
- package/dist/pi-extensions/canvas-stophook.js +1 -1
- package/dist/pi-extensions/canvas-structured-output.js +4 -4
- package/dist/pi-extensions/canvas-tool-guide.js +1 -1
- package/dist/pi-extensions/system-prompt-entry.d.ts +15 -0
- package/dist/pi-extensions/system-prompt-entry.js +1 -0
- package/dist/shared/env.d.ts +5 -1
- package/dist/shared/env.js +1 -1
- package/dist/shared/strip-cd-prefix.d.ts +1 -0
- package/dist/shared/strip-cd-prefix.js +1 -0
- package/dist/types.d.ts +31 -15
- package/docs/cli/memory-and-preferences.md +3 -1
- package/docs/sdk/client.md +34 -0
- package/docs/sdk/errors.md +2 -0
- package/docs/sdk/memory.md +2 -2
- package/docs/sdk/streaming.md +21 -0
- package/package.json +18 -4
- package/packages/crouter-identity/dist/index.d.ts +54 -0
- package/packages/crouter-identity/dist/index.js +166 -0
- package/packages/crouter-identity/package.json +33 -0
- package/runtime.lock.json +34 -8
- package/scripts/build-native-linux.mjs +16 -0
- package/scripts/install-runtime.mjs +9 -7
- package/scripts/lib/isolation-env.mjs +42 -0
- package/scripts/runtime-smoke.mjs +49 -0
- package/src/native/linux/addon.c +249 -0
- package/dist/core/profiles/state-block.d.ts +0 -4
- package/dist/core/profiles/state-block.js +0 -3
- package/dist/core/runtime/broker/auth-reload.d.ts +0 -41
- package/dist/core/runtime/broker/auth-reload.js +0 -1
- package/dist/core/substrate/cli-context-delivery.d.ts +0 -22
- package/dist/core/substrate/cli-context-delivery.js +0 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var E=Object.defineProperty;var i=(t,n)=>E(t,"name",{value:n,configurable:!0});import{join as w}from"node:path";import{getNode as x,subscriptionsOf as k,subscribersOf as M}from"../canvas/index.js";import{contextDir as h,nodeAgentDir as f,reportsDir as v}from"../canvas/node-agent-paths.js";import{readdirBeneath as A,readTextBeneathIfExists as j,unlinkBeneath as N,writeFileBeneath as R}from"../spaces/open-beneath.js";import{activeBackgroundBashJobs as O,bashJobCommandLine as I,formatBashElapsed as D}from"../bash-jobs.js";import{readRoadmap as C,roadmapPath as G}from"./roadmap.js";import{buildWakeBearings as Y}from"./bearings.js";import{personaDrift as P}from"./persona.js";import{coalesce as S,nodeMailEntry as U}from"../feed/inbox.js";import{claimKickoffMail as L}from"../canvas/deliveries.js";import{formatCard as _}from"../../shared/generated-context.js";const ct=_("restart-continuation",{},"continue");function y(t){return w(h(t),"initial-prompt.md")}i(y,"goalPath");function B(t){return j(f(t),y(t))}i(B,"readGoal");function J(t,n){const e=n.trim();e!==""&&R(f(t),y(t),e+`
|
|
2
|
+
`)}i(J,"writeGoal");function pt(t,n){const e=B(t);if(e!==null&&e.trim()!=="")return!1;const o=n.trim();return o===""?!1:(J(t,o),!0)}i(pt,"captureGoalIfAbsent");function b(t){return w(h(t),"yield-message.md")}i(b,"yieldMessagePath");function ft(t,n){const e=n.trim();e!==""&&R(f(t),b(t),e+`
|
|
3
|
+
`)}i(ft,"writeYieldMessage");function K(t){const n=j(f(t),b(t))?.trim()??"";return n!==""?n:null}i(K,"readYieldMessage");function ht(t){try{N(f(t),b(t))}catch{}}i(ht,"clearYieldMessage");function W(t){return $(t,h(t)).sort()}i(W,"listContextDir");function F(t){return $(t,v(t)).some(n=>n.endsWith(".md"))}i(F,"hasRetainedReports");function $(t,n){try{return A(f(t),n).map(e=>e.name)}catch(e){if(e.code==="ENOENT")return[];throw e}}i($,"agentDirNames");function mt(t,n){const e=t.node_id,o=K(e),s=t.run_id?[]:L(e,n),r=s.map(c=>c.message.messageId),d=s.map(U);let l=null;if(d.length>0){const c=i(p=>{const g=p.data?.cards;return Array.isArray(g)?g.filter(T=>typeof T=="string"):[]},"cardsFor"),m=[];for(const p of d)(c(p).length>0||m.length===0)&&m.push([]),m.at(-1).push(p);l=m.map(p=>[...c(p[0]),S(p).map(g=>g.text).join(`
|
|
4
4
|
|
|
5
5
|
`)].join(`
|
|
6
6
|
|
|
7
7
|
`)).join(`
|
|
8
8
|
|
|
9
|
-
`)}const
|
|
9
|
+
`)}const a=P(e),u=a?.guidance===void 0||a.guidance===""?null:a.guidance;return{yieldMsg:o,unreadDigest:l,unreadMessageIds:r,driftGuidance:u}}i(mt,"drainBearings");const H=8;function q(t){return t.match(/^[0-9]{8}T[0-9]{6}-(.+)\.md$/)?.[1]??"report"}i(q,"reportKind");function z(t){const n=[];for(const e of k(t).filter(o=>o.active)){const o=$(e.node_id,v(e.node_id)).filter(r=>r.endsWith(".md")).sort().reverse();if(o.length===0)continue;const s=x(e.node_id);n.push({nodeId:e.node_id,name:s?.name??e.node_id,count:o.length,latest:o[0]})}return n.sort((e,o)=>o.latest.localeCompare(e.latest))}i(z,"reportHistorySources");function Q(t,n){const e=k(t).filter(r=>r.active).map(r=>x(r.node_id)).filter(r=>r!==null&&(r.status==="active"||r.status==="idle")),o=[];if(e.length>0){const r=e.length,d=r===1?"it is":"they are",l=r===1?"it":"they",a=r===1?"pushes":"push";o.push(`Awaiting ${r} node${r===1?"":"s"} \u2014 ${d} alive and running right now, and will wake you the moment ${l} ${a}. The wake is automatic; nothing to check, poll, or verify.`);for(const u of e)o.push(` - ${u.name} (${u.node_id}) \u2014 ${u.status}`);o.push("",n??"(no unread reports yet \u2014 expected while they run: a worker leaves no pointer until it pushes, so an empty feed means still working, not stalled)")}else o.push("Awaiting 0 nodes."),o.push("",n??"(no unread reports)");const s=z(t);if(s.length>0){const r=s.slice(0,H),d=s.length-r.length,l=s.reduce((a,u)=>a+u.count,0);o.push("",`Report history on disk (collapsed): ${l} report${l===1?"":"s"} across ${s.length} subscribed node${s.length===1?"":"s"}. This is a catch-up index for earlier reports; read only what matters.`,...r.map(a=>{const u=`${a.nodeId}:reports/${a.latest}`;return` - ${a.name} (${a.nodeId}): ${a.count} report${a.count===1?"":"s"}; latest ${q(a.latest)}: ${u}`}),...d>0?[` - \u2026 ${d} more subscribed node${d===1?"":"s"} with reports hidden`]:[],"Expand: `crtr canvas history read <ref>` for one listed report; `crtr node inspect artifacts <node-id> --type report` for that node's full report list; `crtr node inspect artifacts <node-id> --type inbox` for retained inbox history including full message bodies.")}return`<feed>
|
|
10
10
|
${o.join(`
|
|
11
11
|
`)}
|
|
12
|
-
</feed>`}
|
|
13
|
-
${
|
|
12
|
+
</feed>`}i(Q,"feedBlock");function V(t,n){const e=(t??I(n)).trim()||"(no command)";return e.length>120?`${e.slice(0,117)}\u2026`:e}i(V,"jobLabel");function X(t){const n=O(h(t));if(n.length===0)return null;const e=Date.now(),o=n.length===1,s=[`${n.length} background bash job${o?"":"s"} you started ${o?"is":"are"} STILL RUNNING, detached from any turn and unaffected by your refresh. Each one sends you a message when it exits \u2014 that wake is automatic, so do not poll it and do not relaunch the same command.`];for(const r of n)s.push(` - ${r.jobId} \u2014 ${V(r.purpose,r.command)} \xB7 running ${D(e-r.startedAtMs)} \xB7 log ${r.logPath}`);return s.push("","Read output so far: `tail -n 50 <log>` (or `crtr node bash list --tail 20`). Abandon one: `crtr node bash kill <job-id>`."),`<background-jobs>
|
|
13
|
+
${s.join(`
|
|
14
14
|
`)}
|
|
15
|
-
</background-jobs>`}
|
|
15
|
+
</background-jobs>`}i(X,"backgroundJobsBlock");function gt(t,n,e){const o=t.node_id,s=["You have been revived fresh after a context refresh \u2014 your previous in-memory context is gone, by design. Everything below was just read from disk; it is your full bearings. Rebuild from it and continue toward your goal."];e!==void 0&&s.push(Y(e));const r=C(o),d=r!==null&&r.trim()!=="";if(s.push(`<roadmap file="${G(o)}">
|
|
16
16
|
${d?r.trim():"(no roadmap on disk yet)"}
|
|
17
|
-
</roadmap>`),!d&&!
|
|
17
|
+
</roadmap>`),!d&&!F(o)){const c=B(o);c!==null&&c.trim()!==""&&s.push(`<goal file="${y(o)}">
|
|
18
18
|
${c.trim()}
|
|
19
|
-
</goal>`)}const l=
|
|
19
|
+
</goal>`)}const l=W(o).filter(c=>c!=="yield-message.md");s.push(`<context-dir path="${h(o)}">
|
|
20
20
|
${l.length>0?l.join(`
|
|
21
21
|
`):"(empty)"}
|
|
22
|
-
</context-dir>`);const a=
|
|
23
|
-
${
|
|
24
|
-
</yield-message>`:"<yield-message/>");const u=
|
|
25
|
-
Your role was changed while you were away. ${
|
|
26
|
-
</persona-transition>`),
|
|
27
|
-
${
|
|
22
|
+
</context-dir>`);const a=X(o);a!==null&&s.push(a),s.push(Q(o,n.unreadDigest)),s.push(n.yieldMsg!==null?`<yield-message>
|
|
23
|
+
${n.yieldMsg.trim()}
|
|
24
|
+
</yield-message>`:"<yield-message/>");const u=M(o).length>0;return s.push(u?"If there is work to do, perform it. Otherwise stop \u2014 pipe the result to `crtr push final` through a single-quoted heredoc if the goal is met, or end your turn without a message to stay dormant awaiting your workers.":"If there is work to do, perform it. Otherwise end your turn without writing a message \u2014 the user already has your last reply, and a status recap would only bury it. You are working directly with the user, so stay available and continue when they write back."),n.driftGuidance!==null&&s.push(`<persona-transition>
|
|
25
|
+
Your role was changed while you were away. ${n.driftGuidance}
|
|
26
|
+
</persona-transition>`),_("revive",{},`
|
|
27
|
+
${s.join(`
|
|
28
28
|
|
|
29
29
|
`)}
|
|
30
|
-
`)}
|
|
30
|
+
`)}i(gt,"buildReviveKickoff");export{ct as RUNTIME_RESTART_CONTINUATION,gt as buildReviveKickoff,pt as captureGoalIfAbsent,ht as clearYieldMessage,mt as drainBearings,y as goalPath,F as hasRetainedReports,W as listContextDir,B as readGoal,K as readYieldMessage,J as writeGoal,ft as writeYieldMessage,b as yieldMessagePath};
|
|
@@ -22,4 +22,4 @@ export declare function resolveLaunchTarget(req: CreateNodeRequest, options?: {
|
|
|
22
22
|
validateKind?: (kind: string) => void | Promise<void>;
|
|
23
23
|
}): Promise<ResolvedLaunchTarget>;
|
|
24
24
|
/** The directory a new node is pinned to. */
|
|
25
|
-
export declare function resolveNodeCwd(req: CreateNodeRequest, parent: string | undefined,
|
|
25
|
+
export declare function resolveNodeCwd(req: CreateNodeRequest, parent: string | undefined, _profileId: string | null, contextCwd: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var u=Object.defineProperty;var
|
|
1
|
+
var u=Object.defineProperty;var d=(e,n)=>u(e,"name",{value:n,configurable:!0});import{appSpace as p}from"../layout.js";import{envProfileId as m}from"../../shared/env.js";import{resolve as s}from"node:path";import{getNode as w}from"../canvas/canvas.js";import{usage as v}from"../errors.js";import{assertProfileActive as y}from"../profiles/manifest.js";import{buildLaunchSpecAsync as h,readMergedLaunchConfigAsync as g}from"./launch.js";import{resolveProfileId as k}from"./spawn.js";function x(e,n){return e??n?.manifest.default_kind??"general"}d(x,"resolveCreateKind");async function _(e,n=process.cwd(),t=m()||null){const i=Object.keys((await g(n,t)).kinds);if(!i.includes(e))throw v(`unknown kind: ${e}`,{received:e,next:`Valid kinds: ${i.sort().join(", ")}.`})}d(_,"assertLaunchKind");async function M(e,n={}){const t=e.parent??void 0,i=e.cwd??process.cwd(),o=await k(e.profile,t??null,i,{readOnlySelection:n.readOnlyProfileSelection}),l=y(o),r=x(e.kind,l);await n.validateKind?.(r);const c=C({...e,kind:r},t,o,i);n.validateKind===void 0&&await _(r,c,o);const a=e.mode??"base",f=(await h(r,a,{lifecycle:e.root_lifecycle??(e.root===!0?"resident":"terminal"),hasManager:e.root!==!0,...e.model!==void 0?{model:e.model,modelOverride:!0}:{},cwd:c,profileId:o})).launch;return{profileId:o,profile:l,kind:r,mode:a,cwd:c,launch:f}}d(M,"resolveLaunchTarget");function C(e,n,t,i){if(e.pin_cwd!==void 0&&e.pin_cwd!=="")return s(e.pin_cwd);if(n!=null){const o=w(n);if(o!==null)return o.cwd}return e.cwd!==void 0&&e.cwd!==""?s(e.cwd):process.platform==="linux"?p("terminal").files:i}d(C,"resolveNodeCwd");export{_ as assertLaunchKind,x as resolveCreateKind,M as resolveLaunchTarget,C as resolveNodeCwd};
|
|
@@ -2,18 +2,9 @@ import { type MergedLaunchConfig } from '../config.js';
|
|
|
2
2
|
import type { PiInvocation } from './invocation.js';
|
|
3
3
|
export { CANVAS_EXTENSIONS, CANVAS_STOPHOOK_PATH, CANVAS_INBOX_WATCHER_PATH, CANVAS_RECAP_PATH, CANVAS_GOAL_CAPTURE_PATH, CANVAS_PASSIVE_CONTEXT_PATH, CANVAS_CONTEXT_INTRO_PATH, CANVAS_TOOL_GUIDE_PATH, CANVAS_DOC_SUBSTRATE_PATH, CANVAS_STRUCTURED_OUTPUT_PATH, CANVAS_BASH_VALVE_PATH, } from './canvas-extensions.js';
|
|
4
4
|
import type { NodeMeta, LaunchSpec, Mode, Lifecycle } from '../canvas/index.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ModelIntent, ModelProvider, ScopeConfig } from '../../types.js';
|
|
6
6
|
export { OPENAI_PROVIDER_ENV, configuredLadderProviders, inferPortableModelSelection } from './model-selection.js';
|
|
7
7
|
export type { PortableModelSelection } from './model-selection.js';
|
|
8
|
-
/** True when an explicit model token is QUALIFIED — a `<provider>/<model-id>`
|
|
9
|
-
* or `<provider>/<tier>` raw token — the structural marker of a concrete exact
|
|
10
|
-
* pick. Deliberately provider-agnostic: a real registry provider namespace
|
|
11
|
-
* (`anthropic`, `openai-codex`, a user's own `amazon-bedrock`, …)
|
|
12
|
-
* qualifies identically, so the rule never depends on a fixed provider
|
|
13
|
-
* allowlist and never needs updating as providers are added. A bare tier
|
|
14
|
-
* (`ultra`) or bare family alias (`opus`/`sonnet`/`haiku`) has no `/` and
|
|
15
|
-
* stays unpinned. */
|
|
16
|
-
export declare function isProviderPinnedModelToken(model: string): boolean;
|
|
17
8
|
/** True when `model` is a PORTABLE ladder token — a bare strength/alias
|
|
18
9
|
* (`ultra`, `normal`, `opus`, …), a `<family>/<strength>` pair, or an
|
|
19
10
|
* anthropic family alias — i.e. a logical preference rather than a concrete
|
|
@@ -22,10 +13,13 @@ export declare function isProviderPinnedModelToken(model: string): boolean;
|
|
|
22
13
|
* ladder the running build ships, so they never freeze a stale concrete model
|
|
23
14
|
* id to disk. */
|
|
24
15
|
export declare function isPortableModelToken(model: string): boolean;
|
|
25
|
-
export declare function logicalModelIntent(model: string, ladders?: ScopeConfig['modelLadders']):
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
export declare function logicalModelIntent(model: string, ladders?: ScopeConfig['modelLadders']): ModelIntent | undefined;
|
|
17
|
+
/** The routing contract an explicit model choice asks for, decided from the RAW
|
|
18
|
+
* token: a portable token (`anthropic/strong`, `strong`, `opus`) is an intent
|
|
19
|
+
* that may rotate to another family at the same strength; any other token names
|
|
20
|
+
* one model exactly (undefined). `node new --model`, `node config --model`, and
|
|
21
|
+
* a viewer `/model` all apply this one rule. */
|
|
22
|
+
export declare function explicitModelIntent(model: string, ladders?: ScopeConfig['modelLadders']): ModelIntent | undefined;
|
|
29
23
|
export declare function normalizeModel(model: string, ladders?: ScopeConfig['modelLadders']): string;
|
|
30
24
|
/** The interleaved model-ladder cycle Alt+M / Alt+Shift+M walks: for each strength tier
|
|
31
25
|
* from strongest to weakest, each offered provider before descending — anthropic/ultra,
|
|
@@ -88,24 +82,8 @@ export interface LaunchBuildOptions {
|
|
|
88
82
|
* exactly the path that creates the user's sessions — so callers that
|
|
89
83
|
* know the node's profile must pass it explicitly (null = no profile). */
|
|
90
84
|
profileId?: string | null;
|
|
91
|
-
/** Carry an EXISTING node's pin verbatim through a rebuild that supplies
|
|
92
|
-
* no NEW `--model` override (a polymorph/lifecycle/kind change, or a
|
|
93
|
-
* fresh-root relaunch). When set (including `false`), this wins over the
|
|
94
|
-
* token-shape derivation below — the pin is decided exactly once, at the
|
|
95
|
-
* moment of an explicit user model change, from that change's RAW token;
|
|
96
|
-
* every other rebuild must preserve it rather than re-infer it from
|
|
97
|
-
* `opts.model`, which may be a portablized `model_override` whose shape
|
|
98
|
-
* no longer reflects the original raw pick (e.g. a concrete pin that
|
|
99
|
-
* happens to byte-equal a ladder tier cell). Leave undefined for genuine
|
|
100
|
-
* first-spawn and for an explicit new `--model` override on
|
|
101
|
-
* promote/config, where `opts.model`'s shape IS the raw token and
|
|
102
|
-
* legitimately re-decides the pin. */
|
|
103
|
-
modelProviderPinned?: boolean;
|
|
104
85
|
/** Preserved intent from an existing launch recipe when rebuilding it. */
|
|
105
|
-
modelIntent?:
|
|
106
|
-
family: string;
|
|
107
|
-
strength: ModelStrength;
|
|
108
|
-
};
|
|
86
|
+
modelIntent?: ModelIntent;
|
|
109
87
|
/** Exact-consult launch: pass the captured `provider/id:thinking` spec
|
|
110
88
|
* verbatim as `launch.model`, skipping `floorReviewModel`/`normalizeModel`
|
|
111
89
|
* entirely (avoids any tier-collision reinterpretation). `opts.model` MUST
|
|
@@ -160,8 +138,7 @@ export declare function buildPiArgv(meta: NodeMeta, opts?: {
|
|
|
160
138
|
* maps one of buildPiArgv's emitted flags back to its SDK option:
|
|
161
139
|
* `-e`→`extensionPaths`, `-n`→`editorName`, `--fork`→`forkFrom`,
|
|
162
140
|
* `--session`→`resumeSessionPath|resumeSessionId`, `--crtr-new-cycle`→
|
|
163
|
-
* `newCycle`, `--model`→`model`, `--crtr-model-
|
|
164
|
-
* `modelProviderPinned`, `--crtr-model-exact`→`modelExact`, `--tools`→`tools`,
|
|
141
|
+
* `newCycle`, `--model`→`model`, `--crtr-model-exact`→`modelExact`, `--tools`→`tools`,
|
|
165
142
|
* `--append-system-prompt`→`appendSystemPromptPath`, the trailing
|
|
166
143
|
* positional→`firstPrompt`. */
|
|
167
144
|
export interface BrokerSdkConfig {
|
|
@@ -186,8 +163,6 @@ export interface BrokerSdkConfig {
|
|
|
186
163
|
newCycle?: boolean;
|
|
187
164
|
/** Model spec, e.g. `anthropic/sonnet` (`--model`). */
|
|
188
165
|
model?: string;
|
|
189
|
-
/** A caller explicitly pinned `--model` to a provider; only a managed launch cooldown permits fallback. */
|
|
190
|
-
modelProviderPinned?: boolean;
|
|
191
166
|
/** Exact-consult launch (`--crtr-model-exact`): `model` must run verbatim —
|
|
192
167
|
* every launch-time/turn-time fallback is bypassed and unavailability must
|
|
193
168
|
* fail rather than substitute. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var y=Object.defineProperty;var c=(e,r)=>y(e,"name",{value:r,configurable:!0});import{envProfileId as _}from"../../shared/env.js";import{mkdirSync as w}from"node:fs";import{join as L}from"node:path";import{readMergedLaunchConfig as R}from"../config.js";import{fork as b}from"node:child_process";import{fileURLToPath as H}from"node:url";import{LAUNCH_SYSTEM_PROMPT as V}from"./launch-prompt.js";import{nodeEnv as M}from"./nodes.js";import{editorLabel as U}from"../canvas/index.js";import{CANVAS_EXTENSIONS as xe,CANVAS_STOPHOOK_PATH as Ee,CANVAS_INBOX_WATCHER_PATH as Pe,CANVAS_RECAP_PATH as Ie,CANVAS_GOAL_CAPTURE_PATH as Ce,CANVAS_PASSIVE_CONTEXT_PATH as Ne,CANVAS_CONTEXT_INTRO_PATH as ke,CANVAS_TOOL_GUIDE_PATH as Oe,CANVAS_DOC_SUBSTRATE_PATH as ve,CANVAS_STRUCTURED_OUTPUT_PATH as ye,CANVAS_BASH_VALVE_PATH as we}from"./canvas-extensions.js";import{nodeRunDir as D}from"../canvas/paths.js";import{writeFileBeneath as F}from"../spaces/open-beneath.js";import{projectOutputSchema as G}from"./structured-output.js";import{CANVAS_EXTENSIONS as K,mergeCanvasExtensions as T,assertMandatoryCanvasExtensions as X}from"./canvas-extensions.js";import{modelLadders as d,defaultProvider as x,STRENGTH_ALIASES as l,MODEL_PROVIDER_KEYS as S,MODEL_STRENGTHS as g,THINKING_SUFFIXES as B,stripThinkingSuffix as a}from"./model-selection.js";import{OPENAI_PROVIDER_ENV as Re,configuredLadderProviders as be,inferPortableModelSelection as He}from"./model-selection.js";function E(e,r=d()){return r[e]}c(E,"ladderFor");const p={light:0,medium:1,strong:2,ultra:3};function $(e,r,n){const t=a(e);for(const o of[!0,!1]){const i=o?g:[...g].sort((u,f)=>p[u]-p[f]);for(const u of n)for(const f of i){const s=r[u][f];if(!(o?s!==e:a(s)!==t))return{provider:u,strength:f}}}return null}c($,"findLadderCell");function P(e){const r=e.lastIndexOf("/"),n=r===-1?void 0:e.slice(0,r),t=r===-1?e:e.slice(r+1),o=l[t];return o!==void 0?o:n!==void 0&&n!=="anthropic"?null:t==="opus"?"strong":t==="sonnet"?"medium":t==="haiku"?"light":null}c(P,"modelTokenStrength");function I(e,r=d()){const n=P(e);return n!==null?n:$(A(e,r),r,S)?.strength??null}c(I,"resolvedModelStrength");function W(e){return e==="review"||e.startsWith("review/")||e.includes("/reviewers/")}c(W,"isReviewQualityKind");function j(e,r,n,t=d()){if(r===void 0)return n;if(!W(e)||n===void 0)return r;const o=I(r,t),i=I(n,t);return o===null||i===null?r:p[o]<p[i]?n:r}c(j,"floorReviewModel");function C(e){if(e.includes("/")){const r=e.lastIndexOf("/"),n=e.slice(0,r),t=e.slice(r+1);return n!==""&&(l[t]!==void 0||n==="anthropic"&&(t==="opus"||t==="sonnet"||t==="haiku"))}return l[e]!==void 0||e==="opus"||e==="sonnet"||e==="haiku"}c(C,"isPortableModelToken");function N(e,r=d()){const n=P(e);if(n!==null)return e.includes("/")?{family:e.slice(0,e.lastIndexOf("/")),strength:n}:e==="opus"||e==="sonnet"||e==="haiku"?{family:"anthropic",strength:n}:{family:x(r),strength:n}}c(N,"logicalModelIntent");function he(e,r=d()){return C(e)?N(e,r):void 0}c(he,"explicitModelIntent");function A(e,r=d()){if(e.includes("/")){const t=e.indexOf("/"),o=e.slice(0,t),i=e.slice(t+1),u=l[i];if(u!==void 0&&(o==="anthropic"||o==="openai"))return E(o,r)[u];if(o==="anthropic"){if(i==="opus")return r.anthropic.strong;if(i==="sonnet")return r.anthropic.medium;if(i==="haiku")return r.anthropic.light}return e}const n=l[e];return n!==void 0?E(x(r),r)[n]:e==="opus"?r.anthropic.strong:e==="sonnet"?r.anthropic.medium:e==="haiku"?r.anthropic.light:e}c(A,"normalizeModel");function k(e){const r=e.lastIndexOf(":");if(r<=0)return;const n=e.slice(r+1);return B.has(n)?n:void 0}c(k,"thinkingSuffixOf");function z(e=S){const r=e.length>0?e:S,n=d(),t=[];for(const o of g)for(const i of r)t.push(n[i][o]);return t}c(z,"interleavedLadderCycle");function pe(e,r=1,n){const t=z(n),o=A(e),i=a(o),u=k(o);let f=t.findIndex(s=>a(s)===i&&k(s)===u);return f===-1&&(f=t.findIndex(s=>a(s)===i)),f===-1?t[0]:t[(f+r+t.length)%t.length]}c(pe,"nextLadderModel");function O(e,r,n,t){const o=t.kinds[e],i=t.modelLadders,u=r==="orchestrator"?o?.orchestratorModel??o?.model:o?.model,f=n.modelExact===!0?n.model:j(e,n.model,u,i),s=n.modelExact===!0||n.modelOverride===!0&&n.model!==void 0&&!C(n.model),m=n.modelExact===!0?f:f!==void 0?A(f,i):void 0,h=s?void 0:n.modelIntent??(f!==void 0?N(f,i):void 0);return{launch:{model:m,modelIntent:h,modelExact:s?!0:void 0,tools:o?.tools??[],extensions:T([...K,...o?.extensions??[]]),systemPrompt:V,env:{...n.extraEnv??{},...h?{CRTR_MODEL_INTENT:`${h.family}/${h.strength}`}:{}}},lifecycle:n.lifecycle}}c(O,"buildLaunchSpecFromMerged");function me(e,r,n){return O(e,r,n,R(n.cwd??process.cwd(),n.profileId!==void 0?n.profileId:_()||null))}c(me,"buildLaunchSpec");async function Se(e,r,n){const t=n.cwd??process.cwd(),o=n.profileId!==void 0?n.profileId:_()||null,i=await Y(t,o);return O(e,r,n,i)}c(Se,"buildLaunchSpecAsync");const v=15e3;function Y(e,r){return new Promise((n,t)=>{const o=b(H(new URL("./launch-config-worker.js",import.meta.url)),[],{stdio:["ignore","ignore","ignore","ipc"],serialization:"advanced"});o.send({cwd:e,profileId:r});let i=!1;const u=c(s=>{i||(i=!0,clearTimeout(f),o.connected&&o.disconnect(),o.killed||o.kill("SIGKILL"),s())},"finish"),f=setTimeout(()=>u(()=>t(new Error(`timed out after ${v}ms reading launch config for ${e}`))),v);o.once("message",s=>{s.error!==void 0?u(()=>t(new Error(s.error))):s.config!==void 0?u(()=>n(s.config)):u(()=>t(new Error("launch config subprocess returned no result")))}),o.once("error",s=>u(()=>t(s))),o.once("exit",(s,m)=>{s!==0&&m!=="SIGKILL"&&u(()=>t(new Error(`launch config subprocess exited with code ${s}`)))})})}c(Y,"readMergedLaunchConfigAsync");function Q(e,r){try{const n=D(e);w(n,{recursive:!0});const t=L(n,"system-prompt.md");return F(n,t,r,{atomic:!0}),t}catch{return null}}c(Q,"writeSystemPromptFile");function ge(e,r={}){const n=e.launch,t=T(n?.extensions);X(t);const o=[];for(const i of t)o.push("-e",i);if(o.push("-n",U(e)),r.forkFrom!==void 0&&r.forkFrom!=="")o.push("--fork",r.forkFrom);else{const i=r.resumeSessionPath??r.resumeSessionId;i!==void 0&&o.push("--session",i),r.newCycle===!0&&o.push("--crtr-new-cycle")}if(n?.model!==void 0&&o.push("--model",n.model),n?.modelExact===!0&&o.push("--crtr-model-exact"),n?.tools!==void 0&&n.tools.length>0&&o.push("--tools",n.tools.join(",")),n?.systemPrompt!==void 0&&n.systemPrompt!==""){const i=Q(e.node_id,n.systemPrompt)??n.systemPrompt;o.push("--append-system-prompt",i)}return r.prompt!==void 0&&r.prompt!==""&&o.push(r.prompt),G(e.node_id),{argv:o,env:M(e)}}c(ge,"buildPiArgv");function Ae(e){for(const[t,o]of Object.entries(e.env))process.env[t]=o;const r={cwd:e.env.CRTR_NODE_CWD??process.cwd(),extensionPaths:[]},n=e.argv;for(let t=0;t<n.length;t++){const o=n[t];switch(o){case"-e":r.extensionPaths.push(n[++t]);break;case"-n":r.editorName=n[++t];break;case"--fork":r.forkFrom=n[++t];break;case"--session":{const i=n[++t];i.includes("/")||i.endsWith(".jsonl")?r.resumeSessionPath=i:r.resumeSessionId=i;break}case"--model":r.model=n[++t];break;case"--crtr-model-exact":r.modelExact=!0;break;case"--tools":r.tools=n[++t].split(",").filter(i=>i!=="");break;case"--append-system-prompt":r.appendSystemPromptPath=n[++t];break;case"--crtr-new-cycle":r.newCycle=!0;break;default:r.firstPrompt=o;break}}return r}c(Ae,"piInvocationToSdkConfig");export{we as CANVAS_BASH_VALVE_PATH,ke as CANVAS_CONTEXT_INTRO_PATH,ve as CANVAS_DOC_SUBSTRATE_PATH,xe as CANVAS_EXTENSIONS,Ce as CANVAS_GOAL_CAPTURE_PATH,Pe as CANVAS_INBOX_WATCHER_PATH,Ne as CANVAS_PASSIVE_CONTEXT_PATH,Ie as CANVAS_RECAP_PATH,Ee as CANVAS_STOPHOOK_PATH,ye as CANVAS_STRUCTURED_OUTPUT_PATH,Oe as CANVAS_TOOL_GUIDE_PATH,Re as OPENAI_PROVIDER_ENV,me as buildLaunchSpec,Se as buildLaunchSpecAsync,ge as buildPiArgv,be as configuredLadderProviders,he as explicitModelIntent,He as inferPortableModelSelection,z as interleavedLadderCycle,C as isPortableModelToken,N as logicalModelIntent,pe as nextLadderModel,A as normalizeModel,Ae as piInvocationToSdkConfig,Y as readMergedLaunchConfigAsync};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)[0]??"";let n=0,
|
|
1
|
+
var S=Object.defineProperty;var a=(t,e)=>S(t,"name",{value:e,configurable:!0});import{getNode as k,cancelCronsOnWake as A,transitionStatusIntent as N}from"../canvas/index.js";import{readExternalActionDelivery as _}from"../canvas/deliveries.js";import{composeNodeOutcomeDocument as b}from"./outcome-document.js";const f="*",J={finish:"finished",park:"parked",cancel:"stranded",crash:"crashed","refresh-launch":null,revive:null},c=["active","idle"],v={finish:{status:"done",intent:"done",from:c},park:{status:"done",intent:"parked",from:c},cancel:{status:"canceled",intent:null,from:f},crash:{status:"dead",from:c},yield:{intent:"refresh",from:c},release:{status:"idle",intent:"idle-release",from:[...c,"done"]},"refresh-launch":{status:"active",intent:"refresh",from:f},revive:{status:"active",intent:null,from:f}};function E(t,e){const r=t.split(`
|
|
2
|
+
`)[0]??"";let n=0,u="";for(const l of r){const i=Buffer.byteLength(l,"utf8");if(n+i>e)break;n+=i,u+=l}return u}a(E,"firstLineAtMost");function R(t){if(t===void 0)return null;const e=t.message===void 0?void 0:E(t.message,500),r={...t,...e===void 0?{}:{message:e}},n=JSON.stringify(r);return Buffer.byteLength(n,"utf8")<=4*1024?n:JSON.stringify({schema:"crtr.node-outcome-detail/v1",truncated:!0,...e===void 0?{}:{message:e}})}a(R,"detailJson");function $(t){const e=_(`node-outcome:${t}`);if(e===null||e.state!=="armed")return null;const r=e.adapter;if(r?.adapter!=="subprocess"||!Array.isArray(r.argv)||!r.argv.every(n=>typeof n=="string")||typeof r.cwd!="string")throw new Error(`outcome delivery ${e.deliveryId} has an invalid subprocess adapter`);return{name:e.destinationId,payload:r.payload??null}}a($,"armedOutcomeAction");function x(t,e){let r,n;return e==="finished"||e==="declined"?(r="done",n="done"):e==="parked"?(r="done",n="parked"):e==="closed"||e==="retired"||e==="stranded"||e==="deadline_exceeded"?(r="canceled",n=null):(r="dead",n=null),{...t,status:r,intent:n,terminal_reason:e}}a(x,"nodeAtOutcome");function B(t,e,r){const n=v[e],u=Object.prototype.hasOwnProperty.call(n,"status"),l=Object.prototype.hasOwnProperty.call(n,"intent"),i=r?.reason??J[e],d={};u&&(d.status=n.status),l&&(d.intent=n.intent??null),i!==void 0&&(d.terminal_reason=i);const m=e==="finish"||e==="park"||e==="cancel"||e==="crash",o=m?k(t):null,p=m&&o?.kind!=="human",h=i,g=m?new Date().toISOString():null,O=R(r?.outcome?.detail),w=p&&o?.run_id!=null&&i!=="parked"&&o.outcome_at!==null&&(c.includes(o.status)||o.outcome_reason==="parked");let y;if(p&&o!==null&&(o.outcome_at===null||w)){const s=$(t);s!==null&&(y=JSON.stringify(b({node:x(o,h),outcome:{kind:"failure",reason:h,at:g,revision:(o.outcome_revision??0)+1,detailJson:O},action:s})))}if(N(t,d,{fromStatuses:n.from===f?void 0:n.from,requireNoFinalReport:e==="cancel",...p?{outcome:{kind:"failure",reason:h,detailJson:O,at:g,...w?{supersede:!0}:{},...y===void 0?{}:{documentJson:y}}}:{}})===0){const s=k(t);if(s===null)throw new Error(`transition: unknown node ${t}`);if(e==="cancel"&&s.final_report!==null&&s.final_report!==void 0)return s;throw new Error(`illegal lifecycle transition: '${e}' from status='${s.status}' (node ${t})`)}return(e==="finish"||e==="park"||e==="cancel")&&A(t),k(t)}a(B,"transition");function I(t){return t.status==="done"&&t.intent==="parked"}a(I,"isParked");export{I as isParked,B as transition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=Object.defineProperty;var m=(r,o)=>e(r,"name",{value:o,configurable:!0});import{join as p}from"node:path";import{appSpace as i}from"../layout.js";function a(r,o){if(!o)throw new Error(`memory store for ${r} requires an app`);return p(i(o).memory,"nodes",r)}m(a,"memoryDir");export{a as memoryDir};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var i=Object.defineProperty;var r=(o,e)=>i(o,"name",{value:e,configurable:!0});import{join as t}from"node:path";import{ModelRegistry as n,ModelRuntime as m}from"@earendil-works/pi-coding-agent";import{PoolCredentialStore as s}from"../pool-credential-store.js";import{piAgentDir as a}from"./package-health.js";import{secretsDir as l}from"../layout.js";async function j(){const o=a(),e=await m.create({credentials:new s(t(l(),"auth.json")),modelsPath:t(o,"models.json")});return new n(e)}r(j,"openModelRegistry");export{j as openModelRegistry};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type NodeMeta } from '../canvas/index.js';
|
|
2
|
+
import type { ModelIntent } from '../../types.js';
|
|
2
3
|
/** True when the node's broker engine is reachable: its recorded pid is alive
|
|
3
4
|
* AND its view.sock exists. Both are required — a dead pid with a stale socket,
|
|
4
5
|
* or a live pid mid-boot before it binds the socket, is NOT a live broker. */
|
|
@@ -7,22 +8,19 @@ export declare function isBrokerLive(node: Pick<NodeMeta, 'node_id' | 'pi_pid'>)
|
|
|
7
8
|
* sends `set_model`, and resolves with the broker-resolved durable spec from its
|
|
8
9
|
* `model_changed` frame. Rejects with the broker's message on an `error` frame (e.g.
|
|
9
10
|
* `no model matching '<spec>' in the registry`), on connect failure, or timeout.
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* (
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
* deliberately chosen bare tier that happens to byte-equal a ladder cell). */
|
|
27
|
-
export declare function updateModelRecipe(meta: NodeMeta, spec: string, pinnedOverride: boolean | undefined, userSelected: boolean): NodeMeta;
|
|
28
|
-
export declare function persistDormantModel(nodeId: string, spec: string, pinned: boolean): void;
|
|
11
|
+
* `intent` is the routing contract the CALLER derived from the RAW token
|
|
12
|
+
* (`explicitModelIntent`); `spec` is already normalized, so its shape no longer
|
|
13
|
+
* says whether the pick was portable. Undefined means an exact model. */
|
|
14
|
+
export declare function setModelLive(nodeId: string, spec: string, intent: ModelIntent | undefined): Promise<string>;
|
|
15
|
+
/** Write a model choice into a node's durable recipe: `model_override` (so
|
|
16
|
+
* polymorphs preserve it via buildLaunchSpec) and `launch.model`. A
|
|
17
|
+
* `userSelected` change also replaces the routing contract the next revive
|
|
18
|
+
* replays: with an `intent`, `launch.modelIntent` + `CRTR_MODEL_INTENT` (the
|
|
19
|
+
* route may rotate to another family at that strength); without one,
|
|
20
|
+
* `launch.modelExact` (the model runs verbatim). `spec` must already be a
|
|
21
|
+
* concrete `provider/id` (normalizeModel maps tiers/aliases; a bare substring
|
|
22
|
+
* cannot resolve offline). */
|
|
23
|
+
export declare function updateModelRecipe(meta: NodeMeta, spec: string, intent: ModelIntent | undefined, userSelected: boolean): NodeMeta;
|
|
24
|
+
/** Persist a user's model choice into a DORMANT node's durable recipe — the same
|
|
25
|
+
* write the broker commits on a live switch. */
|
|
26
|
+
export declare function persistDormantModel(nodeId: string, spec: string, intent: ModelIntent | undefined): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u=Object.defineProperty;var n=(e,o)=>u(e,"name",{value:o,configurable:!0});import{existsSync as c}from"node:fs";import{getNode as s,updateNode as f}from"../canvas/index.js";import{viewSocketPath as p}from"../canvas/paths.js";import{isPidAlive as _}from"../canvas/pid.js";import{oneShotControllerRequest as a}from"./broker-request.js";function y(e){return _(e.pi_pid)&&c(p(e.node_id))}n(y,"isBrokerLive");function L(e,o,t){let d;return a({nodeId:e,what:"the model switch",ackFor:"set_model",frame:n(()=>({type:"set_model",model:o,...t!==void 0?{intent:t}:{}}),"frame"),observe:n(r=>{r.type==="model_changed"&&r.spec!==null&&(d=r.spec)},"observe"),result:n(()=>d??o,"result")})}n(L,"setModelLive");function v(e,o,t,d){const r=e.launch===void 0?void 0:d?(()=>{const{modelIntent:h,modelExact:E,env:m,...l}=e.launch,{CRTR_MODEL_INTENT:x,...i}=m;return t!==void 0?{...l,model:o,modelIntent:t,env:{...i,CRTR_MODEL_INTENT:`${t.family}/${t.strength}`}}:{...l,model:o,modelExact:!0,env:i}})():{...e.launch,model:o};return f(e.node_id,{model_override:o,...r!==void 0?{launch:r}:{}})}n(v,"updateModelRecipe");function S(e,o,t){const d=s(e);d!==null&&v(d,o,t,!0)}n(S,"persistDormantModel");export{y as isBrokerLive,S as persistDormantModel,L as setModelLive,v as updateModelRecipe};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}i(
|
|
1
|
+
var C=Object.defineProperty;var a=(e,t)=>C(e,"name",{value:t,configurable:!0});import{existsSync as N,readFileSync as R}from"node:fs";import{isBeneathRefusal as F,readFileBeneath as $,readTextBeneathIfExists as j}from"../spaces/open-beneath.js";import{join as g}from"node:path";import{InputError as f}from"../io.js";import{conversationIdFromPath as h,conversationStore as y,ConversationNotFoundError as A}from"../conversation-store/index.js";import{fullName as k,getNode as p}from"../canvas/index.js";import{nodeRunDir as w,nodeRunJobDir as S,sessionPtrPath as L}from"../canvas/paths.js";import{hydratePersistedAdvertisedCommandMessages as x}from"./advertised-command-invocation.js";import{SessionManager as T}from"./broker-sdk.js";import{openModelRegistry as P}from"./model-registry.js";import{BUILTIN_SLASH_COMMANDS as B}from"./pi-vendored.js";import{cycleAwareMessages as E}from"./session-cycles.js";import{projectTranscript as J}from"./session-visibility.js";import{normalizeToolGroupSummaryRecord as O}from"../../shared/tool-groups.js";async function U(e){if(e!==null)try{return(await P()).find(e.provider,e.modelId)}catch{return}}a(U,"resolveRecordedModel");function b(e,t){const o=a(i=>{const n=i?h(i):null;if(n===null)return null;try{return y().header(n).path}catch(l){if(l instanceof A)return null;throw l}},"resolvePath"),s=o(t);if(s!==null)return s;const r=L(e);return N(r)?o(R(r,"utf8").trim()):null}a(b,"resolveSessionFile");function V(e){const t=p(e);if(t===null)throw new f({error:"not_found",message:`no node: ${e}`,field:"id",next:"List nodes with `crtr node inspect list`."});return b(e,t.pi_session_file)}a(V,"readableSessionFile");function W(e,t){return{sessionFile:t,sessionId:e,userMessages:0,assistantMessages:0,toolCalls:0,toolResults:0,totalMessages:0,tokens:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0},cost:0}}a(W,"emptyStats");function D(e,t,o){const s=W(t,o);s.totalMessages=e.length;for(const r of e)if(r.role==="user")s.userMessages++;else if(r.role==="assistant"){s.assistantMessages++;const i=Array.isArray(r.content)?r.content:[];s.toolCalls+=i.filter(l=>l!==null&&typeof l=="object"&&l.type==="toolCall").length;const n=r.usage;n!==void 0&&(s.tokens.input+=n.input??0,s.tokens.output+=n.output??0,s.tokens.cacheRead+=n.cacheRead??0,s.tokens.cacheWrite+=n.cacheWrite??0,s.cost+=n.cost?.total??0)}else r.role==="toolResult"&&s.toolResults++;return s.tokens.total=s.tokens.input+s.tokens.output+s.tokens.cacheRead+s.tokens.cacheWrite,s}a(D,"statsFromMessages");function me(e){const t=p(e);if(t===null)throw new f({error:"not_found",message:`no node: ${e}`,field:"id",next:"List nodes with `crtr node inspect list`."});const o=b(e,t.pi_session_file);if(o===null)throw new f({error:"no_session",message:`node has no readable session file: ${e}`,field:"id",next:"Choose a node with captured conversation history."});return{nodeId:e,sessionFile:o,sessionJsonl:(()=>{const{header:s,entries:r}=y().read(h(o));return[s,...r].map(i=>`${JSON.stringify(i)}
|
|
2
|
+
`).join("")})(),systemPrompt:v(e,g(S(e),"system-prompt.md"))??v(e,g(w(e),"system-prompt.md"))}}a(me,"readNodeSession");function v(e,t){try{return $(w(e),t).toString("utf8")}catch(o){if(F(o))throw o;return null}}a(v,"readRunFileIfPresent");function G(e){try{const t=j(w(e),g(S(e),"tool-summaries.json"));return O(t===null?null:JSON.parse(t))}catch{return{}}}a(G,"readToolGroupSummaries");async function M(e){const t=p(e);if(t===null)throw new f({error:"not_found",message:`no node: ${e}`,field:"id",next:"List nodes with `crtr node inspect list`."});const o=b(e,t.pi_session_file);if(o===null)throw new f({error:"no_session",message:`node has no readable session file: ${e}`,field:"id",next:"Choose a node with captured conversation history."});const{header:s,entries:r}=y().read(h(o)),i=T.inMemory(s.cwd,void 0,[s,...r]),n=i.buildSessionContext();x(n.messages);const l=E(i);l!==void 0&&x(l.map(({message:c})=>c));const u=l===void 0?void 0:J(l,{boundaryReviewId:t.review_binding?.review_id,sessionEntries:i.getEntries()}),m=u?.map(({message:c})=>c)??n.messages;return{sessionFile:o,messages:m,identified:u,model:n.model,thinkingLevel:n.thinkingLevel,sessionId:i.getSessionId(),sessionName:i.getSessionName()}}a(M,"reconstructTranscript");function d(){throw new f({error:"invalid_cursor",message:"cursor must be a base64url-encoded messages cursor.",field:"cursor",next:"Omit cursor to start from the newest messages."})}a(d,"invalidCursor");function z(e,t){/^[A-Za-z0-9_-]+$/u.test(e)||d();let o;try{const r=Buffer.from(e,"base64url").toString("utf8");Buffer.from(r,"utf8").toString("base64url")!==e&&d(),o=JSON.parse(r)}catch{d()}(typeof o!="object"||o===null||o.v!==1||!Number.isSafeInteger(o.before))&&d();const s=o.before;return(s<0||s>t)&&d(),s}a(z,"decodeMessagesCursor");function q(e){return Buffer.from(JSON.stringify({v:1,before:e}),"utf8").toString("base64url")}a(q,"encodeMessagesCursor");async function H(e){const t=await M(e),o={messages:t.messages,...t.identified===void 0?{}:{messageIds:t.identified.map(({id:s})=>s)},messageVisibility:t.identified?.map(({visibility:s})=>s)??t.messages.map(()=>"visible"),turnVisibility:"visible",stats:D(t.messages,t.sessionId,t.sessionFile),state:{model:await U(t.model),thinkingLevel:t.thinkingLevel,isStreaming:!1,isCompacting:!1,steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",sessionFile:t.sessionFile,sessionId:t.sessionId,sessionName:t.sessionName,autoCompactionEnabled:!0,messageCount:t.messages.length,pendingMessageCount:0},display:{statuses:{},widgets:{},title:void 0},queued:{steering:[],followUp:[]},toolGroupSummaries:G(e)};return{nodeId:e,snapshot:o,commands:B.map(s=>({...s,source:"builtin"}))}}a(H,"readNodeSnapshot");async function de(e,{cursor:t,limit:o=200}){if(!Number.isSafeInteger(o)||o<1||o>500)throw new f({error:"invalid_limit",message:"limit must be an integer from 1 through 500.",field:"limit",next:"Use a limit from 1 through 500."});if(V(e)===null)return{messages:[],messageIds:[],messageVisibility:[],nextCursor:null};const{messages:s,identified:r}=await M(e),i=t===void 0?s.length:z(t,s.length);let n=Math.max(0,i-o);for(;n>0&&typeof s[n]=="object"&&s[n]!==null&&s[n].role==="toolResult";)n--;const l=r?.slice(n,i);return{messages:l?.map(({message:u})=>u)??s.slice(n,i),...l===void 0?{}:{messageIds:l.map(({id:u})=>u)},messageVisibility:l?.map(({visibility:u})=>u)??s.slice(n,i).map(()=>"visible"),nextCursor:n===0?null:q(n)}}a(de,"readNodeMessagesPage");function Y(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null).filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(""):""}a(Y,"textFromContent");function Z(e){switch(e.role){case"user":return"You";case"assistant":return"Agent";case"toolResult":return"Tool result";default:return typeof e.role=="string"?e.role:"Message"}}a(Z,"roleLabel");function K(e){return Array.isArray(e.content)?e.content.filter(t=>typeof t=="object"&&t!==null&&t.type==="toolCall").map(t=>`Tool: ${typeof t.name=="string"?t.name:"call"}`):[]}a(K,"toolSummaries");async function pe(e){const t=p(e);if(t===null)throw new f({error:"not_found",message:`no node: ${e}`,field:"node-id",next:"List nodes with `crtr node inspect list`."});const{snapshot:o}=await H(e),r=[`# ${k(t)}`,"",`Saved transcript \xB7 ${t.status} \xB7 ${t.lifecycle}`,""];for(const i of o.messages){if(typeof i!="object"||i===null)continue;const n=i;if(n.role==="custom"&&n.display===!1)continue;const l=Y(n.content),u=typeof n.text=="string"?n.text:"",m=l.trim()?l:u.trim()?u:"",c=K(n);if(!(!m&&c.length===0)){r.push(`## ${Z(n)}`,""),m&&r.push(m,"");for(const _ of c)r.push(`- ${_}`);c.length&&r.push("")}}return r.length===5&&r.push("_No saved messages._",""),r.join(`
|
|
3
|
+
`)}a(pe,"transcriptMarkdown");export{de as readNodeMessagesPage,me as readNodeSession,H as readNodeSnapshot,pe as transcriptMarkdown};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
1
2
|
import { type NodeMeta, type Mode, type Lifecycle, type LaunchSpec, type ManagedWorktree, type OutcomeDeliveryBinding, type ReviewBinding } from '../canvas/index.js';
|
|
2
3
|
/** Explicitly set the resolved install id. crtrd calls this once at boot,
|
|
3
4
|
* immediately after `resolveInstallId()` — see crtrd.ts — so a provisioning
|
|
@@ -97,6 +98,10 @@ export interface SpawnNodeOpts {
|
|
|
97
98
|
profile_id?: string | null;
|
|
98
99
|
/** Per-run scope allow-list. Omit to inherit the creating node's list. */
|
|
99
100
|
scopes?: string[];
|
|
101
|
+
/** Run identity set on an app root; managed children inherit it. */
|
|
102
|
+
run?: Pick<NodeMeta, 'grantee' | 'sub' | 'grant_id' | 'client_id' | 'metadata_json' | 'run_id' | 'event_cursor' | 'usage_json'>;
|
|
103
|
+
/** Additional rows committed atomically with the newborn node. */
|
|
104
|
+
withinCreate?: (db: DatabaseSync, row: NodeMeta) => void;
|
|
100
105
|
/** Managed worktree already created for this node, if any. */
|
|
101
106
|
managedWorktree?: ManagedWorktree;
|
|
102
107
|
/** Absolute wall-clock deadline persisted with the row at birth. */
|
|
@@ -113,6 +118,8 @@ export interface SpawnNodeOpts {
|
|
|
113
118
|
* and duplicate-rejected (`NodeIdConflictError`) here. */
|
|
114
119
|
nodeId?: string;
|
|
115
120
|
}
|
|
121
|
+
/** The node that owns the conversation a fork copies, or null when no node does. */
|
|
122
|
+
export declare function forkSourceNode(sourceFile: string): NodeMeta | null;
|
|
116
123
|
/** Create a node on the canvas and wire its spawn-time edges.
|
|
117
124
|
*
|
|
118
125
|
* For a child (parent given): the parent auto-subscribes ACTIVE to the child
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $=Object.defineProperty;var o=(e,r)=>$(e,"name",{value:r,configurable:!0});import{envHomeOverride as A,envRuntimeHomeOverride as M,scopeAllowed as m}from"../../shared/env.js";import{validateScopes as B}from"../scopes.js";import{activeGrant as N,terminalGrant as w}from"../grants/mirror.js";import{appendRunEvent as F}from"../runs/events.js";import{readConfig as h}from"../config.js";import{InputError as v}from"../io.js";import{randomBytes as P}from"node:crypto";import{existsSync as H,mkdirSync as U}from"node:fs";import{createNode as L,assertRunNotDeleting as j,conversationOwner as q,getNode as s,getRow as G,subscribe as J,recordSpawn as K,subscribersOf as W}from"../canvas/index.js";import{memoryDir as z}from"./memory.js";import{ensureAppSpace as X}from"../spaces/space.js";import{LAUNCHER_SOCKET as Y}from"../../launcher/spec.js";import{resolveInstallId as Q}from"../canvas/install-id.js";import{canvasDbPath as V,contextDir as Z}from"../canvas/paths.js";import{conversationIdFromPath as ee}from"../conversation-store/index.js";import{usage as T}from"../errors.js";import{assertProfileAvailableForBirth as ne}from"../profiles/deletion-reservation.js";import{loadExactProfileManifest as re}from"../profiles/manifest.js";import{admitNodeCreate as ie}from"../command-hooks/lifecycle-create.js";import{fanDoctrineWake as te}from"./close.js";import{BIRTH_ANNOUNCEMENT_MARKER as oe,birthAnnouncementBody as le}from"../../shared/birth-announcement.js";let E;const D=new Map;function Be(e){E=e}o(Be,"setInstallId");function de(){if(E!==void 0)return E;const e=V(),r=D.get(e);if(r!==void 0)return r;const i=Q();return D.set(e,i),i}o(de,"installId");function ae(){return`${Date.now().toString(36)}-${P(4).toString("hex")}`}o(ae,"newJobId");function se(){return`${de()}-${ae()}`}o(se,"newNodeId");const C=128,ce=/^[a-z0-9-]+$/;class S extends Error{static{o(this,"NodeIdConflictError")}nodeId;constructor(r){super(`node already exists: ${r}`),this.nodeId=r,this.name="NodeIdConflictError"}}function I(e){if(e.length===0||e.length>C)throw T(`invalid --node-id '${e}': must be 1-${C} characters`,{next:`Pass an id-safe string (lowercase letters, digits, hyphens) of at most ${C} characters.`});if(!ce.test(e))throw T(`invalid --node-id '${e}': must contain only lowercase letters, digits, and hyphens (e.g. 'remote42', 'my-node-1')`,{next:"Use only lowercase letters, digits, and hyphens."})}o(I,"validateNodeIdFormat");function Fe(e){if(I(e),s(e)!==null)throw new S(e)}o(Fe,"preflightNodeId");function ue(e){if(I(e),s(e)!==null)throw new S(e);return e}o(ue,"validatedExplicitNodeId");function Pe(e){let r=e;const i=new Set;for(;;){if(i.has(r))return r;i.add(r);const t=G(r);if(t===null||t.parent==null)return r;r=t.parent}}o(Pe,"rootOfSpine");function He(){const e=process.env;return{nodeId:e.CRTR_NODE_ID??null,kind:e.CRTR_KIND??null,mode:e.CRTR_MODE??null}}o(He,"currentNodeContext");function Ue(e){const r={CRTR_NODE_ID:e.node_id,CRTR_KIND:e.kind,CRTR_MODE:e.mode,CRTR_LIFECYCLE:e.lifecycle,CRTR_NODE_CWD:e.cwd,CRTR_CONTEXT_DIR:Z(e.node_id,e.grantee),CRTR_CYCLES:(e.cycles??0).toString(),CRTR_PROFILE_ID:e.profile_id??"",PI_CLAUDE_OAUTH_REINJECT_SCOPE:"never"};e.parent&&(r.CRTR_PARENT_NODE_ID=e.parent),e.run_id&&(r.CRTR_RUN_ID=e.run_id),e.scopes!==null&&e.scopes!==void 0&&(r.CRTR_SCOPES=e.scopes.join(",")),r.CRTR_GRANTEE=e.grantee??"app:terminal";const i=A();i!==void 0&&i!==""&&(r.CRTR_HOME=i);const t=M();t!==void 0&&t!==""&&(r.CRTR_RUNTIME_HOME=t);const a=process.env.CRTR_SUBTREE;return a!==void 0&&a!==""&&(r.CRTR_SUBTREE=a),{...r,...e.launch?.env??{}}}o(Ue,"nodeEnv");function fe(e){const r=ee(e),i=r===null?null:q(r);return i===null?null:s(i)}o(fe,"forkSourceNode");async function Le(e){const r=e.nodeId!==void 0?(I(e.nodeId),e.nodeId):se(),i=e.parent??null,t=i===null,a=e.spawnedBy??i,c=e.creator??null,y=e.mode??"base",R=e.lifecycle??(t?"resident":"terminal"),_=e.run===void 0?w():null;if(e.run===void 0&&h("user").runtime?.issuer&&_===null)throw new Error("terminal grant is not active");const n={node_id:r,name:e.name??e.kind,description:e.description,cycles:0,created:new Date().toISOString(),cwd:e.cwd,host_kind:"broker",profile_id:e.profile_id??null,kind:e.kind,mode:y,lifecycle:R,persona_ack:{kind:e.kind,mode:y,lifecycle:R},status:"active",parent:i,spawned_by:a,creator:c,fork_from:e.forkFrom,fork_source_file:e.forkSourceFile,review_binding:e.reviewBinding,model_override:e.modelOverride??null,scopes:e.scopes??null,grantee:e.run?.grantee??"app:terminal",sub:e.run?.sub??_?.sub??null,grant_id:e.run?.grant_id??_?.id??null,client_id:e.run?.client_id??null,metadata_json:t?e.run?.metadata_json??null:null,run_id:t?r:e.run?.run_id??null,event_cursor:t?e.run?.event_cursor??1:null,usage_json:t?e.run?.usage_json??JSON.stringify({input_tokens:0,output_tokens:0,cache_read_tokens:0,cache_write_tokens:0,cost_usd:0}):null,passive_default:e.passiveDefault??!1,...e.managedWorktree!==void 0?{managed_worktree:e.managedWorktree}:{},intent:null,deadline_at:e.deadlineAt??null,pi_session_id:null,pi_session_file:null,launch:e.launch},p=e.scopes===void 0?void 0:B(e.scopes),g=i===null?null:s(i);if(i!==null&&g===null)throw new Error(`cannot spawn under unknown parent node: ${i}`);if(g?.run_id&&s(g.run_id)?.deleting_at)throw new Error("run is deleting");const k=c===null?null:s(c);if(c!==null&&k===null)throw new Error(`cannot spawn from unknown creator node: ${c}`);const O=e.forkSourceFile==null?null:fe(e.forkSourceFile),b=e.replaces==null?null:s(e.replaces),l=g??O??b??k??(a===null?null:s(a));if(l!==null){const u=l.grantee==="app:terminal"?w():l.grant_id?N(l.grant_id):null,d=l.grantee==="app:terminal"&&!h("user").runtime?.issuer;if(p!==void 0&&!p.every(f=>m(l.scopes,f)&&(u?m(u.resolved,f):d)))throw new v({error:"unknown_scope",message:"child scopes must be covered by the creating node and its current grant",received:p,field:"scopes",next:"Request only scopes the creating node currently holds."});if(n.scopes=p??l.scopes??null,n.scopes?.includes("crtr:act")&&!m(n.scopes,"crtr:llm"))throw new v({error:"invalid_scope",message:"crtr:act requires crtr:llm",received:n.scopes,field:"scopes",next:"Include crtr:llm or omit crtr:act."});n.grantee=l.grantee==="user:local"?"app:terminal":l.grantee,n.sub=l.sub??_?.sub??null,n.grant_id=l.grant_id??_?.id??null,n.client_id=l.client_id,n.run_id=t?r:l.run_id??null}if(n.profile_id){const u=re(n.profile_id).manifest.grantee??"app:terminal";if(u!==n.grantee){const d=`crtr:memory:rw:${u}:profile:${n.profile_id}`,f=n.grantee==="app:terminal"?w():n.grant_id?N(n.grant_id):null;if(!(n.grantee==="app:terminal"&&!h("user").runtime?.issuer)&&(!f||f.grantee!==n.grantee||!m(f.resolved,d))||!m(n.scopes,d))throw new v({error:"scope_missing",message:`missing scope ${d}`,received:n.profile_id,field:"profile",next:"Select a profile covered by this run and its current grant."})}}if(ne(n.profile_id??null),!n.grantee)throw new Error("node creation requires an app");const x=await ie({kind:n.kind,mode:n.mode,cwd:n.cwd,profile:n.profile_id??null,root:t,parentId:i,requestingNodeId:c,lifecycle:R,replaces:e.replaces??null},n.grantee);try{e.nodeId!==void 0&&ue(e.nodeId),await e.beforeCreate?.(),(process.platform!=="linux"||H(Y))&&await X(n.grantee??"app:terminal"),L(n,{outcomeDelivery:e.outcomeDelivery,withinCreate:o((u,d)=>{d.run_id&&d.run_id!==d.node_id&&j(u,d.run_id),t&&e.run===void 0&&F(u,r,r,"run.started",{scopes:d.scopes,payer:"user",usage:JSON.parse(d.usage_json)}),e.withinCreate?.(u,d)},"withinCreate")})}finally{x()}if(n.kind!=="human"&&U(z(n.node_id,n.grantee),{recursive:!0}),i!==null&&e.subscribe!==!1&&J(i,n.node_id,!0),i!==null&&c!==i)try{te(n.node_id,W(n.node_id),`Child created \u2014 ${n.name} (${n.node_id}, ${n.kind})`,{birth_announcement:oe,body:le({name:n.name,nodeId:n.node_id,kind:n.kind,creator:c===null?"an external process":s(c).name})},"deferred")}catch{}return a!=null&&s(a)!==null&&K(n.node_id,a),n}o(Le,"spawnNode");export{S as NodeIdConflictError,He as currentNodeContext,fe as forkSourceNode,ae as newJobId,se as newNodeId,Ue as nodeEnv,Fe as preflightNodeId,Pe as rootOfSpine,Be as setInstallId,Le as spawnNode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var s=(t,e)=>f(t,"name",{value:e,configurable:!0});import{
|
|
1
|
+
var f=Object.defineProperty;var s=(t,e)=>f(t,"name",{value:e,configurable:!0});import{contextDir as m,reportsDir as p}from"../canvas/node-agent-paths.js";import{readOutputResult as y}from"./structured-output.js";const _=256*1024;function R(t,e){try{return y(t,e)}catch{return}}s(R,"structuredResult");function h(t){if(t===null)return null;try{return JSON.parse(t)}catch{return null}}s(h,"parseDetail");function c(t){if(Buffer.byteLength(t,"utf8")<=1024)return t;const n="\u2026";let l=Buffer.byteLength(n,"utf8"),r="";for(const d of t){const i=Buffer.byteLength(d,"utf8");if(l+i>1024)break;l+=i,r+=d}return`${r}${n}`}s(c,"truncateDescription");function $(t){const{node:e,outcome:n,action:l}=t,r=h(n.detailJson),d=t.finalReport??e.final_report??"",i=c(e.name),o=e.description===void 0?void 0:c(e.description),a=n.kind==="result"?t.structuredResult===void 0?R(e.node_id,e.grantee):t.structuredResult:void 0,u={schema:"crtr.node-outcome/v1",outcomeId:`${e.node_id}:${n.revision}`,nodeId:e.node_id,revision:n.revision,kind:n.kind,reason:n.reason,settledAt:n.at,node:{name:i,...o===void 0?{}:{description:o},kind:e.kind,mode:e.mode,lifecycle:e.lifecycle,status:e.status,terminalReason:e.terminal_reason??null,cwd:e.cwd,createdAt:e.created,parent:e.parent??null,spawnedBy:e.spawned_by??null},...n.kind==="result"?{result:{finalReport:{basename:d,path:`${p(e.node_id)}/${d}`},...a===void 0?{}:{structuredResult:a}}}:{failure:{message:r?.message??null,faultKind:r?.fault_kind??null,errorClass:r?.error_class??null,respawnFailures:r?.respawn_failures??null,deadline:r?.deadline===void 0?null:{deadlineAt:r.deadline.deadline_at,elapsedMs:r.deadline.elapsed_ms},declined:r?.declined??null}},action:l,delivery:{attempt:0}};return Buffer.byteLength(JSON.stringify(u),"utf8")>_&&u.result?.structuredResult!==void 0&&(delete u.result.structuredResult,u.result.structuredResultOmitted=!0,u.result.structuredResultPath=`${m(e.node_id,e.grantee)}/result.json`),u}s($,"composeNodeOutcomeDocument");export{$ as composeNodeOutcomeDocument};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var u=Object.defineProperty;var t=(r,e)=>u(r,"name",{value:e,configurable:!0});import{existsSync as f,readFileSync as g}from"node:fs";import{homedir as a}from"node:os";import{join as
|
|
1
|
+
var u=Object.defineProperty;var t=(r,e)=>u(r,"name",{value:e,configurable:!0});import{existsSync as f,readFileSync as g}from"node:fs";import{homedir as a}from"node:os";import{appSpace as m}from"../layout.js";import{join as c,resolve as d}from"node:path";import{isRendererReady as h}from"../termrender/termrender.js";import{expandTilde as l}from"../fs-utils.js";function j(){return h()?null:"crtr: the pinned termrender renderer is not provisioned \u2014 pages, reviews, and inline diagrams render as plaintext.\n Fix: run `crtr sys setup` (requires `uv`: curl -LsSf https://astral.sh/uv/install.sh | sh)."}t(j,"rendererWarning");function w(r=a()){const e=process.env.PI_CODING_AGENT_DIR;return e!==void 0&&e!==""?l(e,r):c(r===a()?m("terminal").home:r,".pi","agent")}t(w,"piAgentDir");function y(r){return r.startsWith("npm:")?!1:r.startsWith(".")||r.startsWith("/")||r.startsWith("~")}t(y,"isLocalPathSource");function v(r,e=a()){let n;try{n=g(c(r,"settings.json"),"utf8")}catch{return[]}let s;try{s=JSON.parse(n).packages}catch{return[]}if(!Array.isArray(s))return[];const i=[];for(const o of s){if(typeof o!="string"||!y(o))continue;const p=d(r,l(o,e));f(p)||i.push({source:o,resolved:p})}return i}t(v,"findMissingPackagePaths");function F(r,e=a()){const n=v(r,e);if(n.length===0)return null;const s=n.map(i=>` \u2022 ${i.source}
|
|
2
2
|
\u2192 ${i.resolved} (missing)`);return`crtr: ${n.length} configured pi package path${n.length===1?"":"s"} no longer exist${n.length===1?"s":""} \u2014 pi silently skips these, so their slash commands (e.g. ~/.claude commands & marketplace plugins) will not load.
|
|
3
3
|
`+s.join(`
|
|
4
|
-
`)+"\n Fix: re-run `crtr sys setup` (re-resolves package paths to this repo's current location)."}t(
|
|
4
|
+
`)+"\n Fix: re-run `crtr sys setup` (re-resolves package paths to this repo's current location)."}t(F,"missingPackageWarning");export{v as findMissingPackagePaths,F as missingPackageWarning,w as piAgentDir,j as rendererWarning};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}a(
|
|
1
|
+
var c=Object.defineProperty;var a=(o,e)=>c(o,"name",{value:e,configurable:!0});import{getNode as s,updateNode as l}from"../canvas/index.js";import{readRoadmap as d,roadmapPath as u}from"./roadmap.js";import{orchestratorContextNote as m}from"./bearings.js";function f(o,e,r){const t=d(o)??"(no roadmap yet)",n=u(o),i=[`You are now a ${e.toUpperCase()} ORCHESTRATOR. Your scarce resource is your own context window.`,"Your job is to manage context and delegate \u2014 not to do the goal yourself."];return i.push("",`Your roadmap scaffold (\`${n}\`) \u2014 author it now: state the goal, exit criteria, and the phase skeleton, using your orchestration protocol. Current contents:`,"",t,"",m(o,r),"",'Your three long-term memory scopes (user-global, project, node-local) already surface in your bearings at boot. What promotion changes is USE, not access: you now persist across refresh cycles, so node-local carries what THIS goal needs between your refreshes, and durable facts you commit to user-global or project outlive this node. Use `crtr memory write` to save a document; `crtr memory list` to browse; `crtr memory find` to search (see "Your long-term memory" above for the full substrate flow).',"","Then delegate each phase with `crtr node new --kind <kind>`. When your context fills, run `crtr node yield` to refresh against this roadmap."),i.join(`
|
|
2
|
+
`)}a(f,"orchestrationGuidance");function p(){return"You are HANDS-ON again \u2014 base mode. Do the work yourself in THIS window and finish it here; stop delegating by default. You no longer drive a roadmap, so `crtr node yield` is not your exit. Spawn a child only for a cleanly separable unit, never as your first move."}a(p,"baseModeGuidance");function h(o,e,r){if(e.mode===r.mode)return"";if(r.mode==="base")return p();const t=s(o);return f(o,t?.kind??"general",t?.grantee)}a(h,"transitionGuidance");function b(o){const e=s(o);if(e===null)return null;const r={kind:e.kind,mode:e.mode,lifecycle:e.lifecycle},t=e.persona_ack,n=t===void 0?r:{kind:t.kind??e.kind,mode:t.mode,lifecycle:t.lifecycle};return n.kind===r.kind&&n.mode===r.mode&&n.lifecycle===r.lifecycle?null:{from:n,to:r,guidance:h(o,n,r)}}a(b,"personaDrift");function x(o,e){l(o,{persona_ack:e})}a(x,"commitPersonaAck");export{x as commitPersonaAck,b as personaDrift,h as transitionGuidance};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var i=Object.defineProperty;var
|
|
1
|
+
var i=Object.defineProperty;var e=(s,n)=>i(s,"name",{value:n,configurable:!0});import{join as o}from"node:path";import{piAgentDir as t}from"./package-health.js";function c(){return o(t(),"sessions")}e(c,"piSessionsRoot");const m=[{name:"settings",description:"Open settings menu"},{name:"model",description:"Select model (opens selector UI)"},{name:"scoped-models",description:"Enable/disable models for Ctrl+P cycling"},{name:"export",description:"Export session (HTML default, or specify path: .html/.jsonl)"},{name:"import",description:"Import and resume a session from a JSONL file"},{name:"share",description:"Share session as a secret GitHub gist"},{name:"copy",description:"Copy last agent message to clipboard"},{name:"name",description:"Set session display name"},{name:"session",description:"Show session info and stats"},{name:"changelog",description:"Show changelog entries"},{name:"hotkeys",description:"Show all keyboard shortcuts"},{name:"fork",description:"Create a new fork from a previous user message"},{name:"clone",description:"Duplicate the current session at the current position"},{name:"tree",description:"Navigate session tree (switch branches)"},{name:"login",description:"Configure provider authentication"},{name:"logout",description:"Remove provider authentication"},{name:"new",description:"Start a new session"},{name:"compact",description:"Manually compact the session context"},{name:"resume",description:"Resume a different session"},{name:"reload",description:"Reload keybindings, extensions, skills, prompts, and themes"},{name:"quit",description:"Quit pi"}];export{m as BUILTIN_SLASH_COMMANDS,c as piSessionsRoot};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { paneExists, paneLocation, paneOfNode, paneCurrentPath, paneSize, paneRunning, ensureSession, openNodeWindow, splitWindow, closePane, currentTmux, switchClient, selectWindow, selectLayout, selectPane, getPaneOption, setPaneOption, breakPane, inTmux, piCommand, shellQuote, renameWindow, displayPopup, windowOfPane, respawnPaneSync, respawnPaneInBackground, respawnPaneInPlace, paneStartCommand, panePid, windowAlive, listLivePanes, VIEWER_STAMP_OPTION, stampViewerPaneAsync, liveViewerPanes, sendAttachControl, displayClientMessage, } from './tmux-driver.js';
|
|
1
|
+
export { paneExists, paneLocation, paneOfNode, paneCurrentPath, paneSize, paneRunning, ensureSession, openNodeWindow, splitWindow, closePane, currentTmux, switchClient, selectWindow, selectLayout, selectPane, getPaneOption, setPaneOption, breakPane, inTmux, piCommand, shellQuote, renameWindow, displayPopup, windowOfPane, respawnPaneSync, respawnPaneInBackground, respawnPaneInPlace, runShellInBackground, paneStartCommand, panePid, windowAlive, listLivePanes, VIEWER_STAMP_OPTION, stampViewerPaneAsync, liveViewerPanes, sendAttachControl, displayClientMessage, } from './tmux-driver.js';
|
|
2
2
|
export { installTmuxBindings } from './tmux-bindings.js';
|
|
3
3
|
export { BROKER_VIEW_SOCKET_WAIT_MS, waitForBrokerViewSocket } from './view-socket.js';
|
|
4
4
|
/** Env for a `crtr surface attach` VIEWER pane (the focus split, the spawn viewer
|