@north-light/cli 0.3.730 → 0.3.731
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/errors.d.ts +5 -0
- package/dist/api/errors.js +1 -1
- package/dist/clients/attach/viewer.js +526 -526
- package/dist/core/canvas/history.d.ts +1 -1
- package/dist/core/canvas/history.js +8 -8
- package/dist/core/conversation-store/row-store.js +13 -13
- package/dist/core/environment-starter-script.d.ts +1 -1
- package/dist/core/environment-starter-script.js +4 -1
- package/dist/core/model-auth/activations.js +1 -1
- package/dist/core/runtime/runner/blaxel/image-build.d.ts +3 -0
- package/dist/core/runtime/runner/blaxel/image-build.js +6 -6
- package/dist/daemon/api/bridge.js +2 -2
- package/dist/daemon/api/handlers/canvas.js +1 -1
- package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/errors.js +11 -0
- package/packages/crouter-api/dist/core/canvas/history.js +3 -3
- package/packages/crouter-api/dist/core/conversation-store/row-store.js +7 -2
- package/packages/crouter-api/dist/core/environment-starter-script.js +4 -1
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +4 -1
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
|
@@ -55,6 +55,17 @@ export function isDaemonTransportApiError(error) {
|
|
|
55
55
|
|| error.code === 'northlight_unreachable')) || (error.status === 504 && (error.code === 'request_timeout' || error.code === 'deadline_exceeded'))
|
|
56
56
|
|| (error.status >= 500 && error.code === 'daemon_health_unavailable');
|
|
57
57
|
}
|
|
58
|
+
/** A daemon answer that says nothing about the caller's data: the daemon was unreachable, starting, draining for a
|
|
59
|
+
* restart (503 `startup_blocked`), overloaded, or failed server-side. Retrying the same request later can succeed, so a
|
|
60
|
+
* long-lived caller (a broker's inbox poll) retries it rather than treating it as corrupt state. A 4xx other than
|
|
61
|
+
* 408/429 is about the request itself and is not transient. */
|
|
62
|
+
export function isTransientDaemonApiError(error) {
|
|
63
|
+
if (!(error instanceof APIError))
|
|
64
|
+
return false;
|
|
65
|
+
const { status, code, retryable } = error;
|
|
66
|
+
return isDaemonTransportApiError(error) || retryable === true || code === 'startup_blocked'
|
|
67
|
+
|| status === 408 || status === 429 || status >= 500;
|
|
68
|
+
}
|
|
58
69
|
/** The daemon refused the caller's node token. A teardown revokes the broker's token before its process stops, so a broker
|
|
59
70
|
* that sees this on a poll is being shut down, not hitting a corrupt state. */
|
|
60
71
|
export function isTokenRevokedApiError(error) {
|
|
@@ -454,10 +454,10 @@ export async function resolveRef(ref) {
|
|
|
454
454
|
ts: messages[messages.length - 1]?.ts ?? node.created,
|
|
455
455
|
nodeName: node.name,
|
|
456
456
|
body: rendered,
|
|
457
|
-
raw:
|
|
457
|
+
raw: async () => {
|
|
458
458
|
const { header, entries } = await conversationStore().read(conversationIdFromPath(file));
|
|
459
459
|
return [header, ...entries].map((entry) => `${JSON.stringify(entry)}\n`).join('');
|
|
460
|
-
}
|
|
460
|
+
},
|
|
461
461
|
path: file,
|
|
462
462
|
};
|
|
463
463
|
}
|
|
@@ -472,7 +472,7 @@ export async function resolveRef(ref) {
|
|
|
472
472
|
ts: msg.ts,
|
|
473
473
|
nodeName: node.name,
|
|
474
474
|
body: msg.text,
|
|
475
|
-
raw:
|
|
475
|
+
raw: () => rawSessionLine(file, index),
|
|
476
476
|
path: file,
|
|
477
477
|
};
|
|
478
478
|
}
|
|
@@ -265,8 +265,13 @@ export function createRowStore() {
|
|
|
265
265
|
lines.shift();
|
|
266
266
|
return { header, entries: entriesOf(lines.join('\n')), path };
|
|
267
267
|
}
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
// Line by line: a conversation over V8's string limit (~512 MB) cannot be decoded as one string.
|
|
269
|
+
if (!window || size <= window.head + window.tail) {
|
|
270
|
+
const entries = [];
|
|
271
|
+
for await (const line of linesOf(snap))
|
|
272
|
+
entries.push(...entriesOf(line));
|
|
273
|
+
return { header, entries, path };
|
|
274
|
+
}
|
|
270
275
|
const front = (await bytesOf(snap, 0, Math.max(0, window.head))).toString('utf8').split('\n');
|
|
271
276
|
front.pop();
|
|
272
277
|
// One byte before the tail window says whether it begins on a line boundary.
|
|
@@ -7,7 +7,10 @@ export const STARTER_SETUP_SCRIPT = `#!/usr/bin/env bash
|
|
|
7
7
|
# How it runs
|
|
8
8
|
# - Once per image build, as root, in /work, on Alpine Linux (use apk, not apt). Every sandbox of the profile starts from the result.
|
|
9
9
|
# - Your repositories are already checked out at /work/<repo name> before this runs.
|
|
10
|
-
# - The sandbox user is "crtr"
|
|
10
|
+
# - The sandbox user is "crtr". Files you create for it must be chowned to it. A node runs with HOME set to its app's home
|
|
11
|
+
# (/var/lib/crtr/apps/<app>/home, created at run time), not /home/crtr, so dotfiles written to /home/crtr are not read through ~.
|
|
12
|
+
# - Private GitHub Packages (@northlight-systems) already work: /home/crtr/.npmrc holds the auth line and NPM_CONFIG_USERCONFIG points at it,
|
|
13
|
+
# with the token filled in from NODE_AUTH_TOKEN at run time. pnpm 12 ignores a token in a repository's own .npmrc, so do not rely on one.
|
|
11
14
|
# - Already done for you: git, gh, curl, ripgrep, Node 24, pnpm. Packages are not pre-installed: run \`pnpm install\` in a sandbox,
|
|
12
15
|
# or install at build time below.
|
|
13
16
|
# - Output goes to /work/.crtr/setup.log in the image. If this script exits non-zero, sandboxes refuse to start and point at that log.
|
|
@@ -30,6 +30,9 @@ export const RUN_USER_NPMRC = [
|
|
|
30
30
|
'//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}',
|
|
31
31
|
`store-dir=/home/${RUN_USER}/.local/share/pnpm/store`,
|
|
32
32
|
];
|
|
33
|
+
/** A node runs with HOME set to its app's home (`/var/lib/crtr/apps/<app>/home`), not `/home/crtr`, so npm and pnpm would never read the npmrc above;
|
|
34
|
+
* this pins their user config to it for every app. pnpm 12 reads credentials from no other non-repository file (not npm's or pnpm's global config). */
|
|
35
|
+
export const RUN_USER_NPMRC_ENV = `ENV NPM_CONFIG_USERCONFIG=/home/${RUN_USER}/.npmrc`;
|
|
33
36
|
const writeRunUserNpmrc = () => `printf '%s\\n' ${RUN_USER_NPMRC.map((l) => `'${l}'`).join(' ')} > /home/${RUN_USER}/.npmrc`;
|
|
34
37
|
export const REPOS_DIR = 'repos';
|
|
35
38
|
/** Where the image keeps the setup script's output, and its exit status when it failed. `sandbox-start.mjs` reads both (it derives them from `/work/.crtr`). */
|
|
@@ -93,7 +96,7 @@ export function recipeDockerfile(recipe, revision, packagesToken = false) {
|
|
|
93
96
|
// A setup script may have written a resolved token into an npmrc; the run user's npmrc is rewritten to the token-free lines.
|
|
94
97
|
if (packagesToken)
|
|
95
98
|
out.push('RUN rm -f /work/.npmrc', `RUN ${writeRunUserNpmrc()} && chown ${RUN_USER}:${RUN_USER} /home/${RUN_USER}/.npmrc`);
|
|
96
|
-
out.push(`USER ${RUN_USER}`, 'WORKDIR /work', 'ENTRYPOINT ["/usr/local/bin/sandbox-api"]', '');
|
|
99
|
+
out.push(RUN_USER_NPMRC_ENV, `USER ${RUN_USER}`, 'WORKDIR /work', 'ENTRYPOINT ["/usr/local/bin/sandbox-api"]', '');
|
|
97
100
|
return out.join('\n');
|
|
98
101
|
}
|
|
99
102
|
const runGit = (args, env, cwd) => new Promise((resolve, reject) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.731",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.731",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@north-light/api": "0.3.
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
30
|
+
"@north-light/api": "0.3.731",
|
|
31
|
+
"@north-light/identity": "0.3.731"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|
|
34
34
|
"publishConfig": {
|
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.731",
|
|
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.731",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
29
29
|
"@milkdown/prose": "^7.22.3",
|
|
30
30
|
"@milkdown/utils": "^7.22.3",
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
32
|
-
"@north-light/plugin": "0.3.
|
|
31
|
+
"@north-light/identity": "0.3.731",
|
|
32
|
+
"@north-light/plugin": "0.3.731",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -11902,17 +11902,17 @@
|
|
|
11902
11902
|
},
|
|
11903
11903
|
"packages/crouter-api": {
|
|
11904
11904
|
"name": "@north-light/api",
|
|
11905
|
-
"version": "0.3.
|
|
11905
|
+
"version": "0.3.731",
|
|
11906
11906
|
"license": "UNLICENSED"
|
|
11907
11907
|
},
|
|
11908
11908
|
"packages/crouter-env-docker": {
|
|
11909
11909
|
"name": "@north-light/env-docker",
|
|
11910
|
-
"version": "0.3.
|
|
11910
|
+
"version": "0.3.731",
|
|
11911
11911
|
"license": "UNLICENSED"
|
|
11912
11912
|
},
|
|
11913
11913
|
"packages/crouter-identity": {
|
|
11914
11914
|
"name": "@north-light/identity",
|
|
11915
|
-
"version": "0.3.
|
|
11915
|
+
"version": "0.3.731",
|
|
11916
11916
|
"license": "UNLICENSED",
|
|
11917
11917
|
"dependencies": {
|
|
11918
11918
|
"jose": "^6.2.1"
|
|
@@ -11920,21 +11920,21 @@
|
|
|
11920
11920
|
},
|
|
11921
11921
|
"packages/crouter-plugin": {
|
|
11922
11922
|
"name": "@north-light/plugin",
|
|
11923
|
-
"version": "0.3.
|
|
11923
|
+
"version": "0.3.731",
|
|
11924
11924
|
"license": "UNLICENSED",
|
|
11925
11925
|
"dependencies": {
|
|
11926
|
-
"@north-light/api": "0.3.
|
|
11927
|
-
"@north-light/identity": "0.3.
|
|
11926
|
+
"@north-light/api": "0.3.731",
|
|
11927
|
+
"@north-light/identity": "0.3.731"
|
|
11928
11928
|
}
|
|
11929
11929
|
},
|
|
11930
11930
|
"packages/crouter-sdk": {
|
|
11931
11931
|
"name": "@north-light/sdk",
|
|
11932
|
-
"version": "0.3.
|
|
11932
|
+
"version": "0.3.731",
|
|
11933
11933
|
"license": "UNLICENSED",
|
|
11934
11934
|
"dependencies": {
|
|
11935
|
-
"@north-light/api": "0.3.
|
|
11936
|
-
"@north-light/identity": "0.3.
|
|
11937
|
-
"@north-light/plugin": "0.3.
|
|
11935
|
+
"@north-light/api": "0.3.731",
|
|
11936
|
+
"@north-light/identity": "0.3.731",
|
|
11937
|
+
"@north-light/plugin": "0.3.731",
|
|
11938
11938
|
"jose": "^6.2.1"
|
|
11939
11939
|
},
|
|
11940
11940
|
"bin": {
|