@north-light/cli 0.3.667 → 0.3.669
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +10 -1
- package/dist/api/client.js +3 -3
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/bash-jobs.d.ts +3 -0
- package/dist/api/dto/broker-ops.d.ts +37 -0
- package/dist/api/dto/docs.d.ts +1 -1
- package/dist/api/dto/imports.d.ts +5 -1
- package/dist/api/dto/objects.d.ts +2 -2
- package/dist/api/dto/profiles.d.ts +6 -2
- package/dist/api/dto/profiles.js +1 -1
- package/dist/api/dto/repo-import.d.ts +25 -0
- package/dist/api/dto/repo-import.js +0 -0
- package/dist/api/routes.d.ts +3 -0
- package/dist/api/routes.js +1 -1
- package/dist/builtin-memory/crouter-concepts/documents.md +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +2 -1
- package/dist/clients/attach/render/card-presentation.js +2 -2
- package/dist/clients/attach/session/profile-files.js +1 -1
- package/dist/clients/attach/viewer.js +482 -482
- package/dist/clients/dashboard/app.js +2 -2
- package/dist/commands/canvas/share.js +2 -2
- package/dist/commands/doc/shared.d.ts +1 -1
- package/dist/commands/doc/shared.js +1 -1
- package/dist/commands/node/bash.js +4 -4
- package/dist/commands/node-lifecycle-revive.d.ts +10 -0
- package/dist/commands/node-lifecycle-revive.js +1 -1
- package/dist/commands/pkg/plugin-inspect.js +1 -1
- package/dist/commands/profile/list.js +1 -1
- package/dist/commands/profile/project.js +1 -1
- package/dist/commands/profile/show.js +1 -1
- package/dist/commands/sys/panels/profiles-panel.js +1 -1
- package/dist/commands/sys/repo-docs.d.ts +1 -0
- package/dist/commands/sys/repo-docs.js +2 -0
- package/dist/commands/sys/sync-project-guidance.js +5 -5
- package/dist/commands/sys.js +1 -1
- package/dist/core/bash-job-supervisor.js +3 -3
- package/dist/core/bash-jobs.js +5 -5
- package/dist/core/broker-client/transport-relay.d.ts +3 -0
- package/dist/core/broker-client/transport-relay.js +1 -1
- package/dist/core/canvas/db.js +4 -4
- package/dist/core/canvas/export-sqlite.js +1 -1
- package/dist/core/canvas/memory-reads.js +2 -1
- package/dist/core/canvas/schema-pg/021-repo-docs.sql +38 -0
- package/dist/core/canvas/schema-version.d.ts +1 -1
- package/dist/core/canvas/schema-version.js +1 -1
- package/dist/core/canvas/waits.d.ts +2 -0
- package/dist/core/canvas/waits.js +6 -6
- package/dist/core/checkout-identities.d.ts +15 -0
- package/dist/core/checkout-identities.js +3 -0
- package/dist/core/feed/messages.d.ts +5 -2
- package/dist/core/feed/messages.js +10 -5
- package/dist/core/grants/mirror.d.ts +11 -3
- package/dist/core/grants/mirror.js +6 -4
- package/dist/core/grants/on-sync.js +1 -1
- package/dist/core/graph/bodies-boot-copy.d.ts +1 -1
- package/dist/core/graph/bodies-boot-copy.js +1 -1
- package/dist/core/graph/custom.js +9 -9
- package/dist/core/graph/documents.d.ts +1 -1
- package/dist/core/graph/documents.js +11 -11
- package/dist/core/graph/events.d.ts +9 -0
- package/dist/core/graph/events.js +12 -12
- package/dist/core/graph/group-invites.d.ts +10 -0
- package/dist/core/graph/group-invites.js +1 -0
- package/dist/core/graph/groups.d.ts +27 -0
- package/dist/core/graph/groups.js +3 -0
- package/dist/core/graph/kinds/document.js +2 -2
- package/dist/core/graph/kinds/kind.d.ts +2 -1
- package/dist/core/graph/kinds/node.js +1 -1
- package/dist/core/graph/kinds/owner.js +2 -2
- package/dist/core/graph/names.d.ts +6 -5
- package/dist/core/graph/names.js +10 -9
- package/dist/core/graph/objects.d.ts +4 -1
- package/dist/core/graph/objects.js +10 -10
- package/dist/core/graph/package-publish.js +3 -3
- package/dist/core/graph/package-reconcile.js +2 -2
- package/dist/core/graph/reader.d.ts +19 -8
- package/dist/core/graph/reader.js +3 -3
- package/dist/core/graph/repo-sync/exchange.d.ts +0 -11
- package/dist/core/graph/repo-sync/exchange.js +1 -2
- package/dist/core/graph/repo-sync/identity.d.ts +4 -0
- package/dist/core/graph/repo-sync/ref-format.d.ts +0 -29
- package/dist/core/graph/repo-sync/ref-format.js +1 -2
- package/dist/core/graph/repo-sync/repos.d.ts +12 -2
- package/dist/core/graph/repo-sync/repos.js +4 -3
- package/dist/core/graph/types.d.ts +2 -2
- package/dist/core/graph/watches.d.ts +11 -2
- package/dist/core/graph/watches.js +13 -9
- package/dist/core/human/page-schema.d.ts +1 -1
- package/dist/core/human/requests.d.ts +18 -1
- package/dist/core/human/requests.js +20 -18
- package/dist/core/human/scan.d.ts +3 -2
- package/dist/core/human/scan.js +1 -1
- package/dist/core/import/export/stores.js +4 -1
- package/dist/core/import/load/stores.js +2 -2
- package/dist/core/peer/stubs.d.ts +1 -1
- package/dist/core/peer/stubs.js +1 -1
- package/dist/core/permissions/builtin.d.ts +1 -1
- package/dist/core/permissions/builtin.js +4 -2
- package/dist/core/permissions/ceiling.js +9 -9
- package/dist/core/profiles/manifest.d.ts +7 -2
- package/dist/core/profiles/manifest.js +1 -1
- package/dist/core/profiles/select.js +21 -21
- package/dist/core/runtime/bearings-render.js +8 -8
- package/dist/core/runtime/broker/attachments-fetch.d.ts +2 -1
- package/dist/core/runtime/broker/attachments-fetch.js +1 -1
- package/dist/core/runtime/broker/bash-job-launch.js +1 -1
- package/dist/core/runtime/broker/boot-state.d.ts +5 -0
- package/dist/core/runtime/broker/boot-state.js +1 -1
- package/dist/core/runtime/broker/cycle-start.d.ts +50 -0
- package/dist/core/runtime/broker/cycle-start.js +2 -0
- package/dist/core/runtime/broker/fault-retry.js +1 -1
- package/dist/core/runtime/broker/frame-dispatch.d.ts +2 -0
- package/dist/core/runtime/broker/frame-dispatch.js +1 -1
- package/dist/core/runtime/broker/frame-memory-refs.d.ts +2 -0
- package/dist/core/runtime/broker/frame-memory-refs.js +1 -1
- package/dist/core/runtime/broker/job-reporter.d.ts +4 -2
- package/dist/core/runtime/broker/job-reporter.js +2 -2
- package/dist/core/runtime/broker/rebind.d.ts +3 -0
- package/dist/core/runtime/broker/rebind.js +1 -1
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/resume-root.d.ts +1 -0
- package/dist/core/runtime/resume-root.js +7 -7
- package/dist/core/runtime/runner/blaxel/image-build.d.ts +3 -0
- package/dist/core/runtime/runner/blaxel/image-build.js +1 -1
- package/dist/core/runtime/runner/blaxel/release-image.d.ts +37 -0
- package/dist/core/runtime/runner/blaxel/release-image.js +3 -0
- package/dist/core/runtime/runner/blaxel/runner.d.ts +1 -1
- package/dist/core/runtime/runner/machine/call.js +2 -2
- package/dist/core/runtime/runner/machine/executor.d.ts +1 -1
- package/dist/core/runtime/runner/machine/ops.d.ts +11 -1
- package/dist/core/runtime/runner/machine/ops.js +1 -1
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/scope.js +1 -1
- package/dist/core/scoped-state/db.js +2 -2
- package/dist/core/scoped-state/legacy-profiles.js +2 -1
- package/dist/core/scoped-state/person-rows.js +6 -3
- package/dist/core/scoped-state/schema.d.ts +4 -0
- package/dist/core/scoped-state/schema.js +5 -4
- package/dist/core/secrets/blaxel-launch.d.ts +8 -0
- package/dist/core/secrets/blaxel-launch.js +3 -3
- package/dist/core/substrate/delivery/corpus.d.ts +7 -2
- package/dist/core/substrate/delivery/corpus.js +2 -2
- package/dist/core/substrate/delivery/deliver.js +3 -3
- package/dist/core/substrate/delivery/plan.js +2 -3
- package/dist/core/substrate/delivery/render-boot.js +27 -27
- package/dist/core/substrate/delivery/render-event.d.ts +5 -4
- package/dist/core/substrate/delivery/render-event.js +6 -6
- package/dist/core/substrate/subject.js +1 -1
- package/dist/daemon/api/bridge.js +3 -3
- package/dist/daemon/api/canvas-host.d.ts +1 -0
- package/dist/daemon/api/canvas-host.js +1 -1
- package/dist/daemon/api/document-page.js +5 -5
- package/dist/daemon/api/environment-of.d.ts +4 -0
- package/dist/daemon/api/environment-of.js +3 -3
- package/dist/daemon/api/handlers/attach.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.d.ts +2 -0
- package/dist/daemon/api/handlers/bash-jobs.js +3 -3
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/broker-recovery.d.ts +2 -0
- package/dist/daemon/api/handlers/broker-recovery.js +1 -1
- package/dist/daemon/api/handlers/canvas.js +6 -6
- package/dist/daemon/api/handlers/delivery.js +1 -1
- package/dist/daemon/api/handlers/docs.d.ts +1 -12
- package/dist/daemon/api/handlers/docs.js +2 -2
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/memory.js +1 -1
- package/dist/daemon/api/handlers/node-records.d.ts +7 -0
- package/dist/daemon/api/handlers/node-records.js +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/objects.js +1 -1
- package/dist/daemon/api/handlers/profiles.d.ts +1 -1
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/api/handlers/repo-import.d.ts +2 -0
- package/dist/daemon/api/handlers/repo-import.js +2 -0
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/handlers/shares.js +1 -1
- package/dist/daemon/api/map.js +2 -2
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/reader.js +1 -1
- package/dist/daemon/api/repo-plugin.d.ts +12 -0
- package/dist/daemon/api/repo-plugin.js +1 -0
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/boot-migrations.js +1 -1
- package/dist/daemon/cron/authority.d.ts +3 -1
- package/dist/daemon/cron/authority.js +1 -1
- package/dist/daemon/cron/escalation.js +1 -1
- package/dist/daemon/cron/sinks.js +2 -2
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd.js +11 -11
- package/dist/daemon/due-sources.d.ts +1 -1
- package/dist/daemon/due-sources.js +1 -1
- package/dist/daemon/due.js +7 -7
- package/dist/daemon/machine-daemon.js +1 -1
- package/dist/daemon/machine-link/client.d.ts +8 -0
- package/dist/daemon/machine-link/client.js +1 -1
- package/dist/daemon/machine-link/frames.d.ts +18 -0
- package/dist/daemon/machine-link/frames.js +1 -1
- package/dist/daemon/machine-link/holder.d.ts +2 -0
- package/dist/daemon/machine-link/holder.js +5 -5
- package/dist/daemon/machine-link/job-sweep.d.ts +15 -0
- package/dist/daemon/machine-link/job-sweep.js +1 -0
- package/dist/daemon/reconcilers/action-lane.js +1 -1
- package/dist/daemon/reconcilers/bash-deadline.js +1 -1
- package/dist/daemon/reconcilers/group-invite-expiry.d.ts +9 -0
- package/dist/daemon/reconcilers/group-invite-expiry.js +1 -0
- package/dist/daemon/review/finish.js +1 -1
- package/dist/migrations/004-canvas-documents/index.js +2 -2
- package/dist/pi-extensions/canvas-context-intro.js +2 -2
- package/dist/pi-extensions/canvas-doc-substrate.js +4 -4
- package/dist/pi-extensions/canvas-passive-context.d.ts +13 -10
- package/dist/pi-extensions/canvas-passive-context.js +9 -12
- 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 +7 -7
- package/docs/concepts/documents.md +1 -1
- package/package.json +10 -2
- package/packages/crouter-api/dist/api/client.js +1585 -0
- package/packages/crouter-api/dist/api/command-manifest/index.js +4 -0
- package/packages/crouter-api/dist/api/command-manifest/manifest.js +332 -0
- package/packages/crouter-api/dist/api/command-manifest/object-kinds.js +100 -0
- package/packages/crouter-api/dist/api/command-manifest/result.js +166 -0
- package/packages/crouter-api/dist/api/command-manifest/schema.js +934 -0
- package/packages/crouter-api/dist/api/contract.js +57 -0
- package/packages/crouter-api/dist/api/dto/analytics.js +3 -0
- package/packages/crouter-api/dist/api/dto/attach.js +13 -0
- package/packages/crouter-api/dist/api/dto/bash-jobs.js +11 -0
- package/packages/crouter-api/dist/api/dto/bash.js +1 -0
- package/packages/crouter-api/dist/api/dto/broker-ops.js +6 -0
- package/packages/crouter-api/dist/api/dto/broker-signals.js +1 -0
- package/packages/crouter-api/dist/api/dto/broker.js +20 -0
- package/packages/crouter-api/dist/api/dto/canvas.js +2 -0
- package/packages/crouter-api/dist/api/dto/charges.js +4 -0
- package/packages/crouter-api/dist/api/dto/chat-inventory.js +11 -0
- package/packages/crouter-api/dist/api/dto/common.js +15 -0
- package/packages/crouter-api/dist/api/dto/config.js +3 -0
- package/packages/crouter-api/dist/api/dto/crons.js +10 -0
- package/packages/crouter-api/dist/api/dto/custom-objects.js +1 -0
- package/packages/crouter-api/dist/api/dto/delivery.js +7 -0
- package/packages/crouter-api/dist/api/dto/docs.js +8 -0
- package/packages/crouter-api/dist/api/dto/environments.js +2 -0
- package/packages/crouter-api/dist/api/dto/exec.js +1 -0
- package/packages/crouter-api/dist/api/dto/execution-start.js +2 -0
- package/packages/crouter-api/dist/api/dto/files.js +1 -0
- package/packages/crouter-api/dist/api/dto/focus.js +10 -0
- package/packages/crouter-api/dist/api/dto/grants.js +1 -0
- package/packages/crouter-api/dist/api/dto/health.js +2 -0
- package/packages/crouter-api/dist/api/dto/human-requests.js +4 -0
- package/packages/crouter-api/dist/api/dto/human.js +4 -0
- package/packages/crouter-api/dist/api/dto/imports.js +2 -0
- package/packages/crouter-api/dist/api/dto/inbox.js +4 -0
- package/packages/crouter-api/dist/api/dto/lifecycle.js +3 -0
- package/packages/crouter-api/dist/api/dto/limits.js +2 -0
- package/packages/crouter-api/dist/api/dto/mail.js +1 -0
- package/packages/crouter-api/dist/api/dto/messages.js +2 -0
- package/packages/crouter-api/dist/api/dto/model-config.js +1 -0
- package/packages/crouter-api/dist/api/dto/modelauth.js +4 -0
- package/packages/crouter-api/dist/api/dto/node-events.js +4 -0
- package/packages/crouter-api/dist/api/dto/node-outcomes.js +2 -0
- package/packages/crouter-api/dist/api/dto/node-records.js +5 -0
- package/packages/crouter-api/dist/api/dto/nodes.js +3 -0
- package/packages/crouter-api/dist/api/dto/objects.js +5 -0
- package/packages/crouter-api/dist/api/dto/permissions.js +5 -0
- package/packages/crouter-api/dist/api/dto/plugins.js +5 -0
- package/packages/crouter-api/dist/api/dto/profiles.js +8 -0
- package/packages/crouter-api/dist/api/dto/recovery.js +1 -0
- package/packages/crouter-api/dist/api/dto/repo-import.js +5 -0
- package/packages/crouter-api/dist/api/dto/reports.js +2 -0
- package/packages/crouter-api/dist/api/dto/review-comments.js +5 -0
- package/packages/crouter-api/dist/api/dto/reviews.js +5 -0
- package/packages/crouter-api/dist/api/dto/run-events.js +6 -0
- package/packages/crouter-api/dist/api/dto/settings.js +4 -0
- package/packages/crouter-api/dist/api/dto/structured-requests.js +5 -0
- package/packages/crouter-api/dist/api/dto/subscriptions.js +2 -0
- package/packages/crouter-api/dist/api/dto/usage.js +1 -0
- package/packages/crouter-api/dist/api/dto/worktree.js +6 -0
- package/packages/crouter-api/dist/api/error-codes.js +86 -0
- package/packages/crouter-api/dist/api/errors.js +72 -0
- package/packages/crouter-api/dist/api/index.js +55 -0
- package/packages/crouter-api/dist/api/long-poll.js +67 -0
- package/packages/crouter-api/dist/api/node-transport.js +105 -0
- package/packages/crouter-api/dist/api/plugin-manifest-schema.js +23 -0
- package/packages/crouter-api/dist/api/routes.js +233 -0
- package/packages/crouter-api/dist/api/runtime-version.js +50 -0
- package/packages/crouter-api/dist/build-root.js +411 -0
- package/packages/crouter-api/dist/clients/attach/ansi-cells.js +137 -0
- package/packages/crouter-api/dist/clients/attach/chrome/bash-jobs.js +34 -0
- package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +267 -0
- package/packages/crouter-api/dist/clients/attach/chrome/completion-bell.js +89 -0
- package/packages/crouter-api/dist/clients/attach/chrome/cron-wait.js +34 -0
- package/packages/crouter-api/dist/clients/attach/chrome/git-info.js +44 -0
- package/packages/crouter-api/dist/clients/attach/chrome/header.js +30 -0
- package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +219 -0
- package/packages/crouter-api/dist/clients/attach/chrome/key-hint.js +16 -0
- package/packages/crouter-api/dist/clients/attach/chrome/object-wait.js +24 -0
- package/packages/crouter-api/dist/clients/attach/chrome/recap.js +19 -0
- package/packages/crouter-api/dist/clients/attach/chrome/review-wait.js +22 -0
- package/packages/crouter-api/dist/clients/attach/chrome/roster.js +293 -0
- package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +127 -0
- package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +261 -0
- package/packages/crouter-api/dist/clients/attach/chrome/widgets.js +51 -0
- package/packages/crouter-api/dist/clients/attach/command.js +107 -0
- package/packages/crouter-api/dist/clients/attach/config.js +275 -0
- package/packages/crouter-api/dist/clients/attach/input/capabilities.js +112 -0
- package/packages/crouter-api/dist/clients/attach/input/clipboard-image.js +237 -0
- package/packages/crouter-api/dist/clients/attach/input/completion-frecency.js +141 -0
- package/packages/crouter-api/dist/clients/attach/input/controller.js +383 -0
- package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +199 -0
- package/packages/crouter-api/dist/clients/attach/input/ref-autocomplete.js +176 -0
- package/packages/crouter-api/dist/clients/attach/input/titled-editor.js +859 -0
- package/packages/crouter-api/dist/clients/attach/overlays/auth.js +247 -0
- package/packages/crouter-api/dist/clients/attach/overlays/dialogs.js +102 -0
- package/packages/crouter-api/dist/clients/attach/overlays/file-review.js +146 -0
- package/packages/crouter-api/dist/clients/attach/overlays/graph.js +725 -0
- package/packages/crouter-api/dist/clients/attach/overlays/help.js +214 -0
- package/packages/crouter-api/dist/clients/attach/overlays/mcp.js +302 -0
- package/packages/crouter-api/dist/clients/attach/overlays/pickers.js +163 -0
- package/packages/crouter-api/dist/clients/attach/render/activity-slot.js +13 -0
- package/packages/crouter-api/dist/clients/attach/render/assistant-message.js +56 -0
- package/packages/crouter-api/dist/clients/attach/render/card-presentation.js +232 -0
- package/packages/crouter-api/dist/clients/attach/render/chat-view.js +2091 -0
- package/packages/crouter-api/dist/clients/attach/render/condensed-history.js +60 -0
- package/packages/crouter-api/dist/clients/attach/render/context-message.js +63 -0
- package/packages/crouter-api/dist/clients/attach/render/crtr-output.js +721 -0
- package/packages/crouter-api/dist/clients/attach/render/diagram.js +111 -0
- package/packages/crouter-api/dist/clients/attach/render/doc-links.js +78 -0
- package/packages/crouter-api/dist/clients/attach/render/edit-diff.js +304 -0
- package/packages/crouter-api/dist/clients/attach/render/glyph-codepoints.js +42 -0
- package/packages/crouter-api/dist/clients/attach/render/group-activity.js +276 -0
- package/packages/crouter-api/dist/clients/attach/render/group-recap.js +146 -0
- package/packages/crouter-api/dist/clients/attach/render/markdown-source.js +279 -0
- package/packages/crouter-api/dist/clients/attach/render/measured-container.js +322 -0
- package/packages/crouter-api/dist/clients/attach/render/page-block.js +187 -0
- package/packages/crouter-api/dist/clients/attach/render/scroll-animation.js +80 -0
- package/packages/crouter-api/dist/clients/attach/render/tool-calls.js +350 -0
- package/packages/crouter-api/dist/clients/attach/render/transcript-copy.js +81 -0
- package/packages/crouter-api/dist/clients/attach/render/transcript-search.js +152 -0
- package/packages/crouter-api/dist/clients/attach/render/viewport.js +184 -0
- package/packages/crouter-api/dist/clients/attach/session/banner.js +33 -0
- package/packages/crouter-api/dist/clients/attach/session/bindings.js +72 -0
- package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +154 -0
- package/packages/crouter-api/dist/clients/attach/session/connection.js +204 -0
- package/packages/crouter-api/dist/clients/attach/session/context.js +16 -0
- package/packages/crouter-api/dist/clients/attach/session/document-links.js +48 -0
- package/packages/crouter-api/dist/clients/attach/session/editor-frame.js +142 -0
- package/packages/crouter-api/dist/clients/attach/session/editor-inventory.js +156 -0
- package/packages/crouter-api/dist/clients/attach/session/file-links.js +73 -0
- package/packages/crouter-api/dist/clients/attach/session/focus-events.js +12 -0
- package/packages/crouter-api/dist/clients/attach/session/frame.js +214 -0
- package/packages/crouter-api/dist/clients/attach/session/frames.js +203 -0
- package/packages/crouter-api/dist/clients/attach/session/identity.js +26 -0
- package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +150 -0
- package/packages/crouter-api/dist/clients/attach/session/invariant.js +15 -0
- package/packages/crouter-api/dist/clients/attach/session/keys.js +77 -0
- package/packages/crouter-api/dist/clients/attach/session/layout.js +59 -0
- package/packages/crouter-api/dist/clients/attach/session/mouse.js +78 -0
- package/packages/crouter-api/dist/clients/attach/session/pane-focus.js +42 -0
- package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +112 -0
- package/packages/crouter-api/dist/clients/attach/session/pi-assets.js +24 -0
- package/packages/crouter-api/dist/clients/attach/session/pi-oauth-flows.js +21 -0
- package/packages/crouter-api/dist/clients/attach/session/profile-files.js +208 -0
- package/packages/crouter-api/dist/clients/attach/session/readonly-popup.js +25 -0
- package/packages/crouter-api/dist/clients/attach/session/reconnect.js +195 -0
- package/packages/crouter-api/dist/clients/attach/session/selection.js +108 -0
- package/packages/crouter-api/dist/clients/attach/session/state-sync.js +67 -0
- package/packages/crouter-api/dist/clients/attach/session/surface-frame.js +73 -0
- package/packages/crouter-api/dist/clients/attach/session/surface-host.js +256 -0
- package/packages/crouter-api/dist/clients/attach/session/teardown.js +94 -0
- package/packages/crouter-api/dist/clients/attach/session/transcript-search.js +151 -0
- package/packages/crouter-api/dist/clients/attach/session/whip-achievements.js +145 -0
- package/packages/crouter-api/dist/clients/attach/session/whip.js +362 -0
- package/packages/crouter-api/dist/clients/attach/slash/dispatch.js +747 -0
- package/packages/crouter-api/dist/clients/attach/slash/prompt-preview.js +121 -0
- package/packages/crouter-api/dist/clients/attach/viewer.js +881 -0
- package/packages/crouter-api/dist/clients/conversation/projection.js +324 -0
- package/packages/crouter-api/dist/clients/conversation/submit.js +51 -0
- package/packages/crouter-api/dist/clients/dashboard/app.js +439 -0
- package/packages/crouter-api/dist/clients/dashboard/model.js +77 -0
- package/packages/crouter-api/dist/clients/dashboard/render.js +148 -0
- package/packages/crouter-api/dist/clients/inbox/controller.js +791 -0
- package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +93 -0
- package/packages/crouter-api/dist/clients/inbox/layout.js +9 -0
- package/packages/crouter-api/dist/clients/inbox/page-adapter.js +56 -0
- package/packages/crouter-api/dist/clients/inbox/resolve.js +35 -0
- package/packages/crouter-api/dist/clients/inbox/review/anchors.js +89 -0
- package/packages/crouter-api/dist/clients/inbox/review/comments-client.js +103 -0
- package/packages/crouter-api/dist/clients/inbox/review/companion-pane.js +109 -0
- package/packages/crouter-api/dist/clients/inbox/review/document-surface.js +1268 -0
- package/packages/crouter-api/dist/clients/inbox/review/frame.js +309 -0
- package/packages/crouter-api/dist/clients/inbox/review/keys.js +133 -0
- package/packages/crouter-api/dist/clients/inbox/review/launch.js +170 -0
- package/packages/crouter-api/dist/clients/inbox/review/live-source.js +160 -0
- package/packages/crouter-api/dist/clients/inbox/review/nvim.js +43 -0
- package/packages/crouter-api/dist/clients/inbox/review/remap.js +157 -0
- package/packages/crouter-api/dist/clients/inbox/review/review-client.js +123 -0
- package/packages/crouter-api/dist/clients/inbox/review/roundtrip.js +41 -0
- package/packages/crouter-api/dist/clients/inbox/review/state.js +315 -0
- package/packages/crouter-api/dist/clients/inbox/review-adapter.js +43 -0
- package/packages/crouter-api/dist/clients/inbox/surface.js +190 -0
- package/packages/crouter-api/dist/clients/inbox/tui/ansi.js +321 -0
- package/packages/crouter-api/dist/clients/inbox/tui/input.js +392 -0
- package/packages/crouter-api/dist/clients/inbox/tui/keys.js +104 -0
- package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +69 -0
- package/packages/crouter-api/dist/clients/inbox/tui/panel.js +92 -0
- package/packages/crouter-api/dist/clients/inbox/tui/render.js +389 -0
- package/packages/crouter-api/dist/clients/inbox/tui/slots.js +134 -0
- package/packages/crouter-api/dist/clients/inbox/tui/types.js +1 -0
- package/packages/crouter-api/dist/clients/inbox/tui.js +91 -0
- package/packages/crouter-api/dist/clients/surfaces/host.js +1 -0
- package/packages/crouter-api/dist/commands/api-client.js +438 -0
- package/packages/crouter-api/dist/commands/attention.js +215 -0
- package/packages/crouter-api/dist/commands/canvas/edges.js +41 -0
- package/packages/crouter-api/dist/commands/canvas/list.js +79 -0
- package/packages/crouter-api/dist/commands/canvas/read.js +95 -0
- package/packages/crouter-api/dist/commands/canvas/search.js +49 -0
- package/packages/crouter-api/dist/commands/canvas/share.js +80 -0
- package/packages/crouter-api/dist/commands/canvas/unwatch.js +42 -0
- package/packages/crouter-api/dist/commands/canvas/watch.js +63 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/chart.js +124 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/drilldown.js +96 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/format.js +106 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/graph-detail.js +307 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/graphs.js +365 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/memory.js +211 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/overview.js +189 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/shell.js +416 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/time.js +228 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/usage.js +305 -0
- package/packages/crouter-api/dist/commands/canvas-analytics/view.js +102 -0
- package/packages/crouter-api/dist/commands/canvas-analytics.js +28 -0
- package/packages/crouter-api/dist/commands/canvas-browse.js +71 -0
- package/packages/crouter-api/dist/commands/canvas-config.js +192 -0
- package/packages/crouter-api/dist/commands/canvas-history/grep.js +85 -0
- package/packages/crouter-api/dist/commands/canvas-history/read.js +48 -0
- package/packages/crouter-api/dist/commands/canvas-history/search.js +99 -0
- package/packages/crouter-api/dist/commands/canvas-history/shared.js +135 -0
- package/packages/crouter-api/dist/commands/canvas-history/stats.js +68 -0
- package/packages/crouter-api/dist/commands/canvas-history.js +29 -0
- package/packages/crouter-api/dist/commands/canvas-issue.js +148 -0
- package/packages/crouter-api/dist/commands/canvas-prune.js +111 -0
- package/packages/crouter-api/dist/commands/canvas-roster.js +69 -0
- package/packages/crouter-api/dist/commands/canvas-snapshot.js +34 -0
- package/packages/crouter-api/dist/commands/canvas-use.js +61 -0
- package/packages/crouter-api/dist/commands/canvas.js +57 -0
- package/packages/crouter-api/dist/commands/chord.js +242 -0
- package/packages/crouter-api/dist/commands/cron.js +541 -0
- package/packages/crouter-api/dist/commands/custom-object/ack.js +30 -0
- package/packages/crouter-api/dist/commands/custom-object/publish.js +39 -0
- package/packages/crouter-api/dist/commands/custom-object/receive.js +69 -0
- package/packages/crouter-api/dist/commands/custom-object/register.js +69 -0
- package/packages/crouter-api/dist/commands/custom-object/shared.js +14 -0
- package/packages/crouter-api/dist/commands/custom-object/unregister.js +26 -0
- package/packages/crouter-api/dist/commands/custom-object.js +21 -0
- package/packages/crouter-api/dist/commands/dashboard.js +86 -0
- package/packages/crouter-api/dist/commands/doc/delete.js +30 -0
- package/packages/crouter-api/dist/commands/doc/edit.js +83 -0
- package/packages/crouter-api/dist/commands/doc/history.js +38 -0
- package/packages/crouter-api/dist/commands/doc/lint.js +36 -0
- package/packages/crouter-api/dist/commands/doc/list.js +19 -0
- package/packages/crouter-api/dist/commands/doc/move.js +37 -0
- package/packages/crouter-api/dist/commands/doc/read.js +19 -0
- package/packages/crouter-api/dist/commands/doc/replace-blocks.js +40 -0
- package/packages/crouter-api/dist/commands/doc/shared.js +156 -0
- package/packages/crouter-api/dist/commands/doc/write.js +53 -0
- package/packages/crouter-api/dist/commands/doc.js +27 -0
- package/packages/crouter-api/dist/commands/human/components.js +78 -0
- package/packages/crouter-api/dist/commands/human/feedback.js +112 -0
- package/packages/crouter-api/dist/commands/human/prompts.js +326 -0
- package/packages/crouter-api/dist/commands/human/queue.js +191 -0
- package/packages/crouter-api/dist/commands/human/request.js +266 -0
- package/packages/crouter-api/dist/commands/human/review.js +288 -0
- package/packages/crouter-api/dist/commands/human/shared.js +67 -0
- package/packages/crouter-api/dist/commands/human.js +63 -0
- package/packages/crouter-api/dist/commands/node/bash.js +395 -0
- package/packages/crouter-api/dist/commands/node/create.js +363 -0
- package/packages/crouter-api/dist/commands/node/inspect.js +288 -0
- package/packages/crouter-api/dist/commands/node/lifecycle.js +577 -0
- package/packages/crouter-api/dist/commands/node/message.js +170 -0
- package/packages/crouter-api/dist/commands/node/outcome.js +133 -0
- package/packages/crouter-api/dist/commands/node/pyramid.js +79 -0
- package/packages/crouter-api/dist/commands/node/subscription.js +78 -0
- package/packages/crouter-api/dist/commands/node/wait.js +165 -0
- package/packages/crouter-api/dist/commands/node-context.js +145 -0
- package/packages/crouter-api/dist/commands/node-lifecycle-revive.js +224 -0
- package/packages/crouter-api/dist/commands/node-snapshot.js +37 -0
- package/packages/crouter-api/dist/commands/node-transcript.js +59 -0
- package/packages/crouter-api/dist/commands/node-worktree.js +138 -0
- package/packages/crouter-api/dist/commands/node.js +29 -0
- package/packages/crouter-api/dist/commands/person-settings.js +23 -0
- package/packages/crouter-api/dist/commands/pkg/app-installs.js +125 -0
- package/packages/crouter-api/dist/commands/pkg/browse/actions.js +198 -0
- package/packages/crouter-api/dist/commands/pkg/browse/catalog.js +461 -0
- package/packages/crouter-api/dist/commands/pkg/browse/command-view.js +217 -0
- package/packages/crouter-api/dist/commands/pkg/browse/detail-panel.js +402 -0
- package/packages/crouter-api/dist/commands/pkg/browse/doc-view.js +84 -0
- package/packages/crouter-api/dist/commands/pkg/browse/list-panel.js +168 -0
- package/packages/crouter-api/dist/commands/pkg/browse/model.js +36 -0
- package/packages/crouter-api/dist/commands/pkg/browse/shell.js +640 -0
- package/packages/crouter-api/dist/commands/pkg/browse.js +27 -0
- package/packages/crouter-api/dist/commands/pkg/market-inspect.js +145 -0
- package/packages/crouter-api/dist/commands/pkg/market-manage.js +340 -0
- package/packages/crouter-api/dist/commands/pkg/market.js +14 -0
- package/packages/crouter-api/dist/commands/pkg/plugin-env.js +65 -0
- package/packages/crouter-api/dist/commands/pkg/plugin-inspect.js +178 -0
- package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +1039 -0
- package/packages/crouter-api/dist/commands/pkg/plugin.js +14 -0
- package/packages/crouter-api/dist/commands/pkg/shared.js +62 -0
- package/packages/crouter-api/dist/commands/pkg.js +21 -0
- package/packages/crouter-api/dist/commands/profile/daemon-profiles.js +38 -0
- package/packages/crouter-api/dist/commands/profile/default.js +183 -0
- package/packages/crouter-api/dist/commands/profile/delete.js +66 -0
- package/packages/crouter-api/dist/commands/profile/env.js +188 -0
- package/packages/crouter-api/dist/commands/profile/environment.js +88 -0
- package/packages/crouter-api/dist/commands/profile/kind.js +27 -0
- package/packages/crouter-api/dist/commands/profile/list.js +45 -0
- package/packages/crouter-api/dist/commands/profile/meta.js +65 -0
- package/packages/crouter-api/dist/commands/profile/new.js +107 -0
- package/packages/crouter-api/dist/commands/profile/pause.js +59 -0
- package/packages/crouter-api/dist/commands/profile/project.js +146 -0
- package/packages/crouter-api/dist/commands/profile/rename.js +41 -0
- package/packages/crouter-api/dist/commands/profile/show.js +55 -0
- package/packages/crouter-api/dist/commands/profile.js +36 -0
- package/packages/crouter-api/dist/commands/push.js +357 -0
- package/packages/crouter-api/dist/commands/revive.js +183 -0
- package/packages/crouter-api/dist/commands/surface/node/cycle.js +83 -0
- package/packages/crouter-api/dist/commands/surface/node/focus.js +60 -0
- package/packages/crouter-api/dist/commands/surface/node/id.js +38 -0
- package/packages/crouter-api/dist/commands/surface/node/pin.js +42 -0
- package/packages/crouter-api/dist/commands/surface/node/placement.js +49 -0
- package/packages/crouter-api/dist/commands/surface-dashboard.js +138 -0
- package/packages/crouter-api/dist/commands/surface-edit.js +157 -0
- package/packages/crouter-api/dist/commands/surface-inbox.js +98 -0
- package/packages/crouter-api/dist/commands/surface-inspect.js +41 -0
- package/packages/crouter-api/dist/commands/surface-node.js +19 -0
- package/packages/crouter-api/dist/commands/surface-reload.js +129 -0
- package/packages/crouter-api/dist/commands/surface-tmux-spread.js +214 -0
- package/packages/crouter-api/dist/commands/surface.js +29 -0
- package/packages/crouter-api/dist/commands/sys/branch.js +19 -0
- package/packages/crouter-api/dist/commands/sys/config.js +353 -0
- package/packages/crouter-api/dist/commands/sys/connect.js +185 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/actions.js +89 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/detail-panel.js +233 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/docs-panel.js +185 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/list-view.js +170 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/model.js +179 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/rail-panel.js +229 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/read-view.js +172 -0
- package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +870 -0
- package/packages/crouter-api/dist/commands/sys/context/admin.js +148 -0
- package/packages/crouter-api/dist/commands/sys/context/doc.js +126 -0
- package/packages/crouter-api/dist/commands/sys/context/expose.js +66 -0
- package/packages/crouter-api/dist/commands/sys/context/prompt-review.js +244 -0
- package/packages/crouter-api/dist/commands/sys/context/resolve.js +326 -0
- package/packages/crouter-api/dist/commands/sys/context/sysprompt.js +95 -0
- package/packages/crouter-api/dist/commands/sys/context.js +21 -0
- package/packages/crouter-api/dist/commands/sys/daemon.js +351 -0
- package/packages/crouter-api/dist/commands/sys/db.js +69 -0
- package/packages/crouter-api/dist/commands/sys/desktop.js +201 -0
- package/packages/crouter-api/dist/commands/sys/doctor.js +633 -0
- package/packages/crouter-api/dist/commands/sys/env.js +39 -0
- package/packages/crouter-api/dist/commands/sys/feedback.js +228 -0
- package/packages/crouter-api/dist/commands/sys/import/move.js +393 -0
- package/packages/crouter-api/dist/commands/sys/import/resume.js +23 -0
- package/packages/crouter-api/dist/commands/sys/import/start.js +92 -0
- package/packages/crouter-api/dist/commands/sys/join.js +85 -0
- package/packages/crouter-api/dist/commands/sys/limits.js +133 -0
- package/packages/crouter-api/dist/commands/sys/logs.js +129 -0
- package/packages/crouter-api/dist/commands/sys/machine/rotate.js +49 -0
- package/packages/crouter-api/dist/commands/sys/migrate.js +79 -0
- package/packages/crouter-api/dist/commands/sys/panels/broker-limits-panel.js +110 -0
- package/packages/crouter-api/dist/commands/sys/panels/dependencies-panel.js +80 -0
- package/packages/crouter-api/dist/commands/sys/panels/keybindings-panel.js +703 -0
- package/packages/crouter-api/dist/commands/sys/panels/models-panel.js +1160 -0
- package/packages/crouter-api/dist/commands/sys/panels/plugin-env-panel.js +70 -0
- package/packages/crouter-api/dist/commands/sys/panels/plugins-panel.js +87 -0
- package/packages/crouter-api/dist/commands/sys/panels/prefs-panel.js +97 -0
- package/packages/crouter-api/dist/commands/sys/panels/profiles-panel.js +656 -0
- package/packages/crouter-api/dist/commands/sys/panels/provider-panel.js +534 -0
- package/packages/crouter-api/dist/commands/sys/panels/terminal-panel.js +67 -0
- package/packages/crouter-api/dist/commands/sys/provider-login.js +99 -0
- package/packages/crouter-api/dist/commands/sys/repo-docs.js +96 -0
- package/packages/crouter-api/dist/commands/sys/retry-delivery.js +33 -0
- package/packages/crouter-api/dist/commands/sys/settings-shell.js +400 -0
- package/packages/crouter-api/dist/commands/sys/settings.js +46 -0
- package/packages/crouter-api/dist/commands/sys/setup-core.js +890 -0
- package/packages/crouter-api/dist/commands/sys/setup-settings-runner.js +15 -0
- package/packages/crouter-api/dist/commands/sys/setup-wizard.js +351 -0
- package/packages/crouter-api/dist/commands/sys/setup.js +41 -0
- package/packages/crouter-api/dist/commands/sys/shared.js +81 -0
- package/packages/crouter-api/dist/commands/sys/signin.js +149 -0
- package/packages/crouter-api/dist/commands/sys/spaces.js +22 -0
- package/packages/crouter-api/dist/commands/sys/spend.js +144 -0
- package/packages/crouter-api/dist/commands/sys/support/prepare.js +239 -0
- package/packages/crouter-api/dist/commands/sys/support/submit.js +524 -0
- package/packages/crouter-api/dist/commands/sys/support.js +18 -0
- package/packages/crouter-api/dist/commands/sys/sync-deps.js +445 -0
- package/packages/crouter-api/dist/commands/sys/sync-project-guidance.js +320 -0
- package/packages/crouter-api/dist/commands/sys/sync-shared.js +139 -0
- package/packages/crouter-api/dist/commands/sys/sync-skills.js +297 -0
- package/packages/crouter-api/dist/commands/sys/sync.js +17 -0
- package/packages/crouter-api/dist/commands/sys/terminal-option.js +542 -0
- package/packages/crouter-api/dist/commands/sys/tutorial/branch.js +15 -0
- package/packages/crouter-api/dist/commands/sys/tutorial/lessons.js +107 -0
- package/packages/crouter-api/dist/commands/sys/tutorial/scenario.js +431 -0
- package/packages/crouter-api/dist/commands/sys/tutorial/tracks.js +96 -0
- package/packages/crouter-api/dist/commands/sys/update.js +157 -0
- package/packages/crouter-api/dist/commands/sys/worktrees.js +53 -0
- package/packages/crouter-api/dist/commands/sys.js +32 -0
- package/packages/crouter-api/dist/core/activity-signal.js +38 -0
- package/packages/crouter-api/dist/core/asset-root.js +18 -0
- package/packages/crouter-api/dist/core/async-array.js +48 -0
- package/packages/crouter-api/dist/core/auth-file.js +89 -0
- package/packages/crouter-api/dist/core/auth-interaction.js +94 -0
- package/packages/crouter-api/dist/core/bash-guard.js +527 -0
- package/packages/crouter-api/dist/core/bash-job-supervisor.js +157 -0
- package/packages/crouter-api/dist/core/bash-jobs.js +460 -0
- package/packages/crouter-api/dist/core/blobs/directory.js +264 -0
- package/packages/crouter-api/dist/core/blobs/fault.js +6 -0
- package/packages/crouter-api/dist/core/blobs/index.js +30 -0
- package/packages/crouter-api/dist/core/blobs/r2.js +169 -0
- package/packages/crouter-api/dist/core/broker-client/client.js +184 -0
- package/packages/crouter-api/dist/core/broker-client/index.js +14 -0
- package/packages/crouter-api/dist/core/broker-client/transport-relay.js +186 -0
- package/packages/crouter-api/dist/core/broker-client/transport-socket.js +187 -0
- package/packages/crouter-api/dist/core/broker-client/transport.js +40 -0
- package/packages/crouter-api/dist/core/canvas/app-run.js +4 -0
- package/packages/crouter-api/dist/core/canvas/attention.js +47 -0
- package/packages/crouter-api/dist/core/canvas/boot-id.js +26 -0
- package/packages/crouter-api/dist/core/canvas/browse/app.js +1050 -0
- package/packages/crouter-api/dist/core/canvas/browse/model.js +477 -0
- package/packages/crouter-api/dist/core/canvas/browse/pins.js +29 -0
- package/packages/crouter-api/dist/core/canvas/browse/render.js +1058 -0
- package/packages/crouter-api/dist/core/canvas/canvas.js +1225 -0
- package/packages/crouter-api/dist/core/canvas/crons.js +541 -0
- package/packages/crouter-api/dist/core/canvas/daemon-actions.js +98 -0
- package/packages/crouter-api/dist/core/canvas/db.js +429 -0
- package/packages/crouter-api/dist/core/canvas/deliveries.js +398 -0
- package/packages/crouter-api/dist/core/canvas/delivery-contract.js +30 -0
- package/packages/crouter-api/dist/core/canvas/executions.js +279 -0
- package/packages/crouter-api/dist/core/canvas/extensions.js +90 -0
- package/packages/crouter-api/dist/core/canvas/focuses.js +82 -0
- package/packages/crouter-api/dist/core/canvas/history.js +480 -0
- package/packages/crouter-api/dist/core/canvas/index.js +16 -0
- package/packages/crouter-api/dist/core/canvas/install-id.js +64 -0
- package/packages/crouter-api/dist/core/canvas/labels.js +43 -0
- package/packages/crouter-api/dist/core/canvas/legacy-person.js +4 -0
- package/packages/crouter-api/dist/core/canvas/memory-reads.js +37 -0
- package/packages/crouter-api/dist/core/canvas/meta-file.js +89 -0
- package/packages/crouter-api/dist/core/canvas/nav-render.js +224 -0
- package/packages/crouter-api/dist/core/canvas/node-agent-paths.js +30 -0
- package/packages/crouter-api/dist/core/canvas/node-order.js +37 -0
- package/packages/crouter-api/dist/core/canvas/node-recap.js +62 -0
- package/packages/crouter-api/dist/core/canvas/node-tokens.js +53 -0
- package/packages/crouter-api/dist/core/canvas/outcome-actions.js +71 -0
- package/packages/crouter-api/dist/core/canvas/paths.js +167 -0
- package/packages/crouter-api/dist/core/canvas/person-state.js +41 -0
- package/packages/crouter-api/dist/core/canvas/person.js +251 -0
- package/packages/crouter-api/dist/core/canvas/pid.js +977 -0
- package/packages/crouter-api/dist/core/canvas/reconciler-leases.js +40 -0
- package/packages/crouter-api/dist/core/canvas/recovery.js +715 -0
- package/packages/crouter-api/dist/core/canvas/remote-canvas-source.js +290 -0
- package/packages/crouter-api/dist/core/canvas/remote-transport.js +57 -0
- package/packages/crouter-api/dist/core/canvas/render-source.js +518 -0
- package/packages/crouter-api/dist/core/canvas/schema-chain.js +110 -0
- package/packages/crouter-api/dist/core/canvas/schema-version.js +58 -0
- package/packages/crouter-api/dist/core/canvas/sessions.js +128 -0
- package/packages/crouter-api/dist/core/canvas/source.js +57 -0
- package/packages/crouter-api/dist/core/canvas/status-glyph.js +132 -0
- package/packages/crouter-api/dist/core/canvas/structured-requests.js +176 -0
- package/packages/crouter-api/dist/core/canvas/telemetry.js +35 -0
- package/packages/crouter-api/dist/core/canvas/tree.js +128 -0
- package/packages/crouter-api/dist/core/canvas/types.js +6 -0
- package/packages/crouter-api/dist/core/canvas/waits.js +113 -0
- package/packages/crouter-api/dist/core/canvas/worktrees.js +97 -0
- package/packages/crouter-api/dist/core/checkout-identities.js +88 -0
- package/packages/crouter-api/dist/core/clipboard-text.js +57 -0
- package/packages/crouter-api/dist/core/command-hooks/artifact.js +145 -0
- package/packages/crouter-api/dist/core/command-hooks/catalog.js +38 -0
- package/packages/crouter-api/dist/core/command-hooks/compose.js +101 -0
- package/packages/crouter-api/dist/core/command-hooks/discovery.js +246 -0
- package/packages/crouter-api/dist/core/command-hooks/help.js +18 -0
- package/packages/crouter-api/dist/core/command-hooks/lifecycle-catalog.js +9 -0
- package/packages/crouter-api/dist/core/command-hooks/lifecycle-create.js +51 -0
- package/packages/crouter-api/dist/core/command-hooks/report.js +28 -0
- package/packages/crouter-api/dist/core/command-hooks/schema.js +157 -0
- package/packages/crouter-api/dist/core/command-hooks/transport/exec-invoke.js +315 -0
- package/packages/crouter-api/dist/core/command-hooks/transport/exec-lifecycle.js +248 -0
- package/packages/crouter-api/dist/core/command-hooks/transport/plan.js +30 -0
- package/packages/crouter-api/dist/core/command-manifests/registry.js +118 -0
- package/packages/crouter-api/dist/core/command-plugins/bundle.js +604 -0
- package/packages/crouter-api/dist/core/command-plugins/caller-header.js +15 -0
- package/packages/crouter-api/dist/core/command-plugins/compose.js +243 -0
- package/packages/crouter-api/dist/core/command-plugins/discovery.js +240 -0
- package/packages/crouter-api/dist/core/command-plugins/endpoint.js +60 -0
- package/packages/crouter-api/dist/core/command-plugins/extensions.js +166 -0
- package/packages/crouter-api/dist/core/command-plugins/help-addenda.js +55 -0
- package/packages/crouter-api/dist/core/command-plugins/presence.js +36 -0
- package/packages/crouter-api/dist/core/command-plugins/transport/exec-invoke.js +138 -0
- package/packages/crouter-api/dist/core/command-plugins/transport/http-fetch.js +68 -0
- package/packages/crouter-api/dist/core/command-plugins/transport/http-invoke.js +333 -0
- package/packages/crouter-api/dist/core/command-plugins/transport/http-plan.js +349 -0
- package/packages/crouter-api/dist/core/command-plugins/transport/sign.js +115 -0
- package/packages/crouter-api/dist/core/command.js +848 -0
- package/packages/crouter-api/dist/core/config.js +1154 -0
- package/packages/crouter-api/dist/core/conversation-store/client.js +111 -0
- package/packages/crouter-api/dist/core/conversation-store/index.js +62 -0
- package/packages/crouter-api/dist/core/conversation-store/patch.js +192 -0
- package/packages/crouter-api/dist/core/conversation-store/repair.js +84 -0
- package/packages/crouter-api/dist/core/conversation-store/row-store.js +365 -0
- package/packages/crouter-api/dist/core/directory/issuer.js +15 -0
- package/packages/crouter-api/dist/core/directory/join-lock.js +61 -0
- package/packages/crouter-api/dist/core/directory/join.js +218 -0
- package/packages/crouter-api/dist/core/directory/person-credential.js +220 -0
- package/packages/crouter-api/dist/core/directory/reach.js +19 -0
- package/packages/crouter-api/dist/core/document-lines.js +6 -0
- package/packages/crouter-api/dist/core/editor-resolver.js +77 -0
- package/packages/crouter-api/dist/core/env-name.js +25 -0
- package/packages/crouter-api/dist/core/environment-recipe.js +59 -0
- package/packages/crouter-api/dist/core/environments.js +59 -0
- package/packages/crouter-api/dist/core/errors.js +90 -0
- package/packages/crouter-api/dist/core/events/emit.js +44 -0
- package/packages/crouter-api/dist/core/events/envelope.js +84 -0
- package/packages/crouter-api/dist/core/events/errors.js +69 -0
- package/packages/crouter-api/dist/core/events/operation-id.js +24 -0
- package/packages/crouter-api/dist/core/events/outbound.js +92 -0
- package/packages/crouter-api/dist/core/events/read.js +625 -0
- package/packages/crouter-api/dist/core/events/serialize.js +199 -0
- package/packages/crouter-api/dist/core/events/source.js +31 -0
- package/packages/crouter-api/dist/core/events/types.js +11 -0
- package/packages/crouter-api/dist/core/exclusive-lock.js +197 -0
- package/packages/crouter-api/dist/core/fault-classifier.js +101 -0
- package/packages/crouter-api/dist/core/feed/feed.js +190 -0
- package/packages/crouter-api/dist/core/feed/inbox.js +93 -0
- package/packages/crouter-api/dist/core/feed/messages.js +219 -0
- package/packages/crouter-api/dist/core/feed/reports.js +58 -0
- package/packages/crouter-api/dist/core/frontmatter.js +35 -0
- package/packages/crouter-api/dist/core/fs-utils.js +263 -0
- package/packages/crouter-api/dist/core/git.js +103 -0
- package/packages/crouter-api/dist/core/grants/cover.js +66 -0
- package/packages/crouter-api/dist/core/grants/hosted-endpoint.js +70 -0
- package/packages/crouter-api/dist/core/grants/local.js +26 -0
- package/packages/crouter-api/dist/core/grants/mirror.js +464 -0
- package/packages/crouter-api/dist/core/grants/on-sync.js +163 -0
- package/packages/crouter-api/dist/core/grants/sandboxes.js +24 -0
- package/packages/crouter-api/dist/core/grants/sync.js +216 -0
- package/packages/crouter-api/dist/core/grants/terminal.js +25 -0
- package/packages/crouter-api/dist/core/graph/access.js +37 -0
- package/packages/crouter-api/dist/core/graph/bodies.js +68 -0
- package/packages/crouter-api/dist/core/graph/custom.js +298 -0
- package/packages/crouter-api/dist/core/graph/deletion.js +115 -0
- package/packages/crouter-api/dist/core/graph/documents.js +675 -0
- package/packages/crouter-api/dist/core/graph/edges.js +83 -0
- package/packages/crouter-api/dist/core/graph/events.js +432 -0
- package/packages/crouter-api/dist/core/graph/exposures.js +164 -0
- package/packages/crouter-api/dist/core/graph/jobs.js +184 -0
- package/packages/crouter-api/dist/core/graph/kinds/action.js +20 -0
- package/packages/crouter-api/dist/core/graph/kinds/custom.js +25 -0
- package/packages/crouter-api/dist/core/graph/kinds/document.js +132 -0
- package/packages/crouter-api/dist/core/graph/kinds/dto.js +20 -0
- package/packages/crouter-api/dist/core/graph/kinds/environment.js +21 -0
- package/packages/crouter-api/dist/core/graph/kinds/job.js +24 -0
- package/packages/crouter-api/dist/core/graph/kinds/kind.js +15 -0
- package/packages/crouter-api/dist/core/graph/kinds/live-read.js +11 -0
- package/packages/crouter-api/dist/core/graph/kinds/node.js +87 -0
- package/packages/crouter-api/dist/core/graph/kinds/owner.js +26 -0
- package/packages/crouter-api/dist/core/graph/kinds/registry.js +58 -0
- package/packages/crouter-api/dist/core/graph/kinds/render.js +17 -0
- package/packages/crouter-api/dist/core/graph/names.js +239 -0
- package/packages/crouter-api/dist/core/graph/objects.js +292 -0
- package/packages/crouter-api/dist/core/graph/package-docs.js +148 -0
- package/packages/crouter-api/dist/core/graph/package-files.js +146 -0
- package/packages/crouter-api/dist/core/graph/package-publish.js +158 -0
- package/packages/crouter-api/dist/core/graph/package-reconcile.js +99 -0
- package/packages/crouter-api/dist/core/graph/reader.js +284 -0
- package/packages/crouter-api/dist/core/graph/receiver-url.js +83 -0
- package/packages/crouter-api/dist/core/graph/receivers.js +66 -0
- package/packages/crouter-api/dist/core/graph/repo-sync/identity.js +147 -0
- package/packages/crouter-api/dist/core/graph/repo-sync/repos.js +94 -0
- package/packages/crouter-api/dist/core/graph/rules.js +144 -0
- package/packages/crouter-api/dist/core/graph/types.js +10 -0
- package/packages/crouter-api/dist/core/graph/watches.js +223 -0
- package/packages/crouter-api/dist/core/help.js +445 -0
- package/packages/crouter-api/dist/core/human/action-binding.js +41 -0
- package/packages/crouter-api/dist/core/human/answer-text.js +100 -0
- package/packages/crouter-api/dist/core/human/answer.js +119 -0
- package/packages/crouter-api/dist/core/human/completion.js +27 -0
- package/packages/crouter-api/dist/core/human/component-docs.js +442 -0
- package/packages/crouter-api/dist/core/human/convention.js +75 -0
- package/packages/crouter-api/dist/core/human/feedback-companion.js +92 -0
- package/packages/crouter-api/dist/core/human/feedback.js +88 -0
- package/packages/crouter-api/dist/core/human/page-authoring.js +19 -0
- package/packages/crouter-api/dist/core/human/page-catalog.js +172 -0
- package/packages/crouter-api/dist/core/human/page-errors.js +14 -0
- package/packages/crouter-api/dist/core/human/page-eval.js +125 -0
- package/packages/crouter-api/dist/core/human/page-html-markdown.js +260 -0
- package/packages/crouter-api/dist/core/human/page-markdown.js +295 -0
- package/packages/crouter-api/dist/core/human/page-schema.js +381 -0
- package/packages/crouter-api/dist/core/human/page.js +251 -0
- package/packages/crouter-api/dist/core/human/request-files.js +54 -0
- package/packages/crouter-api/dist/core/human/requests.js +647 -0
- package/packages/crouter-api/dist/core/human/root.js +11 -0
- package/packages/crouter-api/dist/core/human/summary.js +5 -0
- package/packages/crouter-api/dist/core/human/tickets.js +175 -0
- package/packages/crouter-api/dist/core/human/types.js +1 -0
- package/packages/crouter-api/dist/core/human/visible-paths.js +74 -0
- package/packages/crouter-api/dist/core/human-actions.js +101 -0
- package/packages/crouter-api/dist/core/import/bundle/blob-keys.js +25 -0
- package/packages/crouter-api/dist/core/import/bundle/layout.js +111 -0
- package/packages/crouter-api/dist/core/import/export/archive.js +22 -0
- package/packages/crouter-api/dist/core/import/export/cloud.js +164 -0
- package/packages/crouter-api/dist/core/import/export/dump.js +245 -0
- package/packages/crouter-api/dist/core/import/export/files.js +169 -0
- package/packages/crouter-api/dist/core/import/export/inline.js +15 -0
- package/packages/crouter-api/dist/core/import/export/source.js +5 -0
- package/packages/crouter-api/dist/core/import/export/stores.js +73 -0
- package/packages/crouter-api/dist/core/import/load/catalog.js +70 -0
- package/packages/crouter-api/dist/core/import/load/copy.js +132 -0
- package/packages/crouter-api/dist/core/import/load/prepare.js +211 -0
- package/packages/crouter-api/dist/core/import/load/rewrite.js +310 -0
- package/packages/crouter-api/dist/core/import/load/stage.js +99 -0
- package/packages/crouter-api/dist/core/inspector/chrome.js +14 -0
- package/packages/crouter-api/dist/core/inspector/contract.js +1 -0
- package/packages/crouter-api/dist/core/inspector/core.js +296 -0
- package/packages/crouter-api/dist/core/inspector/host.js +538 -0
- package/packages/crouter-api/dist/core/inspector/model.js +225 -0
- package/packages/crouter-api/dist/core/inspector/text.js +45 -0
- package/packages/crouter-api/dist/core/inspector/transport.js +36 -0
- package/packages/crouter-api/dist/core/inspector/tui.js +295 -0
- package/packages/crouter-api/dist/core/installed-plugins.js +82 -0
- package/packages/crouter-api/dist/core/io.js +470 -0
- package/packages/crouter-api/dist/core/keybindings/attach-control.js +42 -0
- package/packages/crouter-api/dist/core/keybindings/background-bash.js +33 -0
- package/packages/crouter-api/dist/core/keybindings/catalog.js +288 -0
- package/packages/crouter-api/dist/core/keybindings/inbox.js +25 -0
- package/packages/crouter-api/dist/core/keybindings/index.js +7 -0
- package/packages/crouter-api/dist/core/keybindings/match.js +146 -0
- package/packages/crouter-api/dist/core/keybindings/persistence.js +49 -0
- package/packages/crouter-api/dist/core/keybindings/resolve.js +348 -0
- package/packages/crouter-api/dist/core/keybindings/types.js +1 -0
- package/packages/crouter-api/dist/core/layout-migrate/index.js +523 -0
- package/packages/crouter-api/dist/core/layout-migrate/paths.js +118 -0
- package/packages/crouter-api/dist/core/layout-migrate/stored-paths.js +424 -0
- package/packages/crouter-api/dist/core/layout-migrate/stores.js +543 -0
- package/packages/crouter-api/dist/core/layout.js +143 -0
- package/packages/crouter-api/dist/core/ledger/account.js +13 -0
- package/packages/crouter-api/dist/core/ledger/charges.js +44 -0
- package/packages/crouter-api/dist/core/ledger/check.js +40 -0
- package/packages/crouter-api/dist/core/ledger/chunks.js +43 -0
- package/packages/crouter-api/dist/core/ledger/index.js +10 -0
- package/packages/crouter-api/dist/core/ledger/infra-allowance.js +31 -0
- package/packages/crouter-api/dist/core/ledger/limits.js +35 -0
- package/packages/crouter-api/dist/core/ledger/months.js +19 -0
- package/packages/crouter-api/dist/core/ledger/payer.js +14 -0
- package/packages/crouter-api/dist/core/ledger/rates.js +64 -0
- package/packages/crouter-api/dist/core/ledger/read.js +194 -0
- package/packages/crouter-api/dist/core/ledger/totals.js +34 -0
- package/packages/crouter-api/dist/core/ledger/types.js +2 -0
- package/packages/crouter-api/dist/core/llm/app-rungs.js +64 -0
- package/packages/crouter-api/dist/core/llm/body-limits.js +7 -0
- package/packages/crouter-api/dist/core/llm/owner-candidates.js +79 -0
- package/packages/crouter-api/dist/core/llm/refusal.js +22 -0
- package/packages/crouter-api/dist/core/llm/run.js +558 -0
- package/packages/crouter-api/dist/core/locked-file.js +121 -0
- package/packages/crouter-api/dist/core/log.js +91 -0
- package/packages/crouter-api/dist/core/managed-providers.js +61 -0
- package/packages/crouter-api/dist/core/manifest-stale.js +39 -0
- package/packages/crouter-api/dist/core/manifest.js +37 -0
- package/packages/crouter-api/dist/core/model-auth/api-credential-store.js +49 -0
- package/packages/crouter-api/dist/core/model-auth/daemon-login.js +156 -0
- package/packages/crouter-api/dist/core/model-auth/readiness.js +83 -0
- package/packages/crouter-api/dist/core/model-routes-pool.js +57 -0
- package/packages/crouter-api/dist/core/model-routes.js +212 -0
- package/packages/crouter-api/dist/core/northlight/previews.js +87 -0
- package/packages/crouter-api/dist/core/nvim-launch.js +45 -0
- package/packages/crouter-api/dist/core/output.js +99 -0
- package/packages/crouter-api/dist/core/packages/eligibility.js +34 -0
- package/packages/crouter-api/dist/core/packages/launch-kinds.js +20 -0
- package/packages/crouter-api/dist/core/packages/source-url.js +17 -0
- package/packages/crouter-api/dist/core/pagination.js +88 -0
- package/packages/crouter-api/dist/core/peer/client.js +168 -0
- package/packages/crouter-api/dist/core/peer/directory.js +193 -0
- package/packages/crouter-api/dist/core/peer/envelope.js +98 -0
- package/packages/crouter-api/dist/core/peer/names.js +8 -0
- package/packages/crouter-api/dist/core/peer/outbox-store.js +84 -0
- package/packages/crouter-api/dist/core/peer/receiver.js +54 -0
- package/packages/crouter-api/dist/core/peer/stubs.js +208 -0
- package/packages/crouter-api/dist/core/peer/token.js +30 -0
- package/packages/crouter-api/dist/core/peer/version.js +23 -0
- package/packages/crouter-api/dist/core/permissions/builtin.js +29 -0
- package/packages/crouter-api/dist/core/permissions/ceiling.js +332 -0
- package/packages/crouter-api/dist/core/permissions/compile.js +175 -0
- package/packages/crouter-api/dist/core/permissions/errors.js +13 -0
- package/packages/crouter-api/dist/core/permissions/evaluator.js +98 -0
- package/packages/crouter-api/dist/core/permissions/facts.js +102 -0
- package/packages/crouter-api/dist/core/permissions/schema-parser.js +151 -0
- package/packages/crouter-api/dist/core/permissions/schemas.js +83 -0
- package/packages/crouter-api/dist/core/permissions/sql.js +31 -0
- package/packages/crouter-api/dist/core/plugin-app.js +58 -0
- package/packages/crouter-api/dist/core/plugin-env.js +30 -0
- package/packages/crouter-api/dist/core/plugin-extensions.js +191 -0
- package/packages/crouter-api/dist/core/plugin-objects-manifest.js +86 -0
- package/packages/crouter-api/dist/core/plugin-quarantine.js +70 -0
- package/packages/crouter-api/dist/core/plugin-swap-lock.js +31 -0
- package/packages/crouter-api/dist/core/pool-credential-store.js +116 -0
- package/packages/crouter-api/dist/core/predicate.js +191 -0
- package/packages/crouter-api/dist/core/preview-registry.js +403 -0
- package/packages/crouter-api/dist/core/preview-result-path.js +26 -0
- package/packages/crouter-api/dist/core/profiles/default-binding.js +29 -0
- package/packages/crouter-api/dist/core/profiles/deletion-reservation.js +42 -0
- package/packages/crouter-api/dist/core/profiles/fuzzy-match.js +92 -0
- package/packages/crouter-api/dist/core/profiles/manifest.js +574 -0
- package/packages/crouter-api/dist/core/profiles/select.js +740 -0
- package/packages/crouter-api/dist/core/provider-credential.js +17 -0
- package/packages/crouter-api/dist/core/provider-error-recognition.js +82 -0
- package/packages/crouter-api/dist/core/provider-failure.js +157 -0
- package/packages/crouter-api/dist/core/provider-management.js +9 -0
- package/packages/crouter-api/dist/core/providers/approval.js +146 -0
- package/packages/crouter-api/dist/core/providers/audit.js +52 -0
- package/packages/crouter-api/dist/core/providers/bundles.js +643 -0
- package/packages/crouter-api/dist/core/providers/call.js +497 -0
- package/packages/crouter-api/dist/core/providers/description.js +1 -0
- package/packages/crouter-api/dist/core/providers/device-libs.js +202 -0
- package/packages/crouter-api/dist/core/providers/device.js +95 -0
- package/packages/crouter-api/dist/core/providers/errors.js +136 -0
- package/packages/crouter-api/dist/core/providers/files.js +390 -0
- package/packages/crouter-api/dist/core/providers/inflight.js +14 -0
- package/packages/crouter-api/dist/core/providers/mint.js +219 -0
- package/packages/crouter-api/dist/core/providers/receipts.js +61 -0
- package/packages/crouter-api/dist/core/providers/request.js +173 -0
- package/packages/crouter-api/dist/core/providers/roots.js +118 -0
- package/packages/crouter-api/dist/core/providers/token-cache.js +203 -0
- package/packages/crouter-api/dist/core/rate-limit-scope.js +64 -0
- package/packages/crouter-api/dist/core/remote-canvas-target.js +30 -0
- package/packages/crouter-api/dist/core/render.js +146 -0
- package/packages/crouter-api/dist/core/resolver.js +111 -0
- package/packages/crouter-api/dist/core/review/comments.js +296 -0
- package/packages/crouter-api/dist/core/review/companion.js +211 -0
- package/packages/crouter-api/dist/core/review/signal.js +12 -0
- package/packages/crouter-api/dist/core/review/store.js +178 -0
- package/packages/crouter-api/dist/core/review/types.js +23 -0
- package/packages/crouter-api/dist/core/runs/activity.js +57 -0
- package/packages/crouter-api/dist/core/runs/events.js +179 -0
- package/packages/crouter-api/dist/core/runs/initial-input.js +27 -0
- package/packages/crouter-api/dist/core/runs/operations.js +793 -0
- package/packages/crouter-api/dist/core/runs/questions.js +151 -0
- package/packages/crouter-api/dist/core/runtime/banner.js +53 -0
- package/packages/crouter-api/dist/core/runtime/bearings-render.js +273 -0
- package/packages/crouter-api/dist/core/runtime/bearings.js +199 -0
- package/packages/crouter-api/dist/core/runtime/bin-contributions.js +186 -0
- package/packages/crouter-api/dist/core/runtime/blaxel-environment.js +17 -0
- package/packages/crouter-api/dist/core/runtime/branded-host.js +485 -0
- package/packages/crouter-api/dist/core/runtime/broker/attachments-fetch.js +20 -0
- package/packages/crouter-api/dist/core/runtime/broker/bash-job-launch.js +66 -0
- package/packages/crouter-api/dist/core/runtime/broker/daemon-ops.js +232 -0
- package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +431 -0
- package/packages/crouter-api/dist/core/runtime/broker/node-token.js +16 -0
- package/packages/crouter-api/dist/core/runtime/broker/read-ops.js +173 -0
- package/packages/crouter-api/dist/core/runtime/broker/signal-stream.js +149 -0
- package/packages/crouter-api/dist/core/runtime/broker/turn-cause.js +44 -0
- package/packages/crouter-api/dist/core/runtime/broker-protocol.js +152 -0
- package/packages/crouter-api/dist/core/runtime/broker-request.js +86 -0
- package/packages/crouter-api/dist/core/runtime/broker-sdk.js +130 -0
- package/packages/crouter-api/dist/core/runtime/canvas-extensions.js +100 -0
- package/packages/crouter-api/dist/core/runtime/close.js +266 -0
- package/packages/crouter-api/dist/core/runtime/command-expansion.js +104 -0
- package/packages/crouter-api/dist/core/runtime/command-surface.js +117 -0
- package/packages/crouter-api/dist/core/runtime/crtr-theme.js +146 -0
- package/packages/crouter-api/dist/core/runtime/deliver-live.js +84 -0
- package/packages/crouter-api/dist/core/runtime/fault-recovery.js +83 -0
- package/packages/crouter-api/dist/core/runtime/fault.js +17 -0
- package/packages/crouter-api/dist/core/runtime/fleet.js +75 -0
- package/packages/crouter-api/dist/core/runtime/focus-viewer.js +151 -0
- package/packages/crouter-api/dist/core/runtime/front-door-env.js +16 -0
- package/packages/crouter-api/dist/core/runtime/headless-pi.js +176 -0
- package/packages/crouter-api/dist/core/runtime/host.js +701 -0
- package/packages/crouter-api/dist/core/runtime/interactive-deliver.js +51 -0
- package/packages/crouter-api/dist/core/runtime/invocation.js +10 -0
- package/packages/crouter-api/dist/core/runtime/kickoff.js +263 -0
- package/packages/crouter-api/dist/core/runtime/launch-prompt.js +13 -0
- package/packages/crouter-api/dist/core/runtime/launch-target.js +87 -0
- package/packages/crouter-api/dist/core/runtime/launch.js +505 -0
- package/packages/crouter-api/dist/core/runtime/ledger.js +55 -0
- package/packages/crouter-api/dist/core/runtime/lifecycle.js +283 -0
- package/packages/crouter-api/dist/core/runtime/managed-provider-cooling.js +62 -0
- package/packages/crouter-api/dist/core/runtime/memory-admission.js +68 -0
- package/packages/crouter-api/dist/core/runtime/model-registry.js +13 -0
- package/packages/crouter-api/dist/core/runtime/model-selection.js +135 -0
- package/packages/crouter-api/dist/core/runtime/model-swap.js +75 -0
- package/packages/crouter-api/dist/core/runtime/naming.js +300 -0
- package/packages/crouter-api/dist/core/runtime/nerd-font.js +162 -0
- package/packages/crouter-api/dist/core/runtime/nodes.js +506 -0
- package/packages/crouter-api/dist/core/runtime/outcome-document.js +86 -0
- package/packages/crouter-api/dist/core/runtime/output-result.js +32 -0
- package/packages/crouter-api/dist/core/runtime/output-schema-refs.js +100 -0
- package/packages/crouter-api/dist/core/runtime/package-health.js +100 -0
- package/packages/crouter-api/dist/core/runtime/persona.js +54 -0
- package/packages/crouter-api/dist/core/runtime/pi-cli.js +65 -0
- package/packages/crouter-api/dist/core/runtime/pi-vendored.js +63 -0
- package/packages/crouter-api/dist/core/runtime/placement-tmux.js +81 -0
- package/packages/crouter-api/dist/core/runtime/placement.js +418 -0
- package/packages/crouter-api/dist/core/runtime/progress-bar.js +50 -0
- package/packages/crouter-api/dist/core/runtime/provider-credential-gate.js +48 -0
- package/packages/crouter-api/dist/core/runtime/recovery-hold.js +46 -0
- package/packages/crouter-api/dist/core/runtime/reopen.js +160 -0
- package/packages/crouter-api/dist/core/runtime/revive.js +748 -0
- package/packages/crouter-api/dist/core/runtime/roadmap.js +86 -0
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +140 -0
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +233 -0
- package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +24 -0
- package/packages/crouter-api/dist/core/runtime/runner/index.js +37 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +94 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/environment.js +7 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +42 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/runner.js +90 -0
- package/packages/crouter-api/dist/core/runtime/runner/process.js +70 -0
- package/packages/crouter-api/dist/core/runtime/runner/types.js +16 -0
- package/packages/crouter-api/dist/core/runtime/session-branch.js +16 -0
- package/packages/crouter-api/dist/core/runtime/session-cycles.js +110 -0
- package/packages/crouter-api/dist/core/runtime/session-list-cache.js +302 -0
- package/packages/crouter-api/dist/core/runtime/session-visibility.js +99 -0
- package/packages/crouter-api/dist/core/runtime/setup-marker.js +46 -0
- package/packages/crouter-api/dist/core/runtime/situational-context.js +54 -0
- package/packages/crouter-api/dist/core/runtime/situational-live.js +41 -0
- package/packages/crouter-api/dist/core/runtime/spawn-env-rows.js +15 -0
- package/packages/crouter-api/dist/core/runtime/spawn-env.js +260 -0
- package/packages/crouter-api/dist/core/runtime/spawn.js +717 -0
- package/packages/crouter-api/dist/core/runtime/stamp/protocol.js +113 -0
- package/packages/crouter-api/dist/core/runtime/start-check.js +43 -0
- package/packages/crouter-api/dist/core/runtime/stop-guard.js +150 -0
- package/packages/crouter-api/dist/core/runtime/structured-output.js +112 -0
- package/packages/crouter-api/dist/core/runtime/surface-bg.js +85 -0
- package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +743 -0
- package/packages/crouter-api/dist/core/runtime/tmux-chrome.js +5 -0
- package/packages/crouter-api/dist/core/runtime/tmux-driver.js +713 -0
- package/packages/crouter-api/dist/core/runtime/unsandboxed.js +18 -0
- package/packages/crouter-api/dist/core/runtime/view-socket.js +195 -0
- package/packages/crouter-api/dist/core/runtime/warm-pool.js +479 -0
- package/packages/crouter-api/dist/core/scope.js +184 -0
- package/packages/crouter-api/dist/core/scoped-state/db.js +271 -0
- package/packages/crouter-api/dist/core/scoped-state/legacy-profiles.js +65 -0
- package/packages/crouter-api/dist/core/scoped-state/migrate.js +332 -0
- package/packages/crouter-api/dist/core/scoped-state/paths.js +27 -0
- package/packages/crouter-api/dist/core/scoped-state/person-rows.js +185 -0
- package/packages/crouter-api/dist/core/scoped-state/person-store.js +116 -0
- package/packages/crouter-api/dist/core/scoped-state/schema.js +52 -0
- package/packages/crouter-api/dist/core/scopes.js +48 -0
- package/packages/crouter-api/dist/core/secrets/env-rows.js +40 -0
- package/packages/crouter-api/dist/core/secrets/environment-owner.js +31 -0
- package/packages/crouter-api/dist/core/secrets/environment-secrets.js +14 -0
- package/packages/crouter-api/dist/core/secrets/index.js +2 -0
- package/packages/crouter-api/dist/core/secrets/key.js +33 -0
- package/packages/crouter-api/dist/core/secrets/seal.js +43 -0
- package/packages/crouter-api/dist/core/secrets.js +147 -0
- package/packages/crouter-api/dist/core/self-update.js +77 -0
- package/packages/crouter-api/dist/core/session-model/session-state.js +180 -0
- package/packages/crouter-api/dist/core/shell-segments.js +169 -0
- package/packages/crouter-api/dist/core/spaces/cache-env.js +15 -0
- package/packages/crouter-api/dist/core/spaces/file-root.js +68 -0
- package/packages/crouter-api/dist/core/spaces/mounts.js +126 -0
- package/packages/crouter-api/dist/core/spaces/open-beneath.js +581 -0
- package/packages/crouter-api/dist/core/spaces/permissions.js +77 -0
- package/packages/crouter-api/dist/core/spaces/process.js +172 -0
- package/packages/crouter-api/dist/core/spaces/runtime-home.js +8 -0
- package/packages/crouter-api/dist/core/spaces/space.js +58 -0
- package/packages/crouter-api/dist/core/spaces/stop.js +138 -0
- package/packages/crouter-api/dist/core/spaces/users.js +43 -0
- package/packages/crouter-api/dist/core/sqlite-statements.js +17 -0
- package/packages/crouter-api/dist/core/statements.js +81 -0
- package/packages/crouter-api/dist/core/storage/attachments.js +141 -0
- package/packages/crouter-api/dist/core/storage/caller-file.js +84 -0
- package/packages/crouter-api/dist/core/storage/client.js +220 -0
- package/packages/crouter-api/dist/core/storage/media-types.js +22 -0
- package/packages/crouter-api/dist/core/storage/purge.js +55 -0
- package/packages/crouter-api/dist/core/storage/tables.js +129 -0
- package/packages/crouter-api/dist/core/subscription-state.js +449 -0
- package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +206 -0
- package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +336 -0
- package/packages/crouter-api/dist/core/substrate/delivery/listings.js +75 -0
- package/packages/crouter-api/dist/core/substrate/delivery/match.js +146 -0
- package/packages/crouter-api/dist/core/substrate/delivery/plan.js +130 -0
- package/packages/crouter-api/dist/core/substrate/delivery/render-boot.js +330 -0
- package/packages/crouter-api/dist/core/substrate/delivery/render-event.js +186 -0
- package/packages/crouter-api/dist/core/substrate/delivery/sub-persona-menu.js +24 -0
- package/packages/crouter-api/dist/core/substrate/delivery/types.js +1 -0
- package/packages/crouter-api/dist/core/substrate/gate-explain.js +397 -0
- package/packages/crouter-api/dist/core/substrate/schema.js +81 -0
- package/packages/crouter-api/dist/core/substrate/subject-fields.js +39 -0
- package/packages/crouter-api/dist/core/substrate/subject.js +60 -0
- package/packages/crouter-api/dist/core/termrender/code-doc.js +92 -0
- package/packages/crouter-api/dist/core/termrender/display.js +56 -0
- package/packages/crouter-api/dist/core/termrender/termrender.js +719 -0
- package/packages/crouter-api/dist/core/termrender/version.js +1 -0
- package/packages/crouter-api/dist/core/timing.js +94 -0
- package/packages/crouter-api/dist/core/tui/draw.js +378 -0
- package/packages/crouter-api/dist/core/tui/fuzzy.js +38 -0
- package/packages/crouter-api/dist/core/tui/markdown.js +407 -0
- package/packages/crouter-api/dist/core/tui/page-host.js +74 -0
- package/packages/crouter-api/dist/core/tui/panel.js +142 -0
- package/packages/crouter-api/dist/core/tui/terminal.js +100 -0
- package/packages/crouter-api/dist/core/user-settings.js +478 -0
- package/packages/crouter-api/dist/core/wake.js +296 -0
- package/packages/crouter-api/dist/core/worktree-close.js +251 -0
- package/packages/crouter-api/dist/core/worktree-containment.js +48 -0
- package/packages/crouter-api/dist/core/worktree-landing.js +56 -0
- package/packages/crouter-api/dist/core/worktree-machine.js +92 -0
- package/packages/crouter-api/dist/core/worktree-mutation-async.js +385 -0
- package/packages/crouter-api/dist/core/worktree-remove.js +84 -0
- package/packages/crouter-api/dist/core/worktree.js +909 -0
- package/packages/crouter-api/dist/daemon/api/deferred-head.js +117 -0
- package/packages/crouter-api/dist/daemon/api/environment-of.js +64 -0
- package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +341 -0
- package/packages/crouter-api/dist/daemon/api/handlers/broker-recovery.js +266 -0
- package/packages/crouter-api/dist/daemon/api/handlers/git-credential.js +64 -0
- package/packages/crouter-api/dist/daemon/api/handlers/providers.js +284 -0
- package/packages/crouter-api/dist/daemon/api/handlers/validate.js +58 -0
- package/packages/crouter-api/dist/daemon/api/map.js +768 -0
- package/packages/crouter-api/dist/daemon/api/operations.js +316 -0
- package/packages/crouter-api/dist/daemon/api/principal.js +147 -0
- package/packages/crouter-api/dist/daemon/api/reader.js +125 -0
- package/packages/crouter-api/dist/daemon/api/router.js +542 -0
- package/packages/crouter-api/dist/daemon/api/sync-notice.js +46 -0
- package/packages/crouter-api/dist/daemon/api/viewer-presence.js +100 -0
- package/packages/crouter-api/dist/daemon/broker-signals/bus.js +203 -0
- package/packages/crouter-api/dist/daemon/companion-retire.js +44 -0
- package/packages/crouter-api/dist/daemon/control.js +22 -0
- package/packages/crouter-api/dist/daemon/cron/authority.js +101 -0
- package/packages/crouter-api/dist/daemon/cron/live-runs.js +66 -0
- package/packages/crouter-api/dist/daemon/cron/run-socket.js +170 -0
- package/packages/crouter-api/dist/daemon/drain.js +76 -0
- package/packages/crouter-api/dist/daemon/http-dispatcher.js +37 -0
- package/packages/crouter-api/dist/daemon/human/finish.js +178 -0
- package/packages/crouter-api/dist/daemon/human/settle.js +103 -0
- package/packages/crouter-api/dist/daemon/machine-link/config.js +63 -0
- package/packages/crouter-api/dist/daemon/machine-link/credential.js +24 -0
- package/packages/crouter-api/dist/daemon/machine-link/forward.js +181 -0
- package/packages/crouter-api/dist/daemon/machine-link/frames.js +29 -0
- package/packages/crouter-api/dist/daemon/machine-link/holder.js +317 -0
- package/packages/crouter-api/dist/daemon/machine-link/move-notify.js +15 -0
- package/packages/crouter-api/dist/daemon/manage.js +736 -0
- package/packages/crouter-api/dist/daemon/park-activity.js +33 -0
- package/packages/crouter-api/dist/daemon/park-pending.js +76 -0
- package/packages/crouter-api/dist/daemon/pidfile.js +37 -0
- package/packages/crouter-api/dist/daemon/postgres/binary.js +193 -0
- package/packages/crouter-api/dist/daemon/postgres/cluster.js +111 -0
- package/packages/crouter-api/dist/daemon/postgres/pins.js +16 -0
- package/packages/crouter-api/dist/daemon/postgres/supervisor.js +177 -0
- package/packages/crouter-api/dist/daemon/readiness.js +37 -0
- package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +846 -0
- package/packages/crouter-api/dist/daemon/reconcilers/ledger-sandbox.js +249 -0
- package/packages/crouter-api/dist/daemon/reconcilers/live-obligation.js +125 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/launch-failure.js +8 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/node-person.js +40 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +151 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +59 -0
- package/packages/crouter-api/dist/daemon/reconcilers/recipe-image.js +196 -0
- package/packages/crouter-api/dist/daemon/reconcilers/throttled-lane.js +63 -0
- package/packages/crouter-api/dist/daemon/runs/append-section.js +135 -0
- package/packages/crouter-api/dist/daemon/runs/observer.js +441 -0
- package/packages/crouter-api/dist/daemon/runs/view-transport.js +81 -0
- package/packages/crouter-api/dist/daemon/startup-policy.js +1 -0
- package/packages/crouter-api/dist/daemon/structured-requests/sidecar.js +5 -0
- package/packages/crouter-api/dist/hook-authoring.js +447 -0
- package/packages/crouter-api/dist/hook-process.js +34 -0
- package/packages/crouter-api/dist/launcher/client.js +52 -0
- package/packages/crouter-api/dist/launcher/limits/policy.js +142 -0
- package/packages/crouter-api/dist/launcher/limits/settings.js +94 -0
- package/packages/crouter-api/dist/launcher/spec.js +10 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/apply.js +113 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/fields.js +52 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/index.js +89 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/discover.js +251 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/history.js +37 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/nested.js +37 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/parse.js +24 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/types.js +3 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/plan.js +410 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/pointers.js +95 -0
- package/packages/crouter-api/dist/migrations/activation.js +46 -0
- package/packages/crouter-api/dist/native/linux.js +20 -0
- package/packages/crouter-api/dist/shared/crtr-version.js +18 -0
- package/packages/crouter-api/dist/shared/env.js +335 -0
- package/packages/crouter-api/dist/shared/generated-context.js +240 -0
- package/packages/crouter-api/dist/shared/inbox-entry-body.js +124 -0
- package/packages/crouter-api/dist/shared/inline-ref-grammar.js +99 -0
- package/packages/crouter-api/dist/shared/predicates.js +4 -0
- package/packages/crouter-api/dist/shared/shell-quote.js +5 -0
- package/packages/crouter-api/dist/shared/strip-cd-prefix.js +13 -0
- package/packages/crouter-api/dist/shared/tool-groups.js +64 -0
- package/packages/crouter-api/dist/shared/traceparent.js +28 -0
- package/packages/crouter-api/dist/shared/turn-replies.js +71 -0
- package/packages/crouter-api/dist/shared/working-activity.js +27 -0
- package/packages/crouter-api/dist/types.js +193 -0
- package/packages/crouter-api/package.json +49 -0
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/dist/approval.js +12 -0
- package/packages/crouter-plugin/dist/bundle.js +203 -0
- package/packages/crouter-plugin/dist/caller.js +23 -0
- package/packages/crouter-plugin/dist/client/index.js +338 -0
- package/packages/crouter-plugin/dist/compare.js +314 -0
- package/packages/crouter-plugin/dist/define.js +531 -0
- package/packages/crouter-plugin/dist/errors.js +150 -0
- package/packages/crouter-plugin/dist/fields.js +83 -0
- package/packages/crouter-plugin/dist/index.js +15 -0
- package/packages/crouter-plugin/dist/manifest.js +111 -0
- package/packages/crouter-plugin/dist/node.js +153 -0
- package/packages/crouter-plugin/dist/params.js +85 -0
- package/packages/crouter-plugin/dist/receipts.js +234 -0
- package/packages/crouter-plugin/dist/serve.js +630 -0
- package/packages/crouter-plugin/dist/verify.js +84 -0
- package/packages/crouter-plugin/dist/watchable.js +14 -0
- package/packages/crouter-plugin/package.json +42 -0
- package/runtime.lock.json +14 -13
- package/scripts/sandbox-bootstrap.sh +36 -7
- package/scripts/sandbox-start.mjs +41 -7
- package/dist/core/graph/repo-sync/index.d.ts +0 -4
- package/dist/core/graph/repo-sync/index.js +0 -1
- package/dist/core/graph/repo-sync/mirror.d.ts +0 -30
- package/dist/core/graph/repo-sync/mirror.js +0 -6
- package/dist/core/graph/repo-sync/sync.d.ts +0 -40
- package/dist/core/graph/repo-sync/sync.js +0 -2
|
@@ -3,4 +3,4 @@ var B=Object.defineProperty;var l=(e,r)=>B(e,"name",{value:r,configurable:!0});i
|
|
|
3
3
|
`)}l(X,"recipeDockerfile");const ee=l((e,r,a)=>new Promise((o,i)=>{const n=P("git",e,{cwd:a,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","ignore","pipe"]});let t="";n.stderr.on("data",s=>{t+=s.toString()}),n.on("error",i),n.on("close",s=>{s===0?o():i(new Error(`git ${e[0]} failed (${s}): ${t.slice(0,300)}`))})}),"runGit");async function le(e){const r=e.git??ee,a=e.packagesToken??null,o=e.cloneUrl??(n=>`https://github.com/${n}.git`);G(g(e.dir,U),{recursive:!0});const i=e.token===null?{}:{GIT_CONFIG_COUNT:"1",GIT_CONFIG_KEY_0:"http.https://github.com/.extraheader",GIT_CONFIG_VALUE_0:`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${e.token}`).toString("base64")}`};for(const n of e.recipe.repositories){if(!/^[A-Za-z0-9._-]+$/.test(n.name)||n.name==="."||n.name==="..")throw new Error(`repository name ${JSON.stringify(n.name)} is not a plain directory name`);await r(["clone","--quiet","--branch",n.default_branch,o(n.github_full_name),g(U,n.name)],i,e.dir)}b(g(e.dir,"Dockerfile"),X(e.recipe,e.revision,a!==null)),a!==null&&b(g(e.dir,".env.build"),`NODE_AUTH_TOKEN=${a}
|
|
4
4
|
`,{mode:384}),e.recipe.setup_script!==null&&e.recipe.setup_script.trim()!==""&&b(g(e.dir,I),e.recipe.setup_script.endsWith(`
|
|
5
5
|
`)?e.recipe.setup_script:`${e.recipe.setup_script}
|
|
6
|
-
`)}l(le,"prepareBuildDir");function v(e,r,a){for(const o of F(r).sort()){const i=g(r,o),n=C(i),t=j(e,i).split("\\").join("/");n.isDirectory()?v(e,i,a):n.isSymbolicLink()?a.push({name:t,data:Buffer.from(K(i)),mode:y.S_IFLNK|511}):n.isFile()&&a.push({name:t,data:M(i),mode:y.S_IFREG|n.mode&511})}}l(v,"walk");function te(e){const r=[];v(e,e,r);const a=[],o=[];let i=0;for(const s of r){const u=Buffer.from(s.name),m=z(s.data),$=q(s.data),p=Buffer.alloc(30);p.writeUInt32LE(67324752,0),p.writeUInt16LE(20,4),p.writeUInt16LE(2048,6),p.writeUInt16LE(8,8),p.writeUInt32LE(33,12),p.writeUInt32LE($,14),p.writeUInt32LE(m.length,18),p.writeUInt32LE(s.data.length,22),p.writeUInt16LE(u.length,26),a.push(p,u,m);const c=Buffer.alloc(46);c.writeUInt32LE(33639248,0),c.writeUInt16LE(788,4),c.writeUInt16LE(20,6),c.writeUInt16LE(2048,8),c.writeUInt16LE(8,10),c.writeUInt32LE(33,14),c.writeUInt32LE($,16),c.writeUInt32LE(m.length,20),c.writeUInt32LE(s.data.length,24),c.writeUInt16LE(u.length,28),c.writeUInt32LE(s.mode<<16>>>0,38),c.writeUInt32LE(i,42),o.push(c,u),i+=p.length+u.length+m.length}const n=Buffer.concat(o),t=Buffer.alloc(22);return t.writeUInt32LE(101010256,0),t.writeUInt16LE(r.length,8),t.writeUInt16LE(r.length,10),t.writeUInt32LE(n.length,12),t.writeUInt32LE(i,16),Buffer.concat([...a,n,t])}l(te,"zipDirectory");async function
|
|
6
|
+
`)}l(le,"prepareBuildDir");function v(e,r,a){for(const o of F(r).sort()){const i=g(r,o),n=C(i),t=j(e,i).split("\\").join("/");n.isDirectory()?v(e,i,a):n.isSymbolicLink()?a.push({name:t,data:Buffer.from(K(i)),mode:y.S_IFLNK|511}):n.isFile()&&a.push({name:t,data:M(i),mode:y.S_IFREG|n.mode&511})}}l(v,"walk");function te(e){const r=[];v(e,e,r);const a=[],o=[];let i=0;for(const s of r){const u=Buffer.from(s.name),m=z(s.data),$=q(s.data),p=Buffer.alloc(30);p.writeUInt32LE(67324752,0),p.writeUInt16LE(20,4),p.writeUInt16LE(2048,6),p.writeUInt16LE(8,8),p.writeUInt32LE(33,12),p.writeUInt32LE($,14),p.writeUInt32LE(m.length,18),p.writeUInt32LE(s.data.length,22),p.writeUInt16LE(u.length,26),a.push(p,u,m);const c=Buffer.alloc(46);c.writeUInt32LE(33639248,0),c.writeUInt16LE(788,4),c.writeUInt16LE(20,6),c.writeUInt16LE(2048,8),c.writeUInt16LE(8,10),c.writeUInt32LE(33,14),c.writeUInt32LE($,16),c.writeUInt32LE(m.length,20),c.writeUInt32LE(s.data.length,24),c.writeUInt16LE(u.length,28),c.writeUInt32LE(s.mode<<16>>>0,38),c.writeUInt32LE(i,42),o.push(c,u),i+=p.length+u.length+m.length}const n=Buffer.concat(o),t=Buffer.alloc(22);return t.writeUInt32LE(101010256,0),t.writeUInt16LE(r.length,8),t.writeUInt16LE(r.length,10),t.writeUInt32LE(n.length,12),t.writeUInt32LE(i,16),Buffer.concat([...a,n,t])}l(te,"zipDirectory");async function x(e,r,a,o,i=[]){const n=`${e.controlUrl??"https://api.blaxel.ai/v0"}${a}`,t=await(e.fetch??fetch)(n,{method:r,headers:{authorization:`Bearer ${e.apiKey}`,"x-blaxel-workspace":e.workspace,"content-type":"application/json"},...o===void 0?{}:{body:JSON.stringify(o)}}),s=await t.text();let u=null;if(s!=="")try{u=JSON.parse(s)}catch{u={raw:s}}if(!t.ok&&!i.includes(t.status))throw new H(t.status,null,`Blaxel ${r} ${n} failed (${t.status}): ${s.slice(0,300)}`);return{status:t.status,headers:t.headers,json:u}}l(x,"api");async function S(e,r){const{status:a,json:o}=await x(e,"GET",`/images/sandbox/${encodeURIComponent(r)}`,void 0,[404]);return a===404?null:o}l(S,"getImage");async function pe(e,r){await x(e,"DELETE",`/images/sandbox/${encodeURIComponent(r)}`,void 0,[404])}l(pe,"deleteImage");async function de(e,r,a,o={}){const i=o.sleep??(f=>new Promise(w=>setTimeout(w,f))),n=o.now??Date.now,t=n(),s=await S(e,r),u=new Set((s?.spec?.tags??[]).map(f=>f.name)),m=s?.metadata?.events?.length??0,p=(await x(e,"POST","/images",{resourceType:"sandbox",name:r})).headers.get("x-blaxel-upload-url");if(p===null)throw new Error(`Blaxel gave no upload URL for image ${r}`);const c=await(e.fetch??fetch)(p,{method:"PUT",headers:{"content-type":"application/zip"},body:new Uint8Array(te(a))});if(!c.ok)throw new Error(`uploading the build context of image ${r} failed (${c.status}): ${(await c.text()).slice(0,300)}`);const A=t+(o.timeoutMs??20*6e4);let _=null;for(;;){const f=await S(e,r),w=f?.metadata?.status;if(w==="BUILT"&&(f?.metadata?.events?.length??0)>=m+2){_??=n();const E=(f?.spec?.tags??[]).filter(d=>d.name!==void 0),L=(f?.metadata?.events??[]).slice(m).map(d=>d.time??"").filter(d=>d!=="").sort()[0],R=l(d=>L!==void 0&&Date.parse(d??"")>=Date.parse(L),"touchedSince"),N=E.filter(d=>!u.has(d.name)||R(d.createdAt)||R(d.updatedAt)),k=n()-_>=(o.tagGraceMs??6e4),O=(N.length>0?N:k?E:[]).sort((d,D)=>(D.updatedAt??"").localeCompare(d.updatedAt??""))[0]?.name;if(O!==void 0)return{ref:`sandbox/${r}:${O}`,buildMs:n()-t};if(k)throw new Error(`Blaxel built image ${r} but no tag appeared`)}if(w==="FAILED"||w==="TERMINATED"){const E=f?.metadata?.events??[];throw new Error(`building image ${r} ${w.toLowerCase()}: ${E[E.length-1]?.message??"no message"}`)}if(n()>A)throw new Error(`building image ${r} did not finish within ${o.timeoutMs??20*6e4} ms (last status ${w??"none"})`);await i(o.pollMs??3e3)}}l(de,"buildImage");const ue=l(e=>`env-${e}`,"environmentImageName");function fe(e){Y(e,{recursive:!0,force:!0})}l(fe,"removeBuildDir");export{J as NODE_BASE_IMAGE,T as RECIPE_PI_AGENT_DIR,U as REPOS_DIR,h as RUN_USER,W as SANDBOX_API_IMAGE,I as SETUP_SCRIPT_FILE,de as buildImage,pe as deleteImage,ue as environmentImageName,S as getImage,le as prepareBuildDir,X as recipeDockerfile,fe as removeBuildDir,te as zipDirectory};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { BlaxelConfig } from './client.js';
|
|
2
|
+
import { type BuildImageOptions, type BuiltImage } from './image-build.js';
|
|
3
|
+
/** Where the bootstrap keeps releases. Keep in step with `ROOT` in scripts/sandbox-bootstrap.sh. */
|
|
4
|
+
export declare const RELEASES_DIR = "/opt/crtr/releases";
|
|
5
|
+
/** Written into an unpacked release by the bootstrap and by this image: the sha256 of the tarball it came from. The bootstrap trusts a present release only when this equals the sha the wake names. */
|
|
6
|
+
export declare const RELEASE_SHA_FILE = ".sha256";
|
|
7
|
+
/** Written last into an unpacked release: it is complete. */
|
|
8
|
+
export declare const RELEASE_COMPLETE_FILE = ".complete";
|
|
9
|
+
export declare const RELEASE_TARBALL_FILE = "runtime.tar.gz";
|
|
10
|
+
/** The pointer object's key in the release bucket, beside `runtime.tar.gz` and its sha256. */
|
|
11
|
+
export declare const releaseImageKey: (version: string) => string;
|
|
12
|
+
/** The Blaxel image name of a release: `0.3.668-delivery.1` -> `crtr-release-0-3-668-delivery-1`. Every release has its own image, so a release's image is deleted by name. */
|
|
13
|
+
export declare function releaseImageName(version: string): string;
|
|
14
|
+
/** The Dockerfile of a release image. Pure. Two stages: the release is unpacked in the first, so the tarball is in no layer of the final image.
|
|
15
|
+
* The base is the recipe image's (node, sandbox-api, the `crtr` user), plus `ripgrep` (pi's grep tool) and `python3` (the stock image has it). */
|
|
16
|
+
export declare function releaseImageDockerfile(version: string, sha256: string): string;
|
|
17
|
+
/** What `releases/<version>/sandbox-image.json` holds. `sha256` is the tarball's, so a pointer left over from another build of the same version is refused. */
|
|
18
|
+
export interface ReleaseImagePointer {
|
|
19
|
+
release: string;
|
|
20
|
+
sha256: string;
|
|
21
|
+
image: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function releaseImagePointerText(pointer: ReleaseImagePointer): string;
|
|
24
|
+
/** The image a pointer names for `release` and the tarball `sha256` the wake carries. Throws on a malformed pointer, one for another release, or one built from another tarball: none is a reason to launch silently from the stock image. */
|
|
25
|
+
export declare function parseReleaseImagePointer(text: string, release: string, sha256: string): string;
|
|
26
|
+
export interface BuildReleaseImageInput {
|
|
27
|
+
release: string;
|
|
28
|
+
/** The `runtime.tar.gz` the release was published with (scripts/sandbox-release.mjs). */
|
|
29
|
+
tarball: string;
|
|
30
|
+
/** Its sha256; checked against the file, so an image is never built from a tarball other than the one the wake will name. */
|
|
31
|
+
sha256: string;
|
|
32
|
+
}
|
|
33
|
+
/** Builds the release's image in the workspace `config` names and returns its pointer. */
|
|
34
|
+
export declare function buildReleaseImage(config: BlaxelConfig, input: BuildReleaseImageInput, options?: BuildImageOptions): Promise<{
|
|
35
|
+
pointer: ReleaseImagePointer;
|
|
36
|
+
built: BuiltImage;
|
|
37
|
+
}>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var p=Object.defineProperty;var o=(e,r)=>p(e,"name",{value:r,configurable:!0});import{createHash as f}from"node:crypto";import{copyFileSync as E,mkdtempSync as g,readFileSync as w,writeFileSync as d}from"node:fs";import{tmpdir as b}from"node:os";import{join as l}from"node:path";import{buildImage as R,NODE_BASE_IMAGE as h,removeBuildDir as S,RUN_USER as c,SANDBOX_API_IMAGE as u}from"./image-build.js";const x="/opt/crtr/releases",y=".sha256",I=".complete",n="runtime.tar.gz",A=/^[0-9a-f]{64}$/,O=/^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$/,i=o(e=>`releases/${e}/sandbox-image.json`,"releaseImageKey");function $(e){if(!O.test(e))throw new Error(`${JSON.stringify(e)} is not a release version`);const r=`crtr-release-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;if(r.length>63)throw new Error(`image name ${r} is longer than 63 characters`);return r}o($,"releaseImageName");function N(e,r){if(!A.test(r))throw new Error("sha256 must be 64 lowercase hex characters");$(e);const a=`${x}/${e}`;return[`FROM ${h} AS release`,`COPY ${n} /tmp/${n}`,`RUN mkdir -p ${a} && tar -xzf /tmp/${n} -C ${a} && echo ${r} > ${a}/${y} && : > ${a}/${I}`,"",`FROM ${h}`,"RUN apk add --no-cache bash git curl ripgrep python3",`COPY --from=${u} /sandbox-api /usr/local/bin/sandbox-api`,`RUN adduser -D -h /home/${c} -s /bin/sh ${c} && mkdir -p /run/crtr /var/lib/crtr /work/.crtr && chown -R ${c} /run/crtr /var/lib/crtr /work`,"COPY --from=release /opt/crtr /opt/crtr","WORKDIR /work",'ENTRYPOINT ["/usr/local/bin/sandbox-api"]',""].join(`
|
|
2
|
+
`)}o(N,"releaseImageDockerfile");function C(e){return`${JSON.stringify(e)}
|
|
3
|
+
`}o(C,"releaseImagePointerText");function M(e,r,a){let s;try{s=JSON.parse(e)}catch{throw new Error(`${i(r)} is not JSON`)}const t=s;if(t===null||typeof t!="object"||typeof t.release!="string"||typeof t.sha256!="string"||typeof t.image!="string"||t.image==="")throw new Error(`${i(r)} must hold {release, sha256, image}`);if(t.release!==r)throw new Error(`${i(r)} names release ${t.release}`);if(t.sha256!==a)throw new Error(`${i(r)} was built from tarball ${t.sha256}, not ${a}`);return t.image}o(M,"parseReleaseImagePointer");async function T(e,r,a={}){const s=f("sha256").update(w(r.tarball)).digest("hex");if(s!==r.sha256)throw new Error(`${r.tarball} has sha256 ${s}, not ${r.sha256}`);const t=g(l(b(),"crtr-release-image-"));try{E(r.tarball,l(t,n)),d(l(t,"Dockerfile"),N(r.release,r.sha256));const m=await R(e,$(r.release),t,a);return{pointer:{release:r.release,sha256:r.sha256,image:m.ref},built:m}}finally{S(t)}}o(T,"buildReleaseImage");export{x as RELEASES_DIR,I as RELEASE_COMPLETE_FILE,y as RELEASE_SHA_FILE,n as RELEASE_TARBALL_FILE,T as buildReleaseImage,M as parseReleaseImagePointer,N as releaseImageDockerfile,i as releaseImageKey,$ as releaseImageName,C as releaseImagePointerText};
|
|
@@ -12,7 +12,7 @@ export declare const brokerProcessName: (executionId: string) => string;
|
|
|
12
12
|
export declare const sandboxNameFor: (execution: RunnerExecution) => string;
|
|
13
13
|
/** What `start` needs from the control plane beyond the execution: the environment's image and size, the release object, the secrets. */
|
|
14
14
|
export interface BlaxelLaunchContext {
|
|
15
|
-
/** `environments.image_ref` for a recipe environment, else `blaxel/base-image:latest`. */
|
|
15
|
+
/** `environments.image_ref` for a recipe environment, else the release's own image (release-image.ts) when it was published with one, else `blaxel/base-image:latest`. */
|
|
16
16
|
image: string;
|
|
17
17
|
memoryMb: number;
|
|
18
18
|
/** `CRTR_API_URL` the broker reaches `/v1` at. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var S=Object.defineProperty;var o=(e,n)=>S(e,"name",{value:n,configurable:!0});import{randomUUID as g}from"node:crypto";import{openDb as E,withCanvasWrite as N}from"../../../canvas/db.js";import{brokerSignalBus as k}from"../../../../daemon/broker-signals/bus.js";import{MachineCallFailedError as O,MachineLostError as _,MachineOfflineError as d}from"./ops.js";const D={start:60,wake:15,stop:15,status:15,"status.all":15,delete:15,viewer:15,"cron.run":15,"cron.cancel":15,"worktree.create":60,"worktree.rollback":60,"worktree.close":60,"worktree.abandon":60,"worktree.finalize":60},M=1e3;async function x(e,n,
|
|
1
|
+
var S=Object.defineProperty;var o=(e,n)=>S(e,"name",{value:n,configurable:!0});import{randomUUID as g}from"node:crypto";import{openDb as E,withCanvasWrite as N}from"../../../canvas/db.js";import{brokerSignalBus as k}from"../../../../daemon/broker-signals/bus.js";import{MachineCallFailedError as O,MachineLostError as _,MachineOfflineError as d}from"./ops.js";const D={start:60,wake:15,stop:15,status:15,"status.all":15,delete:15,viewer:15,"cron.run":15,"cron.cancel":15,"worktree.create":60,"worktree.rollback":60,"worktree.close":60,"worktree.abandon":60,"worktree.finalize":60,"repo.identify":15},M=1e3;async function x(e,n,t,l={}){const s=g(),c=new Date().toISOString();if(!await N(async r=>await r.prepare("SELECT 1 AS live FROM machine_links WHERE environment = ? AND lease_expires_at > ?").get(e,c)===void 0?!1:(await r.prepare("INSERT INTO machine_calls (call_id, environment, op, args_json, created_at) VALUES (?, ?, ?, ?, ?)").run(s,e,n,JSON.stringify(t),c),await r.prepare("SELECT pg_notify(?, ?)").get("crtr_signal",`machine:${e}`),!0)))throw new d(e,"no live link");const i=Date.now()+(l.timeoutMs??D[n]*1e3);let u,f=!1;const h=await k.subscribe(r=>{r===s&&(f=!0,u?.())},{kinds:["machine_call"]});try{return await T(e,n,s,i,l.rereadMs??M,r=>new Promise(w=>{if(f){f=!1,w();return}const p=setTimeout(()=>{u=void 0,w()},r);u=o(()=>{clearTimeout(p),u=void 0,f=!1,w()},"wake")}))}finally{h()}}o(x,"callMachine");async function T(e,n,t,l,s,c){for(;;){const a=await(await E()).prepare("SELECT state, result_json, lease_expires_at, claimed_generation FROM machine_calls WHERE call_id = ?").get(t);if(a===void 0)throw new _(e,t);if(a.state==="done")return a.result_json===null?null:JSON.parse(a.result_json);if(a.state==="failed"){const i=a.result_json===null?{}:JSON.parse(a.result_json);throw i.code==="machine_offline"?new d(e,i.message,i.sent===!0):i.code==="machine_lost"?new _(e,t):new O(e,n,i.message??"unknown")}if(a.claimed_generation!==null&&a.lease_expires_at!==null&&a.lease_expires_at<=new Date().toISOString()){if(await m(t,"lease expired")===void 0)continue;throw new _(e,t)}if(Date.now()>=l){const i=await m(t,"timed out");if(i===void 0)continue;throw i===null?new d(e,"no holder claimed the call"):new _(e,t)}await c(Math.min(s,Math.max(0,l-Date.now())))}}o(T,"waitForCall");async function m(e,n){const t=await(await E()).prepare(`UPDATE machine_calls SET state = 'failed', finished_at = ?,
|
|
2
2
|
result_json = CASE WHEN claimed_generation IS NULL THEN ? ELSE ? END
|
|
3
|
-
WHERE call_id = ? AND state IN ('pending', 'sent') RETURNING claimed_generation`).get(new Date().toISOString(),JSON.stringify({code:"machine_offline",message:n,sent:!1}),JSON.stringify({code:"machine_lost",message:n}),e);return
|
|
3
|
+
WHERE call_id = ? AND state IN ('pending', 'sent') RETURNING claimed_generation`).get(new Date().toISOString(),JSON.stringify({code:"machine_offline",message:n,sent:!1}),JSON.stringify({code:"machine_lost",message:n}),e);return t===void 0?void 0:t.claimed_generation===null?null:Number(t.claimed_generation)}o(m,"failOpenCall");export{D as MACHINE_CALL_TIMEOUT_S,x as callMachine};
|
|
@@ -45,5 +45,5 @@ export declare function machineBrokerEnv(bundle: StartBundleDTO, deps: Pick<Mach
|
|
|
45
45
|
* SIGKILL, so the caller never reports stopped while something of this home may still run. */
|
|
46
46
|
export declare function stopAllBrokers(graceMs?: number): Promise<void>;
|
|
47
47
|
export declare function createMachineExecutor(deps: MachineExecutorDeps): {
|
|
48
|
-
[O in Exclude<keyof MachineOpTable, 'cron.run' | 'cron.cancel' | `worktree.${string}
|
|
48
|
+
[O in Exclude<keyof MachineOpTable, 'cron.run' | 'cron.cancel' | `worktree.${string}` | 'repo.identify'>]: (args: MachineOpTable[O]['args'], signal?: AbortSignal) => Promise<MachineOpTable[O]['result']>;
|
|
49
49
|
};
|
|
@@ -2,8 +2,9 @@ import type { ManagedWorktree } from '../../../canvas/types.js';
|
|
|
2
2
|
import type { AutoDroppedWorktree, AbandonManagedWorktreeResult } from '../../../worktree.js';
|
|
3
3
|
import type { CloseOnHostOutcome } from '../../../worktree-close.js';
|
|
4
4
|
import type { AbandonOutcome, FinalizeWorktreeOutcome } from '../../../worktree-mutation-async.js';
|
|
5
|
+
import type { CheckoutChainEntry } from '../../../graph/repo-sync/identity.js';
|
|
5
6
|
import type { RunnerExecution, RunnerStartInput, RunnerStatus, RunnerStopOptions, RunnerStopResult, RunnerViewerAddress, RunnerWakeResult } from '../types.js';
|
|
6
|
-
export declare const MACHINE_OPS: readonly ["start", "wake", "stop", "status", "status.all", "delete", "viewer", "cron.run", "cron.cancel", "worktree.create", "worktree.rollback", "worktree.close", "worktree.abandon", "worktree.finalize"];
|
|
7
|
+
export declare const MACHINE_OPS: readonly ["start", "wake", "stop", "status", "status.all", "delete", "viewer", "cron.run", "cron.cancel", "worktree.create", "worktree.rollback", "worktree.close", "worktree.abandon", "worktree.finalize", "repo.identify"];
|
|
7
8
|
export type MachineOp = (typeof MACHINE_OPS)[number];
|
|
8
9
|
/** A `start` call carries the whole start input and the node token the control plane minted: the Mac has no database, so it cannot mint one.
|
|
9
10
|
* The token sits in `machine_calls.args_json` until the row is deleted a day after it finishes; the execution's token row holds its hash. */
|
|
@@ -108,6 +109,11 @@ export interface MachineWorktreeFinalizeArgs {
|
|
|
108
109
|
worktree: ManagedWorktree;
|
|
109
110
|
}
|
|
110
111
|
export type { AutoDroppedWorktree, AbandonManagedWorktreeResult };
|
|
112
|
+
/** The Mac's git lookup for each directory: the enclosing checkouts, innermost first. A directory in no repo, or whose lookup failed, answers `[]`. */
|
|
113
|
+
export interface MachineRepoIdentifyArgs {
|
|
114
|
+
dirs: string[];
|
|
115
|
+
}
|
|
116
|
+
export type MachineRepoIdentifyResult = Record<string, CheckoutChainEntry[]>;
|
|
111
117
|
export interface MachineOpTable {
|
|
112
118
|
start: {
|
|
113
119
|
args: MachineStartArgs;
|
|
@@ -167,6 +173,10 @@ export interface MachineOpTable {
|
|
|
167
173
|
args: MachineWorktreeFinalizeArgs;
|
|
168
174
|
result: MachineWorktreeAnswer<FinalizeWorktreeOutcome>;
|
|
169
175
|
};
|
|
176
|
+
'repo.identify': {
|
|
177
|
+
args: MachineRepoIdentifyArgs;
|
|
178
|
+
result: MachineRepoIdentifyResult;
|
|
179
|
+
};
|
|
170
180
|
}
|
|
171
181
|
/** No live link row for the environment: the caller leaves its work pending and retries on its own backoff. */
|
|
172
182
|
export declare class MachineOfflineError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var s=Object.defineProperty;var n=(t,e)=>s(t,"name",{value:e,configurable:!0});const i=["start","wake","stop","status","status.all","delete","viewer","cron.run","cron.cancel","worktree.create","worktree.rollback","worktree.close","worktree.abandon","worktree.finalize"];class c extends Error{static{n(this,"MachineOfflineError")}environmentId;sent;code="machine_offline";constructor(e,r,o=!1){super(`machine ${e} is offline${r?`: ${r}`:""}`),this.environmentId=e,this.sent=o}}class l extends c{static{n(this,"MachineLaunchUncertainError")}uncertain=!0;constructor(e,r){super(e,r,!0)}}class h extends Error{static{n(this,"MachineLostError")}environmentId;callId;code="machine_lost";constructor(e,r){super(`call ${r} to machine ${e} was lost`),this.environmentId=e,this.callId=r}}class d extends Error{static{n(this,"MachineCallFailedError")}environmentId;op;code="machine_call_failed";constructor(e,r,o){super(`${r} on machine ${e} failed: ${o}`),this.environmentId=e,this.op=r}}export{i as MACHINE_OPS,d as MachineCallFailedError,l as MachineLaunchUncertainError,h as MachineLostError,c as MachineOfflineError};
|
|
1
|
+
var s=Object.defineProperty;var n=(t,e)=>s(t,"name",{value:e,configurable:!0});const i=["start","wake","stop","status","status.all","delete","viewer","cron.run","cron.cancel","worktree.create","worktree.rollback","worktree.close","worktree.abandon","worktree.finalize","repo.identify"];class c extends Error{static{n(this,"MachineOfflineError")}environmentId;sent;code="machine_offline";constructor(e,r,o=!1){super(`machine ${e} is offline${r?`: ${r}`:""}`),this.environmentId=e,this.sent=o}}class l extends c{static{n(this,"MachineLaunchUncertainError")}uncertain=!0;constructor(e,r){super(e,r,!0)}}class h extends Error{static{n(this,"MachineLostError")}environmentId;callId;code="machine_lost";constructor(e,r){super(`call ${r} to machine ${e} was lost`),this.environmentId=e,this.callId=r}}class d extends Error{static{n(this,"MachineCallFailedError")}environmentId;op;code="machine_call_failed";constructor(e,r,o){super(`${r} on machine ${e} failed: ${o}`),this.environmentId=e,this.op=r}}export{i as MACHINE_OPS,d as MachineCallFailedError,l as MachineLaunchUncertainError,h as MachineLostError,c as MachineOfflineError};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var he=Object.defineProperty;var d=(e,o)=>he(e,"name",{value:o,configurable:!0});import{accessSync as pe,constants as ke}from"node:fs";import{isAbsolute as _e,resolve as ve,join as ge}from"node:path";import{appSpace as ye}from"../layout.js";import{ApiError as oe}from"../../api/errors.js";import{spawnNode as be,forkSourceNode as xe,currentNodeContext as $e,rootOfSpine as Ce,newNodeId as Se,preflightNodeId as Oe}from"./nodes.js";import{resolveProfileOperand as Ee}from"../profiles/manifest.js";import{selectProfileForCwd as Re,selectProfileForCwdReadOnly as Ie}from"../profiles/select.js";import{buildLaunchSpecAsync as re,buildPiArgv as Fe}from"./launch.js";import{runsOnBlaxel as Me,sandboxWorktreeRequest as Be}from"../../daemon/api/environment-of.js";import{createManagedWorktreeAsync as Pe,rollbackManagedWorktreeAsync as De}from"../worktree-mutation-async.js";import{createManagedWorktreeOnMachine as Ne,rollbackManagedWorktreeOnMachine as Le,worktreeMachineOf as Te}from"../worktree-machine.js";import{usage as w,brokerLaunchFailed as N}from"../errors.js";import{writeGoal as Ae}from"./kickoff.js";import{appendSituationalContext as We,formatSituationalProse as je}from"./situational-context.js";import{ensureRoadmap as ze}from"./roadmap.js";import{buildWakeBearings as He}from"./bearings.js";import{encodeKickoffOrigin as Ke,KICKOFF_ORIGIN_ENV as Ge}from"./stamp/protocol.js";import{carryInitialInput as Ue}from"../runs/initial-input.js";import{ExecutionCapReached as Ve,beginExecution as Xe,crtrHome as qe,getNode as u,fullName as te,jobDir as Ye,recordExecutionPid as Je,abortExecution as z,setFrozen as H}from"../canvas/index.js";import{contextDir as K,nodeAgentDir as G}from"../canvas/node-agent-paths.js";import{copyTreeBeneath as Qe}from"../spaces/open-beneath.js";import{conversationIdFromPath as L,conversationStore as S}from"../conversation-store/index.js";import{appMemoryTooSmall as Ze,boundFleet as en,brokerThresholdsForDaemon as ie}from"./fleet.js";import{admitBrokerMemory as nn}from"./memory-admission.js";import{emitEvent as T}from"../events/emit.js";import{remoteEnvironmentOf as on}from"./blaxel-environment.js";import{openViewerWindow as rn,focusOf as tn,windowOfPane as an}from"./placement.js";import{awaitBrokerViewSocket as dn}from"./view-socket.js";import{readLogSnapshot as sn}from"../events/read.js";import{transition as g}from"./lifecycle.js";import{beginBootFaultAttempt as ln}from"../canvas/recovery.js";import{headlessBrokerHost as U}from"./host.js";import{ensureDaemon as cn}from"../../daemon/manage.js";import{readConfig as un}from"../config.js";import{modelRequestFromConfig as fn,unregisteredConcreteModel as wn,unroutableConcreteModel as mn}from"../model-routes.js";import{openModelRegistry as hn}from"./model-registry.js";import{MODEL_SPEC_NEXT as pn}from"./model-selection.js";import{forkNodeLedger as kn}from"./ledger.js";import{appRungForGrant as _n}from"../llm/app-rungs.js";import{APP_FAMILY as V}from"../model-routes.js";import{discoverLifecycleHookRegistry as vn}from"../command-hooks/discovery.js";import{invokeLifecycleHooks as gn}from"../command-hooks/transport/exec-lifecycle.js";import{someAsync as yn}from"../async-array.js";import{checkStart as bn}from"./start-check.js";function y(e){return{detail:{schema:"crtr.node-outcome-detail/v1",message:e instanceof Error?e.message:String(e)}}}d(y,"launchFailureOutcome");async function xn(e,o,a){try{return await U.launch(e,o,a)}catch(r){try{await g(e,"crash",{reason:"launch_failed",outcome:y(r)})}catch{}const t=r.message;throw N(t.startsWith("[broker]")?t:`[broker] refusing to launch ${e}: ${t}`,"Inspect the cause above, fix the launch recipe or environment, then retry.")}}d(xn,"launchBrokerOrCrash");function $n(e){return sn({nodeId:e,component:"broker",pattern:"broker.startup."},!1).items.flatMap(a=>a.kind==="event"&&a.envelope.event.startsWith("broker.startup.")&&a.envelope.event!=="broker.startup.warning"?[a.envelope.event.slice(15)]:[]).at(-1)??null}d($n,"lastStartupStep");function Cn(e,o){const a=$n(e),r=a===null?"it had logged no startup step":`the last startup step it logged was \`${a}\``;if(o.reason==="exited"){const{code:t,signal:s}=o.status;return{text:`exited (code ${t??"null"}, signal ${s??"null"}) before binding its view socket; ${r}`,fields:{reason:"exited",code:t,signal:s,last_startup_step:a}}}return{text:`was still starting after ${Math.round(o.waitedMs/1e3)} s without binding its view socket, so the launcher stopped it; ${r}`,fields:{reason:"timeout",waited_ms:o.waitedMs,last_startup_step:a}}}d(Cn,"notReadyDescription");async function Sn(e,o){try{await g(e,"crash",{reason:"launch_failed",outcome:y(o)})}catch{}try{U.teardown(e)}catch{}}d(Sn,"crashAndTearDown");async function On(e){const o=(await S().list()).map(({conversation_id:t,path:s})=>({id:t,path:s})),a=o.filter(t=>t.id===e),r=a.length>0?a:o.filter(t=>t.id.startsWith(e));if(r.length===0)throw w(`--fork-from '${e}': no pi session with that id found.`,{next:"Pass a live node id, a real session uuid/prefix, or an absolute .jsonl session path."});if(r.length>1)throw w(`--fork-from '${e}': ambiguous \u2014 ${r.length} sessions match that id prefix; pass the full id or the .jsonl path.`,{next:"Pass the full session uuid or an absolute .jsonl path to disambiguate."});return r[0].path}d(On,"resolveSessionUuid");async function ae(e){const o=e.trim();if(o==="")throw w("--fork-from requires a node id, session file, or session uuid.",{next:"Pass a live node id, an absolute .jsonl session path, or a session uuid/prefix."});if(o.includes("/")||o.endsWith(".jsonl")){const r=L(_e(o)?o:ve(process.cwd(),o));if(r===null)throw w(`--fork-from '${o}': invalid conversation path.`,{next:"Pass a conversation file path or id."});return(await S().header(r)).path}const a=await u(o);if(a!==null){const r=a.pi_session_file;if(r==null||r==="")throw w(`node ${o} has no pi session yet \u2014 it has not captured a session FILE to fork from (the broker forks a .jsonl path, not a bare id).`,{next:"Pick a node that has captured a session, or drop --fork-from."});const t=L(r);if(t===null)throw w(`node ${o} has no valid conversation id.`,{next:"Pick a node with a captured conversation."});return(await S().header(t)).path}return await On(o)}d(ae,"resolveForkSource");async function En(e,o,a,r={}){return e===null?null:e!==void 0&&e!==""?Ee(e).profileId:o!==null?(await u(o))?.profile_id??null:r.readOnlySelection===!0?Ie(a):Re(a)}d(En,"resolveProfileId");function de(e){const o=e.modelIntent===void 0?void 0:`${e.modelIntent.family}/${e.modelIntent.strength}`;return fn(e.model,o,e.modelExact===!0)}d(de,"requestFromLaunch");async function se(e,o,a){const r=a??(e.modelIntent?`${e.modelIntent.family}/${e.modelIntent.strength}`:e.model),t=await _n(o,r,e.modelExact===!0);if(t===null)return e;const{CRTR_MODEL_INTENT:s,...l}=e.env??{};return{...e,model:t.model,modelIntent:{family:V,strength:t.strength},modelExact:void 0,env:{...l,CRTR_MODEL_INTENT:`${V}/${t.strength}`}}}d(se,"appPaidLaunch");async function le(e,o,a){if(e===void 0||e.kind==="logical"&&e.family!==V)return;const r=await wn(e.kind==="logical"?{kind:"concrete",spec:e.spec}:e,a??await hn(),o);if(r!==void 0)throw w(`model '${r.request.spec}' is not registered in this daemon.`,{received:r.request.spec,next:pn});const t=await mn(e,o);if(t!==void 0)throw w(`model '${t.spec}' is registered but no configured model route offers it, so no turn could be served.`,{received:t.spec,next:"Pick a model from your configured routes (`crtr sys config get modelLadders`), or add this one to a ladder or route."})}d(le,"assertLaunchModelRegistered");function Rn(e,o,a){const r=e??o??null;if(!a&&r===null)throw new Error("spawnChild requires a calling node (CRTR_NODE_ID) or an explicit parent");return r}d(Rn,"resolveSpawner");async function ce(e,o,a){try{cn()}catch{}const r=$e(),t=e.root===!0,s=Rn(e.parent,r.nodeId??null,t),l=e.mode??"base",b=e.rootLifecycle??(t?"resident":"terminal"),ue=t&&b==="resident",E=s===null?null:await u(s),X=e.creator===void 0||e.creator===null?null:await u(e.creator);e.nodeId!==void 0&&await Oe(e.nodeId);const x=e.forkFrom!==void 0?await ae(e.forkFrom):void 0,A=x===void 0?null:await xe(x),W=await yn([E,X,A],async f=>f?.isolated===!0||f?.run_id!=null&&(await u(f.run_id))?.isolated===!0);if(W&&e.isolated===!1)throw new oe(403,"isolated_run","isolation cannot be turned off under an isolated run",{param:"isolated"});const R=W||e.isolated===!0;if(R&&e.worktree===!0)throw new oe(400,"invalid_request","isolated nodes cannot use a worktree",{param:"worktree"});const $=e.worktree===!0,m=R||$?e.nodeId??await Se():e.nodeId,I=R?e.run!==void 0&&t&&!W?e.cwd:ge(ye(e.run?.grantee??E?.grantee??"app:terminal").nodes,m):e.cwd,h=await En(e.profile,s,I),q=e.run?.grant_id??E?.grant_id??null,O=e.run??X??E??A,Y=await se((await re(e.kind,l,{lifecycle:b,hasManager:!t,model:e.model,modelOverride:e.model!==void 0,cwd:I,profileId:h,app:O?.grantee??"app:terminal"})).launch,q,e.model);await le(de(Y),{cwd:I,profileId:h}),await bn({grantee:O?.grantee??"app:terminal",sub:O?.sub,grant_id:O?.grant_id});const J=A?.node_id??null;let p,F=I;const M=$&&await Me(h)?await Be(h,e.worktreeCwd??e.cwd,m,e.worktreeBase):void 0,B=$&&M===void 0?await Te(h):null;try{$&&M===void 0&&(p=B!==null?await Ne(B,e.worktreeCwd??e.cwd,m,e.worktreeBase):await Pe(e.worktreeCwd??e.cwd,m,e.worktreeBase),F=p.path);const f=$?await se((await re(e.kind,l,{lifecycle:b,hasManager:!t,model:e.model,modelOverride:e.model!==void 0,cwd:F,profileId:h,app:O?.grantee??"app:terminal"})).launch,q,e.model):Y;M!==void 0&&(f.worktree=M),$&&await le(de(f),{cwd:F,profileId:h});const n=await be({kind:e.kind,mode:l,lifecycle:b,cwd:F,name:e.name??e.kind,description:e.description,parent:t?null:s,creator:e.creator,...e.actor===void 0?{}:{actor:e.actor},forkSourceNode:J,spawnedBy:t?s??void 0:void 0,profile_id:h,...e.scopes===void 0?{}:{scopes:e.scopes},isolated:R,...e.run===void 0?{}:{run:e.run},...e.causedBy===void 0?{}:{causedBy:e.causedBy},...e.withinCreate===void 0?{}:{withinCreate:e.withinCreate},forkFrom:e.forkFrom,forkSourceFile:x,modelOverride:e.model===void 0?void 0:f.model,...p!==void 0?{managedWorktree:p}:{},...m!==void 0?{nodeId:m}:{},...e.reviewBinding===void 0?{}:{reviewBinding:e.reviewBinding},...e.deadlineAt===void 0?{}:{deadlineAt:e.deadlineAt},...e.outcomeDelivery===void 0?{}:{outcomeDelivery:e.outcomeDelivery},launch:f});if(a?.(n.node_id),e.forkFrom!==void 0)try{await kn(n.node_id,J??null)}catch(i){throw await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),i}if(await Ae(n.node_id,e.prompt),e.situationalContext!==void 0&&await We(n.node_id,je(e.situationalContext)),o!==void 0)try{o(n.node_id)}catch(i){throw await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),i}const j=e.prompt!=="",fe=`${j&&e.wakeOrigin!==void 0?`${He(e.wakeOrigin)}
|
|
1
|
+
var ke=Object.defineProperty;var d=(e,r)=>ke(e,"name",{value:r,configurable:!0});import{accessSync as _e,constants as ve}from"node:fs";import{isAbsolute as ge,resolve as ye,join as be}from"node:path";import{appSpace as xe}from"../layout.js";import{ApiError as oe}from"../../api/errors.js";import{spawnNode as Ce,forkSourceNode as $e,currentNodeContext as Se,rootOfSpine as Ee,newNodeId as te,preflightNodeId as Oe}from"./nodes.js";import{resolveProfileOperand as Re}from"../profiles/manifest.js";import{selectProfileForCwd as Ie,selectProfileForCwdReadOnly as Fe}from"../profiles/select.js";import{buildLaunchSpecAsync as ie,buildPiArgv as Me}from"./launch.js";import{devEnvironmentCwd as Be,runsOnBlaxel as Pe,sandboxWorktreeRequest as De}from"../../daemon/api/environment-of.js";import{createManagedWorktreeAsync as Ne,rollbackManagedWorktreeAsync as Le}from"../worktree-mutation-async.js";import{createManagedWorktreeOnMachine as Te,rollbackManagedWorktreeOnMachine as Ae,worktreeMachineOf as We}from"../worktree-machine.js";import{usage as h,brokerLaunchFailed as L}from"../errors.js";import{writeGoal as je}from"./kickoff.js";import{appendSituationalContext as ze,formatSituationalProse as He}from"./situational-context.js";import{ensureRoadmap as Ke}from"./roadmap.js";import{buildWakeBearings as Ge}from"./bearings.js";import{encodeKickoffOrigin as Ue,KICKOFF_ORIGIN_ENV as Ve}from"./stamp/protocol.js";import{carryInitialInput as Xe}from"../runs/initial-input.js";import{ExecutionCapReached as qe,beginExecution as Ye,crtrHome as Je,getNode as u,fullName as ae,jobDir as Qe,recordExecutionPid as Ze,abortExecution as H,setFrozen as K}from"../canvas/index.js";import{contextDir as G,nodeAgentDir as U}from"../canvas/node-agent-paths.js";import{copyTreeBeneath as en}from"../spaces/open-beneath.js";import{conversationIdFromPath as T,conversationStore as S}from"../conversation-store/index.js";import{appMemoryTooSmall as nn,boundFleet as rn,brokerThresholdsForDaemon as de}from"./fleet.js";import{admitBrokerMemory as on}from"./memory-admission.js";import{emitEvent as A}from"../events/emit.js";import{remoteEnvironmentOf as tn}from"./blaxel-environment.js";import{openViewerWindow as an,focusOf as dn,windowOfPane as sn}from"./placement.js";import{awaitBrokerViewSocket as ln}from"./view-socket.js";import{readLogSnapshot as cn}from"../events/read.js";import{transition as g}from"./lifecycle.js";import{beginBootFaultAttempt as un}from"../canvas/recovery.js";import{headlessBrokerHost as V}from"./host.js";import{ensureDaemon as fn}from"../../daemon/manage.js";import{readConfig as wn}from"../config.js";import{modelRequestFromConfig as mn,unregisteredConcreteModel as hn,unroutableConcreteModel as pn}from"../model-routes.js";import{openModelRegistry as kn}from"./model-registry.js";import{MODEL_SPEC_NEXT as _n}from"./model-selection.js";import{forkNodeLedger as vn}from"./ledger.js";import{appRungForGrant as gn}from"../llm/app-rungs.js";import{APP_FAMILY as X}from"../model-routes.js";import{discoverLifecycleHookRegistry as yn}from"../command-hooks/discovery.js";import{invokeLifecycleHooks as bn}from"../command-hooks/transport/exec-lifecycle.js";import{someAsync as xn}from"../async-array.js";import{checkStart as Cn}from"./start-check.js";function y(e){return{detail:{schema:"crtr.node-outcome-detail/v1",message:e instanceof Error?e.message:String(e)}}}d(y,"launchFailureOutcome");async function $n(e,r,a){try{return await V.launch(e,r,a)}catch(o){try{await g(e,"crash",{reason:"launch_failed",outcome:y(o)})}catch{}const t=o.message;throw L(t.startsWith("[broker]")?t:`[broker] refusing to launch ${e}: ${t}`,"Inspect the cause above, fix the launch recipe or environment, then retry.")}}d($n,"launchBrokerOrCrash");function Sn(e){return cn({nodeId:e,component:"broker",pattern:"broker.startup."},!1).items.flatMap(a=>a.kind==="event"&&a.envelope.event.startsWith("broker.startup.")&&a.envelope.event!=="broker.startup.warning"?[a.envelope.event.slice(15)]:[]).at(-1)??null}d(Sn,"lastStartupStep");function En(e,r){const a=Sn(e),o=a===null?"it had logged no startup step":`the last startup step it logged was \`${a}\``;if(r.reason==="exited"){const{code:t,signal:s}=r.status;return{text:`exited (code ${t??"null"}, signal ${s??"null"}) before binding its view socket; ${o}`,fields:{reason:"exited",code:t,signal:s,last_startup_step:a}}}return{text:`was still starting after ${Math.round(r.waitedMs/1e3)} s without binding its view socket, so the launcher stopped it; ${o}`,fields:{reason:"timeout",waited_ms:r.waitedMs,last_startup_step:a}}}d(En,"notReadyDescription");async function On(e,r){try{await g(e,"crash",{reason:"launch_failed",outcome:y(r)})}catch{}try{V.teardown(e)}catch{}}d(On,"crashAndTearDown");async function Rn(e){const r=(await S().list()).map(({conversation_id:t,path:s})=>({id:t,path:s})),a=r.filter(t=>t.id===e),o=a.length>0?a:r.filter(t=>t.id.startsWith(e));if(o.length===0)throw h(`--fork-from '${e}': no pi session with that id found.`,{next:"Pass a live node id, a real session uuid/prefix, or an absolute .jsonl session path."});if(o.length>1)throw h(`--fork-from '${e}': ambiguous \u2014 ${o.length} sessions match that id prefix; pass the full id or the .jsonl path.`,{next:"Pass the full session uuid or an absolute .jsonl path to disambiguate."});return o[0].path}d(Rn,"resolveSessionUuid");async function se(e){const r=e.trim();if(r==="")throw h("--fork-from requires a node id, session file, or session uuid.",{next:"Pass a live node id, an absolute .jsonl session path, or a session uuid/prefix."});if(r.includes("/")||r.endsWith(".jsonl")){const o=T(ge(r)?r:ye(process.cwd(),r));if(o===null)throw h(`--fork-from '${r}': invalid conversation path.`,{next:"Pass a conversation file path or id."});return(await S().header(o)).path}const a=await u(r);if(a!==null){const o=a.pi_session_file;if(o==null||o==="")throw h(`node ${r} has no pi session yet \u2014 it has not captured a session FILE to fork from (the broker forks a .jsonl path, not a bare id).`,{next:"Pick a node that has captured a session, or drop --fork-from."});const t=T(o);if(t===null)throw h(`node ${r} has no valid conversation id.`,{next:"Pick a node with a captured conversation."});return(await S().header(t)).path}return await Rn(r)}d(se,"resolveForkSource");async function In(e,r,a,o={}){return e===null?null:e!==void 0&&e!==""?Re(e).profileId:r!==null?(await u(r))?.profile_id??null:o.readOnlySelection===!0?Fe(a):Ie(a)}d(In,"resolveProfileId");function le(e){const r=e.modelIntent===void 0?void 0:`${e.modelIntent.family}/${e.modelIntent.strength}`;return mn(e.model,r,e.modelExact===!0)}d(le,"requestFromLaunch");async function ce(e,r,a){const o=a??(e.modelIntent?`${e.modelIntent.family}/${e.modelIntent.strength}`:e.model),t=await gn(r,o,e.modelExact===!0);if(t===null)return e;const{CRTR_MODEL_INTENT:s,...l}=e.env??{};return{...e,model:t.model,modelIntent:{family:X,strength:t.strength},modelExact:void 0,env:{...l,CRTR_MODEL_INTENT:`${X}/${t.strength}`}}}d(ce,"appPaidLaunch");async function ue(e,r,a){if(e===void 0||e.kind==="logical"&&e.family!==X)return;const o=await hn(e.kind==="logical"?{kind:"concrete",spec:e.spec}:e,a??await kn(),r);if(o!==void 0)throw h(`model '${o.request.spec}' is not registered in this daemon.`,{received:o.request.spec,next:_n});const t=await pn(e,r);if(t!==void 0)throw h(`model '${t.spec}' is registered but no configured model route offers it, so no turn could be served.`,{received:t.spec,next:"Pick a model from your configured routes (`crtr sys config get modelLadders`), or add this one to a ladder or route."})}d(ue,"assertLaunchModelRegistered");function Fn(e,r,a){const o=e??r??null;if(!a&&o===null)throw new Error("spawnChild requires a calling node (CRTR_NODE_ID) or an explicit parent");return o}d(Fn,"resolveSpawner");async function fe(e,r,a){try{fn()}catch{}const o=Se(),t=e.root===!0,s=Fn(e.parent,o.nodeId??null,t),l=e.mode??"base",b=e.rootLifecycle??(t?"resident":"terminal"),we=t&&b==="resident",I=s===null?null:await u(s),q=e.creator===void 0||e.creator===null?null:await u(e.creator);e.nodeId!==void 0&&await Oe(e.nodeId);const x=e.forkFrom!==void 0?await se(e.forkFrom):void 0,W=x===void 0?null:await $e(x),j=await xn([I,q,W],async f=>f?.isolated===!0||f?.run_id!=null&&(await u(f.run_id))?.isolated===!0);if(j&&e.isolated===!1)throw new oe(403,"isolated_run","isolation cannot be turned off under an isolated run",{param:"isolated"});const E=j||e.isolated===!0;if(E&&e.worktree===!0)throw new oe(400,"invalid_request","isolated nodes cannot use a worktree",{param:"worktree"});let w=E||e.worktree===!0?e.nodeId??await te():e.nodeId,C=E?e.run!==void 0&&t&&!j?e.cwd:be(xe(e.run?.grantee??I?.grantee??"app:terminal").nodes,w):e.cwd;const m=await In(e.profile,s,C),F=E?null:await Be(m,e.worktreeCwd??C);F!==null&&(C=F,w??=await te());const O=e.worktree===!0||F!==null,Y=e.run?.grant_id??I?.grant_id??null,R=e.run??q??I??W,J=await ce((await ie(e.kind,l,{lifecycle:b,hasManager:!t,model:e.model,modelOverride:e.model!==void 0,cwd:C,profileId:m,app:R?.grantee??"app:terminal"})).launch,Y,e.model);await ue(le(J),{cwd:C,profileId:m}),await Cn({grantee:R?.grantee??"app:terminal",sub:R?.sub,grant_id:R?.grant_id});const Q=W?.node_id??null;let p,M=C;const B=O&&await Pe(m)?await De(m,F??e.worktreeCwd??e.cwd,w,e.worktreeBase):void 0,P=O&&B===void 0?await We(m):null;try{O&&B===void 0&&(p=P!==null?await Te(P,e.worktreeCwd??e.cwd,w,e.worktreeBase):await Ne(e.worktreeCwd??e.cwd,w,e.worktreeBase),M=p.path);const f=O?await ce((await ie(e.kind,l,{lifecycle:b,hasManager:!t,model:e.model,modelOverride:e.model!==void 0,cwd:M,profileId:m,app:R?.grantee??"app:terminal"})).launch,Y,e.model):J;B!==void 0&&(f.worktree=B),O&&await ue(le(f),{cwd:M,profileId:m});const n=await Ce({kind:e.kind,mode:l,lifecycle:b,cwd:M,name:e.name??e.kind,description:e.description,parent:t?null:s,creator:e.creator,...e.actor===void 0?{}:{actor:e.actor},forkSourceNode:Q,spawnedBy:t?s??void 0:void 0,profile_id:m,...e.scopes===void 0?{}:{scopes:e.scopes},isolated:E,...e.run===void 0?{}:{run:e.run},...e.causedBy===void 0?{}:{causedBy:e.causedBy},...e.withinCreate===void 0?{}:{withinCreate:e.withinCreate},forkFrom:e.forkFrom,forkSourceFile:x,modelOverride:e.model===void 0?void 0:f.model,...p!==void 0?{managedWorktree:p}:{},...w!==void 0?{nodeId:w}:{},...e.reviewBinding===void 0?{}:{reviewBinding:e.reviewBinding},...e.deadlineAt===void 0?{}:{deadlineAt:e.deadlineAt},...e.outcomeDelivery===void 0?{}:{outcomeDelivery:e.outcomeDelivery},launch:f});if(a?.(n.node_id),e.forkFrom!==void 0)try{await vn(n.node_id,Q??null)}catch(i){throw await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),i}if(await je(n.node_id,e.prompt),e.situationalContext!==void 0&&await ze(n.node_id,He(e.situationalContext)),r!==void 0)try{r(n.node_id)}catch(i){throw await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),i}const z=e.prompt!=="",me=`${z&&e.wakeOrigin!==void 0?`${Ge(e.wakeOrigin)}
|
|
2
2
|
|
|
3
|
-
`:""}${e.prompt}`;l==="orchestrator"&&await
|
|
3
|
+
`:""}${e.prompt}`;l==="orchestrator"&&await Ke(n.node_id,{goal:e.prompt.trim()}),await Mn(n);let Z;if(x!==void 0)try{const i=T(x);if(i===null)throw new Error(`invalid fork source ${x}`);const c=await S().fork(i,n.node_id);Z=(await S().header(c)).path}catch(i){throw await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),i}const k=Me(n,{prompt:me,resumeSessionPath:Z});if(k.env={...k.env,CRTR_SUBTREE:await Ee(n.node_id)},z){const i=e.wakeOrigin!==void 0?{type:"runtime",kind:"wake",wake:e.wakeOrigin}:{type:"runtime",kind:"kickoff",...n.spawned_by!=null&&n.spawned_by!==""?{spawnedBy:n.spawned_by}:{}};k.env[Ve]=Ue(i),await Xe(k,n)}const _=rn();if(await tn(n.profile_id??null)!==null)return await K(n.node_id,new Date().toISOString()),A({level:"info",event:"broker.frozen",node_id:n.node_id,fields:{reason:"remote_environment"}}),{node:await u(n.node_id),frozen:!0,window:null,session:null};const ee=await _.reserveSlot(n.node_id),v=ee?await on(n.node_id):null;if(v?.verdict==="too_small"){_.releaseReservation(n.node_id);const i=nn(v);throw await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),i}if(!ee||v?.verdict==="denied")return v?.verdict==="denied"&&_.releaseReservation(n.node_id),await K(n.node_id,new Date().toISOString()),A({level:"info",event:"broker.frozen",node_id:n.node_id,fields:v?.verdict==="denied"?{reason:"app_memory",free_bytes:v.free_bytes,needed_bytes:v.needed_bytes}:{reason:"broker_cap",live_count:await _.occupancy(),hard_cap:de().automaticReviveCap}}),{node:await u(n.node_id),frozen:!0,window:null,session:null};const he=await un(n.node_id),{automaticReviveCap:pe}=de();let $;try{$=await Ye(n.node_id,{daemonEpoch:_.epoch(),cap:pe})}catch(i){if(!(i instanceof qe))throw i;return _.releaseReservation(n.node_id),await K(n.node_id,new Date().toISOString()),A({level:"info",event:"broker.frozen",node_id:n.node_id,fields:{reason:"broker_cap",live_count:i.live,hard_cap:i.cap}}),{node:await u(n.node_id),frozen:!0,window:null,session:null}}k.env={...k.env,CRTR_EXECUTION_ID:$};let D;try{D=await $n(n.node_id,k,{cwd:n.cwd,name:ae(n),resuming:!1})}catch(i){throw await H($,{reason:"launch_failed"}),i}finally{_.releaseReservation(n.node_id)}if(D.pid===null){const i=new Error(`broker host returned no pid for ${n.node_id}`);throw await H($,{reason:"launch_failed"}),await g(n.node_id,"crash",{reason:"launch_failed",outcome:y(i)}),L(`failed to launch the broker engine for ${n.node_id} (${n.name}) \u2014 the node was not started.`,`Inspect canonical event diagnostics with \`crtr sys logs --node ${n.node_id}\`, then verify the pi engine can start in this environment.`)}if(await Ze($,n.node_id,D.pid)==="shutdown")throw await H($,{reason:"superseded"}),V.teardown(n.node_id),L(`broker execution was superseded for ${n.node_id}`,"Retry spawning the node.");if(we&&e.readiness==="await"){const i=await ln(n.node_id,D.exited);if(!i.ready){const c=En(n.node_id,i);A({level:"error",event:"broker.launch.not_ready",node_id:n.node_id,fields:c.fields});const N=await he.explanation();throw await On(n.node_id,new Error(N??c.text)),L(N!==null?`the root broker ${n.node_id} could not start \u2014 ${N}`:`the root broker ${n.node_id} ${c.text} \u2014 it was not started.`,N!==null?"Resolve the cause named above, then retry.":`Inspect canonical event diagnostics with \`crtr sys logs --node ${n.node_id}\`, then retry.`)}}let ne=null,re=null;if(!t&&s!==null&&wn("user").auto_open_child_viewers)try{const i=await dn(s);if(i!==null&&i.pane!==null&&i.pane!==""){const c=await an(n.node_id,i.session??"",{name:ae(n),cwd:e.cwd,besidePane:i.pane,waitForBroker:!0,initialWhip:z});c!==null&&c.pane!==null&&c.pane!==""&&(re=c.session,ne=sn(c.pane))}}catch{}return{node:await u(n.node_id),frozen:!1,window:ne,session:re}}catch(f){throw p!==void 0&&w!==void 0&&await u(w)===null&&(P!==null?await Ae(P,p):await Le(p)),f}}d(fe,"spawnChildPrepared");async function Er(e){return fe(e)}d(Er,"spawnChild");async function Mn(e){const r=yn(e.cwd,e.profile_id).plans.get("node:start")??[];await bn(r,{node:{id:e.node_id,name:e.name,kind:e.kind,mode:e.mode,lifecycle:e.lifecycle,cwd:e.cwd,nodeDir:await U(e.node_id),contextDir:await G(e.node_id),jobDir:Qe(e.node_id)},runtime:{isBirth:!0,canvasHome:Je(),profile:e.profile_id??null}})}d(Mn,"invokeBirthLifecycleHooks");const Bn=new Set(["initial-prompt.md","yield-message.md","result.json","jobs"]);async function Or(e,r,a){const o=await u(e);if(o===null)throw h(`unknown node: ${e}`,{received:e,next:"List nodes and pass the id of a node with a captured pi session."});const t=await se(e),s=await G(e);try{await S().header(T(t)),_e(s,ve.R_OK)}catch(l){throw new Error(`cannot fork ${e}: its conversation or context is unreadable \u2014 ${l.message}`)}return fe({kind:o.kind,mode:"base",cwd:o.cwd,prompt:"",root:!0,readiness:"await",forkFrom:e,...a===void 0?{}:{actor:a},profile:o.profile_id,model:o.model_override??void 0,...r===void 0?{}:{scopes:r}},async l=>{const b=await G(l);en(await U(e),s,await U(l),b,Bn)})}d(Or,"forkNode");export{ce as appPaidLaunch,ue as assertLaunchModelRegistered,Or as forkNode,Mn as invokeBirthLifecycleHooks,se as resolveForkSource,In as resolveProfileId,Fn as resolveSpawner,Er as spawnChild,fe as spawnChildPrepared};
|
package/dist/core/scope.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var D=Object.defineProperty;var
|
|
1
|
+
var D=Object.defineProperty;var t=(o,r)=>D(o,"name",{value:r,configurable:!0});import{envProfileId as $,isSandboxedNode as S}from"../shared/env.js";import{projectPaths as g}from"../api/dto/profiles.js";import{homedir as j}from"node:os";import{existsSync as k,statSync as M}from"node:fs";import{join as n,resolve as a,dirname as C,sep as h}from"node:path";import{CRTR_DIR_NAME as p}from"../types.js";import{assetRoot as P}from"./asset-root.js";import{usage as b}from"./errors.js";import{loadProfileManifest as N}from"./profiles/manifest.js";import{realpathOrSelf as i}from"./fs-utils.js";import{appsRoot as W,layoutRoot as _,runtimeRoot as x}from"./layout.js";function X(){return n(P(),"builtin-memory")}t(X,"builtinMemoryRoot");function q(){return n(P(),"builtin-pi-packages")}t(q,"builtinPiPackagesDir");function Y(o){return n(q(),o)}t(Y,"builtinPiPackageDir");function d(){return n(x(),"scope")}t(d,"userScopeRoot");function A(o,r){if(!k(o)||i(o)===i(n(j(),p))||i(o).startsWith(`${i(W())}${h}`)&&o.endsWith(`${h}home${h}${p}`)||!S()&&(i(o)===i(r)||i(o)===i(_())))return!1;try{return M(o).isDirectory()}catch{return!1}}t(A,"isProjectScopeDir");function y(o=process.cwd()){return v(o)[0]??null}t(y,"findProjectScopeRoot");function E(o,r){const e=[],f=i(j());let u=a(o);for(;;){const s=n(u,p);if(A(s,r)&&e.push(s),i(u)===f)return e;const c=C(u);if(c===u)return e;u=c}}t(E,"collectAncestorScopeRoots");function v(o=process.cwd(),r=$()||null){return L(o,r)}t(v,"findProjectScopeRoots");function L(o,r){const e=a(o),f=d(),u=[e];if(!S()&&r!==null&&r!=="")try{const{manifest:l}=N(r);u.push(...g(l.projects))}catch{}const s=new Set,c=[];for(const l of u)for(const m of E(l,f))s.has(m)||(s.add(m),c.push(m));return c}t(L,"resolveProjectScopeRoots");function w(o){return y(o)}t(w,"projectScopeRoot");function Z(o,r){return v(o,r)}t(Z,"projectScopeRoots");function R(o){return o==="builtin"?null:o==="user"?d():w()}t(R,"scopeRoot");function oo(o){const r=R(o);if(!r)throw b(`no ${o} scope available \u2014 run \`crtr init\` here or use --scope user`);return r}t(oo,"requireScopeRoot");function ro(o=process.cwd()){const r=y(o);return r||n(a(o),p)}t(ro,"ensureProjectScopeRoot");function to(o){const r=o==="user"?x():R(o);return r?n(r,"plugins"):null}t(to,"pluginsDir");function eo(o){const r=o==="user"?x():R(o);return r?n(r,"marketplaces"):null}t(eo,"marketplacesDir");function no(o){return n(o.root,"memory")}t(no,"pluginMemoryDir");function O(o){if(o===void 0)return"all";const r=o.toLowerCase();if(r==="user"||r==="project"||r==="builtin"||r==="all")return r;throw b(`invalid --scope: ${o} (expected user|project|builtin|all)`)}t(O,"resolveScopeArg");function io(o){const r=O(o);if(r==="all"){const e=[];return w()&&e.push("project"),e.push("user"),e.push("builtin"),e}return[r]}t(io,"listScopes");export{X as builtinMemoryRoot,Y as builtinPiPackageDir,q as builtinPiPackagesDir,ro as ensureProjectScopeRoot,y as findProjectScopeRoot,v as findProjectScopeRoots,io as listScopes,eo as marketplacesDir,no as pluginMemoryDir,to as pluginsDir,w as projectScopeRoot,Z as projectScopeRoots,oo as requireScopeRoot,O as resolveScopeArg,R as scopeRoot,d as userScopeRoot};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
ALTER TABLE profile_projects DROP COLUMN memory;`),e.exec(`PRAGMA user_version = ${p}`)),c(e)===p&&!
|
|
1
|
+
var P=Object.defineProperty;var i=(e,o)=>P(e,"name",{value:o,configurable:!0});import{DatabaseSync as f}from"node:sqlite";import{forgetPrepared as I}from"../sqlite-statements.js";import{chmodSync as m,existsSync as a,mkdirSync as _,readdirSync as C,rmSync as j,statSync as v,writeFileSync as D}from"node:fs";import{join as n}from"node:path";import k from"proper-lockfile";import{CONFIG_FILE as y,PROFILE_DIR as G,STATE_FILE as l}from"../../types.js";import{withExclusiveDirectoryLock as L}from"../exclusive-lock.js";import{syncDirectory as $,syncFile as g}from"../fs-utils.js";import{layoutNeedsMigration as U}from"../layout.js";import{providerStore as F,projectStore as B,userStore as X}from"./paths.js";import{createScopedSchema as H,ensureProviderModelCooldowns as K,PROFILE_ENVIRONMENT_COLUMN as R,PROFILE_PROJECT_REPO_COLUMN as A,PROVIDER_SCHEMA_VERSION as S,SCOPED_SCHEMA_VERSION as p}from"./schema.js";const u=new Map,z=/^[a-z0-9]+(?:-[a-z0-9]+)*-[0-9a-f]{8}$/;function Q(e,o,r){e.prepare("UPDATE scope_owners SET root=? WHERE owner_key=?").run(r,o)}i(Q,"writeOwnerRoot");function c(e){return Number(e.prepare("PRAGMA user_version").get().user_version)}i(c,"version");function M(e,o){const r=c(e);if(r===0)throw new Error(`scoped SQL store is uninitialized: ${o.path}; crtr was updated and \`crtr sys daemon restart\` converts local state`);const t=o.kind==="provider"?S:p;if(r>t)throw new Error(`scoped SQL store ${o.path} uses unsupported schema version ${r}`);if(r!==t)throw new Error(`scoped SQL store ${o.path} requires an explicit conversion`)}i(M,"assertVersion");function w(e){return e.prepare("PRAGMA table_info(profiles)").all().some(({name:o})=>o===R)}i(w,"profilesHaveEnvironmentColumn");function x(e,o,r){return e.prepare(`PRAGMA table_info(${o})`).all().some(({name:t})=>t===r)}i(x,"hasColumn");function V(e){x(e,"profile_projects",A)||e.exec(`ALTER TABLE profile_projects ADD COLUMN ${A} TEXT`),e.exec("CREATE TABLE IF NOT EXISTS profile_project_repos (profile_id TEXT NOT NULL REFERENCES profiles(id) ON DELETE CASCADE, repo TEXT NOT NULL, position INTEGER NOT NULL, PRIMARY KEY(profile_id,repo))")}i(V,"addProfileProjectRepos");function O(e,o){if(o.kind==="provider"){c(e)===S&&(e.exec("PRAGMA busy_timeout = 5000"),K(e));return}if(!(c(e)>p)&&(e.exec("PRAGMA busy_timeout = 5000"),!(c(e)===p&&w(e)&&x(e,"profile_projects",A)))){e.exec("BEGIN IMMEDIATE");try{c(e)===1&&(e.prepare("PRAGMA table_info(profiles)").all().some(({name:t})=>t==="grantee")||e.exec("ALTER TABLE profiles ADD COLUMN grantee TEXT"),e.exec("PRAGMA user_version = 2")),c(e)===2&&(e.prepare("PRAGMA table_info(profiles)").all().some(({name:t})=>t==="home")&&e.exec("ALTER TABLE profiles DROP COLUMN home"),e.exec("PRAGMA user_version = 3")),c(e)===3&&(e.exec("ALTER TABLE profiles ADD COLUMN delivery_limits_json TEXT NOT NULL DEFAULT '{}' CHECK(json_valid(delivery_limits_json))"),e.exec("PRAGMA user_version = 4")),c(e)===4&&(e.exec("CREATE TABLE IF NOT EXISTS legacy_project_caps (profile_id TEXT NOT NULL, path TEXT NOT NULL, memory TEXT NOT NULL CHECK(memory IN ('none','name','preview')), PRIMARY KEY(profile_id,path))"),e.prepare("PRAGMA table_info(profile_projects)").all().some(({name:t})=>t==="memory")&&e.exec(`INSERT INTO legacy_project_caps SELECT profile_id, path, memory FROM profile_projects WHERE memory != 'content';
|
|
2
|
+
ALTER TABLE profile_projects DROP COLUMN memory;`),e.exec(`PRAGMA user_version = ${p}`)),c(e)===p&&!w(e)&&e.exec(`ALTER TABLE profiles ADD COLUMN ${R} TEXT`),c(e)===p&&V(e),e.exec("COMMIT")}catch(r){throw e.exec("ROLLBACK"),r}}}i(O,"upgradeScopedStore");function ue(e){const o=new f(e.path);try{O(o,e),M(o,e)}finally{o.close()}}i(ue,"assertScopedStoreReady");function W(e){if(!N(e))return;const o=new f(e.path,{readOnly:!0});let r;try{r=c(o)}finally{o.close()}if(r===0)for(const t of[e.path,`${e.path}-wal`,`${e.path}-shm`])j(t,{force:!0})}i(W,"discardIncompleteScopedStore");function Y(e,o){return L(n(e,".init.lock"),()=>{const r=n(e,l),t=Date.now()+5e3;let s=10;for(;;){let h;try{h=k.lockSync(r,{realpath:!1,retries:0,stale:3e4,update:1e4})}catch(E){if(E.code!=="ELOCKED")throw E;const T=t-Date.now();if(T<=0)throw new Error(`timed out waiting for project state conversion lock: ${r}`,{cause:E});Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,Math.min(s,T)),s=Math.min(s*2,250);continue}try{return o()}finally{h()}}})}i(Y,"withProjectStateLock");function d(e){a(e)&&m(e,384);for(const o of["-wal","-shm"])a(`${e}${o}`)&&m(`${e}${o}`,384)}i(d,"secure");function N(e){return a(e.path)}i(N,"scopedStoreExists");function q(e){if(e.kind==="project")return[n(e.root,l)];if(e.kind==="provider")return[n(e.root,"anthropic-subscriptions.json"),n(e.root,"openai-codex-subscriptions.json"),n(e.root,"provider-rotation.json")];const o=[n(e.root,y),n(e.root,l),n(e.root,"profile-defaults.json")],r=n(e.root,G);if(a(r))for(const t of C(r,{withFileTypes:!0}))t.isDirectory()&&z.test(t.name)&&o.push(n(r,t.name,"profile.json"),n(r,t.name,y),n(r,t.name,l));return o}i(q,"legacyScopedStorePaths");function J(e){const o=e.kind==="user"?X(e.root):e.kind==="project"?B(e.root):F(e.root);o.kind!=="project"&&_(o.root,{recursive:!0,mode:448});const r=i(()=>{if(o.kind==="project"&&W(o),N(o))return;const t=q(o).find(a);if(t!==void 0)throw new Error(`legacy scoped state exists at ${t}; crtr was updated and \`crtr sys daemon restart\` converts local state`);b(o,s=>{H(s,o.kind),o.kind!=="provider"&&Q(s,o.kind,o.root)})},"initialize");o.kind==="project"?Y(o.root,r):L(n(o.root,".init.lock"),r)}i(J,"initializeFreshScopedStore");function Z(e){if(U())throw new Error("layout_migration_required");const o=u.get(e.path);if(o!==void 0)return o;J(e);const r=new f(e.path);try{return r.exec("PRAGMA busy_timeout = 5000; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;"),O(r,e),M(r,e),d(e.path),u.set(e.path,r),r}catch(t){throw r.close(),t}}i(Z,"openScopedStore");function b(e,o){if(a(e.path))throw new Error(`scoped SQL store already exists: ${e.path}`);if(e.kind!=="project"&&_(e.root,{recursive:!0,mode:448}),!v(e.root).isDirectory())throw new Error(`scoped SQL root is not a directory: ${e.root}`);(e.kind!=="project"||process.platform!=="linux")&&m(e.root,448),D(e.path,"",{mode:384});const r=new f(e.path);try{r.exec("PRAGMA busy_timeout = 5000; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON; BEGIN IMMEDIATE;"),o(r),r.exec("COMMIT")}catch(t){try{r.exec("ROLLBACK")}catch{}throw t}finally{d(e.path),r.close()}g(e.path),$(e.root)}i(b,"createScopedStore");function Ee(e,o){const r=Z(e);if(r.isTransaction)return o(r);r.exec("BEGIN IMMEDIATE");try{const t=o(r);return r.exec("COMMIT"),d(e.path),t}catch(t){try{r.exec("ROLLBACK")}catch{}throw t}}i(Ee,"withScopedWrite");function me(){for(const e of u.values())I(e),e.close();u.clear()}i(me,"closeScopedStores");export{z as PROFILE_ID_SHAPE,ue as assertScopedStoreReady,me as closeScopedStores,b as createScopedStore,W as discardIncompleteScopedStore,J as initializeFreshScopedStore,q as legacyScopedStorePaths,Z as openScopedStore,N as scopedStoreExists,Y as withProjectStateLock,Ee as withScopedWrite,Q as writeOwnerRoot};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var
|
|
1
|
+
var y=Object.defineProperty;var n=(r,a)=>y(r,"name",{value:a,configurable:!0});import{prepared as o}from"../sqlite-statements.js";import{userStore as i}from"./paths.js";import{openScopedStore as u,scopedStoreExists as _,withScopedWrite as R}from"./db.js";function L(r){const a=i(r);if(!_(a))return null;const t=u(a),m=t.prepare("PRAGMA table_info(profile_projects)").all().some(({name:e})=>e==="repo")?t.prepare(`SELECT profile_id, path, repo, position FROM (SELECT profile_id, path, repo, position FROM profile_projects
|
|
2
|
+
UNION ALL SELECT profile_id, NULL, repo, position FROM profile_project_repos) ORDER BY profile_id, position`).all():t.prepare("SELECT profile_id, path, NULL AS repo, position FROM profile_projects ORDER BY profile_id, position").all(),E=o(t,"SELECT id, name, created_at, last_used_at, paused_at, default_kind, grantee, metadata_json, delivery_limits_json, environment_id FROM profiles ORDER BY rowid").all().map(e=>{const p=JSON.parse(e.metadata_json),f=JSON.parse(e.delivery_limits_json);return{profileId:e.id,manifest:{schema_version:1,name:e.name,projects:m.filter(s=>s.profile_id===e.id).map(s=>({...s.repo===null?{}:{repo:s.repo},...s.path===null?{}:{path:s.path}})),paused_at:e.paused_at,...e.default_kind===null?{}:{default_kind:e.default_kind},...e.grantee===null?{}:{grantee:e.grantee},...e.environment_id===null?{}:{environment_id:e.environment_id},...Object.keys(f).length===0?{}:{delivery_limits:f},...Object.keys(p).length===0?{}:{metadata:p},created_at:e.created_at,last_used_at:e.last_used_at}}}),k=Object.fromEntries(o(t,"SELECT directory, profile_id FROM profile_defaults").all().map(e=>[e.directory,e.profile_id])),c={};for(const e of o(t,"SELECT owner_key, raw_json FROM scope_settings WHERE owner_key != 'project'").all())c[e.owner_key]=JSON.parse(e.raw_json);const d={},l=n(e=>d[e]??={marketplaces:{},plugins:{},activeCanvas:null},"stateOf");for(const e of o(t,"SELECT owner_key, last_self_check, active_canvas FROM scope_bookkeeping WHERE owner_key != 'project'").all()){const p=l(e.owner_key);e.last_self_check!==null&&(p.last_self_check=e.last_self_check),p.activeCanvas=e.active_canvas}for(const e of o(t,"SELECT owner_key, name, last_updated FROM scope_marketplaces WHERE owner_key != 'project'").all())l(e.owner_key).marketplaces[e.name]=e.last_updated===null?{}:{last_updated:e.last_updated};for(const e of o(t,"SELECT owner_key, name, last_updated, etag, checked_at FROM scope_plugins WHERE owner_key != 'project'").all())l(e.owner_key).plugins[e.name]={...e.last_updated===null?{}:{last_updated:e.last_updated},...e.etag===null?{}:{etag:e.etag},...e.checked_at===null?{}:{checked_at:e.checked_at}};return{profiles:E,defaults:k,settings:c,state:d,apps:{}}}n(L,"readLegacyUserSnapshot");function v(r){const a=i(r);return _(a)?o(u(a),"SELECT profile_id, path, memory FROM legacy_project_caps ORDER BY profile_id, path").all().map(t=>({profileId:t.profile_id,path:t.path,memory:t.memory})):[]}n(v,"listLegacyProjectCaps");function w(r){const a=i(r);_(a)&&R(a,t=>{o(t,"DELETE FROM legacy_project_caps").run()})}n(w,"deleteLegacyProjectCaps");export{w as deleteLegacyProjectCaps,v as listLegacyProjectCaps,L as readLegacyUserSnapshot};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var y=Object.defineProperty;var c=(t,a)=>y(t,"name",{value:a,configurable:!0});import{openDb as D,withCanvasWrite as v}from"../canvas/db.js";import{appRevisionOf as w,revisionOf as L,setPersonSnapshot as I,setSettingsReloader as h,setSettingsTransport as j,SettingsRevisionConflictError as S}from"./person-store.js";const s=c(t=>typeof t=="string"?t:void 0,"s");async function k(t,a){const o=await t.prepare("SELECT * FROM profiles WHERE person = ? AND deleting_since IS NULL ORDER BY created_at, id").all(a),l=await t.prepare(`SELECT profile_id, path, repo, position FROM (
|
|
2
|
+
SELECT p.profile_id, p.path, p.repo, p.position FROM profile_projects p JOIN profiles f ON f.id = p.profile_id WHERE f.person = ?
|
|
3
|
+
UNION ALL SELECT r.profile_id, NULL AS path, r.repo, r.position FROM profile_project_repos r JOIN profiles f ON f.id = r.profile_id WHERE f.person = ?) e
|
|
4
|
+
ORDER BY profile_id, position`).all(a,a),n=new Map;for(const e of l)(n.get(e.profile_id)??n.set(e.profile_id,[]).get(e.profile_id)).push({...e.repo===null?{}:{repo:e.repo},...e.path===null?{}:{path:e.path}});const r=o.map(e=>{const p=JSON.parse(String(e.metadata_json)),_=JSON.parse(String(e.delivery_limits_json));return{profileId:String(e.id),manifest:{schema_version:1,name:String(e.name),projects:n.get(String(e.id))??[],paused_at:s(e.paused_at)??null,...s(e.default_kind)===void 0?{}:{default_kind:s(e.default_kind)},...s(e.grantee)===void 0?{}:{grantee:s(e.grantee)},...s(e.environment_id)===void 0?{}:{environment_id:s(e.environment_id)},...Object.keys(_).length===0?{}:{delivery_limits:_},...Object.keys(p).length===0?{}:{metadata:p},created_at:String(e.created_at),last_used_at:s(e.last_used_at)??null}}}),i=Object.fromEntries((await t.prepare("SELECT directory, profile_id FROM profile_defaults WHERE person = ?").all(a)).map(e=>[e.directory,e.profile_id])),f={};for(const e of await t.prepare("SELECT owner_key, raw_json FROM scope_settings WHERE person = ?").all(a))f[e.owner_key]=JSON.parse(e.raw_json);const E={},u={},d=c(e=>u[e]??={plugins:{},marketplaces:{},revision:""},"appOf"),m=c(e=>E[e]??={marketplaces:{},plugins:{},activeCanvas:null},"stateOf");for(const e of await t.prepare("SELECT owner_key, last_self_check, active_canvas FROM scope_bookkeeping WHERE person = ?").all(a)){const p=m(e.owner_key);e.last_self_check!==null&&(p.last_self_check=e.last_self_check),p.activeCanvas=e.active_canvas}for(const e of await t.prepare("SELECT * FROM scope_marketplaces WHERE person = ? ORDER BY owner_key, name").all(a)){const p=String(e.owner_key),_=String(e.name);if(p.startsWith("app:")){d(p).marketplaces[_]={url:s(e.url),ref:s(e.ref)??"",installed_at:s(e.installed_at)??""};continue}if(m(p).marketplaces[_]=s(e.last_updated)===void 0?{}:{last_updated:s(e.last_updated)},s(e.url)!==void 0){const g=f[p]??={},O=g.marketplaces??={};O[_]={url:s(e.url),ref:s(e.ref)??"",installed_at:s(e.installed_at)??""}}}for(const e of await t.prepare("SELECT * FROM scope_plugins WHERE person = ? ORDER BY owner_key, name").all(a)){const p=String(e.owner_key),_=String(e.name);if(p.startsWith("app:")){d(p).plugins[_]={enabled:Number(e.enabled)===1,...s(e.source_marketplace)===void 0?{}:{source_marketplace:s(e.source_marketplace)},...s(e.version)===void 0?{}:{version:s(e.version)}};continue}m(p).plugins[_]={...s(e.last_updated)===void 0?{}:{last_updated:s(e.last_updated)},...s(e.etag)===void 0?{}:{etag:s(e.etag)},...s(e.checked_at)===void 0?{}:{checked_at:s(e.checked_at)}};const g=f[p]??={},O=g.plugins??={};O[_]={enabled:Number(e.enabled)===1,...s(e.source_marketplace)===void 0?{}:{source_marketplace:s(e.source_marketplace)},...s(e.version)===void 0?{}:{version:s(e.version)}}}for(const e of Object.values(u))e.revision=w(e);return{profiles:r,defaults:i,settings:f,state:E,apps:u}}c(k,"readSnapshotFromRows");async function N(t){const a=await D(),o=await k(a,t);return I(t,o),o}c(N,"loadPersonSettings");async function C(t,a,o){return(await k(t,a)).settings[o]}c(C,"currentRaw");async function A(t,a,o){let l=!1;for(const n of o)if(n.op==="settings.replace"){const r=await C(t,a,n.owner);if(n.ifRevision!==L(r))throw new S;const{plugins:i,marketplaces:f,...E}=n.raw,u=JSON.stringify(E);await t.prepare("INSERT INTO scope_settings (person, owner_key, raw_json) VALUES (?, ?, ?) ON CONFLICT (person, owner_key) DO UPDATE SET raw_json = EXCLUDED.raw_json").run(a,n.owner,u);const d=JSON.stringify([r?.plugins,r?.marketplaces]);d!==JSON.stringify([i,f])&&!(d==="[null,null]"&&i===void 0&&f===void 0)&&(l=!0),await T(t,a,n.owner,i??{},f??{})}else if(n.op==="app-plugins.replace"){await t.prepare("SELECT pg_advisory_xact_lock(hashtext(?))").get(`app-plugins|${a}|${n.app}`);const r=(await k(t,a)).apps[n.app];if(n.ifRevision!==w(r))throw new S;w(n)!==w(r)&&(l=!0),await T(t,a,n.app,n.plugins,n.marketplaces)}else if(n.op==="state.write"){await t.prepare(`INSERT INTO scope_bookkeeping (person, owner_key, last_self_check, active_canvas) VALUES (?, ?, ?, ?)
|
|
5
|
+
ON CONFLICT (person, owner_key) DO UPDATE SET last_self_check = EXCLUDED.last_self_check, active_canvas = EXCLUDED.active_canvas`).run(a,n.owner,n.state.last_self_check??null,n.state.activeCanvas??null);for(const[r,i]of Object.entries(n.state.marketplaces))await t.prepare("UPDATE scope_marketplaces SET last_updated = ? WHERE person = ? AND owner_key = ? AND name = ?").run(i.last_updated??null,a,n.owner,r);for(const[r,i]of Object.entries(n.state.plugins))await t.prepare("UPDATE scope_plugins SET last_updated = ?, etag = ?, checked_at = ? WHERE person = ? AND owner_key = ? AND name = ?").run(i.last_updated??null,i.etag??null,i.checked_at??null,a,n.owner,r)}else if(n.op==="profile.insert"){const r=n.profile.manifest;await t.prepare("INSERT INTO profiles (id, person, name, created_at, last_used_at, paused_at, default_kind, grantee, metadata_json, delivery_limits_json, environment_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(n.profile.profileId,a,r.name,r.created_at,r.last_used_at,r.paused_at,r.default_kind??null,r.grantee??null,JSON.stringify(r.metadata??{}),JSON.stringify(r.delivery_limits??{}),r.environment_id??null),await R(t,n.profile)}else if(n.op==="profile.update"){const r=n.profile.manifest;if((await t.prepare("UPDATE profiles SET name = ?, last_used_at = ?, paused_at = ?, default_kind = ?, grantee = ?, metadata_json = ?, delivery_limits_json = ?, environment_id = ? WHERE id = ? AND person = ?").run(r.name,r.last_used_at,r.paused_at,r.default_kind??null,r.grantee??null,JSON.stringify(r.metadata??{}),JSON.stringify(r.delivery_limits??{}),r.environment_id??null,n.profile.profileId,a)).changes!==1)throw new Error(`no stored profile ${n.profile.profileId}`);await R(t,n.profile)}else if(n.op==="profile.delete"){const r=`profile:${n.profileId}`;for(const i of["scope_settings","scope_bookkeeping","scope_marketplaces","scope_plugins"])await t.prepare(`DELETE FROM ${i} WHERE person = ? AND owner_key = ?`).run(a,r);await t.prepare("DELETE FROM profiles WHERE id = ? AND person = ?").run(n.profileId,a)}else{await t.prepare("DELETE FROM profile_defaults WHERE person = ?").run(a);for(const[r,i]of Object.entries(n.defaults))await t.prepare("INSERT INTO profile_defaults (person, directory, profile_id) VALUES (?, ?, ?)").run(a,r,i)}l&&await t.prepare("INSERT INTO person_settings (person, plugins_revision) VALUES (?, 1) ON CONFLICT (person) DO UPDATE SET plugins_revision = person_settings.plugins_revision + 1").run(a),await t.prepare("SELECT pg_notify('crtr_signal', ?)").get(`settings:${a}`)}c(A,"applyOpsToRows");async function T(t,a,o,l,n){await t.prepare("DELETE FROM scope_plugins WHERE person = ? AND owner_key = ? AND NOT (name IN (SELECT jsonb_array_elements_text(?::jsonb)))").run(a,o,JSON.stringify(Object.keys(l)));for(const[r,i]of Object.entries(l))await t.prepare(`INSERT INTO scope_plugins (person, owner_key, name, enabled, source_marketplace, version) VALUES (?, ?, ?, ?, ?, ?)
|
|
3
6
|
ON CONFLICT (person, owner_key, name) DO UPDATE SET enabled = EXCLUDED.enabled, source_marketplace = EXCLUDED.source_marketplace, version = EXCLUDED.version`).run(a,o,r,i.enabled===!1?0:1,i.source_marketplace??null,i.version??null);await t.prepare("DELETE FROM scope_marketplaces WHERE person = ? AND owner_key = ? AND NOT (name IN (SELECT jsonb_array_elements_text(?::jsonb)))").run(a,o,JSON.stringify(Object.keys(n)));for(const[r,i]of Object.entries(n))await t.prepare(`INSERT INTO scope_marketplaces (person, owner_key, name, url, ref, installed_at) VALUES (?, ?, ?, ?, ?, ?)
|
|
4
|
-
ON CONFLICT (person, owner_key, name) DO UPDATE SET url = EXCLUDED.url, ref = EXCLUDED.ref, installed_at = EXCLUDED.installed_at`).run(a,o,r,i.url??null,i.ref??null,i.installed_at??null)}
|
|
7
|
+
ON CONFLICT (person, owner_key, name) DO UPDATE SET url = EXCLUDED.url, ref = EXCLUDED.ref, installed_at = EXCLUDED.installed_at`).run(a,o,r,i.url??null,i.ref??null,i.installed_at??null)}c(T,"writeInstallRows");async function R(t,a){await t.prepare("DELETE FROM profile_projects WHERE profile_id = ?").run(a.profileId),await t.prepare("DELETE FROM profile_project_repos WHERE profile_id = ?").run(a.profileId);let o=0;for(const l of a.manifest.projects)l.path!==void 0?await t.prepare("INSERT INTO profile_projects (profile_id, path, repo, position) VALUES (?, ?, ?, ?)").run(a.profileId,l.path,l.repo??null,o++):await t.prepare("INSERT INTO profile_project_repos (profile_id, repo, position) VALUES (?, ?, ?)").run(a.profileId,l.repo,o++)}c(R,"replaceProjects");const U=c(async(t,a)=>(await v(o=>A(o,t,a)),await N(t)),"rowsTransport");j(U),h(N);export{A as applyOpsToRows,N as loadPersonSettings,k as readSnapshotFromRows,U as rowsTransport};
|
|
@@ -5,6 +5,10 @@ export declare const PROVIDER_SCHEMA_VERSION = 1;
|
|
|
5
5
|
* column on open (`upgradeScopedStore`), and an older generation sharing the store names its columns and never reads it, so
|
|
6
6
|
* the version stays 5 and a runtime rollback keeps opening the store. */
|
|
7
7
|
export declare const PROFILE_ENVIRONMENT_COLUMN = "environment_id";
|
|
8
|
+
/** `profile_projects.repo` and the `profile_project_repos` table (a repo with no folder) are additive to version 5, like `PROFILE_ENVIRONMENT_COLUMN`:
|
|
9
|
+
* a store written before them gains both on open (`upgradeScopedStore`), and an older generation never reads them. One position
|
|
10
|
+
* counter covers both tables. */
|
|
11
|
+
export declare const PROFILE_PROJECT_REPO_COLUMN = "repo";
|
|
8
12
|
/** Adds the model-cooldown table to a provider store that predates it; a no-op (no write) once present. */
|
|
9
13
|
export declare function ensureProviderModelCooldowns(db: DatabaseSync): void;
|
|
10
14
|
export declare function createScopedSchema(db: DatabaseSync, kind: 'user' | 'project' | 'provider'): void;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
var t=Object.defineProperty;var T=(e,E)=>t(e,"name",{value:E,configurable:!0});import{prepared as o}from"../sqlite-statements.js";const
|
|
1
|
+
var t=Object.defineProperty;var T=(e,E)=>t(e,"name",{value:E,configurable:!0});import{prepared as o}from"../sqlite-statements.js";const _=5,n=1,p="environment_id",R="repo",N=`
|
|
2
2
|
CREATE TABLE scope_owners (owner_key TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK(kind IN ('user','profile','project')), root TEXT NOT NULL UNIQUE, profile_id TEXT UNIQUE);
|
|
3
3
|
CREATE TABLE profiles (id TEXT PRIMARY KEY, name TEXT NOT NULL, created_at TEXT NOT NULL, last_used_at TEXT, paused_at TEXT, default_kind TEXT, grantee TEXT, metadata_json TEXT NOT NULL CHECK(json_valid(metadata_json)), delivery_limits_json TEXT NOT NULL DEFAULT '{}' CHECK(json_valid(delivery_limits_json)), environment_id TEXT);
|
|
4
|
-
CREATE TABLE profile_projects (profile_id TEXT NOT NULL REFERENCES profiles(id) ON DELETE CASCADE, path TEXT NOT NULL, position INTEGER NOT NULL, PRIMARY KEY(profile_id,path), UNIQUE(profile_id,position));
|
|
4
|
+
CREATE TABLE profile_projects (profile_id TEXT NOT NULL REFERENCES profiles(id) ON DELETE CASCADE, path TEXT NOT NULL, position INTEGER NOT NULL, repo TEXT, PRIMARY KEY(profile_id,path), UNIQUE(profile_id,position));
|
|
5
|
+
CREATE TABLE profile_project_repos (profile_id TEXT NOT NULL REFERENCES profiles(id) ON DELETE CASCADE, repo TEXT NOT NULL, position INTEGER NOT NULL, PRIMARY KEY(profile_id,repo));
|
|
5
6
|
-- Pre-canvas per-project memory caps awaiting the canvas import, which turns them into delivery_limits and deletes the rows.
|
|
6
7
|
CREATE TABLE legacy_project_caps (profile_id TEXT NOT NULL, path TEXT NOT NULL, memory TEXT NOT NULL CHECK(memory IN ('none','name','preview')), PRIMARY KEY(profile_id,path));
|
|
7
8
|
CREATE TABLE profile_defaults (directory TEXT PRIMARY KEY, profile_id TEXT NOT NULL REFERENCES profiles(id) ON DELETE CASCADE);
|
|
8
9
|
CREATE TABLE scope_settings (owner_key TEXT PRIMARY KEY REFERENCES scope_owners(owner_key), raw_json TEXT NOT NULL CHECK(json_valid(raw_json)));
|
|
9
10
|
CREATE TABLE scope_bookkeeping (owner_key TEXT PRIMARY KEY REFERENCES scope_owners(owner_key), last_self_check TEXT, active_canvas TEXT);
|
|
10
11
|
CREATE TABLE scope_marketplaces (owner_key TEXT NOT NULL REFERENCES scope_owners(owner_key), name TEXT NOT NULL, last_updated TEXT, PRIMARY KEY(owner_key,name));
|
|
11
|
-
CREATE TABLE scope_plugins (owner_key TEXT NOT NULL REFERENCES scope_owners(owner_key), name TEXT NOT NULL, last_updated TEXT, etag TEXT, checked_at TEXT, PRIMARY KEY(owner_key,name));`,r="CREATE TABLE IF NOT EXISTS managed_account_model_cooldowns (provider_id TEXT NOT NULL, account_id TEXT NOT NULL, family TEXT NOT NULL, rate_limited_until INTEGER NOT NULL, last_rate_limited_at INTEGER NOT NULL, PRIMARY KEY(provider_id,account_id,family));";function l(e){e.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='managed_account_model_cooldowns'").get()===void 0&&e.exec(r)}T(l,"ensureProviderModelCooldowns");const
|
|
12
|
+
CREATE TABLE scope_plugins (owner_key TEXT NOT NULL REFERENCES scope_owners(owner_key), name TEXT NOT NULL, last_updated TEXT, etag TEXT, checked_at TEXT, PRIMARY KEY(owner_key,name));`,r="CREATE TABLE IF NOT EXISTS managed_account_model_cooldowns (provider_id TEXT NOT NULL, account_id TEXT NOT NULL, family TEXT NOT NULL, rate_limited_until INTEGER NOT NULL, last_rate_limited_at INTEGER NOT NULL, PRIMARY KEY(provider_id,account_id,family));";function l(e){e.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='managed_account_model_cooldowns'").get()===void 0&&e.exec(r)}T(l,"ensureProviderModelCooldowns");const a=`
|
|
12
13
|
CREATE TABLE managed_accounts (provider_id TEXT NOT NULL, id TEXT NOT NULL, label TEXT NOT NULL, label_key TEXT NOT NULL, position INTEGER NOT NULL, last_attempt_at INTEGER NOT NULL, last_rate_limited_at INTEGER NOT NULL, rate_limited_until INTEGER NOT NULL, auth_failure TEXT CHECK(auth_failure IS NULL OR auth_failure='invalid_grant'), PRIMARY KEY(provider_id,id), UNIQUE(provider_id,label_key));
|
|
13
14
|
CREATE INDEX managed_accounts_order ON managed_accounts(provider_id,position);
|
|
14
15
|
CREATE TABLE rotation_settings (singleton INTEGER PRIMARY KEY CHECK(singleton=1), default_fallback_strength TEXT, revert_when_available INTEGER CHECK(revert_when_available IN (0,1)));
|
|
15
16
|
CREATE TABLE provider_revision (singleton INTEGER PRIMARY KEY CHECK(singleton=1), revision INTEGER NOT NULL);
|
|
16
|
-
${r}`;function d(e,E){if(e.exec(E==="provider"?N
|
|
17
|
+
${r}`;function d(e,E){if(e.exec(E==="provider"?a:N),E!=="provider"){const i=E==="user"?"user":"project";o(e,"INSERT INTO scope_owners(owner_key, kind, root, profile_id) VALUES (?, ?, ?, NULL)").run(i,E,"")}else o(e,"INSERT INTO provider_revision(singleton, revision) VALUES (1, 0)").run();e.exec(`PRAGMA user_version = ${E==="provider"?n:_}`)}T(d,"createScopedSchema");export{p as PROFILE_ENVIRONMENT_COLUMN,R as PROFILE_PROJECT_REPO_COLUMN,n as PROVIDER_SCHEMA_VERSION,_ as SCOPED_SCHEMA_VERSION,d as createScopedSchema,l as ensureProviderModelCooldowns};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { type EnvironmentImage } from '../../daemon/reconcilers/recipe-image.js';
|
|
1
2
|
import type { BlaxelLaunchContext } from '../runtime/runner/blaxel/runner.js';
|
|
2
3
|
import type { RunnerStartInput } from '../runtime/runner/types.js';
|
|
3
4
|
export declare const BASE_IMAGE = "blaxel/base-image:latest";
|
|
4
5
|
/** How long the signed release URL stays valid. */
|
|
5
6
|
export declare const RELEASE_URL_TTL_S: number;
|
|
7
|
+
/** The sandbox image a launch starts from: the environment's recipe image when it has one; otherwise the release's own image (`releaseImage`, from the pointer object
|
|
8
|
+
* beside the release) when the release was published with one; otherwise the stock image, whose bootstrap installs the release at boot. */
|
|
9
|
+
export declare function launchImage(environment: Exclude<EnvironmentImage, {
|
|
10
|
+
state: 'pending';
|
|
11
|
+
}>, releaseImage: string | null): string;
|
|
6
12
|
export interface ReleaseSigner {
|
|
7
13
|
bucket: string;
|
|
8
14
|
endpoint: string;
|
|
@@ -17,6 +23,8 @@ export interface BlaxelLaunchDeps {
|
|
|
17
23
|
signer: ReleaseSigner;
|
|
18
24
|
/** The sha256 text of `releases/<version>/runtime.tar.gz.sha256`; default: the blob store. */
|
|
19
25
|
releaseSha?: (version: string) => Promise<string | null>;
|
|
26
|
+
/** The text of `releases/<version>/sandbox-image.json`; default: the blob store. Null: the release has no image. */
|
|
27
|
+
releaseImage?: (version: string) => Promise<string | null>;
|
|
20
28
|
now?: () => Date;
|
|
21
29
|
}
|
|
22
30
|
/** Reads the control plane's settings from the environment: `CRTR_PUBLIC_API_URL` (where a sandbox reaches `/v1`) and the four `CRTR_R2_*` variables. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=Object.defineProperty;var t=(r,e)=>A(r,"name",{value:e,configurable:!0});import{createHash as I,createHmac as R}from"node:crypto";import{openDb as C}from"../canvas/db.js";import{blobStore as S}from"../blobs/index.js";import{environmentOfNode as $,packagesTokenFor as b}from"../../daemon/api/environment-of.js";import{EnvironmentImagePending as T}from"../../daemon/reconcilers/node-lifecycle/remote-wake.js";import{resolveEnvironmentImage as y}from"../../daemon/reconcilers/recipe-image.js";import{parseReleaseImagePointer as U,releaseImageKey as x}from"../runtime/runner/blaxel/release-image.js";import{environmentSecrets as L}from"./environment-secrets.js";import{environmentOwnerProfile as v,profileInApp as D}from"./environment-owner.js";const H="blaxel/base-image:latest",P=900;function z(r,e){return r.state==="image"?r.ref:e??H}t(z,"launchImage");function K(r=process.env){const e=t(a=>{const n=r[a];if(!n)throw new Error(`${a} is required to sign release URLs`);return n},"need");return{bucket:e("CRTR_R2_BUCKET"),endpoint:e("CRTR_R2_ENDPOINT"),accessKeyId:e("CRTR_R2_ACCESS_KEY_ID"),secretAccessKey:e("CRTR_R2_SECRET_ACCESS_KEY")}}t(K,"releaseSignerFromEnv");const O=t(r=>I("sha256").update(r).digest("hex"),"sha256hex"),w=t((r,e)=>R("sha256",r).update(e).digest(),"hmac"),h=t(r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),"encode");function N(r,e,a,n=new Date){const l=new URL(r.endpoint),i=n.toISOString().replace(/[:-]|\.\d{3}/g,""),o=i.slice(0,8),s=`${o}/auto/s3/aws4_request`,m=`/${h(r.bucket)}/${e.split("/").map(h).join("/")}`,f=[["X-Amz-Algorithm","AWS4-HMAC-SHA256"],["X-Amz-Credential",`${r.accessKeyId}/${s}`],["X-Amz-Date",i],["X-Amz-Expires",String(a)],["X-Amz-SignedHeaders","host"]].sort(([c],[_])=>c<_?-1:1).map(([c,_])=>`${h(c)}=${h(_)}`).join("&"),p=["GET",m,f,`host:${l.host}
|
|
2
2
|
`,"host","UNSIGNED-PAYLOAD"].join(`
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
3
|
+
`),d=["AWS4-HMAC-SHA256",i,s,O(p)].join(`
|
|
4
|
+
`),E=w(w(w(w(`AWS4${r.secretAccessKey}`,o),"auto"),"s3"),"aws4_request"),g=R("sha256",E).update(d).digest("hex");return`${l.origin}${m}?${f}&X-Amz-Signature=${g}`}t(N,"presignGet");function V(r=process.env){const e=r.CRTR_PUBLIC_API_URL;if(!e||!/^https?:\/\//.test(e))throw new Error("CRTR_PUBLIC_API_URL must be an http(s) URL for the Blaxel runner");return{apiUrl:e,signer:K(r)}}t(V,"blaxelLaunchDepsFromEnv");async function M(r){const e=await(await S()).get(`releases/${r}/runtime.tar.gz.sha256`);return e===null?null:e.toString("utf8")}t(M,"defaultReleaseSha");async function j(r){const e=await(await S()).get(x(r));return e===null?null:e.toString("utf8")}t(j,"defaultReleaseImage");function Z(r){return async e=>{const a=await C(),n=await a.prepare("SELECT profile_id, grantee FROM node_rows WHERE node_id = ?").get(e.nodeId);if(n===void 0)throw new Error(`no node ${e.nodeId}`);if(n.profile_id===null)throw new Error(`node ${e.nodeId} has no profile, so it has no person`);const l=await a.prepare("SELECT person FROM profiles WHERE id = ?").get(n.profile_id);if(l===void 0)throw new Error(`profile ${n.profile_id} has no row`);const i=n.grantee??"app:terminal",o=await $(n.profile_id),s=await y(o);if(s.state==="pending")throw new T(o,s.error);const m=await a.prepare("SELECT memory_mb FROM environments WHERE object = ?").get(o);if(m===void 0)throw new Error(`no environment ${o}`);const u=await v(o),f=u!==null&&await D(u,i),p=(await(r.releaseSha??M)(e.release)??"").trim().split(/\s+/)[0]??"";if(!/^[0-9a-f]{64}$/.test(p))throw new Error(`release ${e.release} has no sha256 object (releases/${e.release}/runtime.tar.gz.sha256)`);const d=s.state==="base"?await(r.releaseImage??j)(e.release):null,E=d===null?null:U(d,e.release,p),g=await b(o),c=await L({person:l.person,app:i,ownerProfile:u,ownerProfileInApp:f,includeDeployment:!1});return{image:z(s,E),memoryMb:Number(m.memory_mb),apiUrl:r.apiUrl,releaseUrl:N(r.signer,`releases/${e.release}/runtime.tar.gz`,P,r.now?.()),releaseSha256:p,secrets:g!==null?{NODE_AUTH_TOKEN:g,...c}:c}}}t(Z,"createBlaxelLaunchContext");export{H as BASE_IMAGE,P as RELEASE_URL_TTL_S,V as blaxelLaunchDepsFromEnv,Z as createBlaxelLaunchContext,z as launchImage,N as presignGet,K as releaseSignerFromEnv};
|
|
@@ -4,6 +4,7 @@ import { type NodeConfigSubject } from '../subject.js';
|
|
|
4
4
|
import type { Rung } from '../schema.js';
|
|
5
5
|
import type { DeliveryDoc } from './types.js';
|
|
6
6
|
import type { CanvasDb } from '../../canvas/db.js';
|
|
7
|
+
import type { Frag } from '../../permissions/sql.js';
|
|
7
8
|
export declare function ownerHandle(owner: ObjectRow): string;
|
|
8
9
|
/** The key that names one owner exactly in `delivery_limits`: `<type>:<handle>`,
|
|
9
10
|
* the typed form `resolveName` accepts (`repo:crouter`, `person:user`, `app:terminal`). */
|
|
@@ -13,6 +14,8 @@ export declare function typedLimitKey(owner: ObjectRow): string;
|
|
|
13
14
|
* reader's own profile is never capped, even when a bare key shares its handle
|
|
14
15
|
* with another owner; an owner the profile does not name is uncapped. */
|
|
15
16
|
export declare function deliveryLimitFor(manifest: ProfileManifest | null, owner: ObjectRow, reader?: Reader): Rung;
|
|
17
|
+
/** The reader's `permits(read)` fragment over the alias `o`, from the reader's shared scope. */
|
|
18
|
+
export declare function readRule(db: CanvasDb, reader: Reader): Promise<Frag>;
|
|
16
19
|
/** Fetch the bodies of every document in `docs` that has not read its own, in one query, so each `body()` call after it answers from memory. */
|
|
17
20
|
export declare function primeBodies(db: CanvasDb, docs: readonly DeliveryDoc[]): Promise<void>;
|
|
18
21
|
/** Documents with a rule on one of `on` whose owner is in the reader's view and that the reader may read, in view order. At `boot` a node's
|
|
@@ -23,7 +26,9 @@ export declare function loadCorpus(db: CanvasDb, reader: Reader, on: RuleOn[]):
|
|
|
23
26
|
export declare function deliveryDocsOf(db: CanvasDb, reader: Reader, docs: readonly ObjectRow[]): Promise<DeliveryDoc[]>;
|
|
24
27
|
/** One document as a delivery document for `reader`, with all its rules (an explicit read). */
|
|
25
28
|
export declare function deliveryDocOf(db: CanvasDb, reader: Reader, doc: ObjectRow): Promise<DeliveryDoc>;
|
|
26
|
-
/**
|
|
27
|
-
export declare function
|
|
29
|
+
/** The reader's view owners, nearest first. */
|
|
30
|
+
export declare function viewOwners(db: CanvasDb, reader: Reader): Promise<ObjectRow[]>;
|
|
31
|
+
/** Every listed document the reader can read of each of `owners`, for prefix listings, keyed by owner id (an owner with none maps to []). */
|
|
32
|
+
export declare function listingCorpora(db: CanvasDb, reader: Reader, owners: readonly ObjectRow[]): Promise<Map<string, DeliveryDoc[]>>;
|
|
28
33
|
/** The node reader's gate subject, with `repo` from the reader's eligible repos (cwd's, then its profile projects'). */
|
|
29
34
|
export declare function nodeSubject(_db: CanvasDb, reader: Reader): Promise<NodeConfigSubject>;
|