@arcforge/core 2.0.170 → 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 +12 -12
- package/src/Axon.ts +21 -1
- package/src/tools/tools.ts +57 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.172",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
"test:coverage": "bun test --coverage"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@arcforge/air": "2.0.
|
|
18
|
-
"@arcforge/capsule": "2.0.
|
|
19
|
-
"@arcforge/cloud": "2.0.
|
|
20
|
-
"@arcforge/cognet": "2.0.
|
|
21
|
-
"@arcforge/engines": "2.0.
|
|
22
|
-
"@arcforge/err": "2.0.
|
|
23
|
-
"@arcforge/kernel": "2.0.
|
|
24
|
-
"@arcforge/link": "2.0.
|
|
25
|
-
"@arcforge/session": "2.0.
|
|
26
|
-
"@arcforge/types": "2.0.
|
|
27
|
-
"@arcforge/vstr": "2.0.
|
|
17
|
+
"@arcforge/air": "2.0.172",
|
|
18
|
+
"@arcforge/capsule": "2.0.172",
|
|
19
|
+
"@arcforge/cloud": "2.0.172",
|
|
20
|
+
"@arcforge/cognet": "2.0.172",
|
|
21
|
+
"@arcforge/engines": "2.0.172",
|
|
22
|
+
"@arcforge/err": "2.0.172",
|
|
23
|
+
"@arcforge/kernel": "2.0.172",
|
|
24
|
+
"@arcforge/link": "2.0.172",
|
|
25
|
+
"@arcforge/session": "2.0.172",
|
|
26
|
+
"@arcforge/types": "2.0.172",
|
|
27
|
+
"@arcforge/vstr": "2.0.172",
|
|
28
28
|
"crossws": "^0.3.5",
|
|
29
29
|
"h3": "^1.13.0",
|
|
30
30
|
"hookable": "^5.5.3",
|
package/src/Axon.ts
CHANGED
|
@@ -200,7 +200,27 @@ export async function Axon(opts?: AxonOpts) {
|
|
|
200
200
|
// to coincide with confinement. Anything booted without it loaded
|
|
201
201
|
// ZERO tools, so a script run that way failed with "fs is not
|
|
202
202
|
// defined" for a module its config plainly installed.
|
|
203
|
-
const tools = Tools({
|
|
203
|
+
const tools = Tools({
|
|
204
|
+
mediation: kernel.mediation,
|
|
205
|
+
/**
|
|
206
|
+
* A name two tools both export, reported on the durable record.
|
|
207
|
+
*
|
|
208
|
+
* Flat placement means the second one wins, and silence is how
|
|
209
|
+
* the previous behaviour hid: a capability the author declared
|
|
210
|
+
* was simply not there, with nothing anywhere saying which tool
|
|
211
|
+
* had taken the name. `build:warning` is the family for exactly
|
|
212
|
+
* this — its own doc names "a tool shadowed by one of the same
|
|
213
|
+
* name" — and it is recoverable rather than fatal, because an
|
|
214
|
+
* agent with one shadowed export still serves everything else.
|
|
215
|
+
*/
|
|
216
|
+
onClash: ({ name, previous, next }) => {
|
|
217
|
+
void session.commit("build:warning", {
|
|
218
|
+
domain: "tools",
|
|
219
|
+
message: `\`${name}\` is exported by both \`${previous}\` and \`${next}\` — \`${next}\` wins.`
|
|
220
|
+
+ " Rename one export, or call the shadowed one through axon.tools.",
|
|
221
|
+
})
|
|
222
|
+
},
|
|
223
|
+
})
|
|
204
224
|
await tools.install(blueprint.tools)
|
|
205
225
|
|
|
206
226
|
// user facing handle
|
package/src/tools/tools.ts
CHANGED
|
@@ -9,6 +9,18 @@ import type { MediateOpts } from "./mediate"
|
|
|
9
9
|
|
|
10
10
|
type ToolsOpts = {
|
|
11
11
|
mediation: MediateOpts
|
|
12
|
+
/**
|
|
13
|
+
* Two tools exporting the same name into one scope.
|
|
14
|
+
*
|
|
15
|
+
* Reported rather than resolved: which one the author meant is not
|
|
16
|
+
* something the runtime can know, and quietly renaming one — which is what
|
|
17
|
+
* wrapping a module's tools under their own name amounted to — changes how
|
|
18
|
+
* it is called for a reason the author never chose.
|
|
19
|
+
*
|
|
20
|
+
* Optional because the placement is correct either way; this only decides
|
|
21
|
+
* whether anyone is told. A surface that can warn supplies one.
|
|
22
|
+
*/
|
|
23
|
+
onClash?(input: { name: string; previous: string; next: string }): void
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
/**
|
|
@@ -114,17 +126,52 @@ export function Tools(opts: ToolsOpts) {
|
|
|
114
126
|
*/
|
|
115
127
|
globals(): Record<string, unknown> {
|
|
116
128
|
const globals: Record<string, unknown> = {}
|
|
129
|
+
/** Which tool placed each name, so a clash can name both sides. */
|
|
130
|
+
const placedBy = new Map<string, string>()
|
|
131
|
+
|
|
117
132
|
for (const tool of loaded.values()) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
/**
|
|
134
|
+
* EVERY tool is placed flat, whatever its origin.
|
|
135
|
+
*
|
|
136
|
+
* Placement used to follow origin: an agent's own tools flat,
|
|
137
|
+
* an installed module's wrapped under its own name. Two things
|
|
138
|
+
* were wrong with that.
|
|
139
|
+
*
|
|
140
|
+
* It DISAGREED WITH THE DECLARATIONS in practice. The generated
|
|
141
|
+
* `.d.ts` and the model's `<scope>` both spelled a module tool
|
|
142
|
+
* `subagents.subagents.request()`, and the runtime here did not
|
|
143
|
+
* always agree — so a model read its own types, called exactly
|
|
144
|
+
* what they promised, and got `undefined is not an object`.
|
|
145
|
+
* That is the one failure this whole surface exists to prevent.
|
|
146
|
+
*
|
|
147
|
+
* And it made placement CONDITIONAL on provenance, which is not
|
|
148
|
+
* the author's concern. `import { subagents }` should be
|
|
149
|
+
* `subagents.request()` whether that came from src/tools or a
|
|
150
|
+
* package — otherwise moving a tool into a module silently
|
|
151
|
+
* rewrites every call site, for a reason nobody chose.
|
|
152
|
+
*
|
|
153
|
+
* A module exporting `const fs = {…}` is already its own
|
|
154
|
+
* namespace; it needs no help being one. What the wrap actually
|
|
155
|
+
* guarded was a NAME CLASH between two tools, and that is the
|
|
156
|
+
* author's to resolve — so it is reported rather than silently
|
|
157
|
+
* worked around by changing how one of them is addressed.
|
|
158
|
+
*/
|
|
159
|
+
for (const [name, value] of Object.entries(tool.values)) {
|
|
160
|
+
const previous = placedBy.get(name)
|
|
161
|
+
if (previous !== undefined && previous !== tool.namespace) {
|
|
162
|
+
/**
|
|
163
|
+
* Last write wins, and SAYS SO.
|
|
164
|
+
*
|
|
165
|
+
* Refusing would brick an agent over a collision it can
|
|
166
|
+
* still mostly serve, and silence is how the previous
|
|
167
|
+
* behaviour hid: `Object.assign` overwrote and nothing
|
|
168
|
+
* anywhere recorded that a capability had been shadowed.
|
|
169
|
+
*/
|
|
170
|
+
opts.onClash?.({ name, previous, next: tool.namespace })
|
|
171
|
+
}
|
|
172
|
+
globals[name] = value
|
|
173
|
+
placedBy.set(name, tool.namespace)
|
|
174
|
+
}
|
|
128
175
|
}
|
|
129
176
|
return globals
|
|
130
177
|
},
|