@north-light/crouter 0.3.227 → 0.3.229
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 +5 -5
- package/dist/api/client.js +3 -3
- package/dist/api/dto/broker-ops.d.ts +8 -0
- package/dist/api/dto/memory.d.ts +8 -7
- package/dist/api/dto/memory.js +2 -2
- package/dist/builtin-memory/04-base-worker.md +1 -1
- package/dist/builtin-memory/insights/init.md +5 -5
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/agent-shaping.md +11 -11
- package/dist/builtin-memory/internal/examples/INDEX.md +1 -1
- package/dist/builtin-memory/internal/memory-loading.md +6 -6
- package/dist/builtin-memory/internal/plugins.md +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +50 -37
- package/dist/clients/attach/__tests__/pane-tag-successor.test.js +56 -0
- package/dist/clients/attach/__tests__/profile-files.test.js +21 -0
- package/dist/clients/attach/chrome/inbox-strip.js +11 -7
- package/dist/clients/attach/session/pane-tag.d.ts +28 -2
- package/dist/clients/attach/session/pane-tag.js +48 -22
- package/dist/clients/attach/session/profile-files.d.ts +6 -0
- package/dist/clients/attach/session/profile-files.js +44 -11
- package/dist/clients/attach/slash/dispatch.js +4 -7
- package/dist/clients/attach/viewer.js +588 -596
- package/dist/commands/__tests__/surface-reload-target.test.js +21 -0
- package/dist/commands/api-client.d.ts +3 -7
- package/dist/commands/api-client.js +7 -12
- package/dist/commands/memory/__tests__/command-selector-and-mutation-guards.test.js +292 -0
- package/dist/commands/memory/__tests__/repository-root-lint.test.js +146 -0
- package/dist/commands/memory/delete.js +51 -24
- package/dist/commands/memory/edit.js +50 -10
- package/dist/commands/memory/find.js +105 -56
- package/dist/commands/memory/history.js +51 -31
- package/dist/commands/memory/lint.d.ts +0 -9
- package/dist/commands/memory/lint.js +78 -322
- package/dist/commands/memory/list.d.ts +12 -4
- package/dist/commands/memory/list.js +64 -25
- package/dist/commands/memory/move.js +103 -73
- package/dist/commands/memory/origin.js +35 -5
- package/dist/commands/memory/read.d.ts +4 -0
- package/dist/commands/memory/read.js +132 -80
- package/dist/commands/memory/shared.d.ts +115 -25
- package/dist/commands/memory/shared.js +331 -74
- package/dist/commands/memory/write.js +72 -21
- package/dist/commands/memory.js +2 -2
- package/dist/commands/node/create.d.ts +1 -1
- package/dist/commands/node/create.js +1 -1
- package/dist/commands/node/inspect.js +1 -1
- package/dist/commands/node/lifecycle.js +5 -5
- package/dist/commands/pkg/market-manage.js +25 -24
- package/dist/commands/pkg/plugin-manage.d.ts +22 -6
- package/dist/commands/pkg/plugin-manage.js +118 -25
- package/dist/commands/pkg/shared.d.ts +8 -0
- package/dist/commands/pkg/shared.js +23 -20
- package/dist/commands/surface-reload.d.ts +5 -0
- package/dist/commands/surface-reload.js +9 -1
- package/dist/commands/sys/__tests__/migrate.test.js +1140 -22
- package/dist/commands/sys/__tests__/sync-project-guidance.test.js +218 -0
- package/dist/commands/sys/migrate.js +126 -140
- package/dist/commands/sys/panels/profiles-panel.d.ts +66 -0
- package/dist/commands/sys/panels/profiles-panel.js +599 -0
- package/dist/commands/sys/settings-shell.d.ts +4 -2
- package/dist/commands/sys/settings-shell.js +35 -4
- package/dist/commands/sys/settings.js +21 -5
- package/dist/commands/sys/sync-deps.d.ts +2 -0
- package/dist/commands/sys/sync-deps.js +26 -15
- package/dist/commands/sys/sync-project-guidance.js +228 -145
- package/dist/commands/sys/sync-skills.js +28 -17
- package/dist/commands/sys/update.js +11 -3
- package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +15 -2
- package/dist/core/__tests__/config-change-delta.test.js +106 -0
- package/dist/core/__tests__/context-intro.test.js +13 -9
- package/dist/core/__tests__/daemon-boot.test.js +22 -16
- package/dist/core/__tests__/fixtures/memory-slash-live-probe.js +5 -1
- package/dist/core/__tests__/human-deliver.test.js +19 -0
- package/dist/core/__tests__/inline-memory-refs.test.js +50 -46
- package/dist/core/__tests__/{serial → integration}/broker-fork-seam.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/broker-sdk-wiring.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/broker-snapshot-history.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/command-plugins.test.js +94 -3
- package/dist/core/__tests__/{serial → integration}/deferred-no-wake.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/flagship-lifecycle.test.js +13 -27
- package/dist/core/__tests__/{serial → integration}/host-teardown-process-group.test.js +1 -1
- package/dist/core/__tests__/{serial → integration}/human-deliver-e2e.test.js +1 -1
- package/dist/core/__tests__/{live-mutation-verbs.test.js → integration/live-mutation-verbs.test.js} +22 -33
- package/dist/core/__tests__/{serial → integration}/live-mutation.test.js +21 -41
- package/dist/core/__tests__/integration/refresh-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/refresh-stall-recycle.test.js +1 -1
- package/dist/core/__tests__/integration/revive.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/revive.test.js +38 -19
- package/dist/core/__tests__/integration/spawn-root.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/spawn-root.test.js +104 -1
- package/dist/core/__tests__/integration/subscription-delivery.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/subscription-delivery.test.js +1 -1
- package/dist/core/__tests__/integration/tmux-surface.test.d.ts +1 -0
- package/dist/core/__tests__/{serial → integration}/tmux-surface.test.js +1 -1
- package/dist/core/__tests__/integration/worktree-land.test.d.ts +1 -0
- package/dist/core/__tests__/integration/worktree-land.test.js +400 -0
- package/dist/core/__tests__/integration/worktree-reap.test.d.ts +1 -0
- package/dist/core/__tests__/{serial/worktree.test.js → integration/worktree-reap.test.js} +6 -338
- package/dist/core/__tests__/kickoff.test.js +16 -5
- package/dist/core/__tests__/memory-resolver-precedence.test.js +122 -91
- package/dist/core/__tests__/nested-store-discovery.test.js +5 -3
- package/dist/core/__tests__/on-read-crouter-home-fence.test.js +2 -1
- package/dist/core/__tests__/on-read-dedup-resume.test.js +39 -27
- package/dist/core/__tests__/on-read-nested-store.test.js +19 -13
- package/dist/core/__tests__/profile-project-memory-delivery.test.js +138 -44
- package/dist/core/__tests__/repository-association.test.d.ts +1 -0
- package/dist/core/__tests__/repository-association.test.js +153 -0
- package/dist/core/__tests__/repository-root-identity.test.d.ts +1 -0
- package/dist/core/__tests__/repository-root-identity.test.js +219 -0
- package/dist/core/__tests__/review-model-floor.test.js +12 -4
- package/dist/core/__tests__/seam/memory-slash-node-relative-inventory.test.js +27 -11
- package/dist/core/__tests__/warm-claim-preference-snapshot.test.d.ts +1 -0
- package/dist/core/__tests__/warm-claim-preference-snapshot.test.js +40 -0
- package/dist/core/canvas/canvas.d.ts +3 -0
- package/dist/core/canvas/canvas.js +30 -10
- package/dist/core/canvas/db.js +28 -1
- package/dist/core/canvas/paths.d.ts +4 -6
- package/dist/core/canvas/paths.js +8 -6
- package/dist/core/canvas/render-source.js +2 -2
- package/dist/core/canvas/types.d.ts +9 -13
- package/dist/core/config.d.ts +3 -3
- package/dist/core/config.js +3 -3
- package/dist/core/exclusive-lock.d.ts +2 -0
- package/dist/core/exclusive-lock.js +21 -0
- package/dist/core/git.d.ts +0 -1
- package/dist/core/git.js +0 -3
- package/dist/core/human/__tests__/integration/inbox-core.test.d.ts +1 -0
- package/dist/core/human/feedback-companion.js +3 -0
- package/dist/core/human/scan.js +8 -1
- package/dist/core/keybindings/catalog.d.ts +2 -2
- package/dist/core/keybindings/catalog.js +2 -1
- package/dist/core/memory/doc-link-grammar.js +2 -2
- package/dist/core/memory/history.d.ts +24 -0
- package/dist/core/memory/history.js +66 -1
- package/dist/core/memory/identity.d.ts +65 -0
- package/dist/core/memory/identity.js +185 -0
- package/dist/core/memory/inline-ref-guidance.d.ts +1 -1
- package/dist/core/memory/inline-ref-guidance.js +1 -1
- package/dist/core/memory/inline-ref-inventory.d.ts +3 -10
- package/dist/core/memory/inline-ref-inventory.js +30 -62
- package/dist/core/memory/lint.d.ts +129 -0
- package/dist/core/memory/lint.js +517 -0
- package/dist/core/memory/project-namespace.d.ts +31 -0
- package/dist/core/memory/project-namespace.js +85 -0
- package/dist/core/memory/repository-association.d.ts +31 -0
- package/dist/core/memory/repository-association.js +129 -0
- package/dist/core/memory/tree.d.ts +39 -0
- package/dist/core/memory/tree.js +93 -0
- package/dist/core/memory-resolver.d.ts +193 -90
- package/dist/core/memory-resolver.js +461 -375
- package/dist/core/nested-stores.js +6 -13
- package/dist/core/profiles/select.d.ts +4 -1
- package/dist/core/profiles/select.js +108 -48
- package/dist/core/review/__tests__/capture-origin.test.js +2 -2
- package/dist/core/review/__tests__/stage-identity.test.js +2 -2
- package/dist/core/review/companion.js +11 -2
- package/dist/core/runtime/bearings.d.ts +2 -2
- package/dist/core/runtime/bearings.js +3 -3
- package/dist/core/runtime/broker/daemon-ops.d.ts +2 -2
- package/dist/core/runtime/broker/rebind.js +5 -0
- package/dist/core/runtime/broker-extension-render.d.ts +7 -3
- package/dist/core/runtime/broker-extension-render.js +10 -5
- package/dist/core/runtime/broker-persona-guidance.d.ts +19 -5
- package/dist/core/runtime/broker-persona-guidance.js +122 -27
- package/dist/core/runtime/deliver-live.d.ts +16 -4
- package/dist/core/runtime/deliver-live.js +29 -15
- package/dist/core/runtime/kickoff.d.ts +3 -3
- package/dist/core/runtime/kickoff.js +8 -16
- package/dist/core/runtime/launch.js +1 -1
- package/dist/core/runtime/lifecycle.js +2 -3
- package/dist/core/runtime/nodes.d.ts +3 -4
- package/dist/core/runtime/nodes.js +3 -4
- package/dist/core/runtime/persona.d.ts +8 -12
- package/dist/core/runtime/persona.js +24 -96
- package/dist/core/runtime/promote.d.ts +2 -2
- package/dist/core/runtime/promote.js +8 -21
- package/dist/core/runtime/revive.js +20 -17
- package/dist/core/runtime/spawn.js +18 -7
- package/dist/core/runtime/tmux-bindings.js +2 -3
- package/dist/core/runtime/warm-pool.js +3 -4
- package/dist/core/scope.js +2 -0
- package/dist/core/self-update.d.ts +0 -2
- package/dist/core/self-update.js +2 -35
- package/dist/core/substrate/__tests__/surface-match-memory-read.test.d.ts +1 -0
- package/dist/core/substrate/__tests__/surface-match-memory-read.test.js +28 -0
- package/dist/core/substrate/index.d.ts +2 -2
- package/dist/core/substrate/index.js +1 -1
- package/dist/core/substrate/injected-store.d.ts +43 -27
- package/dist/core/substrate/injected-store.js +208 -104
- package/dist/core/substrate/listings.d.ts +19 -12
- package/dist/core/substrate/listings.js +75 -52
- package/dist/core/substrate/on-read-node.d.ts +4 -7
- package/dist/core/substrate/on-read-node.js +6 -8
- package/dist/core/substrate/on-read.d.ts +22 -25
- package/dist/core/substrate/on-read.js +103 -147
- package/dist/core/substrate/render-node.d.ts +4 -7
- package/dist/core/substrate/render-node.js +5 -7
- package/dist/core/substrate/render.d.ts +21 -3
- package/dist/core/substrate/render.js +291 -223
- package/dist/core/substrate/schema.d.ts +1 -13
- package/dist/core/substrate/schema.js +5 -40
- package/dist/core/substrate/session-cache.d.ts +14 -4
- package/dist/core/substrate/session-cache.js +40 -22
- package/dist/core/substrate/surface-match.d.ts +9 -7
- package/dist/core/substrate/surface-match.js +26 -25
- package/dist/daemon/__tests__/helpers/source-daemon.d.ts +30 -0
- package/dist/daemon/__tests__/helpers/source-daemon.js +174 -0
- package/dist/daemon/__tests__/integration/migration-startup.test.d.ts +1 -0
- package/dist/daemon/__tests__/integration/migration-startup.test.js +97 -0
- package/dist/daemon/api/__tests__/bridge-heartbeat.test.js +21 -5
- package/dist/daemon/api/handlers/broker-ops.js +21 -16
- package/dist/daemon/api/handlers/memory.js +2 -0
- package/dist/daemon/crtrd.js +2 -0
- package/dist/daemon/human/finish.js +8 -1
- package/dist/daemon/manage.d.ts +0 -1
- package/dist/daemon/manage.js +7 -16
- package/dist/daemon/startup-policy.d.ts +1 -0
- package/dist/daemon/startup-policy.js +1 -0
- package/dist/migrations/001-surfaces-frontmatter.js +21 -109
- package/dist/migrations/002-profile-project-memory.js +1 -0
- package/dist/migrations/003-repository-root-memory-identity/front-door.d.ts +26 -0
- package/dist/migrations/003-repository-root-memory-identity/front-door.js +231 -0
- package/dist/migrations/003-repository-root-memory-identity/index.d.ts +2 -0
- package/dist/migrations/003-repository-root-memory-identity/index.js +513 -0
- package/dist/migrations/003-repository-root-memory-identity/references.d.ts +95 -0
- package/dist/migrations/003-repository-root-memory-identity/references.js +469 -0
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.d.ts +39 -0
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.js +349 -0
- package/dist/migrations/__tests__/activation-concurrency.test.d.ts +1 -0
- package/dist/migrations/__tests__/activation-concurrency.test.js +145 -0
- package/dist/migrations/__tests__/activation.test.d.ts +1 -0
- package/dist/migrations/__tests__/activation.test.js +149 -0
- package/dist/migrations/__tests__/deletion-and-root-declaration.test.d.ts +1 -0
- package/dist/migrations/__tests__/deletion-and-root-declaration.test.js +149 -0
- package/dist/migrations/activation.d.ts +16 -0
- package/dist/migrations/activation.js +78 -0
- package/dist/migrations/convergent.d.ts +14 -3
- package/dist/migrations/convergent.js +21 -10
- package/dist/migrations/corpus.d.ts +78 -0
- package/dist/migrations/corpus.js +497 -0
- package/dist/migrations/frontmatter-splice.d.ts +15 -0
- package/dist/migrations/frontmatter-splice.js +176 -0
- package/dist/migrations/registry.d.ts +6 -1
- package/dist/migrations/registry.js +7 -2
- package/dist/migrations/runner.d.ts +41 -0
- package/dist/migrations/runner.js +81 -0
- package/dist/migrations/types.d.ts +148 -9
- package/dist/migrations/types.js +9 -2
- package/dist/pi-extensions/__tests__/canvas-context-intro.test.js +225 -17
- package/dist/pi-extensions/__tests__/canvas-goal-capture-envelope.test.js +11 -3
- package/dist/pi-extensions/canvas-context-intro.d.ts +3 -5
- package/dist/pi-extensions/canvas-context-intro.js +50 -46
- package/dist/pi-extensions/canvas-doc-substrate.d.ts +1 -8
- package/dist/pi-extensions/canvas-doc-substrate.js +55 -122
- package/dist/pi-extensions/canvas-stophook.js +6 -13
- package/dist/shared/generated-context.d.ts +0 -3
- package/dist/shared/generated-context.js +0 -57
- package/dist/shared/tool-groups.js +2 -3
- package/dist/types.d.ts +8 -11
- package/dist/types.js +4 -31
- package/package.json +5 -4
- package/runtime.lock.json +2 -2
- package/dist/builtin-memory/05-kinds/design/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/design/01-orchestrator.md +0 -15
- package/dist/builtin-memory/05-kinds/design/design-contract.md +0 -19
- package/dist/builtin-memory/05-kinds/developer/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/developer/01-orchestrator.md +0 -15
- package/dist/builtin-memory/05-kinds/plan/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/01-orchestrator.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/plan-contract.md +0 -28
- package/dist/builtin-memory/05-kinds/plan/reviewers/architecture-fit.md +0 -15
- package/dist/builtin-memory/05-kinds/plan/reviewers/code-smells.md +0 -15
- package/dist/builtin-memory/05-kinds/plan/reviewers/lens-contract.md +0 -13
- package/dist/builtin-memory/05-kinds/plan/reviewers/pattern-consistency.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/reviewers/requirements-coverage.md +0 -17
- package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +0 -17
- package/dist/builtin-memory/05-kinds/spec/00-base.md +0 -17
- package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +0 -15
- package/dist/builtin-memory/05-kinds/spec/requirements.md +0 -15
- package/dist/builtin-memory/design/guide.md +0 -35
- package/dist/builtin-memory/design/roadmap.md +0 -21
- package/dist/builtin-memory/development.md +0 -113
- package/dist/builtin-memory/plan/roadmap.md +0 -25
- package/dist/builtin-memory/spec/guide.md +0 -53
- package/dist/builtin-memory/spec/requirements.md +0 -29
- package/dist/builtin-memory/spec/roadmap.md +0 -36
- package/dist/builtin-memory/testing.md +0 -39
- /package/dist/api/__tests__/{serial → integration}/client.test.d.ts +0 -0
- /package/dist/api/__tests__/{serial → integration}/client.test.js +0 -0
- /package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/{serial → integration}/provider-rotation.test.ts +0 -0
- /package/dist/clients/{inbox/__tests__/serial/inbox-controller.test.d.ts → attach/__tests__/pane-tag-successor.test.d.ts} +0 -0
- /package/dist/clients/{inbox/__tests__/serial/mount-panel.test.d.ts → attach/__tests__/profile-files.test.d.ts} +0 -0
- /package/dist/{core/__tests__/live-mutation-verbs.test.d.ts → clients/inbox/__tests__/integration/inbox-controller.test.d.ts} +0 -0
- /package/dist/clients/inbox/__tests__/{serial → integration}/inbox-controller.test.js +0 -0
- /package/dist/{core/__tests__/serial/broker-fork-seam.test.d.ts → clients/inbox/__tests__/integration/mount-panel.test.d.ts} +0 -0
- /package/dist/clients/inbox/__tests__/{serial → integration}/mount-panel.test.js +0 -0
- /package/dist/{core/__tests__/serial/broker-sdk-wiring.test.d.ts → commands/__tests__/surface-reload-target.test.d.ts} +0 -0
- /package/dist/{core/__tests__/serial/broker-snapshot-history.test.d.ts → commands/memory/__tests__/command-selector-and-mutation-guards.test.d.ts} +0 -0
- /package/dist/{core/__tests__/serial/command-plugins.test.d.ts → commands/memory/__tests__/repository-root-lint.test.d.ts} +0 -0
- /package/dist/{core/__tests__/serial/deferred-no-wake.test.d.ts → commands/sys/__tests__/sync-project-guidance.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/flagship-lifecycle.test.d.ts → config-change-delta.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/host-teardown-process-group.test.d.ts → integration/broker-fork-seam.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/human-deliver-e2e.test.d.ts → integration/broker-sdk-wiring.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/live-mutation.test.d.ts → integration/broker-snapshot-history.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/refresh-stall-recycle.test.d.ts → integration/command-plugins.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/revive.test.d.ts → integration/deferred-no-wake.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/spawn-root.test.d.ts → integration/flagship-lifecycle.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/subscription-delivery.test.d.ts → integration/host-teardown-process-group.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/tmux-surface.test.d.ts → integration/human-deliver-e2e.test.d.ts} +0 -0
- /package/dist/core/__tests__/{serial/worktree.test.d.ts → integration/live-mutation-verbs.test.d.ts} +0 -0
- /package/dist/core/{human/__tests__/serial/inbox-core.test.d.ts → __tests__/integration/live-mutation.test.d.ts} +0 -0
- /package/dist/core/human/__tests__/{serial → integration}/inbox-core.test.js +0 -0
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import type { StateMigration } from './types.js';
|
|
1
|
+
import type { OnDiskMigrationLane, StateMigration } from './types.js';
|
|
2
2
|
export declare const STATE_MIGRATIONS: readonly StateMigration[];
|
|
3
|
+
export interface OnDiskMigrationIdentity {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly lane: OnDiskMigrationLane;
|
|
6
|
+
}
|
|
7
|
+
export declare function onDiskMigrationIdentity(): readonly OnDiskMigrationIdentity[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The ordered state-migration registry — ONE list for both lanes, so a cut
|
|
2
2
|
// that spans canvas-db and document stores ships as adjacent entries.
|
|
3
3
|
//
|
|
4
|
-
// Authoring contract (each migration is one file, `NNN-<desc>.ts`,
|
|
5
|
-
// here in order):
|
|
4
|
+
// Authoring contract (each migration is one file, `NNN-<desc>.ts`, or one
|
|
5
|
+
// directory, `NNN-<desc>/index.ts`, appended here in order):
|
|
6
6
|
// • Idempotent. A convergent or profile-manifest migration re-runs on every
|
|
7
7
|
// `crtr sys migrate`, so applying it to already-migrated state must plan
|
|
8
8
|
// zero changes. A journaled migration runs once per database via
|
|
@@ -18,7 +18,12 @@
|
|
|
18
18
|
// build's V-1 gate).
|
|
19
19
|
import { surfacesFrontmatterMigration } from './001-surfaces-frontmatter.js';
|
|
20
20
|
import { profileProjectMemoryMigration } from './002-profile-project-memory.js';
|
|
21
|
+
import { repositoryRootMemoryIdentityMigration } from './003-repository-root-memory-identity/index.js';
|
|
21
22
|
export const STATE_MIGRATIONS = [
|
|
22
23
|
surfacesFrontmatterMigration,
|
|
23
24
|
profileProjectMemoryMigration,
|
|
25
|
+
repositoryRootMemoryIdentityMigration,
|
|
24
26
|
];
|
|
27
|
+
export function onDiskMigrationIdentity() {
|
|
28
|
+
return STATE_MIGRATIONS.filter((migration) => migration.lane !== 'journaled').map(({ id, lane }) => ({ id, lane }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CorpusDiscovery } from './corpus.js';
|
|
2
|
+
import type { CorpusBlocker, CorpusIdentityRename, CorpusRepositoryDecision, CorpusStorePrefix, CorpusReferenceRewrite, OnDiskMigrationLane, StoreSnapshot } from './types.js';
|
|
3
|
+
export type OnDiskMigrationPhase = 'not-started' | 'planned' | 'written';
|
|
4
|
+
export interface OnDiskMigrationApplied {
|
|
5
|
+
store: string;
|
|
6
|
+
lane: OnDiskMigrationLane;
|
|
7
|
+
migration: string;
|
|
8
|
+
files: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface OnDiskMigrationSkipped {
|
|
11
|
+
store: string;
|
|
12
|
+
relPath: string;
|
|
13
|
+
error: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OnDiskMigrationRunResult {
|
|
16
|
+
profiles: number;
|
|
17
|
+
discovery: CorpusDiscovery;
|
|
18
|
+
snapshots: ReadonlyMap<string, StoreSnapshot>;
|
|
19
|
+
changed: number;
|
|
20
|
+
applied: OnDiskMigrationApplied[];
|
|
21
|
+
skipped: OnDiskMigrationSkipped[];
|
|
22
|
+
blocked: boolean;
|
|
23
|
+
blockers: CorpusBlocker[];
|
|
24
|
+
corpusPhase: OnDiskMigrationPhase;
|
|
25
|
+
wrote: {
|
|
26
|
+
profileManifests: string[];
|
|
27
|
+
documents: string[];
|
|
28
|
+
corpusConsumers: string[];
|
|
29
|
+
corpusIdentities: string[];
|
|
30
|
+
};
|
|
31
|
+
repositories: CorpusRepositoryDecision[];
|
|
32
|
+
storePrefixes: CorpusStorePrefix[];
|
|
33
|
+
renames: CorpusIdentityRename[];
|
|
34
|
+
references: CorpusReferenceRewrite[];
|
|
35
|
+
finalVerificationSucceeded: boolean;
|
|
36
|
+
dryRun: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare function runOnDiskMigrations(opts?: {
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
explicitDirs?: readonly string[];
|
|
41
|
+
}): Promise<OnDiskMigrationRunResult>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { profilesRoot, withProfileManifestLock } from '../core/profiles/manifest.js';
|
|
2
|
+
import { buildCorpusSnapshot, discoverCorpus, loadCorpusSnapshots, parseFailureBlockers, runCorpusMigrations, } from './corpus.js';
|
|
3
|
+
import { runConvergentMigrations } from './convergent.js';
|
|
4
|
+
import { runProfileManifestMigrations } from './profile-manifests.js';
|
|
5
|
+
export async function runOnDiskMigrations(opts = {}) {
|
|
6
|
+
const dryRun = opts.dryRun === true;
|
|
7
|
+
const applied = [];
|
|
8
|
+
const skipped = [];
|
|
9
|
+
const profilesDir = profilesRoot();
|
|
10
|
+
const profileRun = runProfileManifestMigrations(profilesDir, { dryRun, withLock: withProfileManifestLock });
|
|
11
|
+
const profileBlockers = [];
|
|
12
|
+
for (const row of profileRun.applied) {
|
|
13
|
+
applied.push({ store: profilesDir, lane: 'profile-manifest', migration: row.migration, files: [row.path] });
|
|
14
|
+
}
|
|
15
|
+
for (const row of profileRun.skipped) {
|
|
16
|
+
const relPath = `${row.profileId}/profile.json`;
|
|
17
|
+
skipped.push({ store: profilesDir, relPath, error: row.error });
|
|
18
|
+
profileBlockers.push({
|
|
19
|
+
kind: 'parse-failure',
|
|
20
|
+
message: `${row.path}: profile manifest is not valid JSON (${row.error}) — its projects cannot be discovered; fix the file and re-run \`crtr sys migrate\``,
|
|
21
|
+
storeRoot: profilesDir,
|
|
22
|
+
path: row.path,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const discovery = await discoverCorpus({ profiles: profileRun.snapshots, explicitDirs: opts.explicitDirs });
|
|
26
|
+
const parseFailures = [];
|
|
27
|
+
const folded = new Map();
|
|
28
|
+
for (const store of discovery.stores) {
|
|
29
|
+
if (!store.writable)
|
|
30
|
+
continue;
|
|
31
|
+
const result = runConvergentMigrations(store.descriptor.storeRoot, { dryRun });
|
|
32
|
+
folded.set(store.key, result.snapshot);
|
|
33
|
+
for (const row of result.applied) {
|
|
34
|
+
applied.push({ store: store.key, lane: 'convergent', migration: row.migration, files: row.files });
|
|
35
|
+
}
|
|
36
|
+
for (const row of result.skipped)
|
|
37
|
+
parseFailures.push({ storeRoot: store.key, ...row });
|
|
38
|
+
}
|
|
39
|
+
const loaded = loadCorpusSnapshots(discovery, { preloaded: folded });
|
|
40
|
+
parseFailures.push(...loaded.skipped);
|
|
41
|
+
for (const row of parseFailures)
|
|
42
|
+
skipped.push({ store: row.storeRoot, relPath: row.relPath, error: row.error });
|
|
43
|
+
const corpusRun = runCorpusMigrations(buildCorpusSnapshot(discovery, loaded.snapshots), {
|
|
44
|
+
dryRun,
|
|
45
|
+
blockers: [...profileBlockers, ...discovery.blockers, ...parseFailureBlockers(parseFailures)],
|
|
46
|
+
rebuild: () => buildCorpusSnapshot(discovery, loadCorpusSnapshots(discovery).snapshots),
|
|
47
|
+
});
|
|
48
|
+
const corpusWrote = corpusRun.wrote.consumers.length > 0 || corpusRun.wrote.identities.length > 0;
|
|
49
|
+
if (corpusWrote) {
|
|
50
|
+
for (const row of corpusRun.planned) {
|
|
51
|
+
const files = [...row.consumers, ...row.identities];
|
|
52
|
+
if (files.length > 0)
|
|
53
|
+
applied.push({ store: 'corpus', lane: 'corpus', migration: row.migration, files });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const corpusPhase = dryRun ? 'planned' : corpusWrote ? 'written' : 'not-started';
|
|
57
|
+
const blocked = profileBlockers.length > 0 || corpusRun.blocked;
|
|
58
|
+
return {
|
|
59
|
+
profiles: profileRun.profiles,
|
|
60
|
+
discovery,
|
|
61
|
+
snapshots: loaded.snapshots,
|
|
62
|
+
changed: applied.reduce((count, row) => count + row.files.length, 0),
|
|
63
|
+
applied,
|
|
64
|
+
skipped,
|
|
65
|
+
blocked,
|
|
66
|
+
blockers: corpusRun.blockers,
|
|
67
|
+
corpusPhase,
|
|
68
|
+
wrote: {
|
|
69
|
+
profileManifests: applied.filter((row) => row.lane === 'profile-manifest').flatMap((row) => row.files),
|
|
70
|
+
documents: applied.filter((row) => row.lane === 'convergent').flatMap((row) => row.files),
|
|
71
|
+
corpusConsumers: corpusRun.wrote.consumers,
|
|
72
|
+
corpusIdentities: corpusRun.wrote.identities,
|
|
73
|
+
},
|
|
74
|
+
repositories: corpusRun.repositories,
|
|
75
|
+
storePrefixes: corpusRun.storePrefixes,
|
|
76
|
+
renames: corpusRun.renames,
|
|
77
|
+
references: corpusRun.references,
|
|
78
|
+
finalVerificationSucceeded: corpusRun.verified && !blocked,
|
|
79
|
+
dryRun,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { MemoryStoreDescriptor, MemoryTarget } from '../core/memory-resolver.js';
|
|
3
|
+
import type { ProjectNamespaceSource } from '../core/memory/project-namespace.js';
|
|
2
4
|
import type { ProfileManifest } from '../types.js';
|
|
3
5
|
export interface JournaledMigration {
|
|
4
6
|
lane: 'journaled';
|
|
@@ -8,17 +10,13 @@ export interface JournaledMigration {
|
|
|
8
10
|
* (a re-run after a partial application completes rather than corrupts). */
|
|
9
11
|
apply(db: DatabaseSync, canvasHome: string): void;
|
|
10
12
|
}
|
|
11
|
-
export interface ConvergentMigrationContext {
|
|
12
|
-
/** Frozen pre-cut directory-INDEX resolution for this store's owning memory
|
|
13
|
-
* corpus. Null means rewriting the bare ref would not preserve meaning. */
|
|
14
|
-
legacyDirectoryIndex(name: string): string | null;
|
|
15
|
-
}
|
|
16
13
|
export interface ConvergentMigration {
|
|
14
|
+
readonly id: string;
|
|
17
15
|
lane: 'convergent';
|
|
18
16
|
description: string;
|
|
19
17
|
/** Pure planning: return the full new text of each doc to rewrite. The
|
|
20
18
|
* runner filters no-op changes and performs the writes. */
|
|
21
|
-
apply(store: StoreSnapshot
|
|
19
|
+
apply(store: StoreSnapshot): DocChange[];
|
|
22
20
|
}
|
|
23
21
|
/** One stored `profile.json` handed to the profile-manifest lane. */
|
|
24
22
|
export interface ProfileManifestInput {
|
|
@@ -31,6 +29,7 @@ export interface ProfileManifestInput {
|
|
|
31
29
|
raw: Record<string, unknown>;
|
|
32
30
|
}
|
|
33
31
|
export interface ProfileManifestMigration {
|
|
32
|
+
readonly id: string;
|
|
34
33
|
lane: 'profile-manifest';
|
|
35
34
|
description: string;
|
|
36
35
|
/** Pure planning: the full replacement record, or null when this manifest is
|
|
@@ -38,7 +37,9 @@ export interface ProfileManifestMigration {
|
|
|
38
37
|
* run fails rather than persisting a guessed value. */
|
|
39
38
|
apply(input: ProfileManifestInput): Record<string, unknown> | null;
|
|
40
39
|
}
|
|
41
|
-
export type
|
|
40
|
+
export type OnDiskMigration = ConvergentMigration | ProfileManifestMigration | CorpusMigration;
|
|
41
|
+
export type OnDiskMigrationLane = OnDiskMigration['lane'];
|
|
42
|
+
export type StateMigration = JournaledMigration | OnDiskMigration;
|
|
42
43
|
/** One profile's manifest after every profile-manifest migration folded —
|
|
43
44
|
* the bytes on disk after a write run, and the bytes a write run WOULD have
|
|
44
45
|
* produced under `--dry-run`. */
|
|
@@ -67,6 +68,144 @@ export interface StoreSnapshot {
|
|
|
67
68
|
/** One planned rewrite: the full new file text for `path`. */
|
|
68
69
|
export interface DocChange {
|
|
69
70
|
path: string;
|
|
70
|
-
/** Complete replacement text for the file. */
|
|
71
|
-
after: string;
|
|
71
|
+
/** Complete replacement text for the file, or null to delete it. */
|
|
72
|
+
after: string | null;
|
|
73
|
+
}
|
|
74
|
+
/** Why a root or store entered the corpus. `cwd-ancestor` is the walk up from
|
|
75
|
+
* the invoking directory, `profile-project` a project a profile manifest names,
|
|
76
|
+
* `descendant` the exhaustive nested-store walk below either, `explicit-dir` a
|
|
77
|
+
* `--dir` argument. */
|
|
78
|
+
export type CorpusDiscoveryReason = 'user' | 'profile' | 'profile-project' | 'cwd-ancestor' | 'descendant' | 'node' | 'plugin' | 'builtin' | 'explicit-dir';
|
|
79
|
+
/** How far discovery searched from one root: the root's own store only, the
|
|
80
|
+
* ancestor walk above it, the exhaustive descendant walk below it, its
|
|
81
|
+
* installed plugins, or the canvas node stores. */
|
|
82
|
+
export type CorpusDiscoveryBoundary = 'store' | 'ancestors' | 'descendants' | 'plugins' | 'nodes';
|
|
83
|
+
/** One place discovery looked, reported whether or not it yielded a store —
|
|
84
|
+
* the frontier an operator reads to see what a run could NOT have seen. */
|
|
85
|
+
export interface CorpusDiscoveryRoot {
|
|
86
|
+
reason: CorpusDiscoveryReason;
|
|
87
|
+
/** The directory searched: a `.crouter` root, a store dir, or a scan root. */
|
|
88
|
+
root: string;
|
|
89
|
+
boundary: CorpusDiscoveryBoundary;
|
|
90
|
+
/** Profile id, node id, or the `--dir` argument that produced this root. */
|
|
91
|
+
detail?: string;
|
|
92
|
+
}
|
|
93
|
+
/** One reason a store is in the corpus. A store reached several ways keeps
|
|
94
|
+
* every reason — deduping physical stores must not erase why they matter. */
|
|
95
|
+
export interface CorpusStoreDiscovery {
|
|
96
|
+
reason: CorpusDiscoveryReason;
|
|
97
|
+
root: string;
|
|
98
|
+
targetId?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface CorpusStore {
|
|
101
|
+
/** Realpath of the memory dir: the dedup key, and the id every report row and
|
|
102
|
+
* blocker cites this store by. */
|
|
103
|
+
key: string;
|
|
104
|
+
descriptor: MemoryStoreDescriptor;
|
|
105
|
+
/** Documents after the per-store convergent lane folded, so the corpus lane
|
|
106
|
+
* plans against exactly the bytes a write run leaves on disk. */
|
|
107
|
+
snapshot: StoreSnapshot;
|
|
108
|
+
discovery: readonly CorpusStoreDiscovery[];
|
|
109
|
+
/** Ids of every target that mounts this store. Empty for a store no target
|
|
110
|
+
* reaches — a disabled plugin, a node store whose metadata is unreadable. */
|
|
111
|
+
targets: readonly string[];
|
|
112
|
+
/** False for builtin: package-owned, regenerated on install, corpus INPUT
|
|
113
|
+
* only (link resolution and lint validation), never written. */
|
|
114
|
+
writable: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface CorpusTarget {
|
|
117
|
+
/** `${profileId ?? '-'}:${nodeId ?? '-'}:${realCwd}`. */
|
|
118
|
+
id: string;
|
|
119
|
+
kind: 'cwd' | 'profile' | 'project' | 'node';
|
|
120
|
+
/** Profile id, node id, or the directory this target speaks for. */
|
|
121
|
+
origin: string;
|
|
122
|
+
target: MemoryTarget;
|
|
123
|
+
/** Store keys in this target's source precedence order. */
|
|
124
|
+
storeKeys: readonly string[];
|
|
125
|
+
}
|
|
126
|
+
export interface CorpusSnapshot {
|
|
127
|
+
stores: readonly CorpusStore[];
|
|
128
|
+
targets: readonly CorpusTarget[];
|
|
129
|
+
roots: readonly CorpusDiscoveryRoot[];
|
|
130
|
+
store(key: string): CorpusStore | undefined;
|
|
131
|
+
/** The target's stores in precedence order; empty for an unknown target. */
|
|
132
|
+
storesForTarget(targetId: string): CorpusStore[];
|
|
133
|
+
}
|
|
134
|
+
/** Why a corpus run may not write. `inaccessible-root`/`inaccessible-target`
|
|
135
|
+
* mean discovery could not see all of the corpus; `package-owned-corpus` is a
|
|
136
|
+
* store the run may only read (builtin, or a package handed in read-only)
|
|
137
|
+
* whose documents still need an identity rewrite; `verification` is raised
|
|
138
|
+
* after both write phases, against a corpus rebuilt from file truth. */
|
|
139
|
+
export type CorpusBlockerKind = 'inaccessible-root' | 'inaccessible-target' | 'parse-failure' | 'namespace' | 'association' | 'front-door' | 'divergent-reference' | 'unsafe-route' | 'collision' | 'package-owned-corpus' | 'verification';
|
|
140
|
+
export interface CorpusBlocker {
|
|
141
|
+
kind: CorpusBlockerKind;
|
|
142
|
+
/** What is wrong and what the operator does about it. */
|
|
143
|
+
message: string;
|
|
144
|
+
storeRoot?: string;
|
|
145
|
+
targetId?: string;
|
|
146
|
+
/** The one file at fault. */
|
|
147
|
+
path?: string;
|
|
148
|
+
/** The canonical name or namespace at fault. */
|
|
149
|
+
name?: string;
|
|
150
|
+
/** Every file at fault when the finding is a relationship between them. */
|
|
151
|
+
paths?: string[];
|
|
152
|
+
}
|
|
153
|
+
export interface CorpusRepositoryDecision {
|
|
154
|
+
repositoryRoot: string;
|
|
155
|
+
repositoryKey: string;
|
|
156
|
+
declarationPath: string;
|
|
157
|
+
namespace: string;
|
|
158
|
+
source: 'declared' | ProjectNamespaceSource;
|
|
159
|
+
action: 'kept' | 'created' | 'filled-linked-root';
|
|
160
|
+
}
|
|
161
|
+
export type FrontDoorAction = 'none' | 'kept-root' | 'created-root' | `transferred-from:${string}`;
|
|
162
|
+
export interface CorpusStorePrefix {
|
|
163
|
+
storeRoot: string;
|
|
164
|
+
ownerDir: string;
|
|
165
|
+
repositoryRoot: string;
|
|
166
|
+
ownerRelativePath: string;
|
|
167
|
+
oldPrefix: string;
|
|
168
|
+
oldRule: 'pre-003' | 'per-store-declaration';
|
|
169
|
+
effectivePrefix: string;
|
|
170
|
+
nestedDeclarationAction: 'none' | 'removed' | 'synthetic-index-removed';
|
|
171
|
+
/** Only the repository-root store reports the repository's front-door action. */
|
|
172
|
+
frontDoorAction: FrontDoorAction;
|
|
173
|
+
}
|
|
174
|
+
export interface CorpusIdentityRename {
|
|
175
|
+
storeRoot: string;
|
|
176
|
+
path: string;
|
|
177
|
+
from: string;
|
|
178
|
+
to: string;
|
|
179
|
+
}
|
|
180
|
+
export interface CorpusReferenceRewrite {
|
|
181
|
+
storeRoot: string;
|
|
182
|
+
path: string;
|
|
183
|
+
kind: 'link' | 'memory-read';
|
|
184
|
+
from: string;
|
|
185
|
+
to: string;
|
|
186
|
+
}
|
|
187
|
+
export interface CorpusPlan {
|
|
188
|
+
/** A blocker anywhere stops the whole lane: nothing is written in any store. */
|
|
189
|
+
blockers: CorpusBlocker[];
|
|
190
|
+
/** Phase 1 — rewrites of authored links and routes that POINT AT an identity. */
|
|
191
|
+
consumers: DocChange[];
|
|
192
|
+
/** Phase 2 — rewrites that change a document's own identity. A non-null
|
|
193
|
+
* `after` is the file's complete final text INCLUDING that same file's
|
|
194
|
+
* phase-1 consumer rewrites: phase 2 writes last and would otherwise revert
|
|
195
|
+
* them. A null `after` deletes an obsolete synthetic identity document. */
|
|
196
|
+
identities: DocChange[];
|
|
197
|
+
repositories: CorpusRepositoryDecision[];
|
|
198
|
+
storePrefixes: CorpusStorePrefix[];
|
|
199
|
+
renames: CorpusIdentityRename[];
|
|
200
|
+
references: CorpusReferenceRewrite[];
|
|
201
|
+
}
|
|
202
|
+
export interface CorpusMigration {
|
|
203
|
+
readonly id: string;
|
|
204
|
+
lane: 'corpus';
|
|
205
|
+
description: string;
|
|
206
|
+
/** Pure planning over every discovered store at once. */
|
|
207
|
+
plan(corpus: CorpusSnapshot): CorpusPlan;
|
|
208
|
+
/** Re-checked against a corpus rebuilt from file truth AFTER both write
|
|
209
|
+
* phases; findings surface as `verification` blockers. */
|
|
210
|
+
verify?(corpus: CorpusSnapshot): CorpusBlocker[];
|
|
72
211
|
}
|
package/dist/migrations/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// State-migration shapes.
|
|
1
|
+
// State-migration shapes. Four lanes, split by which store owns the state:
|
|
2
2
|
//
|
|
3
3
|
// journaled — canvas-db state. Runs inside the db's ordered migration
|
|
4
4
|
// chain (core/canvas/db.ts appends these to MIGRATIONS), so
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
// the document lane, but each manifest folds under the same
|
|
13
13
|
// per-profile lock add/remove take, and a structure the
|
|
14
14
|
// migration cannot convert throws instead of being guessed.
|
|
15
|
+
// corpus — on-disk memory documents again, but planned across EVERY
|
|
16
|
+
// discovered store at once: an identity a document changes
|
|
17
|
+
// is an address other stores' links and routes point at, so
|
|
18
|
+
// the plan is global (one blocker anywhere writes nothing
|
|
19
|
+
// anywhere) and applies in two phases — every consumer
|
|
20
|
+
// rewrite, then every identity rewrite.
|
|
15
21
|
//
|
|
16
|
-
// `crtr sys migrate` runs
|
|
22
|
+
// `crtr sys migrate` runs all three on-disk lanes: profile manifests, then the
|
|
23
|
+
// per-store convergent lane, then the corpus lane over the folded result.
|
|
17
24
|
export {};
|