pi-shadow-mind 0.1.16 → 0.1.17
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/DESIGN.md +3 -3
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/DESIGN.md
CHANGED
|
@@ -111,7 +111,7 @@ active_for_models:
|
|
|
111
111
|
| `run_with_model` | Shadow 自己使用的模型;省略时使用插件默认模型 |
|
|
112
112
|
| `thinking_level` | Shadow 使用的 thinking level;省略时使用插件默认值,再回退到 Main 会话当前生效等级 |
|
|
113
113
|
| `timeout_seconds` | Shadow 单次运行超时;省略时使用插件默认超时 |
|
|
114
|
-
| `tools` | 在 Pi SDK `readOnlyTools`
|
|
114
|
+
| `tools` | 在 Pi SDK `readOnlyTools` 之上追加的工具白名单;`["*"]` 授权当前 Session 的全部工具;默认 `[]` |
|
|
115
115
|
|
|
116
116
|
`name` 只用于 `shadow-report` 和状态界面展示,不参与身份判断;省略时回退到最终解析出的 `id`。Markdown 正文就是 Shadow 的认知定义、长期职责和行为要求。
|
|
117
117
|
|
|
@@ -131,9 +131,9 @@ Pi SDK readOnlyTools
|
|
|
131
131
|
|
|
132
132
|
默认名称集合包含 `read`、`grep`、`find` 和 `ls`。激活时插件按名称从当前 Main Session 的最终工具 registry 解析实际实现,因此会继承其他插件对同名工具的覆盖以及当前环境适配。这里的 `readOnlyTools` 表示默认名称约定,不保证被覆盖后的实现仍然没有副作用。
|
|
133
133
|
|
|
134
|
-
`tools` 是在该集合之上追加的显式白名单,省略时视为 `[]`。例如 `tools: [write]` 会获得当前 registry 中的默认四个工具、`write` 和内置 `report_to_main
|
|
134
|
+
`tools` 是在该集合之上追加的显式白名单,省略时视为 `[]`。例如 `tools: [write]` 会获得当前 registry 中的默认四个工具、`write` 和内置 `report_to_main`。使用 `tools: ["*"]` 时,Shadow 会获得激活时 Main Session registry 中的全部工具以及 `report_to_main`;之后新增或改名的工具会自动随 registry 解析,不需要同步维护定义文件。
|
|
135
135
|
|
|
136
|
-
Pi 的通用 `ToolDefinition` 没有可供插件查询的只读属性,因此自定义工具不会被自动归类或加入;编辑文件、执行 Shell 或其他能力也不会被隐式继承自 Main
|
|
136
|
+
Pi 的通用 `ToolDefinition` 没有可供插件查询的只读属性,因此自定义工具不会被自动归类或加入;编辑文件、执行 Shell 或其他能力也不会被隐式继承自 Main,除非显式列出名称或使用 `"*"`。配置的追加工具在当前 Session 不存在时,插件忽略该项、写入轻量运行事件,其余工具继续正常提供。
|
|
137
137
|
|
|
138
138
|
`tools` 白名单本身就是用户对该 Shadow 的执行授权。列入白名单的写入、Shell 或其他工具可以由后台 Shadow 直接调用,插件不增加逐次确认层。
|
|
139
139
|
|
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ Report only concrete, actionable issues grounded in the visible trajectory or
|
|
|
66
66
|
repository. If the current work is unrelated, do not intervene.
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
This Shadow is read-only. It reviews the implementation in parallel and reports concrete architectural concerns without taking control of the main task.
|
|
69
|
+
This Shadow is read-only. It reviews the implementation in parallel and reports concrete architectural concerns without taking control of the main task. Tool names extend the default read-only set; use `tools: ["*"]` only when the Shadow should inherit every tool currently registered in the main session, including tools added later.
|
|
70
70
|
|
|
71
71
|
## How it works
|
|
72
72
|
|
package/README.zh-CN.md
CHANGED
|
@@ -63,7 +63,7 @@ tools: [read, grep]
|
|
|
63
63
|
无关,不要介入。
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
这个 Shadow 默认只读。它会在实现过程中并行审阅架构,并向主 Agent
|
|
66
|
+
这个 Shadow 默认只读。它会在实现过程中并行审阅架构,并向主 Agent 报告具体问题,但不会接管主任务。`tools` 中的名称会追加到默认只读工具集;只有确实需要继承 Main Session 当前注册的全部工具(包括未来新增工具)时,才使用 `tools: ["*"]`。
|
|
67
67
|
|
|
68
68
|
## 工作方式
|
|
69
69
|
|
package/dist/index.js
CHANGED
|
@@ -7747,7 +7747,7 @@ function compactJson(value) {
|
|
|
7747
7747
|
// src/shadow-runner.ts
|
|
7748
7748
|
function resolveShadowTools(whitelist, available, defaults = DEFAULT_READ_TOOLS) {
|
|
7749
7749
|
const builtin = /* @__PURE__ */ new Set(["report_to_main"]);
|
|
7750
|
-
const requested = [.../* @__PURE__ */ new Set([...defaults, ...whitelist, ...builtin])];
|
|
7750
|
+
const requested = whitelist.includes("*") ? [.../* @__PURE__ */ new Set([...available, ...builtin])] : [.../* @__PURE__ */ new Set([...defaults, ...whitelist, ...builtin])];
|
|
7751
7751
|
const tools = [];
|
|
7752
7752
|
const missing = [];
|
|
7753
7753
|
for (const name of requested) {
|
|
@@ -7769,13 +7769,13 @@ function buildRunResult(options) {
|
|
|
7769
7769
|
const usage = usageMetrics(ownMessages);
|
|
7770
7770
|
return {
|
|
7771
7771
|
reason,
|
|
7772
|
-
...error
|
|
7772
|
+
...error === void 0 ? {} : { error },
|
|
7773
7773
|
durationMs,
|
|
7774
7774
|
toolNames: session?.getActiveToolNames() ?? [],
|
|
7775
7775
|
missingTools,
|
|
7776
7776
|
...metrics,
|
|
7777
7777
|
usage,
|
|
7778
|
-
...thinkingLevel
|
|
7778
|
+
...thinkingLevel === void 0 ? {} : { thinkingLevel },
|
|
7779
7779
|
sessionFile: session?.sessionFile
|
|
7780
7780
|
};
|
|
7781
7781
|
}
|