@zihanw/pi-forge 0.5.9 → 0.5.10

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.
@@ -1,7 +1,7 @@
1
1
  import { formatStatusText } from "../status-text.js";
2
2
  import { basename } from "node:path";
3
3
  import { isValidToolName } from "../codecs/capability.js";
4
- import { applyResourcePolicy, hasResourcePolicy, hasToolSelectionPolicy } from "../policy.js";
4
+ import { applyResourcePolicy, hasResourcePolicy, hasToolSelectionPolicy, matchesAnyPattern } from "../policy.js";
5
5
  export function createToolPolicyRuntime(pi, getActiveStack) {
6
6
  let baseline;
7
7
  let lastApplied;
@@ -50,6 +50,21 @@ export function createToolPolicyRuntime(pi, getActiveStack) {
50
50
  result = result.filter((name) => !allRemoved.has(name));
51
51
  return result;
52
52
  }
53
+ // Authorization depends only on Forge's effective set, never retained host tools.
54
+ function toolAuthorization(toolName, effective, policy, tools = pi.getAllTools()) {
55
+ if (hasResourcePolicy(policy) && matchesAnyPattern(toolName, policy?.deny ?? []))
56
+ return "stack-deny";
57
+ if (capabilityPatches.some((patch) => patch.remove.includes(toolName)))
58
+ return "capability-remove";
59
+ if (effective.includes(toolName))
60
+ return "authorized";
61
+ const targetSource = registrationSource(tools.find((tool) => tool.name === toolName)?.sourceInfo);
62
+ if (targetSource && effective.some((parent) => toolName.startsWith(`${parent}__`)
63
+ && registrationSource(tools.find((tool) => tool.name === parent)?.sourceInfo) === targetSource)) {
64
+ return "authorized";
65
+ }
66
+ return "not-enabled";
67
+ }
53
68
  function sync(ctx) {
54
69
  const policy = getActiveStack()?.stack.tools;
55
70
  const selectionActive = hasToolSelectionPolicy(policy);
@@ -63,7 +78,20 @@ export function createToolPolicyRuntime(pi, getActiveStack) {
63
78
  baseline = reconcileToolPolicyBaseline(baseline, lastApplied, currentTools);
64
79
  const sourceTools = baseline ?? currentTools;
65
80
  baseline ??= [...sourceTools];
66
- const nextTools = computeEffectiveTools(policy, sourceTools);
81
+ const effective = computeEffectiveTools(policy, sourceTools);
82
+ const nextTools = [...effective];
83
+ const tools = pi.getAllTools();
84
+ for (const name of currentTools) {
85
+ if (nextTools.includes(name))
86
+ continue;
87
+ const authorization = toolAuthorization(name, effective, policy, tools);
88
+ if (authorization === "stack-deny" || authorization === "capability-remove")
89
+ continue;
90
+ // Older hosts omit exposure: treat them as direct, preserving selection behavior.
91
+ const exposure = tools.find((tool) => tool.name === name)?.exposure ?? "direct";
92
+ if (authorization === "authorized" || exposure === "deferred" || exposure === "codemode")
93
+ nextTools.push(name);
94
+ }
67
95
  if (!sameStringSet(currentTools, nextTools))
68
96
  pi.setActiveTools(nextTools);
69
97
  lastApplied = [...nextTools];
@@ -156,21 +184,32 @@ export function createToolPolicyRuntime(pi, getActiveStack) {
156
184
  }
157
185
  function blockReason(toolName) {
158
186
  const active = getActiveStack();
159
- if (active && hasResourcePolicy(active.stack.tools)) {
160
- if (!applyResourcePolicy([toolName], active.stack.tools).includes(toolName)) {
161
- return `Tool "${toolName}" is blocked by prompt stack "${active.stack.id}".`;
162
- }
187
+ const policy = active?.stack.tools;
188
+ // Recompute from Forge state, never from the host's active list or
189
+ // lastApplied. An absent baseline is fail-closed; an empty one stays empty.
190
+ const effective = computeEffectiveTools(policy, baseline ?? []);
191
+ const tools = pi.getAllTools();
192
+ const authorization = toolAuthorization(toolName, effective, policy, tools);
193
+ if (authorization === "stack-deny" && active) {
194
+ return `Tool "${toolName}" is blocked by prompt stack "${active.stack.id}".`;
163
195
  }
164
- const allRemoved = new Set();
165
- for (const patch of capabilityPatches) {
166
- for (const name of patch.remove) {
167
- allRemoved.add(name);
168
- }
169
- }
170
- if (allRemoved.has(toolName)) {
196
+ if (authorization === "capability-remove") {
171
197
  return `Tool "${toolName}" is blocked by active capability.`;
172
198
  }
173
- return undefined;
199
+ if (!active || !hasResourcePolicy(policy) || authorization === "authorized")
200
+ return undefined;
201
+ const targetSource = registrationSource(tools.find((tool) => tool.name === toolName)?.sourceInfo);
202
+ // A namespace child whose same-source parent is permitted (but not
203
+ // enabled) is reachable by enabling that parent: say so instead of
204
+ // reporting a hard policy block.
205
+ const permittedParent = targetSource !== undefined && tools.some((tool) => typeof tool.name === "string"
206
+ && toolName.startsWith(`${tool.name}__`)
207
+ && applyResourcePolicy([tool.name], policy).includes(tool.name)
208
+ && registrationSource(tool.sourceInfo) === targetSource);
209
+ if (!permittedParent && !applyResourcePolicy([toolName], policy).includes(toolName)) {
210
+ return `Tool "${toolName}" is blocked by prompt stack "${active.stack.id}".`;
211
+ }
212
+ return `Tool "${toolName}" is not currently enabled by prompt stack "${active.stack.id}". If provided by a capability, enable it with forge_capability.`;
174
213
  }
175
214
  function previewToolNames(stack) {
176
215
  const sourceTools = filterKnownTools(baseline ?? pi.getActiveTools());
@@ -331,4 +370,15 @@ function sameStringSet(left, right) {
331
370
  const rightSet = new Set(right);
332
371
  return left.every((value) => rightSet.has(value));
333
372
  }
373
+ // Compare registration identity, not UI/package groups: two entrypoints in
374
+ // one package (or two extensions both labelled "auto") are not one registrar.
375
+ function registrationSource(value) {
376
+ if (!value || typeof value !== "object")
377
+ return undefined;
378
+ const info = value;
379
+ const fields = [info.path, info.source, info.scope, info.origin];
380
+ if (!fields.every((field) => typeof field === "string" && field.trim()))
381
+ return undefined;
382
+ return JSON.stringify([...fields, stringValue(info.baseDir) ?? null]);
383
+ }
334
384
  //# sourceMappingURL=tool-policy-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-policy-runtime.js","sourceRoot":"","sources":["../../src/runtime/tool-policy-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,eAAe,EAA4B,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAyB9F,MAAM,UAAU,uBAAuB,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AA0B,EAAE,CAA0B;IACpF,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,qBAAqB,CAAC,QAAiC;IAC/D,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,aAAa,CAAC,IAAc,EAAE,KAAe;IACrD,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,2EAA2E;AAC3E,8EAA8E;AAC9E,SAAS,kBAAkB,CAAC,KAAc;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC1D,MAAM,IAAI,GAAG,KAAmG,CAAC;IACjH,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1F,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC"}
@@ -13,18 +13,18 @@ The optional package is tested against the released Forge host before its own pu
13
13
  1. Confirm the intended version in the manifest, lockfile, changelog, and current user documentation. Preserve historical release records and document breaking configuration/session boundaries.
14
14
  2. Install dependencies from the lockfile with `npm ci`, build, and run the complete `npm run verify` chain: Node tests, browser tests, types, generated client, docs, distribution, package contents, and packed installation.
15
15
  3. Require the Ubuntu, macOS, Windows, and configured Pi compatibility GitHub Actions jobs to pass for the **exact release commit**, not an earlier source revision.
16
- 4. Test a packed main-package installation against both the documented minimum (0.87.0) and current tested Pi versions (1.3.0) using `PI_TEST_VERSION` / `TYPEBOX_TEST_VERSION`; exercise ordinary Preset/Profile/Capability behavior independently of optional delegation.
16
+ 4. Test a packed main-package installation against both the documented minimum (0.87.0) and current tested Pi versions (1.4.0) using `PI_TEST_VERSION` / `TYPEBOX_TEST_VERSION`; exercise ordinary Preset/Profile/Capability behavior independently of optional delegation.
17
17
  5. Inspect `npm pack --dry-run` for package size and unexpected or missing files. Publish the verified artifact, not an unreviewed working tree.
18
18
 
19
19
  The macOS and Windows jobs run the same complete verification surface as Linux, including the real-browser editor suite. Compatibility-version (older supported releases) and scheduled latest-Pi probes remain Linux-only; they test dependency drift rather than operating-system behavior. Exact-release CI is a mandatory pre-release gate; this documentation does not record cross-platform release CI results.
20
20
 
21
21
  ## Dependency policy
22
22
 
23
- The four Pi SDK packages remain host-provided optional peers, never private runtime dependencies. Published Forge 0.5.7 required Pi `>=0.87.0 <0.88.0`. Forge 0.5.9 expands supported peers to the union:
23
+ The four Pi SDK packages remain host-provided optional peers, never private runtime dependencies. Published Forge 0.5.7 required Pi `>=0.87.0 <0.88.0`. Forge 0.5.10 expands supported peers to the union:
24
24
  ```
25
- >=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.4.0
25
+ >=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0
26
26
  ```
27
- Development fixtures are pinned to `1.3.0` with `typebox@1.3.27`. Minimum supported Pi `0.87.0` remains unchanged; The 1.x range covers 1.0–1.3; Pi 0.86, other 0.x versions and Pi 1.4 or later are not implicitly supported. Exact tested versions belong in development dependencies and the lockfile, not exact host-version requirements. See the [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
27
+ Development fixtures are pinned to `1.4.0` with `typebox@1.3.27`. Minimum supported Pi `0.87.0` remains unchanged; The 1.x range covers 1.0–1.4; Pi 0.86, other 0.x versions and Pi 1.5 or later are not implicitly supported. Exact tested versions belong in development dependencies and the lockfile, not exact host-version requirements. See the [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
28
28
 
29
29
  To run packed installation smoke tests against the minimum or current version:
30
30
 
@@ -32,8 +32,8 @@ To run packed installation smoke tests against the minimum or current version:
32
32
  # Test packed install against pinned minimum (0.87.0):
33
33
  PI_TEST_VERSION=0.87.0 TYPEBOX_TEST_VERSION=1.3.7 npm run check:packed
34
34
 
35
- # Test packed install against current Pi 1.3.0:
36
- PI_TEST_VERSION=1.3.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
35
+ # Test packed install against current Pi 1.4.0:
36
+ PI_TEST_VERSION=1.4.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
37
37
  ```
38
38
 
39
39
  Published `@zihanw/pi-forge-subagents` 0.5.3 does not understand `tools.initial`. Its published dependency metadata does not include this source compatibility patch. A companion release can combine its pending features with Pi 1.0 adaptation, independently after the runtime floor is updated and the bubblewrap (`bwrap`) `/tmp` mount shadowing issue is resolved. This is an independent companion release, not a requirement to publish the packages simultaneously. See the [host-port compatibility note](../reference/subagent-host-port.md#tool-selection-compatibility).
@@ -54,6 +54,6 @@ Do not silently move unrelated legacy or prerelease tags. Publishing is not a ho
54
54
 
55
55
  ### Coherent fixtures versus fresh consumers
56
56
 
57
- Compatibility CI pins the four SDKs and, for 1.x, codemode/MCP/telemetry/chord to the same exact version and asserts resolved versions. These are explicit coherent fixtures, not ordinary fresh consumer resolution. By default the packed check keeps normal npm resolution and verifies the installed four-SDK family; the ordinary 1.3.0 jobs (all three platforms) are the unconstrained normal-consumer gate. Compatibility lanes set `PI_TEST_COHERENT_UPSTREAM=1`, which also pins codemode/MCP/telemetry/chord to the host version inside the packed consumers and is printed in the log. This is required because fresh unconstrained installs of Pi 1.0.1–1.1.x now resolve their caret ranges to newer, incompatible upstream releases (observed 2026-10-20: Pi 1.1.0 + pi-codemode 1.3.0 fails with a missing `MCP_TYPESCRIPT_PREAMBLE` export) independently of Forge. Fixture success on those lanes says Forge works on that host family; it does not claim that a fresh unconstrained install of that old Pi works.
57
+ Compatibility CI pins the four SDKs and, for 1.x, codemode/MCP/telemetry/chord to the same exact version and asserts resolved versions. These are explicit coherent fixtures, not ordinary fresh consumer resolution. By default the packed check keeps normal npm resolution and verifies the installed four-SDK family; the ordinary 1.4.0 jobs (all three platforms) are the unconstrained normal-consumer gate. Compatibility lanes set `PI_TEST_COHERENT_UPSTREAM=1`, which also pins codemode/MCP/telemetry/chord to the host version inside the packed consumers and is printed in the log. This is required because fresh unconstrained installs of Pi 1.0.1–1.1.x now resolve their caret ranges to newer, incompatible upstream releases (observed 2026-10-20: Pi 1.1.0 + pi-codemode 1.3.0 fails with a missing `MCP_TYPESCRIPT_PREAMBLE` export) independently of Forge. Fixture success on those lanes says Forge works on that host family; it does not claim that a fresh unconstrained install of that old Pi works.
58
58
 
59
- Pi 1.3 pins its internal Pi dependencies exactly; normal 1.3 consumers resolve the four SDKs plus codemode/MCP/telemetry to 1.3.0 without a fixture overlay. Real-SDK regressions cover default/modifier transcript tool restoration, resumed Preset initial/allow/deny policy, Capability additions, and disabling a Preset back to the policy owner's saved startup baseline (with distinguishable external changes reconciled). This does not change tool authorization or enable every default-active extension tool on resume.
59
+ Pi 1.3 pins its internal Pi dependencies exactly; normal 1.3 consumers resolve the four SDKs plus codemode/MCP/telemetry to 1.3.0 without a fixture overlay. Real-SDK regressions cover default/modifier transcript tool restoration, resumed Preset initial/allow/deny policy, Capability additions, and disabling a Preset back to the policy owner's saved startup baseline (with distinguishable external changes reconciled). Those 0.5.9 restoration changes did not change execution authorization or enable every default-active extension tool on resume. Forge 0.5.10 separately adds [effective-set execution authorization](../reference/capabilities.md#execution-authorization-forge-0510).
@@ -55,18 +55,18 @@ Set `CHROME_PATH` when Chrome/Chromium is outside a standard location. CI runs t
55
55
 
56
56
  ## Pi compatibility
57
57
 
58
- Pi-forge treats Pi-owned SDK packages (`pi-agent-core`, `pi-ai`, `pi-coding-agent`, `pi-tui`, and `typebox`) as host-provided optional peers, not private runtime dependencies. Published Forge 0.5.7 declared peer range `>=0.87.0 <0.88.0`. Forge 0.5.9 expands supported peers to the union:
58
+ Pi-forge treats Pi-owned SDK packages (`pi-agent-core`, `pi-ai`, `pi-coding-agent`, `pi-tui`, and `typebox`) as host-provided optional peers, not private runtime dependencies. Published Forge 0.5.7 declared peer range `>=0.87.0 <0.88.0`. Forge 0.5.10 expands supported peers to the union:
59
59
  ```
60
- >=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.4.0
60
+ >=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0
61
61
  ```
62
- The repository dev SDK fixtures are updated to `1.3.0` with `typebox@1.3.27`. The minimum supported version remains `0.87.0`; there is no claim of dual 0.86 runtime support. The running host supplies one coherent SDK instance, avoiding duplicate packages and exact-version locks while expressing the actual API requirement. See the [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
62
+ The repository dev SDK fixtures are updated to `1.4.0` with `typebox@1.3.27`. The minimum supported version remains `0.87.0`; there is no claim of dual 0.86 runtime support. The running host supplies one coherent SDK instance, avoiding duplicate packages and exact-version locks while expressing the actual API requirement. See the [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
63
63
 
64
64
  The repository keeps exact SDK versions as development/test fixtures for reproducibility. Exact fixtures do not constrain which Pi version may load the published extension.
65
65
 
66
66
  Release validation and smoke testing verify:
67
67
 
68
68
  - the documented minimum supported Pi version (`0.87.0`);
69
- - the current Pi version at release time (`1.3.0`), with earlier releases (`1.0.0`, `1.0.1`, `1.0.2`, `1.0.4`, `1.1.0`, `1.2.0`) as compatibility lanes;
69
+ - the current Pi version at release time (`1.4.0`), with earlier releases (`1.0.0`, `1.0.1`, `1.0.2`, `1.0.4`, `1.1.0`, `1.2.0`, `1.3.0`) as compatibility lanes;
70
70
  - an automated or scheduled probe of npm `latest`.
71
71
 
72
72
  Run packed installation tests against specific target versions using environment variables:
@@ -75,11 +75,11 @@ Run packed installation tests against specific target versions using environment
75
75
  # Verify packed install against pinned minimum (0.87.0):
76
76
  PI_TEST_VERSION=0.87.0 TYPEBOX_TEST_VERSION=1.3.7 npm run check:packed
77
77
 
78
- # Verify packed install against current Pi 1.3.0:
79
- PI_TEST_VERSION=1.3.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
78
+ # Verify packed install against current Pi 1.4.0:
79
+ PI_TEST_VERSION=1.4.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
80
80
  ```
81
81
 
82
- Ordinary Linux/macOS/Windows CI uses Pi 1.3.0; older supported versions, including minimum 0.87.0 and Pi 1.0.0/1.0.1/1.0.2/1.0.4/1.1.0/1.2.0, are explicit Linux compatibility lanes; passing CI on the exact release commit is a release gate (its result is not recorded in this document).
82
+ Ordinary Linux/macOS/Windows CI uses Pi 1.4.0; older supported versions, including minimum 0.87.0 and Pi 1.0.0/1.0.1/1.0.2/1.0.4/1.1.0/1.2.0/1.3.0, are explicit Linux compatibility lanes; passing CI on the exact release commit is a release gate (its result is not recorded in this document).
83
83
 
84
84
  Document the tested range separately from peer constraints. Pi-coupled experimental subagent capabilities must preflight against the actual host and fail closed with a precise compatibility diagnostic when required APIs are unavailable; ordinary stacks and profiles should remain usable.
85
85
 
@@ -94,6 +94,6 @@ See the [public API policy](../reference/public-api.md).
94
94
 
95
95
  ### Coherent fixtures versus fresh consumers
96
96
 
97
- Compatibility CI pins the four SDKs and, for 1.x, codemode/MCP/telemetry/chord to the same exact version and asserts resolved versions. These are explicit coherent fixtures, not ordinary fresh consumer resolution. By default the packed check keeps normal npm resolution and verifies the installed four-SDK family; the ordinary 1.3.0 jobs (all three platforms) are the unconstrained normal-consumer gate. Compatibility lanes set `PI_TEST_COHERENT_UPSTREAM=1`, which also pins codemode/MCP/telemetry/chord to the host version inside the packed consumers and is printed in the log. This is required because fresh unconstrained installs of Pi 1.0.1–1.1.x now resolve their caret ranges to newer, incompatible upstream releases (observed 2026-10-20: Pi 1.1.0 + pi-codemode 1.3.0 fails with a missing `MCP_TYPESCRIPT_PREAMBLE` export) independently of Forge. Fixture success on those lanes says Forge works on that host family; it does not claim that a fresh unconstrained install of that old Pi works.
97
+ Compatibility CI pins the four SDKs and, for 1.x, codemode/MCP/telemetry/chord to the same exact version and asserts resolved versions. These are explicit coherent fixtures, not ordinary fresh consumer resolution. By default the packed check keeps normal npm resolution and verifies the installed four-SDK family; the ordinary 1.4.0 jobs (all three platforms) are the unconstrained normal-consumer gate. Compatibility lanes set `PI_TEST_COHERENT_UPSTREAM=1`, which also pins codemode/MCP/telemetry/chord to the host version inside the packed consumers and is printed in the log. This is required because fresh unconstrained installs of Pi 1.0.1–1.1.x now resolve their caret ranges to newer, incompatible upstream releases (observed 2026-10-20: Pi 1.1.0 + pi-codemode 1.3.0 fails with a missing `MCP_TYPESCRIPT_PREAMBLE` export) independently of Forge. Fixture success on those lanes says Forge works on that host family; it does not claim that a fresh unconstrained install of that old Pi works.
98
98
 
99
- Pi 1.3 pins its internal Pi dependencies exactly; normal 1.3 consumers resolve the four SDKs plus codemode/MCP/telemetry to 1.3.0 without a fixture overlay. Real-SDK regressions cover default/modifier transcript tool restoration, resumed Preset initial/allow/deny policy, Capability additions, and disabling a Preset back to the policy owner's saved startup baseline (with distinguishable external changes reconciled). This does not change tool authorization or enable every default-active extension tool on resume.
99
+ Pi 1.3 pins its internal Pi dependencies exactly; normal 1.3 consumers resolve the four SDKs plus codemode/MCP/telemetry to 1.3.0 without a fixture overlay. Real-SDK regressions cover default/modifier transcript tool restoration, resumed Preset initial/allow/deny policy, Capability additions, and disabling a Preset back to the policy owner's saved startup baseline (with distinguishable external changes reconciled). Those 0.5.9 restoration changes did not change execution authorization or enable every default-active extension tool on resume. Forge 0.5.10 separately adds [effective-set execution authorization](../reference/capabilities.md#execution-authorization-forge-0510).
@@ -2,6 +2,18 @@
2
2
 
3
3
  [Documentation](../README.md) · [简体中文](../zh-CN/guides/pi-1-compatibility.md)
4
4
 
5
+ ## Forge 0.5.10: Pi 1.4
6
+
7
+ Development SDKs are pinned to **1.4.0** and the four optional SDK peers expand to:
8
+
9
+ ```text
10
+ >=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0
11
+ ```
12
+
13
+ Minimum Pi 0.87.0 and `typebox@1.3.27` remain unchanged; Pi 1.5+ and other 0.x hosts are not implicitly supported. Ordinary CI and normal packed consumers use 1.4.0; historical compatibility lanes retain 1.3.0 and all existing versions. Forge 0.5.10 also adds the execution gate and namespace authorization described below; MCP names are not rewritten. The 0.5.9 / 0.5.8 sections below are historical records, not the current peer range.
14
+
15
+ **Pi 1.4 resume note:** Pi 1.4 activates extension tools that a resumed branch never mentioned (for example `forge_capability` when the transcript predates it). Forge still narrows execution authorization to the active preset and Capabilities once it binds; the active tool list may retain discovered `deferred`/`codemode` tools that are not authorized to execute; `tests/pi13-tool-restore.test.ts` covers this on 1.4.
16
+
5
17
  ## Forge 0.5.9: Pi 1.1 / 1.2 / 1.3
6
18
 
7
19
  Forge 0.5.9 pins development SDKs to **1.3.0** and expands the four optional SDK peers to:
@@ -18,7 +30,7 @@ Ordinary and legacy user events retain their authoritative expanded prompt, even
18
30
 
19
31
  **Known limitation on Pi 1.1 and earlier:** these hosts start idle custom wakes (for example a Subagents completion notification that wakes the parent) without any `before_agent_start`, so Forge never sees that run start. The wake request and its tool followups are sent without the Preset's System blocks; tool policy still applies. This is unchanged from 0.5.8 and was verified on Pi 1.1.0. Ordinary user turns and busy steering are not affected. If you rely on background completion wakes, use Pi 1.2 or later.
20
32
 
21
- Pi 1.3 keeps the custom-start/System contract. It additionally restores the transcript's active tool loadout on default/modifier-based session creation; explicit tool selections still override restoration. Forge recomputes the effective selection using its Preset (`tools.initial`, allow/deny) and active Capabilities, rather than trusting stale restored tools. Disabling a Preset restores the tool-policy owner's saved pre-policy startup baseline, reconciling distinguishable external changes; a reduced transcript loadout must not erase that saved baseline. No new enabled-membership execution restriction is introduced. Real-SDK persisted-session regressions cover these paths with offline faux streams.
33
+ Pi 1.3 keeps the custom-start/System contract. It additionally restores the transcript's active tool loadout on default/modifier-based session creation; explicit tool selections still override restoration. Forge recomputes the effective selection using its Preset (`tools.initial`, allow/deny) and active Capabilities, rather than trusting stale restored tools. Disabling a Preset restores the tool-policy owner's saved pre-policy startup baseline, reconciling distinguishable external changes; a reduced transcript loadout must not erase that saved baseline. That 0.5.9 restoration change did not add an execution gate; Forge 0.5.10 adds the gate described below. Real-SDK persisted-session regressions cover these paths with offline faux streams.
22
34
 
23
35
  Pi 1.3's internal SDK/codemode/MCP/telemetry dependencies are exact pins. Normal 1.3 consumers therefore resolve the seven Pi packages to 1.3.0 without the historical fixture overlay; this does not retroactively fix older releases' caret-resolution drift.
24
36
 
@@ -63,7 +75,7 @@ These rules concern **native MCP**, not third-party adapters such as `pi-mcp-ada
63
75
 
64
76
  ## Discovery and delayed registration
65
77
 
66
- Default native MCP servers now connect in the background without blocking the first prompt; `direct` exposure has different startup behavior. Default tools are registered with deferred exposure, omitted from codemode's description, and discovered using `searchTools()` / `describeNamespace()`. Discovery does not grant a Forge Capability or override its policy.
78
+ Default native MCP servers now connect in the background without blocking the first prompt; `direct` exposure has different startup behavior. Default tools are registered with deferred exposure, omitted from codemode's description, and discovered using `searchTools()` / `describeNamespace()`. Discovery does not grant a Forge Capability or override its policy: finding a tool does not authorize its execution.
67
79
 
68
80
  Pi 1.0 improves deferred-tool restoration on resume/reload. Forge still requires Capability additions to be registered before activation; when a server is late, wait for registration and retry the intended action. Reload alone is not a guaranteed remedy. Explicit policy sync can replace a restored host loadout, so do not assume pending tools must always reactivate. Full slow-MCP resume/reload behavior needs integration validation, not just catalog-mock tests.
69
81
 
@@ -73,13 +85,23 @@ Forge preserves foreign System sections such as `mcp_servers`, including updates
73
85
 
74
86
  On Anthropic models with native mid-conversation tool changes, Pi 1.0.1 keeps the request-level tool list fixed at the initial tools plus a reserved placeholder and defines every later tool inline in a `tool_addition` block. Enabling or disabling a Capability therefore no longer rewrites the request-level tool list, and a same-name redefinition no longer forces the full list. The native path still needs at least one initial tool: a session that starts with no active tools (for example a Preset with `tools.initial: []`) sends the full current list at request level on every tool change. Forge does not change this behavior, and no new live cache measurements were taken for 1.0.1+. See [provider support](../reference/provider-support.md).
75
87
 
76
- ## Codemode boundaries remain unchanged
88
+ ## Tool execution and codemode boundaries (Forge 0.5.10)
77
89
 
78
90
  Pi 1.0 throws when scripts read missing `tools` properties. Use `"name" in tools`, not `typeof tools.name`, to test existence.
79
91
 
80
- `tools.initial` is a default loadout, **not an enabled-membership execution gate**. Registered deferred/codemode tools permitted by the Preset can remain callable through nested codemode even when omitted from initial or after their adding Capability is disabled. Preset allow **or** deny policy and active Capability removes still apply; direct calls also depend on the host's active loadout. This patch does not change those semantics or make discovery authorization-aware.
92
+ With an active Preset's restrictive tool policy, **all tool calls, including nested codemode calls, require Forge authorization**. The effective set starts from `tools.initial` when configured, otherwise the policy-derived baseline, then applies enabled Capability additions and removals under allow/deny. Turning a Capability off immediately revokes execution access for any tool no longer authorized; defaults or another Capability may still authorize it. Running tools are not interrupted. Forge uses this effective set, not Pi's active tool list; allow membership alone does not enable a tool omitted from the effective set. Calls to tools not currently enabled point to `forge_capability` when a Capability can provide access.
93
+
94
+ An effective tool `P` also authorizes registered `P__*` descendants **from the same registration source**. For example, enabling `mcp` or `mcp__hitch` permits pi-mcp-adapter 6+/7 calls named `mcp__hitch__<tool>` from that source, without listing every child in `allow`. Different or missing registration sources do not grant this access. Preset deny and active Capability remove still block child tools; use an exact deny entry to exclude one child. Capability `remove` uses exact names, not wildcards.
95
+
96
+ Sync retains already-active tools authorized by the effective set or same-source namespace rule, and tools registered with `deferred` or `codemode` exposure, unless Preset deny or Capability remove excludes them. Retention does not grant execution access: unauthorized discovered tools remain callable so the gate can return an actionable block instead of a misleading “not found”. Other external `direct` tools are removed; missing exposure on older Pi is treated as `direct`. Disabling a Capability still removes its direct additions when no longer authorized. `tools.initial` stays authoritative; deny-only Presets and mixed wildcard allow lists (for example `allow: ["*", "read"]`) without `initial` keep their existing external-addition baseline absorption, which can authorize those tools. Pure selective allow lists (without `*`) do not gain execution authorization from external activation alone. Retention avoids unnecessary removals, not all OpenAI cache fallback.
97
+
98
+ Without an active Preset or a restrictive tool policy, execution behavior is unchanged. `tools.initial` alone or `allow: ["*"]` alone does not enable the new gate; an allow list containing an entry other than `*`, or a nonempty deny list, does. Existing explicit Capability removals still apply.
99
+
100
+ ### Known limitations
81
101
 
82
- `models.generateImages()` (new in 1.0) and `models.classify()` (since 0.99) call the session model registry, not `ctx.executeTool()` / `tool_call`. Disabling image tools does **not** disable these model APIs. Pi settings have no `models: false` toggle; the SDK factory `createCodemodeExtension({ models: false })` requires explicit programmatic extension assembly.
102
+ - **Discovery:** codemode `ALL_TOOLS` / `searchTools()` and `tool_search` can still reveal unauthorized names. Forge blocks execution, not discovery.
103
+ - **Model APIs:** codemode `models.generateImages()` (new in Pi 1.0) and `models.classify()` (since 0.99) do not pass through `tool_call`, so Forge cannot block them. Disabling an image Capability does **not** disable these APIs. Only programmatic SDK assembly with `createCodemodeExtension({ models: false })` disables this codemode model access; Pi settings have no equivalent toggle.
104
+ - **Prefix caching:** on OpenAI Responses/Completions transports, any tool removal, including disabling a Capability that removes tools, makes subsequent requests in that session send the full current tool list. Removal detection scans the transcript, so re-enabling tools does not restore incremental delivery while that history remains. This disrupts prefix caching. Anthropic's native `tool_removal` path is unaffected by this fallback. Forge aims to preserve cacheable prefixes where possible, not guarantee cache hits.
83
105
 
84
106
  Pi accounts for reported codemode model usage. Forge's cache display still separates assistant usage from explicit `details.forgeNestedUsage`; it does not newly aggregate arbitrary native tool/model usage. Do not add both receipts without deduplication.
85
107
 
@@ -96,9 +118,9 @@ Published subagents 0.5.3 does not support `tools.initial`. Its pending feature
96
118
  ```bash
97
119
  # Override both when testing a different host than the installed development SDK.
98
120
  PI_TEST_VERSION=0.87.0 TYPEBOX_TEST_VERSION=1.3.7 npm run check:packed
99
- PI_TEST_VERSION=1.3.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
121
+ PI_TEST_VERSION=1.4.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
100
122
  ```
101
123
 
102
124
  Without overrides, packed checks use the coherent installed SDK family and its declared TypeBox version, not a hardcoded historical pin. Both consumers use normal npm peer resolution and check the installed versions. An optional sibling, when present, uses its declared runtime dependency; this is not a test of an unreleased local runtime.
103
125
 
104
- Ordinary Linux/macOS/Windows CI uses pinned Pi 1.3.0; explicit compatibility lanes (0.87.0 through 1.2.0, including 1.0.2) and scheduled latest-Pi probes run on Linux. CI on the exact release commit remains a release gate; this document does not record its result or any real-provider testing.
126
+ Ordinary Linux/macOS/Windows CI uses pinned Pi 1.4.0; explicit compatibility lanes (0.87.0 through 1.3.0, including 1.0.2) and scheduled latest-Pi probes run on Linux. CI on the exact release commit remains a release gate; this document does not record its result or any real-provider testing.
@@ -6,7 +6,7 @@ Pi-forge introduces capabilities: session-scoped prompt directives paired with d
6
6
 
7
7
  ## Requirements and installation
8
8
 
9
- - **Host requirement:** Minimum supported Pi version is 0.87.0. Published Forge 0.5.7 declared peer range `>=0.87.0 <0.88.0`; Forge 0.5.8 supported `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.1.0`; Forge 0.5.9 supports `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.4.0` (dev SDK 1.3.0, `typebox@1.3.27`; min SDK 0.87 unchanged; no dual 0.86 runtime support claim). Capabilities require Forge 0.5.5. See [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
9
+ - **Host requirement:** Minimum supported Pi version is 0.87.0. Published Forge 0.5.7 declared peer range `>=0.87.0 <0.88.0`; Forge 0.5.8 supported `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.1.0`; Forge 0.5.10 supports `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0` (dev SDK 1.4.0, `typebox@1.3.27`; min SDK 0.87 unchanged; no dual 0.86 runtime support claim). Capabilities require Forge 0.5.5. See [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
10
10
  - **Project trust:** Activating capabilities, preset bindings, or manual directives requires a trusted project (`isProjectTrusted()`).
11
11
  - **Compatibility:** Configurations utilizing `tools.initial` require a Forge version with this support; older Forge versions may ignore `initial`, so configurations are not downgrade-compatible.
12
12
 
@@ -48,6 +48,35 @@ Capabilities are JSON files stored in:
48
48
  - **Revocation behavior:** Revoking a binding's authorization (`modelCallable: false`) or removing the binding from the Preset does not retroactively erase active snapshots; human CLI (`/capability disable` or `/capability reset`) or Web panel deactivation is the recovery path.
49
49
  - **User vs. Agent ownership and deduplication:** Activations record actor attribution (`user` vs `agent`). Repeated `enable` of an already active capability is idempotent and never performs an automatic owner takeover between user and agent. Takeover requires an explicit deactivation and reactivation cycle.
50
50
 
51
+ ## Execution authorization (Forge 0.5.10)
52
+
53
+ With an active Preset's restrictive tool policy, **all tool calls, including nested codemode calls, require Forge authorization**. The effective set starts from `tools.initial` when configured, otherwise the policy-derived baseline, then applies enabled Capability additions and removals under allow/deny. Turning a Capability off immediately revokes execution access for any tool no longer authorized; defaults or another Capability may still authorize it. Running tools are not interrupted. Forge uses this effective set, not Pi's active tool list; allow membership alone does not enable a tool omitted from the effective set. Calls to tools not currently enabled point to `forge_capability` when a Capability can provide access.
54
+
55
+ An effective tool `P` also authorizes registered `P__*` descendants **from the same registration source**. For example, enabling `mcp` or `mcp__hitch` permits pi-mcp-adapter 6+/7 calls named `mcp__hitch__<tool>` from that source, without listing every child in `allow`. Different or missing registration sources do not grant this access. Preset deny and active Capability remove still block child tools; use an exact deny entry to exclude one child. Capability `remove` uses exact names, not wildcards.
56
+
57
+ Sync retains already-active tools authorized by the effective set or same-source namespace rule, and tools registered with `deferred` or `codemode` exposure, unless Preset deny or Capability remove excludes them. Retention does not grant execution access: unauthorized discovered tools remain callable so the gate can return an actionable block instead of a misleading “not found”. Other external `direct` tools are removed; missing exposure on older Pi is treated as `direct`. Disabling a Capability still removes its direct additions when no longer authorized. `tools.initial` stays authoritative; deny-only Presets and mixed wildcard allow lists (for example `allow: ["*", "read"]`) without `initial` keep their existing external-addition baseline absorption, which can authorize those tools. Pure selective allow lists (without `*`) do not gain execution authorization from external activation alone. Retention avoids unnecessary removals, not all OpenAI cache fallback.
58
+
59
+ Without an active Preset or a restrictive tool policy, execution behavior is unchanged. `tools.initial` alone or `allow: ["*"]` alone does not enable the new gate; an allow list containing an entry other than `*`, or a nonempty deny list, does. Existing explicit Capability removals still apply.
60
+
61
+ This **Preset tool-policy fragment** uses deny (not allow; the two policies are mutually exclusive) to permit enabling `mcp__hitch` while denying one child even after the parent is enabled:
62
+
63
+ ```json
64
+ {
65
+ "tools": {
66
+ "deny": ["mcp__hitch__delete"],
67
+ "initial": ["forge_capability"]
68
+ }
69
+ }
70
+ ```
71
+
72
+ A Capability can use `"tools": { "add": ["mcp__hitch"], "remove": [] }`. Once enabled, same-source children other than `mcp__hitch__delete` are authorized. Disabling it revokes that namespace access unless another effective parent still authorizes it. Use actual registered names from your session.
73
+
74
+ ### Known limitations
75
+
76
+ - **Discovery:** codemode `ALL_TOOLS` / `searchTools()` and `tool_search` can still reveal unauthorized names. Forge blocks execution, not discovery.
77
+ - **Model APIs:** codemode `models.generateImages()` (new in Pi 1.0) and `models.classify()` (since 0.99) do not pass through `tool_call`, so Forge cannot block them. Disabling an image Capability does **not** disable these APIs. Only programmatic SDK assembly with `createCodemodeExtension({ models: false })` disables this codemode model access; Pi settings have no equivalent toggle.
78
+ - **Prefix caching:** on OpenAI Responses/Completions transports, any tool removal, including disabling a Capability that removes tools, makes subsequent requests in that session send the full current tool list. Removal detection scans the transcript, so re-enabling tools does not restore incremental delivery while that history remains. This disrupts prefix caching. Anthropic's native `tool_removal` path is unaffected by this fallback. Forge aims to preserve cacheable prefixes where possible, not guarantee cache hits.
79
+
51
80
  ## Preset-authorized Agent controls
52
81
 
53
82
  Preset `capabilities` bindings support autonomous Agent activation when explicitly authorized:
@@ -230,7 +259,7 @@ Active state is derived deterministically from session events and delivery curso
230
259
 
231
260
  ## Compatibility and security boundaries
232
261
 
233
- - **Upstream Pi minimum required:** Pi 0.87.0 is the minimum supported host (Forge 0.5.9 supports `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.4.0`; Forge 0.5.8 supported `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.1.0`; published 0.5.7 peer metadata remains `>=0.87.0 <0.88.0`). Dual 0.86 runtime support is not provided. Extensions that previously manipulated or inspected full System messages in `context` must migrate to the full `context_with_system` hook. See [Pi 1.0 compatibility](../guides/pi-1-compatibility.md).
262
+ - **Upstream Pi minimum required:** Pi 0.87.0 is the minimum supported host (Forge 0.5.10 supports `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0`; Forge 0.5.8 supported `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.1.0`; published 0.5.7 peer metadata remains `>=0.87.0 <0.88.0`). Dual 0.86 runtime support is not provided. Extensions that previously manipulated or inspected full System messages in `context` must migrate to the full `context_with_system` hook. See [Pi 1.0 compatibility](../guides/pi-1-compatibility.md).
234
263
  - **Timing with `before_agent_start`:** Any forced System prompt injection via `before_agent_start` continues to execute later than `context_with_system`.
235
264
  - **Preceding extension message rewrites:** Pi permits context hooks to rewrite messages. When visible metadata anchors or unanchored events need positioning, Forge requires a unique ordered alignment with the canonical session projection and fails closed if arbitrary preceding rewrites break alignment. Pi may persist queued custom messages absent from a tool follow-up: Forge permits only uniquely alignable custom-message omissions, ignores their regenerated envelope timestamps, and preserves incoming objects without restoring omitted dialogue. A preceding rewrite can therefore conflict with this locator; moving it later does not guarantee safe composition. Broad plugin, warming, and automatic-overflow compatibility remain unverified.
236
265
  - **Upstream defect status and protocol limits:** Upstream Pi metadata chunking and semantic-cut defects are NOT patched and remain unfixed upstream. Compaction checkpoint placement is unchanged. Old sessions and former delivery carriers remain untouched and unsupported for continuing capability state; Forge does not migrate old JSONL or rewrite historical summaries. Oh My Pi (OMP) is not supported or promised.
@@ -10,7 +10,7 @@ This file tracks the currently implemented feature surface for agent profiles, t
10
10
  - Tarball verification rejects physical `src/` entries and requires the root and subagent compiled entry points.
11
11
  - The web editor's HTML page shell and static styles are maintained separately from its browser behavior modules.
12
12
  - Strict typed web-editor client modules bundled into one self-contained browser script at build time, with generated-client consistency verification.
13
- - Supported Node.js baseline is 22.19+. In published 0.5.7, peer metadata required `>=0.87.0 <0.88.0`. Forge 0.5.8 expanded supported peers to `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.1.0`; Forge 0.5.9 expands them to `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.4.0` (development SDK pinned to 1.3.0 with `typebox@1.3.27`, minimum 0.87.0 unchanged). All five packages remain host-provided optional peers. Exact repository versions are reproducible development/test fixtures rather than runtime constraints. See [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
13
+ - Supported Node.js baseline is 22.19+. In published 0.5.7, peer metadata required `>=0.87.0 <0.88.0`. Forge 0.5.8 expanded supported peers to `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.1.0`; Forge 0.5.10 expands them to `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0` (development SDK pinned to 1.4.0 with `typebox@1.3.27`, minimum 0.87.0 unchanged). All five packages remain host-provided optional peers. Exact repository versions are reproducible development/test fixtures rather than runtime constraints. See [Pi 1.0 compatibility guide](../guides/pi-1-compatibility.md).
14
14
  - Project trust check before loading prompt stacks.
15
15
  - Footer status showing the active prompt stack.
16
16
 
@@ -249,7 +249,7 @@ This file tracks the currently implemented feature surface for agent profiles, t
249
249
 
250
250
  ## Capabilities and System Updates
251
251
 
252
- - Upstream host requirement: Minimum supported Pi version is 0.87.0 (published 0.5.7 declared `>=0.87.0 <0.88.0`; 0.5.9 supports `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.4.0`; dev SDK updated to 1.3.0 with `typebox@1.3.27`; no dual 0.86 runtime support claim). See [Pi 1.0 compatibility](../guides/pi-1-compatibility.md).
252
+ - Upstream host requirement: Minimum supported Pi version is 0.87.0 (published 0.5.7 declared `>=0.87.0 <0.88.0`; 0.5.10 supports `>=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0`; dev SDK updated to 1.4.0 with `typebox@1.3.27`; no dual 0.86 runtime support claim). See [Pi 1.0 compatibility](../guides/pi-1-compatibility.md).
253
253
  - File-backed capability definitions stored in `.pi/forge/capabilities/<id>.json` (project scope) and `~/.pi/forge/capabilities/<id>.json` (global scope) with schema `schemaVersion: 1`, `type: "pi-forge.capability"`.
254
254
  - Literal text content (up to 100,000 characters) without macro, template, or script evaluation.
255
255
  - Tool modification patches supporting `add` and `remove` arrays (tool IDs ≤ 128 characters, no whitespace/controls/wildcards, up to 256 tools per array). Capabilities support `add` and `remove` ONLY; candidate `only`/allowlist is not implemented.
@@ -24,7 +24,7 @@ Tool flags only apply when `supportsMidConvoSystemMessages` is also enabled. The
24
24
  | API | Instruction text | Tool changes |
25
25
  |---|---|---|
26
26
  | `anthropic-messages` | With the flag: a `role: "system"` message. Pi holds it until just before the next assistant message, so it never separates a `tool_use` from its `tool_result`; an update recorded before a user message is sent after it. | With `supportsMidConvoToolChanges` and at least one initial tool. **Pi 1.0.1+:** the request-level list stays fixed (initial tools plus a reserved deferred placeholder); later tools are defined by value inside `tool_addition` blocks (a same-name redefinition replaces the earlier definition) and withdrawn by `tool_removal`. **Pi 1.0.0 and earlier:** later tools are appended to the request-level list with `defer_loading`, the list only grows, and a same-name redefinition falls back to the full list. Otherwise (including a session that starts with no active tools, such as `tools.initial: []`): the current list at request level. |
27
- | `openai-responses`, `openai-codex-responses`, `azure-openai-responses` | With the flag: a `developer` message (reasoning models that accept the developer role) or a `system` message, at its position. | Additions load in place while retained history contains only additions. Any removal or same-name redeclaration anywhere in retained history switches that request to the full current list at request level. |
27
+ | `openai-responses`, `openai-codex-responses`, `azure-openai-responses` | With the flag: a `developer` message (reasoning models that accept the developer role) or a `system` message, at its position. | Additions load in place while retained history contains only additions. Any removal or same-name redeclaration anywhere in retained history switches that and subsequent requests to the full current list at request level while that history remains. |
28
28
  | `openai-completions` | With the flag: a `developer` or `system` message at its position. | Additions load in place with `supportsMidConvoToolAdditions`; removals and redeclarations switch to the full current list. |
29
29
  | `mistral-conversations` | With the flag: a `system` message at its position. | Always the full current list at request level. |
30
30
  | Google Generative AI / Vertex | Always folded into `systemInstruction`; no mid-conversation path. | Full current list. |
@@ -58,7 +58,7 @@ These are single-session observations, not guarantees. Cache reuse is decided by
58
58
  - **`anthropic/claude-sonnet-5`, fallback path:** the request after a tool change read nothing from cache, because Pi rewrote the leading system prompt and tool list. The model also questioned the labeled user update before using the new tool.
59
59
  - **OpenAI Responses / Codex:** in earlier tests, a removal switched to the full tool list and cache reads dropped to zero; requests with only additions kept the prefix.
60
60
 
61
- To keep caches stable, prefer a flagged model with native tool changes. On Responses-family models, avoid removing tools in a session where cache reuse matters.
61
+ To preserve cacheable prefixes where possible, prefer a flagged model with native tool changes; cache hits are not guaranteed. On OpenAI Responses/Completions transports, any removal, including disabling a Capability that removes tools, makes later session requests send the full current tool list because removal detection scans the transcript. Re-enabling tools does not restore incremental delivery while that history remains. Anthropic's native `tool_removal` path is unaffected by this fallback.
62
62
 
63
63
  ## Checking your own setup
64
64
 
@@ -2,6 +2,18 @@
2
2
 
3
3
  [中文文档](../README.md) · [English](../../guides/pi-1-compatibility.md)
4
4
 
5
+ ## Forge 0.5.10:Pi 1.4
6
+
7
+ 开发 SDK 固定为 **1.4.0**,四个可选 SDK peer 范围扩大为:
8
+
9
+ ```text
10
+ >=0.87.0 <0.88.0 || 0.99.0 || 0.99.1 || 0.99.2 || >=1.0.0 <1.5.0
11
+ ```
12
+
13
+ 最低 Pi 0.87.0 与 `typebox@1.3.27` 保持不变;不自动承诺 Pi 1.5+ 或其他 0.x。常规 CI 与普通打包消费者使用 1.4.0,历史兼容矩阵保留 1.3.0 及已有版本。Forge 0.5.10 还新增下文所述的执行门禁与命名空间授权;不改写 MCP 名称。下方 0.5.9 / 0.5.8 段落保留为历史说明,并非当前 peer 范围。
14
+
15
+ **Pi 1.4 恢复说明:** Pi 1.4 恢复会话时,会激活该分支从未提到过的扩展工具(例如 transcript 早于 `forge_capability` 时)。Forge 绑定后仍会把执行授权收敛到当前预设与 Capability 的有效范围;active 工具列表可能保留被发现但不可执行的 `deferred`/`codemode` 工具;`tests/pi13-tool-restore.test.ts` 在 1.4 上覆盖了这一点。
16
+
5
17
  ## Forge 0.5.9:Pi 1.1 / 1.2 / 1.3
6
18
 
7
19
  Forge 0.5.9 将开发 SDK 固定为 **1.3.0**,四个可选 SDK peer 范围扩大为:
@@ -16,7 +28,7 @@ Pi 1.2 的空闲自定义唤醒触发无 `prompt` 的 `before_agent_start`,启
16
28
 
17
29
  **Pi 1.1 及更早版本的已知限制:** 这些宿主启动空闲自定义唤醒时(例如 Subagents 完成通知唤醒父会话)不触发任何 `before_agent_start`,Forge 无从得知这一轮开始。该次唤醒请求及其工具后续请求不带预设的 System 块;工具策略照常生效。这一点与 0.5.8 相同,已在 Pi 1.1.0 上实测。普通用户输入和忙碌时的 steering 不受影响。依赖后台完成唤醒的话,请使用 Pi 1.2 或更高版本。
18
30
 
19
- Pi 1.3 保持 custom-start/System 契约,并在默认或修饰符工具选择模式创建会话时恢复 transcript 中的活动工具;显式工具列表仍覆盖恢复。Forge 按预设的 `tools.initial`、allow/deny 与活动能力重新计算有效工具,不能让过期 transcript 越过权限上限或丢失能力工具。停用预设时恢复工具策略所有者保存的启动基线,并协调可区分的外部修改,而不是用经过策略缩减的 transcript 丢弃原基线。真实 SDK 持久化会话测试使用离线 faux 流覆盖这些路径;不引入新的 enabled-membership 执行权限限制。
31
+ Pi 1.3 保持 custom-start/System 契约,并在默认或修饰符工具选择模式创建会话时恢复 transcript 中的活动工具;显式工具列表仍覆盖恢复。Forge 按预设的 `tools.initial`、allow/deny 与活动能力重新计算有效工具,不能让过期 transcript 越过权限上限或丢失能力工具。停用预设时恢复工具策略所有者保存的启动基线,并协调可区分的外部修改,而不是用经过策略缩减的 transcript 丢弃原基线。真实 SDK 持久化会话测试使用离线 faux 流覆盖这些路径。该 0.5.9 恢复改动未新增执行门禁;Forge 0.5.10 新增下文所述的门禁。
20
32
 
21
33
  Pi 1.3 内部 SDK/codemode/MCP/telemetry 改为精确版本依赖,普通消费者无需历史 fixture 覆盖即可解析七个 Pi 包为 1.3.0;这不会修复旧版本 caret 的解析漂移。
22
34
 
@@ -61,7 +73,7 @@ Pi 0.99.2+ 规范化 native MCP 名称,例如 `mcp__demo-server__ping` 改为
61
73
 
62
74
  ## Discovery 与延迟注册
63
75
 
64
- 默认 native MCP 服务器后台连接,不阻塞首个 prompt;`direct` exposure 的启动行为不同。默认工具以 deferred exposure 注册,不列进 codemode description,通过 `searchTools()` / `describeNamespace()` 发现。搜索工具不会授予 Forge Capability,也不会覆盖工具策略。
76
+ 默认 native MCP 服务器后台连接,不阻塞首个 prompt;`direct` exposure 的启动行为不同。默认工具以 deferred exposure 注册,不列进 codemode description,通过 `searchTools()` / `describeNamespace()` 发现。搜索工具不会授予 Forge Capability,也不会覆盖工具策略:发现工具不等于获准执行。
65
77
 
66
78
  Pi 1.0 改进了 resume/reload 后的 deferred 工具恢复。Forge 仍要求 Capability add 的工具已注册;服务器未就绪时,应等待注册后重试原操作。单纯 reload 不保证解决问题。显式策略同步可能替换宿主恢复的 loadout,不应假定所有 pending 工具必须自动恢复。完整慢 MCP resume/reload 需要集成验收,不能拿 catalog mock 测试冒充。
67
79
 
@@ -71,13 +83,23 @@ Forge 保留 `mcp_servers` 等外来 System section,包括更新和删除。
71
83
 
72
84
  在支持原生中途改工具的 Anthropic 模型上,Pi 1.0.1 起请求级工具列表固定为初始工具加一个保留占位工具,之后的每个工具都直接以完整定义写在 `tool_addition` 块里。因此启用或停用 Capability 不再改写请求级工具列表,同名重定义也不再强制发送完整列表。原生路径仍需要至少一个初始工具:会话开始时没有任何活动工具(例如 `tools.initial: []` 的预设)时,每次工具变化都会在请求级别发送当前完整列表。Forge 不改变这一行为,也没有针对 1.0.1 起重新做真实缓存实测。详见 [Provider 支持](../reference/provider-support.md)。
73
85
 
74
- ## Codemode 边界保持原样
86
+ ## 工具执行与 Codemode 边界(Forge 0.5.10)
75
87
 
76
88
  Pi 1.0 访问不存在的 `tools` 属性会抛错。检查存在性请用 `"name" in tools`,不要用 `typeof tools.name`。
77
89
 
78
- `tools.initial` 是默认 loadout,**不是按 enabled 集合检查执行的 gate**。在 Preset 许可内、已注册的 deferred/codemode 工具,即使未列入 initial,或添加它的 Capability 已关闭,仍可能经 codemode nested 调用。Preset 的 allow **或** deny 策略和活动 Capability.remove 仍生效;direct 调用还取决于宿主 active loadout。本补丁不改变这些语义,也不让 discovery 自动按授权过滤。
90
+ 活跃 Preset 含有限制性的工具策略时,**所有工具调用(包括 codemode 嵌套调用)都必须获得 Forge 授权**。有效集以配置的 `tools.initial` 为起点,否则采用按策略计算的基线,再在 allow/deny 约束下应用已启用 Capability 的添加与移除。关闭 Capability 会立即撤销不再获授权工具的执行权限;默认集或其他 Capability 仍可能授权该工具。不会中断正在执行的工具。Forge 依据这个有效集,而不是 Pi 的 active 工具列表;仅列入 allow 不会启用有效集之外的工具。对当前未启用工具的调用,若可由 Capability 提供权限,拦截提示会指向 `forge_capability`。
91
+
92
+ 有效集中的工具 `P` 还授权**同一注册来源**的已注册 `P__*` 子工具。例如,启用 `mcp` 或 `mcp__hitch` 后,pi-mcp-adapter 6+/7 以 `mcp__hitch__<tool>` 名义发出的同来源调用可以执行,无需把每个子工具写入 `allow`。注册来源不同或缺失时不授予此权限。Preset deny 与活动 Capability remove 仍可阻止子工具;可用精确 deny 项排除单个子工具。Capability `remove` 使用精确名称,不支持通配符。
93
+
94
+ 同步会保留已 active 且由有效集或同来源命名空间规则授权的工具,以及注册 exposure 为 `deferred` 或 `codemode` 的工具,但 Preset deny 或 Capability remove 排除的工具仍会撤掉。保留不授予执行权限:未授权的已发现工具保留在可调用表中,让门禁返回可操作的拦截提示,而非误导性的 “not found”。其他外部激活的 `direct` 工具仍会撤掉;旧 Pi 缺失 exposure 时按 `direct` 处理。关闭 Capability 仍会撤掉其不再获授权的 direct 添加项。`tools.initial` 保持权威;无 `initial` 的仅 deny 预设和混合 wildcard allow(例如 `allow: ["*", "read"]`)保持既有的外部新增吸收进基线语义,可因此授权这些工具。纯选择性 allow(不含 `*`)不会仅因外部激活而获得执行授权。保留减少不必要的撤销,但不能消除所有 OpenAI 缓存回退。
95
+
96
+ 无活跃 Preset 或无限制性工具策略时,执行行为不变。仅 `tools.initial` 或仅 `allow: ["*"]` 不会启用新门禁;allow 列表含有非 `*` 项,或 deny 列表非空时才启用。已有的显式 Capability 移除仍生效。
97
+
98
+ ### 已知限制
79
99
 
80
- `models.generateImages()`(1.0 新增)和 `models.classify()`(0.99 已有)直接调用会话 model registry,不经过 `ctx.executeTool()` / `tool_call`。关闭生图工具**不等于**关闭模型 API。Pi settings 没有 `models: false` 开关;SDK factory `createCodemodeExtension({ models: false })` 需要明确的编程式插件装配。
100
+ - **发现:** codemode `ALL_TOOLS` / `searchTools()` 与 `tool_search` 仍可能显示未授权工具名。Forge 只阻断执行,不过滤发现。
101
+ - **模型 API:** codemode `models.generateImages()`(Pi 1.0 新增)与 `models.classify()`(0.99 已有)不经过 `tool_call`,Forge 无法拦截。关闭生图 Capability **不能**禁用这些 API。只有通过 SDK 编程式装配 `createCodemodeExtension({ models: false })` 才能关闭这类 codemode 模型访问;Pi settings 没有对应开关。
102
+ - **前缀缓存:** 在 OpenAI Responses/Completions 系列传输上,任何工具移除(包括关闭 Capability 导致的工具移除)都会使该会话后续请求发送当前完整工具表。移除检测会扫描转录历史,因此只要该历史仍保留,重新启用工具也不能恢复增量投递。这会破坏前缀缓存。Anthropic 原生 `tool_removal` 路径不受这种回退影响。Forge 旨在尽量保留可缓存前缀,不承诺缓存命中。
81
103
 
82
104
  Pi 会将 codemode 模型返回的用量计入总账。Forge cache 面板仍分别展示 assistant 用量与显式 `details.forgeNestedUsage`,没有新增任意 native tool/model usage 汇总;不能把两份回执直接重复加总。
83
105
 
@@ -94,9 +116,9 @@ agent-core 实验 harness 的移除,不等于我们配套 runtime 使用的 co
94
116
  ```bash
95
117
  # 目标与已安装开发 SDK 不同时,请同时指定这两个版本。
96
118
  PI_TEST_VERSION=0.87.0 TYPEBOX_TEST_VERSION=1.3.7 npm run check:packed
97
- PI_TEST_VERSION=1.3.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
119
+ PI_TEST_VERSION=1.4.0 TYPEBOX_TEST_VERSION=1.3.27 npm run check:packed
98
120
  ```
99
121
 
100
122
  不指定时,packed 检查读取一致的已安装 SDK family 及其声明的 TypeBox 版本,不再硬编码旧 pin。两个消费者都使用正常 npm peer 解析,并核对实际安装版本。如果存在 optional sibling,使用它声明的 runtime 依赖;不把这当成未发布本地 runtime 的测试。
101
123
 
102
- 常规 Linux/macOS/Windows CI 使用固定的 Pi 1.3.0;显式兼容(0.87.0 至 1.2.0,含 1.0.2)与 scheduled latest 探针运行在 Linux。目标 release commit 的 CI 仍是发布门槛;本文不记录其结果,也不代表已完成真实 provider 验收。
124
+ 常规 Linux/macOS/Windows CI 使用固定的 Pi 1.4.0;显式兼容(0.87.0 至 1.3.0,含 1.0.2)与 scheduled latest 探针运行在 Linux。目标 release commit 的 CI 仍是发布门槛;本文不记录其结果,也不代表已完成真实 provider 验收。