@osovv/vv-opencode 2.0.0 → 2.1.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/CHANGELOG.md +51 -0
- package/README.md +87 -85
- package/dist/commands/completion.js +0 -1
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/doctor.js +6 -9
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +2 -1
- package/dist/commands/init.js +7 -12
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +4 -0
- package/dist/commands/install.js +40 -37
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/launch.d.ts +2 -1
- package/dist/commands/launch.js +18 -14
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/patch-provider.d.ts +225 -307
- package/dist/commands/patch-provider.js +92 -296
- package/dist/commands/patch-provider.js.map +1 -1
- package/dist/commands/status.js +7 -10
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts +4 -0
- package/dist/commands/sync.js +38 -35
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.d.ts +25 -5
- package/dist/index.js +73 -34
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-tool-catalog.d.ts +1 -1
- package/dist/lib/agent-tool-catalog.js +3 -6
- package/dist/lib/agent-tool-catalog.js.map +1 -1
- package/dist/lib/agent-tool-contract.d.ts +22 -13
- package/dist/lib/agent-tool-contract.js +20 -20
- package/dist/lib/agent-tool-contract.js.map +1 -1
- package/dist/lib/analytics/types.d.ts +7 -1
- package/dist/lib/analytics/types.js +2 -2
- package/dist/lib/analytics/types.js.map +1 -1
- package/dist/lib/config-layers.d.ts +28 -6
- package/dist/lib/config-layers.js +268 -73
- package/dist/lib/config-layers.js.map +1 -1
- package/dist/lib/managed-agents.d.ts +24 -2
- package/dist/lib/managed-agents.js +45 -15
- package/dist/lib/managed-agents.js.map +1 -1
- package/dist/lib/model-roles.d.ts +5 -0
- package/dist/lib/model-roles.js +22 -1
- package/dist/lib/model-roles.js.map +1 -1
- package/dist/lib/opencode/agent-registrations.d.ts +4 -4
- package/dist/lib/opencode/agent-registrations.js +386 -197
- package/dist/lib/opencode/agent-registrations.js.map +1 -1
- package/dist/lib/opencode/inspection.d.ts +13 -13
- package/dist/lib/opencode/inspection.js +69 -106
- package/dist/lib/opencode/inspection.js.map +1 -1
- package/dist/lib/opencode/model-overrides.d.ts +2 -2
- package/dist/lib/opencode/model-overrides.js +192 -47
- package/dist/lib/opencode/model-overrides.js.map +1 -1
- package/dist/lib/opencode/paths.d.ts +6 -2
- package/dist/lib/opencode/paths.js +12 -11
- package/dist/lib/opencode/paths.js.map +1 -1
- package/dist/lib/opencode/plugin-registration.d.ts +10 -11
- package/dist/lib/opencode/plugin-registration.js +76 -138
- package/dist/lib/opencode/plugin-registration.js.map +1 -1
- package/dist/lib/opencode/shared-utils.d.ts +47 -3
- package/dist/lib/opencode/shared-utils.js +346 -15
- package/dist/lib/opencode/shared-utils.js.map +1 -1
- package/dist/lib/opencode.d.ts +5 -6
- package/dist/lib/opencode.js +10 -10
- package/dist/lib/opencode.js.map +1 -1
- package/dist/lib/vvoc-config.js +4 -4
- package/dist/lib/vvoc-config.js.map +1 -1
- package/dist/lib/vvoc-paths.d.ts +7 -0
- package/dist/lib/vvoc-paths.js +15 -1
- package/dist/lib/vvoc-paths.js.map +1 -1
- package/dist/lib/vvoc-preset-registry.d.ts +38 -50
- package/dist/lib/vvoc-preset-registry.js +38 -48
- package/dist/lib/vvoc-preset-registry.js.map +1 -1
- package/dist/plugins/analytics/index.d.ts +20 -14
- package/dist/plugins/analytics/index.js +281 -133
- package/dist/plugins/analytics/index.js.map +1 -1
- package/dist/plugins/guardian/index.d.ts +63 -42
- package/dist/plugins/guardian/index.js +217 -759
- package/dist/plugins/guardian/index.js.map +1 -1
- package/dist/plugins/hashline-edit/index.d.ts +145 -31
- package/dist/plugins/hashline-edit/index.js +679 -244
- package/dist/plugins/hashline-edit/index.js.map +1 -1
- package/dist/plugins/hashline-edit/schemas.d.ts +1 -1
- package/dist/plugins/hashline-edit/schemas.js +3 -3
- package/dist/plugins/hashline-edit/schemas.js.map +1 -1
- package/dist/plugins/model-roles/index.d.ts +18 -4
- package/dist/plugins/model-roles/index.js +44 -181
- package/dist/plugins/model-roles/index.js.map +1 -1
- package/dist/plugins/peak-hours/index.d.ts +23 -22
- package/dist/plugins/peak-hours/index.js +210 -178
- package/dist/plugins/peak-hours/index.js.map +1 -1
- package/dist/plugins/secrets-redaction/deep.js +35 -51
- package/dist/plugins/secrets-redaction/deep.js.map +1 -1
- package/dist/plugins/secrets-redaction/index.d.ts +96 -8
- package/dist/plugins/secrets-redaction/index.js +290 -102
- package/dist/plugins/secrets-redaction/index.js.map +1 -1
- package/dist/plugins/secrets-redaction/session.d.ts +9 -0
- package/dist/plugins/secrets-redaction/session.js +21 -4
- package/dist/plugins/secrets-redaction/session.js.map +1 -1
- package/dist/plugins/secrets-redaction/stream.d.ts +92 -0
- package/dist/plugins/secrets-redaction/stream.js +772 -0
- package/dist/plugins/secrets-redaction/stream.js.map +1 -0
- package/dist/plugins/spec-guard/index.d.ts +49 -18
- package/dist/plugins/spec-guard/index.js +231 -129
- package/dist/plugins/spec-guard/index.js.map +1 -1
- package/dist/plugins/system-context-injection/index.d.ts +10 -4
- package/dist/plugins/system-context-injection/index.js +271 -78
- package/dist/plugins/system-context-injection/index.js.map +1 -1
- package/dist/plugins/tool-history-compaction/index.d.ts +26 -4
- package/dist/plugins/tool-history-compaction/index.js +170 -32
- package/dist/plugins/tool-history-compaction/index.js.map +1 -1
- package/dist/plugins/tool-history-compaction/transform.d.ts +47 -16
- package/dist/plugins/tool-history-compaction/transform.js +173 -55
- package/dist/plugins/tool-history-compaction/transform.js.map +1 -1
- package/dist/plugins/web-tools/fetch-service.d.ts +51 -13
- package/dist/plugins/web-tools/fetch-service.js +106 -75
- package/dist/plugins/web-tools/fetch-service.js.map +1 -1
- package/dist/plugins/web-tools/index.d.ts +58 -16
- package/dist/plugins/web-tools/index.js +202 -91
- package/dist/plugins/web-tools/index.js.map +1 -1
- package/dist/plugins/web-tools/media-loader.d.ts +3 -3
- package/dist/plugins/web-tools/media-loader.js +3 -3
- package/dist/plugins/web-tools/media-loader.js.map +1 -1
- package/dist/plugins/web-tools/providers/native-fetch.d.ts +2 -2
- package/dist/plugins/web-tools/providers/native-fetch.js +1 -1
- package/dist/plugins/web-tools/providers/native-fetch.js.map +1 -1
- package/dist/plugins/web-tools/providers/spider.d.ts +2 -2
- package/dist/plugins/web-tools/providers/spider.js +1 -1
- package/dist/plugins/web-tools/providers/spider.js.map +1 -1
- package/dist/plugins/web-tools/providers/zai.d.ts +2 -2
- package/dist/plugins/web-tools/providers/zai.js +1 -1
- package/dist/plugins/web-tools/providers/zai.js.map +1 -1
- package/dist/plugins/web-tools/schemas.d.ts +1 -1
- package/dist/plugins/web-tools/schemas.js +3 -3
- package/dist/plugins/web-tools/schemas.js.map +1 -1
- package/dist/plugins/web-tools/search-service.d.ts +81 -12
- package/dist/plugins/web-tools/search-service.js +104 -57
- package/dist/plugins/web-tools/search-service.js.map +1 -1
- package/dist/plugins/workflow/authorization.d.ts +44 -10
- package/dist/plugins/workflow/authorization.js +113 -73
- package/dist/plugins/workflow/authorization.js.map +1 -1
- package/dist/plugins/workflow/cancellation.d.ts +86 -0
- package/dist/plugins/workflow/cancellation.js +202 -0
- package/dist/plugins/workflow/cancellation.js.map +1 -0
- package/dist/plugins/workflow/checkpoints.d.ts +7 -1
- package/dist/plugins/workflow/checkpoints.js +141 -21
- package/dist/plugins/workflow/checkpoints.js.map +1 -1
- package/dist/plugins/workflow/delegated.d.ts +14 -0
- package/dist/plugins/workflow/delegated.js +6 -5
- package/dist/plugins/workflow/delegated.js.map +1 -1
- package/dist/plugins/workflow/host.d.ts +81 -0
- package/dist/plugins/workflow/host.js +189 -0
- package/dist/plugins/workflow/host.js.map +1 -0
- package/dist/plugins/workflow/index.d.ts +69 -4
- package/dist/plugins/workflow/index.js +1391 -1026
- package/dist/plugins/workflow/index.js.map +1 -1
- package/dist/plugins/workflow/recovery.d.ts +3 -5
- package/dist/plugins/workflow/recovery.js +18 -33
- package/dist/plugins/workflow/recovery.js.map +1 -1
- package/dist/plugins/workflow/repair.d.ts +31 -5
- package/dist/plugins/workflow/repair.js +116 -48
- package/dist/plugins/workflow/repair.js.map +1 -1
- package/dist/plugins/workflow/results.d.ts +31 -31
- package/dist/plugins/workflow/results.js +4 -4
- package/dist/plugins/workflow/results.js.map +1 -1
- package/dist/plugins/workflow/schemas.d.ts +3 -3
- package/dist/plugins/workflow/schemas.js +5 -5
- package/dist/plugins/workflow/schemas.js.map +1 -1
- package/dist/plugins/workflow/system-instruction.md +4 -0
- package/dist/plugins/workflow/tooling.d.ts +6 -0
- package/dist/plugins/workflow/tooling.js +3 -1
- package/dist/plugins/workflow/tooling.js.map +1 -1
- package/dist/runtime/auxiliary.d.ts +13 -0
- package/dist/runtime/auxiliary.js +108 -0
- package/dist/runtime/auxiliary.js.map +1 -0
- package/dist/runtime/client.d.ts +88 -0
- package/dist/runtime/client.js +174 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/context-inspection-contract.d.ts +397 -0
- package/dist/runtime/context-inspection-contract.js +622 -0
- package/dist/runtime/context-inspection-contract.js.map +1 -0
- package/dist/runtime/context-inspection.d.ts +52 -0
- package/dist/runtime/context-inspection.js +324 -0
- package/dist/runtime/context-inspection.js.map +1 -0
- package/dist/runtime/context.d.ts +192 -0
- package/dist/runtime/context.js +1246 -0
- package/dist/runtime/context.js.map +1 -0
- package/dist/runtime/coordination.d.ts +40 -0
- package/dist/runtime/coordination.js +87 -0
- package/dist/runtime/coordination.js.map +1 -0
- package/dist/runtime/model-registry.d.ts +34 -0
- package/dist/runtime/model-registry.js +227 -0
- package/dist/runtime/model-registry.js.map +1 -0
- package/dist/runtime/permissions.d.ts +20 -0
- package/dist/runtime/permissions.js +250 -0
- package/dist/runtime/permissions.js.map +1 -0
- package/dist/runtime/snapshot-config.d.ts +80 -0
- package/dist/runtime/snapshot-config.js +268 -0
- package/dist/runtime/snapshot-config.js.map +1 -0
- package/dist/runtime/snapshot-store.d.ts +25 -0
- package/dist/runtime/snapshot-store.js +519 -0
- package/dist/runtime/snapshot-store.js.map +1 -0
- package/dist/runtime/snapshots.d.ts +59 -0
- package/dist/runtime/snapshots.js +721 -0
- package/dist/runtime/snapshots.js.map +1 -0
- package/dist/runtime/types.d.ts +713 -0
- package/dist/runtime/types.js +190 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/tui/analytics/indicator.d.ts +25 -26
- package/dist/tui/analytics/indicator.js +66 -74
- package/dist/tui/analytics/indicator.js.map +1 -1
- package/dist/tui/branding/footer.d.ts +7 -12
- package/dist/tui/branding/footer.js +16 -24
- package/dist/tui/branding/footer.js.map +1 -1
- package/dist/tui/context/analyze.d.ts +20 -9
- package/dist/tui/context/analyze.js +295 -257
- package/dist/tui/context/analyze.js.map +1 -1
- package/dist/tui/context/collect.d.ts +29 -3
- package/dist/tui/context/collect.js +450 -66
- package/dist/tui/context/collect.js.map +1 -1
- package/dist/tui/context/plugin.d.ts +21 -7
- package/dist/tui/context/plugin.js +65 -70
- package/dist/tui/context/plugin.js.map +1 -1
- package/dist/tui/context/types.d.ts +174 -43
- package/dist/tui/context/types.js +25 -19
- package/dist/tui/context/types.js.map +1 -1
- package/dist/tui/context/view.d.ts +33 -7
- package/dist/tui/context/view.js +136 -81
- package/dist/tui/context/view.js.map +1 -1
- package/dist/tui/peak-hours/banner.d.ts +13 -11
- package/dist/tui/peak-hours/banner.js +48 -80
- package/dist/tui/peak-hours/banner.js.map +1 -1
- package/dist/tui/policy.d.ts +69 -0
- package/dist/tui/policy.js +169 -0
- package/dist/tui/policy.js.map +1 -0
- package/dist/tui.d.ts +3 -8
- package/dist/tui.js +72 -68
- package/dist/tui.js.map +1 -1
- package/package.json +19 -15
- package/schemas/vvoc/v3.json +1 -1
- package/server.js +3 -5
- package/templates/agents/enhancer.md +10 -5
- package/templates/agents/guardian.md +10 -4
- package/templates/agents/investigator.md +4 -2
- package/templates/agents/vv-code-reviewer.md +4 -2
- package/templates/agents/vv-spec-reviewer.md +4 -2
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
- package/tui.js +3 -5
- package/dist/plugins/analytics/v2.d.ts +0 -21
- package/dist/plugins/analytics/v2.js +0 -133
- package/dist/plugins/analytics/v2.js.map +0 -1
- package/dist/plugins/guardian/v2.d.ts +0 -13
- package/dist/plugins/guardian/v2.js +0 -161
- package/dist/plugins/guardian/v2.js.map +0 -1
- package/dist/plugins/hashline-edit/v2.d.ts +0 -12
- package/dist/plugins/hashline-edit/v2.js +0 -145
- package/dist/plugins/hashline-edit/v2.js.map +0 -1
- package/dist/plugins/model-roles/v2.d.ts +0 -24
- package/dist/plugins/model-roles/v2.js +0 -274
- package/dist/plugins/model-roles/v2.js.map +0 -1
- package/dist/plugins/peak-hours/v2.d.ts +0 -12
- package/dist/plugins/peak-hours/v2.js +0 -95
- package/dist/plugins/peak-hours/v2.js.map +0 -1
- package/dist/plugins/secrets-redaction/v2.d.ts +0 -14
- package/dist/plugins/secrets-redaction/v2.js +0 -100
- package/dist/plugins/secrets-redaction/v2.js.map +0 -1
- package/dist/plugins/spec-guard/v2.d.ts +0 -12
- package/dist/plugins/spec-guard/v2.js +0 -139
- package/dist/plugins/spec-guard/v2.js.map +0 -1
- package/dist/plugins/system-context-injection/agent-contexts.d.ts +0 -5
- package/dist/plugins/system-context-injection/agent-contexts.js +0 -164
- package/dist/plugins/system-context-injection/agent-contexts.js.map +0 -1
- package/dist/plugins/system-context-injection/v2.d.ts +0 -13
- package/dist/plugins/system-context-injection/v2.js +0 -60
- package/dist/plugins/system-context-injection/v2.js.map +0 -1
- package/dist/plugins/tool-history-compaction/v2.d.ts +0 -11
- package/dist/plugins/tool-history-compaction/v2.js +0 -56
- package/dist/plugins/tool-history-compaction/v2.js.map +0 -1
- package/dist/plugins/v2-runtime/config-watcher.d.ts +0 -26
- package/dist/plugins/v2-runtime/config-watcher.js +0 -111
- package/dist/plugins/v2-runtime/config-watcher.js.map +0 -1
- package/dist/plugins/v2-runtime/index.d.ts +0 -50
- package/dist/plugins/v2-runtime/index.js +0 -114
- package/dist/plugins/v2-runtime/index.js.map +0 -1
- package/dist/plugins/v2-runtime/location-config.d.ts +0 -51
- package/dist/plugins/v2-runtime/location-config.js +0 -91
- package/dist/plugins/v2-runtime/location-config.js.map +0 -1
- package/dist/plugins/v2-runtime/setup.d.ts +0 -48
- package/dist/plugins/v2-runtime/setup.js +0 -174
- package/dist/plugins/v2-runtime/setup.js.map +0 -1
- package/dist/plugins/web-tools/v2.d.ts +0 -11
- package/dist/plugins/web-tools/v2.js +0 -99
- package/dist/plugins/web-tools/v2.js.map +0 -1
- package/dist/plugins/workflow/v2.d.ts +0 -58
- package/dist/plugins/workflow/v2.js +0 -181
- package/dist/plugins/workflow/v2.js.map +0 -1
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
// FILE: src/plugins/workflow/repair.ts
|
|
2
|
-
// VERSION: 0.
|
|
2
|
+
// VERSION: 2.0.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE: Recognize resumable
|
|
5
|
-
// SCOPE:
|
|
6
|
-
// DEPENDS: [@opencode
|
|
4
|
+
// PURPOSE: Recognize resumable native subagent/task envelopes and perform one bounded same-child continuation for malformed tracked outputs using the native session prompt/wait/message surface.
|
|
5
|
+
// SCOPE: Native `<subagent ...>` and legacy task envelope parsing, protocol-error-aware continuation prompt construction from the shared status/route contract that preserves work-item identity while reporting a truthful post-continuation status/route, explicit hard-stop status detection preserving the observed substantive stop for terminal settlement, continued-output extraction from native assistant messages, and one same-child continuation call. No child creation, no tool/agent override, no forged result status.
|
|
6
|
+
// DEPENDS: [@opencode/client, src/plugins/workflow/protocol.ts, src/plugins/workflow/host.ts]
|
|
7
7
|
// LINKS: [M-WORKFLOW-REPAIR, M-WORKFLOW-PROTOCOL, M-PLUGIN-WORKFLOW]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
11
11
|
//
|
|
12
12
|
// START_MODULE_MAP
|
|
13
|
-
// ResumableTaskEnvelope - Recognized
|
|
14
|
-
// unwrapResumableTaskResult - Extracts tracked result text
|
|
13
|
+
// ResumableTaskEnvelope - Recognized native resumable task wrapper metadata plus inner tracked result text.
|
|
14
|
+
// unwrapResumableTaskResult - Extracts tracked result text from known native/legacy subagent envelopes.
|
|
15
15
|
// buildTrackedResultRepairPrompt - Constructs the strict bounded-continuation prompt for the same child session with a truthful post-continuation status/route.
|
|
16
16
|
// hasExplicitHardStopStatus - Detects explicit BLOCKED/NEEDS_CONTEXT protocol status lines before any continuation.
|
|
17
17
|
// detectExplicitHardStopStatus - Returns the explicit BLOCKED/NEEDS_CONTEXT status line value, if any.
|
|
18
18
|
// isTrackedResultRepairEligible - Restricts the one-shot continuation to safe protocol error classes.
|
|
19
|
-
//
|
|
19
|
+
// NativeRepairClient - Narrow full-client surface (session prompt/wait + message list) used for the continuation.
|
|
20
|
+
// attemptTrackedResultRepair - Continues the same child session once and returns a NEW terminal assistant created at/after the accepted prompt.
|
|
20
21
|
// END_MODULE_MAP
|
|
21
22
|
//
|
|
22
23
|
// START_CHANGE_SUMMARY
|
|
23
|
-
// LAST_CHANGE: [C-
|
|
24
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-004 attempt 4 - Continuation requires a NEW assistant id absent before the prompt with finite created+completed, created at/after the authoritative accepted timestamp, and no terminal error; invalid acceptance timestamps fail closed (no wall-clock substitution).]
|
|
24
25
|
// END_CHANGE_SUMMARY
|
|
25
26
|
import { describeStatusVocabulary, resultBlockRequiresRoute, } from "./protocol.js";
|
|
27
|
+
import { parseSubagentCompletionElement } from "./host.js";
|
|
26
28
|
const RESUMABLE_TASK_ID_RE = /^task_id:\s+(\S+)\s+\(for resuming to continue this task if needed\)$/;
|
|
27
29
|
const SAFE_TRACKED_RESULT_REPAIR_CODES = new Set([
|
|
28
30
|
"MISSING_STATUS",
|
|
@@ -37,7 +39,6 @@ const TASK_ELEMENT_OPEN_RE = /^<task\s+id="([^"]+)"\s+state="([^"]+)"\s*>$/;
|
|
|
37
39
|
* or NEEDS_CONTEXT, so natural-language text cannot suppress a continuation.
|
|
38
40
|
*/
|
|
39
41
|
const EXPLICIT_HARD_STOP_STATUS_RE = /^\s*VVOC_STATUS\s*:\s*(BLOCKED|NEEDS_CONTEXT)\b/;
|
|
40
|
-
const TRACKED_RESULT_CONTINUATION_SYSTEM_PROMPT = "Bounded same-session workflow continuation. Preserve the original work item, assignment, role, and write scope. Finish any unfinished implementation or review work using your existing history and currently permitted tools, or, if it was already complete, correct only the final report. Report the VVOC_STATUS and VVOC_ROUTE that truthfully reflect the result after this continuation.";
|
|
41
42
|
function parseResumableTaskEnvelope(output) {
|
|
42
43
|
const normalizedOutput = output.replace(/\r\n/g, "\n");
|
|
43
44
|
const lines = normalizedOutput.split("\n");
|
|
@@ -75,7 +76,7 @@ function parseResumableTaskEnvelope(output) {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
78
|
-
* Parse the
|
|
79
|
+
* Parse the legacy OpenCode `<task id="ses_..." state="completed">...</task>` envelope format.
|
|
79
80
|
* Also strips any nested `<task_result>`/`</task_result>` wrapper inside the element body.
|
|
80
81
|
*/
|
|
81
82
|
function parseTaskElementEnvelope(output) {
|
|
@@ -91,19 +92,15 @@ function parseTaskElementEnvelope(output) {
|
|
|
91
92
|
return undefined;
|
|
92
93
|
}
|
|
93
94
|
const taskId = openTagMatch[1];
|
|
94
|
-
// Find closing </task> tag
|
|
95
95
|
const closeTagIndex = lines.findIndex((line, index) => index > firstMeaningfulIndex && line.trim() === "</task>");
|
|
96
96
|
if (closeTagIndex < 0) {
|
|
97
97
|
return undefined;
|
|
98
98
|
}
|
|
99
|
-
// Extract inner content (between open and close tags)
|
|
100
99
|
let innerLines = lines.slice(firstMeaningfulIndex + 1, closeTagIndex);
|
|
101
|
-
// Strip outer <task_result>/</task_result> wrapper if present
|
|
102
100
|
const innerFirstIdx = innerLines.findIndex((line) => line.trim().length > 0);
|
|
103
101
|
if (innerFirstIdx >= 0) {
|
|
104
102
|
const innerFirstTrimmed = innerLines[innerFirstIdx]?.trim() ?? "";
|
|
105
103
|
if (innerFirstTrimmed === "<task_result>") {
|
|
106
|
-
// Find the closing </task_result>
|
|
107
104
|
const innerCloseIdx = innerLines.findIndex((line, index) => index > innerFirstIdx && line.trim() === "</task_result>");
|
|
108
105
|
if (innerCloseIdx >= 0) {
|
|
109
106
|
innerLines = innerLines.slice(innerFirstIdx + 1, innerCloseIdx);
|
|
@@ -116,16 +113,26 @@ function parseTaskElementEnvelope(output) {
|
|
|
116
113
|
format: "task_element",
|
|
117
114
|
};
|
|
118
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Extract tracked result text from a known native subagent delivery envelope
|
|
118
|
+
* (`<subagent sessionID="..." state="...">...</subagent>`). Other states still
|
|
119
|
+
* unwrap so a terminal cancellation/failure body is never mistaken for a result.
|
|
120
|
+
*/
|
|
121
|
+
function parseSubagentElementEnvelope(output) {
|
|
122
|
+
const parsed = parseSubagentCompletionElement(output);
|
|
123
|
+
if (!parsed)
|
|
124
|
+
return undefined;
|
|
125
|
+
return { taskId: parsed.sessionID, innerResult: parsed.output, format: "subagent_element" };
|
|
126
|
+
}
|
|
119
127
|
export function unwrapResumableTaskResult(output) {
|
|
120
|
-
|
|
128
|
+
const subagentEnvelope = parseSubagentElementEnvelope(output);
|
|
129
|
+
if (subagentEnvelope) {
|
|
130
|
+
return { normalizedOutput: subagentEnvelope.innerResult, envelope: subagentEnvelope };
|
|
131
|
+
}
|
|
121
132
|
const taskElementEnvelope = parseTaskElementEnvelope(output);
|
|
122
133
|
if (taskElementEnvelope) {
|
|
123
|
-
return {
|
|
124
|
-
normalizedOutput: taskElementEnvelope.innerResult,
|
|
125
|
-
...(taskElementEnvelope ? { envelope: taskElementEnvelope } : {}),
|
|
126
|
-
};
|
|
134
|
+
return { normalizedOutput: taskElementEnvelope.innerResult, envelope: taskElementEnvelope };
|
|
127
135
|
}
|
|
128
|
-
// Fall back to the old resumable task header format
|
|
129
136
|
const envelope = parseResumableTaskEnvelope(output);
|
|
130
137
|
return {
|
|
131
138
|
normalizedOutput: envelope?.innerResult ?? output,
|
|
@@ -184,44 +191,105 @@ export function hasExplicitHardStopStatus(output) {
|
|
|
184
191
|
export function isTrackedResultRepairEligible(code) {
|
|
185
192
|
return SAFE_TRACKED_RESULT_REPAIR_CODES.has(code);
|
|
186
193
|
}
|
|
187
|
-
function
|
|
188
|
-
return
|
|
189
|
-
|
|
194
|
+
function isRecord(value) {
|
|
195
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
196
|
+
}
|
|
197
|
+
function readFiniteNumber(value) {
|
|
198
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
199
|
+
}
|
|
200
|
+
/** Extract the text of one native assistant message, or undefined when it has none. */
|
|
201
|
+
function assistantMessageText(message) {
|
|
202
|
+
if (!isRecord(message) || message.type !== "assistant")
|
|
203
|
+
return undefined;
|
|
204
|
+
const content = message.content;
|
|
205
|
+
if (!Array.isArray(content))
|
|
206
|
+
return undefined;
|
|
207
|
+
const text = content
|
|
208
|
+
.filter((part) => {
|
|
209
|
+
return isRecord(part) && part.type === "text" && typeof part.text === "string";
|
|
210
|
+
})
|
|
190
211
|
.map((part) => part.text)
|
|
191
212
|
.join("")
|
|
192
213
|
.trim();
|
|
214
|
+
return text === "" ? undefined : text;
|
|
193
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Continue the SAME child session exactly once after a malformed final report.
|
|
218
|
+
* The native prompt preserves the child's agent, model, permissions and
|
|
219
|
+
* history, and this retrieves only a NEW terminal assistant created at or after
|
|
220
|
+
* the accepted prompt; an old assistant returned by a projected context view or
|
|
221
|
+
* a continuation that produced no new output is never treated as a corrected
|
|
222
|
+
* result. Any prompt or retrieval failure returns undefined.
|
|
223
|
+
*/
|
|
194
224
|
export async function attemptTrackedResultRepair(options) {
|
|
195
225
|
try {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
226
|
+
// Record existing message identities BEFORE the prompt so a stale
|
|
227
|
+
// same-millisecond assistant can never be accepted as the continuation.
|
|
228
|
+
const beforeIds = new Set();
|
|
229
|
+
const beforeList = await options.client.message.list({
|
|
230
|
+
sessionID: options.sessionId,
|
|
231
|
+
order: "desc",
|
|
232
|
+
limit: 50,
|
|
233
|
+
});
|
|
234
|
+
const beforeData = isRecord(beforeList) && Array.isArray(beforeList.data)
|
|
235
|
+
? beforeList.data
|
|
236
|
+
: Array.isArray(beforeList)
|
|
237
|
+
? beforeList
|
|
238
|
+
: undefined;
|
|
239
|
+
if (beforeData === undefined)
|
|
240
|
+
return undefined;
|
|
241
|
+
for (const message of beforeData) {
|
|
242
|
+
if (isRecord(message) && typeof message.id === "string")
|
|
243
|
+
beforeIds.add(message.id);
|
|
244
|
+
}
|
|
245
|
+
const accepted = await options.client.session.prompt({
|
|
246
|
+
sessionID: options.sessionId,
|
|
247
|
+
text: buildTrackedResultRepairPrompt({
|
|
204
248
|
agent: options.agent,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
agent: options.agent,
|
|
211
|
-
workItemId: options.workItemId,
|
|
212
|
-
malformedOutput: options.malformedOutput,
|
|
213
|
-
parseErrorCode: options.parseErrorCode,
|
|
214
|
-
parseErrorMessage: options.parseErrorMessage,
|
|
215
|
-
}),
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
},
|
|
249
|
+
workItemId: options.workItemId,
|
|
250
|
+
malformedOutput: options.malformedOutput,
|
|
251
|
+
parseErrorCode: options.parseErrorCode,
|
|
252
|
+
parseErrorMessage: options.parseErrorMessage,
|
|
253
|
+
}),
|
|
219
254
|
});
|
|
220
|
-
|
|
255
|
+
// The native acceptance response is authoritative. An invalid/absent
|
|
256
|
+
// created timestamp is NOT replaced by wall clock; the continuation fails.
|
|
257
|
+
const acceptedRecord = isRecord(accepted) ? accepted : undefined;
|
|
258
|
+
const acceptedTime = acceptedRecord && isRecord(acceptedRecord.time)
|
|
259
|
+
? readFiniteNumber(acceptedRecord.time.created)
|
|
260
|
+
: undefined;
|
|
261
|
+
if (acceptedTime === undefined || acceptedTime <= 0)
|
|
221
262
|
return undefined;
|
|
263
|
+
await options.client.session.wait({ sessionID: options.sessionId });
|
|
264
|
+
const list = await options.client.message.list({
|
|
265
|
+
sessionID: options.sessionId,
|
|
266
|
+
order: "desc",
|
|
267
|
+
limit: 50,
|
|
268
|
+
type: "assistant",
|
|
269
|
+
});
|
|
270
|
+
const data = isRecord(list) && Array.isArray(list.data) ? list.data : Array.isArray(list) ? list : [];
|
|
271
|
+
for (const message of data) {
|
|
272
|
+
if (!isRecord(message) || message.type !== "assistant")
|
|
273
|
+
continue;
|
|
274
|
+
const id = message.id;
|
|
275
|
+
// A NEW assistant: not present before the accepted continuation.
|
|
276
|
+
if (typeof id !== "string" || beforeIds.has(id))
|
|
277
|
+
continue;
|
|
278
|
+
const time = isRecord(message.time) ? message.time : undefined;
|
|
279
|
+
const created = time ? readFiniteNumber(time.created) : undefined;
|
|
280
|
+
const completed = time ? readFiniteNumber(time.completed) : undefined;
|
|
281
|
+
if (created === undefined || completed === undefined)
|
|
282
|
+
continue;
|
|
283
|
+
if (created < acceptedTime)
|
|
284
|
+
continue;
|
|
285
|
+
// A terminal error is not a corrected report.
|
|
286
|
+
if (message.error !== undefined)
|
|
287
|
+
continue;
|
|
288
|
+
const text = assistantMessageText(message);
|
|
289
|
+
if (text !== undefined)
|
|
290
|
+
return text;
|
|
222
291
|
}
|
|
223
|
-
|
|
224
|
-
return repairedOutput || undefined;
|
|
292
|
+
return undefined;
|
|
225
293
|
}
|
|
226
294
|
catch {
|
|
227
295
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair.js","sourceRoot":"","sources":["../../../src/plugins/workflow/repair.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"repair.js","sourceRoot":"","sources":["../../../src/plugins/workflow/repair.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,iBAAiB;AACjB,wBAAwB;AACxB,oMAAoM;AACpM,0gBAA0gB;AAC1gB,gGAAgG;AAChG,uEAAuE;AACvE,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,8GAA8G;AAC9G,0GAA0G;AAC1G,kKAAkK;AAClK,sHAAsH;AACtH,yGAAyG;AACzG,wGAAwG;AACxG,oHAAoH;AACpH,kJAAkJ;AAClJ,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,iTAAiT;AACjT,qBAAqB;AAErB,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GAGzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAQ3D,MAAM,oBAAoB,GACxB,uEAAuE,CAAC;AAE1E,MAAM,gCAAgC,GAAmC,IAAI,GAAG,CAAC;IAC/E,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;CACzB,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,8CAA8C,CAAC;AAE5E;;;;GAIG;AACH,MAAM,4BAA4B,GAAG,iDAAiD,CAAC;AAEvF,SAAS,0BAA0B,CAAC,MAAc;IAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,oBAAoB,GAAG,KAAK,CAAC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,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACtE,IAAI,OAAO,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;gBAAE,SAAS;YAC/D,IAAI,OAAO,GAAG,YAAY;gBAAE,SAAS;YACrC,8CAA8C;YAC9C,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;gBAAE,SAAS;YAC1C,MAAM,IAAI,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC3C,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;QACtC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
import { type ContractIssue } from "../../lib/agent-tool-contract.js";
|
|
3
3
|
/**
|
|
4
4
|
* Documented finite bounds for failure diagnostics only. Success payloads,
|
|
@@ -112,11 +112,11 @@ export declare const workflowFailureSchema: z.ZodObject<{
|
|
|
112
112
|
errorCode: z.ZodString;
|
|
113
113
|
category: z.ZodEnum<{
|
|
114
114
|
input: "input";
|
|
115
|
-
state: "state";
|
|
116
|
-
host_context: "host_context";
|
|
117
115
|
authorization: "authorization";
|
|
118
|
-
persistence: "persistence";
|
|
119
116
|
internal: "internal";
|
|
117
|
+
host_context: "host_context";
|
|
118
|
+
state: "state";
|
|
119
|
+
persistence: "persistence";
|
|
120
120
|
}>;
|
|
121
121
|
message: z.ZodString;
|
|
122
122
|
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -294,7 +294,6 @@ declare const workItemViewSchema: z.ZodObject<{
|
|
|
294
294
|
autonomousGrantConsumed: z.ZodBoolean;
|
|
295
295
|
reportRejectionCount: z.ZodNumber;
|
|
296
296
|
nextAction: z.ZodEnum<{
|
|
297
|
-
close: "close";
|
|
298
297
|
closed: "closed";
|
|
299
298
|
launch_implementer: "launch_implementer";
|
|
300
299
|
await_result: "await_result";
|
|
@@ -302,6 +301,7 @@ declare const workItemViewSchema: z.ZodObject<{
|
|
|
302
301
|
recover: "recover";
|
|
303
302
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
304
303
|
launch_blocked: "launch_blocked";
|
|
304
|
+
close: "close";
|
|
305
305
|
}>;
|
|
306
306
|
latestAttempt: z.ZodOptional<z.ZodObject<{
|
|
307
307
|
attempt: z.ZodNumber;
|
|
@@ -322,7 +322,6 @@ declare const workItemViewSchema: z.ZodObject<{
|
|
|
322
322
|
}, z.core.$strict>>;
|
|
323
323
|
guidance: z.ZodOptional<z.ZodObject<{
|
|
324
324
|
nextAction: z.ZodEnum<{
|
|
325
|
-
close: "close";
|
|
326
325
|
closed: "closed";
|
|
327
326
|
launch_implementer: "launch_implementer";
|
|
328
327
|
await_result: "await_result";
|
|
@@ -330,6 +329,7 @@ declare const workItemViewSchema: z.ZodObject<{
|
|
|
330
329
|
recover: "recover";
|
|
331
330
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
332
331
|
launch_blocked: "launch_blocked";
|
|
332
|
+
close: "close";
|
|
333
333
|
}>;
|
|
334
334
|
launchEligible: z.ZodBoolean;
|
|
335
335
|
blockers: z.ZodArray<z.ZodString>;
|
|
@@ -680,7 +680,6 @@ declare const workItemListViewSchema: z.ZodObject<{
|
|
|
680
680
|
autonomousGrantConsumed: z.ZodBoolean;
|
|
681
681
|
reportRejectionCount: z.ZodNumber;
|
|
682
682
|
nextAction: z.ZodEnum<{
|
|
683
|
-
close: "close";
|
|
684
683
|
closed: "closed";
|
|
685
684
|
launch_implementer: "launch_implementer";
|
|
686
685
|
await_result: "await_result";
|
|
@@ -688,6 +687,7 @@ declare const workItemListViewSchema: z.ZodObject<{
|
|
|
688
687
|
recover: "recover";
|
|
689
688
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
690
689
|
launch_blocked: "launch_blocked";
|
|
690
|
+
close: "close";
|
|
691
691
|
}>;
|
|
692
692
|
latestAttempt: z.ZodOptional<z.ZodObject<{
|
|
693
693
|
attempt: z.ZodNumber;
|
|
@@ -708,7 +708,6 @@ declare const workItemListViewSchema: z.ZodObject<{
|
|
|
708
708
|
}, z.core.$strict>>;
|
|
709
709
|
guidance: z.ZodOptional<z.ZodObject<{
|
|
710
710
|
nextAction: z.ZodEnum<{
|
|
711
|
-
close: "close";
|
|
712
711
|
closed: "closed";
|
|
713
712
|
launch_implementer: "launch_implementer";
|
|
714
713
|
await_result: "await_result";
|
|
@@ -716,6 +715,7 @@ declare const workItemListViewSchema: z.ZodObject<{
|
|
|
716
715
|
recover: "recover";
|
|
717
716
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
718
717
|
launch_blocked: "launch_blocked";
|
|
718
|
+
close: "close";
|
|
719
719
|
}>;
|
|
720
720
|
launchEligible: z.ZodBoolean;
|
|
721
721
|
blockers: z.ZodArray<z.ZodString>;
|
|
@@ -1070,7 +1070,6 @@ export declare const workflowToolResultSchemas: {
|
|
|
1070
1070
|
autonomousGrantConsumed: z.ZodBoolean;
|
|
1071
1071
|
reportRejectionCount: z.ZodNumber;
|
|
1072
1072
|
nextAction: z.ZodEnum<{
|
|
1073
|
-
close: "close";
|
|
1074
1073
|
closed: "closed";
|
|
1075
1074
|
launch_implementer: "launch_implementer";
|
|
1076
1075
|
await_result: "await_result";
|
|
@@ -1078,6 +1077,7 @@ export declare const workflowToolResultSchemas: {
|
|
|
1078
1077
|
recover: "recover";
|
|
1079
1078
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
1080
1079
|
launch_blocked: "launch_blocked";
|
|
1080
|
+
close: "close";
|
|
1081
1081
|
}>;
|
|
1082
1082
|
latestAttempt: z.ZodOptional<z.ZodObject<{
|
|
1083
1083
|
attempt: z.ZodNumber;
|
|
@@ -1098,7 +1098,6 @@ export declare const workflowToolResultSchemas: {
|
|
|
1098
1098
|
}, z.core.$strict>>;
|
|
1099
1099
|
guidance: z.ZodOptional<z.ZodObject<{
|
|
1100
1100
|
nextAction: z.ZodEnum<{
|
|
1101
|
-
close: "close";
|
|
1102
1101
|
closed: "closed";
|
|
1103
1102
|
launch_implementer: "launch_implementer";
|
|
1104
1103
|
await_result: "await_result";
|
|
@@ -1106,6 +1105,7 @@ export declare const workflowToolResultSchemas: {
|
|
|
1106
1105
|
recover: "recover";
|
|
1107
1106
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
1108
1107
|
launch_blocked: "launch_blocked";
|
|
1108
|
+
close: "close";
|
|
1109
1109
|
}>;
|
|
1110
1110
|
launchEligible: z.ZodBoolean;
|
|
1111
1111
|
blockers: z.ZodArray<z.ZodString>;
|
|
@@ -1118,11 +1118,11 @@ export declare const workflowToolResultSchemas: {
|
|
|
1118
1118
|
errorCode: z.ZodString;
|
|
1119
1119
|
category: z.ZodOptional<z.ZodEnum<{
|
|
1120
1120
|
input: "input";
|
|
1121
|
-
state: "state";
|
|
1122
|
-
host_context: "host_context";
|
|
1123
1121
|
authorization: "authorization";
|
|
1124
|
-
persistence: "persistence";
|
|
1125
1122
|
internal: "internal";
|
|
1123
|
+
host_context: "host_context";
|
|
1124
|
+
state: "state";
|
|
1125
|
+
persistence: "persistence";
|
|
1126
1126
|
}>>;
|
|
1127
1127
|
message: z.ZodString;
|
|
1128
1128
|
existingWorkItemId: z.ZodOptional<z.ZodString>;
|
|
@@ -1390,11 +1390,11 @@ export declare const workflowToolResultSchemas: {
|
|
|
1390
1390
|
errorCode: z.ZodString;
|
|
1391
1391
|
category: z.ZodEnum<{
|
|
1392
1392
|
input: "input";
|
|
1393
|
-
state: "state";
|
|
1394
|
-
host_context: "host_context";
|
|
1395
1393
|
authorization: "authorization";
|
|
1396
|
-
persistence: "persistence";
|
|
1397
1394
|
internal: "internal";
|
|
1395
|
+
host_context: "host_context";
|
|
1396
|
+
state: "state";
|
|
1397
|
+
persistence: "persistence";
|
|
1398
1398
|
}>;
|
|
1399
1399
|
message: z.ZodString;
|
|
1400
1400
|
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1576,7 +1576,6 @@ export declare const workflowToolResultSchemas: {
|
|
|
1576
1576
|
autonomousGrantConsumed: z.ZodBoolean;
|
|
1577
1577
|
reportRejectionCount: z.ZodNumber;
|
|
1578
1578
|
nextAction: z.ZodEnum<{
|
|
1579
|
-
close: "close";
|
|
1580
1579
|
closed: "closed";
|
|
1581
1580
|
launch_implementer: "launch_implementer";
|
|
1582
1581
|
await_result: "await_result";
|
|
@@ -1584,6 +1583,7 @@ export declare const workflowToolResultSchemas: {
|
|
|
1584
1583
|
recover: "recover";
|
|
1585
1584
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
1586
1585
|
launch_blocked: "launch_blocked";
|
|
1586
|
+
close: "close";
|
|
1587
1587
|
}>;
|
|
1588
1588
|
latestAttempt: z.ZodOptional<z.ZodObject<{
|
|
1589
1589
|
attempt: z.ZodNumber;
|
|
@@ -1604,7 +1604,6 @@ export declare const workflowToolResultSchemas: {
|
|
|
1604
1604
|
}, z.core.$strict>>;
|
|
1605
1605
|
guidance: z.ZodOptional<z.ZodObject<{
|
|
1606
1606
|
nextAction: z.ZodEnum<{
|
|
1607
|
-
close: "close";
|
|
1608
1607
|
closed: "closed";
|
|
1609
1608
|
launch_implementer: "launch_implementer";
|
|
1610
1609
|
await_result: "await_result";
|
|
@@ -1612,6 +1611,7 @@ export declare const workflowToolResultSchemas: {
|
|
|
1612
1611
|
recover: "recover";
|
|
1613
1612
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
1614
1613
|
launch_blocked: "launch_blocked";
|
|
1614
|
+
close: "close";
|
|
1615
1615
|
}>;
|
|
1616
1616
|
launchEligible: z.ZodBoolean;
|
|
1617
1617
|
blockers: z.ZodArray<z.ZodString>;
|
|
@@ -1828,11 +1828,11 @@ export declare const workflowToolResultSchemas: {
|
|
|
1828
1828
|
errorCode: z.ZodString;
|
|
1829
1829
|
category: z.ZodEnum<{
|
|
1830
1830
|
input: "input";
|
|
1831
|
-
state: "state";
|
|
1832
|
-
host_context: "host_context";
|
|
1833
1831
|
authorization: "authorization";
|
|
1834
|
-
persistence: "persistence";
|
|
1835
1832
|
internal: "internal";
|
|
1833
|
+
host_context: "host_context";
|
|
1834
|
+
state: "state";
|
|
1835
|
+
persistence: "persistence";
|
|
1836
1836
|
}>;
|
|
1837
1837
|
message: z.ZodString;
|
|
1838
1838
|
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1897,11 +1897,11 @@ export declare const workflowToolResultSchemas: {
|
|
|
1897
1897
|
errorCode: z.ZodString;
|
|
1898
1898
|
category: z.ZodEnum<{
|
|
1899
1899
|
input: "input";
|
|
1900
|
-
state: "state";
|
|
1901
|
-
host_context: "host_context";
|
|
1902
1900
|
authorization: "authorization";
|
|
1903
|
-
persistence: "persistence";
|
|
1904
1901
|
internal: "internal";
|
|
1902
|
+
host_context: "host_context";
|
|
1903
|
+
state: "state";
|
|
1904
|
+
persistence: "persistence";
|
|
1905
1905
|
}>;
|
|
1906
1906
|
message: z.ZodString;
|
|
1907
1907
|
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1987,7 +1987,6 @@ export declare const workflowToolResultSchemas: {
|
|
|
1987
1987
|
closed: "closed";
|
|
1988
1988
|
}>;
|
|
1989
1989
|
nextAction: z.ZodEnum<{
|
|
1990
|
-
close: "close";
|
|
1991
1990
|
closed: "closed";
|
|
1992
1991
|
launch_implementer: "launch_implementer";
|
|
1993
1992
|
await_result: "await_result";
|
|
@@ -1995,6 +1994,7 @@ export declare const workflowToolResultSchemas: {
|
|
|
1995
1994
|
recover: "recover";
|
|
1996
1995
|
recover_with_user_authorization: "recover_with_user_authorization";
|
|
1997
1996
|
launch_blocked: "launch_blocked";
|
|
1997
|
+
close: "close";
|
|
1998
1998
|
}>;
|
|
1999
1999
|
}, z.core.$strict>, z.ZodObject<{
|
|
2000
2000
|
tool: z.ZodLiteral<"work_item_decide">;
|
|
@@ -2023,11 +2023,11 @@ export declare const workflowToolResultSchemas: {
|
|
|
2023
2023
|
errorCode: z.ZodString;
|
|
2024
2024
|
category: z.ZodEnum<{
|
|
2025
2025
|
input: "input";
|
|
2026
|
-
state: "state";
|
|
2027
|
-
host_context: "host_context";
|
|
2028
2026
|
authorization: "authorization";
|
|
2029
|
-
persistence: "persistence";
|
|
2030
2027
|
internal: "internal";
|
|
2028
|
+
host_context: "host_context";
|
|
2029
|
+
state: "state";
|
|
2030
|
+
persistence: "persistence";
|
|
2031
2031
|
}>;
|
|
2032
2032
|
message: z.ZodString;
|
|
2033
2033
|
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -2476,11 +2476,11 @@ export declare const workflowToolResultSchemas: {
|
|
|
2476
2476
|
errorCode: z.ZodString;
|
|
2477
2477
|
category: z.ZodEnum<{
|
|
2478
2478
|
input: "input";
|
|
2479
|
-
state: "state";
|
|
2480
|
-
host_context: "host_context";
|
|
2481
2479
|
authorization: "authorization";
|
|
2482
|
-
persistence: "persistence";
|
|
2483
2480
|
internal: "internal";
|
|
2481
|
+
host_context: "host_context";
|
|
2482
|
+
state: "state";
|
|
2483
|
+
persistence: "persistence";
|
|
2484
2484
|
}>;
|
|
2485
2485
|
message: z.ZodString;
|
|
2486
2486
|
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
4
|
// PURPOSE: Own the concrete public workflow result contracts: failure category taxonomy and classification, bounded failure DTOs with preserved tokenized issues and state/prerequisite guidance, closed result schemas and types for every owned workflow response family (standalone batch, generic mutation, list views, close, decide, checkpoint/authority actions, and failures), producer/test result validation, and production serialization with a truthful post-side-effect failure fallback.
|
|
5
5
|
// SCOPE: Pure result/response shape ownership only. No store lookup, no state eligibility, no permission decisions, no mutation, no persistence. Serialization never throws after a side effect and never parses free-form messages to recover paths or state.
|
|
6
|
-
// DEPENDS: [
|
|
6
|
+
// DEPENDS: [zod (direct runtime result schemas; pinned direct dependency is T-009 package assembly), src/lib/agent-tool-contract.ts]
|
|
7
7
|
// LINKS: [M-WORKFLOW-TOOLING, M-AGENT-TOOL-CONTRACT, M-PLUGIN-WORKFLOW]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
// END_MODULE_MAP
|
|
44
44
|
//
|
|
45
45
|
// START_CHANGE_SUMMARY
|
|
46
|
-
// LAST_CHANGE: [C-
|
|
46
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-004 - Replaced the V1 SDK tool.schema re-export with the direct zod instance for native Tool.ValueSchema compatibility; result shapes and validation are unchanged.]
|
|
47
47
|
// END_CHANGE_SUMMARY
|
|
48
|
-
import {
|
|
48
|
+
import { z } from "zod";
|
|
49
49
|
import { MAX_CONTRACT_ISSUES, MAX_ISSUE_MESSAGE_CHARS, MAX_ISSUE_PATH_CHARS, MAX_ISSUE_VALUE_CHARS, formatContractIssues, toContractIssues, } from "../../lib/agent-tool-contract.js";
|
|
50
50
|
import { AUTHORITY_STAGES, REVIEWER_ROLES, WORK_ITEM_MODES } from "../../lib/workflow-contract.js";
|
|
51
51
|
/**
|
|
@@ -501,7 +501,7 @@ export class WorkflowDiagnosticError extends Error {
|
|
|
501
501
|
}
|
|
502
502
|
// END_BLOCK_FAILURE_DTO
|
|
503
503
|
// START_BLOCK_SCHEMAS
|
|
504
|
-
const schema =
|
|
504
|
+
const schema = z;
|
|
505
505
|
const WORK_ITEM_STATES = [
|
|
506
506
|
"open",
|
|
507
507
|
"awaiting_implementer",
|