@north-light/crouter 0.3.349 → 0.3.351
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
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { createLocalJWKSet, decodeProtectedHeader, jwtVerify } from 'jose';
|
|
2
|
+
/** App-memory form keys omit the app id. */
|
|
3
|
+
export const ENFORCED = new Set(['crtr:llm', 'crtr:act', 'crtr:memory:read:app', 'crtr:memory:rw:app', 'crtr:files:read:user:.', 'crtr:files:rw:user:.']);
|
|
4
|
+
const id = /^[A-Za-z0-9_-]{1,64}$/;
|
|
5
|
+
function validPath(path, directoryOnly = false) {
|
|
6
|
+
if (path === '.' && directoryOnly)
|
|
7
|
+
return true;
|
|
8
|
+
return path.length > 0 && !path.startsWith('/') && !path.includes('..') && !path.includes(':') &&
|
|
9
|
+
!path.includes('\\') && !/\s/.test(path) &&
|
|
10
|
+
!path.split('/').some((part, index, parts) => part === '.' || (part === '' && index !== parts.length - 1)) &&
|
|
11
|
+
(!directoryOnly || !path.endsWith('/'));
|
|
12
|
+
}
|
|
13
|
+
function selector(value) {
|
|
14
|
+
if (value === 'crtr:llm' || value === 'crtr:act' || value === 'crtr:schedule')
|
|
15
|
+
return { kind: value.slice(5), value };
|
|
16
|
+
if (value === 'crtr:files:share')
|
|
17
|
+
return { kind: 'share', value };
|
|
18
|
+
if (value === 'crtr:memory:manage:user')
|
|
19
|
+
return { kind: 'memory', access: 'manage', holder: 'user' };
|
|
20
|
+
let match = /^crtr:memory:(read|rw):user(?::(.+))?$/.exec(value);
|
|
21
|
+
if (match && (match[2] === undefined || validPath(match[2])))
|
|
22
|
+
return { kind: 'memory', access: match[1], holder: 'user', path: match[2] };
|
|
23
|
+
match = /^crtr:memory:(read|rw):app:([A-Za-z0-9_-]{1,64})(?::profile:([A-Za-z0-9_-]{1,64})(?::(.+))?)?$/.exec(value);
|
|
24
|
+
if (match && (match[4] === undefined || validPath(match[4]))) {
|
|
25
|
+
return { kind: 'memory', access: match[1], holder: `app:${match[2]}`, profile: match[3], path: match[4] };
|
|
26
|
+
}
|
|
27
|
+
match = /^crtr:files:(read|rw):(user|app:[A-Za-z0-9_-]{1,64}):(.+)$/.exec(value);
|
|
28
|
+
if (match && validPath(match[3], true))
|
|
29
|
+
return { kind: 'files', access: match[1], holder: match[2], path: match[3] };
|
|
30
|
+
match = /^crtr:(conversations|objects):read:app:([A-Za-z0-9_-]{1,64})$/.exec(value);
|
|
31
|
+
if (match)
|
|
32
|
+
return { kind: match[1], value };
|
|
33
|
+
match = /^crtr:peer:([A-Za-z0-9_-]{1,64})$/.exec(value);
|
|
34
|
+
if (match)
|
|
35
|
+
return { kind: 'peer', value };
|
|
36
|
+
match = /^([^:]+):([^:]+)$/.exec(value);
|
|
37
|
+
if (match && match[1] !== 'crtr' && id.test(match[1]) && id.test(match[2]))
|
|
38
|
+
return { kind: 'provider', value };
|
|
39
|
+
throw new TypeError(`Unsupported scope: ${value}`);
|
|
40
|
+
}
|
|
41
|
+
export function parseScope(value, grantee) {
|
|
42
|
+
const parsed = selector(value);
|
|
43
|
+
if (grantee && (parsed.kind === 'memory' || parsed.kind === 'files') && parsed.holder.startsWith('app:') && parsed.holder !== grantee) {
|
|
44
|
+
throw new TypeError(`Unsupported scope: ${value}`);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function containsPath(held, requested) {
|
|
49
|
+
if (held === undefined)
|
|
50
|
+
return true;
|
|
51
|
+
if (requested === undefined)
|
|
52
|
+
return false;
|
|
53
|
+
return held === requested || (held.endsWith('/') && requested.startsWith(held));
|
|
54
|
+
}
|
|
55
|
+
export function covers(held, requested) {
|
|
56
|
+
const h = selector(held);
|
|
57
|
+
const r = selector(requested);
|
|
58
|
+
if (h.kind !== r.kind)
|
|
59
|
+
return false;
|
|
60
|
+
if (h.kind === 'memory' && r.kind === 'memory') {
|
|
61
|
+
return h.holder === r.holder && (h.access === r.access || h.access === 'manage' || (h.access === 'rw' && r.access === 'read')) &&
|
|
62
|
+
(h.profile === undefined || h.profile === r.profile) && containsPath(h.path, r.path);
|
|
63
|
+
}
|
|
64
|
+
if (h.kind === 'files' && r.kind === 'files') {
|
|
65
|
+
return h.holder === r.holder && (h.access === 'rw' || r.access === 'read') &&
|
|
66
|
+
(h.path === '.' || h.path === r.path || r.path.startsWith(`${h.path}/`));
|
|
67
|
+
}
|
|
68
|
+
return held === requested;
|
|
69
|
+
}
|
|
70
|
+
/** Keys are scoped to one configured issuer; failed refreshes keep the last successful set. */
|
|
71
|
+
export class JwksCache {
|
|
72
|
+
issuer;
|
|
73
|
+
fetcher;
|
|
74
|
+
keys;
|
|
75
|
+
lastUnknownRefresh = -Infinity;
|
|
76
|
+
discovery;
|
|
77
|
+
constructor(issuer, fetcher = fetch, jwksUri) {
|
|
78
|
+
this.issuer = issuer;
|
|
79
|
+
this.fetcher = fetcher;
|
|
80
|
+
if (jwksUri)
|
|
81
|
+
this.discovery = { jwks_uri: jwksUri };
|
|
82
|
+
}
|
|
83
|
+
async load() {
|
|
84
|
+
if (!this.discovery) {
|
|
85
|
+
const response = await this.fetcher(`${this.issuer.replace(/\/$/, '')}/.well-known/openid-configuration`);
|
|
86
|
+
if (!response.ok)
|
|
87
|
+
throw new Error(`Directory discovery failed: ${response.status}`);
|
|
88
|
+
const value = await response.json();
|
|
89
|
+
if (!value || typeof value !== 'object' || !('jwks_uri' in value) || typeof value.jwks_uri !== 'string')
|
|
90
|
+
throw new Error('Directory discovery has no jwks_uri');
|
|
91
|
+
this.discovery = { jwks_uri: value.jwks_uri };
|
|
92
|
+
}
|
|
93
|
+
const response = await this.fetcher(this.discovery.jwks_uri);
|
|
94
|
+
if (!response.ok)
|
|
95
|
+
throw new Error(`Directory JWKS failed: ${response.status}`);
|
|
96
|
+
const keys = await response.json();
|
|
97
|
+
if (!keys || typeof keys !== 'object' || !('keys' in keys) || !Array.isArray(keys.keys))
|
|
98
|
+
throw new Error('Invalid directory JWKS');
|
|
99
|
+
this.keys = keys;
|
|
100
|
+
return this.keys;
|
|
101
|
+
}
|
|
102
|
+
async forKid(kid) {
|
|
103
|
+
if (!this.keys)
|
|
104
|
+
return this.load();
|
|
105
|
+
if (this.keys.keys.some((key) => key.kid === kid))
|
|
106
|
+
return this.keys;
|
|
107
|
+
if (Date.now() - this.lastUnknownRefresh >= 30_000) {
|
|
108
|
+
this.lastUnknownRefresh = Date.now();
|
|
109
|
+
await this.load();
|
|
110
|
+
}
|
|
111
|
+
return this.keys;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function validatePrincipal(value, kind) {
|
|
115
|
+
return typeof value === 'string' && value.startsWith(`${kind}:`) && id.test(value.slice(kind.length + 1));
|
|
116
|
+
}
|
|
117
|
+
function keySet(jwks, kid) {
|
|
118
|
+
return jwks instanceof JwksCache ? jwks.forKid(kid) : Promise.resolve(jwks);
|
|
119
|
+
}
|
|
120
|
+
export async function verifyAccessToken(options) {
|
|
121
|
+
const header = decodeProtectedHeader(options.token);
|
|
122
|
+
if (header.typ !== 'at+jwt' || header.alg !== 'ES256')
|
|
123
|
+
throw new Error('Invalid access token header');
|
|
124
|
+
const keys = await keySet(options.jwks, header.kid);
|
|
125
|
+
const { payload } = await jwtVerify(options.token, createLocalJWKSet(keys), {
|
|
126
|
+
issuer: options.issuer, audience: options.audience, algorithms: ['ES256'], typ: 'at+jwt',
|
|
127
|
+
});
|
|
128
|
+
if (payload.aud !== options.audience || !validatePrincipal(payload.sub, 'user') || !validatePrincipal(payload.grantee, 'app') ||
|
|
129
|
+
typeof payload.client_id !== 'string' || !id.test(payload.client_id) || typeof payload.grant !== 'string' ||
|
|
130
|
+
typeof payload.exp !== 'number') {
|
|
131
|
+
throw new Error('Invalid access token claims');
|
|
132
|
+
}
|
|
133
|
+
return payload;
|
|
134
|
+
}
|
|
135
|
+
/** The directory's grant-sync notice: ES256 with the directory signing key named
|
|
136
|
+
* by `kid`, no `typ`, `aud` = the runtime's registered URL, a lifetime of at most
|
|
137
|
+
* five minutes, and a `jti` the runtime uses to answer replays without a sync. */
|
|
138
|
+
export async function verifySyncNotice(options) {
|
|
139
|
+
const header = decodeProtectedHeader(options.token);
|
|
140
|
+
if (header.alg !== 'ES256')
|
|
141
|
+
throw new Error('Invalid sync notice algorithm');
|
|
142
|
+
if (typeof header.kid !== 'string' || header.kid === '')
|
|
143
|
+
throw new Error('Sync notice has no key id');
|
|
144
|
+
const keys = await keySet(options.jwks, header.kid);
|
|
145
|
+
const { payload } = await jwtVerify(options.token, createLocalJWKSet(keys), {
|
|
146
|
+
issuer: options.issuer, audience: options.audience, algorithms: ['ES256'], requiredClaims: ['exp', 'iat', 'jti'],
|
|
147
|
+
maxTokenAge: 300, clockTolerance: 30,
|
|
148
|
+
});
|
|
149
|
+
if (payload.aud !== options.audience || payload.purpose !== 'grant_sync' || typeof payload.jti !== 'string' || payload.jti === '' ||
|
|
150
|
+
typeof payload.exp !== 'number' || typeof payload.iat !== 'number' || payload.exp - payload.iat > 300) {
|
|
151
|
+
throw new Error('Invalid sync notice claims');
|
|
152
|
+
}
|
|
153
|
+
return payload;
|
|
154
|
+
}
|
|
155
|
+
export async function verifyIdToken(options) {
|
|
156
|
+
const header = decodeProtectedHeader(options.token);
|
|
157
|
+
if (header.alg !== 'ES256')
|
|
158
|
+
throw new Error('Invalid ID token algorithm');
|
|
159
|
+
const keys = await keySet(options.jwks, header.kid);
|
|
160
|
+
const { payload } = await jwtVerify(options.token, createLocalJWKSet(keys), {
|
|
161
|
+
issuer: options.issuer, audience: options.audience, algorithms: ['ES256'],
|
|
162
|
+
});
|
|
163
|
+
if (payload.aud !== options.audience || typeof payload.exp !== 'number' || !validatePrincipal(payload.sub, 'user'))
|
|
164
|
+
throw new Error('Invalid ID token claims');
|
|
165
|
+
return payload;
|
|
166
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@north-light/crouter-identity",
|
|
3
|
+
"version": "0.3.351",
|
|
4
|
+
"description": "Northlight access-token verification and scope rules",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"jose": "^6.2.1"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/vallum-security/crouter.git",
|
|
30
|
+
"directory": "packages/crouter-identity"
|
|
31
|
+
},
|
|
32
|
+
"license": "GPL-3.0-only"
|
|
33
|
+
}
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/crouter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.351",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/crouter",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.351",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "GPL-3.0-only",
|
|
12
12
|
"workspaces": [
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
"@earendil-works/pi-ai": "0.87.1",
|
|
19
19
|
"@earendil-works/pi-coding-agent": "0.87.1",
|
|
20
20
|
"@earendil-works/pi-tui": "0.87.1",
|
|
21
|
+
"@north-light/crouter-identity": "^0.3.351",
|
|
21
22
|
"cron-parser": "^5.6.0",
|
|
22
23
|
"esbuild": "^0.27.7",
|
|
24
|
+
"jose": "^6.2.12",
|
|
23
25
|
"proper-lockfile": "4.1.2",
|
|
24
26
|
"string-width": "^7.0.0",
|
|
25
27
|
"tar": "^7.5.22",
|
|
@@ -32,6 +34,7 @@
|
|
|
32
34
|
"bin": {
|
|
33
35
|
"crouter": "bin/crouter",
|
|
34
36
|
"crtr": "bin/crtr",
|
|
37
|
+
"crtr-launcher": "bin/crtr-launcher",
|
|
35
38
|
"crtrd": "bin/crtrd"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
@@ -4324,6 +4327,10 @@
|
|
|
4324
4327
|
"resolved": "packages/crouter-env-docker",
|
|
4325
4328
|
"link": true
|
|
4326
4329
|
},
|
|
4330
|
+
"node_modules/@north-light/crouter-identity": {
|
|
4331
|
+
"resolved": "packages/crouter-identity",
|
|
4332
|
+
"link": true
|
|
4333
|
+
},
|
|
4327
4334
|
"node_modules/@north-light/crouter-plugin": {
|
|
4328
4335
|
"resolved": "packages/crouter-plugin",
|
|
4329
4336
|
"link": true
|
|
@@ -7485,6 +7492,15 @@
|
|
|
7485
7492
|
"jiti": "lib/jiti-cli.mjs"
|
|
7486
7493
|
}
|
|
7487
7494
|
},
|
|
7495
|
+
"node_modules/jose": {
|
|
7496
|
+
"version": "6.2.12",
|
|
7497
|
+
"resolved": "https://registry.npmjs.org/jose/-/jose-6.2.12.tgz",
|
|
7498
|
+
"integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==",
|
|
7499
|
+
"license": "MIT",
|
|
7500
|
+
"funding": {
|
|
7501
|
+
"url": "https://github.com/sponsors/panva"
|
|
7502
|
+
}
|
|
7503
|
+
},
|
|
7488
7504
|
"node_modules/json-bigint": {
|
|
7489
7505
|
"version": "1.0.0",
|
|
7490
7506
|
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
|
@@ -10869,28 +10885,38 @@
|
|
|
10869
10885
|
},
|
|
10870
10886
|
"packages/crouter-api": {
|
|
10871
10887
|
"name": "@north-light/crouter-api",
|
|
10872
|
-
"version": "0.3.
|
|
10888
|
+
"version": "0.3.351",
|
|
10873
10889
|
"license": "GPL-3.0-only"
|
|
10874
10890
|
},
|
|
10875
10891
|
"packages/crouter-env-docker": {
|
|
10876
10892
|
"name": "@north-light/crouter-env-docker",
|
|
10877
|
-
"version": "0.3.
|
|
10893
|
+
"version": "0.3.351",
|
|
10878
10894
|
"license": "GPL-3.0-only"
|
|
10879
10895
|
},
|
|
10896
|
+
"packages/crouter-identity": {
|
|
10897
|
+
"name": "@north-light/crouter-identity",
|
|
10898
|
+
"version": "0.3.351",
|
|
10899
|
+
"license": "GPL-3.0-only",
|
|
10900
|
+
"dependencies": {
|
|
10901
|
+
"jose": "^6.2.1"
|
|
10902
|
+
}
|
|
10903
|
+
},
|
|
10880
10904
|
"packages/crouter-plugin": {
|
|
10881
10905
|
"name": "@north-light/crouter-plugin",
|
|
10882
|
-
"version": "0.3.
|
|
10906
|
+
"version": "0.3.351",
|
|
10883
10907
|
"license": "GPL-3.0-only",
|
|
10884
10908
|
"dependencies": {
|
|
10885
|
-
"@north-light/crouter-api": "^0.3.
|
|
10909
|
+
"@north-light/crouter-api": "^0.3.351"
|
|
10886
10910
|
}
|
|
10887
10911
|
},
|
|
10888
10912
|
"packages/crouter-sdk": {
|
|
10889
10913
|
"name": "@north-light/crouter-sdk",
|
|
10890
|
-
"version": "0.3.
|
|
10914
|
+
"version": "0.3.351",
|
|
10891
10915
|
"license": "GPL-3.0-only",
|
|
10892
10916
|
"dependencies": {
|
|
10893
|
-
"@north-light/crouter-api": "^0.3.
|
|
10917
|
+
"@north-light/crouter-api": "^0.3.351",
|
|
10918
|
+
"@north-light/crouter-identity": "^0.3.351",
|
|
10919
|
+
"jose": "^6.2.1"
|
|
10894
10920
|
}
|
|
10895
10921
|
}
|
|
10896
10922
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
if (process.platform !== 'linux') throw new Error('The native addon builds only on Linux');
|
|
7
|
+
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
+
const header = resolve(dirname(process.execPath), '../include/node');
|
|
9
|
+
if (!existsSync(join(header, 'node_api.h'))) throw new Error(`Node headers not found: ${header}`);
|
|
10
|
+
// The build passes its staging directory; run by hand it writes into dist/.
|
|
11
|
+
const target = resolve(process.argv[2] ?? join(root, 'dist/native/linux/addon.node'));
|
|
12
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
13
|
+
const args = ['-std=c11', '-O2', '-fPIC', '-shared', '-Wall', '-Wextra', '-Werror', `-I${header}`, join(root, 'src/native/linux/addon.c'), '-o', target];
|
|
14
|
+
const result = spawnSync('cc', args, { stdio: 'inherit' });
|
|
15
|
+
if (result.error) throw result.error;
|
|
16
|
+
if (result.status !== 0) throw new Error(`cc failed: ${result.status ?? result.signal}`);
|
|
@@ -7,6 +7,14 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { ENTRY_NAMES, GENERATION_ID, MANIFEST_KEYS, PACKAGE_NAME, MANIFEST_SCHEMA, contained, isSealed, publishedMarkerPath, runtimeHome, sortInventory, validateManifestShape } from '../bin/runtime-generation-manifest.mjs';
|
|
9
9
|
import { patchPiTreeRootOrdering } from './patch-pi-tree-root-ordering.mjs';
|
|
10
|
+
import { smokeValidate } from './runtime-smoke.mjs';
|
|
11
|
+
import { scrubInheritedBrokerEnv, unsafeIsolationReason } from './lib/isolation-env.mjs';
|
|
12
|
+
|
|
13
|
+
scrubInheritedBrokerEnv();
|
|
14
|
+
// CI has no account store to protect, and its checkout sits inside the runner's
|
|
15
|
+
// home while the lanes move HOME elsewhere; test-env-scrub skips CI the same way.
|
|
16
|
+
const unsafeReason = process.env.CI ? null : unsafeIsolationReason();
|
|
17
|
+
if (unsafeReason) throw new Error(`Unsafe crouter runtime install: ${unsafeReason}`);
|
|
10
18
|
|
|
11
19
|
const PACKAGE_ROOT = process.argv[2] ? resolve(process.argv[2]) : resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
12
20
|
const RUNTIME_HOME = runtimeHome();
|
|
@@ -129,12 +137,6 @@ async function removeStage(root) {
|
|
|
129
137
|
await rm(root, { recursive: true, force: true });
|
|
130
138
|
}
|
|
131
139
|
|
|
132
|
-
async function smokeValidate(stage) {
|
|
133
|
-
await run(process.execPath, ['--input-type=module', '--eval', "await import('./dist/index.js')"], stage);
|
|
134
|
-
const lazyPiModule = 'node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js';
|
|
135
|
-
await lstat(join(stage, lazyPiModule));
|
|
136
|
-
await run(process.execPath, ['--input-type=module', '--eval', `await import('./${lazyPiModule}')`], stage);
|
|
137
|
-
}
|
|
138
140
|
|
|
139
141
|
/** Atomically mark generation `id` eligible as a sibling-fallback candidate
|
|
140
142
|
* (see `runtime-generation-manifest.mjs`'s `publishedMarkerPath` for the
|
|
@@ -436,7 +438,7 @@ async function install() {
|
|
|
436
438
|
platform: process.platform,
|
|
437
439
|
arch: process.arch,
|
|
438
440
|
createdAt: new Date().toISOString(),
|
|
439
|
-
entries: { cli: 'dist/cli.js', daemon: 'dist/daemon/crtrd-cli.js', broker: 'dist/core/runtime/broker-cli.js' },
|
|
441
|
+
entries: { cli: 'dist/cli.js', daemon: 'dist/daemon/crtrd-cli.js', broker: 'dist/core/runtime/broker-cli.js', launcher: 'dist/launcher/main.js' },
|
|
440
442
|
files,
|
|
441
443
|
};
|
|
442
444
|
if (JSON.stringify(Object.keys(manifest).sort()) !== JSON.stringify(MANIFEST_KEYS) || manifest.packageName !== PACKAGE_NAME) throw new Error('generated runtime manifest has an invalid schema or package identity');
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { realpathSync } from 'node:fs';
|
|
2
|
+
import { tmpdir, userInfo } from 'node:os';
|
|
3
|
+
import { isAbsolute, relative, sep } from 'node:path';
|
|
4
|
+
|
|
5
|
+
// A node's shell inherits broker identity and pi paths. Neither an installer
|
|
6
|
+
// nor a test lane is that broker; nested processes must resolve their own roots.
|
|
7
|
+
export function scrubInheritedBrokerEnv(env = process.env) {
|
|
8
|
+
for (const key of Object.keys(env)) {
|
|
9
|
+
if (key.startsWith('PI_') || (key.startsWith('CRTR_') &&
|
|
10
|
+
key !== 'CRTR_HOME' && key !== 'CRTR_RUNTIME_HOME' && key !== 'CRTR_NO_DAEMON_AUTOSTART')) {
|
|
11
|
+
delete env[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// A normal host install uses the account HOME. When HOME is overridden, no
|
|
17
|
+
// working directory or configured write root may still point into that account.
|
|
18
|
+
export function unsafeIsolationReason({ requireTemporaryHome = false, requireCrtrHome = false } = {}) {
|
|
19
|
+
const inside = (home, target) => {
|
|
20
|
+
const rel = relative(home, target);
|
|
21
|
+
return rel === '' || (rel !== '..' && !rel.startsWith(`..${sep}`) && !isAbsolute(rel));
|
|
22
|
+
};
|
|
23
|
+
try {
|
|
24
|
+
const home = realpathSync(process.env.HOME);
|
|
25
|
+
const accountHome = realpathSync(userInfo().homedir);
|
|
26
|
+
if (home === accountHome) return requireTemporaryHome ? 'HOME is the account home' : null;
|
|
27
|
+
if (requireCrtrHome && !process.env.CRTR_HOME) return 'CRTR_HOME is missing';
|
|
28
|
+
for (const [name, path] of [
|
|
29
|
+
['cwd', process.cwd()], ['TMPDIR', tmpdir()],
|
|
30
|
+
...(process.env.CRTR_HOME ? [['CRTR_HOME', process.env.CRTR_HOME]] : []),
|
|
31
|
+
...(process.env.CRTR_RUNTIME_HOME ? [['CRTR_RUNTIME_HOME', process.env.CRTR_RUNTIME_HOME]] : []),
|
|
32
|
+
]) {
|
|
33
|
+
const target = realpathSync(path);
|
|
34
|
+
if (inside(accountHome, target) && !inside(home, target)) {
|
|
35
|
+
return `${name} is inside the account home but outside HOME`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
} catch {
|
|
40
|
+
return 'HOME, account home, cwd, TMPDIR, CRTR_HOME, or CRTR_RUNTIME_HOME cannot be resolved';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { mkdtemp, readdir, realpath, rm } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
|
|
7
|
+
const exec = promisify(execFile);
|
|
8
|
+
|
|
9
|
+
// npm ci can succeed with workspace links whose targets were omitted from
|
|
10
|
+
// npm pack. Reject those before publishing or selecting a generation.
|
|
11
|
+
async function validateLinks(root, directory = root) {
|
|
12
|
+
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
13
|
+
const path = join(directory, entry.name);
|
|
14
|
+
if (entry.isDirectory()) await validateLinks(root, path);
|
|
15
|
+
else if (entry.isSymbolicLink()) {
|
|
16
|
+
let target;
|
|
17
|
+
try { target = await realpath(path); }
|
|
18
|
+
catch (error) { throw new Error(`Broken runtime symlink: ${relative(root, path)}`, { cause: error }); }
|
|
19
|
+
const rel = relative(root, target);
|
|
20
|
+
if (isAbsolute(rel) || rel === '..' || rel.startsWith(`..${sep}`)) {
|
|
21
|
+
throw new Error(`Runtime symlink escapes generation: ${relative(root, path)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function smokeValidate(stage) {
|
|
28
|
+
stage = await realpath(resolve(stage));
|
|
29
|
+
await validateLinks(stage);
|
|
30
|
+
const home = await mkdtemp(join(tmpdir(), 'crtr-runtime-smoke-'));
|
|
31
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) =>
|
|
32
|
+
!key.startsWith('CRTR_') && !key.startsWith('PI_') && key !== 'NODE_OPTIONS'));
|
|
33
|
+
Object.assign(env, {
|
|
34
|
+
HOME: home, CRTR_HOME: join(home, 'canvas'),
|
|
35
|
+
CRTR_NO_DAEMON_AUTOSTART: '1', PI_CODING_AGENT_DIR: join(home, 'pi'),
|
|
36
|
+
});
|
|
37
|
+
try {
|
|
38
|
+
// Load the actual daemon and broker graphs without starting either. The
|
|
39
|
+
// public index alone does not reach daemon-only dependencies.
|
|
40
|
+
await exec(process.execPath, ['--input-type=module', '--eval', `
|
|
41
|
+
await import('./dist/index.js');
|
|
42
|
+
await import('./dist/daemon/crtrd.js');
|
|
43
|
+
await import('./dist/core/runtime/broker.js');
|
|
44
|
+
await import('./node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js');
|
|
45
|
+
`], { cwd: stage, env, timeout: 30_000, maxBuffer: 1024 * 1024 });
|
|
46
|
+
} finally {
|
|
47
|
+
await rm(home, { recursive: true, force: true });
|
|
48
|
+
}
|
|
49
|
+
}
|