@north-light/crouter 0.3.353 → 0.3.355
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/client.d.ts +35 -25
- package/dist/api/client.js +2 -2
- package/dist/api/dto/broker-ops.d.ts +2 -36
- package/dist/api/dto/canvas.d.ts +8 -13
- package/dist/api/dto/config.d.ts +4 -0
- package/dist/api/dto/delivery.d.ts +61 -0
- package/dist/api/dto/docs.d.ts +135 -0
- package/dist/api/dto/docs.js +1 -0
- package/dist/api/dto/health.d.ts +26 -79
- package/dist/api/dto/node-outcomes.d.ts +1 -3
- package/dist/api/dto/nodes.d.ts +5 -26
- package/dist/api/dto/objects.d.ts +168 -0
- package/dist/api/dto/objects.js +1 -0
- package/dist/api/dto/profiles.d.ts +14 -8
- package/dist/api/dto/reports.d.ts +9 -7
- package/dist/api/dto/reviews.d.ts +11 -3
- package/dist/api/dto/worktree.d.ts +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +1 -1
- package/dist/api/routes.d.ts +14 -12
- package/dist/api/routes.js +1 -1
- package/dist/build-root.js +1 -1
- package/dist/builtin-memory/00-runtime-base/00-authoring.md +10 -5
- package/dist/builtin-memory/02-turn-lifecycle/02-resident.md +1 -0
- package/dist/builtin-memory/04-orchestration-kernel.md +10 -31
- package/dist/builtin-memory/05-kinds/advisor/01-orchestrator.md +1 -1
- package/dist/builtin-memory/05-kinds/explore/00-base.md +2 -2
- package/dist/builtin-memory/05-kinds/explore/01-orchestrator.md +2 -2
- package/dist/builtin-memory/crouter-concepts/INDEX.md +2 -2
- package/dist/builtin-memory/crouter-concepts/lifecycle-and-wakes.md +1 -1
- package/dist/builtin-memory/crouter-concepts/memory.md +15 -15
- package/dist/builtin-memory/crouter-concepts/nodes-and-the-canvas.md +1 -1
- package/dist/builtin-memory/crouter-concepts/profiles-kinds-and-modes.md +5 -5
- package/dist/builtin-memory/crouter-concepts/scopes-and-trust.md +1 -1
- package/dist/builtin-memory/crouter-concepts/why-a-daemon.md +1 -1
- package/dist/builtin-memory/crouter-sdk/INDEX.md +2 -2
- package/dist/builtin-memory/crouter-sdk/README.md +5 -6
- package/dist/builtin-memory/crouter-sdk/errors.md +0 -13
- package/dist/builtin-memory/crouter-sdk/guides/README.md +0 -1
- package/dist/builtin-memory/crouter-sdk/guides/event-driven-assistant.md +2 -2
- package/dist/builtin-memory/crouter-sdk/nodes.md +0 -2
- package/dist/builtin-memory/crouter-sdk/resources.md +0 -1
- package/dist/builtin-memory/explore/exploration-doc.md +4 -4
- package/dist/builtin-memory/insights/capture.md +6 -6
- package/dist/builtin-memory/insights/init.md +14 -14
- package/dist/builtin-memory/internal/INDEX.md +4 -4
- package/dist/builtin-memory/internal/agent-shaping.md +20 -20
- package/dist/builtin-memory/internal/examples/imessage-assistant.md +2 -2
- package/dist/builtin-memory/internal/marketplaces.md +2 -2
- package/dist/builtin-memory/internal/memory-loading.md +31 -30
- package/dist/builtin-memory/internal/nodes-and-canvas.md +1 -1
- package/dist/builtin-memory/internal/plugins.md +16 -14
- package/dist/builtin-memory/internal/storage-tiers.md +4 -4
- package/dist/builtin-memory/memory-read-orientation.md +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +32 -40
- package/dist/clients/attach/input/controller.js +1 -1
- package/dist/clients/attach/input/ref-autocomplete.js +1 -1
- package/dist/clients/attach/input/titled-editor.js +1 -1
- package/dist/clients/attach/overlays/file-review.d.ts +1 -0
- package/dist/clients/attach/overlays/file-review.js +2 -2
- package/dist/clients/attach/render/chat-view.d.ts +6 -0
- package/dist/clients/attach/render/chat-view.js +2 -2
- package/dist/clients/attach/render/crtr-output.d.ts +1 -2
- package/dist/clients/attach/render/crtr-output.js +17 -17
- package/dist/clients/attach/render/doc-links.d.ts +34 -0
- package/dist/clients/attach/render/doc-links.js +1 -0
- package/dist/clients/attach/render/group-activity.d.ts +8 -8
- package/dist/clients/attach/render/group-activity.js +2 -2
- package/dist/clients/attach/render/group-recap.js +1 -1
- package/dist/clients/attach/render/markdown-source.js +5 -5
- package/dist/clients/attach/render/tool-calls.d.ts +1 -1
- package/dist/clients/attach/session/doc-materialize.d.ts +53 -0
- package/dist/clients/attach/session/doc-materialize.js +3 -0
- package/dist/clients/attach/session/document-links.d.ts +21 -0
- package/dist/clients/attach/session/document-links.js +1 -0
- package/dist/clients/attach/session/file-links.d.ts +2 -0
- package/dist/clients/attach/session/file-links.js +1 -1
- package/dist/clients/attach/session/profile-files.js +1 -1
- package/dist/clients/attach/slash/dispatch.js +1 -1
- package/dist/clients/attach/viewer.js +816 -1561
- package/dist/clients/inbox/review/review-client.d.ts +5 -1
- package/dist/clients/inbox/review/review-client.js +1 -1
- package/dist/commands/api-client.d.ts +2 -0
- package/dist/commands/api-client.js +3 -3
- package/dist/commands/canvas/edges.d.ts +2 -0
- package/dist/commands/canvas/edges.js +2 -0
- package/dist/commands/canvas/list.d.ts +4 -0
- package/dist/commands/canvas/list.js +3 -0
- package/dist/commands/canvas/read.d.ts +8 -0
- package/dist/commands/canvas/read.js +5 -0
- package/dist/commands/canvas/search.d.ts +2 -0
- package/dist/commands/canvas/search.js +3 -0
- package/dist/commands/canvas/unwatch.d.ts +2 -0
- package/dist/commands/canvas/unwatch.js +1 -0
- package/dist/commands/canvas/watch.d.ts +3 -0
- package/dist/commands/canvas/watch.js +1 -0
- package/dist/commands/canvas-analytics.js +1 -1
- package/dist/commands/canvas-history/grep.js +4 -4
- package/dist/commands/canvas-history/read.js +2 -2
- package/dist/commands/canvas-history/search.js +7 -7
- package/dist/commands/canvas-history/shared.d.ts +0 -1
- package/dist/commands/canvas-history/shared.js +1 -1
- package/dist/commands/canvas-history/stats.js +2 -2
- package/dist/commands/canvas-history.js +1 -1
- package/dist/commands/canvas.js +1 -1
- package/dist/commands/doc/delete.d.ts +2 -0
- package/dist/commands/doc/delete.js +1 -0
- package/dist/commands/doc/edit.d.ts +2 -0
- package/dist/commands/doc/edit.js +1 -0
- package/dist/commands/doc/history.d.ts +2 -0
- package/dist/commands/doc/history.js +2 -0
- package/dist/commands/doc/lint.d.ts +2 -0
- package/dist/commands/doc/lint.js +2 -0
- package/dist/commands/doc/list.d.ts +2 -0
- package/dist/commands/doc/list.js +1 -0
- package/dist/commands/doc/move.d.ts +2 -0
- package/dist/commands/doc/move.js +1 -0
- package/dist/commands/doc/read.d.ts +2 -0
- package/dist/commands/doc/read.js +1 -0
- package/dist/commands/doc/shared.d.ts +25 -0
- package/dist/commands/doc/shared.js +2 -0
- package/dist/commands/doc/write.d.ts +2 -0
- package/dist/commands/doc/write.js +1 -0
- package/dist/commands/{memory.d.ts → doc.d.ts} +1 -1
- package/dist/commands/doc.js +1 -0
- package/dist/commands/human/review.js +1 -1
- package/dist/commands/node/bash.js +2 -2
- package/dist/commands/node/create.js +1 -1
- package/dist/commands/node/inspect.js +10 -10
- package/dist/commands/node/lifecycle.js +2 -2
- package/dist/commands/node/outcome.js +1 -1
- package/dist/commands/node/subscription.js +1 -1
- package/dist/commands/node-context.js +2 -2
- package/dist/commands/pkg/browse/catalog.js +1 -1
- package/dist/commands/pkg/browse/doc-view.js +1 -1
- package/dist/commands/pkg/browse/model.d.ts +9 -17
- package/dist/commands/pkg/plugin-inspect.js +1 -1
- package/dist/commands/pkg/plugin-manage.d.ts +4 -8
- package/dist/commands/pkg/plugin-manage.js +15 -17
- package/dist/commands/profile/list.js +1 -1
- package/dist/commands/profile/new.js +1 -1
- package/dist/commands/profile/project.js +1 -1
- package/dist/commands/profile/show.js +1 -1
- package/dist/commands/push.js +3 -3
- package/dist/commands/sys/config.js +1 -1
- package/dist/commands/sys/context/admin/actions.d.ts +18 -43
- package/dist/commands/sys/context/admin/actions.js +1 -2
- package/dist/commands/sys/context/admin/detail-panel.d.ts +17 -25
- package/dist/commands/sys/context/admin/detail-panel.js +2 -1
- package/dist/commands/sys/context/admin/docs-panel.d.ts +7 -6
- package/dist/commands/sys/context/admin/docs-panel.js +1 -1
- package/dist/commands/sys/context/admin/list-view.d.ts +12 -12
- package/dist/commands/sys/context/admin/list-view.js +1 -1
- package/dist/commands/sys/context/admin/model.d.ts +96 -69
- package/dist/commands/sys/context/admin/model.js +1 -1
- package/dist/commands/sys/context/admin/rail-panel.d.ts +7 -5
- package/dist/commands/sys/context/admin/rail-panel.js +1 -1
- package/dist/commands/sys/context/admin/read-view.d.ts +10 -14
- package/dist/commands/sys/context/admin/read-view.js +1 -2
- package/dist/commands/sys/context/admin/shell.d.ts +26 -31
- package/dist/commands/sys/context/admin/shell.js +1 -1
- package/dist/commands/sys/context/admin.js +2 -2
- package/dist/commands/sys/context/doc.js +2 -3
- package/dist/commands/sys/context/expose.js +2 -2
- package/dist/commands/sys/context/prompt-review.js +4 -4
- package/dist/commands/sys/context/resolve.d.ts +92 -65
- package/dist/commands/sys/context/resolve.js +7 -9
- package/dist/commands/sys/context.js +1 -1
- package/dist/commands/sys/doctor.js +1 -1
- package/dist/commands/sys/migrate.js +1 -1
- package/dist/commands/sys/panels/profiles-panel.d.ts +3 -1
- package/dist/commands/sys/panels/profiles-panel.js +1 -1
- package/dist/commands/sys/sync-deps.d.ts +6 -11
- package/dist/commands/sys/sync-deps.js +7 -8
- package/dist/commands/sys/sync-project-guidance.js +5 -4
- package/dist/commands/sys/sync-shared.d.ts +41 -4
- package/dist/commands/sys/sync-shared.js +1 -1
- package/dist/commands/sys/sync-skills.js +2 -2
- package/dist/commands/sys/sync.js +1 -1
- package/dist/core/bash-job-supervisor.d.ts +2 -3
- package/dist/core/bash-job-supervisor.js +3 -3
- package/dist/core/bash-jobs.d.ts +0 -5
- package/dist/core/bash-jobs.js +7 -7
- package/dist/core/bootstrap.js +2 -2
- package/dist/core/canvas/canvas.d.ts +6 -50
- package/dist/core/canvas/canvas.js +16 -21
- package/dist/core/canvas/db.d.ts +4 -1
- package/dist/core/canvas/db.js +2 -2
- package/dist/core/canvas/history.d.ts +11 -39
- package/dist/core/canvas/history.js +9 -20
- package/dist/core/canvas/install-id.d.ts +2 -2
- package/dist/core/canvas/install-id.js +1 -1
- package/dist/core/canvas/memory-reads.d.ts +5 -0
- package/dist/core/canvas/memory-reads.js +1 -1
- package/dist/core/canvas/migrations.js +215 -41
- package/dist/core/canvas/node-agent-paths.js +1 -1
- package/dist/core/canvas/node-tokens.js +1 -1
- package/dist/core/canvas/paths.d.ts +0 -4
- package/dist/core/canvas/paths.js +1 -1
- package/dist/core/canvas/remote-canvas-source.d.ts +0 -1
- package/dist/core/canvas/remote-canvas-source.js +1 -1
- package/dist/core/canvas/render-source.d.ts +9 -6
- package/dist/core/canvas/render-source.js +6 -6
- package/dist/core/canvas/sessions.js +2 -2
- package/dist/core/canvas/source.d.ts +6 -0
- package/dist/core/canvas/tree.d.ts +29 -0
- package/dist/core/canvas/tree.js +12 -0
- package/dist/core/canvas/types.d.ts +0 -20
- package/dist/core/command-plugins/bundle.js +1 -1
- package/dist/core/config.d.ts +1 -1
- package/dist/core/conversation-store/listener.js +4 -2
- package/dist/core/feed/feed.d.ts +9 -7
- package/dist/core/feed/feed.js +3 -7
- package/dist/core/feed/inbox.d.ts +3 -5
- package/dist/core/feed/inbox.js +1 -10
- package/dist/core/feed/messages.d.ts +33 -6
- package/dist/core/feed/messages.js +10 -7
- package/dist/core/feed/reports.d.ts +10 -0
- package/dist/core/feed/reports.js +2 -0
- package/dist/core/grants/remove.js +1 -1
- package/dist/core/graph/access.d.ts +24 -0
- package/dist/core/graph/access.js +8 -0
- package/dist/core/graph/bodies.d.ts +6 -0
- package/dist/core/graph/bodies.js +1 -0
- package/dist/core/graph/deletion.d.ts +10 -0
- package/dist/core/graph/deletion.js +5 -0
- package/dist/core/graph/diff.d.ts +4 -0
- package/dist/core/graph/diff.js +4 -0
- package/dist/core/graph/documents.d.ts +167 -0
- package/dist/core/graph/documents.js +10 -0
- package/dist/core/graph/edges.d.ts +25 -0
- package/dist/core/graph/edges.js +1 -0
- package/dist/core/graph/events.d.ts +26 -0
- package/dist/core/graph/events.js +7 -0
- package/dist/core/graph/exposures.d.ts +53 -0
- package/dist/core/graph/exposures.js +4 -0
- package/dist/core/graph/jobs.d.ts +31 -0
- package/dist/core/graph/jobs.js +2 -0
- package/dist/core/graph/names.d.ts +30 -0
- package/dist/core/graph/names.js +3 -0
- package/dist/core/graph/objects.d.ts +55 -0
- package/dist/core/graph/objects.js +9 -0
- package/dist/core/graph/package-docs.d.ts +31 -0
- package/dist/core/graph/package-docs.js +5 -0
- package/dist/core/graph/package-files.d.ts +20 -0
- package/dist/core/graph/package-files.js +2 -0
- package/dist/core/graph/reader.d.ts +21 -0
- package/dist/core/graph/reader.js +3 -0
- package/dist/core/graph/repo-sync/exchange.d.ts +34 -0
- package/dist/core/graph/repo-sync/exchange.js +2 -0
- package/dist/core/graph/repo-sync/identity.d.ts +30 -0
- package/dist/core/graph/repo-sync/identity.js +1 -0
- package/dist/core/graph/repo-sync/index.d.ts +4 -0
- package/dist/core/graph/repo-sync/index.js +1 -0
- package/dist/core/graph/repo-sync/mirror.d.ts +30 -0
- package/dist/core/graph/repo-sync/mirror.js +6 -0
- package/dist/core/graph/repo-sync/ref-format.d.ts +76 -0
- package/dist/core/graph/repo-sync/ref-format.js +2 -0
- package/dist/core/graph/repo-sync/repos.d.ts +17 -0
- package/dist/core/graph/repo-sync/repos.js +3 -0
- package/dist/core/graph/repo-sync/sync.d.ts +42 -0
- package/dist/core/graph/repo-sync/sync.js +2 -0
- package/dist/core/graph/rules.d.ts +26 -0
- package/dist/core/graph/rules.js +3 -0
- package/dist/core/graph/spaces/app.d.ts +3 -0
- package/dist/core/graph/spaces/app.js +1 -0
- package/dist/core/graph/spaces/index.d.ts +19 -0
- package/dist/core/graph/spaces/index.js +1 -0
- package/dist/core/graph/spaces/person.d.ts +5 -0
- package/dist/core/graph/spaces/person.js +2 -0
- package/dist/core/graph/spaces/repo.d.ts +4 -0
- package/dist/core/graph/spaces/repo.js +1 -0
- package/dist/core/graph/types.d.ts +75 -0
- package/dist/core/graph/types.js +1 -0
- package/dist/core/graph/watches.d.ts +62 -0
- package/dist/core/graph/watches.js +18 -0
- package/dist/core/human/feedback-companion.js +1 -1
- package/dist/core/human/requests.d.ts +3 -1
- package/dist/core/human/requests.js +6 -6
- package/dist/core/inspector/model.js +2 -2
- package/dist/core/io.js +5 -5
- package/dist/core/layout-migrate/index.d.ts +24 -1
- package/dist/core/layout-migrate/index.js +4 -4
- package/dist/core/layout-migrate/paths.d.ts +4 -0
- package/dist/core/layout-migrate/paths.js +1 -1
- package/dist/core/layout-migrate/stored-paths.d.ts +7 -0
- package/dist/core/layout-migrate/stored-paths.js +11 -11
- package/dist/core/layout-migrate/stores.d.ts +19 -6
- package/dist/core/layout-migrate/stores.js +3 -4
- package/dist/core/manifest.d.ts +0 -2
- package/dist/core/manifest.js +1 -1
- package/dist/core/{memory/extensions.d.ts → plugin-extensions.d.ts} +9 -10
- package/dist/core/plugin-extensions.js +1 -0
- package/dist/core/preview-registry.d.ts +1 -1
- package/dist/core/preview-registry.js +3 -2
- package/dist/core/profiles/manifest.d.ts +7 -7
- package/dist/core/profiles/manifest.js +1 -1
- package/dist/core/profiles/select.js +3 -3
- package/dist/core/review/birth.js +1 -1
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/stage.d.ts +12 -1
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/store.d.ts +2 -0
- package/dist/core/review/store.js +1 -1
- package/dist/core/review/types.d.ts +7 -1
- package/dist/core/runs/events.js +1 -1
- package/dist/core/runs/operations.js +5 -5
- package/dist/core/runs/questions.js +2 -2
- package/dist/core/runtime/bearings-render.d.ts +13 -7
- package/dist/core/runtime/bearings-render.js +12 -12
- package/dist/core/runtime/bearings.d.ts +8 -18
- package/dist/core/runtime/bearings.js +7 -7
- package/dist/core/runtime/broker/daemon-ops.d.ts +7 -12
- package/dist/core/runtime/broker/daemon-ops.js +1 -1
- package/dist/core/runtime/broker/fault-retry.d.ts +2 -0
- package/dist/core/runtime/broker/fault-retry.js +1 -1
- package/dist/core/runtime/broker/frame-dispatch.d.ts +1 -1
- package/dist/core/runtime/broker/frame-memory-refs.d.ts +7 -2
- package/dist/core/runtime/broker/frame-memory-refs.js +1 -1
- package/dist/core/runtime/broker/inbox.d.ts +1 -4
- package/dist/core/runtime/broker/inbox.js +1 -10
- package/dist/core/runtime/broker/rebind.js +1 -1
- package/dist/core/runtime/broker/retry-card-elision.d.ts +7 -0
- package/dist/core/runtime/broker/retry-card-elision.js +1 -0
- package/dist/core/runtime/broker-extension-render.d.ts +0 -13
- package/dist/core/runtime/broker-extension-render.js +2 -4
- package/dist/core/runtime/broker-persona-guidance.js +3 -3
- package/dist/core/runtime/broker-protocol.d.ts +1 -1
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/close.d.ts +9 -4
- package/dist/core/runtime/close.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/kickoff.js +17 -19
- package/dist/core/runtime/launch-target.d.ts +7 -0
- package/dist/core/runtime/launch-target.js +1 -1
- package/dist/core/runtime/ledger.d.ts +10 -0
- package/dist/core/runtime/ledger.js +3 -0
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/nodes.d.ts +10 -2
- package/dist/core/runtime/nodes.js +1 -1
- package/dist/core/runtime/outcome-document.d.ts +2 -2
- package/dist/core/runtime/outcome-document.js +1 -1
- package/dist/core/runtime/persona.js +2 -2
- package/dist/core/runtime/placement.js +1 -1
- package/dist/core/runtime/promote.d.ts +2 -2
- package/dist/core/runtime/promote.js +1 -1
- package/dist/core/runtime/prospective-inventory-cli.js +2 -2
- package/dist/core/runtime/recycle.js +1 -1
- package/dist/core/runtime/reopen.js +1 -1
- package/dist/core/runtime/revive.js +2 -2
- package/dist/core/runtime/roadmap.d.ts +20 -9
- package/dist/core/runtime/roadmap.js +10 -6
- package/dist/core/runtime/spawn-env.js +1 -1
- package/dist/core/runtime/spawn.d.ts +5 -3
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/runtime/structured-output.d.ts +3 -1
- package/dist/core/runtime/structured-output.js +4 -4
- package/dist/core/scope.d.ts +1 -32
- package/dist/core/scope.js +1 -1
- package/dist/core/scoped-state/db.js +2 -1
- package/dist/core/scoped-state/migrate.js +2 -2
- package/dist/core/scoped-state/profiles.d.ts +11 -0
- package/dist/core/scoped-state/profiles.js +1 -1
- package/dist/core/scoped-state/schema.d.ts +1 -1
- package/dist/core/scoped-state/schema.js +7 -5
- package/dist/core/spaces/permissions.d.ts +0 -14
- package/dist/core/spaces/permissions.js +1 -1
- package/dist/core/spaces/stop.d.ts +13 -0
- package/dist/core/spaces/stop.js +2 -2
- package/dist/core/storage/tables.d.ts +1 -1
- package/dist/core/substrate/delivery/corpus.d.ts +21 -0
- package/dist/core/substrate/delivery/corpus.js +3 -0
- package/dist/core/substrate/delivery/deliver.d.ts +76 -0
- package/dist/core/substrate/delivery/deliver.js +6 -0
- package/dist/core/substrate/delivery/listings.d.ts +30 -0
- package/dist/core/substrate/delivery/listings.js +7 -0
- package/dist/core/substrate/delivery/match.d.ts +28 -0
- package/dist/core/substrate/delivery/match.js +1 -0
- package/dist/core/substrate/delivery/plan.d.ts +67 -0
- package/dist/core/substrate/delivery/plan.js +3 -0
- package/dist/core/substrate/delivery/render-boot.d.ts +20 -0
- package/dist/core/substrate/delivery/render-boot.js +54 -0
- package/dist/core/substrate/delivery/render-event.d.ts +54 -0
- package/dist/core/substrate/delivery/render-event.js +8 -0
- package/dist/core/substrate/delivery/sub-persona-menu.d.ts +2 -0
- package/dist/core/substrate/delivery/sub-persona-menu.js +6 -0
- package/dist/core/substrate/delivery/types.d.ts +30 -0
- package/dist/core/substrate/delivery/types.js +0 -0
- package/dist/core/substrate/gate-explain.d.ts +0 -13
- package/dist/core/substrate/gate-explain.js +1 -1
- package/dist/core/substrate/schema.d.ts +11 -139
- package/dist/core/substrate/schema.js +1 -1
- package/dist/core/substrate/subject-fields.d.ts +3 -0
- package/dist/core/substrate/subject.d.ts +2 -1
- package/dist/core/substrate/subject.js +1 -1
- package/dist/daemon/api/handlers/app-profiles.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +1 -2
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/canvas.js +5 -5
- package/dist/daemon/api/handlers/daemon.js +1 -1
- package/dist/daemon/api/handlers/delivery.d.ts +2 -0
- package/dist/daemon/api/handlers/delivery.js +1 -0
- package/dist/daemon/api/handlers/{memory.d.ts → docs.d.ts} +1 -1
- package/dist/daemon/api/handlers/docs.js +1 -0
- package/dist/daemon/api/handlers/hook-exec.js +1 -1
- package/dist/daemon/api/handlers/messages.js +2 -2
- package/dist/daemon/api/handlers/node-records.js +2 -2
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/objects.d.ts +2 -0
- package/dist/daemon/api/handlers/objects.js +5 -0
- package/dist/daemon/api/handlers/package-docs.d.ts +2 -0
- package/dist/daemon/api/handlers/package-docs.js +1 -0
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/api/handlers/reports.d.ts +2 -2
- package/dist/daemon/api/handlers/reports.js +4 -4
- package/dist/daemon/api/handlers/reviews.d.ts +4 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/map.d.ts +2 -2
- package/dist/daemon/api/map.js +2 -2
- package/dist/daemon/api/operations.d.ts +1 -1
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/reader.d.ts +17 -0
- package/dist/daemon/api/reader.js +1 -0
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/control.d.ts +2 -3
- package/dist/daemon/crtrd.js +8 -6
- package/dist/daemon/fleet.js +4 -4
- package/dist/daemon/reconcilers/bash-deadline.d.ts +11 -1
- package/dist/daemon/reconcilers/bash-deadline.js +2 -1
- package/dist/daemon/reconcilers/broker-supervision.js +4 -4
- package/dist/daemon/reconcilers/live-obligation.js +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/storage-maintenance.d.ts +1 -0
- package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
- package/dist/daemon/review/deliver.js +2 -2
- package/dist/daemon/review/finish.js +1 -1
- package/dist/hook-authoring.d.ts +0 -1
- package/dist/hook-authoring.js +3 -3
- package/dist/migrations/004-canvas-documents/apply.d.ts +10 -0
- package/dist/migrations/004-canvas-documents/apply.js +1 -0
- package/dist/migrations/004-canvas-documents/fields.d.ts +24 -0
- package/dist/migrations/004-canvas-documents/fields.js +2 -0
- package/dist/migrations/004-canvas-documents/index.d.ts +16 -0
- package/dist/migrations/004-canvas-documents/index.js +2 -0
- package/dist/migrations/004-canvas-documents/legacy/discover.d.ts +16 -0
- package/dist/migrations/004-canvas-documents/legacy/discover.js +1 -0
- package/dist/migrations/004-canvas-documents/legacy/history.d.ts +5 -0
- package/dist/migrations/004-canvas-documents/legacy/history.js +2 -0
- package/dist/migrations/004-canvas-documents/legacy/nested.d.ts +7 -0
- package/dist/migrations/004-canvas-documents/legacy/nested.js +1 -0
- package/dist/migrations/004-canvas-documents/legacy/parse.d.ts +14 -0
- package/dist/migrations/004-canvas-documents/legacy/parse.js +1 -0
- package/dist/migrations/004-canvas-documents/legacy/types.d.ts +91 -0
- package/dist/migrations/004-canvas-documents/legacy/types.js +0 -0
- package/dist/migrations/004-canvas-documents/legacy-edges.d.ts +6 -0
- package/dist/migrations/004-canvas-documents/legacy-edges.js +18 -0
- package/dist/migrations/004-canvas-documents/plan.d.ts +102 -0
- package/dist/migrations/004-canvas-documents/plan.js +3 -0
- package/dist/migrations/004-canvas-documents/pointers.d.ts +23 -0
- package/dist/migrations/004-canvas-documents/pointers.js +4 -0
- package/dist/migrations/activation.d.ts +9 -18
- package/dist/migrations/activation.js +2 -2
- package/dist/pi-extensions/broker-local.d.ts +2 -2
- package/dist/pi-extensions/broker-local.js +2 -2
- package/dist/pi-extensions/canvas-bash-valve.js +5 -4
- package/dist/pi-extensions/canvas-context-intro.js +2 -2
- package/dist/pi-extensions/canvas-doc-substrate.d.ts +0 -1
- package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
- package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
- package/dist/pi-extensions/canvas-passive-context.js +1 -1
- package/dist/pi-extensions/canvas-recap.js +2 -2
- package/dist/pi-extensions/canvas-stophook.d.ts +1 -1
- package/dist/pi-extensions/canvas-stophook.js +1 -1
- package/dist/prompts/review.js +3 -3
- package/dist/shared/env.d.ts +5 -0
- package/dist/shared/env.js +1 -1
- package/dist/shared/generated-context.js +2 -10
- package/dist/shared/inbox-entry-body.d.ts +22 -0
- package/dist/shared/inbox-entry-body.js +10 -0
- package/dist/{core/memory → shared}/inline-ref-guidance.d.ts +2 -2
- package/dist/shared/inline-ref-guidance.js +2 -0
- package/dist/types.d.ts +3 -1
- package/docs/cli/memory-and-preferences.md +12 -14
- package/docs/concepts/README.md +1 -1
- package/docs/concepts/lifecycle-and-wakes.md +1 -1
- package/docs/concepts/memory.md +15 -15
- package/docs/concepts/nodes-and-the-canvas.md +1 -1
- package/docs/concepts/profiles-kinds-and-modes.md +5 -5
- package/docs/concepts/scopes-and-trust.md +1 -1
- package/docs/concepts/why-a-daemon.md +1 -1
- package/docs/sdk/README.md +5 -6
- package/docs/sdk/errors.md +0 -13
- package/docs/sdk/guides/README.md +0 -1
- package/docs/sdk/nodes.md +0 -2
- package/docs/sdk/resources.md +0 -1
- package/package.json +2 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +11 -11
- package/scripts/lib/isolation-env.mjs +8 -2
- package/dist/api/dto/memory.d.ts +0 -171
- package/dist/api/dto/memory.js +0 -1
- package/dist/builtin-memory/crouter-sdk/guides/app-memory.md +0 -73
- package/dist/builtin-memory/crouter-sdk/memory.md +0 -87
- package/dist/commands/broker-permissions.d.ts +0 -2
- package/dist/commands/broker-permissions.js +0 -1
- package/dist/commands/memory/client.d.ts +0 -11
- package/dist/commands/memory/client.js +0 -1
- package/dist/commands/memory/delete.d.ts +0 -1
- package/dist/commands/memory/delete.js +0 -1
- package/dist/commands/memory/edit.d.ts +0 -1
- package/dist/commands/memory/edit.js +0 -21
- package/dist/commands/memory/find.d.ts +0 -1
- package/dist/commands/memory/find.js +0 -1
- package/dist/commands/memory/history.d.ts +0 -1
- package/dist/commands/memory/history.js +0 -5
- package/dist/commands/memory/lint.d.ts +0 -1
- package/dist/commands/memory/lint.js +0 -1
- package/dist/commands/memory/list.d.ts +0 -1
- package/dist/commands/memory/list.js +0 -1
- package/dist/commands/memory/move.d.ts +0 -1
- package/dist/commands/memory/move.js +0 -1
- package/dist/commands/memory/origin.d.ts +0 -1
- package/dist/commands/memory/origin.js +0 -1
- package/dist/commands/memory/read.d.ts +0 -1
- package/dist/commands/memory/read.js +0 -6
- package/dist/commands/memory/shared.d.ts +0 -22
- package/dist/commands/memory/shared.js +0 -1
- package/dist/commands/memory/write.d.ts +0 -1
- package/dist/commands/memory/write.js +0 -13
- package/dist/commands/memory.js +0 -1
- package/dist/commands/node-inspect-artifacts.d.ts +0 -1
- package/dist/commands/node-inspect-artifacts.js +0 -8
- package/dist/core/help/memory-extensions.d.ts +0 -3
- package/dist/core/help/memory-extensions.js +0 -2
- package/dist/core/memory/cli-selector.d.ts +0 -13
- package/dist/core/memory/cli-selector.js +0 -1
- package/dist/core/memory/doc-link-grammar.d.ts +0 -20
- package/dist/core/memory/doc-link-grammar.js +0 -2
- package/dist/core/memory/extensions.js +0 -1
- package/dist/core/memory/history.d.ts +0 -87
- package/dist/core/memory/history.js +0 -6
- package/dist/core/memory/identity.d.ts +0 -65
- package/dist/core/memory/identity.js +0 -1
- package/dist/core/memory/inline-ref-guidance.js +0 -2
- package/dist/core/memory/inline-ref-inventory.d.ts +0 -9
- package/dist/core/memory/inline-ref-inventory.js +0 -1
- package/dist/core/memory/lint.d.ts +0 -163
- package/dist/core/memory/lint.js +0 -2
- package/dist/core/memory/mutation-domain.d.ts +0 -113
- package/dist/core/memory/mutation-domain.js +0 -12
- package/dist/core/memory/mutations.d.ts +0 -74
- package/dist/core/memory/mutations.js +0 -1
- package/dist/core/memory/project-namespace.d.ts +0 -31
- package/dist/core/memory/project-namespace.js +0 -2
- package/dist/core/memory/repository-association.d.ts +0 -31
- package/dist/core/memory/repository-association.js +0 -1
- package/dist/core/memory/service.d.ts +0 -145
- package/dist/core/memory/service.js +0 -2
- package/dist/core/memory/tree.d.ts +0 -39
- package/dist/core/memory/tree.js +0 -1
- package/dist/core/memory-resolver.d.ts +0 -280
- package/dist/core/memory-resolver.js +0 -2
- package/dist/core/nested-stores.d.ts +0 -18
- package/dist/core/nested-stores.js +0 -1
- package/dist/core/runtime/memory.d.ts +0 -3
- package/dist/core/runtime/memory.js +0 -1
- package/dist/core/substrate/frontmatter-validation.d.ts +0 -11
- package/dist/core/substrate/frontmatter-validation.js +0 -1
- package/dist/core/substrate/gate.d.ts +0 -16
- package/dist/core/substrate/gate.js +0 -1
- package/dist/core/substrate/index.d.ts +0 -18
- package/dist/core/substrate/index.js +0 -1
- package/dist/core/substrate/injected-store.d.ts +0 -75
- package/dist/core/substrate/injected-store.js +0 -2
- package/dist/core/substrate/listings.d.ts +0 -28
- package/dist/core/substrate/listings.js +0 -1
- package/dist/core/substrate/memory-events.d.ts +0 -6
- package/dist/core/substrate/memory-events.js +0 -1
- package/dist/core/substrate/on-read-node.d.ts +0 -6
- package/dist/core/substrate/on-read-node.js +0 -1
- package/dist/core/substrate/on-read.d.ts +0 -101
- package/dist/core/substrate/on-read.js +0 -9
- package/dist/core/substrate/plan.d.ts +0 -94
- package/dist/core/substrate/plan.js +0 -1
- package/dist/core/substrate/render-node.d.ts +0 -12
- package/dist/core/substrate/render-node.js +0 -1
- package/dist/core/substrate/render.d.ts +0 -41
- package/dist/core/substrate/render.js +0 -65
- package/dist/core/substrate/session-cache.d.ts +0 -27
- package/dist/core/substrate/session-cache.js +0 -1
- package/dist/core/substrate/surface-match.d.ts +0 -73
- package/dist/core/substrate/surface-match.js +0 -1
- package/dist/daemon/api/handlers/memory.js +0 -5
- package/dist/migrations/001-surfaces-frontmatter.d.ts +0 -2
- package/dist/migrations/001-surfaces-frontmatter.js +0 -1
- package/dist/migrations/002-profile-project-memory.d.ts +0 -2
- package/dist/migrations/002-profile-project-memory.js +0 -1
- package/dist/migrations/003-repository-root-memory-identity/front-door.d.ts +0 -26
- package/dist/migrations/003-repository-root-memory-identity/front-door.js +0 -11
- package/dist/migrations/003-repository-root-memory-identity/index.d.ts +0 -2
- package/dist/migrations/003-repository-root-memory-identity/index.js +0 -5
- package/dist/migrations/003-repository-root-memory-identity/references.d.ts +0 -95
- package/dist/migrations/003-repository-root-memory-identity/references.js +0 -5
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.d.ts +0 -39
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.js +0 -3
- package/dist/migrations/convergent.d.ts +0 -43
- package/dist/migrations/convergent.js +0 -2
- package/dist/migrations/corpus.d.ts +0 -75
- package/dist/migrations/corpus.js +0 -3
- package/dist/migrations/frontmatter-splice.d.ts +0 -15
- package/dist/migrations/frontmatter-splice.js +0 -8
- package/dist/migrations/profile-manifests.d.ts +0 -30
- package/dist/migrations/profile-manifests.js +0 -2
- package/dist/migrations/registry.d.ts +0 -7
- package/dist/migrations/registry.js +0 -1
- package/dist/migrations/runner.d.ts +0 -43
- package/dist/migrations/runner.js +0 -1
- package/dist/migrations/types.d.ts +0 -211
- package/dist/shared/birth-announcement.d.ts +0 -12
- package/dist/shared/birth-announcement.js +0 -1
- package/docs/sdk/guides/app-memory.md +0 -22
- package/docs/sdk/memory.md +0 -85
- /package/dist/{migrations/types.js → api/dto/delivery.js} +0 -0
- /package/dist/{core/memory → shared}/inline-ref-grammar.d.ts +0 -0
- /package/dist/{core/memory → shared}/inline-ref-grammar.js +0 -0
package/dist/api/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DaemonAdmitDTO, DaemonRestartDTO, HealthDTO, MigrateStateDTO, MigrateStateRequest, StatusDTO } from './dto/health.js';
|
|
2
2
|
import type { BashJobStatusDTO, BashJobStopResultDTO } from './dto/bash-jobs.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ContextListDTO, CreateNodeRequest, ListNodesQuery, NodeDetailDTO, NodeMessagesPageDTO, NodeMessagesQuery, NodeSessionDTO, NodeSnapshotDTO, NodeSubjectDTO, NodeSummaryDTO, TranscriptDTO, TranscriptQuery } from './dto/nodes.js';
|
|
4
4
|
import type { NodeOutcomeResponseDTO, OutcomeDeliveryDTO, RegisterOutcomeDeliveryRequest } from './dto/node-outcomes.js';
|
|
5
5
|
import type { AnalyticsDTO, AnalyticsQuery, MemoryReadsRequestDTO } from './dto/analytics.js';
|
|
6
6
|
import type { NodeEventsQuery } from './dto/node-events.js';
|
|
@@ -16,7 +16,9 @@ import type { AttachEnsureRequest, AttachEnsureResultDTO } from './dto/attach.js
|
|
|
16
16
|
import type { CreateProfileRequest, DeleteProfileRequest, DeleteProfileResultDTO, EnsureProfileRequest, ProfileDTO, ProfileEnvChangeDTO, ProfileEnvNamesDTO, ProfilePauseResultDTO, UpdateProfileMetadataRequest, UpdateProfileRequest } from './dto/profiles.js';
|
|
17
17
|
import type { FileEncoding, FileListDTO, FilePeekDTO, FileWriteDTO } from './dto/files.js';
|
|
18
18
|
import type { BashRunDTO, BashRunParams } from './dto/bash.js';
|
|
19
|
-
import type {
|
|
19
|
+
import type { EdgesDTO, EdgesQuery, ObjectListDTO, ObjectListRequest, ObjectReadDTO, ObjectReadQuery, ObjectSearchDTO, ObjectSearchRequest, UnwatchQuery, UnwatchResultDTO, WatchRequest, WatchResultDTO } from './dto/objects.js';
|
|
20
|
+
import type { DocDeletedDTO, DocEditRequest, DocEditedDTO, DocHistoryDTO, DocHistoryQuery, DocLintDTO, DocLintRequest, DocMoveRequest, DocMovedDTO, DocWriteRequest, DocWrittenDTO, ReconcilePackagesDTO } from './dto/docs.js';
|
|
21
|
+
import type { BackgroundedJobDTO, BackgroundedJobRequest, DeliveryDryRunRequest, DeliveryRequest, DeliveryResponse } from './dto/delivery.js';
|
|
20
22
|
import type { ChatInventoryDTO, ProspectiveChatInventoryDTO, ProspectiveChatInventoryQuery } from './dto/chat-inventory.js';
|
|
21
23
|
import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, CompleteModelAuthFlowRequest, ModelAuthFlowCompletedDTO, ModelAuthFlowDTO, ModelAuthFlowStartedDTO, ModelAuthListDTO, ModelAuthReadinessDTO, ModelAuthReadinessQuery, StartModelAuthFlowRequest } from './dto/modelauth.js';
|
|
22
24
|
import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
|
|
@@ -25,7 +27,7 @@ import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, I
|
|
|
25
27
|
import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest, PageComponentListDTO } from './dto/human-requests.js';
|
|
26
28
|
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, GraphDTO, PruneRequest, PruneResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
27
29
|
import type { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO, QuarantinedWorktreeDTO, SpaceListDTO } from './dto/worktree.js';
|
|
28
|
-
import type { BrokerExtensionStateDTO,
|
|
30
|
+
import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest, BrokerTelemetryRequest } from './dto/broker-ops.js';
|
|
29
31
|
import type { AcknowledgeMailRequest, AcknowledgeMailResultDTO, ClaimMailRequest, ClaimMailResultDTO } from './dto/mail.js';
|
|
30
32
|
import type { BrokerFaultInputDTO, BrokerFaultRequest, BrokerFaultResultDTO, BrokerProviderRetryRequest, BrokerProviderRetryResultDTO, BrokerTurnRequest, BrokerTurnResultDTO, NodeFaultClearResultDTO, RecoveryStateDTO } from './dto/recovery.js';
|
|
31
33
|
export interface CrtrClientOptions {
|
|
@@ -157,10 +159,6 @@ export declare class CrtrClient {
|
|
|
157
159
|
}): Promise<NodeFaultClearResultDTO>;
|
|
158
160
|
commitBrokerModel(id: string, req: BrokerModelCommitRequest): Promise<BrokerModelCommitResultDTO>;
|
|
159
161
|
brokerExtensionState(id: string): Promise<BrokerExtensionStateDTO>;
|
|
160
|
-
brokerContext(id: string, req: BrokerContextRequest): Promise<BrokerContextDTO>;
|
|
161
|
-
brokerMemoryRefs(id: string, expectedExecutionId: string): Promise<import('./dto/broker-ops.js').BrokerMemoryRefsDTO>;
|
|
162
|
-
commitBrokerContext(id: string, req: BrokerContextCommitRequest): Promise<void>;
|
|
163
|
-
brokerContextEvent(id: string, req: BrokerContextEventRequest): Promise<BrokerContextDTO>;
|
|
164
162
|
commitBrokerGeneratedName(id: string, req: BrokerGeneratedNameRequest): Promise<BrokerGeneratedNameResultDTO>;
|
|
165
163
|
commitBrokerPersonaAck(id: string, req: BrokerPersonaAckRequest): Promise<BrokerPersonaAckResultDTO>;
|
|
166
164
|
closeNode(id: string, req?: CloseRequest): Promise<CloseResultDTO>;
|
|
@@ -179,7 +177,7 @@ export declare class CrtrClient {
|
|
|
179
177
|
closeWorktree(id: string): Promise<CloseWorktreeResultDTO>;
|
|
180
178
|
abandonWorktree(id: string, req: AbandonWorktreeRequest): Promise<AbandonWorktreeResultDTO>;
|
|
181
179
|
listQuarantinedWorktrees(): Promise<QuarantinedWorktreeDTO[]>;
|
|
182
|
-
/** Every space on the runtime with its size
|
|
180
|
+
/** Every space on the runtime with its size. */
|
|
183
181
|
listSpaces(): Promise<SpaceListDTO>;
|
|
184
182
|
subscribe(id: string, req: SubscribeRequest): Promise<SubscriptionDTO>;
|
|
185
183
|
listFocuses(): Promise<FocusDTO[]>;
|
|
@@ -227,28 +225,40 @@ export declare class CrtrClient {
|
|
|
227
225
|
* not live answers `broker_live: false` with empty arrays. */
|
|
228
226
|
getChatInventory(id: string): Promise<ChatInventoryDTO>;
|
|
229
227
|
getProspectiveChatInventory(q?: ProspectiveChatInventoryQuery): Promise<ProspectiveChatInventoryDTO>;
|
|
230
|
-
getArtifacts(id: string, q?: ArtifactsQuery): Promise<ArtifactListDTO>;
|
|
231
228
|
getContext(id: string): Promise<ContextListDTO>;
|
|
232
229
|
/** Read an absolute host path (capped, `truncated` when clipped). */
|
|
233
230
|
peekFile(path: string, encoding?: FileEncoding, options?: CrtrRequestOptions): Promise<FilePeekDTO>;
|
|
234
231
|
writeFile(path: string, content: string, encoding?: FileEncoding, options?: CrtrRequestOptions): Promise<FileWriteDTO>;
|
|
235
232
|
listFiles(path: string, limit?: number, options?: CrtrRequestOptions): Promise<FileListDTO>;
|
|
236
233
|
runBash(params: BashRunParams, options?: CrtrRequestOptions): Promise<BashRunDTO>;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
234
|
+
/** `crtr canvas` shared verbs. A ref is a name (with or without `[[ ]]`) or a raw object id. */
|
|
235
|
+
readonly objects: {
|
|
236
|
+
read: (ref: string, query?: ObjectReadQuery) => Promise<ObjectReadDTO>;
|
|
237
|
+
list: (query?: ObjectListRequest) => Promise<ObjectListDTO>;
|
|
238
|
+
search: (request: ObjectSearchRequest) => Promise<ObjectSearchDTO>;
|
|
239
|
+
watch: (ref: string, request?: WatchRequest) => Promise<WatchResultDTO>;
|
|
240
|
+
unwatch: (ref: string, query?: UnwatchQuery) => Promise<UnwatchResultDTO>;
|
|
241
|
+
edges: (ref: string, query?: EdgesQuery) => Promise<EdgesDTO>;
|
|
242
|
+
};
|
|
243
|
+
/** `crtr doc` write verbs. */
|
|
244
|
+
readonly docs: {
|
|
245
|
+
write: (request: DocWriteRequest) => Promise<DocWrittenDTO>;
|
|
246
|
+
edit: (ref: string, request: DocEditRequest) => Promise<DocEditedDTO>;
|
|
247
|
+
move: (ref: string, request: DocMoveRequest) => Promise<DocMovedDTO>;
|
|
248
|
+
delete: (ref: string) => Promise<DocDeletedDTO>;
|
|
249
|
+
history: (ref: string, query?: DocHistoryQuery) => Promise<DocHistoryDTO>;
|
|
250
|
+
lint: (request?: DocLintRequest) => Promise<DocLintDTO>;
|
|
251
|
+
};
|
|
252
|
+
/** Package (builtin and plugin) documents. */
|
|
253
|
+
readonly documents: {
|
|
254
|
+
reconcilePackages: () => Promise<ReconcilePackagesDTO>;
|
|
255
|
+
};
|
|
256
|
+
/** The broker's delivery of one node activity. */
|
|
257
|
+
nodeDelivery(id: string, request: DeliveryRequest): Promise<DeliveryResponse>;
|
|
258
|
+
/** A person's dry run of one delivery activity, for a live or hypothetical node. Writes nothing. */
|
|
259
|
+
deliveryDryRun(request: DeliveryDryRunRequest): Promise<DeliveryResponse>;
|
|
260
|
+
/** Record a backgrounded bash command as a job object. */
|
|
261
|
+
recordBackgroundedJob(id: string, jobId: string, request: BackgroundedJobRequest): Promise<BackgroundedJobDTO>;
|
|
252
262
|
/** Create-or-return by name. Supplied `projects` are shape-checked even when
|
|
253
263
|
* the profile already exists; their directories are only required to exist
|
|
254
264
|
* when this call creates the profile. */
|
|
@@ -364,7 +374,7 @@ export declare class CrtrClient {
|
|
|
364
374
|
/** The machine-readable browser canvas roster (`crtr canvas snapshot`) —
|
|
365
375
|
* distinct from the per-node `getSnapshot`. */
|
|
366
376
|
canvasSnapshot(): Promise<SnapshotDTO>;
|
|
367
|
-
/** The Analytics page model (`GET /v1/canvas/analytics
|
|
377
|
+
/** The Analytics page model (`GET /v1/canvas/analytics`). The
|
|
368
378
|
* daemon scans transcripts for the window: a cold 7d scan of ~2 GB of
|
|
369
379
|
* transcripts measured 10 s, and with scan workers capped at 4 a queued
|
|
370
380
|
* request waits about one scan more. 60 s is 3x that worst case; past it the
|
package/dist/api/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var g=Object.defineProperty;var d=(n,e)=>g(n,"name",{value:e,configurable:!0});import{ApiError as h,isErrorBody as b}from"./errors.js";import{routes as r}from"./routes.js";import{isSafeNodeId as E}from"./dto/common.js";import{isSafeBashJobId as R}from"./dto/bash-jobs.js";import{isSafeCronId as k}from"./dto/crons.js";const C=3e4,G=Symbol.for("@north-light/crouter-api/local-socket-fetch"),M=1e4,D=200;async function _({windowMs:n,probe:e,initialError:t,pollIntervalMs:s=D,retry:i=d(()=>!0,"retry"),now:a=Date.now,sleep:P=w}){const l=a()+n;let u=t;for(;;){const c=l-a();if(c<=0)throw u??new Error("crtrd availability window expired without a probe failure");try{await e(c);return}catch(f){if(u=f,!i(f))throw f}const m=l-a();if(m<=0)throw u;await P(Math.min(s,m))}}d(_,"waitForDaemonAvailability");class U{static{d(this,"CrtrClient")}baseUrl;fetch;headers;autostart;timeoutMs;maxRetries;localSocketTransport;onColdSocket;coldStartDiagnostic;coldStartPollWindowMs;coldStartAttempted=!1;constructor(e){if(e.baseUrl==="")throw new TypeError("CrtrClient requires baseUrl");this.baseUrl=new URL(e.baseUrl),this.fetch=e.fetch??globalThis.fetch,this.headers={...e.headers},this.autostart=e.autostart??!1,this.timeoutMs=e.timeoutMs??C,this.maxRetries=e.maxRetries??2,this.localSocketTransport=this.fetch[G]===!0,e.onColdSocket!==void 0&&(this.onColdSocket=e.onColdSocket),e.coldStartDiagnostic!==void 0&&(this.coldStartDiagnostic=e.coldStartDiagnostic),this.coldStartPollWindowMs=e.coldStartPollWindowMs??M}healthz(){return this.request("GET",r.healthz())}async probeHealthz(e){const t=await this.transport("GET",r.healthz(),void 0,{timeout:e});if(t.status===503)try{const s=await t.clone().json();if(typeof s.startup_blocked=="string")return s}catch{}return p(t)}status(){return this.request("GET",r.status())}restartDaemon(){return this.request("POST",r.daemonRestart())}admitDaemon(){return this.request("POST",r.daemonAdmit())}migrateState(e){return this.request("POST",r.daemonMigrate(),e)}appendNodeLog(e,t){return this.request("POST",r.nodeLog(this.nodePath(e)),t)}async putNodeTelemetry(e,t){await this.request("PUT",r.nodeTelemetry(this.nodePath(e)),t)}async putNodeRecap(e,t){await this.request("PUT",r.nodeRecap(this.nodePath(e)),t)}readNodeInboxReport(e,t,s){return this.request("GET",o(r.nodeInboxReport(this.nodePath(e)),{ref:t,execution_id:s}))}readNodePassiveMessage(e,t){return this.request("GET",o(r.nodePassiveMessage(this.nodePath(e)),{ref:t}))}nodePushedFinal(e,t){return this.request("POST",r.nodePushedFinal(this.nodePath(e)),t)}createNode(e){return this.request("POST",r.nodes(),e)}listNodes(e){return this.request("GET",o(r.nodes(),e))}getNode(e){return this.request("GET",r.node(this.nodePath(e)))}getNodeOutcome(e,{waitSeconds:t}={}){if(t!==void 0&&(!Number.isInteger(t)||t<0||t>25))throw new RangeError("waitSeconds must be an integer between 0 and 25");return this.request("GET",o(r.nodeOutcome(this.nodePath(e)),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}getNodeEvents(e,t={},s={}){if(t.after!==void 0&&(!Number.isSafeInteger(t.after)||t.after<0))throw new RangeError("after must be a non-negative safe integer");return this.transport("GET",o(r.nodeEvents(this.nodePath(e)),t),void 0,{...s,headers:{accept:"text/event-stream",...s.headers??{}},timeout:0})}registerOutcomeDelivery(e,t){return this.request("PUT",r.nodeOutcomeDelivery(this.nodePath(e)),t)}getOutcomeDelivery(e){return this.request("GET",r.nodeOutcomeDelivery(this.nodePath(e)))}async disarmOutcomeDelivery(e){await this.request("DELETE",r.nodeOutcomeDelivery(this.nodePath(e)))}listBashJobs(e){return this.request("GET",r.nodeJobs(this.nodePath(e)))}stopBashJob(e,t){return this.request("DELETE",r.nodeJob(this.nodePath(e),this.jobPath(t)))}sendMessage(e,t){return this.request("POST",r.nodeMessages(this.nodePath(e)),t)}interruptNode(e){return this.request("POST",r.nodeInterrupt(this.nodePath(e)),{})}pushReport(e,t){return this.request("POST",r.nodeReports(this.nodePath(e)),t)}submitResult(e,t){return this.request("POST",r.nodeResult(this.nodePath(e)),t)}forkNode(e){return this.request("POST",r.nodeFork(this.nodePath(e)),{})}reviveNode(e,t){return this.request("POST",r.nodeRevive(this.nodePath(e)),t??{})}relaunchRoot(e){return this.request("POST",r.nodeRelaunchRoot(this.nodePath(e)),{})}bindBrokerSession(e,t){return this.request("POST",r.nodeBrokerSessionBound(this.nodePath(e)),t)}settleBroker(e,t){return this.request("POST",r.nodeBrokerSettle(this.nodePath(e)),t)}completeBrokerPark(e,t){return this.request("POST",r.nodeBrokerParkComplete(this.nodePath(e)),t)}recordBrokerParkActivity(e,t){return this.request("POST",r.nodeBrokerParkActivity(this.nodePath(e)),t)}async recordBrokerTelemetry(e,t){await this.request("POST",r.nodeBrokerTelemetry(this.nodePath(e)),t)}claimNodeMail(e,t){return this.request("POST",r.nodeMailClaim(this.nodePath(e)),t)}acknowledgeNodeMail(e,t){return this.request("POST",r.nodeMailAcknowledge(this.nodePath(e)),t)}recordBrokerTurn(e,t){return this.request("POST",r.brokerTurn(this.nodePath(e)),t)}mutateBrokerProviderRetry(e,t){return this.request("POST",r.brokerProviderRetry(this.nodePath(e)),t)}mutateBrokerFault(e,t){return this.request("POST",r.brokerFault(this.nodePath(e)),t)}getBrokerRecovery(e,t){return this.request("GET",`${r.brokerRecovery(this.nodePath(e))}?expected_execution_id=${encodeURIComponent(t)}`)}recordNodeFault(e,t){return this.request("POST",r.nodeFault(this.nodePath(e)),t)}clearNodeFault(e,t={}){const s=new URLSearchParams;t.link!==void 0&&s.set("link",t.link),t.preserve_episode!==void 0&&s.set("preserve_episode",String(t.preserve_episode));const i=s.size===0?"":`?${s.toString()}`;return this.request("DELETE",`${r.nodeFault(this.nodePath(e))}${i}`)}commitBrokerModel(e,t){return this.request("POST",r.nodeBrokerModel(this.nodePath(e)),t)}brokerExtensionState(e){return this.request("GET",r.nodeBrokerExtensionState(this.nodePath(e)))}brokerContext(e,t){return this.request("POST",r.nodeBrokerContext(this.nodePath(e)),t)}brokerMemoryRefs(e,t){return this.request("POST",r.nodeBrokerMemoryRefs(this.nodePath(e)),{expected_execution_id:t})}commitBrokerContext(e,t){return this.request("POST",r.nodeBrokerContextCommit(this.nodePath(e)),t)}brokerContextEvent(e,t){return this.request("POST",r.nodeBrokerContextEvent(this.nodePath(e)),t)}commitBrokerGeneratedName(e,t){return this.request("POST",r.nodeBrokerGeneratedName(this.nodePath(e)),t)}commitBrokerPersonaAck(e,t){return this.request("POST",r.nodeBrokerPersonaAck(this.nodePath(e)),t)}closeNode(e,t){return this.request("POST",r.nodeClose(this.nodePath(e)),t??{})}recycleNode(e){return this.request("POST",r.nodeRecycle(this.nodePath(e)),{})}demoteNode(e){return this.request("POST",r.nodeDemote(this.nodePath(e)),{})}promoteNode(e,t){return this.request("POST",r.nodePromote(this.nodePath(e)),t)}yieldNode(e,t){return this.request("POST",r.nodeYield(this.nodePath(e)),t)}waitNode(e,t){return this.request("POST",r.nodeWait(this.nodePath(e)),t)}listKinds(){return this.request("GET",r.kinds())}patchConfig(e,t){return this.request("PATCH",r.nodeConfig(this.nodePath(e)),t,t.model!==void 0?{timeout:45e3+this.timeoutMs}:void 0)}closeWorktree(e){return this.request("POST",r.nodeWorktreeClose(this.nodePath(e)),{})}abandonWorktree(e,t){return this.request("POST",r.nodeWorktreeAbandon(this.nodePath(e)),t)}listQuarantinedWorktrees(){return this.request("GET",r.quarantinedWorktrees())}listSpaces(){return this.request("GET",r.spaces())}subscribe(e,t){return this.request("POST",r.nodeSubscriptions(this.nodePath(e)),t)}listFocuses(){return this.request("GET",r.focuses())}focusOf(e){return this.request("GET",o(r.focusByNode(),{node_id:e}))}focusByPane(e){return this.request("GET",o(r.focusByPane(),{pane:e}))}registerFocus(e){return this.request("POST",r.focuses(),e)}async setFocusPane(e,t){await this.request("PATCH",r.focus(e),t)}async closeFocus(e){await this.request("DELETE",r.focus(e))}async unsubscribe(e,t){await this.request("DELETE",r.nodeSubscription(this.nodePath(e),this.nodePath(t)))}armCron(e){return this.request("POST",r.crons(),e)}listCrons(e){return this.request("GET",o(r.crons(),e))}showCron(e,t){return this.request("GET",o(r.cron(this.cronPath(e)),t))}pauseCron(e,t){return this.request("POST",o(r.cronPause(this.cronPath(e)),t),{})}resumeCron(e,t){return this.request("POST",o(r.cronResume(this.cronPath(e)),t),{})}runCron(e,t){return this.request("POST",o(r.cronRun(this.cronPath(e)),t),{})}async cancelCron(e,t){await this.request("DELETE",o(r.cron(this.cronPath(e)),t))}pokeCrons(){return this.request("POST",r.cronsPoke(),{})}ensureAttach(e,t){return this.request("POST",r.nodeAttach(this.nodePath(e)),t??{})}getReports(e,t){return this.request("GET",o(r.nodeReports(this.nodePath(e)),t))}getTranscript(e,t){return this.request("GET",o(r.nodeTranscript(this.nodePath(e)),t))}getSnapshot(e){return this.request("GET",r.nodeSnapshot(this.nodePath(e)))}nodeSubject(e){return this.request("GET",r.nodeSubject(this.nodePath(e)))}getNodeMessages(e,t){return this.request("GET",o(r.nodeMessages(this.nodePath(e)),t))}getSession(e){return this.request("GET",r.nodeSession(this.nodePath(e)))}getChatInventory(e){return this.request("GET",r.nodeChatInventory(this.nodePath(e)))}getProspectiveChatInventory(e){return this.request("GET",o(r.prospectiveChatInventory(),e))}getArtifacts(e,t){return this.request("GET",o(r.nodeArtifacts(this.nodePath(e)),t))}getContext(e){return this.request("GET",r.nodeContext(this.nodePath(e)))}peekFile(e,t,s){return this.request("GET",o(r.filePeek(),{path:e,encoding:t}),void 0,s)}writeFile(e,t,s,i){return this.request("POST",r.fileWrite(),{path:e,content:t,encoding:s},i)}listFiles(e,t,s){return this.request("GET",o(r.fileList(),{path:e,limit:t}),void 0,s)}runBash(e,t){return this.request("POST",r.bash(),e,t)}getMemoryOriginConversation(e){return this.request("GET",o(r.memoryOrigin(),{conversation_id:e}))}resolveMemoryDoc(e,t={}){return this.request("GET",o(r.memoryResolve(),{name:e,...t}))}listMemoryDocs(e){return this.request("GET",o(r.memoryDocs(),e))}getMemoryDoc(e,t){return this.request("GET",o(r.memoryDoc(e),t))}createMemoryDoc(e){return this.request("POST",r.memoryDocs(),e)}updateMemoryDoc(e,t){return this.request("PATCH",r.memoryDoc(e),t)}deleteMemoryDoc(e,t){return this.request("DELETE",o(r.memoryDoc(e),t))}moveMemoryDoc(e,t){return this.request("POST",r.memoryDocMove(e),t)}searchMemoryDocs(e){return this.request("POST",r.memorySearch(),e)}getMemoryHistory(e,t){return this.request("GET",o(r.memoryDocHistory(e),t))}ensureProfile(e,t){return this.request("PUT",r.profile(e),t??{})}createProfile(e){return this.request("POST",r.profiles(),e)}listProfiles(){return this.request("GET",r.profiles())}updateProfile(e,t){return this.request("PATCH",r.profile(e),t)}listProfileEnv(e){return this.request("GET",r.profileEnv(e))}setProfileEnv(e,t,s){return this.request("PUT",r.profileEnvVar(e,t),{value:s})}removeProfileEnv(e,t){return this.request("DELETE",r.profileEnvVar(e,t))}getProfile(e){return this.request("GET",r.profile(e))}pauseProfile(e){return this.request("POST",r.profilePause(e),{})}resumeProfile(e){return this.request("POST",r.profileResume(e),{})}updateProfileMetadata(e,t){return this.request("PATCH",r.profileMetadata(e),t)}deleteProfile(e,t){return this.request("DELETE",r.profile(e),t)}listModelAuth(){return this.request("GET",r.modelAuths())}getModelAuthReadiness(e){return this.request("GET",o(r.modelAuthReadiness(),e))}installCredential(e,t){return this.request("PUT",r.modelAuth(e),t)}removeCredential(e){return this.request("DELETE",r.modelAuth(e))}startModelAuth(e){return this.request("POST",r.modelAuthFlows(),e,{timeout:3e4+this.timeoutMs})}completeModelAuth(e,t){return this.request("POST",r.modelAuthFlowComplete(e),t,{timeout:35e3+this.timeoutMs})}cancelModelAuth(e){return this.request("POST",r.modelAuthFlowCancel(e),{})}getModelAuthFlow(e,t){return this.request("GET",o(r.modelAuthFlow(e),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}createReview(e){return this.request("POST",r.humanReviews(),e)}listReviews(e){return this.request("GET",o(r.humanReviews(),e))}getReview(e){return this.request("GET",r.humanReview(this.reviewPath(e)))}submitReview(e){return this.request("POST",r.humanReviewSubmit(this.reviewPath(e)),{})}cancelReview(e,t={}){return this.request("POST",r.humanReviewCancel(this.reviewPath(e)),t)}getReviewDocumentBase(e){return this.request("GET",r.humanReviewDocument(this.reviewPath(e)))}createReviewComment(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("POST",r.humanReviewComments(s),t)}listReviewComments(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("GET",o(r.humanReviewComments(s),t))}readReviewCommentEvents(e,t){return this.request("GET",o(r.humanReviewCommentEvents(this.reviewPath(e)),t))}updateReviewCommentRanges(e,t){return this.request("POST",r.humanReviewCommentRanges(this.reviewPath(e)),t)}getReviewComment(e){return this.request("GET",r.humanComment(this.commentPath(e)))}editReviewComment(e,t){return this.request("POST",r.humanCommentEdit(this.commentPath(e)),t)}resolveReviewComment(e,t={}){return this.request("POST",r.humanCommentResolve(this.commentPath(e)),t)}reopenReviewComment(e,t={}){return this.request("POST",r.humanCommentReopen(this.commentPath(e)),t)}deleteReviewComment(e,t={}){return this.request("POST",r.humanCommentDelete(this.commentPath(e)),t)}forkReviewComment(e){return this.request("POST",r.humanCommentFork(this.commentPath(e)),{})}listHumanInbox(){return this.request("GET",r.humanInbox())}getHumanInboxPage(e){return this.request("GET",r.humanInboxTicket(this.ticketId(e)))}getInboxHistory(e){if(e===void 0)return this.request("GET",r.humanInbox()+"/history");if(typeof e!="string"||e==="")throw new TypeError(`invalid node id: ${JSON.stringify(e)}`);return this.request("GET",o(r.humanInbox()+"/history",{node_id:e}))}respondHumanInboxPage(e,t){return this.request("POST",r.humanInboxRespond(this.ticketId(e)),t)}postInboxProgress(e,t){return this.request("POST",r.humanInboxProgress(this.ticketId(e)),{responses:t})}getInboxResponse(e){return this.request("GET",r.humanInboxResponse(this.ticketId(e)))}cancelHumanInboxTicket(e,t){return this.request("POST",r.humanInboxCancel(this.ticketId(e)),t??{})}createHumanRequest(e){return this.request("POST",r.humanRequests(),e)}listPageComponents(){return this.request("GET",r.humanComponents())}getHumanRequest(e){return this.request("GET",r.humanRequest(this.requestPath(e)))}replaceHumanRequest(e,t){return this.request("POST",r.humanRequestReplace(this.requestPath(e)),t)}respondHumanRequest(e,t){return this.request("POST",r.humanRequestRespond(this.requestPath(e)),t)}dismissHumanRequest(e,t={}){return this.request("POST",r.humanRequestDismiss(this.requestPath(e)),t)}cancelHumanRequest(e,t={}){return this.request("POST",r.humanRequestCancel(this.requestPath(e)),t)}resolvePageFeedbackComment(e,t,s){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(t))throw new TypeError(`invalid feedback comment id: ${JSON.stringify(t)}`);return this.request("POST",r.humanInboxFeedbackResolve(this.ticketId(e),t),{node_id:s})}async dashboard(e){const t=e?.under!==void 0?{under:e.under}:void 0,[s,i]=await Promise.all([this.listNodes(t),this.status()]);return{nodes:s,counts:i.node_counts,generated_at:new Date().toISOString()}}attention(){return this.request("GET",r.canvasAttention())}attentionCounts(e){const t={node_ids:e};return this.request("POST",r.canvasAttentionCounts(),t)}historySearch(e){return this.request("POST",r.canvasHistorySearch(),e)}historyGrep(e){return this.request("POST",r.canvasHistoryGrep(),e)}historyRead(e){return this.request("GET",o(r.canvasHistoryRead(),e))}historyStats(e){return this.request("POST",r.canvasHistoryStats(),e)}canvasSnapshot(){return this.request("GET",r.canvasSnapshot())}analytics(e){return this.request("GET",o(r.canvasAnalytics(),e),void 0,{timeout:6e4})}async recordMemoryReads(e,t){await this.request("POST",r.nodeMemoryReads(this.nodePath(e)),t)}canvasRoster(){return this.request("GET",r.canvasRoster())}canvasGraph(){return this.request("GET",r.canvasGraph())}prune(e){return this.request("POST",r.canvasPrune(),e)}async request(e,t,s,i){try{return await p(await this.send(e,t,s,i))}catch(a){throw T(a,i?.signal)}}async send(e,t,s,i={}){const a=e==="GET"||e==="HEAD"||e==="DELETE",P=i.maxRetries??this.maxRetries;for(let l=0;;l++){let u;try{u=await this.transport(e,t,s,i)}catch(c){if(this.isColdSocketError(c))try{await this.handleColdSocket(c),u=await this.transport(e,t,s,i)}catch(m){throw T(m,i.signal)}else{if(this.isInterruptedSocketError(c)&&this.localSocketTransport&&(!a||l<P))return await this.rideOutInterruptedRequest(e,t,s,i);if(a&&l<P&&!N(c,i.signal)&&(!this.localSocketTransport||!this.isInterruptedSocketError(c))){await w(O(l+1));continue}else throw T(c,i.signal)}}if(a&&l<P&&x(u.status)){await v(u),await w(O(l+1));continue}return u}}nodePath(e){if(!E(e))throw new h(400,"invalid_node_id",`invalid node id: ${JSON.stringify(e)}`);return e}jobPath(e){if(!R(e))throw new h(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(e)}`);return e}cronPath(e){if(!k(e))throw new h(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(e)}`);return e}requestPath(e){if(!E(e))throw new h(400,"invalid_request_id",`invalid request id: ${JSON.stringify(e)}`);return e}ticketId(e){if(!/^[a-f0-9]{64}$/.test(e))throw new TypeError(`invalid inbox ticket id: ${JSON.stringify(e)}`);return e}reviewPath(e){if(!E(e))throw new h(400,"invalid_review_id",`invalid review id: ${JSON.stringify(e)}`);return e}commentPath(e){if(!/^[a-f0-9]{32}$/.test(e))throw new h(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(e)}`);return e}transport(e,t,s,i={}){const a=s===void 0?void 0:JSON.stringify(s),P={accept:"application/json",...this.headers,...i.headers};a!==void 0&&(P["content-type"]="application/json");const l=i.timeout??this.timeoutMs,u=new AbortController,c=l>0?setTimeout(()=>u.abort(new DOMException("request timed out","TimeoutError")),l):void 0,m=i.signal,f=d(()=>u.abort(m?.reason),"onExternalAbort");m!==void 0&&(m.aborted?u.abort(m.reason):m.addEventListener("abort",f,{once:!0}));const y=d(()=>{c!==void 0&&clearTimeout(c),m?.removeEventListener("abort",f)},"finish");return this.fetch(new URL(t,this.baseUrl),{method:e,headers:P,body:a,signal:u.signal}).then(q=>this.retainRequestLifetime(q,y,()=>u.signal.aborted?u.signal.reason:void 0),q=>{throw y(),q})}retainRequestLifetime(e,t,s){if(e.body===null)return t(),e;const i=e.body.getReader();let a=!1;const P=d(()=>{a||(a=!0,t())},"close"),l=new ReadableStream({async pull(u){try{const{done:c,value:m}=await i.read();c?(P(),u.close()):u.enqueue(m)}catch(c){P(),u.error(s()??c)}},async cancel(u){P(),await i.cancel(u)}});return new Response(l,{status:e.status,statusText:e.statusText,headers:e.headers})}isColdSocketError(e){const t=S(e);return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"}isInterruptedSocketError(e){const t=S(e);return t==="ECONNRESET"||t==="EPIPE"}async rideOutInterruptedRequest(e,t,s,i={}){try{await this.awaitAvailability()}catch(a){throw T(a,i.signal)}if(e!=="GET"&&e!=="HEAD")throw new h(503,"daemon_request_interrupted",`crtrd connection ended before this ${e} response; the request may or may not have been applied.`);try{return await this.transport(e,t,s,i)}catch(a){throw T(a,i.signal)}}async awaitAvailability(e){await _({windowMs:this.coldStartPollWindowMs,initialError:e,probe:d(async t=>{const s=await this.transport("GET",r.healthz(),void 0,{timeout:t});if(s.status>=200&&s.status<300){await v(s);return}const i=await s.text();try{if(typeof JSON.parse(i).startup_blocked=="string")return}catch{}throw new h(s.status,"daemon_health_unavailable",`crtrd health check returned HTTP ${s.status}: ${i.slice(0,500)}`)},"probe")})}async handleColdSocket(e){const t=this.autostart&&this.onColdSocket!==void 0&&!this.coldStartAttempted;t&&(this.coldStartAttempted=!0,await this.onColdSocket());try{await this.awaitAvailability(e)}catch(s){if(t){const i=A(this.coldStartDiagnostic);if(i!==void 0){const a=T(s);throw new h(a.status,a.code,`${a.message}
|
|
2
|
-
${i}`)}}throw s}}}function o(n,e){if(e===void 0)return n;const t=new URLSearchParams;for(const[i,
|
|
1
|
+
var b=Object.defineProperty;var a=(n,e)=>b(n,"name",{value:e,configurable:!0});import{ApiError as d,isErrorBody as g}from"./errors.js";import{routes as r}from"./routes.js";import{isSafeNodeId as E}from"./dto/common.js";import{isSafeBashJobId as R}from"./dto/bash-jobs.js";import{isSafeCronId as k}from"./dto/crons.js";const C=3e4,G=Symbol.for("@north-light/crouter-api/local-socket-fetch"),N=1e4,_=200;async function A({windowMs:n,probe:e,initialError:t,pollIntervalMs:s=_,retry:i=a(()=>!0,"retry"),now:u=Date.now,sleep:P=w}){const l=u()+n;let h=t;for(;;){const c=l-u();if(c<=0)throw h??new Error("crtrd availability window expired without a probe failure");try{await e(c);return}catch(f){if(h=f,!i(f))throw f}const m=l-u();if(m<=0)throw h;await P(Math.min(s,m))}}a(A,"waitForDaemonAvailability");class U{static{a(this,"CrtrClient")}baseUrl;fetch;headers;autostart;timeoutMs;maxRetries;localSocketTransport;onColdSocket;coldStartDiagnostic;coldStartPollWindowMs;coldStartAttempted=!1;constructor(e){if(e.baseUrl==="")throw new TypeError("CrtrClient requires baseUrl");this.baseUrl=new URL(e.baseUrl),this.fetch=e.fetch??globalThis.fetch,this.headers={...e.headers},this.autostart=e.autostart??!1,this.timeoutMs=e.timeoutMs??C,this.maxRetries=e.maxRetries??2,this.localSocketTransport=this.fetch[G]===!0,e.onColdSocket!==void 0&&(this.onColdSocket=e.onColdSocket),e.coldStartDiagnostic!==void 0&&(this.coldStartDiagnostic=e.coldStartDiagnostic),this.coldStartPollWindowMs=e.coldStartPollWindowMs??N}healthz(){return this.request("GET",r.healthz())}async probeHealthz(e){const t=await this.transport("GET",r.healthz(),void 0,{timeout:e});if(t.status===503)try{const s=await t.clone().json();if(typeof s.startup_blocked=="string")return s}catch{}return v(t)}status(){return this.request("GET",r.status())}restartDaemon(){return this.request("POST",r.daemonRestart())}admitDaemon(){return this.request("POST",r.daemonAdmit())}migrateState(e){return this.request("POST",r.daemonMigrate(),e)}appendNodeLog(e,t){return this.request("POST",r.nodeLog(this.nodePath(e)),t)}async putNodeTelemetry(e,t){await this.request("PUT",r.nodeTelemetry(this.nodePath(e)),t)}async putNodeRecap(e,t){await this.request("PUT",r.nodeRecap(this.nodePath(e)),t)}readNodeInboxReport(e,t,s){return this.request("GET",o(r.nodeInboxReport(this.nodePath(e)),{ref:t,execution_id:s}))}readNodePassiveMessage(e,t){return this.request("GET",o(r.nodePassiveMessage(this.nodePath(e)),{ref:t}))}nodePushedFinal(e,t){return this.request("POST",r.nodePushedFinal(this.nodePath(e)),t)}createNode(e){return this.request("POST",r.nodes(),e)}listNodes(e){return this.request("GET",o(r.nodes(),e))}getNode(e){return this.request("GET",r.node(this.nodePath(e)))}getNodeOutcome(e,{waitSeconds:t}={}){if(t!==void 0&&(!Number.isInteger(t)||t<0||t>25))throw new RangeError("waitSeconds must be an integer between 0 and 25");return this.request("GET",o(r.nodeOutcome(this.nodePath(e)),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}getNodeEvents(e,t={},s={}){if(t.after!==void 0&&(!Number.isSafeInteger(t.after)||t.after<0))throw new RangeError("after must be a non-negative safe integer");return this.transport("GET",o(r.nodeEvents(this.nodePath(e)),t),void 0,{...s,headers:{accept:"text/event-stream",...s.headers??{}},timeout:0})}registerOutcomeDelivery(e,t){return this.request("PUT",r.nodeOutcomeDelivery(this.nodePath(e)),t)}getOutcomeDelivery(e){return this.request("GET",r.nodeOutcomeDelivery(this.nodePath(e)))}async disarmOutcomeDelivery(e){await this.request("DELETE",r.nodeOutcomeDelivery(this.nodePath(e)))}listBashJobs(e){return this.request("GET",r.nodeJobs(this.nodePath(e)))}stopBashJob(e,t){return this.request("DELETE",r.nodeJob(this.nodePath(e),this.jobPath(t)))}sendMessage(e,t){return this.request("POST",r.nodeMessages(this.nodePath(e)),t)}interruptNode(e){return this.request("POST",r.nodeInterrupt(this.nodePath(e)),{})}pushReport(e,t){return this.request("POST",r.nodeReports(this.nodePath(e)),t)}submitResult(e,t){return this.request("POST",r.nodeResult(this.nodePath(e)),t)}forkNode(e){return this.request("POST",r.nodeFork(this.nodePath(e)),{})}reviveNode(e,t){return this.request("POST",r.nodeRevive(this.nodePath(e)),t??{})}relaunchRoot(e){return this.request("POST",r.nodeRelaunchRoot(this.nodePath(e)),{})}bindBrokerSession(e,t){return this.request("POST",r.nodeBrokerSessionBound(this.nodePath(e)),t)}settleBroker(e,t){return this.request("POST",r.nodeBrokerSettle(this.nodePath(e)),t)}completeBrokerPark(e,t){return this.request("POST",r.nodeBrokerParkComplete(this.nodePath(e)),t)}recordBrokerParkActivity(e,t){return this.request("POST",r.nodeBrokerParkActivity(this.nodePath(e)),t)}async recordBrokerTelemetry(e,t){await this.request("POST",r.nodeBrokerTelemetry(this.nodePath(e)),t)}claimNodeMail(e,t){return this.request("POST",r.nodeMailClaim(this.nodePath(e)),t)}acknowledgeNodeMail(e,t){return this.request("POST",r.nodeMailAcknowledge(this.nodePath(e)),t)}recordBrokerTurn(e,t){return this.request("POST",r.brokerTurn(this.nodePath(e)),t)}mutateBrokerProviderRetry(e,t){return this.request("POST",r.brokerProviderRetry(this.nodePath(e)),t)}mutateBrokerFault(e,t){return this.request("POST",r.brokerFault(this.nodePath(e)),t)}getBrokerRecovery(e,t){return this.request("GET",`${r.brokerRecovery(this.nodePath(e))}?expected_execution_id=${encodeURIComponent(t)}`)}recordNodeFault(e,t){return this.request("POST",r.nodeFault(this.nodePath(e)),t)}clearNodeFault(e,t={}){const s=new URLSearchParams;t.link!==void 0&&s.set("link",t.link),t.preserve_episode!==void 0&&s.set("preserve_episode",String(t.preserve_episode));const i=s.size===0?"":`?${s.toString()}`;return this.request("DELETE",`${r.nodeFault(this.nodePath(e))}${i}`)}commitBrokerModel(e,t){return this.request("POST",r.nodeBrokerModel(this.nodePath(e)),t)}brokerExtensionState(e){return this.request("GET",r.nodeBrokerExtensionState(this.nodePath(e)))}commitBrokerGeneratedName(e,t){return this.request("POST",r.nodeBrokerGeneratedName(this.nodePath(e)),t)}commitBrokerPersonaAck(e,t){return this.request("POST",r.nodeBrokerPersonaAck(this.nodePath(e)),t)}closeNode(e,t){return this.request("POST",r.nodeClose(this.nodePath(e)),t??{})}recycleNode(e){return this.request("POST",r.nodeRecycle(this.nodePath(e)),{})}demoteNode(e){return this.request("POST",r.nodeDemote(this.nodePath(e)),{})}promoteNode(e,t){return this.request("POST",r.nodePromote(this.nodePath(e)),t)}yieldNode(e,t){return this.request("POST",r.nodeYield(this.nodePath(e)),t)}waitNode(e,t){return this.request("POST",r.nodeWait(this.nodePath(e)),t)}listKinds(){return this.request("GET",r.kinds())}patchConfig(e,t){return this.request("PATCH",r.nodeConfig(this.nodePath(e)),t,t.model!==void 0?{timeout:45e3+this.timeoutMs}:void 0)}closeWorktree(e){return this.request("POST",r.nodeWorktreeClose(this.nodePath(e)),{})}abandonWorktree(e,t){return this.request("POST",r.nodeWorktreeAbandon(this.nodePath(e)),t)}listQuarantinedWorktrees(){return this.request("GET",r.quarantinedWorktrees())}listSpaces(){return this.request("GET",r.spaces())}subscribe(e,t){return this.request("POST",r.nodeSubscriptions(this.nodePath(e)),t)}listFocuses(){return this.request("GET",r.focuses())}focusOf(e){return this.request("GET",o(r.focusByNode(),{node_id:e}))}focusByPane(e){return this.request("GET",o(r.focusByPane(),{pane:e}))}registerFocus(e){return this.request("POST",r.focuses(),e)}async setFocusPane(e,t){await this.request("PATCH",r.focus(e),t)}async closeFocus(e){await this.request("DELETE",r.focus(e))}async unsubscribe(e,t){await this.request("DELETE",r.nodeSubscription(this.nodePath(e),this.nodePath(t)))}armCron(e){return this.request("POST",r.crons(),e)}listCrons(e){return this.request("GET",o(r.crons(),e))}showCron(e,t){return this.request("GET",o(r.cron(this.cronPath(e)),t))}pauseCron(e,t){return this.request("POST",o(r.cronPause(this.cronPath(e)),t),{})}resumeCron(e,t){return this.request("POST",o(r.cronResume(this.cronPath(e)),t),{})}runCron(e,t){return this.request("POST",o(r.cronRun(this.cronPath(e)),t),{})}async cancelCron(e,t){await this.request("DELETE",o(r.cron(this.cronPath(e)),t))}pokeCrons(){return this.request("POST",r.cronsPoke(),{})}ensureAttach(e,t){return this.request("POST",r.nodeAttach(this.nodePath(e)),t??{})}getReports(e,t){return this.request("GET",o(r.nodeReports(this.nodePath(e)),t))}getTranscript(e,t){return this.request("GET",o(r.nodeTranscript(this.nodePath(e)),t))}getSnapshot(e){return this.request("GET",r.nodeSnapshot(this.nodePath(e)))}nodeSubject(e){return this.request("GET",r.nodeSubject(this.nodePath(e)))}getNodeMessages(e,t){return this.request("GET",o(r.nodeMessages(this.nodePath(e)),t))}getSession(e){return this.request("GET",r.nodeSession(this.nodePath(e)))}getChatInventory(e){return this.request("GET",r.nodeChatInventory(this.nodePath(e)))}getProspectiveChatInventory(e){return this.request("GET",o(r.prospectiveChatInventory(),e))}getContext(e){return this.request("GET",r.nodeContext(this.nodePath(e)))}peekFile(e,t,s){return this.request("GET",o(r.filePeek(),{path:e,encoding:t}),void 0,s)}writeFile(e,t,s,i){return this.request("POST",r.fileWrite(),{path:e,content:t,encoding:s},i)}listFiles(e,t,s){return this.request("GET",o(r.fileList(),{path:e,limit:t}),void 0,s)}runBash(e,t){return this.request("POST",r.bash(),e,t)}objects={read:a((e,t)=>this.request("GET",o(r.object(e),t)),"read"),list:a(e=>this.request("GET",o(r.objects(),e)),"list"),search:a(e=>this.request("POST",r.objectsSearch(),e),"search"),watch:a((e,t={})=>this.request("POST",r.objectWatch(e),t),"watch"),unwatch:a((e,t)=>this.request("DELETE",o(r.objectWatch(e),t)),"unwatch"),edges:a((e,t)=>this.request("GET",o(r.objectEdges(e),t)),"edges")};docs={write:a(e=>this.request("POST",r.docs(),e),"write"),edit:a((e,t)=>this.request("PATCH",r.doc(e),t),"edit"),move:a((e,t)=>this.request("POST",r.docMove(e),t),"move"),delete:a(e=>this.request("DELETE",r.doc(e)),"delete"),history:a((e,t)=>this.request("GET",o(r.docHistory(e),t)),"history"),lint:a((e={})=>this.request("POST",r.docsLint(),e),"lint")};documents={reconcilePackages:a(()=>this.request("POST",r.documentsReconcilePackages()),"reconcilePackages")};nodeDelivery(e,t){return this.request("POST",r.nodeDelivery(this.nodePath(e)),t)}deliveryDryRun(e){return this.request("POST",r.deliveryDryRun(),e)}recordBackgroundedJob(e,t,s){return this.request("POST",r.nodeJobBackground(this.nodePath(e),this.jobPath(t)),s)}ensureProfile(e,t){return this.request("PUT",r.profile(e),t??{})}createProfile(e){return this.request("POST",r.profiles(),e)}listProfiles(){return this.request("GET",r.profiles())}updateProfile(e,t){return this.request("PATCH",r.profile(e),t)}listProfileEnv(e){return this.request("GET",r.profileEnv(e))}setProfileEnv(e,t,s){return this.request("PUT",r.profileEnvVar(e,t),{value:s})}removeProfileEnv(e,t){return this.request("DELETE",r.profileEnvVar(e,t))}getProfile(e){return this.request("GET",r.profile(e))}pauseProfile(e){return this.request("POST",r.profilePause(e),{})}resumeProfile(e){return this.request("POST",r.profileResume(e),{})}updateProfileMetadata(e,t){return this.request("PATCH",r.profileMetadata(e),t)}deleteProfile(e,t){return this.request("DELETE",r.profile(e),t)}listModelAuth(){return this.request("GET",r.modelAuths())}getModelAuthReadiness(e){return this.request("GET",o(r.modelAuthReadiness(),e))}installCredential(e,t){return this.request("PUT",r.modelAuth(e),t)}removeCredential(e){return this.request("DELETE",r.modelAuth(e))}startModelAuth(e){return this.request("POST",r.modelAuthFlows(),e,{timeout:3e4+this.timeoutMs})}completeModelAuth(e,t){return this.request("POST",r.modelAuthFlowComplete(e),t,{timeout:35e3+this.timeoutMs})}cancelModelAuth(e){return this.request("POST",r.modelAuthFlowCancel(e),{})}getModelAuthFlow(e,t){return this.request("GET",o(r.modelAuthFlow(e),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}createReview(e){return this.request("POST",r.humanReviews(),e)}listReviews(e){return this.request("GET",o(r.humanReviews(),e))}getReview(e){return this.request("GET",r.humanReview(this.reviewPath(e)))}submitReview(e){return this.request("POST",r.humanReviewSubmit(this.reviewPath(e)),{})}cancelReview(e,t={}){return this.request("POST",r.humanReviewCancel(this.reviewPath(e)),t)}getReviewDocumentBase(e){return this.request("GET",r.humanReviewDocument(this.reviewPath(e)))}createReviewComment(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("POST",r.humanReviewComments(s),t)}listReviewComments(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("GET",o(r.humanReviewComments(s),t))}readReviewCommentEvents(e,t){return this.request("GET",o(r.humanReviewCommentEvents(this.reviewPath(e)),t))}updateReviewCommentRanges(e,t){return this.request("POST",r.humanReviewCommentRanges(this.reviewPath(e)),t)}getReviewComment(e){return this.request("GET",r.humanComment(this.commentPath(e)))}editReviewComment(e,t){return this.request("POST",r.humanCommentEdit(this.commentPath(e)),t)}resolveReviewComment(e,t={}){return this.request("POST",r.humanCommentResolve(this.commentPath(e)),t)}reopenReviewComment(e,t={}){return this.request("POST",r.humanCommentReopen(this.commentPath(e)),t)}deleteReviewComment(e,t={}){return this.request("POST",r.humanCommentDelete(this.commentPath(e)),t)}forkReviewComment(e){return this.request("POST",r.humanCommentFork(this.commentPath(e)),{})}listHumanInbox(){return this.request("GET",r.humanInbox())}getHumanInboxPage(e){return this.request("GET",r.humanInboxTicket(this.ticketId(e)))}getInboxHistory(e){if(e===void 0)return this.request("GET",r.humanInbox()+"/history");if(typeof e!="string"||e==="")throw new TypeError(`invalid node id: ${JSON.stringify(e)}`);return this.request("GET",o(r.humanInbox()+"/history",{node_id:e}))}respondHumanInboxPage(e,t){return this.request("POST",r.humanInboxRespond(this.ticketId(e)),t)}postInboxProgress(e,t){return this.request("POST",r.humanInboxProgress(this.ticketId(e)),{responses:t})}getInboxResponse(e){return this.request("GET",r.humanInboxResponse(this.ticketId(e)))}cancelHumanInboxTicket(e,t){return this.request("POST",r.humanInboxCancel(this.ticketId(e)),t??{})}createHumanRequest(e){return this.request("POST",r.humanRequests(),e)}listPageComponents(){return this.request("GET",r.humanComponents())}getHumanRequest(e){return this.request("GET",r.humanRequest(this.requestPath(e)))}replaceHumanRequest(e,t){return this.request("POST",r.humanRequestReplace(this.requestPath(e)),t)}respondHumanRequest(e,t){return this.request("POST",r.humanRequestRespond(this.requestPath(e)),t)}dismissHumanRequest(e,t={}){return this.request("POST",r.humanRequestDismiss(this.requestPath(e)),t)}cancelHumanRequest(e,t={}){return this.request("POST",r.humanRequestCancel(this.requestPath(e)),t)}resolvePageFeedbackComment(e,t,s){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(t))throw new TypeError(`invalid feedback comment id: ${JSON.stringify(t)}`);return this.request("POST",r.humanInboxFeedbackResolve(this.ticketId(e),t),{node_id:s})}async dashboard(e){const t=e?.under!==void 0?{under:e.under}:void 0,[s,i]=await Promise.all([this.listNodes(t),this.status()]);return{nodes:s,counts:i.node_counts,generated_at:new Date().toISOString()}}attention(){return this.request("GET",r.canvasAttention())}attentionCounts(e){const t={node_ids:e};return this.request("POST",r.canvasAttentionCounts(),t)}historySearch(e){return this.request("POST",r.canvasHistorySearch(),e)}historyGrep(e){return this.request("POST",r.canvasHistoryGrep(),e)}historyRead(e){return this.request("GET",o(r.canvasHistoryRead(),e))}historyStats(e){return this.request("POST",r.canvasHistoryStats(),e)}canvasSnapshot(){return this.request("GET",r.canvasSnapshot())}analytics(e){return this.request("GET",o(r.canvasAnalytics(),e),void 0,{timeout:6e4})}async recordMemoryReads(e,t){await this.request("POST",r.nodeMemoryReads(this.nodePath(e)),t)}canvasRoster(){return this.request("GET",r.canvasRoster())}canvasGraph(){return this.request("GET",r.canvasGraph())}prune(e){return this.request("POST",r.canvasPrune(),e)}async request(e,t,s,i){try{return await v(await this.send(e,t,s,i))}catch(u){throw T(u,i?.signal)}}async send(e,t,s,i={}){const u=e==="GET"||e==="HEAD"||e==="DELETE",P=i.maxRetries??this.maxRetries;for(let l=0;;l++){let h;try{h=await this.transport(e,t,s,i)}catch(c){if(this.isColdSocketError(c))try{await this.handleColdSocket(c),h=await this.transport(e,t,s,i)}catch(m){throw T(m,i.signal)}else{if(this.isInterruptedSocketError(c)&&this.localSocketTransport&&(!u||l<P))return await this.rideOutInterruptedRequest(e,t,s,i);if(u&&l<P&&!D(c,i.signal)&&(!this.localSocketTransport||!this.isInterruptedSocketError(c))){await w(y(l+1));continue}else throw T(c,i.signal)}}if(u&&l<P&&M(h.status)){await O(h),await w(y(l+1));continue}return h}}nodePath(e){if(!E(e))throw new d(400,"invalid_node_id",`invalid node id: ${JSON.stringify(e)}`);return e}jobPath(e){if(!R(e))throw new d(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(e)}`);return e}cronPath(e){if(!k(e))throw new d(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(e)}`);return e}requestPath(e){if(!E(e))throw new d(400,"invalid_request_id",`invalid request id: ${JSON.stringify(e)}`);return e}ticketId(e){if(!/^[a-f0-9]{64}$/.test(e))throw new TypeError(`invalid inbox ticket id: ${JSON.stringify(e)}`);return e}reviewPath(e){if(!E(e))throw new d(400,"invalid_review_id",`invalid review id: ${JSON.stringify(e)}`);return e}commentPath(e){if(!/^[a-f0-9]{32}$/.test(e))throw new d(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(e)}`);return e}transport(e,t,s,i={}){const u=s===void 0?void 0:JSON.stringify(s),P={accept:"application/json",...this.headers,...i.headers};u!==void 0&&(P["content-type"]="application/json");const l=i.timeout??this.timeoutMs,h=new AbortController,c=l>0?setTimeout(()=>h.abort(new DOMException("request timed out","TimeoutError")),l):void 0,m=i.signal,f=a(()=>h.abort(m?.reason),"onExternalAbort");m!==void 0&&(m.aborted?h.abort(m.reason):m.addEventListener("abort",f,{once:!0}));const p=a(()=>{c!==void 0&&clearTimeout(c),m?.removeEventListener("abort",f)},"finish");return this.fetch(new URL(t,this.baseUrl),{method:e,headers:P,body:u,signal:h.signal}).then(q=>this.retainRequestLifetime(q,p,()=>h.signal.aborted?h.signal.reason:void 0),q=>{throw p(),q})}retainRequestLifetime(e,t,s){if(e.body===null)return t(),e;const i=e.body.getReader();let u=!1;const P=a(()=>{u||(u=!0,t())},"close"),l=new ReadableStream({async pull(h){try{const{done:c,value:m}=await i.read();c?(P(),h.close()):h.enqueue(m)}catch(c){P(),h.error(s()??c)}},async cancel(h){P(),await i.cancel(h)}});return new Response(l,{status:e.status,statusText:e.statusText,headers:e.headers})}isColdSocketError(e){const t=S(e);return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"}isInterruptedSocketError(e){const t=S(e);return t==="ECONNRESET"||t==="EPIPE"}async rideOutInterruptedRequest(e,t,s,i={}){try{await this.awaitAvailability()}catch(u){throw T(u,i.signal)}if(e!=="GET"&&e!=="HEAD")throw new d(503,"daemon_request_interrupted",`crtrd connection ended before this ${e} response; the request may or may not have been applied.`);try{return await this.transport(e,t,s,i)}catch(u){throw T(u,i.signal)}}async awaitAvailability(e){await A({windowMs:this.coldStartPollWindowMs,initialError:e,probe:a(async t=>{const s=await this.transport("GET",r.healthz(),void 0,{timeout:t});if(s.status>=200&&s.status<300){await O(s);return}const i=await s.text();try{if(typeof JSON.parse(i).startup_blocked=="string")return}catch{}throw new d(s.status,"daemon_health_unavailable",`crtrd health check returned HTTP ${s.status}: ${i.slice(0,500)}`)},"probe")})}async handleColdSocket(e){const t=this.autostart&&this.onColdSocket!==void 0&&!this.coldStartAttempted;t&&(this.coldStartAttempted=!0,await this.onColdSocket());try{await this.awaitAvailability(e)}catch(s){if(t){const i=x(this.coldStartDiagnostic);if(i!==void 0){const u=T(s);throw new d(u.status,u.code,`${u.message}
|
|
2
|
+
${i}`)}}throw s}}}function o(n,e){if(e===void 0)return n;const t=new URLSearchParams;for(const[i,u]of Object.entries(e))u!=null&&t.set(i,String(u));const s=t.toString();return s===""?n:`${n}?${s}`}a(o,"withQuery");async function v(n){const e=n.status>=200&&n.status<300,t=(await n.text()).trim();let s;if(t!=="")try{s=JSON.parse(t)}catch{if(e)return;throw new d(n.status,"invalid_response",t.slice(0,500),void 0,n.headers)}if(e)return s;throw g(s)?new d(n.status,s.error.code,s.error.message,s.error.details,n.headers,s.error):new d(n.status,"internal",`request failed with status ${n.status}`,void 0,n.headers)}a(v,"parse");function M(n){return n===429||n>=500}a(M,"isRetryableStatus");async function O(n){try{await n.body?.cancel()}catch{}}a(O,"drainResponseBody");function y(n){return Math.min(2e3,250*2**(n-1))}a(y,"retryDelayMs");function S(n){if(typeof n!="object"||n===null)return;const e=n.code;if(typeof e=="string")return e;const t=n.cause;if(typeof t=="object"&&t!==null){const s=t.code;if(typeof s=="string")return s}}a(S,"transportErrorCode");function D(n,e){return e?.aborted?!0:n instanceof DOMException&&(n.name==="AbortError"||n.name==="TimeoutError")}a(D,"isAbortError");function T(n,e){if(e?.aborted)return new d(0,"request_aborted","request aborted by caller signal");if(n instanceof d)return n;if(n instanceof DOMException&&n.name==="TimeoutError")return new d(504,"request_timeout",`crtrd request timed out: ${n.message}`);if(n instanceof DOMException&&n.name==="AbortError")return new d(0,"request_aborted","request aborted by caller signal");const t=S(n),s=n instanceof Error?n.message:String(n);return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"?new d(503,"daemon_unavailable",`crtrd is not reachable: ${s}`):t==="ETIMEDOUT"?new d(504,"request_timeout",`crtrd request timed out: ${s}`):new d(503,"transport_error",s)}a(T,"toTransportApiError");function w(n){return new Promise(e=>setTimeout(e,n))}a(w,"sleepMs");function x(n){if(n!==void 0)try{return n()}catch{return}}a(x,"safeColdStartDiagnostic");export{U as CrtrClient,x as safeColdStartDiagnostic,A as waitForDaemonAvailability};
|
|
@@ -133,42 +133,8 @@ export interface BrokerExtensionStateDTO {
|
|
|
133
133
|
fork_source: BrokerExtensionNodeDTO | null;
|
|
134
134
|
subject: BrokerExtensionSubjectDTO;
|
|
135
135
|
report_nodes: BrokerReportNodeDTO[];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
export interface BrokerContextSnapshotDTO {
|
|
139
|
-
preferenceSnapshot: string | null;
|
|
140
|
-
exposures: Record<string, {
|
|
141
|
-
system?: number;
|
|
142
|
-
transcript?: number;
|
|
143
|
-
}>;
|
|
144
|
-
}
|
|
145
|
-
export interface BrokerContextRequest extends BrokerExecutionRequest {
|
|
146
|
-
mode: 'baseline' | 'compact' | 'preferences';
|
|
147
|
-
}
|
|
148
|
-
/** One full document body that entered the context: a `loaded` memory-log event. */
|
|
149
|
-
export interface BrokerContextLoadDTO {
|
|
150
|
-
name: string;
|
|
151
|
-
scope: string;
|
|
152
|
-
}
|
|
153
|
-
export interface BrokerContextDTO {
|
|
154
|
-
content: string;
|
|
155
|
-
compact: boolean;
|
|
156
|
-
snapshot: BrokerContextSnapshotDTO;
|
|
157
|
-
/** Full bodies this preparation delivers; the broker returns them with the commit. */
|
|
158
|
-
loads: BrokerContextLoadDTO[];
|
|
159
|
-
}
|
|
160
|
-
export interface BrokerMemoryRefsDTO {
|
|
161
|
-
refs: import('../../core/runtime/broker-protocol.js').RefMeta[];
|
|
162
|
-
names: string[];
|
|
163
|
-
}
|
|
164
|
-
export interface BrokerContextCommitRequest extends BrokerExecutionRequest {
|
|
165
|
-
snapshot: BrokerContextSnapshotDTO;
|
|
166
|
-
/** The prepared `loads` once the broker has delivered them; recorded as `loaded` events. */
|
|
167
|
-
loads?: BrokerContextLoadDTO[];
|
|
168
|
-
}
|
|
169
|
-
export interface BrokerContextEventRequest extends BrokerExecutionRequest {
|
|
170
|
-
event: 'read' | 'command' | 'pre-command' | 'compact' | 'persona';
|
|
171
|
-
value?: string;
|
|
136
|
+
/** The head body of the node's `roadmap` document, or null when it has none. */
|
|
137
|
+
roadmap: string | null;
|
|
172
138
|
}
|
|
173
139
|
/** Guarded generated-label update. `initial` can only fill a blank generated
|
|
174
140
|
* description; `recap` additionally compares the exact automatic-name snapshot
|
package/dist/api/dto/canvas.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface AttentionCountsDTO {
|
|
|
37
37
|
counts: Record<NodeIdDTO, number>;
|
|
38
38
|
}
|
|
39
39
|
/** `POST /v1/canvas/history/search` body — the ranked/filtered search over the
|
|
40
|
-
* per-cwd
|
|
40
|
+
* per-cwd conversation corpus (inboxes and transcripts), backing `crtr canvas history search` (optional
|
|
41
41
|
* query: ranked when present, recency browse when omitted). The CLI parses +
|
|
42
42
|
* validates flags (`--type` set, `--since`/`--until` → epoch ms) and sends
|
|
43
43
|
* this normalized query; the server runs `buildCorpus` + ranking + pagination
|
|
@@ -52,9 +52,8 @@ export interface HistorySearchQuery {
|
|
|
52
52
|
under?: string;
|
|
53
53
|
/** Restrict to specific node ids. */
|
|
54
54
|
nodes?: string[];
|
|
55
|
-
/** Corpus types:
|
|
55
|
+
/** Corpus types: inbox | transcript. */
|
|
56
56
|
types?: string[];
|
|
57
|
-
report_kind?: string;
|
|
58
57
|
kinds?: string[];
|
|
59
58
|
statuses?: string[];
|
|
60
59
|
/** Lower bound on artifact timestamp (epoch ms), parsed CLI-side. */
|
|
@@ -87,7 +86,7 @@ export interface HistorySearchResultDTO {
|
|
|
87
86
|
total: number;
|
|
88
87
|
}
|
|
89
88
|
/** `POST /v1/canvas/history/grep` body — the required-pattern line-hit search
|
|
90
|
-
* over the per-cwd
|
|
89
|
+
* over the per-cwd conversation corpus (inboxes and transcripts), backing `crtr canvas history grep`.
|
|
91
90
|
* Shares scope/corpus filters with `HistorySearchQuery` but is a distinct
|
|
92
91
|
* wire contract: `pattern` is mandatory (an ECMAScript regex) and there is no
|
|
93
92
|
* ranking/snippet/full-body shape. */
|
|
@@ -99,9 +98,8 @@ export interface HistoryGrepQuery {
|
|
|
99
98
|
under?: string;
|
|
100
99
|
/** Restrict to specific node ids. */
|
|
101
100
|
nodes?: string[];
|
|
102
|
-
/** Corpus types:
|
|
101
|
+
/** Corpus types: inbox | transcript. */
|
|
103
102
|
types?: string[];
|
|
104
|
-
report_kind?: string;
|
|
105
103
|
kinds?: string[];
|
|
106
104
|
statuses?: string[];
|
|
107
105
|
/** Lower bound on artifact timestamp (epoch ms), parsed CLI-side. */
|
|
@@ -129,7 +127,6 @@ export interface HistoryStatsQuery {
|
|
|
129
127
|
under?: string;
|
|
130
128
|
nodes?: string[];
|
|
131
129
|
types?: string[];
|
|
132
|
-
report_kind?: string;
|
|
133
130
|
kinds?: string[];
|
|
134
131
|
statuses?: string[];
|
|
135
132
|
since_ms?: number;
|
|
@@ -168,14 +165,12 @@ export interface HistoryGrepResultDTO {
|
|
|
168
165
|
next_cursor: Cursor | null;
|
|
169
166
|
total: number;
|
|
170
167
|
}
|
|
171
|
-
/** `GET /v1/canvas/history/read` query — resolve one `<node-id
|
|
168
|
+
/** `GET /v1/canvas/history/read` query — resolve one `<node-id>:inbox/<n>`,
|
|
169
|
+
* `<node-id>:session` or `<node-id>:session/<n>` ref. */
|
|
172
170
|
export interface HistoryReadQuery {
|
|
173
171
|
ref: string;
|
|
174
|
-
/** Keep the artifact's YAML frontmatter (stripped by default). */
|
|
175
|
-
frontmatter?: boolean;
|
|
176
172
|
/** `rendered` (default) or `raw` — the verbatim bytes behind the ref: the
|
|
177
|
-
* session file for a bare `session` ref, the one jsonl line for a message
|
|
178
|
-
* the unparsed file for a report or doc. */
|
|
173
|
+
* session file for a bare `session` ref, the one jsonl line for a message. */
|
|
179
174
|
format?: string;
|
|
180
175
|
}
|
|
181
176
|
/** `GET /v1/canvas/history/read` result — one hit's full body. */
|
|
@@ -183,7 +178,7 @@ export interface HistoryReadResultDTO {
|
|
|
183
178
|
ref: string;
|
|
184
179
|
/** "name (id)". */
|
|
185
180
|
node: string;
|
|
186
|
-
/**
|
|
181
|
+
/** inbox | transcript. */
|
|
187
182
|
source: string;
|
|
188
183
|
ts: IsoTime;
|
|
189
184
|
content: string;
|
package/dist/api/dto/config.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ export interface NodeConfigPatch {
|
|
|
18
18
|
cwd?: string;
|
|
19
19
|
/** Per-run allow-list. A patch may only remove scopes; it applies to a live broker on its next revive. */
|
|
20
20
|
scopes?: string[];
|
|
21
|
+
/** The node's default listening configuration: event level ("1".."10") → delivery
|
|
22
|
+
* (`interrupt`|`steer`|`after-turn`|`next-turn`) for watches with no config of their own.
|
|
23
|
+
* `null` resets it to the global default. */
|
|
24
|
+
listen?: Record<string, 'interrupt' | 'steer' | 'after-turn' | 'next-turn'> | null;
|
|
21
25
|
}
|
|
22
26
|
/** One installed persona kind, as the daemon resolves kinds for node creation. */
|
|
23
27
|
export interface KindDTO {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type DeliveryActivity = 'boot' | 'system-prompt' | 'compact' | 'persona' | 'file-read' | 'command' | 'pre-command' | 'slash-command' | 'names'
|
|
2
|
+
/** Dry run only: a live node's workspace-open arrives inside its boot. */
|
|
3
|
+
| 'workspace-open'
|
|
4
|
+
/** Dry run only: what reading the document named by `subject` delivers alongside it. */
|
|
5
|
+
| 'document-read';
|
|
6
|
+
export interface DeliveryRequest {
|
|
7
|
+
expected_execution_id?: string;
|
|
8
|
+
activity: DeliveryActivity;
|
|
9
|
+
subject?: string;
|
|
10
|
+
inherited?: boolean;
|
|
11
|
+
dry_run?: boolean;
|
|
12
|
+
subject_override?: Partial<import('../../core/substrate/subject-fields.js').NodeConfigSubject>;
|
|
13
|
+
}
|
|
14
|
+
/** A node that does not exist, for `POST /v1/delivery/dry-run`. Unset fields
|
|
15
|
+
* come from `node` when one is named, else from defaults. */
|
|
16
|
+
export interface HypotheticalNodeDTO {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
/** Profile id or name; null for no profile. Defaults to the profile pinned to `cwd`. */
|
|
19
|
+
profile?: string | null;
|
|
20
|
+
grantee?: string;
|
|
21
|
+
kind?: string;
|
|
22
|
+
mode?: 'base' | 'orchestrator';
|
|
23
|
+
lifecycle?: 'terminal' | 'resident';
|
|
24
|
+
has_manager?: boolean;
|
|
25
|
+
depth?: number;
|
|
26
|
+
}
|
|
27
|
+
/** `POST /v1/delivery/dry-run` — a person's dry run of one delivery activity,
|
|
28
|
+
* for a live node (`node`), a node that does not exist (`hypothetical`), or a
|
|
29
|
+
* live node dialled away from (both). Writes nothing. */
|
|
30
|
+
export interface DeliveryDryRunRequest {
|
|
31
|
+
activity: DeliveryActivity;
|
|
32
|
+
subject?: string;
|
|
33
|
+
node?: string;
|
|
34
|
+
hypothetical?: HypotheticalNodeDTO;
|
|
35
|
+
subject_override?: Partial<import('../../core/substrate/subject-fields.js').NodeConfigSubject>;
|
|
36
|
+
}
|
|
37
|
+
export interface DeliveryCommandDTO {
|
|
38
|
+
name: string;
|
|
39
|
+
command_name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
canonical_body: string;
|
|
42
|
+
execution_body: string;
|
|
43
|
+
}
|
|
44
|
+
export interface DeliveryResponse {
|
|
45
|
+
content: string;
|
|
46
|
+
inherited?: boolean;
|
|
47
|
+
commands?: DeliveryCommandDTO[];
|
|
48
|
+
blocks?: string[];
|
|
49
|
+
execution_body?: string;
|
|
50
|
+
refs?: import('../../core/runtime/broker-protocol.js').RefMeta[];
|
|
51
|
+
names?: string[];
|
|
52
|
+
plan?: unknown;
|
|
53
|
+
}
|
|
54
|
+
export interface BackgroundedJobRequest {
|
|
55
|
+
command: string;
|
|
56
|
+
job_dir: string;
|
|
57
|
+
log_path: string;
|
|
58
|
+
}
|
|
59
|
+
export interface BackgroundedJobDTO {
|
|
60
|
+
id: string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { ObjectDTO, PrivacyName } from './objects.js';
|
|
2
|
+
export declare const RULE_ON: readonly ["boot", "workspace-open", "file-read", "document-read", "command", "pre-command", "slash-command"];
|
|
3
|
+
export type RuleOnName = typeof RULE_ON[number];
|
|
4
|
+
export declare const RULE_DELIVER: readonly ["name", "preview", "content"];
|
|
5
|
+
export type RuleDeliverName = typeof RULE_DELIVER[number];
|
|
6
|
+
export interface DeliveryRuleDTO {
|
|
7
|
+
on: RuleOnName;
|
|
8
|
+
match?: string[];
|
|
9
|
+
match_frontmatter?: Record<string, unknown>;
|
|
10
|
+
if?: unknown;
|
|
11
|
+
deliver: RuleDeliverName;
|
|
12
|
+
}
|
|
13
|
+
/** The `--owner` value: whose document it is. */
|
|
14
|
+
export type DocOwnerFlag = 'node' | 'user' | 'profile' | `profile:${string}` | 'app' | 'repo' | `repo:${string}`;
|
|
15
|
+
export declare const DOC_KINDS: readonly ["knowledge", "preference"];
|
|
16
|
+
export type DocKindName = typeof DOC_KINDS[number];
|
|
17
|
+
export interface DocWriteRequest {
|
|
18
|
+
name: string;
|
|
19
|
+
body: string;
|
|
20
|
+
preview: string;
|
|
21
|
+
owner?: DocOwnerFlag;
|
|
22
|
+
kind?: DocKindName;
|
|
23
|
+
summary?: string;
|
|
24
|
+
privacy?: PrivacyName;
|
|
25
|
+
rules?: DeliveryRuleDTO[];
|
|
26
|
+
why_it_exists?: string;
|
|
27
|
+
unlisted?: boolean;
|
|
28
|
+
lint_ignore?: string[];
|
|
29
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
30
|
+
/** The caller's cwd, for `--owner repo` resolution. */
|
|
31
|
+
cwd?: string;
|
|
32
|
+
}
|
|
33
|
+
/** `name` is canonical: `<owner-handle>/<name>`. */
|
|
34
|
+
/** `unresolved_links`: names that match nothing in the writer's view. `remote_links`: names whose
|
|
35
|
+
* first segment is no owner on this runtime — on another runtime, or misspelled. */
|
|
36
|
+
export interface DocLinkReportDTO {
|
|
37
|
+
unresolved_links?: string[];
|
|
38
|
+
remote_links?: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface DocWrittenDTO extends DocLinkReportDTO {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const DOC_UNSET_FIELDS: readonly ["summary", "why_it_exists", "unlisted", "lint_ignore", "extensions", "rules"];
|
|
45
|
+
export type DocUnsetField = typeof DOC_UNSET_FIELDS[number];
|
|
46
|
+
export interface DocEditRequest {
|
|
47
|
+
body?: string;
|
|
48
|
+
replace?: Array<{
|
|
49
|
+
old: string;
|
|
50
|
+
new: string;
|
|
51
|
+
}>;
|
|
52
|
+
rationale: string;
|
|
53
|
+
/** The heads key the edit was made from. Absent → the caller's last read of the document. */
|
|
54
|
+
base?: string;
|
|
55
|
+
verbatim?: boolean;
|
|
56
|
+
preview?: string;
|
|
57
|
+
summary?: string;
|
|
58
|
+
privacy?: PrivacyName;
|
|
59
|
+
rules?: DeliveryRuleDTO[];
|
|
60
|
+
why_it_exists?: string;
|
|
61
|
+
unlisted?: boolean;
|
|
62
|
+
lint_ignore?: string[];
|
|
63
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
64
|
+
unset?: DocUnsetField[];
|
|
65
|
+
}
|
|
66
|
+
export interface DocEditedDTO extends DocLinkReportDTO {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
revision: number;
|
|
70
|
+
}
|
|
71
|
+
/** Body of the 409 `stale_revision` error's `details`. */
|
|
72
|
+
export interface DocStaleDTO {
|
|
73
|
+
stale: {
|
|
74
|
+
revision: number;
|
|
75
|
+
heads_key: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface DocMoveRequest {
|
|
79
|
+
new_name?: string;
|
|
80
|
+
owner?: DocOwnerFlag;
|
|
81
|
+
cwd?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface DocMovedDTO {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
}
|
|
87
|
+
export interface DocDeletedDTO {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
}
|
|
91
|
+
export interface DocHistoryQuery {
|
|
92
|
+
diff?: number;
|
|
93
|
+
}
|
|
94
|
+
export interface DocRevisionDTO {
|
|
95
|
+
rev_id: string;
|
|
96
|
+
number: number;
|
|
97
|
+
author_id: string | null;
|
|
98
|
+
rationale: string | null;
|
|
99
|
+
verbatim: boolean;
|
|
100
|
+
created_at: string;
|
|
101
|
+
parents: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface DocHistoryDTO {
|
|
104
|
+
object: ObjectDTO;
|
|
105
|
+
revisions: DocRevisionDTO[];
|
|
106
|
+
diff?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface DocLintRequest {
|
|
109
|
+
owner?: DocOwnerFlag;
|
|
110
|
+
cwd?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface DocLintFindingDTO {
|
|
113
|
+
name: string;
|
|
114
|
+
severity: 'error' | 'warning';
|
|
115
|
+
rule: string;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
export interface DocLintDTO {
|
|
119
|
+
findings: DocLintFindingDTO[];
|
|
120
|
+
}
|
|
121
|
+
export interface ReconcilePackagesDTO {
|
|
122
|
+
created: number;
|
|
123
|
+
updated: number;
|
|
124
|
+
deleted: number;
|
|
125
|
+
/** plugins whose handle another owner holds; their documents are not on the canvas */
|
|
126
|
+
conflicts: Array<{
|
|
127
|
+
plugin: string;
|
|
128
|
+
message: string;
|
|
129
|
+
}>;
|
|
130
|
+
/** package files that are not documents (unparseable frontmatter, a name another file holds) */
|
|
131
|
+
invalid: Array<{
|
|
132
|
+
path: string;
|
|
133
|
+
error: string;
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=["boot","workspace-open","file-read","document-read","command","pre-command","slash-command"],o=["name","preview","content"],n=["knowledge","preference"],t=["summary","why_it_exists","unlisted","lint_ignore","extensions","rules"];export{n as DOC_KINDS,t as DOC_UNSET_FIELDS,o as RULE_DELIVER,e as RULE_ON};
|