@north-light/api 0.3.415 → 0.3.416

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.
@@ -1,12 +1,13 @@
1
1
  /** The current node's id (`CRTR_NODE_ID`), or undefined outside a node. */
2
2
  export declare function envNodeId(): string | undefined;
3
3
  /** Find the single launch snapshot mounted by the launcher into this process's
4
- * Linux namespace. Cron bash has no CRTR_NODE_ID, but its creator's mounted
5
- * launch snapshot supplies config and granted-command projection without
6
- * claiming the cron is a node. Its broker relay may already have closed when
7
- * the cron fires; still classify the sandbox so CLI bootstrap never falls back
8
- * to host stores or person authority. Neither CRTR_NODE_ID, CRTR_ANCHOR, nor
4
+ * Linux namespace. Cron bash has no CRTR_NODE_ID: its own execution folder
5
+ * (`cron-<execution_id>`, holding `cron-launch.json` and the execution socket)
6
+ * supplies config and granted-command projection without claiming the cron is
7
+ * a node, and never falls back to host stores or person authority. Neither CRTR_NODE_ID, CRTR_ANCHOR, nor
9
8
  * the caller-editable CRTR_API_SOCKET selects the launch identity. */
9
+ /** The launch snapshot a mounted run folder carries: a node's `broker-launch.json`, or a cron execution's `cron-launch.json`. */
10
+ export declare function launchSnapshotFile(dir: string): string | undefined;
10
11
  export declare function sandboxCliNodeId(): string | undefined;
11
12
  /** A Linux app command uses its mounted launch snapshot, not host user stores. */
12
13
  export declare function isSandboxedNode(): boolean;
@@ -30,12 +30,20 @@ export function envNodeId() {
30
30
  return process.env['CRTR_NODE_ID'];
31
31
  }
32
32
  /** Find the single launch snapshot mounted by the launcher into this process's
33
- * Linux namespace. Cron bash has no CRTR_NODE_ID, but its creator's mounted
34
- * launch snapshot supplies config and granted-command projection without
35
- * claiming the cron is a node. Its broker relay may already have closed when
36
- * the cron fires; still classify the sandbox so CLI bootstrap never falls back
37
- * to host stores or person authority. Neither CRTR_NODE_ID, CRTR_ANCHOR, nor
33
+ * Linux namespace. Cron bash has no CRTR_NODE_ID: its own execution folder
34
+ * (`cron-<execution_id>`, holding `cron-launch.json` and the execution socket)
35
+ * supplies config and granted-command projection without claiming the cron is
36
+ * a node, and never falls back to host stores or person authority. Neither CRTR_NODE_ID, CRTR_ANCHOR, nor
38
37
  * the caller-editable CRTR_API_SOCKET selects the launch identity. */
38
+ /** The launch snapshot a mounted run folder carries: a node's `broker-launch.json`, or a cron execution's `cron-launch.json`. */
39
+ export function launchSnapshotFile(dir) {
40
+ for (const name of ['broker-launch.json', 'cron-launch.json']) {
41
+ const path = join(dir, name);
42
+ if (lstatSync(path, { throwIfNoEntry: false })?.isFile())
43
+ return path;
44
+ }
45
+ return undefined;
46
+ }
39
47
  export function sandboxCliNodeId() {
40
48
  if (process.platform !== 'linux')
41
49
  return undefined;
@@ -45,7 +53,7 @@ export function sandboxCliNodeId() {
45
53
  const ids = readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() &&
46
54
  /^[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$/.test(entry.name) &&
47
55
  mounted.has(join(root, entry.name)) &&
48
- lstatSync(join(root, entry.name, 'broker-launch.json'), { throwIfNoEntry: false })?.isFile());
56
+ launchSnapshotFile(join(root, entry.name)) !== undefined);
49
57
  return ids.length === 1 ? ids[0].name : undefined;
50
58
  }
51
59
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.415",
3
+ "version": "0.3.416",
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",