@arcforge/kernel 2.0.169 → 2.0.171

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/kernel",
3
- "version": "2.0.169",
3
+ "version": "2.0.171",
4
4
  "description": "The Axon kernel — ring 0. Owns resources and execution, enforces policy, and is the only constructor of the unprivileged capsule.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -15,13 +15,13 @@
15
15
  "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"
16
16
  },
17
17
  "dependencies": {
18
- "@arcforge/air": "2.0.169",
19
- "@arcforge/engines": "2.0.169",
20
- "@arcforge/err": "2.0.169",
21
- "@arcforge/session": "2.0.169",
22
- "@arcforge/types": "2.0.169",
23
- "@arcforge/cloud": "2.0.169",
24
- "@arcforge/capsule": "2.0.169"
18
+ "@arcforge/air": "2.0.171",
19
+ "@arcforge/engines": "2.0.171",
20
+ "@arcforge/err": "2.0.171",
21
+ "@arcforge/session": "2.0.171",
22
+ "@arcforge/types": "2.0.171",
23
+ "@arcforge/cloud": "2.0.171",
24
+ "@arcforge/capsule": "2.0.171"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/bun": "latest",
package/src/mediation.ts CHANGED
@@ -140,14 +140,30 @@ export function Mediation(opts: MediationOpts) {
140
140
  // decision event alone says WHAT was answered; only this says the call
141
141
  // did not happen, which is the fact a surface renders.
142
142
  if (!allow) {
143
+ /**
144
+ * "Nobody was there to ask" is a different fact from "a person said
145
+ * no", and only one of them has a fix.
146
+ *
147
+ * A headless run — a script, CI, the subagent module shelling out —
148
+ * has no decider, so every escalation dies. Reporting that as a
149
+ * refusal sends the reader looking for a decision nobody made. It
150
+ * names the grant instead, the same way `withheldMessage` does for
151
+ * an env var: deny-by-default is only adoptable when its denials
152
+ * say which line to write.
153
+ */
143
154
  await opts.session.commit("process:policy:denied", {
144
155
  id: randomUUID(), commandId: commandId() || null, module: owner, fn, args,
145
- rule: "escalation-denied",
156
+ rule: headless() ? "escalation-headless" : "escalation-denied",
146
157
  }, span())
147
158
  }
148
159
  return allow
149
160
  }
150
161
 
162
+ /** True when this run has nobody to ask — a script, CI, a headless invocation. */
163
+ function headless(): boolean {
164
+ return !opts.escalate
165
+ }
166
+
151
167
  function decide(id: string, fn: string, args: unknown[]): Promise<boolean> {
152
168
  // No decider attached (a script, a headless run) means nobody to ask,
153
169
  // and an unanswered escalation must never read as permission.
package/src/scope.ts CHANGED
@@ -39,11 +39,22 @@ export function toScopeModule(tool: AxonTool): AxonScopeModule {
39
39
  ...(tool.description ? { description: tool.description } : {}),
40
40
  members: tool.fns,
41
41
  ...(tool.ambientTypes ? { ambientTypes: tool.ambientTypes } : {}),
42
- // ORIGIN is the placement decision, and this is the one place it is
43
- // made. Dropping it here is what let both scope renderers declare
44
- // every tool flat while the runtime installed a module's under its
45
- // namespace — see AxonScopeModule.flat.
46
- flat: tool.origin !== "module",
42
+ /**
43
+ * There is NO placement decision here any more.
44
+ *
45
+ * `flat` used to be derived from origin, and three surfaces spelled it
46
+ * — the model's `<scope>`, the editor's `.d.ts`, and the runtime's
47
+ * actual globals. Carrying the decision was meant to stop them
48
+ * disagreeing; it could not, because it is one more thing to keep in
49
+ * step and it drifted anyway: the renderers wrapped a module's tools
50
+ * in a namespace the runtime did not install, so a model called what
51
+ * its own scope promised and found nothing there.
52
+ *
53
+ * Every tool is now placed flat, unconditionally. A tool exporting an
54
+ * object is already its own namespace, and a name two tools both claim
55
+ * is reported (Tools.onClash) rather than resolved by silently
56
+ * renaming one — which is the author's call, not the runtime's.
57
+ */
47
58
  }
48
59
  }
49
60