@zihanw/pi-forge 0.4.1 → 0.5.0
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/CHANGELOG.md +41 -1
- package/README.md +11 -11
- package/README.zh-CN.md +3 -5
- package/SUBAGENT_ADAPTER_CONTRACT.md +3 -1
- package/dist/agent-profile.d.ts +18 -62
- package/dist/agent-profile.d.ts.map +1 -1
- package/dist/agent-profile.js +27 -249
- package/dist/agent-profile.js.map +1 -1
- package/dist/codecs/agent-profile.d.ts +53 -0
- package/dist/codecs/agent-profile.d.ts.map +1 -0
- package/dist/codecs/agent-profile.js +176 -0
- package/dist/codecs/agent-profile.js.map +1 -0
- package/dist/codecs/index.d.ts +5 -0
- package/dist/codecs/index.d.ts.map +1 -0
- package/dist/codecs/index.js +3 -0
- package/dist/codecs/index.js.map +1 -0
- package/dist/codecs/prompt-stack.d.ts +18 -0
- package/dist/codecs/prompt-stack.d.ts.map +1 -0
- package/dist/codecs/prompt-stack.js +479 -0
- package/dist/codecs/prompt-stack.js.map +1 -0
- package/dist/compile-cycle.d.ts +18 -0
- package/dist/compile-cycle.d.ts.map +1 -0
- package/dist/compile-cycle.js +13 -0
- package/dist/compile-cycle.js.map +1 -0
- package/dist/compiler.d.ts +10 -4
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +53 -19
- package/dist/compiler.js.map +1 -1
- package/dist/extension-registry.d.ts.map +1 -1
- package/dist/extension-registry.js +5 -2
- package/dist/extension-registry.js.map +1 -1
- package/dist/forge-config.d.ts +0 -105
- package/dist/forge-config.d.ts.map +1 -1
- package/dist/forge-config.js +1 -313
- package/dist/forge-config.js.map +1 -1
- package/dist/forge-v1/analyzer.d.ts +3 -0
- package/dist/forge-v1/analyzer.d.ts.map +1 -0
- package/dist/forge-v1/analyzer.js +50 -0
- package/dist/forge-v1/analyzer.js.map +1 -0
- package/dist/forge-v1/index.d.ts +6 -0
- package/dist/forge-v1/index.d.ts.map +1 -0
- package/dist/forge-v1/index.js +13 -0
- package/dist/forge-v1/index.js.map +1 -0
- package/dist/forge-v1/parser.d.ts +3 -0
- package/dist/forge-v1/parser.d.ts.map +1 -0
- package/dist/forge-v1/parser.js +186 -0
- package/dist/forge-v1/parser.js.map +1 -0
- package/dist/forge-v1/renderer.d.ts +9 -0
- package/dist/forge-v1/renderer.d.ts.map +1 -0
- package/dist/forge-v1/renderer.js +181 -0
- package/dist/forge-v1/renderer.js.map +1 -0
- package/dist/forge-v1/types.d.ts +87 -0
- package/dist/forge-v1/types.d.ts.map +1 -0
- package/dist/forge-v1/types.js +4 -0
- package/dist/forge-v1/types.js.map +1 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -81
- package/dist/index.js.map +1 -1
- package/dist/lifecycle.d.ts +6 -5
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +43 -112
- package/dist/lifecycle.js.map +1 -1
- package/dist/loader.d.ts +5 -8
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +10 -467
- package/dist/loader.js.map +1 -1
- package/dist/macro-engine.d.ts +9 -14
- package/dist/macro-engine.d.ts.map +1 -1
- package/dist/macro-engine.js +5 -238
- package/dist/macro-engine.js.map +1 -1
- package/dist/payload-command.d.ts +6 -6
- package/dist/payload-command.d.ts.map +1 -1
- package/dist/payload-command.js.map +1 -1
- package/dist/payload-state.d.ts +16 -0
- package/dist/payload-state.d.ts.map +1 -0
- package/dist/payload-state.js +14 -0
- package/dist/payload-state.js.map +1 -0
- package/dist/preset-command.d.ts +4 -4
- package/dist/preset-command.d.ts.map +1 -1
- package/dist/preset-command.js +33 -104
- package/dist/preset-command.js.map +1 -1
- package/dist/preview.d.ts +4 -4
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +17 -8
- package/dist/preview.js.map +1 -1
- package/dist/profile-command.d.ts +2 -2
- package/dist/profile-command.d.ts.map +1 -1
- package/dist/profile-command.js +15 -14
- package/dist/profile-command.js.map +1 -1
- package/dist/profile-service.d.ts.map +1 -1
- package/dist/profile-service.js +23 -39
- package/dist/profile-service.js.map +1 -1
- package/dist/prompt-analysis.d.ts +24 -0
- package/dist/prompt-analysis.d.ts.map +1 -0
- package/dist/prompt-analysis.js +84 -0
- package/dist/prompt-analysis.js.map +1 -0
- package/dist/prompt-runtime.d.ts +19 -0
- package/dist/prompt-runtime.d.ts.map +1 -0
- package/dist/prompt-runtime.js +30 -0
- package/dist/prompt-runtime.js.map +1 -0
- package/dist/regex.js +6 -12
- package/dist/regex.js.map +1 -1
- package/dist/render-helpers.d.ts +2 -10
- package/dist/render-helpers.d.ts.map +1 -1
- package/dist/render-helpers.js +3 -53
- package/dist/render-helpers.js.map +1 -1
- package/dist/repositories/agent-profile.d.ts +36 -0
- package/dist/repositories/agent-profile.d.ts.map +1 -0
- package/dist/repositories/agent-profile.js +153 -0
- package/dist/repositories/agent-profile.js.map +1 -0
- package/dist/repositories/index.d.ts +3 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +3 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/prompt-stack.d.ts +57 -0
- package/dist/repositories/prompt-stack.d.ts.map +1 -0
- package/dist/repositories/prompt-stack.js +175 -0
- package/dist/repositories/prompt-stack.js.map +1 -0
- package/dist/runtime/profile-runtime.d.ts +2 -2
- package/dist/runtime/profile-runtime.d.ts.map +1 -1
- package/dist/runtime/profile-runtime.js +13 -10
- package/dist/runtime/profile-runtime.js.map +1 -1
- package/dist/runtime/prompt-stack-runtime.d.ts +4 -3
- package/dist/runtime/prompt-stack-runtime.d.ts.map +1 -1
- package/dist/runtime/prompt-stack-runtime.js +42 -57
- package/dist/runtime/prompt-stack-runtime.js.map +1 -1
- package/dist/runtime/tool-policy-runtime.d.ts +2 -2
- package/dist/runtime/tool-policy-runtime.d.ts.map +1 -1
- package/dist/runtime/tool-policy-runtime.js +3 -3
- package/dist/runtime/tool-policy-runtime.js.map +1 -1
- package/dist/session-adapter.d.ts +17 -0
- package/dist/session-adapter.d.ts.map +1 -0
- package/dist/session-adapter.js +57 -0
- package/dist/session-adapter.js.map +1 -0
- package/dist/slot-renderers.d.ts +16 -3
- package/dist/slot-renderers.d.ts.map +1 -1
- package/dist/slot-renderers.js +15 -63
- package/dist/slot-renderers.js.map +1 -1
- package/dist/stack-migration.d.ts +6 -0
- package/dist/stack-migration.d.ts.map +1 -1
- package/dist/stack-migration.js +49 -52
- package/dist/stack-migration.js.map +1 -1
- package/dist/subagent/fingerprints.d.ts +24 -0
- package/dist/subagent/fingerprints.d.ts.map +1 -0
- package/dist/subagent/fingerprints.js +81 -0
- package/dist/subagent/fingerprints.js.map +1 -0
- package/dist/subagent/host-port.d.ts +296 -0
- package/dist/subagent/host-port.d.ts.map +1 -0
- package/dist/subagent/host-port.js +560 -0
- package/dist/subagent/host-port.js.map +1 -0
- package/dist/subagent/index.d.ts +10 -10
- package/dist/subagent/index.d.ts.map +1 -1
- package/dist/subagent/index.js +9 -10
- package/dist/subagent/index.js.map +1 -1
- package/dist/subagent-host.d.ts +99 -18
- package/dist/subagent-host.d.ts.map +1 -1
- package/dist/subagent-host.js +143 -146
- package/dist/subagent-host.js.map +1 -1
- package/dist/template-render.d.ts +18 -0
- package/dist/template-render.d.ts.map +1 -0
- package/dist/template-render.js +232 -0
- package/dist/template-render.js.map +1 -0
- package/dist/types.d.ts +40 -27
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/web-editor/client-script.generated.d.ts.map +1 -1
- package/dist/web-editor/client-script.generated.js +1 -1
- package/dist/web-editor/client-script.generated.js.map +1 -1
- package/dist/web-editor/client-styles.generated.d.ts.map +1 -1
- package/dist/web-editor/client-styles.generated.js +1 -1
- package/dist/web-editor/client-styles.generated.js.map +1 -1
- package/dist/web-editor/server.d.ts.map +1 -1
- package/dist/web-editor/server.js +1 -68
- package/dist/web-editor/server.js.map +1 -1
- package/dist/web-editor/styles.d.ts.map +1 -1
- package/dist/web-editor/styles.js +13 -0
- package/dist/web-editor/styles.js.map +1 -1
- package/dist/web-editor/types.d.ts +0 -35
- package/dist/web-editor/types.d.ts.map +1 -1
- package/dist/web-host.d.ts +4 -2
- package/dist/web-host.d.ts.map +1 -1
- package/dist/web-host.js +32 -103
- package/dist/web-host.js.map +1 -1
- package/dist/workspace.d.ts +74 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +351 -0
- package/dist/workspace.js.map +1 -0
- package/docs/README.md +6 -4
- package/docs/concepts/agent-profiles.md +1 -1
- package/docs/concepts/prompt-stacks.md +5 -5
- package/docs/design/README.md +21 -3
- package/docs/design/architecture-0.5.md +211 -0
- package/docs/design/archive/0.5-full-proposal/0.5-consumer-audit.md +62 -0
- package/docs/design/archive/0.5-full-proposal/0.5-inventory.md +208 -0
- package/docs/design/archive/0.5-full-proposal/0.5-phase0-decision-drafts.md +237 -0
- package/docs/design/archive/0.5-full-proposal/README.md +12 -0
- package/docs/design/archive/0.5-full-proposal/architecture-0.5.md +423 -0
- package/docs/design/archive/0.5-full-proposal/host-discovery-spike.md +103 -0
- package/docs/design/archive/0.5-full-proposal/template-language-spike.md +156 -0
- package/docs/design/context-diff-plan.md +72 -0
- package/docs/design/decision-template.md +33 -0
- package/docs/design/roadmap-0.4-archive.md +1 -1
- package/docs/design/subagents/interface-design.md +1 -1
- package/docs/development/architecture-rules.md +148 -0
- package/docs/development/roadmap.md +37 -5
- package/docs/development/scoped-global-profiles-stacks.md +1 -1
- package/docs/development/setup.md +6 -4
- package/docs/getting-started.md +5 -4
- package/docs/guides/custom-macros-and-slots.md +8 -7
- package/docs/guides/debugging.md +1 -1
- package/docs/guides/delegation.md +18 -22
- package/docs/guides/migrating-to-0.5.md +107 -0
- package/docs/guides/use-cases.md +7 -11
- package/docs/guides/web-editor.md +5 -9
- package/docs/reference/commands.md +4 -3
- package/docs/reference/configuration.md +17 -18
- package/docs/reference/features.md +34 -80
- package/docs/reference/macros-and-slots.md +70 -49
- package/docs/reference/public-api.md +64 -17
- package/docs/reference/stack-schema.md +14 -9
- package/docs/reference/subagent-host-port.md +49 -0
- package/docs/zh-CN/README.md +3 -3
- package/docs/zh-CN/concepts/agent-profiles.md +1 -1
- package/docs/zh-CN/concepts/prompt-stacks.md +4 -4
- package/docs/zh-CN/getting-started.md +3 -2
- package/docs/zh-CN/guides/delegation.md +10 -12
- package/docs/zh-CN/guides/migrating-to-0.5.md +92 -0
- package/docs/zh-CN/guides/web-editor.md +4 -4
- package/docs/zh-CN/reference/commands.md +3 -2
- package/examples/custom-system-status-extension/README.md +3 -3
- package/examples/custom-system-status-extension/index.ts +2 -1
- package/examples/custom-system-status-extension/prompt-stack.json +4 -3
- package/examples/default-prompt-stack.json +9 -4
- package/examples/image-reader-prompt-stack.json +16 -26
- package/examples/reviewer-prompt-stack.json +13 -24
- package/package.json +101 -120
- package/dist/runtime/subagent-runtime.d.ts +0 -45
- package/dist/runtime/subagent-runtime.d.ts.map +0 -1
- package/dist/runtime/subagent-runtime.js +0 -343
- package/dist/runtime/subagent-runtime.js.map +0 -1
- package/dist/runtime-state.d.ts +0 -30
- package/dist/runtime-state.d.ts.map +0 -1
- package/dist/runtime-state.js +0 -17
- package/dist/runtime-state.js.map +0 -1
- package/dist/sillytavern-importer/items.d.ts +0 -3
- package/dist/sillytavern-importer/items.d.ts.map +0 -1
- package/dist/sillytavern-importer/items.js +0 -88
- package/dist/sillytavern-importer/items.js.map +0 -1
- package/dist/sillytavern-importer/macros.d.ts +0 -15
- package/dist/sillytavern-importer/macros.d.ts.map +0 -1
- package/dist/sillytavern-importer/macros.js +0 -141
- package/dist/sillytavern-importer/macros.js.map +0 -1
- package/dist/sillytavern-importer/prompt-order.d.ts +0 -6
- package/dist/sillytavern-importer/prompt-order.d.ts.map +0 -1
- package/dist/sillytavern-importer/prompt-order.js +0 -38
- package/dist/sillytavern-importer/prompt-order.js.map +0 -1
- package/dist/sillytavern-importer/regex.d.ts +0 -3
- package/dist/sillytavern-importer/regex.d.ts.map +0 -1
- package/dist/sillytavern-importer/regex.js +0 -275
- package/dist/sillytavern-importer/regex.js.map +0 -1
- package/dist/sillytavern-importer/report.d.ts +0 -21
- package/dist/sillytavern-importer/report.d.ts.map +0 -1
- package/dist/sillytavern-importer/report.js +0 -166
- package/dist/sillytavern-importer/report.js.map +0 -1
- package/dist/sillytavern-importer/types.d.ts +0 -106
- package/dist/sillytavern-importer/types.d.ts.map +0 -1
- package/dist/sillytavern-importer/types.js +0 -2
- package/dist/sillytavern-importer/types.js.map +0 -1
- package/dist/sillytavern-importer.d.ts +0 -5
- package/dist/sillytavern-importer.d.ts.map +0 -1
- package/dist/sillytavern-importer.js +0 -117
- package/dist/sillytavern-importer.js.map +0 -1
- package/dist/subagent/canonical.d.ts +0 -22
- package/dist/subagent/canonical.d.ts.map +0 -1
- package/dist/subagent/canonical.js +0 -24
- package/dist/subagent/canonical.js.map +0 -1
- package/dist/subagent/context.d.ts +0 -8
- package/dist/subagent/context.d.ts.map +0 -1
- package/dist/subagent/context.js +0 -125
- package/dist/subagent/context.js.map +0 -1
- package/dist/subagent/contract.d.ts +0 -10
- package/dist/subagent/contract.d.ts.map +0 -1
- package/dist/subagent/contract.js +0 -10
- package/dist/subagent/contract.js.map +0 -1
- package/dist/subagent/plan.d.ts +0 -18
- package/dist/subagent/plan.d.ts.map +0 -1
- package/dist/subagent/plan.js +0 -157
- package/dist/subagent/plan.js.map +0 -1
- package/dist/subagent/preflight.d.ts +0 -4
- package/dist/subagent/preflight.d.ts.map +0 -1
- package/dist/subagent/preflight.js +0 -108
- package/dist/subagent/preflight.js.map +0 -1
- package/dist/subagent/request.d.ts +0 -4
- package/dist/subagent/request.d.ts.map +0 -1
- package/dist/subagent/request.js +0 -154
- package/dist/subagent/request.js.map +0 -1
- package/dist/subagent/response.d.ts +0 -8
- package/dist/subagent/response.d.ts.map +0 -1
- package/dist/subagent/response.js +0 -155
- package/dist/subagent/response.js.map +0 -1
- package/dist/subagent/tools.d.ts +0 -4
- package/dist/subagent/tools.d.ts.map +0 -1
- package/dist/subagent/tools.js +0 -42
- package/dist/subagent/tools.js.map +0 -1
- package/dist/subagent/types.d.ts +0 -272
- package/dist/subagent/types.d.ts.map +0 -1
- package/dist/subagent/types.js +0 -3
- package/dist/subagent/types.js.map +0 -1
- package/dist/subagent/validation.d.ts +0 -35
- package/dist/subagent/validation.d.ts.map +0 -1
- package/dist/subagent/validation.js +0 -314
- package/dist/subagent/validation.js.map +0 -1
- package/dist/subagent-command.d.ts +0 -5
- package/dist/subagent-command.d.ts.map +0 -1
- package/dist/subagent-command.js +0 -249
- package/dist/subagent-command.js.map +0 -1
- package/dist/subagent-profile-tool.d.ts +0 -49
- package/dist/subagent-profile-tool.d.ts.map +0 -1
- package/dist/subagent-profile-tool.js +0 -125
- package/dist/subagent-profile-tool.js.map +0 -1
- package/dist/subagent-tool.d.ts +0 -77
- package/dist/subagent-tool.d.ts.map +0 -1
- package/dist/subagent-tool.js +0 -559
- package/dist/subagent-tool.js.map +0 -1
- package/docs/guides/sillytavern-import.md +0 -47
- package/docs/reference/subagent-adapter.md +0 -204
- package/examples/sillytavern-dm-writer-prompt-stack.json +0 -190
package/docs/getting-started.md
CHANGED
|
@@ -70,11 +70,12 @@ Profiles live in `.pi/forge/agent-profiles/*.json` by default; `/profile save gl
|
|
|
70
70
|
|---|---|
|
|
71
71
|
| `.pi/forge/prompt-stacks/` | Project prompt stacks |
|
|
72
72
|
| `.pi/forge/agent-profiles/` | Project agent profiles |
|
|
73
|
-
| `.pi/forge/config.json` | Trusted project configuration
|
|
73
|
+
| `.pi/forge/config.json` | Trusted project configuration (`webEditor.*`) |
|
|
74
74
|
| `.pi/forge/extensions/` | Trusted project macro/slot registration code |
|
|
75
75
|
| `~/.pi/forge/prompt-stacks/` | User-global prompt stacks |
|
|
76
76
|
| `~/.pi/forge/agent-profiles/` | User-global agent profiles |
|
|
77
|
-
| `~/.pi/forge/config.json` | User defaults
|
|
77
|
+
| `~/.pi/forge/config.json` | User defaults (`webEditor.*`) |
|
|
78
|
+
| `.pi/forge/subagents.json` / `~/.pi/forge/subagents.json` | Delegation authorization owned by the optional `@zihanw/pi-forge-subagents` package |
|
|
78
79
|
| `~/.pi/forge/extensions/` | Trusted user macro/slot registration code |
|
|
79
80
|
|
|
80
81
|
Legacy `.pi/prompt-stacks/*.json` files remain readable. Command-created stacks go to `.pi/forge/prompt-stacks`; use the web editor's `global` scope selector to create stacks in `~/.pi/forge/prompt-stacks`. Same-named new-location files shadow legacy ones. Migrate safely with:
|
|
@@ -89,7 +90,7 @@ Add `--overwrite` only when target replacement is intended. Add `--delete-legacy
|
|
|
89
90
|
## Where to go next
|
|
90
91
|
|
|
91
92
|
- Learn the [prompt-stack model](concepts/prompt-stacks.md).
|
|
92
|
-
- Fork a [focused reviewer](../examples/reviewer-prompt-stack.json)
|
|
93
|
-
- Use the [SillyTavern importer](guides/sillytavern-import.md).
|
|
93
|
+
- Fork a [focused reviewer](../examples/reviewer-prompt-stack.json).
|
|
94
94
|
- Learn [macros and slots](reference/macros-and-slots.md).
|
|
95
|
+
- Read the [0.5 migration guide](guides/migrating-to-0.5.md).
|
|
95
96
|
- Inspect the [complete commands](reference/commands.md) and [stack schema](reference/stack-schema.md).
|
|
@@ -15,8 +15,9 @@ Modules receive the pi-forge API directly, so they do not need to import the pac
|
|
|
15
15
|
export default function register(api) {
|
|
16
16
|
api.registerMacro({
|
|
17
17
|
name: "ticketId",
|
|
18
|
-
description: "Current ticket id from
|
|
19
|
-
|
|
18
|
+
description: "Current ticket id from static parameters.",
|
|
19
|
+
dependencies: ["parameters.ticket.id"],
|
|
20
|
+
render: ({ env, helpers }) => String(env.parameters["ticket.id"]),
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
api.registerSlot({
|
|
@@ -25,10 +26,10 @@ export default function register(api) {
|
|
|
25
26
|
options: {
|
|
26
27
|
heading: { type: "string", default: "Ticket context" },
|
|
27
28
|
},
|
|
28
|
-
render: (
|
|
29
|
-
String(
|
|
30
|
-
"- Ticket: " +
|
|
31
|
-
"- Project: " +
|
|
29
|
+
render: ({ item, options, env, helpers }) => [
|
|
30
|
+
String(options.heading ?? "Ticket context") + ":",
|
|
31
|
+
"- Ticket: " + String(env.parameters["ticket.id"]),
|
|
32
|
+
"- Project: " + helpers.normalizePath(String(env.runtime.cwd)),
|
|
32
33
|
].join("\n"),
|
|
33
34
|
});
|
|
34
35
|
}
|
|
@@ -57,7 +58,7 @@ Use the slot declaratively:
|
|
|
57
58
|
- Missing custom slots are validation warnings until their module is loaded.
|
|
58
59
|
- Registration ownership is disposed when the runtime shuts down.
|
|
59
60
|
|
|
60
|
-
The API provides `
|
|
61
|
+
The API provides `forgeDir`, `extensionPath`, helpers, registration functions, and `getRegisteredMacros()` / `getRegisteredSlots()`. Custom macro renderers receive a frozen `{ env, helpers }` and dependencies from the declaration. Global `forgeDir` is `~/.pi/forge`; project `forgeDir` is `<project>/.pi/forge`.
|
|
61
62
|
|
|
62
63
|
Reusable Pi packages may import `registerMacro` and `registerSlot` from `@zihanw/pi-forge`. The directory loaders are intended for small trusted customizations without package boilerplate.
|
|
63
64
|
|
package/docs/guides/debugging.md
CHANGED
|
@@ -30,7 +30,7 @@ Saved payloads can contain prompt and conversation content. Keep them out of ver
|
|
|
30
30
|
|
|
31
31
|
## Common checks
|
|
32
32
|
|
|
33
|
-
- Unexpected duplicate task: set the `chat-history` slot's `includeLastUserMessage` to `false` when a later block uses `{{lastUserMessage}}`.
|
|
33
|
+
- Unexpected duplicate task: set the `chat-history` slot's `includeLastUserMessage` to `false` when a later block uses `{{ runtime.lastUserMessage }}`.
|
|
34
34
|
- Missing tool: inspect stack `allow`/`deny` policy and `/preset status`; the tool-call guard enforces the selected stack even if another extension modifies active tools.
|
|
35
35
|
- Skill still visible: use `replace` mode when Pi's base prompt must not include its own skill listing.
|
|
36
36
|
- Missing custom slot: trust the project, check `.pi/forge/extensions`, reload, and inspect diagnostics.
|
|
@@ -4,33 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
> **Experimental:** This API and its backends may change independently of stable prompt-stack and profile behavior.
|
|
6
6
|
|
|
7
|
-
pi-forge
|
|
7
|
+
The optional `@zihanw/pi-forge-subagents` package executes an explicitly authorized agent profile as a separate, clean, one-shot Pi process. It runs in the foreground and returns a bounded report to the parent conversation.
|
|
8
8
|
|
|
9
9
|
## Enable a profile
|
|
10
10
|
|
|
11
|
-
Profiles are not delegatable by default. Enable each eligible ID in the trusted project's `.pi/forge/
|
|
11
|
+
Profiles are not delegatable by default. Enable each eligible ID in the trusted project's `.pi/forge/subagents.json`:
|
|
12
12
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"timeoutMs": 180000
|
|
27
|
-
}
|
|
15
|
+
"backend": "pi-subprocess-readonly",
|
|
16
|
+
"timeoutMs": 60000,
|
|
17
|
+
"profiles": {
|
|
18
|
+
"reviewer": {
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"timeoutMs": 300000
|
|
21
|
+
},
|
|
22
|
+
"rpc-reviewer": {
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"backend": "pi-rpc-readonly",
|
|
25
|
+
"timeoutMs": 180000
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
Enablement follows the profile's scope. A global `~/.pi/forge/
|
|
31
|
+
Legacy `.pi/forge/config.json.subagents` is accepted as read-only fallback with a warning. Enablement follows the profile's scope. A global `~/.pi/forge/subagents.json` may define general `backend` and `timeoutMs` defaults and may authorize `global:<id>` profiles through its own `profiles` map. The trusted project's `subagents.json` authorizes `project:<id>` profiles. Same-ID global and project profiles never inherit enablement, backend, or timeout policy from one another. Disabled or unlisted profiles are hidden from discovery and rejected even if guessed.
|
|
34
32
|
|
|
35
33
|
## Discover, plan, and run
|
|
36
34
|
|
|
@@ -49,7 +47,7 @@ Profile selectors accept the same grammar everywhere: `reviewer` (project first)
|
|
|
49
47
|
|
|
50
48
|
The parent model uses `forge_subagent_profiles` to discover enabled profiles and `forge_subagent` to invoke one. A restrictive parent stack must allow both tool names. Discovery is local/no-egress and reports metadata, resolution readiness, effective backend/timeout, approval mode, and whether parent tool policy permits invocation.
|
|
51
49
|
|
|
52
|
-
Projects with only a few frequently used profiles can set `
|
|
50
|
+
Projects with only a few frequently used profiles can set `summaryInToolDescription: true` (global or trusted-project `subagents.json`). The `forge_subagent` tool description then carries a compact summary of enabled profiles—id, model, thinking level, stack, backend, and timeout—so the parent model does not need a discovery call to pick a profile. Ready profiles appear first; unavailable enabled profiles remain visible with their first resolution error so the model knows not to invoke them. The summary rides in every request, is capped at 8 profiles and 1,000 characters, and refreshes with profiles, stacks, and configuration; `forge_subagent_profiles` remains the authoritative full-detail surface.
|
|
53
51
|
|
|
54
52
|
## Parallel invocation
|
|
55
53
|
|
|
@@ -74,13 +72,11 @@ To authorize the parent model without per-run approval:
|
|
|
74
72
|
|
|
75
73
|
```json
|
|
76
74
|
{
|
|
77
|
-
"
|
|
78
|
-
"allowAgentInvocationWithoutApproval": true
|
|
79
|
-
}
|
|
75
|
+
"allowAgentInvocationWithoutApproval": true
|
|
80
76
|
}
|
|
81
77
|
```
|
|
82
78
|
|
|
83
|
-
This affects only `forge_subagent`; `/forge-agent run` remains interactive. It is ignored in untrusted projects and malformed values fail closed. Treat this project
|
|
79
|
+
This affects only `forge_subagent`; `/forge-agent run` remains interactive. It is ignored in untrusted projects and malformed values fail closed. Treat this project `subagents.json` as an authorization file: do not enable or commit it unless every parent agent allowed to call `forge_subagent` may send the compiled prompt and readable file contents to the selected provider without asking again.
|
|
84
80
|
|
|
85
81
|
## Child context and output
|
|
86
82
|
|
|
@@ -104,4 +100,4 @@ The current backends are **shared-user, not operating-system sandboxes**.
|
|
|
104
100
|
|
|
105
101
|
The default tools intentionally provide no mutation path. Do not add write, edit, or shell access to this shared-user design. OS isolation and separately approved staged writes remain future work.
|
|
106
102
|
|
|
107
|
-
For integration authors, see the [
|
|
103
|
+
For integration authors, see the [subagent host port contract](../reference/subagent-host-port.md).
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Migrating to pi-forge 0.5
|
|
2
|
+
|
|
3
|
+
[Documentation](../README.md)
|
|
4
|
+
|
|
5
|
+
0.5.0 is a breaking cleanup release. This page is the migration note for the
|
|
6
|
+
changes landed so far (Lane 1a-1c plus the compiler/extension conformance
|
|
7
|
+
pass in Lane 1d).
|
|
8
|
+
|
|
9
|
+
## What was removed
|
|
10
|
+
|
|
11
|
+
- SillyTavern importer (`/preset import-silly`), its reports, guide, example,
|
|
12
|
+
and tests. Convert SillyTavern presets with pi-forge 0.4 before upgrading.
|
|
13
|
+
- Mutable turn/session variables, variable mutation macros,
|
|
14
|
+
`pi-forge-variable-state` session entries, and the `variables` slot.
|
|
15
|
+
- Regex `display` and `both` effects; `outgoing` and `finalize` remain.
|
|
16
|
+
|
|
17
|
+
## Template syntax changes
|
|
18
|
+
|
|
19
|
+
Prompt text now compiles with the closed `forge-v1` grammar.
|
|
20
|
+
|
|
21
|
+
| 0.4 construct | 0.5 forge-v1 |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `{{name}}` (static) | `{{ parameters.name }}` |
|
|
24
|
+
| `{{lastUserMessage}}` | `{{ runtime.lastUserMessage }}` |
|
|
25
|
+
| `{{date}}` / `{{time}}` / `{{cwd}}` | `{{ runtime.date }}` / `{{ runtime.time }}` / `{{ runtime.cwd }}` |
|
|
26
|
+
| `{{tools}}` | `{{ runtime.selectedToolsText }}` |
|
|
27
|
+
| `{{upper::x}}` | `{{ x \| upper }}` |
|
|
28
|
+
| `{{iftools::bash::A::B}}` | `{% if runtime.tool.bash %}A{% else %}B{% endif %}` |
|
|
29
|
+
| custom `{{myMacro}}` | `{{ extensions.myMacro }}` |
|
|
30
|
+
|
|
31
|
+
Unknown paths, unknown filters, parse errors, cycles, and output-limit breaches
|
|
32
|
+
are compile errors; a failing block is omitted instead of re-injecting raw
|
|
33
|
+
template text.
|
|
34
|
+
|
|
35
|
+
## Schema v2
|
|
36
|
+
|
|
37
|
+
Schema v2 stacks store immutable static values in `parameters` (JSON-compatible)
|
|
38
|
+
instead of the legacy string-only `variables` field:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"schemaVersion": 2,
|
|
43
|
+
"parameters": { "char": "Konata" }
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Unversioned / v1 stacks continue to load through the legacy `variables` reader.
|
|
48
|
+
|
|
49
|
+
## Running the migration utility
|
|
50
|
+
|
|
51
|
+
A mechanical, diagnostics-first script converts a saved stack file:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
node scripts/migrate-stack-v2.mjs .pi/forge/prompt-stacks/default.json --dry-run
|
|
55
|
+
node scripts/migrate-stack-v2.mjs .pi/forge/prompt-stacks/default.json --write
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
It renames `variables` to `parameters`, maps runtime/parameter paths, and
|
|
59
|
+
converts simple filter pipelines. Non-mechanical constructs are reported and
|
|
60
|
+
the file is only written when they are absent. A schema v2 file that still
|
|
61
|
+
contains a legacy `variables` field is left untouched and only warned about.
|
|
62
|
+
|
|
63
|
+
## Preview and finalize
|
|
64
|
+
|
|
65
|
+
Preview never applies `finalize`; it now reports an informational diagnostic.
|
|
66
|
+
`finalize` remains a destructive, lifecycle-owned transform that replaces the
|
|
67
|
+
stored assistant message.
|
|
68
|
+
|
|
69
|
+
## Lane 2: scoped global profiles and prompt stacks
|
|
70
|
+
|
|
71
|
+
- User-global resources now live in `~/.pi/forge/prompt-stacks` and `~/.pi/forge/agent-profiles` alongside the project stores. Profile and stack selectors accept explicit scopes: `project:<id>`, `global:<id>`, with bare IDs resolving project-first.
|
|
72
|
+
- Same-ID project resources shadow their global counterparts; global stacks cannot reference project resources (and vice versa) — references resolve within the referenced resource's scope.
|
|
73
|
+
- Untrusted projects fail closed: only global resources load, all mutation routes are rejected, and `session_shutdown` no longer disposes a trusted workspace while sessions may still be active (idle workspaces are swept after an hour; hosts stop independently).
|
|
74
|
+
- The web editor gained scope selectors for creating stacks/profiles into either store and routes global mutations through explicit `global:<id>` selectors.
|
|
75
|
+
|
|
76
|
+
## Lane 3: subagent package split
|
|
77
|
+
|
|
78
|
+
Subagent execution moved out of the main package into the optional `@zihanw/pi-forge-subagents` package (requires `@zihanw/pi-forge@^0.5.0`). Install it separately to keep foreground delegation.
|
|
79
|
+
|
|
80
|
+
- **Commands:** `/subagents` and `/subagent-run` were removed from the main package. The optional package registers `/forge-agent backends|plan|run`.
|
|
81
|
+
- **Model tools:** `forge_subagent_profiles` and `forge_subagent` are registered by the optional package.
|
|
82
|
+
- **Configuration:** `subagents.*` moved out of `.pi/forge/config.json` into dedicated `.pi/forge/subagents.json` (trusted project) and `~/.pi/forge/subagents.json` (user defaults). The optional package reads legacy `config.json.subagents` sections as a read-only fallback with a warning; it never writes them. Copy the values into `subagents.json` to silence the warning.
|
|
83
|
+
- **Web editor:** the delegation card was removed from the main editor; edit `subagents.json` directly.
|
|
84
|
+
- **Architecture:** the main package's prompt compiler is host-neutral (no subagent assumptions), and `ForgeWorkspace` is the single owner of resource state and compilation contexts.
|
|
85
|
+
|
|
86
|
+
## Lane 4: Forge-native host contract and public surface
|
|
87
|
+
|
|
88
|
+
- The main package no longer depends on `@zihanw/pi-subagent-runtime` and no longer exports the 0.4 execution contract. That contract (`AgentRequest`, `createAgentExecutionPlan`, `validateAgentRequest`, `negotiateSubagentTools`, preflight/plan/response validators, …) now lives in `@zihanw/pi-forge-subagents` for its own runtime wiring; it is not a public surface of either package for third-party consumers.
|
|
89
|
+
- `@zihanw/pi-forge/subagent` now exports only the versioned host port: wire DTOs and validators, `ForgeHostTransport`, `ForgeHost`/`ForgeHostClient`, lifecycle constants, and the Forge-owned canonical fingerprint helpers. `resolveSubagentHostProfile` / `prepareSubagentHostPlan` were replaced by the host-port operations `resolveProfile` and `prepare`.
|
|
90
|
+
- The package root exports only the default extension factory, `registerMacro`/`registerSlot`, and their contract types. All other root re-exports (loader, agent-profile, profile-service, catalog, resource-identity, render-helper values, the `forge-v1` engine, registry readers) were removed.
|
|
91
|
+
- All `@zihanw/pi-forge/src/*` subpath aliases and the `./examples/*` export were removed; `check-package` rejects them.
|
|
92
|
+
|
|
93
|
+
### Import migration table
|
|
94
|
+
|
|
95
|
+
| 0.4 import | 0.5 replacement |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `@zihanw/pi-forge` (default, `registerMacro`, `registerSlot`) | unchanged |
|
|
98
|
+
| `@zihanw/pi-forge/subagent` host-port names (`ForgeHost*`, validators, fingerprints) | unchanged |
|
|
99
|
+
| `@zihanw/pi-forge/subagent` execution contract (`AgentRequest`, `createAgentExecutionPlan`, …) | internal to `@zihanw/pi-forge-subagents`; no public replacement |
|
|
100
|
+
| `@zihanw/pi-forge/subagent` `resolveSubagentHostProfile` / `prepareSubagentHostPlan` | host-port operations via `ForgeHostClient` |
|
|
101
|
+
| `@zihanw/pi-forge/src/*` aliases | removed; no replacement (internals) |
|
|
102
|
+
| root loader/profile/catalog/engine re-exports | removed; no replacement (internals) |
|
|
103
|
+
|
|
104
|
+
## Compatibility notes
|
|
105
|
+
|
|
106
|
+
- The wire shape of the host port is additive across `FORGE_HOST_PORT_VERSION = 1`; unknown operations are rejected with a plain `{ ok: false, error }` result (`"Unknown Forge host operation: …"`), not a thrown error, and optional packages must treat any operation failure as terminal for that request.
|
|
107
|
+
- Vendored fingerprint helpers in the main package are pinned by golden vectors to stay byte-compatible with `@zihanw/pi-subagent-runtime` canonical serialization; plan sealing still happens only in the optional package.
|
package/docs/guides/use-cases.md
CHANGED
|
@@ -9,21 +9,21 @@ Use these as starting patterns rather than rigid templates. The [default Pi mirr
|
|
|
9
9
|
Put long-lived character rules in a system block, runtime context in appropriate slots, and the current user action in an explicit final user block:
|
|
10
10
|
|
|
11
11
|
1. System character/personality block.
|
|
12
|
-
2. Tools, project context,
|
|
12
|
+
2. Tools, project context, and other runtime slots.
|
|
13
13
|
3. `chat-history` with `includeLastUserMessage: false`.
|
|
14
|
-
4. Final user block containing `{{lastUserMessage}}`.
|
|
14
|
+
4. Final user block containing `{{ runtime.lastUserMessage }}`.
|
|
15
15
|
|
|
16
|
-
This keeps the latest request clear and avoids duplication. Static `{{char}}` / `{{user}}`
|
|
16
|
+
This keeps the latest request clear and avoids duplication. Static `{{ parameters.char }}` / `{{ parameters.user }}` values work well for character constants. Durable project memory belongs in project files, not parameters.
|
|
17
17
|
|
|
18
18
|
## Focused code review
|
|
19
19
|
|
|
20
20
|
Start from [the reviewer example](../../examples/reviewer-prompt-stack.json). It denies writing tools, wraps prior history as background, omits the latest user message from history, then reinserts it as the explicit review target.
|
|
21
21
|
|
|
22
|
-
Use a rule such as “prioritize correctness, regressions, security, and missing tests.” Keep tools, project context,
|
|
22
|
+
Use a rule such as “prioritize correctness, regressions, security, and missing tests.” Keep tools, project context, and history when the reviewer must inspect the repository. Use `append` to retain Pi's normal coding prompt, or `replace` when the stack must fully control prompt and skill visibility.
|
|
23
23
|
|
|
24
24
|
## Translation mode
|
|
25
25
|
|
|
26
|
-
Create a small stack with a system block for target language, register/tone, and terminology rules. Retain history and a final `{{lastUserMessage}}`. Separate literal translation, localization review, and bilingual editing into different stacks when their rules conflict.
|
|
26
|
+
Create a small stack with a system block for target language, register/tone, and terminology rules. Retain history and a final `{{ runtime.lastUserMessage }}`. Separate literal translation, localization review, and bilingual editing into different stacks when their rules conflict.
|
|
27
27
|
|
|
28
28
|
## Multi-mode switching
|
|
29
29
|
|
|
@@ -48,13 +48,9 @@ Tool policy constrains model tool calls but is not an operating-system sandbox.
|
|
|
48
48
|
|
|
49
49
|
Keep the Pi mirror, require the tools needed for the workflow, strip prior assistant thinking from inserted history, and move project context near the current user turn. This reduces distracting prompt material without removing relevant repository instructions.
|
|
50
50
|
|
|
51
|
-
## SillyTavern DM writer
|
|
52
|
-
|
|
53
|
-
[The DM-writer example](../../examples/sillytavern-dm-writer-prompt-stack.json) defines a Dungeon Master through `{{char}}` / `{{user}}`, wraps prior adventure history, reinserts the current action, and uses deterministic regex cleanup for OOC notes, secret-roll markers, dice notation, and `Player:` prefixes.
|
|
54
|
-
|
|
55
51
|
## Payload lab
|
|
56
52
|
|
|
57
|
-
Include `active-model
|
|
53
|
+
Include `active-model` and `date-cwd`, then add compiled regex rules for deterministic redaction or formatting. Pair the stack with `/payload next` or the web editor's capture view to audit exactly what changed.
|
|
58
54
|
|
|
59
55
|
## Pi-docs expert
|
|
60
56
|
|
|
@@ -62,4 +58,4 @@ Allow read/search tools, include the `pi-docs` and project-context slots, and ke
|
|
|
62
58
|
|
|
63
59
|
## Trusted runtime status
|
|
64
60
|
|
|
65
|
-
The [custom system-status example](../../examples/custom-system-status-extension/README.md) registers `{{cpuLoad}}` and a `machine-status` slot from trusted project code. Use this pattern for deterministic host data that cannot be represented as static stack JSON.
|
|
61
|
+
The [custom system-status example](../../examples/custom-system-status-extension/README.md) registers `{{ extensions.cpuLoad }}` and a `machine-status` slot from trusted project code. Use this pattern for deterministic host data that cannot be represented as static stack JSON.
|
|
@@ -38,30 +38,26 @@ The stack workspace provides:
|
|
|
38
38
|
- validation and a full compiled preview;
|
|
39
39
|
- registered-tool and loaded-skill search with exact-name chips and wildcard patterns;
|
|
40
40
|
- raw JSON recovery for advanced or unknown fields;
|
|
41
|
-
- native pi-forge
|
|
41
|
+
- native pi-forge JSON import;
|
|
42
42
|
- export, fork, and deletion;
|
|
43
43
|
- payload arming and redacted captured-payload inspection;
|
|
44
44
|
- light and dark themes.
|
|
45
45
|
|
|
46
46
|
Existing IDs are immutable during edit. Use **Fork** to create a different ID without breaking profile references or the active selection. The toolbar scope selector (default `project`) chooses where new stacks, imports, and forks are written: `global` targets the user-global `~/.pi/forge/prompt-stacks`, `project` targets `.pi/forge/prompt-stacks`. Stack rows show a `global` badge, and save/delete routes use `global:<id>` for exact global mutations. Legacy stacks remain editable in place.
|
|
47
47
|
|
|
48
|
-
Saves, imports, forks, and deletes reload stack state into the current Pi session. When another surface changes a referenced stack, returning to profiles refreshes profile resolution
|
|
48
|
+
Saves, imports, forks, and deletes reload stack state into the current Pi session. When another surface changes a referenced stack, returning to profiles refreshes profile resolution.
|
|
49
49
|
|
|
50
50
|
## Agent-profile workspace
|
|
51
51
|
|
|
52
|
-
The profile list shows each profile's ID, display metadata, model, thinking level, stack, resolution state, auto-activation, last-applied provenance,
|
|
52
|
+
The profile list shows each profile's ID, display metadata, model, thinking level, stack, resolution state, auto-activation, last-applied provenance, and a `project`/`global` scope badge. Same-ID shadow pairs are marked `shadows global:<id>` or `shadowed by project:<id>`.
|
|
53
53
|
|
|
54
54
|
Trusted projects can create profiles in either scope: the scope selector beside **New profile** (default `project`) chooses whether to write the user-global `~/.pi/forge/agent-profiles` or the project `.pi/forge/agent-profiles`. Global profiles can be edited, validated, saved, applied once, and deleted through explicit `global:<id>` routes; unqualified routes stay project-only. When editing a global profile, the prompt-stack dropdown offers only global stacks. Model choices come from Pi's model registry, thinking choices reflect model support, and stack choices come from the shared repository. The editor rejects a second auto-activation profile within the same scope.
|
|
55
55
|
|
|
56
56
|
The runtime/provenance card separates current runtime state, last-applied snapshot, source-definition changes, and field-level runtime drift.
|
|
57
57
|
|
|
58
|
-
## Delegation
|
|
58
|
+
## Delegation
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Unsaved delegation changes are guarded when selecting another profile, starting another profile operation, refreshing, deleting, or leaving/reloading the page. The card shows effective values and the source of each inherited or overridden setting.
|
|
63
|
-
|
|
64
|
-
Read [foreground delegation](delegation.md) before enabling a profile.
|
|
60
|
+
Delegation configuration is not part of the main editor. The optional `@zihanw/pi-forge-subagents` package owns the dedicated `.pi/forge/subagents.json` and `~/.pi/forge/subagents.json` files. Read [foreground delegation](delegation.md) before enabling a profile.
|
|
65
61
|
|
|
66
62
|
## Migration
|
|
67
63
|
|
|
@@ -23,9 +23,8 @@ Arguments in brackets are optional. Commands that write project files require a
|
|
|
23
23
|
| Command | Behavior |
|
|
24
24
|
|---|---|
|
|
25
25
|
| `/preset migrate-stacks [--dry-run] [--overwrite] [--delete-legacy]` | Copy legacy `.pi/prompt-stacks` files into `.pi/forge/prompt-stacks`. |
|
|
26
|
-
| `/preset import-silly <path> [character_id] [--dry-run] [--overwrite]` | Convert a SillyTavern preset and write a migration report. |
|
|
27
26
|
|
|
28
|
-
Use migration
|
|
27
|
+
Use migration dry runs before overwriting or deleting anything.
|
|
29
28
|
|
|
30
29
|
## Agent profiles
|
|
31
30
|
|
|
@@ -42,13 +41,15 @@ Use migration/import dry runs before overwriting or deleting anything. See [Sill
|
|
|
42
41
|
|
|
43
42
|
## Experimental foreground delegation
|
|
44
43
|
|
|
44
|
+
The commands below are provided by the optional `@zihanw/pi-forge-subagents` package.
|
|
45
|
+
|
|
45
46
|
| Command | Behavior |
|
|
46
47
|
|---|---|
|
|
47
48
|
| `/forge-agent backends` | List registered experimental backends, capabilities, and effective defaults. |
|
|
48
49
|
| `/forge-agent plan <profile> [--backend <id>] <task>` | Prepare, validate, display, and discard an exact plan without provider transport. |
|
|
49
50
|
| `/forge-agent run <profile> [--backend <id>] <task>` | Review and approve an exact foreground read-only run. |
|
|
50
51
|
|
|
51
|
-
Only
|
|
52
|
+
Only profiles explicitly authorized in the matching scope are accepted: the project `subagents.json` authorizes `project:<id>` profiles and the global `subagents.json` authorizes `global:<id>` profiles; `.pi/forge/config.json.subagents` remains a read-only legacy fallback. The model-callable equivalents are `forge_subagent_profiles` (local discovery) and `forge_subagent` (execution). See the [delegation safety guide](../guides/delegation.md).
|
|
52
53
|
|
|
53
54
|
## Payload inspection
|
|
54
55
|
|
|
@@ -18,31 +18,30 @@ The port is preferred, not guaranteed. The editor binds only to `127.0.0.1` and
|
|
|
18
18
|
|
|
19
19
|
## Experimental subagents
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Subagent configuration is owned by the optional `@zihanw/pi-forge-subagents` package. Dedicated files are `.pi/forge/subagents.json` for a trusted project and `~/.pi/forge/subagents.json` for user defaults. Legacy `.pi/forge/config.json` / `~/.pi/forge/config.json` `subagents` sections are read-only fallback material and emit a warning.
|
|
22
|
+
|
|
23
|
+
User defaults may set general settings:
|
|
22
24
|
|
|
23
25
|
```json
|
|
24
26
|
{
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"timeoutMs": 60000
|
|
28
|
-
}
|
|
27
|
+
"backend": "pi-subprocess-readonly",
|
|
28
|
+
"timeoutMs": 60000
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Trusted project
|
|
32
|
+
Trusted project `subagents.json` may override defaults, authorize individual project profile IDs, and authorize unattended model invocation:
|
|
33
33
|
|
|
34
34
|
```json
|
|
35
35
|
{
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
36
|
+
"backend": "pi-subprocess-readonly",
|
|
37
|
+
"timeoutMs": 60000,
|
|
38
|
+
"allowAgentInvocationWithoutApproval": false,
|
|
39
|
+
"summaryInToolDescription": false,
|
|
40
|
+
"profiles": {
|
|
41
|
+
"reviewer": {
|
|
42
|
+
"enabled": true,
|
|
43
|
+
"backend": "pi-rpc-readonly",
|
|
44
|
+
"timeoutMs": 180000
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
}
|
|
@@ -50,9 +49,9 @@ Trusted project configuration may override defaults, authorize individual projec
|
|
|
50
49
|
|
|
51
50
|
Valid timeouts are 1,000–3,600,000 ms. Invalid fields warn and fall back to the preceding applicable default. General backend precedence is project then user then built-in; an interactive run and a project profile entry can further override it as described in [delegation](../guides/delegation.md#backends-and-precedence).
|
|
52
51
|
|
|
53
|
-
`
|
|
52
|
+
`summaryInToolDescription` (default `false`) embeds a compact, bounded summary of enabled subagent profiles directly in the `forge_subagent` tool description so the parent model can pick a profile without a discovery call. Ready profiles appear first, and unavailable enabled profiles include their first resolution error. It may be set in user or trusted-project `subagents.json` and applies wherever it is enabled.
|
|
54
53
|
|
|
55
|
-
`profiles` in global
|
|
54
|
+
`profiles` in global `subagents.json` authorizes `global:<id>` profiles; the trusted project's `profiles` authorizes `project:<id>` profiles. Same-ID profiles never inherit enablement, backend, or timeout policy from each other. `allowAgentInvocationWithoutApproval` is project-only, requires trust, and fails closed when malformed. Deleting a profile does not modify `subagents.json`; remove any enabled entry for the deleted profile manually.
|
|
56
55
|
|
|
57
56
|
Treat project configuration as an authorization boundary. In particular, do not commit unattended delegation unless every permitted parent agent may transmit compiled prompt and readable project content without another human approval.
|
|
58
57
|
|