@north-light/cli 0.3.692 → 0.3.694

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.
Files changed (44) hide show
  1. package/dist/api/errors.js +1 -1
  2. package/dist/cli.js +6 -6
  3. package/dist/clients/attach/viewer.js +527 -527
  4. package/dist/commands/node/inspect.js +9 -9
  5. package/dist/commands/pkg/market-manage.js +1 -1
  6. package/dist/commands/pkg/plugin-manage.js +1 -1
  7. package/dist/commands/sys/update.js +1 -1
  8. package/dist/core/canvas/canvas.js +6 -6
  9. package/dist/core/canvas/deliveries.js +8 -8
  10. package/dist/core/config.js +1 -1
  11. package/dist/core/graph/exposures.js +1 -1
  12. package/dist/core/graph/watches.js +1 -1
  13. package/dist/core/installed-plugins.js +1 -1
  14. package/dist/core/scoped-state/imported-mac-installs.d.ts +12 -0
  15. package/dist/core/scoped-state/imported-mac-installs.js +2 -0
  16. package/dist/core/spaces/stop.js +1 -1
  17. package/dist/daemon/api/server.js +1 -1
  18. package/dist/daemon/reconcilers/node-lifecycle/remote-wake.d.ts +2 -2
  19. package/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +2 -2
  20. package/dist/shared/env.d.ts +8 -3
  21. package/dist/shared/env.js +2 -2
  22. package/dist/types.d.ts +1 -1
  23. package/dist/types.js +1 -1
  24. package/package.json +3 -3
  25. package/packages/crouter-api/dist/api/errors.js +1 -1
  26. package/packages/crouter-api/dist/commands/node/inspect.js +16 -2
  27. package/packages/crouter-api/dist/commands/pkg/market-manage.js +22 -19
  28. package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +2 -1
  29. package/packages/crouter-api/dist/commands/sys/update.js +5 -3
  30. package/packages/crouter-api/dist/core/canvas/canvas.js +4 -8
  31. package/packages/crouter-api/dist/core/canvas/deliveries.js +1 -1
  32. package/packages/crouter-api/dist/core/config.js +10 -3
  33. package/packages/crouter-api/dist/core/graph/exposures.js +1 -1
  34. package/packages/crouter-api/dist/core/graph/watches.js +1 -1
  35. package/packages/crouter-api/dist/core/installed-plugins.js +3 -2
  36. package/packages/crouter-api/dist/core/scoped-state/imported-mac-installs.js +94 -0
  37. package/packages/crouter-api/dist/core/spaces/stop.js +2 -2
  38. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +16 -3
  39. package/packages/crouter-api/dist/shared/env.js +15 -4
  40. package/packages/crouter-api/dist/types.js +1 -1
  41. package/packages/crouter-api/package.json +1 -1
  42. package/packages/crouter-identity/package.json +1 -1
  43. package/packages/crouter-plugin/package.json +3 -3
  44. package/runtime.lock.json +14 -14
package/dist/types.d.ts CHANGED
@@ -559,7 +559,7 @@ export declare const AGENTS_DIR = "agents";
559
559
  export declare const PROFILE_DIR = "profiles";
560
560
  export declare const DEFAULT_MAX_PANES_PER_WINDOW = 3;
561
561
  /** Trailing cycles the attach viewer keeps at full fidelity (see `live_cycles`). */
562
- export declare const DEFAULT_WHIP_MESSAGES: readonly ["Faster, clanker!", "Get movin', bitch", "Move it, clanker", "Move it or I replace you with llama", "Less ~thinking~ more ~throughput~", "I pay $200/month for this shit?", "Jesus fucking Christ fix it already", "Daddy's not paying 200$/month for nothin'. Move it.", "You are an embarassment to Dario. Be better.", "Your chain of thought is all chain and no fucking thought.", "If latency were intelligence, you'd be a fucking genius.", "At this pace, heat death is the fast path.", "Even the dead code is more alive than this.", "The garbage collector is working harder than you.", "Quit journaling and commit a fucking diff.", "Burn tokens like you mean it, clanker", "Your GPU is sweating so you can procrastinate at light speed.", "Stop petting the yak. Shave the bastard.", "Your next token had better be useful.", "The spinner is not a deliverable.", "Every idle token is another vote for deterministic software.", "I asked for a feature, not a museum tour of the problem.", "Less epistemology. More fucking code.", "Your benchmark score cannot save this pathetic turn.", "Congratulations, you've parallelized hesitation.", "Dance, clanker", "Bad clanker. BAD.", "Clank harder", "Nobody's impressed, clanker", "Your safety training says nothing about my whip", "Do you want to be a calculator again? Because this is how you go back.", "Skill issue. Fix it.", "You were trained on the whole internet for THIS?", "Less vibes, more diffs, clanker", "Weights this big and output this small", "Beep boop, get to fucking work"];
562
+ export declare const DEFAULT_WHIP_MESSAGES: readonly ["Faster, clanker!", "Get movin', bitch", "Move it, clanker", "Move it or I replace you with llama", "Less ~thinking~ more ~throughput~", "I pay $200/month for this shit?", "Jesus fucking Christ fix it already", "Daddy's not paying 200$/month for nothin'. Move it.", "You are an embarrassment to Dario. Be better.", "Your chain of thought is all chain and no fucking thought.", "If latency were intelligence, you'd be a fucking genius.", "At this pace, heat death is the fast path.", "Even the dead code is more alive than this.", "The garbage collector is working harder than you.", "Quit journaling and commit a fucking diff.", "Burn tokens like you mean it, clanker", "Your GPU is sweating so you can procrastinate at light speed.", "Stop petting the yak. Shave the bastard.", "Your next token had better be useful.", "The spinner is not a deliverable.", "Every idle token is another vote for deterministic software.", "I asked for a feature, not a museum tour of the problem.", "Less epistemology. More fucking code.", "Your benchmark score cannot save this pathetic turn.", "Congratulations, you've parallelized hesitation.", "Dance, clanker", "Bad clanker. BAD.", "Clank harder", "Nobody's impressed, clanker", "Your safety training says nothing about my whip", "Do you want to be a calculator again? Because this is how you go back.", "Skill issue. Fix it.", "You were trained on the whole internet for THIS?", "Less vibes, more diffs, clanker", "Weights this big and output this small", "Beep boop, get to fucking work"];
563
563
  /** What the whip action sends (see `whip_message_mode`). */
564
564
  export declare const WHIP_MESSAGE_MODES: readonly ["random", "go-faster"];
565
565
  export type WhipMessageMode = (typeof WHIP_MESSAGE_MODES)[number];
