@zhushanwen/subagent-core 0.4.0 → 0.5.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/dist/{chunk-4KN4TTG7.js → chunk-43ONBFZX.js} +1 -1
- package/dist/{chunk-X7SZ5HLQ.js → chunk-V3VHZ2VX.js} +20 -27
- package/dist/execution/engine/engines/zcode/constants.cjs +29 -41
- package/dist/execution/engine/engines/zcode/constants.d.cts +65 -53
- package/dist/execution/engine/engines/zcode/constants.d.ts +65 -53
- package/dist/execution/engine/engines/zcode/constants.js +17 -27
- package/dist/execution/engine/engines/zcode/reader.d.cts +2 -1
- package/dist/execution/engine/engines/zcode/reader.d.ts +2 -1
- package/dist/execution/engine/engines/zcode/reader.js +2 -2
- package/dist/index.cjs +16418 -14070
- package/dist/index.d.cts +5136 -4016
- package/dist/index.d.ts +5136 -4016
- package/dist/index.js +16343 -14048
- package/dist/{types-DpUO16pj.d.cts → types-Dv4QhSJ_.d.cts} +215 -112
- package/dist/{types-DpUO16pj.d.ts → types-Dv4QhSJ_.d.ts} +215 -112
- package/package.json +3 -3
- package/src/__tests__/agent-opts-resolver-schema-prompt.test.ts +0 -1
- package/src/__tests__/append-system-prompt-assembly.test.ts +8 -7
- package/src/__tests__/fr4-get-state-handshake.test.ts +2 -2
- package/src/__tests__/m2-append-content-probe.test.ts +0 -1
- package/src/__tests__/manifest-store.test.ts +10 -9
- package/src/__tests__/record-store-cache.test.ts +0 -2
- package/src/__tests__/record-store-index.test.ts +1 -2
- package/src/__tests__/review-fix-loop-script.test.ts +4 -2
- package/src/__tests__/review-fix-loop-utils.test.ts +10 -10
- package/src/__tests__/robustness-low-batch1.test.ts +6 -5
- package/src/__tests__/robustness-medium-batch1.test.ts +2 -2
- package/src/__tests__/robustness-medium-batch2.test.ts +17 -6
- package/src/__tests__/robustness-medium-batch4.test.ts +2 -2
- package/src/__tests__/session-runner.test.ts +1 -1
- package/src/core/__tests__/host-services.test.ts +2 -2
- package/src/core/__tests__/logger.test.ts +1 -1
- package/src/core/error-message.ts +9 -0
- package/src/core/host-services.ts +21 -5
- package/src/core/notify-ports.ts +18 -5
- package/src/execution/__tests__/agent-profile.test.ts +4 -4
- package/src/execution/__tests__/agent-registry.test.ts +370 -0
- package/src/execution/__tests__/agent-result-mapper.test.ts +18 -2
- package/src/execution/__tests__/agents-assembly.test.ts +2 -2
- package/src/execution/__tests__/ask-user-transit-e2e.test.ts +6 -6
- package/src/execution/__tests__/chat-engine-routing.test.ts +68 -33
- package/src/execution/__tests__/chatmode-first-round-closure-spawn.test.ts +4 -4
- package/src/execution/__tests__/cold-resurrect.test.ts +283 -0
- package/src/execution/__tests__/delivery-methods.test.ts +75 -62
- package/src/execution/__tests__/descendant-sweep-guards.test.ts +220 -0
- package/src/execution/__tests__/descendant-sweep.test.ts +6 -6
- package/src/execution/__tests__/dialog-queue.test.ts +2 -2
- package/src/execution/__tests__/engine-model-validation.test.ts +741 -0
- package/src/execution/__tests__/epipe-fallback.test.ts +29 -24
- package/src/execution/__tests__/execute-and-await-worktree.test.ts +21 -91
- package/src/execution/__tests__/execute-nesting.test.ts +34 -188
- package/src/execution/__tests__/execution-record.test.ts +217 -60
- package/src/execution/__tests__/execution-runtime-face.test.ts +5 -5
- package/src/execution/__tests__/explicit-agent-ref-guard.test.ts +3 -3
- package/src/execution/__tests__/finalize-record.test.ts +173 -17
- package/src/execution/__tests__/gc-timer.test.ts +55 -2
- package/src/execution/__tests__/get-record-for-action-restart.test.ts +12 -12
- package/src/execution/__tests__/get-state-handshake.test.ts +1 -1
- package/src/execution/__tests__/helpers/mock-extension-api.ts +1 -1
- package/src/execution/__tests__/helpers/session-runner-mocks.ts +113 -0
- package/src/execution/__tests__/helpers/spawn-mock.ts +150 -3
- package/src/execution/__tests__/helpers/subagent-service-mocks.ts +137 -0
- package/src/execution/__tests__/keep-alive-no-progress.test.ts +50 -148
- package/src/execution/__tests__/kill-all-escalation.test.ts +2 -2
- package/src/execution/__tests__/lifecycle-predicates.test.ts +1 -2
- package/src/execution/__tests__/manifest-parentid.test.ts +4 -4
- package/src/execution/__tests__/max-turns-to-watchdog-ms.test.ts +1 -1
- package/src/execution/__tests__/model-resolver.test.ts +2 -2
- package/src/execution/__tests__/nested-visibility-env-propagation.test.ts +23 -121
- package/src/execution/__tests__/nested-visibility.test.ts +2 -0
- package/src/execution/__tests__/notify-ledger.test.ts +973 -18
- package/src/execution/__tests__/output-collector.test.ts +117 -6
- package/src/execution/__tests__/pi-invocation.test.ts +1 -1
- package/src/execution/__tests__/record-store.test.ts +10 -9
- package/src/execution/__tests__/records-cwd-isolation.test.ts +2 -2
- package/src/execution/__tests__/recursive-visibility-baseline.test.ts +29 -132
- package/src/execution/__tests__/recursive-visibility-env.test.ts +55 -179
- package/src/execution/__tests__/rpc-mode.test.ts +2 -2
- package/src/execution/__tests__/run-and-finalize-anchoring.test.ts +387 -0
- package/src/execution/__tests__/run-and-finalize-chatmode.test.ts +15 -9
- package/src/execution/__tests__/run-spawn-chatmode-settled.test.ts +4 -4
- package/src/execution/__tests__/run-spawn-edges.test.ts +17 -15
- package/src/execution/__tests__/run-spawn-integration.test.ts +2 -2
- package/src/execution/__tests__/run-spawn-resume.test.ts +2 -2
- package/src/execution/__tests__/run-spawn-rpc-mode.test.ts +2 -2
- package/src/execution/__tests__/run-spawn-stdout-callback-throw.test.ts +4 -4
- package/src/execution/__tests__/service-kill-escalation.test.ts +7 -5
- package/src/execution/__tests__/session-context-resolver.test.ts +0 -2
- package/src/execution/__tests__/session-file-gc.test.ts +35 -0
- package/src/execution/__tests__/session-pending.test.ts +257 -14
- package/src/execution/__tests__/session-reconstructor.test.ts +366 -15
- package/src/execution/__tests__/session-runner-branch-cache-lru.test.ts +1 -1
- package/src/execution/__tests__/session-runner-close-prune.test.ts +2 -2
- package/src/execution/__tests__/session-runner-dispatch.test.ts +489 -0
- package/src/execution/__tests__/session-runner-epipe.test.ts +3 -3
- package/src/execution/__tests__/session-runner-heartbeat-idle-fallback.test.ts +5 -4
- package/src/execution/__tests__/session-runner-lifecycle-helpers.test.ts +290 -0
- package/src/execution/__tests__/session-runner-schema-env.test.ts +7 -5
- package/src/execution/__tests__/settled-watchdog.test.ts +282 -47
- package/src/execution/__tests__/spawn-args.test.ts +11 -10
- package/src/execution/__tests__/spawn-event-adapter-rpc.test.ts +26 -23
- package/src/execution/__tests__/spawn-event-adapter.test.ts +1 -1
- package/src/execution/__tests__/spawn-worktree-guidance.test.ts +5 -4
- package/src/execution/__tests__/spawned-children.test.ts +2 -1
- package/src/execution/__tests__/start-sync-model-guard.test.ts +4 -4
- package/src/execution/__tests__/stdin-writer.test.ts +6 -4
- package/src/execution/__tests__/stream-sink-retirement.test.ts +6 -6
- package/src/execution/__tests__/subagent-actions-core.test.ts +42 -22
- package/src/execution/__tests__/subagent-service-message-close.test.ts +29 -26
- package/src/execution/__tests__/subagent-service-multiproc-guard.test.ts +8 -8
- package/src/execution/__tests__/subagent-service-notify-gate.test.ts +27 -22
- package/src/execution/__tests__/subagent-service-parent-guard.test.ts +30 -29
- package/src/execution/__tests__/subagent-service-recovery-bounds.test.ts +45 -20
- package/src/execution/__tests__/subagent-service.test.ts +37 -30
- package/src/execution/__tests__/subprocess-agent-runner-routing.test.ts +88 -12
- package/src/execution/__tests__/subprocess-agent-runner-timeout.test.ts +75 -0
- package/src/execution/__tests__/subprocess-agent-runner.test.ts +22 -20
- package/src/execution/__tests__/temp-prompt.test.ts +1 -1
- package/src/execution/__tests__/timeout-integration.test.ts +6 -5
- package/src/execution/__tests__/turn-limiter-semantics.test.ts +1 -1
- package/src/execution/__tests__/turn-limiter.test.ts +1 -1
- package/src/execution/__tests__/ui-request-handler-factory.test.ts +12 -6
- package/src/execution/__tests__/ui-request-handler.test.ts +4 -3
- package/src/execution/__tests__/ui-request-queue.test.ts +142 -2
- package/src/execution/__tests__/worktree-manager.test.ts +14 -5
- package/src/execution/__tests__/worktree-pid-registration.integration.test.ts +4 -3
- package/src/execution/agent-registry.ts +74 -30
- package/src/execution/agent-result-mapper.ts +3 -0
- package/src/execution/cold-resurrect.ts +199 -0
- package/src/execution/engine/__tests__/common/capability-gate.test.ts +91 -0
- package/src/execution/engine/__tests__/common/data-dir.test.ts +1 -1
- package/src/execution/engine/__tests__/common/journal-wiring.test.ts +84 -0
- package/src/execution/engine/__tests__/common/kill-chain.test.ts +34 -7
- package/src/execution/engine/__tests__/common/persona-router.test.ts +4 -5
- package/src/execution/engine/__tests__/common/pool-manager.test.ts +211 -51
- package/src/execution/engine/__tests__/common/session-view-service-zcode-dbpath.test.ts +149 -0
- package/src/execution/engine/__tests__/common/session-view-service.test.ts +499 -0
- package/src/execution/engine/__tests__/conformance/contract.abort.test.ts +22 -112
- package/src/execution/engine/__tests__/conformance/contract.agent-events.test.ts +15 -28
- package/src/execution/engine/__tests__/conformance/engine-conformance.live.test.ts +12 -12
- package/src/execution/engine/__tests__/conformance/golden-replay.pi.test.ts +1 -1
- package/src/execution/engine/__tests__/conformance/golden-replay.zcode.test.ts +21 -82
- package/src/execution/engine/__tests__/conformance/zcode-appserver-harness.ts +4 -7
- package/src/execution/engine/__tests__/engine-discovery.test.ts +15 -3
- package/src/execution/engine/__tests__/model-prompt.test.ts +15 -3
- package/src/execution/engine/__tests__/registry.test.ts +4 -2
- package/src/execution/engine/__tests__/routing.test.ts +115 -6
- package/src/execution/engine/common/capability-gate.ts +92 -0
- package/src/execution/engine/common/journal-wiring.ts +97 -0
- package/src/execution/engine/common/kill-chain.ts +42 -10
- package/src/execution/engine/common/nesting-guard.ts +66 -0
- package/src/execution/engine/common/persona-router.ts +18 -8
- package/src/execution/engine/common/pool-manager.ts +332 -78
- package/src/execution/engine/common/session-view-service.ts +506 -0
- package/src/execution/engine/common/session-view-types.ts +125 -0
- package/src/execution/engine/engines/pi/__tests__/pi-engine.test.ts +174 -28
- package/src/execution/engine/engines/pi/__tests__/spawn-opts-direct.test.ts +257 -0
- package/src/execution/{argv-mirror.ts → engine/engines/pi/argv-mirror.ts} +43 -21
- package/src/execution/{get-state-handshake.ts → engine/engines/pi/get-state-handshake.ts} +1 -1
- package/src/execution/{output-collector.ts → engine/engines/pi/output-collector.ts} +108 -19
- package/src/execution/engine/engines/pi/pi-engine.ts +434 -38
- package/src/execution/{pi-invocation.ts → engine/engines/pi/pi-invocation.ts} +2 -2
- package/src/execution/engine/engines/pi/reader.ts +11 -0
- package/src/execution/engine/engines/pi/registration.ts +4 -2
- package/src/execution/{session-runner.ts → engine/engines/pi/session-runner.ts} +617 -412
- package/src/execution/{spawn-event-adapter.ts → engine/engines/pi/spawn-event-adapter.ts} +75 -34
- package/src/execution/{stdin-writer.ts → engine/engines/pi/stdin-writer.ts} +10 -9
- package/src/execution/{temp-prompt.ts → engine/engines/pi/temp-prompt.ts} +2 -2
- package/src/execution/{turn-limiter.ts → engine/engines/pi/turn-limiter.ts} +1 -1
- package/src/execution/engine/engines/zcode/__tests__/__fixtures__/fake-appserver.mjs +54 -27
- package/src/execution/engine/engines/zcode/__tests__/appserver-launcher.test.ts +321 -0
- package/src/execution/engine/engines/zcode/__tests__/connection.test.ts +13 -12
- package/src/execution/engine/engines/zcode/__tests__/parser.test.ts +7 -210
- package/src/execution/engine/engines/zcode/__tests__/preparer.test.ts +6 -110
- package/src/execution/engine/engines/zcode/__tests__/session-channel-dispose-harvest.test.ts +247 -0
- package/src/execution/engine/engines/zcode/__tests__/session-channel-turn-timers.test.ts +451 -0
- package/src/execution/engine/engines/zcode/__tests__/session-channel.test.ts +20 -8
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-appserver.test.ts +77 -110
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-degrade.test.ts +25 -319
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-dispose.test.ts +210 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-retry.test.ts +353 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-status.test.ts +282 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-timeout.test.ts +372 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine.live.test.ts +48 -148
- package/src/execution/engine/engines/zcode/appserver-launcher.ts +167 -0
- package/src/execution/engine/engines/zcode/connection.ts +24 -11
- package/src/execution/engine/engines/zcode/constants.ts +75 -71
- package/src/execution/engine/engines/zcode/golden-sample.ts +8 -46
- package/src/execution/engine/engines/zcode/parser.ts +12 -346
- package/src/execution/engine/engines/zcode/preparer.ts +12 -143
- package/src/execution/engine/engines/zcode/session-channel.ts +351 -39
- package/src/execution/engine/engines/zcode/zcode-engine.ts +665 -760
- package/src/execution/engine/host-task-spec.ts +32 -36
- package/src/execution/engine/model-validation.ts +177 -0
- package/src/execution/engine/port.ts +24 -6
- package/src/execution/engine/routing.ts +75 -1
- package/src/execution/engine/types.ts +30 -103
- package/src/execution/execution-record.ts +222 -144
- package/src/execution/finalize-record.ts +131 -93
- package/src/execution/idle-gc.ts +28 -0
- package/src/execution/lifecycle-predicates.ts +1 -1
- package/src/execution/notify-host.ts +212 -0
- package/src/execution/record-store.ts +119 -73
- package/src/execution/round-settlement.ts +93 -0
- package/src/execution/session-file-gc.ts +96 -62
- package/src/execution/session-reconstructor.ts +256 -143
- package/src/execution/sessions-index.ts +117 -47
- package/src/execution/settled-watchdog.ts +264 -52
- package/src/execution/subagent-actions-core.ts +22 -22
- package/src/execution/subagent-service.ts +815 -963
- package/src/execution/subprocess-agent-runner.ts +144 -97
- package/src/execution/types.ts +9 -0
- package/src/execution/ui-request-handler-factory.ts +102 -74
- package/src/execution/ui-request-queue.ts +50 -19
- package/src/index.ts +442 -316
- package/src/orchestration/__tests__/agent-call-catch-fallback.test.ts +1 -1
- package/src/orchestration/__tests__/agent-call-stream.test.ts +2 -2
- package/src/orchestration/__tests__/args-validator.test.ts +14 -0
- package/src/orchestration/__tests__/error-recovery-rebuild-failure.test.ts +1 -1
- package/src/orchestration/__tests__/error-recovery-terminal-hardening.test.ts +11 -9
- package/src/orchestration/__tests__/execute-agent-call.test.ts +151 -11
- package/src/orchestration/__tests__/file-run-store.test.ts +7 -6
- package/src/orchestration/__tests__/launcher-nested-workflow.test.ts +2 -2
- package/src/orchestration/__tests__/lifecycle-abort-broadcast-signal.test.ts +1 -1
- package/src/orchestration/__tests__/lifecycle-runid-injection.test.ts +3 -3
- package/src/orchestration/__tests__/lifecycle.test.ts +7 -5
- package/src/orchestration/__tests__/non-cloneable-return-e2e.test.ts +1 -1
- package/src/orchestration/__tests__/run-snapshot.test.ts +8 -5
- package/src/orchestration/__tests__/script-lint.test.ts +17 -0
- package/src/orchestration/__tests__/test-mocks.ts +2 -0
- package/src/orchestration/__tests__/worker-exit-without-result.test.ts +7 -6
- package/src/orchestration/__tests__/worker-message-pump-finalize-run.test.ts +229 -0
- package/src/orchestration/__tests__/{error-recovery-handlers.test.ts → worker-message-pump-handlers.test.ts} +27 -19
- package/src/orchestration/__tests__/{error-recovery-postmessage-defense.test.ts → worker-message-pump-postmessage-defense.test.ts} +8 -8
- package/src/orchestration/__tests__/{error-recovery-serialize-failed-result.test.ts → worker-message-pump-serialize-failed-result.test.ts} +2 -2
- package/src/orchestration/__tests__/{error-recovery-workflow-call.test.ts → worker-message-pump-workflow-call.test.ts} +1 -1
- package/src/orchestration/__tests__/worker-pending-timeout-abort.test.ts +1 -1
- package/src/orchestration/__tests__/worker-script-builder.test.ts +1 -1
- package/src/orchestration/__tests__/workflow-nesting-e2e.test.ts +1 -1
- package/src/orchestration/agent-opts-resolver.ts +1 -1
- package/src/orchestration/args-validator.ts +53 -31
- package/src/orchestration/execute-agent-call.ts +19 -73
- package/src/orchestration/launcher.ts +128 -81
- package/src/orchestration/lifecycle.ts +43 -45
- package/src/orchestration/models/ports.ts +4 -4
- package/src/orchestration/models/run-runtime.ts +2 -2
- package/src/orchestration/models/trace.ts +1 -1
- package/src/orchestration/models/types.ts +111 -22
- package/src/orchestration/models/workflow-run.ts +1 -1
- package/src/orchestration/script-lint.ts +91 -58
- package/src/orchestration/{error-recovery.ts → worker-message-pump.ts} +157 -150
- package/src/shared/__tests__/meta-parser.test.ts +151 -0
- package/src/shared/__tests__/resource-discovery.test.ts +258 -215
- package/src/shared/atomic-write.ts +12 -9
- package/src/shared/meta-parser.ts +158 -84
- package/src/shared/model-ref.ts +15 -2
- package/src/shared/resource-discovery.ts +9 -183
- package/src/shared/schema-jsonify.ts +1 -1
- package/workflows/review-fix-loop-utils.cjs +151 -89
- package/workflows/review-fix-loop-utils.d.cts +287 -0
- package/src/execution/__tests__/execute-options-mapper.test.ts +0 -200
- package/src/execution/engine/engines/pi/__tests__/task-spec-mapper.test.ts +0 -164
- package/src/execution/engine/engines/pi/task-spec-mapper.ts +0 -100
- package/src/execution/engine/engines/zcode/__tests__/__fixtures__/zcode-golden-spawn.json +0 -39
- package/src/execution/engine/engines/zcode/__tests__/launcher.test.ts +0 -150
- package/src/execution/engine/engines/zcode/__tests__/preparer-appserver.test.ts +0 -387
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine.test.ts +0 -710
- package/src/execution/engine/engines/zcode/appserver-home.ts +0 -442
- package/src/execution/engine/engines/zcode/appserver-probe.ts +0 -141
- package/src/execution/engine/engines/zcode/launcher.ts +0 -161
- package/src/execution/execute-options-mapper.ts +0 -115
- package/src/shared/__tests__/resource-discovery-manifest-cache.test.ts +0 -288
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GuiRenderResult } from '@xyz-agent/extension-protocol';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* ModelRegistry 的最小接口(duck-typed,测试可 mock)。
|
|
3
5
|
* 字段结构与 Pi SDK 的 ctx.modelRegistry 对齐。
|
|
@@ -49,6 +51,19 @@ interface ResolvedModel {
|
|
|
49
51
|
thinkingLevel: string | undefined;
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/**
|
|
55
|
+
* 未显式指定 agent 时的兜底名。
|
|
56
|
+
*
|
|
57
|
+
* 必须是真实存在、可被 agentRegistry 发现的 agent(用户 agentDir 内置的通用 agent)。
|
|
58
|
+
* Service 层(resolveIdentity)与 TUI 层(extractAgentName)共用此常量,保证
|
|
59
|
+
* 「调用时显示的名」与「实际加载的 agent.md」一致。
|
|
60
|
+
*
|
|
61
|
+
* [HISTORICAL] 旧实现两处各硬编码:service 用 "default"(虚构名),format 用
|
|
62
|
+
* "worker"(真实但不是兜底语义,worker agent 已在 2026-08 agent 重构中删除)。
|
|
63
|
+
* 导致不传 agent 时,block 标题显示 worker,但实际执行兜底逻辑不一致。统一为
|
|
64
|
+
* general-purpose 后名实相符。
|
|
65
|
+
*/
|
|
66
|
+
declare const DEFAULT_AGENT_NAME = "general-purpose";
|
|
52
67
|
/**
|
|
53
68
|
* 唯一执行状态。所有路径共用。v4 B-1 两态收敛:旧 idle 折入 running、
|
|
54
69
|
* 旧 cancelled 折入 closed(closedReason='cancelled' 区分)。
|
|
@@ -86,6 +101,8 @@ type ClosedReason = 'parent-shutdown' | 'parent-fork' | 'parent-new' | 'user-clo
|
|
|
86
101
|
*/
|
|
87
102
|
declare class ResurrectDeniedError extends Error {
|
|
88
103
|
}
|
|
104
|
+
/** ClosedReason 全枚举值(运行时守卫用——防御性解析外部输入时校验成员资格)。 */
|
|
105
|
+
declare const CLOSED_REASONS: readonly ClosedReason[];
|
|
89
106
|
/**
|
|
90
107
|
* 终态三态对外语义(U3 C-outcome 一等披露)。
|
|
91
108
|
*
|
|
@@ -279,6 +296,12 @@ interface AgentResult$1 {
|
|
|
279
296
|
durationMs: number;
|
|
280
297
|
success: boolean;
|
|
281
298
|
error?: string;
|
|
299
|
+
/**
|
|
300
|
+
* [D5-③] 失败分诊结构化标签(类型 SSOT 在 orchestration/models/types.ts 的
|
|
301
|
+
* AgentFailureKind——消费语义「unknown=可重试」与其文档同源)。collectResult 对
|
|
302
|
+
* 最终 error 分类后写入;缺省 = unknown(可重试)。type-only 引用零运行时依赖。
|
|
303
|
+
*/
|
|
304
|
+
failureKind?: AgentFailureKind;
|
|
282
305
|
sessionId: string;
|
|
283
306
|
toolCalls: ToolCall[];
|
|
284
307
|
usage?: AgentUsageTotal;
|
|
@@ -306,6 +329,14 @@ interface AliveMarker {
|
|
|
306
329
|
readonly id: string;
|
|
307
330
|
readonly startedAt: number;
|
|
308
331
|
}
|
|
332
|
+
/** git diff patch 结果。 */
|
|
333
|
+
interface PatchResult {
|
|
334
|
+
readonly patchFile: string;
|
|
335
|
+
readonly failed: boolean;
|
|
336
|
+
/** patch 是否实际写入 patchFile。true=diff 非空且写盘成功;false=空 diff 或写失败。
|
|
337
|
+
* 调用方据此回填 record.patchFile,避免悬空路径(`git apply` 不存在的文件)。 */
|
|
338
|
+
readonly written: boolean;
|
|
339
|
+
}
|
|
309
340
|
/** fork depth 超限错误。 */
|
|
310
341
|
declare class ForkDepthExceededError extends Error {
|
|
311
342
|
constructor(message: string);
|
|
@@ -676,6 +707,55 @@ interface MessageResponse {
|
|
|
676
707
|
interface CloseResponse {
|
|
677
708
|
closed: true;
|
|
678
709
|
}
|
|
710
|
+
/**
|
|
711
|
+
* Tool 外层出参(renderResult + LLM content JSON 同源)。
|
|
712
|
+
* adapter 唯一产出:领域对象(bg/list/cancel/message/close 五选一)+ action/subagentId/sessionFile。
|
|
713
|
+
*
|
|
714
|
+
* - background 启动 → bgResponse(subagentId 有值;sessionFile 窗口期可能 undefined)
|
|
715
|
+
* - list → listResponse(最外层 subagentId/sessionFile 为 null,sessionFile 在各 item 内)
|
|
716
|
+
* - cancel → cancelResponse(subagentId 有值;sessionFile 无意义,可为 null)
|
|
717
|
+
* - message → messageResponse(subagentId 有值;sessionFile 无意义,可为 null)
|
|
718
|
+
* - close → closeResponse(subagentId 有值;sessionFile 无意义,可为 null)
|
|
719
|
+
*/
|
|
720
|
+
type SubagentToolResult = {
|
|
721
|
+
action: "start";
|
|
722
|
+
subagentId: string;
|
|
723
|
+
sessionFile: string | null;
|
|
724
|
+
slug: string; /** registry 全等回显(U1):放行即与 registry 条目全等,"provider/id" 形态。 */
|
|
725
|
+
model: string;
|
|
726
|
+
bgResponse: BgResponse;
|
|
727
|
+
__gui__?: GuiRenderResult;
|
|
728
|
+
} | {
|
|
729
|
+
action: "list";
|
|
730
|
+
subagentId: null;
|
|
731
|
+
sessionFile: null;
|
|
732
|
+
listResponse: ListResponse;
|
|
733
|
+
__gui__?: GuiRenderResult;
|
|
734
|
+
} | {
|
|
735
|
+
action: "cancel";
|
|
736
|
+
subagentId: string;
|
|
737
|
+
sessionFile: null;
|
|
738
|
+
cancelResponse: CancelResponse;
|
|
739
|
+
__gui__?: GuiRenderResult;
|
|
740
|
+
} | {
|
|
741
|
+
action: "message";
|
|
742
|
+
subagentId: string;
|
|
743
|
+
sessionFile: null;
|
|
744
|
+
messageResponse: MessageResponse;
|
|
745
|
+
__gui__?: GuiRenderResult;
|
|
746
|
+
} | {
|
|
747
|
+
action: "close";
|
|
748
|
+
subagentId: string;
|
|
749
|
+
sessionFile: null;
|
|
750
|
+
closeResponse: CloseResponse;
|
|
751
|
+
__gui__?: GuiRenderResult;
|
|
752
|
+
} | {
|
|
753
|
+
action: "fork-from";
|
|
754
|
+
subagentId: string;
|
|
755
|
+
sessionFile: string | null;
|
|
756
|
+
forkFromResponse: ForkFromResponse;
|
|
757
|
+
__gui__?: GuiRenderResult;
|
|
758
|
+
};
|
|
679
759
|
/** fork-from 的内层响应:新 subagent id + 作为继承源的旧记录 session 文件。
|
|
680
760
|
* [v8.5 B] 断联恢复通道——新 subagent 以 --fork 方式继承旧会话历史,源文件只读
|
|
681
761
|
* 不续写(pi fork 建 branched session,copy-on-write)。 */
|
|
@@ -696,6 +776,8 @@ interface SubagentRecord {
|
|
|
696
776
|
status: ExecutionStatus;
|
|
697
777
|
/** L2 关闭原因子枚举(仅 status="closed" 时有意义)。SP-1 新增。 */
|
|
698
778
|
closedReason?: ClosedReason;
|
|
779
|
+
/** 终态三态对外语义(U3 C-outcome)。磁盘重建源一等直读;无字段的存量兜底走 projectOutcome。 */
|
|
780
|
+
outcome?: ExecutionOutcome;
|
|
699
781
|
mode: ExecutionMode;
|
|
700
782
|
startedAt: number;
|
|
701
783
|
/** 根 Pi session ID(session 隔离过滤用)。递归链上所有层 record 同值。 */
|
|
@@ -844,7 +926,36 @@ type RunStatus = "running" | "done";
|
|
|
844
926
|
/** 终态原因。done 时必有(WorkflowRun 不变式)。 */
|
|
845
927
|
type DoneReason = "completed" | "failed" | "aborted" | "budget_limited" | "time_limited" | "invalid_args";
|
|
846
928
|
/**
|
|
847
|
-
*
|
|
929
|
+
* slug 最大长度(D6 合流迁入本文件,原权威定义在已删除的 execution/execute-options-mapper.ts)。
|
|
930
|
+
* 历史值 20 偏紧——描述性 slug 如 "audit-structured-output"(23)/ "fix-subagent-wf-tools"(21)
|
|
931
|
+
* 会撞上限,放宽到 35 兼顾「短到能塞进 TUI 标题行」与「容纳合理描述性 kebab-case 名」。
|
|
932
|
+
* 放本文件的原因:约束对象是 AgentCallOpts.description(slug 的源字段,见下方 slug 派生说明),
|
|
933
|
+
* 与字段同文件;worker-message-pump(live record slug 截断)与壳侧 tool schema maxLength 共享引用。
|
|
934
|
+
*/
|
|
935
|
+
declare const SLUG_MAX_LENGTH = 35;
|
|
936
|
+
/**
|
|
937
|
+
* 单次 agent 调用的任务声明(D6 任务形状合流后的单一形状)。
|
|
938
|
+
*
|
|
939
|
+
* [D6 合流裁决] 本类型 = 原 AgentCallOpts(workflow 调用方声明,18 字段)与原
|
|
940
|
+
* AgentTaskSpec(engine 中立任务声明,已删除)的合流形态,从模型脚本 agent() API
|
|
941
|
+
* 到 EnginePort.run 直达 pi 边界一次映射——SAR 链路上的 ExecuteOptions/AgentTaskSpec
|
|
942
|
+
* 中间态消除(设计 docs/design/subagent-dual-track-convergence.md §3.3 D6 / 终态四)。
|
|
943
|
+
*
|
|
944
|
+
* 终态命名按变化轴裁定为 AgentCallOpts,理由:
|
|
945
|
+
* - 字段演进的首要驱动轴是「调用方要表达的任务语义」(agent() API 是唯一生产写入方,
|
|
946
|
+
* 合流字段中 prompt/description/skill/skillPath/schemaEnv/thinkingLevel 等多数派
|
|
947
|
+
* 已是调用方命名);
|
|
948
|
+
* - 原 AgentTaskSpec 的中立重命名层(task/slug/effort/persona)与调用方命名是
|
|
949
|
+
* 形式同构、语义同构的假差异(prompt≡task、slug=description 截断、effort≡thinkingLevel、
|
|
950
|
+
* persona≡skillPath+appendSystemPrompt 平铺),按「消假差异」原则并入调用方命名;
|
|
951
|
+
* - 持久化兼容反向锁定 prompt 形态:jsonl run 快照的 AgentCall.opts 与 worker 消息
|
|
952
|
+
* opts 均以 prompt 字段落盘,改名会破坏旧快照重水合。
|
|
953
|
+
*
|
|
954
|
+
* 引擎中立字段的并入方式(可选字段,原 AgentTaskSpec 独有字段去向):
|
|
955
|
+
* - graceTurns / conversation / idleTimeoutMs / denyTools / permissionMode:可选并入;
|
|
956
|
+
* - persona.agentRef:裁撤(无生产写入方、无消费者——pi 走 agent 字段解析身份);
|
|
957
|
+
* - requires:裁撤(P4 形状预留、无生产写入方;且并入需 import EngineCapabilities
|
|
958
|
+
* 形成 orchestration↔engine 类型环)。将来能力依赖声明下钻时在本形状上加回。
|
|
848
959
|
*
|
|
849
960
|
* D-12 仅重组执行编排,AgentCallOpts 形状保持兼容。
|
|
850
961
|
*/
|
|
@@ -880,14 +991,20 @@ interface AgentCallOpts {
|
|
|
880
991
|
*/
|
|
881
992
|
timeoutMs?: number;
|
|
882
993
|
/**
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
994
|
+
* Turn 上限(turn limiter 用)。
|
|
995
|
+
*
|
|
996
|
+
* [预算语义对齐] 未传或 <=0 = 不限 turn;此时也不按 turns 估算 spawn watchdog——
|
|
997
|
+
* 仅当 env XYZ_SUBAGENT_SPAWN_WATCHDOG_MS 设置时才按绝对时限挂 watchdog(见
|
|
998
|
+
* session-runner.resolveSpawnWatchdogMs)。pi 边界直出为 ExecuteOptions.maxTurns
|
|
999
|
+
* → runSpawn(D6 合流后无中间映射层)。
|
|
1000
|
+
*/
|
|
890
1001
|
maxTurns?: number;
|
|
1002
|
+
/**
|
|
1003
|
+
* Turn limiter 的宽限轮数(原 AgentTaskSpec.graceTurns 并入):超 maxTurns 后
|
|
1004
|
+
* 允许继续的轮数(等待在途工具收尾)。pi 引擎消费;workflow agent() 无写入方,
|
|
1005
|
+
* chat 域(ExecuteOptions.graceTurns 同名透传)经 host-task-spec 填充。
|
|
1006
|
+
*/
|
|
1007
|
+
graceTurns?: number;
|
|
891
1008
|
/**
|
|
892
1009
|
* Skill name to load (e.g. "code-review"). Resolved to SKILL.md path
|
|
893
1010
|
* and injected via --skill flag in the subprocess.
|
|
@@ -908,18 +1025,18 @@ interface AgentCallOpts {
|
|
|
908
1025
|
*/
|
|
909
1026
|
agent?: string;
|
|
910
1027
|
/**
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
*/
|
|
1028
|
+
* System prompt injection CONTENT (not file paths).
|
|
1029
|
+
* Set by agent-opts-resolver: schema structured-output instruction string.
|
|
1030
|
+
* Agent systemPrompt is NOT included here (handled by resolveIdentity/agentConfig).
|
|
1031
|
+
* pi 边界直出为 ExecuteOptions.appendSystemPrompt(同名同义透传,D6 合流后无中间映射层)。
|
|
1032
|
+
*/
|
|
917
1033
|
appendSystemPrompt?: string[];
|
|
918
1034
|
/**
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1035
|
+
* Schema JSON for PI_WORKFLOW_SCHEMA env var.
|
|
1036
|
+
* Set by agent-opts-resolver when opts.schema is present (值 = stringifySchemaCached
|
|
1037
|
+
* compact,与 schema 派生等值); passed as env var to activate the structured-output
|
|
1038
|
+
* tool + hook. pi 边界直出时 schema 派生优先、本字段兜底(解耦形态通道,生产不可达)。
|
|
1039
|
+
*/
|
|
923
1040
|
schemaEnv?: string;
|
|
924
1041
|
/**
|
|
925
1042
|
* Per-call 工作目录(ADR-029 决策 1)。传给 child_process.spawn 的 cwd option。
|
|
@@ -938,11 +1055,36 @@ interface AgentCallOpts {
|
|
|
938
1055
|
* agent() → execute-agent-call → SAR 路由层。
|
|
939
1056
|
*/
|
|
940
1057
|
engine?: string;
|
|
941
|
-
/** Filesystem isolation: when true, creates a new git worktree for the agent. Independent of fork.
|
|
942
|
-
|
|
1058
|
+
/** Filesystem isolation: when true, creates a new git worktree for the agent. Independent of fork.
|
|
1059
|
+
* [D6 合流] 类型扩展为 boolean | WorktreeHandle(原 AgentTaskSpec.worktree 的超集)——
|
|
1060
|
+
* WorktreeHandle 形态仅在 chat 域(复用外部已创建的 worktree)出现,workflow agent()
|
|
1061
|
+
* 恒传 boolean。 */
|
|
1062
|
+
worktree?: boolean | WorktreeHandle;
|
|
943
1063
|
/** When true, agent() resolves {value, sessionFile, worktreePath, error} instead of a bare value.
|
|
944
|
-
* Worker-layer flag only — not
|
|
1064
|
+
* Worker-layer flag only — not consumed by any engine (dropped at the pi boundary). */
|
|
945
1065
|
returnMeta?: boolean;
|
|
1066
|
+
/**
|
|
1067
|
+
* 可持续对话模式(原 AgentTaskSpec.conversation 并入):true = record 标记 chatMode,
|
|
1068
|
+
* 轮次完成进 idle 态等待 message 续聊。chat 域(ExecuteOptions.conversation 同名)经
|
|
1069
|
+
* host-task-spec 填充;workflow agent() 无写入方。
|
|
1070
|
+
*/
|
|
1071
|
+
conversation?: boolean;
|
|
1072
|
+
/**
|
|
1073
|
+
* 空闲超时毫秒数(原 AgentTaskSpec.idleTimeoutMs 并入,仅 conversation 模式有意义)。
|
|
1074
|
+
* 优先级:参数 > env XYZ_SUBAGENT_IDLE_TIMEOUT_MS > 默认 300000ms;显式 0/负 = 禁用
|
|
1075
|
+
* idle GC。chat 域经 host-task-spec 填充。
|
|
1076
|
+
*/
|
|
1077
|
+
idleTimeoutMs?: number;
|
|
1078
|
+
/**
|
|
1079
|
+
* 工具 denylist(原 AgentTaskSpec.denyTools 并入,中立新增面):各引擎做语法映射
|
|
1080
|
+
* (zcode buildZcodeArgv 消费;pi 链路暂无对应面)。无 workflow 写入方,预留形状。
|
|
1081
|
+
*/
|
|
1082
|
+
denyTools?: string[];
|
|
1083
|
+
/**
|
|
1084
|
+
* 中立权限模式(原 AgentTaskSpec.permissionMode 并入,预留形状):映射按各引擎
|
|
1085
|
+
* capabilities.permissionMode。无生产写入方/消费者。
|
|
1086
|
+
*/
|
|
1087
|
+
permissionMode?: string;
|
|
946
1088
|
}
|
|
947
1089
|
/**
|
|
948
1090
|
* 单次 agent 调用的资源用量(FR-7 跨 turn 累积)。
|
|
@@ -965,6 +1107,23 @@ interface ToolCallEntry {
|
|
|
965
1107
|
/** Args preview string. */
|
|
966
1108
|
input: string;
|
|
967
1109
|
}
|
|
1110
|
+
/**
|
|
1111
|
+
* 失败分诊结构化标签(D5-③,r1 MF4 钉正语义)。
|
|
1112
|
+
*
|
|
1113
|
+
* - stale_context:pi session context 被 compact/cancel/替换——重试无意义(同 call
|
|
1114
|
+
* 再次失败),不重试。
|
|
1115
|
+
* - schema_deterministic:确定性 schema 失败(SO tool 从未调用 / gate 终止 /
|
|
1116
|
+
* 不可满足 schema)——同 schema 重试必同结果,不重试。
|
|
1117
|
+
* - unknown:其余一切失败(瞬态 provider 错误、spawn 失败等)——**默认可重试**。
|
|
1118
|
+
*
|
|
1119
|
+
* **语义守恒(最高优先约束)**:unknown(含字段缺省)= 可重试——保持收敛前的
|
|
1120
|
+
* 默认重试语义;仅 stale_context 与 schema_deterministic 两态维持不重试特判。
|
|
1121
|
+
* 词表归属(产出侧单点识别):stale_context / schema_deterministic 的识别词表
|
|
1122
|
+
* (stale 词表与确定性 schema 失败标记前缀)保留在产出侧
|
|
1123
|
+
* execution/engine/engines/pi/output-collector.ts 包内——词表漂移的失效模式是
|
|
1124
|
+
* failureKind=unknown → 保守重试(安全默认),不再是静默漏诊。
|
|
1125
|
+
*/
|
|
1126
|
+
type AgentFailureKind = "stale_context" | "schema_deterministic" | "unknown";
|
|
968
1127
|
/**
|
|
969
1128
|
* 单次 agent 调用的结果(统一形态)。
|
|
970
1129
|
*
|
|
@@ -975,6 +1134,16 @@ interface AgentResult {
|
|
|
975
1134
|
/** Raw text output from the agent. */
|
|
976
1135
|
content: string;
|
|
977
1136
|
/**
|
|
1137
|
+
* [D5-③] 失败分诊结构化标签(AgentFailureKind)。产出侧唯一识别点 =
|
|
1138
|
+
* execution/engine/engines/pi/output-collector.ts(collectResult 对最终 error
|
|
1139
|
+
* 分类后写入,经 agent-result-mapper / AgentOutcome 透传到本形态);消费侧
|
|
1140
|
+
* execute-agent-call 读本字段分诊,不再扫 error 文案子串。
|
|
1141
|
+
*
|
|
1142
|
+
* 仅在 error !== undefined 时有意义(成功时缺省);缺省视为 unknown = 可重试
|
|
1143
|
+
* (语义守恒,见 AgentFailureKind)。
|
|
1144
|
+
*/
|
|
1145
|
+
failureKind?: AgentFailureKind;
|
|
1146
|
+
/**
|
|
978
1147
|
* Parsed structured output.
|
|
979
1148
|
* Present when `schema` was provided and the output was valid JSON.
|
|
980
1149
|
* Source: tool_execution_end.result.details(validated data object)。
|
|
@@ -1069,95 +1238,6 @@ interface WorkerLogEntry {
|
|
|
1069
1238
|
message: string;
|
|
1070
1239
|
}
|
|
1071
1240
|
|
|
1072
|
-
/** 人设(persona)注入规格:原 skillPath + appendSystemPrompt 收拢进一个语义单元(D2)。 */
|
|
1073
|
-
interface PersonaSpec {
|
|
1074
|
-
/**
|
|
1075
|
-
* agent 名/路径。与 AgentTaskSpec.agent 的分工:agent 是 resolveIdentity 的身份解析
|
|
1076
|
-
* 键(模型/系统提示等身份语义);agentRef 是 persona 注入通道的定位符——引擎按
|
|
1077
|
-
* capabilities.personaInjection 决定注入通道(file/flag/prompt)时用它定位人设。
|
|
1078
|
-
* pi 引擎不消费此字段(身份解析走 spec.agent),留给 flag/file 通道的引擎。
|
|
1079
|
-
*/
|
|
1080
|
-
agentRef?: string;
|
|
1081
|
-
/**
|
|
1082
|
-
* 原 ExecuteOptions.skillPath。公共 persona 路由三策略(file/flag/prompt)的分流
|
|
1083
|
-
* 载体(D4)——超长 prompt 时优先 file/flag 通道分流的落点。
|
|
1084
|
-
*/
|
|
1085
|
-
skillPath?: string;
|
|
1086
|
-
/** 追加系统提示内容数组(原样透传;schema 仿真段由公共降级层拼装后放入,P2)。 */
|
|
1087
|
-
appendSystemPrompt?: string[];
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* 引擎无关的 agent 任务声明(= ExecuteOptions 泛化,字段逐条锚定设计 §3.3.5)。
|
|
1091
|
-
*
|
|
1092
|
-
* 与 ExecuteOptions 的差异(泛化点):
|
|
1093
|
-
* - thinkingLevel(pi 7 档枚举语义)→ effort?: string,各引擎自行映射或忽略;
|
|
1094
|
-
* - skillPath + appendSystemPrompt → persona(PersonaSpec);
|
|
1095
|
-
* - conversation/idleTimeoutMs 保留原名透传——属 interact 交互控制面的 task 标志(D1),
|
|
1096
|
-
* 不是 pi 专有语义的泄漏,而是「任务声明里声明交互模式」的中立表达;
|
|
1097
|
-
* - 删字段去向:signal/ctxModel/onComplete 是运行期句柄,移入 RunContext(port.ts);
|
|
1098
|
-
* schemaEnv 内化到 PiEngine(从 task.schema 派生,见 engines/pi/task-spec-mapper.ts)。
|
|
1099
|
-
*
|
|
1100
|
-
* 新增(为后续 wave 预留形状,P1 无生产写入方):
|
|
1101
|
-
* - denyTools:中立工具 denylist(附录 A 该行的载体);
|
|
1102
|
-
* - permissionMode:中立权限模式(映射按 capabilities.permissionMode)。
|
|
1103
|
-
*/
|
|
1104
|
-
interface AgentTaskSpec {
|
|
1105
|
-
/** 原样(ExecuteOptions.task)。 */
|
|
1106
|
-
task: string;
|
|
1107
|
-
/** 原样(ExecuteOptions.slug,≤35 字符)。 */
|
|
1108
|
-
slug: string;
|
|
1109
|
-
/** 原样(ExecuteOptions.agent,resolveIdentity 的 agent ref)。 */
|
|
1110
|
-
agent?: string;
|
|
1111
|
-
/** 原样(ExecuteOptions.model;在引擎 provider 体系内解释,D9②)。 */
|
|
1112
|
-
model?: string;
|
|
1113
|
-
/**
|
|
1114
|
-
* 泛化:原 ExecuteOptions.thinkingLevel。引擎无关的推理投入档位字符串——
|
|
1115
|
-
* pi 引擎把它原值映射回 thinkingLevel 7 档;其他引擎自行映射(CC 5 档)或忽略
|
|
1116
|
-
* (kimi ❌)。不定义联合枚举:档位集合是引擎私有语义,中立层只透传字符串。
|
|
1117
|
-
*/
|
|
1118
|
-
effort?: string;
|
|
1119
|
-
/** 泛化:原 skillPath + appendSystemPrompt 收拢(D2)。 */
|
|
1120
|
-
persona?: PersonaSpec;
|
|
1121
|
-
/**
|
|
1122
|
-
* 原样(ExecuteOptions.schema)。native/emulated 分流依据(D4 硬边界):pi 的
|
|
1123
|
-
* PI_WORKFLOW_SCHEMA env 注入链路按 native 直传,公共仿真层只服务 emulated 引擎。
|
|
1124
|
-
*/
|
|
1125
|
-
schema?: Record<string, unknown>;
|
|
1126
|
-
/**
|
|
1127
|
-
* 原样(ExecuteOptions.maxTurns)。pi 引擎专属(turn limiter + spawn watchdog
|
|
1128
|
-
* 估算依赖 pi 的 turn_end 事件流);其他引擎 prepare 期显式拒绝(U4,同 fork 模式)。
|
|
1129
|
-
* 显式 0 压过 SPAWN_WATCHDOG_ENV 兑底(SP-6 参数 > env,U5);undefined 未传才由
|
|
1130
|
-
* env 兑底。
|
|
1131
|
-
*/
|
|
1132
|
-
maxTurns?: number;
|
|
1133
|
-
/** 原样(ExecuteOptions.graceTurns)。 */
|
|
1134
|
-
graceTurns?: number;
|
|
1135
|
-
/** 原样(ExecuteOptions.fork)。pi 专属;其他引擎 prepare 期按 capabilities 拒绝。 */
|
|
1136
|
-
fork?: boolean;
|
|
1137
|
-
/**
|
|
1138
|
-
* 原样(ExecuteOptions.worktree)。公共层职责(worktree-manager),非引擎职责——
|
|
1139
|
-
* 引擎只把它当 spawn cwd 的来源之一。
|
|
1140
|
-
*/
|
|
1141
|
-
worktree?: boolean | WorktreeHandle;
|
|
1142
|
-
/** 原样(ExecuteOptions.cwd)。 */
|
|
1143
|
-
cwd?: string;
|
|
1144
|
-
/** 原样(ExecuteOptions.conversation,interact 控制面的 task 标志,D1)。 */
|
|
1145
|
-
conversation?: boolean;
|
|
1146
|
-
/** 原样(ExecuteOptions.idleTimeoutMs,同上)。 */
|
|
1147
|
-
idleTimeoutMs?: number;
|
|
1148
|
-
/** 新增:中立工具 denylist。各引擎做语法映射(附录 A「工具 denylist」行的载体)。 */
|
|
1149
|
-
denyTools?: string[];
|
|
1150
|
-
/** 新增:中立权限模式。映射按 capabilities.permissionMode(kimi fixed auto = ignored)。 */
|
|
1151
|
-
permissionMode?: string;
|
|
1152
|
-
/**
|
|
1153
|
-
* [P4 形状预留,D9① 守卫 b 的独立载体] 任务对引擎能力的显式依赖声明。
|
|
1154
|
-
* 首期无生产写入方:守卫 b 与守卫 a 合流(显式 engine 即能力依赖声明)——调用方
|
|
1155
|
-
* 按引擎 id 表达依赖。下钻时机(AgentTaskSpec 泛化成熟后):调用方改按能力表达
|
|
1156
|
-
* (如 requires: { sandbox: 'native' }),路由层将本字段与各引擎 capabilities()
|
|
1157
|
-
* 对照,无引擎满足时报 engine_capability_unsupported(调用前拒绝,D11 处置三级)。
|
|
1158
|
-
*/
|
|
1159
|
-
requires?: Partial<EngineCapabilities>;
|
|
1160
|
-
}
|
|
1161
1241
|
/**
|
|
1162
1242
|
* 一次引擎执行的终态。锚定 orchestration/models/types.ts 的 AgentResult(workflow
|
|
1163
1243
|
* 引擎消费的那份——content/parsedOutput/usage/error)并追加引擎层字段;见文件头消歧说明。
|
|
@@ -1165,6 +1245,13 @@ interface AgentTaskSpec {
|
|
|
1165
1245
|
interface AgentOutcome {
|
|
1166
1246
|
/** 原样(AgentResult.content)。 */
|
|
1167
1247
|
content: string;
|
|
1248
|
+
/**
|
|
1249
|
+
* 原样(AgentResult.failureKind,D5-③ 失败分诊结构化标签)。产出侧唯一识别点 =
|
|
1250
|
+
* engines/pi/output-collector(collectResult 分类写入);缺省 = unknown = 可重试
|
|
1251
|
+
* (消费侧 executeAgentCall 只读字段分诊,不扫 error 文案)。非 pi 引擎不产出,
|
|
1252
|
+
* 恒缺省(unknown 语义)。
|
|
1253
|
+
*/
|
|
1254
|
+
failureKind?: AgentFailureKind;
|
|
1168
1255
|
/**
|
|
1169
1256
|
* 原样(AgentResult.parsedOutput)。native 引擎直传 / 仿真层 ajv 产出(D4 硬分流:
|
|
1170
1257
|
* native 路径公共层不做二次校验、不改写其结果)。
|
|
@@ -1289,6 +1376,15 @@ interface EngineCapabilities {
|
|
|
1289
1376
|
interrupt: "native" | "kill-only";
|
|
1290
1377
|
/** kimi headless 固定 auto = ignored;GUI 据此隐藏/提示。 */
|
|
1291
1378
|
permissionMode: "native" | "fixed" | "ignored";
|
|
1379
|
+
/**
|
|
1380
|
+
* [D3-④ r3 裁定] maxTurns 轮数上限的执行能力位(pi = true:turn limiter + spawn
|
|
1381
|
+
* watchdog 估算兑现;zcode = false:无 turn_end 语义,静默丢弃会造成「传了上限却
|
|
1382
|
+
* 失控」假象)。调用前预检(common/capability-gate)按本位拦「声明不支持的能力」
|
|
1383
|
+
* ——pi 不拦 maxTurns(已支持能力,由 turn-limiter 执行)、zcode 同步拒绝。
|
|
1384
|
+
* 现状 11 个能力位无可承载 maxTurns 的语义位(fork 拦截可借 session 分叉通道族判,
|
|
1385
|
+
* maxTurns 无可借位),故扩位而非保留引擎内硬编码 shape 检查。
|
|
1386
|
+
*/
|
|
1387
|
+
maxTurns: boolean;
|
|
1292
1388
|
}
|
|
1293
1389
|
/** 引擎探针报告(probe() 返回)。探针在引擎 factory 初始化与版本变化检测时触发(P4 接线)。 */
|
|
1294
1390
|
interface ProbeReport {
|
|
@@ -1311,9 +1407,16 @@ interface ProbeReport {
|
|
|
1311
1407
|
* interact 的 action(D1 交互控制面)。pi 首期原生实现(现有 chatMode 行为直通);
|
|
1312
1408
|
* 声明 conversation unsupported 的引擎调用前拒绝(engine_capability_unsupported)。
|
|
1313
1409
|
*/
|
|
1314
|
-
type InteractAction =
|
|
1410
|
+
type InteractAction =
|
|
1411
|
+
/**
|
|
1412
|
+
* interrupt:true = steer(抢占)/ false|缺省 = followUp(排队)——pi streamingBehavior
|
|
1413
|
+
* 语义的中立承载(D1 §3.3.5「后续 wave 如需抢占语义再扩展 InteractAction」的兑现,
|
|
1414
|
+
* chat 域投递经 engine.interact 接通时落地;不支持抢占的引擎忽略)。
|
|
1415
|
+
*/
|
|
1416
|
+
{
|
|
1315
1417
|
kind: "message";
|
|
1316
1418
|
payload: string;
|
|
1419
|
+
interrupt?: boolean;
|
|
1317
1420
|
} | {
|
|
1318
1421
|
kind: "close";
|
|
1319
1422
|
payload?: {
|
|
@@ -1335,4 +1438,4 @@ type InteractResult = {
|
|
|
1335
1438
|
message: string;
|
|
1336
1439
|
};
|
|
1337
1440
|
|
|
1338
|
-
export { type
|
|
1441
|
+
export { type SubagentToolResult as $, type AgentCallOpts as A, type DisplayItem as B, type ClosedReason as C, type DoneReason as D, type EngineCapabilities as E, type CancelResponse as F, type CloseResponse as G, type ForkFromResponse as H, type InteractAction as I, type MessageResponse as J, type BgResponse as K, type ListResponse as L, type ModelInfo as M, type ExternalState as N, type SubagentListItem as O, type ProbeReport as P, CLOSED_REASONS as Q, type RecordSnapshot as R, type SessionView as S, type ToolCall as T, DEFAULT_AGENT_NAME as U, DirtyWorktreeError as V, type WorktreeHandle as W, ForkDepthExceededError as X, type ReplayedTurn as Y, ResurrectDeniedError as Z, SLUG_MAX_LENGTH as _, type AgentEvent as a, type ToolCallEntry as a0, type EngineHandleData as b, type EngineHandle as c, type AgentOutcome as d, type InteractResult as e, type ExecutionRecord as f, type SubagentRecord as g, type ExecuteOptions as h, type AgentResult as i, type AgentConfig as j, type ResolvedModel as k, type AgentResult$1 as l, type ExecutionOutcome as m, type AgentEventLogEntry as n, type ExecutionStatus as o, type ProjectedOutcome as p, type SubagentsGlobalConfig as q, type ModelRegistryLike as r, type ExecutionHandle as s, type ExecutionMode as t, type PatchResult as u, type AgentUsage as v, type ExecutionTraceNode as w, type TracePatch as x, type RunStatus as y, type WorkerLogEntry as z };
|