@north-light/crouter 0.3.352 → 0.3.354
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 +133 -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 +167 -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 +9 -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/04-orchestration-kernel.md +7 -7
- 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/render/chat-view.js +1 -1
- 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/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/tool-calls.d.ts +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 +806 -1553
- 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 +9 -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 +160 -0
- package/dist/core/graph/documents.js +7 -0
- package/dist/core/graph/edges.d.ts +24 -0
- package/dist/core/graph/edges.js +1 -0
- package/dist/core/graph/events.d.ts +26 -0
- package/dist/core/graph/events.js +6 -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 +28 -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 +17 -9
- package/dist/core/runtime/roadmap.js +4 -4
- 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 +27 -0
- package/dist/core/substrate/delivery/listings.js +4 -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 +47 -0
- package/dist/core/substrate/delivery/render-event.js +6 -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/app-listener.js +11 -11
- 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/modelauth.d.ts +3 -0
- package/dist/daemon/api/handlers/modelauth.js +1 -1
- 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.js +1 -1
- package/dist/daemon/api/handlers/vendor-status.d.ts +8 -0
- package/dist/daemon/api/handlers/vendor-status.js +1 -0
- 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/principal.d.ts +5 -0
- package/dist/daemon/api/principal.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/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
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { type InstalledPlugin, type Scope } from '../types.js';
|
|
2
|
-
import type { ProfileProjectMemory } from '../api/dto/profiles.js';
|
|
3
|
-
import { type DocRepresentation } from './memory/identity.js';
|
|
4
|
-
/**
|
|
5
|
-
* Memory-document loading and resolution for the document substrate.
|
|
6
|
-
*
|
|
7
|
-
* Every document belongs to exactly one physical STORE. A store declares a
|
|
8
|
-
* namespace — a project's `namespace:` on its root `INDEX.md`, an installed
|
|
9
|
-
* plugin's mount prefix, or empty for user/profile/node/builtin — and every
|
|
10
|
-
* document's CANONICAL name is that namespace composed with the document's
|
|
11
|
-
* store-local name (see memory/identity.ts). The canonical name is the only
|
|
12
|
-
* address: resolution compares the normalized query with canonical identities
|
|
13
|
-
* and nothing else. There is no physical-path pass, no bare-leaf pass, no
|
|
14
|
-
* scope-prefixed spelling, and no `<dir>/INDEX` address — a trailing `INDEX`
|
|
15
|
-
* segment collapses, so a directory's own document answers at the directory
|
|
16
|
-
* name and `memory find` is the discovery surface when the name is unknown.
|
|
17
|
-
*
|
|
18
|
-
* A project store whose repository root carries no valid `namespace:` does not mount: its
|
|
19
|
-
* documents are absent from every target view, and its descriptor carries the
|
|
20
|
-
* `crtr sys migrate --dir <repository root>` remedy. Exact-store inspection
|
|
21
|
-
* (`openProjectMemoryStore` + `loadMemoryStoreView`) still loads it, which is
|
|
22
|
-
* what lint and migration diagnose an unmounted store through.
|
|
23
|
-
*
|
|
24
|
-
* Two views exist over the same loader:
|
|
25
|
-
* - a TARGET view — the ordered source stack of one cwd/profile/node
|
|
26
|
-
* (node > project stores nearest-first > profile > user > builtin, native
|
|
27
|
-
* documents before enabled-plugin documents within each source). Alternate
|
|
28
|
-
* physical stores legitimately expose the same canonical identity (a linked
|
|
29
|
-
* worktree, a generated copy), so a name yields an ordered CANDIDATE set:
|
|
30
|
-
* source order picks the address winner, every later candidate stays
|
|
31
|
-
* inspectable.
|
|
32
|
-
* - an exact STORE view — one physical project store selected by owner
|
|
33
|
-
* directory, which still requires the full canonical query.
|
|
34
|
-
*
|
|
35
|
-
* Resolution never consults a project store's profile memory ceiling
|
|
36
|
-
* (`projectMemory`); the full corpus resolves and lists regardless, and only
|
|
37
|
-
* automatic delivery clamps against it.
|
|
38
|
-
*/
|
|
39
|
-
/** The memory-only scope union: the global `Scope` (`user|project|builtin`)
|
|
40
|
-
* plus `profile` and `node`. Confined to the memory resolver/list/read/write/
|
|
41
|
-
* render paths — deliberately NOT folded into the global `Scope` union, because
|
|
42
|
-
* that would leak these into config, plugin, marketplace, and sys-config
|
|
43
|
-
* surfaces the spec does not extend. `node` is the this-node store
|
|
44
|
-
* (`nodes/<id>/context/memory/`), available only inside a running node
|
|
45
|
-
* (`CRTR_NODE_ID`), and it is the NEAREST scope — a node doc overrides a
|
|
46
|
-
* same-named doc at any wider scope. */
|
|
47
|
-
export type MemoryScope = Scope | 'profile' | 'node';
|
|
48
|
-
/** Whether a store contributes to target views.
|
|
49
|
-
* `absent` — no `memory/` dir on disk (silent, the ordinary case).
|
|
50
|
-
* `undeclared`/`invalid` — a project store the runtime refuses to mount until
|
|
51
|
-
* its namespace is declared; `diagnostic` carries the migration remedy. */
|
|
52
|
-
export type MemoryStoreMountStatus = 'ready' | 'absent' | 'undeclared' | 'invalid';
|
|
53
|
-
/** One physical memory store: where its documents live, what namespace their
|
|
54
|
-
* canonical names compose under, and whether it mounts. */
|
|
55
|
-
export interface MemoryStoreDescriptor {
|
|
56
|
-
scope: MemoryScope;
|
|
57
|
-
/** App holding a profile store; absent for legacy local profiles. */
|
|
58
|
-
ownerApp?: string;
|
|
59
|
-
profileId?: string;
|
|
60
|
-
/** Absolute path of the physical `memory/` dir. Store identity (and the
|
|
61
|
-
* dedup of one real store reached twice) uses its realpath. */
|
|
62
|
-
storeRoot: string;
|
|
63
|
-
/** The project directory containing `.crouter/`, for project stores only. */
|
|
64
|
-
ownerDir?: string;
|
|
65
|
-
/** Effective project prefix, repository-root namespace composed with the
|
|
66
|
-
* owner-relative path; installed-plugin mount prefix, or `''`. */
|
|
67
|
-
namespace: string;
|
|
68
|
-
/** The repository-root `INDEX.md` a project namespace is declared on, when
|
|
69
|
-
* association succeeds — present even for an undeclared/invalid store so
|
|
70
|
-
* lint and migration can point at it. */
|
|
71
|
-
namespacePath?: string;
|
|
72
|
-
/** Absolute realpath of the associated repository root, for project stores. */
|
|
73
|
-
repositoryRoot?: string;
|
|
74
|
-
/** Linked-worktree/non-Git grouping key, for project stores. */
|
|
75
|
-
repositoryKey?: string;
|
|
76
|
-
/** Valid namespace read from the repository-root declaration. */
|
|
77
|
-
repositoryNamespace?: string;
|
|
78
|
-
/** Canonical owner path relative to the repository root, empty at the root. */
|
|
79
|
-
ownerRelativePath?: string;
|
|
80
|
-
/** Structured cause for a project store that does not mount. */
|
|
81
|
-
mountFailure?: 'association' | 'collision' | 'undeclared-root' | 'invalid-root' | 'symlink';
|
|
82
|
-
/** The owning plugin's name for a plugin-mounted store. Plugin docs surface
|
|
83
|
-
* within a source scope but live under the plugins dir and are managed by
|
|
84
|
-
* `crtr pkg`, so consumers that mutate the store gate on this. */
|
|
85
|
-
plugin?: string;
|
|
86
|
-
mountStatus: MemoryStoreMountStatus;
|
|
87
|
-
/** Why a non-`ready` store does not mount, with its actionable remedy. */
|
|
88
|
-
diagnostic?: string;
|
|
89
|
-
/** The selected profile relationship's ceiling for this store: the maximum
|
|
90
|
-
* rung AUTOMATIC boot and workspace-open delivery may disclose it at.
|
|
91
|
-
* Neutral (`content`) for every non-project store. */
|
|
92
|
-
projectMemory: ProfileProjectMemory;
|
|
93
|
-
}
|
|
94
|
-
export interface MemoryDoc {
|
|
95
|
-
/** Canonical identity — the store's namespace composed with `localName`, and
|
|
96
|
-
* the only address resolution accepts. */
|
|
97
|
-
name: string;
|
|
98
|
-
/** Store-local identity: the explicit frontmatter `name` when present, else
|
|
99
|
-
* derived from the store-relative path with ordering prefixes stripped and
|
|
100
|
-
* one trailing `INDEX` collapsed. Empty for a store's root document. */
|
|
101
|
-
localName: string;
|
|
102
|
-
scope: MemoryScope;
|
|
103
|
-
/** Absolute path to the resolved .md file. */
|
|
104
|
-
path: string;
|
|
105
|
-
/** Absolute path of the `memory/` dir this doc loaded from — the store root
|
|
106
|
-
* its physical path is relative to. Sidecar trees that mirror the doc tree
|
|
107
|
-
* (the revision-history log) are derived from `path` relative to this. */
|
|
108
|
-
root: string;
|
|
109
|
-
/** Store-relative markdown path, kept exactly: placement, ordering, origin,
|
|
110
|
-
* and history depend on the physical form, never on segment counts of the
|
|
111
|
-
* canonical name. */
|
|
112
|
-
physicalRelativePath: string;
|
|
113
|
-
/** Which physical form owns this identity — `foo.md` or `foo/INDEX.md`. */
|
|
114
|
-
representation: DocRepresentation;
|
|
115
|
-
/** The canonical directory this doc's `./` memory-read entries match against:
|
|
116
|
-
* its own name for a directory document, its parent for a leaf. */
|
|
117
|
-
routingAnchor: string;
|
|
118
|
-
store: MemoryStoreDescriptor;
|
|
119
|
-
/** Raw, uncoerced frontmatter record (null when the doc has no frontmatter). */
|
|
120
|
-
frontmatter: Record<string, unknown> | null;
|
|
121
|
-
/** Document body, with the frontmatter block stripped. */
|
|
122
|
-
body: string;
|
|
123
|
-
plugin?: string;
|
|
124
|
-
projectMemory: ProfileProjectMemory;
|
|
125
|
-
}
|
|
126
|
-
/** Every physical document sharing one canonical identity in a view, in source
|
|
127
|
-
* order. `winner` is the address a deliberate read resolves to; automatic
|
|
128
|
-
* delivery filters the ordered candidates for its own event eligibility. */
|
|
129
|
-
export interface MemoryCandidateSet {
|
|
130
|
-
name: string;
|
|
131
|
-
winner: MemoryDoc;
|
|
132
|
-
candidates: readonly MemoryDoc[];
|
|
133
|
-
}
|
|
134
|
-
/** Restrict resolution to docs whose resolved kind matches. Threaded INTO
|
|
135
|
-
* candidate selection, not applied as a post-filter: a wrong-kind candidate is
|
|
136
|
-
* skipped so a nearer one cannot shadow a farther matching-kind document into
|
|
137
|
-
* a false not_found. */
|
|
138
|
-
export interface MemoryCandidateOpts {
|
|
139
|
-
kind?: string;
|
|
140
|
-
}
|
|
141
|
-
export interface MemoryResolutionOpts extends MemoryCandidateOpts {
|
|
142
|
-
/** Restrict resolution to a single scope. Narrows the source stack only — the
|
|
143
|
-
* query is still the full canonical name. */
|
|
144
|
-
scope?: MemoryScope;
|
|
145
|
-
/** Also consult `.crouter/memory` stores discovered BELOW the mounted
|
|
146
|
-
* project roots (bounded discovery — see nested-stores.ts). Opt-in for the
|
|
147
|
-
* addressing surfaces (`memory read/list/find/lint/delete/origin`); OFF for
|
|
148
|
-
* boot render, on-read resolvedDocs, the slash-command snapshot, and
|
|
149
|
-
* persona resolution, which stay on the flat ancestor+profile stack. */
|
|
150
|
-
includeDescendants?: boolean;
|
|
151
|
-
/** Report when bounded descendant discovery omits an owner. Defaults to the inverse of `quiet`, so callers can preserve quiet malformed-document handling while still making an incomplete corpus visible to their caller. */
|
|
152
|
-
reportDiscovery?: boolean;
|
|
153
|
-
}
|
|
154
|
-
/** A loaded corpus and the exact-identity queries over it. */
|
|
155
|
-
export interface MemoryView {
|
|
156
|
-
/** Every store the view discovered, mounted or not, in precedence order. */
|
|
157
|
-
stores: readonly MemoryStoreDescriptor[];
|
|
158
|
-
/** Every document of every MOUNTED store, in source order — candidates
|
|
159
|
-
* included, so a first-wins dedup by name yields the winners. */
|
|
160
|
-
docs: readonly MemoryDoc[];
|
|
161
|
-
/** The ordered candidate set for one exact canonical name, or null. */
|
|
162
|
-
candidates(name: string, opts?: MemoryCandidateOpts): MemoryCandidateSet | null;
|
|
163
|
-
/** One entry per canonical identity, sorted by name. */
|
|
164
|
-
candidateSets(opts?: MemoryCandidateOpts): MemoryCandidateSet[];
|
|
165
|
-
/** The address winner for one exact canonical name; throws not_found. */
|
|
166
|
-
resolve(name: string, opts?: MemoryCandidateOpts): MemoryDoc;
|
|
167
|
-
}
|
|
168
|
-
export interface MemoryTargetView extends MemoryView {
|
|
169
|
-
target: MemoryTarget;
|
|
170
|
-
}
|
|
171
|
-
export interface MemoryStoreView extends MemoryView {
|
|
172
|
-
store: MemoryStoreDescriptor;
|
|
173
|
-
}
|
|
174
|
-
/** Whose memory view is being resolved: the workspace dir, profile, and node
|
|
175
|
-
* id that decide which stores exist and in what order. Ambient resolution
|
|
176
|
-
* builds this from the process (`process.cwd()`, `CRTR_PROFILE_ID`,
|
|
177
|
-
* `CRTR_NODE_ID`); a TARGET-ADDRESSED caller passes another node's, which is
|
|
178
|
-
* what one process serving several nodes needs — crtrd resolving a link on
|
|
179
|
-
* behalf of a node, or a warm-spare claim building a node's first-message
|
|
180
|
-
* context. The same name can name different documents for different nodes, so
|
|
181
|
-
* every scope in the chain (node-local, project stack, profile, user, builtin)
|
|
182
|
-
* reads from the target rather than the host process. */
|
|
183
|
-
export interface MemoryTarget {
|
|
184
|
-
/** The workspace dir the project-scope stack walks up from. */
|
|
185
|
-
cwd: string;
|
|
186
|
-
/** The selected profile id, or null when none. */
|
|
187
|
-
profileId: string | null;
|
|
188
|
-
/** The node whose `nodes/<id>/context/memory/` store is the nearest scope,
|
|
189
|
-
* or null outside a node. */
|
|
190
|
-
nodeId: string | null;
|
|
191
|
-
/** App assignment from the selected node's row when outside its broker. */
|
|
192
|
-
grantee?: string;
|
|
193
|
-
/** Daemon authorization applied before exposing any candidate or store. */
|
|
194
|
-
allowsStore?: (store: MemoryStoreDescriptor, name?: string) => boolean;
|
|
195
|
-
/** Project roots whose repository is readable in the run's mount set. */
|
|
196
|
-
allowsProject?: (repositoryRoot: string) => boolean;
|
|
197
|
-
}
|
|
198
|
-
/** The target the ambient process describes: cwd + the two env seams every
|
|
199
|
-
* profile/node-aware memory path reads through (`CRTR_PROFILE_ID`,
|
|
200
|
-
* `CRTR_NODE_ID`). */
|
|
201
|
-
export declare function ambientMemoryTarget(): MemoryTarget;
|
|
202
|
-
/** The exact project store owned by `ownerDir` — the `--dir` selector's store,
|
|
203
|
-
* loaded whatever its mount status so lint and migration can inspect a store
|
|
204
|
-
* the runtime refuses to mount. */
|
|
205
|
-
export declare function openProjectMemoryStore(ownerDir: string): MemoryStoreDescriptor;
|
|
206
|
-
/** Every store a target sees, in precedence order: node, each project store
|
|
207
|
-
* nearest-first (its enabled plugins after it), then profile, user, builtin.
|
|
208
|
-
* One real store reached twice contributes once, at its first position. */
|
|
209
|
-
export declare function memoryStoresInPrecedence(target: MemoryTarget, scope?: MemoryScope, includeDescendants?: boolean, reportDiscovery?: boolean): MemoryStoreDescriptor[];
|
|
210
|
-
/** The native (non-plugin) MOUNTED store dirs in resolution precedence.
|
|
211
|
-
* Addresses a store directly when the document itself may be absent, which is
|
|
212
|
-
* how a DELETED doc's revision log is still found: history outlives the doc,
|
|
213
|
-
* so its lookup cannot go through document resolution. */
|
|
214
|
-
export declare function nativeMemoryStoresInPrecedence(scope?: MemoryScope, includeDescendants?: boolean): {
|
|
215
|
-
scope: MemoryScope;
|
|
216
|
-
memoryDir: string;
|
|
217
|
-
store: MemoryStoreDescriptor;
|
|
218
|
-
}[];
|
|
219
|
-
/** Every document in one store, sorted by canonical identity. SKILL.md bundles
|
|
220
|
-
* are Agent Skills, not memory docs. Enumeration stops at a nested `.crouter/`:
|
|
221
|
-
* that is another store's mount point, never this store's content. */
|
|
222
|
-
export declare function loadStoreMemoryDocs(store: MemoryStoreDescriptor, quiet?: boolean): MemoryDoc[];
|
|
223
|
-
/** All of one plugin's substrate docs, mounted under the plugin's own name:
|
|
224
|
-
* each doc's store-local name (explicit or path-derived) composes under that
|
|
225
|
-
* mount prefix. */
|
|
226
|
-
export declare function listPluginMemoryDocs(plugin: InstalledPlugin, scope: MemoryScope, quiet?: boolean, projectMemory?: ProfileProjectMemory): MemoryDoc[];
|
|
227
|
-
/** Load one target's whole corpus: every mounted store's documents in source
|
|
228
|
-
* order. A project store that does not mount is reported once (unless quiet)
|
|
229
|
-
* with its migration remedy and contributes nothing. */
|
|
230
|
-
export declare function loadMemoryTargetView(target: MemoryTarget, opts?: MemoryResolutionOpts & {
|
|
231
|
-
quiet?: boolean;
|
|
232
|
-
}): MemoryTargetView;
|
|
233
|
-
/** Load ONE exact physical store. An undeclared/invalid project store loads
|
|
234
|
-
* under the empty namespace so lint and migration can inspect what it holds;
|
|
235
|
-
* no target view ever sees those documents. */
|
|
236
|
-
export declare function loadMemoryStoreView(store: MemoryStoreDescriptor, quiet?: boolean, target?: MemoryTarget): MemoryStoreView;
|
|
237
|
-
/** All project-scoped docs visible from an explicit node workspace/profile — the
|
|
238
|
-
* project-only slice of a `MemoryTarget` view, used where only workspace docs
|
|
239
|
-
* are wanted (a workspace-open render). For a full-precedence target-addressed
|
|
240
|
-
* lookup, use `resolveMemoryDocForTarget`. */
|
|
241
|
-
export declare function listProjectMemoryDocs(startDir?: string, profileId?: string | null, quiet?: boolean): MemoryDoc[];
|
|
242
|
-
/** All memory docs across the resolved sources, in precedence order: each
|
|
243
|
-
* ancestor project `.crouter/` from nearest to farthest, then the selected
|
|
244
|
-
* profile's memory (if any), then user, then builtin. Within each source,
|
|
245
|
-
* native docs are emitted before enabled-plugin docs, and equal-canonical
|
|
246
|
-
* candidates stay in source order, so a caller's first-wins dedup yields the
|
|
247
|
-
* address winners. */
|
|
248
|
-
export declare function listAllMemoryDocs(scope?: MemoryScope, quiet?: boolean, includeDescendants?: boolean): MemoryDoc[];
|
|
249
|
-
export interface MemoryDocSnapshot {
|
|
250
|
-
/** Every document in default scope precedence order, loaded once. */
|
|
251
|
-
docs: readonly MemoryDoc[];
|
|
252
|
-
/** Resolve names against that source snapshot; failures are omitted so
|
|
253
|
-
* callers can retain their own per-document error behavior. */
|
|
254
|
-
resolve(names: readonly string[]): Map<string, MemoryDoc>;
|
|
255
|
-
}
|
|
256
|
-
export declare function createMemoryDocSnapshot(target?: MemoryTarget): MemoryDocSnapshot;
|
|
257
|
-
/** Resolve several canonical names over one memory-source snapshot. Failed
|
|
258
|
-
* names are omitted so callers can preserve their per-document error behavior. */
|
|
259
|
-
export declare function resolveMemoryDocs(names: readonly string[]): Map<string, MemoryDoc>;
|
|
260
|
-
/** The address winner for an exact canonical name in the ambient target. */
|
|
261
|
-
export declare function resolveMemoryDoc(rawName: string, opts?: MemoryResolutionOpts): MemoryDoc;
|
|
262
|
-
/** Resolve a memory document as ANOTHER node would see it — the same precedence
|
|
263
|
-
* chain (node-local > project stack > profile > user > builtin), read from the
|
|
264
|
-
* target's cwd/profile/node rather than the host process's. This is what crtrd
|
|
265
|
-
* resolves a `[[name]]` link through: the daemon's own cwd and env name no
|
|
266
|
-
* node, and the same name can be a different document for two nodes. */
|
|
267
|
-
export declare function resolveMemoryDocForTarget(rawName: string, target: MemoryTarget, opts?: MemoryResolutionOpts): MemoryDoc;
|
|
268
|
-
/** Every physical candidate for an exact canonical name in the ambient target,
|
|
269
|
-
* in source order — what path-aware inventory, diagnostics, and automatic
|
|
270
|
-
* event eligibility consume instead of the winner alone. */
|
|
271
|
-
export declare function resolveMemoryCandidates(rawName: string, opts?: MemoryResolutionOpts): MemoryCandidateSet;
|
|
272
|
-
export declare function resolveMemoryCandidatesForTarget(rawName: string, target: MemoryTarget, opts?: MemoryResolutionOpts): MemoryCandidateSet;
|
|
273
|
-
/** The address winner for an exact canonical name inside ONE project store —
|
|
274
|
-
* the `--dir` selector's resolution. The query is still the full canonical
|
|
275
|
-
* name, including that store's namespace. */
|
|
276
|
-
export declare function resolveMemoryDocInStore(rawName: string, store: MemoryStoreDescriptor, opts?: MemoryCandidateOpts): MemoryDoc;
|
|
277
|
-
/** Resolve PHYSICAL path segments against a `.history` tree, which mirrors the
|
|
278
|
-
* doc tree segment for segment with `.jsonl` in place of `.md`. A log outlives
|
|
279
|
-
* its document, so this lookup cannot go through document resolution. */
|
|
280
|
-
export declare function resolveHistoryLogPath(historyDir: string, segments: string[]): string | null;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var W=Object.defineProperty;var c=(e,o)=>W(e,"name",{value:o,configurable:!0});import{envGrantee as G,envNodeId as V,envProfileId as H}from"../shared/env.js";import{dirname as x,join as y,relative as J,sep as Q}from"node:path";import{readdirSync as U}from"node:fs";import{CRTR_DIR_NAME as F}from"../types.js";import{realpathOrSelf as $}from"./fs-utils.js";import{existsBeneath as X,isBeneathRefusal as Y,readFileBeneath as Z,readTextBeneathIfExists as ee,walkFilesBeneath as oe}from"./spaces/open-beneath.js";import{parseFrontmatterGeneric as k}from"./frontmatter.js";import{listInstalledPlugins as ne,listInstalledPluginsInRoot as te}from"./resolver.js";import{notFound as re,usage as N}from"./errors.js";import{warn as j}from"./output.js";import{NEUTRAL_PROJECT_MEMORY as h,pluginMemoryDir as ie,projectScopeRoots as ae,projectScopeRootsWithMemory as se,scopeMemoryDir as ce}from"./scope.js";import{effectiveDocKind as b}from"./substrate/schema.js";import{INDEX_SEGMENT as w,canonicalSegments as E,composeCanonicalName as T,localNameFromPath as ue,normalizeNameSegment as C,representationForPath as le,resolveLocalName as me,routingAnchorFor as de,validateNamespace as fe}from"./memory/identity.js";import{loadProfileManifest as A,profileMemoryDir as pe}from"./profiles/manifest.js";import{memoryDir as ye}from"./runtime/memory.js";import{descendantStoreRoots as he}from"./nested-stores.js";import{associateRepository as ge}from"./memory/repository-association.js";import{appSpace as we}from"./layout.js";function g(){return{cwd:process.cwd(),profileId:H()||null,nodeId:V()||null,grantee:G()||void 0}}c(g,"ambientMemoryTarget");function ve(){return g().profileId??""}c(ve,"selectedProfileId");function Se(e,o){if(o)return[o];const n=[];return e.nodeId&&n.push("node"),ae(e.cwd,e.profileId).length>0&&n.push("project"),e.profileId&&n.push("profile"),n.push("user"),n.push("builtin"),n}c(Se,"scopesInPrecedence");function L(e,o,n){const t={scope:"project",storeRoot:o,ownerDir:e,projectMemory:n},r=R(o);if(r.mountStatus!=="ready")return{...t,namespace:"",...r};const i=ge(e);if(!i.ok){const p=`run \`crtr sys migrate --dir ${e}\``;return i.code==="no-project-root"?{...t,namespace:"",mountStatus:"undeclared",mountFailure:"association",diagnostic:`project memory store at ${o} has no repository root declaring \`namespace:\` \u2014 ${p}`}:{...t,namespace:"",mountStatus:"invalid",mountFailure:"association",diagnostic:`project memory store at ${o} cannot be associated: ${i.reason} \u2014 ${p}`}}const{association:s}=i,u={namespacePath:s.declarationPath,repositoryRoot:s.repositoryRoot,repositoryKey:s.repositoryKey,ownerRelativePath:s.ownerRelativePath},m=s.declarationPath,a=s.ownerRelativePath!=="",l=`run \`crtr sys migrate --dir ${s.repositoryRoot}\``,f=a?`nested project memory store at ${o} takes its identity from ${m}, which is missing root ${w}.md declaring \`namespace:\` \u2014 ${l}`:`project memory store has no root ${w}.md declaring \`namespace:\` \u2014 ${l}`;let d;try{const p=ee(x(m),m);if(p===null)return{...t,...u,namespace:"",mountStatus:"undeclared",mountFailure:"undeclared-root",diagnostic:f};d=k(p).data?.namespace}catch(p){return{...t,...u,namespace:"",mountStatus:"invalid",mountFailure:"invalid-root",diagnostic:`project memory store's ${m} does not parse (${z(p)}) \u2014 ${l}`}}if(d==null||d===""){const p=a?`nested project memory store at ${o} takes its identity from ${m}, which declares no \`namespace:\` \u2014 ${l}`:`project memory store's ${m} declares no \`namespace:\` \u2014 ${l}`;return{...t,...u,namespace:"",mountStatus:"undeclared",mountFailure:"undeclared-root",diagnostic:p}}if(typeof d!="string")return{...t,...u,namespace:"",mountStatus:"invalid",mountFailure:"invalid-root",diagnostic:`project memory store declares a non-string \`namespace:\` (${JSON.stringify(d)}) \u2014 quote it in ${m}, or ${l}`};const v=fe(d);return v.ok?{...t,...u,repositoryNamespace:d,namespace:T(d,s.ownerRelativePath),mountStatus:"ready"}:{...t,...u,namespace:"",mountStatus:"invalid",mountFailure:"invalid-root",diagnostic:`project memory store declares an invalid namespace \`${d}\` (${v.reason}) \u2014 ${l}`}}c(L,"projectStoreDescriptor");function R(e){try{return{mountStatus:X(e,e)?"ready":"absent"}}catch(o){if(!Y(o))throw o;return{mountStatus:"invalid",mountFailure:"symlink",diagnostic:`memory store at ${e} is reached through a symlink, which never mounts`}}}c(R,"storeRootMount");function M(e,o){return o===null?{scope:e,storeRoot:"",namespace:"",mountStatus:"absent",projectMemory:h}:{scope:e,storeRoot:o,namespace:"",...R(o),projectMemory:h}}c(M,"plainStoreDescriptor");function I(e,o,n){const t=$(ie(e));return{scope:o,storeRoot:t,namespace:e.name,plugin:e.name,...R(t),projectMemory:n}}c(I,"pluginStoreDescriptor");function Ve(e){const o=$(e);return L(o,y(o,F,"memory"),h)}c(Ve,"openProjectMemoryStore");function q(e,o,n=!1,t=!0){const r=[],i=c((a,l)=>{r.push(L(x(a),y(a,"memory"),l));for(const f of te("project",a).filter(d=>d.enabled))r.push(I(f,"project",l))},"projectStores");for(const a of Se(e,o))if(a==="project"){const l=se(e.cwd,e.profileId);for(const{root:f,memory:d}of l)i(f,d);if(n)for(const f of he(l.map(({root:d})=>d),t))i(f,h)}else if(a==="profile"){const l=e.profileId??"";if(l!=="")try{const{profileId:f}=A(l),{manifest:d}=A(f),v=d.grantee?.startsWith("app:")?y(we(d.grantee).memory,"profiles",f):pe(f);r.push({...M("profile",v),profileId:f,ownerApp:d.grantee})}catch{}}else if(a==="node"){const l=e.nodeId??"";l!==""&&r.push({...M("node",ye(l,e.grantee)),ownerApp:e.grantee})}else{r.push(M(a,ce(a)));for(const l of ne(a).filter(f=>f.enabled))r.push(I(l,a,h))}const s=new Set,u=r.filter(a=>{if(a.storeRoot==="")return!1;const l=$(a.storeRoot);return s.has(l)?!1:(s.add(l),!0)}),m=new Map;for(const a of u){if(a.scope!=="project"||a.mountStatus!=="ready"||a.repositoryRoot===void 0||a.ownerRelativePath===void 0)continue;const l=`${a.repositoryRoot}\0${a.ownerRelativePath}`,f=m.get(l);f?f.push(a):m.set(l,[a])}return u.filter(a=>(a.scope!=="project"||a.repositoryRoot===void 0||e.allowsProject?.(a.repositoryRoot)!==!1)&&e.allowsStore?.(a)!==!1).map(a=>{if(a.scope!=="project"||a.mountStatus!=="ready"||a.repositoryRoot===void 0||a.ownerRelativePath===void 0)return a;const l=m.get(`${a.repositoryRoot}\0${a.ownerRelativePath}`);if(l===void 0||l.length<2)return a;const f=l.map(d=>d.ownerDir??d.storeRoot).join(", ");return{...a,mountStatus:"invalid",mountFailure:"collision",diagnostic:`project memory stores at ${f} normalize to the same effective prefix \`${a.namespace}\` \u2014 rename one owner directory`}})}c(q,"memoryStoresInPrecedence");function He(e,o=!1){return q(g(),e,o).filter(n=>n.mountStatus==="ready"&&n.scope!=="builtin"&&n.plugin===void 0).map(n=>({scope:n.scope,memoryDir:n.storeRoot,store:n}))}c(He,"nativeMemoryStoresInPrecedence");function z(e){return(e instanceof Error?e.message:String(e)).split(`
|
|
2
|
-
`)[0]??""}c(z,"firstLine");function $e(e,o,n){const{data:t,body:r}=k(Z(e.storeRoot,o).toString("utf8")),i=ue(n),s=le(n),u=i===""?"":me(t,i),m=T(e.namespace,u);return m===""?null:{name:m,localName:u,scope:e.scope,path:o,root:e.storeRoot,physicalRelativePath:n,representation:s,routingAnchor:de(m,s),store:e,frontmatter:t,body:r,projectMemory:e.projectMemory,...e.plugin===void 0?{}:{plugin:e.plugin}}}c($e,"loadMemoryDoc");function je(e,o){const n=e.name.localeCompare(o.name);return n!==0?n:e.representation!==o.representation?e.representation==="directory-index"?-1:1:e.physicalRelativePath.localeCompare(o.physicalRelativePath)}c(je,"compareDocs");function P(e,o=!1){if(e.storeRoot===""||e.mountFailure==="symlink")return[];const n=[];for(const t of oe(e.storeRoot,e.storeRoot,r=>r.endsWith(".md")&&r!=="SKILL.md",r=>r===F)){const r=J(e.storeRoot,t).split(Q).join("/");try{const i=$e(e,t,r);if(i===null){o||j(`${t}: a root ${w}.md has no canonical name in a store without a namespace`);continue}n.push(i)}catch(i){o||j(`invalid frontmatter in ${t}: ${z(i)}`)}}return n.sort(je)}c(P,"loadStoreMemoryDocs");function Je(e,o,n=!1,t=h){return P(I(e,o,t),n)}c(Je,"listPluginMemoryDocs");function D(e){return E(e.trim()).join("/")}c(D,"normalizeQuery");function B(e,o,n){const t=E(o),r=t[t.length-1]===w;r&&t.pop();const i=t[t.length-1]??o,s=r?`A directory's own document answers at the directory name \u2014 drop the trailing /${w}. Run \`crtr memory find ${i}\` to find the canonical name.`:`Resolution takes the full canonical name (a project doc is <namespace>/<local name>). Run \`crtr memory find ${i}\` to find it.`;return re(`memory document not found: ${e}`,{memory:o,...n?{scope:n}:{},next:s})}c(B,"notFoundError");function _(e,o,n){const t=c((r,i)=>{const s=D(r);if(s==="")return null;const u=i?.kind,m=o.filter(a=>a.name===s&&(u===void 0||b(a)===u));return m.length===0?null:{name:s,winner:m[0],candidates:m}},"candidatesFor");return{stores:e,docs:o,candidates:t,candidateSets(r){const i=r?.kind,s=new Map;for(const u of o){if(i!==void 0&&b(u)!==i)continue;const m=s.get(u.name);m?m.push(u):s.set(u.name,[u])}return[...s.entries()].sort(([u],[m])=>u.localeCompare(m)).map(([u,m])=>({name:u,winner:m[0],candidates:m}))},resolve(r,i){const s=D(r);if(s==="")throw N("memory document name required");const u=t(s,i);if(u===null)throw B(r,s,n);return u.winner}}}c(_,"makeView");function S(e,o={}){const n=o.quiet??!1,t=q(e,o.scope,o.includeDescendants??!1,o.reportDiscovery??!n),r=[];for(const i of t)if(i.mountStatus!=="absent"){if(i.mountStatus!=="ready"){!n&&i.diagnostic!==void 0&&j(`memory store not mounted: ${i.diagnostic}`);continue}r.push(...P(i,n).filter(s=>e.allowsStore?.(i,s.name)!==!1))}return{target:e,..._(t,r,o.scope)}}c(S,"loadMemoryTargetView");function Re(e,o=!1,n){const t=P(e,o).filter(r=>n?.allowsStore?.(e,r.name)!==!1);return{store:e,..._([e],t)}}c(Re,"loadMemoryStoreView");function Qe(e=process.cwd(),o=ve()||null,n=!1){return[...S({cwd:e,profileId:o,nodeId:null},{scope:"project",quiet:n}).docs]}c(Qe,"listProjectMemoryDocs");function Ue(e,o=!1,n=!1){return[...S(g(),{...e?{scope:e}:{},quiet:o,includeDescendants:n}).docs]}c(Ue,"listAllMemoryDocs");function Me(e=g()){const o=S(e,{quiet:!0});return{docs:o.docs,resolve:c(n=>{const t=new Map;for(const r of n){const i=o.candidates(r);i!==null&&t.set(r,i.winner)}return t},"resolve")}}c(Me,"createMemoryDocSnapshot");function Xe(e){return Me().resolve(e)}c(Xe,"resolveMemoryDocs");function Ye(e,o={}){return Ie(e,g(),o)}c(Ye,"resolveMemoryDoc");function Ie(e,o,n={}){return K(e,o,n).winner}c(Ie,"resolveMemoryDocForTarget");function Ze(e,o={}){return K(e,g(),o)}c(Ze,"resolveMemoryCandidates");function K(e,o,n={}){const t=S(o,{...n,quiet:!0}),r=D(e);if(r==="")throw N("memory document name required");const i=t.candidates(r,n);if(i===null)throw B(e,r,n.scope);return i}c(K,"resolveMemoryCandidatesForTarget");function eo(e,o,n={}){return Re(o,!0).resolve(e,n)}c(eo,"resolveMemoryDocInStore");function O(e,o,n,t=".md"){let r;try{r=U(e,{withFileTypes:!0})}catch{return null}let i=null;for(const s of r)if(n==="dir"){if(!s.isDirectory())continue;if(s.name===o)return y(e,s.name);i===null&&C(s.name)===o&&(i=y(e,s.name))}else{if(!(s.isFile()&&s.name.endsWith(t)))continue;const u=s.name.slice(0,-t.length);if(u===o)return y(e,s.name);i===null&&C(u)===o&&(i=y(e,s.name))}return i}c(O,"matchNormalizedChild");function Pe(e,o,n){let t=e;for(let r=0;r<o.length-1;r++){const i=O(t,o[r],"dir",n);if(!i)return null;t=i}return O(t,o[o.length-1],"file",n)}c(Pe,"resolveNormalizedFile");function oo(e,o){return o.length===0?null:Pe(e,o,".jsonl")}c(oo,"resolveHistoryLogPath");export{g as ambientMemoryTarget,Me as createMemoryDocSnapshot,Ue as listAllMemoryDocs,Je as listPluginMemoryDocs,Qe as listProjectMemoryDocs,Re as loadMemoryStoreView,S as loadMemoryTargetView,P as loadStoreMemoryDocs,q as memoryStoresInPrecedence,He as nativeMemoryStoresInPrecedence,Ve as openProjectMemoryStore,oo as resolveHistoryLogPath,Ze as resolveMemoryCandidates,K as resolveMemoryCandidatesForTarget,Ye as resolveMemoryDoc,Ie as resolveMemoryDocForTarget,eo as resolveMemoryDocInStore,Xe as resolveMemoryDocs};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare function descendantStoreDiscoveryWarnings(ancestorRoots: string[]): string[];
|
|
2
|
-
/**
|
|
3
|
-
* Every `.crouter` store root strictly BELOW the given ancestor roots' owning
|
|
4
|
-
* dirs, in owner order then discovery order. Takes the `projectScopeRoots()`
|
|
5
|
-
* entries themselves (`.crouter` dir paths) and derives owner dirs internally.
|
|
6
|
-
*
|
|
7
|
-
* Any discovered root whose realpath matches an INPUT root is excluded here,
|
|
8
|
-
* inside the function: a profile can manage both `/a` and `/a/b`, making
|
|
9
|
-
* `/a/b/.crouter` simultaneously an ancestor root and a descendant of `/a` —
|
|
10
|
-
* excluding centrally gives the resolver and lint the identical call with no
|
|
11
|
-
* duplicated dedupe logic.
|
|
12
|
-
*/
|
|
13
|
-
export declare function descendantStoreRoots(ancestorRoots: string[], reportBudgetExceeded?: boolean, warnings?: string[]): string[];
|
|
14
|
-
/** Complete descendant-store discovery for state migrations. Unlike the
|
|
15
|
-
* interactive addressing lane, this filesystem walk has no time or depth
|
|
16
|
-
* budget, crosses embedded repositories, admits plugin-only `.crouter` roots,
|
|
17
|
-
* and does not cache. */
|
|
18
|
-
export declare function descendantStoreRootsExhaustive(ancestorRoots: string[]): string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var D=Object.defineProperty;var a=(t,r)=>D(t,"name",{value:r,configurable:!0});import{readdirSync as E}from"node:fs";import{dirname as x,join as f,sep as R}from"node:path";import{CRTR_DIR_NAME as l}from"../types.js";import{pathExists as p,realpathOrSelf as m}from"./fs-utils.js";import{gitSync as _}from"./git.js";import{warn as v}from"./output.js";const O=new Set(["node_modules",".git","dist","build",".next",".cache",".yalc",".venv"]),T=6,h=500;function C(t){const r=[];return b(t,!1,r),r}a(C,"descendantStoreDiscoveryWarnings");function b(t,r=!0,o=[]){const i=new Set(t.map(s=>m(s))),c=[],d=new Set;for(const s of t){const u=x(s),y=m(u);d.has(y)||(d.add(y),c.push(u))}const e=a(s=>{const u=`memory: nested-store discovery under ${s} exceeded its ${h}ms budget \u2014 this result may omit nested stores. To read a document from a known nested store, pass its owner as \`--dir <owner>\`; that exact-store read bypasses discovery.`;o.push(u),r&&v(u)},"tripBudget"),n=[],w=new Set,S=a(s=>{const u=m(s);w.has(u)||i.has(u)||(w.add(u),n.push(s))},"add");for(const s of c)p(f(s,".git"))?k(s,S,h,()=>e(s)):M(s,S,Date.now()+h,()=>e(s));return n}a(b,"descendantStoreRoots");function k(t,r,o,i){const c=`/${l}/memory/`,d=_(["-C",t,"ls-files","-z","-co","--exclude-standard","--",`*/${l}/memory/*`],void 0,void 0,{timeoutMs:o});if(d.timedOut===!0){i();return}if(d.status===0)for(const e of d.stdout.split("\0")){if(e==="")continue;const n=e.indexOf(c);n<=0||r(f(t,e.slice(0,n).split("/").join(R),l))}}a(k,"collectGitStores");function M(t,r,o,i){g(t,r,{deadline:o,maxDepth:T,trip:i})}a(M,"collectWalkStores");function g(t,r,o={}){const i=[{dir:t,depth:0}];for(;i.length>0;){if(o.deadline!==void 0&&Date.now()>o.deadline){o.trip?.();return}const{dir:c,depth:d}=i.pop();if(c!==t){if(o.crossEmbeddedRepos!==!0&&p(f(c,".git")))continue;const n=f(c,l);p(o.includePluginOnly===!0?n:f(n,"memory"))&&r(n)}if(o.maxDepth!==void 0&&d>=o.maxDepth)continue;let e;try{e=E(c,{withFileTypes:!0})}catch{continue}for(const n of e)n.isDirectory()&&(O.has(n.name)||n.name===l||i.push({dir:f(c,n.name),depth:d+1}))}}a(g,"collectWalkStoresFromOwner");function F(t){const r=new Set(t.map(e=>m(e))),o=[],i=new Set,c=a(e=>{const n=m(e);i.has(n)||r.has(n)||(i.add(n),o.push(e))},"add"),d=new Set(t.map(e=>m(x(e))));for(const e of d)g(e,c,{includePluginOnly:!0,crossEmbeddedRepos:!0});return o}a(F,"descendantStoreRootsExhaustive");export{C as descendantStoreDiscoveryWarnings,b as descendantStoreRoots,F as descendantStoreRootsExhaustive};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.defineProperty;var m=(r,o)=>e(r,"name",{value:o,configurable:!0});import{join as p}from"node:path";import{appSpace as i}from"../layout.js";function a(r,o){if(!o)throw new Error(`memory store for ${r} requires an app`);return p(i(o).memory,"nodes",r)}m(a,"memoryDir");export{a as memoryDir};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type SurfaceEntry } from './schema.js';
|
|
2
|
-
export declare const SUPPRESSIBLE_RULES: readonly string[];
|
|
3
|
-
/** Strict validation of one raw routing entry. Runtime parsing deliberately
|
|
4
|
-
* tolerates malformed docs; this authoring/preflight contract does not. */
|
|
5
|
-
export declare function lintSubstrateSurfaces(value: unknown): string | null;
|
|
6
|
-
/** Strict substrate frontmatter checker shared by lint and package preflight. */
|
|
7
|
-
export declare function lintSubstrateFrontmatter(fm: Record<string, unknown> | null): string | null;
|
|
8
|
-
/** Compatibility name for consumers that adopted lint's former export. */
|
|
9
|
-
export declare const lintSubstrateSchema: typeof lintSubstrateFrontmatter;
|
|
10
|
-
/** Parsed routing entries for checks that run after strict validation. */
|
|
11
|
-
export declare function parsedSubstrateSurfaces(fm: Record<string, unknown>): SurfaceEntry[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var s=(e,n)=>g(e,"name",{value:n,configurable:!0});import{isDocKind as m,parseSubstrateFrontmatter as b,PRIVACY_LEVELS as y,SURFACE_EVENTS as f,SURFACE_RUNGS as h}from"./schema.js";const S=["system-prompt-visibility","file-read-visibility","applies-to","read-when"],v=["on","match","match-frontmatter","gate","at"],p=["length","broad-memory-read","orphan"];function $(e){if(e===void 0)return null;if(!Array.isArray(e))return`invalid surfaces: ${JSON.stringify(e)} (expected a list of {on, at, match?, match-frontmatter?, gate?} entries)`;for(const n of e){if(n===null||typeof n!="object"||Array.isArray(n))return`invalid surfaces entry: ${JSON.stringify(n)} (expected an {on, at, match?, match-frontmatter?, gate?} object)`;const r=n;for(const i of Object.keys(r))if(!v.includes(i))return`invalid surfaces entry: unknown key \`${i}\` (an entry carries only on, match, match-frontmatter, gate, at)`;const t=r.on;if(typeof t!="string"||!f.includes(t))return`invalid surfaces entry \`on\`: ${JSON.stringify(t)} (expected ${f.join("|")})`;const c=r.at;if(typeof c!="string"||!h.includes(c))return`invalid surfaces entry \`at\`: ${JSON.stringify(c)} (expected ${h.join("|")})`;let u=!1;if(r.match!==void 0){if(t==="boot"||t==="workspace-open")return`invalid surfaces entry: \`match\` is meaningless on \`${t}\` \u2014 the entry's presence is the match; drop it`;const i=r.match,d=typeof i=="string"?[i]:Array.isArray(i)&&i.every(l=>typeof l=="string")?i:null;if(d===null||d.length===0||d.some(l=>l.trim()===""))return`invalid surfaces entry \`match\`: ${JSON.stringify(i)} (expected a non-empty glob or non-empty glob list)`;u=!0}const a=r["match-frontmatter"];if(a!==void 0){if(t!=="read")return"invalid surfaces entry: `match-frontmatter` is a `read`-event predicate only";if(a===null||typeof a!="object"||Array.isArray(a))return`invalid surfaces entry \`match-frontmatter\`: ${JSON.stringify(a)} (expected a field\u2192matcher object)`}if((t==="read"||t==="memory-read"||t==="command"||t==="pre-command")&&!u&&a===void 0)return`invalid surfaces entry: a \`${t}\` entry requires \`match\`${t==="read"?" or `match-frontmatter`":""}`;const o=r.gate;if(o!==void 0&&(o===null||typeof o!="object"||Array.isArray(o)))return`invalid surfaces entry \`gate\`: ${JSON.stringify(o)} (expected a field\u2192matcher object)`}return null}s($,"lintSubstrateSurfaces");function w(e){if(e===null)return"missing frontmatter: a memory store doc requires `kind: knowledge|preference`";if(!m(e.kind))return`invalid kind: ${JSON.stringify(e.kind)} (expected knowledge|preference)`;if("when"in e||"why"in e)return'retired `when`/`why` keys: merge them into one `when-and-why-to-read` line \u2014 "When <circumstance>, this <kind> should be read because <broader downstream payoff>." WHY is the benefit unlocked by reading, not the document summary, rule, or obedience rationale.';if(typeof e["when-and-why-to-read"]!="string"||e["when-and-why-to-read"].trim()==="")return'missing `when-and-why-to-read`: one routing line \u2014 "When <circumstance>, this <kind> should be read because <broader downstream payoff>." WHY is the benefit unlocked by reading, not the document summary, rule, or obedience rationale.';for(const r of S)if(r in e)return`retired \`${r}\` key: the visibility axes were replaced by \`surfaces\` event routing \u2014 run \`crtr sys migrate\` to convert old-format docs, or author \`surfaces\` entries by hand (\`crtr memory write -h\`)`;if("privacy"in e&&!y.includes(e.privacy))return`invalid privacy: ${JSON.stringify(e.privacy)} (expected ${y.join("|")})`;if(e.unlisted!==void 0&&typeof e.unlisted!="boolean")return`invalid unlisted: ${JSON.stringify(e.unlisted)} (expected a boolean)`;const n=$(e.surfaces);if(n!==null)return n;if(e.gate!==void 0&&(e.gate===null||typeof e.gate!="object"||Array.isArray(e.gate)))return`invalid gate: ${JSON.stringify(e.gate)} (expected a field\u2192matcher object)`;if(e.slash!==void 0&&typeof e.slash!="boolean")return`invalid slash: ${JSON.stringify(e.slash)} (expected a boolean)`;if(e.rationale!==void 0&&typeof e.rationale!="string")return`invalid rationale: ${JSON.stringify(e.rationale)} (expected a string)`;if(e["lint-ignore"]!==void 0){const r=Array.isArray(e["lint-ignore"])?e["lint-ignore"]:[e["lint-ignore"]];if(r.length===0||!r.every(t=>typeof t=="string"&&p.includes(t)))return`invalid lint-ignore: ${JSON.stringify(e["lint-ignore"])} (suppressible rules: ${p.map(t=>`\`${t}\``).join(", ")})`}return null}s(w,"lintSubstrateFrontmatter");const k=w;function N(e){return b(e)?.surfaces??[]}s(N,"parsedSubstrateSurfaces");export{p as SUPPRESSIBLE_RULES,w as lintSubstrateFrontmatter,k as lintSubstrateSchema,$ as lintSubstrateSurfaces,N as parsedSubstrateSurfaces};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SubstrateDoc, SurfaceEntry } from './schema.js';
|
|
2
|
-
import type { NodeConfigSubject } from './subject-fields.js';
|
|
3
|
-
/** Does `doc` pass its gate for `subject`?
|
|
4
|
-
*
|
|
5
|
-
* - No gate (field absent) ⇒ `true`: always eligible (the common case).
|
|
6
|
-
* - A gate present ⇒ the matcher engine's verdict. An empty `gate: {}` is inert
|
|
7
|
-
* and returns `false` (never matches) per design §4 — so an author cannot
|
|
8
|
-
* write an always-eligible-via-empty-predicate doc.
|
|
9
|
-
*
|
|
10
|
-
* Eligibility only. A failing gate excludes the doc from BOTH automatic hooks
|
|
11
|
-
* for this node; it remains findable by `crtr memory find` (search ignores
|
|
12
|
-
* gate + rung). */
|
|
13
|
-
export declare function gatePasses(doc: SubstrateDoc, subject: NodeConfigSubject): boolean;
|
|
14
|
-
/** Does a surface entry participate for `subject`? A missing subject cannot
|
|
15
|
-
* satisfy an entry gate; entries without one remain eligible. */
|
|
16
|
-
export declare function surfaceEntryGatePasses(entry: Pick<SurfaceEntry, 'gate'>, subject: NodeConfigSubject | null): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=Object.defineProperty;var n=(e,t)=>a(e,"name",{value:t,configurable:!0});import{evalCondition as r}from"../predicate.js";function f(e,t){return e.gate===void 0?!0:r(e.gate,t)}n(f,"gatePasses");function o(e,t){return e.gate===void 0||t!==null&&r(e.gate,t)}n(o,"surfaceEntryGatePasses");export{f as gatePasses,o as surfaceEntryGatePasses};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { KINDS, isDocKind, RUNGS, rungRank, rungAtLeast, SURFACE_EVENTS, SURFACE_RUNGS, parseSubstrateFrontmatter, parseSubstrateDoc, previewLine, normalizeNameSegment, normalizeDocName, resolveDocName, } from './schema.js';
|
|
2
|
-
export type { DocKind, Rung, GatePredicate, SubstrateSchema, SubstrateDoc, SurfaceEntry, SurfaceEvent, SurfaceRung } from './schema.js';
|
|
3
|
-
export { lintSubstrateFrontmatter, lintSubstrateSchema, lintSubstrateSurfaces, parsedSubstrateSurfaces } from './frontmatter-validation.js';
|
|
4
|
-
export { matchesReadEntry, matchesMemoryReadEntry, matchesCommandEntry, readDeliveryRung, workspaceOpenRung, memoryReadDeliveryRung, commandDeliveryRung, matchingSurfaceEntry, surfaceEntryParticipates, owningRootOf, underOwningRoot } from './surface-match.js';
|
|
5
|
-
export type { SurfaceMatchPayload } from './surface-match.js';
|
|
6
|
-
export { planDelivery, bootPartitionOf } from './plan.js';
|
|
7
|
-
export type { DeliveryPlan, DeliveryRecord, DeliveryPayload, EntryDecision, GateOutcome } from './plan.js';
|
|
8
|
-
export { dirDedupKey, docsByName, isDirName, ancestorDirsOf, renderDirListing } from './listings.js';
|
|
9
|
-
export { clearContextExposureState, cloneContextExposureState, cloneTranscriptExposureState, contentExposureIdentity, contextExposureStatesEqual, documentExposedAtOrAbove, emptyContextExposureState, exposedAtOrAbove, exposureTarget, freezePreferenceSnapshot, hasTranscriptExposure, initializeForkContextExposure, loadContextExposureState, mergeContextExposureState, registerDocumentExposure, registerExposure, replaceContextExposureState, saveContextExposureState, sharedContextExposureState, } from './injected-store.js';
|
|
10
|
-
export type { ContextExposureState, ExposureSource, ExposureTarget } from './injected-store.js';
|
|
11
|
-
export { scopeForCwd, profileNameFor } from './subject-fields.js';
|
|
12
|
-
export type { NodeConfigSubject } from './subject-fields.js';
|
|
13
|
-
export { spineDepth, assembleNodeSubject } from './subject.js';
|
|
14
|
-
export { gatePasses } from './gate.js';
|
|
15
|
-
export { renderPreferencesForSubject, renderKnowledgeForSubject } from './render.js';
|
|
16
|
-
export { renderPreferencesSection, renderKnowledgeBlock } from './render-node.js';
|
|
17
|
-
export { renderOnReadDocsForSubject, renderWorkspaceOpenDocsForSubject, renderOnCommandDocsForSubject, memoryReadDocBlocks } from './on-read.js';
|
|
18
|
-
export { renderOnReadDocs, renderWorkspaceOpenDocs } from './on-read-node.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{KINDS as t,isDocKind as o,RUNGS as n,rungRank as a,rungAtLeast as s,SURFACE_EVENTS as p,SURFACE_RUNGS as c,parseSubstrateFrontmatter as m,parseSubstrateDoc as u,previewLine as x,normalizeNameSegment as i,normalizeDocName as d,resolveDocName as S}from"./schema.js";import{lintSubstrateFrontmatter as f,lintSubstrateSchema as l,lintSubstrateSurfaces as D,parsedSubstrateSurfaces as g}from"./frontmatter-validation.js";import{matchesReadEntry as b,matchesMemoryReadEntry as y,matchesCommandEntry as C,readDeliveryRung as F,workspaceOpenRung as O,memoryReadDeliveryRung as N,commandDeliveryRung as h,matchingSurfaceEntry as v,surfaceEntryParticipates as k,owningRootOf as w,underOwningRoot as A}from"./surface-match.js";import{planDelivery as P,bootPartitionOf as K}from"./plan.js";import{dirDedupKey as T,docsByName as U,isDirName as B,ancestorDirsOf as L,renderDirListing as G}from"./listings.js";import{clearContextExposureState as W,cloneContextExposureState as _,cloneTranscriptExposureState as q,contentExposureIdentity as M,contextExposureStatesEqual as V,documentExposedAtOrAbove as H,emptyContextExposureState as J,exposedAtOrAbove as Q,exposureTarget as X,freezePreferenceSnapshot as Y,hasTranscriptExposure as Z,initializeForkContextExposure as $,loadContextExposureState as ee,mergeContextExposureState as re,registerDocumentExposure as te,registerExposure as oe,replaceContextExposureState as ne,saveContextExposureState as ae,sharedContextExposureState as se}from"./injected-store.js";import{scopeForCwd as ce,profileNameFor as me}from"./subject-fields.js";import{spineDepth as xe,assembleNodeSubject as ie}from"./subject.js";import{gatePasses as Se}from"./gate.js";import{renderPreferencesForSubject as fe,renderKnowledgeForSubject as le}from"./render.js";import{renderPreferencesSection as ge,renderKnowledgeBlock as Re}from"./render-node.js";import{renderOnReadDocsForSubject as ye,renderWorkspaceOpenDocsForSubject as Ce,renderOnCommandDocsForSubject as Fe,memoryReadDocBlocks as Oe}from"./on-read.js";import{renderOnReadDocs as he,renderWorkspaceOpenDocs as ve}from"./on-read-node.js";export{t as KINDS,n as RUNGS,p as SURFACE_EVENTS,c as SURFACE_RUNGS,L as ancestorDirsOf,ie as assembleNodeSubject,K as bootPartitionOf,W as clearContextExposureState,_ as cloneContextExposureState,q as cloneTranscriptExposureState,h as commandDeliveryRung,M as contentExposureIdentity,V as contextExposureStatesEqual,T as dirDedupKey,U as docsByName,H as documentExposedAtOrAbove,J as emptyContextExposureState,Q as exposedAtOrAbove,X as exposureTarget,Y as freezePreferenceSnapshot,Se as gatePasses,Z as hasTranscriptExposure,$ as initializeForkContextExposure,B as isDirName,o as isDocKind,f as lintSubstrateFrontmatter,l as lintSubstrateSchema,D as lintSubstrateSurfaces,ee as loadContextExposureState,C as matchesCommandEntry,y as matchesMemoryReadEntry,b as matchesReadEntry,v as matchingSurfaceEntry,N as memoryReadDeliveryRung,Oe as memoryReadDocBlocks,re as mergeContextExposureState,d as normalizeDocName,i as normalizeNameSegment,w as owningRootOf,u as parseSubstrateDoc,m as parseSubstrateFrontmatter,g as parsedSubstrateSurfaces,P as planDelivery,x as previewLine,me as profileNameFor,F as readDeliveryRung,te as registerDocumentExposure,oe as registerExposure,G as renderDirListing,Re as renderKnowledgeBlock,le as renderKnowledgeForSubject,Fe as renderOnCommandDocsForSubject,he as renderOnReadDocs,ye as renderOnReadDocsForSubject,fe as renderPreferencesForSubject,ge as renderPreferencesSection,ve as renderWorkspaceOpenDocs,Ce as renderWorkspaceOpenDocsForSubject,ne as replaceContextExposureState,S as resolveDocName,s as rungAtLeast,a as rungRank,ae as saveContextExposureState,ce as scopeForCwd,se as sharedContextExposureState,xe as spineDepth,k as surfaceEntryParticipates,A as underOwningRoot,O as workspaceOpenRung};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type Rung } from './schema.js';
|
|
2
|
-
export type ExposureSource = 'system' | 'transcript';
|
|
3
|
-
interface ExposureRanks {
|
|
4
|
-
system?: number;
|
|
5
|
-
transcript?: number;
|
|
6
|
-
}
|
|
7
|
-
/** Memory visible to the currently loaded LLM context. */
|
|
8
|
-
export interface ContextExposureState {
|
|
9
|
-
/** Byte-stable preference splice for this context. */
|
|
10
|
-
preferenceSnapshot: string | null;
|
|
11
|
-
/** Canonical identity → ranks loaded from the system and transcript snapshots. */
|
|
12
|
-
exposures: Map<string, ExposureRanks>;
|
|
13
|
-
}
|
|
14
|
-
/** One full document body that entered a context — the analytics memory log's
|
|
15
|
-
* `loaded` event, before it is timestamped and sent. */
|
|
16
|
-
export interface MemoryLoad {
|
|
17
|
-
name: string;
|
|
18
|
-
scope: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ExposureTarget {
|
|
21
|
-
state: ContextExposureState;
|
|
22
|
-
source: ExposureSource;
|
|
23
|
-
/** Present only at real delivery sites; diagnostic renders pass none. */
|
|
24
|
-
loads?: MemoryLoad[];
|
|
25
|
-
}
|
|
26
|
-
/** JSON form exchanged with the daemon after Pi has materialized a baseline. */
|
|
27
|
-
export interface ContextExposureSnapshot {
|
|
28
|
-
preferenceSnapshot: string | null;
|
|
29
|
-
exposures: Record<string, {
|
|
30
|
-
system?: number;
|
|
31
|
-
transcript?: number;
|
|
32
|
-
}>;
|
|
33
|
-
}
|
|
34
|
-
export declare function snapshotContextExposure(state: ContextExposureState): ContextExposureSnapshot;
|
|
35
|
-
export declare function restoreContextExposure(value: ContextExposureSnapshot): ContextExposureState;
|
|
36
|
-
export declare function emptyContextExposureState(): ContextExposureState;
|
|
37
|
-
export declare function exposureTarget(state: ContextExposureState, source: ExposureSource, loads?: MemoryLoad[]): ExposureTarget;
|
|
38
|
-
export declare function exposedAtOrAbove(state: ContextExposureState, identity: string, rung: Rung): boolean;
|
|
39
|
-
/** The sole delivery mutation: max-fold one loaded identity into its source rank. */
|
|
40
|
-
export declare function registerExposure(target: ExposureTarget, identity: string, rung: Rung): void;
|
|
41
|
-
export declare function contentExposureIdentity(body: string): string | null;
|
|
42
|
-
export declare function documentExposedAtOrAbove(state: ContextExposureState, path: string, body: string, rung: Rung): boolean;
|
|
43
|
-
/** Register both the physical document and its non-empty content alias. A
|
|
44
|
-
* `content` registration of a body the context did not already hold is a full
|
|
45
|
-
* body entering the context, so it lands in the target's collector. */
|
|
46
|
-
export declare function registerDocumentExposure(target: ExposureTarget, doc: {
|
|
47
|
-
path: string;
|
|
48
|
-
body: string;
|
|
49
|
-
name: string;
|
|
50
|
-
scope: string;
|
|
51
|
-
}, rung: Rung): void;
|
|
52
|
-
/** Forget that a document was delivered into the TRANSCRIPT — both its physical
|
|
53
|
-
* identity and its content alias — while leaving any `system` rank intact,
|
|
54
|
-
* because the system prompt is rebuilt on every agent run and survives
|
|
55
|
-
* compaction. This is what re-arms a `pre-command` hold for guidance that
|
|
56
|
-
* compaction dropped out of the transcript. */
|
|
57
|
-
export declare function demoteDocumentTranscriptExposure(state: ContextExposureState, path: string, body: string): void;
|
|
58
|
-
export declare function freezePreferenceSnapshot(state: ContextExposureState, rendered: string): string;
|
|
59
|
-
export declare function cloneContextExposureState(source: ContextExposureState): ContextExposureState;
|
|
60
|
-
export declare function hasTranscriptExposure(state: ContextExposureState): boolean;
|
|
61
|
-
/** The context copied into a fork excludes the source's system snapshot. */
|
|
62
|
-
export declare function cloneTranscriptExposureState(source: ContextExposureState): ContextExposureState;
|
|
63
|
-
export declare function replaceContextExposureState(target: ContextExposureState, source: ContextExposureState): void;
|
|
64
|
-
export declare function contextExposureStatesEqual(left: ContextExposureState, right: ContextExposureState): boolean;
|
|
65
|
-
/** Fold state written by another process into the live context state. */
|
|
66
|
-
export declare function mergeContextExposureState(target: ContextExposureState, source: ContextExposureState): void;
|
|
67
|
-
export declare function sharedContextExposureState(nodeId: string): ContextExposureState;
|
|
68
|
-
/** v1/v2 ranks predate provenance and conservatively become transcript exposure. */
|
|
69
|
-
export declare function loadContextExposureState(nodeId: string): ContextExposureState;
|
|
70
|
-
export declare function saveContextExposureState(nodeId: string, state: ContextExposureState): void;
|
|
71
|
-
/** Clear in place so every extension closure observes the new context boundary. */
|
|
72
|
-
export declare function clearContextExposureState(nodeId: string): void;
|
|
73
|
-
/** Seed a fork with only context copied in the source transcript. */
|
|
74
|
-
export declare function initializeForkContextExposure(destinationNodeId: string, sourceNodeId: string | null): void;
|
|
75
|
-
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var s=(e,t)=>T(e,"name",{value:t,configurable:!0});import{createHash as M}from"node:crypto";import{injectedDocsPath as S,nodeRunDir as d}from"../canvas/paths.js";import{realpathOrSelf as w}from"../fs-utils.js";import{existsBeneath as g,readFileBeneath as B,setModeBeneath as R,statBeneath as z,unlinkBeneath as D,writeFileBeneath as N}from"../spaces/open-beneath.js";import{rungRank as v}from"./schema.js";function V(e){return{preferenceSnapshot:e.preferenceSnapshot,exposures:Object.fromEntries(e.exposures)}}s(V,"snapshotContextExposure");function W(e){if(e===null||typeof e!="object"||e.preferenceSnapshot!==null&&typeof e.preferenceSnapshot!="string"||e.exposures===null||typeof e.exposures!="object"||Array.isArray(e.exposures))throw new Error("invalid context exposure snapshot");const t=x();t.preferenceSnapshot=e.preferenceSnapshot;for(const[r,n]of Object.entries(e.exposures)){if(n===null||typeof n!="object"||Array.isArray(n)||n.system===void 0&&n.transcript===void 0||n.system!==void 0&&!u(n.system)||n.transcript!==void 0&&!u(n.transcript))throw new Error(`invalid context exposure ranks for '${r}'`);t.exposures.set(r,{...n})}return t}s(W,"restoreContextExposure");const F=v("content"),a=new Map;function x(){return{preferenceSnapshot:null,exposures:new Map}}s(x,"emptyContextExposureState");function $(e,t,r){return r===void 0?{state:e,source:t}:{state:e,source:t,loads:r}}s($,"exposureTarget");function u(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=F}s(u,"validRank");function J(e){return Math.max(e?.system??0,e?.transcript??0)}s(J,"activeRank");function O(e,t,r){return J(e.exposures.get(t))>=v(r)}s(O,"exposedAtOrAbove");function y(e,t,r){const n=v(r);if(n===0)return;const o=e.state.exposures.get(t)??{};(o[e.source]??0)>=n||e.state.exposures.set(t,{...o,[e.source]:n})}s(y,"registerExposure");function b(e){const t=e.trim();return t===""?null:`content-sha256:${M("sha256").update(t).digest("hex")}`}s(b,"contentExposureIdentity");function P(e,t,r,n){if(O(e,w(t),n))return!0;const o=b(r);return o!==null&&O(e,o,n)}s(P,"documentExposedAtOrAbove");function X(e,t,r){const{path:n,body:o}=t;r==="content"&&e.loads!==void 0&&!P(e.state,n,o,"content")&&e.loads.push({name:t.name,scope:t.scope}),y(e,w(n),r);const p=b(o);p!==null&&y(e,p,r)}s(X,"registerDocumentExposure");function j(e,t){const r=e.exposures.get(t);r!==void 0&&(u(r.system)?e.exposures.set(t,{system:r.system}):e.exposures.delete(t))}s(j,"dropTranscriptExposure");function Y(e,t,r){j(e,w(t));const n=b(r);n!==null&&j(e,n)}s(Y,"demoteDocumentTranscriptExposure");function Z(e,t){return e.preferenceSnapshot===null&&(e.preferenceSnapshot=t),e.preferenceSnapshot}s(Z,"freezePreferenceSnapshot");function I(e){return{preferenceSnapshot:e.preferenceSnapshot,exposures:new Map([...e.exposures].map(([t,r])=>[t,{...r}]))}}s(I,"cloneContextExposureState");function ee(e){return[...e.exposures.values()].some(t=>u(t.transcript))}s(ee,"hasTranscriptExposure");function q(e){const t=x(),r=$(t,"transcript");for(const[n,o]of e.exposures){const p=o.transcript;u(p)&&y(r,n,p===1?"name":p===2?"preview":"content")}return t}s(q,"cloneTranscriptExposureState");function k(e,t){e.preferenceSnapshot=t.preferenceSnapshot,e.exposures.clear();for(const[r,n]of t.exposures)e.exposures.set(r,{...n})}s(k,"replaceContextExposureState");function te(e,t){if(e.preferenceSnapshot!==t.preferenceSnapshot||e.exposures.size!==t.exposures.size)return!1;for(const[r,n]of e.exposures){const o=t.exposures.get(r);if(n.system!==o?.system||n.transcript!==o?.transcript)return!1}return!0}s(te,"contextExposureStatesEqual");function re(e,t){if(e.preferenceSnapshot!==null&&t.preferenceSnapshot!==null&&e.preferenceSnapshot!==t.preferenceSnapshot)throw new Error("context exposure state contains conflicting preference snapshots");e.preferenceSnapshot===null&&t.preferenceSnapshot!==null&&(e.preferenceSnapshot=t.preferenceSnapshot);for(const[r,n]of t.exposures){const o=e.exposures.get(r)??{},p=Math.max(o.system??0,n.system??0),i=Math.max(o.transcript??0,n.transcript??0);e.exposures.set(r,{...p>0?{system:p}:{},...i>0?{transcript:i}:{}})}}s(re,"mergeContextExposureState");function ne(e){let t=a.get(e);return t===void 0&&(t=x(),a.set(e,t)),t}s(ne,"sharedContextExposureState");function C(e){const t=S(e);let r;try{r=JSON.parse(B(d(e),t).toString("utf8"))}catch(c){if(c.code==="ENOENT")return x();throw new Error(`failed to read context exposure state at ${t}: ${c instanceof Error?c.message:String(c)}`)}const n=x(),o=$(n,"transcript");if(Array.isArray(r)){for(const c of r){if(typeof c!="string")throw new Error(`invalid v1 context exposure state at ${t}`);y(o,c,"content")}return n}if(r===null||typeof r!="object")throw new Error(`invalid context exposure state at ${t}`);const p=r;if(p.v===3){const c=p.preferenceSnapshot,f=p.exposures;if(c!==null&&typeof c!="string"||f===null||typeof f!="object"||Array.isArray(f))throw new Error(`invalid v3 context exposure state at ${t}`);n.preferenceSnapshot=c;for(const[E,m]of Object.entries(f)){if(m===null||typeof m!="object"||Array.isArray(m))throw new Error(`invalid v3 exposure entry '${E}' at ${t}`);const A=m,h=A.system,l=A.transcript;if(h!==void 0&&!u(h)||l!==void 0&&!u(l)||h===void 0&&l===void 0)throw new Error(`invalid v3 exposure ranks for '${E}' at ${t}`);n.exposures.set(E,{...u(h)?{system:h}:{},...u(l)?{transcript:l}:{}})}return n}if(p.v!==2)throw new Error(`unsupported context exposure state at ${t}`);const i=p.docs;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`invalid v2 context exposure state at ${t}`);for(const[c,f]of Object.entries(i)){if(!u(f))throw new Error(`invalid v2 exposure rank for '${c}' at ${t}`);y(o,c,f===1?"name":f===2?"preview":"content")}return n}s(C,"loadContextExposureState");function H(e,t){const r=d(e),n=S(e);let o=384;try{o=z(r,n).mode&511}catch(i){if(i.code!=="ENOENT")throw i}const p=`${JSON.stringify({v:3,preferenceSnapshot:t.preferenceSnapshot,exposures:Object.fromEntries(t.exposures)},null,2)}
|
|
2
|
-
`;N(r,n,p,{atomic:!0,mode:o}),R(r,n,o)}s(H,"saveContextExposureState");function oe(e){const t=a.get(e);t!==void 0&&k(t,x());try{D(d(e),S(e))}catch(r){if(r.code!=="ENOENT")throw r}}s(oe,"clearContextExposureState");function se(e,t){if(g(d(e),S(e))){const o=C(e),p=a.get(e);p===void 0?a.set(e,o):k(p,o);return}const r=t===null?x():q(C(t)),n=a.get(e);n===void 0?a.set(e,r):k(n,r),H(e,r)}s(se,"initializeForkContextExposure");export{oe as clearContextExposureState,I as cloneContextExposureState,q as cloneTranscriptExposureState,b as contentExposureIdentity,te as contextExposureStatesEqual,Y as demoteDocumentTranscriptExposure,P as documentExposedAtOrAbove,x as emptyContextExposureState,O as exposedAtOrAbove,$ as exposureTarget,Z as freezePreferenceSnapshot,ee as hasTranscriptExposure,se as initializeForkContextExposure,C as loadContextExposureState,re as mergeContextExposureState,X as registerDocumentExposure,y as registerExposure,k as replaceContextExposureState,W as restoreContextExposure,H as saveContextExposureState,ne as sharedContextExposureState,V as snapshotContextExposure};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { MemoryDoc } from '../memory-resolver.js';
|
|
2
|
-
import { type ExposureTarget } from './injected-store.js';
|
|
3
|
-
/** Exposure identity for a whole directory listing. Realpath identities start
|
|
4
|
-
* with `/`, so the scheme prefix never collides with a document. */
|
|
5
|
-
export declare function dirDedupKey(dir: string): string;
|
|
6
|
-
/** First-occurrence-wins name map over a precedence-ordered corpus: the doc
|
|
7
|
-
* that renders a name's line is the doc a read of that name would return. */
|
|
8
|
-
export declare function docsByName(corpus: readonly MemoryDoc[]): Map<string, MemoryDoc>;
|
|
9
|
-
/** Is `name` a directory in the merged name tree — i.e. does it have members?
|
|
10
|
-
* A doc that fronts a directory answers true here and still returns its own
|
|
11
|
-
* body, because one node carries both. The corpus root ('') is never a
|
|
12
|
-
* directory here: store roots merge into the whole catalog, which
|
|
13
|
-
* `memory list` owns. */
|
|
14
|
-
export declare function isDirName(byName: ReadonlyMap<string, MemoryDoc>, name: string): boolean;
|
|
15
|
-
/** The dirs a doc read discloses: the doc's own directory, then each ancestor
|
|
16
|
-
* walking up, the root excluded. `a/b/c` → `['a/b', 'a']`. */
|
|
17
|
-
export declare function ancestorDirsOf(name: string): string[];
|
|
18
|
-
/** The listings a read of `name` discloses, in render order: the node's own
|
|
19
|
-
* listing first when it has members (a directory document's members belong
|
|
20
|
-
* with its body), then each ancestor walking up. */
|
|
21
|
-
export declare function docListingDirs(byName: ReadonlyMap<string, MemoryDoc>, name: string): string[];
|
|
22
|
-
/** Render one directory's listing lines: `[[name]]: <when-and-why>` per member
|
|
23
|
-
* (bare `[[name]]` when it carries no routing line), childless members first
|
|
24
|
-
* and subdirectories after. `unlisted` members are omitted always;
|
|
25
|
-
* `filterDelivered` additionally drops members already exposed at preview rank
|
|
26
|
-
* or higher. A subdirectory always keeps its row — it advertises a subtree, so
|
|
27
|
-
* an omitted preview leaves the bare name. */
|
|
28
|
-
export declare function renderDirListing(byName: ReadonlyMap<string, MemoryDoc>, dir: string, target: ExposureTarget | null, filterDelivered: boolean, onPreview?: (doc: MemoryDoc) => void): string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var o=(e,n)=>h(e,"name",{value:n,configurable:!0});import{buildMemoryTree as x}from"../memory/tree.js";import{parseSubstrateDoc as D,previewLine as a}from"./schema.js";import{documentExposedAtOrAbove as b,registerDocumentExposure as w}from"./injected-store.js";function A(e){return`dir://${e}`}o(A,"dirDedupKey");function E(e){const n=new Map;for(const t of e)n.has(t.name)||n.set(t.name,t);return n}o(E,"docsByName");const f=new WeakMap;function p(e){const n=f.get(e);if(n!==void 0)return n;const t=x([...e.values()]);return f.set(e,t),t}o(p,"treeFor");function v(e,n){return n!==""&&p(e).isDirectory(n)}o(v,"isDirName");function y(e){const n=[],t=e.split("/");for(let r=t.length-1;r>=1;r--)n.push(t.slice(0,r).join("/"));return n}o(y,"ancestorDirsOf");function O(e,n){return[...v(e,n)?[n]:[],...y(n)]}o(O,"docListingDirs");function d(e,n,t){const r=D(e);return r?.unlisted||t&&n!==null&&b(n.state,e.path,e.body,"preview")?null:(n!==null&&w(n,e,"preview"),r===null?"":a(r))}o(d,"previewSuffix");function m(e,n){return n===null||n===""?`[[${e}]]`:`[[${e}]]: ${n}`}o(m,"line");function S(e,n,t,r,l){const s=p(e).node(n);if(s===null)return[];const c=[];for(const u of s.childDocuments){const i=d(u.document,t,r);i!==null&&(l?.(u.document),c.push(m(u.name,i)))}for(const u of s.childDirectories){const i=u.document===null?null:d(u.document,t,r);u.document!==null&&i!==null&&l?.(u.document),c.push(m(u.name,i))}return c}o(S,"renderDirListing");export{y as ancestorDirsOf,A as dirDedupKey,O as docListingDirs,E as docsByName,v as isDirName,S as renderDirListing};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { MemoryReadEventDTO } from '../../api/dto/analytics.js';
|
|
2
|
-
import type { MemoryLoad } from './injected-store.js';
|
|
3
|
-
export declare function memoryEvents(loads: readonly MemoryLoad[], type: MemoryReadEventDTO['type'], at?: string): MemoryReadEventDTO[];
|
|
4
|
-
/** One POST for all of `events`; resolves (never rejects) whether or not crtrd
|
|
5
|
-
* recorded them. Sends nothing when there is nothing to record. */
|
|
6
|
-
export declare function sendMemoryEvents(nodeId: string, events: MemoryReadEventDTO[]): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var r=(o,t)=>i(o,"name",{value:t,configurable:!0});import{localClient as c}from"../../api/node-transport.js";function s(o,t,e=new Date().toISOString()){return o.map(({name:n,scope:a})=>({name:n,scope:a,at:e,type:t}))}r(s,"memoryEvents");async function u(o,t){if(t.length!==0)try{await c({autostart:!1,coldStartPollWindowMs:0,timeoutMs:500}).recordMemoryReads(o,{events:t})}catch{}}r(u,"sendMemoryEvents");export{s as memoryEvents,u as sendMemoryEvents};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ExposureTarget } from './injected-store.js';
|
|
2
|
-
/** Surface docs matched by a successful read tool call. An unknown node id or
|
|
3
|
-
* an unreadable canvas renders nothing. */
|
|
4
|
-
export declare function renderOnReadDocs(nodeId: string, readFilePath: string, target?: ExposureTarget): string;
|
|
5
|
-
/** Surface matching workspace-open docs from the node's mounted project stores. */
|
|
6
|
-
export declare function renderWorkspaceOpenDocs(nodeId: string, target?: ExposureTarget): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var n=(e,t)=>i(e,"name",{value:t,configurable:!0});import{getNode as m}from"../canvas/index.js";import{appForNode as s}from"../canvas/node-agent-paths.js";import{automaticMemoryTarget as a}from"../spaces/permissions.js";import{emptyContextExposureState as c,exposureTarget as p}from"./injected-store.js";import{assembleNodeSubject as u}from"./subject.js";import{renderOnReadDocsForSubject as f,renderWorkspaceOpenDocsForSubject as l}from"./on-read.js";function S(e,t,o=p(c(),"transcript")){let r;try{r=u(e)}catch{return""}return r===null?"":f(r,t,o)}n(S,"renderOnReadDocs");function y(e,t=p(c(),"transcript")){const o=u(e),r=m(e);return o===null||r===null?"":l(o,r.cwd,r.profile_id??null,t,void 0,a({...r,grantee:s(e)}))}n(y,"renderWorkspaceOpenDocs");export{S as renderOnReadDocs,y as renderWorkspaceOpenDocs};
|