@zenalexa/unicli 0.222.0 → 0.222.2
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/AGENTS.md +1 -1
- package/README.md +114 -16
- package/README.zh-CN.md +97 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/delivery.d.ts +17 -0
- package/dist/commands/delivery.d.ts.map +1 -0
- package/dist/commands/delivery.js +577 -0
- package/dist/commands/delivery.js.map +1 -0
- package/dist/commands/do.d.ts.map +1 -1
- package/dist/commands/do.js +3 -4
- package/dist/commands/do.js.map +1 -1
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +6 -2
- package/dist/commands/extract.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +9 -5
- package/dist/commands/runs.js.map +1 -1
- package/dist/discovery/aliases.d.ts.map +1 -1
- package/dist/discovery/aliases.js +1 -0
- package/dist/discovery/aliases.js.map +1 -1
- package/dist/discovery/search.d.ts.map +1 -1
- package/dist/discovery/search.js +20 -0
- package/dist/discovery/search.js.map +1 -1
- package/dist/engine/delivery/index.d.ts +20 -0
- package/dist/engine/delivery/index.d.ts.map +1 -0
- package/dist/engine/delivery/index.js +20 -0
- package/dist/engine/delivery/index.js.map +1 -0
- package/dist/engine/delivery/planner.d.ts +19 -0
- package/dist/engine/delivery/planner.d.ts.map +1 -0
- package/dist/engine/delivery/planner.js +322 -0
- package/dist/engine/delivery/planner.js.map +1 -0
- package/dist/engine/delivery/repair.d.ts +17 -0
- package/dist/engine/delivery/repair.d.ts.map +1 -0
- package/dist/engine/delivery/repair.js +86 -0
- package/dist/engine/delivery/repair.js.map +1 -0
- package/dist/engine/delivery/session.d.ts +17 -0
- package/dist/engine/delivery/session.d.ts.map +1 -0
- package/dist/engine/delivery/session.js +78 -0
- package/dist/engine/delivery/session.js.map +1 -0
- package/dist/engine/delivery/trajectory.d.ts +17 -0
- package/dist/engine/delivery/trajectory.d.ts.map +1 -0
- package/dist/engine/delivery/trajectory.js +166 -0
- package/dist/engine/delivery/trajectory.js.map +1 -0
- package/dist/engine/delivery/types.d.ts +157 -0
- package/dist/engine/delivery/types.d.ts.map +1 -0
- package/dist/engine/delivery/types.js +16 -0
- package/dist/engine/delivery/types.js.map +1 -0
- package/dist/manifest.json +2 -2
- package/dist/output/error-writer.d.ts +23 -0
- package/dist/output/error-writer.d.ts.map +1 -0
- package/dist/output/error-writer.js +20 -0
- package/dist/output/error-writer.js.map +1 -0
- package/package.json +2 -2
- package/server.json +2 -2
- package/skills/unicli/SKILL.md +1 -1
- package/skills/unicli-claude-code/SKILL.md +1 -1
- package/skills/unicli-hermes/SKILL.md +1 -1
- package/src/adapters/instagram/reels.yaml +5 -7
- package/src/adapters/weread/shelf.yaml +1 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owner src/engine/delivery/planner.ts
|
|
3
|
+
* @does Evaluates objective attempts against evidence gates and selects the next delivery action.
|
|
4
|
+
* @needs src/engine/delivery/types.ts
|
|
5
|
+
* @feeds future objective-level delivery command, repair bridge, and run/session adapters.
|
|
6
|
+
* @breaks Throws no errors; malformed or exhausted state is surfaced as blocked, exhausted, or inconclusive assessment.
|
|
7
|
+
* @invariants permission/auth blocks never become repair actions; strategy switching skips exhausted strategies.
|
|
8
|
+
* @side-effects none
|
|
9
|
+
* @perf O(strategies + attempts + gates) per assessment.
|
|
10
|
+
* @concurrency pure and reentrant.
|
|
11
|
+
* @test tests/unit/engine-delivery.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_EVIDENCE_GATES = [
|
|
16
|
+
{ kind: "run_completed" },
|
|
17
|
+
];
|
|
18
|
+
const ADAPTER_DRIFT_CODES = new Set([
|
|
19
|
+
"selector_miss",
|
|
20
|
+
"stale_ref",
|
|
21
|
+
"ref_not_found",
|
|
22
|
+
"ambiguous",
|
|
23
|
+
]);
|
|
24
|
+
const AUTH_CODES = new Set(["auth_required", "not_authenticated"]);
|
|
25
|
+
const OUTPUT_CONTRACT_CODES = new Set([
|
|
26
|
+
"invalid_input",
|
|
27
|
+
"schema_mismatch",
|
|
28
|
+
"shape_mismatch",
|
|
29
|
+
]);
|
|
30
|
+
const TRANSIENT_CODES = new Set([
|
|
31
|
+
"network_error",
|
|
32
|
+
"rate_limited",
|
|
33
|
+
"upstream_error",
|
|
34
|
+
"api_error",
|
|
35
|
+
]);
|
|
36
|
+
export function assessDeliveryState(input) {
|
|
37
|
+
const strategies = enabledStrategies(input.strategies);
|
|
38
|
+
const currentAttempt = latestAttempt(input.attempts);
|
|
39
|
+
if (!currentAttempt) {
|
|
40
|
+
const firstStrategy = strategies[0];
|
|
41
|
+
return {
|
|
42
|
+
objective_id: input.objective.id,
|
|
43
|
+
status: firstStrategy ? "ready" : "blocked",
|
|
44
|
+
next_action: firstStrategy ? "run_strategy" : "inspect_failure",
|
|
45
|
+
gates: [],
|
|
46
|
+
...(firstStrategy ? { next_strategy_id: firstStrategy.id } : {}),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const gates = evaluateDeliveryGates(input.objective, currentAttempt);
|
|
50
|
+
if (gates.length > 0 && gates.every((gate) => gate.passed)) {
|
|
51
|
+
return {
|
|
52
|
+
objective_id: input.objective.id,
|
|
53
|
+
status: "delivered",
|
|
54
|
+
next_action: "stop",
|
|
55
|
+
gates,
|
|
56
|
+
current_attempt_id: currentAttempt.id,
|
|
57
|
+
current_strategy_id: currentAttempt.strategy_id,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const currentStrategy = strategies.find((strategy) => strategy.id === currentAttempt.strategy_id);
|
|
61
|
+
const diagnosis = diagnoseDeliveryAttempt(currentAttempt, gates);
|
|
62
|
+
return planRecovery({
|
|
63
|
+
objective: input.objective,
|
|
64
|
+
attempts: input.attempts,
|
|
65
|
+
strategies,
|
|
66
|
+
currentAttempt,
|
|
67
|
+
currentStrategy,
|
|
68
|
+
gates,
|
|
69
|
+
diagnosis,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export function evaluateDeliveryGates(objective, attempt) {
|
|
73
|
+
return evidenceGates(objective).map((gate) => evaluateDeliveryGate(gate, attempt));
|
|
74
|
+
}
|
|
75
|
+
function planRecovery(input) {
|
|
76
|
+
const nextStrategy = nextAvailableStrategy(input.objective, input.attempts, input.strategies, input.currentAttempt.strategy_id);
|
|
77
|
+
const isGlobalExhausted = hasGlobalAttemptBudgetExhausted(input.objective, input.attempts);
|
|
78
|
+
const isCurrentStrategyExhausted = hasStrategyAttemptBudgetExhausted(input.objective, input.attempts, input.currentAttempt.strategy_id);
|
|
79
|
+
const base = {
|
|
80
|
+
objective_id: input.objective.id,
|
|
81
|
+
gates: input.gates,
|
|
82
|
+
current_attempt_id: input.currentAttempt.id,
|
|
83
|
+
current_strategy_id: input.currentAttempt.strategy_id,
|
|
84
|
+
diagnosis: input.diagnosis,
|
|
85
|
+
};
|
|
86
|
+
if (input.diagnosis.code === "permission_denied") {
|
|
87
|
+
return { ...base, status: "blocked", next_action: "request_permission" };
|
|
88
|
+
}
|
|
89
|
+
if (input.diagnosis.code === "auth_required") {
|
|
90
|
+
return { ...base, status: "blocked", next_action: "request_auth" };
|
|
91
|
+
}
|
|
92
|
+
if (isGlobalExhausted) {
|
|
93
|
+
return exhaustedAssessment(base, input.currentAttempt, input.currentStrategy);
|
|
94
|
+
}
|
|
95
|
+
if (isCurrentStrategyExhausted && nextStrategy) {
|
|
96
|
+
return {
|
|
97
|
+
...base,
|
|
98
|
+
status: "needs_retry",
|
|
99
|
+
next_action: "switch_strategy",
|
|
100
|
+
next_strategy_id: nextStrategy.id,
|
|
101
|
+
hypothesis: createHypothesis({
|
|
102
|
+
action: "switch_strategy",
|
|
103
|
+
diagnosis: input.diagnosis,
|
|
104
|
+
attempt: input.currentAttempt,
|
|
105
|
+
strategy: nextStrategy,
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (input.diagnosis.repairable) {
|
|
110
|
+
return {
|
|
111
|
+
...base,
|
|
112
|
+
status: "needs_repair",
|
|
113
|
+
next_action: "repair_adapter",
|
|
114
|
+
hypothesis: createHypothesis({
|
|
115
|
+
action: "repair_adapter",
|
|
116
|
+
diagnosis: input.diagnosis,
|
|
117
|
+
attempt: input.currentAttempt,
|
|
118
|
+
strategy: input.currentStrategy,
|
|
119
|
+
}),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (input.diagnosis.retryable && !isCurrentStrategyExhausted) {
|
|
123
|
+
return {
|
|
124
|
+
...base,
|
|
125
|
+
status: "needs_retry",
|
|
126
|
+
next_action: "retry_strategy",
|
|
127
|
+
next_strategy_id: input.currentAttempt.strategy_id,
|
|
128
|
+
hypothesis: createHypothesis({
|
|
129
|
+
action: "retry_strategy",
|
|
130
|
+
diagnosis: input.diagnosis,
|
|
131
|
+
attempt: input.currentAttempt,
|
|
132
|
+
strategy: input.currentStrategy,
|
|
133
|
+
}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (nextStrategy) {
|
|
137
|
+
return {
|
|
138
|
+
...base,
|
|
139
|
+
status: "needs_retry",
|
|
140
|
+
next_action: "switch_strategy",
|
|
141
|
+
next_strategy_id: nextStrategy.id,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return exhaustedAssessment(base, input.currentAttempt, input.currentStrategy);
|
|
145
|
+
}
|
|
146
|
+
function exhaustedAssessment(base, attempt, strategy) {
|
|
147
|
+
const diagnosis = base.diagnosis?.code === "strategy_exhausted"
|
|
148
|
+
? base.diagnosis
|
|
149
|
+
: {
|
|
150
|
+
code: "strategy_exhausted",
|
|
151
|
+
reason: "No remaining enabled strategy can satisfy the objective.",
|
|
152
|
+
repairable: false,
|
|
153
|
+
retryable: false,
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
...base,
|
|
157
|
+
status: "exhausted",
|
|
158
|
+
next_action: "inspect_failure",
|
|
159
|
+
diagnosis,
|
|
160
|
+
hypothesis: createHypothesis({
|
|
161
|
+
action: "inspect_failure",
|
|
162
|
+
diagnosis,
|
|
163
|
+
attempt,
|
|
164
|
+
strategy,
|
|
165
|
+
}),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export function diagnoseDeliveryAttempt(attempt, gates) {
|
|
169
|
+
const error = attempt.error;
|
|
170
|
+
const errorCode = error?.code;
|
|
171
|
+
const permissionDenied = attempt.summary.runtime_permission_denied;
|
|
172
|
+
if (permissionDenied || errorCode === "permission_denied") {
|
|
173
|
+
return {
|
|
174
|
+
code: "permission_denied",
|
|
175
|
+
reason: "Runtime policy denied access to a required resource.",
|
|
176
|
+
repairable: false,
|
|
177
|
+
retryable: false,
|
|
178
|
+
...(error?.adapter_path ? { adapter_path: error.adapter_path } : {}),
|
|
179
|
+
...(typeof error?.step === "number" ? { step: error.step } : {}),
|
|
180
|
+
...(error?.suggestion ? { suggestion: error.suggestion } : {}),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (errorCode && AUTH_CODES.has(errorCode)) {
|
|
184
|
+
return {
|
|
185
|
+
code: "auth_required",
|
|
186
|
+
reason: "The operation needs authenticated state before it can proceed.",
|
|
187
|
+
repairable: false,
|
|
188
|
+
retryable: false,
|
|
189
|
+
...(error?.adapter_path ? { adapter_path: error.adapter_path } : {}),
|
|
190
|
+
...(typeof error?.step === "number" ? { step: error.step } : {}),
|
|
191
|
+
...(error?.suggestion ? { suggestion: error.suggestion } : {}),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (errorCode && ADAPTER_DRIFT_CODES.has(errorCode)) {
|
|
195
|
+
return {
|
|
196
|
+
code: "adapter_drift",
|
|
197
|
+
reason: "The adapter path no longer matches the live software surface.",
|
|
198
|
+
repairable: Boolean(error.adapter_path),
|
|
199
|
+
retryable: error.retryable !== false,
|
|
200
|
+
...(error.adapter_path ? { adapter_path: error.adapter_path } : {}),
|
|
201
|
+
...(typeof error.step === "number" ? { step: error.step } : {}),
|
|
202
|
+
...(error.suggestion ? { suggestion: error.suggestion } : {}),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (errorCode && OUTPUT_CONTRACT_CODES.has(errorCode)) {
|
|
206
|
+
return {
|
|
207
|
+
code: "output_contract_mismatch",
|
|
208
|
+
reason: "The latest result did not match the expected output contract.",
|
|
209
|
+
repairable: Boolean(error.adapter_path),
|
|
210
|
+
retryable: error.retryable !== false,
|
|
211
|
+
...(error.adapter_path ? { adapter_path: error.adapter_path } : {}),
|
|
212
|
+
...(typeof error.step === "number" ? { step: error.step } : {}),
|
|
213
|
+
...(error.suggestion ? { suggestion: error.suggestion } : {}),
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (errorCode && TRANSIENT_CODES.has(errorCode)) {
|
|
217
|
+
return {
|
|
218
|
+
code: "transient_upstream",
|
|
219
|
+
reason: "The run failed on a transient upstream or transport condition.",
|
|
220
|
+
repairable: false,
|
|
221
|
+
retryable: error.retryable !== false,
|
|
222
|
+
...(error.adapter_path ? { adapter_path: error.adapter_path } : {}),
|
|
223
|
+
...(typeof error.step === "number" ? { step: error.step } : {}),
|
|
224
|
+
...(error.suggestion ? { suggestion: error.suggestion } : {}),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (gates.some((gate) => !gate.passed)) {
|
|
228
|
+
return {
|
|
229
|
+
code: "evidence_gate_failed",
|
|
230
|
+
reason: "The run completed without enough evidence to prove delivery.",
|
|
231
|
+
repairable: false,
|
|
232
|
+
retryable: true,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
code: "unknown_failure",
|
|
237
|
+
reason: "The attempt did not satisfy the objective and has no known diagnosis.",
|
|
238
|
+
repairable: false,
|
|
239
|
+
retryable: error?.retryable === true,
|
|
240
|
+
...(error?.adapter_path ? { adapter_path: error.adapter_path } : {}),
|
|
241
|
+
...(typeof error?.step === "number" ? { step: error.step } : {}),
|
|
242
|
+
...(error?.suggestion ? { suggestion: error.suggestion } : {}),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function evaluateDeliveryGate(gate, attempt) {
|
|
246
|
+
switch (gate.kind) {
|
|
247
|
+
case "run_completed":
|
|
248
|
+
return {
|
|
249
|
+
name: "run_completed",
|
|
250
|
+
kind: gate.kind,
|
|
251
|
+
passed: attempt.summary.status === "completed",
|
|
252
|
+
expected: "completed",
|
|
253
|
+
actual: attempt.summary.status,
|
|
254
|
+
};
|
|
255
|
+
case "min_evidence_count":
|
|
256
|
+
return {
|
|
257
|
+
name: "min_evidence_count",
|
|
258
|
+
kind: gate.kind,
|
|
259
|
+
passed: attempt.summary.evidence_count >= gate.min,
|
|
260
|
+
expected: gate.min,
|
|
261
|
+
actual: attempt.summary.evidence_count,
|
|
262
|
+
};
|
|
263
|
+
case "required_evidence_type": {
|
|
264
|
+
const actual = attempt.summary.evidence_by_type[gate.evidence_type] ?? 0;
|
|
265
|
+
const expected = gate.min ?? 1;
|
|
266
|
+
return {
|
|
267
|
+
name: `evidence_type:${gate.evidence_type}`,
|
|
268
|
+
kind: gate.kind,
|
|
269
|
+
passed: actual >= expected,
|
|
270
|
+
expected,
|
|
271
|
+
actual,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function createHypothesis(input) {
|
|
277
|
+
const target = input.diagnosis.adapter_path ?? input.strategy?.adapter_path;
|
|
278
|
+
return {
|
|
279
|
+
id: `${input.attempt.id}:${input.diagnosis.code}:${input.action}`,
|
|
280
|
+
diagnosis_code: input.diagnosis.code,
|
|
281
|
+
action: input.action,
|
|
282
|
+
reason: input.diagnosis.suggestion ?? input.diagnosis.reason,
|
|
283
|
+
...(input.strategy ? { strategy_id: input.strategy.id } : {}),
|
|
284
|
+
...(target ? { target } : {}),
|
|
285
|
+
...(input.strategy?.verify_command
|
|
286
|
+
? { verify_command: input.strategy.verify_command }
|
|
287
|
+
: {}),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function evidenceGates(objective) {
|
|
291
|
+
return objective.evidence_gates && objective.evidence_gates.length > 0
|
|
292
|
+
? objective.evidence_gates
|
|
293
|
+
: DEFAULT_EVIDENCE_GATES;
|
|
294
|
+
}
|
|
295
|
+
function latestAttempt(attempts) {
|
|
296
|
+
const sorted = [...attempts].sort((left, right) => left.ordinal - right.ordinal);
|
|
297
|
+
return sorted[sorted.length - 1];
|
|
298
|
+
}
|
|
299
|
+
function enabledStrategies(strategies) {
|
|
300
|
+
return [...strategies]
|
|
301
|
+
.filter((strategy) => strategy.enabled !== false)
|
|
302
|
+
.sort((left, right) => {
|
|
303
|
+
const priority = left.priority - right.priority;
|
|
304
|
+
return priority === 0 ? left.id.localeCompare(right.id) : priority;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function nextAvailableStrategy(objective, attempts, strategies, currentStrategyId) {
|
|
308
|
+
return strategies.find((strategy) => strategy.id !== currentStrategyId &&
|
|
309
|
+
!hasStrategyAttemptBudgetExhausted(objective, attempts, strategy.id));
|
|
310
|
+
}
|
|
311
|
+
function hasGlobalAttemptBudgetExhausted(objective, attempts) {
|
|
312
|
+
const maxAttempts = objective.attempt_budget?.max_attempts;
|
|
313
|
+
return typeof maxAttempts === "number" && attempts.length >= maxAttempts;
|
|
314
|
+
}
|
|
315
|
+
function hasStrategyAttemptBudgetExhausted(objective, attempts, strategyId) {
|
|
316
|
+
const maxAttempts = objective.attempt_budget?.max_attempts_per_strategy;
|
|
317
|
+
if (typeof maxAttempts !== "number")
|
|
318
|
+
return false;
|
|
319
|
+
return (attempts.filter((attempt) => attempt.strategy_id === strategyId).length >=
|
|
320
|
+
maxAttempts);
|
|
321
|
+
}
|
|
322
|
+
//# sourceMappingURL=planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AAyB;IAEzB,OAAO,UAAU,CAAC,IAAI,CACpB,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,EAAE,KAAK,iBAAiB;QACjC,CAAC,iCAAiC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CACvE,CAAC;AACJ,CAAC;AAED,SAAS,+BAA+B,CACtC,SAA4B,EAC5B,QAA2B;IAE3B,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC;IAC3D,OAAO,OAAO,WAAW,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,IAAI,WAAW,CAAC;AAC3E,CAAC;AAED,SAAS,iCAAiC,CACxC,SAA4B,EAC5B,QAA2B,EAC3B,UAAkB;IAElB,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,EAAE,yBAAyB,CAAC;IACxE,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClD,OAAO,CACL,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,MAAM;QACvE,WAAW,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owner src/engine/delivery/repair.ts
|
|
3
|
+
* @does Compiles delivery repair assessments into bounded adapter repair candidates.
|
|
4
|
+
* @needs src/engine/delivery/types.ts, src/engine/user-home.ts, node:path, node:url
|
|
5
|
+
* @feeds future repair command bridge and delivery operator surfaces.
|
|
6
|
+
* @breaks Over-broad candidate creation can turn auth, policy, or transient failures into unsafe code edits.
|
|
7
|
+
* @invariants candidates require repair_adapter action, repairable diagnosis, owned adapter path, attempt id, strategy id, and verify command.
|
|
8
|
+
* @side-effects none
|
|
9
|
+
* @perf O(1) over a completed delivery trajectory.
|
|
10
|
+
* @concurrency pure and reentrant.
|
|
11
|
+
* @test tests/unit/engine-delivery-repair.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
import type { DeliveryRepairCandidate, DeliveryTrajectory } from "./types.js";
|
|
16
|
+
export declare function deliveryRepairCandidateFromTrajectory(trajectory: DeliveryTrajectory): DeliveryRepairCandidate | undefined;
|
|
17
|
+
//# sourceMappingURL=repair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair.d.ts","sourceRoot":"","sources":["../../../src/engine/delivery/repair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgB9E,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,kBAAkB,GAC7B,uBAAuB,GAAG,SAAS,CA2CrC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owner src/engine/delivery/repair.ts
|
|
3
|
+
* @does Compiles delivery repair assessments into bounded adapter repair candidates.
|
|
4
|
+
* @needs src/engine/delivery/types.ts, src/engine/user-home.ts, node:path, node:url
|
|
5
|
+
* @feeds future repair command bridge and delivery operator surfaces.
|
|
6
|
+
* @breaks Over-broad candidate creation can turn auth, policy, or transient failures into unsafe code edits.
|
|
7
|
+
* @invariants candidates require repair_adapter action, repairable diagnosis, owned adapter path, attempt id, strategy id, and verify command.
|
|
8
|
+
* @side-effects none
|
|
9
|
+
* @perf O(1) over a completed delivery trajectory.
|
|
10
|
+
* @concurrency pure and reentrant.
|
|
11
|
+
* @test tests/unit/engine-delivery-repair.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { userHome } from "../user-home.js";
|
|
18
|
+
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const PACKAGE_ADAPTERS_ROOT = resolve(MODULE_DIR, "..", "..", "..", "src", "adapters");
|
|
20
|
+
export function deliveryRepairCandidateFromTrajectory(trajectory) {
|
|
21
|
+
const assessment = trajectory.assessment;
|
|
22
|
+
const diagnosis = assessment.diagnosis;
|
|
23
|
+
const nextExperiment = trajectory.next_experiment;
|
|
24
|
+
if (assessment.status !== "needs_repair" ||
|
|
25
|
+
assessment.next_action !== "repair_adapter" ||
|
|
26
|
+
nextExperiment?.action !== "repair_adapter" ||
|
|
27
|
+
diagnosis?.repairable !== true) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const adapterPath = diagnosis.adapter_path ?? nextExperiment.target;
|
|
31
|
+
const verifyCommand = nextExperiment.verify_command ?? assessment.hypothesis?.verify_command;
|
|
32
|
+
const attemptId = assessment.current_attempt_id;
|
|
33
|
+
const strategyId = assessment.current_strategy_id;
|
|
34
|
+
if (!attemptId ||
|
|
35
|
+
!strategyId ||
|
|
36
|
+
!verifyCommand ||
|
|
37
|
+
!adapterPath ||
|
|
38
|
+
!isAdapterFilePath(adapterPath)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const reason = assessment.hypothesis?.reason ?? diagnosis.suggestion ?? diagnosis.reason;
|
|
42
|
+
return {
|
|
43
|
+
schema_version: "1",
|
|
44
|
+
objective_id: trajectory.objective_id,
|
|
45
|
+
attempt_id: attemptId,
|
|
46
|
+
strategy_id: strategyId,
|
|
47
|
+
adapter_path: adapterPath,
|
|
48
|
+
verify_command: verifyCommand,
|
|
49
|
+
diagnosis_code: diagnosis.code,
|
|
50
|
+
reason,
|
|
51
|
+
...(nextExperiment.command ? { command: nextExperiment.command } : {}),
|
|
52
|
+
...(typeof diagnosis.step === "number" ? { step: diagnosis.step } : {}),
|
|
53
|
+
...(diagnosis.suggestion ? { suggestion: diagnosis.suggestion } : {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function isAdapterFilePath(path) {
|
|
57
|
+
const expandedPath = expandHome(path.trim());
|
|
58
|
+
const normalizedPath = expandedPath.replaceAll("\\", "/");
|
|
59
|
+
const hasAdapterExtension = normalizedPath.endsWith(".yaml") || normalizedPath.endsWith(".ts");
|
|
60
|
+
if (!hasAdapterExtension ||
|
|
61
|
+
normalizedPath.endsWith(".test.ts") ||
|
|
62
|
+
hasParentSegment(normalizedPath)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (isRelativePackageAdapterPath(normalizedPath))
|
|
66
|
+
return true;
|
|
67
|
+
const absolutePath = resolve(expandedPath);
|
|
68
|
+
const userAdaptersRoot = resolve(userHome(), ".unicli", "adapters");
|
|
69
|
+
return (isPathInsideRoot(absolutePath, PACKAGE_ADAPTERS_ROOT) ||
|
|
70
|
+
isPathInsideRoot(absolutePath, userAdaptersRoot));
|
|
71
|
+
}
|
|
72
|
+
function expandHome(path) {
|
|
73
|
+
return path.startsWith("~/") ? resolve(userHome(), path.slice(2)) : path;
|
|
74
|
+
}
|
|
75
|
+
function hasParentSegment(path) {
|
|
76
|
+
return path.split("/").includes("..");
|
|
77
|
+
}
|
|
78
|
+
function isRelativePackageAdapterPath(path) {
|
|
79
|
+
const relativePath = path.startsWith("./") ? path.slice(2) : path;
|
|
80
|
+
return !isAbsolute(relativePath) && relativePath.startsWith("src/adapters/");
|
|
81
|
+
}
|
|
82
|
+
function isPathInsideRoot(path, root) {
|
|
83
|
+
const relation = relative(root, path);
|
|
84
|
+
return (relation.length > 0 && !relation.startsWith("..") && !isAbsolute(relation));
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=repair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair.js","sourceRoot":"","sources":["../../../src/engine/delivery/repair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,W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/engine/session/types.ts, src/engine/delivery/types.ts
|
|
5
|
+
* @feeds src/engine/delivery/trajectory.ts and future run-record driven delivery commands.
|
|
6
|
+
* @breaks Missing structured error extraction hides repairable adapter failures from the delivery trajectory.
|
|
7
|
+
* @invariants latest structured AgentError wins; malformed error payloads are ignored, not fabricated.
|
|
8
|
+
* @side-effects none
|
|
9
|
+
* @perf O(events) scan; allocates one summary and optional error object.
|
|
10
|
+
* @concurrency pure and reentrant.
|
|
11
|
+
* @test tests/unit/engine-delivery-session.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
import type { DeliveryAttempt, DeliveryAttemptFromRunEventsInput } from "./types.js";
|
|
16
|
+
export declare function deliveryAttemptFromRunEvents(input: DeliveryAttemptFromRunEventsInput): DeliveryAttempt;
|
|
17
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/engine/delivery/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAEpB,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GACvC,eAAe,CAgBjB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owner src/engine/delivery/session.ts
|
|
3
|
+
* @does Adapts recorded session run events into delivery attempts.
|
|
4
|
+
* @needs src/engine/session/query.ts, src/engine/session/types.ts, src/engine/delivery/types.ts
|
|
5
|
+
* @feeds src/engine/delivery/trajectory.ts and future run-record driven delivery commands.
|
|
6
|
+
* @breaks Missing structured error extraction hides repairable adapter failures from the delivery trajectory.
|
|
7
|
+
* @invariants latest structured AgentError wins; malformed error payloads are ignored, not fabricated.
|
|
8
|
+
* @side-effects none
|
|
9
|
+
* @perf O(events) scan; allocates one summary and optional error object.
|
|
10
|
+
* @concurrency pure and reentrant.
|
|
11
|
+
* @test tests/unit/engine-delivery-session.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
import { summarizeRunEvents } from "../session/query.js";
|
|
16
|
+
export function deliveryAttemptFromRunEvents(input) {
|
|
17
|
+
const runId = input.run_id ??
|
|
18
|
+
input.events[0]?.metadata.run_id ??
|
|
19
|
+
input.events[0]?.run_id ??
|
|
20
|
+
input.id;
|
|
21
|
+
const summary = summarizeRunEvents(input.events, { runId });
|
|
22
|
+
const error = extractLatestAgentError(input.events);
|
|
23
|
+
return {
|
|
24
|
+
id: input.id,
|
|
25
|
+
ordinal: input.ordinal,
|
|
26
|
+
strategy_id: input.strategy_id,
|
|
27
|
+
run_id: summary.run_id,
|
|
28
|
+
summary,
|
|
29
|
+
...(error ? { error } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function extractLatestAgentError(events) {
|
|
33
|
+
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
34
|
+
const event = events[index];
|
|
35
|
+
const error = agentErrorFromValue(event.data?.error) ??
|
|
36
|
+
agentErrorFromValue(agentEnvelopeError(event.data?.envelope));
|
|
37
|
+
if (error)
|
|
38
|
+
return error;
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
function agentEnvelopeError(envelope) {
|
|
43
|
+
if (!isRecord(envelope))
|
|
44
|
+
return undefined;
|
|
45
|
+
return envelope.error;
|
|
46
|
+
}
|
|
47
|
+
function agentErrorFromValue(value) {
|
|
48
|
+
if (!isRecord(value))
|
|
49
|
+
return undefined;
|
|
50
|
+
if (typeof value.code !== "string" || typeof value.message !== "string") {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
code: value.code,
|
|
55
|
+
message: value.message,
|
|
56
|
+
...(typeof value.adapter_path === "string"
|
|
57
|
+
? { adapter_path: value.adapter_path }
|
|
58
|
+
: {}),
|
|
59
|
+
...(typeof value.step === "number" && Number.isFinite(value.step)
|
|
60
|
+
? { step: value.step }
|
|
61
|
+
: {}),
|
|
62
|
+
...(typeof value.suggestion === "string"
|
|
63
|
+
? { suggestion: value.suggestion }
|
|
64
|
+
: {}),
|
|
65
|
+
...(typeof value.retryable === "boolean"
|
|
66
|
+
? { retryable: value.retryable }
|
|
67
|
+
: {}),
|
|
68
|
+
...(Array.isArray(value.alternatives)
|
|
69
|
+
? {
|
|
70
|
+
alternatives: value.alternatives.filter((entry) => typeof entry === "string"),
|
|
71
|
+
}
|
|
72
|
+
: {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function isRecord(value) {
|
|
76
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/engine/delivery/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,MAAM,UAAU,4BAA4B,CAC1C,KAAwC;IAExC,MAAM,KAAK,GACT,KAAK,CAAC,MAAM;QACZ,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM;QACvB,KAAK,CAAC,EAAE,CAAC;IACX,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpD,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,WAAW,EAAE,KAAK,CAAC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AC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;YAC/D,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;YACtB,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;YACtC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE;YAClC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS;YACtC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE;YAChC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;YACnC,CAAC,CAAC;gBACE,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CACrC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CACtD;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owner src/engine/delivery/trajectory.ts
|
|
3
|
+
* @does Converts delivery state into a reviewable experiment trajectory with observations, hypotheses, and the next executable experiment.
|
|
4
|
+
* @needs src/engine/delivery/planner.ts, src/engine/delivery/types.ts
|
|
5
|
+
* @feeds future delivery ledgers, repair bridge, and operator CLI summaries.
|
|
6
|
+
* @breaks Trajectory output becomes misleading if assessment statuses stop mapping to verification and failure classifications.
|
|
7
|
+
* @invariants non-active assessments never produce next executable experiments.
|
|
8
|
+
* @side-effects none
|
|
9
|
+
* @perf O(attempts log attempts + strategies + gates) per trajectory.
|
|
10
|
+
* @concurrency pure and reentrant.
|
|
11
|
+
* @test tests/unit/engine-delivery-trajectory.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
import type { DeliveryTrajectory, DeliveryTrajectoryInput } from "./types.js";
|
|
16
|
+
export declare function buildDeliveryTrajectory(input: DeliveryTrajectoryInput): DeliveryTrajectory;
|
|
17
|
+
//# sourceMappingURL=trajectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trajectory.d.ts","sourceRoot":"","sources":["../../../src/engine/delivery/trajectory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAOV,kBAAkB,EAClB,uBAAuB,EAGxB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,uBAAuB,GAC7B,kBAAkB,CAgCpB"}
|