@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,577 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owner src/commands/delivery.ts
|
|
3
|
+
* @does Exposes the objective-level delivery kernel as a conservative operator CLI.
|
|
4
|
+
* @needs commander, src/engine/delivery/*, src/engine/session/store.ts, src/output/formatter.ts
|
|
5
|
+
* @feeds src/cli.ts, tests/unit/delivery-cli.test.ts, future delivery operator workflows.
|
|
6
|
+
* @breaks Invalid spec parsing or unbounded repair candidates can mislead agents about delivery state.
|
|
7
|
+
* @invariants specs are explicit files; existing run traces remain the source of prior evidence; delivery.run records only through the run store.
|
|
8
|
+
* @side-effects reads spec files and run traces; delivery.run writes one recorded run trace; writes stdout/stderr and process.exitCode.
|
|
9
|
+
* @perf O(spec attempts + referenced run events).
|
|
10
|
+
* @concurrency no shared mutable state beyond process.exitCode on command errors.
|
|
11
|
+
* @test tests/unit/delivery-cli.test.ts
|
|
12
|
+
* @stability experimental
|
|
13
|
+
* @since 2026-05-24
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync } from "node:fs";
|
|
16
|
+
import { readFile } from "node:fs/promises";
|
|
17
|
+
import { resolveCommand } from "../registry.js";
|
|
18
|
+
import { resolveArgs } from "../engine/args.js";
|
|
19
|
+
import { buildInvocation } from "../engine/kernel/execute.js";
|
|
20
|
+
import { executeWithRunRecording } from "../engine/session/run-loop.js";
|
|
21
|
+
import { detectFormat, format } from "../output/formatter.js";
|
|
22
|
+
import { makeCtx } from "../output/envelope.js";
|
|
23
|
+
import { printErrorEnvelope } from "../output/error-writer.js";
|
|
24
|
+
import { ExitCode } from "../types.js";
|
|
25
|
+
import { assessDeliveryState, buildDeliveryTrajectory, deliveryAttemptFromRunEvents, deliveryRepairCandidateFromTrajectory, } from "../engine/delivery/index.js";
|
|
26
|
+
import { createRunStore, readRunEvents, runTracePath, RunStoreError, } from "../engine/session/store.js";
|
|
27
|
+
class DeliveryCliError extends Error {
|
|
28
|
+
code;
|
|
29
|
+
suggestion;
|
|
30
|
+
constructor(code, message, suggestion) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.code = code;
|
|
33
|
+
this.suggestion = suggestion;
|
|
34
|
+
this.name = "DeliveryCliError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function fmt(program) {
|
|
38
|
+
return detectFormat(program.opts().format);
|
|
39
|
+
}
|
|
40
|
+
export function registerDeliveryCommand(program) {
|
|
41
|
+
const delivery = program
|
|
42
|
+
.command("delivery")
|
|
43
|
+
.description("Plan objective delivery from run evidence and repair signals");
|
|
44
|
+
delivery
|
|
45
|
+
.command("run <spec>")
|
|
46
|
+
.description("Execute the next delivery experiment and record its attempt")
|
|
47
|
+
.option("--root <path>", "Override run trace root")
|
|
48
|
+
.option("--run-id <run_id>", "Override the recorded run id")
|
|
49
|
+
.option("--permission-profile <profile>", "Override next experiment permission profile")
|
|
50
|
+
.option("--yes", "Approve permission-gated next experiment execution")
|
|
51
|
+
.option("--recorded-at <iso>", "Override returned trajectory recorded_at")
|
|
52
|
+
.action(async (specPath, opts) => {
|
|
53
|
+
const startedAt = Date.now();
|
|
54
|
+
try {
|
|
55
|
+
emitDelivery(program, "delivery.run", startedAt, {
|
|
56
|
+
...(await runNextDeliveryExperimentFromSpec(specPath, opts)),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
emitDeliveryError(program, "delivery.run", startedAt, err);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
delivery
|
|
64
|
+
.command("assess <spec>")
|
|
65
|
+
.description("Assess an objective delivery spec and choose the next action")
|
|
66
|
+
.option("--root <path>", "Override run trace root for spec runs")
|
|
67
|
+
.action(async (specPath, opts) => {
|
|
68
|
+
const startedAt = Date.now();
|
|
69
|
+
try {
|
|
70
|
+
const input = await deliveryStateInputFromSpec(specPath, opts);
|
|
71
|
+
emitDelivery(program, "delivery.assess", startedAt, {
|
|
72
|
+
assessment: assessDeliveryState(input),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
emitDeliveryError(program, "delivery.assess", startedAt, err);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
delivery
|
|
80
|
+
.command("trajectory <spec>")
|
|
81
|
+
.description("Build a reviewable delivery trajectory from a spec")
|
|
82
|
+
.option("--root <path>", "Override run trace root for spec runs")
|
|
83
|
+
.option("--recorded-at <iso>", "Override trajectory recorded_at")
|
|
84
|
+
.action(async (specPath, opts) => {
|
|
85
|
+
const startedAt = Date.now();
|
|
86
|
+
try {
|
|
87
|
+
emitDelivery(program, "delivery.trajectory", startedAt, {
|
|
88
|
+
...(await deliveryTrajectoryFromSpec(specPath, opts)),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
emitDeliveryError(program, "delivery.trajectory", startedAt, err);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
delivery
|
|
96
|
+
.command("repair-candidate <spec>")
|
|
97
|
+
.description("Compile a trajectory into one bounded adapter repair candidate")
|
|
98
|
+
.option("--root <path>", "Override run trace root for spec runs")
|
|
99
|
+
.option("--recorded-at <iso>", "Override trajectory recorded_at")
|
|
100
|
+
.action(async (specPath, opts) => {
|
|
101
|
+
const startedAt = Date.now();
|
|
102
|
+
try {
|
|
103
|
+
const trajectory = await deliveryTrajectoryFromSpec(specPath, opts);
|
|
104
|
+
const candidate = deliveryRepairCandidateFromTrajectory(trajectory);
|
|
105
|
+
emitDelivery(program, "delivery.repair-candidate", startedAt, {
|
|
106
|
+
objective_id: trajectory.objective_id,
|
|
107
|
+
verification_status: trajectory.verification_status,
|
|
108
|
+
assessment_status: trajectory.assessment.status,
|
|
109
|
+
candidate: candidate ?? null,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
emitDeliveryError(program, "delivery.repair-candidate", startedAt, err);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async function runNextDeliveryExperimentFromSpec(specPath, opts) {
|
|
118
|
+
const spec = await readDeliveryOperatorSpec(specPath);
|
|
119
|
+
const attempts = await attemptsFromSpec(spec, opts.root);
|
|
120
|
+
const trajectory = buildDeliveryTrajectory({
|
|
121
|
+
objective: spec.objective,
|
|
122
|
+
strategies: spec.strategies,
|
|
123
|
+
attempts,
|
|
124
|
+
recorded_at: opts.recordedAt ?? spec.recorded_at,
|
|
125
|
+
});
|
|
126
|
+
const nextExperiment = trajectory.next_experiment;
|
|
127
|
+
if (!nextExperiment) {
|
|
128
|
+
throw new DeliveryCliError("invalid_input", `delivery trajectory is not executable: ${trajectory.verification_status}`, "inspect `delivery trajectory` and resolve blocked, verified, exhausted, or repair-only state first");
|
|
129
|
+
}
|
|
130
|
+
if (nextExperiment.action !== "run_strategy" &&
|
|
131
|
+
nextExperiment.action !== "retry_strategy" &&
|
|
132
|
+
nextExperiment.action !== "switch_strategy") {
|
|
133
|
+
throw new DeliveryCliError("invalid_input", `delivery next action is not directly executable: ${nextExperiment.action}`, "use `delivery repair-candidate` for adapter repairs or resolve auth/permission blocks first");
|
|
134
|
+
}
|
|
135
|
+
const strategy = spec.strategies.find((entry) => entry.id === nextExperiment.strategy_id);
|
|
136
|
+
if (!strategy || !strategy.command) {
|
|
137
|
+
throw new DeliveryCliError("invalid_input", `strategy has no executable command: ${nextExperiment.strategy_id}`, "add `command: site.command` to the selected strategy");
|
|
138
|
+
}
|
|
139
|
+
const parsedCommand = parseStrategyCommand(strategy.command);
|
|
140
|
+
const resolved = resolveCommand(parsedCommand.site, parsedCommand.command);
|
|
141
|
+
if (!resolved) {
|
|
142
|
+
throw new DeliveryCliError("invalid_input", `command is not registered: ${strategy.command}`, "run `unicli list` and choose a currently registered command");
|
|
143
|
+
}
|
|
144
|
+
const resolvedArgs = resolveArgs({
|
|
145
|
+
opts: strategy.args ?? {},
|
|
146
|
+
positionals: [],
|
|
147
|
+
schema: resolved.command.adapterArgs ?? [],
|
|
148
|
+
stdinIsTTY: true,
|
|
149
|
+
});
|
|
150
|
+
const invocation = buildInvocation("cli", parsedCommand.site, parsedCommand.command, resolvedArgs, {
|
|
151
|
+
permissionProfile: opts.permissionProfile,
|
|
152
|
+
approved: opts.yes === true,
|
|
153
|
+
});
|
|
154
|
+
if (!invocation) {
|
|
155
|
+
throw new DeliveryCliError("invalid_input", `command is not registered: ${strategy.command}`, "run `unicli list` and choose a currently registered command");
|
|
156
|
+
}
|
|
157
|
+
const store = createRunStore({ rootDir: opts.root });
|
|
158
|
+
const runId = opts.runId ?? `run-delivery-${invocation.trace_id}`;
|
|
159
|
+
let tracePath;
|
|
160
|
+
try {
|
|
161
|
+
tracePath = runTracePath(store, runId);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
if (err instanceof RunStoreError && err.code === "invalid_run_id") {
|
|
165
|
+
throw new DeliveryCliError("invalid_input", err.message, "use letters, numbers, dot, underscore, or dash in --run-id");
|
|
166
|
+
}
|
|
167
|
+
throw err;
|
|
168
|
+
}
|
|
169
|
+
if (existsSync(tracePath)) {
|
|
170
|
+
throw new DeliveryCliError("invalid_input", `run id already exists: ${runId}`, "omit --run-id or choose a new run id");
|
|
171
|
+
}
|
|
172
|
+
const result = await executeWithRunRecording(invocation, {
|
|
173
|
+
enabled: true,
|
|
174
|
+
store,
|
|
175
|
+
runId,
|
|
176
|
+
});
|
|
177
|
+
const runEvents = await readRunEvents(store, runId);
|
|
178
|
+
const newAttempt = deliveryAttemptFromRunEvents({
|
|
179
|
+
id: `attempt-${attempts.length + 1}`,
|
|
180
|
+
ordinal: attempts.length + 1,
|
|
181
|
+
strategy_id: strategy.id,
|
|
182
|
+
run_id: runId,
|
|
183
|
+
events: runEvents,
|
|
184
|
+
});
|
|
185
|
+
const nextTrajectory = buildDeliveryTrajectory({
|
|
186
|
+
objective: spec.objective,
|
|
187
|
+
strategies: spec.strategies,
|
|
188
|
+
attempts: [...attempts, newAttempt],
|
|
189
|
+
recorded_at: opts.recordedAt ?? spec.recorded_at,
|
|
190
|
+
});
|
|
191
|
+
if (result.exitCode !== 0)
|
|
192
|
+
process.exitCode = result.exitCode;
|
|
193
|
+
return {
|
|
194
|
+
objective_id: spec.objective.id,
|
|
195
|
+
run_id: runId,
|
|
196
|
+
strategy_id: strategy.id,
|
|
197
|
+
next_action: nextExperiment.action,
|
|
198
|
+
result: {
|
|
199
|
+
exit_code: result.exitCode,
|
|
200
|
+
duration_ms: result.durationMs,
|
|
201
|
+
result_count: result.results.length,
|
|
202
|
+
error: result.error ?? null,
|
|
203
|
+
warnings: result.warnings,
|
|
204
|
+
},
|
|
205
|
+
trajectory: nextTrajectory,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
async function deliveryTrajectoryFromSpec(specPath, opts) {
|
|
209
|
+
const spec = await readDeliveryOperatorSpec(specPath);
|
|
210
|
+
const attempts = await attemptsFromSpec(spec, opts.root);
|
|
211
|
+
const input = {
|
|
212
|
+
objective: spec.objective,
|
|
213
|
+
strategies: spec.strategies,
|
|
214
|
+
attempts,
|
|
215
|
+
recorded_at: opts.recordedAt ?? spec.recorded_at,
|
|
216
|
+
};
|
|
217
|
+
return buildDeliveryTrajectory(input);
|
|
218
|
+
}
|
|
219
|
+
async function deliveryStateInputFromSpec(specPath, opts) {
|
|
220
|
+
const spec = await readDeliveryOperatorSpec(specPath);
|
|
221
|
+
return {
|
|
222
|
+
objective: spec.objective,
|
|
223
|
+
strategies: spec.strategies,
|
|
224
|
+
attempts: await attemptsFromSpec(spec, opts.root),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
async function attemptsFromSpec(spec, root) {
|
|
228
|
+
const attempts = [...spec.attempts];
|
|
229
|
+
const baseAttemptCount = attempts.length;
|
|
230
|
+
const store = createRunStore({ rootDir: root });
|
|
231
|
+
for (const [index, runRef] of spec.runs.entries()) {
|
|
232
|
+
const events = await readRunEvents(store, runRef.run_id);
|
|
233
|
+
if (events.length === 0) {
|
|
234
|
+
throw new DeliveryCliError("invalid_input", `run trace not found or empty: ${runRef.run_id}`, "run the objective command with --record or choose an existing run id from `unicli runs list`");
|
|
235
|
+
}
|
|
236
|
+
attempts.push(deliveryAttemptFromRunEvents({
|
|
237
|
+
id: runRef.id ?? `attempt-${baseAttemptCount + index + 1}`,
|
|
238
|
+
ordinal: runRef.ordinal ?? baseAttemptCount + index + 1,
|
|
239
|
+
strategy_id: runRef.strategy_id,
|
|
240
|
+
run_id: runRef.run_id,
|
|
241
|
+
events,
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
return attempts;
|
|
245
|
+
}
|
|
246
|
+
async function readDeliveryOperatorSpec(specPath) {
|
|
247
|
+
let parsed;
|
|
248
|
+
try {
|
|
249
|
+
parsed = JSON.parse(await readFile(specPath, "utf-8"));
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
253
|
+
throw new DeliveryCliError("invalid_input", `failed to read delivery spec: ${message}`, "pass a JSON file with objective, strategies, and optional attempts or runs");
|
|
254
|
+
}
|
|
255
|
+
return parseDeliveryOperatorSpec(parsed);
|
|
256
|
+
}
|
|
257
|
+
function parseDeliveryOperatorSpec(value) {
|
|
258
|
+
const record = asRecord(value, "delivery spec");
|
|
259
|
+
const objective = parseObjective(record.objective);
|
|
260
|
+
const strategiesValue = record.strategies;
|
|
261
|
+
if (!Array.isArray(strategiesValue) || strategiesValue.length === 0) {
|
|
262
|
+
throw new DeliveryCliError("invalid_input", "delivery spec requires at least one strategy", "add `strategies: [{ id, kind, label, priority }]` to the spec");
|
|
263
|
+
}
|
|
264
|
+
const strategies = strategiesValue.map(parseStrategy);
|
|
265
|
+
const attempts = arrayOrEmpty(record.attempts, "attempts").map(parseAttempt);
|
|
266
|
+
const runs = arrayOrEmpty(record.runs, "runs").map(parseRunRef);
|
|
267
|
+
validateStrategyReferences(strategies, attempts, runs);
|
|
268
|
+
return {
|
|
269
|
+
objective,
|
|
270
|
+
strategies,
|
|
271
|
+
attempts,
|
|
272
|
+
runs,
|
|
273
|
+
...(typeof record.recorded_at === "string"
|
|
274
|
+
? { recorded_at: record.recorded_at }
|
|
275
|
+
: {}),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function parseObjective(value) {
|
|
279
|
+
const record = asRecord(value, "objective");
|
|
280
|
+
const id = requiredString(record.id, "objective.id");
|
|
281
|
+
const goal = requiredString(record.goal, "objective.goal");
|
|
282
|
+
return {
|
|
283
|
+
id,
|
|
284
|
+
goal,
|
|
285
|
+
...(record.evidence_gates !== undefined
|
|
286
|
+
? {
|
|
287
|
+
evidence_gates: arrayOrEmpty(record.evidence_gates, "objective.evidence_gates").map(parseEvidenceGate),
|
|
288
|
+
}
|
|
289
|
+
: {}),
|
|
290
|
+
...(record.attempt_budget !== undefined
|
|
291
|
+
? { attempt_budget: parseAttemptBudget(record.attempt_budget) }
|
|
292
|
+
: {}),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function parseStrategy(value) {
|
|
296
|
+
const record = asRecord(value, "strategy");
|
|
297
|
+
const kind = requiredString(record.kind, "strategy.kind");
|
|
298
|
+
if (!isDeliveryStrategyKind(kind)) {
|
|
299
|
+
throw new DeliveryCliError("invalid_input", `invalid strategy.kind: ${kind}`, "use adapter, browser, desktop, local, mcp, or manual");
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
id: requiredString(record.id, "strategy.id"),
|
|
303
|
+
kind,
|
|
304
|
+
label: requiredString(record.label, "strategy.label"),
|
|
305
|
+
priority: requiredNumber(record.priority, "strategy.priority"),
|
|
306
|
+
...(typeof record.enabled === "boolean" ? { enabled: record.enabled } : {}),
|
|
307
|
+
...(typeof record.command === "string" ? { command: record.command } : {}),
|
|
308
|
+
...(record.args !== undefined
|
|
309
|
+
? { args: plainRecord(record.args, "strategy.args") }
|
|
310
|
+
: {}),
|
|
311
|
+
...(typeof record.adapter_path === "string"
|
|
312
|
+
? { adapter_path: record.adapter_path }
|
|
313
|
+
: {}),
|
|
314
|
+
...(typeof record.verify_command === "string"
|
|
315
|
+
? { verify_command: record.verify_command }
|
|
316
|
+
: {}),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function parseStrategyCommand(command) {
|
|
320
|
+
const trimmed = command.trim();
|
|
321
|
+
const dotIndex = trimmed.indexOf(".");
|
|
322
|
+
if (dotIndex > 0 && dotIndex < trimmed.length - 1) {
|
|
323
|
+
return {
|
|
324
|
+
site: trimmed.slice(0, dotIndex),
|
|
325
|
+
command: trimmed.slice(dotIndex + 1),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const parts = trimmed.split(/\s+/).filter(Boolean);
|
|
329
|
+
if (parts.length === 2) {
|
|
330
|
+
return { site: parts[0], command: parts[1] };
|
|
331
|
+
}
|
|
332
|
+
throw new DeliveryCliError("invalid_input", `strategy.command must be "site.command" or "site command": ${command}`, "use a command from `unicli list`, for example `github.search`");
|
|
333
|
+
}
|
|
334
|
+
function parseAttempt(value) {
|
|
335
|
+
const record = asRecord(value, "attempt");
|
|
336
|
+
return {
|
|
337
|
+
id: requiredString(record.id, "attempt.id"),
|
|
338
|
+
ordinal: requiredNumber(record.ordinal, "attempt.ordinal"),
|
|
339
|
+
strategy_id: requiredString(record.strategy_id, "attempt.strategy_id"),
|
|
340
|
+
run_id: requiredString(record.run_id, "attempt.run_id"),
|
|
341
|
+
summary: parseRunSummary(record.summary),
|
|
342
|
+
...(record.error !== undefined
|
|
343
|
+
? { error: parseAgentError(record.error) }
|
|
344
|
+
: {}),
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function parseRunSummary(value) {
|
|
348
|
+
const record = asRecord(value, "attempt.summary");
|
|
349
|
+
const status = requiredString(record.status, "attempt.summary.status");
|
|
350
|
+
if (!isRunTraceStatus(status)) {
|
|
351
|
+
throw new DeliveryCliError("invalid_input", `invalid attempt.summary.status: ${status}`, "use completed, failed, running, empty, or unreadable");
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
run_id: requiredString(record.run_id, "attempt.summary.run_id"),
|
|
355
|
+
status,
|
|
356
|
+
events: requiredNumber(record.events, "attempt.summary.events"),
|
|
357
|
+
evidence_count: requiredNumber(record.evidence_count, "attempt.summary.evidence_count"),
|
|
358
|
+
evidence_by_type: numberRecord(record.evidence_by_type, "attempt.summary.evidence_by_type"),
|
|
359
|
+
...(typeof record.command === "string" ? { command: record.command } : {}),
|
|
360
|
+
...(typeof record.runtime_permission_denied === "object" &&
|
|
361
|
+
record.runtime_permission_denied !== null
|
|
362
|
+
? {
|
|
363
|
+
runtime_permission_denied: parseRuntimePermissionDenied(record.runtime_permission_denied),
|
|
364
|
+
}
|
|
365
|
+
: {}),
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function parseRunRef(value) {
|
|
369
|
+
const record = asRecord(value, "runs[]");
|
|
370
|
+
if (record.ordinal !== undefined) {
|
|
371
|
+
requiredNumber(record.ordinal, "runs[].ordinal");
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
run_id: requiredString(record.run_id, "runs[].run_id"),
|
|
375
|
+
strategy_id: requiredString(record.strategy_id, "runs[].strategy_id"),
|
|
376
|
+
...(typeof record.id === "string" ? { id: record.id } : {}),
|
|
377
|
+
...(typeof record.ordinal === "number" && Number.isFinite(record.ordinal)
|
|
378
|
+
? { ordinal: record.ordinal }
|
|
379
|
+
: {}),
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function parseEvidenceGate(value) {
|
|
383
|
+
const record = asRecord(value, "evidence gate");
|
|
384
|
+
const kind = requiredString(record.kind, "evidence_gate.kind");
|
|
385
|
+
switch (kind) {
|
|
386
|
+
case "run_completed":
|
|
387
|
+
return { kind };
|
|
388
|
+
case "min_evidence_count":
|
|
389
|
+
return {
|
|
390
|
+
kind,
|
|
391
|
+
min: requiredNumber(record.min, "evidence_gate.min"),
|
|
392
|
+
};
|
|
393
|
+
case "required_evidence_type":
|
|
394
|
+
if (record.min !== undefined) {
|
|
395
|
+
requiredNumber(record.min, "evidence_gate.min");
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
kind,
|
|
399
|
+
evidence_type: requiredString(record.evidence_type, "evidence_gate.evidence_type"),
|
|
400
|
+
...(typeof record.min === "number" && Number.isFinite(record.min)
|
|
401
|
+
? { min: record.min }
|
|
402
|
+
: {}),
|
|
403
|
+
};
|
|
404
|
+
default:
|
|
405
|
+
throw new DeliveryCliError("invalid_input", `invalid evidence_gate.kind: ${kind}`, "use run_completed, min_evidence_count, or required_evidence_type");
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function parseAttemptBudget(value) {
|
|
409
|
+
const record = asRecord(value, "attempt_budget");
|
|
410
|
+
if (record.max_attempts !== undefined) {
|
|
411
|
+
requiredNumber(record.max_attempts, "attempt_budget.max_attempts");
|
|
412
|
+
}
|
|
413
|
+
if (record.max_attempts_per_strategy !== undefined) {
|
|
414
|
+
requiredNumber(record.max_attempts_per_strategy, "attempt_budget.max_attempts_per_strategy");
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
...(typeof record.max_attempts === "number" &&
|
|
418
|
+
Number.isFinite(record.max_attempts)
|
|
419
|
+
? { max_attempts: record.max_attempts }
|
|
420
|
+
: {}),
|
|
421
|
+
...(typeof record.max_attempts_per_strategy === "number" &&
|
|
422
|
+
Number.isFinite(record.max_attempts_per_strategy)
|
|
423
|
+
? { max_attempts_per_strategy: record.max_attempts_per_strategy }
|
|
424
|
+
: {}),
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function validateStrategyReferences(strategies, attempts, runs) {
|
|
428
|
+
const strategyIds = new Set(strategies.map((strategy) => strategy.id));
|
|
429
|
+
for (const attempt of attempts) {
|
|
430
|
+
if (!strategyIds.has(attempt.strategy_id)) {
|
|
431
|
+
throw new DeliveryCliError("invalid_input", `attempt.strategy_id references unknown strategy: ${attempt.strategy_id}`, "add the strategy to `strategies` or correct the attempt strategy_id");
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
for (const run of runs) {
|
|
435
|
+
if (!strategyIds.has(run.strategy_id)) {
|
|
436
|
+
throw new DeliveryCliError("invalid_input", `runs[].strategy_id references unknown strategy: ${run.strategy_id}`, "add the strategy to `strategies` or correct the run strategy_id");
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function parseAgentError(value) {
|
|
441
|
+
const record = asRecord(value, "attempt.error");
|
|
442
|
+
return {
|
|
443
|
+
code: requiredString(record.code, "attempt.error.code"),
|
|
444
|
+
message: requiredString(record.message, "attempt.error.message"),
|
|
445
|
+
...(typeof record.adapter_path === "string"
|
|
446
|
+
? { adapter_path: record.adapter_path }
|
|
447
|
+
: {}),
|
|
448
|
+
...(typeof record.step === "number" && Number.isFinite(record.step)
|
|
449
|
+
? { step: record.step }
|
|
450
|
+
: {}),
|
|
451
|
+
...(typeof record.suggestion === "string"
|
|
452
|
+
? { suggestion: record.suggestion }
|
|
453
|
+
: {}),
|
|
454
|
+
...(typeof record.retryable === "boolean"
|
|
455
|
+
? { retryable: record.retryable }
|
|
456
|
+
: {}),
|
|
457
|
+
...(Array.isArray(record.alternatives)
|
|
458
|
+
? {
|
|
459
|
+
alternatives: record.alternatives.filter((entry) => typeof entry === "string"),
|
|
460
|
+
}
|
|
461
|
+
: {}),
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function parseRuntimePermissionDenied(value) {
|
|
465
|
+
const record = asRecord(value, "runtime_permission_denied");
|
|
466
|
+
return {
|
|
467
|
+
...(typeof record.code === "string" ? { code: record.code } : {}),
|
|
468
|
+
...(typeof record.action === "string" ? { action: record.action } : {}),
|
|
469
|
+
...(typeof record.step === "number" && Number.isFinite(record.step)
|
|
470
|
+
? { step: record.step }
|
|
471
|
+
: {}),
|
|
472
|
+
...(typeof record.rule_id === "string" ? { rule_id: record.rule_id } : {}),
|
|
473
|
+
...(Array.isArray(record.resource_buckets)
|
|
474
|
+
? {
|
|
475
|
+
resource_buckets: record.resource_buckets.filter((entry) => typeof entry === "string"),
|
|
476
|
+
}
|
|
477
|
+
: {}),
|
|
478
|
+
...(typeof record.retryable === "boolean"
|
|
479
|
+
? { retryable: record.retryable }
|
|
480
|
+
: {}),
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
function emitDelivery(program, command, startedAt, data) {
|
|
484
|
+
console.log(format(data, undefined, fmt(program), {
|
|
485
|
+
...makeCtx(command, startedAt, {
|
|
486
|
+
surface: "system",
|
|
487
|
+
operator: "delivery",
|
|
488
|
+
}),
|
|
489
|
+
}));
|
|
490
|
+
}
|
|
491
|
+
function emitDeliveryError(program, command, startedAt, err) {
|
|
492
|
+
const error = agentErrorFromUnknown(err);
|
|
493
|
+
printErrorEnvelope({
|
|
494
|
+
fmt: fmt(program),
|
|
495
|
+
exitCode: ExitCode.USAGE_ERROR,
|
|
496
|
+
ctx: {
|
|
497
|
+
...makeCtx(command, startedAt, {
|
|
498
|
+
surface: "system",
|
|
499
|
+
operator: "delivery",
|
|
500
|
+
}),
|
|
501
|
+
error,
|
|
502
|
+
},
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
function agentErrorFromUnknown(err) {
|
|
506
|
+
if (err instanceof DeliveryCliError) {
|
|
507
|
+
return {
|
|
508
|
+
code: err.code,
|
|
509
|
+
message: err.message,
|
|
510
|
+
...(err.suggestion ? { suggestion: err.suggestion } : {}),
|
|
511
|
+
retryable: false,
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
if (err instanceof RunStoreError) {
|
|
515
|
+
return {
|
|
516
|
+
code: err.code === "invalid_run_id" || err.code === "malformed_jsonl"
|
|
517
|
+
? "invalid_input"
|
|
518
|
+
: "internal_error",
|
|
519
|
+
message: err.message,
|
|
520
|
+
suggestion: "run `unicli runs list` and choose an existing run id",
|
|
521
|
+
retryable: false,
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
525
|
+
return {
|
|
526
|
+
code: "internal_error",
|
|
527
|
+
message,
|
|
528
|
+
retryable: false,
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function arrayOrEmpty(value, label) {
|
|
532
|
+
if (value === undefined)
|
|
533
|
+
return [];
|
|
534
|
+
if (!Array.isArray(value)) {
|
|
535
|
+
throw new DeliveryCliError("invalid_input", `${label} must be an array`, "check the delivery spec JSON shape");
|
|
536
|
+
}
|
|
537
|
+
return value;
|
|
538
|
+
}
|
|
539
|
+
function asRecord(value, label) {
|
|
540
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
541
|
+
throw new DeliveryCliError("invalid_input", `${label} must be an object`, "check the delivery spec JSON shape");
|
|
542
|
+
}
|
|
543
|
+
return value;
|
|
544
|
+
}
|
|
545
|
+
function plainRecord(value, label) {
|
|
546
|
+
return { ...asRecord(value, label) };
|
|
547
|
+
}
|
|
548
|
+
function requiredString(value, label) {
|
|
549
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
550
|
+
throw new DeliveryCliError("invalid_input", `${label} must be a non-empty string`, "check the delivery spec JSON shape");
|
|
551
|
+
}
|
|
552
|
+
return value;
|
|
553
|
+
}
|
|
554
|
+
function requiredNumber(value, label) {
|
|
555
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
556
|
+
throw new DeliveryCliError("invalid_input", `${label} must be a finite number`, "check the delivery spec JSON shape");
|
|
557
|
+
}
|
|
558
|
+
return value;
|
|
559
|
+
}
|
|
560
|
+
function numberRecord(value, label) {
|
|
561
|
+
const record = asRecord(value, label);
|
|
562
|
+
const parsed = {};
|
|
563
|
+
for (const [key, entry] of Object.entries(record)) {
|
|
564
|
+
if (typeof entry !== "number" || !Number.isFinite(entry)) {
|
|
565
|
+
throw new DeliveryCliError("invalid_input", `${label}.${key} must be a finite number`, "check the delivery spec JSON shape");
|
|
566
|
+
}
|
|
567
|
+
parsed[key] = entry;
|
|
568
|
+
}
|
|
569
|
+
return parsed;
|
|
570
|
+
}
|
|
571
|
+
function isDeliveryStrategyKind(value) {
|
|
572
|
+
return ["adapter", "browser", "desktop", "local", "mcp", "manual"].includes(value);
|
|
573
|
+
}
|
|
574
|
+
function isRunTraceStatus(value) {
|
|
575
|
+
return ["completed", "failed", "running", "empty", "unreadable"].includes(value);
|
|
576
|
+
}
|
|
577
|
+
//# sourceMappingURL=delivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../src/commands/delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,wBA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commands/do.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"do.d.ts","sourceRoot":"","sources":["../../src/commands/do.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BpC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2GxD"}
|
package/dist/commands/do.js
CHANGED
|
@@ -29,6 +29,7 @@ import { search } from "../discovery/search.js";
|
|
|
29
29
|
import { getAdapter, resolveCommand } from "../registry.js";
|
|
30
30
|
import { describeCommand } from "./describe.js";
|
|
31
31
|
import { format, detectFormat } from "../output/formatter.js";
|
|
32
|
+
import { printErrorEnvelope } from "../output/error-writer.js";
|
|
32
33
|
const DEFAULT_TOP = 3;
|
|
33
34
|
const SCORE_FLOOR = 0.0;
|
|
34
35
|
export function registerDoCommand(program) {
|
|
@@ -221,8 +222,7 @@ function emitEmpty(startedAt, fmt, intent, reason) {
|
|
|
221
222
|
suggestion: "Use simpler keywords or run `unicli describe` to see the full catalogue",
|
|
222
223
|
},
|
|
223
224
|
};
|
|
224
|
-
|
|
225
|
-
console.log(format(null, undefined, fmt, ctx));
|
|
225
|
+
printErrorEnvelope({ fmt, exitCode: 66, ctx });
|
|
226
226
|
}
|
|
227
227
|
function emitInvalidInput(startedAt, fmt, intent, message, suggestion) {
|
|
228
228
|
const ctx = {
|
|
@@ -242,7 +242,6 @@ function emitInvalidInput(startedAt, fmt, intent, message, suggestion) {
|
|
|
242
242
|
suggestion,
|
|
243
243
|
},
|
|
244
244
|
};
|
|
245
|
-
|
|
246
|
-
console.log(format(null, undefined, fmt, ctx));
|
|
245
|
+
printErrorEnvelope({ fmt, exitCode: 2, ctx });
|
|
247
246
|
}
|
|
248
247
|
//# sourceMappingURL=do.js.map
|