@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,249 @@
|
|
|
1
|
+
#define _GNU_SOURCE
|
|
2
|
+
#include <errno.h>
|
|
3
|
+
#include <fcntl.h>
|
|
4
|
+
#include <linux/openat2.h>
|
|
5
|
+
#include <math.h>
|
|
6
|
+
#include <node_api.h>
|
|
7
|
+
#include <poll.h>
|
|
8
|
+
#include <stdint.h>
|
|
9
|
+
#include <stdio.h>
|
|
10
|
+
#include <stdlib.h>
|
|
11
|
+
#include <string.h>
|
|
12
|
+
#include <sys/socket.h>
|
|
13
|
+
#include <sys/stat.h>
|
|
14
|
+
#include <sys/syscall.h>
|
|
15
|
+
#include <unistd.h>
|
|
16
|
+
#include <uv.h>
|
|
17
|
+
|
|
18
|
+
#define CHECK(call) do { if ((call) != napi_ok) { napi_throw_error(env, NULL, "N-API operation failed"); return NULL; } } while (0)
|
|
19
|
+
|
|
20
|
+
static napi_value system_error(napi_env env, const char *operation) {
|
|
21
|
+
int saved = errno;
|
|
22
|
+
napi_throw_error(env, uv_err_name(-saved), operation);
|
|
23
|
+
return NULL;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static int argument_count(napi_env env, size_t actual, size_t expected) {
|
|
27
|
+
if (actual == expected) return 1;
|
|
28
|
+
napi_throw_type_error(env, NULL, "wrong number of arguments");
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static int unsigned_arg(napi_env env, napi_value value, uint32_t *out) {
|
|
33
|
+
napi_valuetype type;
|
|
34
|
+
double number;
|
|
35
|
+
if (napi_typeof(env, value, &type) != napi_ok || type != napi_number ||
|
|
36
|
+
napi_get_value_double(env, value, &number) != napi_ok ||
|
|
37
|
+
!isfinite(number) || number < 0 || number > UINT32_MAX || floor(number) != number) {
|
|
38
|
+
napi_throw_type_error(env, NULL, "expected an unsigned 32-bit integer");
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
*out = (uint32_t)number;
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static int fd_arg(napi_env env, napi_value value, int *out) {
|
|
46
|
+
uint32_t number;
|
|
47
|
+
if (!unsigned_arg(env, value, &number)) return 0;
|
|
48
|
+
if (number > INT32_MAX) {
|
|
49
|
+
napi_throw_range_error(env, NULL, "file descriptor is too large");
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
*out = (int)number;
|
|
53
|
+
return 1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static int string_arg(napi_env env, napi_value value, char **out) {
|
|
57
|
+
napi_valuetype type;
|
|
58
|
+
size_t length;
|
|
59
|
+
if (napi_typeof(env, value, &type) != napi_ok || type != napi_string ||
|
|
60
|
+
napi_get_value_string_utf8(env, value, NULL, 0, &length) != napi_ok) {
|
|
61
|
+
napi_throw_type_error(env, NULL, "expected a path string");
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
char *path = malloc(length + 1);
|
|
65
|
+
if (path == NULL) { napi_throw_error(env, "ENOMEM", "allocating path"); return 0; }
|
|
66
|
+
size_t written;
|
|
67
|
+
if (napi_get_value_string_utf8(env, value, path, length + 1, &written) != napi_ok ||
|
|
68
|
+
written != length || memchr(path, 0, length) != NULL) {
|
|
69
|
+
free(path);
|
|
70
|
+
napi_throw_type_error(env, NULL, "path must be UTF-8 without NUL bytes");
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
*out = path;
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static napi_value peer_cred(napi_env env, napi_callback_info info) {
|
|
78
|
+
size_t argc = 1;
|
|
79
|
+
napi_value argv[1], result, value;
|
|
80
|
+
CHECK(napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
|
81
|
+
int fd;
|
|
82
|
+
if (!argument_count(env, argc, 1) || !fd_arg(env, argv[0], &fd)) return NULL;
|
|
83
|
+
struct ucred cred;
|
|
84
|
+
socklen_t length = sizeof(cred);
|
|
85
|
+
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &length) < 0) return system_error(env, "SO_PEERCRED");
|
|
86
|
+
if (length != sizeof(cred)) { napi_throw_error(env, NULL, "SO_PEERCRED returned an invalid length"); return NULL; }
|
|
87
|
+
CHECK(napi_create_object(env, &result));
|
|
88
|
+
CHECK(napi_create_int32(env, cred.pid, &value));
|
|
89
|
+
CHECK(napi_set_named_property(env, result, "pid", value));
|
|
90
|
+
CHECK(napi_create_uint32(env, cred.uid, &value));
|
|
91
|
+
CHECK(napi_set_named_property(env, result, "uid", value));
|
|
92
|
+
CHECK(napi_create_uint32(env, cred.gid, &value));
|
|
93
|
+
CHECK(napi_set_named_property(env, result, "gid", value));
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static napi_value open_at2(napi_env env, napi_callback_info info) {
|
|
98
|
+
size_t argc = 4;
|
|
99
|
+
napi_value argv[4], result;
|
|
100
|
+
CHECK(napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
|
101
|
+
int dirfd;
|
|
102
|
+
uint32_t flags, resolve;
|
|
103
|
+
char *path;
|
|
104
|
+
if (!argument_count(env, argc, 4) || !fd_arg(env, argv[0], &dirfd) || !string_arg(env, argv[1], &path)) return NULL;
|
|
105
|
+
if (!unsigned_arg(env, argv[2], &flags) || !unsigned_arg(env, argv[3], &resolve)) { free(path); return NULL; }
|
|
106
|
+
struct open_how how = { .flags = flags, .resolve = resolve };
|
|
107
|
+
int fd = syscall(SYS_openat2, dirfd, path, &how, sizeof(how));
|
|
108
|
+
free(path);
|
|
109
|
+
if (fd < 0) return system_error(env, "openat2");
|
|
110
|
+
if (napi_create_int32(env, fd, &result) != napi_ok) { close(fd); napi_throw_error(env, NULL, "N-API operation failed"); return NULL; }
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static napi_value fd_path(napi_env env, napi_callback_info info) {
|
|
115
|
+
size_t argc = 1;
|
|
116
|
+
napi_value argv[1], result;
|
|
117
|
+
CHECK(napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
|
118
|
+
int fd;
|
|
119
|
+
if (!argument_count(env, argc, 1) || !fd_arg(env, argv[0], &fd)) return NULL;
|
|
120
|
+
char link[64];
|
|
121
|
+
snprintf(link, sizeof(link), "/proc/self/fd/%d", fd);
|
|
122
|
+
size_t size = 256;
|
|
123
|
+
for (;;) {
|
|
124
|
+
char *path = malloc(size + 1);
|
|
125
|
+
if (path == NULL) { napi_throw_error(env, "ENOMEM", "allocating fd path"); return NULL; }
|
|
126
|
+
ssize_t length = readlink(link, path, size);
|
|
127
|
+
if (length < 0) { free(path); return system_error(env, "readlink /proc/self/fd"); }
|
|
128
|
+
if ((size_t)length < size) {
|
|
129
|
+
path[length] = 0;
|
|
130
|
+
napi_status status = napi_create_string_utf8(env, path, (size_t)length, &result);
|
|
131
|
+
free(path);
|
|
132
|
+
if (status != napi_ok) { napi_throw_error(env, NULL, "N-API operation failed"); return NULL; }
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
free(path);
|
|
136
|
+
if (size >= 1024 * 1024) { napi_throw_error(env, "ENAMETOOLONG", "fd path exceeds 1 MiB"); return NULL; }
|
|
137
|
+
size *= 2;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static napi_value fd_stat(napi_env env, napi_callback_info info) {
|
|
142
|
+
size_t argc = 1;
|
|
143
|
+
napi_value argv[1], result, value;
|
|
144
|
+
CHECK(napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
|
145
|
+
int fd;
|
|
146
|
+
if (!argument_count(env, argc, 1) || !fd_arg(env, argv[0], &fd)) return NULL;
|
|
147
|
+
struct stat st;
|
|
148
|
+
if (fstat(fd, &st) < 0) return system_error(env, "fstat");
|
|
149
|
+
CHECK(napi_create_object(env, &result));
|
|
150
|
+
#define NUMBER(name, field) do { CHECK(napi_create_uint32(env, st.field, &value)); CHECK(napi_set_named_property(env, result, name, value)); } while (0)
|
|
151
|
+
NUMBER("uid", st_uid);
|
|
152
|
+
NUMBER("gid", st_gid);
|
|
153
|
+
NUMBER("mode", st_mode);
|
|
154
|
+
NUMBER("nlink", st_nlink);
|
|
155
|
+
#undef NUMBER
|
|
156
|
+
CHECK(napi_create_bigint_uint64(env, st.st_dev, &value));
|
|
157
|
+
CHECK(napi_set_named_property(env, result, "dev", value));
|
|
158
|
+
CHECK(napi_create_bigint_uint64(env, st.st_ino, &value));
|
|
159
|
+
CHECK(napi_set_named_property(env, result, "ino", value));
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static napi_value send_fds(napi_env env, napi_callback_info info) {
|
|
164
|
+
size_t argc = 3;
|
|
165
|
+
napi_value argv[3], item;
|
|
166
|
+
int socket_fd;
|
|
167
|
+
char *data;
|
|
168
|
+
uint32_t count;
|
|
169
|
+
CHECK(napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
|
170
|
+
if (!argument_count(env, argc, 3) || !fd_arg(env, argv[0], &socket_fd) || !string_arg(env, argv[1], &data)) return NULL;
|
|
171
|
+
if (napi_get_array_length(env, argv[2], &count) != napi_ok || count > 16 || strlen(data) > 65535) {
|
|
172
|
+
free(data); napi_throw_range_error(env, NULL, "invalid launcher packet"); return NULL;
|
|
173
|
+
}
|
|
174
|
+
char control[CMSG_SPACE(16 * sizeof(int))] = {0};
|
|
175
|
+
struct iovec iov = { .iov_base = data, .iov_len = strlen(data) };
|
|
176
|
+
struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1 };
|
|
177
|
+
if (count) {
|
|
178
|
+
msg.msg_control = control; msg.msg_controllen = CMSG_SPACE(count * sizeof(int));
|
|
179
|
+
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
|
|
180
|
+
cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(count * sizeof(int));
|
|
181
|
+
for (uint32_t i = 0; i < count; i++) {
|
|
182
|
+
int fd;
|
|
183
|
+
CHECK(napi_get_element(env, argv[2], i, &item));
|
|
184
|
+
if (!fd_arg(env, item, &fd)) { free(data); return NULL; }
|
|
185
|
+
memcpy((char *)CMSG_DATA(cmsg) + i * sizeof(int), &fd, sizeof(fd));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
ssize_t sent = sendmsg(socket_fd, &msg, MSG_NOSIGNAL | MSG_DONTWAIT);
|
|
189
|
+
int saved = errno;
|
|
190
|
+
free(data);
|
|
191
|
+
if (sent < 0) { errno = saved; return system_error(env, "sendmsg"); }
|
|
192
|
+
if ((size_t)sent != iov.iov_len) { napi_throw_error(env, "EIO", "short launcher packet"); return NULL; }
|
|
193
|
+
napi_value result;
|
|
194
|
+
CHECK(napi_get_undefined(env, &result));
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
static napi_value recv_fds(napi_env env, napi_callback_info info) {
|
|
199
|
+
size_t argc = 1;
|
|
200
|
+
napi_value argv[1], result, value, fds;
|
|
201
|
+
int socket_fd;
|
|
202
|
+
CHECK(napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
|
203
|
+
if (!argument_count(env, argc, 1) || !fd_arg(env, argv[0], &socket_fd)) return NULL;
|
|
204
|
+
char data[65536], control[CMSG_SPACE(16 * sizeof(int))] = {0};
|
|
205
|
+
struct iovec iov = { .iov_base = data, .iov_len = sizeof(data) };
|
|
206
|
+
struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1, .msg_control = control, .msg_controllen = sizeof(control) };
|
|
207
|
+
struct pollfd pending = { .fd = socket_fd, .events = POLLIN };
|
|
208
|
+
int ready = poll(&pending, 1, 1000);
|
|
209
|
+
if (ready < 0) return system_error(env, "poll launcher packet");
|
|
210
|
+
if (ready == 0) { errno = ETIMEDOUT; return system_error(env, "launcher packet timed out"); }
|
|
211
|
+
ssize_t received = recvmsg(socket_fd, &msg, MSG_CMSG_CLOEXEC);
|
|
212
|
+
if (received < 0) return system_error(env, "recvmsg");
|
|
213
|
+
int received_fds[16], count = 0;
|
|
214
|
+
for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
|
215
|
+
if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS || cmsg->cmsg_len < CMSG_LEN(0) || (cmsg->cmsg_len - CMSG_LEN(0)) % sizeof(int) != 0 || count + (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int) > 16) goto invalid_packet;
|
|
216
|
+
int n = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
|
|
217
|
+
for (int i = 0; i < n; i++) memcpy(&received_fds[count++], (char *)CMSG_DATA(cmsg) + i * sizeof(int), sizeof(int));
|
|
218
|
+
}
|
|
219
|
+
if (received == 0 || (msg.msg_flags & (MSG_CTRUNC | MSG_TRUNC))) goto invalid_packet;
|
|
220
|
+
CHECK(napi_create_object(env, &result));
|
|
221
|
+
CHECK(napi_create_string_utf8(env, data, (size_t)received, &value));
|
|
222
|
+
CHECK(napi_set_named_property(env, result, "data", value));
|
|
223
|
+
CHECK(napi_create_array_with_length(env, count, &fds));
|
|
224
|
+
for (int i = 0; i < count; i++) {
|
|
225
|
+
CHECK(napi_create_int32(env, received_fds[i], &value));
|
|
226
|
+
CHECK(napi_set_element(env, fds, i, value));
|
|
227
|
+
}
|
|
228
|
+
CHECK(napi_set_named_property(env, result, "fds", fds));
|
|
229
|
+
return result;
|
|
230
|
+
invalid_packet:
|
|
231
|
+
for (int i = 0; i < count; i++) close(received_fds[i]);
|
|
232
|
+
napi_throw_error(env, "EINVAL", "invalid or truncated launcher packet");
|
|
233
|
+
return NULL;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
static napi_value init(napi_env env, napi_value exports) {
|
|
237
|
+
napi_property_descriptor methods[] = {
|
|
238
|
+
{ "peerCred", NULL, peer_cred, NULL, NULL, NULL, napi_default, NULL },
|
|
239
|
+
{ "openat2", NULL, open_at2, NULL, NULL, NULL, napi_default, NULL },
|
|
240
|
+
{ "fdPath", NULL, fd_path, NULL, NULL, NULL, napi_default, NULL },
|
|
241
|
+
{ "fstat", NULL, fd_stat, NULL, NULL, NULL, napi_default, NULL },
|
|
242
|
+
{ "sendFds", NULL, send_fds, NULL, NULL, NULL, napi_default, NULL },
|
|
243
|
+
{ "recvFds", NULL, recv_fds, NULL, NULL, NULL, napi_default, NULL },
|
|
244
|
+
};
|
|
245
|
+
CHECK(napi_define_properties(env, exports, sizeof(methods) / sizeof(methods[0]), methods));
|
|
246
|
+
return exports;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
NAPI_MODULE(NODE_GYP_MODULE_NAME, init)
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var l=(o,t)=>s(o,"name",{value:t,configurable:!0});import{stateBlock as r}from"../help.js";import{listProfiles as c}from"./manifest.js";function u(){const o=c(),t=20,e=o.slice(0,t).map(i=>`${i.profileId} \u2014 ${i.manifest.name}`).join(`
|
|
2
|
-
`),n=o.length>t?`${e}
|
|
3
|
-
\u2026 ${o.length-t} more; use crtr profile list`:e;return r("profiles",{count:o.length},n)}l(u,"profilesStateBlock");export{u as profilesStateBlock};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { AgentSessionServices, ModelRegistry } from '@earendil-works/pi-coding-agent';
|
|
2
|
-
import type { BrokerSdkConfig } from '../launch.js';
|
|
3
|
-
import type { BrokerClient } from './client-registry.js';
|
|
4
|
-
import type { FrameReplies } from './frame-replies.js';
|
|
5
|
-
import type { RebindDriver } from './rebind.js';
|
|
6
|
-
import type { BrokerSession } from './read-ops.js';
|
|
7
|
-
import type { TurnAdmissionGate } from './turn-admission.js';
|
|
8
|
-
type ResolvedLaunchModel = {
|
|
9
|
-
model: NonNullable<ReturnType<ModelRegistry['find']>>;
|
|
10
|
-
thinkingLevel: string | undefined;
|
|
11
|
-
} | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* The `reload_auth` frame and the two pieces of work it starts: a model
|
|
14
|
-
* reconcile against freshly re-read credentials, and — when this node is
|
|
15
|
-
* sitting on a recorded provider auth fault — a rewind-and-redrive of the turn
|
|
16
|
-
* that fault killed. Owns the in-flight state both need so a burst of
|
|
17
|
-
* canvas-wide /login fans collapses into one reconcile per generation.
|
|
18
|
-
*/
|
|
19
|
-
export type AuthReloadGate = {
|
|
20
|
-
/** The in-flight reconcile an idle prompt must not overtake, if any. */
|
|
21
|
-
inFlight(): Promise<void> | undefined;
|
|
22
|
-
/** Handle a `reload_auth` frame. Open to any client, observers included. */
|
|
23
|
-
handle(client: BrokerClient): void;
|
|
24
|
-
/** A session replacement invalidates the reconcile the old one was waiting on. */
|
|
25
|
-
resetForSession(): void;
|
|
26
|
-
};
|
|
27
|
-
export declare function createAuthReloadGate(deps: {
|
|
28
|
-
nodeId: string;
|
|
29
|
-
cfg: BrokerSdkConfig;
|
|
30
|
-
replies: FrameReplies;
|
|
31
|
-
rebind: RebindDriver;
|
|
32
|
-
session: () => BrokerSession;
|
|
33
|
-
services: () => AgentSessionServices;
|
|
34
|
-
broadcastModelChanged: (persist?: boolean, pinnedOverride?: boolean, userSelected?: boolean) => Promise<void>;
|
|
35
|
-
formatModelSpec: (model: BrokerSession['model'], thinkingLevel?: string) => string | null;
|
|
36
|
-
resolveLaunchModel: (services: AgentSessionServices, cfg: BrokerSdkConfig) => Promise<ResolvedLaunchModel>;
|
|
37
|
-
/** A reconcile that finally resolves a model releases the held launch prompt. */
|
|
38
|
-
driveKickoff: () => void;
|
|
39
|
-
turnAdmission: TurnAdmissionGate;
|
|
40
|
-
}): AuthReloadGate;
|
|
41
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var E=Object.defineProperty;var d=(u,s)=>E(u,"name",{value:s,configurable:!0});import{AUTH_FAULT_RECOVERY_BODY as T,formatCard as G}from"../../../shared/generated-context.js";import{envModelIntent as x}from"../../../shared/env.js";import{emitEvent as g}from"../../events/emit.js";import{brokerRecovery as y,mutateBrokerFault as B}from"./daemon-ops.js";import{isUnknownModel as C}from"../model-selection.js";import{announceMessageOrigin as O}from"../stamp/channel.js";function V(u){const{nodeId:s,cfg:m,replies:k,rebind:v,session:p,services:_,broadcastModelChanged:R,formatModelSpec:w,resolveLaunchModel:L,driveKickoff:F,turnAdmission:I}=u;let c=null,h=!1;const a=d((r,e)=>v.installedGeneration()!==r||p()!==e,"supersededBy"),M=d(async(r,e,t)=>{if(await t.modelRuntime.refresh({allowNetwork:!1}),a(r,e))return;const i=e.model===void 0||C(e.model),o=m.modelExact!==!0&&m.modelProviderPinned!==!0&&(x()??"").trim()!=="";if(i||o){const n=await L(t,m);if(a(r,e))return;if(n!==void 0){const l=w(e.model,e.thinkingLevel),f=w(n.model,n.thinkingLevel);if(f!==null&&f!==l){if(await e.setModel(n.model),a(r,e))return;e.setThinkingLevel(n.thinkingLevel??"off")}}}a(r,e)||(await R(),F())},"runAuthReload"),A=d(()=>{const r=v.installedGeneration(),e=c;if(e!==null&&e.generation===r)return e.promise;if(r===void 0)return;const t=p(),i=_(),o=M(r,t,i).catch(l=>{g({level:"warn",event:"broker.auth_reload.reconcile_failed",error:l})}),n={generation:r,promise:o};return c=n,o.finally(()=>{c===n&&(c=null)}),o},"startAuthReload"),b=d(r=>{const e=v.installedGeneration(),t=p();t.isStreaming||h||(h=!0,(async()=>{try{const i=(await y(s)).fault;if(i?.link!=="pi\u2192provider"||i.kind!=="auth"||(r!==void 0&&await r,a(e,t)))return;const o=i.anchor_entry_id;if(o!==void 0)try{if((t.sessionManager.getLeafId?.()??null)!==o&&await t.navigateTree(o),a(e,t))return}catch(l){g({level:"warn",event:"broker.auth_fault.rewind_skipped",error:l})}const n=(await y(s)).fault;if(a(e,t)||t.isStreaming||n?.link!=="pi\u2192provider"||n.kind!=="auth"||n.since!==i.since)return;await I.admit(async l=>{if(a(e,t)||t.isStreaming)return l(),Promise.resolve();await B(s,{op:"clear",link:"pi\u2192provider"});const f=G("recovery",{},T);return O(f,{type:"runtime",kind:"recovery"}),t.prompt(f,{preflightResult:l})})}catch(i){g({level:"error",event:"broker.auth_fault.redrive_failed",error:i})}finally{h=!1}})())},"redriveAuthFault");return{inFlight:d(()=>c?.promise,"inFlight"),handle(r){try{k.ackTo(r,"reload_auth"),b(A())}catch(e){k.engineErrorTo(r)(e)}},resetForSession(){c=null}}}d(V,"createAuthReloadGate");export{V as createAuthReloadGate};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type ContextExposureState, type ExposureTarget } from './injected-store.js';
|
|
2
|
-
import type { NodeConfigSubject } from './subject-fields.js';
|
|
3
|
-
export type CliContextDeliveryOutcome = 'stateless' | 'recorded' | 'unrecorded';
|
|
4
|
-
export interface CliContextDelivery<T> {
|
|
5
|
-
result: T;
|
|
6
|
-
outcome: CliContextDeliveryOutcome;
|
|
7
|
-
diagnostic?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface CliContextDeliveryOptions<T> {
|
|
10
|
-
nodeId: string | undefined;
|
|
11
|
-
/** Explicit memory reads remain useful without a daemon: gated attachments
|
|
12
|
-
* skip while ungated ones render, exactly as before this shared boundary. */
|
|
13
|
-
allowUnavailableSubject?: boolean;
|
|
14
|
-
loadSubject?: (nodeId: string) => Promise<NodeConfigSubject | null>;
|
|
15
|
-
loadState?: (nodeId: string) => ContextExposureState;
|
|
16
|
-
saveState?: (nodeId: string, state: ContextExposureState) => void;
|
|
17
|
-
render: (subject: NodeConfigSubject | null, target: ExposureTarget) => T | Promise<T>;
|
|
18
|
-
}
|
|
19
|
-
/** Render one CLI-owned delivery batch. The renderer owns event routing and
|
|
20
|
-
* exposure registration; this boundary owns subject lookup and the one
|
|
21
|
-
* load/clone/render/save ledger transaction shared by CLI callers. */
|
|
22
|
-
export declare function renderCliContextDelivery<T>(opts: CliContextDeliveryOptions<T>): Promise<CliContextDelivery<T>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var n=(t,e)=>s(t,"name",{value:e,configurable:!0});import{localClient as f}from"../../api/node-transport.js";import{CrtrError as x}from"../errors.js";import{cloneContextExposureState as m,emptyContextExposureState as S,exposureTarget as c,loadContextExposureState as b,saveContextExposureState as w}from"./injected-store.js";function a(t,e){const r=e instanceof Error?e.message:e===void 0?void 0:String(e);return new x("context_delivery_failed",r===void 0?t:`${t}: ${r}`,void 0,{next:"The displayed file content remains available; retry context delivery in a live node when the runtime is reachable."})}n(a,"deliveryError");async function y(t){return await f({autostart:!1,coldStartPollWindowMs:0}).nodeSubject(t)}n(y,"nodeSubject");async function E(t){const e=t.nodeId?.trim();if(e===void 0||e==="")return{result:await t.render(null,c(S(),"transcript")),outcome:"stateless"};let r;try{r=await(t.loadSubject??y)(e)}catch(o){if(t.allowUnavailableSubject!==!0)throw a(`could not load context subject for node ${e}`,o);r=null}if(r===null&&t.allowUnavailableSubject!==!0)throw a(`could not load context subject for node ${e}`);let d;try{d=(t.loadState??b)(e)}catch(o){throw a(`could not load context exposure state for node ${e}`,o)}const l=m(d),i=await t.render(r,c(l,"transcript"));try{return(t.saveState??w)(e,l),{result:i,outcome:"recorded"}}catch(o){const u=o instanceof Error?o.message:String(o);return{result:i,outcome:"unrecorded",diagnostic:`Context was delivered but not recorded for node ${e}: ${u}`}}}n(E,"renderCliContextDelivery");export{E as renderCliContextDelivery};
|