@arcforge/platform 2.0.171 → 2.0.172
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/blueprint/blueprint.ts +17 -8
- package/src/build/runtime/requests.ts +19 -29
- package/src/link/agent-main.ts +37 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/platform",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.172",
|
|
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.172",
|
|
48
|
+
"@arcforge/engines": "2.0.172",
|
|
49
|
+
"@arcforge/err": "2.0.172",
|
|
50
|
+
"@arcforge/types": "2.0.172",
|
|
51
|
+
"@arcforge/cloud": "2.0.172",
|
|
52
|
+
"@arcforge/capsule": "2.0.172",
|
|
53
|
+
"@arcforge/core": "2.0.172",
|
|
54
|
+
"@arcforge/vstr": "2.0.172",
|
|
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.172"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@arcforge/air": "2.0.167",
|
|
@@ -112,15 +112,24 @@ export function Blueprint(opts: BlueprintOpts) {
|
|
|
112
112
|
// Authored truth — a broken config is no agent. Throws.
|
|
113
113
|
const config = await Config(root)
|
|
114
114
|
|
|
115
|
-
// `engine:` is
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
// the
|
|
115
|
+
// `engine:` is READ BY NOTHING, and now REFUSED.
|
|
116
|
+
//
|
|
117
|
+
// It warned for a deprecation window on the reasoning that an
|
|
118
|
+
// agent carrying it already booted on the profile pool, so
|
|
119
|
+
// failing would break working agents over a field that was being
|
|
120
|
+
// ignored anyway. That reasoning had the cost backwards. An agent
|
|
121
|
+
// whose config names a mock engine and silently resolves against
|
|
122
|
+
// the profile pool does not degrade — it runs on a DIFFERENT,
|
|
123
|
+
// billed provider while claiming otherwise, and a warning nobody
|
|
124
|
+
// reads is not a signal. Nine test fixtures declared `engine:
|
|
125
|
+
// Mock()` and spent real credits on every run for exactly as long
|
|
126
|
+
// as this was a warning.
|
|
127
|
+
//
|
|
128
|
+
// Fatal is the honest severity: the config asks for inference
|
|
129
|
+
// this runtime will not provide, and refusing at load is the only
|
|
130
|
+
// point where the author still knows why.
|
|
121
131
|
if ("engine" in config.value && config.value.engine !== undefined) {
|
|
122
|
-
|
|
123
|
-
warnings.push({ domain: "config", error: cause.message, cause })
|
|
132
|
+
throw err("CONFIG_ENGINE_DEPRECATED", { context: { root } })
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
// Before the scan, never after: Cognet.read() below reads exactly
|
|
@@ -3,17 +3,13 @@ import type { AxonRequestInput, AxonResult } from "@arcforge/types"
|
|
|
3
3
|
import type { InstancesT } from "./instances"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
6
|
+
* The in-process door for agent-initiated spawning.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* agent's fan-out, descendants caps the whole tree beneath one root.
|
|
8
|
+
* The LIMITS on it (depth, fan-out, descendants) are enforced by the daemon —
|
|
9
|
+
* see its `checkSubagentLimits`. They lived here while this was the only route
|
|
10
|
+
* an agent could spawn through; it no longer is, and a rule implemented per
|
|
11
|
+
* route is a rule that eventually differs by route.
|
|
13
12
|
*/
|
|
14
|
-
const MAX_DEPTH = 4
|
|
15
|
-
const MAX_LIVE_CHILDREN = 4
|
|
16
|
-
const MAX_LIVE_DESCENDANTS = 12
|
|
17
13
|
|
|
18
14
|
type RequestsOpts = {
|
|
19
15
|
instances: InstancesT
|
|
@@ -51,29 +47,23 @@ export function Requests(opts: RequestsOpts) {
|
|
|
51
47
|
return { prompt: prompt }
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the parent. The LIMITS are the daemon's.
|
|
52
|
+
*
|
|
53
|
+
* Depth, fan-out and descendant caps used to be enforced here, and this
|
|
54
|
+
* was described as "the ONLY caller-initiated spawn path with limits
|
|
55
|
+
* attached". That stopped being true: an agent shelling out to
|
|
56
|
+
* `axon <ref> --parent <id>` spawns through the daemon and never touches
|
|
57
|
+
* this function, so the limits guarded one of two routes.
|
|
58
|
+
*
|
|
59
|
+
* They live in the daemon now — the one place every spawn passes through,
|
|
60
|
+
* and the only one that sees the whole ownership graph. Two
|
|
61
|
+
* implementations of one rule is how they come to disagree about what a
|
|
62
|
+
* limit means, which is worse than either answer.
|
|
63
|
+
*/
|
|
55
64
|
function checkLimits(parentSessionId: string) {
|
|
56
65
|
const parent = instances.get(parentSessionId)
|
|
57
66
|
if (!parent) throw err("PARENT_INSTANCE_NOT_RUNNING", { context: { sessionId: parentSessionId } })
|
|
58
|
-
|
|
59
|
-
if (parent.depth >= MAX_DEPTH) {
|
|
60
|
-
throw err("SUBAGENT_DEPTH_EXCEEDED", {
|
|
61
|
-
detail: `maximum depth is ${MAX_DEPTH}`,
|
|
62
|
-
context: { sessionId: parent.sessionId, depth: parent.depth, limit: MAX_DEPTH },
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
if (instances.children(parent.sessionId).length >= MAX_LIVE_CHILDREN) {
|
|
66
|
-
throw err("SUBAGENT_CHILD_LIMIT_EXCEEDED", {
|
|
67
|
-
detail: `maximum live children is ${MAX_LIVE_CHILDREN}`,
|
|
68
|
-
context: { sessionId: parent.sessionId, limit: MAX_LIVE_CHILDREN },
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
if (instances.descendants(parent.rootSessionId).length >= MAX_LIVE_DESCENDANTS) {
|
|
72
|
-
throw err("SUBAGENT_DESCENDANT_LIMIT_EXCEEDED", {
|
|
73
|
-
detail: `maximum live descendants is ${MAX_LIVE_DESCENDANTS}`,
|
|
74
|
-
context: { rootSessionId: parent.rootSessionId, limit: MAX_LIVE_DESCENDANTS },
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
67
|
return parent
|
|
78
68
|
}
|
|
79
69
|
|
package/src/link/agent-main.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { err } from "@arcforge/err"
|
|
|
24
24
|
import { readFileSync } from "node:fs"
|
|
25
25
|
import { Axon, AxonBus } from "@arcforge/core"
|
|
26
26
|
import { Routes, Middleware, Plugins } from "../build/blueprint"
|
|
27
|
-
import type { AxonMiddleware, AxonPartialBlueprint, AxonPlugin, AxonRoute } from "@arcforge/types"
|
|
27
|
+
import type { AxonCommitContext, AxonMiddleware, AxonPartialBlueprint, AxonPlugin, AxonRoute } from "@arcforge/types"
|
|
28
28
|
import {
|
|
29
29
|
AGENT_BLUEPRINT_ENV,
|
|
30
30
|
AgentRuntime,
|
|
@@ -170,8 +170,8 @@ export async function main(): Promise<void> {
|
|
|
170
170
|
* which is why the TUI's header came up blank: the facts it renders had
|
|
171
171
|
* already gone past.
|
|
172
172
|
*/
|
|
173
|
-
const pending: Array<{ type: string; data: unknown }> = []
|
|
174
|
-
let forward = (type: string, data: unknown) => { pending.push({ type, data }) }
|
|
173
|
+
const pending: Array<{ type: string; data: unknown; ctx?: AxonCommitContext }> = []
|
|
174
|
+
let forward = (type: string, data: unknown, ctx?: AxonCommitContext) => { pending.push({ type, data, ctx }) }
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* The bus, built HERE and handed to Axon() — so this can subscribe
|
|
@@ -240,6 +240,24 @@ export async function main(): Promise<void> {
|
|
|
240
240
|
* shape is known: the supervisor receives (type, data) and cannot tell an
|
|
241
241
|
* envelope from a payload that happens to have a `data` field of its own.
|
|
242
242
|
*/
|
|
243
|
+
/**
|
|
244
|
+
* The correlation half of an envelope's context, for the wire.
|
|
245
|
+
*
|
|
246
|
+
* `agentId` and `sessionId` are the SUPERVISOR's to stamp — it owns the
|
|
247
|
+
* session and knows both — so sending them back would be the child
|
|
248
|
+
* asserting its own identity to the thing that assigned it. Only the ids
|
|
249
|
+
* the child actually mints travel: runId and spanId.
|
|
250
|
+
*
|
|
251
|
+
* Returns undefined when neither is present, so an event with no
|
|
252
|
+
* correlation commits with no context rather than an empty object.
|
|
253
|
+
*/
|
|
254
|
+
function contextOf(context: AxonCommitContext | undefined): AxonCommitContext | undefined {
|
|
255
|
+
if (!context) return undefined
|
|
256
|
+
const { runId, spanId } = context
|
|
257
|
+
if (!runId && !spanId) return undefined
|
|
258
|
+
return { ...(runId ? { runId } : {}), ...(spanId ? { spanId } : {}) }
|
|
259
|
+
}
|
|
260
|
+
|
|
243
261
|
function announce(type: string, payload: unknown): void {
|
|
244
262
|
/**
|
|
245
263
|
* Two shapes travel this bus, and the difference is not cosmetic.
|
|
@@ -261,9 +279,21 @@ export async function main(): Promise<void> {
|
|
|
261
279
|
* payload with its own `data` field is a shape nobody should have to
|
|
262
280
|
* reason about at this seam.
|
|
263
281
|
*/
|
|
264
|
-
const carrier = payload as {
|
|
282
|
+
const carrier = payload as {
|
|
283
|
+
time?: unknown
|
|
284
|
+
data?: unknown
|
|
285
|
+
type?: unknown
|
|
286
|
+
context?: AxonCommitContext
|
|
287
|
+
} | undefined
|
|
265
288
|
if (carrier && typeof carrier === "object" && "time" in carrier) {
|
|
266
|
-
|
|
289
|
+
// The context travels WITH the payload, as its own argument.
|
|
290
|
+
// Unwrapping the envelope and dropping `context` is what silently
|
|
291
|
+
// un-correlated every span once agents moved into subprocesses:
|
|
292
|
+
// the kernel mints one spanId per engine call, start/input/
|
|
293
|
+
// complete share it, and nothing else joins them. The supervisor
|
|
294
|
+
// re-envelopes on the far side, so this is the only place the ids
|
|
295
|
+
// can be handed over.
|
|
296
|
+
forward(type, carrier.data, contextOf(carrier.context))
|
|
267
297
|
return
|
|
268
298
|
}
|
|
269
299
|
// A raw event: strip the name it already travels under, keep the rest.
|
|
@@ -276,8 +306,8 @@ export async function main(): Promise<void> {
|
|
|
276
306
|
}
|
|
277
307
|
|
|
278
308
|
// Live from here — and everything boot produced goes first, in order.
|
|
279
|
-
forward = (type, data) => { supervisor.commit(type as never, data as never) }
|
|
280
|
-
for (const event of pending.splice(0)) forward(event.type, event.data)
|
|
309
|
+
forward = (type, data, ctx) => { supervisor.commit(type as never, data as never, ctx) }
|
|
310
|
+
for (const event of pending.splice(0)) forward(event.type, event.data, event.ctx)
|
|
281
311
|
|
|
282
312
|
/**
|
|
283
313
|
* The agent's last words.
|