zob-harness 0.15.4 → 0.16.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/.pi/capabilities/zob-public-runtime-capabilities.json +27 -6
- package/.pi/extensions/zob-harness/index.ts +229 -1
- package/.pi/extensions/zob-harness/src/core/utils/formatting.ts +58 -2
- package/.pi/extensions/zob-harness/src/domains/delegation/child-runner.ts +16 -4
- package/.pi/extensions/zob-harness/src/domains/delegation/output-contracts.ts +99 -21
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todo-types.ts +813 -6
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/formatting.ts +5 -2
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/normalize.ts +857 -90
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/operations.ts +922 -81
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/reducer.ts +51 -11
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/reference.ts +308 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/transition-engine.ts +400 -0
- package/.pi/extensions/zob-harness/src/domains/goal/mutation-cas.ts +527 -0
- package/.pi/extensions/zob-harness/src/domains/governance/file-tool-preflight.ts +865 -0
- package/.pi/extensions/zob-harness/src/domains/governance/safety.ts +169 -1
- package/.pi/extensions/zob-harness/src/domains/telemetry/tool-failures.ts +215 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/zlive.ts +10 -8
- package/.pi/extensions/zob-harness/src/runtime/delegation-monitor.ts +105 -0
- package/.pi/extensions/zob-harness/src/runtime/events.ts +207 -86
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/commands.ts +83 -39
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/events.ts +18 -1
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/handoff.ts +131 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/mutation-cas.ts +327 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/mutation-tools.ts +31 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/schemas.ts +130 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/state.ts +830 -51
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/tools.ts +1548 -293
- package/.pi/extensions/zob-harness/src/runtime/schemas.ts +6 -3
- package/.pi/extensions/zob-harness/src/runtime/state.ts +12 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-coms.ts +9 -14
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation/helpers.ts +407 -124
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation/register.ts +76 -21
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation/types.ts +24 -0
- package/.pi/extensions/zob-harness/src/runtime/zpeer-auto-reply.ts +192 -0
- package/.pi/extensions/zob-harness/src/types.ts +89 -0
- package/.pi/skills/zob-coms-safety/SKILL.md +3 -1
- package/.pi/skills/zob-coms-v2-live/SKILL.md +4 -2
- package/.pi/skills/zob-goal-todo-tree/SKILL.md +45 -0
- package/package.json +3 -1
- package/scripts/goal-todo/child-goal-ref-smoke.mjs +22 -2
- package/scripts/goal-todo/handoff-static-smoke.mjs +12 -6
- package/scripts/goal-todo/reconcile-legacy-attempts.mjs +466 -0
- package/scripts/telemetry/replay-tool-failures.mjs +32 -0
- package/scripts/zpeer-static-smoke.mjs +2 -2
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"docRefs": [
|
|
126
126
|
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
127
127
|
],
|
|
128
|
-
"noShipNotes": "Primary parent-owned TODO transition path; child no_ship is review evidence, not delivery success/failure by itself."
|
|
128
|
+
"noShipNotes": "Primary parent-owned TODO transition path; child no_ship is review evidence, not delivery success/failure by itself. Transitions bind the strict canonical todo_id (or dual agreed todo_id+todo_path; reference_mismatch/invalid_todo_id are fail-closed and never retarget a failed todo_id through todo_path). Terminal accept/complete transitions require mandatory CAS/revision agreement, while normal transitions may use optional observe-first CAS; mutation_id is replay-idempotent and conflicting state fails closed. Claim attempts are tracked separately, so a recovered/re-delegated attempt is distinct from the original."
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
"name": "complete_goal_todo",
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
"docRefs": [
|
|
222
222
|
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
223
223
|
],
|
|
224
|
-
"noShipNotes": "Records oracle validation metadata for a returned delegated TODO claim; auto-accept requires exact claim_hash, PASS, recommended_action=accept_claim, no_ship=false, acceptable confidence, and no blocking issues."
|
|
224
|
+
"noShipNotes": "Records oracle validation metadata for a returned delegated TODO claim; auto-accept requires exact claim_hash, PASS, recommended_action=accept_claim, no_ship=false, acceptable confidence, and no blocking issues. Validation is attempt-separated and CAS/revision-gated: the validated claim_hash must match the exact returned attempt (a recovered/re-delegated attempt has a distinct claim_hash) and any mismatch or stale/ambiguous state fails closed."
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
"name": "accept_goal_todo_claim",
|
|
@@ -261,6 +261,27 @@
|
|
|
261
261
|
],
|
|
262
262
|
"noShipNotes": "Delegated TODO claim metadata only."
|
|
263
263
|
},
|
|
264
|
+
{
|
|
265
|
+
"name": "recover_goal_todo_delegation",
|
|
266
|
+
"family": "goal",
|
|
267
|
+
"modes": [
|
|
268
|
+
"explore",
|
|
269
|
+
"plan",
|
|
270
|
+
"implement",
|
|
271
|
+
"oracle",
|
|
272
|
+
"factory",
|
|
273
|
+
"orchestrator"
|
|
274
|
+
],
|
|
275
|
+
"skillRefs": [
|
|
276
|
+
".pi/skills/zob-goal-todo-tree/SKILL.md",
|
|
277
|
+
".pi/skills/zob-delegation-routing/SKILL.md",
|
|
278
|
+
".pi/skills/zob-oracle/SKILL.md"
|
|
279
|
+
],
|
|
280
|
+
"docRefs": [
|
|
281
|
+
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
282
|
+
],
|
|
283
|
+
"noShipNotes": "Parent-owned recovery of a stuck delegated Goal TODO lane only; goal TODO metadata repair, not a source edit and not a completion. Requires a strict canonical todo_id (never path text -> invalid_todo_id) or dual agreed todo_id+todo_path (reference_mismatch on disagreement; a failed todo_id is never retargeted through todo_path). Allowed only for recoverable delegated lanes (failed/rejected/orphan) when no active child/run owns the leaf; active/running delegated work is blocked with split-before-parallel guidance and must not be double-delegated. Terminal recovery is CAS/revision-gated and fail-closed on stale/unknown state; observe-only inspection is permitted but never auto-corrects or shadows a blocked lane. mutation_id is replay-idempotent (returns the existing result) and a conflicting mutation_id against changed state is a CAS conflict, not a silent overwrite. The prior child's liveness is treated as unknown; recovery never auto-redelegates the same leaf and never completes the parent TODO or bypasses oracle/no_ship/evidence gates. Durable records stay hash-only/body-free (claim_hash/output_hash and artifact refs only); legacy unbound/stale events/claims/proposals remain readable but fail-closed until explicitly revalidated/recovered with no silent upgrade."
|
|
284
|
+
},
|
|
264
285
|
{
|
|
265
286
|
"name": "import_factory_todos",
|
|
266
287
|
"family": "goal",
|
|
@@ -398,7 +419,7 @@
|
|
|
398
419
|
"docRefs": [
|
|
399
420
|
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
400
421
|
],
|
|
401
|
-
"noShipNotes": "Proposal only; oracle record still required for completion evidence."
|
|
422
|
+
"noShipNotes": "Proposal only; oracle record still required for completion evidence. Completion is a terminal transition and is CAS/revision-gated with mandatory agreement; observe-only is not accepted for completion and stale/ambiguous state fails closed."
|
|
402
423
|
},
|
|
403
424
|
{
|
|
404
425
|
"name": "record_goal_oracle",
|
|
@@ -418,7 +439,7 @@
|
|
|
418
439
|
"docRefs": [
|
|
419
440
|
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
420
441
|
],
|
|
421
|
-
"noShipNotes": "Records oracle verdict metadata only."
|
|
442
|
+
"noShipNotes": "Records oracle verdict metadata only. Oracle records are terminal and CAS/revision-gated: the recorded claim_hash must match the exact validated attempt and stale/ambiguous state fails closed; observe-only is not accepted for an oracle record."
|
|
422
443
|
},
|
|
423
444
|
{
|
|
424
445
|
"name": "update_goal",
|
|
@@ -719,7 +740,7 @@
|
|
|
719
740
|
"docRefs": [
|
|
720
741
|
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
721
742
|
],
|
|
722
|
-
"noShipNotes": "Agent-initiated visible ZPeer ask; local_socket only, room-scoped with optional explicit roomId, mode defaults async, opt-in requireResponse tracks msgId-correlated replies with bounded timeout/reinjection metadata, normal/urgent/force are rate/loop guarded, force requires a hashed reason and role/topology guards, raw bodies transient and durable records hash-only."
|
|
743
|
+
"noShipNotes": "Agent-initiated visible ZPeer ask; local_socket only, room-scoped with optional explicit roomId, mode defaults async and waiting is delivery-only, opt-in requireResponse tracks msgId-correlated replies with bounded timeout/reinjection metadata, normal short-task responses are auto-captured only from an exact custom-message msgId, goal-bound responses wait for terminal goal state, ambiguous inbounds fail closed, normal/urgent/force are rate/loop guarded, force requires a hashed reason and role/topology guards, raw bodies transient and durable records hash-only."
|
|
723
744
|
},
|
|
724
745
|
{
|
|
725
746
|
"name": "zpeer_reply",
|
|
@@ -739,7 +760,7 @@
|
|
|
739
760
|
"docRefs": [
|
|
740
761
|
".pi/extensions/zob-harness/src/AGENTS.md"
|
|
741
762
|
],
|
|
742
|
-
"noShipNotes": "Explicit msgId-bound ZPeer reply path for active inbound messages; local_socket only, requires exact active msgId, wrong/expired/already-answered msgIds are blocked, raw reply body is transient and durable metadata stores outputHash/status only."
|
|
763
|
+
"noShipNotes": "Explicit msgId-bound ZPeer reply path for active inbound messages and fail-closed fallback when automatic binding is ambiguous; local_socket only, requires exact active msgId, wrong/expired/already-answered msgIds are blocked, raw reply body is transient and durable metadata stores outputHash/status only."
|
|
743
764
|
},
|
|
744
765
|
{
|
|
745
766
|
"name": "zob_goal_room_send",
|
|
@@ -4,6 +4,7 @@ import zobHarnessRuntime from "./src/runtime/zobHarness.js";
|
|
|
4
4
|
|
|
5
5
|
export { renderHarnessWidget } from "./src/runtime/widget.js";
|
|
6
6
|
export { createHarnessRuntimeState, inferModeFromUserIntent } from "./src/runtime/state.js";
|
|
7
|
+
export { FILE_TOOL_RELIABILITY_PROMPT } from "./src/runtime/events.js";
|
|
7
8
|
|
|
8
9
|
export type {
|
|
9
10
|
AdaptiveDelegationGovernorState,
|
|
@@ -27,12 +28,20 @@ export type { ChronicleState } from "./src/domains/telemetry/chronicle.js";
|
|
|
27
28
|
|
|
28
29
|
export type {
|
|
29
30
|
ChildStopCondition,
|
|
31
|
+
OutputGateIssue,
|
|
32
|
+
OutputGateIssueClassification,
|
|
33
|
+
OutputGateIssueCode,
|
|
30
34
|
RuleAppliesTo,
|
|
31
35
|
RuleEnforcementLevel,
|
|
32
36
|
RuleOracleRequirement,
|
|
33
37
|
RulePack,
|
|
34
38
|
RuleResolution,
|
|
35
39
|
RuleResolverInput,
|
|
40
|
+
ToolFailureAttempt,
|
|
41
|
+
ToolFailureClass,
|
|
42
|
+
ToolFailureReasonCode,
|
|
43
|
+
ToolFailureReplayFixture,
|
|
44
|
+
ToolFailureReplaySummary,
|
|
36
45
|
} from "./src/types.js";
|
|
37
46
|
|
|
38
47
|
export { pathMatches } from "./src/core/utils/paths.js";
|
|
@@ -41,6 +50,44 @@ export { parseGoalState, validateGoalState, validateStrictGoalSpecAnchor, parseB
|
|
|
41
50
|
export type { StrictGoalSpecAnchor, StrictGoalSpecAnchorKind } from "./src/domains/goal/goal.js";
|
|
42
51
|
export { DEFAULT_GOAL_ACTIVATION_MODE, clearRuntimeGoalContinuationState, clearRuntimeGoalContinuationStateFor, formatGoalActivationMode, formatRuntimeGoalSummary, hasPendingUndeliveredZpeerInbound, queueRuntimeGoalContinuation, restoreRuntimeGoalFromBranch, resumeRuntimeGoal, runtimeGoalStatusLine } from "./src/runtime/goal-runtime.js";
|
|
43
52
|
export type { GoalActivationMode, RuntimeGoal, RuntimeGoalStatus, RuntimeGoalOracleStatus, RuntimeGoalOracleVerdict } from "./src/runtime/goal-runtime.js";
|
|
53
|
+
export {
|
|
54
|
+
buildRuntimeGoalCompletionProposal,
|
|
55
|
+
buildRuntimeGoalOracleBinding,
|
|
56
|
+
evaluateRuntimeGoalCompletionProposalFreshness,
|
|
57
|
+
evaluateRuntimeGoalOracleFreshness,
|
|
58
|
+
formatRuntimeGoalCompletionProposal,
|
|
59
|
+
formatRuntimeGoalOracleBinding,
|
|
60
|
+
hashRuntimeGoalCompletionProposal,
|
|
61
|
+
hashRuntimeGoalCompletionProposalArray,
|
|
62
|
+
hashRuntimeGoalOracleDecision,
|
|
63
|
+
hashRuntimeGoalOracleEvidence,
|
|
64
|
+
isRuntimeGoalCompletionProposalV2,
|
|
65
|
+
isRuntimeGoalOracleBindingV2,
|
|
66
|
+
normalizeRuntimeGoalCompletionProposal,
|
|
67
|
+
normalizeRuntimeGoalOracleState,
|
|
68
|
+
publicRuntimeGoal,
|
|
69
|
+
runtimeGoalCompletionProposalPublicDetails,
|
|
70
|
+
runtimeGoalOraclePublicDetails,
|
|
71
|
+
} from "./src/runtime/goal-runtime/state.js";
|
|
72
|
+
export type {
|
|
73
|
+
BuildRuntimeGoalCompletionProposalInput,
|
|
74
|
+
BuildRuntimeGoalOracleBindingInput,
|
|
75
|
+
EvaluateRuntimeGoalCompletionProposalFreshnessInput,
|
|
76
|
+
EvaluateRuntimeGoalOracleFreshnessInput,
|
|
77
|
+
RuntimeGoalCompletionProposalFreshness,
|
|
78
|
+
RuntimeGoalCompletionProposalFreshnessCode,
|
|
79
|
+
RuntimeGoalCompletionProposalFreshnessStatus,
|
|
80
|
+
RuntimeGoalCompletionProposalLegacy,
|
|
81
|
+
RuntimeGoalCompletionProposalMalformed,
|
|
82
|
+
RuntimeGoalCompletionProposalSafeReproposeAction,
|
|
83
|
+
RuntimeGoalCompletionProposalV2,
|
|
84
|
+
RuntimeGoalEntry,
|
|
85
|
+
RuntimeGoalOracleBindingV2,
|
|
86
|
+
RuntimeGoalOracleFreshness,
|
|
87
|
+
RuntimeGoalOracleFreshnessCode,
|
|
88
|
+
RuntimeGoalOracleFreshnessStatus,
|
|
89
|
+
RuntimeGoalRevisionDiagnostic,
|
|
90
|
+
} from "./src/runtime/goal-runtime/state.js";
|
|
44
91
|
export { extractModeIntent, looksLikeCompletePlanResponse, stripModeIntentMarkup, validateModeIntent } from "./src/runtime/mode-intent.js";
|
|
45
92
|
export type { ZobModeIntent, ZobModeIntentConfidence, ZobModeIntentRisk, ZobModeIntentValidation } from "./src/runtime/mode-intent.js";
|
|
46
93
|
export { capturePlanArtifact, extractPlanTitle, listCapturedPlanEntries, shouldCapturePlanResponse, updateCapturedPlanEntry } from "./src/runtime/plan-capture.js";
|
|
@@ -91,7 +138,139 @@ export {
|
|
|
91
138
|
summarizeGoalTodos,
|
|
92
139
|
validateGoalTodoGraph,
|
|
93
140
|
} from "./src/domains/goal/goal-todos.js";
|
|
94
|
-
export
|
|
141
|
+
export { GoalTodoTransitionError, assertCurrentGoalTodoClaimSettlementBinding, assertCurrentGoalTodoClaimValidationBinding, authorizeGoalTodoTransition, finalizeGoalTodoDelegationAttempt, isCanonicalGoalTodoClaimBinding, markGoalTodoDelegationFailed, recoverGoalTodoDelegation, updateGoalTodo } from "./src/domains/goal/goal-todos/operations.js";
|
|
142
|
+
export type { FinalizeGoalTodoDelegationAttemptInput, GoalTodoClaimBindingExpectation, GoalTodoTransitionAuthorization, RecoverGoalTodoDelegationInput } from "./src/domains/goal/goal-todos/operations.js";
|
|
143
|
+
export { assessDelegationAttemptLiveness } from "./src/runtime/delegation-monitor.js";
|
|
144
|
+
export {
|
|
145
|
+
CANONICAL_GOAL_TODO_ID_PATTERN,
|
|
146
|
+
VISIBLE_GOAL_TODO_PATH_PATTERN,
|
|
147
|
+
GoalTodoReferenceResolutionError,
|
|
148
|
+
adaptLegacyGoalTodoReference,
|
|
149
|
+
goalTodoReferenceDiagnostic,
|
|
150
|
+
resolveCanonicalGoalTodoReference,
|
|
151
|
+
resolveCanonicalGoalTodoReferences,
|
|
152
|
+
throwGoalTodoReferenceResolution,
|
|
153
|
+
} from "./src/domains/goal/goal-todos/reference.js";
|
|
154
|
+
export type {
|
|
155
|
+
GoalTodoCanonicalReferenceInput,
|
|
156
|
+
GoalTodoReferenceBatchResolution,
|
|
157
|
+
GoalTodoReferenceCandidate,
|
|
158
|
+
GoalTodoReferenceCode,
|
|
159
|
+
GoalTodoReferenceDiagnostic,
|
|
160
|
+
GoalTodoReferenceError,
|
|
161
|
+
GoalTodoReferenceField,
|
|
162
|
+
GoalTodoReferenceResolution,
|
|
163
|
+
GoalTodoReferenceRetryPolicy,
|
|
164
|
+
GoalTodoReferenceSafeNextAction,
|
|
165
|
+
} from "./src/domains/goal/goal-todo-types.js";
|
|
166
|
+
export type { GoalRoomTodoReducerAction, GoalRoomTodoReducerDecision, GoalTodoClaimRef, GoalTodoClaimValidationRef, GoalTodoCompletionDiagnostics, GoalTodoEvent, GoalTodoNode, GoalTodoOwner, GoalTodoPolicy, GoalTodoPriority, GoalTodoState, GoalTodoStatus, GoalTodoSummary, ResolveGoalTodoAction, TodoClaimValidationResult, TodoSplitRequest, TodoSplitRequestAction, TodoSplitRiskLevel } from "./src/domains/goal/goal-todos.js";
|
|
167
|
+
export {
|
|
168
|
+
GOAL_TODO_STATUSES,
|
|
169
|
+
GOAL_TODO_TRANSITION_ACTIONS,
|
|
170
|
+
GOAL_TODO_TRANSITION_TABLE,
|
|
171
|
+
decideGoalTodoTransition,
|
|
172
|
+
getGoalTodoTransitionRule,
|
|
173
|
+
listGoalTodoTransitionRules,
|
|
174
|
+
} from "./src/domains/goal/goal-todos/transition-engine.js";
|
|
175
|
+
export { GOAL_MUTATION_PHASE_CODES } from "./src/domains/goal/goal-todo-types.js";
|
|
176
|
+
export type {
|
|
177
|
+
GoalMutationAppliedExecution,
|
|
178
|
+
GoalMutationAppliedOutcome,
|
|
179
|
+
GoalMutationApplyFailureMode,
|
|
180
|
+
GoalMutationApplyResult,
|
|
181
|
+
GoalMutationCanonicalRequest,
|
|
182
|
+
GoalMutationCasInput,
|
|
183
|
+
GoalMutationCasOutcome,
|
|
184
|
+
GoalMutationConflictOutcome,
|
|
185
|
+
GoalMutationCurrentRevisions,
|
|
186
|
+
GoalMutationExecutionDiagnostic,
|
|
187
|
+
GoalMutationExecutionInput,
|
|
188
|
+
GoalMutationExecutionOutcome,
|
|
189
|
+
GoalMutationFailedExecution,
|
|
190
|
+
GoalMutationFailureCode,
|
|
191
|
+
GoalMutationGuard,
|
|
192
|
+
GoalMutationObservation,
|
|
193
|
+
GoalMutationObservedExecution,
|
|
194
|
+
GoalMutationPhase,
|
|
195
|
+
GoalMutationPreparation,
|
|
196
|
+
GoalMutationPreparationInput,
|
|
197
|
+
GoalMutationPreparationPhase,
|
|
198
|
+
GoalMutationProtocolRecord,
|
|
199
|
+
GoalMutationPublicGuard,
|
|
200
|
+
GoalMutationReceipt,
|
|
201
|
+
GoalMutationReceiptDiagnostic,
|
|
202
|
+
GoalMutationReceiptDiagnosticCode,
|
|
203
|
+
GoalMutationReceiptInput,
|
|
204
|
+
GoalMutationReceiptState,
|
|
205
|
+
GoalMutationRejectedOutcome,
|
|
206
|
+
GoalMutationReplayedExecution,
|
|
207
|
+
GoalMutationReplayedOutcome,
|
|
208
|
+
GoalMutationSideEffectRef,
|
|
209
|
+
GoalMutationSideEffectState,
|
|
210
|
+
GoalMutationStaleOutcome,
|
|
211
|
+
GoalTodoClaimResolutionBinding,
|
|
212
|
+
GoalTodoClaimValidationPolicy,
|
|
213
|
+
GoalTodoDelegationAttempt,
|
|
214
|
+
GoalTodoDelegationAttemptFailureKind,
|
|
215
|
+
GoalTodoDelegationAttemptReasonCode,
|
|
216
|
+
GoalTodoDelegationAttemptStatus,
|
|
217
|
+
GoalTodoDelegationLiveness,
|
|
218
|
+
GoalTodoDelegationLivenessAssessmentStatus,
|
|
219
|
+
GoalTodoDelegationLivenessProof,
|
|
220
|
+
GoalTodoDelegationLivenessProofCode,
|
|
221
|
+
GoalTodoDelegationLivenessProofSource,
|
|
222
|
+
GoalTodoDelegationRecovery,
|
|
223
|
+
GoalTodoLegacyEvent,
|
|
224
|
+
GoalTodoPatchClearField,
|
|
225
|
+
GoalTodoRevisionDiagnostic,
|
|
226
|
+
GoalTodoRevisionDiagnosticCode,
|
|
227
|
+
GoalTodoRevisionEvent,
|
|
228
|
+
GoalTodoTransitionAction,
|
|
229
|
+
GoalTodoTransitionCode,
|
|
230
|
+
GoalTodoTransitionContext,
|
|
231
|
+
GoalTodoTransitionDecision,
|
|
232
|
+
GoalTodoTransitionDiagnostic,
|
|
233
|
+
GoalTodoTransitionGuard,
|
|
234
|
+
GoalTodoTransitionInput,
|
|
235
|
+
GoalTodoTransitionOperationContext,
|
|
236
|
+
GoalTodoTransitionRetryPolicy,
|
|
237
|
+
GoalTodoTransitionRule,
|
|
238
|
+
GoalTodoTransitionRuleDiagnostic,
|
|
239
|
+
GoalTodoTransitionTable,
|
|
240
|
+
} from "./src/domains/goal/goal-todo-types.js";
|
|
241
|
+
export {
|
|
242
|
+
GOAL_MUTATION_ID_PATTERN,
|
|
243
|
+
GOAL_MUTATION_PREPARATION_ENTRY_TYPE,
|
|
244
|
+
GOAL_MUTATION_PREPARATION_SCHEMA,
|
|
245
|
+
GOAL_MUTATION_RECEIPT_ENTRY_TYPE,
|
|
246
|
+
GOAL_MUTATION_RECEIPT_SCHEMA,
|
|
247
|
+
blockGoalMutationReceiptState,
|
|
248
|
+
canonicalGoalMutationJson,
|
|
249
|
+
cloneGoalMutationReceipt,
|
|
250
|
+
cloneGoalMutationReceiptState,
|
|
251
|
+
createGoalMutationPreparation,
|
|
252
|
+
createGoalMutationReceipt,
|
|
253
|
+
createGoalMutationReceiptState,
|
|
254
|
+
evaluateGoalMutationCas,
|
|
255
|
+
finalizeGoalMutationReceiptRestore,
|
|
256
|
+
hashGoalMutationRequest,
|
|
257
|
+
indexGoalMutationPreparation,
|
|
258
|
+
indexGoalMutationReceipt,
|
|
259
|
+
indexGoalMutationReceiptEntry,
|
|
260
|
+
isCanonicalGoalMutationId,
|
|
261
|
+
isCanonicalGoalMutationRequestHash,
|
|
262
|
+
markGoalMutationInDoubt,
|
|
263
|
+
normalizeGoalMutationPreparation,
|
|
264
|
+
normalizeGoalMutationReceipt,
|
|
265
|
+
restoreGoalMutationReceiptsFromBranch,
|
|
266
|
+
} from "./src/domains/goal/mutation-cas.js";
|
|
267
|
+
export { GoalDelegationRecoveryGuardSchema, GoalMutationGuardProperties, GoalMutationGuardSchema, GoalTodoCanonicalReferenceProperties, GoalTodoCanonicalReferenceSchema, GoalTodoClaimHashSchema, parseOptionalGoalMutationGuard, parseRequiredGoalDelegationRecoveryGuard } from "./src/runtime/goal-runtime/schemas.js";
|
|
268
|
+
export { GOAL_MUTATION_TOOL_NAMES, isGoalMutationToolName } from "./src/runtime/goal-runtime/mutation-tools.js";
|
|
269
|
+
export type { GoalMutationToolName } from "./src/runtime/goal-runtime/mutation-tools.js";
|
|
270
|
+
export { buildGoalMutationCanonicalRequest, executeGoalMutationCas } from "./src/runtime/goal-runtime/mutation-cas.js";
|
|
271
|
+
export type { GoalMutationCanonicalRequestInput, GoalMutationCanonicalRequestResult } from "./src/runtime/goal-runtime/mutation-cas.js";
|
|
272
|
+
export { GOAL_HANDOFF_EFFECT_FLAGS, buildGoalHandoffCanonicalPayload, executeGoalHandoffCas } from "./src/runtime/goal-runtime/handoff.js";
|
|
273
|
+
export type { GoalHandoffCanonicalPayload, GoalHandoffCasExecution, GoalHandoffCasExecutionInput, GoalHandoffCasPreflight } from "./src/runtime/goal-runtime/handoff.js";
|
|
95
274
|
export { importChainRunTodos, importFactoryRunTodos, importOrchestrationRunTodos } from "./src/domains/goal/goal-todo-imports.js";
|
|
96
275
|
export type { GoalTodoImportResult } from "./src/domains/goal/goal-todo-imports.js";
|
|
97
276
|
export { appendGoalRoomMessage, buildGoalRoomMessage, goalRoomBodyFreeViolations, isGoalRoomMessage, listGoalRoomMessages, validateGoalRoomMessageInput, validateGoalRoomMessageRecord } from "./src/domains/goal/goal-room.js";
|
|
@@ -461,17 +640,54 @@ export {
|
|
|
461
640
|
} from "./src/domains/governance/safety.js";
|
|
462
641
|
|
|
463
642
|
export {
|
|
643
|
+
OUTPUT_GATE_ISSUE_CODES,
|
|
464
644
|
listOutputContracts,
|
|
465
645
|
getOutputContractDefinitions,
|
|
646
|
+
getOutputContractFinalMarker,
|
|
466
647
|
inferOutputContract,
|
|
467
648
|
validateOutputContractId,
|
|
468
649
|
validateOutputContract,
|
|
650
|
+
validateOutputContractIssues,
|
|
469
651
|
validateChildOutput,
|
|
652
|
+
validateChildOutputIssues,
|
|
470
653
|
applyChildGates,
|
|
471
654
|
} from "./src/domains/delegation/output-contracts.js";
|
|
472
655
|
|
|
656
|
+
export { createChildSessionPath } from "./src/domains/delegation/child-runner.js";
|
|
657
|
+
|
|
473
658
|
export { buildChildEnv } from "./src/domains/governance/safety.js";
|
|
474
659
|
|
|
660
|
+
export {
|
|
661
|
+
DEFAULT_CONTENT_READ_BUDGET_BYTES,
|
|
662
|
+
FILE_TOOL_PREFLIGHT_FIELDS,
|
|
663
|
+
FILE_TOOL_PREFLIGHT_REASON_CODES,
|
|
664
|
+
FILE_TOOL_PREFLIGHT_RETRY_POLICIES,
|
|
665
|
+
FILE_TOOL_PREFLIGHT_SAFE_NEXT_ACTIONS,
|
|
666
|
+
FILE_TOOL_PREFLIGHT_TOOLS,
|
|
667
|
+
FILE_TOOL_PREFLIGHT_VERDICTS,
|
|
668
|
+
createFileToolPreflightRuntimeState,
|
|
669
|
+
fileToolPreflightBodyLikeFieldViolations,
|
|
670
|
+
persistFileToolPreflightDecision,
|
|
671
|
+
preflightFileToolCall,
|
|
672
|
+
validateFileToolPreflightDecision,
|
|
673
|
+
validateFileToolPreflightLedgerEntry,
|
|
674
|
+
} from "./src/domains/governance/file-tool-preflight.js";
|
|
675
|
+
export type {
|
|
676
|
+
FileToolPreflightCall,
|
|
677
|
+
FileToolPreflightDecision,
|
|
678
|
+
FileToolPreflightField,
|
|
679
|
+
FileToolPreflightIo,
|
|
680
|
+
FileToolPreflightLedgerEntry,
|
|
681
|
+
FileToolPreflightPolicy,
|
|
682
|
+
FileToolPreflightReasonCode,
|
|
683
|
+
FileToolPreflightRecordResult,
|
|
684
|
+
FileToolPreflightRetryPolicy,
|
|
685
|
+
FileToolPreflightRuntimeState,
|
|
686
|
+
FileToolPreflightSafeNextAction,
|
|
687
|
+
FileToolPreflightTool,
|
|
688
|
+
FileToolPreflightVerdict,
|
|
689
|
+
} from "./src/domains/governance/file-tool-preflight.js";
|
|
690
|
+
|
|
475
691
|
export {
|
|
476
692
|
validateSandboxWritePlanInputs,
|
|
477
693
|
runSandboxWritePlan,
|
|
@@ -507,6 +723,18 @@ export {
|
|
|
507
723
|
writeChronicleSnapshot,
|
|
508
724
|
} from "./src/domains/telemetry/chronicle.js";
|
|
509
725
|
|
|
726
|
+
export {
|
|
727
|
+
TOOL_FAILURE_CLASSES,
|
|
728
|
+
TOOL_FAILURE_REASON_CODES,
|
|
729
|
+
TOOL_FAILURE_TAXONOMY_REVISION,
|
|
730
|
+
replayToolFailureAttempts,
|
|
731
|
+
replayToolFailureFixtures,
|
|
732
|
+
fileToolPreflightFingerprint,
|
|
733
|
+
toolFailureBodyLikeFieldViolations,
|
|
734
|
+
toolFailureIncidentKey,
|
|
735
|
+
validateToolFailureReplayFixture,
|
|
736
|
+
} from "./src/domains/telemetry/tool-failures.js";
|
|
737
|
+
|
|
510
738
|
export { buildCapabilityIndex, buildReuseScoutReport, writeCapabilityIndex, writeReuseScoutReport } from "./src/domains/delegation/capabilities.js";
|
|
511
739
|
|
|
512
740
|
export { buildAutonomousRuntimeDryRun, buildAutonomousRuntimeDryRunFinalReport, buildAutonomousRuntimeDryRunValidation, validateAutonomousReadOnlySmokeRunArtifacts, validateAutonomousRuntimeDryRunArtifacts, writeAutonomousReadOnlySmokeRunReport, writeAutonomousRuntimeDryRunReport } from "./src/domains/autonomy/autonomous-runtime.js";
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import type { ChildResult } from "../../types.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export interface BlockedFeedbackDiagnostics {
|
|
4
|
+
executionPerformed: false;
|
|
5
|
+
currentMode: string;
|
|
6
|
+
reasonCode: string;
|
|
7
|
+
retryPolicy: string;
|
|
8
|
+
safeNextAction: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface FileToolPreflightFeedbackDiagnostics {
|
|
12
|
+
executionPerformed: false;
|
|
13
|
+
toolName: string;
|
|
14
|
+
reasonCode: string;
|
|
15
|
+
field: string;
|
|
16
|
+
pathHash: string;
|
|
17
|
+
inputHash: string;
|
|
18
|
+
snapshotHash: string;
|
|
19
|
+
fingerprintHash: string;
|
|
20
|
+
retryPolicy: string;
|
|
21
|
+
safeNextActions: readonly string[];
|
|
22
|
+
telemetryRecorded: boolean;
|
|
23
|
+
deduplicated: boolean;
|
|
24
|
+
attemptCount: number;
|
|
25
|
+
unchangedRetryCount: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function blockedFeedback(toolName: string, reason: string, attempted: string, diagnostics?: BlockedFeedbackDiagnostics): string {
|
|
4
29
|
return [
|
|
5
30
|
`ZOB damage-control blocked ${toolName}: ${reason}`,
|
|
6
31
|
"",
|
|
@@ -10,6 +35,37 @@ function blockedFeedback(toolName: string, reason: string, attempted: string): s
|
|
|
10
35
|
"- If this was non-destructive reconnaissance, skip it or ask the user for the specific value.",
|
|
11
36
|
"- If this was destructive, stop and ask for explicit approval with exact command, risk, and rollback plan.",
|
|
12
37
|
"- Do not retry the same blocked call.",
|
|
38
|
+
...(diagnostics ? [
|
|
39
|
+
"",
|
|
40
|
+
"Structured diagnostics:",
|
|
41
|
+
`execution_performed=${diagnostics.executionPerformed}`,
|
|
42
|
+
`current_mode=${diagnostics.currentMode}`,
|
|
43
|
+
`reason_code=${diagnostics.reasonCode}`,
|
|
44
|
+
`retry_policy=${diagnostics.retryPolicy}`,
|
|
45
|
+
`safe_next_action=${diagnostics.safeNextAction}`,
|
|
46
|
+
] : []),
|
|
47
|
+
].join("\n");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function fileToolPreflightFeedback(diagnostics: FileToolPreflightFeedbackDiagnostics): string {
|
|
51
|
+
return [
|
|
52
|
+
`ZOB file-tool preflight blocked ${diagnostics.toolName}: ${diagnostics.reasonCode}`,
|
|
53
|
+
"",
|
|
54
|
+
"Structured diagnostics (body-free):",
|
|
55
|
+
`execution_performed=${diagnostics.executionPerformed}`,
|
|
56
|
+
`reason_code=${diagnostics.reasonCode}`,
|
|
57
|
+
`field=${diagnostics.field}`,
|
|
58
|
+
`path_hash=${diagnostics.pathHash}`,
|
|
59
|
+
`input_hash=${diagnostics.inputHash}`,
|
|
60
|
+
`snapshot_hash=${diagnostics.snapshotHash}`,
|
|
61
|
+
`fingerprint_hash=${diagnostics.fingerprintHash}`,
|
|
62
|
+
`retry_policy=${diagnostics.retryPolicy}`,
|
|
63
|
+
`safe_next_actions=${diagnostics.safeNextActions.join(",")}`,
|
|
64
|
+
`telemetry_recorded=${diagnostics.telemetryRecorded}`,
|
|
65
|
+
`deduplicated=${diagnostics.deduplicated}`,
|
|
66
|
+
`attempt_count=${diagnostics.attemptCount}`,
|
|
67
|
+
`unchanged_retry_count=${diagnostics.unchangedRetryCount}`,
|
|
68
|
+
"No native tool execution occurred. Correct the cited field or follow the safe action; no input was changed or retried automatically.",
|
|
13
69
|
].join("\n");
|
|
14
70
|
}
|
|
15
71
|
|
|
@@ -31,4 +87,4 @@ function formatChildResultText(result: ChildResult): string {
|
|
|
31
87
|
return messages.length > 0 ? messages.join("\n\n") : "(no output)";
|
|
32
88
|
}
|
|
33
89
|
|
|
34
|
-
export { blockedFeedback, capOutput, formatChildResultText };
|
|
90
|
+
export { blockedFeedback, capOutput, fileToolPreflightFeedback, formatChildResultText };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { existsSync, mkdirSync } from "node:fs";
|
|
3
4
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
@@ -39,7 +40,7 @@ function providerFromModelPattern(model: string | undefined): string | undefined
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
function resolveCodexFastModeExtension(ctx: ExtensionContext, model: string | undefined): string | undefined {
|
|
42
|
-
const provider = ctx.model?.provider
|
|
43
|
+
const provider = providerFromModelPattern(model) ?? ctx.model?.provider;
|
|
43
44
|
const usesCodexProvider = provider === "openai-codex" || provider === "codex-auto" || provider?.startsWith("codex-") === true;
|
|
44
45
|
if (!usesCodexProvider) return undefined;
|
|
45
46
|
const extensionPath = join(getAgentDir(), "extensions", "codex-fast-mode.ts");
|
|
@@ -48,6 +49,17 @@ function resolveCodexFastModeExtension(ctx: ExtensionContext, model: string | un
|
|
|
48
49
|
|
|
49
50
|
const CHILD_THINKING_LEVELS = new Set<string>(["low", "medium", "high", "xhigh"]);
|
|
50
51
|
|
|
52
|
+
function createChildSessionPath(
|
|
53
|
+
agentSessionDir: string,
|
|
54
|
+
agentName: string,
|
|
55
|
+
options: { now?: number; pid?: number; uniqueSuffix?: string } = {},
|
|
56
|
+
): string {
|
|
57
|
+
const now = options.now ?? Date.now();
|
|
58
|
+
const pid = options.pid ?? process.pid;
|
|
59
|
+
const uniqueSuffix = options.uniqueSuffix ?? randomUUID();
|
|
60
|
+
return join(agentSessionDir, `${now}-${pid}-${safeFileStem(agentName)}-${safeFileStem(uniqueSuffix)}.jsonl`);
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
function validateChildThinkingOverride(thinking: string | undefined, fieldName = "thinking"): string[] {
|
|
52
64
|
if (thinking === undefined) return [];
|
|
53
65
|
return CHILD_THINKING_LEVELS.has(thinking) ? [] : [`${fieldName} must be one of low, medium, high, xhigh`];
|
|
@@ -93,7 +105,7 @@ function createSupervisedReadonlyDispatcher(ctx: ExtensionContext, signal: Abort
|
|
|
93
105
|
if (isFailed(childResult)) {
|
|
94
106
|
const gateErrorHash = childResult.gateErrors && childResult.gateErrors.length > 0 ? sha256(childResult.gateErrors.join("\n")) : undefined;
|
|
95
107
|
const runtimeErrorHash = childResult.errorMessage ? sha256(childResult.errorMessage) : undefined;
|
|
96
|
-
return { status: "failed", outputHash, output: childResult.output, error:
|
|
108
|
+
return { status: "failed", outputHash, output: childResult.output, error: runtimeErrorHash ?? gateErrorHash ?? `child_failed:${childResult.exitCode}`, dispatcher: "live_child_pi", mocked: false, sessionPath: childResult.sessionPath, outputContractValidated: childResult.gatePassed !== undefined, gatePassed: childResult.gatePassed };
|
|
97
109
|
}
|
|
98
110
|
|
|
99
111
|
return { status: "completed", outputHash, output: childResult.output, dispatcher: "live_child_pi", mocked: false, sessionPath: childResult.sessionPath, outputContractValidated: childResult.gatePassed !== undefined, gatePassed: childResult.gatePassed };
|
|
@@ -140,7 +152,7 @@ async function runChildAgent(
|
|
|
140
152
|
const tmp = await mkdtemp(join(tmpdir(), "zob-agent-"));
|
|
141
153
|
const agentSessionDir = join(ctx.cwd, ".pi", "agent-sessions");
|
|
142
154
|
mkdirSync(agentSessionDir, { recursive: true });
|
|
143
|
-
const sessionPath =
|
|
155
|
+
const sessionPath = createChildSessionPath(agentSessionDir, agent.name);
|
|
144
156
|
result.sessionPath = sessionPath;
|
|
145
157
|
emitUpdate?.(result);
|
|
146
158
|
|
|
@@ -271,4 +283,4 @@ async function mapWithConcurrency<T, R>(items: T[], limit: number, fn: (item: T,
|
|
|
271
283
|
return results;
|
|
272
284
|
}
|
|
273
285
|
|
|
274
|
-
export { createSupervisedReadonlyDispatcher, isFailed, mapWithConcurrency, runChildAgent, validateChildThinkingOverride };
|
|
286
|
+
export { createChildSessionPath, createSupervisedReadonlyDispatcher, isFailed, mapWithConcurrency, runChildAgent, validateChildThinkingOverride };
|