@springbrand/agent-runtime 0.2.0-alpha.39 → 0.2.0-alpha.40
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
|
@@ -236,10 +236,10 @@ const IDEMPOTENT_TOOL_NAMES = new Set([
|
|
|
236
236
|
export function piToolRetryPolicy(
|
|
237
237
|
candidate: PiToolCandidate,
|
|
238
238
|
): "idempotent" | "non-idempotent" {
|
|
239
|
-
return IDEMPOTENT_TOOL_NAMES.has(candidate.tool.name) ||
|
|
239
|
+
return candidate.retry ?? (IDEMPOTENT_TOOL_NAMES.has(candidate.tool.name) ||
|
|
240
240
|
candidate.owner.startsWith("subagent:")
|
|
241
241
|
? "idempotent"
|
|
242
|
-
: "non-idempotent";
|
|
242
|
+
: "non-idempotent");
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
// 把工具候选整理成版本描述里要保存的稳定字段。
|
package/src/pi/tool/compiler.ts
CHANGED
|
@@ -66,6 +66,8 @@ export interface PiToolCandidate {
|
|
|
66
66
|
* 那是失效不是降级。`deny` 仍然优先,被 deny 的工具根本不会注入。
|
|
67
67
|
*/
|
|
68
68
|
readonly alwaysRequiresApproval?: boolean;
|
|
69
|
+
/** Recovery may replay this Tool Call only when the candidate guarantees convergence. */
|
|
70
|
+
readonly retry?: "idempotent" | "non-idempotent";
|
|
69
71
|
readonly summary?: string;
|
|
70
72
|
readonly source?: ApprovalReceipt["source"];
|
|
71
73
|
readonly interaction?: PiToolInteractionSpec;
|
package/src/pi/tool/declared.ts
CHANGED
|
@@ -50,6 +50,7 @@ export interface PiDeclaredToolPolicy<Reply = unknown> {
|
|
|
50
50
|
readonly requiredExecutionLevel: PiToolCandidate["requiredExecutionLevel"];
|
|
51
51
|
readonly requiredExecutionLevelForInput?: PiToolCandidate["requiredExecutionLevelForInput"];
|
|
52
52
|
readonly direct?: true;
|
|
53
|
+
readonly retry?: PiToolCandidate["retry"];
|
|
53
54
|
readonly source?: PiToolCandidate["source"];
|
|
54
55
|
readonly summary?: string;
|
|
55
56
|
/**
|
|
@@ -116,6 +117,7 @@ export function createPiDeclaredToolCandidate<Reply = unknown>(
|
|
|
116
117
|
? { requiredExecutionLevelForInput: policy.requiredExecutionLevelForInput }
|
|
117
118
|
: {}),
|
|
118
119
|
...(policy.direct ? { direct: policy.direct } : {}),
|
|
120
|
+
...(policy.retry ? { retry: policy.retry } : {}),
|
|
119
121
|
...(policy.source ? { source: policy.source } : {}),
|
|
120
122
|
};
|
|
121
123
|
}
|