@north-light/cli 0.3.529 → 0.3.531
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/dto/lifecycle.d.ts +3 -1
- package/dist/api/dto/messages.d.ts +5 -3
- package/dist/builtin-memory/crouter-plugin/bundles-and-memory.md +1 -1
- package/dist/builtin-memory/crouter-plugin/commands.md +1 -1
- package/dist/clients/attach/session/connection.js +1 -1
- package/dist/clients/attach/session/reconnect.js +1 -1
- package/dist/clients/attach/viewer.js +508 -508
- package/dist/commands/node/message.js +1 -1
- package/dist/commands/sys/join.js +1 -1
- package/dist/core/async-array.d.ts +7 -0
- package/dist/core/async-array.js +1 -0
- package/dist/core/audit.d.ts +1 -1
- package/dist/core/audit.js +2 -2
- package/dist/core/canvas/attention.d.ts +4 -4
- package/dist/core/canvas/attention.js +1 -1
- package/dist/core/canvas/boot.d.ts +4 -4
- package/dist/core/canvas/boot.js +1 -1
- package/dist/core/canvas/canvas.d.ts +59 -59
- package/dist/core/canvas/canvas.js +19 -19
- package/dist/core/canvas/context-strip.js +2 -2
- package/dist/core/canvas/crons.d.ts +27 -27
- package/dist/core/canvas/crons.js +11 -11
- package/dist/core/canvas/daemon-actions.d.ts +10 -10
- package/dist/core/canvas/daemon-actions.js +8 -8
- package/dist/core/canvas/daemon-owner.d.ts +3 -3
- package/dist/core/canvas/daemon-owner.js +2 -2
- package/dist/core/canvas/db.d.ts +19 -30
- package/dist/core/canvas/db.js +3 -2
- package/dist/core/canvas/deliveries.d.ts +16 -16
- package/dist/core/canvas/deliveries.js +24 -24
- package/dist/core/canvas/executions.d.ts +8 -8
- package/dist/core/canvas/executions.js +1 -1
- package/dist/core/canvas/focuses.d.ts +8 -8
- package/dist/core/canvas/focuses.js +1 -1
- package/dist/core/canvas/history.d.ts +3 -3
- package/dist/core/canvas/history.js +9 -9
- package/dist/core/canvas/install-id.d.ts +1 -1
- package/dist/core/canvas/install-id.js +1 -1
- package/dist/core/canvas/managed-worktree-sweep-candidates.d.ts +1 -1
- package/dist/core/canvas/managed-worktree-sweep-candidates.js +2 -2
- package/dist/core/canvas/memory-reads.d.ts +6 -6
- package/dist/core/canvas/memory-reads.js +1 -1
- package/dist/core/canvas/nav-model.d.ts +13 -13
- package/dist/core/canvas/nav-model.js +1 -1
- package/dist/core/canvas/node-agent-paths.d.ts +6 -6
- package/dist/core/canvas/node-agent-paths.js +1 -1
- package/dist/core/canvas/node-tokens.d.ts +7 -7
- package/dist/core/canvas/node-tokens.js +3 -3
- package/dist/core/canvas/outcome-actions.d.ts +5 -5
- package/dist/core/canvas/outcome-actions.js +3 -3
- package/dist/core/canvas/recovery.d.ts +26 -26
- package/dist/core/canvas/recovery.js +2 -2
- package/dist/core/canvas/render-source.d.ts +1 -1
- package/dist/core/canvas/render-source.js +1 -1
- package/dist/core/canvas/sessions.d.ts +10 -10
- package/dist/core/canvas/sessions.js +4 -4
- package/dist/core/canvas/source.js +1 -1
- package/dist/core/canvas/structured-requests.d.ts +15 -15
- package/dist/core/canvas/structured-requests.js +5 -5
- package/dist/core/canvas/tree.d.ts +9 -9
- package/dist/core/canvas/tree.js +5 -5
- package/dist/core/canvas/waits.d.ts +13 -13
- package/dist/core/canvas/waits.js +6 -6
- package/dist/core/canvas/worktrees.d.ts +15 -15
- package/dist/core/canvas/worktrees.js +1 -1
- package/dist/core/command-hooks/lifecycle-catalog.d.ts +4 -4
- package/dist/core/command-hooks/lifecycle-catalog.js +1 -1
- package/dist/core/command-hooks/transport/exec-lifecycle.js +1 -1
- package/dist/core/command-plugins/bundle.d.ts +1 -1
- package/dist/core/command-plugins/bundle.js +1 -1
- package/dist/core/conversation-store/file-store.d.ts +7 -7
- package/dist/core/conversation-store/file-store.js +9 -9
- package/dist/core/conversation-store/index.d.ts +16 -14
- package/dist/core/conversation-store/index.js +1 -1
- package/dist/core/conversation-store/listener.js +5 -5
- package/dist/core/conversation-store/patch.d.ts +3 -1
- package/dist/core/conversation-store/patch.js +1 -1
- package/dist/core/directory/join.d.ts +1 -1
- package/dist/core/feed/feed.js +3 -3
- package/dist/core/feed/inbox.d.ts +2 -2
- package/dist/core/feed/inbox.js +1 -1
- package/dist/core/feed/messages.d.ts +11 -12
- package/dist/core/feed/messages.js +5 -5
- package/dist/core/feed/reports.d.ts +4 -4
- package/dist/core/feed/reports.js +2 -2
- package/dist/core/grants/cover.d.ts +1 -1
- package/dist/core/grants/cover.js +1 -1
- package/dist/core/grants/local.d.ts +1 -1
- package/dist/core/grants/local.js +1 -1
- package/dist/core/grants/mirror.d.ts +19 -19
- package/dist/core/grants/mirror.js +2 -2
- package/dist/core/grants/on-sync.d.ts +1 -1
- package/dist/core/grants/on-sync.js +1 -1
- package/dist/core/grants/remove.js +1 -1
- package/dist/core/grants/sync.js +1 -1
- package/dist/core/graph/access.d.ts +17 -17
- package/dist/core/graph/access.js +3 -3
- package/dist/core/graph/custom.d.ts +16 -16
- package/dist/core/graph/custom.js +9 -9
- package/dist/core/graph/deletion.d.ts +3 -7
- package/dist/core/graph/deletion.js +4 -4
- package/dist/core/graph/documents.d.ts +24 -27
- package/dist/core/graph/documents.js +7 -7
- package/dist/core/graph/edges.d.ts +13 -13
- package/dist/core/graph/edges.js +1 -1
- package/dist/core/graph/events.d.ts +7 -9
- package/dist/core/graph/events.js +8 -8
- package/dist/core/graph/exposures.d.ts +6 -6
- package/dist/core/graph/exposures.js +4 -4
- package/dist/core/graph/jobs.d.ts +6 -8
- package/dist/core/graph/jobs.js +2 -2
- package/dist/core/graph/kinds/action.js +1 -1
- package/dist/core/graph/kinds/custom.js +2 -2
- package/dist/core/graph/kinds/document.d.ts +1 -0
- package/dist/core/graph/kinds/document.js +4 -4
- package/dist/core/graph/kinds/dto.d.ts +2 -2
- package/dist/core/graph/kinds/dto.js +1 -1
- package/dist/core/graph/kinds/job.js +2 -2
- package/dist/core/graph/kinds/kind.d.ts +6 -8
- package/dist/core/graph/kinds/kind.js +1 -1
- package/dist/core/graph/kinds/node.js +5 -5
- package/dist/core/graph/kinds/owner.js +2 -2
- package/dist/core/graph/kinds/registry.d.ts +6 -9
- package/dist/core/graph/kinds/registry.js +1 -1
- package/dist/core/graph/names.d.ts +6 -6
- package/dist/core/graph/names.js +3 -3
- package/dist/core/graph/object-waits.d.ts +4 -7
- package/dist/core/graph/object-waits.js +1 -1
- package/dist/core/graph/objects.d.ts +14 -14
- package/dist/core/graph/objects.js +9 -9
- package/dist/core/graph/package-docs.d.ts +2 -7
- package/dist/core/graph/package-docs.js +5 -5
- package/dist/core/graph/package-kinds.d.ts +2 -5
- package/dist/core/graph/package-kinds.js +1 -1
- package/dist/core/graph/package-reconcile.d.ts +2 -5
- package/dist/core/graph/package-reconcile.js +1 -1
- package/dist/core/graph/reader.d.ts +18 -18
- package/dist/core/graph/reader.js +3 -3
- package/dist/core/graph/receivers.d.ts +4 -4
- package/dist/core/graph/receivers.js +5 -5
- package/dist/core/graph/repo-sync/exchange.d.ts +3 -7
- package/dist/core/graph/repo-sync/exchange.js +2 -2
- package/dist/core/graph/repo-sync/repos.d.ts +7 -5
- package/dist/core/graph/repo-sync/repos.js +3 -3
- package/dist/core/graph/repo-sync/sync.d.ts +3 -6
- package/dist/core/graph/repo-sync/sync.js +2 -2
- package/dist/core/graph/rules.d.ts +5 -5
- package/dist/core/graph/rules.js +3 -3
- package/dist/core/graph/spaces/app.js +1 -1
- package/dist/core/graph/spaces/index.d.ts +4 -5
- package/dist/core/graph/spaces/index.js +1 -1
- package/dist/core/graph/spaces/own-memory.d.ts +4 -4
- package/dist/core/graph/spaces/own-memory.js +1 -1
- package/dist/core/graph/spaces/person.js +3 -3
- package/dist/core/graph/spaces/repo.d.ts +1 -1
- package/dist/core/graph/spaces/repo.js +1 -1
- package/dist/core/graph/watches.d.ts +15 -15
- package/dist/core/graph/watches.js +10 -10
- package/dist/core/human/feedback-companion.d.ts +2 -2
- package/dist/core/human/feedback-companion.js +1 -1
- package/dist/core/human/feedback.d.ts +3 -3
- package/dist/core/human/feedback.js +1 -1
- package/dist/core/human/requests.d.ts +34 -33
- package/dist/core/human/requests.js +20 -20
- package/dist/core/human/scan.d.ts +2 -2
- package/dist/core/human/scan.js +1 -1
- package/dist/core/human/tickets.d.ts +9 -9
- package/dist/core/human/tickets.js +1 -1
- package/dist/core/llm/app-rungs.d.ts +1 -1
- package/dist/core/llm/app-rungs.js +1 -1
- package/dist/core/llm/run.js +1 -1
- package/dist/core/peer/directory.d.ts +1 -1
- package/dist/core/peer/directory.js +1 -1
- package/dist/core/peer/envelope.d.ts +3 -3
- package/dist/core/peer/envelope.js +1 -1
- package/dist/core/peer/home.d.ts +7 -7
- package/dist/core/peer/home.js +2 -2
- package/dist/core/peer/ingest.d.ts +6 -6
- package/dist/core/peer/ingest.js +1 -1
- package/dist/core/peer/outbox-store.d.ts +14 -14
- package/dist/core/peer/outbox-store.js +5 -5
- package/dist/core/peer/receiver.d.ts +2 -2
- package/dist/core/peer/receiver.js +1 -1
- package/dist/core/peer/stubs.d.ts +10 -10
- package/dist/core/peer/stubs.js +1 -1
- package/dist/core/providers/approval.d.ts +2 -2
- package/dist/core/providers/approval.js +2 -2
- package/dist/core/providers/audit.d.ts +3 -3
- package/dist/core/providers/audit.js +2 -2
- package/dist/core/providers/bundles.js +2 -2
- package/dist/core/providers/call.d.ts +2 -2
- package/dist/core/providers/call.js +1 -1
- package/dist/core/providers/files.d.ts +1 -1
- package/dist/core/providers/files.js +1 -1
- package/dist/core/providers/mint.js +1 -1
- package/dist/core/providers/receipts.d.ts +1 -1
- package/dist/core/providers/receipts.js +2 -2
- package/dist/core/review/birth.js +1 -1
- package/dist/core/review/comments.d.ts +19 -19
- package/dist/core/review/comments.js +5 -5
- package/dist/core/review/companion.d.ts +1 -1
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/document.d.ts +3 -3
- package/dist/core/review/document.js +2 -2
- package/dist/core/review/fork.js +2 -2
- package/dist/core/review/realize.js +1 -1
- package/dist/core/review/remap.d.ts +2 -2
- package/dist/core/review/remap.js +4 -4
- package/dist/core/review/stage.d.ts +1 -1
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/store.d.ts +21 -21
- package/dist/core/review/store.js +1 -1
- package/dist/core/runs/activity.d.ts +1 -1
- package/dist/core/runs/activity.js +5 -5
- package/dist/core/runs/confinement.d.ts +7 -7
- package/dist/core/runs/confinement.js +2 -2
- package/dist/core/runs/events.d.ts +12 -12
- package/dist/core/runs/events.js +4 -4
- package/dist/core/runs/operations.d.ts +11 -11
- package/dist/core/runs/operations.js +5 -5
- package/dist/core/runs/questions.d.ts +10 -10
- package/dist/core/runs/questions.js +3 -3
- package/dist/core/runtime/auth-reload.js +1 -1
- package/dist/core/runtime/bearings.d.ts +5 -5
- package/dist/core/runtime/bearings.js +6 -6
- package/dist/core/runtime/broker-inventory.js +1 -1
- package/dist/core/runtime/broker-request.js +1 -1
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/close.d.ts +3 -3
- package/dist/core/runtime/close.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/fleet.d.ts +2 -2
- package/dist/core/runtime/host.d.ts +3 -3
- package/dist/core/runtime/host.js +3 -3
- package/dist/core/runtime/kickoff.d.ts +12 -12
- package/dist/core/runtime/kickoff.js +17 -17
- package/dist/core/runtime/launch-target.d.ts +1 -1
- package/dist/core/runtime/launch-target.js +1 -1
- package/dist/core/runtime/ledger.d.ts +3 -3
- package/dist/core/runtime/ledger.js +3 -3
- package/dist/core/runtime/lifecycle.d.ts +1 -1
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/memory-admission.js +1 -1
- package/dist/core/runtime/model-swap.d.ts +2 -2
- package/dist/core/runtime/model-swap.js +1 -1
- package/dist/core/runtime/node-read.d.ts +1 -1
- package/dist/core/runtime/node-read.js +2 -2
- package/dist/core/runtime/nodes.d.ts +6 -6
- package/dist/core/runtime/nodes.js +1 -1
- package/dist/core/runtime/outcome-document.d.ts +1 -1
- package/dist/core/runtime/outcome-document.js +1 -1
- package/dist/core/runtime/persona.d.ts +3 -3
- package/dist/core/runtime/persona.js +2 -2
- package/dist/core/runtime/placement.d.ts +11 -11
- package/dist/core/runtime/placement.js +1 -1
- package/dist/core/runtime/promote.d.ts +3 -3
- package/dist/core/runtime/promote.js +1 -1
- package/dist/core/runtime/recycle.js +1 -1
- package/dist/core/runtime/reopen.d.ts +21 -10
- package/dist/core/runtime/reopen.js +1 -1
- package/dist/core/runtime/reset.d.ts +4 -4
- package/dist/core/runtime/reset.js +1 -1
- package/dist/core/runtime/revive-all.d.ts +2 -2
- package/dist/core/runtime/revive-all.js +1 -1
- package/dist/core/runtime/revive.d.ts +4 -4
- package/dist/core/runtime/revive.js +2 -2
- package/dist/core/runtime/roadmap.d.ts +6 -6
- package/dist/core/runtime/roadmap.js +5 -5
- package/dist/core/runtime/session-branch.d.ts +1 -1
- package/dist/core/runtime/session-branch.js +1 -1
- package/dist/core/runtime/session-list-cache.js +1 -1
- package/dist/core/runtime/situational-live.js +1 -1
- package/dist/core/runtime/spawn.d.ts +2 -2
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/runtime/stop-guard.d.ts +2 -2
- package/dist/core/runtime/stop-guard.js +3 -3
- package/dist/core/runtime/warm-pool.d.ts +2 -2
- package/dist/core/runtime/warm-pool.js +1 -1
- package/dist/core/spaces/mounts.d.ts +2 -2
- package/dist/core/spaces/mounts.js +1 -1
- package/dist/core/spaces/permissions.d.ts +1 -1
- package/dist/core/spaces/permissions.js +1 -1
- package/dist/core/spaces/process.d.ts +1 -1
- package/dist/core/spaces/process.js +1 -1
- package/dist/core/spaces/space.js +1 -1
- package/dist/core/spaces/stop.d.ts +3 -3
- package/dist/core/spaces/stop.js +2 -2
- package/dist/core/spaces/users.d.ts +6 -6
- package/dist/core/spaces/users.js +1 -1
- package/dist/core/storage/attachments.d.ts +2 -2
- package/dist/core/storage/attachments.js +1 -1
- package/dist/core/storage/shares.d.ts +2 -2
- package/dist/core/storage/shares.js +1 -1
- package/dist/core/storage/tables.d.ts +21 -21
- package/dist/core/storage/tables.js +3 -3
- package/dist/core/substrate/delivery/corpus.d.ts +5 -8
- package/dist/core/substrate/delivery/corpus.js +3 -3
- package/dist/core/substrate/delivery/deliver.d.ts +10 -15
- package/dist/core/substrate/delivery/deliver.js +3 -3
- package/dist/core/substrate/delivery/plan.d.ts +2 -12
- package/dist/core/substrate/delivery/plan.js +3 -3
- package/dist/core/substrate/delivery/render-boot.d.ts +4 -4
- package/dist/core/substrate/delivery/render-boot.js +18 -18
- package/dist/core/substrate/delivery/render-event.d.ts +7 -14
- package/dist/core/substrate/delivery/render-event.js +4 -4
- package/dist/core/substrate/subject.d.ts +2 -2
- package/dist/core/substrate/subject.js +1 -1
- package/dist/core/usage/ledger.d.ts +6 -6
- package/dist/core/usage/ledger.js +4 -4
- package/dist/core/worktree-close.js +4 -4
- package/dist/core/worktree-mutation-async.js +7 -7
- package/dist/core/worktree-quarantine.js +1 -1
- package/dist/core/worktree-sweep.d.ts +1 -1
- package/dist/core/worktree-sweep.js +6 -6
- package/dist/core/worktree.d.ts +5 -5
- package/dist/core/worktree.js +13 -13
- package/dist/daemon/analytics/compute.d.ts +2 -2
- package/dist/daemon/analytics/compute.js +1 -1
- package/dist/daemon/api/app-listener.d.ts +4 -4
- package/dist/daemon/api/app-listener.js +13 -13
- package/dist/daemon/api/bridge.js +5 -5
- package/dist/daemon/api/document-listener.js +6 -6
- package/dist/daemon/api/handlers/analytics.js +1 -1
- package/dist/daemon/api/handlers/attach.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +1 -1
- package/dist/daemon/api/handlers/bash.js +1 -1
- package/dist/daemon/api/handlers/broker-ops.d.ts +1 -1
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/broker-recovery.d.ts +1 -1
- package/dist/daemon/api/handlers/broker-recovery.js +1 -1
- package/dist/daemon/api/handlers/broker-signals.d.ts +2 -2
- package/dist/daemon/api/handlers/broker-signals.js +2 -2
- package/dist/daemon/api/handlers/canvas.d.ts +1 -1
- package/dist/daemon/api/handlers/canvas.js +4 -4
- package/dist/daemon/api/handlers/chat-inventory.js +1 -1
- package/dist/daemon/api/handlers/crons.js +1 -1
- package/dist/daemon/api/handlers/custom-objects.d.ts +4 -4
- package/dist/daemon/api/handlers/custom-objects.js +3 -3
- package/dist/daemon/api/handlers/delivery-retry.js +1 -1
- package/dist/daemon/api/handlers/delivery.js +1 -1
- package/dist/daemon/api/handlers/docs.d.ts +4 -4
- package/dist/daemon/api/handlers/docs.js +1 -1
- package/dist/daemon/api/handlers/feedback-comments.js +3 -3
- package/dist/daemon/api/handlers/files.js +1 -1
- package/dist/daemon/api/handlers/focus.js +1 -1
- package/dist/daemon/api/handlers/health.js +3 -3
- package/dist/daemon/api/handlers/hook-exec.js +1 -1
- package/dist/daemon/api/handlers/human-requests.js +1 -1
- package/dist/daemon/api/handlers/inbox-page.d.ts +1 -1
- package/dist/daemon/api/handlers/inbox-page.js +1 -1
- package/dist/daemon/api/handlers/inbox.d.ts +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/llm.d.ts +1 -1
- package/dist/daemon/api/handlers/llm.js +3 -3
- package/dist/daemon/api/handlers/memory-reads.js +1 -1
- package/dist/daemon/api/handlers/memory.d.ts +5 -5
- package/dist/daemon/api/handlers/memory.js +5 -5
- package/dist/daemon/api/handlers/messages.js +2 -2
- package/dist/daemon/api/handlers/node-events.d.ts +2 -2
- package/dist/daemon/api/handlers/node-events.js +3 -3
- package/dist/daemon/api/handlers/node-outcomes.js +1 -1
- package/dist/daemon/api/handlers/node-records.js +2 -2
- package/dist/daemon/api/handlers/nodes.d.ts +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/objects.js +3 -3
- package/dist/daemon/api/handlers/package-docs.js +1 -1
- package/dist/daemon/api/handlers/plugin-app-token.d.ts +1 -1
- package/dist/daemon/api/handlers/plugin-app-token.js +1 -1
- package/dist/daemon/api/handlers/profiles.d.ts +3 -3
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/api/handlers/providers.d.ts +1 -1
- package/dist/daemon/api/handlers/providers.js +1 -1
- package/dist/daemon/api/handlers/questions.js +1 -1
- package/dist/daemon/api/handlers/reports.d.ts +1 -1
- package/dist/daemon/api/handlers/reports.js +5 -5
- package/dist/daemon/api/handlers/review-comments.js +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/handlers/runs.js +1 -1
- package/dist/daemon/api/handlers/structured-requests.js +1 -1
- package/dist/daemon/api/handlers/subscriptions.js +1 -1
- package/dist/daemon/api/handlers/transfer.js +1 -1
- package/dist/daemon/api/map.d.ts +3 -3
- package/dist/daemon/api/map.js +1 -1
- package/dist/daemon/api/principal.d.ts +1 -1
- package/dist/daemon/api/principal.js +1 -1
- package/dist/daemon/api/reader.d.ts +5 -5
- package/dist/daemon/api/reader.js +1 -1
- package/dist/daemon/api/router.d.ts +5 -5
- package/dist/daemon/api/router.js +1 -1
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/broker-signals/bus.d.ts +1 -1
- package/dist/daemon/broker-signals/bus.js +1 -1
- package/dist/daemon/companion-retire.js +1 -1
- package/dist/daemon/cron/armed-context.d.ts +2 -2
- package/dist/daemon/cron/armed-context.js +1 -1
- package/dist/daemon/cron/authority.d.ts +2 -2
- package/dist/daemon/cron/authority.js +1 -1
- package/dist/daemon/cron/disposition.js +1 -1
- package/dist/daemon/cron/ended.d.ts +1 -1
- package/dist/daemon/cron/ended.js +2 -2
- package/dist/daemon/cron/escalation.js +3 -3
- package/dist/daemon/cron/folders.d.ts +1 -1
- package/dist/daemon/cron/folders.js +1 -1
- package/dist/daemon/cron/held.d.ts +1 -1
- package/dist/daemon/cron/held.js +1 -1
- package/dist/daemon/cron/lease-recovery.d.ts +1 -1
- package/dist/daemon/cron/lease-recovery.js +1 -1
- package/dist/daemon/cron/passes.d.ts +2 -2
- package/dist/daemon/cron/passes.js +1 -1
- package/dist/daemon/cron/run-socket.d.ts +1 -1
- package/dist/daemon/cron/run-socket.js +1 -1
- package/dist/daemon/cron/settle.js +1 -1
- package/dist/daemon/cron/sinks.d.ts +1 -1
- package/dist/daemon/cron/sinks.js +2 -2
- package/dist/daemon/cron-run.d.ts +12 -3
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd.js +6 -6
- package/dist/daemon/delivery/run-delivery.js +1 -1
- package/dist/daemon/due-sources.d.ts +3 -3
- package/dist/daemon/due-sources.js +1 -1
- package/dist/daemon/due.d.ts +3 -3
- package/dist/daemon/due.js +7 -7
- package/dist/daemon/fleet.d.ts +2 -2
- package/dist/daemon/fleet.js +11 -11
- package/dist/daemon/human/finish.js +3 -3
- package/dist/daemon/human/settle.d.ts +1 -1
- package/dist/daemon/human/settle.js +1 -1
- package/dist/daemon/human/sweep.js +1 -1
- package/dist/daemon/joined-owner.d.ts +3 -3
- package/dist/daemon/joined-owner.js +1 -1
- package/dist/daemon/messaging/node-message.js +1 -1
- package/dist/daemon/park-activity.d.ts +2 -2
- package/dist/daemon/park-activity.js +1 -1
- package/dist/daemon/peer/authority.js +1 -1
- package/dist/daemon/peer/forward.d.ts +6 -6
- package/dist/daemon/peer/forward.js +1 -1
- package/dist/daemon/peer/handlers.js +1 -1
- package/dist/daemon/peer/ingress.d.ts +4 -4
- package/dist/daemon/peer/ingress.js +1 -1
- package/dist/daemon/peer/outbox.d.ts +2 -2
- package/dist/daemon/peer/outbox.js +1 -1
- package/dist/daemon/peer/relay-service.js +1 -1
- package/dist/daemon/plugin-objects/read-leaf.d.ts +2 -2
- package/dist/daemon/plugin-objects/read-leaf.js +2 -2
- package/dist/daemon/profile-delete.js +1 -1
- package/dist/daemon/readiness.d.ts +2 -2
- package/dist/daemon/readiness.js +1 -1
- package/dist/daemon/reconcilers/action-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/action-lane.js +1 -1
- package/dist/daemon/reconcilers/bash-deadline.js +2 -2
- package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
- package/dist/daemon/reconcilers/broker-supervision.js +4 -4
- package/dist/daemon/reconcilers/controller-death.d.ts +1 -1
- package/dist/daemon/reconcilers/controller-death.js +1 -1
- package/dist/daemon/reconcilers/cron-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/cron-lane.js +1 -1
- package/dist/daemon/reconcilers/delivery-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/delivery-lane.js +2 -2
- package/dist/daemon/reconcilers/fault-retry-backstop.d.ts +3 -3
- package/dist/daemon/reconcilers/fault-retry-backstop.js +1 -1
- package/dist/daemon/reconcilers/grove-instance-sweep.d.ts +2 -2
- package/dist/daemon/reconcilers/grove-instance-sweep.js +1 -1
- package/dist/daemon/reconcilers/live-obligation.d.ts +6 -6
- package/dist/daemon/reconcilers/live-obligation.js +1 -1
- package/dist/daemon/reconcilers/managed-worktree-sweep.js +1 -1
- package/dist/daemon/reconcilers/node-deadline.d.ts +1 -1
- package/dist/daemon/reconcilers/node-deadline.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.d.ts +3 -3
- package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/terminating.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/wants-execution.d.ts +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/wants-execution.js +1 -1
- package/dist/daemon/reconcilers/pending-review-submit.d.ts +1 -1
- package/dist/daemon/reconcilers/pending-review-submit.js +1 -1
- package/dist/daemon/reconcilers/storage-due-work.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.js +2 -2
- package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
- package/dist/daemon/review/comment-notify.js +2 -2
- package/dist/daemon/review/companion.d.ts +3 -3
- package/dist/daemon/review/companion.js +1 -1
- package/dist/daemon/review/finish.js +1 -1
- package/dist/daemon/review/sweep.js +1 -1
- package/dist/daemon/run-notices.d.ts +4 -4
- package/dist/daemon/run-notices.js +1 -1
- package/dist/daemon/runs/append-section.d.ts +2 -2
- package/dist/daemon/runs/append-section.js +2 -2
- package/dist/daemon/runs/observer.d.ts +2 -2
- package/dist/daemon/runs/observer.js +2 -2
- package/dist/daemon/structured-requests/boot.d.ts +1 -1
- package/dist/daemon/structured-requests/boot.js +1 -1
- package/dist/daemon/structured-requests/effects.js +1 -1
- package/dist/daemon/structured-requests/sidecar.d.ts +1 -1
- package/dist/daemon/structured-requests/sidecar.js +1 -1
- package/dist/launcher/run.js +1 -1
- package/dist/migrations/004-canvas-documents/apply.d.ts +3 -3
- package/dist/migrations/004-canvas-documents/apply.js +1 -1
- package/dist/migrations/004-canvas-documents/index.d.ts +2 -2
- package/dist/migrations/004-canvas-documents/index.js +2 -2
- package/dist/migrations/activation.js +2 -2
- package/docs/plugin/bundles-and-memory.md +1 -1
- package/docs/plugin/commands.md +1 -1
- package/docs/public-api.md +11 -0
- package/package.json +4 -3
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +12 -12
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/** The one interface every canvas object kind implements: its declared events, how it is
|
|
2
|
-
* addressed, and how it reads. The kind name is what `objects.type` stores. */
|
|
3
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
4
1
|
import type { ReposFn } from '../reader.js';
|
|
5
2
|
import type { ReceiverName } from '../receivers.js';
|
|
6
3
|
import type { CanvasEvent, Level, ObjectRow, Reader } from '../types.js';
|
|
4
|
+
import type { CanvasDb } from '../../canvas/db.js';
|
|
7
5
|
/** A superseding event's attrs: built from the superseded pending delivery's attrs (null when it
|
|
8
6
|
* supersedes nothing) and the new event. */
|
|
9
7
|
export type SupersedeMerge = (prior: Record<string, unknown> | null, ev: CanvasEvent) => Record<string, unknown>;
|
|
@@ -52,18 +50,18 @@ export interface ObjectKind {
|
|
|
52
50
|
/** How a watcher of this kind receives events (a key of `receivers.ts`). Absent: it cannot watch. */
|
|
53
51
|
receiver?: ReceiverName;
|
|
54
52
|
/** Resolve a receiver from this particular object, when it is configured per instance. */
|
|
55
|
-
receiverFor?(db:
|
|
53
|
+
receiverFor?(db: CanvasDb, object: ObjectRow): Promise<ReceiverName | undefined>;
|
|
56
54
|
/** A kind may fence claimed deliveries when a superseding event replaces them. Return true
|
|
57
55
|
* only if the claimed delivery was replaced; model handoffs are not retractable. */
|
|
58
|
-
supersedeClaimed?(db:
|
|
56
|
+
supersedeClaimed?(db: CanvasDb, deliveryId: string): Promise<boolean>;
|
|
59
57
|
/** Records the read (a watch and a `read` event) and renders the object. */
|
|
60
|
-
read(db:
|
|
58
|
+
read(db: CanvasDb, reader: Reader, object: ObjectRow, opts: ReadOpts): Promise<KindRead>;
|
|
61
59
|
/** Extra fields a list or search row carries. */
|
|
62
|
-
listItem?(db:
|
|
60
|
+
listItem?(db: CanvasDb, object: ObjectRow): Promise<Record<string, unknown>>;
|
|
63
61
|
}
|
|
64
62
|
/** Events every kind inherits. */
|
|
65
63
|
export declare const BASE_EVENTS: EventCatalog;
|
|
66
64
|
/** The base events with a kind's own merged over them. */
|
|
67
65
|
export declare function withBase(own?: EventCatalog): EventCatalog;
|
|
68
66
|
/** A live read of a non-document object: the reader watches it and its other watchers hear `read`. */
|
|
69
|
-
export declare function recordLiveRead(db:
|
|
67
|
+
export declare function recordLiveRead(db: CanvasDb, reader: Reader, object: ObjectRow, reposFn: ReposFn): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=Object.defineProperty;var a=(e,r)=>d(e,"name",{value:r,configurable:!0});import{actorOf as l}from"../documents.js";import{publish as c}from"../events.js";import{recordWatch as n}from"../watches.js";const f={created:{level:4},read:{level:1},watched:{level:1},deleted:{level:5},configured:{level:1}};function u(e={}){return{...f,...e}}a(u,"withBase");async function w(e,r,t,i){const o=l(r);o.rowid!==t.rowid&&(await n(e,o,t,"read"),await c(e,{event:"read",object:t,actor:o,attrs:{}},i))}a(w,"recordLiveRead");export{f as BASE_EVENTS,w as recordLiveRead,u as withBase};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).map(
|
|
3
|
-
VALUES (?, ?, ?, ?, ?, 'pending', ?, ?, ?)`);for(const e of
|
|
4
|
-
WHERE n.parent = ? AND o.deleted_at IS NULL ORDER BY o.rowid`).all(
|
|
5
|
-
`);return{data:
|
|
1
|
+
var E=Object.defineProperty;var l=(t,r)=>E(t,"name",{value:r,configurable:!0});import{cancelCronsOnWake as _}from"../../canvas/crons.js";import{settleMatchingControllerWait as T}from"../../canvas/waits.js";import{effectiveTier as b,listenDeliveryTier as R,newId as I}from"../../feed/messages.js";import{readGoal as N}from"../../runtime/kickoff.js";import{canRead as h}from"../access.js";import{objectDTO as f}from"./dto.js";import{recordLiveRead as S,withBase as L}from"./kind.js";import{attr as O,header as D,section as m}from"./render.js";import{filterAsync as j,mapAsync as C}from"../../async-array.js";const p=[3,5,7];function g(t){return t?.split(`
|
|
2
|
+
`).map(r=>r.trim()).find(r=>r!=="")??""}l(g,"firstLine");const K={bodyOwner:l(t=>t[0]?.id??null,"bodyOwner"),async enqueue(t,r,a){const d=Date.now(),s=r.senderNodeId,n=a.map(e=>e.id),c=`(${n.map(()=>"?").join(",")})`,u=s===null?new Set:new Set((await t.prepareUncached(`SELECT DISTINCT node_id FROM waits WHERE kind = 'controller' AND target_id = ? AND satisfied_at IS NULL AND node_id IN ${c}`).all(s,...n)).map(e=>e.node_id)),i=new Set((await t.prepareUncached(`SELECT DISTINCT anchor_node FROM crons WHERE cancel_on_wake = 1 AND anchor_node IN ${c}`).all(...n)).map(e=>e.anchor_node)),w=t.prepare(`INSERT INTO deliveries (delivery_id, message_id, destination_id, urgency, wake, state, created_at, updated_at, idempotency_key)
|
|
3
|
+
VALUES (?, ?, ?, ?, ?, 'pending', ?, ?, ?)`);for(const e of a){const o=R(e.delivery),v=e.reception===2?o.wake:0,y=r.elevatesTier?await b(e.id,o.urgency):o.urgency;await w.run(I(),r.messageId,e.id,y,v,d,d,r.idempotencyKey===void 0?null:`${r.idempotencyKey}:${e.id}`),u.has(e.id)&&await T(e.id,s,d,t),v===1&&y!=="deferred"&&i.has(e.id)&&await _(e.id)}}},J={name:"node",addressable:"id",receiver:"inbox",receiverFor:l(async(t,r)=>await t.prepare("SELECT 1 FROM peer_stubs WHERE object = ?").get(r.rowid)===void 0?"inbox":"peer","receiverFor"),events:L({configured:{level:1,durable:!0},messaged:{level:2,durable:!0},sent:{level:1,durable:!0},"report.update":{level:5,levels:p,durable:!0,carriesBody:!0,elevatesTier:!0},"report.final":{level:7,durable:!0,carriesBody:!0,elevatesTier:!0,inboxKind:"final"},outcome:{level:1,durable:!0,supersedes:!0,carriesBody:!0},"report.result":{level:5,durable:!0,carriesBody:!0,elevatesTier:!0,inboxKind:"completed"},"notice.crash":{level:5,levels:p,durable:!0,carriesBody:!0,elevatesTier:!0},"notice.deadline":{level:5,levels:p,durable:!0,carriesBody:!0,elevatesTier:!0},"notice.close":{level:5,levels:p,durable:!0,carriesBody:!0,elevatesTier:!0}}),async read(t,r,a,d){const s=await t.prepare("SELECT status FROM nodes WHERE node_id = ?").get(a.id),n=l(async e=>await C(await j(e,async o=>await h(t,r,o)),async o=>await f(t,o)),"visible"),c=await t.prepare(`SELECT o.* FROM nodes n JOIN objects o ON o.id = n.node_id
|
|
4
|
+
WHERE n.parent = ? AND o.deleted_at IS NULL ORDER BY o.rowid`).all(a.id),u=await t.prepare("SELECT * FROM objects WHERE owner = ? AND deleted_at IS NULL ORDER BY rowid").all(a.rowid);await S(t,r,a,d.reposFn);const i={status:s?.status??"deleted",mandate_first_line:g(await N(a.id)),children:await n(c),owned:await n(u.filter(e=>e.type!=="job")),jobs:await n(u.filter(e=>e.type==="job"))},w=[D("object",await f(t,a),O("status",i.status)),`Mandate: ${i.mandate_first_line}`,...m("Children",i.children),...m("Owns",i.owned),...m("Jobs",i.jobs)].join(`
|
|
5
|
+
`);return{data:i,text:w}}};export{K as nodeInbox,J as nodeKind};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);return{data:
|
|
1
|
+
var m=Object.defineProperty;var d=(n,t)=>m(n,"name",{value:t,configurable:!0});import{objectDTO as c}from"./dto.js";import{recordLiveRead as l,withBase as h}from"./kind.js";import{header as y}from"./render.js";function i(n){return{name:n,addressable:"handle",events:h(),async read(t,s,e,o){const r=await t.prepare("SELECT scheme, external_id FROM identities WHERE object = ?").get(e.rowid);await l(t,s,e,o.reposFn);const a={handle:e.name,display_name:e.preview||e.name,identity:{scheme:r?.scheme??"",external_id:r?.external_id??""}},p=[y("object",await c(t,e)),`Handle: ${a.handle}`,`Display name: ${a.display_name}`,`Identity: ${a.identity.scheme}:${a.identity.external_id}`].join(`
|
|
2
|
+
`);return{data:a,text:p}}}}d(i,"ownerKind");const E=[i("person"),i("app"),i("repo"),i("profile")];export{E as ownerKinds};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/** The kind registry: kind name → its `ObjectKind`, and each kind's declared events.
|
|
2
|
-
* `createObject` and `publish` go through it, so an undeclared kind cannot be written and an
|
|
3
|
-
* undeclared event cannot be published. It decides no access, fan-out or delivery. */
|
|
4
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
5
1
|
import type { EventSpec, ObjectKind } from './kind.js';
|
|
2
|
+
import type { CanvasDb } from '../../canvas/db.js';
|
|
6
3
|
/** A registration write invalidates the in-process copy before its next lookup. */
|
|
7
|
-
export declare function invalidateCustomKind(db:
|
|
8
|
-
export declare function kindNames(db:
|
|
9
|
-
export declare function isKind(db:
|
|
4
|
+
export declare function invalidateCustomKind(db: CanvasDb, name: string): void;
|
|
5
|
+
export declare function kindNames(db: CanvasDb): Promise<string[]>;
|
|
6
|
+
export declare function isKind(db: CanvasDb, name: string): Promise<boolean>;
|
|
10
7
|
/** The kind named `name`, or throws `unknown_kind`. */
|
|
11
|
-
export declare function kindOf(db:
|
|
8
|
+
export declare function kindOf(db: CanvasDb, name: string): Promise<ObjectKind>;
|
|
12
9
|
/** The declared spec of `event` on `kind`, or throws `unknown_event` naming the declared events. */
|
|
13
|
-
export declare function eventSpec(db:
|
|
10
|
+
export declare function eventSpec(db: CanvasDb, kind: string, event: string): Promise<EventSpec>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m=Object.defineProperty;var o=(t,n)=>m(t,"name",{value:n,configurable:!0});import{CrtrError as d}from"../../errors.js";import{ExitCode as u}from"../../../types.js";import{documentKind as l}from"./document.js";import{jobKind as w}from"./job.js";import{nodeKind as k}from"./node.js";import{actionKind as O}from"./action.js";import{ownerKinds as j}from"./owner.js";import{customKind as E}from"./custom.js";let f=null;function s(){return f??=new Map([l,k,O,w,...j].map(t=>[t.name,t])),f}o(s,"kinds");const a=new WeakMap;function $(t,n){a.get(t)?.delete(n)}o($,"invalidateCustomKind");async function y(t){return[...s().keys(),...(await t.prepare("SELECT name FROM object_kinds ORDER BY name").all()).map(n=>n.name)]}o(y,"kindNames");async function v(t,n){return s().has(n)||await p(t,n)!==null}o(v,"isKind");async function p(t,n){let e=a.get(t);e||(e=new Map,a.set(t,e));const i=e.get(n);if(i)return i;const r=await t.prepare("SELECT events_json FROM object_kinds WHERE name = ?").get(n);if(!r)return null;const c=E(n,JSON.parse(r.events_json));return e.set(n,c),c}o(p,"kindOfCustom");async function g(t,n){const e=s().get(n)??await p(t,n);if(e==null)throw new d("unknown_kind",`no object kind named ${JSON.stringify(n)}; the kinds are ${(await y(t)).join(", ")}`,u.USAGE,{kind:n});return e}o(g,"kindOf");async function N(t,n,e){const i=(await g(t,n)).events,r=Object.hasOwn(i,e)?i[e]:void 0;if(r===void 0)throw new d("unknown_event",`${n} declares no event ${JSON.stringify(e)}; it declares ${Object.keys(i).join(", ")}`,u.USAGE,{kind:n,event:e,declared:Object.keys(i)});return r}o(N,"eventSpec");export{N as eventSpec,$ as invalidateCustomKind,v as isKind,y as kindNames,g as kindOf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { ObjectRow, Reader } from './types.js';
|
|
2
|
+
import type { CanvasDb } from '../canvas/db.js';
|
|
3
3
|
export type Resolution = {
|
|
4
4
|
object: ObjectRow;
|
|
5
5
|
} | {
|
|
@@ -14,7 +14,7 @@ export type Resolution = {
|
|
|
14
14
|
/** The owners a bare name is looked up under, in order: own node, repos nearest
|
|
15
15
|
* first, the profile's project repos, profile, app, you, then the apps whose tools the run may use (installed
|
|
16
16
|
* plugins) with `crtr` last. */
|
|
17
|
-
export declare function viewOf(db:
|
|
17
|
+
export declare function viewOf(db: CanvasDb, reader: Reader): Promise<ObjectRow[]>;
|
|
18
18
|
/** The owner types that carry a handle; `<type>:<handle>/<name>` names one exactly. */
|
|
19
19
|
export declare const HANDLE_TYPES: readonly ["person", "app", "repo", "profile"];
|
|
20
20
|
/** A ref without its `[[ ]]` wrapper. */
|
|
@@ -23,7 +23,7 @@ export declare const unwrapRef: (raw: string) => string;
|
|
|
23
23
|
* holding that handle (handles are unique per type, not across types). Any owner
|
|
24
24
|
* also answers to its object id, so `<owner object id>/<name>` names a document
|
|
25
25
|
* whatever its owner's type. */
|
|
26
|
-
export declare function ownersByHandle(db:
|
|
26
|
+
export declare function ownersByHandle(db: CanvasDb, handle: string, type?: string): Promise<ObjectRow[]>;
|
|
27
27
|
/** `name` may be wrapped in `[[ ]]`, a raw object id, a bare document name,
|
|
28
28
|
* `<owner handle>/<name>`, or `<type>:<owner handle>/<name>`. Under a handle
|
|
29
29
|
* several owner types share, owners in the reader's view come first in view
|
|
@@ -32,11 +32,11 @@ export declare function ownersByHandle(db: DatabaseSync, handle: string, type?:
|
|
|
32
32
|
/** Precomputed for one reader across many resolutions (a corpus names every document). */
|
|
33
33
|
export interface ResolveContext {
|
|
34
34
|
view: ObjectRow[];
|
|
35
|
-
readable: (o: ObjectRow) => boolean
|
|
35
|
+
readable: (o: ObjectRow) => Promise<boolean>;
|
|
36
36
|
}
|
|
37
|
-
export declare function resolveName(db:
|
|
37
|
+
export declare function resolveName(db: CanvasDb, reader: Reader, raw: string, context?: ResolveContext): Promise<Resolution>;
|
|
38
38
|
/** Every readable stub of another machine's object that `raw` (`<owner handle>/<name>`, `<type>:<owner handle>/<name>` or a bare name) names:
|
|
39
39
|
* empty when none does, more than one when the name is ambiguous. `resolveName` never answers a stub, so a stub cannot shadow a local
|
|
40
40
|
* object; this is the lookup a forwarding handler makes only after `resolveName` found no local object, to learn that the name belongs
|
|
41
41
|
* to an object another machine homes. */
|
|
42
|
-
export declare function stubsNamed(db:
|
|
42
|
+
export declare function stubsNamed(db: CanvasDb, reader: Reader, raw: string): Promise<ObjectRow[]>;
|
package/dist/core/graph/names.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
AND deleted_at IS ${
|
|
3
|
-
OR (type IN ('person','app','repo','profile') AND (name = ? OR id = ?) AND home_machine IS NULL)`).all(
|
|
1
|
+
var $=Object.defineProperty;var s=(e,t)=>$(e,"name",{value:t,configurable:!0});import{isSafeNodeId as H}from"../canvas/paths.js";import{canRead as D,toolApps as C}from"./access.js";import{getById as M}from"./objects.js";import{filterAsync as O,findAsync as d,flatMapAsync as h}from"../async-array.js";async function S(e,t){const n=await e.prepare("SELECT * FROM objects WHERE type = 'person' AND name = 'user' AND home_machine IS NULL").get(),r=await C(e,t),o=t.class==="node"?[t.node,...t.repos,...t.projectRepos,t.profile,t.app]:t.class==="app"?[t.app]:t.class==="object"?[t.owner,...t.repos,t.app]:[],c=new Set;return[...o,n,...r].filter(a=>!!a&&!c.has(a.rowid)&&!!c.add(a.rowid))}s(S,"viewOf");async function m(e,t,n,r,o=!1){return await e.prepareUncached(`SELECT * FROM objects WHERE (type = 'document' OR instr(type, '.') > 0) AND owner = ? AND name = ? AND home_machine IS ${o?"NOT NULL":"NULL"}
|
|
2
|
+
AND deleted_at IS ${r?"NOT NULL ORDER BY deleted_at DESC":"NULL"}`).all(t.rowid,n)}s(m,"namedObjects");const b=["person","app","repo","profile"],j=/^(person|app|repo|profile|node):([^/]+)\/(.+)$/,I=s(e=>e.trim().replace(/^\[\[(.*)\]\]$/,"$1").trim(),"unwrapRef");function g(e){const t=j.exec(e);if(t)return{type:t[1],handle:t[2],rest:t[3]};const n=e.indexOf("/");return n>0?{handle:e.slice(0,n),rest:e.slice(n+1)}:null}s(g,"splitOwnerRef");async function x(e,t,n){return n==="node"?await e.prepare("SELECT * FROM objects WHERE type = 'node' AND id = ?").all(t):n?await e.prepare("SELECT * FROM objects WHERE type = ? AND (name = ? OR id = ?) AND home_machine IS NULL").all(n,t,t):await e.prepare(`SELECT * FROM objects WHERE (type = 'node' AND id = ?)
|
|
3
|
+
OR (type IN ('person','app','repo','profile') AND (name = ? OR id = ?) AND home_machine IS NULL)`).all(t,t,t)}s(x,"ownersByHandle");async function P(e,t,n,r){let o=I(n);const c=/^([^:/]+):reports\/(.+?)(?:\.md)?$/.exec(o);c&&!j.test(o)&&(o=`${c[1]}/reports/${c[2]}`);const a=r?.readable??(async p=>await D(e,t,p)),w=await M(e,o);if(w&&await a(w))return w.deleted_at?{deleted:w}:{object:w};const y=r?.view??await S(e,t);for(const p of y){const f=await d(await m(e,p,o,!1),a);if(f)return{object:f}}const u=g(o);if(u){const{type:p,handle:f,rest:R}=u,T=p!==void 0,N=await x(e,f,p),L=s(i=>{const l=y.findIndex(_=>_.rowid===i.rowid);return l<0?1/0:l},"rank"),U=N.filter(i=>L(i)<1/0).sort((i,l)=>L(i)-L(l));for(const i of U){const l=await d(await m(e,i,R,!1),a);if(l)return{object:l}}const E=await O(await h(N,async i=>await m(e,i,R,!1)),a);if(E.length===1)return{object:E[0]};if(E.length>1)return{ambiguous:E};const A=await d(await h(N,async i=>await m(e,i,R,!0)),a);return A?{deleted:A}:!T&&N.length===0&&H(f)?{remote:o}:{missing:!0}}for(const p of y){const f=await d(await m(e,p,o,!0),a);if(f)return{deleted:f}}return{missing:!0}}s(P,"resolveName");async function V(e,t,n){const r=I(n),o=s(async(w,y)=>await O(await h(w,async u=>await m(e,u,y,!1,!0)),async u=>await D(e,t,u)),"found"),c=await o(await S(e,t),r);if(c.length)return c;const a=g(r);return a?await o(await x(e,a.handle,a.type),a.rest):[]}s(V,"stubsNamed");export{b as HANDLE_TYPES,x as ownersByHandle,P as resolveName,V as stubsNamed,I as unwrapRef,S as viewOf};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/** A node's wait on a watched object: armed when a node starts watching an object whose kind declares an
|
|
2
|
-
* event with `endsWait` (a workflow run until `completed`), settled by `publish` when that event lands,
|
|
3
|
-
* by the node stopping its watch, or by the node ending. The rows live in `waits` (kind `object`). */
|
|
4
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
5
1
|
import type { ObjectRow } from './types.js';
|
|
2
|
+
import type { CanvasDb } from '../canvas/db.js';
|
|
6
3
|
/** Whether an object of this kind is something a node waits on: one of its events ends a wait. */
|
|
7
|
-
export declare function kindEndsWait(db:
|
|
4
|
+
export declare function kindEndsWait(db: CanvasDb, type: string): Promise<boolean>;
|
|
8
5
|
/** `watcher` (a node) started watching `object`: arm its wait when the object's kind has an ending event.
|
|
9
6
|
* A node of another machine has no `nodes` row here; its home arms the wait when peer ingest records the watch there. */
|
|
10
|
-
export declare function armObjectWaitForWatch(db:
|
|
7
|
+
export declare function armObjectWaitForWatch(db: CanvasDb, watcher: ObjectRow, object: ObjectRow): Promise<void>;
|
|
11
8
|
/** `watcher` stopped watching `object` entirely: its wait on it is over. */
|
|
12
|
-
export declare function settleObjectWaitForUnwatch(db:
|
|
9
|
+
export declare function settleObjectWaitForUnwatch(db: CanvasDb, watcher: ObjectRow, object: ObjectRow): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n=Object.defineProperty;var a=(i,t)=>n(i,"name",{value:t,configurable:!0});import{armObjectWait as r,settleObjectWaits as o}from"../canvas/waits.js";import{kindOf as s}from"./kinds/registry.js";import{stubOf as f}from"../peer/stubs.js";async function u(i,t){return Object.values((await s(i,t)).events).some(e=>e.endsWait===!0)}a(u,"kindEndsWait");async function O(i,t,e){t.type!=="node"||await f(i,t)!==null||!await u(i,e.type)||await r(i,t.id,e.id)}a(O,"armObjectWaitForWatch");async function W(i,t,e){t.type==="node"&&await o(i,e.id,t.id)}a(W,"settleObjectWaitForUnwatch");export{O as armObjectWaitForWatch,u as kindEndsWait,W as settleObjectWaitForUnwatch};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { ObjectRow, Privacy, Reader } from './types.js';
|
|
2
|
+
import type { CanvasDb } from '../canvas/db.js';
|
|
3
3
|
export type OwnerType = 'person' | 'app' | 'repo' | 'profile';
|
|
4
|
-
export declare function getById(db:
|
|
5
|
-
export declare function getByRowid(db:
|
|
6
|
-
export declare function createObject(db:
|
|
4
|
+
export declare function getById(db: CanvasDb, id: string): Promise<ObjectRow | null>;
|
|
5
|
+
export declare function getByRowid(db: CanvasDb, rowid: number): Promise<ObjectRow | null>;
|
|
6
|
+
export declare function createObject(db: CanvasDb, spec: {
|
|
7
7
|
id?: string;
|
|
8
8
|
type: string;
|
|
9
9
|
kind: string | null;
|
|
@@ -13,25 +13,25 @@ export declare function createObject(db: DatabaseSync, spec: {
|
|
|
13
13
|
preview: string;
|
|
14
14
|
/** Set for a stub, in the insert itself: the name indexes cover only rows without it. */
|
|
15
15
|
home_machine?: string;
|
|
16
|
-
}): ObjectRow
|
|
16
|
+
}): Promise<ObjectRow>;
|
|
17
17
|
/** The owner object for an identity, created on first sight. Idempotent on
|
|
18
18
|
* (scheme, externalId). Handles are unique per owner type: a handle already held
|
|
19
19
|
* by a different identity of the same type throws `conflict` naming both; it is
|
|
20
20
|
* never renamed silently. */
|
|
21
|
-
export declare function ensureOwner(db:
|
|
21
|
+
export declare function ensureOwner(db: CanvasDb, type: OwnerType, scheme: string, externalId: string, handle: string, owner?: ObjectRow): Promise<ObjectRow>;
|
|
22
22
|
/** Give the live profile object of `profileId` the handle `handle`, so `[[handle/x]]` links,
|
|
23
23
|
* `owner=` listings and `--owner profile:<handle>` follow a profile rename. Refuses with
|
|
24
24
|
* `conflict` — before changing anything — when another live profile object holds the handle.
|
|
25
25
|
* A profile with no object yet has nothing to rename (its object is created from the manifest name
|
|
26
26
|
* on first use). Returns whether an object was renamed. Links are edges to ids, so they keep resolving. */
|
|
27
|
-
export declare function renameProfileObject(db:
|
|
27
|
+
export declare function renameProfileObject(db: CanvasDb, profileId: string, handle: string): Promise<boolean>;
|
|
28
28
|
/** The owner object of a node grantee: `user:local` → person `user`; `app:<x>` → app `<x>`. */
|
|
29
|
-
export declare function ownerForGrantee(db:
|
|
29
|
+
export declare function ownerForGrantee(db: CanvasDb, grantee: string): Promise<ObjectRow>;
|
|
30
30
|
/** The owner's live document named `name`, or null. */
|
|
31
|
-
export declare function liveDocumentNamed(db:
|
|
32
|
-
export declare function nodeObject(db:
|
|
33
|
-
export declare function setObjectName(db:
|
|
34
|
-
export declare function setObjectKind(db:
|
|
31
|
+
export declare function liveDocumentNamed(db: CanvasDb, owner: number, name: string): Promise<ObjectRow | null>;
|
|
32
|
+
export declare function nodeObject(db: CanvasDb, nodeId: string): Promise<ObjectRow>;
|
|
33
|
+
export declare function setObjectName(db: CanvasDb, object: ObjectRow, name: string): Promise<void>;
|
|
34
|
+
export declare function setObjectKind(db: CanvasDb, object: ObjectRow, kind: string | null): Promise<void>;
|
|
35
35
|
export interface ObjectFilter {
|
|
36
36
|
type?: string;
|
|
37
37
|
kind?: string;
|
|
@@ -45,7 +45,7 @@ export interface Page {
|
|
|
45
45
|
after_rowid?: number;
|
|
46
46
|
}
|
|
47
47
|
/** Objects the reader can read, in rowid order. Records nothing. `limit` ≤ 100. */
|
|
48
|
-
export declare function listObjects(db:
|
|
48
|
+
export declare function listObjects(db: CanvasDb, reader: Reader, filter: ObjectFilter, page?: Page): Promise<ObjectRow[]>;
|
|
49
49
|
export interface SearchQuery {
|
|
50
50
|
text: string;
|
|
51
51
|
body?: boolean;
|
|
@@ -61,4 +61,4 @@ export interface SearchHit {
|
|
|
61
61
|
* matches name, preview and document summary as a substring; `body` also scans
|
|
62
62
|
* each document's head bodies for the substring, and `grep` scans them for `text`
|
|
63
63
|
* as a regular expression. Body search reads every readable body: linear, no index. */
|
|
64
|
-
export declare function searchObjects(db:
|
|
64
|
+
export declare function searchObjects(db: CanvasDb, reader: Reader, query: SearchQuery): Promise<SearchHit[]>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`).get(e.id??
|
|
3
|
-
WHERE i.scheme = ? AND i.external_id = ?`).get(
|
|
1
|
+
var y=Object.defineProperty;var a=(o,e)=>y(o,"name",{value:e,configurable:!0});import{CrtrError as L,notFound as j}from"../errors.js";import{ExitCode as O}from"../../types.js";import{newNodeId as _}from"../runtime/nodes.js";import{kindOf as b}from"./kinds/registry.js";import{canRead as l}from"./access.js";import{bodyOf as A}from"./bodies.js";const I=new Set(["person","app","repo","profile"]);function h(o){return o||null}a(h,"rowFrom");async function T(o,e){return h(await o.prepare("SELECT * FROM objects WHERE id = ?").get(e))}a(T,"getById");async function M(o,e){return h(await o.prepare("SELECT * FROM objects WHERE rowid = ?").get(e))}a(M,"getByRowid");async function x(o,e){return await b(o,e.type),await o.prepare(`INSERT INTO objects (id, type, kind, owner, privacy, name, preview, created_at, home_machine)
|
|
2
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`).get(e.id??await _(),e.type,e.kind,e.owner,e.privacy,e.name,e.preview,new Date().toISOString(),e.home_machine??null)}a(x,"createObject");async function R(o,e,t,i,n,r){if(!I.has(e))throw new Error(`ensureOwner: ${e} is not an owner type`);const d=await o.prepare(`SELECT o.* FROM identities i JOIN objects o ON o.rowid = i.object
|
|
3
|
+
WHERE i.scheme = ? AND i.external_id = ?`).get(t,i);if(d)return d;const s=await o.prepare(`SELECT o.id, o.type, i.scheme, i.external_id FROM objects o
|
|
4
4
|
LEFT JOIN identities i ON i.object = o.rowid
|
|
5
|
-
WHERE o.name = ? AND o.type = ? AND o.home_machine IS NULL`).get(n,e);if(
|
|
6
|
-
WHERE i.scheme = 'profile' AND i.external_id = ? AND o.type = 'profile' AND o.deleted_at IS NULL`).get(e),n=
|
|
7
|
-
WHERE o.name = ? AND o.type = 'profile' AND o.deleted_at IS NULL AND o.home_machine IS NULL AND o.rowid <> ?`).get(
|
|
5
|
+
WHERE o.name = ? AND o.type = ? AND o.home_machine IS NULL`).get(n,e);if(s)throw new L("conflict",`handle "${n}" is held by ${s.type} ${s.id} (${s.scheme}:${s.external_id}); cannot give it to ${e} ${t}:${i}`,O.GENERAL,{handle:n,holder:s.id});const p=await x(o,{type:e,kind:null,owner:e==="profile"?r?.rowid??null:null,privacy:"public",name:n,preview:""});return await o.prepare("INSERT INTO identities (object, scheme, external_id) VALUES (?, ?, ?)").run(p.rowid,t,i),p}a(R,"ensureOwner");async function k(o,e,t){const i=await o.prepare(`SELECT o.* FROM identities i JOIN objects o ON o.rowid = i.object
|
|
6
|
+
WHERE i.scheme = 'profile' AND i.external_id = ? AND o.type = 'profile' AND o.deleted_at IS NULL`).get(e),n=await o.prepare(`SELECT o.id FROM objects o
|
|
7
|
+
WHERE o.name = ? AND o.type = 'profile' AND o.deleted_at IS NULL AND o.home_machine IS NULL AND o.rowid <> ?`).get(t,i?i.rowid:-1);if(n)throw new L("conflict",`handle "${t}" is already held by profile object ${n.id}; cannot rename profile ${e} to it`,O.GENERAL,{handle:t,holder:n.id});if(!i)return!1;const r=i;return r.name===t?!1:(await D(o,r,t),!0)}a(k,"renameProfileObject");async function P(o,e){if(e==="user:local")return await R(o,"person","local-user",e,"user");if(/^app:[a-z0-9][a-z0-9._-]*$/.test(e))return await R(o,"app","app",e,e.slice(4));throw new Error(`node grantee ${JSON.stringify(e)} is neither app:<name> nor user:local`)}a(P,"ownerForGrantee");async function J(o,e,t){return h(await o.prepare("SELECT * FROM objects WHERE (type = 'document' OR instr(type, '.') > 0) AND owner = ? AND name = ? AND deleted_at IS NULL AND home_machine IS NULL").get(e,t))}a(J,"liveDocumentNamed");async function B(o,e){const t=await T(o,e);if(!t||t.type!=="node")throw j(`no node object ${e}`);return t}a(B,"nodeObject");async function D(o,e,t){await o.prepare("UPDATE objects SET name = ? WHERE rowid = ?").run(t,e.rowid)}a(D,"setObjectName");async function G(o,e,t){await o.prepare("UPDATE objects SET kind = ? WHERE rowid = ?").run(t,e.rowid)}a(G,"setObjectKind");async function K(o,e,t,i={}){const n=["rowid > ?"],r=[i.after_rowid??0];return t.type!==void 0&&(n.push("type = ?"),r.push(t.type)),t.kind!==void 0&&(n.push("kind = ?"),r.push(t.kind)),t.owner!==void 0&&(n.push("owner = ?"),r.push(t.owner.rowid)),t.privacy!==void 0&&(n.push("privacy = ?"),r.push(t.privacy)),t.name!==void 0&&(n.push("name = ?"),r.push(t.name)),n.push("home_machine IS NULL"),n.push(t.deleted?"deleted_at IS NOT NULL":"deleted_at IS NULL"),await g(o,e,`SELECT * FROM objects WHERE ${n.join(" AND ")}`,r,Math.min(i.limit??100,100))}a(K,"listObjects");async function Y(o,e,t){const n=[],r=`%${t.text.replace(/[\\%_]/g,c=>`\\${c}`)}%`;if(!t.grep){const c=await o.prepare(`SELECT o.*, d.summary AS _summary FROM objects o LEFT JOIN documents d ON d.object = o.rowid
|
|
8
8
|
WHERE o.deleted_at IS NULL AND o.home_machine IS NULL AND (o.name LIKE ?1 ESCAPE '\\' OR o.preview LIKE ?1 ESCAPE '\\' OR d.summary LIKE ?1 ESCAPE '\\')
|
|
9
|
-
ORDER BY o.rowid`).all(r),
|
|
10
|
-
AND NOT EXISTS (SELECT 1 FROM revision_parents p WHERE p.parent = r.rowid)`);for(const c of
|
|
11
|
-
`),
|
|
9
|
+
ORDER BY o.rowid`).all(r),w=t.text.toLowerCase();for(const f of c){const{_summary:E,...u}=f,m=u;if(!await l(o,e,m))continue;const N=m.name.toLowerCase().includes(w)?"name":m.preview.toLowerCase().includes(w)?"preview":"summary";if(n.push({object:m,field:N,...N==="summary"?{text:String(E)}:{}}),n.length>=100)return n}}if(!t.body&&!t.grep)return n;const d=new Set(n.map(c=>c.object.rowid)),s=t.grep?(c=>w=>c.test(w))(new RegExp(t.text)):c=>c.includes(t.text),p=await o.prepare("SELECT * FROM objects WHERE type = 'document' AND deleted_at IS NULL ORDER BY rowid").all(),S=o.prepare(`SELECT r.body_hash, d.source_path FROM revisions r JOIN documents d ON d.object = r.document WHERE r.document = ?
|
|
10
|
+
AND NOT EXISTS (SELECT 1 FROM revision_parents p WHERE p.parent = r.rowid)`);for(const c of p)if(!(d.has(c.rowid)||!await l(o,e,c)))for(const{body_hash:w,source_path:f}of await S.all(c.rowid)){const E=A(w,f).split(`
|
|
11
|
+
`),u=E.findIndex(s);if(!(u<0)){if(n.push({object:c,field:"body",line:u+1,text:E[u]}),n.length>=100)return n;break}}return n}a(Y,"searchObjects");async function g(o,e,t,i,n){const r=[],d=o.prepareUncached(`${t} ORDER BY rowid LIMIT ${n*4}`);for(;;){const s=await d.all(...i);for(const p of s)if(await l(o,e,p)&&r.push(p),r.length===n)return r;if(s.length<n*4)return r;i[0]=s[s.length-1].rowid}}a(g,"readablePages");export{x as createObject,R as ensureOwner,T as getById,M as getByRowid,K as listObjects,J as liveDocumentNamed,B as nodeObject,P as ownerForGrantee,k as renameProfileObject,Y as searchObjects,G as setObjectKind,D as setObjectName};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
/** Package documents: builtin (`crtr`) and plugin documents stay files in their package; this
|
|
2
|
-
* converges their `objects`/`documents` rows, their one revision and their rules onto those
|
|
3
|
-
* files (contract §6.6). Bodies are read from `documents.source_path`, never the body store.
|
|
4
|
-
* A plugin is an app: its documents belong to the app `<plugin>` (identity `app:<plugin>`,
|
|
5
|
-
* the one `ownerForGrantee` gives), and a document with a `source_path` is shipped. */
|
|
6
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
7
1
|
import { type QuarantinedPlugin } from '../plugin-quarantine.js';
|
|
2
|
+
import type { CanvasDb } from '../canvas/db.js';
|
|
8
3
|
export interface PackageSource {
|
|
9
4
|
plugin: string;
|
|
10
5
|
dir: string;
|
|
@@ -32,4 +27,4 @@ export interface PackageReconcileReport {
|
|
|
32
27
|
* each document's link edges, which land the same). A changed body replaces the
|
|
33
28
|
* document's single revision and publishes `edited`; a vanished file (or plugin) marks its
|
|
34
29
|
* document deleted and publishes `deleted`. */
|
|
35
|
-
export declare function reconcilePackageDocuments(db:
|
|
30
|
+
export declare function reconcilePackageDocuments(db: CanvasDb, explicitSources?: readonly PackageSource[]): Promise<PackageReconcileReport>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
WHERE o.type = 'document' AND o.deleted_at IS NULL AND d.source_path IS NOT NULL`).all();for(const{rowid:
|
|
3
|
-
WHERE o.type = 'document' AND o.owner = ? AND o.deleted_at IS NULL AND d.source_path = ?`).get(
|
|
4
|
-
WHERE o.type = 'document' AND o.owner = ? AND o.deleted_at IS NULL AND o.name = ? AND d.source_path IS NOT NULL`).get(
|
|
5
|
-
WHERE o.type = 'document' AND o.owner = ? AND o.deleted_at IS NULL AND d.source_path IS NOT NULL`).all(
|
|
1
|
+
var v=Object.defineProperty;var u=(e,a)=>v(e,"name",{value:a,configurable:!0});import{createHash as O,randomUUID as _}from"node:crypto";import{CrtrError as E}from"../errors.js";import{emitEvent as D}from"../events/emit.js";import{quarantineBrokenPlugins as I}from"../plugin-quarantine.js";import{listInstalledPlugins as A}from"../resolver.js";import{builtinMemoryRoot as k,pluginMemoryDir as L}from"../scope.js";import{documentFields as T}from"../../migrations/004-canvas-documents/fields.js";import{applyDocumentFields as j,deleteDocument as R,documentRecord as x,heads as U,importDocument as F,linksIn as b,moveDocument as J}from"./documents.js";import{isShipped as C}from"./access.js";import{setLinks as H}from"./edges.js";import{publish as W}from"./events.js";import{resolveName as M}from"./names.js";import{packageFiles as P}from"./package-files.js";import{ensureOwner as q,getByRowid as h,setObjectKind as B}from"./objects.js";import{checkoutsForCwd as K}from"./repo-sync/repos.js";import{rulesOf as $}from"./rules.js";function z(){return[{plugin:"crtr",dir:k()},...A("user").filter(e=>e.enabled).map(e=>({plugin:e.name,dir:L(e)}))]}u(z,"packageSources");const G=u(e=>O("sha256").update(e,"utf8").digest("hex"),"sha256");async function we(e,a){const n={created:0,updated:0,deleted:0,conflicts:[],invalid:[],quarantined:[]};if(a===void 0){n.quarantined=I();for(const o of n.quarantined)D({level:"error",event:"daemon.plugins.quarantined",fields:{plugin:o.name,file:o.file,reason:o.reason,...o.movedTo!==void 0?{moved_to:o.movedTo}:{}}})}const l=a??z(),p=u(async o=>await K(e,o),"reposFn"),i=new Set,r=[],w=new Set;for(const o of l){let s;try{if(w.has(o.plugin))throw new E("conflict",`plugin "${o.plugin}" is already provided by another package`);w.add(o.plugin),s=await q(e,"app","app",`app:${o.plugin}`,o.plugin)}catch(c){if(!(c instanceof E)||c.code!=="conflict")throw c;n.conflicts.push({plugin:o.plugin,message:c.message});continue}i.add(s.rowid);const{files:m,invalid:f}=P(o.dir);n.invalid.push(...f);const y=new Set;for(const c of m){const d=await V(e,s,c,n,p);y.add(d),r.push({owner:s,rowid:d,body:c.body})}await S(e,s,y,n,p)}const t=await e.prepare(`SELECT DISTINCT o.owner AS rowid FROM objects o JOIN documents d ON d.object = o.rowid
|
|
2
|
+
WHERE o.type = 'document' AND o.deleted_at IS NULL AND d.source_path IS NOT NULL`).all();for(const{rowid:o}of t)i.has(o)||await S(e,await h(e,o),new Set,n,p);for(const{owner:o,rowid:s,body:m}of r)await Q(e,o,await h(e,s),m);return n}u(we,"reconcilePackageDocuments");async function Q(e,a,n,l){if(n.deleted_at!==null)return;const p={class:"app",app:a,scopes:[]},i=[];for(const t of b(l)){const o=await M(e,p,t);"object"in o&&o.object.rowid!==n.rowid&&await C(e,o.object)&&i.push({written_as:t,dst:o.object})}const r=u(t=>JSON.stringify(t.map(o=>[o.dst,o.written_as]).sort()),"key"),w=await e.prepare("SELECT dst, written_as FROM edges WHERE type = 'links-to' AND src = ?").all(n.rowid);r(w)!==r(i.map(t=>({dst:t.dst.rowid,written_as:t.written_as})))&&await H(e,n,i)}u(Q,"deriveLinks");async function V(e,a,n,l,p){const i=T(n.frontmatter,n.body,{missingPrivacy:"public"}),r={preview:i.preview.trim()===""?n.name:i.preview,summary:i.summary,whyItExists:i.whyItExists,unlisted:i.unlisted,rules:i.rules,lintIgnore:Array.isArray(i.lintIgnore)?i.lintIgnore.filter(d=>typeof d=="string"):null,extensions:i.extensions!==null&&typeof i.extensions=="object"&&!Array.isArray(i.extensions)?i.extensions:null},w=G(n.body);let t=await e.prepare(`SELECT o.* FROM objects o JOIN documents d ON d.object = o.rowid
|
|
3
|
+
WHERE o.type = 'document' AND o.owner = ? AND o.deleted_at IS NULL AND d.source_path = ?`).get(a.rowid,n.path);if(t||(t=await e.prepare(`SELECT o.* FROM objects o JOIN documents d ON d.object = o.rowid
|
|
4
|
+
WHERE o.type = 'document' AND o.owner = ? AND o.deleted_at IS NULL AND o.name = ? AND d.source_path IS NOT NULL`).get(a.rowid,n.name),t&&await e.prepare("UPDATE documents SET source_path = ? WHERE object = ?").run(n.path,t.rowid)),!t){const d=await F(e,{owner:a,name:n.name,kind:i.kind,privacy:"public",...r,revisions:[{body_hash:w,author:a,rationale:null,created_at:new Date().toISOString()}]});return await e.prepare("UPDATE documents SET source_path = ? WHERE object = ?").run(n.path,d.rowid),l.created+=1,d.rowid}const o=t.name!==n.name||t.kind!==i.kind;t.name!==n.name&&(t=await J(e,null,t,{name:n.name})),t.kind!==i.kind&&(await B(e,t,i.kind),t=await h(e,t.rowid));const s=await x(e,t),[m]=await U(e,t),f=m?.body_hash!==w,y=t.preview!==r.preview||s.summary!==r.summary||s.why_it_exists!==r.whyItExists||s.unlisted!==r.unlisted||JSON.stringify(s.lint_ignore)!==JSON.stringify(r.lintIgnore)||JSON.stringify(s.extensions)!==JSON.stringify(r.extensions)||JSON.stringify((await $(e,t)).map(N))!==JSON.stringify(r.rules.map(N));if(!f&&!y&&!o)return t.rowid;const c=await j(e,t,r);if(f&&m){const d=_(),g=m.number+1;await e.prepare("UPDATE revisions SET rev_id = ?, number = ?, body_hash = ?, created_at = ? WHERE rowid = ?").run(d,g,w,new Date().toISOString(),m.rowid),await e.prepare("UPDATE documents SET heads_key = ?, revision = ? WHERE object = ?").run(d,g,c.rowid),await W(e,{event:"edited",object:c,actor:a,pointer:d,attrs:{revision:g,from_revision:m.number,rationale:"package file changed"}},p)}return l.updated+=1,c.rowid}u(V,"convergeFile");function N(e){return[e.on,e.deliver,e.match??null,e.matchFrontmatter??null,e.if??null]}u(N,"ruleKey");async function S(e,a,n,l,p){const i=await e.prepare(`SELECT o.* FROM objects o JOIN documents d ON d.object = o.rowid
|
|
5
|
+
WHERE o.type = 'document' AND o.owner = ? AND o.deleted_at IS NULL AND d.source_path IS NOT NULL`).all(a.rowid);for(const r of i)n.has(r.rowid)||(await R(e,null,r,p),l.deleted+=1)}u(S,"deleteMissing");export{z as packageSources,we as reconcilePackageDocuments};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* A kind is never deleted and its catalog is never altered when undeclared: only `declared` flips, so the
|
|
3
|
-
* instances of a dropped kind go inert instead of vanishing. */
|
|
4
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
1
|
+
import type { CanvasDb } from '../canvas/db.js';
|
|
5
2
|
export interface KindsReport {
|
|
6
3
|
/** every kind a valid plugin declares that now has its row, and what upserting it did */
|
|
7
4
|
applied: Array<{
|
|
@@ -22,4 +19,4 @@ export interface KindsReport {
|
|
|
22
19
|
error: string;
|
|
23
20
|
}>;
|
|
24
21
|
}
|
|
25
|
-
export declare function reconcilePackageKinds(db:
|
|
22
|
+
export declare function reconcilePackageKinds(db: CanvasDb): Promise<KindsReport>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u=Object.defineProperty;var d=(o,i)=>u(o,"name",{value:i,configurable:!0});import{CrtrError as p}from"../errors.js";import{invalidAppPlugins as l,kindPlugins as f}from"../plugin-app.js";import{upsertKind as g}from"./custom.js";import{ensureOwner as w}from"./objects.js";async function j(o){const i={applied:[],refused:[],invalid:l().map(e=>({plugin:e.plugin.name,error:e.error}))},t=new Set;for(const e of f()){const s=Object.entries(e.manifest.object_kinds??{});if(s.length===0)continue;let c;try{c=await w(o,"app","app",`app:${e.name}`,e.name)}catch(n){if(!(n instanceof p)||n.code!=="conflict")throw n;i.invalid.push({plugin:e.name,error:n.message});continue}for(const[n,a]of s)try{const r=await g(o,{name:n,owner:c,description:a.description,events:a.events,read:a.read===void 0?null:{command:a.read.command},source:"manifest"});if(r.outcome==="skipped")continue;t.add(n),i.applied.push({plugin:e.name,kind:n,outcome:r.outcome})}catch(r){if(!(r instanceof p)||r.code!=="kind_owned")throw r;i.refused.push({plugin:e.name,kind:n,code:"kind_owned",message:r.message})}}const m=await o.prepare("SELECT name FROM object_kinds WHERE source = 'manifest' AND declared = 1").all();for(const{name:e}of m)t.has(e)||await o.prepare("UPDATE object_kinds SET declared = 0 WHERE name = ?").run(e);return i}d(j,"reconcilePackageKinds");export{j as reconcilePackageKinds};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/** The one package reconcile pass: documents, then kinds, then plugin app tokens. Runs in the caller's write
|
|
2
|
-
* transaction. The token writes go to the secrets store and are idempotent, so a rolled-back pass re-converges
|
|
3
|
-
* on the next one. */
|
|
4
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
5
1
|
import { type KindsReport } from './package-kinds.js';
|
|
6
2
|
import { type PackageReconcileReport } from './package-docs.js';
|
|
3
|
+
import type { CanvasDb } from '../canvas/db.js';
|
|
7
4
|
export interface TokensReport {
|
|
8
5
|
/** plugins holding a `crtr_app_` token, with the manifest scopes it carries */
|
|
9
6
|
granted: Array<{
|
|
@@ -17,4 +14,4 @@ export interface PackagesReport extends PackageReconcileReport {
|
|
|
17
14
|
kinds: KindsReport;
|
|
18
15
|
tokens: TokensReport;
|
|
19
16
|
}
|
|
20
|
-
export declare function reconcilePackages(db:
|
|
17
|
+
export declare function reconcilePackages(db: CanvasDb): Promise<PackagesReport>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var a=(o,t)=>p(o,"name",{value:t,configurable:!0});import{appPlugins as u}from"../plugin-app.js";import{ensurePluginAppToken as f,listScopedApiTokens as g,revokePluginAppTokens as l}from"../secrets.js";import{reconcilePackageKinds as m}from"./package-kinds.js";import{reconcilePackageDocuments as d}from"./package-docs.js";async function A(o){const t=await d(o),i=await m(o),s={granted:[],revoked:[]},r=new Set;for(const e of u()){const n=e.manifest.scopes??[];f(e.name,n),r.add(e.name),s.granted.push({plugin:e.name,scopes:[...n]})}const c=new Set;for(const e of g("user")){if(!e.token.startsWith("crtr_app_")||!e.grantee.startsWith("app:"))continue;const n=e.grantee.slice(4);r.has(n)||c.add(n)}for(const e of c)l(e)&&s.revoked.push(e);return{...t,kinds:i,tokens:s}}a(A,"reconcilePackages");export{A as reconcilePackages};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { RequestPrincipal } from '../../daemon/api/router.js';
|
|
3
2
|
import { type ActiveGrant } from '../grants/mirror.js';
|
|
3
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
4
4
|
import type { Checkout, ObjectRow, Reader } from './types.js';
|
|
5
5
|
/** The repos enclosing a directory, with their checkout roots, nearest first. */
|
|
6
|
-
export type ReposFn = (cwd: string) => Checkout[]
|
|
6
|
+
export type ReposFn = (cwd: string) => Promise<Checkout[]>;
|
|
7
7
|
/** A node's view of repos: the ones enclosing its cwd, then those of each project path of its profile
|
|
8
8
|
* (manifest order), each repo once. A project path that no longer exists, is not in a repo, or has no
|
|
9
9
|
* work tree (a bare repository) contributes nothing. */
|
|
10
|
-
export declare function viewRepos(cwd: string, profileId: string | null, reposFn: ReposFn, lookups: Pick<ReaderLookups, 'projectPaths'>): Pick<Extract<Reader, {
|
|
10
|
+
export declare function viewRepos(cwd: string, profileId: string | null, reposFn: ReposFn, lookups: Pick<ReaderLookups, 'projectPaths'>): Promise<Pick<Extract<Reader, {
|
|
11
11
|
class: 'node';
|
|
12
|
-
}>, 'repos' | 'checkouts' | 'projectRepos' | 'projectCheckouts'
|
|
13
|
-
export declare function readerFor(db:
|
|
12
|
+
}>, 'repos' | 'checkouts' | 'projectRepos' | 'projectCheckouts'>>;
|
|
13
|
+
export declare function readerFor(db: CanvasDb, principal: RequestPrincipal, reposFn: ReposFn): Promise<Exclude<Reader, {
|
|
14
14
|
class: 'object';
|
|
15
|
-
}
|
|
16
|
-
export declare function readerForNode(db:
|
|
15
|
+
}>>;
|
|
16
|
+
export declare function readerForNode(db: CanvasDb, nodeId: string, reposFn: ReposFn, lookups?: ReaderLookups, allowRevoked?: boolean): Promise<Extract<Reader, {
|
|
17
17
|
class: 'node';
|
|
18
|
-
}
|
|
18
|
+
}>>;
|
|
19
19
|
/** A receiving object reads using its owner's app grant, not its registering caller's rights. */
|
|
20
|
-
export declare function readerForObject(db:
|
|
20
|
+
export declare function readerForObject(db: CanvasDb, watcher: ObjectRow, reposFn?: ReposFn, lookups?: ReaderLookups): Promise<Extract<Reader, {
|
|
21
21
|
class: 'node' | 'object';
|
|
22
|
-
}
|
|
22
|
+
}>>;
|
|
23
23
|
/** The scopes `app` (an app object) holds now: its one active grant's always-scopes, or a local plugin's `crtr_app_` token scopes when it has no
|
|
24
24
|
* grant; null for several grants or none that applies. The same rule as an app-owned object's reader (`readerForObject`). */
|
|
25
|
-
export declare function appScopesNow(db:
|
|
25
|
+
export declare function appScopesNow(db: CanvasDb, app: ObjectRow, lookups: ReaderLookups): Promise<readonly string[] | null>;
|
|
26
26
|
/** What building a node reader looks up besides the node's own row. `liveLookups` reads each
|
|
27
27
|
* one per call; `publishLookups` memoizes them for one publish inside its transaction, so the
|
|
28
28
|
* readers of one event share a single config read and one lookup per grant, owner and
|
|
29
29
|
* profile. Never keep a memoized one past that transaction. */
|
|
30
30
|
export interface ReaderLookups {
|
|
31
|
-
grantById(grantId: string): ActiveGrant | null
|
|
32
|
-
grantFor(app: string, sub: string): ActiveGrant | null
|
|
31
|
+
grantById(grantId: string): Promise<ActiveGrant | null>;
|
|
32
|
+
grantFor(app: string, sub: string): Promise<ActiveGrant | null>;
|
|
33
33
|
terminalHasIssuer(): boolean;
|
|
34
34
|
/** The scopes of the `crtr_app_` token a local plugin's app (`app:<plugin>`) holds, or null when it holds none. */
|
|
35
35
|
pluginScopes(grantee: string): readonly string[] | null;
|
|
36
|
-
object(rowid: number): ObjectRow | null
|
|
37
|
-
profile(profileId: string, app: ObjectRow): ObjectRow
|
|
36
|
+
object(rowid: number): Promise<ObjectRow | null>;
|
|
37
|
+
profile(profileId: string, app: ObjectRow): Promise<ObjectRow>;
|
|
38
38
|
/** The profile's project paths in manifest order; none in a sandboxed node, whose profile store is unreadable. */
|
|
39
39
|
projectPaths(profileId: string): readonly string[];
|
|
40
40
|
}
|
|
41
|
-
export declare function liveLookups(db:
|
|
42
|
-
export declare function publishLookups(db:
|
|
43
|
-
export declare function profileObject(db:
|
|
41
|
+
export declare function liveLookups(db: CanvasDb): ReaderLookups;
|
|
42
|
+
export declare function publishLookups(db: CanvasDb): ReaderLookups;
|
|
43
|
+
export declare function profileObject(db: CanvasDb, profileId: string, app: ObjectRow): Promise<ObjectRow>;
|