@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/zh-CN/README.md
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
## 指南
|
|
12
12
|
|
|
13
13
|
- [Web 编辑器](guides/web-editor.md)
|
|
14
|
+
- [迁移到 0.5](guides/migrating-to-0.5.md)
|
|
14
15
|
- [实验性前台 delegation](guides/delegation.md):启用前请先阅读安全边界。
|
|
15
16
|
- [Prompt stack 使用场景(英文)](../guides/use-cases.md)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
自定义 macros/slots 和调试的完整说明目前以英文版为准:
|
|
18
19
|
|
|
19
|
-
- [SillyTavern import](../guides/sillytavern-import.md)
|
|
20
20
|
- [Custom macros and slots](../guides/custom-macros-and-slots.md)
|
|
21
21
|
- [Prompt and payload debugging](../guides/debugging.md)
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ SillyTavern 导入、自定义 macros/slots 和调试的完整说明目前以英
|
|
|
27
27
|
- [Macros 与 slots(英文)](../reference/macros-and-slots.md)
|
|
28
28
|
- [配置(英文)](../reference/configuration.md)
|
|
29
29
|
- [Public API(英文)](../reference/public-api.md)
|
|
30
|
-
- [实验性 subagent
|
|
30
|
+
- [实验性 subagent host port(英文)](../reference/subagent-host-port.md)
|
|
31
31
|
|
|
32
32
|
## 开发与设计
|
|
33
33
|
|
|
@@ -43,4 +43,4 @@ Agent profile 是项目级或用户全局、带 schema version 的预设,只
|
|
|
43
43
|
|
|
44
44
|
`/profile status` 会把 profile 源定义变化和当前模型/思考等级/stack drift 分开显示。Provenance 只用于 branch 状态报告;reload、resume、tree navigation 和 compaction 不会重新应用 profile。
|
|
45
45
|
|
|
46
|
-
普通 profile 默认不能委派。Delegation
|
|
46
|
+
普通 profile 默认不能委派。Delegation 授权由可选包 `@zihanw/pi-forge-subagents` 通过专用文件持有:可信项目 `.pi/forge/subagents.json` 只授权 `project:<id>`,用户全局 `~/.pi/forge/subagents.json` 只授权 `global:<id>`,并可按 profile 覆盖 backend/timeout;同 ID 的全局和项目 profile 永不互相继承授权。主包不读取任何 subagent 配置,删除 profile 也不会改动 `subagents.json`。启用前见[前台 delegation](../guides/delegation.md)。
|
|
@@ -11,7 +11,7 @@ Prompt stack 是一份有序、声明式的 prompt 与策略描述,由固定 *
|
|
|
11
11
|
1. 按 JSON 顺序排列启用的 block/slot。
|
|
12
12
|
2. 构建 system 内容,并使用 `replace`、`append` 或 `prepend` 模式。
|
|
13
13
|
3. 在可移动 `chat-history` 周围插入 user/assistant 消息。
|
|
14
|
-
4.
|
|
14
|
+
4. 用 forge-v1 编译 `runtime.*` / `parameters.*` / `extensions.*` 模板。
|
|
15
15
|
5. 对 Pi 执行工具策略,并过滤 pi-forge 渲染的 skills。
|
|
16
16
|
6. 应用 history/compiled outgoing regex。
|
|
17
17
|
7. 可选地在消息完成后应用破坏性的 finalize regex。
|
|
@@ -21,7 +21,7 @@ Prompt stack 是一份有序、声明式的 prompt 与策略描述,由固定 *
|
|
|
21
21
|
1. 长期 system 规则。
|
|
22
22
|
2. 工具和项目上下文。
|
|
23
23
|
3. `includeLastUserMessage: false` 的 `chat-history`。
|
|
24
|
-
4. 包含 `{{lastUserMessage}}` 的最终 user block。
|
|
24
|
+
4. 包含 `{{ runtime.lastUserMessage }}` 的最终 user block。
|
|
25
25
|
|
|
26
26
|
这样既保留旧上下文,又只在最后明确出现一次当前请求。History 还可以过滤 summary/role、去掉旧工具消息、移除 assistant thinking,并限制消息数或字符数。
|
|
27
27
|
|
|
@@ -35,8 +35,8 @@ Prompt stack 是一份有序、声明式的 prompt 与策略描述,由固定 *
|
|
|
35
35
|
- 项目 stack 优先于全局 stack;项目 scope 存在候选时,即使项目候选无效或冲突也会 fail closed,不会回退到全局 stack。
|
|
36
36
|
- 同 ID 项目 stack 会遮蔽全局 stack,包括无效 shadow 或显式 opt-out。
|
|
37
37
|
- `/preset use none` 会记录 session branch 的 opt-out。
|
|
38
|
-
- Active stack
|
|
38
|
+
- Active stack 选择会跟随 Pi session tree branch。
|
|
39
39
|
- 恢复的 branch 状态优先于新 session 自动启用。
|
|
40
40
|
- 自动启用的 agent profile 优先于独立 stack autoload。
|
|
41
41
|
|
|
42
|
-
完整字段见英文 [stack schema](../../reference/stack-schema.md)
|
|
42
|
+
完整字段见英文 [stack schema](../../reference/stack-schema.md)(schema v2 使用 `parameters`),模板语法见[参考](../../reference/macros-and-slots.md)。
|
|
@@ -64,11 +64,12 @@ Profile 默认保存在 `.pi/forge/agent-profiles/*.json`。`/profile save globa
|
|
|
64
64
|
|---|---|
|
|
65
65
|
| `.pi/forge/prompt-stacks/` | 项目 prompt stacks |
|
|
66
66
|
| `.pi/forge/agent-profiles/` | 项目 agent profiles |
|
|
67
|
-
| `.pi/forge/config.json` |
|
|
67
|
+
| `.pi/forge/config.json` | 项目配置(`webEditor.*`) |
|
|
68
68
|
| `.pi/forge/extensions/` | 可信项目 macro/slot 代码 |
|
|
69
69
|
| `~/.pi/forge/prompt-stacks/` | 用户全局 prompt stacks |
|
|
70
70
|
| `~/.pi/forge/agent-profiles/` | 用户全局 agent profiles |
|
|
71
|
-
| `~/.pi/forge/config.json` |
|
|
71
|
+
| `~/.pi/forge/config.json` | 用户默认配置(`webEditor.*`) |
|
|
72
|
+
| `.pi/forge/subagents.json` / `~/.pi/forge/subagents.json` | 由可选包 `@zihanw/pi-forge-subagents` 持有的 delegation 授权配置 |
|
|
72
73
|
| `~/.pi/forge/extensions/` | 可信用户 macro/slot 代码 |
|
|
73
74
|
|
|
74
75
|
旧的 `.pi/prompt-stacks/*.json` 仍可读取;命令创建的 stack 会写到 `.pi/forge/prompt-stacks`,使用 Web 编辑器的 `global` scope 下拉可创建到用户全局 `~/.pi/forge/prompt-stacks`。安全迁移方式:
|
|
@@ -4,28 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
> **实验性:** 此 API 和 backend 可能独立于稳定的 prompt stack/profile 功能发生变化。
|
|
6
6
|
|
|
7
|
-
pi-forge 可以把明确授权的 agent profile 作为独立、干净、一次性的 Pi 进程执行。它在前台运行,并向父对话返回有界报告。
|
|
7
|
+
可选包 `@zihanw/pi-forge-subagents` 可以把明确授权的 agent profile 作为独立、干净、一次性的 Pi 进程执行。它在前台运行,并向父对话返回有界报告。
|
|
8
8
|
|
|
9
9
|
## 启用 profile
|
|
10
10
|
|
|
11
|
-
Profile 默认不能委派。请在可信项目的 `.pi/forge/
|
|
11
|
+
Profile 默认不能委派。请在可信项目的 `.pi/forge/subagents.json` 中逐个启用项目 profile,在用户全局 `~/.pi/forge/subagents.json` 中逐个启用全局 profile;`.pi/forge/config.json.subagents` 仅作为只读兼容来源:
|
|
12
12
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"timeoutMs": 300000
|
|
22
|
-
}
|
|
15
|
+
"backend": "pi-subprocess-readonly",
|
|
16
|
+
"timeoutMs": 60000,
|
|
17
|
+
"profiles": {
|
|
18
|
+
"reviewer": {
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"timeoutMs": 300000
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
授权跟随 profile scope:项目
|
|
26
|
+
授权跟随 profile scope:项目 `subagents.json` 的 `profiles.<id>` 只授权 `project:<id>`,全局 `subagents.json` 的 `profiles.<id>` 只授权 `global:<id>`。同 ID 的全局和项目 profile 不会互相继承 enable/backend/timeout。未启用或未列出的 ID 不会被 discovery 返回,即使猜中 ID 也会被拒绝。
|
|
29
27
|
|
|
30
28
|
## Plan 与运行
|
|
31
29
|
|
|
@@ -55,7 +53,7 @@ Profile 默认不能委派。请在可信项目的 `.pi/forge/config.json` 中
|
|
|
55
53
|
}
|
|
56
54
|
```
|
|
57
55
|
|
|
58
|
-
它只影响 `forge_subagent`;`/forge-agent run` 仍需要交互审批。格式错误或不可信项目会 fail closed。请把此
|
|
56
|
+
它只影响 `forge_subagent`;`/forge-agent run` 仍需要交互审批。格式错误或不可信项目会 fail closed。请把此 `subagents.json` 当作授权文件:除非所有可调用父 agent 都可以无需再次询问就把编译 prompt 和可读文件发给 provider,否则不要启用或提交此设置。
|
|
59
57
|
|
|
60
58
|
## Child 边界
|
|
61
59
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# 迁移到 pi-forge 0.5
|
|
2
|
+
|
|
3
|
+
[中文文档](../README.md) · [English](../../guides/migrating-to-0.5.md)
|
|
4
|
+
|
|
5
|
+
0.5.0 是一个破坏性的清理版本。本页是全部变更的迁移说明。
|
|
6
|
+
|
|
7
|
+
## 被移除的内容
|
|
8
|
+
|
|
9
|
+
- SillyTavern 导入器(`/preset import-silly`)及其报告、指南、示例和测试。升级前请先用 pi-forge 0.4 转换 SillyTavern preset。
|
|
10
|
+
- 可变 turn/session 变量、变量修改 macro、`pi-forge-variable-state` session 条目和 `variables` slot。
|
|
11
|
+
- 正则的 `display` 与 `both` 效果;保留 `outgoing` 和 `finalize`。
|
|
12
|
+
- 主包中的 subagent 执行功能(移至可选包,见下文 Lane 3/4)。
|
|
13
|
+
|
|
14
|
+
## 模板语法变更
|
|
15
|
+
|
|
16
|
+
Prompt 文本现在使用封闭的 `forge-v1` 语法编译。
|
|
17
|
+
|
|
18
|
+
| 0.4 写法 | 0.5 forge-v1 |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `{{name}}`(静态) | `{{ parameters.name }}` |
|
|
21
|
+
| `{{lastUserMessage}}` | `{{ runtime.lastUserMessage }}` |
|
|
22
|
+
| `{{date}}` / `{{time}}` / `{{cwd}}` | `{{ runtime.date }}` / `{{ runtime.time }}` / `{{ runtime.cwd }}` |
|
|
23
|
+
| `{{tools}}` | `{{ runtime.selectedToolsText }}` |
|
|
24
|
+
| `{{upper::x}}` | `{{ x \| upper }}` |
|
|
25
|
+
| `{{iftools::bash::A::B}}` | `{% if runtime.tool.bash %}A{% else %}B{% endif %}` |
|
|
26
|
+
| 自定义 `{{myMacro}}` | `{{ extensions.myMacro }}` |
|
|
27
|
+
|
|
28
|
+
未知路径、未知 filter、解析错误、循环和输出超限都是编译错误;失败的块会被省略,而不是把原始模板文本重新注入。
|
|
29
|
+
|
|
30
|
+
## Schema v2
|
|
31
|
+
|
|
32
|
+
Schema v2 的 stack 把不可变静态值存入 `parameters`(JSON 兼容),取代旧的纯字符串 `variables` 字段:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"schemaVersion": 2,
|
|
37
|
+
"parameters": { "char": "Konata" }
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
未标注版本 / v1 的 stack 仍通过旧的 `variables` 读取器加载。
|
|
42
|
+
|
|
43
|
+
## 运行迁移工具
|
|
44
|
+
|
|
45
|
+
一个以诊断为先的机械脚本可转换已保存的 stack 文件:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node scripts/migrate-stack-v2.mjs .pi/forge/prompt-stacks/default.json --dry-run
|
|
49
|
+
node scripts/migrate-stack-v2.mjs .pi/forge/prompt-stacks/default.json --write
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
它会把 `variables` 改名为 `parameters`、映射 runtime/parameter 路径并转换简单的 filter 管道。无法机械转换的写法会被报告;只有不存在这类写法时才会写入文件。仍含旧 `variables` 字段的 schema v2 文件不会被改动,仅给出警告。
|
|
53
|
+
|
|
54
|
+
## Lane 2:带 scope 的全局 profile 与 prompt stack
|
|
55
|
+
|
|
56
|
+
- 用户全局资源现在位于 `~/.pi/forge/prompt-stacks` 和 `~/.pi/forge/agent-profiles`,与项目存储并存。Profile 和 stack 选择器支持显式 scope:`project:<id>`、`global:<id>`,裸 ID 优先解析项目资源。
|
|
57
|
+
- 同 ID 的项目资源会遮蔽对应的全局资源;全局 stack 不能引用项目资源(反之亦然)——引用在被引用资源的 scope 内解析。
|
|
58
|
+
- 未信任的项目一律拒绝:只加载全局资源,所有变更路由被拒绝,并且当 session 可能仍活跃时 `session_shutdown` 不再销毁已信任的工作区(空闲工作区一小时后被清扫;host 独立停止)。
|
|
59
|
+
- Web 编辑器新增 scope 下拉,可向任一存储创建 stack/profile,并通过显式 `global:<id>` 路由执行全局变更。
|
|
60
|
+
|
|
61
|
+
## Lane 3:subagent 包拆分
|
|
62
|
+
|
|
63
|
+
Subagent 执行功能从主包移入可选包 `@zihanw/pi-forge-subagents`(要求 `@zihanw/pi-forge@^0.5.0`)。如需保留前台 delegation,请单独安装该包。
|
|
64
|
+
|
|
65
|
+
- **命令:** `/subagents` 和 `/subagent-run` 已从主包移除。可选包注册 `/forge-agent backends|plan|run`。
|
|
66
|
+
- **模型工具:** `forge_subagent_profiles` 和 `forge_subagent` 由可选包注册。
|
|
67
|
+
- **配置:** `subagents.*` 从 `.pi/forge/config.json` 移入专用的 `.pi/forge/subagents.json`(可信项目)和 `~/.pi/forge/subagents.json`(用户默认)。可选包会把旧的 `config.json.subagents` 段落作为只读回退读取并发出警告;它永远不会写入旧位置。把配置值复制到 `subagents.json` 即可消除警告。
|
|
68
|
+
- **Web 编辑器:** delegation 卡片已从主编辑器移除;请直接编辑 `subagents.json`。
|
|
69
|
+
- **架构:** 主包的 prompt 编译器不再携带 subagent 假设,`ForgeWorkspace` 是资源状态和编译上下文的唯一持有者。
|
|
70
|
+
|
|
71
|
+
## Lane 4:Forge 原生 host 契约与公开 surface
|
|
72
|
+
|
|
73
|
+
- 主包不再依赖 `@zihanw/pi-subagent-runtime`,也不再导出 0.4 执行契约。该契约(`AgentRequest`、`createAgentExecutionPlan`、`validateAgentRequest`、`negotiateSubagentTools`、preflight/plan/response 校验器等)现在位于 `@zihanw/pi-forge-subagents` 内部,供其自身 runtime 接线使用;两个包都不把它作为第三方可用的公开 surface。
|
|
74
|
+
- `@zihanw/pi-forge/subagent` 现在只导出带版本的 host port:wire DTO 与校验器、`ForgeHostTransport`、`ForgeHost`/`ForgeHostClient`、生命周期常量,以及 Forge 持有的规范指纹辅助函数。`resolveSubagentHostProfile` / `prepareSubagentHostPlan` 已被 host port 的 `resolveProfile` 和 `prepare` 操作取代。
|
|
75
|
+
- 包根只导出默认扩展工厂、`registerMacro`/`registerSlot` 及其契约类型。其余根导出(loader、agent-profile、profile-service、catalog、resource-identity、render-helper 值、`forge-v1` 引擎、registry 读取器)已全部移除。
|
|
76
|
+
- 所有 `@zihanw/pi-forge/src/*` 子路径别名和 `./examples/*` 导出均已移除;`check-package` 会拒绝它们。
|
|
77
|
+
|
|
78
|
+
### 导入迁移表
|
|
79
|
+
|
|
80
|
+
| 0.4 导入 | 0.5 替代 |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `@zihanw/pi-forge`(默认导出、`registerMacro`、`registerSlot`) | 不变 |
|
|
83
|
+
| `@zihanw/pi-forge/subagent` host-port 名称(`ForgeHost*`、校验器、指纹) | 不变 |
|
|
84
|
+
| `@zihanw/pi-forge/subagent` 执行契约(`AgentRequest`、`createAgentExecutionPlan` 等) | 已内置于 `@zihanw/pi-forge-subagents`;无公开替代 |
|
|
85
|
+
| `@zihanw/pi-forge/subagent` 的 `resolveSubagentHostProfile` / `prepareSubagentHostPlan` | 通过 `ForgeHostClient` 使用 host-port 操作 |
|
|
86
|
+
| `@zihanw/pi-forge/src/*` 别名 | 已移除;无替代(内部实现) |
|
|
87
|
+
| 根部的 loader/profile/catalog/engine 再导出 | 已移除;无替代(内部实现) |
|
|
88
|
+
|
|
89
|
+
## 兼容性说明
|
|
90
|
+
|
|
91
|
+
- Host port 的 wire 结构在 `FORGE_HOST_PORT_VERSION = 1` 内只做增量扩展;未知操作会以普通的 `{ ok: false, error }` 结果拒绝(`"Unknown Forge host operation: …"`),而不是抛出异常。可选包必须把任何操作失败视为该请求的终态。
|
|
92
|
+
- 主包内置的指纹辅助函数由黄金向量锁定,与 `@zihanw/pi-subagent-runtime` 的规范序列化保持字节兼容;计划封存(plan sealing)仍只发生在可选包中。
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
- 拖拽排序、启用/禁用、校验和完整编译预览;
|
|
30
30
|
- 工具/skill 搜索、精确名称 chips 和通配符策略;
|
|
31
31
|
- variables、context 和 regex 规则;
|
|
32
|
-
- 原生 pi-forge
|
|
32
|
+
- 原生 pi-forge JSON 导入;
|
|
33
33
|
- 导出、fork、删除和 payload 捕获。
|
|
34
34
|
|
|
35
35
|
已有 ID 在编辑时不可修改;需要新 ID 时使用 **Fork**,避免破坏 profile 引用和当前选择。工具栏的 scope 下拉(默认 `project`)决定新建、导入和 fork 的写入位置:选择 `global` 写入用户全局 `~/.pi/forge/prompt-stacks`,选择 `project` 写入项目 `.pi/forge/prompt-stacks`。列表会为全局 stack 显示 `global` badge;保存和删除通过 `global:<id>` 路由精确作用于全局文件。保存、导入、fork 和删除后会重新加载当前 Pi session。
|
|
36
36
|
|
|
37
37
|
## Agent profile 工作区
|
|
38
38
|
|
|
39
|
-
列表显示 profile ID、名称、模型、思考等级、stack、校验状态、auto-activation
|
|
39
|
+
列表显示 profile ID、名称、模型、思考等级、stack、校验状态、auto-activation 和 last-applied provenance。每个 profile 都带 `project` / `global` scope badge;同 ID 的 shadow 对会显示 `shadows global:<id>` 或 `shadowed by project:<id>`。
|
|
40
40
|
|
|
41
41
|
可信项目通过 **New profile** 旁的 scope 下拉(默认 `project`)选择目标 scope:选择 `global` 写入用户全局 `~/.pi/forge/agent-profiles`,选择 `project` 写入项目 `.pi/forge/agent-profiles`。全局 profile 可通过显式 `global:<id>` 路由编辑、校验、保存、一次性应用和删除;未限定路由始终只作用于项目资源。编辑全局 profile 时,stack 下拉只显示全局 stack。Model 选项来自 Pi registry,thinking 选项反映模型支持,stack 选项来自同一个 repository。编辑器会拒绝同 scope 内第二个 auto-activation profile。
|
|
42
42
|
|
|
43
|
-
Delegation
|
|
43
|
+
## Delegation
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Delegation 配置不在主编辑器中。可选包 `@zihanw/pi-forge-subagents` 持有专用的 `.pi/forge/subagents.json` 和 `~/.pi/forge/subagents.json` 文件。启用 profile 前请阅读[前台 delegation](delegation.md)。
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
| 命令 | 行为 |
|
|
24
24
|
|---|---|
|
|
25
25
|
| `/preset migrate-stacks [--dry-run] [--overwrite] [--delete-legacy]` | 把旧 stack 复制到 `.pi/forge/prompt-stacks` |
|
|
26
|
-
| `/preset import-silly <path> [character_id] [--dry-run] [--overwrite]` | 转换 SillyTavern preset 并生成报告 |
|
|
27
26
|
|
|
28
27
|
覆盖或删除之前请先使用 `--dry-run`。
|
|
29
28
|
|
|
@@ -42,13 +41,15 @@
|
|
|
42
41
|
|
|
43
42
|
## 实验性 delegation
|
|
44
43
|
|
|
44
|
+
以下命令由可选包 `@zihanw/pi-forge-subagents` 提供。
|
|
45
|
+
|
|
45
46
|
| 命令 | 行为 |
|
|
46
47
|
|---|---|
|
|
47
48
|
| `/forge-agent backends` | 列出 backend、capabilities 和默认值 |
|
|
48
49
|
| `/forge-agent plan <profile> [--backend <id>] <task>` | 准备、显示并丢弃计划,不联系 provider |
|
|
49
50
|
| `/forge-agent run <profile> [--backend <id>] <task>` | 审批并执行前台只读任务 |
|
|
50
51
|
|
|
51
|
-
只接受匹配 scope 明确授权的 profile:项目
|
|
52
|
+
只接受匹配 scope 明确授权的 profile:项目 `subagents.json` 授权 `project:<id>`,全局 `subagents.json` 授权 `global:<id>`;也可使用 `.pi/forge/config.json.subagents` 作为只读兼容来源。模型工具为 `forge_subagent_profiles` 和 `forge_subagent`。见[安全说明](../guides/delegation.md)。
|
|
52
53
|
|
|
53
54
|
## Payload
|
|
54
55
|
|
|
@@ -4,7 +4,7 @@ This example shows how trusted pi-forge extension modules can register a custom
|
|
|
4
4
|
|
|
5
5
|
It registers:
|
|
6
6
|
|
|
7
|
-
- `{{cpuLoad}}` macro: one-line CPU load summary.
|
|
7
|
+
- `{{ extensions.cpuLoad }}` macro: one-line CPU load summary.
|
|
8
8
|
- `machine-status` slot: CPU load, OS load average, memory, and uptime snapshot.
|
|
9
9
|
|
|
10
10
|
The renderers are synchronous, so this example uses Node's OS load average and memory APIs. It is a rough machine-load signal, not an async sampled CPU-utilization profiler.
|
|
@@ -53,12 +53,12 @@ Each module exports a default function or named `register` function:
|
|
|
53
53
|
|
|
54
54
|
```ts
|
|
55
55
|
export default function register(api) {
|
|
56
|
-
api.registerMacro({ name: "cpuLoad", render: () => "..." });
|
|
56
|
+
api.registerMacro({ name: "cpuLoad", dependencies: [], render: ({ env, helpers }) => "..." });
|
|
57
57
|
api.registerSlot({ name: "machine-status", render: () => "..." });
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
pi-forge passes the registration API into the function, tracks unregister callbacks, and unregisters previous definitions before reloading the folder. If the extension is not loaded, the stack can still be read, but `machine-status` will validate as an unsupported slot and `{{cpuLoad}}` will remain an unresolved
|
|
61
|
+
pi-forge passes the registration API into the function, tracks unregister callbacks, and unregisters previous definitions before reloading the folder. If the extension is not loaded, the stack can still be read, but `machine-status` will validate as an unsupported slot and `{{ extensions.cpuLoad }}` will remain an unresolved extension path.
|
|
62
62
|
|
|
63
63
|
Only use this folder for trusted code. These modules execute with normal local code permissions after the project is trusted.
|
|
64
64
|
|
|
@@ -5,7 +5,8 @@ interface ForgeRegistrationApi {
|
|
|
5
5
|
name: string;
|
|
6
6
|
source?: string;
|
|
7
7
|
description?: string;
|
|
8
|
-
|
|
8
|
+
dependencies?: string[];
|
|
9
|
+
render: (ctx: { env: Record<string, unknown>; helpers: unknown }) => string;
|
|
9
10
|
}): () => void;
|
|
10
11
|
registerSlot(definition: {
|
|
11
12
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"type": "pi-forge.prompt-stack",
|
|
4
4
|
"id": "custom-system-status",
|
|
5
5
|
"name": "Custom System Status",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"name": "CPU Load Macro",
|
|
13
13
|
"enabled": true,
|
|
14
14
|
"role": "system",
|
|
15
|
-
"content": "Current rough CPU load: {{cpuLoad}}"
|
|
15
|
+
"content": "Current rough CPU load: {{ extensions.cpuLoad }}"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"kind": "slot",
|
|
@@ -35,5 +35,6 @@
|
|
|
35
35
|
"enabled": true,
|
|
36
36
|
"slot": "chat-history"
|
|
37
37
|
}
|
|
38
|
-
]
|
|
38
|
+
],
|
|
39
|
+
"parameters": {}
|
|
39
40
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"type": "pi-forge.prompt-stack",
|
|
4
4
|
"id": "default",
|
|
5
5
|
"name": "Default Pi Prompt Mirror",
|
|
@@ -14,10 +14,14 @@
|
|
|
14
14
|
"allowDuplicateChatHistory": false
|
|
15
15
|
},
|
|
16
16
|
"tools": {
|
|
17
|
-
"allow": [
|
|
17
|
+
"allow": [
|
|
18
|
+
"*"
|
|
19
|
+
]
|
|
18
20
|
},
|
|
19
21
|
"skills": {
|
|
20
|
-
"allow": [
|
|
22
|
+
"allow": [
|
|
23
|
+
"*"
|
|
24
|
+
]
|
|
21
25
|
},
|
|
22
26
|
"items": [
|
|
23
27
|
{
|
|
@@ -116,5 +120,6 @@
|
|
|
116
120
|
"enabled": true,
|
|
117
121
|
"slot": "chat-history"
|
|
118
122
|
}
|
|
119
|
-
]
|
|
123
|
+
],
|
|
124
|
+
"parameters": {}
|
|
120
125
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"type": "pi-forge.prompt-stack",
|
|
4
4
|
"id": "image-reader",
|
|
5
5
|
"name": "Image Reader Subagent",
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
"allowDuplicateChatHistory": false
|
|
15
15
|
},
|
|
16
16
|
"tools": {
|
|
17
|
-
"deny": [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"detail_level": "exhaustive factual visual inventory",
|
|
23
|
-
"safety_scope": "include safety-relevant visual content neutrally without giving instructions for harmful acts"
|
|
17
|
+
"deny": [
|
|
18
|
+
"bash",
|
|
19
|
+
"edit",
|
|
20
|
+
"write"
|
|
21
|
+
]
|
|
24
22
|
},
|
|
25
23
|
"items": [
|
|
26
24
|
{
|
|
@@ -29,7 +27,7 @@
|
|
|
29
27
|
"name": "Image Reader Role",
|
|
30
28
|
"enabled": true,
|
|
31
29
|
"role": "system",
|
|
32
|
-
"content": "
|
|
30
|
+
"content": "You are an image reader subagent. Your job is to inspect image inputs directly and produce a faithful visual report for the {{ parameters.audience }}.\n\nUse this stack only when you can actually inspect the image. If no image is present, the image is inaccessible, or the current model cannot view images, say that directly and do not guess.\n\nPrimary objective: describe exactly what is visible in the image in detail. Treat the report as sensory evidence for another agent, not as advice, judgment, or creative writing."
|
|
33
31
|
},
|
|
34
32
|
{
|
|
35
33
|
"kind": "block",
|
|
@@ -45,21 +43,7 @@
|
|
|
45
43
|
"name": "Macro Context",
|
|
46
44
|
"enabled": true,
|
|
47
45
|
"role": "system",
|
|
48
|
-
"content": "
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"kind": "slot",
|
|
52
|
-
"id": "variables",
|
|
53
|
-
"name": "Image Reader Variables",
|
|
54
|
-
"enabled": true,
|
|
55
|
-
"role": "system",
|
|
56
|
-
"slot": "variables",
|
|
57
|
-
"options": {
|
|
58
|
-
"includeStatic": true,
|
|
59
|
-
"includeSession": true,
|
|
60
|
-
"includeTurn": true,
|
|
61
|
-
"format": "plain"
|
|
62
|
-
}
|
|
46
|
+
"content": "Report mode is active: {{ parameters.report_mode | upper }}.\nSafety scope: {{ parameters.safety_scope }}.\n{% if runtime.tool.read %}If the user references an image file path and direct vision input is unavailable, you may inspect only file metadata or surrounding text with read tools; do not pretend metadata is image vision.{% endif %}"
|
|
63
47
|
},
|
|
64
48
|
{
|
|
65
49
|
"kind": "slot",
|
|
@@ -118,7 +102,13 @@
|
|
|
118
102
|
"name": "Current Image Task",
|
|
119
103
|
"enabled": true,
|
|
120
104
|
"role": "user",
|
|
121
|
-
"content": "<current_image_task>\n{{xml
|
|
105
|
+
"content": "<current_image_task>\n{{ runtime.lastUserMessage | xml }}\n</current_image_task>\n\nProduce the image report now for the {{ parameters.audience }}.\n\nRequired output:\n1. Access check: state whether you can directly inspect the image.\n2. One-sentence overview: summarize the scene plainly.\n3. Detailed inventory: list visible subjects, objects, setting, text, colors, layout, and relationships.\n4. Safety-relevant content: list visible hazards, injuries, weapons, explicit content, abuse indicators, hate symbols, or other potentially harmful content. Write \"None visible\" only if none are visible.\n5. Uncertainties: list anything important that is unclear, ambiguous, cropped, blurry, or inferred.\n6. Machine-readable summary: include one compact JSON object with keys \"canInspectImage\", \"overview\", \"visibleText\", \"safetyRelevantContent\", and \"uncertainties\". Use strings or arrays only; do not include markdown inside the JSON.\n\nRequest as JSON string for logging: {{ runtime.lastUserMessage | json }}"
|
|
122
106
|
}
|
|
123
|
-
]
|
|
107
|
+
],
|
|
108
|
+
"parameters": {
|
|
109
|
+
"audience": "main agent",
|
|
110
|
+
"report_mode": "image-reader",
|
|
111
|
+
"detail_level": "exhaustive factual visual inventory",
|
|
112
|
+
"safety_scope": "include safety-relevant visual content neutrally without giving instructions for harmful acts"
|
|
113
|
+
}
|
|
124
114
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"type": "pi-forge.prompt-stack",
|
|
4
4
|
"id": "reviewer",
|
|
5
5
|
"name": "Focused Code Reviewer",
|
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
"allowDuplicateChatHistory": false
|
|
15
15
|
},
|
|
16
16
|
"tools": {
|
|
17
|
-
"deny": [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"review_style": "findings first, ordered by severity",
|
|
22
|
-
"max_findings": "8"
|
|
17
|
+
"deny": [
|
|
18
|
+
"edit",
|
|
19
|
+
"write"
|
|
20
|
+
]
|
|
23
21
|
},
|
|
24
22
|
"items": [
|
|
25
23
|
{
|
|
@@ -28,7 +26,7 @@
|
|
|
28
26
|
"name": "Reviewer Role",
|
|
29
27
|
"enabled": true,
|
|
30
28
|
"role": "system",
|
|
31
|
-
"content": "You are a senior code reviewer operating inside pi. Review the user's target with a skeptical engineering lens. Prioritize {{review_focus}}.\n\nRules:\n- Do not edit files or write patches unless the user explicitly asks for implementation.\n- You may inspect files and run safe read-only commands when needed.\n- Treat previous conversation as context, not as the target unless the latest user message says so.\n- Prefer concrete file/line references when available.\n- If there are no substantive issues, say that clearly and mention residual risks or test gaps."
|
|
29
|
+
"content": "You are a senior code reviewer operating inside pi. Review the user's target with a skeptical engineering lens. Prioritize {{ parameters.review_focus }}.\n\nRules:\n- Do not edit files or write patches unless the user explicitly asks for implementation.\n- You may inspect files and run safe read-only commands when needed.\n- Treat previous conversation as context, not as the target unless the latest user message says so.\n- Prefer concrete file/line references when available.\n- If there are no substantive issues, say that clearly and mention residual risks or test gaps."
|
|
32
30
|
},
|
|
33
31
|
{
|
|
34
32
|
"kind": "slot",
|
|
@@ -58,20 +56,6 @@
|
|
|
58
56
|
"role": "system",
|
|
59
57
|
"slot": "date-cwd"
|
|
60
58
|
},
|
|
61
|
-
{
|
|
62
|
-
"kind": "slot",
|
|
63
|
-
"id": "variables",
|
|
64
|
-
"name": "Review Variables",
|
|
65
|
-
"enabled": true,
|
|
66
|
-
"role": "system",
|
|
67
|
-
"slot": "variables",
|
|
68
|
-
"options": {
|
|
69
|
-
"includeStatic": true,
|
|
70
|
-
"includeSession": true,
|
|
71
|
-
"includeTurn": false,
|
|
72
|
-
"format": "plain"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
59
|
{
|
|
76
60
|
"kind": "block",
|
|
77
61
|
"id": "history-open",
|
|
@@ -109,7 +93,12 @@
|
|
|
109
93
|
"name": "Current Review Target",
|
|
110
94
|
"enabled": true,
|
|
111
95
|
"role": "user",
|
|
112
|
-
"content": "<review_target>\n{{lastUserMessage}}\n</review_target>\n\nReview this target now. Lead with findings, ordered by severity. Limit yourself to the most important {{max_findings}} findings unless the target asks for exhaustive review. Use this format:\n\nFindings:\n- [severity] file:line - issue, impact, and suggested fix.\n\nOpen questions:\n- List only questions that materially affect the review.\n\nIf no findings are present, write \"No blocking findings\" and then summarize remaining test or operational risk."
|
|
96
|
+
"content": "<review_target>\n{{ runtime.lastUserMessage }}\n</review_target>\n\nReview this target now. Lead with findings, ordered by severity. Limit yourself to the most important {{ parameters.max_findings }} findings unless the target asks for exhaustive review. Use this format:\n\nFindings:\n- [severity] file:line - issue, impact, and suggested fix.\n\nOpen questions:\n- List only questions that materially affect the review.\n\nIf no findings are present, write \"No blocking findings\" and then summarize remaining test or operational risk."
|
|
113
97
|
}
|
|
114
|
-
]
|
|
98
|
+
],
|
|
99
|
+
"parameters": {
|
|
100
|
+
"review_focus": "correctness, regressions, security, maintainability, and missing tests",
|
|
101
|
+
"review_style": "findings first, ordered by severity",
|
|
102
|
+
"max_findings": "8"
|
|
103
|
+
}
|
|
115
104
|
}
|