@letra-ai/cli 0.7.0 → 0.8.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/dist/{chunk-TNF7XTFG.js → chunk-5VGLNF7Q.js} +27 -12
- package/dist/{chunk-HC24XMPZ.js → chunk-EEIVVJK4.js} +1 -1
- package/dist/{chunk-MUCIMQAU.js → chunk-FK6CIZE7.js} +4 -4
- package/dist/{chunk-2GRNAFBQ.js → chunk-U264XFAO.js} +21 -4
- package/dist/{fallback-CXCCKHBA.js → fallback-J7OVUHDK.js} +1 -1
- package/dist/{flow-serve-LFILD3EV.js → flow-serve-AD4CFVJ4.js} +4 -4
- package/dist/{generate-3R7POT7L.js → generate-MUAEF3JC.js} +1 -1
- package/dist/index.js +63 -37
- package/dist/{push-2ZCQSOHF.js → push-OCAQ5SK3.js} +1 -1
- package/dist/{server-WUYVNSH7.js → server-TOL32IF4.js} +2 -2
- package/dist/{service-TOBY3OHO.js → service-KI5XMOBA.js} +1 -1
- package/dist/{service-USTAY5E3.js → service-YJ3GLLWB.js} +2 -2
- package/dist/{sync-LIVPQXEW.js → sync-553BP2FM.js} +2 -2
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
withRunAssignment,
|
|
30
30
|
writeFocusFile,
|
|
31
31
|
writeWorkflow
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-U264XFAO.js";
|
|
33
33
|
import {
|
|
34
34
|
validateSpecCatalog
|
|
35
35
|
} from "./chunk-LUPN3TRC.js";
|
|
@@ -2792,7 +2792,9 @@ function rejected(root, direction, reasonCode, reason, context, subject, guidanc
|
|
|
2792
2792
|
}
|
|
2793
2793
|
var HUMAN_ONLY_REFUSALS = /* @__PURE__ */ new Set([
|
|
2794
2794
|
"HUMAN_APPROVAL_REQUIRED",
|
|
2795
|
-
"HUMAN_ACTOR_REQUIRED"
|
|
2795
|
+
"HUMAN_ACTOR_REQUIRED",
|
|
2796
|
+
// Signed operations (gate decision, Run migration) need the human's key.
|
|
2797
|
+
"SIGNED_OPERATION_REQUIRED"
|
|
2796
2798
|
]);
|
|
2797
2799
|
function claimRequiredGuidance(root, direction, context, itemId) {
|
|
2798
2800
|
const executorId = context.executorId;
|
|
@@ -2975,21 +2977,19 @@ async function claimOperation(root, input) {
|
|
|
2975
2977
|
const retryClaim = (actor, capability) => ({
|
|
2976
2978
|
nextCommand: claimCommand(item.id, actor, capability, input, before.revision)
|
|
2977
2979
|
});
|
|
2978
|
-
|
|
2980
|
+
const lapsedHandoff = item.handoff && item.handoff.status !== "accepted" && !activeHandoff ? item.handoff : void 0;
|
|
2981
|
+
if (lapsedHandoff?.to.startsWith("human") && !actorForClaim.startsWith("human"))
|
|
2979
2982
|
return rejected(
|
|
2980
2983
|
workspaceRoot,
|
|
2981
2984
|
before,
|
|
2982
2985
|
"HANDOFF_EXPIRED",
|
|
2983
|
-
`O
|
|
2986
|
+
`O item aguarda decis\xE3o de ${lapsedHandoff.to} (handoff de ${lapsedHandoff.from}, prazo vencido em ${lapsedHandoff.expiresAt}); o prazo vencido n\xE3o transfere a decis\xE3o para um agente.`,
|
|
2984
2987
|
input,
|
|
2985
2988
|
subject,
|
|
2986
|
-
{
|
|
2987
|
-
nextCommand: `letra flow handoff ${item.id} --rollback`,
|
|
2988
|
-
// Re-issuing restates the sender's decision; a human sender must do it.
|
|
2989
|
-
humanRequired: item.handoff.from.startsWith("human")
|
|
2990
|
-
}
|
|
2989
|
+
{ humanRequired: true }
|
|
2991
2990
|
);
|
|
2992
|
-
const
|
|
2991
|
+
const lateRecipient = lapsedHandoff?.to === actorForClaim;
|
|
2992
|
+
const activeHandoffForActor = activeHandoff && item.handoff?.to === actorForClaim || lateRecipient;
|
|
2993
2993
|
if (activeHandoff && item.handoff && item.handoff.to !== actorForClaim) {
|
|
2994
2994
|
const recipient = item.handoff.to;
|
|
2995
2995
|
const recipientCapabilities = roleCapabilities(recipient);
|
|
@@ -3008,8 +3008,18 @@ async function claimOperation(root, input) {
|
|
|
3008
3008
|
}
|
|
3009
3009
|
const isCurrentHandoffRecipient = activeHandoffForActor;
|
|
3010
3010
|
const claimIdentityId = requestedActor.startsWith("mcp:") ? requestedActor : actorForClaim;
|
|
3011
|
-
if (isCurrentHandoffRecipient && item.handoff)
|
|
3011
|
+
if (isCurrentHandoffRecipient && item.handoff) {
|
|
3012
|
+
const acceptedAt = /* @__PURE__ */ new Date();
|
|
3012
3013
|
item.handoff.status = "accepted";
|
|
3014
|
+
item.handoff.acceptedAt = acceptedAt.toISOString();
|
|
3015
|
+
if (lateRecipient) {
|
|
3016
|
+
item.handoff.lateAcceptance = true;
|
|
3017
|
+
item.handoff.lateByMinutes = Math.max(
|
|
3018
|
+
0,
|
|
3019
|
+
Math.round((acceptedAt.getTime() - handoffExpiresAt) / 6e4)
|
|
3020
|
+
);
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3013
3023
|
if (stage?.agents.length && !stage.agents.includes(actorForClaim) && !isCurrentHandoffRecipient) {
|
|
3014
3024
|
const suggested = stage.agents.find(
|
|
3015
3025
|
(roleId) => roleCapabilities(roleId).includes(input.capability)
|
|
@@ -3249,7 +3259,12 @@ async function claimOperation(root, input) {
|
|
|
3249
3259
|
originalActor: input.actor,
|
|
3250
3260
|
runId: claimedRun?.id,
|
|
3251
3261
|
runRevision: claimedRun?.revision,
|
|
3252
|
-
cycle: claimedRun?.cycle.number
|
|
3262
|
+
cycle: claimedRun?.cycle.number,
|
|
3263
|
+
...lateRecipient ? {
|
|
3264
|
+
lateAcceptance: true,
|
|
3265
|
+
lateByMinutes: item.handoff?.lateByMinutes,
|
|
3266
|
+
handoffExpiresAt: item.handoff?.expiresAt
|
|
3267
|
+
} : {}
|
|
3253
3268
|
}
|
|
3254
3269
|
});
|
|
3255
3270
|
for (const hook of claimHooks) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-POGWTSEA.js";
|
|
9
9
|
import {
|
|
10
10
|
syncNow
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EEIVVJK4.js";
|
|
12
12
|
import {
|
|
13
13
|
GateChecker,
|
|
14
14
|
activateWorkOperation,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
submitEvidenceOperation,
|
|
35
35
|
updateItemOperation,
|
|
36
36
|
writeFocusWithRecommendations
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5VGLNF7Q.js";
|
|
38
38
|
import {
|
|
39
39
|
DEFAULT_HARNESS_VERSION,
|
|
40
40
|
DiagnosticEngine,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
updateWorkflowDraft,
|
|
77
77
|
validateWorkflowContent,
|
|
78
78
|
writeWorkflow
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-U264XFAO.js";
|
|
80
80
|
import {
|
|
81
81
|
ADAPTER_REGISTRY,
|
|
82
82
|
supportedAdapterTools
|
|
@@ -2701,7 +2701,7 @@ function createContextRoutes(dependencies) {
|
|
|
2701
2701
|
path: `.letra/${f}`,
|
|
2702
2702
|
content: f === "context.md" ? stripSitrepSnapshots(readFile2(f)) : readFile2(f)
|
|
2703
2703
|
}));
|
|
2704
|
-
const direction = (await import("./service-
|
|
2704
|
+
const direction = (await import("./service-KI5XMOBA.js")).resolveDirection(workspaceRoot);
|
|
2705
2705
|
const specName = direction.item?.spec ?? null;
|
|
2706
2706
|
const specContent = specName ? readFile2(`specs/${specName}/spec.md`) : "";
|
|
2707
2707
|
const l2 = {
|
|
@@ -78,6 +78,18 @@ function createWorkspaceBoundary(root) {
|
|
|
78
78
|
return { root: realRoot, assertPath };
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
// src/adapters/refusal-rule.ts
|
|
82
|
+
var REFUSAL_RULE_HEADING = "When an operation is refused";
|
|
83
|
+
var REFUSAL_RULE_LINES = [
|
|
84
|
+
'- A refused operation answers `outcome: "rejected"` with `reasonCode`, `reason`, `nextCommand` and `humanRequired`, and the CLI exits with code 1.',
|
|
85
|
+
"- `humanRequired: false`: run `nextCommand` as given; it already carries the accepted actor, capability and current revision.",
|
|
86
|
+
"- `humanRequired: true`: stop and ask the human. Never retry with a human identity or `--actor human:...`.",
|
|
87
|
+
"- Do not read Letra source code, `--help` output or workflow.json to find the next step: the refusal already names it."
|
|
88
|
+
];
|
|
89
|
+
function refusalRuleSection(level = 2) {
|
|
90
|
+
return [`${"#".repeat(level)} ${REFUSAL_RULE_HEADING}`, "", ...REFUSAL_RULE_LINES].join("\n");
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
// src/adapters/codex-bootstrap.ts
|
|
82
94
|
var MANAGED_START = "# letra:codex-mcp:start";
|
|
83
95
|
var MANAGED_END = "# letra:codex-mcp:end";
|
|
@@ -134,6 +146,8 @@ function renderLetraHarnessSkill() {
|
|
|
134
146
|
"3. Para concluir ou avan\xE7ar, use os subcomandos controlados de `letra operation`; nunca contorne o harness.",
|
|
135
147
|
"4. Execute novamente `letra direction --json` antes de cada muta\xE7\xE3o.",
|
|
136
148
|
"",
|
|
149
|
+
refusalRuleSection(2),
|
|
150
|
+
"",
|
|
137
151
|
"Esta skill define procedimento. Item, stage, AC e pr\xF3xima a\xE7\xE3o sempre v\xEAm do contexto vivo.",
|
|
138
152
|
""
|
|
139
153
|
].join("\n");
|
|
@@ -2173,7 +2187,7 @@ ${L1_FILES.map((p) => `- ${p}`).join("\n")}`
|
|
|
2173
2187
|
sections.push(`## Refer\xEAncias
|
|
2174
2188
|
|
|
2175
2189
|
${formatMarkdownReferences(snapshot)}`);
|
|
2176
|
-
sections.push(...["", formatRulesText()]);
|
|
2190
|
+
sections.push(...["", formatRulesText(), "", refusalRuleSection(1)]);
|
|
2177
2191
|
return sections.join("\n");
|
|
2178
2192
|
}
|
|
2179
2193
|
sections.push(title);
|
|
@@ -2222,6 +2236,7 @@ ${formatAlerts({ ...snapshot, alerts: nonGrave })}`);
|
|
|
2222
2236
|
sections.push(`## Regras (Viola\xE7\xE3o = Erro Grave)
|
|
2223
2237
|
|
|
2224
2238
|
${formatProhibitionRules()}`);
|
|
2239
|
+
sections.push(refusalRuleSection(2));
|
|
2225
2240
|
if (snapshot.hasWorkflow) {
|
|
2226
2241
|
sections.push(`## Fluxo de Execu\xE7\xE3o
|
|
2227
2242
|
|
|
@@ -2783,7 +2798,7 @@ var harnessStaleDetector = {
|
|
|
2783
2798
|
});
|
|
2784
2799
|
}
|
|
2785
2800
|
}
|
|
2786
|
-
const { generateAdapters: generateAdapters2 } = await import("./generate-
|
|
2801
|
+
const { generateAdapters: generateAdapters2 } = await import("./generate-MUAEF3JC.js");
|
|
2787
2802
|
generateAdapters2(rootDir, tools, {
|
|
2788
2803
|
source: "flow-move",
|
|
2789
2804
|
workflow,
|
|
@@ -3408,7 +3423,7 @@ async function writeWorkflowUnlocked(root, options) {
|
|
|
3408
3423
|
return { ok: false, filesUpdated: [], error: "workflow.stages must be an array" };
|
|
3409
3424
|
}
|
|
3410
3425
|
if (options.expectedRevision) {
|
|
3411
|
-
const { resolveOperationDirection: resolveOperationDirection2 } = await import("./service-
|
|
3426
|
+
const { resolveOperationDirection: resolveOperationDirection2 } = await import("./service-KI5XMOBA.js");
|
|
3412
3427
|
const existingTarget = primaryItemId ? loadWorkflow(root)?.items.some((item) => item.id === primaryItemId) === true : false;
|
|
3413
3428
|
const currentRevision = resolveOperationDirection2(root, existingTarget ? { itemId: primaryItemId } : {}).revision;
|
|
3414
3429
|
if (currentRevision !== options.expectedRevision) {
|
|
@@ -5143,7 +5158,9 @@ function stableAdapterBootstrap() {
|
|
|
5143
5158
|
"4. Include the current direction revision and an explicit target on every mutation.",
|
|
5144
5159
|
"5. Report evidence and completion through the Letra operation contract.",
|
|
5145
5160
|
"",
|
|
5146
|
-
"Workspace attention, generated prompts, and cached snapshots do not grant execution authority."
|
|
5161
|
+
"Workspace attention, generated prompts, and cached snapshots do not grant execution authority.",
|
|
5162
|
+
"",
|
|
5163
|
+
refusalRuleSection(2)
|
|
5147
5164
|
].join("\n");
|
|
5148
5165
|
}
|
|
5149
5166
|
function renderAdapterFiles(root, tools, options) {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
FlowServer,
|
|
4
4
|
flowServeAction
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FK6CIZE7.js";
|
|
6
6
|
import "./chunk-POGWTSEA.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-EEIVVJK4.js";
|
|
8
|
+
import "./chunk-5VGLNF7Q.js";
|
|
9
|
+
import "./chunk-U264XFAO.js";
|
|
10
10
|
import "./chunk-JMIC5NKB.js";
|
|
11
11
|
import "./chunk-42RST74I.js";
|
|
12
12
|
import "./chunk-LUPN3TRC.js";
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
migrateCommand,
|
|
6
6
|
pulse_default,
|
|
7
7
|
sitrep_default
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FK6CIZE7.js";
|
|
9
9
|
import {
|
|
10
10
|
validateSpecStructure
|
|
11
11
|
} from "./chunk-POGWTSEA.js";
|
|
12
12
|
import {
|
|
13
13
|
sync_default
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EEIVVJK4.js";
|
|
15
15
|
import {
|
|
16
16
|
GateChecker,
|
|
17
17
|
activityOperation,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runSecurityReviewOperation,
|
|
27
27
|
validate,
|
|
28
28
|
writeFocusWithRecommendations
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5VGLNF7Q.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_HARNESS_VERSION,
|
|
32
32
|
DiagnosticEngine,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
signLocalOperation,
|
|
55
55
|
validateWorkflowContent,
|
|
56
56
|
writeWorkflow
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-U264XFAO.js";
|
|
58
58
|
import {
|
|
59
59
|
supportedAdapterTools
|
|
60
60
|
} from "./chunk-JMIC5NKB.js";
|
|
@@ -170,6 +170,32 @@ import { Command as Command2 } from "commander";
|
|
|
170
170
|
import chalk17 from "chalk";
|
|
171
171
|
import { resolve as resolve17 } from "path";
|
|
172
172
|
|
|
173
|
+
// src/identity/agent-runtime.ts
|
|
174
|
+
var RUNTIME_MARKERS = [
|
|
175
|
+
{ variable: "CLAUDECODE", runtime: "claude-code" },
|
|
176
|
+
{ variable: "CODEX_SANDBOX", runtime: "codex" },
|
|
177
|
+
{ variable: "CODEX_SANDBOX_NETWORK_DISABLED", runtime: "codex" },
|
|
178
|
+
{ variable: "CURSOR_AGENT", runtime: "cursor" }
|
|
179
|
+
];
|
|
180
|
+
function runtimeFromAiAgent(value) {
|
|
181
|
+
const name = value.trim().toLowerCase().match(/^[a-z0-9-]+/)?.[0];
|
|
182
|
+
return name || "agent";
|
|
183
|
+
}
|
|
184
|
+
function detectAgentRuntime(env = process.env) {
|
|
185
|
+
const aiAgent = env.AI_AGENT?.trim();
|
|
186
|
+
if (aiAgent) return runtimeFromAiAgent(aiAgent);
|
|
187
|
+
for (const { variable, runtime } of RUNTIME_MARKERS) {
|
|
188
|
+
if (env[variable]?.trim()) return runtime;
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
function resolveCliActor(root, explicit, env = process.env) {
|
|
193
|
+
const requested = explicit?.trim() || void 0;
|
|
194
|
+
const runtime = detectAgentRuntime(env);
|
|
195
|
+
if (runtime) return requested && !requested.startsWith("human") ? requested : `agent:${runtime}`;
|
|
196
|
+
return requested ?? resolveLocalIdentity(root).id;
|
|
197
|
+
}
|
|
198
|
+
|
|
173
199
|
// src/commands/flow-backlog.ts
|
|
174
200
|
import { resolve as resolve2 } from "path";
|
|
175
201
|
import chalk2 from "chalk";
|
|
@@ -197,7 +223,7 @@ async function backlogAdd(root, description, spec, requestedId) {
|
|
|
197
223
|
spec,
|
|
198
224
|
expectedRevision: direction.revision,
|
|
199
225
|
reason: "Cria\xE7\xE3o de item pelo backlog da CLI.",
|
|
200
|
-
actor:
|
|
226
|
+
actor: resolveCliActor(root)
|
|
201
227
|
});
|
|
202
228
|
if (operation.outcome !== "accepted") {
|
|
203
229
|
console.log(chalk2.red(` ${operation.reasonCode}: ${operation.reason}`));
|
|
@@ -878,7 +904,7 @@ async function flowMove(root, itemId, targetStageInput, options) {
|
|
|
878
904
|
executorId: item.claimExecutorId,
|
|
879
905
|
summary: `Passagem solicitada pela CLI: ${fromStage} \u2192 ${toStage}.`,
|
|
880
906
|
evidence: [],
|
|
881
|
-
actor: options?.actor
|
|
907
|
+
actor: resolveCliActor(root, options?.actor),
|
|
882
908
|
// The revision requestPassageOperation compares (run-aware, bound to
|
|
883
909
|
// the claim's executor); resolveAgentDirection diverges once a Run exists.
|
|
884
910
|
expectedRevision: directionForRunAwareOperation(root, {
|
|
@@ -1059,7 +1085,7 @@ async function handoffItem(root, itemId, options) {
|
|
|
1059
1085
|
process.exit(1);
|
|
1060
1086
|
}
|
|
1061
1087
|
const previousFrom = item.handoff.from;
|
|
1062
|
-
const actor =
|
|
1088
|
+
const actor = resolveCliActor(root);
|
|
1063
1089
|
const operation2 = await rollbackHandoffOperation(root, {
|
|
1064
1090
|
itemId,
|
|
1065
1091
|
actor,
|
|
@@ -2133,18 +2159,18 @@ function flowCommand() {
|
|
|
2133
2159
|
workflowShowCommand(resolve17(process.cwd()), id);
|
|
2134
2160
|
});
|
|
2135
2161
|
workflow.command("draft <id>").option("--actor <actor>", "Identity actor", void 0).option("--based-on <version>", "Base version number", void 0).description("Create a draft for editing").action((id, options) => {
|
|
2136
|
-
const actor =
|
|
2162
|
+
const actor = resolveCliActor(resolve17(process.cwd()), options.actor);
|
|
2137
2163
|
workflowDraftCommand(resolve17(process.cwd()), id, actor, options.basedOn ? Number(options.basedOn) : void 0);
|
|
2138
2164
|
});
|
|
2139
2165
|
workflow.command("validate <id>").description("Validate current draft").action((id) => {
|
|
2140
2166
|
workflowValidateCommand(resolve17(process.cwd()), id);
|
|
2141
2167
|
});
|
|
2142
2168
|
workflow.command("publish <id>").option("--actor <actor>", "Identity actor", void 0).requiredOption("--revision <revision>", "Expected revision number").requiredOption("--reason <reason>", "Publication reason").description("Publish current draft as new version").action((id, options) => {
|
|
2143
|
-
const actor =
|
|
2169
|
+
const actor = resolveCliActor(resolve17(process.cwd()), options.actor);
|
|
2144
2170
|
workflowPublishCommand(resolve17(process.cwd()), id, actor, Number(options.revision), options.reason);
|
|
2145
2171
|
});
|
|
2146
2172
|
workflow.command("rollback <id>").option("--actor <actor>", "Identity actor", void 0).requiredOption("--version <version>", "Version number to restore").requiredOption("--reason <reason>", "Rollback reason").description("Rollback to a previous version (publishes new derived version)").action((id, options) => {
|
|
2147
|
-
const actor =
|
|
2173
|
+
const actor = resolveCliActor(resolve17(process.cwd()), options.actor);
|
|
2148
2174
|
workflowRollbackCommand(resolve17(process.cwd()), id, actor, Number(options.version), options.reason);
|
|
2149
2175
|
});
|
|
2150
2176
|
workflow.command("versions <id>").description("List all published versions").action((id) => {
|
|
@@ -2154,15 +2180,15 @@ function flowCommand() {
|
|
|
2154
2180
|
workflowDraftRevisionsCommand(resolve17(process.cwd()), id);
|
|
2155
2181
|
});
|
|
2156
2182
|
workflow.command("template <id>").option("--template <name>", "Template name").option("--name <name>", "Workflow name").option("--actor <actor>", "Identity actor", void 0).description("Create workflow from template").action((id, options) => {
|
|
2157
|
-
const actor =
|
|
2183
|
+
const actor = resolveCliActor(resolve17(process.cwd()), options.actor);
|
|
2158
2184
|
workflowTemplateCommand(resolve17(process.cwd()), id, actor, options.template ?? "", options);
|
|
2159
2185
|
});
|
|
2160
2186
|
workflow.command("adapters <id>").option("--tools <tools>", "Comma-separated tools").option("--list", "List active adapters").option("--actor <actor>", "Identity actor", void 0).description("Manage workflow adapters").action((id, options) => {
|
|
2161
|
-
const actor =
|
|
2187
|
+
const actor = resolveCliActor(resolve17(process.cwd()), options.actor);
|
|
2162
2188
|
workflowAdaptersCommand(resolve17(process.cwd()), id, { tools: options.tools, list: options.list });
|
|
2163
2189
|
});
|
|
2164
2190
|
workflow.command("locations <id>").option("--add <path>", "Add location").option("--remove <id>", "Remove location").option("--list", "List locations").option("--actor <actor>", "Identity actor", void 0).description("Manage workflow locations").action((id, options) => {
|
|
2165
|
-
const actor =
|
|
2191
|
+
const actor = resolveCliActor(resolve17(process.cwd()), options.actor);
|
|
2166
2192
|
workflowLocationsCommand(resolve17(process.cwd()), id, { add: options.add, remove: options.remove, list: options.list });
|
|
2167
2193
|
});
|
|
2168
2194
|
return cmd;
|
|
@@ -2736,7 +2762,7 @@ function withDirectionScope(direction, itemId) {
|
|
|
2736
2762
|
}
|
|
2737
2763
|
function directionCommand() {
|
|
2738
2764
|
return new Command8("direction").description("Read the current harness direction through the degraded CLI fallback").option("--json", "Output the complete structured snapshot").option("--run <run-id>", "Select a canonical execution Run").option("--item <item-id>", "Select an explicitly authorized item when no Run is selected").option("--executor <executor-id>", "Bind Run selection to an executor identity").action(async (options) => {
|
|
2739
|
-
const { resolveFallbackDirection } = await import("./fallback-
|
|
2765
|
+
const { resolveFallbackDirection } = await import("./fallback-J7OVUHDK.js");
|
|
2740
2766
|
const direction = withDirectionScope(
|
|
2741
2767
|
resolveFallbackDirection(resolve23(process.cwd()), { runId: options.run, itemId: options.item, executorId: options.executor }),
|
|
2742
2768
|
options.item
|
|
@@ -2762,7 +2788,7 @@ import { Command as Command9 } from "commander";
|
|
|
2762
2788
|
function mcpCommand() {
|
|
2763
2789
|
const command = new Command9("mcp").description("Expose Letra harness capabilities through MCP");
|
|
2764
2790
|
command.command("serve").option("--stdio", "Use the local stdio transport").description("Start the local read-only Letra MCP server").action(async () => {
|
|
2765
|
-
const { startLetraMcpServer } = await import("./server-
|
|
2791
|
+
const { startLetraMcpServer } = await import("./server-TOL32IF4.js");
|
|
2766
2792
|
await startLetraMcpServer(resolve24(process.cwd()));
|
|
2767
2793
|
});
|
|
2768
2794
|
command.command("restart").description("Restart the local MCP server (kills running process, opencode will restart it)").action(() => {
|
|
@@ -2811,13 +2837,13 @@ function operationCommand() {
|
|
|
2811
2837
|
);
|
|
2812
2838
|
command.command("run-migrate-workflow <run-id>").requiredOption("--to-version <version-id>", "Published workflow version ID").requiredOption("--to-stage <stage-id>", "Destination stage ID").requiredOption("--run-revision <revision>", "Expected Run revision", (value) => Number(value)).requiredOption("--expected-revision <revision>", "Direction revision").requiredOption("--reason <reason>", "Audited migration reason").action((runId, options) => {
|
|
2813
2839
|
const root = resolve25(process.cwd());
|
|
2814
|
-
const actor =
|
|
2840
|
+
const actor = resolveCliActor(root);
|
|
2815
2841
|
const details = { runId, toWorkflowVersionId: options.toVersion, toStageId: options.toStage, expectedRunRevision: options.runRevision, expectedDirectionRevision: options.expectedRevision, reason: options.reason };
|
|
2816
|
-
const proof = signLocalOperation(root, actor, "run.workflow.migrate", details);
|
|
2842
|
+
const proof = actor.startsWith("human:") ? signLocalOperation(root, actor, "run.workflow.migrate", details) : void 0;
|
|
2817
2843
|
printJson(migrateRunWorkflowOperation(root, { ...details, expectedRevision: options.expectedRevision, actor, proof }));
|
|
2818
2844
|
});
|
|
2819
2845
|
command.command("reclaim-expired-claims").option("--item <item-id>", "Recover only this explicitly selected item").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Audited recovery reason").option("--actor <actor>", "System recovery actor", "system:cli-recovery").option("--idempotency-key <key>", "Idempotency key").action(async (options) => {
|
|
2820
|
-
const { reclaimExpiredClaimsOperation } = await import("./service-
|
|
2846
|
+
const { reclaimExpiredClaimsOperation } = await import("./service-YJ3GLLWB.js");
|
|
2821
2847
|
printJson(await reclaimExpiredClaimsOperation(resolve25(process.cwd()), {
|
|
2822
2848
|
itemId: options.item,
|
|
2823
2849
|
expectedRevision: options.expectedRevision,
|
|
@@ -2827,15 +2853,15 @@ function operationCommand() {
|
|
|
2827
2853
|
}));
|
|
2828
2854
|
});
|
|
2829
2855
|
command.command("event <item-id>").requiredOption("--status <status>", "started, heartbeat, succeeded ou failed").requiredOption("--executor <executor-id>", "Executor externo").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Reason for the operation").option("--actor <actor>", "Identidade do actor", "agent:codex").option("--message <message>", "Mensagem do evento").option("--recovery <recovery>", "retry, release, handoff ou human").option("--error-code <code>", "C\xF3digo da falha").option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").action(async (itemId, options) => {
|
|
2830
|
-
const { recordExecutionEvent } = await import("./service-
|
|
2856
|
+
const { recordExecutionEvent } = await import("./service-YJ3GLLWB.js");
|
|
2831
2857
|
printJson(await recordExecutionEvent(resolve25(process.cwd()), { itemId, status: options.status, executorId: options.executor, expectedRevision: options.expectedRevision, reason: options.reason, actor: options.actor, message: options.message, recovery: options.recovery, errorCode: options.errorCode, idempotencyKey: options.idempotencyKey }));
|
|
2832
2858
|
});
|
|
2833
2859
|
command.command("claim <item-id>").requiredOption("--executor <executor-id>", "Executor externo").requiredOption("--capability <capability>", "Capability usada").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Reason for the operation").option("--actor <actor>", "Identidade do actor", "agent:codex").option("--ttl <minutes>", "TTL do claim em minutos", (value) => Number(value), 30).option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").action(async (itemId, options) => {
|
|
2834
|
-
const { claimOperation } = await import("./service-
|
|
2860
|
+
const { claimOperation } = await import("./service-YJ3GLLWB.js");
|
|
2835
2861
|
printJson(await claimOperation(resolve25(process.cwd()), { itemId, executorId: options.executor, capability: options.capability, expectedRevision: options.expectedRevision, reason: options.reason, actor: options.actor, ttlMinutes: options.ttl, idempotencyKey: options.idempotencyKey }));
|
|
2836
2862
|
});
|
|
2837
2863
|
command.command("link-item-spec <item-id>").requiredOption("--spec <spec-id>", "Existing spec ID under workspace data directory").requiredOption("--run <run-id>", "Selected Run ID").requiredOption("--executor <executor-id>", "Executor that owns the selected Run").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Reason for linking the spec").option("--actor <actor>", "Stage actor", "agent:codex").option("--idempotency-key <key>", "Idempotency key").action(async (itemId, options) => {
|
|
2838
|
-
const { linkItemSpecOperation } = await import("./service-
|
|
2864
|
+
const { linkItemSpecOperation } = await import("./service-YJ3GLLWB.js");
|
|
2839
2865
|
printJson(await linkItemSpecOperation(resolve25(process.cwd()), {
|
|
2840
2866
|
itemId,
|
|
2841
2867
|
specId: options.spec,
|
|
@@ -2848,44 +2874,44 @@ function operationCommand() {
|
|
|
2848
2874
|
}));
|
|
2849
2875
|
});
|
|
2850
2876
|
command.command("activate-work <item-id>").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Human prioritization reason").option("--actor <actor>", "Identidade humana", void 0).action(async (itemId, options) => {
|
|
2851
|
-
const actor =
|
|
2852
|
-
const { activateWorkOperation } = await import("./service-
|
|
2877
|
+
const actor = resolveCliActor(resolve25(process.cwd()), options.actor);
|
|
2878
|
+
const { activateWorkOperation } = await import("./service-YJ3GLLWB.js");
|
|
2853
2879
|
printJson(await activateWorkOperation(resolve25(process.cwd()), { itemId, expectedRevision: options.expectedRevision, reason: options.reason, actor }));
|
|
2854
2880
|
});
|
|
2855
2881
|
command.command("validate").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Reason for the operation").option("--item <item-id>", "Item alvo quando n\xE3o h\xE1 Run selecionada").option("--run <run-id>", "Seleciona o Run cuja dire\xE7\xE3o foi consultada").action(async (options) => {
|
|
2856
|
-
const { runValidationOperation } = await import("./service-
|
|
2882
|
+
const { runValidationOperation } = await import("./service-YJ3GLLWB.js");
|
|
2857
2883
|
printJson(await runValidationOperation(resolve25(process.cwd()), { ...options, itemId: options.item, runId: options.run }));
|
|
2858
2884
|
});
|
|
2859
2885
|
command.command("activity [item-id]").action((itemId) => printJson(activityOperation(resolve25(process.cwd()), itemId)));
|
|
2860
2886
|
command.command("gate-decision <item-id>").addOption(new Option("--decision <decision>", "approve, request-changes ou reject").choices(["approve", "request-changes", "reject"]).makeOptionMandatory()).requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Audited human decision reason").action(async (itemId, options) => {
|
|
2861
2887
|
const root = resolve25(process.cwd());
|
|
2862
|
-
const actor =
|
|
2888
|
+
const actor = resolveCliActor(root);
|
|
2863
2889
|
const details = { itemId, decision: options.decision, expectedRevision: options.expectedRevision, reason: options.reason };
|
|
2864
|
-
const proof = signLocalOperation(root, actor, "gate.decision", details);
|
|
2865
|
-
const { decideGateOperation } = await import("./service-
|
|
2890
|
+
const proof = actor.startsWith("human:") ? signLocalOperation(root, actor, "gate.decision", details) : void 0;
|
|
2891
|
+
const { decideGateOperation } = await import("./service-YJ3GLLWB.js");
|
|
2866
2892
|
printJson(await decideGateOperation(root, { ...details, actor, proof }));
|
|
2867
2893
|
});
|
|
2868
2894
|
command.command("evidence <item-id>").requiredOption("--executor <executor-id>", "Executor externo").requiredOption("--expected-revision <revision>", "Direction revision").requiredOption("--reason <reason>", "Reason").requiredOption("--kind <kind>", "diff, file, command, test ou artifact").requiredOption("--value <value>", "Valor/path").requiredOption("--source <source>", "Origem observada").option("--actor <actor>", "Actor", "agent:codex").option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").action(async (itemId, options) => {
|
|
2869
|
-
const { submitEvidenceOperation } = await import("./service-
|
|
2895
|
+
const { submitEvidenceOperation } = await import("./service-YJ3GLLWB.js");
|
|
2870
2896
|
printJson(await submitEvidenceOperation(resolve25(process.cwd()), { itemId, executorId: options.executor, expectedRevision: options.expectedRevision, reason: options.reason, actor: options.actor, evidence: [{ kind: options.kind, value: options.value, source: options.source }], idempotencyKey: options.idempotencyKey }));
|
|
2871
2897
|
});
|
|
2872
2898
|
command.command("handoff <item-id>").requiredOption("--to <actor>", "Destino").requiredOption("--executor <executor-id>", "Executor").requiredOption("--summary <summary>", "Resumo").requiredOption("--expected-revision <revision>", "Direction revision").requiredOption("--reason <reason>", "Reason").addOption(
|
|
2873
2899
|
new Option("--evidence <evidence>", "Evid\xEAncia verific\xE1vel do handoff").argParser(collectEvidence2).default([])
|
|
2874
2900
|
).option("--actor <actor>", "Actor", "agent:codex").option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").action(async (itemId, options) => {
|
|
2875
|
-
const { requestHandoffOperation: requestHandoffOperation2 } = await import("./service-
|
|
2901
|
+
const { requestHandoffOperation: requestHandoffOperation2 } = await import("./service-YJ3GLLWB.js");
|
|
2876
2902
|
printJson(await requestHandoffOperation2(resolve25(process.cwd()), { itemId, to: options.to, executorId: options.executor, summary: options.summary, evidence: options.evidence, expectedRevision: options.expectedRevision, reason: options.reason, actor: options.actor, idempotencyKey: options.idempotencyKey }));
|
|
2877
2903
|
});
|
|
2878
2904
|
command.command("complete-ac <ac-id>").requiredOption("--item <item-id>", "Explicit target item ID").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Reason for completing the criterion").option("--executor <executor-id>", "Executor que produziu a evid\xEAncia").option("--run <run-id>", "Run cuja dire\xE7\xE3o foi consultada").option("--actor <actor>", "Identidade do actor", "agent:codex").option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").addOption(
|
|
2879
2905
|
new Option("--evidence <evidence>", "Regression evidence").argParser(collectEvidence2).default([])
|
|
2880
2906
|
).action(
|
|
2881
2907
|
async (acId, options) => {
|
|
2882
|
-
const { completeAcOperation: completeAcOperation2 } = await import("./service-
|
|
2908
|
+
const { completeAcOperation: completeAcOperation2 } = await import("./service-YJ3GLLWB.js");
|
|
2883
2909
|
printJson(completeAcOperation2(resolve25(process.cwd()), { acId, itemId: options.item, executorId: options.executor, runId: options.run, ...options }));
|
|
2884
2910
|
}
|
|
2885
2911
|
);
|
|
2886
2912
|
command.command("request-transition <item-id>").requiredOption("--to <stage-id>", "Target stage ID").requiredOption("--expected-revision <revision>", "Direction revision returned by Letra").requiredOption("--reason <reason>", "Reason for requesting the transition").option("--actor <actor>", "Identidade do actor", "agent:codex").option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").action(
|
|
2887
2913
|
async (itemId, options) => {
|
|
2888
|
-
const { requestTransitionOperation } = await import("./service-
|
|
2914
|
+
const { requestTransitionOperation } = await import("./service-YJ3GLLWB.js");
|
|
2889
2915
|
printJson(
|
|
2890
2916
|
await requestTransitionOperation(resolve25(process.cwd()), {
|
|
2891
2917
|
itemId,
|
|
@@ -2899,15 +2925,15 @@ function operationCommand() {
|
|
|
2899
2925
|
}
|
|
2900
2926
|
);
|
|
2901
2927
|
command.command("passage <item-id>").requiredOption("--stage <stage-id>", "Configured destination stage").requiredOption("--to <actor>", "Configured destination role").requiredOption("--executor <executor-id>", "Source executor").requiredOption("--summary <summary>", "Handoff summary").requiredOption("--expected-revision <revision>", "Direction revision").requiredOption("--reason <reason>", "Reason").option("--run <run-id>", "Run cuja dire\xE7\xE3o foi consultada").addOption(new Option("--evidence <evidence>", "Verifiable evidence").argParser(collectEvidence2).default([])).option("--actor <actor>", "Source role", "agent:codex").option("--idempotency-key <key>", "Idempotency key").action(async (itemId, options) => {
|
|
2902
|
-
const { requestPassageOperation: requestPassageOperation2 } = await import("./service-
|
|
2928
|
+
const { requestPassageOperation: requestPassageOperation2 } = await import("./service-YJ3GLLWB.js");
|
|
2903
2929
|
printJson(await requestPassageOperation2(resolve25(process.cwd()), { itemId, targetStageId: options.stage, to: options.to, executorId: options.executor, runId: options.run, summary: options.summary, evidence: options.evidence, expectedRevision: options.expectedRevision, reason: options.reason, actor: options.actor, idempotencyKey: options.idempotencyKey }));
|
|
2904
2930
|
});
|
|
2905
2931
|
command.command("release <item-id>").requiredOption("--expected-revision <revision>", "Direction revision").requiredOption("--reason <reason>", "Reason for releasing the claim").option("--actor <actor>", "Actor", "agent:codex").option("--idempotency-key <key>", "Chave idempotente da opera\xE7\xE3o").action(async (itemId, options) => {
|
|
2906
|
-
const { releaseClaimOperation } = await import("./service-
|
|
2932
|
+
const { releaseClaimOperation } = await import("./service-YJ3GLLWB.js");
|
|
2907
2933
|
printJson(await releaseClaimOperation(resolve25(process.cwd()), { itemId, expectedRevision: options.expectedRevision, reason: options.reason, actor: options.actor, idempotencyKey: options.idempotencyKey }));
|
|
2908
2934
|
});
|
|
2909
2935
|
command.command("request-rework <item-id>").requiredOption("--expected-revision <revision>", "Direction revision").requiredOption("--reason <reason>", "Motivo objetivo do retrabalho").addOption(new Option("--ac <description>", "Crit\xE9rio novo a ser implementado").argParser(collectEvidence2).default([]).makeOptionMandatory()).option("--actor <actor>", "Reviewer que solicita o retrabalho", "reviewer").action(async (itemId, options) => {
|
|
2910
|
-
const { requestReworkOperation } = await import("./service-
|
|
2936
|
+
const { requestReworkOperation } = await import("./service-YJ3GLLWB.js");
|
|
2911
2937
|
printJson(await requestReworkOperation(resolve25(process.cwd()), {
|
|
2912
2938
|
itemId,
|
|
2913
2939
|
expectedRevision: options.expectedRevision,
|
|
@@ -3079,7 +3105,7 @@ async function init(targetPath, options) {
|
|
|
3079
3105
|
writeFileSync9(join10(root, LINK_FILE), `${workspaceDir}
|
|
3080
3106
|
`, "utf-8");
|
|
3081
3107
|
clearWorkspaceCache();
|
|
3082
|
-
const { regenerateWorkspaceAdapters } = await import("./sync-
|
|
3108
|
+
const { regenerateWorkspaceAdapters } = await import("./sync-553BP2FM.js");
|
|
3083
3109
|
const regenerated = regenerateWorkspaceAdapters(root);
|
|
3084
3110
|
for (const path of regenerated.conflicts) {
|
|
3085
3111
|
console.log(chalk22.yellow(` Arquivo de autoria humana preservado: ${path}`));
|
|
@@ -4893,7 +4919,7 @@ program.command("setup [path]").option("--port <number>", "Port for the web UI",
|
|
|
4893
4919
|
Starting web UI on port ${port}...
|
|
4894
4920
|
`);
|
|
4895
4921
|
const root = resolve34(process.cwd(), path ?? ".");
|
|
4896
|
-
const { FlowServer } = await import("./flow-serve-
|
|
4922
|
+
const { FlowServer } = await import("./flow-serve-AD4CFVJ4.js");
|
|
4897
4923
|
const server = new FlowServer(root, port);
|
|
4898
4924
|
try {
|
|
4899
4925
|
await server.start();
|
|
@@ -4936,7 +4962,7 @@ program.addCommand(directionCommand());
|
|
|
4936
4962
|
program.addCommand(mcpCommand());
|
|
4937
4963
|
program.addCommand(operationCommand());
|
|
4938
4964
|
program.addCommand(decisionCommand());
|
|
4939
|
-
program.command("push [path]").option("--dry-run", "Show what would be pushed without writing").description("Sync workspace artifacts to target repository").action((path, options) => import("./push-
|
|
4965
|
+
program.command("push [path]").option("--dry-run", "Show what would be pushed without writing").description("Sync workspace artifacts to target repository").action((path, options) => import("./push-OCAQ5SK3.js").then((m) => m.push(path, options)));
|
|
4940
4966
|
program.addCommand(flowCommand());
|
|
4941
4967
|
program.addCommand(focus_default());
|
|
4942
4968
|
program.addCommand(health_default());
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
runSecurityReviewOperation,
|
|
15
15
|
runValidationOperation,
|
|
16
16
|
submitEvidenceOperation
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5VGLNF7Q.js";
|
|
18
18
|
import {
|
|
19
19
|
assertOperationLevel,
|
|
20
20
|
createWorkflowDefinition,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
signLocalOperation,
|
|
37
37
|
updateWorkflowDraft,
|
|
38
38
|
validateWorkflowContent
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-U264XFAO.js";
|
|
40
40
|
import "./chunk-JMIC5NKB.js";
|
|
41
41
|
import {
|
|
42
42
|
getActiveEntries,
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
runValidationOperation,
|
|
26
26
|
submitEvidenceOperation,
|
|
27
27
|
updateItemOperation
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-5VGLNF7Q.js";
|
|
29
|
+
import "./chunk-U264XFAO.js";
|
|
30
30
|
import "./chunk-JMIC5NKB.js";
|
|
31
31
|
import "./chunk-42RST74I.js";
|
|
32
32
|
import "./chunk-LUPN3TRC.js";
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
syncNow,
|
|
6
6
|
sync_default,
|
|
7
7
|
validateFocus
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-EEIVVJK4.js";
|
|
9
|
+
import "./chunk-U264XFAO.js";
|
|
10
10
|
import "./chunk-JMIC5NKB.js";
|
|
11
11
|
import "./chunk-42RST74I.js";
|
|
12
12
|
import "./chunk-UMC5PDL2.js";
|