@arcforge/platform 2.0.169 → 2.0.170
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/package.json +10 -10
- package/src/build/runtime/instances.ts +52 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/platform",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.170",
|
|
4
4
|
"description": "The Axon developer platform — headless project discovery, blueprint scanning, typegen, agent lifecycle, registry, benches and tests. Shared by the CLI/TUI and the Fleet extension.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
"deploy": "echo \"This package is published ONLY by apps/tui/scripts/release.ts, which pins workspace:* deps to concrete versions first. Publishing it directly ships an unresolvable dependency.\" && exit 1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@arcforge/session": "2.0.
|
|
48
|
-
"@arcforge/engines": "2.0.
|
|
49
|
-
"@arcforge/err": "2.0.
|
|
50
|
-
"@arcforge/types": "2.0.
|
|
51
|
-
"@arcforge/cloud": "2.0.
|
|
52
|
-
"@arcforge/capsule": "2.0.
|
|
53
|
-
"@arcforge/core": "2.0.
|
|
54
|
-
"@arcforge/vstr": "2.0.
|
|
47
|
+
"@arcforge/session": "2.0.170",
|
|
48
|
+
"@arcforge/engines": "2.0.170",
|
|
49
|
+
"@arcforge/err": "2.0.170",
|
|
50
|
+
"@arcforge/types": "2.0.170",
|
|
51
|
+
"@arcforge/cloud": "2.0.170",
|
|
52
|
+
"@arcforge/capsule": "2.0.170",
|
|
53
|
+
"@arcforge/core": "2.0.170",
|
|
54
|
+
"@arcforge/vstr": "2.0.170",
|
|
55
55
|
"fft.js": "^4.0.4",
|
|
56
56
|
"h3": "^1.15.11",
|
|
57
57
|
"semver": "^7.7.4",
|
|
58
58
|
"sharp": "^0.35.3",
|
|
59
59
|
"typescript": "5.9.2",
|
|
60
|
-
"@arcforge/link": "2.0.
|
|
60
|
+
"@arcforge/link": "2.0.170"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@arcforge/air": "2.0.167",
|
|
@@ -74,6 +74,22 @@ export type RemoteTarget = {
|
|
|
74
74
|
* this against the daemon's own return would invert it.
|
|
75
75
|
*/
|
|
76
76
|
export type AgentSupervisor = {
|
|
77
|
+
/**
|
|
78
|
+
* What the supervisor knows about an agent it did not necessarily spawn
|
|
79
|
+
* for THIS process — its place in the ownership graph.
|
|
80
|
+
*
|
|
81
|
+
* Needed because a parent is not always a local instance. Agent code that
|
|
82
|
+
* shells out (`axon @x -p "…" --parent <id>`) runs in its own process, so
|
|
83
|
+
* the CLI serving that spawn has an empty registry and cannot see the
|
|
84
|
+
* agent that asked for it. The daemon can: it is the only thing that sees
|
|
85
|
+
* every spawn, which is exactly why it writes the records.
|
|
86
|
+
*
|
|
87
|
+
* Null for an id the supervisor has never heard of — a caller passing a
|
|
88
|
+
* stale or invented parent gets a refusal rather than a silently rooted
|
|
89
|
+
* child.
|
|
90
|
+
*/
|
|
91
|
+
lineage?(sessionId: string): { rootSessionId: string; depth: number } | null
|
|
92
|
+
|
|
77
93
|
supervise(input: {
|
|
78
94
|
sessionId: string
|
|
79
95
|
blueprint: unknown
|
|
@@ -274,11 +290,36 @@ export function Instances(opts: InstancesOpts) {
|
|
|
274
290
|
throw err("SESSION_ALREADY_RUNNING", { context: { sessionId: spawnOpts.session } })
|
|
275
291
|
}
|
|
276
292
|
|
|
277
|
-
|
|
278
|
-
|
|
293
|
+
/**
|
|
294
|
+
* The parent, which may not be an instance THIS process holds.
|
|
295
|
+
*
|
|
296
|
+
* A subagent spawned in-heap has its parent right here. One spawned by
|
|
297
|
+
* agent code shelling out to the CLI does not: that runs in its own
|
|
298
|
+
* process, whose registry is empty, and the parent is alive in a
|
|
299
|
+
* different one entirely.
|
|
300
|
+
*
|
|
301
|
+
* So the local registry is asked first and the SUPERVISOR second. The
|
|
302
|
+
* daemon sees every spawn — it is what writes the records the tree is
|
|
303
|
+
* read from — and can answer for an agent this process never met.
|
|
304
|
+
* Without the fallback, `--parent` could only ever name something in
|
|
305
|
+
* the same heap, which is precisely the case that never happens.
|
|
306
|
+
*/
|
|
307
|
+
const local = spawnOpts.parentSessionId ? instances.get(spawnOpts.parentSessionId) : undefined
|
|
308
|
+
const remote = !local && spawnOpts.parentSessionId
|
|
309
|
+
? opts.daemon?.lineage?.(spawnOpts.parentSessionId) ?? null
|
|
310
|
+
: null
|
|
311
|
+
|
|
312
|
+
if (spawnOpts.parentSessionId && !local && !remote) {
|
|
279
313
|
throw err("PARENT_INSTANCE_NOT_RUNNING", { context: { sessionId: spawnOpts.parentSessionId } })
|
|
280
314
|
}
|
|
281
315
|
|
|
316
|
+
/** The parentage this spawn inherits, from whichever source knew it. */
|
|
317
|
+
const lineage = local
|
|
318
|
+
? { parentSessionId: local.sessionId, rootSessionId: local.rootSessionId, depth: local.depth + 1 }
|
|
319
|
+
: remote
|
|
320
|
+
? { parentSessionId: spawnOpts.parentSessionId!, rootSessionId: remote.rootSessionId, depth: remote.depth + 1 }
|
|
321
|
+
: null
|
|
322
|
+
|
|
282
323
|
const project = await resolve(target)
|
|
283
324
|
// Read at spawn time, not at construction: the TUI starts serving after
|
|
284
325
|
// Platform() exists, so an instance booted later must still get the port.
|
|
@@ -340,9 +381,9 @@ export function Instances(opts: InstancesOpts) {
|
|
|
340
381
|
dataRoot: join(project.root, ".agent/data"),
|
|
341
382
|
// The ownership graph travels with the spawn: the daemon
|
|
342
383
|
// writes the record, so it needs what the record says.
|
|
343
|
-
parentSessionId:
|
|
344
|
-
rootSessionId:
|
|
345
|
-
depth:
|
|
384
|
+
parentSessionId: lineage?.parentSessionId ?? null,
|
|
385
|
+
rootSessionId: lineage?.rootSessionId ?? sessionId,
|
|
386
|
+
depth: lineage?.depth ?? 0,
|
|
346
387
|
...(spawnOpts.job ? { job: spawnOpts.job } : {}),
|
|
347
388
|
...(control ? { control: control } : {}),
|
|
348
389
|
})
|
|
@@ -436,9 +477,9 @@ export function Instances(opts: InstancesOpts) {
|
|
|
436
477
|
),
|
|
437
478
|
}
|
|
438
479
|
: {}),
|
|
439
|
-
parentSessionId:
|
|
440
|
-
...(
|
|
441
|
-
depth:
|
|
480
|
+
parentSessionId: lineage?.parentSessionId ?? null,
|
|
481
|
+
...(lineage ? { rootSessionId: lineage.rootSessionId } : {}),
|
|
482
|
+
depth: lineage?.depth ?? 0,
|
|
442
483
|
...(spawnOpts?.session ? { session: spawnOpts.session } : {}),
|
|
443
484
|
...(spawnOpts?.onProgress ? { onProgress: spawnOpts.onProgress } : {}),
|
|
444
485
|
...(spawnOpts?.onTiming ? { onTiming: spawnOpts.onTiming } : {}),
|
|
@@ -448,9 +489,9 @@ export function Instances(opts: InstancesOpts) {
|
|
|
448
489
|
const sessionId = agent.sessionId
|
|
449
490
|
const instance: InstanceT = {
|
|
450
491
|
sessionId: sessionId,
|
|
451
|
-
parentSessionId:
|
|
452
|
-
rootSessionId:
|
|
453
|
-
depth:
|
|
492
|
+
parentSessionId: lineage?.parentSessionId ?? null,
|
|
493
|
+
rootSessionId: lineage?.rootSessionId ?? sessionId,
|
|
494
|
+
depth: lineage?.depth ?? 0,
|
|
454
495
|
// Every spawn takes the confined path — `Agent()` calls
|
|
455
496
|
// bootLinked unconditionally — so there is one kind. The "local"
|
|
456
497
|
// branch was for an embedder building Agent() without a `confined`
|