@north-light/cli 0.3.668 → 0.3.670
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/broker/bash-job-launch.d.ts +4 -0
- package/dist/core/runtime/broker/bash-job-launch.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/resume-root.d.ts +1 -0
- package/dist/core/runtime/resume-root.js +7 -7
- package/dist/core/runtime/runner/blaxel/runner.js +2 -2
- package/dist/core/runtime/runner/machine/call.js +2 -2
- package/dist/core/runtime/runner/machine/executor.d.ts +1 -1
- package/dist/core/runtime/runner/machine/ops.d.ts +11 -1
- package/dist/core/runtime/runner/machine/ops.js +1 -1
- package/dist/core/runtime/runner/types.d.ts +2 -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/messages.js +2 -2
- 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/reconcilers/node-lifecycle/remote-wake.js +2 -1
- 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/dist/pi-extensions/canvas-tool-guide.d.ts +3 -1
- package/dist/pi-extensions/canvas-tool-guide.js +4 -4
- 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 +65 -0
- package/packages/crouter-api/dist/core/runtime/broker/daemon-ops.js +232 -0
- package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +431 -0
- package/packages/crouter-api/dist/core/runtime/broker/node-token.js +16 -0
- package/packages/crouter-api/dist/core/runtime/broker/read-ops.js +173 -0
- package/packages/crouter-api/dist/core/runtime/broker/signal-stream.js +149 -0
- package/packages/crouter-api/dist/core/runtime/broker/turn-cause.js +44 -0
- package/packages/crouter-api/dist/core/runtime/broker-protocol.js +152 -0
- package/packages/crouter-api/dist/core/runtime/broker-request.js +86 -0
- package/packages/crouter-api/dist/core/runtime/broker-sdk.js +130 -0
- package/packages/crouter-api/dist/core/runtime/canvas-extensions.js +100 -0
- package/packages/crouter-api/dist/core/runtime/close.js +266 -0
- package/packages/crouter-api/dist/core/runtime/command-expansion.js +104 -0
- package/packages/crouter-api/dist/core/runtime/command-surface.js +117 -0
- package/packages/crouter-api/dist/core/runtime/crtr-theme.js +146 -0
- package/packages/crouter-api/dist/core/runtime/deliver-live.js +84 -0
- package/packages/crouter-api/dist/core/runtime/fault-recovery.js +83 -0
- package/packages/crouter-api/dist/core/runtime/fault.js +17 -0
- package/packages/crouter-api/dist/core/runtime/fleet.js +75 -0
- package/packages/crouter-api/dist/core/runtime/focus-viewer.js +151 -0
- package/packages/crouter-api/dist/core/runtime/front-door-env.js +16 -0
- package/packages/crouter-api/dist/core/runtime/headless-pi.js +176 -0
- package/packages/crouter-api/dist/core/runtime/host.js +701 -0
- package/packages/crouter-api/dist/core/runtime/interactive-deliver.js +51 -0
- package/packages/crouter-api/dist/core/runtime/invocation.js +10 -0
- package/packages/crouter-api/dist/core/runtime/kickoff.js +263 -0
- package/packages/crouter-api/dist/core/runtime/launch-prompt.js +13 -0
- package/packages/crouter-api/dist/core/runtime/launch-target.js +87 -0
- package/packages/crouter-api/dist/core/runtime/launch.js +505 -0
- package/packages/crouter-api/dist/core/runtime/ledger.js +55 -0
- package/packages/crouter-api/dist/core/runtime/lifecycle.js +283 -0
- package/packages/crouter-api/dist/core/runtime/managed-provider-cooling.js +62 -0
- package/packages/crouter-api/dist/core/runtime/memory-admission.js +68 -0
- package/packages/crouter-api/dist/core/runtime/model-registry.js +13 -0
- package/packages/crouter-api/dist/core/runtime/model-selection.js +135 -0
- package/packages/crouter-api/dist/core/runtime/model-swap.js +75 -0
- package/packages/crouter-api/dist/core/runtime/naming.js +300 -0
- package/packages/crouter-api/dist/core/runtime/nerd-font.js +162 -0
- package/packages/crouter-api/dist/core/runtime/nodes.js +506 -0
- package/packages/crouter-api/dist/core/runtime/outcome-document.js +86 -0
- package/packages/crouter-api/dist/core/runtime/output-result.js +32 -0
- package/packages/crouter-api/dist/core/runtime/output-schema-refs.js +100 -0
- package/packages/crouter-api/dist/core/runtime/package-health.js +100 -0
- package/packages/crouter-api/dist/core/runtime/persona.js +54 -0
- package/packages/crouter-api/dist/core/runtime/pi-cli.js +65 -0
- package/packages/crouter-api/dist/core/runtime/pi-vendored.js +63 -0
- package/packages/crouter-api/dist/core/runtime/placement-tmux.js +81 -0
- package/packages/crouter-api/dist/core/runtime/placement.js +418 -0
- package/packages/crouter-api/dist/core/runtime/progress-bar.js +50 -0
- package/packages/crouter-api/dist/core/runtime/provider-credential-gate.js +48 -0
- package/packages/crouter-api/dist/core/runtime/recovery-hold.js +46 -0
- package/packages/crouter-api/dist/core/runtime/reopen.js +160 -0
- package/packages/crouter-api/dist/core/runtime/revive.js +748 -0
- package/packages/crouter-api/dist/core/runtime/roadmap.js +86 -0
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +140 -0
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +233 -0
- package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +24 -0
- package/packages/crouter-api/dist/core/runtime/runner/index.js +37 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +94 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/environment.js +7 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +42 -0
- package/packages/crouter-api/dist/core/runtime/runner/machine/runner.js +90 -0
- package/packages/crouter-api/dist/core/runtime/runner/process.js +70 -0
- package/packages/crouter-api/dist/core/runtime/runner/types.js +16 -0
- package/packages/crouter-api/dist/core/runtime/session-branch.js +16 -0
- package/packages/crouter-api/dist/core/runtime/session-cycles.js +110 -0
- package/packages/crouter-api/dist/core/runtime/session-list-cache.js +302 -0
- package/packages/crouter-api/dist/core/runtime/session-visibility.js +99 -0
- package/packages/crouter-api/dist/core/runtime/setup-marker.js +46 -0
- package/packages/crouter-api/dist/core/runtime/situational-context.js +54 -0
- package/packages/crouter-api/dist/core/runtime/situational-live.js +41 -0
- package/packages/crouter-api/dist/core/runtime/spawn-env-rows.js +15 -0
- package/packages/crouter-api/dist/core/runtime/spawn-env.js +260 -0
- package/packages/crouter-api/dist/core/runtime/spawn.js +717 -0
- package/packages/crouter-api/dist/core/runtime/stamp/protocol.js +113 -0
- package/packages/crouter-api/dist/core/runtime/start-check.js +43 -0
- package/packages/crouter-api/dist/core/runtime/stop-guard.js +150 -0
- package/packages/crouter-api/dist/core/runtime/structured-output.js +112 -0
- package/packages/crouter-api/dist/core/runtime/surface-bg.js +85 -0
- package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +743 -0
- package/packages/crouter-api/dist/core/runtime/tmux-chrome.js +5 -0
- package/packages/crouter-api/dist/core/runtime/tmux-driver.js +713 -0
- package/packages/crouter-api/dist/core/runtime/unsandboxed.js +18 -0
- package/packages/crouter-api/dist/core/runtime/view-socket.js +195 -0
- package/packages/crouter-api/dist/core/runtime/warm-pool.js +479 -0
- package/packages/crouter-api/dist/core/scope.js +184 -0
- package/packages/crouter-api/dist/core/scoped-state/db.js +271 -0
- package/packages/crouter-api/dist/core/scoped-state/legacy-profiles.js +65 -0
- package/packages/crouter-api/dist/core/scoped-state/migrate.js +332 -0
- package/packages/crouter-api/dist/core/scoped-state/paths.js +27 -0
- package/packages/crouter-api/dist/core/scoped-state/person-rows.js +185 -0
- package/packages/crouter-api/dist/core/scoped-state/person-store.js +116 -0
- package/packages/crouter-api/dist/core/scoped-state/schema.js +52 -0
- package/packages/crouter-api/dist/core/scopes.js +48 -0
- package/packages/crouter-api/dist/core/secrets/env-rows.js +40 -0
- package/packages/crouter-api/dist/core/secrets/environment-owner.js +31 -0
- package/packages/crouter-api/dist/core/secrets/environment-secrets.js +14 -0
- package/packages/crouter-api/dist/core/secrets/index.js +2 -0
- package/packages/crouter-api/dist/core/secrets/key.js +33 -0
- package/packages/crouter-api/dist/core/secrets/seal.js +43 -0
- package/packages/crouter-api/dist/core/secrets.js +147 -0
- package/packages/crouter-api/dist/core/self-update.js +77 -0
- package/packages/crouter-api/dist/core/session-model/session-state.js +180 -0
- package/packages/crouter-api/dist/core/shell-segments.js +169 -0
- package/packages/crouter-api/dist/core/spaces/cache-env.js +15 -0
- package/packages/crouter-api/dist/core/spaces/file-root.js +68 -0
- package/packages/crouter-api/dist/core/spaces/mounts.js +126 -0
- package/packages/crouter-api/dist/core/spaces/open-beneath.js +581 -0
- package/packages/crouter-api/dist/core/spaces/permissions.js +77 -0
- package/packages/crouter-api/dist/core/spaces/process.js +172 -0
- package/packages/crouter-api/dist/core/spaces/runtime-home.js +8 -0
- package/packages/crouter-api/dist/core/spaces/space.js +58 -0
- package/packages/crouter-api/dist/core/spaces/stop.js +138 -0
- package/packages/crouter-api/dist/core/spaces/users.js +43 -0
- package/packages/crouter-api/dist/core/sqlite-statements.js +17 -0
- package/packages/crouter-api/dist/core/statements.js +81 -0
- package/packages/crouter-api/dist/core/storage/attachments.js +141 -0
- package/packages/crouter-api/dist/core/storage/caller-file.js +84 -0
- package/packages/crouter-api/dist/core/storage/client.js +220 -0
- package/packages/crouter-api/dist/core/storage/media-types.js +22 -0
- package/packages/crouter-api/dist/core/storage/purge.js +55 -0
- package/packages/crouter-api/dist/core/storage/tables.js +129 -0
- package/packages/crouter-api/dist/core/subscription-state.js +449 -0
- package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +206 -0
- package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +336 -0
- package/packages/crouter-api/dist/core/substrate/delivery/listings.js +75 -0
- package/packages/crouter-api/dist/core/substrate/delivery/match.js +146 -0
- package/packages/crouter-api/dist/core/substrate/delivery/plan.js +130 -0
- package/packages/crouter-api/dist/core/substrate/delivery/render-boot.js +330 -0
- package/packages/crouter-api/dist/core/substrate/delivery/render-event.js +186 -0
- package/packages/crouter-api/dist/core/substrate/delivery/sub-persona-menu.js +24 -0
- package/packages/crouter-api/dist/core/substrate/delivery/types.js +1 -0
- package/packages/crouter-api/dist/core/substrate/gate-explain.js +397 -0
- package/packages/crouter-api/dist/core/substrate/schema.js +81 -0
- package/packages/crouter-api/dist/core/substrate/subject-fields.js +39 -0
- package/packages/crouter-api/dist/core/substrate/subject.js +60 -0
- package/packages/crouter-api/dist/core/termrender/code-doc.js +92 -0
- package/packages/crouter-api/dist/core/termrender/display.js +56 -0
- package/packages/crouter-api/dist/core/termrender/termrender.js +719 -0
- package/packages/crouter-api/dist/core/termrender/version.js +1 -0
- package/packages/crouter-api/dist/core/timing.js +94 -0
- package/packages/crouter-api/dist/core/tui/draw.js +378 -0
- package/packages/crouter-api/dist/core/tui/fuzzy.js +38 -0
- package/packages/crouter-api/dist/core/tui/markdown.js +407 -0
- package/packages/crouter-api/dist/core/tui/page-host.js +74 -0
- package/packages/crouter-api/dist/core/tui/panel.js +142 -0
- package/packages/crouter-api/dist/core/tui/terminal.js +100 -0
- package/packages/crouter-api/dist/core/user-settings.js +478 -0
- package/packages/crouter-api/dist/core/wake.js +296 -0
- package/packages/crouter-api/dist/core/worktree-close.js +251 -0
- package/packages/crouter-api/dist/core/worktree-containment.js +48 -0
- package/packages/crouter-api/dist/core/worktree-landing.js +56 -0
- package/packages/crouter-api/dist/core/worktree-machine.js +92 -0
- package/packages/crouter-api/dist/core/worktree-mutation-async.js +385 -0
- package/packages/crouter-api/dist/core/worktree-remove.js +84 -0
- package/packages/crouter-api/dist/core/worktree.js +909 -0
- package/packages/crouter-api/dist/daemon/api/deferred-head.js +117 -0
- package/packages/crouter-api/dist/daemon/api/environment-of.js +64 -0
- package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +341 -0
- package/packages/crouter-api/dist/daemon/api/handlers/broker-recovery.js +266 -0
- package/packages/crouter-api/dist/daemon/api/handlers/git-credential.js +64 -0
- package/packages/crouter-api/dist/daemon/api/handlers/providers.js +284 -0
- package/packages/crouter-api/dist/daemon/api/handlers/validate.js +58 -0
- package/packages/crouter-api/dist/daemon/api/map.js +768 -0
- package/packages/crouter-api/dist/daemon/api/operations.js +316 -0
- package/packages/crouter-api/dist/daemon/api/principal.js +147 -0
- package/packages/crouter-api/dist/daemon/api/reader.js +125 -0
- package/packages/crouter-api/dist/daemon/api/router.js +542 -0
- package/packages/crouter-api/dist/daemon/api/sync-notice.js +46 -0
- package/packages/crouter-api/dist/daemon/api/viewer-presence.js +100 -0
- package/packages/crouter-api/dist/daemon/broker-signals/bus.js +203 -0
- package/packages/crouter-api/dist/daemon/companion-retire.js +44 -0
- package/packages/crouter-api/dist/daemon/control.js +22 -0
- package/packages/crouter-api/dist/daemon/cron/authority.js +101 -0
- package/packages/crouter-api/dist/daemon/cron/live-runs.js +66 -0
- package/packages/crouter-api/dist/daemon/cron/run-socket.js +170 -0
- package/packages/crouter-api/dist/daemon/drain.js +76 -0
- package/packages/crouter-api/dist/daemon/http-dispatcher.js +37 -0
- package/packages/crouter-api/dist/daemon/human/finish.js +178 -0
- package/packages/crouter-api/dist/daemon/human/settle.js +103 -0
- package/packages/crouter-api/dist/daemon/machine-link/config.js +63 -0
- package/packages/crouter-api/dist/daemon/machine-link/credential.js +24 -0
- package/packages/crouter-api/dist/daemon/machine-link/forward.js +181 -0
- package/packages/crouter-api/dist/daemon/machine-link/frames.js +29 -0
- package/packages/crouter-api/dist/daemon/machine-link/holder.js +317 -0
- package/packages/crouter-api/dist/daemon/machine-link/move-notify.js +15 -0
- package/packages/crouter-api/dist/daemon/manage.js +736 -0
- package/packages/crouter-api/dist/daemon/park-activity.js +33 -0
- package/packages/crouter-api/dist/daemon/park-pending.js +76 -0
- package/packages/crouter-api/dist/daemon/pidfile.js +37 -0
- package/packages/crouter-api/dist/daemon/postgres/binary.js +193 -0
- package/packages/crouter-api/dist/daemon/postgres/cluster.js +111 -0
- package/packages/crouter-api/dist/daemon/postgres/pins.js +16 -0
- package/packages/crouter-api/dist/daemon/postgres/supervisor.js +177 -0
- package/packages/crouter-api/dist/daemon/readiness.js +37 -0
- package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +846 -0
- package/packages/crouter-api/dist/daemon/reconcilers/ledger-sandbox.js +249 -0
- package/packages/crouter-api/dist/daemon/reconcilers/live-obligation.js +125 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/launch-failure.js +8 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/node-person.js +40 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +151 -0
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +59 -0
- package/packages/crouter-api/dist/daemon/reconcilers/recipe-image.js +196 -0
- package/packages/crouter-api/dist/daemon/reconcilers/throttled-lane.js +63 -0
- package/packages/crouter-api/dist/daemon/runs/append-section.js +135 -0
- package/packages/crouter-api/dist/daemon/runs/observer.js +441 -0
- package/packages/crouter-api/dist/daemon/runs/view-transport.js +81 -0
- package/packages/crouter-api/dist/daemon/startup-policy.js +1 -0
- package/packages/crouter-api/dist/daemon/structured-requests/sidecar.js +5 -0
- package/packages/crouter-api/dist/hook-authoring.js +447 -0
- package/packages/crouter-api/dist/hook-process.js +34 -0
- package/packages/crouter-api/dist/launcher/client.js +52 -0
- package/packages/crouter-api/dist/launcher/limits/policy.js +142 -0
- package/packages/crouter-api/dist/launcher/limits/settings.js +94 -0
- package/packages/crouter-api/dist/launcher/spec.js +10 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/apply.js +113 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/fields.js +52 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/index.js +89 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/discover.js +251 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/history.js +37 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/nested.js +37 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/parse.js +24 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/types.js +3 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/plan.js +410 -0
- package/packages/crouter-api/dist/migrations/004-canvas-documents/pointers.js +95 -0
- package/packages/crouter-api/dist/migrations/activation.js +46 -0
- package/packages/crouter-api/dist/native/linux.js +20 -0
- package/packages/crouter-api/dist/shared/crtr-version.js +18 -0
- package/packages/crouter-api/dist/shared/env.js +335 -0
- package/packages/crouter-api/dist/shared/generated-context.js +240 -0
- package/packages/crouter-api/dist/shared/inbox-entry-body.js +124 -0
- package/packages/crouter-api/dist/shared/inline-ref-grammar.js +99 -0
- package/packages/crouter-api/dist/shared/predicates.js +4 -0
- package/packages/crouter-api/dist/shared/shell-quote.js +5 -0
- package/packages/crouter-api/dist/shared/strip-cd-prefix.js +13 -0
- package/packages/crouter-api/dist/shared/tool-groups.js +64 -0
- package/packages/crouter-api/dist/shared/traceparent.js +28 -0
- package/packages/crouter-api/dist/shared/turn-replies.js +71 -0
- package/packages/crouter-api/dist/shared/working-activity.js +27 -0
- package/packages/crouter-api/dist/types.js +193 -0
- package/packages/crouter-api/package.json +49 -0
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/dist/approval.js +12 -0
- package/packages/crouter-plugin/dist/bundle.js +203 -0
- package/packages/crouter-plugin/dist/caller.js +23 -0
- package/packages/crouter-plugin/dist/client/index.js +338 -0
- package/packages/crouter-plugin/dist/compare.js +314 -0
- package/packages/crouter-plugin/dist/define.js +531 -0
- package/packages/crouter-plugin/dist/errors.js +150 -0
- package/packages/crouter-plugin/dist/fields.js +83 -0
- package/packages/crouter-plugin/dist/index.js +15 -0
- package/packages/crouter-plugin/dist/manifest.js +111 -0
- package/packages/crouter-plugin/dist/node.js +153 -0
- package/packages/crouter-plugin/dist/params.js +85 -0
- package/packages/crouter-plugin/dist/receipts.js +234 -0
- package/packages/crouter-plugin/dist/serve.js +630 -0
- package/packages/crouter-plugin/dist/verify.js +84 -0
- package/packages/crouter-plugin/dist/watchable.js +14 -0
- package/packages/crouter-plugin/package.json +42 -0
- package/runtime.lock.json +14 -13
- package/scripts/sandbox-bootstrap.sh +4 -0
- 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
|
@@ -14,7 +14,7 @@ export type Resolution = {
|
|
|
14
14
|
missing: true;
|
|
15
15
|
};
|
|
16
16
|
/** The owners a bare name is looked up under, in order: own node, repos nearest
|
|
17
|
-
* first, the profile's project repos, profile, app, you, then the apps whose tools the run may use (installed
|
|
17
|
+
* first (each checkout's own repo object first, then others oldest first), the profile's project repos, profile, app, you, your groups, then the apps whose tools the run may use (installed
|
|
18
18
|
* plugins) with `crtr` last. */
|
|
19
19
|
export declare function viewOf(db: CanvasDb, reader: Reader): Promise<ObjectRow[]>;
|
|
20
20
|
/** SQL true when the reader may read the candidate `alias`, live or deleted. A live object is `permits(read)`. A deleted object other than a node
|
|
@@ -25,7 +25,7 @@ export declare function readableOrDeleted(db: CanvasDb, ev: EvalReader, alias: s
|
|
|
25
25
|
/** Whether the reader may read the object `id`, live or deleted. */
|
|
26
26
|
export declare function canReadOrDeleted(db: CanvasDb, ev: EvalReader, id: string): Promise<boolean>;
|
|
27
27
|
/** The owner types that carry a handle; `<type>:<handle>/<name>` names one exactly. */
|
|
28
|
-
export declare const HANDLE_TYPES: readonly ["person", "app", "repo", "profile"];
|
|
28
|
+
export declare const HANDLE_TYPES: readonly ["person", "app", "repo", "profile", "group"];
|
|
29
29
|
/** A ref without its `[[ ]]` wrapper. */
|
|
30
30
|
export declare const unwrapRef: (raw: string) => string;
|
|
31
31
|
/** Every owner a handle names: a node by id, and each handle-carrying owner type
|
package/dist/core/graph/names.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
WHERE o.type = 'person' AND o.home_machine IS NULL AND regexp_replace(i.external_id, '^user:', '') = ?`).get(
|
|
1
|
+
var B=Object.defineProperty;var d=(o,t)=>B(o,"name",{value:t,configurable:!0});import{isSafeNodeId as P}from"../canvas/paths.js";import{OBJECT_TYPE as J}from"../permissions/builtin.js";import{ceilingFrag as V,readablePackageApps as X,resolveCeiling as z}from"../permissions/ceiling.js";import{compilePermission as G}from"../permissions/compile.js";import{permits as K,readerUser as Q,resolveReader as x,subjectSet as Z}from"../permissions/evaluator.js";import{loadDefinitions as ee}from"../permissions/schemas.js";import{and as te,or as oe,raw as C}from"../permissions/sql.js";import{flatMapAsync as ne}from"../async-array.js";async function H(o,t){const n=await Q(o,t),r=n===null?void 0:await o.prepare(`SELECT o.* FROM objects o JOIN identities i ON i.object = o.id AND i.scheme = 'user'
|
|
2
|
+
WHERE o.type = 'person' AND o.home_machine IS NULL AND regexp_replace(i.external_id, '^user:', '') = ?`).get(n),i=await X(o,t,n),m=await o.prepare(`SELECT a.* FROM objects a WHERE a.type = 'app' AND a.deleted_at IS NULL AND ${i===null?`EXISTS (
|
|
3
3
|
SELECT 1 FROM objects o JOIN documents d ON d.object = o.id
|
|
4
4
|
WHERE o.owner = a.id AND o.type = 'document' AND o.deleted_at IS NULL AND d.source_path IS NOT NULL)`:"a.id = ANY(?::text[])"}
|
|
5
|
-
ORDER BY a.name = 'crtr', a.name`).all(...
|
|
6
|
-
SELECT ${
|
|
5
|
+
ORDER BY a.name = 'crtr', a.name`).all(...i===null?[]:[i]),p=t.class==="node"?[t.node,...t.repos,...t.projectRepos,t.profile,t.app]:t.class==="app"?[t.app]:t.class==="object"?[t.owner,...t.repos,t.app]:[],f=n===null?[]:(await Z(o,n)).groupIds.filter(u=>u.startsWith("group:")).map(u=>u.slice(6)),c=f.length===0?[]:await o.prepare("SELECT * FROM objects WHERE type = 'group' AND deleted_at IS NULL AND id = ANY(?::text[]) ORDER BY created_at, seq").all(f),N=new Set;return[...p,r,...c,...m].filter(u=>!!u&&!N.has(u.id)&&!!N.add(u.id))}d(H,"viewOf");async function ae(o,t,n){const r=await K(o,t,"read",n),i=await z(o,t.reader,t.userId,"read"),m=G(await ee(o),t.subjects,J,"read",C("gr.id")),p={sql:`EXISTS (WITH RECURSIVE up(id, depth) AS (
|
|
6
|
+
SELECT ${n}.id, 0
|
|
7
7
|
UNION ALL SELECT p.owner, up.depth + 1 FROM up JOIN objects p ON p.id = up.id WHERE p.owner IS NOT NULL AND up.depth < 12)
|
|
8
|
-
SELECT 1 FROM up gr WHERE ${m.sql})`,params:m.params},f=
|
|
9
|
-
AND o.deleted_at IS ${
|
|
10
|
-
OR (type IN ('person','app','repo','profile') AND (name = ? OR id = ?) AND home_machine IS NULL)`).all(t,t,t)}d(
|
|
11
|
-
AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${f.sql}`).all(t.view.map(a=>a.id),p,...f.params),N=new Map(t.view.map((a,w)=>[a.id,w])),
|
|
12
|
-
AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${a.sql}`).all(e,s,...a.params);return new Map(l.map(
|
|
13
|
-
AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NOT NULL AND ${a.sql} ORDER BY o.deleted_at DESC`).all(_,j,...a.params),
|
|
8
|
+
SELECT 1 FROM up gr WHERE ${m.sql})`,params:m.params},f=te([C(`${n}.deleted_at IS NOT NULL AND ${n}.schema_type IS NULL`),...i===null?[]:[V(i,n)],p]);return oe([r,f])}d(ae,"readableOrDeleted");const y=new WeakMap;function D(o,t){let n=y.get(t);return n===void 0&&(n=ae(o,t,"o"),n.catch(()=>y.delete(t)),y.set(t,n)),n}d(D,"readableFrag");async function Ne(o,t,n){const r=await D(o,t);return(await o.prepareUncached(`SELECT ${r.sql} AS ok FROM objects o WHERE o.id = ?`).get(...r.params,n))?.ok===!0}d(Ne,"canReadOrDeleted");async function se(o,t,n,r,i,m=!1){const p=await D(o,t);return await o.prepareUncached(`SELECT o.* FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0) AND o.owner = ? AND o.name = ? AND o.home_machine IS ${m?"NOT NULL":"NULL"}
|
|
9
|
+
AND o.deleted_at IS ${i?"NOT NULL":"NULL"} AND ${p.sql}${i?" ORDER BY o.deleted_at DESC":""}`).all(n.id,r,...p.params)}d(se,"namedObjects");const Ee=["person","app","repo","profile","group"],F=/^(person|app|repo|profile|group|node):([^/]+)\/(.+)$/,I=d(o=>o.trim().replace(/^\[\[(.*)\]\]$/,"$1").trim(),"unwrapRef");function W(o){const t=F.exec(o);if(t)return{type:t[1],handle:t[2],rest:t[3]};const n=o.indexOf("/");return n>0?{handle:o.slice(0,n),rest:o.slice(n+1)}:null}d(W,"splitOwnerRef");async function Y(o,t,n){return n==="node"?await o.prepare("SELECT * FROM objects WHERE type = 'node' AND id = ?").all(t):n?await o.prepare("SELECT * FROM objects WHERE type = ? AND (name = ? OR id = ?) AND home_machine IS NULL").all(n,t,t):await o.prepare(`SELECT * FROM objects WHERE (type = 'node' AND id = ?)
|
|
10
|
+
OR (type IN ('person','app','repo','profile','group') AND (name = ? OR id = ?) AND home_machine IS NULL)`).all(t,t,t)}d(Y,"ownersByHandle");const v=/^([^:/]+):reports\/(.+?)(?:\.md)?$/;async function he(o,t,n){const r=[...new Set(n.filter(a=>I(a)===a&&!v.test(a)))],i=new Map;if(r.length===0||t.view.length===0)return i;const m=new Set((await o.prepare("SELECT id FROM objects WHERE id = ANY(?::text[])").all(r)).map(a=>a.id)),p=r.filter(a=>!m.has(a));for(const a of p)i.set(a,null);const f=await D(o,t.ev),c=await o.prepareUncached(`SELECT o.id, o.owner, o.name FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0)
|
|
11
|
+
AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${f.sql}`).all(t.view.map(a=>a.id),p,...f.params),N=new Map(t.view.map((a,w)=>[a.id,w])),u=new Map;for(const a of c){const w=N.get(a.owner);w<(u.get(a.name)??1/0)&&(u.set(a.name,w),i.set(a.name,a.id))}return i}d(he,"viewResolutions");async function Le(o,t,n,r){return(await re(o,t,[n],r)).get(n)}d(Le,"resolveName");async function re(o,t,n,r){const i=[...n];if(i.length===0)return new Map;const m=r?.ev??await x(o,t),p=r?.view??await H(o,t),f=new Map;for(const a of i){let w=I(a);const R=v.exec(w);R&&!F.test(w)&&(w=`${R[1]}/reports/${R[2]}`),f.set(a,w)}const c=new Map,N=[...new Set(f.values())];if(N.length>0){const a=await D(o,m),w=await o.prepareUncached(`SELECT o.*, ${a.sql} AS readable_ok FROM objects o WHERE o.id = ANY(?::text[])`).all(...a.params,N);for(const{readable_ok:e,...s}of w)e===!0&&c.set(s.id,s.deleted_at?{deleted:s}:{object:s});const R=d(async(e,s)=>{if(e.length===0||s.length===0)return new Map;const l=await o.prepareUncached(`SELECT o.* FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0)
|
|
12
|
+
AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${a.sql}`).all(e,s,...a.params);return new Map(l.map(E=>[`${E.owner}\0${E.name}`,E]))},"live"),M=N.filter(e=>!c.has(e)),T=await R(p.map(e=>e.id),M);for(const e of M){const s=p.find(l=>T.has(`${l.id}\0${e}`));s&&c.set(e,{object:T.get(`${s.id}\0${e}`)})}const S=N.filter(e=>!c.has(e)).flatMap(e=>{const s=W(e);return s?[{name:e,...s}]:[]}),g=new Map;for(const e of S){const s=`${e.type??""}\0${e.handle}`;g.has(s)||g.set(s,await Y(o,e.handle,e.type))}const b=await R([...new Set([...g.values()].flat().map(e=>e.id))],[...new Set(S.map(e=>e.rest))]),$=d(e=>{const s=p.findIndex(l=>l.id===e.id);return s<0?1/0:s},"rank");for(const e of S){const s=g.get(`${e.type??""}\0${e.handle}`),l=d(h=>b.get(`${h.id}\0${e.rest}`),"hitOf"),E=s.filter(h=>$(h)<1/0).sort((h,O)=>$(h)-$(O)).find(h=>l(h)!==void 0),L=s.flatMap(h=>{const O=l(h);return O?[O]:[]});E?c.set(e.name,{object:l(E)}):L.length===1?c.set(e.name,{object:L[0]}):L.length>1&&c.set(e.name,{ambiguous:L})}const k=new Set(S.map(e=>e.name)),U=N.filter(e=>!c.has(e)),_=[...new Set([...p.map(e=>e.id),...[...g.values()].flat().map(e=>e.id)])],j=[...new Set(U.map(e=>k.has(e)?S.find(s=>s.name===e).rest:e))],q=_.length===0||j.length===0?[]:await o.prepareUncached(`SELECT o.* FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0)
|
|
13
|
+
AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NOT NULL AND ${a.sql} ORDER BY o.deleted_at DESC`).all(_,j,...a.params),A=new Map;for(const e of q)A.has(`${e.owner}\0${e.name}`)||A.set(`${e.owner}\0${e.name}`,e);for(const e of U){const s=S.find(l=>l.name===e);if(s){const l=g.get(`${s.type??""}\0${s.handle}`),E=l.map(L=>A.get(`${L.id}\0${s.rest}`)).find(L=>L!==void 0);E?c.set(e,{deleted:E}):s.type===void 0&&l.length===0&&P(s.handle)&&c.set(e,{remote:e})}else{const l=p.find(E=>A.has(`${E.id}\0${e}`));l&&c.set(e,{deleted:A.get(`${l.id}\0${e}`)})}}}const u=new Map;for(const[a,w]of f)u.set(a,c.get(w)??{missing:!0});return u}d(re,"resolveNames");async function Re(o,t,n){const r=I(n),i=await x(o,t),m=d(async(c,N)=>await ne(c,async u=>await se(o,i,u,N,!1,!0)),"found"),p=await m(await H(o,t),r);if(p.length)return p;const f=W(r);return f?await m(await Y(o,f.handle,f.type),f.rest):[]}d(Re,"stubsNamed");export{Ee as HANDLE_TYPES,Ne as canReadOrDeleted,Y as ownersByHandle,ae as readableOrDeleted,Le as resolveName,re as resolveNames,Re as stubsNamed,I as unwrapRef,H as viewOf,he as viewResolutions};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ObjectRow, Privacy, Reader } from './types.js';
|
|
2
2
|
import type { CanvasDb } from '../canvas/db.js';
|
|
3
|
-
export type OwnerType = 'person' | 'app' | 'repo' | 'profile';
|
|
3
|
+
export type OwnerType = 'person' | 'app' | 'repo' | 'profile' | 'group';
|
|
4
4
|
export declare function getById(db: CanvasDb, id: string): Promise<ObjectRow | null>;
|
|
5
5
|
export declare function createObject(db: CanvasDb, spec: {
|
|
6
6
|
id?: string;
|
|
@@ -87,3 +87,6 @@ export interface SearchHit {
|
|
|
87
87
|
* each document's head bodies for the substring, and `grep` scans them for `text`
|
|
88
88
|
* as a regular expression. Body search reads every readable body: linear, no index. */
|
|
89
89
|
export declare function searchObjects(db: CanvasDb, reader: Reader, query: SearchQuery): Promise<SearchHit[]>;
|
|
90
|
+
/** One-time cutover (`crtr sys repo-docs rename`): give the live repo object holding handle `from` the handle `to`.
|
|
91
|
+
* Refuses with `conflict` before changing anything when another live repo holds `to`. The id never changes (I4). */
|
|
92
|
+
export declare function renameRepoObject(db: CanvasDb, from: string, to: string): Promise<boolean>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`).get(t.id??await
|
|
3
|
-
WHERE i.person = ? AND i.scheme = ? AND i.external_id = ?`).get(p,o,i),"find"),
|
|
1
|
+
var k=Object.defineProperty;var r=(e,t)=>k(e,"name",{value:t,configurable:!0});import{CrtrError as A,notFound as C}from"../errors.js";import{ExitCode as O}from"../../types.js";import{newNodeId as J}from"../runtime/nodes.js";import{kindOf as P}from"./kinds/registry.js";import{findMany as Y}from"./bodies.js";import{isCloudRole as _,personId as B,personIdAsync as U}from"../canvas/person.js";import{check as K,permits as y,resolveReader as g}from"../permissions/evaluator.js";import{userSubject as j,writeActsFor as I}from"../permissions/facts.js";const G=new Set(["person","app","repo","profile","group"]);function F(e){return e||null}r(F,"rowFrom");async function X(e,t){return F(await e.prepare("SELECT * FROM objects WHERE id = ?").get(t))}r(X,"getById");async function z(e,t){return await P(e,t.type),await e.prepare(`INSERT INTO objects (id, type, kind, owner, privacy, name, preview, created_at, home_machine, schema_type)
|
|
2
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`).get(t.id??await J(),t.type,t.kind,t.owner,t.privacy,t.name,t.preview,new Date().toISOString(),t.home_machine??null,t.schema_type??null)}r(z,"createObject");const V=r((e,t,o="")=>`owner:${o}:${e}:${t}`,"ownerLockKey");async function M(e,t,o,i,n,d){if(!G.has(t))throw new Error(`ensureOwner: ${t} is not an owner type`);const p=t==="repo"?await U():"",u=r(async()=>await e.prepare(`SELECT o.* FROM identities i JOIN objects o ON o.id = i.object
|
|
3
|
+
WHERE i.person = ? AND i.scheme = ? AND i.external_id = ?`).get(p,o,i),"find"),h=await u();if(h)return h;await e.prepare("SELECT pg_advisory_xact_lock(hashtext(?))").get(V(o,i,p));const L=await u();if(L)return L;const E=await e.prepare(`SELECT o.id, o.type, i.scheme, i.external_id FROM objects o
|
|
4
4
|
LEFT JOIN identities i ON i.object = o.id
|
|
5
|
-
WHERE o.name = ? AND o.type = ? AND o.home_machine IS NULL`).get(n,t);if(E)throw new
|
|
5
|
+
WHERE o.name = ? AND o.type = ? AND o.home_machine IS NULL`).get(n,t);if(E)throw new A("conflict",`handle "${n}" is held by ${E.type} ${E.id} (${E.scheme}:${E.external_id}); cannot give it to ${t} ${o}:${i}`,O.GENERAL,{handle:n,holder:E.id});const m=await z(e,{type:t,kind:null,owner:t==="profile"?d?.id??null:null,privacy:"public",name:n,preview:""});return await e.prepare("INSERT INTO identities (object, scheme, external_id, person) VALUES (?, ?, ?, ?)").run(m.id,o,i,p),t==="person"&&o==="user"?await I(e,m.id,j(i).id):t==="repo"?await I(e,m.id,j(p).id):t==="profile"&&await I(e,m.id,j(await U()).id),m}r(M,"ensureOwner");async function se(e,t,o){if(_())return!1;const i=await e.prepare(`SELECT o.* FROM identities i JOIN objects o ON o.id = i.object
|
|
6
6
|
WHERE i.scheme = 'profile' AND i.external_id = ? AND o.type = 'profile' AND o.deleted_at IS NULL`).get(t),n=await e.prepare(`SELECT o.id FROM objects o
|
|
7
|
-
WHERE o.name = ? AND o.type = 'profile' AND o.deleted_at IS NULL AND o.home_machine IS NULL AND o.id <> ?`).get(o,i?i.id:"");if(n)throw new
|
|
7
|
+
WHERE o.name = ? AND o.type = 'profile' AND o.deleted_at IS NULL AND o.home_machine IS NULL AND o.id <> ?`).get(o,i?i.id:"");if(n)throw new A("conflict",`handle "${o}" is already held by profile object ${n.id}; cannot rename profile ${t} to it`,O.GENERAL,{handle:o,holder:n.id});if(!i)return!1;const d=i;return d.name===o?!1:(await H(e,d,o),!0)}r(se,"renameProfileObject");function ce(e,t){return _()?e:t}r(ce,"profileHandle");async function de(e,t){if(/^app:[a-z0-9][a-z0-9._-]*$/.test(t))return await M(e,"app","app",t,t.slice(4));if(/^user:[a-z0-9][a-z0-9._-]*$/.test(t))return await M(e,"person","user",t,!_()&&t===B()?"user":t.slice(5));throw new Error(`principal ${JSON.stringify(t)} is neither app:<name> nor user:<id>`)}r(de,"ownerForGrantee");async function pe(e,t,o){return F(await e.prepare("SELECT * FROM objects WHERE (type = 'document' OR strpos(type, '.') > 0) AND owner = ? AND name = ? AND deleted_at IS NULL AND home_machine IS NULL").get(t,o))}r(pe,"liveDocumentNamed");async function ue(e,t){const o=await X(e,t);if(!o||o.type!=="node")throw C(`no node object ${t}`);return o}r(ue,"nodeObject");async function H(e,t,o){await e.prepare("UPDATE objects SET name = ? WHERE id = ?").run(o,t.id)}r(H,"setObjectName");async function Ee(e,t,o){await e.prepare("UPDATE objects SET kind = ? WHERE id = ?").run(o,t.id)}r(Ee,"setObjectKind");function D(e,t){const o=[];return e.type!==void 0&&(o.push("o.type = ?"),t.push(e.type)),e.kind!==void 0&&(o.push("o.kind = ?"),t.push(e.kind)),e.owner!==void 0&&(o.push("o.owner = ?"),t.push(e.owner.id)),e.namePrefix!==void 0&&(o.push("o.name LIKE ? ESCAPE '\\'"),t.push(`${e.namePrefix.replace(/[\\%_]/g,i=>`\\${i}`)}%`)),e.schemaType!==void 0&&(o.push("o.schema_type = ?"),t.push(e.schemaType)),e.extensions!==void 0&&(o.push("EXISTS (SELECT 1 FROM documents x WHERE x.object = o.id AND x.extensions_json::jsonb @> ?::jsonb)"),t.push(JSON.stringify(e.extensions))),o}r(D,"narrowing");function Q(e,t){const o="WITH RECURSIVE sa(id, owner, depth) AS (SELECT o.id, o.owner, 0 UNION ALL SELECT p.id, p.owner, sa.depth + 1 FROM sa JOIN objects p ON p.id = sa.owner WHERE sa.depth < 12)";t.push(e.subjects.userIds,e.subjects.groupIds);const i=["o.schema_type IS NULL",`EXISTS (${o} SELECT 1 FROM sa JOIN relations r ON r.resource_type = 'crtr/object' AND r.resource_id = sa.id
|
|
8
8
|
AND r.relation IN ('reader', 'editor', 'messenger', 'user_of') AND r.written_by <> 'package'
|
|
9
9
|
AND ((r.subject_type = 'user' AND r.subject_id = ANY(?::text[])) OR (r.subject_type = 'crtr/group' AND r.subject_relation = 'member' AND r.subject_id = ANY(?::text[]))))`];return e.userId===null?i:(t.push(e.userId),[...i,`NOT EXISTS (${o} SELECT 1 FROM sa JOIN relations r ON r.resource_type = 'crtr/object' AND r.resource_id = sa.id
|
|
10
|
-
AND r.relation = 'acts_for' AND r.subject_type = 'user' AND r.subject_id = ?)`])}
|
|
10
|
+
AND r.relation = 'acts_for' AND r.subject_type = 'user' AND r.subject_id = ?)`])}r(Q,"sharedOnly");async function me(e,t,o,i={}){const n=["o.seq > ?"],d=[i.after_seq??0];o.privacy!==void 0&&(n.push("o.privacy = ?"),d.push(o.privacy)),o.name!==void 0&&(n.push("o.name = ?"),d.push(o.name)),n.push("o.home_machine IS NULL"),n.push(o.deleted?"o.deleted_at IS NOT NULL":"o.deleted_at IS NULL"),n.push(...D(o,d));const p=await g(e,t);o.shared&&n.push(...Q(p,d));const u=await y(e,p,"read","o"),h=Math.min(i.limit??100,100);return await e.prepareUncached(`SELECT o.* FROM objects o WHERE ${n.join(" AND ")} AND (${u.sql}) ORDER BY o.seq LIMIT ${h}`).all(...d,...u.params)}r(me,"listObjects");async function Ne(e,t,o){const n=[],d=`%${o.text.replace(/[\\%_]/g,a=>`\\${a}`)}%`,p=await g(e,t);if(!o.grep){const a=[d],N=D(o,a).map(l=>` AND ${l}`).join(""),c=await y(e,p,"read","o"),s=await e.prepareUncached(`SELECT o.*, (SELECT d.summary FROM documents d WHERE d.object = o.id) AS _summary FROM objects o
|
|
11
11
|
WHERE o.deleted_at IS NULL AND o.home_machine IS NULL AND (o.name ILIKE ?1 ESCAPE '\\' OR o.preview ILIKE ?1 ESCAPE '\\'
|
|
12
|
-
OR EXISTS (SELECT 1 FROM documents d WHERE d.object = o.id AND d.summary ILIKE ?1 ESCAPE '\\'))${
|
|
13
|
-
AND (${c.sql}) ORDER BY o.seq LIMIT 100`).all(...
|
|
12
|
+
OR EXISTS (SELECT 1 FROM documents d WHERE d.object = o.id AND d.summary ILIKE ?1 ESCAPE '\\'))${N}
|
|
13
|
+
AND (${c.sql}) ORDER BY o.seq LIMIT 100`).all(...a,...c.params),f=o.text.toLowerCase();for(const l of s){const{_summary:S,...v}=l,R=v,$=R.name.toLowerCase().includes(f)?"name":R.preview.toLowerCase().includes(f)?"preview":"summary";n.push({object:R,field:$,...$==="summary"?{text:String(S)}:{}})}if(n.length>=100)return n}if(!o.body&&!o.grep)return n;const u=new Set(n.map(a=>a.object.id)),h=o.grep?(a=>N=>a.test(N))(new RegExp(o.text)):a=>a.includes(o.text),L=[],E=D(o,L).map(a=>` AND ${a}`).join(""),m=await e.prepareUncached(`SELECT o.id, r.body_hash AS body_hash FROM objects o
|
|
14
14
|
JOIN documents d ON d.object = o.id JOIN revisions r ON r.document = o.id
|
|
15
15
|
WHERE o.type = 'document' AND o.deleted_at IS NULL AND NOT EXISTS (SELECT 1 FROM revision_parents p WHERE p.parent = r.rev_id)${E}
|
|
16
|
-
ORDER BY o.seq, r.number`).all(...
|
|
17
|
-
`),
|
|
16
|
+
ORDER BY o.seq, r.number`).all(...L),b=await y(e,p,"read","o"),W=200;let w=[];const T=r(async()=>{if(w.length===0)return!1;const a=await e.prepareUncached(`SELECT o.* FROM objects o WHERE o.id = ANY(?::text[]) AND (${b.sql})`).all(w.map(c=>c.id),...b.params),N=new Map(a.map(c=>[c.id,c]));for(const c of w){const s=N.get(c.id);if(s!==void 0&&(n.push({object:s,field:"body",line:c.line,text:c.text}),n.length>=100))return!0}return w=[],!1},"flush"),x=100;for(let a=0;a<m.length;a+=x){const N=m.slice(a,a+x).filter(s=>!u.has(s.id)),c=await Y(e,N.map(s=>s.body_hash));for(const s of N){if(u.has(s.id))continue;const f=c.get(s.body_hash);if(f===void 0){if(await K(e,p,"read",s.id))throw C(`no body ${s.body_hash}`);continue}if(!o.grep&&!f.includes(o.text))continue;const l=f.split(`
|
|
17
|
+
`),S=l.findIndex(h);if(!(S<0)&&(u.add(s.id),w.push({id:s.id,line:S+1,text:l[S]}),w.length>=W&&await T()))return n}}return await T(),n}r(Ne,"searchObjects");async function he(e,t,o){const i=await e.prepare("SELECT * FROM objects WHERE name = ? AND type = 'repo' AND deleted_at IS NULL AND home_machine IS NULL").get(t);if(!i)throw new A("not_found",`no repo named "${t}"`,O.GENERAL,{handle:t});const n=await e.prepare("SELECT id FROM objects WHERE name = ? AND type = 'repo' AND deleted_at IS NULL AND home_machine IS NULL AND id <> ?").get(o,i.id);if(n)throw new A("conflict",`handle "${o}" is already held by repo object ${n.id}; cannot rename repo ${t} to it`,O.GENERAL,{handle:o,holder:n.id});return i.name===o?!1:(await H(e,i,o),!0)}r(he,"renameRepoObject");export{z as createObject,M as ensureOwner,X as getById,me as listObjects,pe as liveDocumentNamed,ue as nodeObject,de as ownerForGrantee,V as ownerLockKey,ce as profileHandle,se as renameProfileObject,he as renameRepoObject,Ne as searchObjects,Ee as setObjectKind,H as setObjectName};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
VALUES (?, ?, '', '', ?, ?) ON CONFLICT (app) DO NOTHING`).run(o.id,s,
|
|
3
|
-
WHERE app = ?`).run(n.origin,n.version,n.revision,n.source,n.launchKinds===null?null:l(n.launchKinds),n.digest,
|
|
1
|
+
var j=Object.defineProperty;var d=(e,i)=>j(e,"name",{value:i,configurable:!0});import{createHash as g}from"node:crypto";import{readdirSync as T,readFileSync as b,statSync as K}from"node:fs";import{join as N,relative as f,sep as m}from"node:path";import{compareReleaseVersions as R}from"../../api/runtime-version.js";import{upsertKind as F}from"./custom.js";import{crtrVersion as D}from"../../shared/crtr-version.js";import{emitEvent as v}from"../events/emit.js";import{builtinMemoryRoot as A}from"../scope.js";import{deleteMissing as E,convergeFile as $,relinkAllShipped as I}from"./package-docs.js";import{packageFiles as L}from"./package-files.js";import{ensureOwner as y}from"./objects.js";import{checkoutsForCwd as k}from"./repo-sync/repos.js";function P(e){if(!K(e,{throwIfNoEntry:!1})?.isDirectory())throw new Error(`package folder is missing or not a directory: ${e}`);const i=[],t=[e];for(;t.length>0;){const r=t.pop();for(const s of T(r,{withFileTypes:!0})){const o=N(r,s.name);s.isDirectory()?s.name.startsWith(".")||t.push(o):s.isFile()&&s.name.endsWith(".md")&&s.name!=="SKILL.md"&&i.push([f(e,o).split(m).join("/"),b(o)])}}return i.sort((r,s)=>r[0]<s[0]?-1:1)}d(P,"strictPackageBytes");function H(e,i){const t=P(e),{files:r,invalid:s}=L(e),o=r.map(n=>({...n,path:`${i.app}/${f(e,n.path).split(m).join("/")}`})),a=g("sha256");for(const[n,c]of t)a.update(n).update("\0").update(c).update("\0");const p=s.map(n=>({...n,path:`${i.app}/${f(e,n.path).split(m).join("/")}`}));return S({revision:null,source:null,launchKinds:null,objectKinds:null,...i},o,p,a)}d(H,"readPackageSnapshot");function l(e){if(Array.isArray(e))return`[${e.map(l).join(",")}]`;if(e!==null&&typeof e=="object"){const i=e;return`{${Object.keys(i).sort().filter(t=>i[t]!==void 0).map(t=>`${JSON.stringify(t)}:${l(i[t])}`).join(",")}}`}return JSON.stringify(e)??"null"}d(l,"canonicalJson");function S(e,i,t,r){return r.update(l({launchKinds:e.launchKinds,objectKinds:e.objectKinds,source:e.source})),{...e,digest:r.digest("hex"),files:i,invalid:t}}d(S,"snapshotOf");function ee(){return H(A(),{app:"crtr",origin:"builtin",version:D()})}d(ee,"readBuiltinSnapshot");function W(e,i){return e.revision!==null?i.revision!==null&&e.revision<Number(i.revision):e.origin==="builtin"?R(e.version,i.version)<0:!1}d(W,"olderThanPublished");async function ne(e,i,t){const{app:r,origin:s}=i,o=await y(e,"app","app",`app:${r}`,r),a=new Date().toISOString();await e.prepare(`INSERT INTO package_publications (app, origin, version, digest, published_at, published_by)
|
|
2
|
+
VALUES (?, ?, '', '', ?, ?) ON CONFLICT (app) DO NOTHING`).run(o.id,s,a,t);const p=await e.prepare("SELECT version, digest, revision, withdrawn_at FROM package_publications WHERE app = ? FOR UPDATE").get(o.id),n="capture"in i?i.capture():i,c={created:0,updated:0,deleted:0,conflicts:[],invalid:[...n.invalid],quarantined:[],superseded:!1,kinds:{applied:[],refused:[]}};if(W(n,p))return c.superseded=!0,v({level:"warn",event:"daemon.packages.superseded",fields:{app:n.app,snapshot_version:n.version,published_version:p.version,snapshot_revision:n.revision??"none",published_revision:p.revision===null?"none":Number(p.revision)}}),c;if(p.digest===n.digest&&p.withdrawn_at===null){if(p.version===n.version&&String(p.revision??"")===String(n.revision??""))return c}else{const h=d(async(u,O)=>await k(e,u,O),"reposFn"),w=new Set;for(const u of n.files)w.add(await $(e,o,u,c,h));n.invalid.length===0&&await E(e,o,w,c,h),c.kinds=await _(e,o,n.objectKinds),c.created+c.updated+c.deleted>0&&await I(e)}return await e.prepare(`UPDATE package_publications SET origin = ?, version = ?, revision = ?, source = ?, launch_kinds_json = ?, digest = ?, published_at = ?, published_by = ?, withdrawn_at = NULL
|
|
3
|
+
WHERE app = ?`).run(n.origin,n.version,n.revision,n.source,n.launchKinds===null?null:l(n.launchKinds),n.digest,a,t,o.id),c}d(ne,"publish");function ie(e){return S({revision:null,source:null,launchKinds:null,objectKinds:null,...e},[],[],g("sha256"))}d(ie,"emptyPackageSnapshot");async function _(e,i,t){const r={applied:[],refused:[]},s=new Set;for(const[a,p]of Object.entries(t??{}))try{const n=await F(e,{name:a,owner:i,description:p.description,events:p.events,read:p.read===void 0?null:{command:p.read.command},source:"manifest"});n.outcome!=="skipped"&&(s.add(a),r.applied.push({kind:a,outcome:n.outcome}))}catch(n){if(n.code!=="kind_owned")throw n;r.refused.push({kind:a,message:n.message}),v({level:"warn",event:"daemon.packages.kind_owned",fields:{app:i.id,kind:a}})}const o=await e.prepare("SELECT name FROM object_kinds WHERE owner = ? AND source = 'manifest' AND declared = 1").all(i.id);for(const{name:a}of o)s.has(a)||await e.prepare("UPDATE object_kinds SET declared = 0 WHERE name = ?").run(a);return r}d(_,"convergeKinds");async function te(e,i){const t={created:0,updated:0,deleted:0,conflicts:[],invalid:[],quarantined:[],superseded:!1,kinds:{applied:[],refused:[]}},r=await y(e,"app","app",`app:${i}`,i),s=await e.prepare("SELECT withdrawn_at FROM package_publications WHERE app = ? FOR UPDATE").get(r.id);return s===void 0||s.withdrawn_at!==null||(await E(e,r,new Set,t,async(o,a)=>await k(e,o,a)),await _(e,r,null),await e.prepare("UPDATE package_publications SET withdrawn_at = ?, digest = '' WHERE app = ?").run(new Date().toISOString(),r.id)),t}d(te,"withdraw");export{l as canonicalJson,ie as emptyPackageSnapshot,ne as publish,ee as readBuiltinSnapshot,H as readPackageSnapshot,te as withdraw};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var v=Object.defineProperty;var a=(i,t)=>v(i,"name",{value:t,configurable:!0});import{statSync as S}from"node:fs";import{CrtrError as m}from"../errors.js";import{emitEvent as E}from"../events/emit.js";import{invalidAppPlugins as y,appPlugins as _,kindPlugins as N}from"../plugin-app.js";import{quarantineBrokenPlugins as T}from"../plugin-quarantine.js";import{listInstalledPlugins as I}from"../resolver.js";import{pluginMemoryDir as P}from"../scope.js";import{ensurePluginAppToken as D,listScopedApiTokens as L,revokePluginAppTokens as O}from"../secrets.js";import{deleteMissing as A}from"./package-docs.js";import{emptyPackageSnapshot as R,publish as f,readBuiltinSnapshot as j,readPackageSnapshot as x,withdraw as B}from"./package-publish.js";import{getById as C}from"./objects.js";import{checkoutsForCwd as b}from"./repo-sync/repos.js";const g="mac";function q(i){return S(i,{throwIfNoEntry:!1})?.isDirectory()===!0}a(q,"isDirectory");async function X(i){const t={created:0,updated:0,deleted:0,conflicts:[],invalid:[],quarantined:T(),kinds:{applied:[],refused:[],invalid:y().map(e=>({plugin:e.plugin.name,error:e.error}))},tokens:{granted:[],revoked:[]}};for(const e of t.quarantined)E({level:"error",event:"daemon.plugins.quarantined",fields:{plugin:e.name,file:e.file,reason:e.reason,...e.movedTo!==void 0?{moved_to:e.movedTo}:{}}});const k=new Set(N().map(e=>e.name)),r=new Set(["crtr"]),
|
|
1
|
+
var v=Object.defineProperty;var a=(i,t)=>v(i,"name",{value:t,configurable:!0});import{statSync as S}from"node:fs";import{CrtrError as m}from"../errors.js";import{emitEvent as E}from"../events/emit.js";import{invalidAppPlugins as y,appPlugins as _,kindPlugins as N}from"../plugin-app.js";import{quarantineBrokenPlugins as T}from"../plugin-quarantine.js";import{listInstalledPlugins as I}from"../resolver.js";import{pluginMemoryDir as P}from"../scope.js";import{ensurePluginAppToken as D,listScopedApiTokens as L,revokePluginAppTokens as O}from"../secrets.js";import{deleteMissing as A}from"./package-docs.js";import{emptyPackageSnapshot as R,publish as f,readBuiltinSnapshot as j,readPackageSnapshot as x,withdraw as B}from"./package-publish.js";import{getById as C}from"./objects.js";import{checkoutsForCwd as b}from"./repo-sync/repos.js";const g="mac";function q(i){return S(i,{throwIfNoEntry:!1})?.isDirectory()===!0}a(q,"isDirectory");async function X(i){const t={created:0,updated:0,deleted:0,conflicts:[],invalid:[],quarantined:T(),kinds:{applied:[],refused:[],invalid:y().map(e=>({plugin:e.plugin.name,error:e.error}))},tokens:{granted:[],revoked:[]}};for(const e of t.quarantined)E({level:"error",event:"daemon.plugins.quarantined",fields:{plugin:e.name,file:e.file,reason:e.reason,...e.movedTo!==void 0?{moved_to:e.movedTo}:{}}});const k=new Set(N().map(e=>e.name)),r=new Set(["crtr"]),c=a((e,n)=>{t.created+=e.created,t.updated+=e.updated,t.deleted+=e.deleted,t.invalid.push(...e.invalid);for(const o of e.kinds.applied)t.kinds.applied.push({plugin:n,kind:o.kind,outcome:o.outcome});for(const o of e.kinds.refused)t.kinds.refused.push({plugin:n,kind:o.kind,code:"kind_owned",message:o.message})},"add");c(await f(i,{app:"crtr",origin:"builtin",capture:a(()=>j(),"capture")},g),"crtr");for(const e of I("user").filter(n=>n.enabled)){const n=e.manifest.provider===void 0?"plugin":"provider",o=P(e),p=e.manifest.kinds!==void 0&&Object.keys(e.manifest.kinds).length>0?e.manifest.kinds:null,s={app:e.name,origin:n,version:e.manifest.version??"",launchKinds:p,objectKinds:k.has(e.name)?e.manifest.object_kinds??null:null};try{if(r.has(e.name))throw new m("conflict",`plugin "${e.name}" is already provided by another package`);r.add(e.name),c(await f(i,{app:e.name,origin:n,capture:a(()=>q(o)?x(o,s):R(s),"capture")},g),e.name)}catch(d){if(!(d instanceof m)||d.code!=="conflict")throw d;t.conflicts.push({plugin:e.name,message:d.message})}}const h=await i.prepare(`SELECT i.external_id FROM package_publications p JOIN identities i ON i.object = p.app AND i.scheme = 'app'
|
|
2
2
|
WHERE p.withdrawn_at IS NULL ORDER BY i.external_id`).all();for(const{external_id:e}of h){const n=e.replace(/^app:/,"");if(r.has(n))continue;const o=await B(i,n);t.deleted+=o.deleted}const w=await i.prepare(`SELECT DISTINCT o.owner AS id FROM objects o JOIN documents d ON d.object = o.id
|
|
3
|
-
WHERE o.type = 'document' AND o.deleted_at IS NULL AND d.source_path IS NOT NULL`).all();for(const{id:e}of w){const n=await C(i,e),o=await i.prepare("SELECT external_id FROM identities WHERE object = ? AND scheme = 'app'").get(e);o!==void 0&&r.has(o.external_id.replace(/^app:/,""))||await A(i,n,new Set,t,async
|
|
3
|
+
WHERE o.type = 'document' AND o.deleted_at IS NULL AND d.source_path IS NOT NULL`).all();for(const{id:e}of w){const n=await C(i,e),o=await i.prepare("SELECT external_id FROM identities WHERE object = ? AND scheme = 'app'").get(e);o!==void 0&&r.has(o.external_id.replace(/^app:/,""))||await A(i,n,new Set,t,async(p,s)=>await b(i,p,s))}const l=new Set;for(const e of _()){const n=e.manifest.scopes??[];D(e.name,n),l.add(e.name),t.tokens.granted.push({plugin:e.name,scopes:[...n]})}const u=new Set;for(const e of L("user")){if(!e.token.startsWith("crtr_app_")||!e.grantee.startsWith("app:"))continue;const n=e.grantee.slice(4);l.has(n)||u.add(n)}for(const e of u)O(e)&&t.tokens.revoked.push(e);return t}a(X,"reconcilePackages");export{X as reconcilePackages};
|
|
@@ -2,23 +2,34 @@ import type { RequestPrincipal } from '../../daemon/api/router.js';
|
|
|
2
2
|
import { type ActiveGrant } from '../grants/mirror.js';
|
|
3
3
|
import { type CanvasDb } from '../canvas/db.js';
|
|
4
4
|
import type { Checkout, ObjectRow, Reader } from './types.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
5
|
+
import type { ProfileProject } from '../../api/dto/profiles.js';
|
|
6
|
+
/** The repos enclosing a directory, with their checkout roots, nearest first. `person` is whose read permission filters them (default: the request's person). */
|
|
7
|
+
export type ReposFn = (cwd: string, person?: string) => Promise<Checkout[]>;
|
|
8
|
+
/** A node's view of repos: for the checkouts enclosing its cwd, every repo object of their remotes the person may read (own first, then oldest), then
|
|
9
|
+
* the repos its profile names (an entry's `repo`, and the checkouts of its `path`), in manifest order, each repo once. A repo entry needs no folder or
|
|
10
|
+
* git; one the person may not read adds nothing. A project path that no longer exists, is not in a repo, or has no work tree contributes nothing. */
|
|
11
|
+
export declare function viewRepos(db: CanvasDb, cwd: string, profileId: string | null, reposFn: ReposFn, lookups: Pick<ReaderLookups, 'projects' | 'object'>, person?: string): Promise<Pick<Extract<Reader, {
|
|
11
12
|
class: 'node';
|
|
12
13
|
}>, 'repos' | 'checkouts' | 'projectRepos' | 'projectCheckouts'>>;
|
|
13
14
|
/** Run the git lookups a node's reader needs (its cwd and its profile's project paths) now, before a canvas write opens, so
|
|
14
15
|
* `viewRepos` inside the write hits the identity cache instead of spawning git while the write holds a pooled connection. */
|
|
15
16
|
export declare function warmNodeRepos(db: CanvasDb, nodeId: string): Promise<void>;
|
|
17
|
+
/** Cloud role: ask the profile's machine for the identities of `dirs` and store them, then fill `repo` on the profile's folder entries that have none from
|
|
18
|
+
* the stored identity (the cloud side of the profile-format migration). Outside a canvas write. A profile with no machine environment asks nothing. */
|
|
19
|
+
export declare function warmCloudNodeCheckouts(profileId: string | null, dirs: readonly string[]): Promise<void>;
|
|
20
|
+
/** Warm the identities of `dirs` for node `nodeId` before a write opens: on a cloud role through its profile's machine, else git here. */
|
|
21
|
+
export declare function warmNodeDirs(db: CanvasDb, nodeId: string | undefined, dirs: readonly string[]): Promise<void>;
|
|
16
22
|
export declare function readerFor(db: CanvasDb, principal: RequestPrincipal, reposFn: ReposFn): Promise<Exclude<Reader, {
|
|
17
23
|
class: 'object';
|
|
18
24
|
}>>;
|
|
19
25
|
export declare function readerForNode(db: CanvasDb, nodeId: string, reposFn: ReposFn, lookups?: ReaderLookups, allowRevoked?: boolean): Promise<Extract<Reader, {
|
|
20
26
|
class: 'node';
|
|
21
27
|
}>>;
|
|
28
|
+
/** `readerForObject` found no app to read as: the object's owner is neither an app nor an app's profile, and this runtime has no terminal app and no
|
|
29
|
+
* person named `user` (a control plane, which keeps many people). */
|
|
30
|
+
export declare class NoOwningAppError extends Error {
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
22
33
|
/** A receiving object reads using its owner's app grant, not its registering caller's rights. */
|
|
23
34
|
export declare function readerForObject(db: CanvasDb, watcher: ObjectRow, reposFn?: ReposFn, lookups?: ReaderLookups): Promise<Extract<Reader, {
|
|
24
35
|
class: 'node' | 'object';
|
|
@@ -37,8 +48,8 @@ export interface ReaderLookups {
|
|
|
37
48
|
pluginScopes(grantee: string): readonly string[] | null;
|
|
38
49
|
object(id: string): Promise<ObjectRow | null>;
|
|
39
50
|
profile(profileId: string, app: ObjectRow): Promise<ObjectRow>;
|
|
40
|
-
/** The profile's project
|
|
41
|
-
|
|
51
|
+
/** The profile's project entries in manifest order; none in a sandboxed node, whose profile store is unreadable. */
|
|
52
|
+
projects(profileId: string): readonly ProfileProject[];
|
|
42
53
|
}
|
|
43
54
|
export declare function liveLookups(db: CanvasDb): ReaderLookups;
|
|
44
55
|
export declare function publishLookups(db: CanvasDb): ReaderLookups;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
sub, grant_id, scopes_json, cwd, profile_id, app FROM nodes WHERE node_id = ?`).get(e);if(!
|
|
3
|
-
WHERE i.scheme = 'profile' AND i.external_id = ?`).get(e)??await
|
|
1
|
+
var M=Object.defineProperty;var s=(o,e)=>M(o,"name",{value:e,configurable:!0});import{coveredByAny as h,isSandboxedNode as $}from"../../shared/env.js";import{projectPaths as H}from"../../api/dto/profiles.js";import{existsSync as N}from"node:fs";import{CrtrError as W}from"../errors.js";import{getCachedProfile as v}from"../scoped-state/person-store.js";import{parseScope as F}from"@north-light/identity";import{activeGrant as b,grantFor as C,runtimeScope as D}from"../grants/mirror.js";import{withCanvasWrite as B}from"../canvas/db.js";import{ApiError as J}from"../../api/errors.js";import{pluginAppToken as P}from"../secrets.js";import{loadExactProfileManifest as k}from"../profiles/manifest.js";import{ensureOwner as x,getById as G,nodeObject as q,ownerForGrantee as U,profileHandle as Y}from"./objects.js";import{personId as z,personIdAsync as K}from"../canvas/person.js";import{OBJECT_TYPE as Q}from"../permissions/builtin.js";import{warmCheckoutDirs as A}from"../checkout-identities.js";import{fillProfileProjectRepo as V}from"../profiles/manifest.js";import{emitEvent as X}from"../events/emit.js";import{isCloudRole as y}from"../canvas/person-state.js";import{mayRead as Z,reposForCwd as I,warmCheckoutIdentities as S}from"./repo-sync/repos.js";async function L(o,e,t,r,n,a){const l=t===null?[]:n.projects(t),c=await r(e,a),p=new Set(c.map(u=>u.repo.id)),f=[],d=[];for(const u of l){if(u.repo!==void 0&&!p.has(u.repo)){const i=await n.object(u.repo);i!==null&&i.type==="repo"&&i.deleted_at===null&&await Z(o,a??await K(),i.id)&&(p.add(i.id),f.push(i))}if(u.path===void 0||!y()&&!N(u.path))continue;let w;try{w=await r(u.path,a)}catch(i){if(i instanceof W&&i.code==="git-lookup-failed")continue;throw i}for(const i of w)p.has(i.repo.id)||(p.add(i.repo.id),f.push(i.repo),d.push(i))}return{repos:c.map(u=>u.repo),checkouts:c,projectRepos:f,projectCheckouts:d}}s(L,"viewRepos");async function Ne(o,e){const t=await o.prepare("SELECT cwd, profile_id FROM nodes WHERE node_id = ?").get(e);if(t===void 0)return;const r=t.profile_id?H(g(o).projects(t.profile_id)):[];if(y()){await ee(t.profile_id,[t.cwd,...r]);return}await S(t.cwd);for(const n of r)N(n)&&await S(n)}s(Ne,"warmNodeRepos");async function ee(o,e){if(await A(o,e),o!==null){for(const t of v(o)?.manifest.projects??[])if(!(t.path===void 0||t.repo!==void 0))try{const r=(await B(async n=>await I(n,t.path)))[0];r!==void 0&&await V(o,t.path,r.id)}catch(r){X({level:"warn",event:"repo.identify.fill_failed",error:r,fields:{profile:o,path:t.path}})}}}s(ee,"warmCloudNodeCheckouts");async function ve(o,e,t){if(!y()){for(const n of t)await S(n);return}const r=e===void 0?void 0:await o.prepare("SELECT profile_id FROM nodes WHERE node_id = ?").get(e);await A(r?.profile_id,t)}s(ve,"warmNodeDirs");async function Fe(o,e,t){if(e.class==="anonymous")throw new Error("a publish token cannot read as a principal");if(e.class==="person")return{class:"person",person:await O(o)};if(e.class==="app")return{class:"app",app:await _(o,e.app),scopes:e.scopes,...e.sub===void 0?{}:{sub:e.sub}};if(e.class==="machine"||e.class==="import")throw new Error(`a ${e.class} token cannot read as a principal`);if(e.class==="forwarded"){if(e.actor.kind==="person")return{class:"person",person:await O(o)};const c=await C(e.actor.app,e.sub);if(!c)throw new J(403,"app_not_granted",`${e.actor.app} holds no active grant for ${e.sub} on this machine`);const p=e.actor.node_scopes;return{class:"app",app:await _(o,e.actor.app),place:e.actor.place,launched:p,scopes:p===null?c.resolved:p.filter(f=>h(c.resolved,f))}}if(e.class==="cron"){const c=e.grant?(await b(e.grant))?.resolved??[]:[],p=e.scopes;return{class:"app",app:await _(o,e.app),scopes:p===null?c:p.filter(f=>h(c,f)),launched:p,place:{run:e.origin_run??"",isolated:e.isolated}}}const r=g(o),n=await q(o,e.node),a=await o.prepare("SELECT cwd, profile_id, app FROM nodes WHERE node_id = ?").get(e.node),l=a.app===null?null:await r.object(a.app);if(!l)throw new Error(`node ${e.node} has no app`);return{class:"node",node:n,app:l,scopes:await T(e.app,e.sub,e.grant,e.scopes,r),launched:e.scopes,cwd:a.cwd,...await L(o,a.cwd,a.profile_id,t,r,e.sub||void 0),profile:a.profile_id===null?null:await r.profile(a.profile_id,l)}}s(Fe,"readerFor");async function oe(o,e,t,r=g(o),n=!1){const a=await o.prepare("SELECT o.* FROM objects o WHERE o.id = ? AND o.type = 'node'").get(e),l=await o.prepare(`SELECT (SELECT external_id FROM identities WHERE object = nodes.app) AS grantee,
|
|
2
|
+
sub, grant_id, scopes_json, cwd, profile_id, app FROM nodes WHERE node_id = ?`).get(e);if(!a||!l)throw new Error(`no node ${e}`);const{grantee:c,sub:p,grant_id:f,scopes_json:d,cwd:u,profile_id:w,app:i}=l,E=i===null?null:await r.object(i);if(!E)throw new Error(`node ${e} has no app`);const j=d===null?null:JSON.parse(d);return{class:"node",node:a,app:E,scopes:await T(c,p??"",f,j,r,n),launched:j,cwd:u,...await L(o,u,w,t,r,p||void 0),profile:w===null?null:await r.profile(w,E)}}s(oe,"readerForNode");class te extends Error{static{s(this,"NoOwningAppError")}constructor(){super("no terminal app or person object"),this.name="NoOwningAppError"}}async function be(o,e,t=async()=>[],r=g(o)){const n=await o.prepare("SELECT envelope_json FROM peer_stubs WHERE object = ?").get(e.id);if(n!==void 0)return await ne(o,e,n.envelope_json===null?null:JSON.parse(n.envelope_json),r);if(e.type==="node")return await oe(o,e.id,t,r,!0);const a=e.owner===null?null:await r.object(e.owner);if(!a)throw new Error(`watcher ${e.id} has no owner`);const c=(a.type==="app"?a:a.type==="profile"&&a.owner!==null?await r.object(a.owner):null)??await o.prepare("SELECT o.* FROM identities i JOIN objects o ON o.id = i.object WHERE i.external_id = 'app:terminal' AND i.scheme = 'app'").get()??await o.prepare("SELECT * FROM objects WHERE type = 'person' AND name = 'user' AND home_machine IS NULL").get();if(!c)throw new te;const p=(await o.prepare("SELECT external_id FROM identities WHERE object = ? AND scheme = 'app'").get(c.id))?.external_id??"app:terminal",f=D(),d=await o.prepare(`SELECT sub, resolved_scopes_json FROM grants WHERE grantee = ? AND status = 'active'${f.sql}`).all(p,...f.args),u=s(m=>JSON.parse(m.resolved_scopes_json).filter(R=>R.mode==="always").map(R=>F(R.scope)),"always"),w=d.length>1&&a.type==="app"?new Set((await o.prepare("SELECT subject_id FROM relations WHERE resource_type = ? AND resource_id = ? AND relation = 'acts_for' AND subject_type = 'user'").all(Q,e.id)).map(m=>m.subject_id)):null,i=w===null?void 0:d.find(m=>w.has(m.sub.replace(/^user:/,"")))?.sub,E=i===void 0?null:await r.grantFor(p,i),j=a.type==="person"?null:d.length===0?r.pluginScopes(p):d.length===1?u(d[0]):E?.resolved??null;return{class:"object",object:e,node:e,owner:a,app:c,scopes:j,...E===null?{}:{sub:E.sub},repos:a.type==="repo"?[a]:[]}}s(be,"readerForObject");async function Ce(o,e,t){const r=(await o.prepare("SELECT external_id FROM identities WHERE object = ? AND scheme = 'app'").get(e.id))?.external_id;if(r===void 0)return null;const n=await o.prepare("SELECT resolved_scopes_json FROM grants WHERE grantee = ? AND status = 'active'").all(r);return n.length===0?t.pluginScopes(r):n.length>1?null:JSON.parse(n[0].resolved_scopes_json).filter(a=>a.mode==="always").map(a=>F(a.scope))}s(Ce,"appScopesNow");async function ne(o,e,t,r){const n=await O(o);if(t!==null&&t.app===null)return{class:"object",object:e,node:e,owner:n,app:n,scopes:null,repos:[]};const a=t?.app==null?null:await _(o,t.app),l=t?.app==null?null:await r.grantFor(t.app,t.sub),c=t===null||l===null?null:t.node_scopes===null?l.resolved:t.node_scopes.filter(f=>h(l.resolved,f)),p=a??(e.owner===null?n:await r.object(e.owner)??n);return{class:"object",object:e,node:e,owner:p,app:p,scopes:c,launched:t?.node_scopes??null,repos:[],...t?.place==null?{}:{place:t.place}}}s(ne,"readerForStub");function g(o){return{grantById:b,grantFor:C,pluginScopes:s(e=>P(e.replace(/^app:/,""))?.scopes??null,"pluginScopes"),object:s(async e=>await G(o,e),"object"),profile:s(async(e,t)=>await re(o,e,t),"profile"),projects:s(e=>$()?[]:v(e)?.manifest.projects??[],"projects")}}s(g,"liveLookups");function xe(o){const e=g(o),t=new Map,r=s((n,a)=>(t.has(n)||t.set(n,a()),t.get(n)),"memo");return{grantById:s(n=>r(`g\0${n}`,()=>e.grantById(n)),"grantById"),grantFor:s((n,a)=>r(`a\0${n}\0${a}`,()=>e.grantFor(n,a)),"grantFor"),pluginScopes:s(n=>r(`t\0${n}`,()=>e.pluginScopes(n)),"pluginScopes"),object:s(async n=>await r(`o\0${n}`,async()=>await e.object(n)),"object"),profile:s(async(n,a)=>await r(`p\0${n}\0${a.id}`,async()=>await e.profile(n,a)),"profile"),projects:s(n=>r(`j\0${n}`,()=>e.projects(n)),"projects")}}s(xe,"publishLookups");async function T(o,e,t,r,n,a=!1){const l=t?await n.grantById(t):await n.grantFor(o,e),c=l&&l.grantee===o?l.resolved:null;if(c===null){if(a)return null;throw new Error(`the grant of ${o} is not active`)}return r===null?c:r.filter(p=>h(c,p))}s(T,"nodeScopes");async function O(o){return await U(o,z())}s(O,"personObject");async function _(o,e){return await x(o,"app","app",e,e.replace(/^app:/,""))}s(_,"appObject");async function re(o,e,t){return await o.prepare(`SELECT o.* FROM identities i JOIN objects o ON o.id = i.object
|
|
3
|
+
WHERE i.scheme = 'profile' AND i.external_id = ?`).get(e)??await x(o,"profile","profile",e,Y(e,k(e).manifest.name),t)}s(re,"profileObject");export{te as NoOwningAppError,Ce as appScopesNow,g as liveLookups,re as profileObject,xe as publishLookups,Fe as readerFor,oe as readerForNode,be as readerForObject,L as viewRepos,ee as warmCloudNodeCheckouts,ve as warmNodeDirs,Ne as warmNodeRepos};
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import type { ReposFn } from '../reader.js';
|
|
2
2
|
import type { ObjectRow } from '../types.js';
|
|
3
3
|
import { type CanvasDb } from '../../canvas/db.js';
|
|
4
|
-
/**
|
|
5
|
-
* The tree (path → file text) of every public document the repo space owns, deleted ones
|
|
6
|
-
* included. A revision already in `previous` is copied verbatim, so a remote author and the
|
|
7
|
-
* links it was written with survive; a revision made here carries its author's object id, and
|
|
8
|
-
* a head carries the document's current `links-to` edges. `carry` names paths of `previous` that
|
|
9
|
-
* are copied through untouched (files whose import was refused and is still pending).
|
|
10
|
-
*/
|
|
11
|
-
export declare function exportRepo(db: CanvasDb, repo: ObjectRow, previous: Map<string, string> | null, imported?: Map<string, string> | null): Promise<Map<string, string>>;
|
|
12
|
-
/** Paths of `tree` whose text differs from the baseline last imported: files that arrived but
|
|
13
|
-
* have not landed in canvas.db. */
|
|
14
|
-
export declare function pendingPaths(tree: Map<string, string> | null, imported: Map<string, string> | null): string[];
|
|
15
4
|
export interface ImportResult {
|
|
16
5
|
created: number;
|
|
17
6
|
revisions: number;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
WHERE e.type = 'links-to' AND e.src = ? ORDER BY e.written_as, o.id`),s=new Map;for(const e of p){const c=await I(t,e),u=new Map((m.get(e.id)?.revisions??[]).map(r=>[r.rev_id,r])),_=new Set((await N(t,e)).map(r=>r.rev_id)),y=(await a.all(e.id)).map(r=>({written_as:r.written_as??"",dst:r.id})),O=await f.all(e.id),g=h(r=>{const d=u.get(r.rev_id);return d!==void 0&&d.body_hash===r.body_hash?d:void 0},"verbatim"),S=await j(t,O.filter(r=>g(r)===void 0).map(r=>r.body_hash)),v=await b(O,async r=>{const d=g(r);if(d!==void 0)return d;const l=S.get(r.body_hash);if(B(l)!==r.body_hash)throw new Error(`body ${r.body_hash} of revision ${r.rev_id} does not hash to its key; refusing to export it`);const E=u.get(r.rev_id);return E!==void 0?{...E,body:l,body_hash:r.body_hash}:{rev_id:r.rev_id,number:r.number,parents:(await w.all(r.rev_id)).map(R=>R.rev_id),body:l,body_hash:r.body_hash,author:r.author,rationale:r.rationale,created_at:r.created_at,links:_.has(r.rev_id)?y:[]}});if(v.length===0)continue;const D=(await X(t,e)).map(r=>({position:r.position,on:r.on,match:r.match??null,match_frontmatter:r.matchFrontmatter??null,if:r.if??null,deliver:r.deliver})),M={id:e.id,name:e.name,kind:e.kind??"document",privacy:"public",preview:e.preview,summary:c.summary,why_it_exists:c.why_it_exists,unlisted:c.unlisted,lint_ignore:c.lint_ignore,extensions:c.extensions,created_at:e.created_at,deleted_at:e.deleted_at,rules:D,revisions:v};s.set(Z(e.id),A(M))}for(const e of ie(o,n)){const c=o.get(e),u=s.get(e);if(u===void 0){s.set(e,c);continue}const _=k(e,c),y=k(e,u);if(!_.ok){s.set(e,c);continue}if(!y.ok)continue;const O=n?.has(e)?k(e,n.get(e)):null;let g;try{g=ee(O?.ok?O.doc:null,y.doc,_.doc)}catch(S){if(!(S instanceof te))throw S;s.set(e,c);continue}g&&s.set(e,A(g))}return s}h(Oe,"exportRepo");function ie(t,i){return[...t??[]].filter(([o,n])=>i?.get(o)!==n).map(([o])=>o)}h(ie,"pendingPaths");function re(t){return[...t].sort((i,o)=>i.position-o.position).map(i=>({on:i.on,deliver:i.deliver,...i.match!==null&&i.match!==void 0?{match:i.match}:{},...i.match_frontmatter!==null&&i.match_frontmatter!==void 0?{matchFrontmatter:i.match_frontmatter}:{},...i.if!==null&&i.if!==void 0?{if:i.if}:{}}))}h(re,"toRuleSpecs");const oe=h((t,i)=>JSON.stringify(t??null)===JSON.stringify(i??null),"same");function L(t,i){const o={},n=h(m=>!t||!oe(t[m],i[m]),"differs");return n("preview")&&(o.preview=i.preview),n("summary")&&(o.summary=i.summary),n("why_it_exists")&&(o.whyItExists=i.why_it_exists),n("unlisted")&&(o.unlisted=i.unlisted),n("lint_ignore")&&(o.lintIgnore=i.lint_ignore),n("extensions")&&(o.extensions=i.extensions),n("rules")&&(o.rules=re(i.rules)),o}h(L,"changedFields");async function Re(t,i,o,n,m){H(i);const p={created:0,revisions:0,deleted:0,needsMerge:[],refused:[]},f=[];for(const[a,s]of n){if(o.get(a)===s)continue;const e=k(a,s);if(!e.ok){p.refused.push({path:a,reason:e.reason});continue}const c=o.has(a)?k(a,o.get(a)):null;f.push({path:a,prior:c?.ok?c.doc:null,doc:e.doc})}for(const[a,s]of o){if(n.has(a))continue;const e=k(a,s);e.ok&&f.push({path:a,prior:e.doc,doc:null,priorId:e.doc.id})}const w=[];return await $(async()=>{for(const s of f)for(const e of s.doc?.revisions??[])await J(t,e.body,e.body_hash);let a=f;for(;;){const s=[];for(const e of a){const c={created:0,revisions:0,deleted:0,needsMerge:[],refused:[]};try{const u=[];await $(async()=>await ue(t,i,e.prior,e.doc,e.priorId??e.doc.id,c,m,u),{savepoint:!0}),w.push(...u),p.created+=c.created,p.revisions+=c.revisions,p.deleted+=c.deleted,p.needsMerge.push(...c.needsMerge)}catch(u){le(u)?s.push({w:e,error:u}):p.refused.push({path:e.path,reason:u.message})}}if(s.length===0)break;if(s.length===a.length){for(const e of s)p.refused.push({path:e.w.path,reason:e.error.message});break}a=s.map(e=>e.w)}await ae(t,n,new Set(w),new Set(f.map(s=>s.path)))},{savepoint:!0}),p}h(Re,"importTree");async function ae(t,i,o,n){if(o.size===0)return;const m=t.prepare("INSERT INTO edges (type, src, dst, written_as, created_at) VALUES ('links-to', ?, ?, ?, ?) ON CONFLICT DO NOTHING"),p=new Date().toISOString();for(const[f,w]of i){if(!n.has(f)&&!de(w,o))continue;const a=k(f,w);if(!a.ok||a.doc.deleted_at)continue;const s=await x(t,a.doc.id);if(!s||s.type!=="document"||s.deleted_at)continue;const e=(await N(t,s))[0],c=a.doc.revisions.find(u=>u.rev_id===e?.rev_id)?.links??[];for(const u of c){const _=await x(t,u.dst);_&&_.id!==s.id&&await m.run(s.id,_.id,u.written_as,p)}}}h(ae,"completeLinks");const se=/"dst":\s*"((?:[^"\\]|\\.)*)"/g;function de(t,i){for(const o of t.matchAll(se))if(i.has(ce(o[1])))return!0;return!1}h(de,"namesArrived");function ce(t){if(!t.includes("\\"))return t;try{return JSON.parse(`"${t}"`)}catch{return t}}h(ce,"decodeJsonString");function le(t){return t instanceof V&&t.code==="conflict"&&t.details?.holder!==void 0}h(le,"isNameConflict");async function ue(t,i,o,n,m,p,f,w){const a=await x(t,m);if(a&&(a.type!=="document"||a.owner!==i.id))throw new Error(`id ${m} is held by ${a.type} ${a.name} outside ${i.name}`);if(!n){a&&!a.deleted_at&&(await C(t,null,a,f),p.deleted++);return}const s=t.prepare("SELECT count(*) AS n FROM revisions WHERE document = ?");let e,c=!1,u=!1,_=0,y=0;if(a){e=a,_=(await I(t,e)).revision,e.created_at!==n.created_at&&(await t.prepare("UPDATE objects SET created_at = ? WHERE id = ?").run(n.created_at,e.id),e=await x(t,e.id));const d=n.kind;(o?o.kind!==d:e.kind!==d)&&await Q(t,e,d),u=!!e.deleted_at&&n.deleted_at===null&&(o===null||o.deleted_at!=null);let l=L(u?null:o,n);if(n.deleted_at&&e.deleted_at){const{rules:E,...R}=l;l=R}u&&(e=await G(t,e,n.name,f),w?.push(e.id)),Object.keys(l).length>0&&(e=await K(t,null,e,l)),n.name!==e.name&&!e.deleted_at&&(e=await F(t,null,e,{name:n.name},f))}else{const l=n.revisions.filter(E=>E.parents.length===0).sort((E,R)=>E.number-R.number||E.rev_id.localeCompare(R.rev_id))[0];if(!l)throw new Error(`${n.name}: no root revision`);e=await z(t,{id:n.id,owner:i,name:n.name,kind:n.kind,preview:n.preview,privacy:"public",...L(null,n),revisions:[{rev_id:l.rev_id,body_hash:l.body_hash,author:null,rationale:l.rationale,created_at:l.created_at}]},f),e.created_at!==n.created_at&&(await t.prepare("UPDATE objects SET created_at = ? WHERE id = ?").run(n.created_at,e.id),e=await x(t,e.id)),c=!0,w?.push(e.id),y=1}const O=(await s.get(e.id)).n,{headCount:g}=await q(t,e,n.revisions.map(d=>({rev_id:d.rev_id,parents:d.parents,body_hash:d.body_hash,rationale:d.rationale,created_at:d.created_at})));y+=(await s.get(e.id)).n-O,p.revisions+=y;const v=(await N(t,e))[0],D=new Map(n.revisions.map(d=>[d.rev_id,d]));if(y>0||u){const d=(await b(D.get(v.rev_id)?.links??[],async l=>({written_as:l.written_as,dst:await x(t,l.dst)}))).filter(l=>l.dst!==null);await Y(t,await U(t,e,d),f),await P(t,e,[])}if(g>1&&p.needsMerge.push(e.id),n.deleted_at&&!e.deleted_at){await C(t,null,e,f,n.deleted_at),p.deleted++;return}if(n.deleted_at&&e.deleted_at&&e.deleted_at!==n.deleted_at&&await t.prepare("UPDATE objects SET deleted_at = ? WHERE id = ?").run(n.deleted_at,e.id),c){p.created++,await T(t,{event:"created",object:e,actor:null,attrs:{revision:v.number},pointer:v.rev_id},f);return}if(u){p.created++,await T(t,{event:"created",object:e,actor:null,attrs:{revision:v.number},pointer:v.rev_id},f);return}if(y===0)return;const r=n.revisions.filter(d=>!o?.revisions.some(l=>l.rev_id===d.rev_id)).sort((d,l)=>l.number-d.number||l.created_at.localeCompare(d.created_at))[0]??D.get(v.rev_id);await T(t,{event:"edited",object:e,actor:null,pointer:v.rev_id,attrs:{revision:v.number,from_revision:_,rationale:r?.rationale??null,author:r?.author??null,heads:g,needs_merge:g>1}},f)}h(ue,"importOne");export{Oe as exportRepo,Re as importTree,de as namesArrived,ie as pendingPaths};
|
|
1
|
+
var A=Object.defineProperty;var m=(t,n)=>A(t,"name",{value:n,configurable:!0});import{put as $}from"../bodies.js";import{setLinks as j,setUnresolved as M}from"../edges.js";import{collectUnlinked as U,deleteDocument as x,documentRecord as H,heads as D,importDocument as L,insertImportedRevisions as W,moveDocument as J,restoreDocument as P,setDocumentRecord as B}from"../documents.js";import{CrtrError as z}from"../../errors.js";import{publish as O}from"../events.js";import{getById as v,setObjectKind as G}from"../objects.js";import{parseDoc as k}from"./ref-format.js";import{withCanvasWrite as I}from"../../canvas/db.js";import{mapAsync as K}from"../../async-array.js";function V(t){if(t.type!=="repo")throw new Error(`${t.type} ${t.id} is not a repo object`)}m(V,"assertRepoRefSpace");function q(t){return[...t].sort((n,a)=>n.position-a.position).map(n=>({on:n.on,deliver:n.deliver,...n.match!==null&&n.match!==void 0?{match:n.match}:{},...n.match_frontmatter!==null&&n.match_frontmatter!==void 0?{matchFrontmatter:n.match_frontmatter}:{},...n.if!==null&&n.if!==void 0?{if:n.if}:{}}))}m(q,"toRuleSpecs");const Q=m((t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null),"same");function N(t,n){const a={},i=m(p=>!t||!Q(t[p],n[p]),"differs");return i("preview")&&(a.preview=n.preview),i("summary")&&(a.summary=n.summary),i("why_it_exists")&&(a.whyItExists=n.why_it_exists),i("unlisted")&&(a.unlisted=n.unlisted),i("lint_ignore")&&(a.lintIgnore=n.lint_ignore),i("extensions")&&(a.extensions=n.extensions),i("rules")&&(a.rules=q(n.rules)),a}m(N,"changedFields");async function me(t,n,a,i,p){V(n);const c={created:0,revisions:0,deleted:0,needsMerge:[],refused:[]},l=[];for(const[r,s]of i){if(a.get(r)===s)continue;const e=k(r,s);if(!e.ok){c.refused.push({path:r,reason:e.reason});continue}const f=a.has(r)?k(r,a.get(r)):null;l.push({path:r,prior:f?.ok?f.doc:null,doc:e.doc})}for(const[r,s]of a){if(i.has(r))continue;const e=k(r,s);e.ok&&l.push({path:r,prior:e.doc,doc:null,priorId:e.doc.id})}const _=[];return await I(async()=>{for(const s of l)for(const e of s.doc?.revisions??[])await $(t,e.body,e.body_hash);let r=l;for(;;){const s=[];for(const e of r){const f={created:0,revisions:0,deleted:0,needsMerge:[],refused:[]};try{const u=[];await I(async()=>await ee(t,n,e.prior,e.doc,e.priorId??e.doc.id,f,p,u),{savepoint:!0}),_.push(...u),c.created+=f.created,c.revisions+=f.revisions,c.deleted+=f.deleted,c.needsMerge.push(...f.needsMerge)}catch(u){b(u)?s.push({w:e,error:u}):c.refused.push({path:e.path,reason:u.message})}}if(s.length===0)break;if(s.length===r.length){for(const e of s)c.refused.push({path:e.w.path,reason:e.error.message});break}r=s.map(e=>e.w)}await X(t,i,new Set(_),new Set(l.map(s=>s.path)))},{savepoint:!0}),c}m(me,"importTree");async function X(t,n,a,i){if(a.size===0)return;const p=t.prepare("INSERT INTO edges (type, src, dst, written_as, created_at) VALUES ('links-to', ?, ?, ?, ?) ON CONFLICT DO NOTHING"),c=new Date().toISOString();for(const[l,_]of n){if(!i.has(l)&&!Z(_,a))continue;const r=k(l,_);if(!r.ok||r.doc.deleted_at)continue;const s=await v(t,r.doc.id);if(!s||s.type!=="document"||s.deleted_at)continue;const e=(await D(t,s))[0],f=r.doc.revisions.find(u=>u.rev_id===e?.rev_id)?.links??[];for(const u of f){const h=await v(t,u.dst);h&&h.id!==s.id&&await p.run(s.id,h.id,u.written_as,c)}}}m(X,"completeLinks");const Y=/"dst":\s*"((?:[^"\\]|\\.)*)"/g;function Z(t,n){for(const a of t.matchAll(Y))if(n.has(F(a[1])))return!0;return!1}m(Z,"namesArrived");function F(t){if(!t.includes("\\"))return t;try{return JSON.parse(`"${t}"`)}catch{return t}}m(F,"decodeJsonString");function b(t){return t instanceof z&&t.code==="conflict"&&t.details?.holder!==void 0}m(b,"isNameConflict");async function ee(t,n,a,i,p,c,l,_){const r=await v(t,p);if(r&&(r.type!=="document"||r.owner!==n.id))throw new Error(`id ${p} is held by ${r.type} ${r.name} outside ${n.name}`);if(!i){r&&!r.deleted_at&&(await x(t,null,r,l),c.deleted++);return}const s=t.prepare("SELECT count(*) AS n FROM revisions WHERE document = ?");let e,f=!1,u=!1,h=0,y=0;if(r){e=r,h=(await H(t,e)).revision,e.created_at!==i.created_at&&(await t.prepare("UPDATE objects SET created_at = ? WHERE id = ?").run(i.created_at,e.id),e=await v(t,e.id));const o=i.kind;(a?a.kind!==o:e.kind!==o)&&await G(t,e,o),u=!!e.deleted_at&&i.deleted_at===null&&(a===null||a.deleted_at!=null);let d=N(u?null:a,i);if(i.deleted_at&&e.deleted_at){const{rules:g,...E}=d;d=E}u&&(e=await P(t,e,i.name,l),_?.push(e.id)),Object.keys(d).length>0&&(e=await B(t,null,e,d)),i.name!==e.name&&!e.deleted_at&&(e=await J(t,null,e,{name:i.name},l))}else{const d=i.revisions.filter(g=>g.parents.length===0).sort((g,E)=>g.number-E.number||g.rev_id.localeCompare(E.rev_id))[0];if(!d)throw new Error(`${i.name}: no root revision`);e=await L(t,{id:i.id,owner:n,name:i.name,kind:i.kind,preview:i.preview,privacy:"public",...N(null,i),revisions:[{rev_id:d.rev_id,body_hash:d.body_hash,author:null,rationale:d.rationale,created_at:d.created_at}]},l),e.created_at!==i.created_at&&(await t.prepare("UPDATE objects SET created_at = ? WHERE id = ?").run(i.created_at,e.id),e=await v(t,e.id)),f=!0,_?.push(e.id),y=1}const C=(await s.get(e.id)).n,{headCount:S}=await W(t,e,i.revisions.map(o=>({rev_id:o.rev_id,parents:o.parents,body_hash:o.body_hash,rationale:o.rationale,created_at:o.created_at})));y+=(await s.get(e.id)).n-C,c.revisions+=y;const w=(await D(t,e))[0],R=new Map(i.revisions.map(o=>[o.rev_id,o]));if(y>0||u){const o=(await K(R.get(w.rev_id)?.links??[],async d=>({written_as:d.written_as,dst:await v(t,d.dst)}))).filter(d=>d.dst!==null);await U(t,await j(t,e,o),l),await M(t,e,[])}if(S>1&&c.needsMerge.push(e.id),i.deleted_at&&!e.deleted_at){await x(t,null,e,l,i.deleted_at),c.deleted++;return}if(i.deleted_at&&e.deleted_at&&e.deleted_at!==i.deleted_at&&await t.prepare("UPDATE objects SET deleted_at = ? WHERE id = ?").run(i.deleted_at,e.id),f){c.created++,await O(t,{event:"created",object:e,actor:null,attrs:{revision:w.number},pointer:w.rev_id},l);return}if(u){c.created++,await O(t,{event:"created",object:e,actor:null,attrs:{revision:w.number},pointer:w.rev_id},l);return}if(y===0)return;const T=i.revisions.filter(o=>!a?.revisions.some(d=>d.rev_id===o.rev_id)).sort((o,d)=>d.number-o.number||d.created_at.localeCompare(o.created_at))[0]??R.get(w.rev_id);await O(t,{event:"edited",object:e,actor:null,pointer:w.rev_id,attrs:{revision:w.number,from_revision:h,rationale:T?.rationale??null,author:T?.author??null,heads:S,needs_merge:S>1}},l)}m(ee,"importOne");export{me as importTree,Z as namesArrived};
|
|
@@ -18,6 +18,10 @@ export type CheckoutIdentity = {
|
|
|
18
18
|
dir: string;
|
|
19
19
|
reason: string;
|
|
20
20
|
};
|
|
21
|
+
/** One identified checkout in a chain: what the Mac reports over `repo.identify` and the cloud stores. */
|
|
22
|
+
export type CheckoutChainEntry = Extract<CheckoutIdentity, {
|
|
23
|
+
ok: true;
|
|
24
|
+
}>;
|
|
21
25
|
/** `https://User@GitHub.com:443/Org/Repo.git/` and `git@github.com:org/repo`
|
|
22
26
|
* both give `github.com/org/repo`. A local remote (absolute path or
|
|
23
27
|
* `file://`) gives `file:<realpath>`, resolved against `base` when relative. */
|
|
@@ -39,9 +39,6 @@ export interface RefDocument {
|
|
|
39
39
|
revisions: RefRevision[];
|
|
40
40
|
}
|
|
41
41
|
export declare const docPath: (id: string) => string;
|
|
42
|
-
/** Every field merged three-way: all but id, created_at and revisions. */
|
|
43
|
-
export declare const RECORD_FIELDS: readonly ["name", "kind", "privacy", "preview", "summary", "why_it_exists", "unlisted", "lint_ignore", "extensions", "deleted_at", "rules"];
|
|
44
|
-
export declare function serializeDoc(doc: RefDocument): string;
|
|
45
42
|
/** Parse one ref file. Refuses anything not public, a body whose hash disagrees, or an id that is not the file name.
|
|
46
43
|
* Each body is checked against the hash it arrived with, then held as `canonical` makes it (NUL → U+FFFD, hash of that text), so every consumer of a
|
|
47
44
|
* parsed file — prior export, import, merge — sees the one representation the database stores. */
|
|
@@ -52,29 +49,3 @@ export declare function parseDoc(path: string, text: string): {
|
|
|
52
49
|
ok: false;
|
|
53
50
|
reason: string;
|
|
54
51
|
};
|
|
55
|
-
/** Two sides name one revision id with different content: a revision-id collision, never merged or overwritten. */
|
|
56
|
-
export declare class RevisionConflict extends Error {
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Merge one document. Revisions: union by rev_id (first copy kept verbatim; the same id with another body hash or parents throws `RevisionConflict`). Fields: three-way
|
|
60
|
-
* against base, remote wins when both changed — except that clearing `deleted_at` (a restoration) beats a tombstone. A side missing the file while base had it deleted
|
|
61
|
-
* it: the result is marked deleted (at `now`) and keeps every revision.
|
|
62
|
-
*/
|
|
63
|
-
export declare function mergeDoc(base: RefDocument | null, local: RefDocument | null, remote: RefDocument | null, now?: string): RefDocument | null;
|
|
64
|
-
/**
|
|
65
|
-
* Merge three trees (path → file text). Per path mergeDoc; then two live documents with one name:
|
|
66
|
-
* the one already on the remote under that name keeps it, the other becomes `<name>-<id first 8>`.
|
|
67
|
-
* A file that fails to parse is refused; it stays in the tree verbatim (the local side's text, else the remote's).
|
|
68
|
-
*/
|
|
69
|
-
export declare function mergeTrees(base: Map<string, string>, local: Map<string, string>, remote: Map<string, string>, now?: string): {
|
|
70
|
-
tree: Map<string, string>;
|
|
71
|
-
renamed: Array<{
|
|
72
|
-
id: string;
|
|
73
|
-
from: string;
|
|
74
|
-
to: string;
|
|
75
|
-
}>;
|
|
76
|
-
refused: Array<{
|
|
77
|
-
path: string;
|
|
78
|
-
reason: string;
|
|
79
|
-
}>;
|
|
80
|
-
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
`}f(E,"serializeDoc");const I=new Set(["boot","workspace-open","file-read","document-read","command","pre-command","slash-command"]),M=new Set(["name","preview","content"]),y=f(n=>typeof n=="string","isStr"),b=f(n=>n===null||typeof n=="string","isStrOrNull");function x(n,t){let o;try{o=JSON.parse(t)}catch(e){return{ok:!1,reason:`not JSON: ${e.message}`}}if(!o||typeof o!="object"||Array.isArray(o))return{ok:!1,reason:"not an object"};const r=o;if(r.privacy!=="public")return{ok:!1,reason:`privacy is ${String(r.privacy)}; a repo holds only public documents`};if(!y(r.id)||R(r.id)!==n)return{ok:!1,reason:`id ${String(r.id)} does not match file ${n}`};for(const e of["name","kind","preview","created_at"])if(!y(r[e]))return{ok:!1,reason:`${e} is not a string`};for(const e of["summary","why_it_exists","deleted_at"])if(!b(r[e]))return{ok:!1,reason:`${e} is not a string or null`};if(typeof r.unlisted!="boolean")return{ok:!1,reason:"unlisted is not a boolean"};if(!Array.isArray(r.rules))return{ok:!1,reason:"rules is not an array"};for(const e of r.rules)if(!e||typeof e.position!="number"||!I.has(e.on)||!M.has(e.deliver))return{ok:!1,reason:"malformed rule"};if(!Array.isArray(r.revisions)||r.revisions.length===0)return{ok:!1,reason:"no revisions"};const a=new Set;for(const e of r.revisions){if(!e||!y(e.rev_id)||typeof e.number!="number"||!y(e.body)||!y(e.body_hash)||!y(e.created_at)||!b(e.author)||!b(e.rationale)||!Array.isArray(e.parents)||!e.parents.every(y)||!Array.isArray(e.links))return{ok:!1,reason:"malformed revision"};if(a.has(e.rev_id))return{ok:!1,reason:`revision ${e.rev_id} appears twice`};if(a.add(e.rev_id),N(e.body)!==e.body_hash)return{ok:!1,reason:`revision ${e.rev_id} body does not match body_hash`}}const d=r.revisions.map(e=>{const{text:p,hash:h}=D(e.body,e.body_hash);return p===e.body?e:{...e,body:p,body_hash:h}});return{ok:!0,doc:{...r,revisions:d}}}f(x,"parseDoc");class C extends Error{static{f(this,"RevisionConflict")}}const $=f(n=>[...n.parents].sort().join(","),"parentsKey");function A(...n){const t=new Map;for(const o of n)for(const r of o?.revisions??[]){const a=t.get(r.rev_id);if(!a)t.set(r.rev_id,r);else if(a.body_hash!==r.body_hash||$(a)!==$(r))throw new C(`revision ${r.rev_id} is named with different content (body hash or parents) on two sides`)}return[...t.values()].sort(S)}f(A,"unionRevisions");function J(n,t,o,r=new Date().toISOString()){if(!t&&!o)return null;if(!t||!o){const d=t??o;return n?{...d,deleted_at:d.deleted_at??r,revisions:A(o,t,n)}:d}const a={...o,revisions:A(o,t,n)};for(const d of j){const e=g(t[d]),p=g(o[d]);if(e===p)continue;const h=n?g(n[d]):void 0;if(d==="deleted_at"&&n?.deleted_at!=null&&t.deleted_at===null!=(o.deleted_at===null)){a.deleted_at=null,a.rules=(t.deleted_at===null?t:o).rules;continue}h===p&&(a[d]=t[d])}return a}f(J,"mergeDoc");function K(n,t,o,r=new Date().toISOString()){const a=new Map,d=[],e=new Map,p=[...new Set([...n.keys(),...t.keys(),...o.keys()])].sort();for(const i of p){const s=[];let l=null;for(const u of[n,t,o]){const _=u.get(i);if(_===void 0){s.push(null);continue}const k=x(i,_);k.ok?s.push(k.doc):(l??=k.reason,s.push(null))}if(l!==null){d.push({path:i,reason:l});const u=t.get(i)??o.get(i);u!==void 0&&a.set(i,u);continue}const c=J(s[0],s[1],s[2],r);c&&e.set(i,c)}const h=f(i=>{const s=o.get(i);if(s===void 0)return null;const l=x(i,s);return l.ok&&l.doc.deleted_at===null?l.doc.name:null},"remoteNameOf"),v=new Map;for(const[i,s]of e)s.deleted_at===null&&v.set(s.name,[...v.get(s.name)??[],i]);const w=[];for(const[i,s]of v){if(s.length<2)continue;const l=s.find(c=>h(c)===i)??[...s].sort((c,u)=>e.get(c).id.localeCompare(e.get(u).id))[0];for(const c of s){if(c===l)continue;const u=e.get(c),_=`${i}-${u.id.slice(0,8)}`;e.set(c,{...u,name:_}),w.push({id:u.id,from:i,to:_})}}for(const[i,s]of e)a.set(i,E(s));return{tree:new Map([...a].sort(([i],[s])=>i.localeCompare(s))),renamed:w,refused:d}}f(K,"mergeTrees");export{j as RECORD_FIELDS,C as RevisionConflict,R as docPath,J as mergeDoc,K as mergeTrees,x as parseDoc,E as serializeDoc};
|
|
1
|
+
var y=Object.defineProperty;var a=(o,t)=>y(o,"name",{value:t,configurable:!0});import{canonical as u,hashOf as p}from"../bodies.js";const h=a(o=>`docs/${o}.json`,"docPath"),m=new Set(["boot","workspace-open","file-read","document-read","command","pre-command","slash-command"]),b=new Set(["name","preview","content"]),s=a(o=>typeof o=="string","isStr"),i=a(o=>o===null||typeof o=="string","isStrOrNull");function _(o,t){let n;try{n=JSON.parse(t)}catch(e){return{ok:!1,reason:`not JSON: ${e.message}`}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,reason:"not an object"};const r=n;if(r.privacy!=="public")return{ok:!1,reason:`privacy is ${String(r.privacy)}; a repo holds only public documents`};if(!s(r.id)||h(r.id)!==o)return{ok:!1,reason:`id ${String(r.id)} does not match file ${o}`};for(const e of["name","kind","preview","created_at"])if(!s(r[e]))return{ok:!1,reason:`${e} is not a string`};for(const e of["summary","why_it_exists","deleted_at"])if(!i(r[e]))return{ok:!1,reason:`${e} is not a string or null`};if(typeof r.unlisted!="boolean")return{ok:!1,reason:"unlisted is not a boolean"};if(!Array.isArray(r.rules))return{ok:!1,reason:"rules is not an array"};for(const e of r.rules)if(!e||typeof e.position!="number"||!m.has(e.on)||!b.has(e.deliver))return{ok:!1,reason:"malformed rule"};if(!Array.isArray(r.revisions)||r.revisions.length===0)return{ok:!1,reason:"no revisions"};const d=new Set;for(const e of r.revisions){if(!e||!s(e.rev_id)||typeof e.number!="number"||!s(e.body)||!s(e.body_hash)||!s(e.created_at)||!i(e.author)||!i(e.rationale)||!Array.isArray(e.parents)||!e.parents.every(s)||!Array.isArray(e.links))return{ok:!1,reason:"malformed revision"};if(d.has(e.rev_id))return{ok:!1,reason:`revision ${e.rev_id} appears twice`};if(d.add(e.rev_id),p(e.body)!==e.body_hash)return{ok:!1,reason:`revision ${e.rev_id} body does not match body_hash`}}const l=r.revisions.map(e=>{const{text:f,hash:c}=u(e.body,e.body_hash);return f===e.body?e:{...e,body:f,body_hash:c}});return{ok:!0,doc:{...r,revisions:l}}}a(_,"parseDoc");export{h as docPath,_ as parseDoc};
|
|
@@ -10,6 +10,14 @@ export interface RepoIdentity {
|
|
|
10
10
|
/** The repo object of the person this request runs as for an identity, created on first sight. A handle already
|
|
11
11
|
* held by another repo gets `-2`, `-3`, … appended. */
|
|
12
12
|
export declare function ensureRepo(db: CanvasDb, id: RepoIdentity, handle?: string): Promise<ObjectRow>;
|
|
13
|
+
/** Whether `person` may read the object `id` by permission facts alone (no ceiling): the gate for a repo a profile names. */
|
|
14
|
+
export declare function mayRead(db: CanvasDb, person: string, id: string): Promise<boolean>;
|
|
15
|
+
/** The repo objects of one remote identity, any person's, that `person` may read (permission facts only, no ceiling), the person's own first and
|
|
16
|
+
* then by age, oldest first. `heldByPerson` says whether the person has an identity row for it at all, readable or not. */
|
|
17
|
+
export declare function readableRepos(db: CanvasDb, person: string, scheme: string, externalId: string): Promise<{
|
|
18
|
+
readable: ObjectRow[];
|
|
19
|
+
heldByPerson: boolean;
|
|
20
|
+
}>;
|
|
13
21
|
/** Repos enclosing `cwd`, nearest first: every enclosing git checkout (created
|
|
14
22
|
* on first sight) and every existing local-path repo whose path is `cwd` or
|
|
15
23
|
* an ancestor of it. A non-git folder is never created here. */
|
|
@@ -17,5 +25,7 @@ export declare function reposForCwd(db: CanvasDb, cwd: string): Promise<ObjectRo
|
|
|
17
25
|
/** Run the git lookups for `cwd`'s checkouts now, so a later `checkoutsForCwd` inside a canvas write hits the identity
|
|
18
26
|
* cache instead of spawning git while every other db caller waits on the write lock. */
|
|
19
27
|
export declare function warmCheckoutIdentities(cwd: string): Promise<void>;
|
|
20
|
-
/** `reposForCwd` with the directory each repo is checked out at.
|
|
21
|
-
|
|
28
|
+
/** `reposForCwd` with the directory each repo is checked out at. Each git checkout yields every repo object of its remote that `person` (default: the
|
|
29
|
+
* request's person) may read: their own first, then the others oldest first. A personal repo object is created only when the person holds none for the
|
|
30
|
+
* remote; one they hold but may no longer read (a group they left) contributes nothing. */
|
|
31
|
+
export declare function checkoutsForCwd(db: CanvasDb, cwd: string, person?: string): Promise<Checkout[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
WHERE o.type = 'repo' AND i.person = ? AND i.scheme = ? AND i.external_id = ?`).get(
|
|
3
|
-
WHERE o.type = 'repo' AND i.scheme =
|
|
1
|
+
var C=Object.defineProperty;var c=(o,t)=>C(o,"name",{value:t,configurable:!0});import{resolve as f,sep as u}from"node:path";import{CrtrError as k}from"../../errors.js";import{realpathOrSelf as w}from"../../fs-utils.js";import{ExitCode as O}from"../../../types.js";import{personIdAsync as d}from"../../canvas/person.js";import{ensureOwner as R}from"../objects.js";import{checkoutChain as _,handleHint as g}from"./identity.js";import{checkoutChainOf as L}from"../../checkout-identities.js";import{subjectSet as E}from"../../permissions/evaluator.js";import{loadDefinitions as N}from"../../permissions/schemas.js";import{compilePermission as x}from"../../permissions/compile.js";import{f as D,raw as I}from"../../permissions/sql.js";import{OBJECT_TYPE as y}from"../../permissions/builtin.js";async function $(o,t,r,a){return await o.prepare(`SELECT o.* FROM identities i JOIN objects o ON o.id = i.object
|
|
2
|
+
WHERE o.type = 'repo' AND i.person = ? AND i.scheme = ? AND i.external_id = ?`).get(t,r,a)??null}c($,"existingRepo");async function j(o,t,r){const a=await $(o,await d(),t.scheme,t.externalId);if(a)return a;const n=r??t.handleHint;await o.prepare("SELECT pg_advisory_xact_lock(hashtext(?))").get(`repo-handle:${n}`);const m=o.prepare("SELECT 1 FROM objects WHERE name = ? AND type = 'repo' AND home_machine IS NULL");let s=n;for(let p=2;await m.get(s);p++)s=`${n}-${p}`;return await R(o,"repo",t.scheme,t.externalId,s)}c(j,"ensureRepo");async function Q(o,t,r){const a=x(await N(o),await E(o,t.replace(/^user:/,"")),y,"read",D`${r}::text`);return(await o.prepareUncached(`SELECT ${a.sql} AS ok`).get(...a.params))?.ok===!0}c(Q,"mayRead");async function T(o,t,r,a){const n=x(await N(o),await E(o,t.replace(/^user:/,"")),y,"read",I("o.id")),m=await o.prepareUncached(`SELECT o.*, i.person AS holder, ${n.sql} AS ok FROM identities i JOIN objects o ON o.id = i.object
|
|
3
|
+
WHERE o.type = 'repo' AND o.deleted_at IS NULL AND i.scheme = ? AND i.external_id = ?`).all(...n.params,r,a),s=`user:${t.replace(/^user:/,"")}`,p=c(e=>e.holder===s&&e.owner===null,"own");return{readable:m.filter(e=>e.ok).sort((e,i)=>Number(p(i))-Number(p(e))||e.created_at.localeCompare(i.created_at)||e.seq-i.seq).map(({holder:e,ok:i,...l})=>l),heldByPerson:m.some(e=>e.holder===s)}}c(T,"readableRepos");async function V(o,t){return(await F(o,t)).map(r=>r.repo)}c(V,"reposForCwd");async function X(o){await _(w(f(o)))}c(X,"warmCheckoutIdentities");async function F(o,t,r){const a=w(f(t)),n=[];for(const e of await L(o,a,async()=>r??await d())){if(!e.ok)throw new k("git-lookup-failed",`cannot identify the repo at ${e.dir}: ${e.reason}`,O.GENERAL,{dir:e.dir});const i=r??await d(),{readable:l,heldByPerson:A}=await T(o,i,e.scheme,e.externalId);l.length===0&&!A&&l.push(await j(o,e));for(const S of l)n.push({root:e.root,repo:S})}const s=(await o.prepare(`SELECT o.*, i.external_id AS path, i.person AS person FROM identities i JOIN objects o ON o.id = i.object
|
|
4
|
+
WHERE o.type = 'repo' AND i.scheme = 'local-path'`).all()).filter(({path:e})=>a===e||a.startsWith(e.endsWith(u)?e:e+u)),p=s.length>0?r??await d():"";for(const{path:e,person:i,...l}of s)i===`user:${p.replace(/^user:/,"")}`&&n.push({root:e,repo:l});n.sort((e,i)=>i.root.length-e.root.length);const h=new Set;return n.filter(({repo:e})=>!h.has(e.id)&&(h.add(e.id),!0))}c(F,"checkoutsForCwd");export{F as checkoutsForCwd,j as ensureRepo,g as handleHint,Q as mayRead,T as readableRepos,V as reposForCwd,X as warmCheckoutIdentities};
|