pi-ptc-subagents 6.0.3 → 6.2.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/dist/worker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { stripTypeScriptTypes } from "node:module";
2
- import { parentPort, workerData } from "node:worker_threads";
3
2
  import { inspect } from "node:util";
3
+ import { parentPort, workerData } from "node:worker_threads";
4
4
  // ../ptc/src/compile.ts
5
5
  function compileProgram(source) {
6
6
  const stripped = stripTypeScriptTypes(`async function __ptcProgram() {\n${source}\n}`, { mode: "strip" });
@@ -11,7 +11,7 @@ function createWorkflowHelpers(emit) {
11
11
  return {
12
12
  log: (...args) => emit(args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ")),
13
13
  phase: (name) => emit(`— phase: ${name} —`),
14
- parallel: (items) => Promise.all(items.map((run) => run())),
14
+ parallel: (items) => Promise.allSettled(items.map((run) => run())),
15
15
  pipeline: (items, step) => {
16
16
  const results = [];
17
17
  return items.reduce((chain, item, index) => chain.then(async () => {
@@ -5,7 +5,7 @@
5
5
  - `pi_task_ptc`:PTC 程序内的 binding,程序里 `tools.pi_task_ptc({...})`
6
6
  - `pi_task_codemode`:注册的工具(exposure: codemode,模型不可见),codemode 脚本里 `tools.pi_task_codemode({...})`
7
7
 
8
- 参数:`task`(必填,孩子要干的活)、`label`、`wait`、`why`、`agent`、`agentScope`、`model`、`thinkingLevel`、`readOnly` 均已生效(`cwd` 待接);
8
+ 参数:`task`(必填,孩子要干的活)、`label`、`wait`、`why`、`agent`、`agentScope`、`model`、`thinkingLevel`、`readOnly`;
9
9
  agent 定义里的 `tools / model / thinkingLevel / childReport` 由 frontmatter 钉住。
10
10
 
11
11
  返回 handle:`{ taskId, label?, status: "queued" }`。默认不等;撞闸(随闸门落地)返回
@@ -13,3 +13,14 @@ agent 定义里的 `tools / model / thinkingLevel / childReport` 由 frontmatter
13
13
 
14
14
  任务建成后在任务记录里排队(满员排队不拒绝,ADR-0010),经
15
15
  `ptc_task_list / ptc_task_output / ptc_task_stop` 查/停。
16
+
17
+ ## Briefing 纪律(省 token,派发前自查)
18
+
19
+ - **给确切路径、命令、决策**:孩子看不到父会话。task 里写死一个路径,省孩子一轮探索
20
+ (每轮探索 = 一次工具调用结果 + 推理 token)。
21
+ - **写明最终消息要带回什么**:孩子只回一次。要什么格式、哪些字段,task 里说清。
22
+ - **不确定能否一次搜中才派**:目标明确(已知路径、已知行号)的活别派,主会话直接
23
+ `tools.read` 更省。
24
+ - **同域的活合并给一个串行孩子**:每个孩子都付一份固定 harness 税(系统提示词 +
25
+ 项目上下文)。多个重叠的小活拆并行 = 同一份探索被付费多次。
26
+ - **孩子不写报告文件**:交付物就是最终消息(含报告 JSON 块),落盘 .md 是浪费。
@@ -6,7 +6,7 @@ script 内额外可用(仅 workflow 面注入):
6
6
 
7
7
  - `workflow.log(...)`:阶段内日志
8
8
  - `workflow.phase(name)`:阶段标记
9
- - `workflow.parallel([fn, ...])`:并行执行
9
+ - `workflow.parallel([fn, ...])`:并行执行,返回 `Promise.allSettled` 记录(`{status:"fulfilled", value}` / `{status:"rejected", reason}`)——单边失败不丢兄弟结果(决策 12);要「一错全拒」语义的自己写 `Promise.all`
10
10
  - `workflow.pipeline(items, step)`:顺序流水线
11
11
 
12
12
  args 必须是可 JSON 序列化的值(进 worker 前校验)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ptc-subagents",
3
- "version": "6.0.3",
3
+ "version": "6.2.0",
4
4
  "description": "Programmable tool calling (PTC) and subagent fan-out for pi",
5
5
  "keywords": [
6
6
  "pi",
@@ -30,10 +30,12 @@
30
30
  ".": "./dist/index.js"
31
31
  },
32
32
  "scripts": {
33
- "build": "pnpm -r run build",
33
+ "build": "pnpm -r --filter=!@pi-ptc/website run build",
34
34
  "prepack": "pnpm run build && rm -rf dist docs/routes && cp -R packages/entry/dist dist && cp -R packages/routes/docs/routes docs/routes",
35
- "check": "pnpm -r run check",
35
+ "check": "pnpm -r --filter=!@pi-ptc/website run check",
36
36
  "lint": "oxlint",
37
+ "test": "node --test tests/*.test.mjs",
38
+ "pretest": "pnpm run build",
37
39
  "fmt": "oxfmt",
38
40
  "fmt:check": "oxfmt --check"
39
41
  },