@north-light/cli 0.3.529 → 0.3.531
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/dto/lifecycle.d.ts +3 -1
- package/dist/api/dto/messages.d.ts +5 -3
- package/dist/builtin-memory/crouter-plugin/bundles-and-memory.md +1 -1
- package/dist/builtin-memory/crouter-plugin/commands.md +1 -1
- package/dist/clients/attach/session/connection.js +1 -1
- package/dist/clients/attach/session/reconnect.js +1 -1
- package/dist/clients/attach/viewer.js +508 -508
- package/dist/commands/node/message.js +1 -1
- package/dist/commands/sys/join.js +1 -1
- package/dist/core/async-array.d.ts +7 -0
- package/dist/core/async-array.js +1 -0
- package/dist/core/audit.d.ts +1 -1
- package/dist/core/audit.js +2 -2
- package/dist/core/canvas/attention.d.ts +4 -4
- package/dist/core/canvas/attention.js +1 -1
- package/dist/core/canvas/boot.d.ts +4 -4
- package/dist/core/canvas/boot.js +1 -1
- package/dist/core/canvas/canvas.d.ts +59 -59
- package/dist/core/canvas/canvas.js +19 -19
- package/dist/core/canvas/context-strip.js +2 -2
- package/dist/core/canvas/crons.d.ts +27 -27
- package/dist/core/canvas/crons.js +11 -11
- package/dist/core/canvas/daemon-actions.d.ts +10 -10
- package/dist/core/canvas/daemon-actions.js +8 -8
- package/dist/core/canvas/daemon-owner.d.ts +3 -3
- package/dist/core/canvas/daemon-owner.js +2 -2
- package/dist/core/canvas/db.d.ts +19 -30
- package/dist/core/canvas/db.js +3 -2
- package/dist/core/canvas/deliveries.d.ts +16 -16
- package/dist/core/canvas/deliveries.js +24 -24
- package/dist/core/canvas/executions.d.ts +8 -8
- package/dist/core/canvas/executions.js +1 -1
- package/dist/core/canvas/focuses.d.ts +8 -8
- package/dist/core/canvas/focuses.js +1 -1
- package/dist/core/canvas/history.d.ts +3 -3
- package/dist/core/canvas/history.js +9 -9
- package/dist/core/canvas/install-id.d.ts +1 -1
- package/dist/core/canvas/install-id.js +1 -1
- package/dist/core/canvas/managed-worktree-sweep-candidates.d.ts +1 -1
- package/dist/core/canvas/managed-worktree-sweep-candidates.js +2 -2
- package/dist/core/canvas/memory-reads.d.ts +6 -6
- package/dist/core/canvas/memory-reads.js +1 -1
- package/dist/core/canvas/nav-model.d.ts +13 -13
- package/dist/core/canvas/nav-model.js +1 -1
- package/dist/core/canvas/node-agent-paths.d.ts +6 -6
- package/dist/core/canvas/node-agent-paths.js +1 -1
- package/dist/core/canvas/node-tokens.d.ts +7 -7
- package/dist/core/canvas/node-tokens.js +3 -3
- package/dist/core/canvas/outcome-actions.d.ts +5 -5
- package/dist/core/canvas/outcome-actions.js +3 -3
- package/dist/core/canvas/recovery.d.ts +26 -26
- package/dist/core/canvas/recovery.js +2 -2
- package/dist/core/canvas/render-source.d.ts +1 -1
- package/dist/core/canvas/render-source.js +1 -1
- package/dist/core/canvas/sessions.d.ts +10 -10
- package/dist/core/canvas/sessions.js +4 -4
- package/dist/core/canvas/source.js +1 -1
- package/dist/core/canvas/structured-requests.d.ts +15 -15
- package/dist/core/canvas/structured-requests.js +5 -5
- package/dist/core/canvas/tree.d.ts +9 -9
- package/dist/core/canvas/tree.js +5 -5
- package/dist/core/canvas/waits.d.ts +13 -13
- package/dist/core/canvas/waits.js +6 -6
- package/dist/core/canvas/worktrees.d.ts +15 -15
- package/dist/core/canvas/worktrees.js +1 -1
- package/dist/core/command-hooks/lifecycle-catalog.d.ts +4 -4
- package/dist/core/command-hooks/lifecycle-catalog.js +1 -1
- package/dist/core/command-hooks/transport/exec-lifecycle.js +1 -1
- package/dist/core/command-plugins/bundle.d.ts +1 -1
- package/dist/core/command-plugins/bundle.js +1 -1
- package/dist/core/conversation-store/file-store.d.ts +7 -7
- package/dist/core/conversation-store/file-store.js +9 -9
- package/dist/core/conversation-store/index.d.ts +16 -14
- package/dist/core/conversation-store/index.js +1 -1
- package/dist/core/conversation-store/listener.js +5 -5
- package/dist/core/conversation-store/patch.d.ts +3 -1
- package/dist/core/conversation-store/patch.js +1 -1
- package/dist/core/directory/join.d.ts +1 -1
- package/dist/core/feed/feed.js +3 -3
- package/dist/core/feed/inbox.d.ts +2 -2
- package/dist/core/feed/inbox.js +1 -1
- package/dist/core/feed/messages.d.ts +11 -12
- package/dist/core/feed/messages.js +5 -5
- package/dist/core/feed/reports.d.ts +4 -4
- package/dist/core/feed/reports.js +2 -2
- package/dist/core/grants/cover.d.ts +1 -1
- package/dist/core/grants/cover.js +1 -1
- package/dist/core/grants/local.d.ts +1 -1
- package/dist/core/grants/local.js +1 -1
- package/dist/core/grants/mirror.d.ts +19 -19
- package/dist/core/grants/mirror.js +2 -2
- package/dist/core/grants/on-sync.d.ts +1 -1
- package/dist/core/grants/on-sync.js +1 -1
- package/dist/core/grants/remove.js +1 -1
- package/dist/core/grants/sync.js +1 -1
- package/dist/core/graph/access.d.ts +17 -17
- package/dist/core/graph/access.js +3 -3
- package/dist/core/graph/custom.d.ts +16 -16
- package/dist/core/graph/custom.js +9 -9
- package/dist/core/graph/deletion.d.ts +3 -7
- package/dist/core/graph/deletion.js +4 -4
- package/dist/core/graph/documents.d.ts +24 -27
- package/dist/core/graph/documents.js +7 -7
- package/dist/core/graph/edges.d.ts +13 -13
- package/dist/core/graph/edges.js +1 -1
- package/dist/core/graph/events.d.ts +7 -9
- package/dist/core/graph/events.js +8 -8
- package/dist/core/graph/exposures.d.ts +6 -6
- package/dist/core/graph/exposures.js +4 -4
- package/dist/core/graph/jobs.d.ts +6 -8
- package/dist/core/graph/jobs.js +2 -2
- package/dist/core/graph/kinds/action.js +1 -1
- package/dist/core/graph/kinds/custom.js +2 -2
- package/dist/core/graph/kinds/document.d.ts +1 -0
- package/dist/core/graph/kinds/document.js +4 -4
- package/dist/core/graph/kinds/dto.d.ts +2 -2
- package/dist/core/graph/kinds/dto.js +1 -1
- package/dist/core/graph/kinds/job.js +2 -2
- package/dist/core/graph/kinds/kind.d.ts +6 -8
- package/dist/core/graph/kinds/kind.js +1 -1
- package/dist/core/graph/kinds/node.js +5 -5
- package/dist/core/graph/kinds/owner.js +2 -2
- package/dist/core/graph/kinds/registry.d.ts +6 -9
- package/dist/core/graph/kinds/registry.js +1 -1
- package/dist/core/graph/names.d.ts +6 -6
- package/dist/core/graph/names.js +3 -3
- package/dist/core/graph/object-waits.d.ts +4 -7
- package/dist/core/graph/object-waits.js +1 -1
- package/dist/core/graph/objects.d.ts +14 -14
- package/dist/core/graph/objects.js +9 -9
- package/dist/core/graph/package-docs.d.ts +2 -7
- package/dist/core/graph/package-docs.js +5 -5
- package/dist/core/graph/package-kinds.d.ts +2 -5
- package/dist/core/graph/package-kinds.js +1 -1
- package/dist/core/graph/package-reconcile.d.ts +2 -5
- package/dist/core/graph/package-reconcile.js +1 -1
- package/dist/core/graph/reader.d.ts +18 -18
- package/dist/core/graph/reader.js +3 -3
- package/dist/core/graph/receivers.d.ts +4 -4
- package/dist/core/graph/receivers.js +5 -5
- package/dist/core/graph/repo-sync/exchange.d.ts +3 -7
- package/dist/core/graph/repo-sync/exchange.js +2 -2
- package/dist/core/graph/repo-sync/repos.d.ts +7 -5
- package/dist/core/graph/repo-sync/repos.js +3 -3
- package/dist/core/graph/repo-sync/sync.d.ts +3 -6
- package/dist/core/graph/repo-sync/sync.js +2 -2
- package/dist/core/graph/rules.d.ts +5 -5
- package/dist/core/graph/rules.js +3 -3
- package/dist/core/graph/spaces/app.js +1 -1
- package/dist/core/graph/spaces/index.d.ts +4 -5
- package/dist/core/graph/spaces/index.js +1 -1
- package/dist/core/graph/spaces/own-memory.d.ts +4 -4
- package/dist/core/graph/spaces/own-memory.js +1 -1
- package/dist/core/graph/spaces/person.js +3 -3
- package/dist/core/graph/spaces/repo.d.ts +1 -1
- package/dist/core/graph/spaces/repo.js +1 -1
- package/dist/core/graph/watches.d.ts +15 -15
- package/dist/core/graph/watches.js +10 -10
- package/dist/core/human/feedback-companion.d.ts +2 -2
- package/dist/core/human/feedback-companion.js +1 -1
- package/dist/core/human/feedback.d.ts +3 -3
- package/dist/core/human/feedback.js +1 -1
- package/dist/core/human/requests.d.ts +34 -33
- package/dist/core/human/requests.js +20 -20
- package/dist/core/human/scan.d.ts +2 -2
- package/dist/core/human/scan.js +1 -1
- package/dist/core/human/tickets.d.ts +9 -9
- package/dist/core/human/tickets.js +1 -1
- package/dist/core/llm/app-rungs.d.ts +1 -1
- package/dist/core/llm/app-rungs.js +1 -1
- package/dist/core/llm/run.js +1 -1
- package/dist/core/peer/directory.d.ts +1 -1
- package/dist/core/peer/directory.js +1 -1
- package/dist/core/peer/envelope.d.ts +3 -3
- package/dist/core/peer/envelope.js +1 -1
- package/dist/core/peer/home.d.ts +7 -7
- package/dist/core/peer/home.js +2 -2
- package/dist/core/peer/ingest.d.ts +6 -6
- package/dist/core/peer/ingest.js +1 -1
- package/dist/core/peer/outbox-store.d.ts +14 -14
- package/dist/core/peer/outbox-store.js +5 -5
- package/dist/core/peer/receiver.d.ts +2 -2
- package/dist/core/peer/receiver.js +1 -1
- package/dist/core/peer/stubs.d.ts +10 -10
- package/dist/core/peer/stubs.js +1 -1
- package/dist/core/providers/approval.d.ts +2 -2
- package/dist/core/providers/approval.js +2 -2
- package/dist/core/providers/audit.d.ts +3 -3
- package/dist/core/providers/audit.js +2 -2
- package/dist/core/providers/bundles.js +2 -2
- package/dist/core/providers/call.d.ts +2 -2
- package/dist/core/providers/call.js +1 -1
- package/dist/core/providers/files.d.ts +1 -1
- package/dist/core/providers/files.js +1 -1
- package/dist/core/providers/mint.js +1 -1
- package/dist/core/providers/receipts.d.ts +1 -1
- package/dist/core/providers/receipts.js +2 -2
- package/dist/core/review/birth.js +1 -1
- package/dist/core/review/comments.d.ts +19 -19
- package/dist/core/review/comments.js +5 -5
- package/dist/core/review/companion.d.ts +1 -1
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/document.d.ts +3 -3
- package/dist/core/review/document.js +2 -2
- package/dist/core/review/fork.js +2 -2
- package/dist/core/review/realize.js +1 -1
- package/dist/core/review/remap.d.ts +2 -2
- package/dist/core/review/remap.js +4 -4
- package/dist/core/review/stage.d.ts +1 -1
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/store.d.ts +21 -21
- package/dist/core/review/store.js +1 -1
- package/dist/core/runs/activity.d.ts +1 -1
- package/dist/core/runs/activity.js +5 -5
- package/dist/core/runs/confinement.d.ts +7 -7
- package/dist/core/runs/confinement.js +2 -2
- package/dist/core/runs/events.d.ts +12 -12
- package/dist/core/runs/events.js +4 -4
- package/dist/core/runs/operations.d.ts +11 -11
- package/dist/core/runs/operations.js +5 -5
- package/dist/core/runs/questions.d.ts +10 -10
- package/dist/core/runs/questions.js +3 -3
- package/dist/core/runtime/auth-reload.js +1 -1
- package/dist/core/runtime/bearings.d.ts +5 -5
- package/dist/core/runtime/bearings.js +6 -6
- package/dist/core/runtime/broker-inventory.js +1 -1
- package/dist/core/runtime/broker-request.js +1 -1
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/close.d.ts +3 -3
- package/dist/core/runtime/close.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/fleet.d.ts +2 -2
- package/dist/core/runtime/host.d.ts +3 -3
- package/dist/core/runtime/host.js +3 -3
- package/dist/core/runtime/kickoff.d.ts +12 -12
- package/dist/core/runtime/kickoff.js +17 -17
- package/dist/core/runtime/launch-target.d.ts +1 -1
- package/dist/core/runtime/launch-target.js +1 -1
- package/dist/core/runtime/ledger.d.ts +3 -3
- package/dist/core/runtime/ledger.js +3 -3
- package/dist/core/runtime/lifecycle.d.ts +1 -1
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/memory-admission.js +1 -1
- package/dist/core/runtime/model-swap.d.ts +2 -2
- package/dist/core/runtime/model-swap.js +1 -1
- package/dist/core/runtime/node-read.d.ts +1 -1
- package/dist/core/runtime/node-read.js +2 -2
- package/dist/core/runtime/nodes.d.ts +6 -6
- package/dist/core/runtime/nodes.js +1 -1
- package/dist/core/runtime/outcome-document.d.ts +1 -1
- package/dist/core/runtime/outcome-document.js +1 -1
- package/dist/core/runtime/persona.d.ts +3 -3
- package/dist/core/runtime/persona.js +2 -2
- package/dist/core/runtime/placement.d.ts +11 -11
- package/dist/core/runtime/placement.js +1 -1
- package/dist/core/runtime/promote.d.ts +3 -3
- package/dist/core/runtime/promote.js +1 -1
- package/dist/core/runtime/recycle.js +1 -1
- package/dist/core/runtime/reopen.d.ts +21 -10
- package/dist/core/runtime/reopen.js +1 -1
- package/dist/core/runtime/reset.d.ts +4 -4
- package/dist/core/runtime/reset.js +1 -1
- package/dist/core/runtime/revive-all.d.ts +2 -2
- package/dist/core/runtime/revive-all.js +1 -1
- package/dist/core/runtime/revive.d.ts +4 -4
- package/dist/core/runtime/revive.js +2 -2
- package/dist/core/runtime/roadmap.d.ts +6 -6
- package/dist/core/runtime/roadmap.js +5 -5
- package/dist/core/runtime/session-branch.d.ts +1 -1
- package/dist/core/runtime/session-branch.js +1 -1
- package/dist/core/runtime/session-list-cache.js +1 -1
- package/dist/core/runtime/situational-live.js +1 -1
- package/dist/core/runtime/spawn.d.ts +2 -2
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/runtime/stop-guard.d.ts +2 -2
- package/dist/core/runtime/stop-guard.js +3 -3
- package/dist/core/runtime/warm-pool.d.ts +2 -2
- package/dist/core/runtime/warm-pool.js +1 -1
- package/dist/core/spaces/mounts.d.ts +2 -2
- package/dist/core/spaces/mounts.js +1 -1
- package/dist/core/spaces/permissions.d.ts +1 -1
- package/dist/core/spaces/permissions.js +1 -1
- package/dist/core/spaces/process.d.ts +1 -1
- package/dist/core/spaces/process.js +1 -1
- package/dist/core/spaces/space.js +1 -1
- package/dist/core/spaces/stop.d.ts +3 -3
- package/dist/core/spaces/stop.js +2 -2
- package/dist/core/spaces/users.d.ts +6 -6
- package/dist/core/spaces/users.js +1 -1
- package/dist/core/storage/attachments.d.ts +2 -2
- package/dist/core/storage/attachments.js +1 -1
- package/dist/core/storage/shares.d.ts +2 -2
- package/dist/core/storage/shares.js +1 -1
- package/dist/core/storage/tables.d.ts +21 -21
- package/dist/core/storage/tables.js +3 -3
- package/dist/core/substrate/delivery/corpus.d.ts +5 -8
- package/dist/core/substrate/delivery/corpus.js +3 -3
- package/dist/core/substrate/delivery/deliver.d.ts +10 -15
- package/dist/core/substrate/delivery/deliver.js +3 -3
- package/dist/core/substrate/delivery/plan.d.ts +2 -12
- package/dist/core/substrate/delivery/plan.js +3 -3
- package/dist/core/substrate/delivery/render-boot.d.ts +4 -4
- package/dist/core/substrate/delivery/render-boot.js +18 -18
- package/dist/core/substrate/delivery/render-event.d.ts +7 -14
- package/dist/core/substrate/delivery/render-event.js +4 -4
- package/dist/core/substrate/subject.d.ts +2 -2
- package/dist/core/substrate/subject.js +1 -1
- package/dist/core/usage/ledger.d.ts +6 -6
- package/dist/core/usage/ledger.js +4 -4
- package/dist/core/worktree-close.js +4 -4
- package/dist/core/worktree-mutation-async.js +7 -7
- package/dist/core/worktree-quarantine.js +1 -1
- package/dist/core/worktree-sweep.d.ts +1 -1
- package/dist/core/worktree-sweep.js +6 -6
- package/dist/core/worktree.d.ts +5 -5
- package/dist/core/worktree.js +13 -13
- package/dist/daemon/analytics/compute.d.ts +2 -2
- package/dist/daemon/analytics/compute.js +1 -1
- package/dist/daemon/api/app-listener.d.ts +4 -4
- package/dist/daemon/api/app-listener.js +13 -13
- package/dist/daemon/api/bridge.js +5 -5
- package/dist/daemon/api/document-listener.js +6 -6
- package/dist/daemon/api/handlers/analytics.js +1 -1
- package/dist/daemon/api/handlers/attach.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +1 -1
- package/dist/daemon/api/handlers/bash.js +1 -1
- package/dist/daemon/api/handlers/broker-ops.d.ts +1 -1
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/broker-recovery.d.ts +1 -1
- package/dist/daemon/api/handlers/broker-recovery.js +1 -1
- package/dist/daemon/api/handlers/broker-signals.d.ts +2 -2
- package/dist/daemon/api/handlers/broker-signals.js +2 -2
- package/dist/daemon/api/handlers/canvas.d.ts +1 -1
- package/dist/daemon/api/handlers/canvas.js +4 -4
- package/dist/daemon/api/handlers/chat-inventory.js +1 -1
- package/dist/daemon/api/handlers/crons.js +1 -1
- package/dist/daemon/api/handlers/custom-objects.d.ts +4 -4
- package/dist/daemon/api/handlers/custom-objects.js +3 -3
- package/dist/daemon/api/handlers/delivery-retry.js +1 -1
- package/dist/daemon/api/handlers/delivery.js +1 -1
- package/dist/daemon/api/handlers/docs.d.ts +4 -4
- package/dist/daemon/api/handlers/docs.js +1 -1
- package/dist/daemon/api/handlers/feedback-comments.js +3 -3
- package/dist/daemon/api/handlers/files.js +1 -1
- package/dist/daemon/api/handlers/focus.js +1 -1
- package/dist/daemon/api/handlers/health.js +3 -3
- package/dist/daemon/api/handlers/hook-exec.js +1 -1
- package/dist/daemon/api/handlers/human-requests.js +1 -1
- package/dist/daemon/api/handlers/inbox-page.d.ts +1 -1
- package/dist/daemon/api/handlers/inbox-page.js +1 -1
- package/dist/daemon/api/handlers/inbox.d.ts +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/llm.d.ts +1 -1
- package/dist/daemon/api/handlers/llm.js +3 -3
- package/dist/daemon/api/handlers/memory-reads.js +1 -1
- package/dist/daemon/api/handlers/memory.d.ts +5 -5
- package/dist/daemon/api/handlers/memory.js +5 -5
- package/dist/daemon/api/handlers/messages.js +2 -2
- package/dist/daemon/api/handlers/node-events.d.ts +2 -2
- package/dist/daemon/api/handlers/node-events.js +3 -3
- package/dist/daemon/api/handlers/node-outcomes.js +1 -1
- package/dist/daemon/api/handlers/node-records.js +2 -2
- package/dist/daemon/api/handlers/nodes.d.ts +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/objects.js +3 -3
- package/dist/daemon/api/handlers/package-docs.js +1 -1
- package/dist/daemon/api/handlers/plugin-app-token.d.ts +1 -1
- package/dist/daemon/api/handlers/plugin-app-token.js +1 -1
- package/dist/daemon/api/handlers/profiles.d.ts +3 -3
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/api/handlers/providers.d.ts +1 -1
- package/dist/daemon/api/handlers/providers.js +1 -1
- package/dist/daemon/api/handlers/questions.js +1 -1
- package/dist/daemon/api/handlers/reports.d.ts +1 -1
- package/dist/daemon/api/handlers/reports.js +5 -5
- package/dist/daemon/api/handlers/review-comments.js +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/handlers/runs.js +1 -1
- package/dist/daemon/api/handlers/structured-requests.js +1 -1
- package/dist/daemon/api/handlers/subscriptions.js +1 -1
- package/dist/daemon/api/handlers/transfer.js +1 -1
- package/dist/daemon/api/map.d.ts +3 -3
- package/dist/daemon/api/map.js +1 -1
- package/dist/daemon/api/principal.d.ts +1 -1
- package/dist/daemon/api/principal.js +1 -1
- package/dist/daemon/api/reader.d.ts +5 -5
- package/dist/daemon/api/reader.js +1 -1
- package/dist/daemon/api/router.d.ts +5 -5
- package/dist/daemon/api/router.js +1 -1
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/broker-signals/bus.d.ts +1 -1
- package/dist/daemon/broker-signals/bus.js +1 -1
- package/dist/daemon/companion-retire.js +1 -1
- package/dist/daemon/cron/armed-context.d.ts +2 -2
- package/dist/daemon/cron/armed-context.js +1 -1
- package/dist/daemon/cron/authority.d.ts +2 -2
- package/dist/daemon/cron/authority.js +1 -1
- package/dist/daemon/cron/disposition.js +1 -1
- package/dist/daemon/cron/ended.d.ts +1 -1
- package/dist/daemon/cron/ended.js +2 -2
- package/dist/daemon/cron/escalation.js +3 -3
- package/dist/daemon/cron/folders.d.ts +1 -1
- package/dist/daemon/cron/folders.js +1 -1
- package/dist/daemon/cron/held.d.ts +1 -1
- package/dist/daemon/cron/held.js +1 -1
- package/dist/daemon/cron/lease-recovery.d.ts +1 -1
- package/dist/daemon/cron/lease-recovery.js +1 -1
- package/dist/daemon/cron/passes.d.ts +2 -2
- package/dist/daemon/cron/passes.js +1 -1
- package/dist/daemon/cron/run-socket.d.ts +1 -1
- package/dist/daemon/cron/run-socket.js +1 -1
- package/dist/daemon/cron/settle.js +1 -1
- package/dist/daemon/cron/sinks.d.ts +1 -1
- package/dist/daemon/cron/sinks.js +2 -2
- package/dist/daemon/cron-run.d.ts +12 -3
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd.js +6 -6
- package/dist/daemon/delivery/run-delivery.js +1 -1
- package/dist/daemon/due-sources.d.ts +3 -3
- package/dist/daemon/due-sources.js +1 -1
- package/dist/daemon/due.d.ts +3 -3
- package/dist/daemon/due.js +7 -7
- package/dist/daemon/fleet.d.ts +2 -2
- package/dist/daemon/fleet.js +11 -11
- package/dist/daemon/human/finish.js +3 -3
- package/dist/daemon/human/settle.d.ts +1 -1
- package/dist/daemon/human/settle.js +1 -1
- package/dist/daemon/human/sweep.js +1 -1
- package/dist/daemon/joined-owner.d.ts +3 -3
- package/dist/daemon/joined-owner.js +1 -1
- package/dist/daemon/messaging/node-message.js +1 -1
- package/dist/daemon/park-activity.d.ts +2 -2
- package/dist/daemon/park-activity.js +1 -1
- package/dist/daemon/peer/authority.js +1 -1
- package/dist/daemon/peer/forward.d.ts +6 -6
- package/dist/daemon/peer/forward.js +1 -1
- package/dist/daemon/peer/handlers.js +1 -1
- package/dist/daemon/peer/ingress.d.ts +4 -4
- package/dist/daemon/peer/ingress.js +1 -1
- package/dist/daemon/peer/outbox.d.ts +2 -2
- package/dist/daemon/peer/outbox.js +1 -1
- package/dist/daemon/peer/relay-service.js +1 -1
- package/dist/daemon/plugin-objects/read-leaf.d.ts +2 -2
- package/dist/daemon/plugin-objects/read-leaf.js +2 -2
- package/dist/daemon/profile-delete.js +1 -1
- package/dist/daemon/readiness.d.ts +2 -2
- package/dist/daemon/readiness.js +1 -1
- package/dist/daemon/reconcilers/action-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/action-lane.js +1 -1
- package/dist/daemon/reconcilers/bash-deadline.js +2 -2
- package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
- package/dist/daemon/reconcilers/broker-supervision.js +4 -4
- package/dist/daemon/reconcilers/controller-death.d.ts +1 -1
- package/dist/daemon/reconcilers/controller-death.js +1 -1
- package/dist/daemon/reconcilers/cron-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/cron-lane.js +1 -1
- package/dist/daemon/reconcilers/delivery-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/delivery-lane.js +2 -2
- package/dist/daemon/reconcilers/fault-retry-backstop.d.ts +3 -3
- package/dist/daemon/reconcilers/fault-retry-backstop.js +1 -1
- package/dist/daemon/reconcilers/grove-instance-sweep.d.ts +2 -2
- package/dist/daemon/reconcilers/grove-instance-sweep.js +1 -1
- package/dist/daemon/reconcilers/live-obligation.d.ts +6 -6
- package/dist/daemon/reconcilers/live-obligation.js +1 -1
- package/dist/daemon/reconcilers/managed-worktree-sweep.js +1 -1
- package/dist/daemon/reconcilers/node-deadline.d.ts +1 -1
- package/dist/daemon/reconcilers/node-deadline.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.d.ts +3 -3
- package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/terminating.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/wants-execution.d.ts +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/wants-execution.js +1 -1
- package/dist/daemon/reconcilers/pending-review-submit.d.ts +1 -1
- package/dist/daemon/reconcilers/pending-review-submit.js +1 -1
- package/dist/daemon/reconcilers/storage-due-work.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.js +2 -2
- package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -1
- package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
- package/dist/daemon/review/comment-notify.js +2 -2
- package/dist/daemon/review/companion.d.ts +3 -3
- package/dist/daemon/review/companion.js +1 -1
- package/dist/daemon/review/finish.js +1 -1
- package/dist/daemon/review/sweep.js +1 -1
- package/dist/daemon/run-notices.d.ts +4 -4
- package/dist/daemon/run-notices.js +1 -1
- package/dist/daemon/runs/append-section.d.ts +2 -2
- package/dist/daemon/runs/append-section.js +2 -2
- package/dist/daemon/runs/observer.d.ts +2 -2
- package/dist/daemon/runs/observer.js +2 -2
- package/dist/daemon/structured-requests/boot.d.ts +1 -1
- package/dist/daemon/structured-requests/boot.js +1 -1
- package/dist/daemon/structured-requests/effects.js +1 -1
- package/dist/daemon/structured-requests/sidecar.d.ts +1 -1
- package/dist/daemon/structured-requests/sidecar.js +1 -1
- package/dist/launcher/run.js +1 -1
- package/dist/migrations/004-canvas-documents/apply.d.ts +3 -3
- package/dist/migrations/004-canvas-documents/apply.js +1 -1
- package/dist/migrations/004-canvas-documents/index.d.ts +2 -2
- package/dist/migrations/004-canvas-documents/index.js +2 -2
- package/dist/migrations/activation.js +2 -2
- package/docs/plugin/bundles-and-memory.md +1 -1
- package/docs/plugin/commands.md +1 -1
- package/docs/public-api.md +11 -0
- package/package.json +4 -3
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
var m=Object.defineProperty;var r=(i,e)=>m(i,"name",{value:e,configurable:!0});import{conversationIdFromPath as v,conversationStore as h,ConversationNotFoundError as g}from"../conversation-store/index.js";import{getNode as s}from"../canvas/index.js";import{openRequest as q,cancelBindingRequest as b,getRequest as y}from"../human/requests.js";import{NodeIdConflictError as I}from"../runtime/nodes.js";import{reviveNode as N}from"../runtime/revive.js";import{awaitCompanionBind as E,spawnReviewCompanion as S}from"./companion.js";import{signalReviewActivity as l}from"./signal.js";import{COMPANION_BIND_DEADLINE_MS as f,ReviewOperationError as o}from"./types.js";function p(i){const e=y(i);if(e===null||e.kind!=="review")throw new o("unknown_review","review was not found",{received:i});return e}r(p,"requireBinding");function R(i){try{const e=JSON.parse(i.specification_json);if(typeof e!="object"||e===null)throw new Error("not an object");return e}catch(e){throw new Error(`corrupt review specification: ${i.request_id}`,{cause:e})}}r(R,"specification");async function k(i){let e=p(i);if(e.state!=="binding")return e;const w=R(e),t=w.branch_file,
|
|
1
|
+
var m=Object.defineProperty;var r=(i,e)=>m(i,"name",{value:e,configurable:!0});import{conversationIdFromPath as v,conversationStore as h,ConversationNotFoundError as g}from"../conversation-store/index.js";import{getNode as s}from"../canvas/index.js";import{openRequest as q,cancelBindingRequest as b,getRequest as y}from"../human/requests.js";import{NodeIdConflictError as I}from"../runtime/nodes.js";import{reviveNode as N}from"../runtime/revive.js";import{awaitCompanionBind as E,spawnReviewCompanion as S}from"./companion.js";import{signalReviewActivity as l}from"./signal.js";import{COMPANION_BIND_DEADLINE_MS as f,ReviewOperationError as o}from"./types.js";async function p(i){const e=await y(i);if(e===null||e.kind!=="review")throw new o("unknown_review","review was not found",{received:i});return e}r(p,"requireBinding");function R(i){try{const e=JSON.parse(i.specification_json);if(typeof e!="object"||e===null)throw new Error("not an object");return e}catch(e){throw new Error(`corrupt review specification: ${i.request_id}`,{cause:e})}}r(R,"specification");async function k(i){let e=await p(i);if(e.state!=="binding")return e;const w=R(e),t=w.branch_file,a=typeof t=="string"?v(t):null;let u=a===null;if(a!==null)try{await h().header(a)}catch(n){if(!(n instanceof g))throw n;u=!0}if(u)throw await b(e.request_id,new Date().toISOString(),"branch_lost")&&l(),new o("branch_lost","review branch was lost before realization",{review_id:e.request_id});if(e.file===null||e.requester_node_id===null||e.companion_node_id===null)throw new Error(`binding review has incomplete identity: ${e.request_id}`);const d=await s(e.requester_node_id);if(d===null)throw new o("review_origin_missing","review origin was not found",{origin_node_id:e.requester_node_id});if(await s(e.companion_node_id)===null){const n=w.model_spec;if(typeof n!="string")throw new Error(`binding review has no model spec: ${e.request_id}`);try{await S({nodeId:e.companion_node_id,reviewId:e.request_id,originNodeId:e.requester_node_id,branchFile:t,targetFile:e.file,modelSpec:n,cwd:d.cwd,profileId:d.profile_id??null})}catch(_){if(!(_ instanceof I))throw _}}const c=await s(e.companion_node_id);if(c===null)throw new o("review_companion_unbound","review companion was not created",{review_id:e.request_id});if(c.pi_session_id===null&&await N(c.node_id,{resume:!1,capacity:"refuse"}),!await E(e.companion_node_id,f))throw new o("review_companion_unbound","review companion did not bind in time",{review_id:e.request_id,waited_ms:f});return await q(e.request_id,new Date().toISOString())&&l(),e=await p(i),e}r(k,"realizeReview");export{k as realizeReview};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var q=Object.defineProperty;var
|
|
1
|
+
var q=Object.defineProperty;var r=(e,o)=>q(e,"name",{value:o,configurable:!0});import{withCanvasWrite as A}from"../canvas/db.js";import{nowIso as S}from"../fs-utils.js";import{signalReviewActivity as k}from"./signal.js";import{replaceAnchorBaseLocked as T}from"./store.js";import{ReviewOperationError as h}from"./types.js";import{captureAnchorText as b,readReviewSource as O,validateAnchorShape as N}from"./document.js";function D(e){return{line:e.anchor_line,end_line:e.anchor_end_line,...e.anchor_col_start===null?{}:{col_start:e.anchor_col_start},...e.anchor_col_end===null?{}:{col_end:e.anchor_col_end},...e.anchor_quote===null?{}:{quote:e.anchor_quote}}}r(D,"anchorFromRow");function p(e,o,c,i){throw new h("range_batch_stale","review comment ranges are stale",{reason:e,expected:o,actual:c,...i===void 0?{}:{comment_id:i}})}r(p,"rangeBatchStale");function I(e){if(typeof e.comment_id!="string"||e.comment_id==="")throw new h("invalid_anchor","comment anchor is invalid",{violations:["comment_id must be a non-empty string"]});const o=e.anchor!==void 0,c=e.detached===!0;if(o===c)throw new h("invalid_anchor","comment anchor is invalid",{violations:["each range batch entry must provide exactly one of anchor or detached"]});o&&N(e.anchor)}r(I,"validateEntry");async function L(e,o){await e.prepare(`
|
|
2
2
|
INSERT INTO review_comment_events
|
|
3
3
|
(review_id, comment_id, kind, state_change, revision_after, actor_kind, actor_node_id, at, operation_id, payload)
|
|
4
4
|
SELECT review_id, ?, 'reanchored', 1, ?, ?, ?, ?, ?, ?
|
|
5
5
|
FROM review_comments WHERE comment_id = ?
|
|
6
|
-
`).run(
|
|
6
|
+
`).run(o.row.comment_id,o.row.revision+1,o.actor.kind,o.actor.node_id,o.at,o.operation_id,JSON.stringify({previous_anchor:o.previous_anchor,anchor:o.anchor,previous_anchor_state:o.previous_anchor_state,anchor_state:o.anchor_state,previous_doc_hash:o.previous_doc_hash,doc_hash:o.doc_hash,line_text:o.line_text}),o.row.comment_id)}r(L,"appendReanchorEvent");async function U(e){const o=await A(async c=>{const i=await c.prepare("SELECT file, anchor_base_sha256 FROM human_requests WHERE request_id = ? AND kind = 'review' AND state = 'open'").get(e.review_id);if(i===void 0)throw new h("unknown_review","review was not found",{received:e.review_id});const a=O(i.file,"comment");a.sha256!==e.to_doc_hash&&p("to_doc_hash",e.to_doc_hash,a.sha256),i.anchor_base_sha256!==e.from_doc_hash&&p("from_doc_hash",i.anchor_base_sha256,e.from_doc_hash);const d=await c.prepare(`
|
|
7
7
|
SELECT comment_id, status, revision, text, anchor_line, anchor_end_line,
|
|
8
8
|
anchor_col_start, anchor_col_end, anchor_quote, anchor_line_text,
|
|
9
9
|
anchor_doc_hash, anchor_state
|
|
10
10
|
FROM review_comments
|
|
11
11
|
WHERE review_id = ? AND status != 'deleted'
|
|
12
12
|
ORDER BY created_seq
|
|
13
|
-
`).all(e.review_id);for(const
|
|
13
|
+
`).all(e.review_id);for(const n of d)n.anchor_doc_hash!==e.from_doc_hash&&p("comment_hash",e.from_doc_hash,n.anchor_doc_hash,n.comment_id);const _=new Map,s=[];for(const n of e.entries)I(n),_.has(n.comment_id)?s.push(n.comment_id):_.set(n.comment_id,n);const y=new Set(d.map(n=>n.comment_id));for(const n of _.keys())y.has(n)||s.push(n);const v=d.filter(n=>!_.has(n.comment_id)).map(n=>n.comment_id);if(v.length>0||s.length>0)throw new h("range_batch_incomplete","range batch must cover every non-deleted comment exactly once",{missing:v,extra:s});let f=0,w=0;const E=S();for(const n of d){const m=_.get(n.comment_id),x=D(n),t=m.detached===!0?x:m.anchor,l=m.detached===!0?"detached":"live",u=m.detached===!0?n.anchor_line_text:b(a.lines,t);if(!(n.anchor_state!==l||n.anchor_doc_hash!==a.sha256||n.anchor_line!==t.line||n.anchor_end_line!==t.end_line||n.anchor_col_start!==(t.col_start??null)||n.anchor_col_end!==(t.col_end??null)||n.anchor_quote!==(t.quote??null)||n.anchor_line_text!==u))continue;const R=n.revision+1;await c.prepare(`
|
|
14
14
|
UPDATE review_comments
|
|
15
15
|
SET revision = ?, anchor_line = ?, anchor_end_line = ?, anchor_col_start = ?, anchor_col_end = ?,
|
|
16
16
|
anchor_quote = ?, anchor_line_text = ?, anchor_doc_hash = ?, anchor_state = ?,
|
|
17
17
|
updated_by_kind = ?, updated_by_node_id = ?, updated_at = ?
|
|
18
18
|
WHERE comment_id = ?
|
|
19
|
-
`).run(
|
|
19
|
+
`).run(R,t.line,t.end_line,t.col_start??null,t.col_end??null,t.quote??null,u,a.sha256,l,e.actor.kind,e.actor.node_id,E,n.comment_id),await L(c,{row:n,actor:e.actor,operation_id:e.operation_id,at:E,previous_anchor:x,anchor:t,previous_anchor_state:n.anchor_state,anchor_state:l,previous_doc_hash:n.anchor_doc_hash,doc_hash:a.sha256,line_text:u}),f+=1,l==="detached"&&(w+=1)}return await T(c,e.review_id,a.bytes,a.sha256),{updated:f,detached:w,anchor_base_sha256:a.sha256}});return k(),o}r(U,"applyRangeBatch");export{U as applyRangeBatch};
|
|
@@ -30,7 +30,7 @@ export type StagedReview = {
|
|
|
30
30
|
review_dir: string;
|
|
31
31
|
};
|
|
32
32
|
/** Remove only review-directory state that was never committed to a review row. */
|
|
33
|
-
export declare function discardStaging(reviewId: string, branchFile?: string): void
|
|
33
|
+
export declare function discardStaging(reviewId: string, branchFile?: string): Promise<void>;
|
|
34
34
|
/**
|
|
35
35
|
* Capture an existing origin and write its immutable branch without creating a
|
|
36
36
|
* canvas node or review row. The caller alone commits or discards this stage.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var
|
|
1
|
+
var v=Object.defineProperty;var t=(e,n)=>v(e,"name",{value:n,configurable:!0});import{createHash as g}from"node:crypto";import{existsSync as y,readFileSync as b,realpathSync as S,rmSync as F,statSync as I,writeFileSync as k}from"node:fs";import{isAbsolute as x,join as R}from"node:path";import{getNode as O}from"../canvas/index.js";import{conversationIdFromPath as j,conversationStore as z,ConversationNotFoundError as D}from"../conversation-store/index.js";import{ensureReviewDir as E,reviewDir as l}from"../canvas/paths.js";import{checkReviewableFile as B}from"../human/visible-paths.js";import{newNodeId as w}from"../runtime/nodes.js";import{captureOrigin as N}from"./companion.js";import{materializeSessionBranch as q}from"../runtime/session-branch.js";import{getRequestByIdempotencyKey as A}from"../human/requests.js";import{ReviewOperationError as r}from"./types.js";function a(e,n){return new r("review_target_unreviewable","review target cannot be staged",{phase:"create",file:e,reason:n})}t(a,"targetError");function h(e){if(!x(e))throw a(e,"not_absolute");if(!y(e))throw a(e,"missing");try{if(!I(e).isFile())throw a(e,"not_a_file")}catch(i){throw i instanceof r?i:a(e,"missing")}const n=B(e);if(!n.ok){const i=n.reason==="file is not UTF-8 text"?"binary":n.reason==="file is too large to review (2 MB limit)"?"too_large":n.reason==="file is too long to review (5,000 line limit)"?"too_many_lines":"not_a_file";throw a(e,i)}try{return S(e)}catch{throw a(e,"missing")}}t(h,"validateReviewFile");function U(e){return new r("review_branch_unavailable","review branch could not be materialized",{reason:"materialize_failed",origin_node_id:e})}t(U,"branchUnavailable");async function C(e){try{return await N(e)}catch(n){throw n instanceof r&&n.code==="review_origin_missing"?new r("review_origin_missing","review origin was not found",{origin_node_id:e,reason:"origin_missing"}):n}}t(C,"captureStagedOrigin");async function H(e,n){try{return await q(n)}catch{throw U(e)}}t(H,"materialize");async function K(e,n){if(n!==void 0){const i=j(n);if(i===null)throw new Error(`invalid staged conversation path: ${n}`);try{await z().delete(i)}catch(c){if(!(c instanceof D))throw c}}try{F(l(e),{recursive:!0,force:!0})}catch{}}t(K,"discardStaging");async function ee(e){const n=await A(e.idempotency_key);if(n!==null)return{existing:n};if(await O(e.origin_node_id)===null)throw new r("review_origin_missing","review origin was not found",{origin_node_id:e.origin_node_id,reason:"origin_missing"});const i=await w(),c=await w();let d,s=e.document===void 0?h(e.file??""):"";try{if(E(i),e.document!==void 0){const m=R(l(i),"document.md");k(m,e.document.body),s=h(m)}const o=await C(e.origin_node_id),p=new Date().toISOString(),_=b(s),u=g("sha256").update(_).digest("hex");d=await H(e.origin_node_id,o);const f=new Date().toISOString();return{row:{review_id:i,idempotency_key:e.idempotency_key,origin_kind:e.origin_kind,origin_node_id:e.origin_node_id,companion_node_id:c,review_dir:l(i),file:s,origin_session_file:o.sourceFile,origin_session_id:o.sourceSessionId,origin_leaf_id:o.leafId,model_spec:o.modelSpec,branch_file:d,baseline_sha256:u,baseline_bytes:_.length,anchor_base_sha256:u,anchor_base_bytes:_,state:"binding",created:f,captured_at:p,opened_at:null,submit_requested_at:null,output_path:e.output_path??null,document_id:e.document?.id??null,document_name:e.document?.name??null,document_base:e.document?.base??null,subtitle:e.subtitle??null,approved_at:null,approved_sha256:null,changed:null,comments_total:null,comments_unresolved:null,result_json:null,canceled_at:null,cancel_reason:null,cancel_actor:null,delivery_entry_id:null,delivered_at:null,delivery_error:null,projected_at:null,projection_error:null},review_dir:l(i)}}catch(o){throw await K(i,d),o}}t(ee,"stageReview");export{K as discardStaging,ee as stageReview};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
2
2
|
import { type ReviewRecord, type ReviewState } from './types.js';
|
|
3
3
|
export interface ApproveReviewArgs {
|
|
4
4
|
review_id: string;
|
|
@@ -9,36 +9,36 @@ export interface ApproveReviewArgs {
|
|
|
9
9
|
comments_unresolved: number;
|
|
10
10
|
result_json: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function getReview(reviewId: string): ReviewRecord | null
|
|
13
|
-
export declare function requireVisibleReview(reviewId: string): ReviewRecord
|
|
14
|
-
export declare function getReviewByIdempotencyKey(key: string): ReviewRecord | null
|
|
15
|
-
export declare function getReviewByCompanion(nodeId: string): ReviewRecord | null
|
|
12
|
+
export declare function getReview(reviewId: string): Promise<ReviewRecord | null>;
|
|
13
|
+
export declare function requireVisibleReview(reviewId: string): Promise<ReviewRecord>;
|
|
14
|
+
export declare function getReviewByIdempotencyKey(key: string): Promise<ReviewRecord | null>;
|
|
15
|
+
export declare function getReviewByCompanion(nodeId: string): Promise<ReviewRecord | null>;
|
|
16
16
|
export declare function listReviews(filter: {
|
|
17
17
|
state?: ReviewState;
|
|
18
18
|
origin_node_id?: string;
|
|
19
19
|
file?: string;
|
|
20
|
-
}): ReviewRecord[]
|
|
21
|
-
export declare function reviewIdsByOriginNodes(nodeIds: readonly string[]): string[]
|
|
22
|
-
export declare function deleteReviewsByOriginNodes(nodeIds: readonly string[]): string[]
|
|
23
|
-
export declare function listBindingReviews(): ReviewRecord[]
|
|
24
|
-
export declare function listSubmitRequestedReviews(): ReviewRecord[]
|
|
25
|
-
export declare function listUnprojectedTerminalReviews(): ReviewRecord[]
|
|
26
|
-
export declare function openReviewRow(reviewId: string, openedAt: string): boolean
|
|
20
|
+
}): Promise<ReviewRecord[]>;
|
|
21
|
+
export declare function reviewIdsByOriginNodes(nodeIds: readonly string[]): Promise<string[]>;
|
|
22
|
+
export declare function deleteReviewsByOriginNodes(nodeIds: readonly string[]): Promise<string[]>;
|
|
23
|
+
export declare function listBindingReviews(): Promise<ReviewRecord[]>;
|
|
24
|
+
export declare function listSubmitRequestedReviews(): Promise<ReviewRecord[]>;
|
|
25
|
+
export declare function listUnprojectedTerminalReviews(): Promise<ReviewRecord[]>;
|
|
26
|
+
export declare function openReviewRow(reviewId: string, openedAt: string): Promise<boolean>;
|
|
27
27
|
/** Put a deferred submit back to not-requested, so the person sees the review open again. */
|
|
28
|
-
export declare function clearReviewSubmit(reviewId: string): void
|
|
29
|
-
export declare function requestReviewSubmit(reviewId: string, at: string): boolean
|
|
30
|
-
export declare function approveReviewLocked(db:
|
|
28
|
+
export declare function clearReviewSubmit(reviewId: string): Promise<void>;
|
|
29
|
+
export declare function requestReviewSubmit(reviewId: string, at: string): Promise<boolean>;
|
|
30
|
+
export declare function approveReviewLocked(db: CanvasDb, args: ApproveReviewArgs): Promise<boolean>;
|
|
31
31
|
export declare function cancelReviewRow(reviewId: string, args: {
|
|
32
32
|
at: string;
|
|
33
33
|
reason: string;
|
|
34
34
|
actor: string | null;
|
|
35
|
-
}): boolean
|
|
36
|
-
export declare function markProjected(reviewId: string, at: string): void
|
|
37
|
-
export declare function markProjectionError(reviewId: string, error: string): void
|
|
35
|
+
}): Promise<boolean>;
|
|
36
|
+
export declare function markProjected(reviewId: string, at: string): Promise<void>;
|
|
37
|
+
export declare function markProjectionError(reviewId: string, error: string): Promise<void>;
|
|
38
38
|
export declare function markDelivered(_reviewId: string, _receipt: string | null, _at: string): void;
|
|
39
39
|
export declare function markDeliveryError(_reviewId: string, _error: string): void;
|
|
40
|
-
export declare function readAnchorBase(reviewId: string): {
|
|
40
|
+
export declare function readAnchorBase(reviewId: string): Promise<{
|
|
41
41
|
bytes: Buffer;
|
|
42
42
|
sha256: string;
|
|
43
|
-
} | null
|
|
44
|
-
export declare function replaceAnchorBaseLocked(db:
|
|
43
|
+
} | null>;
|
|
44
|
+
export declare function replaceAnchorBaseLocked(db: CanvasDb, reviewId: string, bytes: Buffer, sha256: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var t=(e,n)=>c(e,"name",{value:n,configurable:!0});import{
|
|
1
|
+
var c=Object.defineProperty;var t=(e,n)=>c(e,"name",{value:n,configurable:!0});import{existsSync as u}from"node:fs";import{withCanvasWrite as d,openDb as o}from"../canvas/db.js";import{getRequest as l,getRequestByCompanion as _,getRequestByIdempotencyKey as p,listBindingRequests as w,listRequests as s,listSubmitRequestedRequests as m,listUnprojectedReviews as v,markProjected as y,markProjectionError as f,openRequest as h,readAnchorBase as R,replaceAnchorBaseLocked as E,requestSubmit as j}from"../human/requests.js";import{ReviewOperationError as k}from"./types.js";function b(e){try{const n=JSON.parse(e.specification_json);if(typeof n!="object"||n===null)throw new Error("not an object");return n}catch(n){throw new Error(`corrupt review specification: ${e.request_id}`,{cause:n})}}t(b,"specification");function g(e){return e.state!=="settled"?e.state:e.outcome==="approved"?"approved":"canceled"}t(g,"state");function a(e){if(e.kind!=="review")throw new Error(`human request is not a review: ${e.request_id}`);const n=b(e),r=g(e),i=e.settled_at;return{review_id:e.request_id,idempotency_key:e.idempotency_key??"",origin_kind:n.origin_kind??(e.inbox_listed?"ticket":"inline"),origin_node_id:e.requester_node_id??"",companion_node_id:e.companion_node_id??"",review_dir:e.request_dir,file:e.file??"",origin_session_file:n.origin_session_file,origin_session_id:n.origin_session_id,origin_leaf_id:n.origin_leaf_id,model_spec:n.model_spec,branch_file:n.branch_file,baseline_sha256:n.baseline_sha256,baseline_bytes:n.baseline_bytes,anchor_base_sha256:e.anchor_base_sha256??"",state:r,created:e.created_at,captured_at:n.captured_at,opened_at:e.opened_at,submit_requested_at:e.submit_requested_at,output_path:n.output_path??null,document_id:n.document_id??null,document_name:n.document_name??null,document_base:n.document_base??null,subtitle:e.subtitle,approved_at:r==="approved"?i:null,approved_sha256:r==="approved"?(()=>{try{return JSON.parse(e.result_json??"{}").approved_sha256??null}catch{return null}})():null,changed:r==="approved"?(()=>{try{return JSON.parse(e.result_json??"{}").changed??null}catch{return null}})():null,comments_total:r==="approved"?(()=>{try{return JSON.parse(e.result_json??"{}").comments_total??null}catch{return null}})():null,comments_unresolved:r==="approved"?(()=>{try{return JSON.parse(e.result_json??"{}").comments_unresolved??null}catch{return null}})():null,result_json:e.result_json,canceled_at:r==="canceled"?i:null,cancel_reason:r==="canceled"?(()=>{try{return JSON.parse(e.result_json??"{}").reason??null}catch{return null}})():null,cancel_actor:r==="canceled"?(()=>{try{return JSON.parse(e.result_json??"{}").actor??null}catch{return null}})():null,delivery_entry_id:e.settlement_delivery_id,delivered_at:e.settlement_delivery_id===null?null:i,delivery_error:null,projected_at:e.projected_at,projection_error:e.projection_error,source_missing:!u(e.file??"")}}t(a,"record");async function x(e){const n=await l(e);return n?.kind==="review"?n:null}t(x,"requestForReview");async function N(e){const n=await x(e);return n===null?null:a(n)}t(N,"getReview");async function U(e){const n=await N(e);if(n===null||n.state==="binding")throw new k("unknown_review","review was not found",{received:e});return n}t(U,"requireVisibleReview");async function q(e){const n=await p(e);return n?.kind==="review"?a(n):null}t(q,"getReviewByIdempotencyKey");async function T(e){const n=await _(e);return n?.kind==="review"?a(n):null}t(T,"getReviewByCompanion");async function I(e){return(await s({kind:"review",...e.origin_node_id===void 0?{}:{requester_node_id:e.origin_node_id},...e.file===void 0?{}:{file:e.file}})).map(a).filter(n=>n.state!=="binding"&&(e.state===void 0||n.state===e.state))}t(I,"listReviews");async function S(e){const n=new Set(e);return(await s({kind:"review"})).filter(r=>r.requester_node_id!==null&&n.has(r.requester_node_id)).map(r=>r.request_id)}t(S,"reviewIdsByOriginNodes");async function P(e){const n=await S(e);return n.length===0?[]:(await d(async r=>{const i=n.map(()=>"?").join(",");await r.prepareUncached(`DELETE FROM review_comment_events WHERE review_id IN (${i})`).run(...n),await r.prepareUncached(`DELETE FROM review_comments WHERE review_id IN (${i})`).run(...n),await r.prepareUncached(`DELETE FROM human_requests WHERE request_id IN (${i})`).run(...n)}),n)}t(P,"deleteReviewsByOriginNodes");async function J(){return(await w()).map(a)}t(J,"listBindingReviews");async function W(){return(await m()).map(a)}t(W,"listSubmitRequestedReviews");async function H(){return(await v()).map(a)}t(H,"listUnprojectedTerminalReviews");async function $(e,n){return await h(e,n)}t($,"openReviewRow");async function F(e){await(await o()).prepare("UPDATE human_requests SET submit_requested_at = NULL, updated_at = ? WHERE request_id = ? AND kind = 'review' AND state = 'open'").run(new Date().toISOString(),e)}t(F,"clearReviewSubmit");async function C(e,n){return await j(e,n)}t(C,"requestReviewSubmit");async function M(e,n){return(await e.prepare("UPDATE human_requests SET state = 'settled', outcome = 'approved', result_json = ?, settled_at = ?, progress_json = NULL, updated_at = ? WHERE request_id = ? AND kind = 'review' AND state = 'open'").run(n.result_json,n.approved_at,n.approved_at,n.review_id)).changes>0}t(M,"approveReviewLocked");async function K(e,n){return(await(await o()).prepare("UPDATE human_requests SET state = 'settled', outcome = 'canceled', result_json = ?, settled_at = ?, progress_json = NULL, updated_at = ? WHERE request_id = ? AND kind = 'review' AND state = 'open'").run(JSON.stringify({schema:"humanloop.cancel/v1",kind:"canceled",canceledAt:n.at,...n.reason===""?{}:{reason:n.reason},...n.actor===null?{}:{actor:n.actor}}),n.at,n.at,e)).changes>0}t(K,"cancelReviewRow");async function V(e,n){await y(e,n)}t(V,"markProjected");async function z(e,n){await f(e,n)}t(z,"markProjectionError");function G(e,n,r){}t(G,"markDelivered");function Q(e,n){}t(Q,"markDeliveryError");async function X(e){return await R(e)}t(X,"readAnchorBase");async function Y(e,n,r,i){await E(e,n,r,i)}t(Y,"replaceAnchorBaseLocked");export{M as approveReviewLocked,K as cancelReviewRow,F as clearReviewSubmit,P as deleteReviewsByOriginNodes,N as getReview,T as getReviewByCompanion,q as getReviewByIdempotencyKey,J as listBindingReviews,I as listReviews,W as listSubmitRequestedReviews,H as listUnprojectedTerminalReviews,G as markDelivered,Q as markDeliveryError,V as markProjected,z as markProjectionError,$ as openReviewRow,X as readAnchorBase,Y as replaceAnchorBaseLocked,C as requestReviewSubmit,U as requireVisibleReview,S as reviewIdsByOriginNodes};
|
|
@@ -8,4 +8,4 @@ export declare function toolCallSummary(args: unknown): string | null;
|
|
|
8
8
|
* state `run.trace` `in_progress_message` reads) says what the model is
|
|
9
9
|
* streaming. Null unless the run is `running`. `streaming` is that open
|
|
10
10
|
* message's newest block; a test passes it in place of a live broker. */
|
|
11
|
-
export declare function runActivity(runId: string, status: string, streaming?: () => OpenAssistantBlock | null): RunActivityDTO | null
|
|
11
|
+
export declare function runActivity(runId: string, status: string, streaming?: () => OpenAssistantBlock | null): Promise<RunActivityDTO | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)[0].trim();return
|
|
3
|
-
AND type IN ('node.turn.started', 'node.turn.completed') ORDER BY sequence_number DESC LIMIT 1`).get(e,e);if(!
|
|
1
|
+
var d=Object.defineProperty;var i=(e,t)=>d(e,"name",{value:t,configurable:!0});import{openDb as f}from"../canvas/db.js";import{openAssistantBlock as b}from"../../daemon/runs/observer.js";import{SUBMIT_RESULT_TOOL as m}from"../runtime/structured-output.js";const p=120;function y(e){if(!e||typeof e!="object")return null;const t=e,s=[t.command,t.file_path,t.path].find(o=>typeof o=="string"&&o.trim()!=="");if(s===void 0)return null;const r=s.trim().split(`
|
|
2
|
+
`)[0].trim();return r.length>p?`${r.slice(0,p-1)}\u2026`:r}i(y,"toolCallSummary");async function S(e,t,s=()=>b(e)){if(t!=="running")return null;const r=await f(),o=await r.prepare(`SELECT type, sequence_number FROM run_events WHERE run_id = ? AND node_id = ?
|
|
3
|
+
AND type IN ('node.turn.started', 'node.turn.completed') ORDER BY sequence_number DESC LIMIT 1`).get(e,e);if(!o)return{phase:"starting"};if(o.type==="node.turn.completed")return{phase:"between_turns"};const l=s();if(l?.kind==="text")return{phase:"writing"};if(l?.kind==="tool_call")return l.name===m?{phase:"submitting_result"}:{phase:"tool",tool:{name:l.name,summary:null}};if(l===null){const u=await r.prepare(`SELECT type, json_extract(body_json, '$.tool_call_id') AS id, sequence_number FROM run_events
|
|
4
4
|
WHERE run_id = ? AND node_id = ? AND type IN ('node.tool_call.started', 'node.tool_call.completed') AND sequence_number > ?
|
|
5
|
-
ORDER BY sequence_number`).all(e,e,
|
|
6
|
-
FROM run_events WHERE run_id = ? AND sequence_number = ?`).get(e,
|
|
5
|
+
ORDER BY sequence_number`).all(e,e,o.sequence_number),_=new Set(u.filter(n=>n.type==="node.tool_call.completed").map(n=>n.id)),c=u.filter(n=>n.type==="node.tool_call.started"&&!_.has(n.id)).at(-1);if(c){const n=await r.prepare(`SELECT json_extract(body_json, '$.name') AS name, json_extract(body_json, '$.arguments') AS args
|
|
6
|
+
FROM run_events WHERE run_id = ? AND sequence_number = ?`).get(e,c.sequence_number);if(n.name===m)return{phase:"submitting_result"};let a=null;try{a=n.args===null?null:JSON.parse(n.args)}catch{a=null}return{phase:"tool",tool:{name:n.name,summary:y(a)}}}}return{phase:"thinking"}}i(S,"runActivity");export{S as runActivity,y as toolCallSummary};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
2
2
|
/** A node's run and whether that run is isolated (the node's own flag or its root's). */
|
|
3
3
|
export interface RunPlace {
|
|
4
4
|
run: string;
|
|
@@ -7,19 +7,19 @@ export interface RunPlace {
|
|
|
7
7
|
/** The run a node belongs to: its `run_id`, or the node itself when it has none.
|
|
8
8
|
* A deleted node of an isolated run keeps its run through `deleted_isolated_nodes`,
|
|
9
9
|
* so what it leaves behind stays confined; any other node without a row is null. */
|
|
10
|
-
export declare function runPlace(nodeId: string, db?:
|
|
10
|
+
export declare function runPlace(nodeId: string, db?: CanvasDb): Promise<RunPlace | null>;
|
|
11
11
|
/** Record, before a node's row is deleted, the run of a node of an isolated run. */
|
|
12
|
-
export declare function rememberDeletedIsolated(nodeId: string, db?:
|
|
12
|
+
export declare function rememberDeletedIsolated(nodeId: string, db?: CanvasDb): Promise<void>;
|
|
13
13
|
/** The place of the node that registered a custom object, which is where that object
|
|
14
14
|
* reads from; null when the person or the app's server registered it. */
|
|
15
|
-
export declare function objectPlace(objectRowid: number, db?:
|
|
15
|
+
export declare function objectPlace(objectRowid: number, db?: CanvasDb): Promise<RunPlace | null>;
|
|
16
16
|
/** The confinement predicate: two places see each other when they are the same
|
|
17
17
|
* run, or when neither run is isolated. */
|
|
18
18
|
export declare function runsSeeEachOther(a: RunPlace, b: RunPlace): boolean;
|
|
19
19
|
/** Whether a node caller of `app` may reach `target` (a node id) under run confinement.
|
|
20
20
|
* Confinement applies only within one app; cross-app reach stays with the scope rules. */
|
|
21
|
-
export declare function nodeMayReach(callerNode: string, callerApp: string, targetNode: string, targetApp: string | null, db?:
|
|
21
|
+
export declare function nodeMayReach(callerNode: string, callerApp: string, targetNode: string, targetApp: string | null, db?: CanvasDb): Promise<boolean>;
|
|
22
22
|
/** The same question for a caller that has a place but no node (a cron command: its origin run). */
|
|
23
|
-
export declare function placeMayReach(caller: RunPlace, callerApp: string, targetNode: string, targetApp: string | null, db?:
|
|
23
|
+
export declare function placeMayReach(caller: RunPlace, callerApp: string, targetNode: string, targetApp: string | null, db?: CanvasDb): Promise<boolean>;
|
|
24
24
|
/** The node ids of one run (its root and every node carrying its `run_id`). */
|
|
25
|
-
export declare function runNodeIds(run: string, db?:
|
|
25
|
+
export declare function runNodeIds(run: string, db?: CanvasDb): Promise<string[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
LEFT JOIN nodes r ON r.node_id = n.run_id WHERE n.node_id = ?`).get(
|
|
1
|
+
var d=Object.defineProperty;var n=(t,e)=>d(t,"name",{value:e,configurable:!0});import{openDb as o}from"../canvas/db.js";async function u(t,e){e??=await o();const r=await e.prepare(`SELECT n.run_id, n.isolated, r.isolated AS root_isolated FROM nodes n
|
|
2
|
+
LEFT JOIN nodes r ON r.node_id = n.run_id WHERE n.node_id = ?`).get(t);if(!r){const a=await e.prepare("SELECT run_id FROM deleted_isolated_nodes WHERE node_id = ?").get(t);return a?{run:a.run_id,isolated:!0}:null}return{run:r.run_id??t,isolated:r.isolated===1||r.root_isolated===1}}n(u,"runPlace");async function E(t,e){e??=await o();const r=await u(t,e);r?.isolated&&await e.prepare("INSERT OR REPLACE INTO deleted_isolated_nodes (node_id, run_id) VALUES (?, ?)").run(t,r.run)}n(E,"rememberDeletedIsolated");async function w(t,e){e??=await o();const r=await e.prepare("SELECT registered_by FROM custom_objects WHERE object = ?").get(t);return r?.registered_by?await u(r.registered_by,e)??{run:r.registered_by,isolated:!1}:null}n(w,"objectPlace");function l(t,e){return t.run===e.run||!t.isolated&&!e.isolated}n(l,"runsSeeEachOther");async function R(t,e,r,a,i){i??=await o();const s=await u(t,i);return s===null?!0:await c(s,e,r,a,i)}n(R,"nodeMayReach");async function c(t,e,r,a,i){if(i??=await o(),(a??"app:terminal")!==e)return!0;const s=await u(r,i);return s===null?!t.isolated:l(t,s)}n(c,"placeMayReach");async function f(t,e){return e??=await o(),(await e.prepare("SELECT node_id FROM nodes WHERE run_id = ? OR node_id = ?").all(t,t)).map(r=>r.node_id)}n(f,"runNodeIds");export{R as nodeMayReach,w as objectPlace,c as placeMayReach,E as rememberDeletedIsolated,f as runNodeIds,u as runPlace,l as runsSeeEachOther};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
2
2
|
import type { RunEvent, RunEventFields, RunEventOf, RunEventType } from '../../api/dto/run-events.js';
|
|
3
3
|
/** Every event on a run's stream, declared once in the API contract. */
|
|
4
4
|
export type { RunEvent, RunEventType, RunEventOf, RunEventFields } from '../../api/dto/run-events.js';
|
|
5
5
|
/** The run-notice outbox's hook: called (after the appender's commit) for every event appended to a run. */
|
|
6
|
-
export declare function onRunEventAppended(hook: ((runId: string) => void) | undefined): void;
|
|
6
|
+
export declare function onRunEventAppended(hook: ((runId: string) => void | Promise<void>) | undefined): void;
|
|
7
7
|
/** Append one event to a run's log. `type` must be a declared run event and `fields` its fields. */
|
|
8
|
-
export declare function appendRunEvent<T extends RunEventType>(db:
|
|
9
|
-
export declare function emitRunEvent<T extends RunEventType>(runId: string, nodeId: string, type: T, fields: RunEventFields<T>): RunEventOf<T
|
|
10
|
-
export declare function emitRunSettlement<T extends 'node.settled' | 'child.settled'>(runId: string, nodeId: string, type: T, fields: RunEventFields<T>): void
|
|
11
|
-
export declare function readRunEvents(runId: string, after?: number): {
|
|
8
|
+
export declare function appendRunEvent<T extends RunEventType>(db: CanvasDb, runId: string, nodeId: string, type: T, fields: RunEventFields<T>): Promise<RunEventOf<T>>;
|
|
9
|
+
export declare function emitRunEvent<T extends RunEventType>(runId: string, nodeId: string, type: T, fields: RunEventFields<T>): Promise<RunEventOf<T>>;
|
|
10
|
+
export declare function emitRunSettlement<T extends 'node.settled' | 'child.settled'>(runId: string, nodeId: string, type: T, fields: RunEventFields<T>): Promise<void>;
|
|
11
|
+
export declare function readRunEvents(runId: string, after?: number): Promise<{
|
|
12
12
|
events: RunEvent[];
|
|
13
13
|
earliest_sequence: number | null;
|
|
14
14
|
latest_sequence: number;
|
|
15
15
|
backlog_count: number;
|
|
16
16
|
backlog_bytes: number;
|
|
17
|
-
}
|
|
18
|
-
export declare function subscribeRunEvents(runId: string, wake: () => void): () => void
|
|
17
|
+
}>;
|
|
18
|
+
export declare function subscribeRunEvents(runId: string, wake: () => void): Promise<() => void>;
|
|
19
19
|
export declare function notifyRunDeleted(runId: string): void;
|
|
20
20
|
/** OWN-11 for a joined runtime: the legacy `user:local` grantee is the terminal app. */
|
|
21
|
-
export declare function rewriteLocalRunEventGrantee(db:
|
|
21
|
+
export declare function rewriteLocalRunEventGrantee(db: CanvasDb): Promise<number>;
|
|
22
22
|
/** A run event cursor stays monotonic. Keep control/settlement/usage history
|
|
23
23
|
* for the observer's 30-day recovery window, but full payload events for 14
|
|
24
24
|
* days only; older conversation content is in the transcript store. The stream
|
|
25
25
|
* already signals a cursor gap when events have expired. Budget one page/tick. */
|
|
26
|
-
export declare function expireRunEvents(now: number, limit?: number): number
|
|
26
|
+
export declare function expireRunEvents(now: number, limit?: number): Promise<number>;
|
|
27
27
|
/** The conversation store is the canonical full transcript. Keep the full
|
|
28
28
|
* stream for one day, then redact settled tool calls, prompts and thinking.
|
|
29
29
|
* This includes older completed events of a still-live run, but tool-call
|
|
@@ -31,10 +31,10 @@ export declare function expireRunEvents(now: number, limit?: number): number;
|
|
|
31
31
|
* An open turn's deltas and status/settlement markers are never redacted. Cursor scans
|
|
32
32
|
* avoid re-searching the whole log each tick. Old event payload replay is a
|
|
33
33
|
* deliberate tradeoff; event identities and 30-day sequence gaps survive. */
|
|
34
|
-
export declare function compactRunEvents(now: number, afterRowid?: number, scanLimit?: number, writeLimit?: number): {
|
|
34
|
+
export declare function compactRunEvents(now: number, afterRowid?: number, scanLimit?: number, writeLimit?: number): Promise<{
|
|
35
35
|
cursor: number;
|
|
36
36
|
compacted: number;
|
|
37
|
-
}
|
|
37
|
+
}>;
|
|
38
38
|
/** Track an open `run.events` stream an app caller holds under `grant`. */
|
|
39
39
|
export declare function registerGrantStream(grant: string, close: () => void): () => void;
|
|
40
40
|
/** Close every open stream held under a grant that is no longer active. */
|
package/dist/core/runs/events.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
1
|
+
var v=Object.defineProperty;var a=(e,t)=>v(e,"name",{value:t,configurable:!0});import{afterCommit as y,withCanvasWrite as _,openDb as S}from"../canvas/db.js";import{emitEvent as g}from"../events/emit.js";import{repairRunConversations as O}from"../canvas/sessions.js";const E=new Map;let w;function L(e){w=e}a(L,"onRunEventAppended");async function f(e,t,n,r,s){const o=await e.prepare("SELECT event_cursor, grantee, metadata_json FROM node_rows WHERE node_id = ? AND run_id = ?").get(t,t);if(!o||o.event_cursor===null)throw new Error(`missing run event cursor: ${t}`);const i={type:r,run_id:t,node_id:n,sequence_number:o.event_cursor,ts:new Date().toISOString(),metadata:o.metadata_json?JSON.parse(o.metadata_json):{},...s};return await e.prepare("INSERT INTO run_events (run_id, sequence_number, node_id, type, ts, body_json, grantee) VALUES (?, ?, ?, ?, ?, ?, ?)").run(t,i.sequence_number,n,r,i.ts,JSON.stringify(i),o.grantee),await e.prepare("UPDATE nodes SET event_cursor = event_cursor + 1, last_activity_at = ? WHERE node_id = ?").run(i.ts,t),y(()=>{for(const d of E.get(t)??[])d();const u=a(d=>{g({level:"error",event:"runs.notice_hook_failed",error:d})},"failed");try{Promise.resolve(w?.(t)).catch(u)}catch(d){u(d)}}),i}a(f,"appendRunEvent");async function M(e,t,n,r){return await _(async s=>await f(s,e,t,n,r))}a(M,"emitRunEvent");async function A(e,t,n,r){await _(async s=>{await s.prepare("SELECT 1 FROM run_events WHERE run_id = ? AND node_id = ? AND type = ? AND json_extract(body_json, '$.outcome.revision') = ? LIMIT 1").get(e,t,n,r.outcome.revision)||await f(s,e,t,n,r)})}a(A,"emitRunSettlement");async function C(e,t=0){await O(e);const n=await S(),r=await n.prepare("SELECT event_cursor FROM nodes WHERE node_id = ? AND run_id = ?").get(e,e);if(!r)throw new Error(`run not found: ${e}`);const s=await n.prepare("SELECT MIN(sequence_number) AS sequence FROM run_events WHERE run_id = ?").get(e),o=await n.prepare("SELECT COUNT(*) AS count, COALESCE(SUM(LENGTH(body_json)), 0) AS bytes FROM run_events WHERE run_id = ? AND sequence_number > ?").get(e,t);return{events:(o.count>1e3||o.bytes>32*1024*1024?[]:await n.prepare("SELECT body_json FROM run_events WHERE run_id = ? AND sequence_number > ? ORDER BY sequence_number LIMIT 1000").all(e,t)).map(u=>JSON.parse(u.body_json)),earliest_sequence:s.sequence,latest_sequence:r.event_cursor-1,backlog_count:o.count,backlog_bytes:o.bytes}}a(C,"readRunEvents");async function H(e,t){let n=E.get(e);return n||(n=new Set,E.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&E.delete(e)}}a(H,"subscribeRunEvents");function x(e){queueMicrotask(()=>{for(const t of E.get(e)??[])t()})}a(x,"notifyRunDeleted");async function W(e){return Number((await e.prepare("UPDATE run_events SET grantee = 'app:terminal' WHERE grantee = 'user:local'").run()).changes)}a(W,"rewriteLocalRunEventGrantee");async function h(e,t=128){return await _(async n=>{const r=new Date(e-12096e5).toISOString(),s=new Date(e-720*60*6e4).toISOString(),o=Number((await n.prepare(`DELETE FROM run_events WHERE rowid IN
|
|
2
2
|
(SELECT rowid FROM run_events WHERE ts < ? AND type IN
|
|
3
3
|
('node.tool_call.completed', 'node.tool_call.started', 'node.system_prompt.set',
|
|
4
|
-
'node.thinking.done', 'node.output_text.done') ORDER BY ts LIMIT ?)`).run(r,t).changes),i=Number(
|
|
5
|
-
(SELECT rowid FROM run_events WHERE ts < ? ORDER BY ts LIMIT ?)`).run(s,t-o).changes);return o+i})}
|
|
4
|
+
'node.thinking.done', 'node.output_text.done') ORDER BY ts LIMIT ?)`).run(r,t)).changes),i=Number((await n.prepare(`DELETE FROM run_events WHERE rowid IN
|
|
5
|
+
(SELECT rowid FROM run_events WHERE ts < ? ORDER BY ts LIMIT ?)`).run(s,t-o)).changes);return o+i})}a(h,"expireRunEvents");async function j(e,t=0,n=256,r=8){return await _(async s=>{const o=await s.prepare(`SELECT e.rowid, e.type, e.ts, length(e.body_json) AS bytes,
|
|
6
6
|
n.finalized_at FROM run_events e LEFT JOIN nodes n ON n.node_id = e.node_id
|
|
7
|
-
WHERE e.rowid > ? ORDER BY e.rowid LIMIT ?`).all(t,n);if(!o.length)return{cursor:0,compacted:0};let i=0,
|
|
7
|
+
WHERE e.rowid > ? ORDER BY e.rowid LIMIT ?`).all(t,n);if(!o.length)return{cursor:0,compacted:0};let i=0,u=t;const d=new Date(e-1440*6e4).toISOString(),R=s.prepare("SELECT body_json FROM run_events WHERE rowid = ?"),m=s.prepare("UPDATE run_events SET body_json = ? WHERE rowid = ?");for(const c of o){if(u=c.rowid,!["node.tool_call.completed","node.tool_call.started","node.system_prompt.set","node.thinking.done"].includes(c.type)||c.ts>=d||c.bytes<1024||c.type==="node.tool_call.started"&&!c.finalized_at)continue;const p=JSON.parse((await R.get(c.rowid)).body_json);if(p.content_redacted!==!0&&(c.type==="node.tool_call.completed"?delete p.result:c.type==="node.tool_call.started"?delete p.arguments:delete p.text,p.content_redacted=!0,await m.run(JSON.stringify(p),c.rowid),++i>=r))break}return{cursor:u,compacted:i}})}a(j,"compactRunEvents");const l=new Map;function F(e,t){let n=l.get(e);return n||(n=new Set,l.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&l.delete(e)}}a(F,"registerGrantStream");function q(e){const t=[...l.get(e)??[]];for(const n of t)n();return t.length}a(q,"closeGrantStreams");export{f as appendRunEvent,q as closeGrantStreams,j as compactRunEvents,M as emitRunEvent,A as emitRunSettlement,h as expireRunEvents,x as notifyRunDeleted,L as onRunEventAppended,C as readRunEvents,F as registerGrantStream,W as rewriteLocalRunEventGrantee,H as subscribeRunEvents};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasDb } from '../canvas/db.js';
|
|
2
2
|
import type { NodeMeta } from '../canvas/types.js';
|
|
3
3
|
import type { AppPrincipal } from '../../daemon/api/principal.js';
|
|
4
4
|
import { type ResolvedAttachments } from '../storage/attachments.js';
|
|
@@ -13,7 +13,7 @@ export interface StorageDeps {
|
|
|
13
13
|
budgetMs?: number;
|
|
14
14
|
}
|
|
15
15
|
/** OWN-11 for a joined runtime: the legacy `user:local` grantee is the terminal app. */
|
|
16
|
-
export declare function rewriteLocalIdempotencyGrantee(db:
|
|
16
|
+
export declare function rewriteLocalIdempotencyGrantee(db: CanvasDb): Promise<number>;
|
|
17
17
|
export declare class RunError extends Error {
|
|
18
18
|
readonly status: number;
|
|
19
19
|
readonly code: string;
|
|
@@ -23,17 +23,17 @@ export declare class RunError extends Error {
|
|
|
23
23
|
readonly retryable: boolean;
|
|
24
24
|
constructor(status: number, code: string, message: string, param?: string | undefined, details?: unknown | undefined, scope?: string | undefined, retryable?: boolean);
|
|
25
25
|
}
|
|
26
|
-
export declare function ownedRun(id: string, grantee: string, allowDeleting?: boolean): NodeMeta
|
|
26
|
+
export declare function ownedRun(id: string, grantee: string, allowDeleting?: boolean): Promise<NodeMeta>;
|
|
27
27
|
export type RunStatus = 'running' | 'waiting_on_user' | 'idle' | 'settled';
|
|
28
28
|
/** Whether the run has a turn in flight or work owed to it (the `running` run status). */
|
|
29
|
-
export declare function runIsRunning(runId: string): boolean
|
|
30
|
-
export declare function runObject(root: NodeMeta): Record<string, unknown
|
|
29
|
+
export declare function runIsRunning(runId: string): Promise<boolean>;
|
|
30
|
+
export declare function runObject(root: NodeMeta): Promise<Record<string, unknown>>;
|
|
31
31
|
/** How long a kept key replays: a record this old or older reads as absent. The SDK's conformance scenarios hold FakeCloud to it. */
|
|
32
32
|
export declare const IDEMPOTENCY_WINDOW_MS = 86400000;
|
|
33
33
|
/** An `Idempotency-Key` header value: absent, or 1–255 characters. */
|
|
34
34
|
export declare function idempotencyKeyOf(header: unknown): string | undefined;
|
|
35
35
|
/** Delete keys past their window; returns how many were removed. */
|
|
36
|
-
export declare function pruneExpiredIdempotencyKeys(now?: number): number
|
|
36
|
+
export declare function pruneExpiredIdempotencyKeys(now?: number): Promise<number>;
|
|
37
37
|
/** Longest `run.start` deadline an app may set: 24 hours. The grammar is `crtr node new --deadline`'s (parts of `<int>[smhd]`, summed). */
|
|
38
38
|
export declare const RUN_DEADLINE_MAX_MS: number;
|
|
39
39
|
/** The milliseconds of a `run.start` `deadline` duration; refuses a malformed, zero, or over-24h value as `invalid_request` on `deadline`. */
|
|
@@ -54,11 +54,11 @@ export declare function listRuns(grantee: string | null, options: {
|
|
|
54
54
|
status?: string;
|
|
55
55
|
after?: string;
|
|
56
56
|
limit: number;
|
|
57
|
-
visible?: (runId: string) => boolean
|
|
58
|
-
}): {
|
|
57
|
+
visible?: (runId: string) => Promise<boolean>;
|
|
58
|
+
}): Promise<{
|
|
59
59
|
runs: Record<string, unknown>[];
|
|
60
60
|
next: string | null;
|
|
61
|
-
}
|
|
61
|
+
}>;
|
|
62
62
|
export declare function waitRun(id: string, grantee: string, seconds: number): Promise<Record<string, unknown>>;
|
|
63
63
|
export declare function messageRun(root: NodeMeta, original: string, resolveAttachments?: AttachmentResolver, startTurn?: boolean, idempotencyKey?: string): Promise<{
|
|
64
64
|
run_id: string;
|
|
@@ -73,11 +73,11 @@ export declare function cancelRun(root: NodeMeta, _options?: {
|
|
|
73
73
|
export declare const RUN_NAME_MAX = 200;
|
|
74
74
|
/** `run.rename`: set the root node's name — the name `crtr` shows for the node —
|
|
75
75
|
* through the same path as `PATCH /v1/nodes/:id/config` `name`. */
|
|
76
|
-
export declare function renameRun(root: NodeMeta, name: unknown): Record<string, unknown
|
|
76
|
+
export declare function renameRun(root: NodeMeta, name: unknown): Promise<Record<string, unknown>>;
|
|
77
77
|
/** Delete a run. Answers how many of the run's released uploads storage has
|
|
78
78
|
* not confirmed deleted; the due-work tick retries those. */
|
|
79
79
|
export declare function deleteRun(root: NodeMeta, storage?: StorageDeps): Promise<{
|
|
80
80
|
uploads_pending: number;
|
|
81
81
|
}>;
|
|
82
|
-
export declare function traceRun(id: string, grantee: string, format?: string): Record<string, unknown
|
|
82
|
+
export declare function traceRun(id: string, grantee: string, format?: string): Promise<Record<string, unknown>>;
|
|
83
83
|
export declare function requestedScopes(held: readonly string[], value: unknown, grantee: string): string[] | null;
|