@osovv/vv-opencode 1.4.5 → 1.6.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 +23 -0
- package/README.md +47 -16
- package/dist/commands/patch-provider.d.ts +5 -5
- package/dist/commands/patch-provider.js +10 -6
- package/dist/commands/patch-provider.js.map +1 -1
- package/dist/lib/agent-tool-catalog.d.ts +144 -0
- package/dist/lib/agent-tool-catalog.js +2551 -0
- package/dist/lib/agent-tool-catalog.js.map +1 -0
- package/dist/lib/agent-tool-contract.d.ts +200 -0
- package/dist/lib/agent-tool-contract.js +407 -0
- package/dist/lib/agent-tool-contract.js.map +1 -0
- package/dist/lib/opencode/agent-registrations.d.ts +33 -0
- package/dist/lib/opencode/agent-registrations.js +469 -0
- package/dist/lib/opencode/agent-registrations.js.map +1 -0
- package/dist/lib/opencode/inspection.d.ts +84 -0
- package/dist/lib/opencode/inspection.js +367 -0
- package/dist/lib/opencode/inspection.js.map +1 -0
- package/dist/lib/opencode/model-overrides.d.ts +19 -0
- package/dist/lib/opencode/model-overrides.js +221 -0
- package/dist/lib/opencode/model-overrides.js.map +1 -0
- package/dist/lib/opencode/paths.d.ts +21 -0
- package/dist/lib/opencode/paths.js +62 -0
- package/dist/lib/opencode/paths.js.map +1 -0
- package/dist/lib/opencode/plugin-registration.d.ts +17 -0
- package/dist/lib/opencode/plugin-registration.js +210 -0
- package/dist/lib/opencode/plugin-registration.js.map +1 -0
- package/dist/lib/opencode/shared-utils.d.ts +30 -0
- package/dist/lib/opencode/shared-utils.js +183 -0
- package/dist/lib/opencode/shared-utils.js.map +1 -0
- package/dist/lib/opencode/vvoc-config-io.d.ts +9 -0
- package/dist/lib/opencode/vvoc-config-io.js +58 -0
- package/dist/lib/opencode/vvoc-config-io.js.map +1 -0
- package/dist/lib/opencode.d.ts +15 -174
- package/dist/lib/opencode.js +19 -1387
- package/dist/lib/opencode.js.map +1 -1
- package/dist/lib/spec-lint/cross-file-rules.d.ts +2 -0
- package/dist/lib/spec-lint/cross-file-rules.js +33 -0
- package/dist/lib/spec-lint/cross-file-rules.js.map +1 -0
- package/dist/lib/spec-lint/delegated-extraction.d.ts +8 -0
- package/dist/lib/spec-lint/delegated-extraction.js +112 -0
- package/dist/lib/spec-lint/delegated-extraction.js.map +1 -0
- package/dist/lib/spec-lint/lint.d.ts +7 -0
- package/dist/lib/spec-lint/lint.js +92 -0
- package/dist/lib/spec-lint/lint.js.map +1 -0
- package/dist/lib/spec-lint/parser.d.ts +101 -0
- package/dist/lib/spec-lint/parser.js +482 -0
- package/dist/lib/spec-lint/parser.js.map +1 -0
- package/dist/lib/spec-lint/plan-rules.d.ts +38 -0
- package/dist/lib/spec-lint/plan-rules.js +745 -0
- package/dist/lib/spec-lint/plan-rules.js.map +1 -0
- package/dist/lib/spec-lint/spec-rules.d.ts +8 -0
- package/dist/lib/spec-lint/spec-rules.js +188 -0
- package/dist/lib/spec-lint/spec-rules.js.map +1 -0
- package/dist/lib/spec-lint.d.ts +4 -63
- package/dist/lib/spec-lint.js +13 -1505
- package/dist/lib/spec-lint.js.map +1 -1
- package/dist/lib/vvoc-preset-registry.d.ts +7 -7
- package/dist/lib/vvoc-preset-registry.js +8 -8
- package/dist/lib/vvoc-preset-registry.js.map +1 -1
- package/dist/lib/workflow-contract.d.ts +12 -0
- package/dist/lib/workflow-contract.js +71 -18
- package/dist/lib/workflow-contract.js.map +1 -1
- package/dist/plugins/hashline-edit/index.js +102 -97
- package/dist/plugins/hashline-edit/index.js.map +1 -1
- package/dist/plugins/hashline-edit/normalize-edits.d.ts +2 -8
- package/dist/plugins/hashline-edit/normalize-edits.js +32 -17
- package/dist/plugins/hashline-edit/normalize-edits.js.map +1 -1
- package/dist/plugins/hashline-edit/schemas.d.ts +246 -0
- package/dist/plugins/hashline-edit/schemas.js +659 -0
- package/dist/plugins/hashline-edit/schemas.js.map +1 -0
- package/dist/plugins/hashline-edit/str-replace-editor.d.ts +6 -17
- package/dist/plugins/hashline-edit/str-replace-editor.js +19 -21
- package/dist/plugins/hashline-edit/str-replace-editor.js.map +1 -1
- package/dist/plugins/hashline-edit/tool-description.d.ts +1 -0
- package/dist/plugins/hashline-edit/tool-description.js +20 -4
- package/dist/plugins/hashline-edit/tool-description.js.map +1 -1
- package/dist/plugins/web-tools/fetch-service.d.ts +8 -5
- package/dist/plugins/web-tools/fetch-service.js +30 -45
- package/dist/plugins/web-tools/fetch-service.js.map +1 -1
- package/dist/plugins/web-tools/index.js +23 -5
- package/dist/plugins/web-tools/index.js.map +1 -1
- package/dist/plugins/web-tools/schemas.d.ts +469 -0
- package/dist/plugins/web-tools/schemas.js +523 -0
- package/dist/plugins/web-tools/schemas.js.map +1 -0
- package/dist/plugins/web-tools/search-service.d.ts +6 -3
- package/dist/plugins/web-tools/search-service.js +24 -29
- package/dist/plugins/web-tools/search-service.js.map +1 -1
- package/dist/plugins/workflow/authority.d.ts +6 -0
- package/dist/plugins/workflow/authority.js +45 -10
- package/dist/plugins/workflow/authority.js.map +1 -1
- package/dist/plugins/workflow/authorization.d.ts +30 -0
- package/dist/plugins/workflow/authorization.js +147 -0
- package/dist/plugins/workflow/authorization.js.map +1 -0
- package/dist/plugins/workflow/checkpoints.d.ts +41 -2
- package/dist/plugins/workflow/checkpoints.js +176 -47
- package/dist/plugins/workflow/checkpoints.js.map +1 -1
- package/dist/plugins/workflow/delegated.d.ts +15 -1
- package/dist/plugins/workflow/delegated.js +65 -35
- package/dist/plugins/workflow/delegated.js.map +1 -1
- package/dist/plugins/workflow/execution.d.ts +15 -30
- package/dist/plugins/workflow/execution.js +133 -33
- package/dist/plugins/workflow/execution.js.map +1 -1
- package/dist/plugins/workflow/index.js +197 -435
- package/dist/plugins/workflow/index.js.map +1 -1
- package/dist/plugins/workflow/input-validation.d.ts +48 -0
- package/dist/plugins/workflow/input-validation.js +536 -0
- package/dist/plugins/workflow/input-validation.js.map +1 -0
- package/dist/plugins/workflow/inspection.d.ts +60 -0
- package/dist/plugins/workflow/inspection.js +316 -0
- package/dist/plugins/workflow/inspection.js.map +1 -0
- package/dist/plugins/workflow/protocol.d.ts +2 -0
- package/dist/plugins/workflow/protocol.js +26 -4
- package/dist/plugins/workflow/protocol.js.map +1 -1
- package/dist/plugins/workflow/recovery.d.ts +18 -0
- package/dist/plugins/workflow/recovery.js +217 -0
- package/dist/plugins/workflow/recovery.js.map +1 -0
- package/dist/plugins/workflow/repair.d.ts +1 -1
- package/dist/plugins/workflow/repair.js +9 -10
- package/dist/plugins/workflow/repair.js.map +1 -1
- package/dist/plugins/workflow/results.d.ts +2566 -0
- package/dist/plugins/workflow/results.js +1111 -0
- package/dist/plugins/workflow/results.js.map +1 -0
- package/dist/plugins/workflow/schemas.d.ts +398 -0
- package/dist/plugins/workflow/schemas.js +399 -0
- package/dist/plugins/workflow/schemas.js.map +1 -0
- package/dist/plugins/workflow/state.d.ts +3 -2
- package/dist/plugins/workflow/state.js +15 -8
- package/dist/plugins/workflow/state.js.map +1 -1
- package/dist/plugins/workflow/system-instruction.md +17 -1
- package/dist/plugins/workflow/tooling.d.ts +11 -82
- package/dist/plugins/workflow/tooling.js +478 -461
- package/dist/plugins/workflow/tooling.js.map +1 -1
- package/dist/plugins/workflow/transactions.d.ts +13 -0
- package/dist/plugins/workflow/transactions.js +13 -3
- package/dist/plugins/workflow/transactions.js.map +1 -1
- package/package.json +6 -3
- package/schemas/vvoc/v3.json +1 -1
- package/templates/agents/vv-code-reviewer.md +13 -4
- package/templates/agents/vv-implementer.md +16 -9
- package/templates/agents/vv-spec-reviewer.md +13 -4
- package/templates/skills/vv-execute/SKILL.md +3 -3
- package/templates/skills/vv-execute/references/tool-contracts.md +1750 -0
- package/templates/skills/vv-review/SKILL.md +1 -1
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
// FILE: src/plugins/workflow/input-validation.ts
|
|
2
|
+
// VERSION: 1.0.0
|
|
3
|
+
// START_MODULE_CONTRACT
|
|
4
|
+
// PURPOSE: Own strict branch-aware runtime input validation for all five vvoc workflow tools: owned-tool contracts over the registered argument maps, canonical standalone/generic/checkpoint/decision/authority branch rules, an args-only allowed/required field matrix for every action and decision, whitespace/omission normalization, and the exported validateWorkflowToolInput entry shared by the tool.execute.before hook and every direct handler.
|
|
5
|
+
// SCOPE: Structural full-object parsing (unknown keys, enums, owning-validator bounds, closed nested shapes), documented trim with field-specific blank rejection from the contract schema, plus args-only branch conditions from the approved workflow branch matrix: execution/runId exclusivity, standalone versus generic item rules, source variants, action-specific required fields, recognized-field conflicts with the selected action/decision, bounded decision/recovery fields, and authority stage/stop validity. No store lookup, no state eligibility, no permission decisions, no filesystem or SDK session access.
|
|
6
|
+
// DEPENDS: [src/lib/agent-tool-contract.ts, src/lib/workflow-contract.ts, src/plugins/workflow/schemas.ts]
|
|
7
|
+
// LINKS: [M-WORKFLOW-TOOLING, M-AGENT-TOOL-CONTRACT, M-WORKFLOW-CONTRACT, M-PLUGIN-WORKFLOW]
|
|
8
|
+
// ROLE: RUNTIME
|
|
9
|
+
// MAP_MODE: EXPORTS
|
|
10
|
+
// END_MODULE_CONTRACT
|
|
11
|
+
//
|
|
12
|
+
// START_MODULE_MAP
|
|
13
|
+
// WORKFLOW_TOOL_IDS - Canonical ids of the five vvoc-owned workflow tools.
|
|
14
|
+
// WorkflowToolId - Union of the five workflow tool ids.
|
|
15
|
+
// isWorkflowToolId - Whether a value names an owned workflow tool.
|
|
16
|
+
// WORKFLOW_TOOL_DESCRIPTIONS - Canonical public descriptions shared by registrations and contracts.
|
|
17
|
+
// WorkflowToolInputMap - Schema-derived argument type per workflow tool id.
|
|
18
|
+
// WorkflowToolValidation - Successful parsed arguments or bounded structural/branch issues.
|
|
19
|
+
// validateWorkflowToolInput - Strict structural plus branch validation for one workflow tool call.
|
|
20
|
+
// assertWorkflowToolInput - Throwing guard mirroring the owned pre-execute contract, including branch rules.
|
|
21
|
+
// workflowToolContracts - Owned-tool contracts for the five workflow tools.
|
|
22
|
+
// getWorkflowToolContract - Contract lookup by tool id.
|
|
23
|
+
// END_MODULE_MAP
|
|
24
|
+
//
|
|
25
|
+
// START_CHANGE_SUMMARY
|
|
26
|
+
// LAST_CHANGE: [C-AGENT-TOOL-CONTRACTS T-002 - Initial branch-aware workflow tool input validation with exported validateWorkflowToolInput, owned contracts, and canonical descriptions; correction cycle adds an args-only action/decision field matrix, bounded branch diagnostics with precise indexed boundary paths, and shared generic task branch validation for both work_item_open items and work_checkpoint register/amend tasks. Field-specific trims/bounds now live in the contract schema so no blanket recursive string rejection is applied.]
|
|
27
|
+
// END_CHANGE_SUMMARY
|
|
28
|
+
import { ContractInputError, MAX_CONTRACT_ISSUES, MAX_ISSUE_MESSAGE_CHARS, MAX_ISSUE_PATH_CHARS, MAX_ISSUE_VALUE_CHARS, defineOwnedToolContract, formatIssuePath, summarizeReceivedValue, } from "../../lib/agent-tool-contract.js";
|
|
29
|
+
import { normalizeDeclaredScopePath, validateExecutionBoundary, } from "../../lib/workflow-contract.js";
|
|
30
|
+
import { workCheckpointArgs, workItemCloseArgs, workItemDecideArgs, workItemListArgs, workItemOpenArgs, } from "./schemas.js";
|
|
31
|
+
// START_BLOCK_TOOL_IDS
|
|
32
|
+
/** Canonical ids of the five vvoc-owned workflow tools. */
|
|
33
|
+
export const WORKFLOW_TOOL_IDS = [
|
|
34
|
+
"work_item_open",
|
|
35
|
+
"work_item_list",
|
|
36
|
+
"work_item_close",
|
|
37
|
+
"work_item_decide",
|
|
38
|
+
"work_checkpoint",
|
|
39
|
+
];
|
|
40
|
+
/** Whether a value names an owned workflow tool. */
|
|
41
|
+
export function isWorkflowToolId(value) {
|
|
42
|
+
return typeof value === "string" && WORKFLOW_TOOL_IDS.includes(value);
|
|
43
|
+
}
|
|
44
|
+
/** Canonical public descriptions shared by registrations and contracts. */
|
|
45
|
+
export const WORKFLOW_TOOL_DESCRIPTIONS = {
|
|
46
|
+
work_item_open: "Open one or more workflow work items idempotently with explicit mode and requiredReviewers.",
|
|
47
|
+
work_item_list: "List workflow work items for the current session.",
|
|
48
|
+
work_item_close: "Close a workflow work item by id when it is ready_to_close.",
|
|
49
|
+
work_item_decide: "Accept or request changes for the current completed delegated attempt, authorize bounded rework of an accepted task from a failed checkpoint, or recover a stopped or exhausted unaccepted task with a bounded diagnosis and changed condition.",
|
|
50
|
+
work_checkpoint: "Register an approved delegated plan, start a declared review checkpoint, verify checkpoint outcomes, or recover a stopped or generation-exhausted checkpoint; verify with complete: true seals a finished final checkpoint.",
|
|
51
|
+
};
|
|
52
|
+
const contracts = {
|
|
53
|
+
work_item_open: defineOwnedToolContract({
|
|
54
|
+
toolId: "work_item_open",
|
|
55
|
+
description: WORKFLOW_TOOL_DESCRIPTIONS.work_item_open,
|
|
56
|
+
registeredArgs: workItemOpenArgs,
|
|
57
|
+
}),
|
|
58
|
+
work_item_list: defineOwnedToolContract({
|
|
59
|
+
toolId: "work_item_list",
|
|
60
|
+
description: WORKFLOW_TOOL_DESCRIPTIONS.work_item_list,
|
|
61
|
+
registeredArgs: workItemListArgs,
|
|
62
|
+
}),
|
|
63
|
+
work_item_close: defineOwnedToolContract({
|
|
64
|
+
toolId: "work_item_close",
|
|
65
|
+
description: WORKFLOW_TOOL_DESCRIPTIONS.work_item_close,
|
|
66
|
+
registeredArgs: workItemCloseArgs,
|
|
67
|
+
}),
|
|
68
|
+
work_item_decide: defineOwnedToolContract({
|
|
69
|
+
toolId: "work_item_decide",
|
|
70
|
+
description: WORKFLOW_TOOL_DESCRIPTIONS.work_item_decide,
|
|
71
|
+
registeredArgs: workItemDecideArgs,
|
|
72
|
+
}),
|
|
73
|
+
work_checkpoint: defineOwnedToolContract({
|
|
74
|
+
toolId: "work_checkpoint",
|
|
75
|
+
description: WORKFLOW_TOOL_DESCRIPTIONS.work_checkpoint,
|
|
76
|
+
registeredArgs: workCheckpointArgs,
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
/** Owned-tool contracts for the five workflow tools. */
|
|
80
|
+
export const workflowToolContracts = [
|
|
81
|
+
contracts.work_item_open,
|
|
82
|
+
contracts.work_item_list,
|
|
83
|
+
contracts.work_item_close,
|
|
84
|
+
contracts.work_item_decide,
|
|
85
|
+
contracts.work_checkpoint,
|
|
86
|
+
];
|
|
87
|
+
/** Contract lookup by tool id. */
|
|
88
|
+
export function getWorkflowToolContract(toolId) {
|
|
89
|
+
return contracts[toolId];
|
|
90
|
+
}
|
|
91
|
+
// END_BLOCK_CONTRACTS
|
|
92
|
+
// START_BLOCK_BRANCH_ISSUES
|
|
93
|
+
function truncateChars(value, max) {
|
|
94
|
+
if (value.length <= max)
|
|
95
|
+
return value;
|
|
96
|
+
return `${value.slice(0, Math.max(0, max - 1))}…`;
|
|
97
|
+
}
|
|
98
|
+
/** Bound one branch-level issue so every claimed-bounded diagnostic is finite. */
|
|
99
|
+
function boundedIssue(issue) {
|
|
100
|
+
return {
|
|
101
|
+
code: issue.code,
|
|
102
|
+
path: truncateChars(issue.path, MAX_ISSUE_PATH_CHARS),
|
|
103
|
+
message: truncateChars(issue.message, MAX_ISSUE_MESSAGE_CHARS),
|
|
104
|
+
...(issue.expected !== undefined
|
|
105
|
+
? { expected: truncateChars(issue.expected, MAX_ISSUE_MESSAGE_CHARS) }
|
|
106
|
+
: {}),
|
|
107
|
+
...(issue.received !== undefined
|
|
108
|
+
? { received: truncateChars(issue.received, MAX_ISSUE_VALUE_CHARS) }
|
|
109
|
+
: {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function pushIssue(issues, issue) {
|
|
113
|
+
if (issues.length >= MAX_CONTRACT_ISSUES)
|
|
114
|
+
return;
|
|
115
|
+
issues.push(boundedIssue(issue));
|
|
116
|
+
}
|
|
117
|
+
function missingIssue(issues, path, message, expected) {
|
|
118
|
+
pushIssue(issues, {
|
|
119
|
+
code: "missing_value",
|
|
120
|
+
path: formatIssuePath(path),
|
|
121
|
+
message,
|
|
122
|
+
expected,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function conflictIssue(issues, path, message, expected) {
|
|
126
|
+
pushIssue(issues, {
|
|
127
|
+
code: "invalid_value",
|
|
128
|
+
path: formatIssuePath(path),
|
|
129
|
+
message,
|
|
130
|
+
expected,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function requireNonEmpty(issues, value, path, label) {
|
|
134
|
+
if (value === undefined || value.trim() === "") {
|
|
135
|
+
missingIssue(issues, path, `${label} must be a non-empty string`, `a non-empty ${label}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function requireNonEmptyList(issues, values, path, label) {
|
|
139
|
+
if (values === undefined || values.length === 0) {
|
|
140
|
+
missingIssue(issues, path, `${label} must be a non-empty array`, `at least one ${label} entry`);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
values.forEach((entry, index) => {
|
|
144
|
+
if (entry.trim() === "") {
|
|
145
|
+
missingIssue(issues, [...path, index], `${label} entries must be non-empty strings`, `a non-empty ${label} entry`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// END_BLOCK_BRANCH_ISSUES
|
|
150
|
+
// START_BLOCK_OPEN_BRANCHES
|
|
151
|
+
const GENERIC_TASK_FIELDS = [
|
|
152
|
+
"taskId",
|
|
153
|
+
"goal",
|
|
154
|
+
"acceptanceCriteria",
|
|
155
|
+
"verification",
|
|
156
|
+
"dependsOn",
|
|
157
|
+
"blockedBy",
|
|
158
|
+
];
|
|
159
|
+
function validateDeclaredFileList(issues, entries, path) {
|
|
160
|
+
const seen = new Set();
|
|
161
|
+
entries.forEach((entry, index) => {
|
|
162
|
+
const normalized = normalizeDeclaredScopePath(entry);
|
|
163
|
+
if (!normalized.ok) {
|
|
164
|
+
conflictIssue(issues, [...path, index], `path ${summarizeReceivedValue(entry)} is malformed (${normalized.reason})`, "a workspace-relative exact file path without traversal, wildcards, or trailing separators");
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (seen.has(normalized.path)) {
|
|
168
|
+
conflictIssue(issues, [...path, index], `path ${summarizeReceivedValue(normalized.path)} is declared more than once`, "unique file paths");
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
seen.add(normalized.path);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Validate one task/work-item entry against its mode. `base` is the exact token
|
|
176
|
+
* path to the entry (`["items", i]` for work_item_open, `["tasks", i]` for
|
|
177
|
+
* work_checkpoint register/amend) so both entry routes share the same rules and
|
|
178
|
+
* report their own indexed paths.
|
|
179
|
+
*/
|
|
180
|
+
function validateOpenItemBranch(issues, item, base, generic) {
|
|
181
|
+
if (generic) {
|
|
182
|
+
if (item.mode !== "delegated") {
|
|
183
|
+
conflictIssue(issues, [...base, "mode"], "generic open/append items require mode delegated", '"delegated"');
|
|
184
|
+
}
|
|
185
|
+
if (item.planRunId !== undefined || item.planTaskId !== undefined) {
|
|
186
|
+
conflictIssue(issues, [...base, "planRunId"], "native plan bindings conflict with generic open/append items", "no planRunId/planTaskId on generic tasks");
|
|
187
|
+
}
|
|
188
|
+
if (item.writeScope === undefined || item.writeScope.length === 0) {
|
|
189
|
+
missingIssue(issues, [...base, "writeScope"], "generic tasks require a non-empty writeScope of workspace-relative files", "at least one workspace-relative file path");
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
validateDeclaredFileList(issues, item.writeScope, [...base, "writeScope"]);
|
|
193
|
+
}
|
|
194
|
+
if (new Set(item.requiredReviewers).size !== item.requiredReviewers.length) {
|
|
195
|
+
conflictIssue(issues, [...base, "requiredReviewers"], "requiredReviewers must be a unique spec/code array", "unique canonical reviewer roles");
|
|
196
|
+
}
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
for (const field of GENERIC_TASK_FIELDS) {
|
|
200
|
+
if (item[field] !== undefined) {
|
|
201
|
+
conflictIssue(issues, [...base, field], `${field} is a generic task field and conflicts with standalone work_item_open items`, "generic task fields only on execution/runId open or work_checkpoint amendments");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (item.mode === "delegated") {
|
|
205
|
+
if (item.requiredReviewers.length !== 0) {
|
|
206
|
+
conflictIssue(issues, [...base, "requiredReviewers"], "delegated mode requires an explicitly empty requiredReviewers array", "[]");
|
|
207
|
+
}
|
|
208
|
+
if (item.writeScope === undefined || item.writeScope.length === 0) {
|
|
209
|
+
missingIssue(issues, [...base, "writeScope"], "delegated mode requires a non-empty writeScope of workspace-relative files", "at least one workspace-relative file path");
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
validateDeclaredFileList(issues, item.writeScope, [...base, "writeScope"]);
|
|
213
|
+
}
|
|
214
|
+
if ((item.planRunId === undefined) !== (item.planTaskId === undefined)) {
|
|
215
|
+
const offending = item.planRunId === undefined ? "planRunId" : "planTaskId";
|
|
216
|
+
conflictIssue(issues, [...base, offending], "planRunId and planTaskId must be provided together", "both native plan bindings or neither");
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// standalone implementation / review_only
|
|
221
|
+
if (item.requiredReviewers.length === 0) {
|
|
222
|
+
missingIssue(issues, [...base, "requiredReviewers"], "standalone implementation/review_only require a non-empty unique reviewer set", "at least one canonical spec/code reviewer");
|
|
223
|
+
}
|
|
224
|
+
else if (new Set(item.requiredReviewers).size !== item.requiredReviewers.length) {
|
|
225
|
+
conflictIssue(issues, [...base, "requiredReviewers"], "requiredReviewers must be a unique spec/code array", "unique canonical reviewer roles");
|
|
226
|
+
}
|
|
227
|
+
if (item.writeScope !== undefined) {
|
|
228
|
+
conflictIssue(issues, [...base, "writeScope"], `writeScope is only valid for delegated mode, not ${item.mode}`, "no writeScope on standalone implementation/review_only items");
|
|
229
|
+
}
|
|
230
|
+
if (item.planRunId !== undefined || item.planTaskId !== undefined) {
|
|
231
|
+
const offending = item.planRunId !== undefined ? "planRunId" : "planTaskId";
|
|
232
|
+
conflictIssue(issues, [...base, offending], `plan bindings are only valid for delegated mode, not ${item.mode}`, "no plan bindings on standalone implementation/review_only items");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function validateOpenBranches(issues, data) {
|
|
236
|
+
const hasExecution = data.execution !== undefined;
|
|
237
|
+
const hasRunId = data.runId !== undefined;
|
|
238
|
+
if (hasExecution && hasRunId) {
|
|
239
|
+
conflictIssue(issues, ["execution"], "execution and runId are mutually exclusive", "exactly one of execution (register) or runId (append)");
|
|
240
|
+
}
|
|
241
|
+
if (hasExecution) {
|
|
242
|
+
// Amendment context belongs to runId appends only; a registration must not
|
|
243
|
+
// silently drop supplied append-only fields.
|
|
244
|
+
for (const field of ["amendmentId", "rationale"]) {
|
|
245
|
+
if (data[field] !== undefined) {
|
|
246
|
+
conflictIssue(issues, [field], `${field} is append-only amendment context and conflicts with execution registration`, "runId with amendment context instead of execution");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (!hasExecution && !hasRunId) {
|
|
251
|
+
if (data.amendmentId !== undefined || data.rationale !== undefined) {
|
|
252
|
+
conflictIssue(issues, ["amendmentId"], "amendmentId and rationale are only valid with runId appends", "runId with amendment context");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const generic = hasExecution || hasRunId;
|
|
256
|
+
data.items.forEach((item, index) => validateOpenItemBranch(issues, item, ["items", index], generic));
|
|
257
|
+
if (data.execution) {
|
|
258
|
+
const boundary = validateExecutionBoundary(data.execution.boundary);
|
|
259
|
+
if (!boundary.ok) {
|
|
260
|
+
for (const problem of boundary.problems) {
|
|
261
|
+
pushIssue(issues, {
|
|
262
|
+
code: problem.code === "EMPTY_BOUNDARY" ? "missing_value" : "invalid_value",
|
|
263
|
+
// The pure boundary validator supplies the indexed file/directory path;
|
|
264
|
+
// never reconstruct it by parsing the prose message.
|
|
265
|
+
path: formatIssuePath(["execution", ...(problem.path ?? ["boundary"])]),
|
|
266
|
+
message: problem.message,
|
|
267
|
+
expected: "normalized non-empty exact files or directory subtrees",
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (hasRunId) {
|
|
273
|
+
requireNonEmpty(issues, data.runId, ["runId"], "runId");
|
|
274
|
+
requireNonEmpty(issues, data.amendmentId, ["amendmentId"], "amendmentId");
|
|
275
|
+
requireNonEmpty(issues, data.rationale, ["rationale"], "rationale");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// END_BLOCK_OPEN_BRANCHES
|
|
279
|
+
// START_BLOCK_DECIDE_BRANCHES
|
|
280
|
+
/**
|
|
281
|
+
* Args-only field matrix for work_item_decide, derived from the fields each
|
|
282
|
+
* decision branch actually consumes. A recognized field supplied for a
|
|
283
|
+
* different decision is rejected instead of being silently ignored.
|
|
284
|
+
*/
|
|
285
|
+
const DECIDE_DECISION_FIELDS = {
|
|
286
|
+
accept: ["workItemId", "attempt", "decision", "rationale", "evidence", "concernsDisposition"],
|
|
287
|
+
request_changes: [
|
|
288
|
+
"workItemId",
|
|
289
|
+
"attempt",
|
|
290
|
+
"decision",
|
|
291
|
+
"rationale",
|
|
292
|
+
"evidence",
|
|
293
|
+
"concernsDisposition",
|
|
294
|
+
],
|
|
295
|
+
rework: ["workItemId", "attempt", "decision", "runId", "checkpointId", "rationale"],
|
|
296
|
+
recover: [
|
|
297
|
+
"workItemId",
|
|
298
|
+
"attempt",
|
|
299
|
+
"decision",
|
|
300
|
+
"recoveryId",
|
|
301
|
+
"diagnosis",
|
|
302
|
+
"changedCondition",
|
|
303
|
+
"verification",
|
|
304
|
+
"userMessageId",
|
|
305
|
+
"authorityId",
|
|
306
|
+
"runId",
|
|
307
|
+
],
|
|
308
|
+
};
|
|
309
|
+
function validateDecideFieldMatrix(issues, data) {
|
|
310
|
+
const allowed = new Set(DECIDE_DECISION_FIELDS[data.decision]);
|
|
311
|
+
for (const key of Object.keys(data)) {
|
|
312
|
+
const value = data[key];
|
|
313
|
+
if (value === undefined || allowed.has(key))
|
|
314
|
+
continue;
|
|
315
|
+
conflictIssue(issues, [key], `${key} is not consumed by decision ${data.decision}`, `only ${[...allowed].join(", ")}`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function validateDecideBranches(issues, data) {
|
|
319
|
+
validateDecideFieldMatrix(issues, data);
|
|
320
|
+
requireNonEmpty(issues, data.workItemId, ["workItemId"], "workItemId");
|
|
321
|
+
if (data.concernsDisposition !== undefined && data.concernsDisposition.trim() === "") {
|
|
322
|
+
missingIssue(issues, ["concernsDisposition"], "concernsDisposition must be a non-empty string when provided", "a non-empty concerns disposition");
|
|
323
|
+
}
|
|
324
|
+
if (data.decision === "accept" || data.decision === "request_changes") {
|
|
325
|
+
requireNonEmpty(issues, data.rationale, ["rationale"], "rationale");
|
|
326
|
+
requireNonEmptyList(issues, data.evidence, ["evidence"], "evidence");
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (data.decision === "rework") {
|
|
330
|
+
requireNonEmpty(issues, data.runId, ["runId"], "runId");
|
|
331
|
+
requireNonEmpty(issues, data.checkpointId, ["checkpointId"], "checkpointId");
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
// recover
|
|
335
|
+
requireNonEmpty(issues, data.recoveryId, ["recoveryId"], "recoveryId");
|
|
336
|
+
requireNonEmpty(issues, data.diagnosis, ["diagnosis"], "diagnosis");
|
|
337
|
+
requireNonEmpty(issues, data.changedCondition, ["changedCondition"], "changedCondition");
|
|
338
|
+
requireNonEmptyList(issues, data.verification, ["verification"], "verification");
|
|
339
|
+
if (data.authorityId !== undefined) {
|
|
340
|
+
requireNonEmpty(issues, data.runId, ["runId"], "runId");
|
|
341
|
+
}
|
|
342
|
+
else if (data.runId !== undefined) {
|
|
343
|
+
// runId is only consumed by recover when it owns the advance authority;
|
|
344
|
+
// without authorityId it would be silently ignored.
|
|
345
|
+
conflictIssue(issues, ["runId"], "runId is only consumed by recover together with an authorityId", "authorityId with its owning runId, or neither");
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// END_BLOCK_DECIDE_BRANCHES
|
|
349
|
+
// START_BLOCK_CHECKPOINT_BRANCHES
|
|
350
|
+
/**
|
|
351
|
+
* Args-only allowed-field matrix for work_checkpoint, derived from the fields
|
|
352
|
+
* each action branch (native and generic) actually consumes. A recognized field
|
|
353
|
+
* supplied for a different action is rejected instead of being silently ignored;
|
|
354
|
+
* fields that are only valid on one source variant stay allowed here and are
|
|
355
|
+
* resolved by the source lookup in tooling.ts.
|
|
356
|
+
*/
|
|
357
|
+
const CHECKPOINT_ACTION_FIELDS = {
|
|
358
|
+
register: ["planPath", "runId", "amendmentId", "rationale", "tasks", "checkpoints"],
|
|
359
|
+
start: ["runId", "checkpointId", "startFingerprint"],
|
|
360
|
+
verify: ["runId", "checkpointId", "complete", "reviewer"],
|
|
361
|
+
recover: [
|
|
362
|
+
"runId",
|
|
363
|
+
"checkpointId",
|
|
364
|
+
"recoveryId",
|
|
365
|
+
"diagnosis",
|
|
366
|
+
"changedCondition",
|
|
367
|
+
"verification",
|
|
368
|
+
"userMessageId",
|
|
369
|
+
"authorityId",
|
|
370
|
+
],
|
|
371
|
+
review: ["runId", "checkpointId", "reviewer"],
|
|
372
|
+
bind: ["runId", "checkpointId", "reviewer"],
|
|
373
|
+
complete: ["runId", "rationale", "verification"],
|
|
374
|
+
amend: ["runId", "amendmentId", "rationale", "tasks", "checkpoints"],
|
|
375
|
+
authorize: [
|
|
376
|
+
"runId",
|
|
377
|
+
"authorityId",
|
|
378
|
+
"messageId",
|
|
379
|
+
"stages",
|
|
380
|
+
"decisionScope",
|
|
381
|
+
"fileBoundary",
|
|
382
|
+
"reservedStops",
|
|
383
|
+
],
|
|
384
|
+
record_approval: [
|
|
385
|
+
"runId",
|
|
386
|
+
"authorityId",
|
|
387
|
+
"approvalId",
|
|
388
|
+
"stage",
|
|
389
|
+
"artifactPath",
|
|
390
|
+
"artifactSha256",
|
|
391
|
+
],
|
|
392
|
+
revoke_authority: ["runId", "authorityId", "revocationId", "stages", "rationale"],
|
|
393
|
+
};
|
|
394
|
+
function validateCheckpointFieldMatrix(issues, data) {
|
|
395
|
+
const allowed = new Set(CHECKPOINT_ACTION_FIELDS[data.action]);
|
|
396
|
+
for (const key of Object.keys(data)) {
|
|
397
|
+
if (key === "action")
|
|
398
|
+
continue;
|
|
399
|
+
const value = data[key];
|
|
400
|
+
if (value === undefined || allowed.has(key))
|
|
401
|
+
continue;
|
|
402
|
+
conflictIssue(issues, [key], `${key} is not consumed by action ${data.action}`, `only ${[...allowed].join(", ")}`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function validateCheckpointBranches(issues, data) {
|
|
406
|
+
validateCheckpointFieldMatrix(issues, data);
|
|
407
|
+
const hasPlanPath = data.planPath !== undefined;
|
|
408
|
+
const hasRunId = data.runId !== undefined;
|
|
409
|
+
const action = data.action;
|
|
410
|
+
// Generic register/amend tasks obey the same branch rules as work_item_open
|
|
411
|
+
// generic items; without this they reached the store with a conflicting mode
|
|
412
|
+
// or native bindings silently erased.
|
|
413
|
+
if ((action === "register" || action === "amend") && hasRunId && data.tasks !== undefined) {
|
|
414
|
+
data.tasks.forEach((task, index) => validateOpenItemBranch(issues, task, ["tasks", index], true));
|
|
415
|
+
}
|
|
416
|
+
if (action === "register") {
|
|
417
|
+
if (hasPlanPath && hasRunId) {
|
|
418
|
+
conflictIssue(issues, ["runId"], "register accepts either planPath (native package) or runId (generic amend context), not both", "exactly one registration route");
|
|
419
|
+
}
|
|
420
|
+
if (hasPlanPath) {
|
|
421
|
+
// Native package registration loads the plan itself; generic task and
|
|
422
|
+
// amendment fields are not consumed and must not be silently ignored.
|
|
423
|
+
for (const field of ["amendmentId", "rationale", "tasks", "checkpoints"]) {
|
|
424
|
+
if (data[field] !== undefined) {
|
|
425
|
+
conflictIssue(issues, [field], `${field} is generic register/amend context and conflicts with native planPath registration`, "no generic registration fields with planPath");
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (!hasPlanPath) {
|
|
430
|
+
if (!hasRunId) {
|
|
431
|
+
missingIssue(issues, ["runId"], "generic register requires the target runId of an existing execution", "the existing execution runId");
|
|
432
|
+
}
|
|
433
|
+
requireNonEmpty(issues, data.amendmentId, ["amendmentId"], "amendmentId");
|
|
434
|
+
requireNonEmpty(issues, data.rationale, ["rationale"], "rationale");
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
else if (!hasRunId) {
|
|
438
|
+
missingIssue(issues, ["runId"], `action ${action} requires the target runId`, "the target execution runId");
|
|
439
|
+
}
|
|
440
|
+
switch (action) {
|
|
441
|
+
case "start":
|
|
442
|
+
case "verify":
|
|
443
|
+
case "review":
|
|
444
|
+
case "bind":
|
|
445
|
+
requireNonEmpty(issues, data.checkpointId, ["checkpointId"], "checkpointId");
|
|
446
|
+
return;
|
|
447
|
+
case "recover":
|
|
448
|
+
requireNonEmpty(issues, data.runId, ["runId"], "runId");
|
|
449
|
+
requireNonEmpty(issues, data.checkpointId, ["checkpointId"], "checkpointId");
|
|
450
|
+
requireNonEmpty(issues, data.recoveryId, ["recoveryId"], "recoveryId");
|
|
451
|
+
requireNonEmpty(issues, data.diagnosis, ["diagnosis"], "diagnosis");
|
|
452
|
+
requireNonEmpty(issues, data.changedCondition, ["changedCondition"], "changedCondition");
|
|
453
|
+
requireNonEmptyList(issues, data.verification, ["verification"], "verification");
|
|
454
|
+
return;
|
|
455
|
+
case "amend":
|
|
456
|
+
requireNonEmpty(issues, data.runId, ["runId"], "runId");
|
|
457
|
+
requireNonEmpty(issues, data.amendmentId, ["amendmentId"], "amendmentId");
|
|
458
|
+
requireNonEmpty(issues, data.rationale, ["rationale"], "rationale");
|
|
459
|
+
return;
|
|
460
|
+
case "complete":
|
|
461
|
+
return;
|
|
462
|
+
case "authorize":
|
|
463
|
+
requireNonEmpty(issues, data.authorityId, ["authorityId"], "authorityId");
|
|
464
|
+
requireNonEmpty(issues, data.messageId, ["messageId"], "messageId");
|
|
465
|
+
if (data.stages === undefined || data.stages.length === 0) {
|
|
466
|
+
missingIssue(issues, ["stages"], "authorize requires explicit delegatable stages", "at least one canonical authority stage");
|
|
467
|
+
}
|
|
468
|
+
return;
|
|
469
|
+
case "record_approval":
|
|
470
|
+
requireNonEmpty(issues, data.authorityId, ["authorityId"], "authorityId");
|
|
471
|
+
requireNonEmpty(issues, data.approvalId, ["approvalId"], "approvalId");
|
|
472
|
+
if (data.stage === undefined) {
|
|
473
|
+
missingIssue(issues, ["stage"], "record_approval requires an authority stage", "a canonical authority stage");
|
|
474
|
+
}
|
|
475
|
+
requireNonEmpty(issues, data.artifactPath, ["artifactPath"], "artifactPath");
|
|
476
|
+
requireNonEmpty(issues, data.artifactSha256, ["artifactSha256"], "artifactSha256");
|
|
477
|
+
return;
|
|
478
|
+
case "revoke_authority":
|
|
479
|
+
requireNonEmpty(issues, data.authorityId, ["authorityId"], "authorityId");
|
|
480
|
+
requireNonEmpty(issues, data.revocationId, ["revocationId"], "revocationId");
|
|
481
|
+
return;
|
|
482
|
+
default:
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
// END_BLOCK_CHECKPOINT_BRANCHES
|
|
487
|
+
// START_BLOCK_VALIDATE_ENTRY
|
|
488
|
+
/**
|
|
489
|
+
* Strict structural plus branch validation for one workflow tool call.
|
|
490
|
+
* Unknown keys, enums, and nested shapes fail first; empty-after-trim supplied
|
|
491
|
+
* values fail next for the whole request; then the args-only branch matrix
|
|
492
|
+
* enforces required fields and rejects recognized fields that conflict with the
|
|
493
|
+
* selected action or decision. Every issue carries a bounded tokenized path.
|
|
494
|
+
* The result never mutates the input and never confers state/permission eligibility.
|
|
495
|
+
*/
|
|
496
|
+
export function validateWorkflowToolInput(toolId, rawArgs) {
|
|
497
|
+
const contract = contracts[toolId];
|
|
498
|
+
// The contract schema already applies the documented trim and rejects a
|
|
499
|
+
// supplied blank on every field whose owning validator requires non-empty
|
|
500
|
+
// (whole-request structural rejection before any item opens). Empty content
|
|
501
|
+
// that is a documented default (decisionScope) stays representable.
|
|
502
|
+
const parsed = contract.safeParse(rawArgs);
|
|
503
|
+
if (!parsed.success) {
|
|
504
|
+
return { ok: false, issues: parsed.issues };
|
|
505
|
+
}
|
|
506
|
+
const issues = [];
|
|
507
|
+
switch (toolId) {
|
|
508
|
+
case "work_item_open":
|
|
509
|
+
validateOpenBranches(issues, parsed.data);
|
|
510
|
+
break;
|
|
511
|
+
case "work_item_list":
|
|
512
|
+
break;
|
|
513
|
+
case "work_item_close":
|
|
514
|
+
requireNonEmpty(issues, parsed.data.workItemId, ["workItemId"], "workItemId");
|
|
515
|
+
break;
|
|
516
|
+
case "work_item_decide":
|
|
517
|
+
validateDecideBranches(issues, parsed.data);
|
|
518
|
+
break;
|
|
519
|
+
case "work_checkpoint":
|
|
520
|
+
validateCheckpointBranches(issues, parsed.data);
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
if (issues.length > 0) {
|
|
524
|
+
return { ok: false, issues };
|
|
525
|
+
}
|
|
526
|
+
return { ok: true, data: parsed.data };
|
|
527
|
+
}
|
|
528
|
+
/** Throwing guard mirroring the owned pre-execute contract, including branch rules. */
|
|
529
|
+
export function assertWorkflowToolInput(toolId, rawArgs) {
|
|
530
|
+
const result = validateWorkflowToolInput(toolId, rawArgs);
|
|
531
|
+
if (!result.ok) {
|
|
532
|
+
throw new ContractInputError(toolId, result.issues);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
// END_BLOCK_VALIDATE_ENTRY
|
|
536
|
+
//# sourceMappingURL=input-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-validation.js","sourceRoot":"","sources":["../../../src/plugins/workflow/input-validation.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,iBAAiB;AACjB,wBAAwB;AACxB,gcAAgc;AAChc,smBAAsmB;AACtmB,6GAA6G;AAC7G,+FAA+F;AAC/F,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,6EAA6E;AAC7E,0D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summarizeDelegatedProgress, type DelegatedNextAction } from "./delegated.js";
|
|
3
|
+
import { latestAttemptView } from "./execution.js";
|
|
4
|
+
import type { WorkflowContractIdentity, WorkflowDelegatedRunView, WorkflowExecutionView, WorkflowWorkItemView } from "./results.js";
|
|
5
|
+
/**
|
|
6
|
+
* Gate-derived guidance for one delegated work item. `nextAction` always agrees
|
|
7
|
+
* with the shared launch/decision gates; `blockers` names the exact gate reason
|
|
8
|
+
* (with the offending task or checkpoint id) when an ordinary launch is blocked.
|
|
9
|
+
*/
|
|
10
|
+
export interface DelegatedGuidanceView {
|
|
11
|
+
nextAction: DelegatedNextAction;
|
|
12
|
+
launchEligible: boolean;
|
|
13
|
+
blockers: string[];
|
|
14
|
+
prerequisites: string[];
|
|
15
|
+
requiresConcernsDisposition: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkflowInspectionResult extends Record<string, unknown> {
|
|
18
|
+
tool: "work_item_list";
|
|
19
|
+
sessionId: string;
|
|
20
|
+
includeClosed: boolean;
|
|
21
|
+
items: WorkflowWorkItemView[];
|
|
22
|
+
planRuns?: WorkflowDelegatedRunView[];
|
|
23
|
+
executions?: WorkflowExecutionView[];
|
|
24
|
+
contract: WorkflowContractIdentity;
|
|
25
|
+
}
|
|
26
|
+
/** Store context required to derive snapshot-level (not host-level) eligibility. */
|
|
27
|
+
export interface InspectionContext {
|
|
28
|
+
data: WorkItemStoreData;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Loaded package/revision identity from the accepted cross-plugin contract
|
|
33
|
+
* module only. Never reads a global install, user config, or remote metadata.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getWorkflowContractIdentity(): WorkflowContractIdentity;
|
|
36
|
+
interface DelegatedGuidanceOptions {
|
|
37
|
+
record: WorkItemRecord;
|
|
38
|
+
progress: ReturnType<typeof summarizeDelegatedProgress>;
|
|
39
|
+
latest: ReturnType<typeof latestAttemptView>;
|
|
40
|
+
context: InspectionContext;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build gate-derived guidance. Ordinary launches are downgraded to
|
|
44
|
+
* `launch_blocked` whenever the real item-level or execution-level gate would
|
|
45
|
+
* reject, so a caller can never see `launch_implementer` beside a blocker. This
|
|
46
|
+
* is the single composed helper shared by inspection and every mutation/failure
|
|
47
|
+
* response that reports a next action.
|
|
48
|
+
*/
|
|
49
|
+
export declare function deriveDelegatedGuidance(options: DelegatedGuidanceOptions): DelegatedGuidanceView;
|
|
50
|
+
/**
|
|
51
|
+
* Read-only serialization of one work item. Delegated budget/guidance derives
|
|
52
|
+
* from shared pure gates; no private ledger body or authorization message text
|
|
53
|
+
* is exposed. Store context is required for delegated items so snapshot-level
|
|
54
|
+
* global gates are honored; non-delegated items are context-independent.
|
|
55
|
+
*/
|
|
56
|
+
export declare function serializeWorkItem(record: WorkItemRecord, context?: InspectionContext): WorkflowWorkItemView;
|
|
57
|
+
export declare function getWorkflowInspection(store: WorkItemStore, sessionId: string, options?: {
|
|
58
|
+
includeClosed?: boolean;
|
|
59
|
+
}): WorkflowInspectionResult;
|
|
60
|
+
export {};
|