@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
package/dist/core/feed/feed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var N=Object.defineProperty;var i=(e,t)=>N(e,"name",{value:t,configurable:!0});import{
|
|
2
|
-
`)[0]??"";return r.length>t?`${r.slice(0,t-1)}\u2026`:r}i(
|
|
1
|
+
var N=Object.defineProperty;var i=(e,t)=>N(e,"name",{value:t,configurable:!0});import{cancelCronsOnWake as O,getNode as E}from"../canvas/index.js";import{runStructuredRequestEffects as y,settleStructuredRequestIn as R}from"../canvas/structured-requests.js";import{openDb as q,withCanvasWrite as T}from"../canvas/db.js";import{randomUUID as x}from"node:crypto";import{composeNodeOutcomeDocument as F}from"../runtime/outcome-document.js";import{closeNode as M}from"../runtime/close.js";import{put as W}from"../graph/bodies.js";import{writeDocument as z}from"../graph/documents.js";import{asRuntimeWriter as A}from"../graph/spaces/own-memory.js";import{publish as k}from"../graph/events.js";import{nodeObject as v}from"../graph/objects.js";import{readerForNode as L}from"../graph/reader.js";import{endMessageSubscriptions as C}from"../graph/watches.js";import{operationIdContext as D}from"../events/operation-id.js";class H extends Error{static{i(this,"StructuredRequestFinalizationError")}state;constructor(t){super(t==="expired"?"structured_request_expired":"structured_request_settled"),this.state=t}}class h extends Error{static{i(this,"FinalizationError")}code;report;constructor(t,r){super(t),this.code=t,this.report=r}}function j(e){const t=i((r,n=2)=>String(r).padStart(n,"0"),"pad");return`${e.getUTCFullYear()}${t(e.getUTCMonth()+1)}${t(e.getUTCDate())}T${t(e.getUTCHours())}${t(e.getUTCMinutes())}${t(e.getUTCSeconds())}${t(e.getUTCMilliseconds(),3)}`}i(j,"compactTs");function S(e,t=80){const r=e.split(`
|
|
2
|
+
`)[0]??"";return r.length>t?`${r.slice(0,t-1)}\u2026`:r}i(S,"firstLine");function B(e){return e.kind==="final"?{event:"report.final"}:e.result!==void 0?{event:"report.result"}:e.kind==="urgent"?{event:"report.update",level:7}:{event:"report.update",level:e.deliveryTier==="deferred"?3:e.deliveryTier==="urgent"?7:5}}i(B,"eventFor");async function U(e,t,r){const n=r.from??t,o=`reports/${j(new Date)}-${x().slice(-8)}-${r.kind}`,u=await v(e,t),c=await v(e,n),{object:d}=await z(e,A(await L(e,n,async()=>[])),{owner:u,kind:"report",name:o,preview:S(r.body)||r.kind,privacy:"public"},r.body),s=`${t}/${o}`,{event:p,level:m}=B(r);await k(e,{event:p,object:u,actor:c,...m===void 0?{}:{level:m},attrs:{},pointer:d.id,messageBody:{kind:r.kind,label:S(r.body),bodyRef:s,...r.disposition===void 0?{}:{disposition:r.disposition}}});const l=(await e.prepare(`SELECT d.destination_id FROM deliveries d JOIN messages m ON m.message_id = d.message_id
|
|
3
3
|
JOIN objects receiver ON receiver.id = d.destination_id
|
|
4
|
-
WHERE m.body_ref = ? AND receiver.type = 'node' ORDER BY d.destination_id`).all(
|
|
4
|
+
WHERE m.body_ref = ? AND receiver.type = 'node' ORDER BY d.destination_id`).all(s)).map(w=>w.destination_id);return r.kind==="final"?await C(e,u,"final"):r.result?.requestMessageId&&await C(e,u,{result:r.result.requestMessageId}),{name:o,ref:s,doc:d,createdAt:d.created_at,deliveredTo:l}}i(U,"writeReport");async function J(e,t){return T(async r=>{const n=await r.prepare("SELECT status, final_report FROM nodes WHERE node_id = ?").get(e);if(n===void 0)throw new h("unknown_node");const o=t.outcome;let u;if(o?.structured!==void 0){const a=await R(r,o.structured.requestId,o.structured.declined===void 0?{intended:"completed",result:o.structured.value}:{intended:"declined",declined:o.structured.declined});if(!a.changed||a.row===null||a.row.state!=="completed"&&a.row.state!=="declined")return{written:void 0,...a.row===null?{}:{structured:a.row},structuredRefused:!0};u=a.row}else{const a=await r.prepareUncached("SELECT request_id FROM structured_requests WHERE node_id = ? AND state = 'pending'").get(e);if(a!==void 0){const f=await R(r,a.request_id,{intended:"failed",failureReason:"finalized"});if(!f.changed||f.row===null||f.row.state!=="failed")return{written:void 0,...f.row===null?{}:{structured:f.row},structuredRefused:!0};u=f.row}}if(n.final_report!==null)throw new h("already_finalized",`${e}/${n.final_report}`);if(n.status!=="active"&&n.status!=="idle"&&n.status!=="done")throw new h("finalization_forbidden");const c=await U(r,e,t),d=await E(e),s=d?.kind!=="human",p=(d?.outcome_revision??0)+1,m=t.outcome?.kind??"result",l=t.outcome?.reason??"finalized",w=t.outcome?.detailJson??null,_=c.createdAt;if(s){const a=d===null?null:await F({node:{...d,status:"done",intent:"done",terminal_reason:l},outcome:{kind:m,reason:l,at:_,revision:p,detailJson:w},finalReport:c.name,...u?.state==="completed"?{structuredResult:u.result}:{}});await r.prepare("UPDATE nodes SET status = 'done', intent = 'done', terminal_reason = ?, final_report = ?, finalized_at = ?, outcome_kind = ?, outcome_reason = ?, outcome_at = ?, outcome_revision = outcome_revision + 1, outcome_detail_json = ? WHERE node_id = ? AND final_report IS NULL").run(l,c.name,_,m,l,_,w,e),a!==null&&await k(r,{event:"outcome",object:await v(r,e),actor:null,attrs:{revision:p},messageBody:a})}else await r.prepare("UPDATE nodes SET status = 'done', intent = 'done', terminal_reason = 'finalized', final_report = ?, finalized_at = ? WHERE node_id = ? AND final_report IS NULL").run(c.name,_,e);return{written:c,...u===void 0?{}:{structured:u}}})}i(J,"commitCanonicalFinal");async function $(e,t){if(!e)throw new Error(`push: empty nodeId (kind=${t.kind}) \u2014 a report must belong to a node`);if(t.kind==="final"&&t.deliveryTier!==void 0)throw new Error("push final does not accept a delivery tier");if(t.kind!=="final"&&t.outcome!==void 0)throw new Error("push outcome is final-only");if(t.kind!=="update"&&t.result!==void 0)throw new Error("a one-off result is an update report");if(W(t.body),t.kind==="final"){const n=await J(e,t);if(n.structuredRefused===!0)throw n.structured!==void 0&&y(n.structured),new H(n.structured?.state??"failed");n.structured!==void 0&&t.outcome?.structured?.skipEffects!==!0&&y(n.structured);const{written:o}=n;if(await O(e),(await E(e))?.run_id===e){const c=await(await q()).prepare("SELECT node_id FROM nodes WHERE run_id = ? AND node_id != ? ORDER BY created DESC").all(e,e);for(const d of c){const s=await E(d.node_id);s&&s.status!=="done"&&s.status!=="canceled"&&s.status!=="dead"&&await M(d.node_id,{preserveEmpty:!0})}}return{report:o.ref,reportId:o.doc.id,deliveredTo:o.deliveredTo}}const r=await T(async n=>await U(n,e,t));return{report:r.ref,reportId:r.doc.id,deliveredTo:r.deliveredTo}}i($,"pushWithContext");function g(e,t){return D.current()===void 0?D.fresh(()=>$(e,t)):$(e,t)}i(g,"push");async function oe(e,t,r){return g(e,{kind:"update",body:t,...r})}i(oe,"pushUpdate");async function ae(e,t,r){return g(e,{kind:"urgent",body:t,...r})}i(ae,"pushUrgent");async function ue(e,t,r){return g(e,{kind:"final",body:t,...r})}i(ue,"pushFinal");export{h as FinalizationError,H as StructuredRequestFinalizationError,g as push,ue as pushFinal,oe as pushUpdate,ae as pushUrgent};
|
|
@@ -24,11 +24,11 @@ export interface InboxEntry {
|
|
|
24
24
|
export declare function nodeMailEntry(delivery: ClaimedNodeMail): InboxEntry;
|
|
25
25
|
/** The newest head body of the report document a message points at, or null when the entry
|
|
26
26
|
* is not a report or the document is gone. */
|
|
27
|
-
export declare function reportDocumentBody(objectId: string): string | null
|
|
27
|
+
export declare function reportDocumentBody(objectId: string): Promise<string | null>;
|
|
28
28
|
export interface InboxDelivery {
|
|
29
29
|
kind: 'human' | 'card';
|
|
30
30
|
text: string;
|
|
31
31
|
entries: readonly InboxEntry[];
|
|
32
32
|
}
|
|
33
33
|
/** Split delivered entries into verbatim human messages and sender-grouped inbox cards. */
|
|
34
|
-
export declare function coalesce(entries: readonly InboxEntry[]): readonly InboxDelivery[]
|
|
34
|
+
export declare function coalesce(entries: readonly InboxEntry[]): Promise<readonly InboxDelivery[]>;
|
package/dist/core/feed/inbox.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f=Object.defineProperty;var i=(n,e)=>f(n,"name",{value:e,configurable:!0});import{openDb as u}from"../canvas/db.js";import{heads as m}from"../graph/documents.js";import{getById as p}from"../graph/objects.js";import{bodyOf as l}from"../graph/bodies.js";import{validateOperationId as y}from"../events/operation-id.js";import{formatInboxCard as h,machineOfEntries as b}from"../../shared/generated-context.js";import{inlineBody as w,renderEntryBody as I,reportRefNodeId as g}from"../../shared/inbox-entry-body.js";import{mapAsync as E}from"../async-array.js";const _=/^(?!0{32}$)[0-9a-f]{32}$/;function x(n){if(typeof n!="string"||!_.test(n))throw new TypeError("entry_id must be 32 lowercase non-zero hexadecimal characters");return n}i(x,"validateInboxEntryId");function S(n){const e=n.message;return{entry_id:x(e.messageId),operation_id:y(e.operationId),ts:e.createdAt,from:e.senderNodeId,...e.senderName===null?{}:{from_name:e.senderName},tier:n.urgency,kind:e.kind,...e.bodyRef===null?{}:{ref:e.bodyRef},label:e.label,...e.bodyJson===null?{}:{data:e.bodyJson},...e.disposition===null?{}:{disposition:e.disposition}}}i(S,"nodeMailEntry");async function k(n){const e=await u(),o=await p(e,n);if(o===null||o.type!=="document"||o.deleted_at!==null)return null;const s=(await m(e,o))[0];if(s===void 0)return null;const d=await e.prepare("SELECT source_path FROM documents WHERE object = ?").get(o.rowid);return l(s.body_hash,d?.source_path??null)}i(k,"reportDocumentBody");async function B(n){const e=n.data?.push?.object?.id,o=g(n.ref)!==void 0&&e!==void 0?await k(e):null;return I(n,o)}i(B,"entryBody");async function N(n){return{kind:n.kind,body:await B(n),...n.ref===void 0?{}:{ref:n.ref},...n.disposition===void 0?{}:{disposition:n.disposition}}}i(N,"cardEntry");async function $(n){if(n.length===0)return[];const e=new Map;for(const t of n){const r=t.from??"system";e.has(r)||e.set(r,[]),e.get(r).push(t)}const o=[],s=[];let d=-1;for(const[t,r]of e){if(t==="human"){for(const a of r){const c=w(a);o.push({kind:"human",text:c===""?a.label:c,entries:[a]})}continue}d<0&&(d=o.length,o.push({kind:"card",text:"",entries:[]})),s.push({id:t,...b(r),entries:await E(r,N)})}return d>=0&&(o[d]={kind:"card",text:h(s),entries:n.filter(t=>(t.from??"system")!=="human")}),o}i($,"coalesce");export{$ as coalesce,S as nodeMailEntry,k as reportDocumentBody};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { openDb } from '../canvas/db.js';
|
|
1
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
3
2
|
import type { OperationId } from '../events/types.js';
|
|
4
3
|
import type { Level, ListenDelivery } from '../graph/types.js';
|
|
5
4
|
import { type InboxDisposition, type InboxKind, type InboxTier } from './inbox.js';
|
|
@@ -20,7 +19,7 @@ export interface NodeMailInput {
|
|
|
20
19
|
/** Optional caller-owned obligation identity, used by cron settlement replay. */
|
|
21
20
|
idempotencyKey?: string;
|
|
22
21
|
/** Runs with the mail insert, before the transaction commits. */
|
|
23
|
-
withinEnqueue?: (db:
|
|
22
|
+
withinEnqueue?: (db: CanvasDb, messageId: string) => Promise<void>;
|
|
24
23
|
}
|
|
25
24
|
export interface EnqueuedNodeMail {
|
|
26
25
|
messageId: string;
|
|
@@ -30,8 +29,8 @@ export interface EnqueuedNodeMail {
|
|
|
30
29
|
}
|
|
31
30
|
export declare function newId(): string;
|
|
32
31
|
/** A terminal-lifecycle destination's normal or deferred mail is raised to urgent. */
|
|
33
|
-
export declare function effectiveTier(nodeId: string, urgency: InboxTier): InboxTier
|
|
34
|
-
export declare function insertMessage(db:
|
|
32
|
+
export declare function effectiveTier(nodeId: string, urgency: InboxTier): Promise<InboxTier>;
|
|
33
|
+
export declare function insertMessage(db: CanvasDb, input: {
|
|
35
34
|
messageId?: string;
|
|
36
35
|
operationId: OperationId;
|
|
37
36
|
createdAt: string;
|
|
@@ -50,7 +49,7 @@ export declare function insertMessage(db: ReturnType<typeof openDb>, input: {
|
|
|
50
49
|
};
|
|
51
50
|
causeMessageId?: string | null;
|
|
52
51
|
depth?: number;
|
|
53
|
-
}): string
|
|
52
|
+
}): Promise<string>;
|
|
54
53
|
/** The message's creation time, operation id and body — an oversized inline body is clipped
|
|
55
54
|
* into `destinationNodeId`'s messages dir and referenced; with no destination it stays inline. */
|
|
56
55
|
export declare function finalizeNodeMail(input: Omit<NodeMailInput, 'wake'>, destinationNodeId: string | null): {
|
|
@@ -60,24 +59,24 @@ export declare function finalizeNodeMail(input: Omit<NodeMailInput, 'wake'>, des
|
|
|
60
59
|
bodyJson: unknown | undefined;
|
|
61
60
|
};
|
|
62
61
|
/** Insert one immutable message and one node-inbox obligation into the caller's write transaction. */
|
|
63
|
-
export declare function enqueueNodeMail(destinationNodeId: string, input: NodeMailInput): EnqueuedNodeMail
|
|
62
|
+
export declare function enqueueNodeMail(destinationNodeId: string, input: NodeMailInput): Promise<EnqueuedNodeMail>;
|
|
64
63
|
/** Contract §1: a listening delivery maps 1:1 onto an inbox tier; only `next-turn` does not wake. */
|
|
65
64
|
export declare function listenDeliveryTier(delivery: ListenDelivery): {
|
|
66
65
|
urgency: InboxTier;
|
|
67
66
|
wake: 0 | 1;
|
|
68
67
|
};
|
|
69
68
|
/** Queue one runtime notice to a node's inbox inside the caller's write transaction (no sender). */
|
|
70
|
-
export declare function queueNodeNotice(db:
|
|
69
|
+
export declare function queueNodeNotice(db: CanvasDb, nodeId: string, notice: {
|
|
71
70
|
body: string;
|
|
72
71
|
label?: string;
|
|
73
72
|
tier: InboxTier;
|
|
74
73
|
wake: 0 | 1;
|
|
75
|
-
}): EnqueuedNodeMail
|
|
74
|
+
}): Promise<EnqueuedNodeMail>;
|
|
76
75
|
/** Retract an obligation without fabricating a terminal receipt. */
|
|
77
|
-
export declare function cancelDelivery(deliveryId: string, now?: number): boolean
|
|
76
|
+
export declare function cancelDelivery(deliveryId: string, now?: number): Promise<boolean>;
|
|
78
77
|
export declare function cancelPendingNodeMail(nodeId: string, select?: {
|
|
79
78
|
senderNodeId?: string | null;
|
|
80
79
|
kind?: InboxKind;
|
|
81
|
-
}): string[]
|
|
80
|
+
}): Promise<string[]>;
|
|
82
81
|
/** Enqueue the one notice only if the same live controller wait is still dead. */
|
|
83
|
-
export declare function enqueueControllerDeathNotice(nodeId: string, controllerId: string): EnqueuedNodeMail | null
|
|
82
|
+
export declare function enqueueControllerDeathNotice(nodeId: string, controllerId: string): Promise<EnqueuedNodeMail | null>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var s=(r,e)=>p(r,"name",{value:e,configurable:!0});import{existsSync as _,mkdirSync as E,renameSync as N,writeFileSync as I}from"node:fs";import{randomBytes as v,randomUUID as b}from"node:crypto";import{join as k}from"node:path";import{cancelCronsOnWake as u}from"../canvas/crons.js";import{withCanvasWrite as c,openDb as h}from"../canvas/db.js";import{getRow as S}from"../canvas/canvas.js";import{messagesDir as R}from"../canvas/paths.js";import{syncDirectory as D,syncFile as A}from"../fs-utils.js";import{settleDeadControllerWait as T,settleMatchingControllerWait as O}from"../canvas/waits.js";import{generateOperationId as x,operationIdContext as L,validateOperationId as J}from"../events/operation-id.js";import{clipBody as U}from"../../shared/inbox-entry-body.js";function y(){let r;do r=v(16).toString("hex");while(r==="00000000000000000000000000000000");return r}s(y,"newId");function C(r,e){const t=JSON.stringify(r);if(t===void 0)throw new TypeError(`${e} must be JSON-serializable`);return t}s(C,"stringify");async function M(r,e){return e!=="normal"&&e!=="deferred"?e:(await S(r))?.lifecycle==="terminal"?"urgent":e}s(M,"effectiveTier");function W(r,e,t){const n=R(r);_(n)||E(n,{recursive:!0});const a=e.replace(/[^0-9]/g,""),d=k(n,`${a}-${b().slice(0,6)}.md`),i=`${d}.tmp`;return I(i,t,"utf8"),A(i),N(i,d),D(n),d}s(W,"writeMessageBody");function q(r){if(typeof r!="object"||r===null)return"";const e=r.body;return typeof e=="string"?e.trim():""}s(q,"inlineBody");async function m(r,e){const t=e.messageId??y(),n=Number((await r.prepare("UPDATE message_sequence SET seq = seq + 1 WHERE id = 1 RETURNING seq").get()).seq);return await r.prepare(`INSERT INTO messages
|
|
2
2
|
(message_id, seq, operation_id, created_at, sender_node_id, sender_name, kind, label, body_ref, body_json, disposition,
|
|
3
3
|
event, object_id, level, actor_id, cause_message_id, depth)
|
|
4
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(n,
|
|
4
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(t,n,e.operationId,e.createdAt,e.senderNodeId,e.senderName,e.kind,e.label,e.bodyRef,e.bodyJson===void 0?null:C(e.bodyJson,"message body"),e.disposition,e.event?.event??null,e.event?.objectId??null,e.event?.level??null,e.event?.actorId??null,e.causeMessageId??null,e.depth??0),t}s(m,"insertMessage");async function f(r,e,t,n,a,d,i){const o=y();return await r.prepare(`INSERT INTO deliveries
|
|
5
5
|
(delivery_id, message_id, destination_id, urgency, wake, state, idempotency_key, created_at, updated_at)
|
|
6
|
-
VALUES (?, ?, ?, ?, ?, 'pending', ?, ?, ?)`).run(
|
|
7
|
-
FROM deliveries d JOIN messages m ON m.message_id = d.message_id WHERE d.idempotency_key = ?`).get(e.idempotencyKey);if(
|
|
8
|
-
WHERE w.node_id = ? AND w.kind = 'controller' AND w.target_id = ? AND w.satisfied_at IS NULL`).get(r,e);if(
|
|
6
|
+
VALUES (?, ?, ?, ?, ?, 'pending', ?, ?, ?)`).run(o,e,t,n,a,i??null,d,d),o}s(f,"insertNodeDelivery");function g(r,e){const t=new Date().toISOString(),n=r.operationId===void 0?L.current()??x():J(r.operationId);let a=r.bodyRef??null,d=r.bodyJson;if(a===null&&e!==null&&r.senderNodeId!=="human"){const i=q(d),o=U(i);o.clipped&&(a=W(e,t,i),d={...d,body:o.text})}return{createdAt:t,operationId:n,bodyRef:a,bodyJson:d}}s(g,"finalizeNodeMail");async function j(r,e){const t=g(e,r);return await c(async n=>{const a=await n.prepare("SELECT run_id FROM nodes WHERE node_id = ?").get(r);if(a?.run_id&&(await n.prepare("SELECT deleting_at FROM nodes WHERE node_id = ?").get(a.run_id))?.deleting_at)throw new Error("run is deleting");if(e.idempotencyKey!==void 0){const l=await n.prepare(`SELECT d.delivery_id, d.message_id, d.urgency, m.created_at
|
|
7
|
+
FROM deliveries d JOIN messages m ON m.message_id = d.message_id WHERE d.idempotency_key = ?`).get(e.idempotencyKey);if(l!==void 0)return{messageId:l.message_id,deliveryId:l.delivery_id,urgency:l.urgency,createdAt:l.created_at}}const d=Date.now(),i=await M(r,e.urgency),o=await m(n,{messageId:e.messageId,operationId:t.operationId,createdAt:t.createdAt,senderNodeId:e.senderNodeId??null,senderName:e.senderName??null,kind:e.kind,label:e.label,bodyRef:t.bodyRef,bodyJson:t.bodyJson,disposition:e.disposition??null}),w=await f(n,o,r,i,e.wake,d,e.idempotencyKey);return await O(r,e.senderNodeId??null,d,n),await e.withinEnqueue?.(n,o),e.wake===1&&i!=="deferred"&&await u(r),{messageId:o,deliveryId:w,urgency:i,createdAt:t.createdAt}})}s(j,"enqueueNodeMail");function Z(r){switch(r){case"interrupt":return{urgency:"critical",wake:1};case"steer":return{urgency:"urgent",wake:1};case"after-turn":return{urgency:"normal",wake:1};case"next-turn":return{urgency:"deferred",wake:0}}}s(Z,"listenDeliveryTier");async function ee(r,e,t){const n={kind:"update",label:t.label??"notice",bodyJson:{body:t.body},urgency:t.tier,wake:t.wake},a=g(n,e),d=Date.now(),i=await m(r,{operationId:a.operationId,createdAt:a.createdAt,senderNodeId:null,senderName:null,kind:n.kind,label:n.label,bodyRef:a.bodyRef,bodyJson:a.bodyJson,disposition:null}),o=await f(r,i,e,t.tier,t.wake,d);return t.wake===1&&t.tier!=="deferred"&&await u(e),{messageId:i,deliveryId:o,urgency:t.tier,createdAt:a.createdAt}}s(ee,"queueNodeNotice");async function re(r,e=Date.now()){return Number((await(await h()).prepare("UPDATE deliveries SET canceled_at = ?, updated_at = ? WHERE delivery_id = ? AND canceled_at IS NULL").run(e,e,r)).changes)===1}s(re,"cancelDelivery");async function te(r,e={}){return await c(async t=>{const n=["d.destination_id = ?","d.canceled_at IS NULL","d.state IN ('pending', 'handed_off')"],a=[r];e.senderNodeId!==void 0&&(n.push("m.sender_node_id IS ?"),a.push(e.senderNodeId)),e.kind!==void 0&&(n.push("m.kind = ?"),a.push(e.kind));const d=await t.prepareUncached(`SELECT d.delivery_id FROM deliveries d JOIN messages m ON m.message_id = d.message_id WHERE ${n.join(" AND ")}`).all(...a);if(d.length===0)return[];const i=Date.now();return await t.prepareUncached(`UPDATE deliveries SET canceled_at = ?, updated_at = ? WHERE delivery_id IN (${d.map(()=>"?").join(",")})`).run(i,i,...d.map(o=>o.delivery_id)),d.map(o=>o.delivery_id)})}s(te,"cancelPendingNodeMail");async function ne(r,e){return await c(async t=>{const n=Date.now(),a=await t.prepare(`SELECT target.status AS controller_status FROM waits w LEFT JOIN nodes target ON target.node_id = w.target_id
|
|
8
|
+
WHERE w.node_id = ? AND w.kind = 'controller' AND w.target_id = ? AND w.satisfied_at IS NULL`).get(r,e);if(a===void 0||a.controller_status==="active"||a.controller_status==="idle")return null;const d=await j(r,{kind:"urgent",label:"declared controller is no longer live",bodyJson:{body:`Controller ${e} is no longer live; the declared message wait was cleared.`},urgency:"urgent",wake:1});if(!await T(r,e,n,t))throw new Error(`controller wait changed while notifying ${r}`);return d})}s(ne,"enqueueControllerDeathNotice");export{re as cancelDelivery,te as cancelPendingNodeMail,M as effectiveTier,ne as enqueueControllerDeathNotice,j as enqueueNodeMail,g as finalizeNodeMail,m as insertMessage,Z as listenDeliveryTier,y as newId,ee as queueNodeNotice};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** Whether `nodeId` owns any live report document — proof it already did work. */
|
|
2
|
-
export declare function hasReportDocuments(nodeId: string): boolean
|
|
2
|
+
export declare function hasReportDocuments(nodeId: string): Promise<boolean>;
|
|
3
3
|
/** `<nodeId>/<name>` of `nodeId`'s newest live report document — the name
|
|
4
4
|
* `crtr canvas read` takes — or null when it pushed none. */
|
|
5
|
-
export declare function newestReportName(nodeId: string): string | null
|
|
5
|
+
export declare function newestReportName(nodeId: string): Promise<string | null>;
|
|
6
6
|
/** Body of `nodeId`'s newest live report document, trimmed; '' when it pushed none. */
|
|
7
|
-
export declare function newestReportBody(nodeId: string): string
|
|
7
|
+
export declare function newestReportBody(nodeId: string): Promise<string>;
|
|
8
8
|
/** Body of the report document a push's `<nodeId>/reports/<name>` ref names;
|
|
9
9
|
* null when the ref is not that shape or the document is gone. */
|
|
10
|
-
export declare function reportBodyByName(ref: string): string | null
|
|
10
|
+
export declare function reportBodyByName(ref: string): Promise<string | null>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
ORDER BY created_at DESC, name DESC LIMIT 1`).get(n.rowid)}
|
|
1
|
+
var f=Object.defineProperty;var o=(t,e)=>f(t,"name",{value:e,configurable:!0});import{openDb as a}from"../canvas/db.js";import{get as u}from"../graph/bodies.js";import{heads as s}from"../graph/documents.js";import{getById as d}from"../graph/objects.js";async function D(t){const e=await a(),n=await d(e,t);return n===null||n.type!=="node"?!1:await e.prepare("SELECT 1 FROM objects WHERE owner = ? AND type = 'document' AND kind = 'report' AND deleted_at IS NULL LIMIT 1").get(n.rowid)!==void 0}o(D,"hasReportDocuments");async function p(t){const e=await a(),n=await d(e,t);if(!(n===null||n.type!=="node"))return await e.prepare(`SELECT * FROM objects WHERE owner = ? AND type = 'document' AND kind = 'report' AND deleted_at IS NULL
|
|
2
|
+
ORDER BY created_at DESC, name DESC LIMIT 1`).get(n.rowid)}o(p,"newestReport");async function N(t){const e=await p(t);return e===void 0?null:`${t}/${e.name}`}o(N,"newestReportName");async function h(t){const e=await a(),n=await p(t);if(n===void 0)return"";const r=(await s(e,n))[0];if(r===void 0)return"";try{return u(r.body_hash).trim()}catch{return""}}o(h,"newestReportBody");async function R(t){const e=t.indexOf("/");if(e<=0||!t.startsWith("reports/",e+1))return null;const n=await a(),r=await d(n,t.slice(0,e));if(r===null||r.type!=="node")return null;const i=await n.prepare("SELECT * FROM objects WHERE owner = ? AND type = 'document' AND name = ? AND deleted_at IS NULL").get(r.rowid,t.slice(e+1)),c=i===void 0?void 0:(await s(n,i))[0];if(c===void 0)return null;try{return u(c.body_hash)}catch{return null}}o(R,"reportBodyByName");export{D as hasReportDocuments,h as newestReportBody,N as newestReportName,R as reportBodyByName};
|
|
@@ -8,7 +8,7 @@ export type GrantSync = (options?: {
|
|
|
8
8
|
export declare function ensureCovers(grantId: string, rev: number, syncGrants: GrantSync): Promise<void>;
|
|
9
9
|
/** The mirrored grant a caller names, read now, when it is still the caller's: active, the same `sub` and
|
|
10
10
|
* `grantee`, and not past `expires_at`. Otherwise 401 `grant_revoked`. */
|
|
11
|
-
export declare function callerGrantOf(grantId: string, sub: string, grantee: string): ActiveGrant
|
|
11
|
+
export declare function callerGrantOf(grantId: string, sub: string, grantee: string): Promise<ActiveGrant>;
|
|
12
12
|
/** The grant a token's app link names: the mirror made to cover `rev`, then the grant itself checked against
|
|
13
13
|
* `sub` and `grantee`. Errors are `ensureCovers`' and `callerGrantOf`'s `RunError`s. */
|
|
14
14
|
export declare function coverGrant(grantId: string, rev: number, sub: string, grantee: string, syncGrants: GrantSync): Promise<ActiveGrant>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var v=Object.defineProperty;var r=(e,t)=>v(e,"name",{value:t,configurable:!0});import{emitEvent as l}from"../events/emit.js";import{RunError as o}from"../runs/operations.js";import{activeGrant as h,grantExpired as m,grantSyncState as s,grantsGeneration as g}from"./mirror.js";let c=new Map,w=-1;async function f(e){const t=await g();return t!==w&&(c=new Map,w=t),c.get(e)}r(f,"behindRev");const u=r((e,t)=>e!==null&&e.rev>=t,"covered");async function p(e,t,a){if(u(await s(e),t))return;const n=await f(e);if(n===void 0||t>n){try{await a({fresh:!0})}catch{throw new o(503,"service_unavailable","grant sync failed")}const i=await s(e);if(u(i,t))return;await f(e),c.set(e,Math.max(t,c.get(e)??0)),l({level:"error",event:"daemon.grants.behind_token",fields:{grant:e,token_rev:t,mirror_rev:i?.rev??0}})}throw await s(e)?new o(503,"service_unavailable","the directory answered grant sync below the access token's grant revision"):new o(401,"grant_revoked","grant is not active")}r(p,"ensureCovers");async function y(e,t,a){const n=await h(e);if(!n||n.sub!==t||n.grantee!==a||m(n))throw new o(401,"grant_revoked","grant is not active");return n}r(y,"callerGrantOf");async function x(e,t,a,n,i){return await p(e,t,i),await y(e,a,n)}r(x,"coverGrant");export{y as callerGrantOf,x as coverGrant,p as ensureCovers};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** The unjoined runtime's one grant; nodes created before join reference it by id. */
|
|
2
2
|
export declare const LOCAL_TERMINAL_GRANT_ID = "local:terminal";
|
|
3
3
|
/** An unjoined local runtime has exactly one grant, owned by its terminal app. */
|
|
4
|
-
export declare function installLocalTerminalGrant(): void
|
|
4
|
+
export declare function installLocalTerminalGrant(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var r=(e,
|
|
1
|
+
var l=Object.defineProperty;var r=(e,t)=>l(e,"name",{value:t,configurable:!0});import{replaceGrants as n}from"./mirror.js";const a=["crtr:llm","crtr:act","crtr:schedule","crtr:memory:rw:user","crtr:memory:manage:user","crtr:files:rw:user:."].map(e=>({scope:e,mode:"always"})),s="local:terminal";async function p(){const e=new Date().toISOString();await n([{id:s,runtime:"runtime:local",sub:"user:local",grantee:"app:terminal",rev:1,scopes:a,resolved_scopes:a,spend_cap:null,expires_at:null,status:"active",revoked_at:null,approved_at:e,payer:"user",dependencies:{},synced_at:e}],e,"local")}r(p,"installLocalTerminalGrant");export{s as LOCAL_TERMINAL_GRANT_ID,p as installLocalTerminalGrant};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import { type Scope } from '@north-light/identity';
|
|
2
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
3
3
|
import type { ProviderDependency } from '../../api/dto/grants.js';
|
|
4
4
|
import type { ModelStrength } from '../../types.js';
|
|
5
5
|
export interface GrantScope {
|
|
@@ -53,9 +53,9 @@ export declare function inferenceEndpointOf(value: unknown): InferenceEndpoint |
|
|
|
53
53
|
* cascade, provider install, or run notice. */
|
|
54
54
|
export declare function mirrorOnly(grant: Pick<GrantRecord, 'grantee'>): boolean;
|
|
55
55
|
/** Every mirrored grant this machine acts on: `allGrants()` without the mirror-only ones. */
|
|
56
|
-
export declare function localGrants(): GrantRecord[]
|
|
56
|
+
export declare function localGrants(): Promise<GrantRecord[]>;
|
|
57
57
|
/** Every mirrored grant, whatever its status. */
|
|
58
|
-
export declare function allGrants(): GrantRecord[]
|
|
58
|
+
export declare function allGrants(): Promise<GrantRecord[]>;
|
|
59
59
|
/** Whether a grant's `expires_at` has passed. An unparsable time reads as expired (fail closed). */
|
|
60
60
|
export declare function grantExpired(grant: Pick<GrantRecord, 'expires_at'>): boolean;
|
|
61
61
|
/** The active form of a grant record read earlier, or null when it is not active, is past `expires_at`, or is unparsable. */
|
|
@@ -65,7 +65,7 @@ export declare function activeRecord(grant: GrantRecord): ActiveGrant | null;
|
|
|
65
65
|
* `payer`, `inference_endpoint`, `dependencies`. `synced_at` and the token's claims are left out, so a
|
|
66
66
|
* periodic sync with the same content (or a daemon restart) keeps it. */
|
|
67
67
|
export declare function grantVersion(grant: Pick<GrantRecord, 'rev' | 'resolved_scopes' | 'spend_cap' | 'payer' | 'dependencies' | 'inference_endpoint'>): string;
|
|
68
|
-
export declare function hasGrant(grantId: string): boolean
|
|
68
|
+
export declare function hasGrant(grantId: string): Promise<boolean>;
|
|
69
69
|
/** The grant state the freshness ordering reads (contract 1 "Grant sync"):
|
|
70
70
|
* the mirrored grant's revision and status, whatever its status. */
|
|
71
71
|
export interface GrantSyncState {
|
|
@@ -73,35 +73,35 @@ export interface GrantSyncState {
|
|
|
73
73
|
status: GrantRecord['status'];
|
|
74
74
|
}
|
|
75
75
|
/** The mirrored state of grant `grantId`, or null when the mirror lacks it. */
|
|
76
|
-
export declare function grantSyncState(grantId: string): GrantSyncState | null
|
|
76
|
+
export declare function grantSyncState(grantId: string): Promise<GrantSyncState | null>;
|
|
77
77
|
/** The mirrored state of the grant `sub` gave `grantee`, whatever its status, or null when the mirror lacks it. */
|
|
78
|
-
export declare function grantSyncStateFor(grantee: string, sub: string): GrantSyncState | null
|
|
78
|
+
export declare function grantSyncStateFor(grantee: string, sub: string): Promise<GrantSyncState | null>;
|
|
79
79
|
/** The mirrored grant `grantId`, whatever its status, or null when the mirror lacks it or the row is unparsable. */
|
|
80
|
-
export declare function grantRecord(grantId: string): GrantRecord | null
|
|
80
|
+
export declare function grantRecord(grantId: string): Promise<GrantRecord | null>;
|
|
81
81
|
/** Who a grant's model calls are charged to: `app` only for a mirrored grant the directory marked app-paid, else the person. */
|
|
82
|
-
export declare function payerOfGrant(grantId: string | null | undefined): 'user' | 'app'
|
|
83
|
-
export declare function activeGrant(grantId: string): ActiveGrant | null
|
|
84
|
-
export declare function grantFor(grantee: string, sub: string): ActiveGrant | null
|
|
82
|
+
export declare function payerOfGrant(grantId: string | null | undefined): Promise<'user' | 'app'>;
|
|
83
|
+
export declare function activeGrant(grantId: string): Promise<ActiveGrant | null>;
|
|
84
|
+
export declare function grantFor(grantee: string, sub: string): Promise<ActiveGrant | null>;
|
|
85
85
|
/** The app's own active grant on this machine. Null for a mirror-only grant: an
|
|
86
86
|
* unsandboxed machine runs no app, so a fanned-out hosted grant is never "the
|
|
87
87
|
* app's grant" for a local app caller, sandbox or install. */
|
|
88
|
-
export declare function activeGrantForApp(grantee: string): ActiveGrant | null
|
|
88
|
+
export declare function activeGrantForApp(grantee: string): Promise<ActiveGrant | null>;
|
|
89
89
|
/** Where a run's notice goes: its grant's registered `run_notice_url`, with the grant's `sub` and `grantee`. Null when the run has no active grant or the grantee registered no URL. */
|
|
90
|
-
export declare function runNoticeTarget(grantId: string): {
|
|
90
|
+
export declare function runNoticeTarget(grantId: string): Promise<{
|
|
91
91
|
url: string;
|
|
92
92
|
sub: string;
|
|
93
93
|
grantee: string;
|
|
94
|
-
} | null
|
|
95
|
-
export declare function terminalGrant(): ActiveGrant | null
|
|
94
|
+
} | null>;
|
|
95
|
+
export declare function terminalGrant(): Promise<ActiveGrant | null>;
|
|
96
96
|
/** Where the grant mirror came from: `'local'` for an unjoined runtime's own grant, the directory issuer once joined, null before any install. */
|
|
97
|
-
export declare function grantsSource(): string | null
|
|
98
|
-
export declare function hasSyncedGrants(source: string): boolean
|
|
97
|
+
export declare function grantsSource(): Promise<string | null>;
|
|
98
|
+
export declare function hasSyncedGrants(source: string): Promise<boolean>;
|
|
99
99
|
/** OWN-11 for a joined runtime: the unjoined runtime's local mirror grants
|
|
100
100
|
* `user:local` full local scopes and is not the directory's. Delete it so no
|
|
101
101
|
* grant exists until grant sync installs the directory's mirror. */
|
|
102
|
-
export declare function dropLocalGrantMirror(db:
|
|
102
|
+
export declare function dropLocalGrantMirror(db: CanvasDb): Promise<number>;
|
|
103
103
|
/** The directory response is complete; commit it or keep the prior snapshot intact. */
|
|
104
|
-
export declare function replaceGrants(grants: readonly GrantRecord[], syncedAt: string, source: string): void
|
|
104
|
+
export declare function replaceGrants(grants: readonly GrantRecord[], syncedAt: string, source: string): Promise<void>;
|
|
105
105
|
/** Bumped by every `replaceGrants`. A launch compiled against one generation
|
|
106
106
|
* and started under another may hold mounts the new mirror no longer grants. */
|
|
107
|
-
export declare function grantsGeneration(): number
|
|
107
|
+
export declare function grantsGeneration(): Promise<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var y=Object.defineProperty;var t=(e,r)=>y(e,"name",{value:r,configurable:!0});import{createHash as
|
|
1
|
+
var y=Object.defineProperty;var t=(e,r)=>y(e,"name",{value:r,configurable:!0});import{createHash as _}from"node:crypto";import{parseScope as g}from"@north-light/identity";import{openDb as o,withCanvasWrite as S}from"../canvas/db.js";import{isUnsandboxedMachine as T}from"../runtime/unsandboxed.js";const v=["not_started","pending","ready","failed","unavailable"],O=["ultra","strong","medium","light"];function p(e){if(!Array.isArray(e))throw new TypeError("grant scopes must be a list");return e.map(r=>{if(!r||typeof r!="object"||typeof r.scope!="string"||!["always","ask"].includes(r.mode))throw new TypeError("invalid grant scope entry");return{scope:r.scope,mode:r.mode}})}t(p,"entries");function m(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const{state:r,message:a,next:i,step:n}=e;return typeof r!="string"||!v.includes(r)||a!==void 0&&typeof a!="string"||n!==void 0&&typeof n!="string"||typeof i!="string"||!i?null:{state:r,...a===void 0?{}:{message:a},next:i,...n===void 0?{}:{step:n}}}t(m,"dependencyOf");function E(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const r={};for(const[a,i]of Object.entries(e)){const n=m(i);n&&(r[a]=n)}return r}t(E,"dependenciesOf");function w(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const{base_url:r,rungs:a}=e;if(typeof r!="string"||!r||!a||typeof a!="object"||Array.isArray(a))return null;const i={};for(const n of O){const c=a[n];typeof c=="string"&&c&&(i[n]=c)}return Object.keys(i).length?{base_url:r.replace(/\/+$/,""),rungs:i}:null}t(w,"inferenceEndpointOf");function l(e){return{id:e.id,runtime:e.runtime,sub:e.sub,grantee:e.grantee,rev:e.rev,scopes:p(JSON.parse(e.scopes_json)),resolved_scopes:p(JSON.parse(e.resolved_scopes_json)),spend_cap:e.spend_cap,expires_at:e.expires_at,status:e.status,revoked_at:e.revoked_at,approved_at:e.approved_at,payer:e.payer,dependencies:E(JSON.parse(e.dependencies_json)),run_notice_url:e.run_notice_url??null,inference_endpoint:e.inference_endpoint_json?w(JSON.parse(e.inference_endpoint_json)):null,synced_at:e.synced_at}}t(l,"record");function u(e){if(!e||e.status!=="active")return null;try{return N(l(e))}catch(r){if(r instanceof TypeError||r instanceof SyntaxError)return null;throw r}}t(u,"active");function f(e){return e.grantee!=="app:terminal"&&T()}t(f,"mirrorOnly");async function M(){return(await x()).filter(e=>!f(e))}t(M,"localGrants");async function x(){return(await(await o()).prepare("SELECT * FROM grants").all()).flatMap(e=>{try{return[l(e)]}catch(r){if(r instanceof TypeError||r instanceof SyntaxError)return[];throw r}})}t(x,"allGrants");function R(e){return e.expires_at!==null&&!(Date.parse(e.expires_at)>Date.now())}t(R,"grantExpired");function N(e){if(e.status!=="active"||R(e))return null;try{const r=e.resolved_scopes.map(({scope:a})=>g(a));return{...e,resolved:e.resolved_scopes.flatMap(({mode:a},i)=>a==="always"?[r[i]]:[])}}catch(r){if(r instanceof TypeError||r instanceof SyntaxError)return null;throw r}}t(N,"activeRecord");function d(e){return Array.isArray(e)?`[${e.map(d).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().filter(r=>e[r]!==void 0).map(r=>`${JSON.stringify(r)}:${d(e[r])}`).join(",")}}`:JSON.stringify(e)??"null"}t(d,"canonicalJson");function j(e){const r={rev:e.rev,resolved_scopes:e.resolved_scopes,spend_cap:e.spend_cap,payer:e.payer,dependencies:e.dependencies??{},...e.inference_endpoint?{inference_endpoint:e.inference_endpoint}:{}};return _("sha256").update(d(r)).digest("base64url").slice(0,22)}t(j,"grantVersion");async function k(e){return!!await(await o()).prepare("SELECT 1 FROM grants WHERE id = ?").get(e)}t(k,"hasGrant");async function H(e){return await(await o()).prepare("SELECT rev, status FROM grants WHERE id = ?").get(e)??null}t(H,"grantSyncState");async function D(e,r){return await(await o()).prepare("SELECT rev, status FROM grants WHERE grantee = ? AND sub = ?").get(e,r)??null}t(D,"grantSyncStateFor");async function A(e){const r=await(await o()).prepare("SELECT * FROM grants WHERE id = ?").get(e);if(!r)return null;try{return l(r)}catch(a){if(a instanceof TypeError||a instanceof SyntaxError)return null;throw a}}t(A,"grantRecord");async function W(e){return(e?(await A(e))?.payer:null)??"user"}t(W,"payerOfGrant");async function G(e){return u(await(await o()).prepare("SELECT * FROM grants WHERE id = ?").get(e))}t(G,"activeGrant");async function J(e,r){return u(await(await o()).prepare("SELECT * FROM grants WHERE grantee = ? AND sub = ?").get(e,r))}t(J,"grantFor");async function I(e){if(f({grantee:e}))return null;const r=await(await o()).prepare("SELECT * FROM grants WHERE grantee = ? AND status = 'active'").all(e);if(r.length>1)throw new Error(`multiple active grants for ${e}`);return u(r[0])}t(I,"activeGrantForApp");async function U(e){const r=await(await o()).prepare("SELECT run_notice_url AS url, sub, grantee FROM grants WHERE id = ? AND status = 'active'").get(e);return r&&r.url&&!f(r)?{url:r.url,sub:r.sub,grantee:r.grantee}:null}t(U,"runNoticeTarget");async function $(){const e=await(await o()).prepare("SELECT * FROM grants WHERE grantee = 'app:terminal' AND status = 'active'").all();if(e.length>1)throw new Error("multiple active terminal grants");return u(e[0])}t($,"terminalGrant");async function V(){return(await(await o()).prepare("SELECT value FROM runtime_state WHERE key = 'grants_source'").get())?.value??null}t(V,"grantsSource");async function P(e){return(await(await o()).prepare("SELECT value FROM runtime_state WHERE key = 'grants_source'").get())?.value===e}t(P,"hasSyncedGrants");async function X(e){return(await e.prepare("SELECT value FROM runtime_state WHERE key = 'grants_source'").get())?.value!=="local"?0:(await e.prepare("DELETE FROM runtime_state WHERE key = 'grants_source'").run(),Number((await e.prepare("DELETE FROM grants").run()).changes))}t(X,"dropLocalGrantMirror");async function q(e,r,a){const i=new Set;for(const n of e){if(i.has(n.id)||!n.id||!n.runtime||!n.sub||!n.grantee||!Number.isInteger(n.rev)||!["active","revoked","removed"].includes(n.status))throw new TypeError("invalid grant sync response");i.add(n.id),p(n.scopes),p(n.resolved_scopes)}await S(async n=>{await n.exec("DELETE FROM grants");const c=n.prepare(`INSERT INTO grants
|
|
2
2
|
(id, runtime, sub, grantee, rev, scopes_json, resolved_scopes_json, spend_cap, expires_at,
|
|
3
3
|
status, revoked_at, approved_at, payer, dependencies_json, run_notice_url, inference_endpoint_json, synced_at)
|
|
4
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(const
|
|
4
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(const s of e)await c.run(s.id,s.runtime,s.sub,s.grantee,s.rev,JSON.stringify(s.scopes),JSON.stringify(s.resolved_scopes),s.spend_cap,s.expires_at,s.status,s.revoked_at,s.approved_at,s.payer,JSON.stringify(E(s.dependencies)),s.run_notice_url??null,s.inference_endpoint?JSON.stringify(s.inference_endpoint):null,s.synced_at);await n.prepare("INSERT INTO runtime_state (key, value) VALUES ('grants_source', ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(a),await n.prepare("INSERT INTO runtime_state (key, value) VALUES ('grants_generation', '1') ON CONFLICT(key) DO UPDATE SET value = CAST(CAST(value AS INTEGER) + 1 AS TEXT)").run()})}t(q,"replaceGrants");async function z(){const e=await(await o()).prepare("SELECT value FROM runtime_state WHERE key = 'grants_generation'").get();return e?Number(e.value):0}t(z,"grantsGeneration");export{G as activeGrant,I as activeGrantForApp,N as activeRecord,x as allGrants,E as dependenciesOf,X as dropLocalGrantMirror,R as grantExpired,J as grantFor,A as grantRecord,H as grantSyncState,D as grantSyncStateFor,j as grantVersion,z as grantsGeneration,V as grantsSource,k as hasGrant,P as hasSyncedGrants,w as inferenceEndpointOf,M as localGrants,f as mirrorOnly,W as payerOfGrant,q as replaceGrants,U as runNoticeTarget,$ as terminalGrant};
|
|
@@ -7,7 +7,7 @@ export type Detach = (work: Promise<void>) => void;
|
|
|
7
7
|
export declare function exceeds(sandbox: Pick<SandboxRecord, 'uid' | 'nodeId' | 'mounts'>, owners?: ReadonlyMap<number, {
|
|
8
8
|
app: string;
|
|
9
9
|
status: string;
|
|
10
|
-
}>): string | null
|
|
10
|
+
}>): Promise<string | null>;
|
|
11
11
|
/** R26 from current state (runtime spec §15 "Ending revoked file access"):
|
|
12
12
|
* compare every live launcher sandbox's launched mounts with what the current
|
|
13
13
|
* mirror grants, and stop each one that holds more. Runs after every sync and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=Object.defineProperty;var c=(n,r)=>_(n,"name",{value:r,configurable:!0});import{relative as y,sep as w}from"node:path";import{activeBackgroundBashJobs as h,readJobPgid as b}from"../bash-jobs.js";import{appSpace as x}from"../layout.js";import{getNode as l,recordSettledTurn as S}from"../canvas/index.js";import{transition as k}from"../runtime/lifecycle.js";import{openDb as v}from"../canvas/db.js";import{contextDir as E}from"../canvas/node-agent-paths.js";import{emitEvent as p}from"../events/emit.js";import{closeGrantStreams as R}from"../runs/events.js";import{grantedMounts as C,isGrantedSource as G,mountAllowed as I}from"../spaces/mounts.js";import{permissionsForRun as m}from"../spaces/permissions.js";import{stopNodeSandboxes as P}from"../spaces/stop.js";import{discardChangedGrantTokens as O}from"../providers/token-cache.js";import{activeGrantForApp as T,allGrants as A,mirrorOnly as F}from"./mirror.js";import{runRemovalCascades as M}from"./remove.js";import{notifyGrantChanges as D}from"./watch.js";import{launcherPresent as N,listSandboxes as W,stopSandboxPid as j}from"./sandboxes.js";import{checkCronFire as B}from"../../daemon/cron/authority.js";import{cronExecutionFor as J}from"../../daemon/cron/live-runs.js";import{cronExecutionsReady as L}from"../../daemon/cron/run-socket.js";import{flatMapAsync as U}from"../async-array.js";async function g(){return new Map((await(await v()).prepare("SELECT uid, app, status FROM app_users").all()).map(n=>[n.uid,{app:n.app,status:n.status}]))}c(g,"appUserOwners");async function $(n,r){r??=await g();const t=r.get(n.uid),i=n.nodeId.startsWith("cron-"),e=i?J(n.nodeId.slice(5)):void 0;if(i&&(e===void 0||!t))return"permission_revoked";if(e!==void 0&&t.status==="active"){const a=await B({grantee:e.grantee,sub:e.sub,grant_id:e.grantId,scopes:e.scopes});if(!a.allowed)return e.refusal??={reason:a.reason,message:a.message},"permission_revoked"}if(!t||t.app==="app:terminal")return null;if(t.status!=="active")return"app_removed";const o=await l(n.nodeId);try{let a;if(e!==void 0)a=await m(e.grantee,e.sub,e.grantId,e.scopes);else if(o&&o.grantee===t.app)a=await m(t.app,o.sub??"user:local",o.grant_id??null,o.scopes??null);else{const d=await T(t.app);if(!d)return"permission_revoked";a=await m(t.app,d.sub,d.id,null)}const u=C(a),f=x(t.app).root;return n.mounts.every(d=>{const s=y(f,d.source);return s===""||s!==".."&&!s.startsWith(`..${w}`)&&!s.startsWith(w)||!G(t.app,d.source)||I(d,u)})?null:"permission_revoked"}catch{return"permission_revoked"}}c($,"exceeds");async function H(n){const r=await l(n);if(!r)return;(r.status==="active"||r.status==="idle")&&await k(n,"release");const t=new Date().toISOString();await S(n,t),r.run_id&&r.run_id!==n&&await(await v()).prepare("UPDATE nodes SET last_settled_at = COALESCE(last_settled_at, ?) WHERE node_id = ?").run(t,r.run_id)}c(H,"afterRevocationStop");async function q(n){const r=new Set,t=await l(n);t?.pi_pid!=null&&r.add(t.pi_pid);try{const i=await E(n,t?.grantee);for(const e of h(i,!0)){const o=b(i,e.jobId);o!==void 0&&r.add(o)}}catch{}return r}c(q,"nodePids");async function z(){if(!N())return{completion:Promise.resolve()};await L();const n=await W(),r=await g(),t=await U(n,async o=>{const a=await $(o,r);return a?[{sandbox:o,reason:a}]:[]}),i=[],e=new Map;for(const o of t){p({level:"info",event:"daemon.grants.sandbox_stop",fields:{sandbox_node:o.sandbox.nodeId,pid:o.sandbox.pid,grantee:r.get(o.sandbox.uid).app,reason:o.reason}});const a=e.get(o.sandbox.nodeId)??[];a.push(o),e.set(o.sandbox.nodeId,a)}for(const[o,a]of e){const u=await l(o),f=u?await q(o):new Set,d=u!==null&&a.some(({sandbox:s})=>f.has(s.pid));i.push((async()=>{if(d){const s=await P(o,"permission_revoked",{holdRecovery:!0,after:c(()=>H(o),"after")});if(!s.confirmed)throw s.error??new Error(`stop of ${o} was not confirmed`)}for(const{sandbox:s}of a)(!d||!f.has(s.pid))&&await j(s.pid)})().catch(s=>{p({level:"error",event:"daemon.grants.sandbox_stop_failed",...u?{node_id:o}:{fields:{sandbox_node:o}},error:s})}))}return{completion:Promise.all(i).then(()=>{})}}c(z,"sweepSandboxes");function K(n,r){try{const{pairs:t,providers:i,tokens:e}=O(n,r);(t||i)&&p({level:"info",event:"daemon.grants.outbound_tokens_discarded",fields:{grants:t,providers:i,tokens:e}})}catch(t){p({level:"error",event:"daemon.grants.outbound_tokens_discard_failed",error:t})}}c(K,"discardOutboundTokens");async function _e(n,r=t=>{}){const t=await A();try{D(n,t)}catch(e){p({level:"error",event:"daemon.grants.notify_failed",error:e})}K(n,t);for(const e of n){if(e.status!=="active"||t.find(u=>u.id===e.id)?.status==="active")continue;const a=R(e.id);a&&p({level:"info",event:"daemon.grants.streams_closed",fields:{grant:e.id,grantee:e.grantee,streams:a}})}try{const{completion:e}=await z();r(e)}catch(e){p({level:"error",event:"daemon.grants.sweep_failed",error:e})}const i=new Set(t.filter(e=>!F(e)&&e.status==="removed"&&n.find(o=>o.id===e.id)?.status!=="removed").map(e=>e.grantee));r(M(i).catch(()=>{})),r(import("../providers/bundles.js").then(({syncProviderBundles:e})=>e()).catch(e=>{p({level:"error",event:"daemon.providers.bundle_sync_failed",error:e})}))}c(_e,"onGrantSync");export{$ as exceeds,_e as onGrantSync,z as sweepSandboxes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var R=Object.defineProperty;var d=(r,n)=>R(r,"name",{value:n,configurable:!0});import{rmSync as _}from"node:fs";import{join as h}from"node:path";import{deleteNodes as S}from"../canvas/canvas.js";import{withCanvasWrite as c,openDb as f}from"../canvas/db.js";import{cancelCron as O}from"../canvas/crons.js";import{emitEvent as m}from"../events/emit.js";import{appSpace as T,appsRoot as E,secretsDir as C}from"../layout.js";import{notifyRunDeleted as D}from"../runs/events.js";import{cancelOpenQuestions as L}from"../runs/questions.js";import{removeTreeBeneath as W}from"../spaces/open-beneath.js";import{markGranteeUploadsDeletePending as y,releaseRunUploads as F,turnSharesOffFor as H}from"../storage/tables.js";import{stopNodeSandboxes as N}from"../spaces/stop.js";import{activeAppUser as p,markAppUserRemoved as M}from"../spaces/users.js";import{launcherRequest as U}from"../../launcher/client.js";import{LaunchRefused as b}from"../../launcher/spec.js";import{localGrants as A}from"./mirror.js";import{launcherPresent as u,listSandboxes as I,stopSandboxPid as P}from"./sandboxes.js";import{filterAsync as $}from"../async-array.js";let w=Promise.resolve();function ie(r=new Set){const n=w.then(async()=>{const o=await A(),t=new Set(o.filter(a=>a.status==="removed").map(a=>a.grantee));for(const a of t)if(!o.some(i=>i.grantee===a&&i.status==="active")&&!(await p(a)===null&&!r.has(a)))try{await x(a)}catch(i){m({level:"error",event:"daemon.grants.removal_failed",error:i,fields:{grantee:a}})}});return w=n.catch(()=>{}),n}d(ie,"runRemovalCascades");async function x(r){if(r==="app:terminal")throw new Error("app:terminal cannot be removed");const n=T(r),o=await p(r);m({level:"info",event:"daemon.grants.removal_started",fields:{grantee:r,uid:o?.uid??null}}),await L({grantee:r},"the app was removed");const t=await c(async e=>(await e.prepare("UPDATE nodes SET deleting_at = COALESCE(deleting_at, ?) WHERE node_id IN (SELECT node_id FROM node_rows WHERE grantee = ?)").run(new Date().toISOString(),r),(await e.prepare("SELECT node_id FROM node_rows WHERE grantee = ? ORDER BY created DESC").all(r)).map(s=>s.node_id)));for(const{cron_id:e}of await(await f()).prepare("SELECT cron_id FROM crons WHERE grantee = ?").all(r))await O(e);const i=(await Promise.all(t.map(e=>N(e,"app_removed",{deleting:!0})))).filter(e=>!e.confirmed);if(i.length)throw new Error(`sandbox teardown could not be confirmed for ${i.length} node(s) of ${r}`);if(o&&u())for(const e of await I())e.uid===o.uid&&await P(e.pid);const g=await $(t,async e=>(await(await f()).prepare("SELECT run_id FROM nodes WHERE node_id = ?").get(e))?.run_id===e);await c(async e=>{if(await H(r,e),await F(t,e),await y(r,e),!t.length)return;const s=t.map(()=>"?").join(","),v=await e.prepareUncached(`SELECT message_id FROM messages WHERE sender_node_id IN (${s}) UNION SELECT message_id FROM deliveries WHERE destination_id IN (${s})`).all(...t,...t);await e.prepareUncached(`DELETE FROM deliveries WHERE destination_id IN (${s})`).run(...t);for(const{message_id:l}of v)await e.prepare("DELETE FROM messages WHERE message_id = ? AND NOT EXISTS (SELECT 1 FROM deliveries WHERE message_id = ?)").run(l,l)}),await S(t);for(const e of g)D(e);if(_(h(C(),"env",n.root.slice(E().length+1)),{recursive:!0,force:!0}),W(E(),n.root),o&&u())try{await U({operation:"user.delete",uid:o.uid})}catch(e){if(!(e instanceof b&&e.refusal==="invalid_uid"))throw e}o&&await M(o.uid),m({level:"info",event:"daemon.grants.removal_completed",fields:{grantee:r,uid:o?.uid??null,nodes:t.length}})}d(x,"removeApp");export{x as removeApp,ie as runRemovalCascades};
|
package/dist/core/grants/sync.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var k=Object.defineProperty;var r=(t,n)=>k(t,"name",{value:n,configurable:!0});import{createPrivateKey as v,randomUUID as E,sign as S}from"node:crypto";import{readFileSync as b}from"node:fs";import{join as j}from"node:path";import{crtrHome as x}from"../canvas/paths.js";import{isUnsandboxedMachine as g}from"../runtime/unsandboxed.js";import{emitEvent as f}from"../events/emit.js";import{allGrants as $,dependenciesOf as T,inferenceEndpointOf as A,replaceGrants as N}from"./mirror.js";import{onGrantSync as O}from"./on-sync.js";const H=300;function G(t,n){const e=Math.floor(Date.now()/1e3),s=Buffer.from(JSON.stringify({alg:"ES256",typ:"JWT",kid:t.kid})).toString("base64url"),c=Buffer.from(JSON.stringify({iss:t.client_id,sub:t.client_id,aud:n,iat:e,exp:e+300,jti:E()})).toString("base64url"),o=`${s}.${c}`,i=S("sha256",Buffer.from(o),{key:v({key:t.jwk,format:"jwk"}),dsaEncoding:"ieee-p1363"});return`${o}.${i.toString("base64url")}`}r(G,"assertion");function y(){const t=JSON.parse(b(j(x(),"secrets","runtime-client.json"),"utf8"));if(!t.jwk||t.alg!=="ES256"||!t.kid||!t.client_id||!t.runtime||t.jwk.kid!==t.kid||t.jwk.kty!=="EC"||t.jwk.crv!=="P-256"||!t.jwk.d)throw new TypeError("invalid runtime client key");return t}r(y,"runtimeClient");function K(t=y()){return t.runtime.startsWith("runtime:")?t.runtime.slice(8):t.runtime}r(K,"runtimeId");function R(t){return`This machine was removed from your Northlight account. To use it again, create a join token at ${t.replace(/\/$/,"")}/account/machines, and run \`crtr sys join\` from a plain terminal.`}r(R,"machineRevokedMessage");class h extends Error{static{r(this,"MachineRevokedError")}constructor(n){super(R(n)),this.name="MachineRevokedError"}}async function B(t,n){const e=y(),s=`${t.replace(/\/$/,"")}/token`,c=new URLSearchParams({grant_type:"client_credentials",client_id:e.client_id,client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer",client_assertion:G(e,s),...n===void 0?{}:{audience:n}}),o=await fetch(s,{method:"POST",body:c,signal:AbortSignal.timeout(1e4)});if(!o.ok)throw o.status===401&&g()&&await D(o)?new h(t):new Error(`directory token request failed: ${o.status}`);const i=await o.json();if(typeof i.access_token!="string")throw new TypeError("directory token response has no access_token");return{access_token:i.access_token,expires_at:J(i.access_token,i.expires_in)}}r(B,"mintDirectoryToken");async function D(t){try{return(await t.json()).error==="invalid_client"}catch{return!1}}r(D,"isInvalidClient");function J(t,n){if(typeof n=="number"&&Number.isFinite(n)&&n>0)return Date.now()+n*1e3;try{const e=JSON.parse(Buffer.from(t.split(".")[1]??"","base64url").toString("utf8"));if(typeof e.exp=="number")return e.exp*1e3}catch{}return Date.now()+3e5}r(J,"tokenExpiry");function M(t,n){if(!t||typeof t!="object")throw new TypeError("invalid grant sync response");const e=t,s=n.runtime.startsWith("runtime:")?n.runtime:`runtime:${n.runtime}`;if(!(e.runtime===s||g()&&typeof e.runtime=="string"&&e.runtime.startsWith("runtime:")&&e.grantee!=="app:terminal")||typeof e.id!="string"||typeof e.sub!="string"||typeof e.grantee!="string"||!Number.isInteger(e.rev)||!Array.isArray(e.scopes)||!Array.isArray(e.resolved_scopes)||!["active","revoked","removed"].includes(e.status??"")||typeof e.synced_at!="string")throw new TypeError("invalid grant sync response");const i=t.revisions?.find(a=>a.rev===e.rev)?.approved_at;if(typeof i!="string")throw new TypeError("grant revision has no approval time");const d=e.payer==="app"?"app":"user";return{...e,spend_cap:e.spend_cap??null,expires_at:e.expires_at??null,revoked_at:e.revoked_at??null,approved_at:i,payer:d,dependencies:T(e.dependencies),inference_endpoint:d==="app"?A(e.inference_endpoint):null,run_notice_url:typeof e.run_notice_url=="string"&&e.run_notice_url!==""?e.run_notice_url:null}}r(M,"responseGrant");let _;function V(t){return _?_(t):Promise.resolve()}r(V,"requestGrantSync");function Y(t,n=e=>{}){let e;const s=t.replace(/\/$/,""),c=r(async()=>{const a=y(),u=await B(s),l=await fetch(`${s}/v1/runtime/grants`,{headers:{Authorization:`Bearer ${u.access_token}`},signal:AbortSignal.timeout(1e4)});if(!l.ok)throw new Error(`directory grant sync failed: ${l.status}`);const p=await l.json();if(!Array.isArray(p.grants)||typeof p.synced_at!="string")throw new TypeError("invalid grant sync response");const w=await $();await N(p.grants.map(m=>M(m,a)),p.synced_at,s),f({level:"info",event:"daemon.grants.synced",fields:{grants:p.grants.length,synced_at:p.synced_at}});try{await O(w,n)}catch(m){f({level:"error",event:"daemon.grants.on_sync_failed",error:m})}},"run");let o;const i=r(()=>{const a=c().catch(u=>{throw u instanceof h?f({level:"error",event:"daemon.grants.machine_revoked",error:u}):f({level:"error",event:"daemon.grants.sync_failed",error:u}),u}).finally(()=>{e===a&&(e=void 0)});return e=a,a},"start"),d=r((a={})=>e?a.fresh?(o??=e.catch(()=>{}).then(()=>(o=void 0,e??i())),o):e:i(),"sync");return _=d,d}r(Y,"createGrantSync");export{H as GRANT_SYNC_INTERVAL_S,h as MachineRevokedError,G as assertion,Y as createGrantSync,R as machineRevokedMessage,B as mintDirectoryToken,V as requestGrantSync,y as runtimeClient,K as runtimeId};
|