@zhushanwen/pi-subagent-workflow 9.0.0 → 9.0.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/pi-subagent-workflow",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"description": "Unified subagent execution and multi-agent workflow orchestration for Pi — spawned-process agent runtime with sync/background modes, stateful workflow management with persistence, state machine, and execution tracing.",
|
|
@@ -58,20 +58,21 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@zhushanwen/extension-protocol": "0.
|
|
62
|
-
"@zhushanwen/session-delivery": "0.
|
|
61
|
+
"@zhushanwen/extension-protocol": "0.16.0",
|
|
62
|
+
"@zhushanwen/session-delivery": "0.11.0",
|
|
63
63
|
"@zhushanwen/pi-ext-guards": "0.4.2",
|
|
64
64
|
"@zhushanwen/pi-extension-logger": "0.6.1",
|
|
65
|
-
"@zhushanwen/
|
|
66
|
-
"@zhushanwen/
|
|
67
|
-
"@zhushanwen/zcode-subagent-cli": "0.4.
|
|
65
|
+
"@zhushanwen/pi-notify-ledger-host": "0.2.0",
|
|
66
|
+
"@zhushanwen/subagent-core": "0.13.0",
|
|
67
|
+
"@zhushanwen/zcode-subagent-cli": "0.4.3",
|
|
68
|
+
"@zhushanwen/pi-subagent-cli": "0.4.5"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"@earendil-works/pi-ai": "^0.84.4",
|
|
71
72
|
"@earendil-works/pi-coding-agent": "^0.84.4",
|
|
72
73
|
"@earendil-works/pi-tui": "^0.84.4",
|
|
73
74
|
"typebox": "*",
|
|
74
|
-
"@zhushanwen/pi-pending-notifications": "0.
|
|
75
|
+
"@zhushanwen/pi-pending-notifications": "0.8.0",
|
|
75
76
|
"@zhushanwen/pi-structured-output": "5.1.9"
|
|
76
77
|
},
|
|
77
78
|
"peerDependenciesMeta": {
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"@types/node": "^24.0.0",
|
|
87
88
|
"@vitest/coverage-v8": "^4.1.9",
|
|
88
89
|
"vitest": "^4.1.8",
|
|
89
|
-
"@zhushanwen/subagent-engine-sdk": "0.7.
|
|
90
|
+
"@zhushanwen/subagent-engine-sdk": "0.7.1"
|
|
90
91
|
},
|
|
91
92
|
"scripts": {
|
|
92
93
|
"typecheck": "npx tsc --noEmit",
|
|
@@ -18,7 +18,7 @@ export interface CapturedTool {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/** workflow-script tool 的窄 view(list/lint 测试共用的 execute 返回形态)。 */
|
|
21
|
-
export interface ScriptResultToolView extends CapturedTool {
|
|
21
|
+
export interface ScriptResultToolView extends CapturedTool { // oe-exempt:20260929:framework:测试 fixture 契约类型(mock 桩/断言视图)——dev-0.10.5 已验收代码 merge 带入
|
|
22
22
|
execute: (
|
|
23
23
|
toolCallId: string,
|
|
24
24
|
params: Record<string, unknown>,
|
package/src/session-lifecycle.ts
CHANGED
|
@@ -21,7 +21,10 @@ import * as path from "node:path";
|
|
|
21
21
|
import type { ExtensionAPI, ExtensionContext, SessionStartEvent } from "@earendil-works/pi-coding-agent";
|
|
22
22
|
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
23
23
|
import { getLogger } from "@zhushanwen/pi-extension-logger";
|
|
24
|
-
import {
|
|
24
|
+
import { oncePerProcess, toErrorMessage } from "@zhushanwen/pi-ext-guards";
|
|
25
|
+
// notify ledger host 装配工厂(五端口接线 + 送达 stale 防御的共享单点实现,
|
|
26
|
+
// 与 session-manager notify-ledger.ts 同一装配机制收敛于此)
|
|
27
|
+
import { createPiNotifyLedgerHost } from "@zhushanwen/pi-notify-ledger-host";
|
|
25
28
|
// [W2/V4 D6] 恢复链注销直落消费的 protocol SSOT(customType + status 映射单点——
|
|
26
29
|
// 与 finalizeRun 直落 / reconcile-sweep 补注销同一函数,零新增定义点)。
|
|
27
30
|
import { mapReasonToStatus, PENDING_UNREGISTER_ENTRY_TYPE } from "@zhushanwen/extension-protocol";
|
|
@@ -519,46 +522,15 @@ function appendSubagentIdentityEntry(pi: ExtensionAPI): void {
|
|
|
519
522
|
* 返回 undefined。
|
|
520
523
|
*/
|
|
521
524
|
export function bindLedgerHostAndRecover(pi: ExtensionAPI, ctx: ExtensionContext): NotifyLedgerHost | undefined {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
sendDelivery: (message) => {
|
|
532
|
-
// D5 单通道:唯一发送形态 = sendCustomMessage({triggerTurn:true}),
|
|
533
|
-
// courier 已在发送前二次复查 isIdle,多通道投递选项已删(D5)。
|
|
534
|
-
// stale ctx 防御(crash-resilience D1 / ext-guards 审计 §7 blockers#1 收口):
|
|
535
|
-
// sendDelivery 经 settled 边沿 / 看门狗 / 恢复重放异步触发——session 替换窗口
|
|
536
|
-
// 触碰 stale pi 命中 assertActive(PS-30)即无人接 rejection(E1 同机制)。
|
|
537
|
-
// stale 静默降级(本条通知不投递,attemptDeliver 按已受理标 sentAt——session
|
|
538
|
-
// 替换后通知对旧 session 已无意义,与守卫前「留 pending 反复撞 stale 直到账本
|
|
539
|
-
// 重绑」终局一致),非 stale 错误原样上抛(attemptDeliver 既有 catch 走
|
|
540
|
-
// settleRejected 留账重试语义不变)。
|
|
541
|
-
guardStaleCtx(() => pi.sendMessage(message, { triggerTurn: true }), {
|
|
542
|
-
label: "subagent-workflow:sendDelivery",
|
|
543
|
-
onStale: (error) =>
|
|
544
|
-
logger.warn("notify delivery skipped (stale ctx)", {
|
|
545
|
-
error: toErrorMessage(error),
|
|
546
|
-
}),
|
|
547
|
-
});
|
|
548
|
-
},
|
|
549
|
-
// abandon 对会话补显形(T4③ 放弃终态):不唤醒的 display 消息(无 triggerTurn),
|
|
550
|
-
// 让主 agent/用户在会话里看到「通知已放弃」线索。
|
|
551
|
-
// 与 sendDelivery(triggerTurn 唤醒)分工,通道不复用。
|
|
552
|
-
sendDisplayMessage: (message) => {
|
|
553
|
-
guardStaleCtx(() => pi.sendMessage(message), {
|
|
554
|
-
label: "subagent-workflow:sendDisplayMessage",
|
|
555
|
-
onStale: (error) =>
|
|
556
|
-
logger.warn("notify abandon display skipped (stale ctx)", {
|
|
557
|
-
error: toErrorMessage(error),
|
|
558
|
-
}),
|
|
559
|
-
});
|
|
560
|
-
},
|
|
561
|
-
};
|
|
525
|
+
// host 五端口接线 + 送达 stale 防御(D5 单通道 {triggerTurn:true} / stale 静默降级 /
|
|
526
|
+
// abandon 补显形 T4③)收敛在 @zhushanwen/pi-notify-ledger-host 工厂,权威注释随迁
|
|
527
|
+
// 工厂内;component/logger 参数保持本包 label 前缀与 warn 通道归因不变,
|
|
528
|
+
// sendDisplayMessage = 生产 bind 恒实现(NotifyLedgerHost 可选端口的本侧既有语义)。
|
|
529
|
+
const ledgerHost = createPiNotifyLedgerHost(pi, ctx, {
|
|
530
|
+
component: "subagent-workflow",
|
|
531
|
+
logger,
|
|
532
|
+
sendDisplayMessage: true,
|
|
533
|
+
});
|
|
562
534
|
// bind 与 recover 拆独立 try(失败归因不同):
|
|
563
535
|
// - bind 失败:槽上无 ledger,消费方(getBoundNotifyLedger)退回内核直发路径;
|
|
564
536
|
// - recover 失败:bind 已成功、槽上 ledger 仍在,消费方照常走账本路径(重启重放
|
package/src/workflow-notify.ts
CHANGED
|
@@ -103,7 +103,7 @@ export const MAX_NOTIFIED_RUN_IDS = 1000;
|
|
|
103
103
|
* 模块私有(原 export 已删):无跨文件消费者,测试经 notifyDone 公共入口
|
|
104
104
|
* 观察并内联类型。
|
|
105
105
|
*/
|
|
106
|
-
interface WorkflowNotifyDetails {
|
|
106
|
+
interface WorkflowNotifyDetails { // oe-exempt:20260929:framework:workflow/record 协议契约类型——ports 类型契约先行、单实现常态(dev-0.10.5 已验收代码 merge 带入)
|
|
107
107
|
runId: string;
|
|
108
108
|
name: string;
|
|
109
109
|
status: string;
|