@north-light/cli 0.3.680 → 0.3.681
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.js +3 -3
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/profiles.d.ts +1 -1
- package/dist/clients/attach/viewer.js +489 -489
- package/dist/core/profiles/manifest.js +1 -1
- package/dist/core/runtime/host.js +3 -3
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/user-settings.d.ts +2 -2
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/crtrd.js +15 -15
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/client.js +5 -4
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/core/profiles/manifest.js +7 -1
- package/packages/crouter-api/dist/core/runtime/host.js +9 -0
- package/packages/crouter-api/dist/core/runtime/spawn.js +13 -2
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.681",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
},
|
|
157
157
|
"license": "UNLICENSED",
|
|
158
158
|
"dependencies": {
|
|
159
|
-
"@north-light/identity": "0.3.
|
|
160
|
-
"@north-light/plugin": "0.3.
|
|
159
|
+
"@north-light/identity": "0.3.681",
|
|
160
|
+
"@north-light/plugin": "0.3.681",
|
|
161
161
|
"@earendil-works/chord": "1.5.2",
|
|
162
162
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
163
163
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -1094,9 +1094,7 @@ export class CrtrClient {
|
|
|
1094
1094
|
async sendOnce(method, path, body, callOpts = {}) {
|
|
1095
1095
|
const opts = this.resolveBudget(callOpts);
|
|
1096
1096
|
try {
|
|
1097
|
-
|
|
1098
|
-
reportServerTiming(response.headers.get('server-timing'));
|
|
1099
|
-
return await parse(response);
|
|
1097
|
+
return await parse(await this.transport(method, path, body, opts));
|
|
1100
1098
|
}
|
|
1101
1099
|
catch (error) {
|
|
1102
1100
|
throw toTransportApiError(error, opts.signal);
|
|
@@ -1200,7 +1198,10 @@ export class CrtrClient {
|
|
|
1200
1198
|
externalSignal?.removeEventListener('abort', onExternalAbort);
|
|
1201
1199
|
};
|
|
1202
1200
|
return abortable(this.fetch(new URL(path, this.baseUrl), { method, headers, body: payload, signal: controller.signal }), controller.signal)
|
|
1203
|
-
.then((response) =>
|
|
1201
|
+
.then((response) => {
|
|
1202
|
+
reportServerTiming(response.headers.get('server-timing'));
|
|
1203
|
+
return this.retainRequestLifetime(response, finish, () => controller.signal.aborted ? controller.signal.reason : undefined);
|
|
1204
|
+
}, (error) => {
|
|
1204
1205
|
finish();
|
|
1205
1206
|
throw error;
|
|
1206
1207
|
});
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//
|
|
13
13
|
// PURITY (spec §3.1): Node built-ins + `src/api/*` only.
|
|
14
14
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
15
|
-
export const CONTRACT_LEVEL = '1.
|
|
15
|
+
export const CONTRACT_LEVEL = '1.62';
|
|
16
16
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
17
17
|
export const REQUIRED_CONTRACT_HEADER = 'Crouter-Required-Contract';
|
|
18
18
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
|
@@ -10,6 +10,7 @@ import { cachedPausedProfileIds, cachedProfilePaused, getCachedProfile as getSto
|
|
|
10
10
|
import { usage, notFound, ambiguous, general } from '../errors.js';
|
|
11
11
|
import { fuzzyMatchProfile } from './fuzzy-match.js';
|
|
12
12
|
import { isCloudRole, personId } from '../canvas/person-state.js';
|
|
13
|
+
import { readMachineConfig } from '../../daemon/machine-link/config.js';
|
|
13
14
|
// A generated id and its stored app determine the memory and environment paths.
|
|
14
15
|
/** `<slug>-<shortid>`: slug is lower-case, non-alphanumeric collapsed to `-`,
|
|
15
16
|
* trimmed to 40 chars (defaulting to `profile`); shortid is 8 lowercase hex
|
|
@@ -353,8 +354,13 @@ export async function createProfile(name, projects = [], opts = {}) {
|
|
|
353
354
|
};
|
|
354
355
|
scaffoldProfile(profileId, manifest);
|
|
355
356
|
const insert = async () => { await writeSettings(() => [{ op: 'profile.insert', profile: { profileId, manifest } }]); };
|
|
356
|
-
if (!isCloudRole())
|
|
357
|
+
if (!isCloudRole()) {
|
|
358
|
+
// A profile made on an imported Mac runs on that Mac: store its environment, or the control plane finds no machine for it.
|
|
359
|
+
const machine = readMachineConfig();
|
|
360
|
+
if (machine !== undefined)
|
|
361
|
+
manifest.environment_id = machine.environmentId;
|
|
357
362
|
await insert();
|
|
363
|
+
}
|
|
358
364
|
else if (cloudProfileWriter === null)
|
|
359
365
|
throw new Error('a cloud role has no profile environment writer registered');
|
|
360
366
|
else
|
|
@@ -590,6 +590,15 @@ export const headlessBrokerHost = {
|
|
|
590
590
|
env: childEnv,
|
|
591
591
|
});
|
|
592
592
|
child = spawned;
|
|
593
|
+
// Wait for the OS to start or refuse the process, so a refusal (a missing cwd or executable) reaches the caller as the
|
|
594
|
+
// original spawn error naming what was attempted, never as a handle with no pid.
|
|
595
|
+
try {
|
|
596
|
+
await new Promise((resolve, reject) => { spawned.once('spawn', resolve); spawned.once('error', reject); });
|
|
597
|
+
}
|
|
598
|
+
catch (error) {
|
|
599
|
+
emitEvent({ level: 'error', event: 'broker.launch.failed', node_id: nodeId, error, fields: { cwd: opts.cwd, executable: brokerExec } });
|
|
600
|
+
throw new Error(`could not spawn the broker (executable ${brokerExec}, cwd ${opts.cwd}): ${error.message}`, { cause: error });
|
|
601
|
+
}
|
|
593
602
|
const tokenPipe = spawned.stdio[3];
|
|
594
603
|
if (!tokenPipe || !('end' in tokenPipe))
|
|
595
604
|
throw new Error('broker token pipe did not open');
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// direct driving, or, with `rootLifecycle: 'terminal'`, an
|
|
10
10
|
// unattended parentless worker that still owes a final (so it
|
|
11
11
|
// reaps) and is never placed on screen.
|
|
12
|
-
import { accessSync, constants } from 'node:fs';
|
|
12
|
+
import { accessSync, constants, existsSync } from 'node:fs';
|
|
13
13
|
import { isAbsolute, resolve, join } from 'node:path';
|
|
14
14
|
import { appSpace } from '../layout.js';
|
|
15
15
|
import { ApiError } from '../../api/errors.js';
|
|
@@ -21,6 +21,8 @@ import { devEnvironmentCwd, runsOnBlaxel, sandboxWorktreeRequest } from '../../d
|
|
|
21
21
|
import { createManagedWorktreeAsync, rollbackManagedWorktreeAsync } from '../worktree-mutation-async.js';
|
|
22
22
|
import { createManagedWorktreeOnMachine, rollbackManagedWorktreeOnMachine, worktreeMachineOf } from '../worktree-machine.js';
|
|
23
23
|
import { usage, brokerLaunchFailed } from '../errors.js';
|
|
24
|
+
import { InputError } from '../io.js';
|
|
25
|
+
import { isCloudRole } from '../canvas/person-state.js';
|
|
24
26
|
import { writeGoal } from './kickoff.js';
|
|
25
27
|
import { appendSituationalContext, formatSituationalProse } from './situational-context.js';
|
|
26
28
|
import { ensureRoadmap } from './roadmap.js';
|
|
@@ -93,7 +95,7 @@ async function launchBrokerOrCrash(nodeId, inv, opts) {
|
|
|
93
95
|
// `[broker] refusing to launch <id>:` lead, so re-surface them as-is
|
|
94
96
|
// rather than double-prefixing the now caller-visible text.
|
|
95
97
|
const cause = error.message;
|
|
96
|
-
throw brokerLaunchFailed(cause.startsWith('[broker]') ? cause : `[broker] refusing to launch ${nodeId}: ${cause}`,
|
|
98
|
+
throw brokerLaunchFailed(cause.startsWith('[broker]') ? cause : `[broker] refusing to launch ${nodeId}: ${cause}`, `Inspect the cause above and \`crtr sys logs --node ${nodeId}\`, fix the launch recipe or environment, then retry.`);
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
/** The last `broker.startup.*` step a freshly created root broker logged, or null when it logged none (it never got
|
|
@@ -597,6 +599,15 @@ export async function spawnChildPrepared(opts, beforeBrokerLaunch, afterNodeCrea
|
|
|
597
599
|
emitEvent({ level: 'info', event: 'broker.frozen', node_id: meta.node_id, fields: { reason: 'remote_environment' } });
|
|
598
600
|
return { node: { ...meta, frozen_at: frozenAt }, frozen: true, window: null, session: null };
|
|
599
601
|
}
|
|
602
|
+
// Here the broker would start on this host. On a cloud role that is the control plane's own pod, never a person's machine: a profile
|
|
603
|
+
// with no environment and a directory this host does not have names a path from the person's computer, so fail with that reason.
|
|
604
|
+
if (isCloudRole() && !existsSync(meta.cwd)) {
|
|
605
|
+
throw new InputError({
|
|
606
|
+
error: 'profile_environment_missing',
|
|
607
|
+
message: `${meta.cwd} does not exist on the control plane, and profile ${meta.profile_id ?? '(none)'} has no environment to run it in.`,
|
|
608
|
+
next: 'Bind the profile to the environment of the computer that holds this directory, then retry.',
|
|
609
|
+
});
|
|
610
|
+
}
|
|
600
611
|
const slot = await fleet.reserveSlot(meta.node_id);
|
|
601
612
|
// The slot is held while the launcher measures the app's memory; a denial gives it back before freezing.
|
|
602
613
|
const memory = slot ? await admitBrokerMemory(meta.node_id) : null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.681",
|
|
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.681",
|
|
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.681",
|
|
31
|
+
"@north-light/identity": "0.3.681"
|
|
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.681",
|
|
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.681",
|
|
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.681",
|
|
32
|
+
"@north-light/plugin": "0.3.681",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -10667,17 +10667,17 @@
|
|
|
10667
10667
|
},
|
|
10668
10668
|
"packages/crouter-api": {
|
|
10669
10669
|
"name": "@north-light/api",
|
|
10670
|
-
"version": "0.3.
|
|
10670
|
+
"version": "0.3.681",
|
|
10671
10671
|
"license": "UNLICENSED"
|
|
10672
10672
|
},
|
|
10673
10673
|
"packages/crouter-env-docker": {
|
|
10674
10674
|
"name": "@north-light/env-docker",
|
|
10675
|
-
"version": "0.3.
|
|
10675
|
+
"version": "0.3.681",
|
|
10676
10676
|
"license": "UNLICENSED"
|
|
10677
10677
|
},
|
|
10678
10678
|
"packages/crouter-identity": {
|
|
10679
10679
|
"name": "@north-light/identity",
|
|
10680
|
-
"version": "0.3.
|
|
10680
|
+
"version": "0.3.681",
|
|
10681
10681
|
"license": "UNLICENSED",
|
|
10682
10682
|
"dependencies": {
|
|
10683
10683
|
"jose": "^6.2.1"
|
|
@@ -10685,21 +10685,21 @@
|
|
|
10685
10685
|
},
|
|
10686
10686
|
"packages/crouter-plugin": {
|
|
10687
10687
|
"name": "@north-light/plugin",
|
|
10688
|
-
"version": "0.3.
|
|
10688
|
+
"version": "0.3.681",
|
|
10689
10689
|
"license": "UNLICENSED",
|
|
10690
10690
|
"dependencies": {
|
|
10691
|
-
"@north-light/api": "0.3.
|
|
10692
|
-
"@north-light/identity": "0.3.
|
|
10691
|
+
"@north-light/api": "0.3.681",
|
|
10692
|
+
"@north-light/identity": "0.3.681"
|
|
10693
10693
|
}
|
|
10694
10694
|
},
|
|
10695
10695
|
"packages/crouter-sdk": {
|
|
10696
10696
|
"name": "@north-light/sdk",
|
|
10697
|
-
"version": "0.3.
|
|
10697
|
+
"version": "0.3.681",
|
|
10698
10698
|
"license": "UNLICENSED",
|
|
10699
10699
|
"dependencies": {
|
|
10700
|
-
"@north-light/api": "0.3.
|
|
10701
|
-
"@north-light/identity": "0.3.
|
|
10702
|
-
"@north-light/plugin": "0.3.
|
|
10700
|
+
"@north-light/api": "0.3.681",
|
|
10701
|
+
"@north-light/identity": "0.3.681",
|
|
10702
|
+
"@north-light/plugin": "0.3.681",
|
|
10703
10703
|
"jose": "^6.2.1"
|
|
10704
10704
|
},
|
|
10705
10705
|
"bin": {
|