@arcforge/platform 2.0.172 → 2.0.173
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/platform",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.173",
|
|
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.173",
|
|
48
|
+
"@arcforge/engines": "2.0.173",
|
|
49
|
+
"@arcforge/err": "2.0.173",
|
|
50
|
+
"@arcforge/types": "2.0.173",
|
|
51
|
+
"@arcforge/cloud": "2.0.173",
|
|
52
|
+
"@arcforge/capsule": "2.0.173",
|
|
53
|
+
"@arcforge/core": "2.0.173",
|
|
54
|
+
"@arcforge/vstr": "2.0.173",
|
|
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.173"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@arcforge/air": "2.0.167",
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises"
|
|
2
|
+
import { join } from "node:path"
|
|
3
|
+
import { fsx } from "../../../utils/fs"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Remove the dead `engine:` field from an agent's config, in place.
|
|
7
|
+
*
|
|
8
|
+
* ── Why a migration and not a message ───────────────────────────────────────
|
|
9
|
+
*
|
|
10
|
+
* `engine:` was retired in favour of `providers:` (a source) and `model:` (a
|
|
11
|
+
* preference). For a window it warned and loaded anyway, which turned out to
|
|
12
|
+
* mean agents ran on a DIFFERENT, billed provider than their config named — so
|
|
13
|
+
* it is now fatal at load. That is the right severity and the wrong migration
|
|
14
|
+
* story: every agent already on disk carrying the field stops booting, and the
|
|
15
|
+
* largest population of those is zeno, which most users never created by hand
|
|
16
|
+
* and have no reason to know how to repair.
|
|
17
|
+
*
|
|
18
|
+
* So the field is removed FOR them, mechanically, on the next prepare.
|
|
19
|
+
*
|
|
20
|
+
* ── Why this is safe to do without asking ───────────────────────────────────
|
|
21
|
+
*
|
|
22
|
+
* The field was already being IGNORED. An agent carrying `engine: Codex()` was
|
|
23
|
+
* never running on Codex — it resolved against the profile pool like any agent
|
|
24
|
+
* declaring nothing. Deleting the line therefore changes no behaviour at all;
|
|
25
|
+
* it only makes the file honest about what was already happening. That is what
|
|
26
|
+
* separates this from "updating the user's agent", which this deliberately is
|
|
27
|
+
* not: nothing else in the config is read, moved, or rewritten.
|
|
28
|
+
*
|
|
29
|
+
* ── The one thing that is preserved ─────────────────────────────────────────
|
|
30
|
+
*
|
|
31
|
+
* `engine: Codex({ model: "gpt-5.6-terra" })` named a model. Dropping the line
|
|
32
|
+
* outright would leave the agent with no `model:` at all, and an agent that
|
|
33
|
+
* declares no preference lets the resolver pick from the pool — a different
|
|
34
|
+
* model than the config named. So a model found inside the old call is carried
|
|
35
|
+
* across into `model: "<route>:<model>"`, which is the field that expresses
|
|
36
|
+
* exactly that preference now.
|
|
37
|
+
*
|
|
38
|
+
* That is a behaviour CHANGE in the strict sense — the pin starts being
|
|
39
|
+
* honoured where before it was ignored — and it is the intended one: it makes
|
|
40
|
+
* the agent do what its author wrote, which is what they will expect when they
|
|
41
|
+
* next read the file. An engine call with no model has no preference to carry
|
|
42
|
+
* and simply loses the line.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/** What one config's migration did, for the report. */
|
|
46
|
+
export type EngineMigration = {
|
|
47
|
+
/** False when the config never declared `engine:` — the common case. */
|
|
48
|
+
migrated: boolean
|
|
49
|
+
/** The `route:model` preference carried across, when the old call named one. */
|
|
50
|
+
model?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The `engine: X(...)` declaration, as a span in the source.
|
|
55
|
+
*
|
|
56
|
+
* Located textually rather than by parsing: the file is the author's own
|
|
57
|
+
* TypeScript and everything around this one line has to survive byte-identical.
|
|
58
|
+
* The scan walks parentheses and braces so a nested option object
|
|
59
|
+
* (`engine: Codex({ model: "x", effort: "high" })`) is matched to its true end
|
|
60
|
+
* rather than to the first `)` it meets.
|
|
61
|
+
*/
|
|
62
|
+
type EngineSpan = {
|
|
63
|
+
/** Index of `engine` in the source. */
|
|
64
|
+
start: number
|
|
65
|
+
/** Index just past the declaration, including a trailing comma if present. */
|
|
66
|
+
end: number
|
|
67
|
+
/** The provider factory called — "Axon", "Codex", … */
|
|
68
|
+
factory: string
|
|
69
|
+
/** The `model:` string inside the call, when it named one. */
|
|
70
|
+
model?: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function locateEngine(source: string): EngineSpan | null {
|
|
74
|
+
// `engine` as a KEY: at a line start (after whitespace) and followed by a
|
|
75
|
+
// colon. Anchoring this way keeps the word from matching inside a comment
|
|
76
|
+
// or a string that merely mentions it.
|
|
77
|
+
const match = /^[ \t]*engine[ \t]*:[ \t]*/m.exec(source)
|
|
78
|
+
if (!match) return null
|
|
79
|
+
|
|
80
|
+
const start = match.index
|
|
81
|
+
let cursor = match.index + match[0].length
|
|
82
|
+
|
|
83
|
+
// The factory name — `Axon`, `Codex`, `Mock`, …
|
|
84
|
+
const name = /^([A-Za-z_$][\w$]*)/.exec(source.slice(cursor))
|
|
85
|
+
if (!name) return null
|
|
86
|
+
const factory = name[1]!
|
|
87
|
+
cursor += name[0].length
|
|
88
|
+
|
|
89
|
+
// Walk to the matching close paren, tracking nesting and strings so a
|
|
90
|
+
// brace or paren inside an option value cannot end the scan early.
|
|
91
|
+
while (cursor < source.length && source[cursor] !== "(") cursor++
|
|
92
|
+
if (source[cursor] !== "(") return null
|
|
93
|
+
|
|
94
|
+
let depth = 0
|
|
95
|
+
let quote: string | null = null
|
|
96
|
+
let end = -1
|
|
97
|
+
for (let i = cursor; i < source.length; i++) {
|
|
98
|
+
const char = source[i]!
|
|
99
|
+
if (quote) {
|
|
100
|
+
if (char === "\\") i++
|
|
101
|
+
else if (char === quote) quote = null
|
|
102
|
+
continue
|
|
103
|
+
}
|
|
104
|
+
if (char === '"' || char === "'" || char === "`") { quote = char; continue }
|
|
105
|
+
if (char === "(" || char === "{" || char === "[") depth++
|
|
106
|
+
else if (char === ")" || char === "}" || char === "]") {
|
|
107
|
+
depth--
|
|
108
|
+
if (depth === 0) { end = i + 1; break }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (end === -1) return null
|
|
112
|
+
|
|
113
|
+
const call = source.slice(cursor, end)
|
|
114
|
+
const model = /\bmodel[ \t]*:[ \t]*["']([^"']+)["']/.exec(call)?.[1]
|
|
115
|
+
|
|
116
|
+
// Take the trailing comma and the rest of the line with it, so removing a
|
|
117
|
+
// whole declaration does not leave a dangling `,` or a blank line where a
|
|
118
|
+
// field used to be.
|
|
119
|
+
let after = end
|
|
120
|
+
if (source[after] === ",") after++
|
|
121
|
+
while (after < source.length && (source[after] === " " || source[after] === "\t")) after++
|
|
122
|
+
if (source[after] === "\n") after++
|
|
123
|
+
|
|
124
|
+
return { start, end: after, factory, ...(model ? { model } : {}) }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The route name a provider factory maps to in a `model:` string.
|
|
129
|
+
*
|
|
130
|
+
* `model:` is `"<route>:<id>"` and the route is the provider's own name
|
|
131
|
+
* lowercased — the same string `providers:` uses. Only the factories that
|
|
132
|
+
* could carry a model are listed: `Mock` has no catalogue to pin against, so
|
|
133
|
+
* a mock engine loses its line and nothing else.
|
|
134
|
+
*/
|
|
135
|
+
const ROUTES: Record<string, string> = {
|
|
136
|
+
Axon: "axon",
|
|
137
|
+
Codex: "codex",
|
|
138
|
+
OpenRouter: "openrouter",
|
|
139
|
+
Ollama: "ollama",
|
|
140
|
+
HuggingFace: "huggingface",
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Migrate one agent config, if it declares `engine:`.
|
|
145
|
+
*
|
|
146
|
+
* Idempotent and cheap: a config without the field is read once and left
|
|
147
|
+
* alone, which is every config written after the field was retired.
|
|
148
|
+
*/
|
|
149
|
+
export async function migrateEngineField(root: string): Promise<EngineMigration> {
|
|
150
|
+
const path = join(root, "axon.config.ts")
|
|
151
|
+
if (!fsx.exists(path)) return { migrated: false }
|
|
152
|
+
|
|
153
|
+
const source = await readFile(path, "utf-8").catch(() => "")
|
|
154
|
+
const span = locateEngine(source)
|
|
155
|
+
if (!span) return { migrated: false }
|
|
156
|
+
|
|
157
|
+
const route = ROUTES[span.factory]
|
|
158
|
+
const model = span.model && route ? `${route}:${span.model}` : undefined
|
|
159
|
+
|
|
160
|
+
// The preference takes the removed declaration's place, so the field lands
|
|
161
|
+
// where its author already had it rather than at the end of the object.
|
|
162
|
+
// Its indentation is the line's own — copied, never assumed.
|
|
163
|
+
const indent = /^[ \t]*/.exec(source.slice(span.start))?.[0] ?? " "
|
|
164
|
+
const replacement = model ? `${indent}model: "${model}",\n` : ""
|
|
165
|
+
|
|
166
|
+
// A config that already declares `model:` keeps it: the author wrote that
|
|
167
|
+
// one deliberately and it is the field the runtime actually reads, so it
|
|
168
|
+
// outranks anything recovered from the dead call.
|
|
169
|
+
const declaresModel = /^[ \t]*model[ \t]*:/m.test(
|
|
170
|
+
source.slice(0, span.start) + source.slice(span.end),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const next = source.slice(0, span.start)
|
|
174
|
+
+ (declaresModel ? "" : replacement)
|
|
175
|
+
+ source.slice(span.end)
|
|
176
|
+
|
|
177
|
+
await writeFile(path, next, "utf-8")
|
|
178
|
+
return { migrated: true, ...(model && !declaresModel ? { model } : {}) }
|
|
179
|
+
}
|
|
@@ -16,6 +16,7 @@ import type { LinkResult, SourceModulesT } from "./modules"
|
|
|
16
16
|
import type { TypegenResult, TypegenT } from "./typegen"
|
|
17
17
|
import { fsx } from "../../utils/fs"
|
|
18
18
|
import { migrateFrame } from "../frame"
|
|
19
|
+
import { migrateEngineField } from "./manifest/engine-migrate"
|
|
19
20
|
import { KINDS, type ProjectKind } from "./kinds"
|
|
20
21
|
|
|
21
22
|
export type PrepareResult = {
|
|
@@ -276,6 +277,26 @@ export function Prepare(opts: PrepareOpts) {
|
|
|
276
277
|
})
|
|
277
278
|
}
|
|
278
279
|
|
|
280
|
+
// Beside the frame migration and for the same reason: an agent already
|
|
281
|
+
// on disk carries a field the runtime now REFUSES, and the user did not
|
|
282
|
+
// put it there — zeno ships to everyone and most people never wrote its
|
|
283
|
+
// config. Removing it here means the repair happens on the next launch
|
|
284
|
+
// with nobody typing anything.
|
|
285
|
+
//
|
|
286
|
+
// Ahead of every read of the config below, which is the whole ordering
|
|
287
|
+
// requirement: `engine:` is fatal at load, so a migration running after
|
|
288
|
+
// the load would never get the chance.
|
|
289
|
+
if (kind === "agent") {
|
|
290
|
+
const engine = await migrateEngineField(root)
|
|
291
|
+
if (engine.migrated) {
|
|
292
|
+
report?.("build:config:migrated", {
|
|
293
|
+
root: root,
|
|
294
|
+
field: "engine",
|
|
295
|
+
...(engine.model ? { model: engine.model } : {}),
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
279
300
|
// A prompt package is text: it declares no dependencies, so there is
|
|
280
301
|
// nothing to install and its frame is self-contained. It still gets
|
|
281
302
|
// one — definePrompt() is a global, and prompt.config.ts calls it.
|