@north-light/cli 0.3.532 → 0.3.534
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 +6 -3
- package/dist/api/client.js +1 -1
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/canvas.d.ts +2 -0
- package/dist/api/dto/crons.d.ts +3 -1
- package/dist/builtin-memory/crouter-sdk/release-notes.md +13 -0
- package/dist/builtin-memory/northlight-apps/providers/README.md +2 -0
- package/dist/builtin-memory/northlight-apps/providers/sms.md +2 -0
- package/dist/clients/attach/chrome/inbox-strip.d.ts +6 -1
- package/dist/clients/attach/chrome/inbox-strip.js +1 -1
- package/dist/clients/attach/chrome/roster.js +1 -1
- package/dist/clients/attach/session/chrome-refresh.d.ts +12 -3
- package/dist/clients/attach/session/chrome-refresh.js +1 -1
- package/dist/clients/attach/session/document-links.js +1 -1
- package/dist/clients/attach/viewer.js +586 -587
- package/dist/commands/api-client.js +3 -3
- package/dist/commands/canvas.js +1 -1
- package/dist/commands/node/inspect.js +6 -6
- package/dist/commands/sys/context/expose.js +2 -2
- package/dist/commands/sys/db.d.ts +1 -0
- package/dist/commands/sys/db.js +1 -0
- package/dist/commands/sys.js +1 -1
- package/dist/core/bash-guard.js +9 -3
- package/dist/core/canvas/canvas.d.ts +12 -2
- package/dist/core/canvas/canvas.js +23 -20
- package/dist/core/canvas/daemon-actions.d.ts +0 -3
- package/dist/core/canvas/daemon-actions.js +7 -24
- package/dist/core/canvas/daemon-owner.d.ts +3 -0
- package/dist/core/canvas/daemon-owner.js +1 -6
- package/dist/core/canvas/db.d.ts +28 -20
- package/dist/core/canvas/db.js +4 -3
- package/dist/core/canvas/deliveries.d.ts +5 -0
- package/dist/core/canvas/deliveries.js +25 -30
- package/dist/core/canvas/export-sqlite.d.ts +14 -0
- package/dist/core/canvas/export-sqlite.js +3 -0
- package/dist/core/canvas/import-sqlite.d.ts +44 -0
- package/dist/core/canvas/import-sqlite.js +7 -0
- package/dist/core/canvas/node-tokens.js +3 -3
- package/dist/core/canvas/outcome-actions.js +4 -4
- package/dist/core/canvas/recovery.js +1 -1
- package/dist/core/canvas/schema-pg.sql +1022 -0
- package/dist/core/canvas/schema-version.d.ts +4 -0
- package/dist/core/canvas/schema-version.js +1 -0
- package/dist/core/canvas/sessions.js +3 -3
- package/dist/core/canvas/structured-requests.js +2 -2
- package/dist/core/canvas/tree.js +6 -6
- package/dist/core/canvas/waits.js +1 -1
- package/dist/core/feed/inbox.js +1 -1
- package/dist/core/feed/messages.js +5 -5
- package/dist/core/feed/reports.js +2 -2
- package/dist/core/grants/mirror.js +2 -2
- package/dist/core/graph/access.js +7 -7
- package/dist/core/graph/custom.js +10 -10
- package/dist/core/graph/deletion.js +6 -6
- package/dist/core/graph/documents.d.ts +1 -1
- package/dist/core/graph/documents.js +9 -9
- package/dist/core/graph/edges.d.ts +3 -3
- package/dist/core/graph/edges.js +3 -1
- package/dist/core/graph/events.js +7 -7
- package/dist/core/graph/exposures.d.ts +8 -8
- package/dist/core/graph/jobs.d.ts +1 -1
- package/dist/core/graph/jobs.js +2 -2
- package/dist/core/graph/kinds/custom.js +1 -1
- package/dist/core/graph/kinds/document.js +4 -4
- package/dist/core/graph/kinds/dto.js +1 -1
- package/dist/core/graph/kinds/job.js +2 -2
- package/dist/core/graph/kinds/kind.d.ts +2 -2
- package/dist/core/graph/kinds/kind.js +1 -1
- package/dist/core/graph/kinds/live-read.d.ts +5 -0
- package/dist/core/graph/kinds/live-read.js +1 -0
- package/dist/core/graph/kinds/node.js +5 -5
- package/dist/core/graph/kinds/owner.js +2 -2
- package/dist/core/graph/names.js +3 -3
- package/dist/core/graph/objects.d.ts +5 -5
- package/dist/core/graph/objects.js +10 -10
- package/dist/core/graph/package-docs.js +6 -5
- package/dist/core/graph/reader.d.ts +1 -1
- package/dist/core/graph/reader.js +2 -2
- package/dist/core/graph/receivers.js +4 -5
- package/dist/core/graph/repo-sync/exchange.js +2 -2
- package/dist/core/graph/repo-sync/repos.js +3 -3
- package/dist/core/graph/repo-sync/sync.js +1 -1
- package/dist/core/graph/rules.d.ts +3 -4
- package/dist/core/graph/rules.js +3 -3
- package/dist/core/graph/spaces/app.js +1 -1
- package/dist/core/graph/spaces/index.d.ts +1 -1
- package/dist/core/graph/spaces/index.js +1 -1
- package/dist/core/graph/spaces/own-memory.js +1 -1
- package/dist/core/graph/spaces/person.js +3 -3
- package/dist/core/graph/spaces/repo.d.ts +1 -1
- package/dist/core/graph/spaces/repo.js +1 -1
- package/dist/core/graph/types.d.ts +4 -3
- package/dist/core/graph/watches.d.ts +2 -2
- package/dist/core/graph/watches.js +17 -17
- package/dist/core/human/page-schema.js +5 -4
- package/dist/core/human/requests.d.ts +1 -1
- package/dist/core/human/requests.js +20 -23
- package/dist/core/peer/ingest.js +1 -1
- package/dist/core/peer/receiver.js +1 -1
- package/dist/core/peer/stubs.js +1 -1
- package/dist/core/providers/receipts.js +3 -2
- package/dist/core/review/comments.js +5 -4
- package/dist/core/runs/activity.js +4 -5
- package/dist/core/runs/confinement.d.ts +1 -1
- package/dist/core/runs/confinement.js +2 -2
- package/dist/core/runs/events.d.ts +1 -1
- package/dist/core/runs/events.js +5 -5
- package/dist/core/runs/operations.js +6 -4
- package/dist/core/runs/questions.d.ts +2 -0
- package/dist/core/runs/questions.js +1 -1
- package/dist/core/runtime/close.d.ts +3 -0
- package/dist/core/runtime/close.js +1 -1
- package/dist/core/runtime/host.d.ts +5 -1
- package/dist/core/runtime/host.js +3 -3
- package/dist/core/runtime/launch.js +2 -2
- package/dist/core/runtime/ledger.js +3 -3
- package/dist/core/runtime/lifecycle.d.ts +9 -0
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/nodes.d.ts +1 -1
- package/dist/core/runtime/nodes.js +1 -1
- package/dist/core/runtime/roadmap.js +1 -1
- package/dist/core/spaces/stop.d.ts +1 -0
- package/dist/core/spaces/stop.js +2 -2
- package/dist/core/statements.d.ts +17 -0
- package/dist/core/statements.js +2 -0
- package/dist/core/substrate/delivery/corpus.js +3 -3
- package/dist/core/substrate/delivery/deliver.js +5 -5
- package/dist/core/substrate/delivery/listings.js +1 -1
- package/dist/core/substrate/delivery/match.d.ts +2 -2
- package/dist/core/substrate/delivery/match.js +1 -1
- package/dist/core/substrate/delivery/plan.js +3 -3
- package/dist/core/substrate/delivery/render-boot.js +5 -5
- package/dist/core/substrate/delivery/render-event.js +6 -6
- package/dist/core/usage/ledger.js +8 -8
- package/dist/core/worktree.js +8 -8
- package/dist/daemon/api/bridge.js +4 -4
- package/dist/daemon/api/document-listener.js +1 -1
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/canvas.js +1 -1
- package/dist/daemon/api/handlers/crons.js +1 -1
- package/dist/daemon/api/handlers/custom-objects.js +3 -3
- package/dist/daemon/api/handlers/docs.js +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/memory.js +7 -7
- package/dist/daemon/api/handlers/messages.js +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/objects.js +3 -3
- package/dist/daemon/api/handlers/questions.js +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/handlers/structured-requests.js +1 -1
- package/dist/daemon/api/reader.js +1 -1
- package/dist/daemon/broker-signals/bus.d.ts +14 -6
- package/dist/daemon/broker-signals/bus.js +1 -10
- package/dist/daemon/cron/ended.d.ts +3 -0
- package/dist/daemon/cron/ended.js +2 -2
- package/dist/daemon/cron/narrowed.d.ts +5 -0
- package/dist/daemon/cron/narrowed.js +2 -0
- package/dist/daemon/cron/settle.js +1 -1
- package/dist/daemon/crtrd-cli.js +1 -1
- package/dist/daemon/crtrd.js +12 -11
- package/dist/daemon/due.js +1 -1
- package/dist/daemon/export-sqlite-run.d.ts +1 -0
- package/dist/daemon/export-sqlite-run.js +4 -0
- package/dist/daemon/fleet.d.ts +1 -0
- package/dist/daemon/fleet.js +3 -3
- package/dist/daemon/human/settle.js +1 -1
- package/dist/daemon/manage.d.ts +10 -0
- package/dist/daemon/manage.js +3 -2
- package/dist/daemon/postgres/binary.d.ts +17 -0
- package/dist/daemon/postgres/binary.js +2 -0
- package/dist/daemon/postgres/cluster.d.ts +37 -0
- package/dist/daemon/postgres/cluster.js +6 -0
- package/dist/daemon/postgres/index.d.ts +2 -0
- package/dist/daemon/postgres/index.js +1 -0
- package/dist/daemon/postgres/pins.d.ts +7 -0
- package/dist/daemon/postgres/pins.js +1 -0
- package/dist/daemon/postgres/supervisor.d.ts +95 -0
- package/dist/daemon/postgres/supervisor.js +2 -0
- package/dist/daemon/reconcilers/bash-deadline.js +2 -2
- package/dist/daemon/reconcilers/delivery-lane.js +2 -2
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.d.ts +7 -3
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +0 -6
- package/dist/daemon/reconcilers/storage-maintenance.js +1 -8
- package/dist/daemon/runs/observer.js +5 -4
- package/dist/migrations/004-canvas-documents/index.js +1 -1
- package/dist/pi-extensions/canvas-doc-substrate.d.ts +2 -0
- package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
- package/dist/pi-extensions/envelope-merge.d.ts +3 -2
- package/dist/pi-extensions/envelope-merge.js +9 -8
- package/dist/shared/env.d.ts +3 -0
- package/dist/shared/env.js +2 -2
- package/docs/apps/providers/README.md +2 -0
- package/docs/apps/providers/sms.md +2 -0
- package/docs/public-api.md +11 -2
- package/docs/sdk/release-notes.md +13 -0
- package/package.json +6 -6
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +13 -26
- package/scripts/install-runtime.mjs +53 -3
- package/scripts/lib/isolation-env.mjs +3 -1
package/docs/public-api.md
CHANGED
|
@@ -44,7 +44,8 @@ comment-organized); this table is the map, not the inventory:
|
|
|
44
44
|
the underlying storage file.
|
|
45
45
|
- **Canvas reads** — `getNode`, `listNodes`, `nodeDir`, `asksForNodes`,
|
|
46
46
|
`asksAcrossCanvas`, `readTelemetry`, `readContextTokens` (+ their types).
|
|
47
|
-
Read-only queries against the
|
|
47
|
+
Read-only queries against the node graph, which lives in the daemon's
|
|
48
|
+
supervised local Postgres.
|
|
48
49
|
- **Broker client** — `ViewSocketClient`, `BrokerUnavailableError`. A typed
|
|
49
50
|
client for a node's `view.sock`. A consumer that would rather not depend on
|
|
50
51
|
this class can speak the frame protocol directly over the socket path
|
|
@@ -76,9 +77,17 @@ comment-organized); this table is the map, not the inventory:
|
|
|
76
77
|
A consumer that runs alongside crtr (a separate process, a separate repo)
|
|
77
78
|
also has a CLI/socket/schema surface to depend on instead of an import:
|
|
78
79
|
`crtr sys version`, `crtr node message send`, the broker `view.sock`
|
|
79
|
-
`reload_auth` subset, and the
|
|
80
|
+
`reload_auth` subset, and the `/v1` socket API. Each of those is versioned
|
|
80
81
|
by the CLI's own `sys version` output rather than by a document here.
|
|
81
82
|
|
|
83
|
+
The canvas is a supervised local Postgres owned by `crtrd`, not a file. The
|
|
84
|
+
old `runtime/canvas.db` is no longer maintained: the first boot of a Postgres
|
|
85
|
+
generation imports it and renames it `canvas.db.imported`. A sibling process
|
|
86
|
+
reads the canvas through `/v1` or the root barrel's canvas reads above, never
|
|
87
|
+
through the database itself. `crtr sys db export-sqlite` writes a `canvas.db`
|
|
88
|
+
for rolling back to a SQLite generation; it is a one-time snapshot taken
|
|
89
|
+
with the daemon stopped, not a live file to read.
|
|
90
|
+
|
|
82
91
|
## Packaging
|
|
83
92
|
|
|
84
93
|
`docs/` is listed in `package.json#files`, so this note ships inside the
|
|
@@ -7,6 +7,19 @@ description: Behavior changes in @north-light/sdk that an app must act on, newes
|
|
|
7
7
|
|
|
8
8
|
Changes to `@north-light/sdk` that can change what an existing app sees. Newest first.
|
|
9
9
|
|
|
10
|
+
## 0.3.533
|
|
11
|
+
|
|
12
|
+
A cron armed by a caller with no scope limit follows the grant, and a narrowed scope pauses it.
|
|
13
|
+
|
|
14
|
+
- `POST /v1/crons` stores and returns `scopes: null` for a cron armed by a node, cron or app token with no scope limit, where it used to return a copy of the grant's scopes. A cron with `scopes: null` runs under the grant's current scopes at every fire, including scopes the grant gains later. A cron armed with an explicit scope list keeps it and is refused if the grant stops covering any of it.
|
|
15
|
+
- A scheduled fire refused `scope_narrowed` now pauses the cron, recurring ones included (`state: paused` in `GET /v1/crons`), and notifies whoever armed it. Resume it with `POST /v1/crons/:id/resume` once the grant covers the scope again.
|
|
16
|
+
|
|
17
|
+
Three reads take optional narrowing. Additive: no request or response an existing app sends or reads changes.
|
|
18
|
+
|
|
19
|
+
- `GET /v1/canvas/roster` node rows carry an optional `description`. A runtime that predates the field omits it.
|
|
20
|
+
- `GET /v1/crons` accepts `created_by=<node id>` and returns only the crons that node armed. An empty value is 400 `invalid_request`. An older runtime ignores the parameter and returns every cron, so filter on `created_by` yourself if you may talk to one.
|
|
21
|
+
- `GET /v1/human/inbox/history` accepts `state=pending|resolved|canceled|passive` and returns only page tickets in that state. Any other value is 400 `invalid_request`. An older runtime ignores the parameter and returns every state.
|
|
22
|
+
|
|
10
23
|
## 0.3.527
|
|
11
24
|
|
|
12
25
|
`POST /v1/nodes/:id/jobs/start` accepts a job prepared as already backgrounded. Additive: no request or response an existing app sends or reads changes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.534",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -116,12 +116,12 @@
|
|
|
116
116
|
"dev": "tsx --conditions=crtr-src src/cli.ts",
|
|
117
117
|
"link": "npm link",
|
|
118
118
|
"prepublishOnly": "npm run build",
|
|
119
|
-
"test": "CRTR_NO_DAEMON_AUTOSTART=1 node --conditions=crtr-src --import tsx/esm --import ./scripts/test-env-scrub.mjs --test --test-concurrency=$(node -p 'Math.max(4, require(`node:os`).availableParallelism() - 1)') --test-timeout=10000 ${CRTR_TEST_SHARD:+--test-shard=$CRTR_TEST_SHARD} 'src/**/__tests__/*.test.ts'",
|
|
120
|
-
"test:integration": "npm run build:sdk && CRTR_NO_DAEMON_AUTOSTART=1 node --conditions=crtr-src --import tsx/esm --import ./scripts/test-env-scrub.mjs --test --test-concurrency=$(node -p 'Math.min(8, Math.max(2, require(`node:os`).availableParallelism() - 1))') --test-timeout=60000 ${CRTR_TEST_SHARD:+--test-shard=$CRTR_TEST_SHARD} 'src/**/__tests__/integration/*.test.ts' 'packages/crouter-sdk/src/**/__tests__/integration/*.test.ts' 'packages/crouter-plugin/src/**/__tests__/integration/*.test.ts'",
|
|
119
|
+
"test": "CRTR_NO_DAEMON_AUTOSTART=1 node scripts/test-lane.mjs -- node --conditions=crtr-src --import tsx/esm --import ./scripts/test-env-scrub.mjs --test --test-concurrency=$(node -p 'Math.max(4, require(`node:os`).availableParallelism() - 1)') --test-timeout=10000 ${CRTR_TEST_SHARD:+--test-shard=$CRTR_TEST_SHARD} 'src/**/__tests__/*.test.ts'",
|
|
120
|
+
"test:integration": "npm run build:sdk && CRTR_NO_DAEMON_AUTOSTART=1 node scripts/test-lane.mjs -- node --conditions=crtr-src --import tsx/esm --import ./scripts/test-env-scrub.mjs --test --test-concurrency=$(node -p 'Math.min(8, Math.max(2, require(`node:os`).availableParallelism() - 1))') --test-timeout=60000 ${CRTR_TEST_SHARD:+--test-shard=$CRTR_TEST_SHARD} 'src/**/__tests__/integration/*.test.ts' 'packages/crouter-sdk/src/**/__tests__/integration/*.test.ts' 'packages/crouter-plugin/src/**/__tests__/integration/*.test.ts'",
|
|
121
121
|
"test:seam": "npm run build && npm run test:seam:built",
|
|
122
122
|
"test:sdk": "npm run build:api && npm run build:identity && node --conditions=crtr-src --import tsx/esm --test --test-timeout=60000 'packages/crouter-sdk/src/__tests__/*.test.ts' 'packages/crouter-sdk/src/__tests__/integration/*.test.ts'",
|
|
123
123
|
"test:sdk:pg": "node -e \"if (!process.env.TEST_DATABASE_URL) { console.error('test:sdk:pg needs TEST_DATABASE_URL (a disposable PostgreSQL), e.g. docker run --rm -d -e POSTGRES_PASSWORD=pw -p 127.0.0.1:55432:5432 postgres:18-alpine; TEST_DATABASE_URL=postgres://postgres:pw@127.0.0.1:55432/postgres'); process.exit(1) }\" && node --conditions=crtr-src --import tsx/esm --test --test-timeout=60000 'packages/crouter-sdk/src/**/__tests__/**/*.pg.test.ts'",
|
|
124
|
-
"test:seam:built": "CRTR_NO_DAEMON_AUTOSTART=1 node --import ./scripts/test-env-scrub.mjs --test --test-concurrency=$(node -p 'Math.min(4, Math.max(2, require(`node:os`).availableParallelism() - 2))') --test-timeout=180000 ${CRTR_TEST_SHARD:+--test-shard=$CRTR_TEST_SHARD} 'dist/**/__tests__/seam/*.test.js'",
|
|
124
|
+
"test:seam:built": "CRTR_NO_DAEMON_AUTOSTART=1 node scripts/test-lane.mjs -- node --import ./scripts/test-env-scrub.mjs --test --test-concurrency=$(node -p 'Math.min(4, Math.max(2, require(`node:os`).availableParallelism() - 2))') --test-timeout=180000 ${CRTR_TEST_SHARD:+--test-shard=$CRTR_TEST_SHARD} 'dist/**/__tests__/seam/*.test.js'",
|
|
125
125
|
"test:all": "npm test && npm run test:integration && npm run test:seam",
|
|
126
126
|
"test:isolated": "node scripts/test-isolated.mjs",
|
|
127
127
|
"build:identity": "tsc -p packages/crouter-identity/tsconfig.json"
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
},
|
|
141
141
|
"license": "UNLICENSED",
|
|
142
142
|
"dependencies": {
|
|
143
|
-
"@north-light/identity": "0.3.
|
|
143
|
+
"@north-light/identity": "0.3.534",
|
|
144
144
|
"@earendil-works/pi-agent-core": "1.1.0",
|
|
145
145
|
"@earendil-works/pi-ai": "1.1.0",
|
|
146
146
|
"@earendil-works/pi-coding-agent": "1.1.0",
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
"esbuild": "^0.27.7",
|
|
156
156
|
"jose": "^6.2.12",
|
|
157
157
|
"marked": "18.0.11",
|
|
158
|
+
"pg": "^8.23.1",
|
|
158
159
|
"proper-lockfile": "4.1.2",
|
|
159
160
|
"remark-gfm": "^4.0.1",
|
|
160
161
|
"remark-parse": "^11.0.0",
|
|
@@ -173,7 +174,6 @@
|
|
|
173
174
|
"@types/proper-lockfile": "^4.1.4",
|
|
174
175
|
"@types/ws": "^8.18.1",
|
|
175
176
|
"mermaid": "11.17.2",
|
|
176
|
-
"pg": "^8.23.1",
|
|
177
177
|
"tsx": "^4.0.0"
|
|
178
178
|
}
|
|
179
179
|
}
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.534",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.534",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
25
25
|
"@milkdown/prose": "^7.22.3",
|
|
26
26
|
"@milkdown/utils": "^7.22.3",
|
|
27
|
-
"@north-light/identity": "0.3.
|
|
27
|
+
"@north-light/identity": "0.3.534",
|
|
28
28
|
"cron-parser": "^5.6.0",
|
|
29
29
|
"esbuild": "^0.27.7",
|
|
30
30
|
"jose": "^6.2.12",
|
|
31
31
|
"marked": "18.0.11",
|
|
32
|
+
"pg": "^8.23.1",
|
|
32
33
|
"proper-lockfile": "4.1.2",
|
|
33
34
|
"remark-gfm": "^4.0.1",
|
|
34
35
|
"remark-parse": "^11.0.0",
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
"@types/proper-lockfile": "^4.1.4",
|
|
54
55
|
"@types/ws": "^8.18.1",
|
|
55
56
|
"mermaid": "11.17.2",
|
|
56
|
-
"pg": "^8.23.1",
|
|
57
57
|
"tsx": "^4.0.0"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
@@ -10127,7 +10127,6 @@
|
|
|
10127
10127
|
"version": "8.23.1",
|
|
10128
10128
|
"resolved": "https://registry.npmjs.org/pg/-/pg-8.23.1.tgz",
|
|
10129
10129
|
"integrity": "sha512-aL96AHANtWjPLDOLqnhx+ngp9+UK7ETEU8VJrDCGvsSSi/mGLcWYsS6Herg7lmaBJe4uwrfqsa7gTEFaSizDoQ==",
|
|
10130
|
-
"devOptional": true,
|
|
10131
10130
|
"license": "MIT",
|
|
10132
10131
|
"dependencies": {
|
|
10133
10132
|
"pg-connection-string": "^2.14.1",
|
|
@@ -10162,14 +10161,12 @@
|
|
|
10162
10161
|
"version": "2.14.1",
|
|
10163
10162
|
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.1.tgz",
|
|
10164
10163
|
"integrity": "sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA==",
|
|
10165
|
-
"devOptional": true,
|
|
10166
10164
|
"license": "MIT"
|
|
10167
10165
|
},
|
|
10168
10166
|
"node_modules/pg-int8": {
|
|
10169
10167
|
"version": "1.0.1",
|
|
10170
10168
|
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
|
10171
10169
|
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
|
|
10172
|
-
"devOptional": true,
|
|
10173
10170
|
"license": "ISC",
|
|
10174
10171
|
"engines": {
|
|
10175
10172
|
"node": ">=4.0.0"
|
|
@@ -10179,7 +10176,6 @@
|
|
|
10179
10176
|
"version": "3.14.0",
|
|
10180
10177
|
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz",
|
|
10181
10178
|
"integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==",
|
|
10182
|
-
"devOptional": true,
|
|
10183
10179
|
"license": "MIT",
|
|
10184
10180
|
"peerDependencies": {
|
|
10185
10181
|
"pg": ">=8.0"
|
|
@@ -10189,14 +10185,12 @@
|
|
|
10189
10185
|
"version": "1.16.1",
|
|
10190
10186
|
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.16.1.tgz",
|
|
10191
10187
|
"integrity": "sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg==",
|
|
10192
|
-
"devOptional": true,
|
|
10193
10188
|
"license": "MIT"
|
|
10194
10189
|
},
|
|
10195
10190
|
"node_modules/pg-types": {
|
|
10196
10191
|
"version": "2.2.0",
|
|
10197
10192
|
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
|
10198
10193
|
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
|
10199
|
-
"devOptional": true,
|
|
10200
10194
|
"license": "MIT",
|
|
10201
10195
|
"dependencies": {
|
|
10202
10196
|
"pg-int8": "1.0.1",
|
|
@@ -10213,7 +10207,6 @@
|
|
|
10213
10207
|
"version": "1.0.5",
|
|
10214
10208
|
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
|
|
10215
10209
|
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
|
|
10216
|
-
"devOptional": true,
|
|
10217
10210
|
"license": "MIT",
|
|
10218
10211
|
"dependencies": {
|
|
10219
10212
|
"split2": "^4.1.0"
|
|
@@ -10286,7 +10279,6 @@
|
|
|
10286
10279
|
"version": "2.0.0",
|
|
10287
10280
|
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
|
10288
10281
|
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
|
|
10289
|
-
"devOptional": true,
|
|
10290
10282
|
"license": "MIT",
|
|
10291
10283
|
"engines": {
|
|
10292
10284
|
"node": ">=4"
|
|
@@ -10296,7 +10288,6 @@
|
|
|
10296
10288
|
"version": "1.0.1",
|
|
10297
10289
|
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
|
|
10298
10290
|
"integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==",
|
|
10299
|
-
"devOptional": true,
|
|
10300
10291
|
"license": "MIT",
|
|
10301
10292
|
"engines": {
|
|
10302
10293
|
"node": ">=0.10.0"
|
|
@@ -10306,7 +10297,6 @@
|
|
|
10306
10297
|
"version": "1.0.7",
|
|
10307
10298
|
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
|
|
10308
10299
|
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
|
|
10309
|
-
"devOptional": true,
|
|
10310
10300
|
"license": "MIT",
|
|
10311
10301
|
"engines": {
|
|
10312
10302
|
"node": ">=0.10.0"
|
|
@@ -10316,7 +10306,6 @@
|
|
|
10316
10306
|
"version": "1.2.0",
|
|
10317
10307
|
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
|
10318
10308
|
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
|
10319
|
-
"devOptional": true,
|
|
10320
10309
|
"license": "MIT",
|
|
10321
10310
|
"dependencies": {
|
|
10322
10311
|
"xtend": "^4.0.0"
|
|
@@ -11138,7 +11127,6 @@
|
|
|
11138
11127
|
"version": "4.2.0",
|
|
11139
11128
|
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
|
11140
11129
|
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
|
11141
|
-
"devOptional": true,
|
|
11142
11130
|
"license": "ISC",
|
|
11143
11131
|
"engines": {
|
|
11144
11132
|
"node": ">= 10.x"
|
|
@@ -12378,7 +12366,6 @@
|
|
|
12378
12366
|
"version": "4.0.2",
|
|
12379
12367
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
|
12380
12368
|
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
|
12381
|
-
"devOptional": true,
|
|
12382
12369
|
"license": "MIT",
|
|
12383
12370
|
"engines": {
|
|
12384
12371
|
"node": ">=0.4"
|
|
@@ -12468,17 +12455,17 @@
|
|
|
12468
12455
|
},
|
|
12469
12456
|
"packages/crouter-api": {
|
|
12470
12457
|
"name": "@north-light/api",
|
|
12471
|
-
"version": "0.3.
|
|
12458
|
+
"version": "0.3.534",
|
|
12472
12459
|
"license": "UNLICENSED"
|
|
12473
12460
|
},
|
|
12474
12461
|
"packages/crouter-env-docker": {
|
|
12475
12462
|
"name": "@north-light/env-docker",
|
|
12476
|
-
"version": "0.3.
|
|
12463
|
+
"version": "0.3.534",
|
|
12477
12464
|
"license": "UNLICENSED"
|
|
12478
12465
|
},
|
|
12479
12466
|
"packages/crouter-identity": {
|
|
12480
12467
|
"name": "@north-light/identity",
|
|
12481
|
-
"version": "0.3.
|
|
12468
|
+
"version": "0.3.534",
|
|
12482
12469
|
"license": "UNLICENSED",
|
|
12483
12470
|
"dependencies": {
|
|
12484
12471
|
"jose": "^6.2.1"
|
|
@@ -12486,20 +12473,20 @@
|
|
|
12486
12473
|
},
|
|
12487
12474
|
"packages/crouter-plugin": {
|
|
12488
12475
|
"name": "@north-light/plugin",
|
|
12489
|
-
"version": "0.3.
|
|
12476
|
+
"version": "0.3.534",
|
|
12490
12477
|
"license": "UNLICENSED",
|
|
12491
12478
|
"dependencies": {
|
|
12492
|
-
"@north-light/api": "0.3.
|
|
12493
|
-
"@north-light/identity": "0.3.
|
|
12479
|
+
"@north-light/api": "0.3.534",
|
|
12480
|
+
"@north-light/identity": "0.3.534"
|
|
12494
12481
|
}
|
|
12495
12482
|
},
|
|
12496
12483
|
"packages/crouter-sdk": {
|
|
12497
12484
|
"name": "@north-light/sdk",
|
|
12498
|
-
"version": "0.3.
|
|
12485
|
+
"version": "0.3.534",
|
|
12499
12486
|
"license": "UNLICENSED",
|
|
12500
12487
|
"dependencies": {
|
|
12501
|
-
"@north-light/api": "0.3.
|
|
12502
|
-
"@north-light/identity": "0.3.
|
|
12488
|
+
"@north-light/api": "0.3.534",
|
|
12489
|
+
"@north-light/identity": "0.3.534",
|
|
12503
12490
|
"jose": "^6.2.1"
|
|
12504
12491
|
},
|
|
12505
12492
|
"bin": {
|
|
@@ -4,7 +4,7 @@ import { createHash } from 'node:crypto';
|
|
|
4
4
|
import { DatabaseSync } from 'node:sqlite';
|
|
5
5
|
import { chmod, copyFile, lstat, mkdir, mkdtemp, readFile, readdir, readlink, rename, rm, symlink, writeFile } from 'node:fs/promises';
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
|
-
import { homedir, hostname } from 'node:os';
|
|
7
|
+
import { homedir, hostname, userInfo } from 'node:os';
|
|
8
8
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
9
9
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
10
10
|
import { ENTRY_NAMES, GENERATION_ID, GENERATION_PACKAGE_NAME, MANIFEST_KEYS, MANIFEST_SCHEMA, contained, isKnownPackageName, isSealed, publishedMarkerPath, runtimeHome, sortInventory, validateManifestShape } from '../bin/runtime-generation-manifest.mjs';
|
|
@@ -169,8 +169,15 @@ async function assertCanvasSchemaCompatible(stage) {
|
|
|
169
169
|
throw new Error('candidate runtime does not expose a valid canvas migration version');
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
const
|
|
173
|
-
const
|
|
172
|
+
const root = process.env.CRTR_HOME || (process.platform === 'linux' ? '/' : join(homedir(), '.crouter'));
|
|
173
|
+
const runtime = join(root, 'runtime');
|
|
174
|
+
if (process.env.CRTR_DATABASE_URL || existsSync(join(runtime, 'pg', 'data'))) {
|
|
175
|
+
await assertPostgresSchemaCompatible(stage, runtime);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// No Postgres cluster yet: the canvas is still the SQLite file the next daemon boot imports.
|
|
180
|
+
const dbPath = join(runtime, 'canvas.db');
|
|
174
181
|
try {
|
|
175
182
|
await lstat(dbPath);
|
|
176
183
|
} catch (error) {
|
|
@@ -191,6 +198,49 @@ async function assertCanvasSchemaCompatible(stage) {
|
|
|
191
198
|
}
|
|
192
199
|
}
|
|
193
200
|
|
|
201
|
+
/** The candidate's Postgres canvas schema version, read from its own `schema-version.js`. */
|
|
202
|
+
async function candidatePostgresSchemaVersion(stage) {
|
|
203
|
+
const { CANVAS_SCHEMA_VERSION: version } = await import(pathToFileURL(join(stage, 'dist', 'core', 'canvas', 'schema-version.js')).href);
|
|
204
|
+
if (!Number.isSafeInteger(version) || version < 1) throw new Error('candidate runtime does not expose a valid canvas schema version');
|
|
205
|
+
return version;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Read `canvas_meta.schema_version` from the live Postgres cluster and refuse a candidate older than it. A cluster that
|
|
209
|
+
* is not running cannot be read, so the candidate is refused until the cluster is started. */
|
|
210
|
+
async function assertPostgresSchemaCompatible(stage, runtime) {
|
|
211
|
+
const { default: pg } = await import('pg');
|
|
212
|
+
const supported = await candidatePostgresSchemaVersion(stage);
|
|
213
|
+
let socketDir = join(runtime, 'pg');
|
|
214
|
+
try { socketDir = (await readFile(join(runtime, 'pg', 'socket-dir'), 'utf8')).trim(); } catch (error) { if (error?.code !== 'ENOENT') throw error; }
|
|
215
|
+
const connectionString = process.env.CRTR_DATABASE_URL
|
|
216
|
+
?? `postgresql://${encodeURIComponent(userInfo().username)}@/postgres?host=${encodeURIComponent(socketDir)}`;
|
|
217
|
+
const client = new pg.Client({ connectionString, connectionTimeoutMillis: 5000 });
|
|
218
|
+
try {
|
|
219
|
+
await client.connect();
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (!process.env.CRTR_DATABASE_URL && (error?.code === 'ENOENT' || error?.code === 'ECONNREFUSED')) {
|
|
222
|
+
throw new Error(
|
|
223
|
+
`refusing to select runtime: the Postgres cluster at ${socketDir} is not running, so its canvas schema version cannot be checked against this build (${supported}). ` +
|
|
224
|
+
'Start it with the currently selected generation (`crtr sys daemon start`) and install again.',
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
const exists = await client.query(`SELECT to_regclass('canvas_meta') AS t`);
|
|
231
|
+
const row = exists.rows[0].t === null ? { rows: [] } : await client.query(`SELECT value FROM canvas_meta WHERE key = 'schema_version'`);
|
|
232
|
+
const current = row.rows[0] === undefined ? undefined : Number(row.rows[0].value);
|
|
233
|
+
if (current !== undefined && current > supported) {
|
|
234
|
+
throw new Error(
|
|
235
|
+
`refusing to select runtime with canvas schema ${supported}: ` +
|
|
236
|
+
`the live database is already at version ${current}; install a descendant build instead`,
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
} finally {
|
|
240
|
+
await client.end();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
194
244
|
/** Atomically mark generation `id` eligible as a sibling-fallback candidate
|
|
195
245
|
* (see `runtime-generation-manifest.mjs`'s `publishedMarkerPath` for the
|
|
196
246
|
* invariant this establishes) — write via temp file + rename IN
|
|
@@ -7,7 +7,9 @@ import { basename, dirname, isAbsolute, join, relative, sep } from 'node:path';
|
|
|
7
7
|
export function scrubInheritedBrokerEnv(env = process.env) {
|
|
8
8
|
for (const key of Object.keys(env)) {
|
|
9
9
|
if (key.startsWith('PI_') || (key.startsWith('CRTR_') &&
|
|
10
|
-
key !== 'CRTR_HOME' && key !== 'CRTR_RUNTIME_HOME' && key !== 'CRTR_NO_DAEMON_AUTOSTART' && key !== 'CRTR_BROKER_SIGNAL_LONG_PROOF'
|
|
10
|
+
key !== 'CRTR_HOME' && key !== 'CRTR_RUNTIME_HOME' && key !== 'CRTR_NO_DAEMON_AUTOSTART' && key !== 'CRTR_BROKER_SIGNAL_LONG_PROOF'
|
|
11
|
+
// The lane runner's test Postgres (scripts/test-lane.mjs): every file worker, subprocess, daemon and broker reaches it.
|
|
12
|
+
&& key !== 'CRTR_TEST_PG_URL')) {
|
|
11
13
|
delete env[key];
|
|
12
14
|
}
|
|
13
15
|
}
|