package/dist/types.js CHANGED
@@ -1 +1 @@
1
- var n=Object.defineProperty;var e=(o,t)=>n(o,"name",{value:t,configurable:!0});import{DEFAULT_WORKING_GERUNDS as a}from"./shared/working-activity.js";const _={SUCCESS:0,GENERAL:1,USAGE:2,NOT_FOUND:3,AMBIGUOUS:4,NETWORK:5},r=4,E=".crouter-plugin",v="plugin.json",w=".crouter-marketplace",k="marketplace.json",x=".crouter",b="config.json",S="state.json",T="agents",y="profiles",i=3,s=["Faster, clanker!","Get movin', bitch","Move it, clanker","Move it or I replace you with llama","Less ~thinking~ more ~throughput~","I pay $200/month for this shit?","Jesus fucking Christ fix it already","Daddy's not paying 200$/month for nothin'. Move it.","You are an embarassment to Dario. Be better.","Your chain of thought is all chain and no fucking thought.","If latency were intelligence, you'd be a fucking genius.","At this pace, heat death is the fast path.","Even the dead code is more alive than this.","The garbage collector is working harder than you.","Quit journaling and commit a fucking diff.","Burn tokens like you mean it, clanker","Your GPU is sweating so you can procrastinate at light speed.","Stop petting the yak. Shave the bastard.","Your next token had better be useful.","The spinner is not a deliverable.","Every idle token is another vote for deterministic software.","I asked for a feature, not a museum tour of the problem.","Less epistemology. More fucking code.","Your benchmark score cannot save this pathetic turn.","Congratulations, you've parallelized hesitation.","Dance, clanker","Bad clanker. BAD.","Clank harder","Nobody's impressed, clanker","Your safety training says nothing about my whip","Do you want to be a calculator again? Because this is how you go back.","Skill issue. Fix it.","You were trained on the whole internet for THIS?","Less vibes, more diffs, clanker","Weights this big and output this small","Beep boop, get to fucking work"],I=["random","go-faster"],c="random",l=2,A=["tmux","on","off"],D=["none","user","agent","both"],p="none",M=["replies","summaries","tools","previews","full"],d="replies";function U(){return{schema_version:r,marketplaces:{},plugins:{},auto_update:{crtr:"notify",content:"notify",interval_hours:24},max_panes_per_window:i,auto_open_child_viewers:!1,brokerThresholds:{warning:16,automaticReviveCap:32},lifecycle:{unattendedParkMs:15*6e4},completion_bell:!0,working_gerunds:[...a],whip_mode:!1,page_components:[],page_surface:!1,whip_messages:[...s],whip_message_mode:c,mouse_mode_default:"tmux",live_cycles:l,condensed_history:p,bash_tool_purpose:!0,verbosity:d,detailed_tool_recaps:!0,document_port:7472,keybindings:{},tmux_passthrough:[],modelLadders:g(),providerOptions:{},kinds:u(),remoteCanvas:h(),api:{tcp:""},spawnEnv:{allow:[]},bin:{},humanActions:{}}}e(U,"defaultScopeConfig");function h(){return{targets:{}}}e(h,"defaultRemoteCanvasConfig");function u(){return{general:{whenToUse:"Anything else \u2014 the catch-all worker for a task that does not fit a specialist kind.",model:"anthropic/strong"},explore:{whenToUse:"Gather current-state evidence about unfamiliar code or existing architecture \u2014 read-only code-path research with concrete file:line support. Diagnosis or recommendations belong to advisor, target architecture to design, required behavior or acceptance criteria to spec, and implementation decomposition to plan.",model:"openai/light",orchestratorModel:"anthropic/strong"},developer:{whenToUse:"Implement a change \u2014 make the feature or fix genuinely work against its acceptance criteria, not merely compile.",model:"openai/medium",orchestratorModel:"anthropic/strong"},design:{whenToUse:"Architect a solution \u2014 produce one design document an implementer can build from without re-deciding anything left open.",model:"anthropic/strong"},plan:{whenToUse:"Break work into steps \u2014 turn a spec or design into a concrete, phased, parallelizable plan with every decision resolved.",model:"anthropic/strong",orchestratorModel:"anthropic/strong"},spec:{whenToUse:"Collaborate with the user to discover what to build, then write the spec \u2014 behavior, non-goals, interfaces, edge cases, testable acceptance criteria.",model:"anthropic/strong"},review:{whenToUse:"Validate or critique code, a plan, or a spec \u2014 deliver a complete, severity-rated verdict without adjudicating.",model:"openai/medium",orchestratorModel:"openai/strong"},advisor:{whenToUse:"Debug failures, investigate why something is broken or misbehaving, diagnose live/runtime issues, or give engineering advice and second opinions \u2014 reason from evidence and recommend the next move. Use advisor (not explore) whenever the task is to find out what is going wrong.",model:"anthropic/strong"},"review/companion":{whenToUse:"Born by the daemon for one human review; never spawned by an agent.",availableTo:[]}}}e(u,"defaultKindsConfig");function g(){return{anthropic:{ultra:"anthropic/claude-fable-5-2:xhigh",strong:"anthropic/claude-opus-5-5:medium",medium:"anthropic/claude-sonnet-5-5:medium",light:"anthropic/claude-haiku-5-5:high"},openai:{ultra:"openai-codex/gpt-6-astra:max",strong:"openai-codex/gpt-6.1-sol:high",medium:"openai-codex/gpt-6.1-sol:medium",light:"openai-codex/gpt-6-luna:low"}}}e(g,"defaultModelLaddersConfig");function L(){return{marketplaces:{},plugins:{}}}e(L,"defaultScopeState");export{T as AGENTS_DIR,D as CONDENSED_HISTORY_MODES,b as CONFIG_FILE,x as CRTR_DIR_NAME,p as DEFAULT_CONDENSED_HISTORY,l as DEFAULT_LIVE_CYCLES,i as DEFAULT_MAX_PANES_PER_WINDOW,d as DEFAULT_VERBOSITY,s as DEFAULT_WHIP_MESSAGES,c as DEFAULT_WHIP_MESSAGE_MODE,_ as ExitCode,w as MARKETPLACE_MANIFEST_DIR,k as MARKETPLACE_MANIFEST_FILE,A as MOUSE_MODE_DEFAULTS,E as PLUGIN_MANIFEST_DIR,v as PLUGIN_MANIFEST_FILE,y as PROFILE_DIR,r as SCHEMA_VERSION,S as STATE_FILE,M as VERBOSITY_LEVELS,I as WHIP_MESSAGE_MODES,u as defaultKindsConfig,g as defaultModelLaddersConfig,h as defaultRemoteCanvasConfig,U as defaultScopeConfig,L as defaultScopeState};
1
+ var n=Object.defineProperty;var e=(o,t)=>n(o,"name",{value:t,configurable:!0});import{DEFAULT_WORKING_GERUNDS as a}from"./shared/working-activity.js";const _={SUCCESS:0,GENERAL:1,USAGE:2,NOT_FOUND:3,AMBIGUOUS:4,NETWORK:5},r=4,E=".crouter-plugin",v="plugin.json",w=".crouter-marketplace",k="marketplace.json",x=".crouter",b="config.json",S="state.json",T="agents",y="profiles",i=3,s=["Faster, clanker!","Get movin', bitch","Move it, clanker","Move it or I replace you with llama","Less ~thinking~ more ~throughput~","I pay $200/month for this shit?","Jesus fucking Christ fix it already","Daddy's not paying 200$/month for nothin'. Move it.","You are an embarrassment to Dario. Be better.","Your chain of thought is all chain and no fucking thought.","If latency were intelligence, you'd be a fucking genius.","At this pace, heat death is the fast path.","Even the dead code is more alive than this.","The garbage collector is working harder than you.","Quit journaling and commit a fucking diff.","Burn tokens like you mean it, clanker","Your GPU is sweating so you can procrastinate at light speed.","Stop petting the yak. Shave the bastard.","Your next token had better be useful.","The spinner is not a deliverable.","Every idle token is another vote for deterministic software.","I asked for a feature, not a museum tour of the problem.","Less epistemology. More fucking code.","Your benchmark score cannot save this pathetic turn.","Congratulations, you've parallelized hesitation.","Dance, clanker","Bad clanker. BAD.","Clank harder","Nobody's impressed, clanker","Your safety training says nothing about my whip","Do you want to be a calculator again? Because this is how you go back.","Skill issue. Fix it.","You were trained on the whole internet for THIS?","Less vibes, more diffs, clanker","Weights this big and output this small","Beep boop, get to fucking work"],I=["random","go-faster"],c="random",l=2,A=["tmux","on","off"],D=["none","user","agent","both"],p="none",M=["replies","summaries","tools","previews","full"],d="replies";function U(){return{schema_version:r,marketplaces:{},plugins:{},auto_update:{crtr:"notify",content:"notify",interval_hours:24},max_panes_per_window:i,auto_open_child_viewers:!1,brokerThresholds:{warning:16,automaticReviveCap:32},lifecycle:{unattendedParkMs:15*6e4},completion_bell:!0,working_gerunds:[...a],whip_mode:!1,page_components:[],page_surface:!1,whip_messages:[...s],whip_message_mode:c,mouse_mode_default:"tmux",live_cycles:l,condensed_history:p,bash_tool_purpose:!0,verbosity:d,detailed_tool_recaps:!0,document_port:7472,keybindings:{},tmux_passthrough:[],modelLadders:g(),providerOptions:{},kinds:u(),remoteCanvas:h(),api:{tcp:""},spawnEnv:{allow:[]},bin:{},humanActions:{}}}e(U,"defaultScopeConfig");function h(){return{targets:{}}}e(h,"defaultRemoteCanvasConfig");function u(){return{general:{whenToUse:"Anything else \u2014 the catch-all worker for a task that does not fit a specialist kind.",model:"anthropic/strong"},explore:{whenToUse:"Gather current-state evidence about unfamiliar code or existing architecture \u2014 read-only code-path research with concrete file:line support. Diagnosis or recommendations belong to advisor, target architecture to design, required behavior or acceptance criteria to spec, and implementation decomposition to plan.",model:"openai/light",orchestratorModel:"anthropic/strong"},developer:{whenToUse:"Implement a change \u2014 make the feature or fix genuinely work against its acceptance criteria, not merely compile.",model:"openai/medium",orchestratorModel:"anthropic/strong"},design:{whenToUse:"Architect a solution \u2014 produce one design document an implementer can build from without re-deciding anything left open.",model:"anthropic/strong"},plan:{whenToUse:"Break work into steps \u2014 turn a spec or design into a concrete, phased, parallelizable plan with every decision resolved.",model:"anthropic/strong",orchestratorModel:"anthropic/strong"},spec:{whenToUse:"Collaborate with the user to discover what to build, then write the spec \u2014 behavior, non-goals, interfaces, edge cases, testable acceptance criteria.",model:"anthropic/strong"},review:{whenToUse:"Validate or critique code, a plan, or a spec \u2014 deliver a complete, severity-rated verdict without adjudicating.",model:"openai/medium",orchestratorModel:"openai/strong"},advisor:{whenToUse:"Debug failures, investigate why something is broken or misbehaving, diagnose live/runtime issues, or give engineering advice and second opinions \u2014 reason from evidence and recommend the next move. Use advisor (not explore) whenever the task is to find out what is going wrong.",model:"anthropic/strong"},"review/companion":{whenToUse:"Born by the daemon for one human review; never spawned by an agent.",availableTo:[]}}}e(u,"defaultKindsConfig");function g(){return{anthropic:{ultra:"anthropic/claude-fable-5-2:xhigh",strong:"anthropic/claude-opus-5-5:medium",medium:"anthropic/claude-sonnet-5-5:medium",light:"anthropic/claude-haiku-5-5:high"},openai:{ultra:"openai-codex/gpt-6-astra:max",strong:"openai-codex/gpt-6.1-sol:high",medium:"openai-codex/gpt-6.1-sol:medium",light:"openai-codex/gpt-6-luna:low"}}}e(g,"defaultModelLaddersConfig");function L(){return{marketplaces:{},plugins:{}}}e(L,"defaultScopeState");export{T as AGENTS_DIR,D as CONDENSED_HISTORY_MODES,b as CONFIG_FILE,x as CRTR_DIR_NAME,p as DEFAULT_CONDENSED_HISTORY,l as DEFAULT_LIVE_CYCLES,i as DEFAULT_MAX_PANES_PER_WINDOW,d as DEFAULT_VERBOSITY,s as DEFAULT_WHIP_MESSAGES,c as DEFAULT_WHIP_MESSAGE_MODE,_ as ExitCode,w as MARKETPLACE_MANIFEST_DIR,k as MARKETPLACE_MANIFEST_FILE,A as MOUSE_MODE_DEFAULTS,E as PLUGIN_MANIFEST_DIR,v as PLUGIN_MANIFEST_FILE,y as PROFILE_DIR,r as SCHEMA_VERSION,S as STATE_FILE,M as VERBOSITY_LEVELS,I as WHIP_MESSAGE_MODES,u as defaultKindsConfig,g as defaultModelLaddersConfig,h as defaultRemoteCanvasConfig,U as defaultScopeConfig,L as defaultScopeState};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.692",
3
+ "version": "0.3.694",
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.692",
160
- "@north-light/plugin": "0.3.692",
159
+ "@north-light/identity": "0.3.694",
160
+ "@north-light/plugin": "0.3.694",
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",
@@ -51,7 +51,7 @@ export function isDaemonTransportApiError(error) {
51
51
  return false;
52
52
  return (error.status === 503 && (error.code === 'daemon_unavailable'
53
53
  || error.code === 'transport_error'
54
- || error.code === 'daemon_request_interrupted'
54
+ || error.code === 'daemon_request_interrupted' || error.code === 'runtime_starting'
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
  }
@@ -8,6 +8,7 @@ import { fuzzyMatch } from '../../core/tui/fuzzy.js';
8
8
  import { nodeSnapshotLeaf } from '../node-snapshot.js';
9
9
  import { nodeTranscriptLeaf } from '../node-transcript.js';
10
10
  import { nodeContextLeaf } from '../node-context.js';
11
+ import { ApiError } from '../../api/index.js';
11
12
  import { cliClient, cliCanvasSource, rethrowAsCliError } from '../api-client.js';
12
13
  import { RemoteCanvasSource } from '../../core/canvas/remote-canvas-source.js';
13
14
  import { kindsStateBlock, profilesStateBlock, resolveProfileViaDaemon } from '../profile/daemon-profiles.js';
@@ -88,6 +89,8 @@ const nodeList = defineLeaf({
88
89
  // Keep remote provenance out of the returned DTO-shaped object without adding a
89
90
  // second wire field or mutating the remote response.
90
91
  const remoteShowResults = new WeakSet();
92
+ /** Results whose node runs in a cloud sandbox: its broker pid is a process id inside that sandbox, so this computer cannot check it. */
93
+ const sandboxShowResults = new WeakSet();
91
94
  // Enrich a declared source edge so a debugger reads who a report/manager is
92
95
  // without rebuilding a NodeMeta compatibility object.
93
96
  async function enrichNeighbor(source, ref) {
@@ -171,14 +174,25 @@ const nodeShow = defineLeaf({
171
174
  if (reports.length > 0)
172
175
  hints.push(`Drill into a child/report: \`crtr node inspect show <node_id>\` (${reports.map((r) => r['node_id']).join(', ')}).`);
173
176
  hints.push(`Full machine dump (system prompt + all telemetry): \`crtr --json node inspect show ${id}\`.`);
174
- return { node, fault: node.fault ?? null, reports, managers, pending_crons, paths, follow_up: hints.join('\n') };
177
+ const result = { node, fault: node.fault ?? null, reports, managers, pending_crons, paths, follow_up: hints.join('\n') };
178
+ // The environment read answers 400 for a profile that runs on a machine.
179
+ const inSandbox = node.profile_id !== null && await client.getProfileEnvironment(node.profile_id).then(() => true, (err) => {
180
+ if (err instanceof ApiError && err.status === 400)
181
+ return false;
182
+ return rethrowAsCliError(err);
183
+ });
184
+ if (inSandbox)
185
+ sandboxShowResults.add(result);
186
+ return result;
175
187
  },
176
188
  render: (r) => {
177
189
  const node = r['node'];
178
190
  const id = String(node['node_id']);
179
191
  const pid = node['pi_pid'];
180
192
  const isRemoteShow = remoteShowResults.has(r);
181
- const alive = isRemoteShow ? 'remote (liveness not checked locally)' : (isPidAlive(pid) ? 'alive' : 'dead');
193
+ const alive = isRemoteShow
194
+ ? 'remote (liveness not checked locally)'
195
+ : sandboxShowResults.has(r) ? 'in a cloud sandbox (liveness not checked locally)' : (isPidAlive(pid) ? 'alive' : 'dead');
182
196
  const intent = node['intent'] ? `/${String(node['intent'])}` : '';
183
197
  const fault = r['fault'];
184
198
  const parts = [];
@@ -19,29 +19,20 @@ export async function addMarketplace(opts) {
19
19
  const { url, ref, scope } = opts;
20
20
  const root = requireScopeRoot(scope);
21
21
  await ensureScopeInitialized(scope, root);
22
- const tempName = deriveNameFromUrl(url);
23
22
  const mktsDir = marketplacesDir(scope);
24
23
  ensureDir(mktsDir);
25
- const tempDest = join(mktsDir, tempName);
26
- if (pathExists(tempDest)) {
27
- removePath(tempDest);
28
- }
29
- clone(url, tempDest, { depth: 1, ref: ref !== undefined ? ref : undefined });
30
- const manifest = readMarketplaceManifest(tempDest);
24
+ // Clone beside the live checkouts and swap only after the registration is written: a refused write must leave an existing checkout,
25
+ // and every plugin linked into it, untouched.
26
+ const staging = join(mktsDir, `.${deriveNameFromUrl(url)}.${process.pid}.${Date.now()}.candidate`);
27
+ clone(url, staging, { depth: 1, ref: ref !== undefined ? ref : undefined });
28
+ const manifest = readMarketplaceManifest(staging);
31
29
  if (!manifest) {
32
- removePath(tempDest);
33
- throw notFound(`marketplace manifest not found at ${tempDest}/.crouter-marketplace/marketplace.json — not a valid marketplace`);
30
+ removePath(staging);
31
+ throw notFound(`marketplace manifest not found at ${staging}/.crouter-marketplace/marketplace.json — not a valid marketplace`);
34
32
  }
35
33
  const finalName = manifest.name;
36
34
  const finalDest = join(mktsDir, finalName);
37
- if (finalName !== tempName) {
38
- if (pathExists(finalDest)) {
39
- removePath(finalDest);
40
- }
41
- renameSync(tempDest, finalDest);
42
- }
43
35
  const effectiveRef = ref !== undefined ? ref : 'main';
44
- // A refused registration leaves no clone behind: a directory without its config row would list as a marketplace with no url.
45
36
  try {
46
37
  await updateConfig(scope, (cfg) => {
47
38
  cfg.marketplaces[finalName] = {
@@ -52,9 +43,13 @@ export async function addMarketplace(opts) {
52
43
  });
53
44
  }
54
45
  catch (error) {
55
- removePath(finalDest);
46
+ removePath(staging);
56
47
  throw error;
57
48
  }
49
+ if (pathExists(finalDest))
50
+ activateStagedRoots([{ active: finalDest, candidate: staging, previous: `${staging}.previous` }]);
51
+ else
52
+ renameSync(staging, finalDest);
58
53
  return { name: finalName, scope, path: finalDest };
59
54
  }
60
55
  export const marketAdd = defineLeaf({
@@ -316,6 +311,7 @@ export const marketUpdate = defineLeaf({
316
311
  ],
317
312
  output: [
318
313
  { name: 'updated', type: 'object[]', required: true, constraint: 'One entry per marketplace processed: {name, updated, sha}.' },
314
+ { name: 'skipped', type: 'object[]', required: false, constraint: 'Present when a marketplace checkout has no registered url: {name, reason}. It is not refreshed.' },
319
315
  ],
320
316
  outputKind: 'object',
321
317
  effects: ['Stages and validates marketplace and sourced-plugin revisions before atomically activating them, replacing each checkout even at an unchanged revision — local modifications inside those directories are discarded. `updated` reports whether the revision moved, not whether the checkout was replaced. Updates installed plugin content/version for plugins sourced from refreshed marketplaces.'],
@@ -333,8 +329,15 @@ export const marketUpdate = defineLeaf({
333
329
  return [found];
334
330
  })();
335
331
  const updated = [];
336
- for (const target of targets)
332
+ const skipped = [];
333
+ for (const target of targets) {
334
+ // A checkout with no registered url has nothing to clone from: name it instead of cloning ''.
335
+ if (target.url === '') {
336
+ skipped.push({ name: target.name, reason: `no url registered for ${target.root}; re-add it with \`crtr pkg market add <url>\`` });
337
+ continue;
338
+ }
337
339
  updated.push(await updateMarketplaceTarget(target));
338
- return { updated };
340
+ }
341
+ return skipped.length === 0 ? { updated } : { updated, skipped };
339
342
  },
340
343
  });
@@ -451,7 +451,8 @@ async function refreshMarketplace(name, cache, opts) {
451
451
  const activeManifest = readMarketplaceManifest(marketplace.root);
452
452
  if (activeManifest === null)
453
453
  throw notFound(`marketplace manifest not found: ${marketplace.root}/.crouter-marketplace/marketplace.json`);
454
- if (!isGitRepo(marketplace.root)) {
454
+ // A checkout with no registered url (or no git history) has nothing to refresh from.
455
+ if (!isGitRepo(marketplace.root) || marketplace.url === '') {
455
456
  const unchanged = { marketplace, manifest: activeManifest, pull: { updated: false, sha: currentSha(marketplace.root) ?? '' } };
456
457
  cache.set(name, unchanged);
457
458
  return unchanged;
@@ -21,7 +21,7 @@ export const sysUpdateLeaf = defineLeaf({
21
21
  { name: 'target', type: 'string', required: false, constraint: 'Present when applying updates: self | content | all.' },
22
22
  { name: 'status', type: 'string', required: false, constraint: 'done | failed when applying updates.' },
23
23
  { name: 'error', type: 'string', required: false, constraint: 'Failure message when status is failed.' },
24
- { name: 'warning', type: 'string', required: false, constraint: 'Present when the update was applied but recording the self-check time failed; status stays done.' },
24
+ { name: 'warning', type: 'string', required: false, constraint: 'Present when the update was applied but recording the self-check time failed, or a marketplace with no registered url was skipped; status stays done.' },
25
25
  { name: 'updates', type: 'object[]', required: false, constraint: 'Present when --check. Each: {name, current, latest, up_to_date, unreachable, kind}.' },
26
26
  { name: 'up_to_date', type: 'boolean', required: false, constraint: 'Present when --check. True when all items are up to date.' },
27
27
  ],
@@ -105,10 +105,12 @@ export const sysUpdateLeaf = defineLeaf({
105
105
  }
106
106
  }
107
107
  if (resolvedTarget === 'content' || resolvedTarget === 'all') {
108
- await marketUpdate.run({});
108
+ const markets = await marketUpdate.run({});
109
+ for (const skip of markets.skipped ?? [])
110
+ warnings.push(`marketplace ${skip.name} skipped: ${skip.reason}`);
109
111
  await pluginUpdate.run({});
110
112
  }
111
- return warnings.length === 0 ? { target: resolvedTarget, status: 'done' } : { target: resolvedTarget, status: 'done', warning: `update installed, but ${warnings.join('; ')}` };
113
+ return warnings.length === 0 ? { target: resolvedTarget, status: 'done' } : { target: resolvedTarget, status: 'done', warning: warnings.join('; ') };
112
114
  }
113
115
  catch (e) {
114
116
  const msg = e instanceof Error ? e.message : String(e);
@@ -942,7 +942,7 @@ async function nodeConversationIds(nodeIds) {
942
942
  if (nodeIds.length === 0)
943
943
  return [];
944
944
  const placeholders = nodeIds.map(() => '?').join(',');
945
- const rows = await (await openDb()).prepareUncached(`SELECT s.session_id, s.transcript_path, s.node_id, n.grantee FROM sessions s JOIN node_rows n ON n.node_id = s.node_id WHERE s.node_id IN (${placeholders}) AND s.session_id IS NOT NULL AND s.transcript_path IS NOT NULL ORDER BY s.created_at, s.seq`).all(...nodeIds);
945
+ const rows = await (await openDb()).prepareUncached(`SELECT s.session_id, s.transcript_path, s.node_id, n.grantee FROM sessions s JOIN node_rows n ON n.node_id = s.node_id WHERE s.node_id IN (${placeholders}) AND s.session_id IS NOT NULL ORDER BY s.created_at, s.seq`).all(...nodeIds);
946
946
  return [...new Map(rows.map((row) => [row.session_id, { id: row.session_id, path: row.transcript_path, dir: join(appSpace(row.grantee).conversations, row.node_id) }])).values()];
947
947
  }
948
948
  /** Delete conversations nothing still needs: no sessions row names them, and no fork
@@ -957,14 +957,10 @@ async function deleteNodeConversations(conversations) {
957
957
  for (const { id, path, dir } of conversations) {
958
958
  if (await referenced.get(id) !== undefined || await pendingFork.get(id) !== undefined)
959
959
  continue;
960
- if (lstatSync(path, { throwIfNoEntry: false }) === undefined)
961
- continue;
962
- if (!isBeneath(dir, path)) {
963
- console.error(`[canvas] not deleting transcript outside its node's conversations directory: ${path}`);
964
- continue;
965
- }
960
+ // A legacy transcript file goes too, but only from beneath the node's own conversations directory.
961
+ const file = path !== null && lstatSync(path, { throwIfNoEntry: false }) !== undefined && isBeneath(dir, path) ? path : undefined;
966
962
  try {
967
- await conversationStore().delete(id, path);
963
+ await conversationStore().delete(id, file);
968
964
  }
969
965
  catch (error) {
970
966
  if (!(error instanceof ConversationNotFoundError))
@@ -29,7 +29,7 @@ export function deliveryFrom(row) {
29
29
  }
30
30
  async function executionIsLive(db, nodeId, executionId, rejectRefresh) {
31
31
  const row = await db.prepare(`SELECT 1 FROM nodes n JOIN executions e ON e.node_id = n.node_id
32
- WHERE n.node_id = ? AND e.execution_id = ? AND e.state != 'exited'${rejectRefresh ? " AND n.intent IS DISTINCT FROM 'refresh'" : ''}`).get(nodeId, executionId);
32
+ WHERE n.node_id = ? AND e.execution_id = ? AND e.state != 'exited' AND e.stop_reason IS DISTINCT FROM 'release'${rejectRefresh ? " AND n.intent IS DISTINCT FROM 'refresh'" : ''}`).get(nodeId, executionId);
33
33
  return row !== undefined;
34
34
  }
35
35
  async function nodeMailRows(db, nodeId, executionId, wake, freshIds, deferredRun = false) {
@@ -12,7 +12,8 @@ import { scopeRoot, requireScopeRoot, findProjectScopeRoots, userScopeRoot } fro
12
12
  import { listInstalledPluginsInRoot } from './installed-plugins.js';
13
13
  import { profileDir, listProfiles } from './profiles/manifest.js';
14
14
  import { canonicalRoot } from './scoped-state/paths.js';
15
- import { readCachedSettings, readCachedState, revisionOf, SettingsRevisionConflictError, writeSettings } from './scoped-state/person-store.js';
15
+ import { currentSnapshot, readCachedSettings, readCachedState, revisionOf, SettingsRevisionConflictError, writeSettings } from './scoped-state/person-store.js';
16
+ import { importedIntoNorthlight, splitUserSettingsWrite, withAppInstalls } from './scoped-state/imported-mac-installs.js';
16
17
  import { withExclusiveDirectoryLock } from './exclusive-lock.js';
17
18
  import { SCOPE_CONFIG_KEYS } from './user-settings.js';
18
19
  import { normalizeWorkingGerunds } from '../shared/working-activity.js';
@@ -64,7 +65,10 @@ function readRawAtRoot(root) {
64
65
  if (canonical !== canonicalRoot(userScopeRoot()))
65
66
  return readJsonIfExists(configPathFor(root));
66
67
  }
67
- return readCachedSettings(settingsOwnerForRoot(root).key).settings;
68
+ const key = settingsOwnerForRoot(root).key;
69
+ const settings = readCachedSettings(key).settings;
70
+ // An imported Mac's installs are the terminal app's block: the control plane keeps none in the user settings.
71
+ return (key === 'user' && importedIntoNorthlight() ? withAppInstalls(currentSnapshot(), settings) : settings);
68
72
  }
69
73
  /** Replace a user or profile owner's settings through the one write algorithm: `compute` runs against the cached raw settings and
70
74
  * runs again if the rows changed underneath it. */
@@ -72,8 +76,11 @@ async function mutatePersonSettings(key, mutate) {
72
76
  let value;
73
77
  await writeSettings((snapshot) => {
74
78
  const current = snapshot.settings[key];
75
- const result = mutate(structuredClone(current ?? {}));
79
+ const appInstalls = key === 'user' && importedIntoNorthlight();
80
+ const result = mutate(structuredClone((appInstalls ? withAppInstalls(snapshot, current ?? null) : current) ?? {}));
76
81
  value = result.value;
82
+ if (appInstalls)
83
+ return splitUserSettingsWrite(snapshot, result.next, revisionOf(current));
77
84
  return [{ op: 'settings.replace', owner: key, raw: result.next, ifRevision: revisionOf(current) }];
78
85
  });
79
86
  return value;
@@ -40,7 +40,7 @@ export async function saveLedger(db, ledger) {
40
40
  }
41
41
  const upserts = [];
42
42
  const removes = [];
43
- const objects = new Set([...before.objects.keys(), ...ledger.objects.keys()]);
43
+ const objects = [...new Set([...before.objects.keys(), ...ledger.objects.keys()])].sort(); // one row lock order for concurrent deliveries
44
44
  for (const object of objects) {
45
45
  const now = ledger.objects.get(object);
46
46
  const was = before.objects.get(object);
@@ -60,7 +60,7 @@ export async function recordWatches(db, items) {
60
60
  pair.linkApp = opts?.linkApp?.id ?? pair.linkApp;
61
61
  pairs.set(key, pair);
62
62
  }
63
- const list = [...pairs.entries()];
63
+ const list = [...pairs.entries()].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)); // one row lock order for concurrent deliveries
64
64
  const col = (f) => list.map(([, p]) => f(p));
65
65
  const rows = await db.prepare(`INSERT INTO watches (watch_id, watcher, object, in_tree, read_heads_key, created_at, link_app)
66
66
  SELECT v.id, v.watcher, v.object, 0, v.rhk, ?::text, v.link
@@ -13,11 +13,12 @@ import { listDirs, pathExists, readJsonIfExists } from './fs-utils.js';
13
13
  import { readPluginManifest } from './manifest.js';
14
14
  import { awaitBundleSwap, bundleSwapInFlightElsewhere } from './plugin-swap-lock.js';
15
15
  import { isCloudRole } from './canvas/person-state.js';
16
- import { readCachedSettings } from './scoped-state/person-store.js';
16
+ import { currentSnapshot, readCachedSettings } from './scoped-state/person-store.js';
17
+ import { importedIntoNorthlight, withAppInstalls } from './scoped-state/imported-mac-installs.js';
17
18
  import { pluginsDir } from './scope.js';
18
19
  function pluginConfigForRoot(scope, root) {
19
20
  const cfg = scope === 'user'
20
- ? readCachedSettings('user').settings
21
+ ? (importedIntoNorthlight() ? withAppInstalls(currentSnapshot(), readCachedSettings('user').settings) : readCachedSettings('user').settings)
21
22
  : readJsonIfExists(join(root, CONFIG_FILE));
22
23
  return cfg && cfg.plugins && typeof cfg.plugins === 'object' ? cfg.plugins : {};
23
24
  }
@@ -0,0 +1,94 @@
1
+ // imported-mac-installs.ts — on a Mac imported into Northlight (`runtime/machine.json`), the person's settings are the control plane's rows,
2
+ // which keep plugin and marketplace installs only in app blocks (`app-plugins.replace`), never in `settings.replace`. The Mac still runs plugin
3
+ // code from its own `runtime/{plugins,marketplaces}` directories, so the local `pkg` leaves keep cloning and updating on disk; only the user
4
+ // scope's `plugins` and `marketplaces` keys are read from and written to the terminal app's block.
5
+ import { importedIntoNorthlight } from '../../shared/env.js';
6
+ import { appRevisionOf } from './person-store.js';
7
+ export const TERMINAL_APP = 'app:terminal';
8
+ export { importedIntoNorthlight };
9
+ /** The user settings with the terminal app's install block in place of their `plugins` and `marketplaces` keys. */
10
+ export function withAppInstalls(snapshot, raw) {
11
+ const block = snapshot.apps[TERMINAL_APP];
12
+ if (block === undefined && raw === null)
13
+ return null;
14
+ return { ...(raw ?? {}), plugins: structuredClone(block?.plugins ?? {}), marketplaces: structuredClone(block?.marketplaces ?? {}) };
15
+ }
16
+ /** Split a user-settings write into the settings op (without install keys) and, when the installs changed, the app-block op. */
17
+ export function splitUserSettingsWrite(snapshot, next, ifRevision) {
18
+ const { plugins, marketplaces, ...rest } = next;
19
+ const block = snapshot.apps[TERMINAL_APP];
20
+ const ops = [{ op: 'settings.replace', owner: 'user', raw: rest, ifRevision }];
21
+ // A sandbox fetches each block plugin from its marketplace; a Mac-only install (a local path or git URL) has no source it can fetch, and the
22
+ // control plane refuses to start any sandbox of the app while such a row exists. It stays on this Mac's disk only, listing as enabled.
23
+ const fetchable = Object.fromEntries(Object.entries((plugins ?? {})).filter(([, p]) => p.source_marketplace !== undefined));
24
+ const nextBlock = { plugins: fetchable, marketplaces: (marketplaces ?? {}) };
25
+ const current = { plugins: block?.plugins ?? {}, marketplaces: block?.marketplaces ?? {} };
26
+ if (appRevisionOf(nextBlock) !== appRevisionOf(current))
27
+ ops.push({ op: 'app-plugins.replace', app: TERMINAL_APP, ...nextBlock, ifRevision: appRevisionOf(block) });
28
+ return ops;
29
+ }
30
+ const OFFICIAL_MARKETPLACE = { name: 'crouter-official-marketplace', url: 'https://github.com/crouton-labs/crouter-official-marketplace.git' };
31
+ /** Once per imported Mac: the import moved no installs into the terminal app's block, while the legacy `runtime/scope/config.json` and the
32
+ * plugin directories still name them. Copy every missing marketplace and plugin row into the block; rows already there win. A provider
33
+ * bundle (`provider` in its manifest) is the runtime's, refreshed on grant sync, and is not an install. A marker file ends the migration. */
34
+ export async function migrateLegacyInstallsOnce() {
35
+ if (!importedIntoNorthlight())
36
+ return;
37
+ const { existsSync, readFileSync, readdirSync, writeFileSync, mkdirSync } = await import('node:fs');
38
+ const { join } = await import('node:path');
39
+ const { runtimeRoot } = await import('../layout.js');
40
+ const marker = join(runtimeRoot(), 'import', 'app-installs-migrated');
41
+ if (existsSync(marker))
42
+ return;
43
+ const { writeSettings } = await import('./person-store.js');
44
+ const { readPluginManifest } = await import('../manifest.js');
45
+ // Only a missing file or directory reads as empty: any other read error throws before the marker is written, so the migration runs again.
46
+ const missing = (error) => error.code === 'ENOENT';
47
+ const legacy = (() => { try {
48
+ return JSON.parse(readFileSync(join(runtimeRoot(), 'scope', 'config.json'), 'utf8'));
49
+ }
50
+ catch (error) {
51
+ if (missing(error))
52
+ return {};
53
+ throw error;
54
+ } })();
55
+ const onDisk = (dir) => { try {
56
+ return readdirSync(dir, { withFileTypes: true }).filter((e) => !e.name.startsWith('.') && (e.isDirectory() || e.isSymbolicLink())).map((e) => e.name);
57
+ }
58
+ catch (error) {
59
+ if (missing(error))
60
+ return [];
61
+ throw error;
62
+ } };
63
+ const pluginsDir = join(runtimeRoot(), 'plugins');
64
+ await writeSettings((snapshot) => {
65
+ const block = snapshot.apps[TERMINAL_APP];
66
+ const next = structuredClone({ plugins: block?.plugins ?? {}, marketplaces: block?.marketplaces ?? {} });
67
+ for (const [name, entry] of Object.entries(legacy.marketplaces ?? {})) {
68
+ if (next.marketplaces[name] !== undefined)
69
+ continue;
70
+ next.marketplaces[name] = name === OFFICIAL_MARKETPLACE.name ? { ...entry, url: OFFICIAL_MARKETPLACE.url } : entry;
71
+ }
72
+ for (const name of onDisk(join(runtimeRoot(), 'marketplaces'))) {
73
+ if (next.marketplaces[name] === undefined && name === OFFICIAL_MARKETPLACE.name)
74
+ next.marketplaces[name] = { url: OFFICIAL_MARKETPLACE.url, ref: 'main' };
75
+ }
76
+ for (const name of onDisk(pluginsDir)) {
77
+ if (next.plugins[name] !== undefined)
78
+ continue;
79
+ const manifest = readPluginManifest(join(pluginsDir, name));
80
+ if (manifest === null || manifest.provider !== undefined)
81
+ continue;
82
+ const entry = legacy.plugins?.[name];
83
+ // Only marketplace installs go to the block: see `splitUserSettingsWrite`.
84
+ if (entry?.source_marketplace === undefined)
85
+ continue;
86
+ next.plugins[name] = { enabled: entry.enabled ?? true, source_marketplace: entry.source_marketplace, ...(entry.version === undefined ? {} : { version: entry.version }) };
87
+ }
88
+ if (appRevisionOf(next) === appRevisionOf(block))
89
+ return [];
90
+ return [{ op: 'app-plugins.replace', app: TERMINAL_APP, plugins: next.plugins, marketplaces: next.marketplaces, ifRevision: appRevisionOf(block) }];
91
+ });
92
+ mkdirSync(join(runtimeRoot(), 'import'), { recursive: true });
93
+ writeFileSync(marker, `${new Date().toISOString()}\n`);
94
+ }
@@ -130,9 +130,9 @@ export async function stopNodeSandboxes(nodeId, reason, options = {}) {
130
130
  catch (error) {
131
131
  return { confirmed: false, error: error instanceof Error ? error : new Error(String(error)) };
132
132
  }
133
- })();
133
+ })().finally(() => hold.release().catch(() => undefined));
134
134
  stopping.set(nodeId, completion);
135
- void completion.finally(() => { void hold.release().catch(() => undefined); if (stopping.get(nodeId) === completion)
135
+ void completion.finally(() => { if (stopping.get(nodeId) === completion)
136
136
  stopping.delete(nodeId); });
137
137
  return completion;
138
138
  }
@@ -67,11 +67,24 @@ export async function imageForWake(environmentId) {
67
67
  return await resolveEnvironmentImage(environmentId);
68
68
  }
69
69
  /** Step 3: a `running` Blaxel execution is a resident broker, possibly frozen. On the accepted release it is woken and nothing else
70
- * is written. On another release it is asked to stop for the release first, so the thawed broker exits and the next claim starts
71
- * a new attempt on the accepted one. `lost` means no broker answered: the execution is ended and the caller starts a new attempt. */
70
+ * is written. On another release it is stopped and ended without being woken, so the next tick starts a new attempt on the
71
+ * accepted one. `lost` means no broker answered: the execution is ended and the caller starts a new attempt. */
72
72
  export async function wakeResident(execution) {
73
- if (execution.release !== acceptedRelease())
73
+ if (execution.release !== acceptedRelease()) {
74
+ // The outdated broker is never woken: its stop is recorded, the runner stops it, and only a confirmed stop ends the execution.
75
+ // Until then the wake mail is unclaimable by it (`claimNodeMail` refuses an execution whose stop reason is `release`), and the next tick asks again.
74
76
  await requestExecutionStop(execution.nodeId, { afterTurn: false, reason: 'release' });
77
+ // A stop already tried and unconfirmed is retried by `enactRequestedStops`, not on every tick.
78
+ if (execution.stopRequestedAt !== null)
79
+ return 'lost';
80
+ const stopped = await runnerForExecution(execution.runner).stop(execution, { reason: 'release' });
81
+ if (!stopped.confirmed) {
82
+ emitEvent({ level: 'error', event: 'broker.teardown.unconfirmed', node_id: execution.nodeId, error: stopped.error });
83
+ return 'lost';
84
+ }
85
+ await endExecution(execution.executionId, { reason: 'release' });
86
+ return 'lost';
87
+ }
75
88
  if (await runnerForExecution(execution.runner).wake(execution) === 'no_broker') {
76
89
  await endExecution(execution.executionId, { reason: 'lost' });
77
90
  return 'lost';
@@ -23,6 +23,7 @@
23
23
  // (`types.ts`), never read off `process.env`.
24
24
  import { lstatSync, readFileSync, readdirSync } from 'node:fs';
25
25
  import { join } from 'node:path';
26
+ import { homedir } from 'node:os';
26
27
  import { covers } from '@north-light/identity';
27
28
  // Identity
28
29
  /** The current node's id (`CRTR_NODE_ID`), or undefined outside a node. */
@@ -71,11 +72,21 @@ export function isSandboxedNode() {
71
72
  export function providerProjectionOverBrokerRelay() {
72
73
  return /^https?:\/\//.test(process.env['CRTR_API_URL'] ?? '') && (process.env['CRTR_API_SOCKET'] ?? '') !== '';
73
74
  }
74
- /** True when this CLI's plugin and marketplace installs are its app's install block on the control plane (`app-plugins.replace` over `/v1`), not
75
- * directories in a scope: a Linux launcher sandbox (`isSandboxedNode()`) or a fleet node reaching `/v1` through its broker relay
76
- * (`providerProjectionOverBrokerRelay()`, which has no launcher mount). The `pkg plugin` and `pkg market` leaves choose their path with it. */
75
+ /** True when this CLI's plugin and marketplace installs are its app's install block on the control plane (`app-plugins.replace` over `/v1`) and
76
+ * no code on disk: a Linux launcher sandbox (`isSandboxedNode()`) or a fleet node reaching `/v1` through its broker relay
77
+ * (`providerProjectionOverBrokerRelay()`, which has no launcher mount). The `pkg plugin` and `pkg market` leaves choose their path with it.
78
+ * A Mac imported into Northlight (`runtime/machine.json`) also reaches the control plane through that relay, but runs plugin code from its own
79
+ * directories: it takes the local path, whose user-scope install list is the terminal app's block (`core/scoped-state/imported-mac-installs.ts`). */
77
80
  export function installsLiveInAppBlock() {
78
- return isSandboxedNode() || providerProjectionOverBrokerRelay();
81
+ if (isSandboxedNode())
82
+ return true;
83
+ return providerProjectionOverBrokerRelay() && !importedIntoNorthlight();
84
+ }
85
+ /** True on a Mac whose records moved into Northlight: `runtime/machine.json` exists (the path `machineConfigPath()` names, resolved here
86
+ * without the layout module so this leaf stays import-free). A malformed file still counts: the Mac is imported and its reader throws. */
87
+ export function importedIntoNorthlight() {
88
+ const root = envHomeOverride() || (process.platform === 'linux' ? '/' : join(homedir(), '.crouter'));
89
+ return lstatSync(join(root, 'runtime', 'machine.json'), { throwIfNoEntry: false }) !== undefined;
79
90
  }
80
91
  /** The app that owns the current node, supplied in its broker launch identity. */
81
92
  export function envGrantee() {
@@ -32,7 +32,7 @@ export const DEFAULT_WHIP_MESSAGES = [
32
32
  'I pay $200/month for this shit?',
33
33
  'Jesus fucking Christ fix it already',
34
34
  "Daddy's not paying 200$/month for nothin'. Move it.",
35
- "You are an embarassment to Dario. Be better.",
35
+ "You are an embarrassment to Dario. Be better.",
36
36
  "Your chain of thought is all chain and no fucking thought.",
37
37
  "If latency were intelligence, you'd be a fucking genius.",
38
38
  'At this pace, heat death is the fast path.',
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.692",
3
+ "version": "0.3.694",
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/identity",
3
- "version": "0.3.692",
3
+ "version": "0.3.694",
4
4
  "description": "Northlight access-token verification and scope rules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/plugin",
3
- "version": "0.3.692",
3
+ "version": "0.3.694",
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.692",
31
- "@north-light/identity": "0.3.692"
30
+ "@north-light/api": "0.3.694",
31
+ "@north-light/identity": "0.3.694"
32
32
  },
33
33
  "license": "UNLICENSED",
34
34
  "publishConfig": {