@north-light/cli 0.3.765 → 0.3.767
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/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +1 -1
- package/dist/builtin-memory/internal/nodes-and-canvas.md +7 -8
- package/dist/builtin-memory/internal/storage-tiers.md +5 -4
- package/dist/builtin-memory/northlight-apps/guides/test-your-app.md +1 -1
- package/dist/clients/attach/viewer.js +416 -416
- package/dist/commands/sys/signin.d.ts +2 -0
- package/dist/commands/sys/signin.js +4 -2
- package/dist/commands/sys.js +1 -1
- package/dist/core/canvas/db.js +4 -4
- package/dist/core/directory/issuer.d.ts +1 -1
- package/dist/daemon/api/handlers/app-environments.d.ts +1 -0
- package/dist/daemon/api/handlers/app-environments.js +1 -1
- package/dist/daemon/api/handlers/environments.d.ts +1 -0
- package/dist/daemon/api/handlers/environments.js +1 -1
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/server.d.ts +1 -0
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/cron/passes.d.ts +0 -2
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd-cli.js +1 -1
- package/dist/daemon/crtrd.d.ts +5 -5
- package/dist/daemon/crtrd.js +7 -19
- package/dist/daemon/due-sources.d.ts +1 -1
- package/dist/daemon/due-sources.js +1 -1
- package/dist/daemon/due.js +4 -4
- package/dist/daemon/machine-link/holder.js +5 -5
- package/dist/daemon/manage.d.ts +0 -12
- package/dist/daemon/manage.js +3 -3
- package/dist/daemon/postgres/index.d.ts +1 -1
- package/dist/daemon/postgres/index.js +1 -1
- package/dist/daemon/postgres/supervisor.d.ts +0 -62
- package/dist/daemon/postgres/supervisor.js +1 -2
- package/dist/daemon/reconcilers/broker-supervision.d.ts +0 -2
- package/dist/daemon/reconcilers/broker-supervision.js +1 -1
- package/dist/daemon/reconcilers/controller-death.d.ts +0 -2
- package/dist/daemon/reconcilers/controller-death.js +1 -1
- package/dist/daemon/reconcilers/cron-lane.d.ts +0 -1
- package/dist/daemon/reconcilers/cron-lane.js +1 -1
- package/dist/daemon/reconcilers/live-obligation.d.ts +1 -6
- package/dist/daemon/reconcilers/live-obligation.js +1 -1
- package/dist/daemon/reconcilers/machine-offline.js +4 -4
- package/dist/daemon/reconcilers/node-deadline.d.ts +1 -2
- package/dist/daemon/reconcilers/node-deadline.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +0 -2
- package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
- package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -2
- package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
- package/docs/apps/guides/test-your-app.md +1 -1
- package/docs/ci-runner.md +3 -3
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/api/index.js +0 -1
- package/packages/crouter-api/dist/daemon/manage.js +0 -12
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
- package/dist/api/dto/imports.d.ts +0 -156
- package/dist/api/dto/imports.js +0 -0
- package/dist/commands/sys/import/move.d.ts +0 -29
- package/dist/commands/sys/import/move.js +0 -6
- package/dist/commands/sys/import/resume.d.ts +0 -1
- package/dist/commands/sys/import/resume.js +0 -1
- package/dist/commands/sys/import/start.d.ts +0 -1
- package/dist/commands/sys/import/start.js +0 -1
- package/dist/core/canvas/daemon-owner.d.ts +0 -75
- package/dist/core/canvas/daemon-owner.js +0 -1
- package/dist/core/import/bundle/blob-keys.d.ts +0 -12
- package/dist/core/import/bundle/blob-keys.js +0 -1
- package/dist/core/import/bundle/layout.d.ts +0 -89
- package/dist/core/import/bundle/layout.js +0 -4
- package/dist/core/import/export/archive.d.ts +0 -11
- package/dist/core/import/export/archive.js +0 -1
- package/dist/core/import/export/cloud.d.ts +0 -41
- package/dist/core/import/export/cloud.js +0 -1
- package/dist/core/import/export/dump.d.ts +0 -34
- package/dist/core/import/export/dump.js +0 -4
- package/dist/core/import/export/files.d.ts +0 -23
- package/dist/core/import/export/files.js +0 -1
- package/dist/core/import/export/inline.d.ts +0 -3
- package/dist/core/import/export/inline.js +0 -1
- package/dist/core/import/export/source.d.ts +0 -2
- package/dist/core/import/export/source.js +0 -1
- package/dist/core/import/export/stores.d.ts +0 -9
- package/dist/core/import/export/stores.js +0 -4
- package/dist/core/import/load/bind.d.ts +0 -42
- package/dist/core/import/load/bind.js +0 -20
- package/dist/core/import/load/blobs.d.ts +0 -27
- package/dist/core/import/load/blobs.js +0 -1
- package/dist/core/import/load/catalog.d.ts +0 -39
- package/dist/core/import/load/catalog.js +0 -9
- package/dist/core/import/load/copy.d.ts +0 -29
- package/dist/core/import/load/copy.js +0 -11
- package/dist/core/import/load/keys.d.ts +0 -5
- package/dist/core/import/load/keys.js +0 -8
- package/dist/core/import/load/open-grants.d.ts +0 -1
- package/dist/core/import/load/open-grants.js +0 -1
- package/dist/core/import/load/path-map.d.ts +0 -7
- package/dist/core/import/load/path-map.js +0 -1
- package/dist/core/import/load/prepare.d.ts +0 -70
- package/dist/core/import/load/prepare.js +0 -14
- package/dist/core/import/load/publish-plugins.d.ts +0 -10
- package/dist/core/import/load/publish-plugins.js +0 -1
- package/dist/core/import/load/rewrite.d.ts +0 -54
- package/dist/core/import/load/rewrite.js +0 -15
- package/dist/core/import/load/rollback.d.ts +0 -3
- package/dist/core/import/load/rollback.js +0 -7
- package/dist/core/import/load/run.d.ts +0 -26
- package/dist/core/import/load/run.js +0 -2
- package/dist/core/import/load/stage.d.ts +0 -15
- package/dist/core/import/load/stage.js +0 -1
- package/dist/core/import/load/stores.d.ts +0 -32
- package/dist/core/import/load/stores.js +0 -2
- package/dist/core/import/load/verify.d.ts +0 -4
- package/dist/core/import/load/verify.js +0 -13
- package/dist/daemon/api/handlers/imports.d.ts +0 -2
- package/dist/daemon/api/handlers/imports.js +0 -1
- package/dist/daemon/api/handlers/machine-credential.d.ts +0 -2
- package/dist/daemon/api/handlers/machine-credential.js +0 -1
- package/dist/daemon/api/import-auth.d.ts +0 -6
- package/dist/daemon/api/import-auth.js +0 -1
- package/dist/daemon/import-dump-run.d.ts +0 -1
- package/dist/daemon/import-dump-run.js +0 -5
- package/dist/daemon/reconcilers/import-lane.d.ts +0 -17
- package/dist/daemon/reconcilers/import-lane.js +0 -1
- package/packages/crouter-api/dist/api/dto/imports.js +0 -2
- package/packages/crouter-api/dist/build-root.js +0 -402
- package/packages/crouter-api/dist/clients/attach/ansi-cells.js +0 -137
- package/packages/crouter-api/dist/clients/attach/chrome/bash-jobs.js +0 -34
- package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +0 -285
- package/packages/crouter-api/dist/clients/attach/chrome/completion-bell.js +0 -89
- package/packages/crouter-api/dist/clients/attach/chrome/cron-wait.js +0 -34
- package/packages/crouter-api/dist/clients/attach/chrome/header.js +0 -30
- package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +0 -221
- package/packages/crouter-api/dist/clients/attach/chrome/key-hint.js +0 -16
- package/packages/crouter-api/dist/clients/attach/chrome/object-wait.js +0 -24
- package/packages/crouter-api/dist/clients/attach/chrome/recap.js +0 -19
- package/packages/crouter-api/dist/clients/attach/chrome/review-wait.js +0 -22
- package/packages/crouter-api/dist/clients/attach/chrome/roster.js +0 -283
- package/packages/crouter-api/dist/clients/attach/chrome/run-facts.js +0 -76
- package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +0 -122
- package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +0 -261
- package/packages/crouter-api/dist/clients/attach/chrome/widgets.js +0 -60
- package/packages/crouter-api/dist/clients/attach/command.js +0 -107
- package/packages/crouter-api/dist/clients/attach/config.js +0 -280
- package/packages/crouter-api/dist/clients/attach/input/capabilities.js +0 -114
- package/packages/crouter-api/dist/clients/attach/input/clipboard-image.js +0 -237
- package/packages/crouter-api/dist/clients/attach/input/completion-frecency.js +0 -141
- package/packages/crouter-api/dist/clients/attach/input/controller.js +0 -432
- package/packages/crouter-api/dist/clients/attach/input/local-files.js +0 -113
- package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +0 -192
- package/packages/crouter-api/dist/clients/attach/input/ref-autocomplete.js +0 -176
- package/packages/crouter-api/dist/clients/attach/input/titled-editor.js +0 -859
- package/packages/crouter-api/dist/clients/attach/overlays/auth.js +0 -247
- package/packages/crouter-api/dist/clients/attach/overlays/dialogs.js +0 -102
- package/packages/crouter-api/dist/clients/attach/overlays/graph.js +0 -743
- package/packages/crouter-api/dist/clients/attach/overlays/help.js +0 -214
- package/packages/crouter-api/dist/clients/attach/overlays/mcp.js +0 -302
- package/packages/crouter-api/dist/clients/attach/overlays/pickers.js +0 -163
- package/packages/crouter-api/dist/clients/attach/render/activity-slot.js +0 -13
- package/packages/crouter-api/dist/clients/attach/render/assistant-message.js +0 -56
- package/packages/crouter-api/dist/clients/attach/render/card-presentation.js +0 -232
- package/packages/crouter-api/dist/clients/attach/render/chat-view.js +0 -1956
- package/packages/crouter-api/dist/clients/attach/render/context-message.js +0 -63
- package/packages/crouter-api/dist/clients/attach/render/crtr-output.js +0 -721
- package/packages/crouter-api/dist/clients/attach/render/diagram.js +0 -111
- package/packages/crouter-api/dist/clients/attach/render/doc-links.js +0 -78
- package/packages/crouter-api/dist/clients/attach/render/edit-diff.js +0 -304
- package/packages/crouter-api/dist/clients/attach/render/glyph-codepoints.js +0 -42
- package/packages/crouter-api/dist/clients/attach/render/group-activity.js +0 -276
- package/packages/crouter-api/dist/clients/attach/render/group-recap.js +0 -146
- package/packages/crouter-api/dist/clients/attach/render/markdown-source.js +0 -279
- package/packages/crouter-api/dist/clients/attach/render/measured-container.js +0 -322
- package/packages/crouter-api/dist/clients/attach/render/page-block.js +0 -187
- package/packages/crouter-api/dist/clients/attach/render/scroll-animation.js +0 -80
- package/packages/crouter-api/dist/clients/attach/render/tool-calls.js +0 -350
- package/packages/crouter-api/dist/clients/attach/render/transcript-copy.js +0 -81
- package/packages/crouter-api/dist/clients/attach/render/transcript-search.js +0 -152
- package/packages/crouter-api/dist/clients/attach/render/viewport.js +0 -184
- package/packages/crouter-api/dist/clients/attach/session/banner.js +0 -33
- package/packages/crouter-api/dist/clients/attach/session/bindings.js +0 -72
- package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +0 -169
- package/packages/crouter-api/dist/clients/attach/session/connection.js +0 -185
- package/packages/crouter-api/dist/clients/attach/session/context.js +0 -16
- package/packages/crouter-api/dist/clients/attach/session/document-links.js +0 -48
- package/packages/crouter-api/dist/clients/attach/session/editor-frame.js +0 -161
- package/packages/crouter-api/dist/clients/attach/session/editor-inventory.js +0 -156
- package/packages/crouter-api/dist/clients/attach/session/file-links.js +0 -73
- package/packages/crouter-api/dist/clients/attach/session/focus-events.js +0 -12
- package/packages/crouter-api/dist/clients/attach/session/frame.js +0 -214
- package/packages/crouter-api/dist/clients/attach/session/frames.js +0 -203
- package/packages/crouter-api/dist/clients/attach/session/identity.js +0 -27
- package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +0 -153
- package/packages/crouter-api/dist/clients/attach/session/invariant.js +0 -15
- package/packages/crouter-api/dist/clients/attach/session/keys.js +0 -84
- package/packages/crouter-api/dist/clients/attach/session/layout-record.js +0 -52
- package/packages/crouter-api/dist/clients/attach/session/layout.js +0 -59
- package/packages/crouter-api/dist/clients/attach/session/mouse.js +0 -78
- package/packages/crouter-api/dist/clients/attach/session/pane-focus.js +0 -42
- package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +0 -118
- package/packages/crouter-api/dist/clients/attach/session/pi-assets.js +0 -24
- package/packages/crouter-api/dist/clients/attach/session/pi-oauth-flows.js +0 -21
- package/packages/crouter-api/dist/clients/attach/session/profile-files.js +0 -208
- package/packages/crouter-api/dist/clients/attach/session/readonly-popup.js +0 -25
- package/packages/crouter-api/dist/clients/attach/session/reconnect.js +0 -237
- package/packages/crouter-api/dist/clients/attach/session/selection.js +0 -108
- package/packages/crouter-api/dist/clients/attach/session/state-sync.js +0 -67
- package/packages/crouter-api/dist/clients/attach/session/surface-frame.js +0 -73
- package/packages/crouter-api/dist/clients/attach/session/surface-host.js +0 -239
- package/packages/crouter-api/dist/clients/attach/session/teardown.js +0 -102
- package/packages/crouter-api/dist/clients/attach/session/transcript-search.js +0 -151
- package/packages/crouter-api/dist/clients/attach/session/whip-achievements.js +0 -145
- package/packages/crouter-api/dist/clients/attach/session/whip.js +0 -362
- package/packages/crouter-api/dist/clients/attach/slash/dispatch.js +0 -759
- package/packages/crouter-api/dist/clients/attach/slash/prompt-preview.js +0 -121
- package/packages/crouter-api/dist/clients/attach/slash/recover.js +0 -133
- package/packages/crouter-api/dist/clients/attach/viewer.js +0 -1026
- package/packages/crouter-api/dist/clients/conversation/projection.js +0 -324
- package/packages/crouter-api/dist/clients/conversation/submit.js +0 -51
- package/packages/crouter-api/dist/clients/dashboard/app.js +0 -439
- package/packages/crouter-api/dist/clients/dashboard/model.js +0 -77
- package/packages/crouter-api/dist/clients/dashboard/render.js +0 -148
- package/packages/crouter-api/dist/clients/editor-roundtrip.js +0 -41
- package/packages/crouter-api/dist/clients/inbox/controller.js +0 -772
- package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +0 -94
- package/packages/crouter-api/dist/clients/inbox/layout.js +0 -9
- package/packages/crouter-api/dist/clients/inbox/page-adapter.js +0 -56
- package/packages/crouter-api/dist/clients/inbox/resolve.js +0 -35
- package/packages/crouter-api/dist/clients/inbox/surface.js +0 -190
- package/packages/crouter-api/dist/clients/inbox/tui/ansi.js +0 -321
- package/packages/crouter-api/dist/clients/inbox/tui/input.js +0 -392
- package/packages/crouter-api/dist/clients/inbox/tui/keys.js +0 -104
- package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +0 -62
- package/packages/crouter-api/dist/clients/inbox/tui/panel.js +0 -92
- package/packages/crouter-api/dist/clients/inbox/tui/render.js +0 -382
- package/packages/crouter-api/dist/clients/inbox/tui/slots.js +0 -134
- package/packages/crouter-api/dist/clients/inbox/tui/types.js +0 -1
- package/packages/crouter-api/dist/clients/inbox/tui.js +0 -91
- package/packages/crouter-api/dist/clients/open-browser.js +0 -6
- package/packages/crouter-api/dist/clients/surfaces/host.js +0 -1
- package/packages/crouter-api/dist/commands/api-client.js +0 -432
- package/packages/crouter-api/dist/commands/attention.js +0 -215
- package/packages/crouter-api/dist/commands/canvas/edges.js +0 -41
- package/packages/crouter-api/dist/commands/canvas/list.js +0 -81
- package/packages/crouter-api/dist/commands/canvas/read.js +0 -97
- package/packages/crouter-api/dist/commands/canvas/search.js +0 -51
- package/packages/crouter-api/dist/commands/canvas/share.js +0 -80
- package/packages/crouter-api/dist/commands/canvas/unwatch.js +0 -42
- package/packages/crouter-api/dist/commands/canvas/watch.js +0 -63
- package/packages/crouter-api/dist/commands/canvas-analytics/chart.js +0 -124
- package/packages/crouter-api/dist/commands/canvas-analytics/drilldown.js +0 -96
- package/packages/crouter-api/dist/commands/canvas-analytics/format.js +0 -106
- package/packages/crouter-api/dist/commands/canvas-analytics/graph-detail.js +0 -307
- package/packages/crouter-api/dist/commands/canvas-analytics/graphs.js +0 -365
- package/packages/crouter-api/dist/commands/canvas-analytics/memory.js +0 -211
- package/packages/crouter-api/dist/commands/canvas-analytics/overview.js +0 -189
- package/packages/crouter-api/dist/commands/canvas-analytics/shell.js +0 -416
- package/packages/crouter-api/dist/commands/canvas-analytics/time.js +0 -228
- package/packages/crouter-api/dist/commands/canvas-analytics/usage.js +0 -305
- package/packages/crouter-api/dist/commands/canvas-analytics/view.js +0 -102
- package/packages/crouter-api/dist/commands/canvas-analytics.js +0 -28
- package/packages/crouter-api/dist/commands/canvas-browse.js +0 -71
- package/packages/crouter-api/dist/commands/canvas-config.js +0 -192
- package/packages/crouter-api/dist/commands/canvas-history/grep.js +0 -85
- package/packages/crouter-api/dist/commands/canvas-history/read.js +0 -48
- package/packages/crouter-api/dist/commands/canvas-history/search.js +0 -99
- package/packages/crouter-api/dist/commands/canvas-history/shared.js +0 -135
- package/packages/crouter-api/dist/commands/canvas-history/stats.js +0 -68
- package/packages/crouter-api/dist/commands/canvas-history.js +0 -29
- package/packages/crouter-api/dist/commands/canvas-issue.js +0 -148
- package/packages/crouter-api/dist/commands/canvas-prune.js +0 -111
- package/packages/crouter-api/dist/commands/canvas-roster.js +0 -69
- package/packages/crouter-api/dist/commands/canvas-snapshot.js +0 -34
- package/packages/crouter-api/dist/commands/canvas-use.js +0 -61
- package/packages/crouter-api/dist/commands/canvas.js +0 -57
- package/packages/crouter-api/dist/commands/chord.js +0 -242
- package/packages/crouter-api/dist/commands/cron.js +0 -541
- package/packages/crouter-api/dist/commands/custom-object/ack.js +0 -30
- package/packages/crouter-api/dist/commands/custom-object/publish.js +0 -39
- package/packages/crouter-api/dist/commands/custom-object/receive.js +0 -69
- package/packages/crouter-api/dist/commands/custom-object/register.js +0 -69
- package/packages/crouter-api/dist/commands/custom-object/shared.js +0 -14
- package/packages/crouter-api/dist/commands/custom-object/unregister.js +0 -26
- package/packages/crouter-api/dist/commands/custom-object.js +0 -21
- package/packages/crouter-api/dist/commands/dashboard.js +0 -86
- package/packages/crouter-api/dist/commands/doc/delete.js +0 -30
- package/packages/crouter-api/dist/commands/doc/edit.js +0 -83
- package/packages/crouter-api/dist/commands/doc/history.js +0 -38
- package/packages/crouter-api/dist/commands/doc/lint.js +0 -36
- package/packages/crouter-api/dist/commands/doc/list.js +0 -19
- package/packages/crouter-api/dist/commands/doc/move.js +0 -37
- package/packages/crouter-api/dist/commands/doc/read.js +0 -19
- package/packages/crouter-api/dist/commands/doc/replace-blocks.js +0 -40
- package/packages/crouter-api/dist/commands/doc/shared.js +0 -156
- package/packages/crouter-api/dist/commands/doc/write.js +0 -53
- package/packages/crouter-api/dist/commands/doc.js +0 -27
- package/packages/crouter-api/dist/commands/human/components.js +0 -78
- package/packages/crouter-api/dist/commands/human/feedback.js +0 -112
- package/packages/crouter-api/dist/commands/human/prompts.js +0 -319
- package/packages/crouter-api/dist/commands/human/queue.js +0 -191
- package/packages/crouter-api/dist/commands/human/request.js +0 -269
- package/packages/crouter-api/dist/commands/human/review.js +0 -287
- package/packages/crouter-api/dist/commands/human/shared.js +0 -67
- package/packages/crouter-api/dist/commands/human.js +0 -63
- package/packages/crouter-api/dist/commands/node/bash.js +0 -398
- package/packages/crouter-api/dist/commands/node/create.js +0 -363
- package/packages/crouter-api/dist/commands/node/inspect.js +0 -305
- package/packages/crouter-api/dist/commands/node/lifecycle.js +0 -577
- package/packages/crouter-api/dist/commands/node/message.js +0 -170
- package/packages/crouter-api/dist/commands/node/outcome.js +0 -133
- package/packages/crouter-api/dist/commands/node/pyramid.js +0 -79
- package/packages/crouter-api/dist/commands/node/subscription.js +0 -78
- package/packages/crouter-api/dist/commands/node/wait.js +0 -157
- package/packages/crouter-api/dist/commands/node-context.js +0 -145
- package/packages/crouter-api/dist/commands/node-lifecycle-revive.js +0 -222
- package/packages/crouter-api/dist/commands/node-snapshot.js +0 -37
- package/packages/crouter-api/dist/commands/node-transcript.js +0 -59
- package/packages/crouter-api/dist/commands/node-worktree.js +0 -134
- package/packages/crouter-api/dist/commands/node.js +0 -29
- package/packages/crouter-api/dist/commands/person-settings.js +0 -30
- package/packages/crouter-api/dist/commands/pkg/app-installs.js +0 -125
- package/packages/crouter-api/dist/commands/pkg/browse/actions.js +0 -198
- package/packages/crouter-api/dist/commands/pkg/browse/catalog.js +0 -461
- package/packages/crouter-api/dist/commands/pkg/browse/command-view.js +0 -217
- package/packages/crouter-api/dist/commands/pkg/browse/detail-panel.js +0 -402
- package/packages/crouter-api/dist/commands/pkg/browse/doc-view.js +0 -84
- package/packages/crouter-api/dist/commands/pkg/browse/list-panel.js +0 -168
- package/packages/crouter-api/dist/commands/pkg/browse/model.js +0 -36
- package/packages/crouter-api/dist/commands/pkg/browse/shell.js +0 -640
- package/packages/crouter-api/dist/commands/pkg/browse.js +0 -27
- package/packages/crouter-api/dist/commands/pkg/market-inspect.js +0 -145
- package/packages/crouter-api/dist/commands/pkg/market-manage.js +0 -343
- package/packages/crouter-api/dist/commands/pkg/market.js +0 -14
- package/packages/crouter-api/dist/commands/pkg/plugin-env.js +0 -65
- package/packages/crouter-api/dist/commands/pkg/plugin-inspect.js +0 -178
- package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +0 -1040
- package/packages/crouter-api/dist/commands/pkg/plugin.js +0 -14
- package/packages/crouter-api/dist/commands/pkg/shared.js +0 -62
- package/packages/crouter-api/dist/commands/pkg.js +0 -21
- package/packages/crouter-api/dist/commands/profile/daemon-profiles.js +0 -38
- package/packages/crouter-api/dist/commands/profile/default.js +0 -183
- package/packages/crouter-api/dist/commands/profile/delete.js +0 -66
- package/packages/crouter-api/dist/commands/profile/env.js +0 -188
- package/packages/crouter-api/dist/commands/profile/environment.js +0 -111
- package/packages/crouter-api/dist/commands/profile/kind.js +0 -27
- package/packages/crouter-api/dist/commands/profile/list.js +0 -45
- package/packages/crouter-api/dist/commands/profile/meta.js +0 -65
- package/packages/crouter-api/dist/commands/profile/new.js +0 -107
- package/packages/crouter-api/dist/commands/profile/pause.js +0 -59
- package/packages/crouter-api/dist/commands/profile/project.js +0 -147
- package/packages/crouter-api/dist/commands/profile/rename.js +0 -41
- package/packages/crouter-api/dist/commands/profile/show.js +0 -55
- package/packages/crouter-api/dist/commands/profile.js +0 -36
- package/packages/crouter-api/dist/commands/push.js +0 -357
- package/packages/crouter-api/dist/commands/revive.js +0 -183
- package/packages/crouter-api/dist/commands/surface/node/cycle.js +0 -83
- package/packages/crouter-api/dist/commands/surface/node/focus.js +0 -60
- package/packages/crouter-api/dist/commands/surface/node/id.js +0 -38
- package/packages/crouter-api/dist/commands/surface/node/pin.js +0 -42
- package/packages/crouter-api/dist/commands/surface/node/placement.js +0 -49
- package/packages/crouter-api/dist/commands/surface-dashboard.js +0 -138
- package/packages/crouter-api/dist/commands/surface-edit.js +0 -157
- package/packages/crouter-api/dist/commands/surface-inbox.js +0 -98
- package/packages/crouter-api/dist/commands/surface-inspect.js +0 -41
- package/packages/crouter-api/dist/commands/surface-node.js +0 -19
- package/packages/crouter-api/dist/commands/surface-tmux-spread.js +0 -214
- package/packages/crouter-api/dist/commands/surface.js +0 -28
- package/packages/crouter-api/dist/commands/sys/branch.js +0 -19
- package/packages/crouter-api/dist/commands/sys/config.js +0 -353
- package/packages/crouter-api/dist/commands/sys/context/admin/actions.js +0 -89
- package/packages/crouter-api/dist/commands/sys/context/admin/detail-panel.js +0 -233
- package/packages/crouter-api/dist/commands/sys/context/admin/docs-panel.js +0 -185
- package/packages/crouter-api/dist/commands/sys/context/admin/list-view.js +0 -170
- package/packages/crouter-api/dist/commands/sys/context/admin/model.js +0 -179
- package/packages/crouter-api/dist/commands/sys/context/admin/rail-panel.js +0 -229
- package/packages/crouter-api/dist/commands/sys/context/admin/read-view.js +0 -172
- package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +0 -870
- package/packages/crouter-api/dist/commands/sys/context/admin.js +0 -148
- package/packages/crouter-api/dist/commands/sys/context/doc.js +0 -126
- package/packages/crouter-api/dist/commands/sys/context/expose.js +0 -66
- package/packages/crouter-api/dist/commands/sys/context/prompt-review.js +0 -244
- package/packages/crouter-api/dist/commands/sys/context/resolve.js +0 -326
- package/packages/crouter-api/dist/commands/sys/context/sysprompt.js +0 -95
- package/packages/crouter-api/dist/commands/sys/context.js +0 -21
- package/packages/crouter-api/dist/commands/sys/daemon.js +0 -354
- package/packages/crouter-api/dist/commands/sys/desktop.js +0 -201
- package/packages/crouter-api/dist/commands/sys/doctor.js +0 -650
- package/packages/crouter-api/dist/commands/sys/env.js +0 -39
- package/packages/crouter-api/dist/commands/sys/feedback.js +0 -238
- package/packages/crouter-api/dist/commands/sys/import/move.js +0 -205
- package/packages/crouter-api/dist/commands/sys/import/resume.js +0 -23
- package/packages/crouter-api/dist/commands/sys/import/start.js +0 -57
- package/packages/crouter-api/dist/commands/sys/join.js +0 -53
- package/packages/crouter-api/dist/commands/sys/limits.js +0 -133
- package/packages/crouter-api/dist/commands/sys/logs.js +0 -129
- package/packages/crouter-api/dist/commands/sys/machine/rotate.js +0 -49
- package/packages/crouter-api/dist/commands/sys/panels/broker-limits-panel.js +0 -110
- package/packages/crouter-api/dist/commands/sys/panels/dependencies-panel.js +0 -80
- package/packages/crouter-api/dist/commands/sys/panels/keybindings-panel.js +0 -703
- package/packages/crouter-api/dist/commands/sys/panels/models-panel.js +0 -1160
- package/packages/crouter-api/dist/commands/sys/panels/plugin-env-panel.js +0 -70
- package/packages/crouter-api/dist/commands/sys/panels/plugins-panel.js +0 -87
- package/packages/crouter-api/dist/commands/sys/panels/prefs-panel.js +0 -97
- package/packages/crouter-api/dist/commands/sys/panels/profiles-panel.js +0 -656
- package/packages/crouter-api/dist/commands/sys/panels/provider-panel.js +0 -534
- package/packages/crouter-api/dist/commands/sys/panels/terminal-panel.js +0 -67
- package/packages/crouter-api/dist/commands/sys/provider-login.js +0 -99
- package/packages/crouter-api/dist/commands/sys/retry-delivery.js +0 -33
- package/packages/crouter-api/dist/commands/sys/settings-shell.js +0 -400
- package/packages/crouter-api/dist/commands/sys/settings.js +0 -46
- package/packages/crouter-api/dist/commands/sys/setup-core.js +0 -882
- package/packages/crouter-api/dist/commands/sys/setup-settings-runner.js +0 -15
- package/packages/crouter-api/dist/commands/sys/setup-wizard.js +0 -351
- package/packages/crouter-api/dist/commands/sys/setup.js +0 -41
- package/packages/crouter-api/dist/commands/sys/shared.js +0 -81
- package/packages/crouter-api/dist/commands/sys/signin.js +0 -169
- package/packages/crouter-api/dist/commands/sys/spaces.js +0 -22
- package/packages/crouter-api/dist/commands/sys/spend.js +0 -144
- package/packages/crouter-api/dist/commands/sys/support/prepare.js +0 -239
- package/packages/crouter-api/dist/commands/sys/support/submit.js +0 -524
- package/packages/crouter-api/dist/commands/sys/support.js +0 -18
- package/packages/crouter-api/dist/commands/sys/sync-deps.js +0 -445
- package/packages/crouter-api/dist/commands/sys/sync-project-guidance.js +0 -320
- package/packages/crouter-api/dist/commands/sys/sync-shared.js +0 -139
- package/packages/crouter-api/dist/commands/sys/sync-skills.js +0 -297
- package/packages/crouter-api/dist/commands/sys/sync.js +0 -17
- package/packages/crouter-api/dist/commands/sys/terminal-option.js +0 -542
- package/packages/crouter-api/dist/commands/sys/tutorial/branch.js +0 -15
- package/packages/crouter-api/dist/commands/sys/tutorial/lessons.js +0 -107
- package/packages/crouter-api/dist/commands/sys/tutorial/scenario.js +0 -432
- package/packages/crouter-api/dist/commands/sys/tutorial/tracks.js +0 -96
- package/packages/crouter-api/dist/commands/sys/update.js +0 -158
- package/packages/crouter-api/dist/commands/sys/worktrees.js +0 -53
- package/packages/crouter-api/dist/commands/sys.js +0 -28
- package/packages/crouter-api/dist/core/activity-signal.js +0 -38
- package/packages/crouter-api/dist/core/async-array.js +0 -48
- package/packages/crouter-api/dist/core/auth-file.js +0 -89
- package/packages/crouter-api/dist/core/auth-interaction.js +0 -94
- package/packages/crouter-api/dist/core/bash-guard.js +0 -527
- package/packages/crouter-api/dist/core/bash-job-supervisor.js +0 -170
- package/packages/crouter-api/dist/core/bash-jobs.js +0 -460
- package/packages/crouter-api/dist/core/blobs/directory.js +0 -264
- package/packages/crouter-api/dist/core/blobs/fault.js +0 -6
- package/packages/crouter-api/dist/core/blobs/index.js +0 -30
- package/packages/crouter-api/dist/core/blobs/r2.js +0 -169
- package/packages/crouter-api/dist/core/broker-client/client.js +0 -186
- package/packages/crouter-api/dist/core/broker-client/index.js +0 -14
- package/packages/crouter-api/dist/core/broker-client/transport-relay.js +0 -256
- package/packages/crouter-api/dist/core/broker-client/transport-socket.js +0 -187
- package/packages/crouter-api/dist/core/broker-client/transport.js +0 -40
- package/packages/crouter-api/dist/core/canvas/app-run.js +0 -4
- package/packages/crouter-api/dist/core/canvas/attention.js +0 -47
- package/packages/crouter-api/dist/core/canvas/browse/app.js +0 -1050
- package/packages/crouter-api/dist/core/canvas/browse/model.js +0 -477
- package/packages/crouter-api/dist/core/canvas/browse/pins.js +0 -29
- package/packages/crouter-api/dist/core/canvas/browse/render.js +0 -1058
- package/packages/crouter-api/dist/core/canvas/canvas.js +0 -1260
- package/packages/crouter-api/dist/core/canvas/crons.js +0 -557
- package/packages/crouter-api/dist/core/canvas/daemon-actions.js +0 -99
- package/packages/crouter-api/dist/core/canvas/db.js +0 -442
- package/packages/crouter-api/dist/core/canvas/deliveries.js +0 -402
- package/packages/crouter-api/dist/core/canvas/delivery-contract.js +0 -30
- package/packages/crouter-api/dist/core/canvas/executions.js +0 -270
- package/packages/crouter-api/dist/core/canvas/extensions.js +0 -90
- package/packages/crouter-api/dist/core/canvas/focuses.js +0 -82
- package/packages/crouter-api/dist/core/canvas/history.js +0 -480
- package/packages/crouter-api/dist/core/canvas/index.js +0 -16
- package/packages/crouter-api/dist/core/canvas/install-id.js +0 -64
- package/packages/crouter-api/dist/core/canvas/labels.js +0 -43
- package/packages/crouter-api/dist/core/canvas/legacy-person.js +0 -4
- package/packages/crouter-api/dist/core/canvas/memory-reads.js +0 -37
- package/packages/crouter-api/dist/core/canvas/meta-file.js +0 -89
- package/packages/crouter-api/dist/core/canvas/nav-render.js +0 -224
- package/packages/crouter-api/dist/core/canvas/node-agent-paths.js +0 -30
- package/packages/crouter-api/dist/core/canvas/node-order.js +0 -37
- package/packages/crouter-api/dist/core/canvas/node-recap.js +0 -62
- package/packages/crouter-api/dist/core/canvas/node-tokens.js +0 -53
- package/packages/crouter-api/dist/core/canvas/outcome-actions.js +0 -71
- package/packages/crouter-api/dist/core/canvas/person.js +0 -239
- package/packages/crouter-api/dist/core/canvas/reconciler-leases.js +0 -44
- package/packages/crouter-api/dist/core/canvas/recovery.js +0 -715
- package/packages/crouter-api/dist/core/canvas/remote-canvas-source.js +0 -290
- package/packages/crouter-api/dist/core/canvas/remote-transport.js +0 -57
- package/packages/crouter-api/dist/core/canvas/render-source.js +0 -518
- package/packages/crouter-api/dist/core/canvas/schema-chain.js +0 -110
- package/packages/crouter-api/dist/core/canvas/schema-version.js +0 -58
- package/packages/crouter-api/dist/core/canvas/sessions.js +0 -128
- package/packages/crouter-api/dist/core/canvas/source.js +0 -57
- package/packages/crouter-api/dist/core/canvas/status-glyph.js +0 -147
- package/packages/crouter-api/dist/core/canvas/structured-requests.js +0 -176
- package/packages/crouter-api/dist/core/canvas/telemetry.js +0 -35
- package/packages/crouter-api/dist/core/canvas/tree.js +0 -150
- package/packages/crouter-api/dist/core/canvas/types.js +0 -6
- package/packages/crouter-api/dist/core/canvas/waits.js +0 -113
- package/packages/crouter-api/dist/core/canvas/worktrees.js +0 -97
- package/packages/crouter-api/dist/core/checkout-identities.js +0 -107
- package/packages/crouter-api/dist/core/clipboard-text.js +0 -57
- package/packages/crouter-api/dist/core/command-hooks/artifact.js +0 -145
- package/packages/crouter-api/dist/core/command-hooks/catalog.js +0 -38
- package/packages/crouter-api/dist/core/command-hooks/compose.js +0 -101
- package/packages/crouter-api/dist/core/command-hooks/discovery.js +0 -246
- package/packages/crouter-api/dist/core/command-hooks/help.js +0 -18
- package/packages/crouter-api/dist/core/command-hooks/lifecycle-catalog.js +0 -9
- package/packages/crouter-api/dist/core/command-hooks/lifecycle-create.js +0 -51
- package/packages/crouter-api/dist/core/command-hooks/report.js +0 -28
- package/packages/crouter-api/dist/core/command-hooks/schema.js +0 -157
- package/packages/crouter-api/dist/core/command-hooks/transport/exec-invoke.js +0 -315
- package/packages/crouter-api/dist/core/command-hooks/transport/exec-lifecycle.js +0 -248
- package/packages/crouter-api/dist/core/command-hooks/transport/plan.js +0 -30
- package/packages/crouter-api/dist/core/command-manifests/registry.js +0 -118
- package/packages/crouter-api/dist/core/command-plugins/caller-header.js +0 -15
- package/packages/crouter-api/dist/core/command-plugins/compose.js +0 -263
- package/packages/crouter-api/dist/core/command-plugins/discovery.js +0 -240
- package/packages/crouter-api/dist/core/command-plugins/extensions.js +0 -166
- package/packages/crouter-api/dist/core/command-plugins/help-addenda.js +0 -55
- package/packages/crouter-api/dist/core/command-plugins/presence.js +0 -36
- package/packages/crouter-api/dist/core/command-plugins/transport/exec-invoke.js +0 -138
- package/packages/crouter-api/dist/core/command-plugins/transport/http-fetch.js +0 -68
- package/packages/crouter-api/dist/core/command-plugins/transport/http-invoke.js +0 -333
- package/packages/crouter-api/dist/core/command-plugins/transport/http-plan.js +0 -349
- package/packages/crouter-api/dist/core/command-plugins/transport/sign.js +0 -115
- package/packages/crouter-api/dist/core/command.js +0 -896
- package/packages/crouter-api/dist/core/conversation-store/row-store.js +0 -420
- package/packages/crouter-api/dist/core/directory/issuer.js +0 -15
- package/packages/crouter-api/dist/core/directory/person-credential.js +0 -237
- package/packages/crouter-api/dist/core/directory/reach.js +0 -19
- package/packages/crouter-api/dist/core/document-lines.js +0 -6
- package/packages/crouter-api/dist/core/editor-resolver.js +0 -77
- package/packages/crouter-api/dist/core/environment-recipe.js +0 -62
- package/packages/crouter-api/dist/core/environment-starter-script.js +0 -64
- package/packages/crouter-api/dist/core/environments.js +0 -24
- package/packages/crouter-api/dist/core/events/outbound.js +0 -92
- package/packages/crouter-api/dist/core/events/read.js +0 -625
- package/packages/crouter-api/dist/core/fault-classifier.js +0 -101
- package/packages/crouter-api/dist/core/feed/feed.js +0 -190
- package/packages/crouter-api/dist/core/feed/inbox.js +0 -93
- package/packages/crouter-api/dist/core/feed/messages.js +0 -234
- package/packages/crouter-api/dist/core/feed/reports.js +0 -58
- package/packages/crouter-api/dist/core/frontmatter.js +0 -35
- package/packages/crouter-api/dist/core/git.js +0 -103
- package/packages/crouter-api/dist/core/grants/cover.js +0 -66
- package/packages/crouter-api/dist/core/grants/hosted-endpoint.js +0 -70
- package/packages/crouter-api/dist/core/grants/local.js +0 -26
- package/packages/crouter-api/dist/core/grants/mirror.js +0 -506
- package/packages/crouter-api/dist/core/grants/on-sync.js +0 -163
- package/packages/crouter-api/dist/core/grants/owner.js +0 -21
- package/packages/crouter-api/dist/core/grants/shadow.js +0 -138
- package/packages/crouter-api/dist/core/grants/sync.js +0 -220
- package/packages/crouter-api/dist/core/grants/terminal.js +0 -25
- package/packages/crouter-api/dist/core/graph/access.js +0 -37
- package/packages/crouter-api/dist/core/graph/bodies.js +0 -68
- package/packages/crouter-api/dist/core/graph/custom.js +0 -298
- package/packages/crouter-api/dist/core/graph/deletion.js +0 -115
- package/packages/crouter-api/dist/core/graph/documents.js +0 -666
- package/packages/crouter-api/dist/core/graph/edges.js +0 -83
- package/packages/crouter-api/dist/core/graph/events.js +0 -432
- package/packages/crouter-api/dist/core/graph/exposures.js +0 -164
- package/packages/crouter-api/dist/core/graph/jobs.js +0 -184
- package/packages/crouter-api/dist/core/graph/kinds/action.js +0 -20
- package/packages/crouter-api/dist/core/graph/kinds/custom.js +0 -23
- package/packages/crouter-api/dist/core/graph/kinds/document.js +0 -115
- package/packages/crouter-api/dist/core/graph/kinds/dto.js +0 -20
- package/packages/crouter-api/dist/core/graph/kinds/environment.js +0 -19
- package/packages/crouter-api/dist/core/graph/kinds/job.js +0 -22
- package/packages/crouter-api/dist/core/graph/kinds/kind.js +0 -15
- package/packages/crouter-api/dist/core/graph/kinds/node.js +0 -85
- package/packages/crouter-api/dist/core/graph/kinds/owner.js +0 -24
- package/packages/crouter-api/dist/core/graph/kinds/registry.js +0 -58
- package/packages/crouter-api/dist/core/graph/kinds/render.js +0 -17
- package/packages/crouter-api/dist/core/graph/names.js +0 -225
- package/packages/crouter-api/dist/core/graph/objects.js +0 -277
- package/packages/crouter-api/dist/core/graph/package-docs.js +0 -153
- package/packages/crouter-api/dist/core/graph/package-files.js +0 -146
- package/packages/crouter-api/dist/core/graph/package-publish.js +0 -165
- package/packages/crouter-api/dist/core/graph/package-reconcile.js +0 -99
- package/packages/crouter-api/dist/core/graph/reader.js +0 -315
- package/packages/crouter-api/dist/core/graph/receiver-url.js +0 -83
- package/packages/crouter-api/dist/core/graph/receivers.js +0 -66
- package/packages/crouter-api/dist/core/graph/repo-sync/identity.js +0 -147
- package/packages/crouter-api/dist/core/graph/repo-sync/repos.js +0 -134
- package/packages/crouter-api/dist/core/graph/rules.js +0 -144
- package/packages/crouter-api/dist/core/graph/types.js +0 -10
- package/packages/crouter-api/dist/core/graph/watches.js +0 -223
- package/packages/crouter-api/dist/core/human/action-binding.js +0 -41
- package/packages/crouter-api/dist/core/human/answer-text.js +0 -100
- package/packages/crouter-api/dist/core/human/answer.js +0 -119
- package/packages/crouter-api/dist/core/human/completion.js +0 -27
- package/packages/crouter-api/dist/core/human/component-docs.js +0 -442
- package/packages/crouter-api/dist/core/human/convention.js +0 -75
- package/packages/crouter-api/dist/core/human/feedback-companion.js +0 -92
- package/packages/crouter-api/dist/core/human/feedback.js +0 -88
- package/packages/crouter-api/dist/core/human/page-authoring.js +0 -19
- package/packages/crouter-api/dist/core/human/page-errors.js +0 -14
- package/packages/crouter-api/dist/core/human/page-eval.js +0 -125
- package/packages/crouter-api/dist/core/human/page-html-markdown.js +0 -260
- package/packages/crouter-api/dist/core/human/page-markdown.js +0 -291
- package/packages/crouter-api/dist/core/human/page-schema.js +0 -381
- package/packages/crouter-api/dist/core/human/page.js +0 -251
- package/packages/crouter-api/dist/core/human/request-files.js +0 -54
- package/packages/crouter-api/dist/core/human/requests.js +0 -647
- package/packages/crouter-api/dist/core/human/root.js +0 -11
- package/packages/crouter-api/dist/core/human/summary.js +0 -5
- package/packages/crouter-api/dist/core/human/tickets.js +0 -166
- package/packages/crouter-api/dist/core/human/types.js +0 -1
- package/packages/crouter-api/dist/core/human/visible-paths.js +0 -74
- package/packages/crouter-api/dist/core/human-actions.js +0 -101
- package/packages/crouter-api/dist/core/import/bundle/blob-keys.js +0 -25
- package/packages/crouter-api/dist/core/import/bundle/layout.js +0 -111
- package/packages/crouter-api/dist/core/import/export/archive.js +0 -22
- package/packages/crouter-api/dist/core/import/export/cloud.js +0 -175
- package/packages/crouter-api/dist/core/import/export/dump.js +0 -245
- package/packages/crouter-api/dist/core/import/export/files.js +0 -169
- package/packages/crouter-api/dist/core/import/export/inline.js +0 -15
- package/packages/crouter-api/dist/core/import/export/source.js +0 -5
- package/packages/crouter-api/dist/core/import/export/stores.js +0 -73
- package/packages/crouter-api/dist/core/import/load/catalog.js +0 -70
- package/packages/crouter-api/dist/core/import/load/copy.js +0 -173
- package/packages/crouter-api/dist/core/import/load/keys.js +0 -77
- package/packages/crouter-api/dist/core/import/load/prepare.js +0 -262
- package/packages/crouter-api/dist/core/import/load/rewrite.js +0 -314
- package/packages/crouter-api/dist/core/import/load/stage.js +0 -99
- package/packages/crouter-api/dist/core/inspector/chrome.js +0 -14
- package/packages/crouter-api/dist/core/inspector/contract.js +0 -1
- package/packages/crouter-api/dist/core/inspector/core.js +0 -296
- package/packages/crouter-api/dist/core/inspector/host.js +0 -538
- package/packages/crouter-api/dist/core/inspector/model.js +0 -225
- package/packages/crouter-api/dist/core/inspector/text.js +0 -45
- package/packages/crouter-api/dist/core/inspector/transport.js +0 -36
- package/packages/crouter-api/dist/core/inspector/tui.js +0 -295
- package/packages/crouter-api/dist/core/keybindings/background-bash.js +0 -33
- package/packages/crouter-api/dist/core/keybindings/inbox.js +0 -25
- package/packages/crouter-api/dist/core/keybindings/index.js +0 -7
- package/packages/crouter-api/dist/core/keybindings/match.js +0 -146
- package/packages/crouter-api/dist/core/keybindings/persistence.js +0 -47
- package/packages/crouter-api/dist/core/keybindings/resolve.js +0 -348
- package/packages/crouter-api/dist/core/ledger/account.js +0 -13
- package/packages/crouter-api/dist/core/ledger/charges.js +0 -44
- package/packages/crouter-api/dist/core/ledger/check.js +0 -40
- package/packages/crouter-api/dist/core/ledger/chunks.js +0 -47
- package/packages/crouter-api/dist/core/ledger/environment-payer.js +0 -15
- package/packages/crouter-api/dist/core/ledger/index.js +0 -11
- package/packages/crouter-api/dist/core/ledger/infra-allowance.js +0 -31
- package/packages/crouter-api/dist/core/ledger/limits.js +0 -35
- package/packages/crouter-api/dist/core/ledger/months.js +0 -19
- package/packages/crouter-api/dist/core/ledger/payer.js +0 -23
- package/packages/crouter-api/dist/core/ledger/read.js +0 -211
- package/packages/crouter-api/dist/core/ledger/totals.js +0 -34
- package/packages/crouter-api/dist/core/ledger/types.js +0 -2
- package/packages/crouter-api/dist/core/llm/app-rungs.js +0 -64
- package/packages/crouter-api/dist/core/llm/body-limits.js +0 -7
- package/packages/crouter-api/dist/core/llm/owner-candidates.js +0 -79
- package/packages/crouter-api/dist/core/llm/refusal.js +0 -22
- package/packages/crouter-api/dist/core/llm/run.js +0 -571
- package/packages/crouter-api/dist/core/logged-step-timings.js +0 -52
- package/packages/crouter-api/dist/core/manifest-stale.js +0 -39
- package/packages/crouter-api/dist/core/model-auth/api-credential-store.js +0 -49
- package/packages/crouter-api/dist/core/model-auth/daemon-login.js +0 -156
- package/packages/crouter-api/dist/core/model-auth/readiness.js +0 -83
- package/packages/crouter-api/dist/core/model-routes-pool.js +0 -57
- package/packages/crouter-api/dist/core/model-routes.js +0 -212
- package/packages/crouter-api/dist/core/northlight/previews.js +0 -87
- package/packages/crouter-api/dist/core/nvim-launch.js +0 -45
- package/packages/crouter-api/dist/core/output.js +0 -99
- package/packages/crouter-api/dist/core/packages/eligibility.js +0 -34
- package/packages/crouter-api/dist/core/packages/launch-kinds.js +0 -20
- package/packages/crouter-api/dist/core/packages/source-url.js +0 -17
- package/packages/crouter-api/dist/core/pagination.js +0 -88
- package/packages/crouter-api/dist/core/peer/client.js +0 -168
- package/packages/crouter-api/dist/core/peer/directory.js +0 -193
- package/packages/crouter-api/dist/core/peer/envelope.js +0 -99
- package/packages/crouter-api/dist/core/peer/names.js +0 -8
- package/packages/crouter-api/dist/core/peer/outbox-store.js +0 -84
- package/packages/crouter-api/dist/core/peer/receiver.js +0 -54
- package/packages/crouter-api/dist/core/peer/stubs.js +0 -212
- package/packages/crouter-api/dist/core/peer/token.js +0 -30
- package/packages/crouter-api/dist/core/peer/version.js +0 -23
- package/packages/crouter-api/dist/core/permissions/builtin.js +0 -29
- package/packages/crouter-api/dist/core/permissions/ceiling.js +0 -345
- package/packages/crouter-api/dist/core/permissions/compile.js +0 -175
- package/packages/crouter-api/dist/core/permissions/errors.js +0 -13
- package/packages/crouter-api/dist/core/permissions/evaluator.js +0 -139
- package/packages/crouter-api/dist/core/permissions/facts.js +0 -102
- package/packages/crouter-api/dist/core/permissions/schema-parser.js +0 -151
- package/packages/crouter-api/dist/core/permissions/schemas.js +0 -83
- package/packages/crouter-api/dist/core/permissions/sql.js +0 -31
- package/packages/crouter-api/dist/core/plugin-app.js +0 -58
- package/packages/crouter-api/dist/core/plugin-quarantine.js +0 -70
- package/packages/crouter-api/dist/core/pool-credential-store.js +0 -135
- package/packages/crouter-api/dist/core/predicate.js +0 -191
- package/packages/crouter-api/dist/core/preview-registry.js +0 -399
- package/packages/crouter-api/dist/core/profiles/default-binding.js +0 -29
- package/packages/crouter-api/dist/core/profiles/deletion-reservation.js +0 -42
- package/packages/crouter-api/dist/core/profiles/select.js +0 -750
- package/packages/crouter-api/dist/core/provider-credential.js +0 -17
- package/packages/crouter-api/dist/core/provider-error-recognition.js +0 -82
- package/packages/crouter-api/dist/core/provider-failure.js +0 -166
- package/packages/crouter-api/dist/core/provider-management.js +0 -9
- package/packages/crouter-api/dist/core/providers/approval.js +0 -146
- package/packages/crouter-api/dist/core/providers/audit.js +0 -52
- package/packages/crouter-api/dist/core/providers/bundles.js +0 -643
- package/packages/crouter-api/dist/core/providers/call.js +0 -503
- package/packages/crouter-api/dist/core/providers/description.js +0 -1
- package/packages/crouter-api/dist/core/providers/device-libs.js +0 -202
- package/packages/crouter-api/dist/core/providers/device.js +0 -95
- package/packages/crouter-api/dist/core/providers/errors.js +0 -137
- package/packages/crouter-api/dist/core/providers/files.js +0 -461
- package/packages/crouter-api/dist/core/providers/inflight.js +0 -14
- package/packages/crouter-api/dist/core/providers/mint.js +0 -248
- package/packages/crouter-api/dist/core/providers/receipts.js +0 -50
- package/packages/crouter-api/dist/core/providers/request.js +0 -173
- package/packages/crouter-api/dist/core/providers/roots.js +0 -118
- package/packages/crouter-api/dist/core/providers/token-cache.js +0 -203
- package/packages/crouter-api/dist/core/remote-canvas-target.js +0 -30
- package/packages/crouter-api/dist/core/review/anchors.js +0 -91
- package/packages/crouter-api/dist/core/review/comments.js +0 -277
- package/packages/crouter-api/dist/core/review/companion.js +0 -207
- package/packages/crouter-api/dist/core/review/document.js +0 -71
- package/packages/crouter-api/dist/core/review/project.js +0 -46
- package/packages/crouter-api/dist/core/review/store.js +0 -178
- package/packages/crouter-api/dist/core/review/types.js +0 -23
- package/packages/crouter-api/dist/core/runs/activity.js +0 -57
- package/packages/crouter-api/dist/core/runs/events.js +0 -179
- package/packages/crouter-api/dist/core/runs/initial-input.js +0 -27
- package/packages/crouter-api/dist/core/runs/node-sub.js +0 -10
- package/packages/crouter-api/dist/core/runs/operations.js +0 -800
- package/packages/crouter-api/dist/core/runs/questions.js +0 -151
- package/packages/crouter-api/dist/core/runtime/banner.js +0 -53
- package/packages/crouter-api/dist/core/runtime/bearings-render.js +0 -284
- package/packages/crouter-api/dist/core/runtime/bearings.js +0 -208
- package/packages/crouter-api/dist/core/runtime/bin-contributions.js +0 -186
- package/packages/crouter-api/dist/core/runtime/blaxel-environment.js +0 -17
- package/packages/crouter-api/dist/core/runtime/broker/bash-job-launch.js +0 -65
- package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +0 -453
- package/packages/crouter-api/dist/core/runtime/broker/read-ops.js +0 -174
- package/packages/crouter-api/dist/core/runtime/broker/turn-cause.js +0 -44
- package/packages/crouter-api/dist/core/runtime/broker-ownership.js +0 -6
- package/packages/crouter-api/dist/core/runtime/broker-protocol.js +0 -166
- package/packages/crouter-api/dist/core/runtime/broker-request.js +0 -86
- package/packages/crouter-api/dist/core/runtime/broker-sdk.js +0 -130
- package/packages/crouter-api/dist/core/runtime/broker-wedge.js +0 -97
- package/packages/crouter-api/dist/core/runtime/canvas-extensions.js +0 -100
- package/packages/crouter-api/dist/core/runtime/close.js +0 -266
- package/packages/crouter-api/dist/core/runtime/command-expansion.js +0 -104
- package/packages/crouter-api/dist/core/runtime/command-surface.js +0 -117
- package/packages/crouter-api/dist/core/runtime/crtr-theme.js +0 -146
- package/packages/crouter-api/dist/core/runtime/deliver-live.js +0 -85
- package/packages/crouter-api/dist/core/runtime/fault-recovery.js +0 -72
- package/packages/crouter-api/dist/core/runtime/fault.js +0 -17
- package/packages/crouter-api/dist/core/runtime/fleet.js +0 -75
- package/packages/crouter-api/dist/core/runtime/focus-viewer.js +0 -151
- package/packages/crouter-api/dist/core/runtime/front-door-env.js +0 -16
- package/packages/crouter-api/dist/core/runtime/headless-pi.js +0 -176
- package/packages/crouter-api/dist/core/runtime/host.js +0 -717
- package/packages/crouter-api/dist/core/runtime/interactive-deliver.js +0 -51
- package/packages/crouter-api/dist/core/runtime/invocation.js +0 -10
- package/packages/crouter-api/dist/core/runtime/kickoff.js +0 -263
- package/packages/crouter-api/dist/core/runtime/launch-prompt.js +0 -13
- package/packages/crouter-api/dist/core/runtime/launch-recipe.js +0 -45
- package/packages/crouter-api/dist/core/runtime/launch-target.js +0 -87
- package/packages/crouter-api/dist/core/runtime/launch.js +0 -505
- package/packages/crouter-api/dist/core/runtime/ledger.js +0 -55
- package/packages/crouter-api/dist/core/runtime/lifecycle.js +0 -286
- package/packages/crouter-api/dist/core/runtime/managed-provider-cooling.js +0 -62
- package/packages/crouter-api/dist/core/runtime/memory-admission.js +0 -68
- package/packages/crouter-api/dist/core/runtime/model-registry.js +0 -13
- package/packages/crouter-api/dist/core/runtime/model-selection.js +0 -135
- package/packages/crouter-api/dist/core/runtime/model-swap.js +0 -76
- package/packages/crouter-api/dist/core/runtime/naming.js +0 -300
- package/packages/crouter-api/dist/core/runtime/nerd-font.js +0 -162
- package/packages/crouter-api/dist/core/runtime/nodes.js +0 -506
- package/packages/crouter-api/dist/core/runtime/outcome-document.js +0 -86
- package/packages/crouter-api/dist/core/runtime/output-result.js +0 -32
- package/packages/crouter-api/dist/core/runtime/output-schema-refs.js +0 -100
- package/packages/crouter-api/dist/core/runtime/package-health.js +0 -100
- package/packages/crouter-api/dist/core/runtime/persona.js +0 -54
- package/packages/crouter-api/dist/core/runtime/pi-cli.js +0 -65
- package/packages/crouter-api/dist/core/runtime/pi-vendored.js +0 -63
- package/packages/crouter-api/dist/core/runtime/placement-tmux.js +0 -81
- package/packages/crouter-api/dist/core/runtime/placement.js +0 -418
- package/packages/crouter-api/dist/core/runtime/progress-bar.js +0 -50
- package/packages/crouter-api/dist/core/runtime/provider-credential-gate.js +0 -48
- package/packages/crouter-api/dist/core/runtime/recovery-hold.js +0 -46
- package/packages/crouter-api/dist/core/runtime/reopen.js +0 -165
- package/packages/crouter-api/dist/core/runtime/revive-all.js +0 -108
- package/packages/crouter-api/dist/core/runtime/revive.js +0 -762
- package/packages/crouter-api/dist/core/runtime/roadmap.js +0 -86
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +0 -150
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +0 -280
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/release-image.js +0 -97
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/runner.js +0 -214
- package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +0 -88
- package/packages/crouter-api/dist/core/runtime/runner/index.js +0 -37
- package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +0 -110
- package/packages/crouter-api/dist/core/runtime/runner/machine/environment.js +0 -7
- package/packages/crouter-api/dist/core/runtime/runner/machine/executor.js +0 -235
- package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +0 -37
- package/packages/crouter-api/dist/core/runtime/runner/machine/runner.js +0 -72
- package/packages/crouter-api/dist/core/runtime/runner/process.js +0 -70
- package/packages/crouter-api/dist/core/runtime/runner/types.js +0 -16
- package/packages/crouter-api/dist/core/runtime/session-branch.js +0 -16
- package/packages/crouter-api/dist/core/runtime/session-cycles.js +0 -144
- package/packages/crouter-api/dist/core/runtime/session-list-cache.js +0 -302
- package/packages/crouter-api/dist/core/runtime/session-visibility.js +0 -99
- package/packages/crouter-api/dist/core/runtime/setup-marker.js +0 -46
- package/packages/crouter-api/dist/core/runtime/situational-context.js +0 -54
- package/packages/crouter-api/dist/core/runtime/situational-live.js +0 -41
- package/packages/crouter-api/dist/core/runtime/spawn-env-rows.js +0 -15
- package/packages/crouter-api/dist/core/runtime/spawn-env.js +0 -260
- package/packages/crouter-api/dist/core/runtime/spawn.js +0 -867
- package/packages/crouter-api/dist/core/runtime/stamp/protocol.js +0 -113
- package/packages/crouter-api/dist/core/runtime/start-check.js +0 -43
- package/packages/crouter-api/dist/core/runtime/stop-guard.js +0 -150
- package/packages/crouter-api/dist/core/runtime/stop-signals.js +0 -46
- package/packages/crouter-api/dist/core/runtime/structured-output.js +0 -112
- package/packages/crouter-api/dist/core/runtime/surface-bg.js +0 -85
- package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +0 -738
- package/packages/crouter-api/dist/core/runtime/tmux-chrome.js +0 -5
- package/packages/crouter-api/dist/core/runtime/tmux-driver.js +0 -706
- package/packages/crouter-api/dist/core/runtime/unsandboxed.js +0 -18
- package/packages/crouter-api/dist/core/runtime/view-socket.js +0 -195
- package/packages/crouter-api/dist/core/runtime/warm-pool.js +0 -479
- package/packages/crouter-api/dist/core/scoped-state/person-rows.js +0 -185
- package/packages/crouter-api/dist/core/scopes.js +0 -48
- package/packages/crouter-api/dist/core/secrets/blaxel-launch.js +0 -104
- package/packages/crouter-api/dist/core/secrets/env-rows.js +0 -40
- package/packages/crouter-api/dist/core/secrets/environment-owner.js +0 -31
- package/packages/crouter-api/dist/core/secrets/environment-secrets.js +0 -14
- package/packages/crouter-api/dist/core/secrets/index.js +0 -2
- package/packages/crouter-api/dist/core/secrets/key.js +0 -33
- package/packages/crouter-api/dist/core/secrets/seal.js +0 -43
- package/packages/crouter-api/dist/core/secrets.js +0 -137
- package/packages/crouter-api/dist/core/self-update.js +0 -77
- package/packages/crouter-api/dist/core/session-model/session-state.js +0 -180
- package/packages/crouter-api/dist/core/shell-segments.js +0 -169
- package/packages/crouter-api/dist/core/spaces/cache-env.js +0 -15
- package/packages/crouter-api/dist/core/spaces/file-root.js +0 -68
- package/packages/crouter-api/dist/core/spaces/mounts.js +0 -126
- package/packages/crouter-api/dist/core/spaces/permissions.js +0 -83
- package/packages/crouter-api/dist/core/spaces/process.js +0 -175
- package/packages/crouter-api/dist/core/spaces/runtime-home.js +0 -8
- package/packages/crouter-api/dist/core/spaces/space.js +0 -58
- package/packages/crouter-api/dist/core/spaces/stop.js +0 -138
- package/packages/crouter-api/dist/core/spaces/users.js +0 -43
- package/packages/crouter-api/dist/core/sqlite-statements.js +0 -17
- package/packages/crouter-api/dist/core/statements.js +0 -81
- package/packages/crouter-api/dist/core/step-timings.js +0 -63
- package/packages/crouter-api/dist/core/storage/attachments.js +0 -141
- package/packages/crouter-api/dist/core/storage/caller-file.js +0 -84
- package/packages/crouter-api/dist/core/storage/client.js +0 -220
- package/packages/crouter-api/dist/core/storage/media-types.js +0 -22
- package/packages/crouter-api/dist/core/storage/node-transfer.js +0 -100
- package/packages/crouter-api/dist/core/storage/purge.js +0 -55
- package/packages/crouter-api/dist/core/storage/tables.js +0 -129
- package/packages/crouter-api/dist/core/subscription-state.js +0 -470
- package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +0 -239
- package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +0 -370
- package/packages/crouter-api/dist/core/substrate/delivery/listings.js +0 -75
- package/packages/crouter-api/dist/core/substrate/delivery/match.js +0 -146
- package/packages/crouter-api/dist/core/substrate/delivery/plan.js +0 -132
- package/packages/crouter-api/dist/core/substrate/delivery/render-boot.js +0 -330
- package/packages/crouter-api/dist/core/substrate/delivery/render-event.js +0 -186
- package/packages/crouter-api/dist/core/substrate/delivery/sub-persona-menu.js +0 -24
- package/packages/crouter-api/dist/core/substrate/delivery/types.js +0 -1
- package/packages/crouter-api/dist/core/substrate/gate-explain.js +0 -397
- package/packages/crouter-api/dist/core/substrate/schema.js +0 -81
- package/packages/crouter-api/dist/core/substrate/subject-fields.js +0 -39
- package/packages/crouter-api/dist/core/substrate/subject.js +0 -60
- package/packages/crouter-api/dist/core/termrender/display.js +0 -56
- package/packages/crouter-api/dist/core/termrender/termrender.js +0 -719
- package/packages/crouter-api/dist/core/termrender/version.js +0 -1
- package/packages/crouter-api/dist/core/timing.js +0 -108
- package/packages/crouter-api/dist/core/tui/draw.js +0 -378
- package/packages/crouter-api/dist/core/tui/fuzzy.js +0 -38
- package/packages/crouter-api/dist/core/tui/markdown.js +0 -407
- package/packages/crouter-api/dist/core/tui/page-host.js +0 -74
- package/packages/crouter-api/dist/core/tui/panel.js +0 -142
- package/packages/crouter-api/dist/core/tui/terminal.js +0 -100
- package/packages/crouter-api/dist/core/wake.js +0 -296
- package/packages/crouter-api/dist/core/worktree-close.js +0 -205
- package/packages/crouter-api/dist/core/worktree-containment.js +0 -48
- package/packages/crouter-api/dist/core/worktree-landing.js +0 -8
- package/packages/crouter-api/dist/core/worktree-machine.js +0 -112
- package/packages/crouter-api/dist/core/worktree-mutation-async.js +0 -393
- package/packages/crouter-api/dist/core/worktree-remove.js +0 -84
- package/packages/crouter-api/dist/core/worktree-scripts.js +0 -72
- package/packages/crouter-api/dist/core/worktree-sweep.js +0 -448
- package/packages/crouter-api/dist/core/worktree.js +0 -844
- package/packages/crouter-api/dist/daemon/api/deferred-head.js +0 -117
- package/packages/crouter-api/dist/daemon/api/environment-of.js +0 -67
- package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +0 -352
- package/packages/crouter-api/dist/daemon/api/handlers/broker-ops.js +0 -705
- package/packages/crouter-api/dist/daemon/api/handlers/broker-recovery.js +0 -266
- package/packages/crouter-api/dist/daemon/api/handlers/execution-start.js +0 -120
- package/packages/crouter-api/dist/daemon/api/handlers/git-credential.js +0 -76
- package/packages/crouter-api/dist/daemon/api/handlers/node-records.js +0 -113
- package/packages/crouter-api/dist/daemon/api/handlers/providers.js +0 -290
- package/packages/crouter-api/dist/daemon/api/handlers/telemetry-record.js +0 -34
- package/packages/crouter-api/dist/daemon/api/handlers/validate.js +0 -58
- package/packages/crouter-api/dist/daemon/api/map.js +0 -750
- package/packages/crouter-api/dist/daemon/api/operations.js +0 -325
- package/packages/crouter-api/dist/daemon/api/principal.js +0 -166
- package/packages/crouter-api/dist/daemon/api/reader.js +0 -133
- package/packages/crouter-api/dist/daemon/api/router.js +0 -568
- package/packages/crouter-api/dist/daemon/api/sync-notice.js +0 -46
- package/packages/crouter-api/dist/daemon/api/viewer-presence.js +0 -100
- package/packages/crouter-api/dist/daemon/companion-retire.js +0 -44
- package/packages/crouter-api/dist/daemon/control.js +0 -22
- package/packages/crouter-api/dist/daemon/cron/armed-context.js +0 -140
- package/packages/crouter-api/dist/daemon/cron/authority.js +0 -101
- package/packages/crouter-api/dist/daemon/cron/capture.js +0 -50
- package/packages/crouter-api/dist/daemon/cron/closed.js +0 -108
- package/packages/crouter-api/dist/daemon/cron/disposition.js +0 -63
- package/packages/crouter-api/dist/daemon/cron/ended.js +0 -91
- package/packages/crouter-api/dist/daemon/cron/escalation.js +0 -136
- package/packages/crouter-api/dist/daemon/cron/held.js +0 -20
- package/packages/crouter-api/dist/daemon/cron/live-runs.js +0 -65
- package/packages/crouter-api/dist/daemon/cron/machine-fire.js +0 -240
- package/packages/crouter-api/dist/daemon/cron/narrowed.js +0 -34
- package/packages/crouter-api/dist/daemon/cron/recurrence.js +0 -38
- package/packages/crouter-api/dist/daemon/cron/run-socket.js +0 -170
- package/packages/crouter-api/dist/daemon/cron/run-token.js +0 -37
- package/packages/crouter-api/dist/daemon/cron/settle.js +0 -78
- package/packages/crouter-api/dist/daemon/cron/sinks.js +0 -70
- package/packages/crouter-api/dist/daemon/drain.js +0 -76
- package/packages/crouter-api/dist/daemon/http-dispatcher.js +0 -37
- package/packages/crouter-api/dist/daemon/human/finish.js +0 -179
- package/packages/crouter-api/dist/daemon/human/settle.js +0 -98
- package/packages/crouter-api/dist/daemon/machine-link/credential.js +0 -24
- package/packages/crouter-api/dist/daemon/machine-link/forward.js +0 -201
- package/packages/crouter-api/dist/daemon/machine-link/frames.js +0 -33
- package/packages/crouter-api/dist/daemon/machine-link/holder.js +0 -395
- package/packages/crouter-api/dist/daemon/park-activity.js +0 -33
- package/packages/crouter-api/dist/daemon/park-pending.js +0 -76
- package/packages/crouter-api/dist/daemon/postgres/binary.js +0 -193
- package/packages/crouter-api/dist/daemon/postgres/cluster.js +0 -111
- package/packages/crouter-api/dist/daemon/postgres/pins.js +0 -16
- package/packages/crouter-api/dist/daemon/postgres/supervisor.js +0 -177
- package/packages/crouter-api/dist/daemon/readiness.js +0 -37
- package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +0 -746
- package/packages/crouter-api/dist/daemon/reconcilers/ledger-sandbox.js +0 -249
- package/packages/crouter-api/dist/daemon/reconcilers/live-obligation.js +0 -125
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/launch-failure.js +0 -8
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/node-person.js +0 -40
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +0 -166
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +0 -59
- package/packages/crouter-api/dist/daemon/reconcilers/recipe-image.js +0 -204
- package/packages/crouter-api/dist/daemon/reconcilers/throttled-lane.js +0 -63
- package/packages/crouter-api/dist/daemon/review/companion.js +0 -29
- package/packages/crouter-api/dist/daemon/review/deliver.js +0 -14
- package/packages/crouter-api/dist/daemon/review/finish.js +0 -149
- package/packages/crouter-api/dist/daemon/runs/append-section.js +0 -129
- package/packages/crouter-api/dist/daemon/runs/observer.js +0 -440
- package/packages/crouter-api/dist/daemon/runs/view-transport.js +0 -81
- package/packages/crouter-api/dist/daemon/structured-requests/sidecar.js +0 -5
- package/packages/crouter-api/dist/hook-authoring.js +0 -447
- package/packages/crouter-api/dist/hook-process.js +0 -34
- package/packages/crouter-api/dist/launcher/limits/settings.js +0 -94
- package/packages/crouter-api/dist/migrations/004-canvas-documents/fields.js +0 -52
- package/packages/crouter-api/dist/shared/git-status.js +0 -44
- package/packages/crouter-api/dist/shared/inline-ref-grammar.js +0 -99
- package/packages/crouter-api/dist/shared/shell-quote.js +0 -5
- package/packages/crouter-api/dist/shared/strip-cd-prefix.js +0 -13
- package/packages/crouter-api/dist/shared/tool-groups.js +0 -64
- package/packages/crouter-api/dist/shared/traceparent.js +0 -28
- package/packages/crouter-api/dist/shared/turn-replies.js +0 -66
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CrtrError } from '../../errors.js';
|
|
2
|
-
import type { ImportRunDTO, ImportStartRequest, ImportStartedDTO, ImportStoreNameDTO, ImportUploadUrlsDTO } from '../../../api/dto/imports.js';
|
|
3
|
-
/** The dump directory's file holding the opened file stores, and the order they are uploaded in. */
|
|
4
|
-
export declare const STORE_FILE = "stores.json";
|
|
5
|
-
export declare const STORE_ORDER: readonly ImportStoreNameDTO[];
|
|
6
|
-
/** The control plane refuses a source that runs another release than its own: name the release it accepts and the command that installs it. */
|
|
7
|
-
export declare function releaseMismatch(accepted: string, status: number): CrtrError;
|
|
8
|
-
export declare class ImportCloud {
|
|
9
|
-
private readonly apiUrl;
|
|
10
|
-
private readonly token;
|
|
11
|
-
private readonly retryBaseMs;
|
|
12
|
-
private readonly putIdleMs;
|
|
13
|
-
private readonly retryBudgetMs;
|
|
14
|
-
/** `token` is a fixed import token, or a getter for a person bearer (5-minute tokens, so a long import asks per call). */
|
|
15
|
-
constructor(apiUrl: string, token: string | (() => Promise<string>), retryBaseMs?: number, putIdleMs?: number, retryBudgetMs?: number);
|
|
16
|
-
/**
|
|
17
|
-
* After a transient failure, wait the backoff for try `attempt` and answer true, or answer false when `retryBudgetMs` has passed since the first failure (`since`).
|
|
18
|
-
* Shared by `put` and `call`, so the rule is one rule.
|
|
19
|
-
*/
|
|
20
|
-
private backoff;
|
|
21
|
-
/** One API call. With `retry` (an idempotent call on the upload path), a network failure, a stalled connection, a 408, 429 or 5xx answer, or a person bearer that could not be fetched because Northlight was unreachable is retried until the budget is spent. */
|
|
22
|
-
private call;
|
|
23
|
-
private callOnce;
|
|
24
|
-
start(request: ImportStartRequest): Promise<ImportStartedDTO>;
|
|
25
|
-
uploadUrls(run: string, keys: string[]): Promise<ImportUploadUrlsDTO>;
|
|
26
|
-
putStore(run: string, name: ImportStoreNameDTO, body: unknown): Promise<void>;
|
|
27
|
-
load(run: string): Promise<ImportRunDTO>;
|
|
28
|
-
retry(run: string): Promise<ImportRunDTO>;
|
|
29
|
-
get(run: string): Promise<ImportRunDTO>;
|
|
30
|
-
/** `rotate` replaces a credential already issued for this run's machine (without it a second call answers 409 `credential_exists`). */
|
|
31
|
-
machineCredential(run: string, rotate?: boolean): Promise<{
|
|
32
|
-
environment_id: string;
|
|
33
|
-
credential: string;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* PUT bytes to a signed URL, retrying what is transient: a failed, dropped or stalled connection (socket closed or reset, no progress within the attempt's deadline)
|
|
37
|
-
* and a 408, 429 or 5xx answer, with doubling backoff capped at 30 s, until `retryBudgetMs` (10 minutes) has passed since the first failure. A 403 is a signed URL that has expired (or been refused): when `freshUrl`
|
|
38
|
-
* is given the URL is replaced by one from `uploadUrls`, once. Any other answer, or running out of budget, throws naming `key`.
|
|
39
|
-
*/
|
|
40
|
-
put(url: string, data: Buffer, key: string, freshUrl?: () => Promise<string>): Promise<void>;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _=Object.defineProperty;var h=(s,t)=>_(s,"name",{value:t,configurable:!0});import{CrtrError as w,general as d}from"../../errors.js";import{ExitCode as O}from"../../../types.js";import{crtrVersion as R}from"../../../shared/crtr-version.js";import{NORTHLIGHT_UNREACHABLE as x}from"../../directory/reach.js";const N="stores.json",D=["auth","credentials","env","settings","plugins"],B=10*6e4,P=3e4,U=6e4,T=64*1024,S=h(s=>s===408||s===429||s>=500,"isTransientStatus");function M(s){const t=s.cause;return`failed: ${s instanceof Error?s.message:String(s)}${typeof t?.code=="string"?` (${t.code})`:""}`}h(M,"failureText");function b(s,t){const e=`npm i -g @north-light/cli@${s}`;return new w("release_mismatch",`Northlight accepts only crtr ${s} for this step, and this computer runs ${R()}. Install it with \`${e}\`, then run \`crtr sys signin\` again.`,O.GENERAL,{status:t,code:"release_mismatch",accepted:s,next:`Run \`${e}\`, then \`crtr sys signin\`.`})}h(b,"releaseMismatch");class L{static{h(this,"ImportCloud")}apiUrl;token;retryBaseMs;putIdleMs;retryBudgetMs;constructor(t,e,r=500,l=U,a=B){this.apiUrl=t,this.token=e,this.retryBaseMs=r,this.putIdleMs=l,this.retryBudgetMs=a}async backoff(t,e){return Date.now()-e>=this.retryBudgetMs?!1:(await new Promise(r=>setTimeout(r,Math.min(this.retryBaseMs*2**(t-1),P)*(.5+Math.random()/2))),!0)}async call(t,e,r,l=!1){let a;for(let o=1;;o+=1)try{return await this.callOnce(t,e,r,l)}catch(i){const n=i instanceof w?i.details?.status:void 0,u=i instanceof w&&(i.code===x||i.details?.network===!0||typeof n=="number"&&S(n));if(!l||!u||(a??=Date.now(),!await this.backoff(o,a)))throw i}}async callOnce(t,e,r,l){let a,o;const i=`Bearer ${typeof this.token=="string"?this.token:await this.token()}`;try{o=await fetch(new URL(e,this.apiUrl),{method:t,headers:{authorization:i,...r===void 0?{}:{"content-type":"application/json"}},...r===void 0?{}:{body:JSON.stringify(r)},...l?{signal:AbortSignal.timeout(this.putIdleMs)}:{}}),a=await o.text()}catch(n){throw d(`${t} ${e} ${M(n)}`,{network:!0})}if(!o.ok){let n;try{n=JSON.parse(a).error?.code}catch{n=void 0}const u=n==="release_mismatch"?/control plane accepts (\S+)/.exec(a)?.[1]?.replace(/[^0-9A-Za-z.+-]+$/,""):void 0;throw u!==void 0?b(u,o.status):d(`${t} ${e} answered ${o.status}: ${a.slice(0,500)}`,{status:o.status,...typeof n=="string"?{code:n}:{}})}return a===""?void 0:JSON.parse(a)}start(t){return this.call("POST","/v1/imports",t)}uploadUrls(t,e){return this.call("POST",`/v1/imports/${t}/upload-urls`,{keys:e},!0)}putStore(t,e,r){return this.call("PUT",`/v1/imports/${t}/stores/${e}`,r,!0)}load(t){return this.call("POST",`/v1/imports/${t}/load`,{})}retry(t){return this.call("POST",`/v1/imports/${t}/retry`,{})}get(t){return this.call("GET",`/v1/imports/${t}`)}machineCredential(t,e=!1){return this.call("POST",`/v1/imports/${t}/machine-credential${e?"?rotate=1":""}`,{})}async put(t,e,r,l){let a=!1,o;for(let i=1;;i+=1){let n,u;const g=new AbortController;let p;const m=h(()=>{clearTimeout(p),p=setTimeout(()=>g.abort(new Error(`no progress for ${Math.round(this.putIdleMs/1e3)}s`)),this.putIdleMs)},"arm");let f=0;const E=new ReadableStream({pull(c){if(m(),f>=e.length){c.close();return}c.enqueue(e.subarray(f,f+T)),f+=T}},{highWaterMark:0});try{m();const c=await fetch(t,{method:"PUT",headers:{"content-length":String(e.length)},body:E,duplex:"half",signal:g.signal});if(m(),c.ok){await c.arrayBuffer();return}const $=c.status;let y="";try{y=(await c.text()).slice(0,300)}catch{}if(n=`answered ${$}: ${y}`,$===403&&l!==void 0&&!a){a=!0,t=await l();continue}u=S($)}catch(c){n=M(c),u=!0}finally{clearTimeout(p)}if(!u)throw d(`upload of ${r} ${n}`,{key:r});if(o??=Date.now(),!await this.backoff(i,o))throw d(`upload of ${r} ${n} after ${i} tries`,{key:r})}}}export{L as ImportCloud,N as STORE_FILE,D as STORE_ORDER,b as releaseMismatch};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type SourceJson } from '../bundle/layout.js';
|
|
2
|
-
export interface DumpRequestRef {
|
|
3
|
-
id: string;
|
|
4
|
-
dir: string;
|
|
5
|
-
file: string | null;
|
|
6
|
-
}
|
|
7
|
-
export interface DumpRunningNode {
|
|
8
|
-
node: string;
|
|
9
|
-
app: string;
|
|
10
|
-
cwd: string;
|
|
11
|
-
worktree: string | null;
|
|
12
|
-
}
|
|
13
|
-
export interface DumpResult {
|
|
14
|
-
source: SourceJson;
|
|
15
|
-
/** Human requests (page and review) with the folder and reviewed file their rows name. */
|
|
16
|
-
requests: DumpRequestRef[];
|
|
17
|
-
/** Nodes with status active or idle, for the hosted node-file archives. */
|
|
18
|
-
runningNodes: DumpRunningNode[];
|
|
19
|
-
/** `body_ref` files that could not be read and stayed as references. */
|
|
20
|
-
bodiesMissing: number;
|
|
21
|
-
bodiesInlined: number;
|
|
22
|
-
}
|
|
23
|
-
/** A row part file holds about this much JSON (the encoded lines, before compression); a row that alone exceeds it is a part of its own. */
|
|
24
|
-
export declare const PART_JSON_BYTES: number;
|
|
25
|
-
/** A body longer than this many UTF-8 bytes fails the export. The largest body on Silas's Mac is 5.2 MB. JSON escapes one character into at most six (`\u0001`), so a body at
|
|
26
|
-
* the ceiling is a line of at most 192 MiB, well inside V8's ~512 MiB string limit. */
|
|
27
|
-
export declare const BODY_MAX_BYTES: number;
|
|
28
|
-
/** The pre-pause dump of `bodies` (design-import cutover step 2): every row, while nodes still run. Rows are never updated or deleted, so the pause dump
|
|
29
|
-
* needs only the rows whose hash is not in the list this leaves in `<out>/bodies-pre.json`. */
|
|
30
|
-
export declare function dumpBodiesPre(out: string): Promise<{
|
|
31
|
-
parts: string[];
|
|
32
|
-
count: number;
|
|
33
|
-
}>;
|
|
34
|
-
export declare function dumpRows(out: string, kind: SourceJson['kind'], maxPageRows?: number): Promise<DumpResult>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var Q=Object.defineProperty;var s=(t,e)=>Q(t,"name",{value:e,configurable:!0});import{mkdirSync as Z,readFileSync as $,writeFileSync as K}from"node:fs";import{join as w}from"node:path";import{openDb as ee,withCanvasWrite as te}from"../../canvas/db.js";import{hashOf as re}from"../../graph/bodies.js";import{personIdAsync as ne}from"../../canvas/person.js";import{CANVAS_SCHEMA_VERSION as ae}from"../../canvas/schema-version.js";import{crtrVersion as se}from"../../../shared/crtr-version.js";import{BODIES_TABLE as O,DUMPED_TABLES as k,RowFileWriter as oe,SEQ_TABLES as ie,rowLine as W}from"../bundle/layout.js";import{inlineMessageBody as ce}from"./inline.js";const le=16*1024*1024,he=8*1024*1024,Y=32*1024*1024,de=500,j=5e3,g="bodies-pre.json";class v{static{s(this,"PartWriter")}dir;prefix;parts=[];file=null;constructor(e,a){this.dir=e,this.prefix=a,Z(e,{recursive:!0})}async add(e){const a=Buffer.byteLength(e,"utf8");if(this.file!==null&&this.file.bytes>0&&this.file.bytes+a>le&&await this.close(),this.file===null){const o=`${this.prefix}${this.parts.length}`;this.file=new oe(w(this.dir,`${o}.jsonl.zst`)),this.parts.push(o)}await this.file.write(e,a)}async close(){const e=this.file;this.file=null,e!==null&&await e.close()}destroy(){this.file?.destroy(),this.file=null}}const b=s(t=>`"${t.replace(/"/g,'""')}"`,"q");function pe(t){try{const e=$(t,"utf8");return e.trim()===""?null:e}catch(e){if(e.code==="ENOENT")return null;throw e}}s(pe,"readText");function ue(t,e){return new Error(`revision text ${t} is ${e} bytes; the import carries at most ${Y} bytes of text per body`)}s(ue,"tooLarge");function Ee(t){const e=re(t.text);if(e!==t.hash)throw new Error(`body ${t.hash} does not hash to its key (its text hashes to ${e}); upgrade and restart the daemon so its boot repair rekeys the row, then export again`)}s(Ee,"assertCanonical");async function H(t,e,a,o){const n=new v(w(e,"rows",O),`${a}-`),y=s(async i=>{Ee(i),await n.add(W(i))},"add");try{for(let i=0;i<o.length;){const S=await t.prepare("SELECT hash, octet_length(text) AS n FROM bodies WHERE hash = ANY(?::text[]) ORDER BY hash").all(o.slice(i,i+j));let h=[],u=0;const m=s(async()=>{if(h.length===0)return;const l=await t.prepare("SELECT hash, text FROM bodies WHERE hash = ANY(?::text[]) ORDER BY hash").all(h);for(const d of l)await y(d);h=[],u=0},"fetchPage");for(const{hash:l,n:d}of S){const p=Number(d);if(p>Y)throw ue(l,p);h.length>0&&u+p>he&&await m(),h.push(l),u+=p}await m(),i+=j}await n.close()}catch(i){throw n.destroy(),i}return n.parts}s(H,"writeBodyParts");const P=s(async t=>(await t.prepare("SELECT hash FROM bodies ORDER BY hash").all()).map(e=>e.hash),"allHashes");async function Le(t){const e=await ee(),a=await P(e),o=await H(e,t,"pre",a),n={hashes:a,parts:o,count:a.length,canonical:!0};return K(w(t,g),JSON.stringify(n)),{parts:o,count:a.length}}s(Le,"dumpBodiesPre");function fe(t){try{return JSON.parse($(w(t,g),"utf8"))}catch(e){if(e.code==="ENOENT")return{hashes:[],parts:[],count:0};throw e}}s(fe,"readPre");function we(t,e){if(t.count===0&&t.parts.length===0)return;if(t.canonical!==!0)throw new Error(`${g} was written before bodies were checked against their keys; discard the export directory and run the pre-pause dump again`);const a=t.hashes.filter(o=>!e.has(o));if(a.length>0)throw new Error(`the pre-pause dump holds ${a.length} body row(s) the database no longer has (first: ${a[0]}); the boot repair ran after it. Discard the export directory and run the pre-pause dump again`)}s(we,"assertPreCurrent");async function Ae(t,e,a=de){const o=await ne();return te(async n=>{await n.exec("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ");const y=new Set((await n.prepareUncached("SELECT table_name FROM information_schema.tables WHERE table_schema = current_schema()").all()).map(r=>r.table_name)),i=k.filter(r=>!y.has(r));if(i.length>0)throw new Error(`the canvas database lacks tables the bundle needs: ${i.join(", ")}`);const S=await n.prepareUncached(`SELECT c.conrelid::regclass::text AS tbl, (SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(c.conkey) WITH ORDINALITY k(attnum, ord)
|
|
2
|
-
JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = k.attnum) AS cols FROM pg_constraint c WHERE c.contype = 'p' AND c.connamespace = current_schema()::regnamespace`).all(),h=new Map(S.map(r=>[r.tbl.replace(/"/g,"").replace(/^.*\./,""),r.cols])),u=await n.prepareUncached("SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = current_schema() ORDER BY table_name, ordinal_position").all(),m=new Set(ie),l={},d={};let p=0,T=0;for(const r of k.filter(E=>E!==O)){const E=m.has(r)?["seq"]:h.get(r),D=E!==void 0&&E.length>0?E.map(c=>`t.${b(c)}`):u.filter(c=>c.table_name===r).map(c=>`t.${b(c.column_name)}::text`);if(D.length===0)throw new Error(`table ${r} has no columns to order its dump by`);const _=new v(w(t,"rows",r),"");let F=0;try{for(await n.exec(`DECLARE dump_cursor NO SCROLL CURSOR FOR SELECT row_to_json(t)::text AS j FROM ${b(r)} t ORDER BY ${D.join(", ")}`);;){const c=await n.prepareUncached(`FETCH FORWARD ${a} FROM dump_cursor`).all();for(const G of c){let f=JSON.parse(G.j);if(r==="messages"){const I=f.body_ref,M=ce(f,pe);typeof I=="string"&&I.startsWith("/")&&(M===f?T+=1:p+=1),f=M}await _.add(W(f))}if(F+=c.length,c.length<a)break}await n.exec("CLOSE dump_cursor"),await _.close()}catch(c){throw _.destroy(),c}l[r]=F,d[r]=_.parts}const N=(await n.prepare("SELECT value FROM canvas_meta WHERE key = 'install_id'").get())?.value;if(N===void 0)throw new Error("this canvas database has no install id");const L=await n.prepare("SELECT object FROM environments WHERE kind = 'machine' ORDER BY object LIMIT 1").get(),A={installId:N,kind:e,person:o,release:se(),schemaVersion:ae,counts:l,rowParts:d,...L===void 0?{}:{environmentObject:L.object}},q=await n.prepare("SELECT request_id, request_dir, file FROM human_requests ORDER BY request_id").all(),J=await n.prepare(`SELECT d.object, r.body_hash FROM documents d JOIN revisions r ON r.document = d.object
|
|
3
|
-
WHERE d.source_path IS NOT NULL AND NOT EXISTS (SELECT 1 FROM revision_parents p WHERE p.parent = r.rev_id) ORDER BY d.object, r.number DESC, r.rev_id`).all(),C={};for(const r of J)C[r.object]??=r.body_hash;const R=fe(t),U=new Set(R.hashes),x=await P(n);we(R,new Set(x));const B=x.filter(r=>!U.has(r)),V=await H(n,t,"pause",B),z=R.count+B.length;l[O]=z,d[O]=[...R.parts,...V];const X=await n.prepare(`SELECT n.node_id, r.grantee, n.cwd, w.path AS worktree FROM nodes n JOIN node_rows r ON r.node_id = n.node_id LEFT JOIN worktrees w ON w.node_id = n.node_id AND w.state = 'open'
|
|
4
|
-
WHERE n.status IN ('active', 'idle') ORDER BY n.node_id`).all();return A.shippedBodies=C,{source:A,requests:q.map(r=>({id:r.request_id,dir:r.request_dir,file:r.file})),runningNodes:X.map(r=>({node:r.node_id,app:r.grantee,cwd:r.cwd,worktree:r.worktree})),bodiesInlined:p,bodiesMissing:T}})}s(Ae,"dumpRows");export{Y as BODY_MAX_BYTES,le as PART_JSON_BYTES,Le as dumpBodiesPre,Ae as dumpRows};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ImportCloud } from './cloud.js';
|
|
2
|
-
export interface LocalObject {
|
|
3
|
-
key: string;
|
|
4
|
-
path: string;
|
|
5
|
-
}
|
|
6
|
-
/** Every file the runtime holds that the cloud serves from a blob key. */
|
|
7
|
-
export declare function localObjects(): LocalObject[];
|
|
8
|
-
/** The reviewed file of a review that lies outside the review's own directory, at the key the lane rewrites `file` to. */
|
|
9
|
-
export declare function reviewSourceObject(requestId: string, requestDir: string, file: string | null): LocalObject | null;
|
|
10
|
-
export declare class Uploader {
|
|
11
|
-
private readonly cloud;
|
|
12
|
-
private readonly run;
|
|
13
|
-
private readonly progress;
|
|
14
|
-
private readonly sent;
|
|
15
|
-
uploaded: number;
|
|
16
|
-
missing: string[];
|
|
17
|
-
constructor(cloud: ImportCloud, run: string, progress: (line: string) => void);
|
|
18
|
-
/** Upload source blobs, each to `imports/<run>/blobs/<its key>`: the upload route signs only under the run's own prefix, and the lane moves each blob to its key. */
|
|
19
|
-
upload(objects: readonly LocalObject[]): Promise<void>;
|
|
20
|
-
private freshUrl;
|
|
21
|
-
/** Upload bytes held in memory (row files, source.json, node archives). */
|
|
22
|
-
uploadBytes(key: string, data: Buffer): Promise<void>;
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var N=Object.defineProperty;var a=(i,e)=>N(i,"name",{value:e,configurable:!0});import{readFileSync as j,readdirSync as M,statSync as R}from"node:fs";import{basename as z,join as w,relative as S,sep as T}from"node:path";import{runtimeRoot as x}from"../../layout.js";import{bundleKeys as k}from"../bundle/layout.js";import{runBlobKey as O}from"../bundle/blob-keys.js";function y(i,e,t=i){let n;try{n=M(i,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;throw o}for(const o of n){const u=w(i,o.name);o.isDirectory()?y(u,e,t):o.isFile()&&!o.name.endsWith(".tmp")&&!o.name.includes(".tmp-")&&e(u,S(t,u).split(T).join("/"))}}a(y,"walk");function _(){const i=x(),e=[];y(w(i,"blobs"),(t,n)=>e.push({key:n,path:t}));for(const t of["requests","reviews"])y(w(i,t),(n,o)=>{const[u,...c]=o.split("/");c.length>0&&e.push({key:k.request(u,c.join("/")),path:n})});return e}a(_,"localObjects");function Y(i,e,t){return t===null||!t.startsWith("/")||t.startsWith(e.endsWith("/")?e:`${e}/`)?null:{key:k.request(i,`source/${z(t)}`),path:t}}a(Y,"reviewSourceObject");const d=100,L=128,v=128*1024*1024;class K{static{a(this,"Uploader")}cloud;run;progress;sent=new Map;uploaded=0;missing=[];constructor(e,t,n){this.cloud=e,this.run=t,this.progress=n}async upload(e){const t=[];for(const r of e){let s;try{s=R(r.path)}catch(h){if(h.code==="ENOENT"){this.missing.push(r.path);continue}throw h}const l=`${s.size}:${s.mtimeMs}`;this.sent.get(r.key)!==l&&t.push({...r,stamp:l,size:s.size})}const n=new Map,o=a(r=>{let s=n.get(r);return s===void 0&&(s=this.cloud.uploadUrls(this.run,t.slice(r*d,(r+1)*d).map(l=>O(this.run,l.key))).then(l=>l.urls),s.catch(()=>{}),n.set(r,s)),s},"urlsFor");let u=0,c=!1,p=0,m=[];const g=a(()=>{const r=m;m=[];for(const s of r)s()},"wake"),$=a(async()=>{try{for(;!c&&u<t.length;){const r=u++,s=t[r],l=Math.floor(r/d);n.delete(l-1),(l+1)*d<t.length&&o(l+1);const h=O(this.run,s.key),U=(await o(l))[h];if(U===void 0)throw new Error(`no upload URL returned for ${s.key}`);for(;!c&&p>0&&p+s.size>v;)await new Promise(f=>m.push(f));if(c)return;p+=s.size;try{let f;try{f=j(s.path)}catch(E){if(E.code==="ENOENT"){this.missing.push(s.path);continue}throw E}await this.cloud.put(U,f,h,()=>this.freshUrl(h))}finally{p-=s.size,g()}this.sent.set(s.key,s.stamp),this.uploaded+=1,this.uploaded%d===0&&this.progress(`uploaded ${this.uploaded}`)}}catch(r){throw c=!0,g(),r}},"worker"),b=await Promise.allSettled(Array.from({length:Math.min(L,t.length)},$));for(const r of b)if(r.status==="rejected")throw r.reason;t.length>0&&this.progress(`uploaded ${t.length}/${t.length}`)}async freshUrl(e){const t=(await this.cloud.uploadUrls(this.run,[e])).urls[e];if(t===void 0)throw new Error(`no upload URL returned for ${e}`);return t}async uploadBytes(e,t){await this.cloud.put(await this.freshUrl(e),t,e,()=>this.freshUrl(e))}}export{K as Uploader,_ as localObjects,Y as reviewSourceObject};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var r=(t,e)=>f(t,"name",{value:e,configurable:!0});function i(t,e){const o=t.body_ref;if(typeof o!="string"||!o.startsWith("/"))return t;const s=e(o);if(s===null)return t;const n=t.body_json,y=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{};return{...t,body_ref:null,body_json:{...y,body_full:s}}}r(i,"inlineMessageBody");export{i as inlineMessageBody};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=Object.defineProperty;var e=(t,n)=>o(t,"name",{value:n,configurable:!0});function u(t,n){return{...t,...n.length>0?{pathPrefixes:[...n]}:{}}}e(u,"buildSourceJson");export{u as buildSourceJson};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ImportAuthStoreDTO, ImportCredentialsStoreDTO, ImportEnvStoreDTO, ImportPluginsStoreDTO, ImportSettingsStoreDTO } from '../../../api/dto/imports.js';
|
|
2
|
-
export interface ExportedStores {
|
|
3
|
-
auth: ImportAuthStoreDTO;
|
|
4
|
-
credentials: ImportCredentialsStoreDTO;
|
|
5
|
-
env: ImportEnvStoreDTO;
|
|
6
|
-
settings: ImportSettingsStoreDTO;
|
|
7
|
-
plugins: ImportPluginsStoreDTO;
|
|
8
|
-
}
|
|
9
|
-
export declare function readStores(): Promise<ExportedStores>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var w=Object.defineProperty;var d=(r,t)=>w(r,"name",{value:t,configurable:!0});import{openDb as k}from"../../canvas/db.js";import{personIdAsync as h}from"../../canvas/person.js";import{loadSecretsKey as y,open as c}from"../../secrets/index.js";import{aadOf as S}from"../../subscription-state.js";import{aadOf as O}from"../../secrets/env-rows.js";const a=d(r=>r==null?null:String(r),"str"),o=d(r=>Number(r??0),"num");async function W(){const r=await h(),t=await k(),_=y(),u={};for(const e of await t.prepare("SELECT provider_id, credential_sealed, key_id FROM model_api_keys WHERE person = ? ORDER BY provider_id").all(r)){const i=String(e.provider_id);u[i]=JSON.parse(c(e.credential_sealed,String(e.key_id),_,`model_api_keys|${r}|${i}`))}const R=await t.prepare("SELECT provider_id, account_id, family, rate_limited_until, last_rate_limited_at FROM model_account_cooldowns WHERE person = ? ORDER BY family").all(r),E=[];for(const e of await t.prepare("SELECT * FROM model_accounts WHERE person = ? ORDER BY provider_id, position").all(r)){const i=String(e.provider_id),l=String(e.id);if(e.refresh_sealed===null||e.access_sealed===null||e.key_id===null)throw new Error(`managed ${i} account ${l} has no credential record`);const g=String(e.key_id);E.push({provider:i,id:l,label:String(e.label),labelKey:String(e.label_key),position:o(e.position),lastAttemptAt:o(e.last_attempt_at),lastRateLimitedAt:o(e.last_rate_limited_at),rateLimitedUntil:o(e.rate_limited_until),...e.auth_failure==="invalid_grant"?{authFailure:"invalid_grant"}:{},refresh:c(e.refresh_sealed,g,_,S(r,i,l,"refresh")),access:c(e.access_sealed,g,_,S(r,i,l,"access")),expires:o(e.expires),...a(e.vendor_account_id)===null?{}:{accountId:a(e.vendor_account_id)},...a(e.client_id)===null?{}:{clientId:a(e.client_id)},cooldowns:R.filter(s=>s.provider_id===i&&s.account_id===l).map(s=>({family:String(s.family),until:o(s.rate_limited_until),at:o(s.last_rate_limited_at)}))})}const n=await t.prepare("SELECT default_fallback_strength, revert_when_available, openai_device_id FROM model_settings WHERE person = ?").get(r),v={accounts:E,...n===void 0||n.default_fallback_strength===null&&n.revert_when_available===null?{}:{rotation:{defaultFallbackStrength:a(n.default_fallback_strength),revertWhenAvailable:n.revert_when_available===null?null:o(n.revert_when_available)===1}},...n===void 0||a(n.openai_device_id)===null?{}:{openaiDeviceId:a(n.openai_device_id)}},m={};for(const e of await t.prepare("SELECT owner_id, name, value_sealed, key_id FROM env_vars WHERE person = ? AND owner_kind = 'profile' ORDER BY owner_id, name").all(r)){const i=String(e.owner_id),l=String(e.name);(m[i]??={})[l]=c(e.value_sealed,String(e.key_id),_,O({person:r,kind:"profile",id:i},l))}const p={settings:{},state:{},profileProjects:{},defaults:{}};for(const e of await t.prepare("SELECT owner_key, raw_json FROM scope_settings WHERE person = ?").all(r))p.settings[String(e.owner_key)]=JSON.parse(String(e.raw_json));for(const e of await t.prepare("SELECT owner_key, last_self_check, active_canvas FROM scope_bookkeeping WHERE person = ?").all(r))p.state[String(e.owner_key)]={last_self_check:a(e.last_self_check),activeCanvas:a(e.active_canvas)};for(const e of await t.prepare(`SELECT profile_id, path, repo FROM (
|
|
2
|
-
SELECT pp.profile_id, pp.path, pp.repo, pp.position FROM profile_projects pp JOIN profiles p ON p.id = pp.profile_id WHERE p.person = ?
|
|
3
|
-
UNION ALL SELECT pr.profile_id, NULL AS path, pr.repo, pr.position FROM profile_project_repos pr JOIN profiles p ON p.id = pr.profile_id WHERE p.person = ?) e
|
|
4
|
-
ORDER BY profile_id, position`).all(r,r))(p.profileProjects[String(e.profile_id)]??=[]).push({...a(e.repo)===null?{}:{repo:a(e.repo)},...a(e.path)===null?{}:{path:a(e.path)}});for(const e of await t.prepare("SELECT directory, profile_id FROM profile_defaults WHERE person = ?").all(r))p.defaults[String(e.directory)]=String(e.profile_id);const f={marketplaces:[],plugins:[]};for(const e of await t.prepare("SELECT * FROM scope_marketplaces WHERE person = ? ORDER BY owner_key, name").all(r))f.marketplaces.push({owner:String(e.owner_key),name:String(e.name),url:a(e.url),ref:a(e.ref),installed_at:a(e.installed_at),last_updated:a(e.last_updated)});for(const e of await t.prepare("SELECT * FROM scope_plugins WHERE person = ? ORDER BY owner_key, name").all(r))f.plugins.push({owner:String(e.owner_key),name:String(e.name),enabled:o(e.enabled)===1,source_marketplace:a(e.source_marketplace),version:a(e.version),source_path:a(e.source_path),last_updated:a(e.last_updated),etag:a(e.etag),checked_at:a(e.checked_at)});return{auth:{apiKeys:u},credentials:v,env:{profiles:m},settings:p,plugins:f}}d(W,"readStores");export{W as readStores};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { CanvasDb } from '../../canvas/db.js';
|
|
2
|
-
import { type RewriteInput } from './rewrite.js';
|
|
3
|
-
/** A grant's or row's `sub` as the run sees it: the source's person is the run's, no other person is allowed. */
|
|
4
|
-
export declare function boundSub(sub: string, source: string, run: string, where: string): string;
|
|
5
|
-
/** Before anything is staged: the bundle's person has the shape of a person, and when it differs from the run's it is not already someone else in the target. */
|
|
6
|
-
export declare function checkSourcePerson(db: CanvasDb, target: string, source: string, run: string): Promise<void>;
|
|
7
|
-
/** After staging, before rewrite 1: every person the staged rows name is the bundle's or the run's. Drops the directory's own team facts
|
|
8
|
-
* (`crtr/group` relations). Returns rows dropped per table. */
|
|
9
|
-
export declare function checkStagedPersons(input: RewriteInput): Promise<Record<string, number>>;
|
|
10
|
-
/** After rewrite 2 and the drop: every reference from a staged row to a target row reaches a row the run's person owns or acts for (an app, a shipped
|
|
11
|
-
* document, the person's own object, an object with an `acts_for` fact for the person, an object a group the person is a member of is granted (a repo document its team shares), an object this person's earlier run of the same install inserted,
|
|
12
|
-
* or anything below those that is not directly under an app), and no profile or grant the rows name belongs to another person.
|
|
13
|
-
*
|
|
14
|
-
* The earlier run's objects are the person's by construction, and a re-load must accept them: the drop step removes every staged document the target already
|
|
15
|
-
* holds, so the bundle's edges to them reach the target's rows, and a soft-deleted document of a reaped node directly under an app has no `acts_for` fact to reach. */
|
|
16
|
-
export declare function checkStagedReferences(input: RewriteInput, own: {
|
|
17
|
-
installId: string;
|
|
18
|
-
person: string;
|
|
19
|
-
runId: string;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
/** Before `checkStagedReferences`: a staged row, in any table but `objects`, that names a target object `checkStagedReferences` would refuse (another account's: a shared
|
|
22
|
-
* repo document, a soft-deleted object of an earlier import from a different install) is dropped, with the rows that depend on it (the `deliveries` and `message_causes` of a
|
|
23
|
-
* dropped message, then every row whose foreign key names a dropped row). Ids with no target row keep the stub treatment. An `objects` row that names such an object (a
|
|
24
|
-
* document parented under it) is still refused. Returns rows dropped per table. */
|
|
25
|
-
export declare function dropForeignReferences(input: RewriteInput, own: {
|
|
26
|
-
installId: string;
|
|
27
|
-
person: string;
|
|
28
|
-
runId: string;
|
|
29
|
-
}): Promise<Record<string, number>>;
|
|
30
|
-
/** After staging, before rewrite 1: every blob key a staged row names has the shape its row would produce and an owner (node) that is in this bundle or is the
|
|
31
|
-
* importing person's own node in the target. A key naming a node of another person is `person_mismatch`; a key of no known shape is `bundle_invalid`. Without this,
|
|
32
|
-
* the importer's own node would read, and compaction would delete, a blob of someone else's conversation. (Human requests are checked by `checkStagedRequestKeys`,
|
|
33
|
-
* after their dirs are rewritten to blob keys.)
|
|
34
|
-
*
|
|
35
|
-
* A row whose owner node is in neither the bundle nor the target, and that no live row of the bundle holds, is what a deleted node left behind (the purge of a node
|
|
36
|
-
* keeps a conversation or attachment row and its blob; a deleted node's job rows stay too). It is dropped, not refused: a conversation no staged `sessions` row binds
|
|
37
|
-
* (its `conversation_parts` and `conversation_entries` rows), an `upload_uses` row whose `run_id` is not a node of the bundle, a `jobs` row whose job object is not
|
|
38
|
-
* owned by a node of the bundle. `moveRunBlobs` leaves the blob of such an owner where it was uploaded. A conversation's owner is the owner of its part keys; a
|
|
39
|
-
* `conversation_entries` row with no part names no owner and is copied as before. Returns rows dropped per table. */
|
|
40
|
-
export declare function checkStagedBlobKeys(input: RewriteInput): Promise<Record<string, number>>;
|
|
41
|
-
/** After rewrite 4b: a human request's `request_dir`, `presentation_dir` and `file` that are blob keys (`requests/…`) are under the request's own `requests/<its id>`. */
|
|
42
|
-
export declare function checkStagedRequestKeys(input: RewriteInput): Promise<void>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var P=Object.defineProperty;var i=(r,o)=>P(r,"name",{value:o,configurable:!0});import{parseBlobKey as R}from"../bundle/blob-keys.js";import{q as N}from"./catalog.js";import{decodeKeys as J}from"./copy.js";import{objectIdColumns as K}from"./rewrite.js";import{ImportLaneError as W}from"./stage.js";const Y=/^user:[A-Za-z0-9._-]+$/,k=i(r=>r.replace(/^user:/,""),"bare"),S=i((r,o)=>`${N(r)}.${N(o)}`,"sq"),m=i(async(r,o,...c)=>await r.prepareUncached(o).all(...c),"all");function T(r,o){return new W("bind","person_mismatch",r,o)}i(T,"mismatch");function ne(r,o,c,p){if(r===o||r===c)return c;throw T(`${p} names ${r}, which is neither the bundle's person nor the importing person`,{where:p,value:r})}i(ne,"boundSub");async function se(r,o,c,p){if(!Y.test(c))throw T(`the bundle's person ${JSON.stringify(c)} is not a user:<id> principal`,{where:"source.json person",value:c});if(c===p)return;const a=i(l=>S(o,l),"T"),n=await r.prepareUncached(`SELECT 'identities' AS tbl FROM ${a("identities")} WHERE scheme IN ('user', 'local-user') AND external_id = ?
|
|
2
|
-
UNION ALL SELECT 'grants' FROM ${a("grants")} WHERE sub = ? UNION ALL SELECT 'profiles' FROM ${a("profiles")} WHERE person = ?
|
|
3
|
-
UNION ALL SELECT 'nodes' FROM ${a("nodes")} WHERE sub = ? LIMIT 1`).get(c,c,c,c);if(n!==void 0)throw T(`the bundle's person ${c} is already a person in the target (${n.tbl}), not the importing person ${p}`,{where:`${n.tbl}`,value:c})}i(se,"checkSourcePerson");const B=[["nodes","sub"],["crons","sub"],["grants","sub"],["profiles","person"],["charges","sub"],["limits","sub"],["audit_rows","sub"],["provider_approvals","sub"],["uploads","sub"],["files","sub"],["shares","sub"]],G=[["charges","payer"],["limits","payer"],["audit_rows","payer"],["audit_rows","grantee"],["charges","grantee"],["run_events","grantee"],["idempotency_keys","grantee"],["uploads","grantee"],["files","grantee"],["provider_approvals","grantee"],["profiles","grantee"],["crons","grantee"]];async function re(r){const{db:o,schema:c,sourcePerson:p,targetPerson:a}=r,n=i(t=>S(c,t),"S"),l=i((t,s)=>{throw T(`${t} names ${s.join(", ")}, who is neither the bundle's person ${p} nor the importing person ${a}`,{where:t,values:s})},"refuse");for(const[t,s]of B){const _=await m(o,`SELECT DISTINCT ${N(s)} AS v FROM ${n(t)} WHERE ${N(s)} IS NOT NULL AND ${N(s)} <> '' AND ${N(s)} NOT IN (?, ?) LIMIT 5`,p,a);_.length>0&&l(`${t}.${s}`,_.map(h=>h.v))}for(const[t,s]of G){const _=await m(o,`SELECT DISTINCT ${N(s)} AS v FROM ${n(t)} WHERE ${N(s)} LIKE 'user:%' AND ${N(s)} NOT IN (?, ?) LIMIT 5`,p,a);_.length>0&&l(`${t}.${s}`,_.map(h=>h.v))}const f=await m(o,`SELECT DISTINCT external_id AS v FROM ${n("identities")} WHERE scheme IN ('user', 'local-user') AND external_id NOT IN (?, ?) LIMIT 5`,p,a);f.length>0&&l("identities.external_id",f.map(t=>t.v));const b=await m(o,`SELECT DISTINCT adapter_json::jsonb #>> '{principal,sub}' AS v FROM ${n("daemon_actions")}
|
|
4
|
-
WHERE adapter_json::jsonb #>> '{principal,sub}' IS NOT NULL AND adapter_json::jsonb #>> '{principal,sub}' NOT IN (?, ?) LIMIT 5`,p,a);b.length>0&&l("daemon_actions principal.sub",b.map(t=>t.v));const d=await m(o,`SELECT DISTINCT subject_id AS v FROM ${n("relations")} WHERE relation = 'acts_for' AND subject_type = 'user' AND subject_id NOT IN (?, ?) LIMIT 5`,k(p),k(a));d.length>0&&l("relations acts_for subject",d.map(t=>t.v));const E=Number((await o.prepareUncached(`DELETE FROM ${n("relations")} WHERE resource_type = 'crtr/group'`).run()).changes);return E>0?{relations:E}:{}}i(re,"checkStagedPersons");async function z(r,o){return(await m(r,`SELECT m.inserted_keys FROM import_manifest m JOIN import_runs r ON r.run_id = m.run_id
|
|
5
|
-
WHERE m.table_name = 'objects' AND r.source_install_id = ? AND r.person = ? AND r.run_id <> ? AND r.state IN ('committed', 'done', 'failed')`,o.installId,o.person,o.runId)).flatMap(p=>J(p.inserted_keys).map(a=>a[0]))}i(z,"earlierImportedObjects");async function ae(r,o){const{db:c,schema:p,catalog:a,targetPerson:n}=r,l=await H(r,o);if(l.length>0)throw T(`the bundle refers to objects that are not ${n}'s: ${l.slice(0,10).map(f=>`${f.tbl}.${f.col}=${f.value}`).join(", ")}`,{references:l.slice(0,10)});await V(r)}i(ae,"checkStagedReferences");async function ie(r,o){const{db:c,schema:p,catalog:a}=r,n=i(t=>S(p,t),"S"),l=(await H(r,o)).filter(t=>t.tbl!=="objects"),f={},b=new Map;for(const t of l){const s=`${t.tbl}.${t.col}`;b.has(s)||b.set(s,{tbl:t.tbl,col:t.col,values:new Set}),b.get(s).values.add(t.value)}const d=i(t=>{const s=a.tables.get(t)?.primaryKey??[];return s.length===1?N(s[0]):null},"keysOf"),E=i(async(t,s,..._)=>{const h=d(t),g=await c.prepareUncached(`DELETE FROM ${n(t)} WHERE ${s} RETURNING ${h===null?"1 AS k":`${h}::text AS k`}`).all(..._);if(g.length===0||(f[t]=(f[t]??0)+g.length,h===null))return;const L=g.map($=>$.k),O=a.foreignKeys.filter($=>$.parent===t&&$.columns.length===1&&$.parentColumns.length===1&&$.parentColumns[0]===h.replace(/"/g,"")&&a.tables.has($.table));for(const $ of O)await E($.table,`${N($.columns[0])}::text = ANY(?::text[])`,L);if(t==="messages")for(const $ of["deliveries","message_causes"])a.tables.has($)&&!O.some(j=>j.table===$)&&await E($,"message_id = ANY(?::text[])",L)},"removeWhere");for(const{tbl:t,col:s,values:_}of b.values()){if(!a.tables.has(t))continue;const h=t==="relations"?" AND resource_type = 'crtr/object'":"";await E(t,`${N(s)}::text = ANY(?::text[])${h}`,[..._])}return f}i(ie,"dropForeignReferences");async function H(r,o){const{db:c,schema:p,target:a,catalog:n,targetPerson:l}=r,f=i(_=>S(p,_),"S"),b=i(_=>S(a,_),"T"),d=k(l);await c.exec(`CREATE TABLE ${f("_refs")} (tbl text NOT NULL, col text NOT NULL, value text NOT NULL)`);const E=[];for(const[_,h]of K(n))if(!(!n.tables.has(_)||_==="relations"))for(const g of h)!(_==="nodes"&&g==="profile_id")&&!(_==="crons"&&g==="profile")&&E.push([_,g,""]);E.push(["relations","resource_id","WHERE resource_type = 'crtr/object'"]);for(const[_,h,g]of E)await c.prepareUncached(`INSERT INTO ${f("_refs")} SELECT ?, ?, ${N(h)}::text FROM ${f(_)} ${g===""?"WHERE":`${g} AND`} ${N(h)} IS NOT NULL
|
|
6
|
-
AND ${N(h)}::text NOT IN (SELECT id FROM ${f("objects")}) AND ${N(h)}::text IN (SELECT id FROM ${b("objects")})`).run(_,h);const t=await z(c,o),s=await m(c,`WITH RECURSIVE chain(start, id) AS (
|
|
7
|
-
SELECT DISTINCT value, value FROM ${f("_refs")}
|
|
8
|
-
UNION SELECT c.start, o.owner FROM chain c JOIN ${b("objects")} o ON o.id = c.id JOIN ${b("objects")} up ON up.id = o.owner AND up.type <> 'app'),
|
|
9
|
-
ok(id) AS (
|
|
10
|
-
SELECT o.id FROM ${b("objects")} o WHERE o.type = 'app'
|
|
11
|
-
UNION SELECT d.object FROM ${b("documents")} d WHERE d.source_path IS NOT NULL
|
|
12
|
-
UNION SELECT i.object FROM ${b("identities")} i WHERE i.scheme IN ('user', 'local-user') AND i.external_id = ?
|
|
13
|
-
UNION SELECT r.resource_id FROM ${b("relations")} r WHERE r.resource_type = 'crtr/object' AND r.relation = 'acts_for' AND r.subject_type = 'user' AND r.subject_id = ?
|
|
14
|
-
UNION SELECT r.resource_id FROM ${b("relations")} r JOIN ${b("relations")} m ON m.resource_type = 'crtr/group' AND m.relation = 'member' AND m.resource_id = r.subject_id
|
|
15
|
-
AND m.subject_type = 'user' AND m.subject_id = ?
|
|
16
|
-
WHERE r.resource_type = 'crtr/object' AND r.relation IN ('reader', 'editor', 'messenger', 'user_of') AND r.subject_type = 'crtr/group' AND r.subject_relation = 'member'
|
|
17
|
-
UNION SELECT unnest(?::text[]))
|
|
18
|
-
SELECT r.tbl, r.col, r.value FROM ${f("_refs")} r
|
|
19
|
-
WHERE NOT EXISTS (SELECT 1 FROM chain c JOIN ok ON ok.id = c.id WHERE c.start = r.value)`,l,d,d,t);return await c.exec(`DROP TABLE ${f("_refs")}`),s}i(H,"foreignReferences");async function V(r){const{db:o,schema:c,target:p,targetPerson:a}=r,n=i(d=>S(c,d),"S"),l=i(d=>S(p,d),"T"),f=[["nodes","profile_id"],["crons","profile"],["profiles","id"]];for(const[d,E]of f){const t=await m(o,`SELECT DISTINCT s.${N(E)} AS v FROM ${n(d)} s JOIN ${l("profiles")} p ON p.id = s.${N(E)} WHERE p.person <> ? LIMIT 5`,a);if(t.length>0)throw T(`${d}.${E} names profiles that belong to another person: ${t.map(s=>s.v).join(", ")}`,{where:`${d}.${E}`,values:t.map(s=>s.v)})}for(const[d,E]of[["nodes","grant_id"],["crons","grant_id"]]){const t=await m(o,`SELECT DISTINCT s.${N(E)} AS v FROM ${n(d)} s JOIN ${l("grants")} g ON g.id = s.${N(E)} WHERE g.sub <> ? LIMIT 5`,a);if(t.length>0)throw T(`${d}.${E} names grants that belong to another person: ${t.map(s=>s.v).join(", ")}`,{where:`${d}.${E}`,values:t.map(s=>s.v)})}const b=await m(o,`SELECT DISTINCT d.adapter_json::jsonb #>> '{principal,grant_id}' AS v FROM ${n("daemon_actions")} d
|
|
20
|
-
JOIN ${l("grants")} g ON g.id = d.adapter_json::jsonb #>> '{principal,grant_id}' WHERE g.sub <> ? LIMIT 5`,a);if(b.length>0)throw T(`a queued action names grants that belong to another person: ${b.map(d=>d.v).join(", ")}`,{where:"daemon_actions principal.grant_id",values:b.map(d=>d.v)})}i(V,"checkStagedProfilesAndGrants");const D=i((r,o)=>new W("bind","bundle_invalid",r,o),"bundleInvalid");async function ce(r){const{db:o,schema:c,target:p,targetPerson:a}=r,n=i(e=>S(c,e),"S"),l=new Set((await m(o,`SELECT node_id AS v FROM ${n("nodes")}`)).map(e=>e.v)),f=await m(o,`SELECT conversation_id, seq::text AS seq, blob_key FROM ${n("conversation_parts")}`),b=await m(o,`SELECT run_id, path, blob_key FROM ${n("upload_uses")} WHERE blob_key IS NOT NULL`),d=await m(o,`SELECT object, output_key FROM ${n("jobs")} WHERE output_key IS NOT NULL`),E=i(e=>e.split("/")[1]??"","jobOwner"),t=i((e,u,w,I)=>{const F=R(u);if(F===null||F.kind!==w||I!==void 0&&u!==I)throw D(`${e} holds ${JSON.stringify(u)}, which is not a ${w} blob key${I===void 0?"":` of the shape ${I}`}`,{where:e,value:u})},"shaped");for(const e of f)if(t("conversation_parts.blob_key",e.blob_key,"conversation"),e.blob_key.split("/")[2]!==e.conversation_id)throw D(`conversation_parts.blob_key ${e.blob_key} is not under its conversation ${e.conversation_id}`,{where:"conversation_parts.blob_key",value:e.blob_key});for(const e of b)t("upload_uses.blob_key",e.blob_key,"attachment");for(const e of d)t("jobs.output_key",e.output_key,"job",`jobs/${E(e.output_key)}/${e.object}/output`);const s=new Set;for(const{blob_key:e}of f){const u=R(e);u!==null&&u.kind==="conversation"&&!l.has(u.owner)&&s.add(u.owner)}for(const{blob_key:e}of b){const u=R(e);u!==null&&u.kind==="attachment"&&!l.has(u.owner)&&s.add(u.owner)}for(const{output_key:e}of d)l.has(E(e))||s.add(E(e));const _=new Map((s.size===0?[]:await m(o,`SELECT node_id, sub FROM ${S(p,"nodes")} WHERE node_id = ANY(?::text[])`,[...s])).map(e=>[e.node_id,e.sub])),h=i(e=>l.has(e)||_.get(e)===a,"held"),g=i(e=>!l.has(e)&&!_.has(e),"gone"),L={},O=i((e,u)=>{u>0&&(L[e]=(L[e]??0)+u)},"count"),$=i(async(e,...u)=>Number((await o.prepareUncached(e).run(...u)).changes),"drop"),j=new Set((await m(o,`SELECT DISTINCT session_id AS v FROM ${n("sessions")} WHERE session_id IS NOT NULL`)).map(e=>e.v)),y=new Map;for(const{conversation_id:e,blob_key:u}of f){const w=R(u),I=y.get(e);I!==null&&(w===null||w.kind!=="conversation"?y.set(e,null):y.set(e,[...I??[],w.owner]))}const v=[...y].filter(([e,u])=>u!==null&&!j.has(e)&&u.every(g)).map(([e])=>e);v.length>0&&(O("conversation_parts",await $(`DELETE FROM ${n("conversation_parts")} WHERE conversation_id = ANY(?::text[])`,v)),O("conversation_entries",await $(`DELETE FROM ${n("conversation_entries")} WHERE conversation_id = ANY(?::text[])`,v)));const x=new Set(v),M=i((e,u)=>{const w=R(u).owner;if(!h(w))throw T(`${e} holds ${u}, which belongs to node ${w}, who is not in the bundle`,{where:e,value:u})},"owned");for(const e of f)x.has(e.conversation_id)||M("conversation_parts.blob_key",e.blob_key);const A=b.filter(e=>{const u=R(e.blob_key);return u!==null&&u.kind==="attachment"&&g(u.owner)&&!l.has(e.run_id)});A.length>0&&O("upload_uses",await $(`DELETE FROM ${n("upload_uses")} u USING unnest(?::text[], ?::text[]) d(run_id, path) WHERE u.run_id = d.run_id AND u.path = d.path`,A.map(e=>e.run_id),A.map(e=>e.path)));const U=new Set(A);for(const e of b)U.has(e)||M("upload_uses.blob_key",e.blob_key);const C=d.filter(e=>e.output_key===`jobs/${E(e.output_key)}/${e.object}/output`&&g(E(e.output_key)));C.length>0&&O("jobs",await $(`DELETE FROM ${n("jobs")} WHERE object = ANY(?::text[])`,C.map(e=>e.object)));const q=new Set(C);for(const e of d)q.has(e)||M("jobs.output_key",e.output_key);return L}i(ce,"checkStagedBlobKeys");async function le(r){const{db:o,schema:c}=r;for(const p of await m(o,`SELECT request_id, request_dir, presentation_dir, file FROM ${S(c,"human_requests")}`))for(const a of["request_dir","presentation_dir","file"]){const n=p[a];if(n===null||!n.startsWith("requests/"))continue;const l=R(n.includes("/",9)?n:`${n}/x`);if(l===null||l.kind!=="request")throw D(`human_requests.${a} holds ${JSON.stringify(n)}, which is not a request blob key`,{where:`human_requests.${a}`,value:n});if(l.owner!==p.request_id)throw T(`human_requests.${a} of ${p.request_id} holds ${n}, which belongs to request ${l.owner}`,{where:`human_requests.${a}`,value:n})}}i(le,"checkStagedRequestKeys");export{ne as boundSub,se as checkSourcePerson,ce as checkStagedBlobKeys,re as checkStagedPersons,ae as checkStagedReferences,le as checkStagedRequestKeys,ie as dropForeignReferences};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { BlobStore } from '../../blobs/index.js';
|
|
2
|
-
import type { CanvasDb } from '../../canvas/db.js';
|
|
3
|
-
export interface MovedBlobs {
|
|
4
|
-
moved: number;
|
|
5
|
-
left: number;
|
|
6
|
-
}
|
|
7
|
-
/** `created` collects the keys this call wrote, so the caller can delete them if the run fails before its copy commits. */
|
|
8
|
-
export declare function moveRunBlobs(db: CanvasDb, schema: string, target: string, person: string, blobs: BlobStore, runId: string, created: string[]): Promise<MovedBlobs>;
|
|
9
|
-
/** Delete the keys, concurrently. With `bestEffort`, a key that cannot be deleted is logged and skipped and the rest still go; otherwise the first failure is thrown. */
|
|
10
|
-
export declare function deleteBlobs(blobs: BlobStore, keys: readonly string[], bestEffort?: boolean): Promise<void>;
|
|
11
|
-
/** Delete every blob `moveRunBlobs` can have moved for these owners (the keys `parseBlobKey` accepts under each owner's prefixes): one paged listing per owner and kind, then the deletes, with no request per key to check. */
|
|
12
|
-
export declare function deleteOwnedBlobs(blobs: BlobStore, nodes: readonly string[], requests: readonly string[]): Promise<void>;
|
|
13
|
-
/** Delete the run's uploaded copies (after the run is done). */
|
|
14
|
-
export declare function deleteRunBlobs(blobs: BlobStore, runId: string): Promise<void>;
|
|
15
|
-
/** Delete everything the run uploaded under `imports/<run>/` once the run can never be loaded again. The node-file archives are kept (`keepNodeFiles`) for a run that failed after its
|
|
16
|
-
* copy committed: its `import_node_files` rows stay until rollback, and a hosted node's start reads the archive. By default a storage error is thrown (rollback reports it to its caller).
|
|
17
|
-
* With `bestEffort`, a run whose state is already settled keeps that state: a list error is logged, and a key that cannot be deleted is logged and skipped while the rest still go. */
|
|
18
|
-
export declare function deleteRunPrefix(blobs: BlobStore, runId: string, options?: {
|
|
19
|
-
keepNodeFiles?: boolean;
|
|
20
|
-
bestEffort?: boolean;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
/** A run that failed before its copy committed keeps its uploaded bundle so `crtr sys import retry` can load it again; the storage sweep deletes it this many days after the failure. */
|
|
23
|
-
export declare const FAILED_UPLOAD_RETENTION_DAYS = 7;
|
|
24
|
-
/** `import_runs.step` of a failed run whose kept upload the sweep deleted. */
|
|
25
|
-
export declare const UPLOAD_DELETED_STEP = "upload_deleted";
|
|
26
|
-
/** Deletes the kept uploads of runs that failed before their copy committed and have been failed for `FAILED_UPLOAD_RETENTION_DAYS`. Returns how many runs were cleared. */
|
|
27
|
-
export declare function sweepFailedUploads(db: CanvasDb, blobs: BlobStore, now: number): Promise<number>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var v=Object.defineProperty;var l=(e,t)=>v(e,"name",{value:t,configurable:!0});import{R2_MAX_CONNECTIONS as A}from"../../blobs/r2.js";import{ownerBlobPrefixes as O,parseBlobKey as R,runBlobPrefix as S}from"../bundle/blob-keys.js";import{bundleKeys as g}from"../bundle/layout.js";import{emitEvent as T}from"../../events/emit.js";import{q as m}from"./catalog.js";import{ImportLaneError as N}from"./stage.js";const M=A;function D(){const e=process.env.CRTR_IMPORT_BLOB_WORKERS;if(e===void 0||e==="")return M;const t=Number(e);if(!Number.isInteger(t)||t<1||t>1024)throw new Error(`CRTR_IMPORT_BLOB_WORKERS must be an integer from 1 to 1024, got ${JSON.stringify(e)}`);return t}l(D,"workerLimit");async function w(e,t){if(e.length===0)return;let i=0,n;const a=l(async()=>{for(;n===void 0&&i<e.length;)try{await t(e[i++])}catch(r){n??={error:r}}},"worker");if(await Promise.all(Array.from({length:Math.min(D(),e.length)},a)),n!==void 0)throw n.error}l(w,"forEachBounded");async function j(e,t,i,n,a,r,f){const p={nodes:new Set((await e.prepareUncached(`SELECT node_id AS v FROM ${m(t)}.nodes UNION SELECT node_id FROM ${m(i)}.nodes WHERE sub = ?`).all(n)).map(o=>o.v)),human_requests:new Set((await e.prepareUncached(`SELECT request_id AS v FROM ${m(t)}.human_requests`).all()).map(o=>o.v))},c=S(r),u={moved:0,left:0},d=[];for(const o of await a.listObjects(c)){const s=R(o.key.slice(c.length));s===null||!p[s.ownerTable].has(s.owner)?u.left+=1:d.push(o)}const h=new Map,E=new Set(d.map(o=>o.key.slice(c.length)));return await w([...new Set([...E].map(I))],async o=>{for(const s of await a.listObjects(o))E.has(s.key)&&h.set(s.key,s)}),await w(d,async o=>{const s=o.key.slice(c.length),y=h.get(s);if(y===void 0){if(f.push(s),!await a.copy(o.key,s))throw L(o.key)}else if(!await P(a,o,y))throw new N("blobs","unique_conflict",`${s} already exists with other contents; the import does not replace it`,{key:s});u.moved+=1}),u}l(j,"moveRunBlobs");const I=l(e=>e.split("/").slice(0,2).join("/")+"/","ownerPrefix"),L=l(e=>new N("blobs","bundle_invalid",`${e} was listed and is gone`),"gone");async function P(e,t,i){if(t.size!==i.size)return!1;if(t.etag!==null&&i.etag!==null)return t.etag===i.etag;for(let n=0;n<t.size;n+=k){const a={start:n,length:Math.min(k,t.size-n)},[r,f]=await Promise.all([e.get(t.key,a),e.get(i.key,a)]);if(r===null)throw L(t.key);if(f===null||!r.equals(f))return!1}return!0}l(P,"sameObject");const k=256*1024;async function _(e,t,i=!1){await w(t,i?n=>e.delete(n).catch(a=>{T({level:"warn",event:"import.blob_delete_failed",error:a,fields:{key:n}})}):n=>e.delete(n))}l(_,"deleteBlobs");async function z(e,t,i){const n=[...t.flatMap(r=>O("nodes",r).map(f=>({prefix:f,owner:r,table:"nodes"}))),...i.flatMap(r=>O("human_requests",r).map(f=>({prefix:f,owner:r,table:"human_requests"})))],a=[];await w(n,async({prefix:r,owner:f,table:p})=>{for(const c of await e.list(r)){const u=R(c);u!==null&&u.ownerTable===p&&u.owner===f&&a.push(c)}}),await _(e,a)}l(z,"deleteOwnedBlobs");async function H(e,t){await _(e,await e.list(S(t)))}l(H,"deleteRunBlobs");async function b(e,t,i={}){const n=`${g.prefix(t)}node-files/`;let a;try{a=await e.list(g.prefix(t))}catch(r){if(i.bestEffort!==!0)throw r;T({level:"warn",event:"import.prefix_delete_failed",error:r,fields:{run_id:t}});return}await _(e,i.keepNodeFiles===!0?a.filter(r=>!r.startsWith(n)):a,i.bestEffort===!0)}l(b,"deleteRunPrefix");const B=7,x="upload_deleted";async function J(e,t,i){const n=new Date(i-B*864e5).toISOString(),a=await e.prepare("SELECT run_id FROM import_runs WHERE state = 'failed' AND committed_at IS NULL AND finished_at IS NOT NULL AND finished_at <= ? AND step IS DISTINCT FROM ? LIMIT 20").all(n,x);for(const{run_id:r}of a)await b(t,r),await e.prepare("UPDATE import_runs SET step = ? WHERE run_id = ?").run(x,r);return a.length}l(J,"sweepFailedUploads");export{B as FAILED_UPLOAD_RETENTION_DAYS,x as UPLOAD_DELETED_STEP,_ as deleteBlobs,z as deleteOwnedBlobs,H as deleteRunBlobs,b as deleteRunPrefix,j as moveRunBlobs,J as sweepFailedUploads};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { CanvasDb } from '../../canvas/db.js';
|
|
2
|
-
/** `cascade`: the database deletes the row when its parent row goes (`ON DELETE CASCADE`). */
|
|
3
|
-
export interface ForeignKey {
|
|
4
|
-
table: string;
|
|
5
|
-
columns: string[];
|
|
6
|
-
parent: string;
|
|
7
|
-
parentColumns: string[];
|
|
8
|
-
cascade: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface UniqueKey {
|
|
11
|
-
table: string;
|
|
12
|
-
name: string;
|
|
13
|
-
columns: string[];
|
|
14
|
-
predicate: string | null;
|
|
15
|
-
}
|
|
16
|
-
/** The columns that identify a row of `info`: its primary key, or every column in order for a table with none (`memory_reads`). */
|
|
17
|
-
export declare const rowKey: (info: TableInfo) => string[];
|
|
18
|
-
/** `types` maps a column to its type name (`udt_name`), so a manifest key (the row key's columns as text) can be cast back and compared through the column's index. */
|
|
19
|
-
export interface TableInfo {
|
|
20
|
-
name: string;
|
|
21
|
-
columns: string[];
|
|
22
|
-
types: Record<string, string>;
|
|
23
|
-
primaryKey: string[];
|
|
24
|
-
identity: string[];
|
|
25
|
-
}
|
|
26
|
-
export interface Catalog {
|
|
27
|
-
schema: string;
|
|
28
|
-
tables: Map<string, TableInfo>;
|
|
29
|
-
foreignKeys: ForeignKey[];
|
|
30
|
-
uniqueKeys: UniqueKey[];
|
|
31
|
-
}
|
|
32
|
-
export declare const q: (name: string) => string;
|
|
33
|
-
/** True when `alias`'s `columns` equal the manifest key held in `keyColumn` (a jsonb array of the key's columns as text, `m.k`). Each column is compared as itself against the key's
|
|
34
|
-
* element cast to the column's type, so the table's index on the key serves the join; building the key from the table's rows instead would defeat every index. */
|
|
35
|
-
export declare const keyMatch: (info: TableInfo, columns: readonly string[], alias: string, keyColumn: string) => string;
|
|
36
|
-
/** Read the catalog of `schema` for `tables`. */
|
|
37
|
-
export declare function readCatalog(db: CanvasDb, schema: string, tables: readonly string[]): Promise<Catalog>;
|
|
38
|
-
/** Parents before children. Cycles (none in the schema today) are broken by the table list's order. */
|
|
39
|
-
export declare function topologicalOrder(catalog: Catalog, tables: readonly string[]): string[];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var c=(a,n)=>g(a,"name",{value:n,configurable:!0});const x=c(a=>a.primaryKey.length>0?a.primaryKey:a.columns,"rowKey"),u=c(a=>`"${a.replace(/"/g,'""')}"`,"q"),_=c((a,n,l,r)=>n.map((s,o)=>`${l}.${u(s)} = (${r} ->> ${o})::${u(a.types[s])}`).join(" AND "),"keyMatch");async function N(a,n,l){const r=[...l],s=await a.prepareUncached(`SELECT table_name, column_name, is_identity, udt_name FROM information_schema.columns
|
|
2
|
-
WHERE table_schema = ? AND table_name = ANY(?::text[]) ORDER BY table_name, ordinal_position`).all(n,`{${r.map(e=>`"${e}"`).join(",")}}`),o=new Map;for(const e of r)o.set(e,{name:e,columns:[],types:{},primaryKey:[],identity:[]});for(const e of s){const i=o.get(e.table_name);i.columns.push(e.column_name),i.types[e.column_name]=e.udt_name,e.is_identity==="YES"&&i.identity.push(e.column_name)}const d=await a.prepareUncached(`SELECT c.conrelid::regclass::text AS tbl, c.contype, c.conname,
|
|
3
|
-
(SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(c.conkey) WITH ORDINALITY k(attnum, ord) JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = k.attnum) AS cols,
|
|
4
|
-
c.confrelid::regclass::text AS ptbl, c.confdeltype = 'c' AS cascade,
|
|
5
|
-
(SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(c.confkey) WITH ORDINALITY k(attnum, ord) JOIN pg_attribute a ON a.attrelid = c.confrelid AND a.attnum = k.attnum) AS pcols
|
|
6
|
-
FROM pg_constraint c WHERE c.connamespace = ?::regnamespace AND c.contype IN ('p', 'f')`).all(n),p=c(e=>e.replace(/^.*\./,"").replace(/"/g,""),"bare"),t=[];for(const e of d){const i=p(e.tbl);o.has(i)&&(e.contype==="p"?o.get(i).primaryKey=e.cols:o.has(p(e.ptbl))&&t.push({table:i,columns:e.cols,parent:p(e.ptbl),parentColumns:e.pcols,cascade:e.cascade===!0}))}const y=(await a.prepareUncached(`SELECT t.relname AS tbl, i.relname AS name, pg_get_expr(x.indpred, x.indrelid) AS predicate, x.indexprs IS NOT NULL AS has_expr,
|
|
7
|
-
(SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(x.indkey::int2[]) WITH ORDINALITY k(attnum, ord) JOIN pg_attribute a ON a.attrelid = x.indrelid AND a.attnum = k.attnum) AS cols
|
|
8
|
-
FROM pg_index x JOIN pg_class t ON t.oid = x.indrelid JOIN pg_class i ON i.oid = x.indexrelid
|
|
9
|
-
WHERE t.relnamespace = ?::regnamespace AND x.indisunique AND NOT x.indisprimary`).all(n)).filter(e=>o.has(e.tbl)&&!e.has_expr).map(e=>({table:e.tbl,name:e.name,columns:e.cols,predicate:e.predicate}));return{schema:n,tables:o,foreignKeys:t,uniqueKeys:y}}c(N,"readCatalog");function O(a,n){const l=new Set(n),r=new Map(n.map(t=>[t,new Set]));for(const t of a.foreignKeys)l.has(t.table)&&l.has(t.parent)&&t.table!==t.parent&&r.get(t.table).add(t.parent);const s=[],o=new Set,d=new Set,p=c(t=>{if(!(o.has(t)||d.has(t))){d.add(t);for(const m of[...r.get(t)].sort())p(m);d.delete(t),o.add(t),s.push(t)}},"visit");for(const t of n)p(t);return s}c(O,"topologicalOrder");export{_ as keyMatch,u as q,N as readCatalog,x as rowKey,O as topologicalOrder};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CanvasDb } from '../../canvas/db.js';
|
|
2
|
-
import { type PathMap } from '../bundle/layout.js';
|
|
3
|
-
import { type Catalog } from './catalog.js';
|
|
4
|
-
import type { IdMap } from './rewrite.js';
|
|
5
|
-
import type { SourceJson } from '../bundle/layout.js';
|
|
6
|
-
export interface CopyResult {
|
|
7
|
-
inserted: Record<string, number>;
|
|
8
|
-
mapped: Record<string, number>;
|
|
9
|
-
}
|
|
10
|
-
/** `import_manifest.inserted_keys`: a zstd-compressed JSON array of primary-key tuples (each value as text). */
|
|
11
|
-
export declare const encodeKeys: (keys: string[][]) => Buffer;
|
|
12
|
-
export declare const decodeKeys: (data: Buffer) => string[][];
|
|
13
|
-
export declare function nodesAwaitingVerify(db: CanvasDb): Promise<Set<string>>;
|
|
14
|
-
export interface CopyInput {
|
|
15
|
-
db: CanvasDb;
|
|
16
|
-
runId: string;
|
|
17
|
-
schema: string;
|
|
18
|
-
target: string;
|
|
19
|
-
catalog: Catalog;
|
|
20
|
-
source: SourceJson;
|
|
21
|
-
person: string;
|
|
22
|
-
idMap: IdMap;
|
|
23
|
-
pathMap: PathMap;
|
|
24
|
-
}
|
|
25
|
-
export declare const copyOrder: (catalog: Catalog) => string[];
|
|
26
|
-
/** Must run inside `withCanvasWrite`. */
|
|
27
|
-
export declare function copyRows(input: CopyInput): Promise<CopyResult>;
|
|
28
|
-
/** Adds keys to a table's manifest row, creating it when the copy inserted no row of that table. */
|
|
29
|
-
export declare function appendManifest(tx: CanvasDb, runId: string, table: string, keys: string[][]): Promise<void>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var W=Object.defineProperty;var E=(r,t)=>W(r,"name",{value:t,configurable:!0});import{zstdCompressSync as v,zstdDecompressSync as q}from"node:zlib";import{BODIES_TABLE as b,COPIED_TABLES as P,KEY_MAPPED_TABLES as k}from"../bundle/layout.js";import{q as s,rowKey as G,topologicalOrder as V}from"./catalog.js";import{fillEnvironments as Y}from"./prepare.js";import{ImportLaneError as D}from"./stage.js";import{encodeKeyBatches as J}from"./keys.js";const M=2e4,U=E((r,t)=>`${s(r)}.${s(t)}`,"sq"),$=E(r=>v(Buffer.from(JSON.stringify(r))),"encodeKeys"),F=E(r=>JSON.parse(q(r).toString("utf8")),"decodeKeys"),H=new Map;async function ae(r){const t=await r.prepare("SELECT run_id FROM import_runs WHERE state = 'committed' OR (state = 'failed' AND committed_at IS NOT NULL)").all(),i=new Set;for(const{run_id:p}of t){let m=H.get(p);if(m===void 0){const u=await r.prepare("SELECT inserted_keys FROM import_manifest WHERE run_id = ? AND table_name = 'nodes'").get(p);if(u===void 0)continue;m=new Set(F(u.inserted_keys).map(N=>N[0])),H.set(p,m)}for(const u of m)i.add(u)}return i}E(ae,"nodesAwaitingVerify");const K=E(r=>V(r,P),"copyOrder");async function se(r){const{db:t,runId:i,schema:p,target:m,catalog:u,source:N}=r,o=E(e=>U(p,e),"S"),l=E(e=>U(m,e),"T"),O={inserted:{},mapped:{}},x=E(async(e,n)=>{O.inserted[e]=n.length,await t.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?)").run(i,e,$(n))},"manifest"),w=E(async(e,n,T)=>(await t.exec(`DROP TABLE IF EXISTS ${o("_ord")}; CREATE TABLE ${o("_ord")} AS SELECT s.ctid AS row_id, (row_number() OVER (ORDER BY ${n}))::bigint AS n FROM ${o(e)} s${T}; CREATE INDEX ON ${o("_ord")} (n)`),Number((await t.prepareUncached(`SELECT count(*) AS n FROM ${o("_ord")}`).get()).n)),"number"),A=E(async(e,n,T,c=!0)=>{let f=0;const R=(async function*(){for(let _=0;_<n;_+=M){const d=await T(_,_+M);f+=d.length,yield d}})(),S=await J(R);return c&&await t.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?)").run(i,e,S),f},"inBatches");for(const[e,n]of Object.entries(k)){const c=u.tables.get(e).columns.filter(S=>S!==n),f=await w(e,`s.${s(n)}::bigint`,""),R=await A(e,f,async(S,_)=>(await t.prepareUncached(`WITH src AS MATERIALIZED (
|
|
2
|
-
SELECT s.source_key, nextval(pg_get_serial_sequence(?, ?)::regclass) AS target_key, ${c.map(d=>`s.${s(d)}`).join(", ")}
|
|
3
|
-
FROM (SELECT s.${s(n)}::text AS source_key, ${c.map(d=>`s.${s(d)}`).join(", ")}, o.n FROM ${o(e)} s JOIN ${o("_ord")} o ON o.row_id = s.ctid WHERE o.n > ${S} AND o.n <= ${_} ORDER BY o.n) s),
|
|
4
|
-
ins AS (INSERT INTO ${l(e)} (${s(n)}, ${c.map(s).join(", ")}) SELECT target_key, ${c.map(s).join(", ")} FROM src RETURNING 1),
|
|
5
|
-
km AS (INSERT INTO import_key_map (source_install_id, table_name, source_key, target_key) SELECT ?, ?, source_key, target_key::text FROM src RETURNING target_key)
|
|
6
|
-
SELECT target_key FROM km ORDER BY target_key::bigint`).all(l(e),n,N.installId,e)).map(d=>[d.target_key]));O.inserted[e]=R}await t.prepareUncached(`UPDATE ${o("review_comments")} c SET created_seq = m.target_key::bigint FROM import_key_map m
|
|
7
|
-
WHERE m.source_install_id = ? AND m.table_name = 'review_comment_events' AND m.source_key = c.created_seq::text`).run(N.installId);const g=K(u);await t.exec(`CREATE TABLE IF NOT EXISTS ${o("_filled")} (tbl text NOT NULL, k jsonb NOT NULL)`);const y=[];for(const e of g){if(e in k)continue;if(e==="profiles"){if(g.indexOf("identities")>g.indexOf("profiles"))throw new D("copy","bundle_invalid","identities must be copied before profiles");y.push(...await Y(t,p,m,N,r.person))}const n=u.tables.get(e),T=Number((await t.prepareUncached(`SELECT count(*) AS n FROM ${o(e)}`).get()).n);if(T===0){O.inserted[e]=0;continue}const c=G(n),f=n.columns.filter(a=>!n.identity.includes(a)),R=n.identity.length>0?n.identity.map(a=>`s.${s(a)}`).join(", "):c.map(a=>`s.${s(a)}`).join(", ");let S=f.map(a=>`s.${s(a)}`),_="",d=0;e==="messages"&&(_=` WHERE NOT EXISTS (SELECT 1 FROM ${l("messages")} t WHERE t.message_id = s.message_id)`);const L=n.primaryKey.length===0;L&&(_=` WHERE NOT EXISTS (SELECT 1 FROM ${l(e)} t WHERE ${c.map(a=>`t.${s(a)} IS NOT DISTINCT FROM s.${s(a)}`).join(" AND ")})`);const I=await w(e,e==="messages"?"s.seq":R,_);if(e==="messages"){if(I===0){O.inserted[e]=0,await x(e,[]);continue}d=Number((await t.prepare("UPDATE message_sequence SET seq = seq + ? WHERE id = 1 RETURNING seq").get(I)).seq),S=f.map(a=>a==="seq"?`${d-I} + o.n`:`s.${s(a)}`)}const B=c.map(a=>`${s(a)}::text`).join(", "),C=await A(e,I,async(a,h)=>(await t.prepareUncached(`INSERT INTO ${l(e)} (${f.map(s).join(", ")}) SELECT ${S.join(", ")} FROM ${o(e)} s JOIN ${o("_ord")} o ON o.row_id = s.ctid WHERE o.n > ${a} AND o.n <= ${h}
|
|
8
|
-
ORDER BY o.n${L?"":` ON CONFLICT (${c.map(s).join(", ")}) DO NOTHING`} RETURNING ${B}`).all()).map(j=>Object.values(j)),e!==b);if(e===b){const a=await t.prepareUncached(`SELECT s.hash FROM ${o(e)} s JOIN ${l(e)} t ON t.hash = s.hash WHERE t.text IS DISTINCT FROM s.text LIMIT 10`).all();if(a.length>0)throw new D("copy","unique_conflict",`the target holds other text under body ${a[0].hash}; its boot repair has not rekeyed that row`,{table:e,hashes:a.map(h=>h.hash)})}O.inserted[e]=C,O.mapped[e]=T-C}for(const e of y)await t.prepare(`INSERT INTO ${o("_filled")} VALUES (?, ?::jsonb)`).run(e.table,JSON.stringify(e.key));for(const e of new Set(y.map(n=>n.table)))await X(t,i,e,y.filter(n=>n.table===e).map(n=>n.key));await t.prepareUncached(`DELETE FROM ${l("charge_totals")} t WHERE (t.month, t.payer) IN (SELECT DISTINCT month, payer FROM ${o("charges")})`).run(),await t.prepareUncached(`INSERT INTO ${l("charge_totals")} (month, payer, funding, sub, grantee, provider, usd, billed_usd)
|
|
9
|
-
SELECT month, payer, funding, COALESCE(sub, ''), grantee, COALESCE(provider, ''), COALESCE(SUM(usd), 0), COALESCE(SUM(billed_usd), 0)
|
|
10
|
-
FROM ${l("charges")} WHERE refused IS NULL AND kind <> 'take' AND (month, payer) IN (SELECT DISTINCT month, payer FROM ${o("charges")})
|
|
11
|
-
GROUP BY month, payer, funding, COALESCE(sub, ''), grantee, COALESCE(provider, '')`).run();for(const[e,n]of[["object",r.idMap.object],["grant",r.idMap.grant],["kind",r.idMap.kind]])for(const[T,c]of n)await t.prepare("INSERT INTO import_id_map (run_id, kind, source_value, target_value) VALUES (?, ?, ?, ?) ON CONFLICT DO NOTHING").run(i,e,T,c);for(const e of r.pathMap)await t.prepare("INSERT INTO import_id_map (run_id, kind, source_value, target_value) VALUES (?, 'path', ?, ?) ON CONFLICT DO NOTHING").run(i,e.from,e.to);return await t.prepare("UPDATE import_runs SET state = 'committed', committed_at = ?, step = 'copy' WHERE run_id = ?").run(new Date().toISOString(),i),O}E(se,"copyRows");async function X(r,t,i,p){if(p.length===0)return;const m=await r.prepare("SELECT inserted_keys FROM import_manifest WHERE run_id = ? AND table_name = ?").get(t,i);m===void 0?await r.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?)").run(t,i,$(p)):await r.prepare("UPDATE import_manifest SET inserted_keys = ? WHERE run_id = ? AND table_name = ?").run($([...F(m.inserted_keys),...p]),t,i)}E(X,"appendManifest");export{X as appendManifest,K as copyOrder,se as copyRows,F as decodeKeys,$ as encodeKeys,ae as nodesAwaitingVerify};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const KEY_BATCH = 5000;
|
|
2
|
-
/** Compress the batches into one `inserted_keys` value. */
|
|
3
|
-
export declare function encodeKeyBatches(batches: AsyncIterable<string[][]>): Promise<Buffer>;
|
|
4
|
-
/** The tuples of an `inserted_keys` value, `size` at a time. */
|
|
5
|
-
export declare function keyBatches(data: Buffer, size?: number): AsyncGenerator<string[][]>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var d=Object.defineProperty;var u=(c,e)=>d(c,"name",{value:e,configurable:!0});import{createZstdCompress as h,createZstdDecompress as g}from"node:zlib";import{once as p}from"node:events";const m=5e3;async function O(c){const e=h(),f=[];e.on("data",i=>f.push(i));const t=p(e,"end"),n=u(async i=>{e.write(i,"utf8")||await p(e,"drain")},"put");await n(`[
|
|
2
|
-
`);let a=!0;for await(const i of c)i.length!==0&&(await n((a?"":`,
|
|
3
|
-
`)+i.map(s=>JSON.stringify(s)).join(`,
|
|
4
|
-
`)),a=!1);return await n(`
|
|
5
|
-
]`),e.end(),await t,Buffer.concat(f)}u(O,"encodeKeyBatches");async function*B(c,e=m){const f=g({chunkSize:1048576});f.end(c);let t="",n=[],a,i=[];for await(const r of f){if(a===!1){i.push(r);continue}if(t+=r.toString("utf8"),a===void 0){if(t.length<2)continue;if(a=t.startsWith(`[
|
|
6
|
-
`)||t==="[]",!a){i.push(Buffer.from(t)),t="";continue}}let o=t.indexOf(`
|
|
7
|
-
`);for(;o!==-1;){const l=t.slice(0,o).replace(/,$/,"");t=t.slice(o+1),l!=="["&&l!=="]"&&l!==""&&(n.push(JSON.parse(l)),n.length>=e&&(yield n,n=[])),o=t.indexOf(`
|
|
8
|
-
`)}}if(a===!1||a===void 0){const r=i.length>0?JSON.parse(Buffer.concat(i).toString("utf8")):t===""?[]:JSON.parse(t);for(let o=0;o<r.length;o+=e)yield r.slice(o,o+e);return}const s=t.replace(/,$/,"").trim();s!==""&&s!=="]"&&s!=="["&&n.push(JSON.parse(s)),n.length>0&&(yield n)}u(B,"keyBatches");export{m as KEY_BATCH,O as encodeKeyBatches,B as keyBatches};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function openImportGrants(runId: string): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=Object.defineProperty;var s=(o,t)=>a(o,"name",{value:t,configurable:!0});import{directoryIssuer as c}from"../../directory/issuer.js";import{outboundFetch as p}from"../../events/outbound.js";import{mintDirectoryToken as m}from"../../grants/sync.js";import{ImportLaneError as n}from"./stage.js";async function y(o){const t=c();if(t===null)throw new n("open-grants","directory_refused","the directory is not configured, so the person's grants cannot be copied onto the fleet runtime");const i=`${t}/v1/runtime/imports/${encodeURIComponent(o)}/open`;let r;try{const e=await m(t);r=await p("import_open_grants",i,{method:"POST",headers:{Authorization:`Bearer ${e.access_token}`},signal:AbortSignal.timeout(12e4)})}catch(e){throw new n("open-grants","directory_refused",`the directory could not be asked to copy the grants: ${e instanceof Error?e.message:String(e)}`)}if(!r.ok)throw new n("open-grants","directory_refused",`the directory refused to copy the person's grants onto the fleet runtime: ${r.status}`)}s(y,"openImportGrants");export{y as openImportGrants};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CanvasDb } from '../../canvas/db.js';
|
|
2
|
-
import { type PathMap, type PathPrefix, type SourceJson } from '../bundle/layout.js';
|
|
3
|
-
/** A directory two nodes share (a cwd outside both worktrees) maps once, to the first node's folder: both nodes' rows read the same target and each
|
|
4
|
-
* sandbox unpacks its own archive there. */
|
|
5
|
-
export declare function sandboxPathMap(prefixes: readonly PathPrefix[]): PathMap;
|
|
6
|
-
/** One `import_node_files` row per hosted running node the exporter archived. Runs in the copy transaction, after the nodes are copied. */
|
|
7
|
-
export declare function writeNodeFiles(tx: CanvasDb, schema: string, runId: string, source: SourceJson): Promise<number>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var d=(n,o)=>s(n,"name",{value:o,configurable:!0});import{basename as m,dirname as l}from"node:path";import{nodeAgentDir as c}from"../../canvas/paths.js";import{bundleKeys as u}from"../bundle/layout.js";import{q as p}from"./catalog.js";import{ImportLaneError as a}from"./stage.js";const h="/work/imported";function A(n){const o=n.map(e=>{if(!e.from.startsWith("/")||e.from.split("/").includes(".."))throw new a("stage","bundle_invalid",`path prefix ${e.from} of node ${e.node} is not an absolute path`);const r=e.app.replace(/^app:/,"");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(r)||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(e.node))throw new a("stage","bundle_invalid",`path prefix names app ${e.app} and node ${e.node}`);const t=c(e.node,e.app);if(e.role==="context"){if(m(e.from)!=="context")throw new a("stage","bundle_invalid",`the context prefix ${e.from} of node ${e.node} is not a context directory`);return{from:l(e.from),to:t}}return{from:e.from,to:e.role==="worktree"?`${t}/worktree`:`${h}/${e.node}`}});return o.filter((e,r)=>o.findIndex(t=>t.from===e.from)===r)}d(A,"sandboxPathMap");async function E(n,o,e,r){if(r.kind!=="hosted")return 0;const t=[...new Set((r.pathPrefixes??[]).map(i=>i.node))];let f=0;for(const i of t){if(await n.prepareUncached(`SELECT 1 AS found FROM ${p(o)}.nodes WHERE node_id = ? AND status IN ('active', 'idle')`).get(i)===void 0)throw new a("copy","bundle_invalid",`an archive was uploaded for node ${i}, which is not a running node of the bundle`);f+=Number((await n.prepare("INSERT INTO import_node_files (node, blob_key) VALUES (?, ?) ON CONFLICT DO NOTHING").run(i,u.nodeFiles(e,i))).changes)}return f}d(E,"writeNodeFiles");export{A as sandboxPathMap,E as writeNodeFiles};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { CanvasDb } from '../../canvas/db.js';
|
|
2
|
-
import { type PathMap, type SourceJson } from '../bundle/layout.js';
|
|
3
|
-
import type { BlobStore } from '../../blobs/index.js';
|
|
4
|
-
import { type Catalog } from './catalog.js';
|
|
5
|
-
/** A revision of a document the target already holds, to be added through repo sync's own arrival path. */
|
|
6
|
-
export interface ArrivingRevision {
|
|
7
|
-
document: string;
|
|
8
|
-
rev_id: string;
|
|
9
|
-
parents: string[];
|
|
10
|
-
body_hash: string;
|
|
11
|
-
rationale: string | null;
|
|
12
|
-
created_at: string;
|
|
13
|
-
}
|
|
14
|
-
/** Rewrite 4: for rows of running nodes of a hosted source, path columns go through the run's map. Ended nodes' rows stay as historical text. */
|
|
15
|
-
export declare function rewritePaths(db: CanvasDb, schema: string, map: PathMap): Promise<number>;
|
|
16
|
-
/** Rewrite 4, conversations: pi refuses to open a session whose header `cwd` does not exist, so the header of part 0 of each conversation of a running node goes through the
|
|
17
|
-
* run's map like `nodes.cwd`. The run's uploaded copy of the blob is rewritten (the move step copies it to its key) and the staged row's `bytes` follows, so verify and the
|
|
18
|
-
* pre-check compare the rewritten rows. A bundle loaded again, or a run retried after an earlier attempt rewrote the upload, ends with the same bytes. Runs after `rewritePaths`, before the pre-check. Returns conversations rewritten. */
|
|
19
|
-
export declare function rewriteConversationHeaders(db: CanvasDb, schema: string, map: PathMap, blobs: BlobStore, runId: string): Promise<number>;
|
|
20
|
-
/** Rewrite 4b: a human request's files live in the blob store under `requests/<id>/` (the exporter uploaded the request dir there). `request_dir` becomes that
|
|
21
|
-
* prefix; a `file` or `presentation_dir` inside the old dir keeps its relative path, one outside it was uploaded to `source/<basename>`. A path that is not
|
|
22
|
-
* absolute is already a blob path and stays. */
|
|
23
|
-
export declare function rewriteRequestPaths(db: CanvasDb, schema: string): Promise<number>;
|
|
24
|
-
/** A profile whose name another profile already holds is renamed `<name>-<install id>` (staging only; runs before the pre-check), in its `profiles` row and in its `profile`
|
|
25
|
-
* object's handle. The name clashes when the person already uses it for another profile, or when the object's handle is held by any other live profile object: `objects_handle`
|
|
26
|
-
* is unique per type across the whole fleet, so another person's profile counts. Only a handle that is the profile's name moves (a cloud role's handle is the profile id).
|
|
27
|
-
* The new name is a function of the install, so a second load of the bundle derives the same one. Runs after `mapProfileIds`, which leaves the staged identity at the profile's id. */
|
|
28
|
-
export declare function renameClashingProfiles(db: CanvasDb, schema: string, target: string, installId: string, person: string): Promise<number>;
|
|
29
|
-
/** A migrated usage charge (`legacy:` id, `importLegacyUsage`) has no install id, so two Macs of one person with usage in the same month and model produce one id with
|
|
30
|
-
* different amounts. A staged one whose id the target holds with a different payer, units or usd is renamed `<id>:install-<install id>`; one the target holds unchanged keeps its
|
|
31
|
-
* id and is skipped by the copy. A second load of the same bundle derives the same id. Runs before the pre-check. */
|
|
32
|
-
export declare function renameClashingLegacyCharges(db: CanvasDb, schema: string, target: string, installId: string): Promise<number>;
|
|
33
|
-
/** A staged watch whose (watcher, object) the target already holds is already imported (a hosted person's nodes watching shared objects): it and its subscriptions are
|
|
34
|
-
* dropped, the target's rows stand. Only this key is skipped; any other unique conflict still fails the pre-check. Returns the dropped watches and subscriptions. Runs before the pre-check. */
|
|
35
|
-
export declare function dropExistingWatches(db: CanvasDb, schema: string, target: string): Promise<{
|
|
36
|
-
watches: number;
|
|
37
|
-
watch_subscriptions: number;
|
|
38
|
-
}>;
|
|
39
|
-
/** A hosted cron runs in its anchor node's sandbox and fails with no anchor. A Mac cron made without `--anchor` has none, so a staged cron of a hosted source with no anchor
|
|
40
|
-
* takes its creator as anchor when that node is staged (still in the bundle after the drops). The anchor's `ON DELETE CASCADE` then removes the cron with its creator. Runs after the drops. Returns the crons anchored. */
|
|
41
|
-
export declare function anchorCronsToCreator(db: CanvasDb, schema: string): Promise<number>;
|
|
42
|
-
/** A staged idempotency key whose (grantee, key) the target already holds is already imported (a hosted person's runs the control plane has since served): it is dropped, the target's
|
|
43
|
-
* row stands, so the copy never inserts it and verify never compares it. Only this key is skipped; any other difference still fails. Returns the dropped rows. Runs before the pre-check. */
|
|
44
|
-
export declare function dropExistingIdempotencyKeys(db: CanvasDb, schema: string, target: string): Promise<number>;
|
|
45
|
-
/** A staged idempotency key at least `IDEMPOTENCY_WINDOW_MS` old is already expired (`findIdempotent` ignores it and the daemon's sweep deletes it within a minute), so it is dropped before
|
|
46
|
-
* the copy: otherwise the sweep removes it between copy and verify and verify reports a difference. Returns the dropped rows. Runs before the pre-check. */
|
|
47
|
-
export declare function dropExpiredIdempotencyKeys(db: CanvasDb, schema: string): Promise<number>;
|
|
48
|
-
/** The rows `fillEnvironments` created, as manifest keys per table, so rollback removes them and verify (which has no staged row for them) skips them. */
|
|
49
|
-
export interface FilledRow {
|
|
50
|
-
table: string;
|
|
51
|
-
key: string[];
|
|
52
|
-
}
|
|
53
|
-
/** Fill: a staged profile with no environment gets the source's machine environment (a Mac) or the person's Blaxel environment (hosted, created if
|
|
54
|
-
* absent). Runs in the copy transaction: it writes target objects. */
|
|
55
|
-
export declare function fillEnvironments(tx: CanvasDb, schema: string, target: string, source: SourceJson, person: string): Promise<FilledRow[]>;
|
|
56
|
-
/** Staged edits that need nothing from the target but its key map: limits the directory or an operator wrote stay out, a hosted source's own
|
|
57
|
-
* machine environment is marked for the drop step, claims of the old runtime's lanes are cleared, and rows of the identity-keyed tables already in
|
|
58
|
-
* `import_key_map` are not staged again. Returns the rows removed per table. */
|
|
59
|
-
export declare function pruneStaged(db: CanvasDb, schema: string, catalog: Catalog, source: SourceJson): Promise<Record<string, number>>;
|
|
60
|
-
/** A staged document whose id the target already holds (repo sync keeps the id across runtimes) is not inserted: its revisions arrive through
|
|
61
|
-
* `insertImportedRevisions`. Removes its staged object, document, revision and parent rows and returns the revisions. Runs before the pre-check. */
|
|
62
|
-
export declare function takeRepoSyncedDocuments(db: CanvasDb, schema: string, target: string): Promise<ArrivingRevision[]>;
|
|
63
|
-
export interface Collision {
|
|
64
|
-
table: string;
|
|
65
|
-
key: string;
|
|
66
|
-
values: string[]; /** Two staged rows collide with each other, not with the target. */
|
|
67
|
-
staged?: true;
|
|
68
|
-
}
|
|
69
|
-
/** Pre-check (I9): every non-primary unique key and every text primary key the target already holds, and every unique key two staged rows share. Throws `unique_conflict` naming the first 10 values. */
|
|
70
|
-
export declare function precheck(db: CanvasDb, schema: string, target: string, catalog: Catalog, tables: readonly string[], skip: ReadonlySet<string>, seqLike: ReadonlyMap<string, string[]>): Promise<void>;
|