@north-light/cli 0.3.530 → 0.3.532
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/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/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/transport/exec-lifecycle.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/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 +2 -2
- 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 +13 -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 +5 -5
- 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 +2 -2
- 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 +13 -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/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/public-api.md +11 -0
- package/package.json +3 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +12 -12
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
1
|
+
var S=Object.defineProperty;var a=(n,s)=>S(n,"name",{value:s,configurable:!0});import{envNodeId as M}from"../../shared/env.js";import{getNode as p,listNodes as v,view as j}from"./canvas.js";import{openDb as E}from"./db.js";import{readTextIfExists as O}from"../fs-utils.js";import{conversationIdFromPath as y,conversationStore as g,ConversationNotFoundError as I}from"../conversation-store/index.js";import{reportBodyByName as C}from"../feed/reports.js";import{readStamps as A}from"../runtime/stamp/protocol.js";import{forEachAsync as B}from"../async-array.js";const nn=["human","inbox","wake","revive","restart-continuation","stop-guard","park","recovery","context-nudge","kickoff","unknown"],en=["user","assistant","toolResult"];async function R(){const n=M();if(n!==void 0&&n!==""){const s=await p(n);if(s!==null)return s.cwd}return process.cwd()}a(R,"callerCwd");function x(n){const s=Date.parse(n);return Number.isNaN(s)?0:s}a(x,"toMs");async function k(n){return(await(await E()).prepare(`SELECT m.created_at, m.sender_node_id, d.urgency, m.kind, m.label, m.body_ref, m.body_json
|
|
2
2
|
FROM deliveries d JOIN messages m ON m.message_id = d.message_id
|
|
3
3
|
WHERE d.destination_id = ? AND d.wake = 1
|
|
4
|
-
ORDER BY m.seq, d.created_at, d.delivery_id`).all(
|
|
5
|
-
`),
|
|
4
|
+
ORDER BY m.seq, d.created_at, d.delivery_id`).all(n)).map(e=>({ts:e.created_at,from:e.sender_node_id,tier:e.urgency,kind:e.kind,label:e.label,ref:e.body_ref,data:e.body_json===null?null:JSON.parse(e.body_json)}))}a(k,"allInboxEntries");async function _(n){const s=[`from: ${n.from??"system"}`,`tier: ${n.tier}`].join(`
|
|
5
|
+
`),e=`[${n.kind}] ${n.label}`,t=typeof n.data=="object"&&n.data!==null&&!Array.isArray(n.data)?n.data.body:void 0,i=typeof t=="string"?t.trim():"",o=typeof t=="string",r=n.ref!==null?o?O(n.ref)??"":await C(n.ref)??"":i,c=r!==""&&r!==n.label,f=[s,e];return n.ref!==null&&f.push(`ref: ${n.ref}`),c&&f.push(r),f.join(`
|
|
6
6
|
|
|
7
|
-
`)}
|
|
8
|
-
`)}
|
|
9
|
-
`).map(r=>r.trim()).find(r=>r!=="")??"",
|
|
7
|
+
`)}a(_,"inboxEntryBody");async function D(n,s,e,t){const i=`inbox/${String(t).padStart(6,"0")}`,o=await _(e),r={ref:`${n.node_id}:${i}`,nodeId:n.node_id,relpath:i,source:"inbox",ts:e.ts,tsMs:x(e.ts),title:`[${e.kind}] from ${e.from??"system"}: ${e.label}`,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:s,loadBody:a(()=>o,"loadBody"),origin:"inbox"};return typeof e.from=="string"&&e.from!==""&&(r.from=e.from),r}a(D,"inboxArtifact");async function N(n){const s=(await p(n))?.pi_session_file,e=typeof s=="string"?y(s):null;if(e===null)return null;try{return(await g().header(e)).path}catch(t){if(t instanceof I)return null;throw t}}a(N,"resolveSessionFile");function T(n){if(typeof n=="string")return n;if(!Array.isArray(n))return"";const s=[];for(const e of n){if(e===null||typeof e!="object")continue;const t=e;t.type==="text"&&typeof t.text=="string"?s.push(t.text):t.type==="toolCall"&&s.push(`Tool: ${typeof t.name=="string"?t.name:"call"}`)}return s.join(`
|
|
8
|
+
`)}a(T,"textFromBlocks");function F(n){return n==null?"unknown":n.type==="human"?"human":n.kind}a(F,"originToken");function L(n){if(n==null||n.type!=="runtime")return;const s=n.entries;if(s===void 0||s.length===0)return;const e=new Set;for(const t of s){const i=t.fromName??t.from;typeof i=="string"&&i!==""&&e.add(i)}return e.size===0?void 0:[...e].join(", ")}a(L,"sendersOf");async function $(n){const s=await N(n);if(s===null)return[];const e=(await g().read(y(s))).entries,t=new Map;for(const o of A(e)){if(o.kind!=="message")continue;const r=o.payload;typeof r.msgTs=="number"&&t.set(r.msgTs,r.origin)}const i=[];for(const o of e){if(o===null||typeof o!="object")continue;const r=o;if(r.type!=="message")continue;const c=r.message;if(c===null||typeof c!="object")continue;const f=c,d=typeof f.role=="string"?f.role:"";if(d==="")continue;const u=typeof f.timestamp=="number"?f.timestamp:void 0,l=typeof r.timestamp=="string"?r.timestamp:u!==void 0?new Date(u).toISOString():"",m=T(f.content),w={index:i.length,role:d,text:m,ts:l,tsMs:u??x(l)};if(d==="user"){const b=u!==void 0&&t.has(u)?t.get(u):null;w.origin=F(b);const h=L(b);h!==void 0&&(w.from=h)}i.push(w)}return i}a($,"sessionMessages");async function J(n,s){const e=(await g().read(y(n))).entries;let t=0;for(const i of e){if(i.type!=="message")continue;const o=i.message;if(!(o===null||typeof o!="object"||typeof o.role!="string")){if(t===s)return JSON.stringify(i);t++}}return null}a(J,"rawSessionLine");function K(n,s,e){const t=`session/${String(e.index).padStart(6,"0")}`,i=e.text.split(`
|
|
9
|
+
`).map(r=>r.trim()).find(r=>r!=="")??"",o={ref:`${n.node_id}:${t}`,nodeId:n.node_id,relpath:t,source:"transcript",ts:e.ts,tsMs:e.tsMs,title:`[${e.role}] ${i.length>80?`${i.slice(0,80)}\u2026`:i}`,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:s,loadBody:a(()=>e.text,"loadBody"),role:e.role};return e.origin!==void 0&&(o.origin=e.origin),e.from!==void 0&&(o.from=e.from),o}a(K,"transcriptArtifact");async function W(n){return(await p(n))?.description??""}a(W,"nodeDescOf");async function tn(n,s){const e=await P(n),t=s.kinds,i=s.statuses,o=e.filter(d=>!(t!==void 0&&t.length>0&&!t.includes(d.kind)||i!==void 0&&i.length>0&&!i.includes(d.status))),r=s.types!==void 0&&s.types.length>0?s.types:["inbox"],c=new Set(r),f=[];for(const d of o){const u=await W(d.node_id);if(c.has("inbox")&&await B(await k(d.node_id),async(l,m)=>f.push(await D(d,u,l,m))),c.has("transcript"))for(const l of await $(d.node_id))f.push(K(d,u,l))}return f.filter(d=>s.sinceMs!==void 0&&d.tsMs<s.sinceMs||s.untilMs!==void 0&&d.tsMs>s.untilMs?!1:G(d,s))}a(tn,"buildCorpus");function G(n,s){const{origins:e,roles:t,from:i}=s;return!(e!==void 0&&e.length>0&&(n.origin===void 0||!e.includes(n.origin))||t!==void 0&&t.length>0&&(n.role===void 0||!t.includes(n.role))||i!==void 0&&i!==""&&(n.from===void 0||!n.from.toLowerCase().includes(i.toLowerCase())))}a(G,"matchesMessageFilters");function sn(n,s){const e=new Map;for(const t of n){let i;switch(s){case"origin":i=t.origin;break;case"role":i=t.role;break;case"node":i=`${t.nodeName} (${t.nodeId})`;break;case"kind":i=t.nodeKind;break;case"type":i=t.source;break;case"day":i=t.ts.slice(0,10)||void 0;break}i===void 0||i===""||e.set(i,(e.get(i)??0)+1)}return[...e.entries()].map(([t,i])=>({key:t,count:i})).sort((t,i)=>i.count-t.count||t.key.localeCompare(i.key))}a(sn,"groupCorpus");async function P(n){const s=await v(),e=new Map(s.map(i=>[i.node_id,i]));if(n.nodes!==void 0&&n.nodes.length>0)return n.nodes.map(i=>e.get(i)).filter(i=>i!==void 0);if(n.under!==void 0&&n.under!=="")return[n.under,...await j(n.under)].map(o=>e.get(o)).filter(o=>o!==void 0);if(n.allCwds===!0)return s;const t=n.cwd!==void 0&&n.cwd!==""?n.cwd:await R();return s.filter(i=>i.cwd===t)}a(P,"scopedRows");async function on(n){const s=n.indexOf(":");if(s===-1)return null;const e=n.slice(0,s),t=n.slice(s+1),i=await p(e);if(i===null)return null;if(t.startsWith("inbox/")){const o=Number(t.slice(6)),r=(await k(e))[o];return r===void 0?null:{nodeId:e,relpath:t,source:"inbox",ts:r.ts,nodeName:i.name,body:await _(r),raw:null,path:null}}if(t==="session"||t.startsWith("session/")){const o=await N(e);if(o===null)return null;const r=await $(e);if(t==="session"){const d=r.map(u=>`## ${u.role}${u.origin!==void 0?` (origin: ${u.origin})`:""}
|
|
10
10
|
|
|
11
|
-
${
|
|
11
|
+
${u.text}`).join(`
|
|
12
12
|
|
|
13
|
-
`);return{nodeId:
|
|
14
|
-
`).join("")})(),path:
|
|
13
|
+
`);return{nodeId:e,relpath:t,source:"transcript",ts:r[r.length-1]?.ts??i.created,nodeName:i.name,body:d,raw:await(async()=>{const{header:u,entries:l}=await g().read(y(o));return[u,...l].map(m=>`${JSON.stringify(m)}
|
|
14
|
+
`).join("")})(),path:o}}const c=Number(t.slice(8)),f=r[c];return f===void 0?null:{nodeId:e,relpath:t,source:"transcript",ts:f.ts,nodeName:i.name,body:f.text,raw:await J(o,c),path:o}}return null}a(on,"resolveRef");export{en as MESSAGE_ROLES,nn as ORIGIN_TOKENS,tn as buildCorpus,R as callerCwd,sn as groupCorpus,on as resolveRef};
|
|
@@ -6,4 +6,4 @@ export declare function isValidInstallId(id: string): boolean;
|
|
|
6
6
|
* which is the intended behavior for both an invalid env value and a
|
|
7
7
|
* stored/env mismatch. Runs in the caller's canvas write transaction when
|
|
8
8
|
* one is open, else its own. `env` is injectable for tests. */
|
|
9
|
-
export declare function resolveInstallId(env?: NodeJS.ProcessEnv): string
|
|
9
|
+
export declare function resolveInstallId(env?: NodeJS.ProcessEnv): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=Object.defineProperty;var r=(t,e)=>c(t,"name",{value:e,configurable:!0});import{randomBytes as u}from"node:crypto";import{withCanvasWrite as d}from"./db.js";const l="install_id",I=/^[a-z0-9]{4,16}$/,o="abcdefghijklmnopqrstuvwxyz0123456789";function w(t){return I.test(t)}r(w,"isValidInstallId");function h(){const t=u(8);let e="";for(let n=0;n<8;n++)e+=o[t[n]%o.length];return e}r(h,"mintInstallId");async function f(t){return(await t.prepare("SELECT value FROM canvas_meta WHERE key = ?").get(l))?.value??null}r(f,"readInstallId");async function v(t,e){await t.prepare("INSERT INTO canvas_meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(l,e)}r(v,"writeInstallId");async function L(t=process.env){return await d(async e=>{const n=await f(e),s=t.CRTR_INSTALL_ID,a=s!==void 0&&s!==""?s:null;if(n!==null){if(a!==null&&a!==n)throw new Error(`CRTR_INSTALL_ID='${a}' conflicts with the install id already persisted in this canvas home ('${n}'). This canvas home was minted under a different install id \u2014 refusing to boot rather than silently mask what is usually a provisioning bug (this process pointed at the wrong volume/home).`);return n}if(a!==null&&!w(a))throw new Error(`CRTR_INSTALL_ID='${a}' is not a valid install id \u2014 expected 4-16 lowercase [a-z0-9] characters.`);const i=a??h();return await v(e,i),i})}r(L,"resolveInstallId");export{w as isValidInstallId,L as resolveInstallId};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** Find only terminal nodes with an unreconciled, explicitly disposable worktree.
|
|
2
2
|
* Keep due-time parsing in JS: Date.parse accepts more than SQLite's date
|
|
3
3
|
* functions, and malformed dates are due rather than permanently skipped. */
|
|
4
|
-
export declare function managedWorktreeSweepCandidates(now: number): string[]
|
|
4
|
+
export declare function managedWorktreeSweepCandidates(now: number): Promise<string[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var d=Object.defineProperty;var
|
|
1
|
+
var d=Object.defineProperty;var s=(t,o)=>d(t,"name",{value:o,configurable:!0});import{openDb as _}from"./db.js";async function w(t){const o=await(await _()).prepare(`
|
|
2
2
|
SELECT w.node_id, w.sweep_observed_json, w.next_attempt_at,
|
|
3
3
|
w.abandoned_json, w.land_intent_json, w.disposal_json
|
|
4
4
|
FROM worktrees w
|
|
@@ -9,4 +9,4 @@ var d=Object.defineProperty;var a=(t,o)=>d(t,"name",{value:o,configurable:!0});i
|
|
|
9
9
|
AND (w.state = 'open' OR w.cleanup_state IS NULL OR w.cleanup_state != 'complete')
|
|
10
10
|
AND (w.state = 'closed' OR (n.status = 'done' AND n.final_report IS NOT NULL))
|
|
11
11
|
ORDER BY n.created
|
|
12
|
-
`).all(),
|
|
12
|
+
`).all(),a=[];for(const e of o){try{for(const n of[e.sweep_observed_json,e.abandoned_json,e.land_intent_json,e.disposal_json])n!==null&&JSON.parse(n)}catch{continue}if(e.sweep_observed_json!==null&&e.next_attempt_at!==null){const n=Date.parse(e.next_attempt_at);if(!Number.isNaN(n)&&n>t)continue}a.push(e.node_id)}return a}s(w,"managedWorktreeSweepCandidates");export{w as managedWorktreeSweepCandidates};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { MemoryReadEventDTO } from '../../api/dto/analytics.js';
|
|
2
|
+
import { type CanvasDb } from './db.js';
|
|
3
3
|
/** Entries older than this are deleted by the hourly storage-maintenance pass. */
|
|
4
4
|
export declare const MEMORY_READS_RETENTION_MS: number;
|
|
5
5
|
export interface MemoryReadRow {
|
|
@@ -11,14 +11,14 @@ export interface MemoryReadRow {
|
|
|
11
11
|
}
|
|
12
12
|
/** Insert every event for one node in one transaction. `at` must already be a
|
|
13
13
|
* canonical ISO UTC string (`Date#toISOString`) so range reads compare as text. */
|
|
14
|
-
export declare function insertMemoryReads(nodeId: string, events: MemoryReadEventDTO[]): void
|
|
14
|
+
export declare function insertMemoryReads(nodeId: string, events: MemoryReadEventDTO[]): Promise<void>;
|
|
15
15
|
/** Record events inside the caller's write transaction: the canvas-model
|
|
16
16
|
* delivery (`loaded`) and explicit document read (`read`) sites call this so
|
|
17
17
|
* the log lands with the exposures and watches it describes. */
|
|
18
|
-
export declare function recordMemoryReadsIn(db:
|
|
18
|
+
export declare function recordMemoryReadsIn(db: CanvasDb, nodeId: string, events: readonly MemoryReadEventDTO[]): Promise<void>;
|
|
19
19
|
/** Entries with `fromIso <= at < toIso`, oldest first. */
|
|
20
|
-
export declare function listMemoryReads(fromIso: string, toIso: string): MemoryReadRow[]
|
|
20
|
+
export declare function listMemoryReads(fromIso: string, toIso: string): Promise<MemoryReadRow[]>;
|
|
21
21
|
/** Delete entries older than the retention window; returns the count deleted. */
|
|
22
|
-
export declare function pruneMemoryReads(nowMs: number): number
|
|
22
|
+
export declare function pruneMemoryReads(nowMs: number): Promise<number>;
|
|
23
23
|
/** When recording began: the time the memory_reads migration ran. */
|
|
24
|
-
export declare function memoryReadsStartedAt(): string | null
|
|
24
|
+
export declare function memoryReadsStartedAt(): Promise<string | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{withCanvasWrite as i,openDb as s}from"./db.js";const c=720*60*60*1e3;async function E(e,t){await i(async n=>{const o=n.prepare("INSERT INTO memory_reads (node_id, name, scope, at, type) VALUES (?, ?, ?, ?, ?)");for(const a of t)await o.run(e,a.name,a.scope,a.at,a.type)})}r(E,"insertMemoryReads");async function d(e,t,n){if(n.length===0)return;const o=e.prepare("INSERT INTO memory_reads (node_id, name, scope, at, type) VALUES (?, ?, ?, ?, ?)");for(const a of n)await o.run(t,a.name,a.scope,a.at,a.type)}r(d,"recordMemoryReadsIn");async function R(e,t){return await(await s()).prepare("SELECT node_id, name, scope, at, type FROM memory_reads WHERE at >= ? AND at < ? ORDER BY at").all(e,t)}r(R,"listMemoryReads");async function u(e){return Number((await(await s()).prepare("DELETE FROM memory_reads WHERE at < ?").run(new Date(e-c).toISOString())).changes)}r(u,"pruneMemoryReads");async function w(){return(await(await s()).prepare("SELECT value FROM canvas_meta WHERE key = 'memory_reads.started_at'").get())?.value??null}r(w,"memoryReadsStartedAt");export{c as MEMORY_READS_RETENTION_MS,E as insertMemoryReads,R as listMemoryReads,w as memoryReadsStartedAt,u as pruneMemoryReads,d as recordMemoryReadsIn};
|
|
@@ -2,7 +2,7 @@ import { type FlatRow, type FoldState, type SubtreeActivity } from './nav-render
|
|
|
2
2
|
import type { NodeMeta } from './index.js';
|
|
3
3
|
export { PI_MAX_WIDGET_LINES, VIEWPORT_FALLBACK_ROWS, ESC, RESET, BOLD, DIM, REVERSE, BG_ATTACHED, GREEN, RED, YELLOW, CYAN, GRAY, nodeGlyph, visibleWidth, truncate, fillWidth, fillBar, fmtTokens, tokensCell, activityCell, cycleBadge, navLabel, shortId, askBadge, liveBelowBadge, isAttached, hasBrokerViewers, fetchAsksMap, graphWidgetBudget, GRAPH_HINT, type FlatRow, type FoldState, type SubtreeActivity, } from './nav-render.js';
|
|
4
4
|
/** First manager (by created) — the UP step for the ancestry spine. */
|
|
5
|
-
export declare function managerOf(id: string): string | undefined
|
|
5
|
+
export declare function managerOf(id: string): Promise<string | undefined>;
|
|
6
6
|
/** A kind:'human' node is a control-plane ASK (a page on the human's
|
|
7
7
|
* screen), NOT a pi conversation — it has no session, so focusing/reviving it
|
|
8
8
|
* boots a confused blank "you have been revived" pi. Its pending-ask signal
|
|
@@ -10,35 +10,35 @@ export declare function managerOf(id: string): string | undefined;
|
|
|
10
10
|
* bridge node's parent relation), so the row carries no signal of its
|
|
11
11
|
* own. Drop it from every navigable list (the tree, BASE reports, child counts,
|
|
12
12
|
* subtree expansion) so it can never be selected. */
|
|
13
|
-
export declare function isHumanAsk(id: string): boolean
|
|
13
|
+
export declare function isHumanAsk(id: string): Promise<boolean>;
|
|
14
14
|
/** A node's direct children that are navigable conversations — human-ask nodes
|
|
15
15
|
* dropped. The one place the nav chrome enumerates children. */
|
|
16
|
-
export declare function convoChildIds(id: string): string[]
|
|
16
|
+
export declare function convoChildIds(id: string): Promise<string[]>;
|
|
17
17
|
/** Live reports (active|idle) of a node — the DOWN set in BASE. */
|
|
18
|
-
export declare function liveReports(id: string): string[]
|
|
18
|
+
export declare function liveReports(id: string): Promise<string[]>;
|
|
19
19
|
/** Direct navigable children — used for the ⤳ badge (human-ask nodes excluded,
|
|
20
20
|
* so the count matches what the tree actually shows). */
|
|
21
|
-
export declare function childCount(id: string): number
|
|
21
|
+
export declare function childCount(id: string): Promise<number>;
|
|
22
22
|
/** Climb first-manager edges from `self` to the ancestry root (cycle-guarded). */
|
|
23
|
-
export declare function climbRoot(self: string): string
|
|
23
|
+
export declare function climbRoot(self: string): Promise<string>;
|
|
24
24
|
/** Space-joined ids of a node's subtree (cursor-relative {subtree} var). */
|
|
25
|
-
export declare function subtreeIds(root: string): string[]
|
|
25
|
+
export declare function subtreeIds(root: string): Promise<string[]>;
|
|
26
26
|
/** ⤳M direct-children badge — the single child-count signal, shown on any row
|
|
27
27
|
* with navigable children (folded or not). In GRAPH the ▸ caret separately marks
|
|
28
28
|
* a collapsed row, so this stays a pure count and never doubles as a fold badge. */
|
|
29
|
-
export declare function childBadge(node: NodeMeta | null): string
|
|
29
|
+
export declare function childBadge(node: NodeMeta | null): Promise<string>;
|
|
30
30
|
/** Direct children, live-first — the sibling order used both when flattening
|
|
31
31
|
* the tree and when stepping into a subtree (`l`). Array.sort is stable, so
|
|
32
32
|
* equal-status siblings keep their creation order. */
|
|
33
|
-
export declare function sortedChildIds(id: string): string[]
|
|
34
|
-
export declare function computeSubtreeActivity(root: string, self: string): SubtreeActivity
|
|
33
|
+
export declare function sortedChildIds(id: string): Promise<string[]>;
|
|
34
|
+
export declare function computeSubtreeActivity(root: string, self: string): Promise<SubtreeActivity>;
|
|
35
35
|
/** Fold policy alone — thin wrapper over computeSubtreeActivity for the keypress
|
|
36
36
|
* path (buildGraphModel without a precomputed set). The render path computes the
|
|
37
37
|
* activity once and threads `expand` in, so it never recomputes here. */
|
|
38
|
-
export declare function computeDefaultExpanded(root: string, self: string): Set<string
|
|
39
|
-
export declare function buildGraphModel(self: string, folds: FoldState, expand?: ReadonlySet<string>): FlatRow[]
|
|
38
|
+
export declare function computeDefaultExpanded(root: string, self: string): Promise<Set<string>>;
|
|
39
|
+
export declare function buildGraphModel(self: string, folds: FoldState, expand?: ReadonlySet<string>): Promise<FlatRow[]>;
|
|
40
40
|
/** Render one GRAPH row. CURSOR (selected) → reverse-video bar; an ATTACHED
|
|
41
41
|
* (human-watched) node → a coloured background bar; SELF → bold name. The
|
|
42
42
|
* cursor outranks the attached tint when both land on the same row. The
|
|
43
43
|
* overlay-aware glyph alone carries the live signal (status / ⟳ / ⚠). */
|
|
44
|
-
export declare function renderGraphRow(r: FlatRow, isCursor: boolean, focused: ReadonlySet<string>, activeBelow: ReadonlyMap<string, number>, asks: Record<string, number>): string
|
|
44
|
+
export declare function renderGraphRow(r: FlatRow, isCursor: boolean, focused: ReadonlySet<string>, activeBelow: ReadonlyMap<string, number>, asks: Record<string, number>): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var S=Object.defineProperty;var n=(t,a)=>S(t,"name",{value:a,configurable:!0});import{getNode as v,subscribersOf as R,subscriptionsOf as I}from"./index.js";import{faultSummary as C}from"./status-glyph.js";import{statusRank as _}from"./node-order.js";import{nodeGlyph as G,navLabel as O,shortId as T,tokensCell as D,activityCell as W,cycleBadge as L,askBadge as M,liveBelowBadge as N,truncate as H,fillBar as k,fillWidth as B,isAttached as K,BOLD as P,DIM as E,RESET as p,REVERSE as V,BG_ATTACHED as Y}from"./nav-render.js";import{filterAsync as b,mapAsync as F}from"../async-array.js";import{PI_MAX_WIDGET_LINES as wt,VIEWPORT_FALLBACK_ROWS as pt,ESC as yt,RESET as $t,BOLD as mt,DIM as vt,REVERSE as Et,BG_ATTACHED as xt,GREEN as gt,RED as kt,YELLOW as Bt,CYAN as bt,GRAY as At,nodeGlyph as St,visibleWidth as Rt,truncate as It,fillWidth as Ct,fillBar as _t,fmtTokens as Gt,tokensCell as Ot,activityCell as Tt,cycleBadge as Dt,navLabel as Wt,shortId as Lt,askBadge as Mt,liveBelowBadge as Nt,isAttached as Ht,hasBrokerViewers as Kt,fetchAsksMap as Pt,graphWidgetBudget as Vt,GRAPH_HINT as Yt}from"./nav-render.js";async function q(t){try{return await I(t)}catch{return[]}}n(q,"subsOf");async function X(t){try{return await R(t)}catch{return[]}}n(X,"mgrsOf");async function j(t){return(await X(t))[0]?.node_id}n(j,"managerOf");async function z(t){return(await v(t))?.kind==="human"}n(z,"isHumanAsk");async function y(t){return await b((await q(t)).map(a=>a.node_id),async a=>!await z(a))}n(y,"convoChildIds");async function it(t){return await b(await y(t),async a=>{const s=(await v(a))?.status;return s==="active"||s==="idle"})}n(it,"liveReports");async function J(t){return(await y(t)).length}n(J,"childCount");async function Q(t){let a=t;const s=new Set([a]);for(;;){const o=await j(a);if(o===void 0||s.has(o))break;s.add(o),a=o}return a}n(Q,"climbRoot");async function lt(t){const a=[],s=new Set([t]),o=await y(t);for(;o.length>0;){const i=o.shift();if(!s.has(i)){s.add(i),a.push(i);for(const l of await y(i))s.has(l)||o.push(l)}}return a}n(lt,"subtreeIds");async function U(t){if(t===null)return"";const a=await J(t.node_id);return a>0?` ${E}\u2933${a}${p}`:""}n(U,"childBadge");async function Z(t){return(await F(await y(t),async a=>({cid:a,rank:_((await v(a))?.status)}))).sort((a,s)=>a.rank-s.rank).map(({cid:a})=>a)}n(Z,"sortedChildIds");async function tt(t,a){const s=new Set,o=new Map,i=new Set,l=n(async e=>{const u=(await v(e))?.status==="active";if(i.has(e))return{active:u?1:0,reveal:u||e===a};i.add(e);let d=0,c=!1;for(const h of await y(e)){const f=await l(h);d+=f.active,f.reveal&&(c=!0)}return o.set(e,d),c&&s.add(e),{active:d+(u?1:0),reveal:c||u||e===a}},"visit");return await l(t),{expand:s,activeBelow:o}}n(tt,"computeSubtreeActivity");async function at(t,a){return(await tt(t,a)).expand}n(at,"computeDefaultExpanded");async function ut(t,a,s){const o=await Q(t),i=s??await at(o,t),l=n(c=>a.userExpanded.has(c)?!1:a.userCollapsed.has(c)?!0:!i.has(c),"isFolded"),e=[],u=new Set,d=n(async(c,h,f,$)=>{if(u.has(c)){const r=f?"":$?"\u2514\u2500 ":"\u251C\u2500 ";e.push({id:c,hasKids:!1,isSelf:c===t,branch:h+r,cycle:!0,collapsed:!1});return}u.add(c);const w=await Z(c),m=l(c),x=f?"":$?"\u2514\u2500 ":"\u251C\u2500 ";if(e.push({id:c,hasKids:w.length>0,isSelf:c===t,branch:h+x,cycle:!1,collapsed:m}),m)return;const g=f?"":h+($?" ":"\u2502 ");for(let r=0;r<w.length;r++)await d(w[r],g,!1,r===w.length-1)},"walk");return await d(o,"",!0,!0),e}n(ut,"buildGraphModel");async function dt(t,a,s,o,i){const l=n((r,A)=>a?k(r,B(),V):A?k(r,B(),Y):H(r),"wrap");if(t.cycle){const r=`${t.branch} ${E}\u21BA ${T(t.id)}${p}`;return l(r,!1)}const e=await v(t.id),u=G(e),d=O(e,t.id),c=t.isSelf?`${P}${d}${p}`:d,h=`${E}${e?.kind??""}${p}`,f=`${E}${D(e)}${p}`,$=t.hasKids&&t.collapsed,w=!a&&$?`${E}\u25B8${p} `:" ",m=e?.fault??null,x=m!==null?` \xB7 ${C(m)}`:"",g=`${t.branch}${w}${u} ${c} ${h} ${f}${L(e)}${await U(e)}${N(e,o)}${M(t.id,i)}${W(e)}${x}`;return l(g,K(t.id,e,s))}n(dt,"renderGraphRow");export{xt as BG_ATTACHED,mt as BOLD,bt as CYAN,vt as DIM,yt as ESC,Yt as GRAPH_HINT,At as GRAY,gt as GREEN,wt as PI_MAX_WIDGET_LINES,kt as RED,$t as RESET,Et as REVERSE,pt as VIEWPORT_FALLBACK_ROWS,Bt as YELLOW,Tt as activityCell,Mt as askBadge,ut as buildGraphModel,U as childBadge,J as childCount,Q as climbRoot,at as computeDefaultExpanded,tt as computeSubtreeActivity,y as convoChildIds,Dt as cycleBadge,Pt as fetchAsksMap,_t as fillBar,Ct as fillWidth,Gt as fmtTokens,Vt as graphWidgetBudget,Kt as hasBrokerViewers,Ht as isAttached,z as isHumanAsk,Nt as liveBelowBadge,it as liveReports,j as managerOf,Wt as navLabel,St as nodeGlyph,dt as renderGraphRow,Lt as shortId,Z as sortedChildIds,lt as subtreeIds,Ot as tokensCell,It as truncate,Rt as visibleWidth};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Resolve an existing node's app from the sole durable assignment, its row.
|
|
2
2
|
* Brokers have only their own app in their launch environment, not the DB. */
|
|
3
|
-
export declare function appForNode(nodeId: string): string
|
|
4
|
-
export declare function nodeAgentDir(nodeId: string, grantee?: string): string
|
|
5
|
-
export declare function contextDir(nodeId: string, grantee?: string): string
|
|
6
|
-
export declare function reportsDir(nodeId: string, grantee?: string): string
|
|
7
|
-
export declare function interpolateNodePaths(text: string, nodeId: string): string
|
|
8
|
-
export declare function ensureNodeDirs(nodeId: string, grantee?: string): void
|
|
3
|
+
export declare function appForNode(nodeId: string): Promise<string>;
|
|
4
|
+
export declare function nodeAgentDir(nodeId: string, grantee?: string): Promise<string>;
|
|
5
|
+
export declare function contextDir(nodeId: string, grantee?: string): Promise<string>;
|
|
6
|
+
export declare function reportsDir(nodeId: string, grantee?: string): Promise<string>;
|
|
7
|
+
export declare function interpolateNodePaths(text: string, nodeId: string): Promise<string>;
|
|
8
|
+
export declare function ensureNodeDirs(nodeId: string, grantee?: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var e=(r,t)=>p(r,"name",{value:t,configurable:!0});import{join as a}from"node:path";import{envGrantee as s,envNodeId as c}from"../../shared/env.js";import{openDb as u}from"./db.js";import{nodeAgentDir as f,ensureNodeDirs as w,interpolateNodePaths as m}from"./paths.js";async function n(r){const t=s();if(c()===r&&t)return t;const o=await(await u()).prepare("SELECT grantee FROM node_rows WHERE node_id = ?").get(r);if(!o?.grantee)throw new Error(`node ${r} has no app assignment`);return o.grantee}e(n,"appForNode");async function i(r,t){return f(r,t??await n(r))}e(i,"nodeAgentDir");async function N(r,t){return a(await i(r,t),"context")}e(N,"contextDir");async function h(r,t){return a(await i(r,t),"reports")}e(h,"reportsDir");async function E(r,t){return m(r,t,await n(t))}e(E,"interpolateNodePaths");async function F(r,t){w(r,t??await n(r))}e(F,"ensureNodeDirs");export{n as appForNode,N as contextDir,F as ensureNodeDirs,E as interpolateNodePaths,i as nodeAgentDir,h as reportsDir};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type CanvasDb } from './db.js';
|
|
2
2
|
export interface NodePrincipal {
|
|
3
3
|
app: string;
|
|
4
4
|
node: string;
|
|
@@ -9,16 +9,16 @@ export interface NodePrincipal {
|
|
|
9
9
|
client_id: string | null;
|
|
10
10
|
scopes: string[] | null;
|
|
11
11
|
}
|
|
12
|
-
export declare function mintNodeToken(db:
|
|
12
|
+
export declare function mintNodeToken(db: CanvasDb, executionId: string, nodeId: string, issuedAt: string): Promise<void>;
|
|
13
13
|
/** Called exactly once by the host at spawn, never serialized into a launch recipe. */
|
|
14
14
|
export declare function takeNodeToken(executionId: string): string;
|
|
15
15
|
export declare function forgetNodeToken(executionId: string): void;
|
|
16
16
|
/** A stopped or superseded execution can never authenticate, even after restart. */
|
|
17
|
-
export declare function resolveNodeToken(token: string): NodePrincipal | null
|
|
18
|
-
export declare function revokeExitedNodeToken(executionId: string): void
|
|
19
|
-
export declare function revokePriorEpochNodeTokens(epoch: string): void
|
|
17
|
+
export declare function resolveNodeToken(token: string): Promise<NodePrincipal | null>;
|
|
18
|
+
export declare function revokeExitedNodeToken(executionId: string): Promise<void>;
|
|
19
|
+
export declare function revokePriorEpochNodeTokens(epoch: string): Promise<void>;
|
|
20
20
|
/** OWN-11 for a joined runtime: a `user:local` subject becomes the owner, a
|
|
21
21
|
* `user:local` grantee becomes `app:terminal` (no token has the owner as grantee),
|
|
22
22
|
* and a reference to the dropped local grant is cleared. */
|
|
23
|
-
export declare function rewriteLocalNodeTokenIdentity(db:
|
|
24
|
-
export declare function revokeNodeTokens(db:
|
|
23
|
+
export declare function rewriteLocalNodeTokenIdentity(db: CanvasDb, owner: string, localGrantId: string): Promise<number>;
|
|
24
|
+
export declare function revokeNodeTokens(db: CanvasDb, where: 'broker_process_id' | 'node_id', id: string, at: string): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var g=Object.defineProperty;var r=(e,n)=>g(e,"name",{value:n,configurable:!0});import{createHash as k,randomBytes as m}from"node:crypto";import{openDb as u}from"./db.js";import{terminalGrant as w}from"../grants/mirror.js";import{readConfig as _}from"../config.js";import{uidForApp as N}from"../spaces/users.js";const a=new Map,l=r(e=>k("sha256").update(e).digest("hex"),"hash");async function x(e,n,o,i){const t=await e.prepare("SELECT grantee, sub, grant_id, client_id, scopes_json, run_id FROM node_rows WHERE node_id = ?").get(o);if(!t)throw new Error(`cannot mint node token: missing node ${o}`);const s=t.run_id&&t.run_id!==o?await e.prepare("SELECT sub, grant_id, client_id FROM nodes WHERE node_id = ?").get(t.run_id):void 0,d=t.grantee==="app:terminal"?await w():null,p=d?.sub??s?.sub??t.sub,E=d?.id??s?.grant_id??t.grant_id??null;if(t.grantee==="app:terminal"&&_("user").runtime?.issuer&&!d)throw new Error("cannot mint node token: terminal grant is not active");if(!p&&t.grantee!=="user:local"&&!(t.grantee==="app:terminal"&&!_("user").runtime?.issuer))throw new Error(`cannot mint node token: no subject for ${t.grantee}`);const c=m(32).toString("base64url");await e.prepare("INSERT INTO node_tokens (broker_process_id, node_id, token_hash, grantee, uid, sub, grant, client_id, scopes_json, issued_at, revoked_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)").run(n,o,l(c),t.grantee==="user:local"?"app:terminal":t.grantee,await N(t.grantee==="user:local"?"app:terminal":t.grantee),p??"user:local",E,s?.client_id??t.client_id,t.scopes_json,i),a.set(n,c)}r(x,"mintNodeToken");function A(e){const n=a.get(e);if(a.delete(e),!n)throw new Error(`missing node token for execution ${e}`);return n}r(A,"takeNodeToken");function T(e){a.delete(e)}r(T,"forgetNodeToken");async function D(e){if(!/^[A-Za-z0-9_-]{43}$/.test(e))return null;const n=await(await u()).prepare(`SELECT t.node_id, t.grantee, t.uid, t.sub, t.grant, t.client_id, t.scopes_json, n.run_id
|
|
2
2
|
FROM node_tokens t JOIN executions e ON e.execution_id = t.broker_process_id
|
|
3
3
|
JOIN nodes n ON n.node_id = t.node_id
|
|
4
|
-
WHERE t.token_hash = ? AND t.revoked_at IS NULL AND e.state != 'exited'`).get(
|
|
5
|
-
AND broker_process_id IN (SELECT execution_id FROM executions WHERE daemon_epoch IS NOT ?)`).run(new Date().toISOString(),e)}
|
|
4
|
+
WHERE t.token_hash = ? AND t.revoked_at IS NULL AND e.state != 'exited'`).get(l(e));return n?{app:n.grantee,node:n.node_id,run:n.run_id,uid:n.uid,sub:n.sub,grant:n.grant,client_id:n.client_id,scopes:n.scopes_json===null?null:JSON.parse(n.scopes_json)}:null}r(D,"resolveNodeToken");async function U(e){T(e),await f(await u(),"broker_process_id",e,new Date().toISOString())}r(U,"revokeExitedNodeToken");async function v(e){await(await u()).prepare(`UPDATE node_tokens SET revoked_at = ? WHERE revoked_at IS NULL
|
|
5
|
+
AND broker_process_id IN (SELECT execution_id FROM executions WHERE daemon_epoch IS NOT ?)`).run(new Date().toISOString(),e)}r(v,"revokePriorEpochNodeTokens");async function H(e,n,o){return Number((await e.prepare("UPDATE node_tokens SET sub = ? WHERE sub = 'user:local'").run(n)).changes)+Number((await e.prepare("UPDATE node_tokens SET grantee = 'app:terminal' WHERE grantee = 'user:local'").run()).changes)+Number((await e.prepare('UPDATE node_tokens SET "grant" = NULL WHERE "grant" = ?').run(o)).changes)}r(H,"rewriteLocalNodeTokenIdentity");async function f(e,n,o,i){await e.prepareUncached(`UPDATE node_tokens SET revoked_at = ? WHERE ${n} = ? AND revoked_at IS NULL`).run(i,o)}r(f,"revokeNodeTokens");export{T as forgetNodeToken,x as mintNodeToken,D as resolveNodeToken,U as revokeExitedNodeToken,f as revokeNodeTokens,v as revokePriorEpochNodeTokens,H as rewriteLocalNodeTokenIdentity,A as takeNodeToken};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { ObjectRow } from '../graph/types.js';
|
|
3
2
|
import type { NodeOutcomeDocumentV1 } from '../runtime/outcome-document.js';
|
|
4
3
|
import type { OutcomeDeliveryBinding } from './canvas.js';
|
|
5
4
|
import { type DeliveryRecord } from './deliveries.js';
|
|
5
|
+
import type { CanvasDb } from './db.js';
|
|
6
6
|
export interface OutcomeActionRecord {
|
|
7
7
|
object: ObjectRow;
|
|
8
8
|
actionName: string;
|
|
@@ -14,10 +14,10 @@ export interface OutcomeActionRecord {
|
|
|
14
14
|
updatedAt: number;
|
|
15
15
|
}
|
|
16
16
|
/** Resolve only the live action belonging to this node, never an unrelated action of the same name. */
|
|
17
|
-
export declare function readOutcomeAction(db:
|
|
17
|
+
export declare function readOutcomeAction(db: CanvasDb, nodeId: string): Promise<OutcomeActionRecord | null>;
|
|
18
18
|
/** Register or replace an undelivered action in the caller's transaction. */
|
|
19
|
-
export declare function registerOutcomeAction(db:
|
|
19
|
+
export declare function registerOutcomeAction(db: CanvasDb, nodeId: string, binding: OutcomeDeliveryBinding): Promise<void>;
|
|
20
20
|
/** Refuse removal after any delivery, including an acknowledged historical one. */
|
|
21
|
-
export declare function unregisterOutcomeAction(db:
|
|
21
|
+
export declare function unregisterOutcomeAction(db: CanvasDb, nodeId: string): Promise<boolean>;
|
|
22
22
|
/** Late registration dispatches directly to its action, not to every outcome watcher. */
|
|
23
|
-
export declare function enqueueLateOutcomeAction(db:
|
|
23
|
+
export declare function enqueueLateOutcomeAction(db: CanvasDb, nodeId: string, document: NodeOutcomeDocumentV1): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var i=(t,a)=>p(t,"name",{value:a,configurable:!0});import{createObject as u,nodeObject as l}from"../graph/objects.js";import{recordWatch as d}from"../graph/watches.js";import{argvReceiver as m}from"../graph/receivers.js";import{finalizeNodeMail as w,insertMessage as v}from"../feed/messages.js";import{deliveryFrom as E}from"./deliveries.js";async function s(t,a){const e=await t.prepare(`SELECT a.*, c.receiver_json, c.payload_json FROM objects a
|
|
2
2
|
JOIN objects n ON n.id = ? AND n.type = 'node'
|
|
3
3
|
JOIN custom_objects c ON c.object = a.rowid
|
|
4
4
|
WHERE a.type = 'action' AND a.name = ? AND a.owner = n.owner AND a.deleted_at IS NULL
|
|
5
|
-
ORDER BY a.rowid DESC LIMIT 1`).get(
|
|
6
|
-
ON CONFLICT(object) DO UPDATE SET receiver_json = excluded.receiver_json, payload_json = excluded.payload_json`).run(n.rowid,
|
|
5
|
+
ORDER BY a.rowid DESC LIMIT 1`).get(a,`outcome/${a}`);if(!e)return null;const r=JSON.parse(e.receiver_json),o=await t.prepare("SELECT * FROM deliveries WHERE destination_id = ? ORDER BY created_at DESC, rowid DESC LIMIT 1").get(e.id);return{object:e,actionName:r.name,argv:r.argv,cwd:r.cwd,configOrigin:r.config_origin,payload:e.payload_json===null?null:JSON.parse(e.payload_json),delivery:o?E(o):null,updatedAt:r.updated_at??Date.parse(e.created_at)}}i(s,"readOutcomeAction");async function g(t,a,e){const r=await l(t,a),o=await s(t,a);if(o?.delivery)throw new Error(`outcome action ${a} already has a delivery`);const n=o?.object??await u(t,{type:"action",kind:null,owner:r.owner,privacy:"public",name:`outcome/${a}`,preview:e.actionName}),c=JSON.stringify({argv:e.argv,cwd:e.cwd,config_origin:e.configOrigin,name:e.actionName,updated_at:o?Math.max(Date.now(),o.updatedAt+1):Date.parse(n.created_at)});await t.prepare(`INSERT INTO custom_objects (object, receiver_json, payload_json) VALUES (?, ?, ?)
|
|
6
|
+
ON CONFLICT(object) DO UPDATE SET receiver_json = excluded.receiver_json, payload_json = excluded.payload_json`).run(n.rowid,c,JSON.stringify(e.payload??null)),o?await t.prepare("UPDATE objects SET preview = ? WHERE rowid = ?").run(e.actionName,n.rowid):(await t.prepare("UPDATE objects SET reception = 2 WHERE rowid = ?").run(n.rowid),await d(t,n,r,"spawn",{patterns:["outcome"],config:[{threshold:1,delivery:"after-turn"}]}))}i(g,"registerOutcomeAction");async function D(t,a){const e=await s(t,a);return e?e.delivery?!1:(await t.prepare("DELETE FROM objects WHERE rowid = ?").run(e.object.rowid),!0):!0}i(D,"unregisterOutcomeAction");async function S(t,a,e){const r=await s(t,a);if(!r||r.delivery)throw new Error(`outcome action ${a} cannot be delivered again`);const o=await l(t,a),n=w({senderNodeId:a,senderName:o.name,kind:"completed",label:`outcome node ${o.name}`,bodyJson:e,urgency:"normal"},null),c=await v(t,{...n,senderNodeId:a,senderName:o.name,kind:"completed",label:`outcome node ${o.name}`,disposition:null,event:{event:"outcome",objectId:a,level:1,actorId:a}});await m.enqueue(t,{messageId:c,event:"outcome",level:1,senderNodeId:a,elevatesTier:!1},[{id:r.object.id,reception:2,delivery:"after-turn"}])}i(S,"enqueueLateOutcomeAction");export{S as enqueueLateOutcomeAction,s as readOutcomeAction,g as registerOutcomeAction,D as unregisterOutcomeAction};
|
|
@@ -28,68 +28,68 @@ export interface TransportPoisonVerdict {
|
|
|
28
28
|
routes: string[];
|
|
29
29
|
}
|
|
30
30
|
export interface BootFaultAttempt {
|
|
31
|
-
explanation(): string | null
|
|
31
|
+
explanation(): Promise<string | null>;
|
|
32
32
|
}
|
|
33
33
|
export declare function parseProviderError(value: unknown): FaultProviderError | undefined;
|
|
34
34
|
export declare function hydrateFault(row: Record<string, unknown>): StoredFault;
|
|
35
35
|
export declare function openTurn(executionId: string, _opts: {
|
|
36
36
|
reason: 'agent-start' | 'prompt-unsettled';
|
|
37
|
-
}): boolean
|
|
38
|
-
export declare function recordTurnProgress(executionId: string): boolean
|
|
37
|
+
}): Promise<boolean>;
|
|
38
|
+
export declare function recordTurnProgress(executionId: string): Promise<boolean>;
|
|
39
39
|
/** Closes the open turn. A `settled` close also stamps the node's `reply_at` (the dashboard's unread marker) in the same
|
|
40
40
|
* write, and `read_at` too when a viewer was shown the conversation while the turn ended. A close that changes no row writes neither. */
|
|
41
41
|
export declare function closeTurn(executionId: string, opts: {
|
|
42
42
|
endReason: 'settled' | 'teardown-aborted';
|
|
43
43
|
viewerPresent?: boolean;
|
|
44
|
-
}): boolean
|
|
44
|
+
}): Promise<boolean>;
|
|
45
45
|
/** Stamps `read_at`: a viewer has just been shown this conversation. */
|
|
46
|
-
export declare function markNodeRead(nodeId: string): boolean
|
|
47
|
-
export declare function recordTransportPoisonVerdict(executionId: string, verdict: TransportPoisonVerdict): boolean
|
|
48
|
-
export declare function readTransportPoisonVerdict(nodeId: string): TransportPoisonVerdict | null
|
|
49
|
-
export declare function readLiveTurn(nodeId: string): {
|
|
46
|
+
export declare function markNodeRead(nodeId: string): Promise<boolean>;
|
|
47
|
+
export declare function recordTransportPoisonVerdict(executionId: string, verdict: TransportPoisonVerdict): Promise<boolean>;
|
|
48
|
+
export declare function readTransportPoisonVerdict(nodeId: string): Promise<TransportPoisonVerdict | null>;
|
|
49
|
+
export declare function readLiveTurn(nodeId: string): Promise<{
|
|
50
50
|
busy: boolean;
|
|
51
51
|
progressAt: string | null;
|
|
52
|
-
} | null
|
|
53
|
-
export declare function readInterruptedTurn(nodeId: string): {
|
|
52
|
+
} | null>;
|
|
53
|
+
export declare function readInterruptedTurn(nodeId: string): Promise<{
|
|
54
54
|
interrupted: boolean;
|
|
55
55
|
progressAt: string | null;
|
|
56
|
-
} | null
|
|
56
|
+
} | null>;
|
|
57
57
|
/** Whether any execution of this node ever admitted a turn (agent_start recorded
|
|
58
58
|
* by the daemon). This, not the transcript, is the durable fact that a node's
|
|
59
59
|
* birth task was delivered: a session file holding only the bearings message
|
|
60
60
|
* exists before the kickoff is admitted. */
|
|
61
|
-
export declare function hasAdmittedTurn(nodeId: string): boolean
|
|
62
|
-
export declare function recordFault(nodeId: string, input: FaultRecordInput): StoredFault | null
|
|
61
|
+
export declare function hasAdmittedTurn(nodeId: string): Promise<boolean>;
|
|
62
|
+
export declare function recordFault(nodeId: string, input: FaultRecordInput): Promise<StoredFault | null>;
|
|
63
63
|
/** Record that the fatal-fault notice for this fault row's current episode has been published. Callers run it in the write that publishes. */
|
|
64
|
-
export declare function markFaultNotified(faultId: string): boolean
|
|
64
|
+
export declare function markFaultNotified(faultId: string): Promise<boolean>;
|
|
65
65
|
/** Nodes whose active fatal provider fault has not been announced yet, read from the fault table so a node with no live broker is still found. */
|
|
66
|
-
export declare function listUnnotifiedFatalFaultNodes(): string[]
|
|
66
|
+
export declare function listUnnotifiedFatalFaultNodes(): Promise<string[]>;
|
|
67
67
|
/** The daemon registers the one function that publishes a fatal provider fault's notice. Every clear of an unannounced fatal fault runs it first, so no clear can drop a notice. */
|
|
68
|
-
export declare function setFatalFaultAnnouncer(announce: ((nodeId: string) => void) | null): void;
|
|
68
|
+
export declare function setFatalFaultAnnouncer(announce: ((nodeId: string) => Promise<void>) | null): void;
|
|
69
69
|
export declare function clearFault(nodeId: string, opts?: {
|
|
70
70
|
link?: FaultLink;
|
|
71
71
|
preserveEpisode?: boolean;
|
|
72
|
-
}): boolean
|
|
73
|
-
export declare function readFault(nodeId: string): StoredFault | null
|
|
72
|
+
}): Promise<boolean>;
|
|
73
|
+
export declare function readFault(nodeId: string): Promise<StoredFault | null>;
|
|
74
74
|
export declare function recordPendingEpisode(nodeId: string, input: {
|
|
75
75
|
sessionId: string;
|
|
76
76
|
input: FaultRecordInput;
|
|
77
|
-
}): StoredFault | null
|
|
77
|
+
}): Promise<StoredFault | null>;
|
|
78
78
|
export declare function admitEpisode(nodeId: string, input: {
|
|
79
79
|
sessionId: string;
|
|
80
80
|
faultId: string;
|
|
81
81
|
retry: FaultRetry;
|
|
82
|
-
}): boolean
|
|
82
|
+
}): Promise<boolean>;
|
|
83
83
|
export declare function reopenEpisode(nodeId: string, input: {
|
|
84
84
|
sessionId: string;
|
|
85
|
-
}): boolean
|
|
85
|
+
}): Promise<boolean>;
|
|
86
86
|
export declare function invalidateEpisode(nodeId: string, input: {
|
|
87
87
|
sessionId: string;
|
|
88
|
-
}): boolean
|
|
88
|
+
}): Promise<boolean>;
|
|
89
89
|
export declare function clearEpisode(nodeId: string, input: {
|
|
90
90
|
sessionId: string;
|
|
91
|
-
}): boolean
|
|
92
|
-
export declare function readEpisode(nodeId: string): ProviderRetryEpisode | null
|
|
91
|
+
}): Promise<boolean>;
|
|
92
|
+
export declare function readEpisode(nodeId: string): Promise<ProviderRetryEpisode | null>;
|
|
93
93
|
/** One active automatic provider-retry fault whose `pending` episode is bound to
|
|
94
94
|
* its node's live session — the shape a broker's in-process retry timer owns. */
|
|
95
95
|
export interface PendingProviderRetry {
|
|
@@ -102,8 +102,8 @@ export interface PendingProviderRetry {
|
|
|
102
102
|
/** Every node with an active daemon-retried provider fault (connection,
|
|
103
103
|
* rate-limit, overloaded) and a pending episode on its live session binding.
|
|
104
104
|
* The daemon backstop reads this to find retries whose broker timer died. */
|
|
105
|
-
export declare function listPendingProviderRetries(): PendingProviderRetry[]
|
|
106
|
-
export declare function beginBootFaultAttempt(nodeId: string): BootFaultAttempt
|
|
105
|
+
export declare function listPendingProviderRetries(): Promise<PendingProviderRetry[]>;
|
|
106
|
+
export declare function beginBootFaultAttempt(nodeId: string): Promise<BootFaultAttempt>;
|
|
107
107
|
/** Import legacy witness and recovery files inside the parent's one shared consolidation transaction. */
|
|
108
108
|
/** v98 — `notified_since` on a fault row: the episode start its fatal notice was published for.
|
|
109
109
|
* No backfill: a fatal fault already active at upgrade reads as unannounced and is announced once more,
|