@north-light/cli 0.3.668 → 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 +8 -0
- 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/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 +2 -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/session/profile-files.js +1 -1
- package/dist/clients/attach/viewer.js +479 -479
- 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-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/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/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/checkout-identities.d.ts +15 -0
- package/dist/core/checkout-identities.js +3 -0
- 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.js +1 -1
- 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/owner.js +2 -2
- package/dist/core/graph/names.d.ts +2 -2
- package/dist/core/graph/names.js +10 -10
- 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/human/page-schema.d.ts +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/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/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/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/substrate/delivery/deliver.js +2 -2
- package/dist/core/substrate/delivery/plan.js +2 -3
- package/dist/core/substrate/subject.js +1 -1
- 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/handlers/broker-ops.js +1 -1
- 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/memory.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/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/crtrd.js +13 -13
- 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/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-structured-output.js +6 -6
- 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/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
|
@@ -83,10 +83,10 @@ export type Reader = {
|
|
|
83
83
|
launched?: readonly string[] | null;
|
|
84
84
|
/** The repos enclosing `cwd`, nearest first; `checkouts` pairs each with its checkout root. Only these are repos the node
|
|
85
85
|
* "works in": `--owner repo` follows them; rule `if: {repo}` follows these plus `projectRepos`; read and write access
|
|
86
|
-
* to a repo's documents follow `
|
|
86
|
+
* to a repo's documents follow `repos` plus `projectRepos` and the schema's permissions alone. */
|
|
87
87
|
repos: ObjectRow[];
|
|
88
88
|
checkouts: Checkout[];
|
|
89
|
-
/** The repos of the profile's project paths that do not enclose `cwd`, in manifest order: in the node's view, readable and
|
|
89
|
+
/** The repos of the profile's project paths that do not enclose `cwd`, in manifest order: in the node's view, readable and changeable by permission alone; not worked in. */
|
|
90
90
|
projectRepos: ObjectRow[];
|
|
91
91
|
projectCheckouts: Checkout[];
|
|
92
92
|
profile: ObjectRow | null;
|
|
@@ -186,8 +186,8 @@ export declare const chartDataRowsSchema: z.ZodArray<z.ZodRecord<z.ZodString, z.
|
|
|
186
186
|
export declare const chartConfigSchema: z.ZodObject<{
|
|
187
187
|
kind: z.ZodEnum<{
|
|
188
188
|
line: "line";
|
|
189
|
-
area: "area";
|
|
190
189
|
bar: "bar";
|
|
190
|
+
area: "area";
|
|
191
191
|
}>;
|
|
192
192
|
x: z.ZodString;
|
|
193
193
|
y: z.ZodArray<z.ZodObject<{
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var w=Object.defineProperty;var d=(r,t)=>w(r,"name",{value:t,configurable:!0});import{openDb as k}from"../../canvas/db.js";import{personIdAsync as h}from"../../canvas/person.js";import{loadSecretsKey as y,open as c}from"../../secrets/index.js";import{aadOf as S}from"../../subscription-state.js";import{aadOf as O}from"../../secrets/env-rows.js";const a=d(r=>r==null?null:String(r),"str"),o=d(r=>Number(r??0),"num");async function W(){const r=await h(),t=await k(),_=y(),u={};for(const e of await t.prepare("SELECT provider_id, credential_sealed, key_id FROM model_api_keys WHERE person = ? ORDER BY provider_id").all(r)){const i=String(e.provider_id);u[i]=JSON.parse(c(e.credential_sealed,String(e.key_id),_,`model_api_keys|${r}|${i}`))}const R=await t.prepare("SELECT provider_id, account_id, family, rate_limited_until, last_rate_limited_at FROM model_account_cooldowns WHERE person = ? ORDER BY family").all(r),E=[];for(const e of await t.prepare("SELECT * FROM model_accounts WHERE person = ? ORDER BY provider_id, position").all(r)){const i=String(e.provider_id),l=String(e.id);if(e.refresh_sealed===null||e.access_sealed===null||e.key_id===null)throw new Error(`managed ${i} account ${l} has no credential record`);const g=String(e.key_id);E.push({provider:i,id:l,label:String(e.label),labelKey:String(e.label_key),position:o(e.position),lastAttemptAt:o(e.last_attempt_at),lastRateLimitedAt:o(e.last_rate_limited_at),rateLimitedUntil:o(e.rate_limited_until),...e.auth_failure==="invalid_grant"?{authFailure:"invalid_grant"}:{},refresh:c(e.refresh_sealed,g,_,S(r,i,l,"refresh")),access:c(e.access_sealed,g,_,S(r,i,l,"access")),expires:o(e.expires),...a(e.vendor_account_id)===null?{}:{accountId:a(e.vendor_account_id)},...a(e.client_id)===null?{}:{clientId:a(e.client_id)},cooldowns:R.filter(s=>s.provider_id===i&&s.account_id===l).map(s=>({family:String(s.family),until:o(s.rate_limited_until),at:o(s.last_rate_limited_at)}))})}const n=await t.prepare("SELECT default_fallback_strength, revert_when_available, openai_device_id FROM model_settings WHERE person = ?").get(r),v={accounts:E,...n===void 0||n.default_fallback_strength===null&&n.revert_when_available===null?{}:{rotation:{defaultFallbackStrength:a(n.default_fallback_strength),revertWhenAvailable:n.revert_when_available===null?null:o(n.revert_when_available)===1}},...n===void 0||a(n.openai_device_id)===null?{}:{openaiDeviceId:a(n.openai_device_id)}},m={};for(const e of await t.prepare("SELECT owner_id, name, value_sealed, key_id FROM env_vars WHERE person = ? AND owner_kind = 'profile' ORDER BY owner_id, name").all(r)){const i=String(e.owner_id),l=String(e.name);(m[i]??={})[l]=c(e.value_sealed,String(e.key_id),_,O({person:r,kind:"profile",id:i},l))}const p={settings:{},state:{},profileProjects:{},defaults:{}};for(const e of await t.prepare("SELECT owner_key, raw_json FROM scope_settings WHERE person = ?").all(r))p.settings[String(e.owner_key)]=JSON.parse(String(e.raw_json));for(const e of await t.prepare("SELECT owner_key, last_self_check, active_canvas FROM scope_bookkeeping WHERE person = ?").all(r))p.state[String(e.owner_key)]={last_self_check:a(e.last_self_check),activeCanvas:a(e.active_canvas)};for(const e of await t.prepare(`SELECT profile_id, path, repo FROM (
|
|
2
|
+
SELECT pp.profile_id, pp.path, pp.repo, pp.position FROM profile_projects pp JOIN profiles p ON p.id = pp.profile_id WHERE p.person = ?
|
|
3
|
+
UNION ALL SELECT pr.profile_id, NULL AS path, pr.repo, pr.position FROM profile_project_repos pr JOIN profiles p ON p.id = pr.profile_id WHERE p.person = ?) e
|
|
4
|
+
ORDER BY profile_id, position`).all(r,r))(p.profileProjects[String(e.profile_id)]??=[]).push({...a(e.repo)===null?{}:{repo:a(e.repo)},...a(e.path)===null?{}:{path:a(e.path)}});for(const e of await t.prepare("SELECT directory, profile_id FROM profile_defaults WHERE person = ?").all(r))p.defaults[String(e.directory)]=String(e.profile_id);const f={marketplaces:[],plugins:[]};for(const e of await t.prepare("SELECT * FROM scope_marketplaces WHERE person = ? ORDER BY owner_key, name").all(r))f.marketplaces.push({owner:String(e.owner_key),name:String(e.name),url:a(e.url),ref:a(e.ref),installed_at:a(e.installed_at),last_updated:a(e.last_updated)});for(const e of await t.prepare("SELECT * FROM scope_plugins WHERE person = ? ORDER BY owner_key, name").all(r))f.plugins.push({owner:String(e.owner_key),name:String(e.name),enabled:o(e.enabled)===1,source_marketplace:a(e.source_marketplace),version:a(e.version),source_path:a(e.source_path),last_updated:a(e.last_updated),etag:a(e.etag),checked_at:a(e.checked_at)});return{auth:{apiKeys:u},credentials:v,env:{profiles:m},settings:p,plugins:f}}d(W,"readStores");export{W as readStores};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),
|
|
1
|
+
var j=Object.defineProperty;var p=(n,o)=>j(n,"name",{value:o,configurable:!0});import{createHash as C}from"node:crypto";import{loadSecretsKey as N,open as U,seal as I}from"../../secrets/index.js";import{insertAccount as D,upsertModelCooldown as F}from"../../subscription-state.js";import{validateEnvVarName as M,isReservedEnvName as V}from"../../env-name.js";import{decodeKeys as x,encodeKeys as W}from"./copy.js";import{compareInstallOwners as H}from"../../scoped-state/migrate-app-installs.js";import{recordCredentialActivation as K}from"../../model-auth/activations.js";const P=["auth","credentials","env","settings","plugins"],T=p((n,o)=>`imports/${n}/stores/${o}.sealed`,"storeKey"),$=p((n,o)=>`import_store|${n}|${o}`,"aadOf");async function re(n,o,d,a){if(a===null||typeof a!="object"||Array.isArray(a))throw new J(`the ${d} store must be a JSON object`);const{sealed:r,keyId:m}=I(JSON.stringify(a),N(),$(o,d));await n.put(T(o,d),Buffer.concat([Buffer.from(`${m}
|
|
2
|
+
`),r]))}p(re,"putStore");class J extends Error{static{p(this,"StoreBodyError")}}async function S(n,o,d){const a=await n.get(T(o,d));if(a===null)return null;const r=a.indexOf(10);return JSON.parse(U(a.subarray(r+1),a.subarray(0,r).toString("utf8"),N(),$(o,d)))}p(S,"readStore");const oe=p((n,o)=>S(n,o,"plugins"),"readPluginsStore"),B=p(n=>n.source_marketplace!=null,"hasFleetSource"),ne=p(n=>P.map(o=>T(n,o)),"allStoreKeys");function G(n){if(n===null||typeof n!="object"||Array.isArray(n))return n;const{runtime:o,api:d,...a}=n,r=a.paths;if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const{user_files:m,...l}=r;Object.keys(l).length===0?delete a.paths:a.paths=l}return a}p(G,"withoutMachineSettings");async function ae(n){const{db:o,blobs:d,runId:a,person:r}=n,m=p(e=>n.objectMap.get(e)??e,"mapId"),l=p(e=>e.startsWith("profile:")?`profile:${m(e.slice(8))}`:e,"mapOwner"),_={},g=[],O=p((e,s)=>{(_[e]??=[]).push(s)},"record"),E=p(async(e,s,i,f)=>{await o.prepareUncached(`${s} ON CONFLICT DO NOTHING RETURNING 1 AS ok`).get(...i)!==void 0&&O(e,f)},"insert"),b=N(),A=new Date().toISOString(),w=await S(d,a,"credentials");if(w!==null){for(const e of w.accounts)if(await o.prepare("SELECT 1 FROM model_accounts WHERE person = ? AND provider_id = ? AND (id = ? OR label_key = ?)").get(r,e.provider,e.id,e.labelKey)===void 0){await D(o,r,e.provider,{providerId:e.provider,id:e.id,label:e.label,labelKey:e.labelKey,position:e.position,lastAttemptAt:e.lastAttemptAt,lastRateLimitedAt:e.lastRateLimitedAt,rateLimitedUntil:e.rateLimitedUntil,...e.authFailure?{authFailure:e.authFailure}:{}},{refresh:e.refresh,access:e.access,expires:e.expires,...e.accountId?{accountId:e.accountId}:{},...e.clientId?{clientId:e.clientId}:{}}),O("model_accounts",[r,e.provider,e.id]);for(const i of e.cooldowns)await F(o,r,e.provider,e.id,i.family,i.until,i.at),O("model_account_cooldowns",[r,e.provider,e.id,i.family])}w.rotation!==void 0&&await E("model_settings","INSERT INTO model_settings (person, default_fallback_strength, revert_when_available) VALUES (?, ?, ?)",[r,w.rotation.defaultFallbackStrength,w.rotation.revertWhenAvailable===null?null:w.rotation.revertWhenAvailable?1:0],[r]),w.openaiDeviceId!==void 0&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(w.openaiDeviceId)&&await o.prepare("INSERT INTO model_settings (person, openai_device_id) VALUES (?, ?) ON CONFLICT (person) DO UPDATE SET openai_device_id = COALESCE(model_settings.openai_device_id, EXCLUDED.openai_device_id)").run(r,w.openaiDeviceId.toLowerCase())}const R=await S(d,a,"auth");if(R!==null)for(const[e,s]of Object.entries(R.apiKeys)){const{sealed:i,keyId:f}=I(JSON.stringify(s),b,`model_api_keys|${r}|${e}`);await E("model_api_keys","INSERT INTO model_api_keys (person, provider_id, credential_sealed, key_id, updated_at) VALUES (?, ?, ?, ?, ?)",[r,e,i,f,A],[r,e])}const L=await S(d,a,"env");if(L!==null)for(const[e,s]of Object.entries(L.profiles)){const i=m(e);for(const[f,t]of Object.entries(s)){if(!M(f).isValid||V(f)||typeof t!="string"||t.includes("\0"))continue;const{sealed:c,keyId:u}=I(t,b,`env_vars|${r}|profile|${i}|${f}`);await E("env_vars","INSERT INTO env_vars (person, owner_kind, owner_id, name, value_sealed, key_id, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",[r,"profile",i,f,c,u,A],[r,"profile",i,f])}}const k=await S(d,a,"settings");if(k!==null){for(const[e,s]of Object.entries(k.settings))await E("scope_settings","INSERT INTO scope_settings (person, owner_key, raw_json) VALUES (?, ?, ?)",[r,l(e),JSON.stringify(G(s))],[r,l(e)]);for(const[e,s]of Object.entries(k.state))await E("scope_bookkeeping","INSERT INTO scope_bookkeeping (person, owner_key, last_self_check, active_canvas) VALUES (?, ?, ?, ?)",[r,l(e),s.last_self_check??null,s.activeCanvas??null],[r,l(e)]);for(const[e,s]of Object.entries(k.profileProjects)){const i=m(e);if(await o.prepare("SELECT 1 FROM profile_projects WHERE profile_id = ?").get(i)!==void 0||await o.prepare("SELECT 1 FROM profile_project_repos WHERE profile_id = ?").get(i)!==void 0)continue;let f=0;for(const t of s){const{path:c,repo:u}=typeof t=="string"?{path:t,repo:void 0}:t;c!==void 0?await E("profile_projects","INSERT INTO profile_projects (profile_id, path, repo, position) VALUES (?, ?, ?, ?)",[i,c,u??null,f++],[i,c]):u!==void 0&&await E("profile_project_repos","INSERT INTO profile_project_repos (profile_id, repo, position) VALUES (?, ?, ?)",[i,u,f++],[i,u])}}for(const[e,s]of Object.entries(k.defaults))await E("profile_defaults","INSERT INTO profile_defaults (person, directory, profile_id) VALUES (?, ?, ?)",[r,e,m(s)],[r,e])}const h=await S(d,a,"plugins");if(h!==null){const e=p(async t=>{if(t.startsWith("app:"))return t;if(t==="user")return"app:terminal";if(!t.startsWith("profile:"))throw new Error(`unsupported install owner in the bundle: ${t}`);return(await o.prepare("SELECT grantee FROM profiles WHERE id = ?").get(m(t.slice(8))))?.grantee??"app:terminal"},"appOf"),s=new Map;for(const t of new Set([...h.marketplaces,...h.plugins].map(c=>c.owner)))t.startsWith("profile:")&&s.set(t,(await o.prepare("SELECT last_used_at FROM profiles WHERE id = ?").get(m(t.slice(8))))?.last_used_at??"");const i=p(t=>[...t].sort((c,u)=>H(l(c.owner),s.get(c.owner)??"",l(u.owner),s.get(u.owner)??"")),"byProfileFirst"),f=new Map;for(const t of i(h.marketplaces)){const c=await e(t.owner),u=new Map((await o.prepare("SELECT name, url FROM scope_marketplaces WHERE person = ? AND owner_key = ?").all(r,c)).map(v=>[v.name,v.url]));let y=t.name;for(let v=2;u.has(y)&&u.get(y)!==(t.url??null);v+=1)y=`${t.name}-${v}`;f.set(`${t.owner}\0${t.name}`,y),await E("scope_marketplaces","INSERT INTO scope_marketplaces (person, owner_key, name, last_updated, url, ref, installed_at) VALUES (?, ?, ?, ?, ?, ?, ?)",[r,c,y,t.last_updated??null,t.url??null,t.ref??null,t.installed_at??null],[r,c,y])}for(const t of i(h.plugins)){if(!B(t)){g.push(`${t.owner}:${t.name}`);continue}const c=await e(t.owner),u=t.source_marketplace==null?null:f.get(`${t.owner}\0${t.source_marketplace}`)??t.source_marketplace;await E("scope_plugins","INSERT INTO scope_plugins (person, owner_key, name, last_updated, etag, checked_at, enabled, source_marketplace, version, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[r,c,t.name,t.last_updated??null,t.etag??null,t.checked_at??null,t.enabled?1:0,u,t.version??null,t.source_path??null],[r,c,t.name])}(_.scope_plugins??[]).length+(_.scope_marketplaces??[]).length>0&&await E("person_settings","INSERT INTO person_settings (person, plugins_revision) VALUES (?, 1)",[r],[r])}for(const[e,s]of Object.entries(_))await o.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?) ON CONFLICT (run_id, table_name) DO UPDATE SET inserted_keys = EXCLUDED.inserted_keys").run(a,e,W(s));return Object.keys(_).length>0&&await o.prepare("SELECT pg_notify('crtr_signal', ?)").get(`settings:${r}`),{inserted:_,unresolvedPlugins:g}}p(ae,"writeStores");async function se(n,o,d){const a=await n.prepare("SELECT table_name, inserted_keys FROM import_manifest WHERE run_id = ? AND table_name IN ('model_accounts', 'model_api_keys')").all(o),r=p(l=>a.filter(_=>_.table_name===l).flatMap(_=>x(_.inserted_keys)),"keys"),m=[...[...new Set(r("model_accounts").map(l=>l[1]))].map(l=>({kind:"subscription",provider:l})),...r("model_api_keys").map(l=>({kind:"api_key",provider:l[1]}))];for(const{kind:l,provider:_}of m){const g=C("sha256").update(JSON.stringify([o,l,_])).digest("hex"),O=`${g.slice(0,8)}-${g.slice(8,12)}-4${g.slice(13,16)}-8${g.slice(17,20)}-${g.slice(20,32)}`;await K(d,l,_,O)}}p(se,"recordImportedActivations");export{P as STORE_NAMES,J as StoreBodyError,ne as allStoreKeys,B as hasFleetSource,re as putStore,oe as readPluginsStore,se as recordImportedActivations,T as storeKey,ae as writeStores};
|
|
@@ -18,7 +18,7 @@ export interface StubIdentity {
|
|
|
18
18
|
/** An owner as the sending machine names it, so the receiver can map it onto its own owner object. */
|
|
19
19
|
export interface OwnerRef {
|
|
20
20
|
id: string;
|
|
21
|
-
type: 'person' | 'app' | 'repo' | 'profile';
|
|
21
|
+
type: 'person' | 'app' | 'repo' | 'profile' | 'group';
|
|
22
22
|
scheme: string | null;
|
|
23
23
|
external_id: string | null;
|
|
24
24
|
handle: string;
|
package/dist/core/peer/stubs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var r=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createObject as A,getById as s,ownerForGrantee as
|
|
1
|
+
var T=Object.defineProperty;var r=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createObject as A,getById as s,ownerForGrantee as y,ownerLockKey as g}from"../graph/objects.js";import{readLegacyPrivacy as L}from"../graph/types.js";import{upsertKind as N}from"../graph/custom.js";import{CrtrError as f}from"../errors.js";import{ExitCode as m}from"../../types.js";import{normalizeMachineId as W}from"./names.js";import{personId as d,personIdAsync as $}from"../canvas/person.js";import{writeActsFor as b}from"../permissions/facts.js";const I=["public","private"],H=r(n=>{const e=n.act.act;return e===void 0?{sub:n.sub,app:null,node:null,node_scopes:null,place:null}:{sub:n.sub,app:e.sub,node:e.node,node_scopes:e.node_scopes,place:e.place}},"identityOfEnvelope");async function S(n,e){const t=typeof e=="string"?await s(n,e):e;if(t===null)return null;const i=await n.prepare("SELECT home_machine, envelope_json FROM peer_stubs WHERE object = ?").get(t.id);return i?{object:t,home_machine:i.home_machine,identity:i.envelope_json===null?null:JSON.parse(i.envelope_json)}:null}r(S,"stubOf");const Q=r(async(n,e)=>await n.prepare("SELECT 1 FROM peer_stubs WHERE object = ?").get(e.id)!==void 0,"isStub");async function C(n){return await y(n,d())}r(C,"localPerson");async function D(n,e){return await y(n,e)}r(D,"localApp");async function X(n,e){return e.type==="app"?await D(n,`app:${e.name}`):e.type==="person"?await C(n):null}r(X,"localOwnerActor");function h(n,e){return n!==null?n.app===null?d():n.app:e?.type==="app"?e.external_id??`app:${e.handle}`:d()}r(h,"ownerGrantee");async function k(n,e,t){return await y(n,h(e,t?.owner))}r(k,"ownerFor");const P=["ingest:","stub:","owner:","kind:"],v=r(n=>{const e=P.findIndex(t=>n.startsWith(t));if(e<0)throw new Error(`lockInOrder: ${JSON.stringify(n)} is not a known lock key`);return e},"rankOf");async function U(n,e){const t=[...new Set(e)];if(t.length===0)return;const p=(await n.prepareUncached(t.map((a,o)=>`SELECT ${o} AS i, hashtext(?) AS h`).join(" UNION ALL ")).all(...t)).map(a=>({key:t[Number(a.i)],hash:Number(a.h)})).sort((a,o)=>v(a.key)-v(o.key)||a.hash-o.hash);for(const{key:a}of p)await n.prepare("SELECT pg_advisory_xact_lock(hashtext(?))").get(a)}r(U,"lockInOrder");async function E(n,e){const[t,i]=e.startsWith("app:")?["app",e]:["user",e];return await n.prepare("SELECT 1 FROM identities WHERE scheme = ? AND external_id = ?").get(t,i)===void 0?[g(t,i)]:[]}r(E,"missingOwnerKey");async function O(n,e,t,i,p){const a=[`stub:${e}`],o=p?.kind_decl;return o!==void 0&&o.name===t&&a.push(`kind:${t}`,...await E(n,h(null,o.owner))),await s(n,e)===null&&a.push(...await E(n,h(i,p?.owner))),a}r(O,"stubLockKeys");async function Z(n,e){return e.type==="app"?await E(n,`app:${e.name}`):e.type==="person"?await E(n,d()):await O(n,e.id,e.type,null,e)}r(Z,"actorLockKeys");async function K(n,e,t,i,p,a){const o=p===void 0?null:H(p),u=L(a?.privacy??"public");if(!I.includes(u))throw new f("invalid_event",`invalid privacy ${JSON.stringify(u)}`,m.GENERAL,{id:e});await U(n,await O(n,e,t,o,a));const c=await s(n,e);if(c!==null){const w=await S(n,c);if(w===null)throw new f("conflict",`${e} is a local ${c.type}, not a stub of ${i}`,m.GENERAL,{id:e});if(w.home_machine!==i)throw new f("conflict",`${e} is already a stub of ${w.home_machine}, not ${i}`,m.GENERAL,{id:e,home_machine:w.home_machine});return o!==null&&(await n.prepare("UPDATE peer_stubs SET envelope_json = ? WHERE object = ?").run(JSON.stringify(o),c.id),await n.prepare("UPDATE objects SET reception = 2 WHERE id = ?").run(c.id)),a!==void 0&&(await x(n,t,a),a.privacy!==void 0&&c.privacy!==u)?(await n.prepare("UPDATE objects SET privacy = ? WHERE id = ?").run(u,c.id),await s(n,c.id)):c}const _=await k(n,o,a);await x(n,t,a);const l=await A(n,{id:e,type:t,kind:a?.kind??null,owner:_.id,privacy:u,name:a?.name??e,preview:a?.preview??"",home_machine:i});return await n.prepare("INSERT INTO peer_stubs (object, home_machine, envelope_json, created_at) VALUES (?, ?, ?, ?)").run(l.id,i,o===null?null:JSON.stringify(o),new Date().toISOString()),_.type==="app"&&await b(n,l.id,await $()),o!==null&&await n.prepare("UPDATE objects SET reception = 2 WHERE id = ?").run(l.id),await s(n,l.id)}r(K,"ensureStub");async function x(n,e,t){const i=t?.kind_decl;i===void 0||i.name!==e||await N(n,{name:i.name,owner:await k(n,null,{...t,owner:i.owner}),description:i.description,events:i.events,read:null,source:"peer"})}r(x,"holdKind");async function ee(n,e,t){const i=await K(n,e,"node",W(t));return await n.prepare("UPDATE objects SET reception = 2 WHERE id = ?").run(i.id),await s(n,i.id)}r(ee,"ensureNodeStub");async function ne(n,e,t){const i=await S(n,e);i===null||i.home_machine===t||(await n.prepare("UPDATE peer_stubs SET home_machine = ? WHERE object = ?").run(t,i.object.id),await n.prepare("UPDATE objects SET home_machine = ? WHERE id = ?").run(t,i.object.id))}r(ne,"rehomeStub");async function te(n,e){const t=await R(n,e.owner===null?null:await s(n,e.owner)),i=await j(n,e.type);return{id:e.id,type:e.type,kind:e.kind,name:e.name,preview:e.preview,owner:t,privacy:e.privacy,...i===null?{}:{kind_decl:i}}}r(te,"describeObject");async function R(n,e){if(e===null||e.type!=="person"&&e.type!=="app"&&e.type!=="repo"&&e.type!=="profile"&&e.type!=="group")return null;const t=await n.prepare("SELECT scheme, external_id FROM identities WHERE object = ?").get(e.id);return{id:e.id,type:e.type,scheme:t?.scheme??null,external_id:t?.external_id??null,handle:e.name}}r(R,"ownerRefOf");async function j(n,e){const t=await n.prepare("SELECT owner, description, events_json FROM object_kinds WHERE name = ?").get(e),i=t===void 0?null:await R(n,await s(n,t.owner));return t===void 0||i===null?null:{name:e,description:t.description,events:JSON.parse(t.events_json),owner:i}}r(j,"kindDeclarationOf");async function ie(n,e,t){const i=await j(n,e.type);return i===null?t:{...t,kind_decl:i}}r(ie,"withKindDecl");export{Z as actorLockKeys,te as describeObject,ee as ensureNodeStub,K as ensureStub,H as identityOfEnvelope,Q as isStub,j as kindDeclarationOf,X as localOwnerActor,U as lockInOrder,ne as rehomeStub,O as stubLockKeys,S as stubOf,ie as withKindDecl};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Definition } from './schema-parser.js';
|
|
2
2
|
/** The built-in definitions: every object's `crtr/object` rules, teams, and the subject types. `crtr` is a reserved namespace. */
|
|
3
|
-
export declare const BUILTIN_SOURCE = "\ndefinition user {}\ndefinition app {}\ndefinition crtr/group {\n relation member: user | crtr/group#member\n}\ndefinition crtr/object {\n relation parent: crtr/object\n relation acts_for: user\n relation reader: user | user:* | crtr/group#member\n relation editor: user | crtr/group#member\n relation messenger: user | crtr/group#member\n relation user_of: user | crtr/group#member\n permission read = reader + editor + messenger + user_of + acts_for + parent->read\n permission edit = editor + acts_for + parent->edit\n permission message = messenger + acts_for + parent->message\n permission use = user_of + acts_for + parent->use\n permission share = acts_for + parent->share\n}\n";
|
|
3
|
+
export declare const BUILTIN_SOURCE = "\ndefinition user {}\ndefinition app {}\ndefinition crtr/group {\n relation member: user | crtr/group#member\n relation admin: user\n}\ndefinition crtr/object {\n relation parent: crtr/object\n relation acts_for: user\n relation reader: user | user:* | crtr/group#member\n relation editor: user | crtr/group#member\n relation messenger: user | crtr/group#member\n relation user_of: user | crtr/group#member\n relation sharer: crtr/group#admin\n permission read = reader + editor + messenger + user_of + acts_for + parent->read\n permission edit = editor + acts_for + parent->edit\n permission message = messenger + acts_for + parent->message\n permission use = user_of + acts_for + parent->use\n permission share = acts_for + sharer + parent->share\n}\n";
|
|
4
4
|
export declare const BUILTIN_DEFINITIONS: Definition[];
|
|
5
5
|
export declare const OBJECT_TYPE = "crtr/object";
|
|
6
6
|
export declare const GROUP_TYPE = "crtr/group";
|
|
@@ -3,6 +3,7 @@ definition user {}
|
|
|
3
3
|
definition app {}
|
|
4
4
|
definition crtr/group {
|
|
5
5
|
relation member: user | crtr/group#member
|
|
6
|
+
relation admin: user
|
|
6
7
|
}
|
|
7
8
|
definition crtr/object {
|
|
8
9
|
relation parent: crtr/object
|
|
@@ -11,10 +12,11 @@ definition crtr/object {
|
|
|
11
12
|
relation editor: user | crtr/group#member
|
|
12
13
|
relation messenger: user | crtr/group#member
|
|
13
14
|
relation user_of: user | crtr/group#member
|
|
15
|
+
relation sharer: crtr/group#admin
|
|
14
16
|
permission read = reader + editor + messenger + user_of + acts_for + parent->read
|
|
15
17
|
permission edit = editor + acts_for + parent->edit
|
|
16
18
|
permission message = messenger + acts_for + parent->message
|
|
17
19
|
permission use = user_of + acts_for + parent->use
|
|
18
|
-
permission share = acts_for + parent->share
|
|
20
|
+
permission share = acts_for + sharer + parent->share
|
|
19
21
|
}
|
|
20
|
-
`,s=r(e),o="crtr/object",i="crtr/group",
|
|
22
|
+
`,s=r(e),o="crtr/object",i="crtr/group",a={read:"reader",edit:"editor",message:"messenger",use:"user_of"};export{s as BUILTIN_DEFINITIONS,e as BUILTIN_SOURCE,i as GROUP_TYPE,o as OBJECT_TYPE,a as VERB_RELATION};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
WHERE g.resolved_scopes_json::jsonb @> '[{"scope":"crtr:memory:manage:user","mode":"always"}]'::jsonb`).all()).map(
|
|
1
|
+
var v=Object.defineProperty;var s=(t,e)=>v(t,"name",{value:e,configurable:!0});import{covers as A}from"@north-light/identity";import{isCloudRole as j}from"../canvas/person-state.js";import{eligiblePackageApps as x}from"../packages/eligibility.js";import{subjectSet as F}from"./evaluator.js";import{FALSE as M,TRUE as C,and as U,f as h,or as D,raw as d}from"./sql.js";const k=s(t=>({ownApp:t,roots:[],namespaces:[],place:null,predicates:{allNodes:!1,spaces:!1},authorApps:[],packageApps:null}),"empty");async function $(t,e){return(await t.prepare("SELECT external_id FROM identities WHERE object = ? ORDER BY scheme LIMIT 1").get(e))?.external_id??null}s($,"externalId");async function L(t,e,n){return(await t.prepare("SELECT o.id FROM identities i JOIN objects o ON o.id = i.object WHERE i.scheme = ? AND i.external_id = ? AND o.deleted_at IS NULL").get(e,n))?.id??null}s(L,"objectOf");async function J(t){return(await t.prepare("SELECT id FROM objects WHERE type = 'person' AND home_machine IS NULL AND deleted_at IS NULL ORDER BY created_at").all()).map(n=>n.id)}s(J,"personObjectIds");async function P(t){return(await t.prepare(`SELECT DISTINCT i.object AS id FROM grants g JOIN identities i ON i.external_id = g.grantee AND i.scheme = 'app'
|
|
2
|
+
WHERE g.resolved_scopes_json::jsonb @> '[{"scope":"crtr:memory:manage:user","mode":"always"}]'::jsonb`).all()).map(n=>n.id)}s(P,"firstPartyApps");function y(t,e){return X(t).has(e.replace(/^app:/,""))}s(y,"holdsProviderGroup");const g=new WeakMap;function X(t){let e=g.get(t);if(e===void 0){e=new Set;for(const n of t){const o=n.indexOf(":");o>=0&&!n.includes(":",o+1)&&e.add(n.slice(0,o))}g.set(t,e)}return e}s(X,"providerGroupHolders");function z(t){return t.class==="object"?t.repos.map(e=>e.id):t.class!=="node"?[]:[...new Set([...t.repos,...t.projectRepos].map(e=>e.id))]}s(z,"repoRoots");async function Y(t,e){return e===null?[]:(await F(t,e)).groupIds.filter(n=>n.startsWith("group:")).map(n=>n.slice(6))}s(Y,"memberGroups");async function Z(t,e,n){if(e.class==="person")return null;const o=e.scopes;return await x(t,{holdsProvider:s(m=>o!==null&&y(o,m),"holdsProvider"),cloud:j(),ownExt:await $(t,e.app.id),user:n})}s(Z,"readablePackageApps");async function oe(t,e,n,o,m={}){if(e.class==="person")return null;const a=k(e.app.id),r=e.scopes,E=s(i=>r!==null&&r.some(p=>A(p,i)),"has"),l=await $(t,e.app.id),w=e.class==="node"?await R(t,e.node.id):e.place??null;a.place=w,a.authorApps=[e.app.id];const c=o==="write"?"rw":"read",f=e.launched,O=s((i,p,u=!0)=>{a.roots.push({id:i,private:u,match:p})},"own");if(o==="message"||f===void 0||f===null||l===null||f.some(i=>A(i,`crtr:memory:${c}:${l}`)))O(e.app.id,"any"),l!==null&&(a.namespaces=await V(t,l));else{O(e.app.id,"non-document"),o==="read"&&w!==null&&O(e.app.id,"run-report");for(const i of await t.prepare("SELECT o.id, i.external_id FROM objects o JOIN identities i ON i.object = o.id AND i.scheme = 'profile' WHERE o.owner = ? AND o.type = 'profile' AND o.deleted_at IS NULL").all(e.app.id))f.some(p=>A(p,`crtr:memory:${c}:${l}:profile:${i.external_id}`))&&O(i.id,"no-node")}if(o==="read"&&(a.packageApps=await Z(t,e,n)??[]),r===null)return a;a.predicates.spaces=!0;const W=await J(t),_=E("crtr:memory:manage:user"),T=_||E("crtr:memory:read_private:user"),N=s((i,p)=>{for(const u of W)u!==e.app.id&&a.roots.push({id:u,private:p,match:i})},"addPerson");if(o==="write")if(_)N("any",!0);else{E("crtr:memory:rw:user")&&(N("self",!0),N("authored:*",!0));for(const i of r){const p=/^crtr:memory:rw:user:(.+)$/.exec(i);p!==null&&N(`authored:${p[1]}`,!0)}E("crtr:objects:write:user")&&N("any",!0),a.roots.some(i=>i.match.startsWith("authored:"))&&a.authorApps.push(...await P(t))}else o==="read"&&(_?N("any",!0):N("direct-doc",T),E(`crtr:objects:${m.verb??"read"}:user`)&&N("any",T));const H=o==="write"?"write":m.verb??"read",b=e.class==="object"&&e.object.type.includes("."),S=s(async(i,p)=>{const u=await L(t,"app",i);u===null||u===e.app.id||a.roots.push({id:u,private:y(r,i),match:p})},"appRoot");for(const i of r){if(!i.startsWith("crtr:"))continue;let p=/^crtr:memory:(read|rw):app:([A-Za-z0-9_-]{1,64})(?::profile:([A-Za-z0-9_-]{1,64}))?$/.exec(i);if(p!==null&&(o==="read"||o==="write"&&p[1]==="rw")){if(p[3]===void 0)await S(`app:${p[2]}`,"no-node");else{const u=await L(t,"profile",p[3]);u!==null&&a.roots.push({id:u,private:!1,match:"no-node"})}continue}if(p=/^crtr:objects:(read|watch|link|write):(user|node|profile:[A-Za-z0-9_-]+|app:[A-Za-z0-9_-]+)$/.exec(i),p!==null&&o!=="message"&&(p[1]===H||o==="read"&&b&&p[1]==="watch")){const u=p[2];if(u==="node")a.predicates.allNodes=!0;else if(u.startsWith("profile:")){const I=await L(t,"profile",u.slice(8));I!==null&&a.roots.push({id:I,private:!1,match:"below"})}else u.startsWith("app:")&&await S(u,"objects-app");continue}if(p=/^crtr:conversations:read:(app:[A-Za-z0-9_-]+)$/.exec(i),p!==null&&o==="read"){await S(p[1],"node-report"),await S(p[1],"run-node");continue}p=/^crtr:objects:message:(app:[A-Za-z0-9_-]+)$/.exec(i),p!==null&&o==="message"&&await S(p[1],"node-tree")}if(o==="read"){for(const i of a.packageApps??[])i!==e.app.id&&a.roots.push({id:i,private:!1,match:"shipped"});for(const i of await t.prepare("SELECT o.id, i.external_id FROM objects o JOIN identities i ON i.object = o.id AND i.scheme = 'app' WHERE o.type = 'app' AND o.deleted_at IS NULL").all())i.id!==e.app.id&&a.roots.push({id:i.id,private:y(r,i.external_id),match:"custom"})}if(o!=="message")for(const i of[...z(e),...await Y(t,n)])a.roots.push({id:i,private:o==="read",match:"any"});return a}s(oe,"resolveCeiling");async function V(t,e){return(await t.prepare("SELECT namespace FROM schemas WHERE app = ?").all(e)).map(n=>n.namespace)}s(V,"ownNamespaces");async function R(t,e){const n=await t.prepare("SELECT run_id, isolated FROM nodes WHERE node_id = ?").get(e);if(n!==void 0)return{run:n.run_id??e,isolated:n.isolated===1};const o=await t.prepare("SELECT run_id FROM deleted_isolated_nodes WHERE node_id = ?").get(e);return o?{run:o.run_id,isolated:!0}:null}s(R,"nodePlace");async function re(t,e){const n=await R(e,t);n?.isolated&&await e.prepare("INSERT INTO deleted_isolated_nodes (node_id, run_id) VALUES (?, ?) ON CONFLICT (node_id) DO UPDATE SET run_id = excluded.run_id").run(t,n.run)}s(re,"rememberDeletedIsolated");function ie(t){return t.class==="person"?t:{...t,launched:null}}s(ie,"asRuntimeWriter");async function ae(t,e,n,o,m=!1){if(e.class==="person"||e.launched===void 0||e.launched===null)return null;const a=await t.prepare(`WITH RECURSIVE c(id, owner, type, kind, depth) AS (
|
|
3
3
|
SELECT id, owner, type, kind, 0 FROM objects WHERE id = ? UNION ALL
|
|
4
4
|
SELECT p.id, p.owner, p.type, p.kind, c.depth + 1 FROM c JOIN objects p ON p.id = c.owner WHERE c.depth < 12)
|
|
5
|
-
SELECT c.id, c.type, c.kind FROM c ORDER BY c.depth`).all(
|
|
5
|
+
SELECT c.id, c.type, c.kind FROM c ORDER BY c.depth`).all(n);if(a[a.length-1]?.id!==e.app.id)return null;const r=await $(t,e.app.id);if(r===null)return null;if(a.length===1)return m?e.launched.some(c=>A(c,`crtr:memory:${o}:${r}`))?null:`crtr:memory:${o}:${r}`:null;if(!m&&a[0].type!=="document")return null;const E=a.slice(0,-1).reverse();if(o==="read"&&!m&&a[0].kind==="report"&&E[0].type==="node"&&e.class!=="object"){const c=e.class==="node"?await R(t,e.node.id):e.place??null,f=await R(t,E[0].id);if(c!==null&&f!==null&&c.run===f.run)return null}const l=E[0],w=l.type==="profile"?`crtr:memory:${o}:${r}:profile:${await $(t,l.id)}`:`crtr:memory:${o}:${r}`;return e.launched.some(c=>A(c,w))?null:w}s(ae,"missingMemoryScope");function pe(t,e){const n=[];t.roots.length>0&&n.push(B(t,e)),t.namespaces.length>0&&n.push(h`split_part(${d(e)}.schema_type, '/', 1) = ANY(${t.namespaces}::text[])`),t.predicates.allNodes&&n.push(d(`(${e}.type = 'node' AND ${e}.privacy = 'public')`)),t.predicates.spaces&&n.push(d(`(${e}.owner IS NULL AND ${e}.type IN ('app','person','repo','group'))`));const o=t.packageApps===null?C:h`(NOT EXISTS (SELECT 1 FROM documents sd WHERE sd.object = ${d(e)}.id AND sd.source_path IS NOT NULL) OR ${d(e)}.owner = ANY(${t.packageApps}::text[]))`;return U([D(n),G(t,e),o])}s(pe,"ceilingFrag");function G(t,e){if(t.place===null)return C;const n=t.place.isolated?1:0;return h`NOT EXISTS (WITH RECURSIVE ca(id, owner, depth, near_node) AS (
|
|
6
6
|
SELECT ${d(e)}.id, ${d(e)}.owner, 0, CASE WHEN ${d(e)}.type = 'node' THEN ${d(e)}.id END
|
|
7
7
|
UNION ALL
|
|
8
8
|
SELECT p.id, p.owner, ca.depth + 1, COALESCE(ca.near_node, CASE WHEN p.type = 'node' THEN p.id END)
|
|
9
9
|
FROM ca JOIN objects p ON p.id = ca.owner WHERE ca.depth < 12)
|
|
10
10
|
SELECT 1 FROM ca LEFT JOIN nodes cn ON cn.node_id = ca.near_node LEFT JOIN deleted_isolated_nodes cd ON cd.node_id = ca.near_node
|
|
11
11
|
WHERE ca.id = ${t.ownApp} AND ca.depth > 0 AND ca.near_node IS NOT NULL
|
|
12
|
-
AND NOT (CASE WHEN cn.node_id IS NOT NULL THEN COALESCE(cn.run_id, cn.node_id) = ${t.place.run} OR (cn.isolated = 0 AND ${
|
|
13
|
-
WHEN cd.node_id IS NOT NULL THEN cd.run_id = ${t.place.run} ELSE ${
|
|
14
|
-
WHERE rv.document = ${d(
|
|
12
|
+
AND NOT (CASE WHEN cn.node_id IS NOT NULL THEN COALESCE(cn.run_id, cn.node_id) = ${t.place.run} OR (cn.isolated = 0 AND ${n} = 0)
|
|
13
|
+
WHEN cd.node_id IS NOT NULL THEN cd.run_id = ${t.place.run} ELSE ${n} = 0 END))`}s(G,"placeFrag");function B(t,e){const n=t.roots.map(c=>c.id),o=t.roots.map(c=>c.private?1:0),m=t.roots.map(c=>c.match),a=new Set(t.roots.map(c=>c.match)),r=s(c=>`${e}.${c}`,"O"),E=[],l=s((c,f)=>{a.has(c)&&E.push(h`(r.match = ${c} AND ${typeof f=="string"?d(f):f})`)},"t");l("any","TRUE"),l("below","ca.depth > 0"),l("direct-doc",`(ca.depth = 0 OR (ca.depth = 1 AND ${r("type")} = 'document'))`),l("no-node","NOT ca.node_below"),l("node-tree","ca.node_below"),l("objects-app",`(ca.node_below OR ${r("type")} LIKE '%.%')`),l("node-report",`(ca.node_below AND ${r("type")} = 'document' AND ${r("kind")} = 'report')`),l("run-node",`(${r("type")} = 'node' AND EXISTS (SELECT 1 FROM nodes rn WHERE rn.node_id = ${r("id")} AND rn.run_id IS NOT NULL))`),l("custom",`${r("type")} LIKE '%.%'`),l("shipped",`(ca.depth > 0 AND EXISTS (SELECT 1 FROM documents sd WHERE sd.object = ${r("id")} AND sd.source_path IS NOT NULL))`),l("non-document",`(${r("type")} <> 'document')`),l("self","ca.depth = 0"),a.has("run-report")&&E.push(t.place===null?M:h`(r.match = 'run-report' AND ${d(r("type"))} = 'document' AND ${d(r("kind"))} = 'report' AND EXISTS (SELECT 1 FROM nodes rn WHERE rn.node_id = ca.near_node AND COALESCE(rn.run_id, rn.node_id) = ${t.place.run}))`);for(const c of a)if(c.startsWith("authored:")){const f=c.slice(9);E.push(h`(r.match = ${c} AND ca.depth = 1 AND ${d(r("type"))} = 'document' AND ${f==="*"?d("TRUE"):h`${d(r("name"))} = ${f}`} AND EXISTS (SELECT 1 FROM revisions rv JOIN objects au ON au.id = rv.author
|
|
14
|
+
WHERE rv.document = ${d(r("id"))} AND rv.number = (SELECT min(number) FROM revisions WHERE document = ${d(r("id"))})
|
|
15
15
|
AND (au.type = 'person' OR COALESCE((SELECT app FROM nodes WHERE node_id = au.id), au.owner) = ANY(${t.authorApps}::text[]))))`)}const w=D(E);return h`EXISTS (WITH RECURSIVE ca(id, owner, type, depth, node_below, near_node) AS (
|
|
16
|
-
SELECT ${d(
|
|
16
|
+
SELECT ${d(r("id"))}, ${d(r("owner"))}, ${d(r("type"))}, 0, FALSE, CASE WHEN ${d(r("type"))} = 'node' THEN ${d(r("id"))} END
|
|
17
17
|
UNION ALL
|
|
18
18
|
SELECT p.id, p.owner, p.type, ca.depth + 1, ca.node_below OR ca.type = 'node', COALESCE(ca.near_node, CASE WHEN p.type = 'node' THEN p.id END)
|
|
19
19
|
FROM ca JOIN objects p ON p.id = ca.owner WHERE ca.depth < 12)
|
|
20
|
-
SELECT 1 FROM ca JOIN unnest(${
|
|
21
|
-
WHERE (${d(
|
|
20
|
+
SELECT 1 FROM ca JOIN unnest(${n}::text[], ${o}::int[], ${m}::text[]) AS r(id, priv, match) ON r.id = ca.id
|
|
21
|
+
WHERE (${d(r("privacy"))} = 'public' OR r.priv = 1) AND ${w})`}s(B,"rootsFrag");export{ie as asRuntimeWriter,pe as ceilingFrag,y as holdsProviderGroup,ae as missingMemoryScope,R as nodePlace,J as personObjectIds,Z as readablePackageApps,re as rememberDeletedIsolated,oe as resolveCeiling};
|
|
@@ -121,8 +121,13 @@ export declare function readProfileMetadata(profileId: string | null): Record<st
|
|
|
121
121
|
* `PATCH /v1/profiles/:name`) must also rename the profile's canvas handle —
|
|
122
122
|
* use `renameProfileAndHandle` there; the CLI and panels go through that route. */
|
|
123
123
|
export declare function renameProfile(profileId: string, name: string): Promise<ProfileEntry>;
|
|
124
|
-
/** A new path appends; a path already listed keeps its position.
|
|
125
|
-
|
|
124
|
+
/** A new path appends; a path already listed keeps its position. `repo` is the repo object the folder's checkout identifies as;
|
|
125
|
+
* a folder no repo identifies keeps `path` only. A listed entry with that path but no repo gains the repo in place. */
|
|
126
|
+
export declare function addProfileProject(profileId: string, dir: string, repo?: string): Promise<ProfileEntry>;
|
|
127
|
+
/** Record a repo with no folder. A repo already listed (with or without a folder) keeps its position. */
|
|
128
|
+
export declare function addProfileRepo(profileId: string, repo: string): Promise<ProfileEntry>;
|
|
129
|
+
/** Give a folder entry without a repo its repo. Returns false when the entry is gone or already has one. */
|
|
130
|
+
export declare function fillProfileProjectRepo(profileId: string, path: string, repo: string): Promise<boolean>;
|
|
126
131
|
/** Set one owner's automatic delivery limit. `content` is the uncapped level,
|
|
127
132
|
* so it removes the owner's entry instead of storing it. */
|
|
128
133
|
export declare function setProfileDeliveryLimit(profileId: string, owner: string, level: ProfileProjectMemory): Promise<ProfileEntry>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var W=Object.defineProperty;var i=(e,t)=>W(e,"name",{value:t,configurable:!0});import{randomUUID as Z}from"node:crypto";import{existsSync as V,realpathSync as E,rmSync as S,statSync as Y}from"node:fs";import{resolve as O}from"node:path";import{SCHEMA_VERSION as R}from"../../types.js";import{profileSpace as g}from"../layout.js";import{PROFILE_PROJECT_MEMORY_VALUES as M}from"../../api/dto/profiles.js";import{ensureDir as G,nowIso as h}from"../fs-utils.js";import{cachedPausedProfileIds as B,cachedProfilePaused as Q,getCachedProfile as p,listCachedProfiles as X,writeSettings as w}from"../scoped-state/person-store.js";import{usage as l,notFound as u,ambiguous as k,general as I}from"../errors.js";import{fuzzyMatchProfile as ee}from"./fuzzy-match.js";import{isCloudRole as C,personId as te}from"../canvas/person-state.js";const P=/^[a-z0-9]+(?:-[a-z0-9]+)*-[0-9a-f]{8}$/,m="root-00000000",$="root";function y(e){return e.grantee??"app:terminal"}i(y,"profileApp");function x(e,t){G(g(y(t),e).dir)}i(x,"scaffoldProfile");function _(e){if(!P.test(e))throw l(`invalid profile id: ${e}`,{received:e,next:"Profile ids look like <slug>-<8-hex-chars> (as printed by `crtr profile new`). Pass an exact id or a profile name, not a raw path."})}i(_,"assertSafeProfileId");function _e(e){_(e);const t=p(e);if(t===null)throw u(`profile not found: ${e}`,{received:e});return g(y(t.manifest),e).dir}i(_e,"profileDir");function D(e){if(!Array.isArray(e))throw l("projects must be an array of {path} objects",{received:typeof e,field:"projects",next:'Pass entries like {"path": "/abs/dir"}.'});for(const t of e){if(typeof t!="object"||t===null||Array.isArray(t))throw l(`invalid project entry: ${JSON.stringify(t)}`,{field:"projects",next:'Every project is an object like {"path": "/abs/dir"}.'});const{path:r}=t;if(typeof r!="string"||r.trim()==="")throw l(`project entry has no path: ${JSON.stringify(t)}`,{field:"projects",next:"Give every project entry a non-empty directory path."})}}i(D,"assertProfileProjects");function re(e){const t=M.join(", ");if(typeof e!="object"||e===null||Array.isArray(e))throw l("delivery_limits must be an object mapping owner handles to a level",{received:typeof e,field:"delivery_limits",next:`Pass e.g. {"crouter": "preview"} \u2014 each level is one of: ${t}.`});for(const[r,n]of Object.entries(e)){if(r.trim()==="")throw l("delivery_limits has an empty owner handle",{field:"delivery_limits",next:"Key each limit by an owner handle such as a repo handle or `user`, or exactly by `<type>:<handle>` such as `repo:crouter`."});if(typeof n!="string"||!M.includes(n))throw l(`invalid delivery limit for ${r}: ${JSON.stringify(n)}`,{received:String(n),field:"delivery_limits",next:`Set ${r} to one of: ${t}.`})}}i(re,"assertDeliveryLimits");function ne(){return{entries:X(),unreadableIds:[]}}i(ne,"enumerateProfiles");function v(){return ne().entries}i(v,"listProfiles");function ie(e){const t=v(),r=N(t,e,j);return r?{kind:"resolved",entry:r}:{kind:"absent"}}i(ie,"lookupProfile");function L(e){_(e);const t=p(e);if(t!==null)return t;throw u(`profile not found: ${e}`,{received:e,next:"Run `crtr profile list` to see available profiles."})}i(L,"loadExactProfileManifest");const j=i(e=>({profileId:e.profileId,name:e.manifest.name}),"entryCandidate");function N(e,t,r){if(P.test(t)){const o=e.find(a=>r(a).profileId===t);if(o!==void 0)return o}const n=e.filter(o=>r(o).name===t);if(n.length===1)return n[0];if(n.length>1){const o=n.map(a=>r(a).profileId);throw k(`profile name "${t}" matches ${o.length} profiles: ${o.join(", ")}`,{received:t,candidates:o,next:`Re-run with one exact profile id: ${o.join(", ")}.`})}return null}i(N,"findExactProfile");function z(e,t,r){const n=e.map(o=>`${r(o).profileId} (${r(o).name})`);return u(`profile not found: ${t}`,{received:t,available:n,next:n.length>0?`Re-run with one of the profiles on this host: ${n.join(", ")} \u2014 or create one with \`crtr profile new --name <name>\`.`:"No profiles exist on this host yet \u2014 create one with `crtr profile new --name <name>`."})}i(z,"profileNotFound");function oe(e){const t=ie(e);if(t.kind==="resolved")return t.entry;throw z(v(),e,j)}i(oe,"loadProfileManifest");function je(e){return ae(v(),e,j)}i(je,"resolveProfileOperand");function ae(e,t,r){const n=N(e,t,r);if(n!==null)return n;const{match:o,tied:a}=ee(t,e.map(r));if(o!==null){const s=e.find(f=>r(f).profileId===o.profileId);return console.error(`crtr: no profile named "${t}" \u2014 using the closest match: ${r(s).name} (${r(s).profileId})`),s}if(a.length>1){const s=a.map(f=>`${f.profileId} (${f.name})`);throw k(`"${t}" is equally close to ${a.length} profiles: ${s.join(", ")}`,{received:t,candidates:a.map(f=>f.profileId),next:`Re-run with one exact profile id or name: ${s.join(", ")}.`})}throw z(e,t,r)}i(ae,"matchProfileOperand");function J(e){const t=O(e);if(!V(t)||!Y(t).isDirectory())throw l(`project directory does not exist or is not a directory: ${e}`,{received:e,next:"Pass an existing directory path."});try{return E(t)}catch{return t}}i(J,"resolveExistingProjectDir");function T(e){const t=new Set,r=[];for(const n of e)t.has(n.path)||(t.add(n.path),r.push(n));return r}i(T,"dedupeProjects");function se(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>40&&(t=t.slice(0,40).replace(/-+$/g,"")),t.length>0?t:"profile"}i(se,"slugify");function fe(e){const t=se(e);for(let r=0;r<20;r++){const n=Z().replace(/-/g,"").slice(0,8),o=`${t}-${n}`;if(p(o)===null)return o}throw I(`failed to generate a unique profile id for "${e}" after 20 attempts`)}i(fe,"generateProfileId");let b=null;function be(e){b=e}i(be,"setCloudProfileWriter");async function Ae(){if(C()){const r=v().find(n=>n.manifest.name===$&&y(n.manifest)==="app:terminal");return r!==void 0?(x(r.profileId,r.manifest),r):await q($,[],{grantee:"app:terminal"})}const e=p(m);if(e!==null)return x(m,e.manifest),e;const t={schema_version:R,name:$,projects:[],grantee:"app:terminal",paused_at:null,created_at:h(),last_used_at:h()};return x(m,t),await w(r=>r.profiles.some(n=>n.profileId===m)?[]:[{op:"profile.insert",profile:{profileId:m,manifest:t}}]),p(m)}i(Ae,"ensureRootProfile");const U=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;function F(e){return`CRTR_PROFILE_META_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}i(F,"metadataEnvName");function A(e){if(typeof e!="object"||e===null||Array.isArray(e))throw l("metadata must be a map of string keys to string values",{field:"metadata",next:'Pass an object, e.g. {"role": "support"}.'});const t=new Map;for(const[r,n]of Object.entries(e)){if(!U.test(r))throw l(`invalid metadata key: ${JSON.stringify(r)}`,{received:r,field:"metadata",next:"Keys start with a letter or digit, followed by letters, digits, `_`, or `-`."});if(typeof n!="string")throw l(`metadata value for ${r} must be a string`,{received:typeof n,field:"metadata",next:"Every metadata value is an env-var value \u2014 pass strings only."});if(n.includes("\0"))throw l(`metadata value for ${r} contains a NUL byte, which no OS accepts in an environment variable`,{field:"metadata",next:"Remove NUL bytes from the value and retry."});const o=F(r),a=t.get(o);if(a!==void 0)throw l(`metadata keys ${JSON.stringify(a)} and ${JSON.stringify(r)} both surface as ${o}`,{field:"metadata",next:"Rename or drop one \u2014 keys must stay distinct after uppercasing and `_`-folding."});t.set(o,r)}}i(A,"assertProfileMetadata");function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};const t={},r=new Set;for(const[n,o]of Object.entries(e)){if(typeof o!="string"||!U.test(n)||o.includes("\0"))continue;const a=F(n);r.has(a)||(r.add(a),t[n]=o)}return t}i(K,"sanitizeProfileMetadata");async function q(e,t=[],r={}){const n=e.trim();if(n==="")throw l("profile name must not be empty");r.metadata!==void 0&&A(r.metadata),D(t);const o=T(t.map(d=>({path:J(d.path)}))),a=fe(n),s={schema_version:R,name:n,projects:o,paused_at:null,...r.grantee===void 0?{}:{grantee:r.grantee},...r.defaultKind!==void 0?{default_kind:r.defaultKind}:{},...r.metadata!==void 0&&Object.keys(r.metadata).length>0?{metadata:{...r.metadata}}:{},created_at:h(),last_used_at:null};x(a,s);const f=i(async()=>{await w(()=>[{op:"profile.insert",profile:{profileId:a,manifest:s}}])},"insert");if(!C())await f();else{if(b===null)throw new Error("a cloud role has no profile environment writer registered");await b({profileId:a,grantee:y(s),person:te(),...r.memoryMb===void 0?{}:{memoryMb:r.memoryMb},...r.recipe===void 0?{}:{recipe:r.recipe}},async d=>{s.environment_id=d,await f()})}return{profileId:a,manifest:s}}i(q,"createProfile");async function Ee(e){if(!e.startsWith("app:")||e.length<=4)throw l("an app grantee is required");const t=`app-${e.slice(4)}`,r=v().filter(n=>n.manifest.name===t&&n.manifest.grantee===e);if(r.length>1)throw new Error(`duplicate default profile for ${e}`);return r[0]?r[0]:await q(t,[],{grantee:e})}i(Ee,"ensureAppProfile");function H(e){if(_(e),p(e)===null)throw u(`profile not found: ${e}`,{received:e,next:"Run `crtr profile list` to see available profiles."})}i(H,"requireExistingProfile");async function c(e,t){H(e);let r;return await w(n=>{const o=n.profiles.find(a=>a.profileId===e);if(o===void 0)throw u(`profile not found: ${e}`,{received:e});return r={profileId:e,manifest:t(structuredClone(o.manifest))},[{op:"profile.update",profile:r}]}),r}i(c,"mutateManifest");async function Se(e){return await c(e,t=>({...t,last_used_at:h()}))}i(Se,"updateProfileLastUsed");function le(e){if(e==null||e==="")return null;try{return oe(e)}catch{return null}}i(le,"loadProfileManifestOrNull");function Oe(e){return e==null||e===""||!P.test(e)?!1:Q(e)}i(Oe,"isProfilePaused");function Re(){return B()}i(Re,"pausedCanvasProfiles");function ce(e){if(e.manifest.paused_at!==null)throw l(`profile "${e.manifest.name}" is paused and cannot start nodes`,{received:e.profileId,next:`Resume it with \`crtr profile resume ${e.profileId}\`.`})}i(ce,"assertProfileEntryActive");function Me(e){const t=le(e);return t===null?null:(ce(t),t)}i(Me,"assertProfileActive");async function ke(e){return await c(e,t=>({...t,paused_at:t.paused_at??h()}))}i(ke,"pauseProfile");async function Ce(e){let t=null;return{...await c(e,n=>(t=n.paused_at,{...n,paused_at:null})),pausedAt:t}}i(Ce,"resumeProfile");async function De(e,t){return await c(e,r=>({...r,default_kind:t}))}i(De,"setProfileDefaultKind");async function Le(e,t,r=[]){return A(t),await c(e,n=>{const o={...K(n.metadata),...t};for(const f of r)delete o[f];A(o);const{metadata:a,...s}=n;return{...s,...Object.keys(o).length>0?{metadata:o}:{}}})}i(Le,"updateProfileMetadata");function Ne(e){if(e===null||e==="")return{};try{return K(L(e).manifest.metadata)}catch{return{}}}i(Ne,"readProfileMetadata");async function ze(e,t){const r=t.trim();if(r==="")throw l("profile name must not be empty");return await c(e,o=>({...o,name:r}))}i(ze,"renameProfile");async function Je(e,t){D([{path:t}]);const r=J(t);return await c(e,o=>({...o,projects:T([...o.projects,{path:r}])}))}i(Je,"addProfileProject");async function Te(e,t,r){return re({[t]:r}),await c(e,n=>{const{[t]:o,...a}=n.delivery_limits??{},s=r==="content"?a:{...a,[t]:r},{delivery_limits:f,...d}=n;return Object.keys(s).length===0?d:{...d,delivery_limits:s}})}i(Te,"setProfileDeliveryLimit");async function Ue(e,t){const r=O(t);let n=r;try{n=E(r)}catch{}return await c(e,a=>{const s=a.projects.filter(f=>f.path!==n&&f.path!==r);if(s.length===a.projects.length)throw u(`project not found on profile: ${t}`,{received:t,next:`Current projects: ${a.projects.length>0?a.projects.map(f=>f.path).join(", "):"(none)"}.`});return{...a,projects:s}})}i(Ue,"removeProfileProject");async function Fe(e){H(e);const t=g(y(L(e).manifest),e);await w(r=>{if(!r.profiles.some(n=>n.profileId===e))throw u(`profile not found: ${e}`,{received:e});return[{op:"profile.delete",profileId:e}]}),S(t.dir,{recursive:!0,force:!0}),S(t.env,{force:!0})}i(Fe,"deleteProfile");export{m as ROOT_PROFILE_ID,Je as addProfileProject,re as assertDeliveryLimits,Me as assertProfileActive,ce as assertProfileEntryActive,A as assertProfileMetadata,D as assertProfileProjects,q as createProfile,Fe as deleteProfile,Ee as ensureAppProfile,Ae as ensureRootProfile,Oe as isProfilePaused,v as listProfiles,L as loadExactProfileManifest,oe as loadProfileManifest,ie as lookupProfile,ae as matchProfileOperand,F as metadataEnvName,ke as pauseProfile,Re as pausedCanvasProfiles,_e as profileDir,Ne as readProfileMetadata,Ue as removeProfileProject,ze as renameProfile,je as resolveProfileOperand,Ce as resumeProfile,K as sanitizeProfileMetadata,be as setCloudProfileWriter,De as setProfileDefaultKind,Te as setProfileDeliveryLimit,Se as updateProfileLastUsed,Le as updateProfileMetadata};
|
|
1
|
+
var W=Object.defineProperty;var a=(e,t)=>W(e,"name",{value:t,configurable:!0});import{randomUUID as Z}from"node:crypto";import{existsSync as G,realpathSync as O,rmSync as R,statSync as V}from"node:fs";import{resolve as M}from"node:path";import{SCHEMA_VERSION as k}from"../../types.js";import{profileSpace as g}from"../layout.js";import{PROFILE_PROJECT_MEMORY_VALUES as C}from"../../api/dto/profiles.js";import{ensureDir as Y,nowIso as h}from"../fs-utils.js";import{cachedPausedProfileIds as B,cachedProfilePaused as Q,getCachedProfile as p,listCachedProfiles as X,writeSettings as w}from"../scoped-state/person-store.js";import{usage as c,notFound as d,ambiguous as N,general as I}from"../errors.js";import{fuzzyMatchProfile as ee}from"./fuzzy-match.js";import{isCloudRole as D,personId as te}from"../canvas/person-state.js";const P=/^[a-z0-9]+(?:-[a-z0-9]+)*-[0-9a-f]{8}$/,m="root-00000000",j="root";function y(e){return e.grantee??"app:terminal"}a(y,"profileApp");function x(e,t){Y(g(y(t),e).dir)}a(x,"scaffoldProfile");function $(e){if(!P.test(e))throw c(`invalid profile id: ${e}`,{received:e,next:"Profile ids look like <slug>-<8-hex-chars> (as printed by `crtr profile new`). Pass an exact id or a profile name, not a raw path."})}a($,"assertSafeProfileId");function $e(e){$(e);const t=p(e);if(t===null)throw d(`profile not found: ${e}`,{received:e});return g(y(t.manifest),e).dir}a($e,"profileDir");function _(e){if(!Array.isArray(e))throw c("projects must be an array of {repo?, path?} objects",{received:typeof e,field:"projects",next:'Pass entries like {"path": "/abs/dir"} or {"repo": "<repo object id>"}.'});for(const t of e){if(typeof t!="object"||t===null||Array.isArray(t))throw c(`invalid project entry: ${JSON.stringify(t)}`,{field:"projects",next:'Every project is an object like {"path": "/abs/dir"} or {"repo": "<repo object id>"}.'});const{path:n,repo:r}=t;for(const[o,i]of[["path",n],["repo",r]])if(i!==void 0&&(typeof i!="string"||i.trim()===""))throw c(`project entry has an invalid ${o}: ${JSON.stringify(t)}`,{field:"projects",next:`Give ${o} a non-empty string, or leave it out.`});if(n===void 0&&r===void 0)throw c(`project entry has neither path nor repo: ${JSON.stringify(t)}`,{field:"projects",next:"Give every project entry a directory path, a repo, or both."})}}a(_,"assertProfileProjects");function ne(e){const t=C.join(", ");if(typeof e!="object"||e===null||Array.isArray(e))throw c("delivery_limits must be an object mapping owner handles to a level",{received:typeof e,field:"delivery_limits",next:`Pass e.g. {"crouter": "preview"} \u2014 each level is one of: ${t}.`});for(const[n,r]of Object.entries(e)){if(n.trim()==="")throw c("delivery_limits has an empty owner handle",{field:"delivery_limits",next:"Key each limit by an owner handle such as a repo handle or `user`, or exactly by `<type>:<handle>` such as `repo:crouter`."});if(typeof r!="string"||!C.includes(r))throw c(`invalid delivery limit for ${n}: ${JSON.stringify(r)}`,{received:String(r),field:"delivery_limits",next:`Set ${n} to one of: ${t}.`})}}a(ne,"assertDeliveryLimits");function re(){return{entries:X(),unreadableIds:[]}}a(re,"enumerateProfiles");function v(){return re().entries}a(v,"listProfiles");function oe(e){const t=v(),n=z(t,e,b);return n?{kind:"resolved",entry:n}:{kind:"absent"}}a(oe,"lookupProfile");function L(e){$(e);const t=p(e);if(t!==null)return t;throw d(`profile not found: ${e}`,{received:e,next:"Run `crtr profile list` to see available profiles."})}a(L,"loadExactProfileManifest");const b=a(e=>({profileId:e.profileId,name:e.manifest.name}),"entryCandidate");function z(e,t,n){if(P.test(t)){const o=e.find(i=>n(i).profileId===t);if(o!==void 0)return o}const r=e.filter(o=>n(o).name===t);if(r.length===1)return r[0];if(r.length>1){const o=r.map(i=>n(i).profileId);throw N(`profile name "${t}" matches ${o.length} profiles: ${o.join(", ")}`,{received:t,candidates:o,next:`Re-run with one exact profile id: ${o.join(", ")}.`})}return null}a(z,"findExactProfile");function J(e,t,n){const r=e.map(o=>`${n(o).profileId} (${n(o).name})`);return d(`profile not found: ${t}`,{received:t,available:r,next:r.length>0?`Re-run with one of the profiles on this host: ${r.join(", ")} \u2014 or create one with \`crtr profile new --name <name>\`.`:"No profiles exist on this host yet \u2014 create one with `crtr profile new --name <name>`."})}a(J,"profileNotFound");function ie(e){const t=oe(e);if(t.kind==="resolved")return t.entry;throw J(v(),e,b)}a(ie,"loadProfileManifest");function _e(e){return ae(v(),e,b)}a(_e,"resolveProfileOperand");function ae(e,t,n){const r=z(e,t,n);if(r!==null)return r;const{match:o,tied:i}=ee(t,e.map(n));if(o!==null){const s=e.find(f=>n(f).profileId===o.profileId);return console.error(`crtr: no profile named "${t}" \u2014 using the closest match: ${n(s).name} (${n(s).profileId})`),s}if(i.length>1){const s=i.map(f=>`${f.profileId} (${f.name})`);throw N(`"${t}" is equally close to ${i.length} profiles: ${s.join(", ")}`,{received:t,candidates:i.map(f=>f.profileId),next:`Re-run with one exact profile id or name: ${s.join(", ")}.`})}throw J(e,t,n)}a(ae,"matchProfileOperand");function T(e){const t=M(e);if(!G(t)||!V(t).isDirectory())throw c(`project directory does not exist or is not a directory: ${e}`,{received:e,next:"Pass an existing directory path."});try{return O(t)}catch{return t}}a(T,"resolveExistingProjectDir");function A(e){const t=new Set,n=new Map,r=[];for(const o of e)if(o.path!==void 0){if(t.has(o.path))continue;t.add(o.path);const i=o.repo===void 0?void 0:n.get(o.repo);if(i!==void 0&&r[i].path===void 0){r[i]={...r[i],path:o.path};continue}r.push(o)}else if(o.repo!==void 0){if(n.has(o.repo))continue;n.set(o.repo,r.length),r.push(o)}else r.push(o);return r}a(A,"dedupeProjects");function se(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>40&&(t=t.slice(0,40).replace(/-+$/g,"")),t.length>0?t:"profile"}a(se,"slugify");function fe(e){const t=se(e);for(let n=0;n<20;n++){const r=Z().replace(/-/g,"").slice(0,8),o=`${t}-${r}`;if(p(o)===null)return o}throw I(`failed to generate a unique profile id for "${e}" after 20 attempts`)}a(fe,"generateProfileId");let E=null;function be(e){E=e}a(be,"setCloudProfileWriter");async function Ae(){if(D()){const n=v().find(r=>r.manifest.name===j&&y(r.manifest)==="app:terminal");return n!==void 0?(x(n.profileId,n.manifest),n):await q(j,[],{grantee:"app:terminal"})}const e=p(m);if(e!==null)return x(m,e.manifest),e;const t={schema_version:k,name:j,projects:[],grantee:"app:terminal",paused_at:null,created_at:h(),last_used_at:h()};return x(m,t),await w(n=>n.profiles.some(r=>r.profileId===m)?[]:[{op:"profile.insert",profile:{profileId:m,manifest:t}}]),p(m)}a(Ae,"ensureRootProfile");const U=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;function F(e){return`CRTR_PROFILE_META_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}a(F,"metadataEnvName");function S(e){if(typeof e!="object"||e===null||Array.isArray(e))throw c("metadata must be a map of string keys to string values",{field:"metadata",next:'Pass an object, e.g. {"role": "support"}.'});const t=new Map;for(const[n,r]of Object.entries(e)){if(!U.test(n))throw c(`invalid metadata key: ${JSON.stringify(n)}`,{received:n,field:"metadata",next:"Keys start with a letter or digit, followed by letters, digits, `_`, or `-`."});if(typeof r!="string")throw c(`metadata value for ${n} must be a string`,{received:typeof r,field:"metadata",next:"Every metadata value is an env-var value \u2014 pass strings only."});if(r.includes("\0"))throw c(`metadata value for ${n} contains a NUL byte, which no OS accepts in an environment variable`,{field:"metadata",next:"Remove NUL bytes from the value and retry."});const o=F(n),i=t.get(o);if(i!==void 0)throw c(`metadata keys ${JSON.stringify(i)} and ${JSON.stringify(n)} both surface as ${o}`,{field:"metadata",next:"Rename or drop one \u2014 keys must stay distinct after uppercasing and `_`-folding."});t.set(o,n)}}a(S,"assertProfileMetadata");function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};const t={},n=new Set;for(const[r,o]of Object.entries(e)){if(typeof o!="string"||!U.test(r)||o.includes("\0"))continue;const i=F(r);n.has(i)||(n.add(i),t[r]=o)}return t}a(K,"sanitizeProfileMetadata");async function q(e,t=[],n={}){const r=e.trim();if(r==="")throw c("profile name must not be empty");n.metadata!==void 0&&S(n.metadata),_(t);const o=A(t.map(u=>({...u.repo===void 0?{}:{repo:u.repo},...u.path===void 0?{}:{path:T(u.path)}}))),i=fe(r),s={schema_version:k,name:r,projects:o,paused_at:null,...n.grantee===void 0?{}:{grantee:n.grantee},...n.defaultKind!==void 0?{default_kind:n.defaultKind}:{},...n.metadata!==void 0&&Object.keys(n.metadata).length>0?{metadata:{...n.metadata}}:{},created_at:h(),last_used_at:null};x(i,s);const f=a(async()=>{await w(()=>[{op:"profile.insert",profile:{profileId:i,manifest:s}}])},"insert");if(!D())await f();else{if(E===null)throw new Error("a cloud role has no profile environment writer registered");await E({profileId:i,grantee:y(s),person:te(),...n.memoryMb===void 0?{}:{memoryMb:n.memoryMb},...n.recipe===void 0?{}:{recipe:n.recipe}},async u=>{s.environment_id=u,await f()})}return{profileId:i,manifest:s}}a(q,"createProfile");async function Ee(e){if(!e.startsWith("app:")||e.length<=4)throw c("an app grantee is required");const t=`app-${e.slice(4)}`,n=v().filter(r=>r.manifest.name===t&&r.manifest.grantee===e);if(n.length>1)throw new Error(`duplicate default profile for ${e}`);return n[0]?n[0]:await q(t,[],{grantee:e})}a(Ee,"ensureAppProfile");function H(e){if($(e),p(e)===null)throw d(`profile not found: ${e}`,{received:e,next:"Run `crtr profile list` to see available profiles."})}a(H,"requireExistingProfile");async function l(e,t){H(e);let n;return await w(r=>{const o=r.profiles.find(i=>i.profileId===e);if(o===void 0)throw d(`profile not found: ${e}`,{received:e});return n={profileId:e,manifest:t(structuredClone(o.manifest))},[{op:"profile.update",profile:n}]}),n}a(l,"mutateManifest");async function Se(e){return await l(e,t=>({...t,last_used_at:h()}))}a(Se,"updateProfileLastUsed");function ce(e){if(e==null||e==="")return null;try{return ie(e)}catch{return null}}a(ce,"loadProfileManifestOrNull");function Oe(e){return e==null||e===""||!P.test(e)?!1:Q(e)}a(Oe,"isProfilePaused");function Re(){return B()}a(Re,"pausedCanvasProfiles");function le(e){if(e.manifest.paused_at!==null)throw c(`profile "${e.manifest.name}" is paused and cannot start nodes`,{received:e.profileId,next:`Resume it with \`crtr profile resume ${e.profileId}\`.`})}a(le,"assertProfileEntryActive");function Me(e){const t=ce(e);return t===null?null:(le(t),t)}a(Me,"assertProfileActive");async function ke(e){return await l(e,t=>({...t,paused_at:t.paused_at??h()}))}a(ke,"pauseProfile");async function Ce(e){let t=null;return{...await l(e,r=>(t=r.paused_at,{...r,paused_at:null})),pausedAt:t}}a(Ce,"resumeProfile");async function Ne(e,t){return await l(e,n=>({...n,default_kind:t}))}a(Ne,"setProfileDefaultKind");async function De(e,t,n=[]){return S(t),await l(e,r=>{const o={...K(r.metadata),...t};for(const f of n)delete o[f];S(o);const{metadata:i,...s}=r;return{...s,...Object.keys(o).length>0?{metadata:o}:{}}})}a(De,"updateProfileMetadata");function Le(e){if(e===null||e==="")return{};try{return K(L(e).manifest.metadata)}catch{return{}}}a(Le,"readProfileMetadata");async function ze(e,t){const n=t.trim();if(n==="")throw c("profile name must not be empty");return await l(e,o=>({...o,name:n}))}a(ze,"renameProfile");async function Je(e,t,n){_([{path:t,...n===void 0?{}:{repo:n}}]);const r=T(t);return await l(e,o=>({...o,projects:A(o.projects.some(i=>i.path===r)?o.projects.map(i=>i.path===r&&i.repo===void 0&&n!==void 0?{...i,repo:n}:i):[...o.projects,{path:r,...n===void 0?{}:{repo:n}}])}))}a(Je,"addProfileProject");async function Te(e,t){return _([{repo:t}]),await l(e,n=>({...n,projects:n.projects.some(r=>r.repo===t)?n.projects:A([...n.projects,{repo:t}])}))}a(Te,"addProfileRepo");async function Ue(e,t,n){let r=!1;return await l(e,o=>{if(o.projects.some(s=>s.repo===n))return o;const i=o.projects.map(s=>s.path!==t||s.repo!==void 0?s:(r=!0,{...s,repo:n}));return r?{...o,projects:i}:o}),r}a(Ue,"fillProfileProjectRepo");async function Fe(e,t,n){return ne({[t]:n}),await l(e,r=>{const{[t]:o,...i}=r.delivery_limits??{},s=n==="content"?i:{...i,[t]:n},{delivery_limits:f,...u}=r;return Object.keys(s).length===0?u:{...u,delivery_limits:s}})}a(Fe,"setProfileDeliveryLimit");async function Ke(e,t){const n=M(t);let r=n;try{r=O(n)}catch{}return await l(e,i=>{const s=i.projects.filter(f=>f.path===void 0||f.path!==r&&f.path!==n);if(s.length===i.projects.length)throw d(`project not found on profile: ${t}`,{received:t,next:`Current projects: ${i.projects.length>0?i.projects.map(f=>f.path??`repo ${f.repo}`).join(", "):"(none)"}.`});return{...i,projects:s}})}a(Ke,"removeProfileProject");async function qe(e){H(e);const t=g(y(L(e).manifest),e);await w(n=>{if(!n.profiles.some(r=>r.profileId===e))throw d(`profile not found: ${e}`,{received:e});return[{op:"profile.delete",profileId:e}]}),R(t.dir,{recursive:!0,force:!0}),R(t.env,{force:!0})}a(qe,"deleteProfile");export{m as ROOT_PROFILE_ID,Je as addProfileProject,Te as addProfileRepo,ne as assertDeliveryLimits,Me as assertProfileActive,le as assertProfileEntryActive,S as assertProfileMetadata,_ as assertProfileProjects,q as createProfile,qe as deleteProfile,Ee as ensureAppProfile,Ae as ensureRootProfile,Ue as fillProfileProjectRepo,Oe as isProfilePaused,v as listProfiles,L as loadExactProfileManifest,ie as loadProfileManifest,oe as lookupProfile,ae as matchProfileOperand,F as metadataEnvName,ke as pauseProfile,Re as pausedCanvasProfiles,$e as profileDir,Le as readProfileMetadata,Ke as removeProfileProject,ze as renameProfile,_e as resolveProfileOperand,Ce as resumeProfile,K as sanitizeProfileMetadata,be as setCloudProfileWriter,Ne as setProfileDefaultKind,Fe as setProfileDeliveryLimit,Se as updateProfileLastUsed,De as updateProfileMetadata};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
1
|
+
var se=Object.defineProperty;var l=(t,e)=>se(t,"name",{value:e,configurable:!0});import{projectPaths as P}from"../../api/dto/profiles.js";import{spawnSync as le}from"node:child_process";import{existsSync as ae,realpathSync as ce}from"node:fs";import{basename as fe,resolve as ue,sep as A}from"node:path";import{createInterface as T}from"node:readline/promises";import{emitKeypressEvents as D}from"node:readline";import{listProfiles as O,loadProfileManifest as pe,resolveProfileOperand as de,updateProfileLastUsed as b,createProfile as me,addProfileProject as k,ensureRootProfile as L,ROOT_PROFILE_ID as N}from"./manifest.js";import{getDefaultProfileId as he,setDefaultProfileId as $e,clearDefaultProfile as j}from"./default-binding.js";import{tildify as v}from"../fs-utils.js";import{stdoutColor as _}from"../output.js";import{inTmux as we}from"../runtime/placement-tmux.js";import{surfaceTmuxStyleArgs as ge}from"../runtime/surface-bg.js";import{formatBinding as w,matchesTerminalInput as Ie,resolveUserKeybindings as ye}from"../keybindings/index.js";const xe=["crtr.profile.menu.abort","crtr.profile.menu.up","crtr.profile.menu.down","crtr.profile.menu.select","crtr.profile.menu.accept-default","crtr.profile.menu.slot.1","crtr.profile.menu.slot.2","crtr.profile.menu.slot.3","crtr.profile.menu.slot.4","crtr.profile.menu.slot.5","crtr.profile.menu.slot.6","crtr.profile.menu.slot.7","crtr.profile.menu.slot.8","crtr.profile.menu.slot.9","crtr.profile.menu.create","crtr.profile.menu.search-existing","crtr.profile.menu.use-root","crtr.profile.menu.set-default","crtr.profile.menu.add-directory","crtr.profile.menu.unpin","crtr.profile.menu.manage"],Pe=["crtr.profile.search.abort","crtr.profile.search.back","crtr.profile.search.pick","crtr.profile.search.up","crtr.profile.search.down","crtr.profile.search.delete"];function Y(t,e){return{input:e.ctrl===!0||e.meta===!0?e.name??t:t,upArrow:e.name==="up",downArrow:e.name==="down",return:e.name==="return"||e.name==="enter",escape:e.name==="escape",backspace:e.name==="backspace",ctrl:e.ctrl,meta:e.meta,shift:e.shift}}l(Y,"profileRawInput");function B(t,e,r){return e.find(n=>Ie(t,n,r))??null}l(B,"firstProfileMatch");function be(t,e){return B(t,xe,e)}l(be,"resolveProfileMenuAction");function ve(t,e){return B(t,Pe,e)}l(ve,"resolveProfileSearchAction");function W(t){const e=ue(t);if(!ae(e))return e;try{return ce(e)}catch{return e}}l(W,"resolveCwd");function F(t,e){return!!(t===e||t.startsWith(e+A)||e.startsWith(t+A))}l(F,"projectCovers");function U(t,e){return P(t.manifest.projects).some(r=>F(e,r))}l(U,"profileCoversCwd");function C(t,e){return t===null?!1:e===null?!0:t>e}l(C,"isMoreRecent");function H(t){return t.reduce((e,r)=>C(r.manifest.last_used_at,e.manifest.last_used_at)?r:e)}l(H,"pickMostRecent");function K(t){const e=W(t),r=O().filter(o=>U(o,e)),n=r.filter(o=>P(o.manifest.projects).includes(e)),s=he(e),i=s===null?null:r.find(o=>o.profileId===s)??null;return{covering:r,exact:n,pinnedId:s,pinned:i}}l(K,"profileSelectionState");function Je(t){const{covering:e,exact:r,pinned:n}=K(t);if(n!==null)return n.profileId;if(r.length===1)return r[0].profileId;const s=r.length>0?r:e;return s.length>0?H(s).profileId:N}l(Je,"selectProfileForCwdReadOnly");function q(){return!!process.stdin.isTTY&&!!process.stdout.isTTY}l(q,"isInteractive");const $=_.dim,x=_.bold,I=_.cyan;function Me(t){return I(x(t))}l(Me,"key");function G(t){if(t===null)return"never used";const e=Date.parse(t);if(Number.isNaN(e))return"used recently";const r=Math.max(0,Math.floor((Date.now()-e)/1e3));if(r<60)return"used just now";const n=Math.floor(r/60);if(n<60)return`used ${n}m ago`;const s=Math.floor(n/60);if(s<24)return`used ${s}h ago`;const i=Math.floor(s/24);if(i<30)return`used ${i}d ago`;const o=Math.floor(i/30);return o<12?`used ${o}mo ago`:`used ${Math.floor(o/12)}y ago`}l(G,"relativeUsed");function Te(t,e){const r=e!==void 0?` ${$(e)}
|
|
2
2
|
`:"";process.stdout.write(`
|
|
3
3
|
${x(t)}
|
|
4
4
|
${r}
|
|
5
|
-
`)}l(
|
|
6
|
-
`),n=r.length-1;let s=0;for(let i=0;i<n;i++){const o=r[i].replace(
|
|
5
|
+
`)}l(Te,"writeHeader");function _e(t){const e=P(t.manifest.projects),r=e.length,n=e[0];return n===void 0?G(t.manifest.last_used_at):r>1?`${v(n)} \xB7 ${r} dirs total`:v(n)}l(_e,"purviewSummary");const J=I("\u25B8"),z=l(t=>t>0?`\x1B[${t}A\r`:"","cursorUp"),Q="\x1B[0J",Ce=/\u001b\[[0-9;]*m/g;function V(t){const e=process.stdout.columns??80,r=t.split(`
|
|
6
|
+
`),n=r.length-1;let s=0;for(let i=0;i<n;i++){const o=r[i].replace(Ce,"").length;e>0&&o>e&&(s+=Math.ceil(o/e)-1)}return n+s}l(V,"blockRows");function Re(t,e,r,n,s,i){let o=`
|
|
7
7
|
${x(e)}
|
|
8
8
|
`;r!==void 0&&(o+=` ${$(r)}
|
|
9
9
|
`),o+=`
|
|
10
|
-
`;let
|
|
10
|
+
`;let d=0;for(const[h,m]of n.entries()){const c=m.bindingId===void 0?++d:0,p=m.bindingId!==void 0?w(t,m.bindingId):c<=9?w(t,`crtr.profile.menu.slot.${c}`):"",u=h===s?J:" ",f=m.detail!==""?" "+$(m.detail):"",a=m.isDefault?" "+I("\xB7 "+(m.defaultText??"default")):"";o+=` ${u} ${Me(p)} ${m.label}${f}${a}
|
|
11
11
|
`}return i!==void 0&&(o+=`
|
|
12
12
|
${$(i)}
|
|
13
13
|
`),o+=`
|
|
14
14
|
${$(`${w(t,"crtr.profile.menu.up")}/${w(t,"crtr.profile.menu.down")} move ${w(t,"crtr.profile.menu.select")} select ${w(t,"crtr.profile.menu.accept-default")} default ${w(t,"crtr.profile.menu.abort")} quit`)}
|
|
15
|
-
`,o}l(
|
|
16
|
-
`),process.exit(130)),a==="crtr.profile.menu.up"){o=(o-1+n.length)%n.length,m();return}if(a==="crtr.profile.menu.down"){o=(o+1)%n.length,m();return}if(a==="crtr.profile.menu.select"){c(),
|
|
17
|
-
`),!1)}l(
|
|
15
|
+
`,o}l(Re,"renderMenu");function X(t,e,r,n,s={}){const i=[];n.forEach((d,h)=>{d.bindingId===void 0&&i.push(h)});let o=s.initialIndex??0;return new Promise(d=>{let h=0;const m=l(()=>{const u=Re(t,e,r,n,o,s.hint);process.stdout.write((h>0?z(h)+Q:"")+u),h=V(u)},"draw"),c=l(()=>{process.stdin.off("keypress",p),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause()},"cleanup"),p=l((u,f)=>{const a=be(t,Y(u,f));if(a==="crtr.profile.menu.abort"&&(c(),process.stdout.write(`
|
|
16
|
+
`),process.exit(130)),a==="crtr.profile.menu.up"){o=(o-1+n.length)%n.length,m();return}if(a==="crtr.profile.menu.down"){o=(o+1)%n.length,m();return}if(a==="crtr.profile.menu.select"){c(),d({index:o});return}if(a==="crtr.profile.menu.accept-default"){c(),d({index:s.initialIndex??0});return}if(a?.startsWith("crtr.profile.menu.slot.")){const g=Number.parseInt(a.slice(-1),10);g>=1&&g<=i.length&&(o=i[g-1],m());return}const y=n.findIndex(g=>g.bindingId!==void 0&&g.bindingId===a);if(y>=0){c(),d({index:y});return}a!==null&&s.actionBindingIds?.includes(a)===!0&&(c(),d({index:o,action:a}))},"onKey");D(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("keypress",p),m()})}l(X,"runMenu");function Z(t){return we()?(le("tmux",["display-popup","-E","-T"," profiles ","-w","90%","-h","85%","-d",t,...ge(),"crtr sys settings --page profiles"],{stdio:"inherit"}),!0):(process.stdout.write(` ${$("the profile manager needs tmux \u2014 run `crtr sys settings` instead")}
|
|
17
|
+
`),!1)}l(Z,"openProfileManager");const R=Symbol("profile-manager-ran");function ee(t){return` ${I("\u203A")} ${$(t)} `}l(ee,"caret");function Se(t){return`crtr: no profile covers ${t}, and this session is non-interactive \u2014 using the root profile.
|
|
18
18
|
Run \`crtr profile new --name <name> --project ${t}\` to create a dedicated profile, or pass --profile <id-or-name> next time.
|
|
19
|
-
`}l(
|
|
20
|
-
`))}l(
|
|
21
|
-
`),null;let r="",n=0;const s=l(()=>r===""?e:e.filter(i=>i.manifest.name.toLowerCase().includes(r)||i.manifest.projects.some(o=>
|
|
19
|
+
`}l(Se,"rootProfileMessage");async function Ee(t,e){const r=T({input:process.stdin,output:process.stdout});try{Te(`Profile "${t.manifest.name}" doesn't cover this directory`),await te(r,t,e)}finally{r.close()}}l(Ee,"promptAddDirToProfile");async function te(t,e,r){const n=(await t.question(ee(`add this directory to "${e.manifest.name}"? [Y/n]`))).trim().toLowerCase();n==="n"||n==="no"||(await k(e.profileId,r),process.stdout.write(` ${I("\u2713")} ${$(`added this directory to "${e.manifest.name}"`)}
|
|
20
|
+
`))}l(te,"offerAddDirToProfile");async function Ae(t){const e=[...O()].filter(i=>i.profileId!==N).sort((i,o)=>C(i.manifest.last_used_at,o.manifest.last_used_at)?-1:1);if(e.length===0)return process.stdout.write(` ${$("no existing profiles to select")}
|
|
21
|
+
`),null;let r="",n=0;const s=l(()=>r===""?e:e.filter(i=>i.manifest.name.toLowerCase().includes(r)||P(i.manifest.projects).some(o=>v(o).toLowerCase().includes(r))),"matchesOf");return new Promise(i=>{let o=0;const d=l(()=>{const c=s();n>=c.length&&(n=Math.max(0,c.length-1));let p=`
|
|
22
22
|
${x("Select an existing profile")}
|
|
23
|
-
`;if(
|
|
23
|
+
`;if(p+=` ${$("across every profile, not just this directory")}
|
|
24
24
|
|
|
25
|
-
`,c.length===0)
|
|
26
|
-
`;else{const
|
|
27
|
-
`})}
|
|
25
|
+
`,c.length===0)p+=` ${$(`no match for "${r}"`)}
|
|
26
|
+
`;else{const u=Math.max(...c.map(f=>f.manifest.name.length));c.forEach((f,a)=>{p+=` ${a===n?J:" "} ${x(f.manifest.name.padEnd(u))} ${$(_e(f))}
|
|
27
|
+
`})}p+=`
|
|
28
28
|
${I("\u203A")} ${r}${$("\u2588")}
|
|
29
|
-
`,
|
|
30
|
-
`,process.stdout.write((o>0?
|
|
31
|
-
`),process.exit(130)),
|
|
32
|
-
`),i}l(
|
|
33
|
-
`),f.profileId):(
|
|
34
|
-
`)):
|
|
35
|
-
`)),f.profileId)}l(
|
|
29
|
+
`,p+=` ${$(`type to filter ${w(t,"crtr.profile.search.up")}/${w(t,"crtr.profile.search.down")} move ${w(t,"crtr.profile.search.pick")} pick ${w(t,"crtr.profile.search.back")} back`)}
|
|
30
|
+
`,process.stdout.write((o>0?z(o)+Q:"")+p),o=V(p)},"draw"),h=l(()=>{process.stdin.off("keypress",m),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause()},"cleanup"),m=l((c,p)=>{const u=ve(t,Y(c,p));if(u==="crtr.profile.search.abort"&&(h(),process.stdout.write(`
|
|
31
|
+
`),process.exit(130)),u==="crtr.profile.search.back"){h(),i(null);return}const f=s();if(u==="crtr.profile.search.pick"){f.length>0&&(h(),i(f[n].profileId));return}if(u==="crtr.profile.search.up"){f.length>0&&(n=(n-1+f.length)%f.length,d());return}if(u==="crtr.profile.search.down"){f.length>0&&(n=(n+1)%f.length,d());return}if(u==="crtr.profile.search.delete"){r=r.slice(0,-1),n=0,d();return}c!==void 0&&c.length===1&&c>=" "&&p.ctrl!==!0&&(r+=c.toLowerCase(),n=0,d())},"onKey");D(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("keypress",m),d()})}l(Ae,"promptSelectExistingProfile");async function re(t,e){const r=fe(e)||"profile",n=(await t.question(ee(`name the new profile [${r}]`))).trim(),s=n!==""?n:r,i=(await me(s,[{path:e}])).profileId;return process.stdout.write(` ${I("\u2713")} ${$(`created profile "${s}"`)}
|
|
32
|
+
`),i}l(re,"createProfileHere");async function De(t,e){const r=[{label:"create a profile here",detail:"",bindingId:"crtr.profile.menu.create"},{label:"select an existing profile",detail:"",bindingId:"crtr.profile.menu.search-existing"},{label:$("use the root profile"),detail:"",bindingId:"crtr.profile.menu.use-root",isDefault:!0}];for(;;){const n=await X(e,"No profile covers this directory",void 0,r,{initialIndex:2,actionBindingIds:["crtr.profile.menu.manage"],hint:`${w(e,"crtr.profile.menu.manage")}=manage profiles`});if(n.action==="crtr.profile.menu.manage"){if(Z(t))return R;continue}if(n.index===0){const s=T({input:process.stdin,output:process.stdout});try{return await re(s,t)}finally{s.close()}}if(n.index===1){const s=await Ae(e);if(s===null)continue;const i=pe(s),o=T({input:process.stdin,output:process.stdout});try{await te(o,i,t)}finally{o.close()}return i.profileId}return(await L()).profileId}}l(De,"promptCreateOrRoot");async function S(t,e,r,n,s){const i=[...t].sort((a,y)=>C(a.manifest.last_used_at,y.manifest.last_used_at)?-1:1),o=n!==null?i.find(a=>a.profileId===n)??null:null,d=o!==null?[o,...i.filter(a=>a!==o)]:i,h=Math.max(...d.map(a=>a.manifest.name.length)),m=d.map((a,y)=>{const g=P(a.manifest.projects),M=g.length,ne=r?`${G(a.manifest.last_used_at)}${M>1?` \xB7 ${M} dirs total`:""}`:(()=>{const E=g.find(ie=>F(e,ie))??g[0];return M>1?`matches ${v(E)} \xB7 ${M} dirs total`:`matches ${v(E)}`})(),oe=o!==null&&d[0]===o?"default (pinned)":"default";return{label:x(a.manifest.name.padEnd(h)),detail:ne,isDefault:y===0,defaultText:oe}});m.push({label:$("create a new profile here"),detail:"",bindingId:"crtr.profile.menu.create"});const c=["crtr.profile.menu.set-default","crtr.profile.menu.manage"];r||c.push("crtr.profile.menu.add-directory"),o!==null&&c.push("crtr.profile.menu.unpin");const p=[`${w(s,"crtr.profile.menu.set-default")}=set default`];r||p.push(`${w(s,"crtr.profile.menu.add-directory")}=add dir here`),o!==null&&p.push(`${w(s,"crtr.profile.menu.unpin")}=unpin`),p.push(`${w(s,"crtr.profile.menu.manage")}=manage profiles`);const u=await X(s,r?"Choose a profile":"Select a profile",r?"Several profiles claim this directory as their project":"This directory falls under existing profile(s)",m,{actionBindingIds:c,hint:p.join(" ")});if(u.action==="crtr.profile.menu.manage")return Z(e)?R:await S(t,e,r,n,s);if(u.index>=d.length){const a=T({input:process.stdin,output:process.stdout});try{return await re(a,e)}finally{a.close()}}const f=d[u.index];return u.action==="crtr.profile.menu.unpin"?(await j(e),process.stdout.write(` ${I("\u2713")} ${$("cleared the default for this directory")}
|
|
33
|
+
`),f.profileId):(u.action==="crtr.profile.menu.set-default"?(await $e(e,f.profileId),process.stdout.write(` ${I("\u2713")} ${$(`"${f.manifest.name}" is now the default here`)}
|
|
34
|
+
`)):u.action==="crtr.profile.menu.add-directory"&&(await k(f.profileId,e),process.stdout.write(` ${I("\u2713")} ${$(`added this directory to "${f.manifest.name}"`)}
|
|
35
|
+
`)),f.profileId)}l(S,"promptPickProfileOrCreate");async function ze(t,e,r=!1){const n=W(t),s=ye();if(e!=null&&e!==""){const i=de(e);return!U(i,n)&&q()&&await Ee(i,n),await b(i.profileId),i.profileId}for(;;){const{covering:i,exact:o,pinnedId:d,pinned:h}=K(n);if(d!==null&&h===null&&await j(n),h!==null&&!r)return await b(h.profileId),h.profileId;if(!r&&h===null&&o.length===1)return await b(o[0].profileId),o[0].profileId;if(!q()){const p=o.length>0?o:i;if(p.length>0){const f=H(p);return await b(f.profileId),f.profileId}const u=await L();return process.stderr.write(Se(n)),u.profileId}const m=h!==null?h.profileId:null,c=o.length>1?await S(o,n,!0,m,s):i.length>0?await S(i,n,!1,m,s):await De(n,s);if(c!==R)return await b(c),c}}l(ze,"selectProfileForCwd");export{U as profileCoversCwd,be as resolveProfileMenuAction,ve as resolveProfileSearchAction,ze as selectProfileForCwd,Je as selectProfileForCwdReadOnly};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var b=Object.defineProperty;var s=(e,t)=>b(e,"name",{value:t,configurable:!0});import{contextDir as m}from"../canvas/paths.js";import{fullName as
|
|
1
|
+
var b=Object.defineProperty;var s=(e,t)=>b(e,"name",{value:t,configurable:!0});import{projectPaths as w}from"../../api/dto/profiles.js";import{contextDir as m}from"../canvas/paths.js";import{fullName as v}from"../canvas/labels.js";import{tmuxSessionsReachable as x}from"./tmux-driver.js";import{spawnSync as k}from"node:child_process";import{readdirBeneath as _}from"../spaces/open-beneath.js";import{hostname as C}from"node:os";import{loadProfileManifest as D}from"../profiles/manifest.js";function N(e){return e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">")}s(N,"escapeAttribute");function T(){const e=x();return`Host: ${[`${process.platform} ${process.arch}`,C(),`node ${process.version}`,`tmux server: ${e?"reachable":"none"}`].join(" \xB7 ")}`}s(T,"runtimeLine");function A(e){try{const n=_("/",e).sort((i,a)=>i.isDirectory()!==a.isDirectory()?i.isDirectory()?-1:1:i.name.localeCompare(a.name)),r=n.slice(0,50).map(i=>`${i.name}${i.isDirectory()?"/":""}`),o=n.length-r.length;return o>0?[...r,`[+${o} more]`]:r}catch{return["Directory listing: unavailable (cwd missing or unreadable)."]}}s(A,"directoryListingLines");function f(e,t,n,r){const o=k(t,n,{cwd:e,encoding:"utf8",...r===void 0?{}:{env:r}});return o.error!==void 0?{ok:!1,stdout:"",stderr:o.error.message}:{ok:o.status===0,stdout:(o.stdout??"").trim(),stderr:(o.stderr??"").trim()}}s(f,"runCommand");function $(){const e={...process.env,GIT_OPTIONAL_LOCKS:"0",GIT_CONFIG_NOSYSTEM:"1",GIT_CONFIG_GLOBAL:"/dev/null"};return delete e.GIT_CONFIG_PARAMETERS,delete e.GIT_CONFIG_COUNT,e}s($,"gitEnv");function d(e,t){const n=f(e,"git",t,$());return n.ok?n.stdout:""}s(d,"runGit");function G(e){const t=[];let n={};for(const r of e)r.startsWith("worktree ")?(n.path!==void 0&&t.push({path:n.path,branch:n.branch??"detached HEAD"}),n={path:r.slice(9)}):r.startsWith("branch ")&&(n.branch=r.slice(7).replace(/^refs\/heads\//,""));return n.path!==void 0&&t.push({path:n.path,branch:n.branch??"detached HEAD"}),t}s(G,"parseWorktrees");function O(e){const t=f(e,"git",["rev-parse","--is-inside-work-tree"],$());if(!t.ok)return/not a git repository/i.test(t.stderr)?["Git: not a git repository."]:[`Git: unavailable (${t.stderr||"git command failed"}).`];const n=d(e,["branch","--show-current"])||d(e,["rev-parse","--abbrev-ref","HEAD"])||"HEAD",r=d(e,["rev-parse","--short","HEAD"])||"unknown",o=d(e,["status","--porcelain"]).split(`
|
|
2
2
|
`).filter(c=>c!=="").length,i=d(e,["worktree","list","--porcelain"]).split(`
|
|
3
|
-
`),a=
|
|
3
|
+
`),a=G(i),u=o===0?"clean":`${o} uncommitted change${o===1?"":"s"}`,h=`Git: ${n} @ ${r}; ${u}; ${a.length} worktree${a.length===1?"":"s"}.`,l=a.length===0?"Worktrees: none.":`Worktrees: ${a.map(c=>`${c.path} (${c.branch})`).join(", ")}`;return[h,l]}s(O,"gitSnapshotLines");function W(e){const t=A(e),n=O(e);let r=`<project_context>
|
|
4
4
|
|
|
5
|
-
`;return r+=`<environment cwd="${
|
|
6
|
-
`,r+=`${
|
|
5
|
+
`;return r+=`<environment cwd="${N(e)}">
|
|
6
|
+
`,r+=`${T()}
|
|
7
7
|
`,r+=`Directory:
|
|
8
8
|
${t.map(o=>` ${o}`).join(`
|
|
9
9
|
`)}
|
|
10
10
|
`,r+=`${n.map(o=>`${o}`).join(`
|
|
11
11
|
`)}
|
|
12
12
|
`,r+=`</environment>
|
|
13
|
-
</project_context>`,r}s(
|
|
14
|
-
`)}s(
|
|
15
|
-
`)}s(
|
|
13
|
+
</project_context>`,r}s(W,"buildProjectContextBlock");function M(e,t){return`Documents you write for another reader \u2014 specs, designs, findings, maps, plans \u2014 are canvas documents you own: write one with \`crtr doc write <name>\` (see \`crtr doc write -h\`), and point at it by the name it prints, \`[[${e}/<name>]]\`, never by a file path; other nodes read it with \`crtr canvas read\`, and inside this node the bare name resolves too. Your context directory \`${m(e,t)}\` (also \`$CRTR_CONTEXT_DIR\`) holds only what is not a document: scripts, data, logs and page modules. Your working dir is the project, NOT this directory, so a bare relative \`context/...\` lands in the repo, not here.`}s(M,"contextDirNote");function F(e,t){if(t==null||t==="")return"";let n;try{n=D(t)}catch{return""}const r=w(n.manifest.projects);return r.length===0?"":`Your working dir is \`${e}\`. Your profile **${n.manifest.name}** also has purview over: ${r.join(", ")}.`}s(F,"profileNote");function X(){return"Because you persist across refresh cycles, the documents you own are also where a future cycle of you resumes the work: your document `roadmap` loads at every new session, and it points at the documents holding the decisions and findings a refreshed you would need, alongside the ones you share with the nodes you spawn."}s(X,"orchestratorContextNote");function z(e,t,n){return`Context directory: \`${m(e,t)}\` (\`$CRTR_CONTEXT_DIR\`), for files only; use it in place of every source-node context path above. Documents you write are yours. The source node's documents stay the source's: read them as \`[[${n}/<name>]]\`, and a bare document name in the copied conversation that meant one of them now needs that prefix.`}s(z,"forkContextNote");function y(e){const t=v(e),n=t!==""&&t!==e.kind&&t!==e.name?` \u2014 ${t}`:"";return`${e.node_id} (${e.kind} \xB7 ${e.status})${n}`}s(y,"relativeLabel");const j=5;function K(e,t,n,r,o){if(r.length===0&&o.length===0)return"";const i=s(c=>" ".repeat(c),"indent"),a=["Your place in the canvas graph (ancestry above you, your direct children below):"];r.forEach((c,p)=>{a.push(`${i(p)}${p===0?"":"\u2514 "}${y(c)}`)});const u=r.length;a.push(`${i(u)}${u===0?"":"\u2514 "}\u25CF you: ${e} (${t}, ${n})`);const h=o.slice(0,j),l=o.length-h.length;return h.forEach((c,p)=>{const g=p===h.length-1&&l===0;a.push(`${i(u+1)}${g?"\u2514 ":"\u251C "}${y(c)}`)}),l>0&&a.push(`${i(u+1)}\u2514 +${l} more`),a.join(`
|
|
14
|
+
`)}s(K,"renderGraphMap");function q(e,t,n,r,o){const i=[`You are node ${e} \u2014 kind ${t}, mode ${n}.`];return r!=null&&r!==""&&i.push("",`You are a new FORK of ${o}, not ${o}. Pi copied the earlier conversation into this session. Treat that first-person history as reference material, not your own past.`),i.join(`
|
|
15
|
+
`)}s(q,"buildIdentityAssertion");function U(e){return e?.state!=="open"?"":`Branch: \`${e.branch}\`
|
|
16
16
|
Worktree: \`${e.path}\`
|
|
17
17
|
Base: \`${e.base_ref}\` @ \`${e.base_sha}\`
|
|
18
|
-
Commit work here. Before finishing, land it with \`crtr node worktree close\` or keep the checkout and branch when the worktree is clean and its exact tip exists on any branch on origin. Auto-drop applies only when the worktree is clean (no uncommitted changes) and nothing remains to land (zero commits ahead of the base, or its commits are already contained in the base); otherwise, unlanded commits or uncommitted changes block finalization.`}s(
|
|
18
|
+
Commit work here. Before finishing, land it with \`crtr node worktree close\` or keep the checkout and branch when the worktree is clean and its exact tip exists on any branch on origin. Auto-drop applies only when the worktree is clean (no uncommitted changes) and nothing remains to land (zero commits ahead of the base, or its commits are already contained in the base); otherwise, unlanded commits or uncommitted changes block finalization.`}s(U,"worktreeNote");export{q as buildIdentityAssertion,W as buildProjectContextBlock,M as contextDirNote,N as escapeAttribute,z as forkContextNote,X as orchestratorContextNote,F as profileNote,y as relativeLabel,K as renderGraphMap,U as worktreeNote};
|