@letra-ai/cli 0.6.2 → 0.7.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-2GRNAFBQ.js +5305 -0
- package/dist/{chunk-MJ2QXNH6.js → chunk-42RST74I.js} +1 -1
- package/dist/chunk-HC24XMPZ.js +269 -0
- package/dist/chunk-LUPN3TRC.js +554 -0
- package/dist/{chunk-URUC6ZZP.js → chunk-MUCIMQAU.js} +1735 -861
- package/dist/chunk-POGWTSEA.js +125 -0
- package/dist/chunk-TNF7XTFG.js +6178 -0
- package/dist/{chunk-BKAUN5QH.js → chunk-UMC5PDL2.js} +227 -33
- package/dist/{chunk-6HSUVCTR.js → chunk-YAQ2TKSK.js} +82 -30
- package/dist/client/assets/index-C-6kWNFi.js +232 -0
- package/dist/client/assets/index-QV-zN0V8.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/fallback-CXCCKHBA.js +56 -0
- package/dist/flow-serve-LFILD3EV.js +19 -0
- package/dist/{generate-UPFERQMD.js → generate-3R7POT7L.js} +4 -5
- package/dist/harness/default/v0.1.0/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.0/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.1.1/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.1/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.1.2/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.2/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.1.3/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.3/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.2.0/executors/registry.yaml +17 -0
- package/dist/harness/default/v0.2.0/flows/flow-main.yaml +81 -3
- package/dist/harness/default/v0.2.0/gates/code-reviewed.yaml +1 -0
- package/dist/harness/default/v0.2.0/gates/human-approved.yaml +1 -0
- package/dist/harness/default/v0.2.0/gates/security-clear.yaml +1 -0
- package/dist/{health-record-YDVXEVLR.js → health-record-JO2ZTIMR.js} +2 -2
- package/dist/index.js +2284 -1168
- package/dist/{push-VJRSQGUD.js → push-2ZCQSOHF.js} +37 -49
- package/dist/server-WUYVNSH7.js +677 -0
- package/dist/service-SVEAXQBX.js +28 -0
- package/dist/service-TOBY3OHO.js +22 -0
- package/dist/service-USTAY5E3.js +62 -0
- package/dist/{session-log-WTQ5JBEN.js → session-log-X2Q4XKQN.js} +6 -2
- package/dist/specs-CQRB7LPA.js +21 -0
- package/dist/sync-LIVPQXEW.js +21 -0
- package/package.json +1 -1
- package/dist/chunk-DMOLJWWW.js +0 -3321
- package/dist/chunk-EDD55PWL.js +0 -119
- package/dist/chunk-H64RC3YS.js +0 -254
- package/dist/chunk-L6YKDTAQ.js +0 -275
- package/dist/chunk-OIHMDOIN.js +0 -1326
- package/dist/client/assets/index-EyRsq1SH.css +0 -1
- package/dist/client/assets/index-WfKR7Xp6.js +0 -232
- package/dist/fallback-MQLGS4KL.js +0 -46
- package/dist/flow-serve-G5MSSB3G.js +0 -18
- package/dist/focus-sync-3D3XWCTI.js +0 -17
- package/dist/server-P6GKRWDX.js +0 -423
- package/dist/service-2JN2KI4D.js +0 -29
- package/dist/sitrep-OKNZJICV.js +0 -16
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
resolveAgentDirection
|
|
4
|
-
} from "./chunk-DMOLJWWW.js";
|
|
5
|
-
import {
|
|
6
|
-
logEntry
|
|
7
|
-
} from "./chunk-BKAUN5QH.js";
|
|
8
|
-
import "./chunk-JMIC5NKB.js";
|
|
9
|
-
import "./chunk-EDD55PWL.js";
|
|
10
|
-
import "./chunk-MJ2QXNH6.js";
|
|
11
|
-
import "./chunk-6HSUVCTR.js";
|
|
12
|
-
import "./chunk-PDX44BCA.js";
|
|
13
|
-
|
|
14
|
-
// src/agent-direction/fallback.ts
|
|
15
|
-
var FALLBACK_WARNING = {
|
|
16
|
-
code: "LIVE_CONTEXT_UNAVAILABLE",
|
|
17
|
-
message: "O contexto vivo por MCP n\xE3o est\xE1 sendo usado. Execute letra direction --json antes de agir e novamente antes de concluir."
|
|
18
|
-
};
|
|
19
|
-
var degradedLogged = false;
|
|
20
|
-
function resolveFallbackDirection(root) {
|
|
21
|
-
const canonical = resolveAgentDirection(root);
|
|
22
|
-
const mode = canonical.mode === "unconfigured" ? "unconfigured" : "degraded";
|
|
23
|
-
if (mode === "degraded" && !degradedLogged) {
|
|
24
|
-
degradedLogged = true;
|
|
25
|
-
logEntry(root, "adapter_degraded", "MCP n\xE3o est\xE1 dispon\xEDvel; modo degradado ativado.", {
|
|
26
|
-
itemId: canonical.item?.id,
|
|
27
|
-
details: {
|
|
28
|
-
adapter: "codex",
|
|
29
|
-
mode: "degraded",
|
|
30
|
-
revision: canonical.revision,
|
|
31
|
-
outcome: "accepted"
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
...canonical,
|
|
37
|
-
mode,
|
|
38
|
-
warnings: [
|
|
39
|
-
...canonical.warnings.filter((warning) => warning.code !== FALLBACK_WARNING.code),
|
|
40
|
-
FALLBACK_WARNING
|
|
41
|
-
]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
resolveFallbackDirection
|
|
46
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
FlowServer,
|
|
4
|
-
flowServeAction
|
|
5
|
-
} from "./chunk-URUC6ZZP.js";
|
|
6
|
-
import "./chunk-H64RC3YS.js";
|
|
7
|
-
import "./chunk-L6YKDTAQ.js";
|
|
8
|
-
import "./chunk-DMOLJWWW.js";
|
|
9
|
-
import "./chunk-BKAUN5QH.js";
|
|
10
|
-
import "./chunk-JMIC5NKB.js";
|
|
11
|
-
import "./chunk-EDD55PWL.js";
|
|
12
|
-
import "./chunk-MJ2QXNH6.js";
|
|
13
|
-
import "./chunk-6HSUVCTR.js";
|
|
14
|
-
import "./chunk-PDX44BCA.js";
|
|
15
|
-
export {
|
|
16
|
-
FlowServer,
|
|
17
|
-
flowServeAction
|
|
18
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
clearFocusFile,
|
|
4
|
-
extractOutcome,
|
|
5
|
-
readFocusFile,
|
|
6
|
-
syncFocus,
|
|
7
|
-
writeFocusFile
|
|
8
|
-
} from "./chunk-EDD55PWL.js";
|
|
9
|
-
import "./chunk-6HSUVCTR.js";
|
|
10
|
-
import "./chunk-PDX44BCA.js";
|
|
11
|
-
export {
|
|
12
|
-
clearFocusFile,
|
|
13
|
-
extractOutcome,
|
|
14
|
-
readFocusFile,
|
|
15
|
-
syncFocus,
|
|
16
|
-
writeFocusFile
|
|
17
|
-
};
|
package/dist/server-P6GKRWDX.js
DELETED
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
activityOperation,
|
|
4
|
-
claimOperation,
|
|
5
|
-
completeAcOperation,
|
|
6
|
-
recordExecutionEvent,
|
|
7
|
-
requestHandoffOperation,
|
|
8
|
-
requestTransitionOperation,
|
|
9
|
-
runValidationOperation,
|
|
10
|
-
submitEvidenceOperation
|
|
11
|
-
} from "./chunk-OIHMDOIN.js";
|
|
12
|
-
import "./chunk-H64RC3YS.js";
|
|
13
|
-
import {
|
|
14
|
-
createWorkspaceBoundary,
|
|
15
|
-
loadHarnessForWorkflow,
|
|
16
|
-
loadWorkflow,
|
|
17
|
-
resolveActiveFlowFor,
|
|
18
|
-
resolveAgentDirection
|
|
19
|
-
} from "./chunk-DMOLJWWW.js";
|
|
20
|
-
import {
|
|
21
|
-
logEntry
|
|
22
|
-
} from "./chunk-BKAUN5QH.js";
|
|
23
|
-
import "./chunk-JMIC5NKB.js";
|
|
24
|
-
import "./chunk-EDD55PWL.js";
|
|
25
|
-
import {
|
|
26
|
-
getActiveEntries,
|
|
27
|
-
loadHealthRecord
|
|
28
|
-
} from "./chunk-MJ2QXNH6.js";
|
|
29
|
-
import {
|
|
30
|
-
getLetraDir2 as getLetraDir,
|
|
31
|
-
resolveWorkspaceRoot
|
|
32
|
-
} from "./chunk-6HSUVCTR.js";
|
|
33
|
-
import "./chunk-PDX44BCA.js";
|
|
34
|
-
|
|
35
|
-
// src/mcp/server.ts
|
|
36
|
-
import { existsSync, readFileSync } from "fs";
|
|
37
|
-
import { join, resolve } from "path";
|
|
38
|
-
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
39
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
40
|
-
import { z } from "zod";
|
|
41
|
-
function jsonText(value) {
|
|
42
|
-
return {
|
|
43
|
-
content: [{ type: "text", text: JSON.stringify(value, null, 2) }]
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function safeActiveSpec(root, boundary) {
|
|
47
|
-
const direction = resolveAgentDirection(root);
|
|
48
|
-
const name = direction.item?.spec ?? null;
|
|
49
|
-
if (!name || !/^[a-zA-Z0-9._-]+$/.test(name)) {
|
|
50
|
-
return { name, path: null, content: null };
|
|
51
|
-
}
|
|
52
|
-
const specsRoot = resolve(root, ".letra", "specs");
|
|
53
|
-
const specDir = resolve(specsRoot, name);
|
|
54
|
-
if (specDir !== specsRoot && !specDir.startsWith(`${specsRoot}\\`) && !specDir.startsWith(`${specsRoot}/`)) {
|
|
55
|
-
return { name, path: null, content: null };
|
|
56
|
-
}
|
|
57
|
-
const acceptancePath = join(specDir, "acceptance.md");
|
|
58
|
-
const specPath = join(specDir, "spec.md");
|
|
59
|
-
const selectedPath = existsSync(acceptancePath) ? acceptancePath : existsSync(specPath) ? specPath : null;
|
|
60
|
-
return {
|
|
61
|
-
name,
|
|
62
|
-
path: selectedPath ? boundary.assertPath(selectedPath).replace(/\\/g, "/") : null,
|
|
63
|
-
content: selectedPath ? readFileSync(boundary.assertPath(selectedPath), "utf-8") : null
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function gateIdFromRef(gateRef) {
|
|
67
|
-
return gateRef.replace(/^.*[\\/]/, "").replace(/\.ya?ml$/, "");
|
|
68
|
-
}
|
|
69
|
-
function loadHarnessManifest(root) {
|
|
70
|
-
return loadHarnessForWorkflow(root, loadWorkflow(root));
|
|
71
|
-
}
|
|
72
|
-
function collectGates(root) {
|
|
73
|
-
const harness = loadHarnessManifest(root);
|
|
74
|
-
return harness ? Object.values(harness.gates) : [];
|
|
75
|
-
}
|
|
76
|
-
function collectRoles(root) {
|
|
77
|
-
const resolution = resolveActiveFlowFor(root);
|
|
78
|
-
return [...resolution.flow?.roles ?? []];
|
|
79
|
-
}
|
|
80
|
-
function healthPayload(root) {
|
|
81
|
-
const record = loadHealthRecord(root);
|
|
82
|
-
return {
|
|
83
|
-
scannedAt: record.lastScanAt ?? null,
|
|
84
|
-
active: getActiveEntries(record)
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function resourceText(uri, text, mimeType = "application/json") {
|
|
88
|
-
return {
|
|
89
|
-
contents: [{ uri, mimeType, text }]
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function createLetraMcpServer(root) {
|
|
93
|
-
const resolution = resolveWorkspaceRoot(root);
|
|
94
|
-
const workspaceDir = resolution.workspaceDir;
|
|
95
|
-
const boundary = createWorkspaceBoundary(workspaceDir);
|
|
96
|
-
const workspaceRoot = boundary.root;
|
|
97
|
-
const auditedReads = /* @__PURE__ */ new Set();
|
|
98
|
-
const server = new McpServer({
|
|
99
|
-
name: "letra",
|
|
100
|
-
version: "0.5.3"
|
|
101
|
-
});
|
|
102
|
-
const readOnlyAnnotations = {
|
|
103
|
-
readOnlyHint: true,
|
|
104
|
-
destructiveHint: false,
|
|
105
|
-
idempotentHint: true,
|
|
106
|
-
openWorldHint: false
|
|
107
|
-
};
|
|
108
|
-
const verificationAnnotations = {
|
|
109
|
-
readOnlyHint: false,
|
|
110
|
-
destructiveHint: false,
|
|
111
|
-
idempotentHint: false,
|
|
112
|
-
openWorldHint: false
|
|
113
|
-
};
|
|
114
|
-
const mutationAnnotations = {
|
|
115
|
-
readOnlyHint: false,
|
|
116
|
-
destructiveHint: true,
|
|
117
|
-
idempotentHint: false,
|
|
118
|
-
openWorldHint: false
|
|
119
|
-
};
|
|
120
|
-
const expectedRevision = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
121
|
-
const reason = z.string().trim().min(1).max(500);
|
|
122
|
-
const clientIdentity = () => {
|
|
123
|
-
const client = server.server.getClientVersion();
|
|
124
|
-
return {
|
|
125
|
-
actor: client?.name ? `mcp:${client.name}` : "mcp:unknown",
|
|
126
|
-
clientVersion: client?.version ?? null
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
const auditRead = (resource, direction = resolveAgentDirection(workspaceRoot)) => {
|
|
130
|
-
const key = `${resource}:${direction.revision}`;
|
|
131
|
-
if (auditedReads.has(key)) return direction;
|
|
132
|
-
auditedReads.add(key);
|
|
133
|
-
const client = clientIdentity();
|
|
134
|
-
logEntry(workspaceRoot, "agent_direction_read", `MCP read: ${resource}`, {
|
|
135
|
-
itemId: direction.item?.id,
|
|
136
|
-
acId: direction.pendingAC?.id,
|
|
137
|
-
details: {
|
|
138
|
-
adapter: "codex",
|
|
139
|
-
by: client.actor,
|
|
140
|
-
clientVersion: client.clientVersion,
|
|
141
|
-
resource,
|
|
142
|
-
revision: direction.revision,
|
|
143
|
-
reason: "Consulta de contexto pelo transporte MCP.",
|
|
144
|
-
outcome: "accepted"
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return direction;
|
|
148
|
-
};
|
|
149
|
-
server.registerTool(
|
|
150
|
-
"get_direction",
|
|
151
|
-
{
|
|
152
|
-
description: "Retorna a dire\xE7\xE3o vigente e versionada do harness para o workspace atual.",
|
|
153
|
-
annotations: readOnlyAnnotations
|
|
154
|
-
},
|
|
155
|
-
async () => jsonText(auditRead("direction"))
|
|
156
|
-
);
|
|
157
|
-
server.registerTool(
|
|
158
|
-
"get_active_spec",
|
|
159
|
-
{
|
|
160
|
-
description: "Retorna a spec ativa e seus crit\xE9rios de aceita\xE7\xE3o.",
|
|
161
|
-
annotations: readOnlyAnnotations
|
|
162
|
-
},
|
|
163
|
-
async () => {
|
|
164
|
-
auditRead("active-spec");
|
|
165
|
-
return jsonText(safeActiveSpec(workspaceRoot, boundary));
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
server.registerTool(
|
|
169
|
-
"get_health",
|
|
170
|
-
{
|
|
171
|
-
description: "Retorna alertas operacionais ativos do workspace.",
|
|
172
|
-
annotations: readOnlyAnnotations
|
|
173
|
-
},
|
|
174
|
-
async () => {
|
|
175
|
-
auditRead("health");
|
|
176
|
-
return jsonText(healthPayload(workspaceRoot));
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
server.registerTool(
|
|
180
|
-
"validate",
|
|
181
|
-
{
|
|
182
|
-
description: "Valida o workspace pela implementa\xE7\xE3o can\xF4nica e registra o resultado.",
|
|
183
|
-
inputSchema: {
|
|
184
|
-
expectedRevision,
|
|
185
|
-
reason
|
|
186
|
-
},
|
|
187
|
-
annotations: verificationAnnotations
|
|
188
|
-
},
|
|
189
|
-
async (input) => jsonText(
|
|
190
|
-
await runValidationOperation(workspaceRoot, {
|
|
191
|
-
...input,
|
|
192
|
-
actor: clientIdentity().actor
|
|
193
|
-
})
|
|
194
|
-
)
|
|
195
|
-
);
|
|
196
|
-
server.registerTool(
|
|
197
|
-
"complete_ac",
|
|
198
|
-
{
|
|
199
|
-
description: "Conclui o AC vigente ap\xF3s validar revis\xE3o e evid\xEAncia de regress\xE3o.",
|
|
200
|
-
inputSchema: {
|
|
201
|
-
acId: z.string().regex(/^AC\d+(?:\.\d+)*$/i),
|
|
202
|
-
expectedRevision,
|
|
203
|
-
evidence: z.array(z.string().trim().min(1).max(500)).max(20),
|
|
204
|
-
reason
|
|
205
|
-
},
|
|
206
|
-
annotations: mutationAnnotations
|
|
207
|
-
},
|
|
208
|
-
async (input) => jsonText(
|
|
209
|
-
completeAcOperation(workspaceRoot, {
|
|
210
|
-
...input,
|
|
211
|
-
actor: clientIdentity().actor
|
|
212
|
-
})
|
|
213
|
-
)
|
|
214
|
-
);
|
|
215
|
-
server.registerTool(
|
|
216
|
-
"request_transition",
|
|
217
|
-
{
|
|
218
|
-
description: "Solicita transi\xE7\xE3o do item vigente sem contornar ACs, pap\xE9is ou gates.",
|
|
219
|
-
inputSchema: {
|
|
220
|
-
itemId: z.string().regex(/^ITEM-\d+$/i),
|
|
221
|
-
targetStageId: z.string().regex(/^[a-zA-Z0-9._-]+$/),
|
|
222
|
-
expectedRevision,
|
|
223
|
-
reason
|
|
224
|
-
},
|
|
225
|
-
annotations: mutationAnnotations
|
|
226
|
-
},
|
|
227
|
-
async (input) => jsonText(
|
|
228
|
-
await requestTransitionOperation(workspaceRoot, {
|
|
229
|
-
...input,
|
|
230
|
-
actor: clientIdentity().actor
|
|
231
|
-
})
|
|
232
|
-
)
|
|
233
|
-
);
|
|
234
|
-
server.registerTool("get_context", { description: "Retorna contexto operacional can\xF4nico.", annotations: readOnlyAnnotations }, async () => jsonText(auditRead("context")));
|
|
235
|
-
server.registerTool("get_activity", { description: "Retorna atividade operacional vigente.", inputSchema: { itemId: z.string().optional() }, annotations: readOnlyAnnotations }, async ({ itemId }) => jsonText(activityOperation(workspaceRoot, itemId)));
|
|
236
|
-
server.registerTool("claim", { description: "Solicita claim exclusivo.", inputSchema: { itemId: z.string(), executorId: z.string(), capability: z.string(), expectedRevision, reason, ttlMinutes: z.number().optional() }, annotations: mutationAnnotations }, async (input) => jsonText(await claimOperation(workspaceRoot, { ...input, actor: clientIdentity().actor })));
|
|
237
|
-
server.registerTool("execution_event", { description: "Registra started, heartbeat, succeeded ou failed.", inputSchema: { itemId: z.string(), status: z.enum(["started", "heartbeat", "succeeded", "failed"]), executorId: z.string(), expectedRevision, reason, message: z.string().optional(), recovery: z.enum(["retry", "release", "handoff", "human"]).optional(), errorCode: z.string().optional() }, annotations: mutationAnnotations }, async (input) => jsonText(await recordExecutionEvent(workspaceRoot, { ...input, actor: clientIdentity().actor })));
|
|
238
|
-
server.registerTool("submit_evidence", { description: "Registra evid\xEAncia estruturada confinada.", inputSchema: { itemId: z.string(), executorId: z.string(), expectedRevision, reason, evidence: z.array(z.object({ kind: z.enum(["diff", "file", "command", "test", "artifact"]), value: z.string(), source: z.string(), observedAt: z.string().optional(), sha256: z.string().optional(), exitCode: z.number().optional() })) }, annotations: mutationAnnotations }, async (input) => jsonText(await submitEvidenceOperation(workspaceRoot, { ...input, actor: clientIdentity().actor })));
|
|
239
|
-
server.registerTool("request_handoff", { description: "Solicita handoff at\xF4mico.", inputSchema: { itemId: z.string(), to: z.string(), executorId: z.string(), summary: z.string(), evidence: z.array(z.string()), expectedRevision, reason }, annotations: mutationAnnotations }, async (input) => jsonText(await requestHandoffOperation(workspaceRoot, { ...input, actor: clientIdentity().actor })));
|
|
240
|
-
server.registerResource(
|
|
241
|
-
"direction",
|
|
242
|
-
"letra://direction",
|
|
243
|
-
{ title: "Dire\xE7\xE3o vigente do harness", mimeType: "application/json" },
|
|
244
|
-
async () => resourceText("letra://direction", JSON.stringify(auditRead("direction"), null, 2))
|
|
245
|
-
);
|
|
246
|
-
server.registerResource(
|
|
247
|
-
"active-spec",
|
|
248
|
-
"letra://spec/active",
|
|
249
|
-
{ title: "Spec ativa", mimeType: "text/markdown" },
|
|
250
|
-
async () => resourceText(
|
|
251
|
-
"letra://spec/active",
|
|
252
|
-
(auditRead("active-spec"), safeActiveSpec(workspaceRoot, boundary).content ?? ""),
|
|
253
|
-
"text/markdown"
|
|
254
|
-
)
|
|
255
|
-
);
|
|
256
|
-
server.registerResource(
|
|
257
|
-
"constitution",
|
|
258
|
-
"letra://constitution",
|
|
259
|
-
{ title: "Constitui\xE7\xE3o do workspace", mimeType: "text/markdown" },
|
|
260
|
-
async () => {
|
|
261
|
-
auditRead("constitution");
|
|
262
|
-
const path = boundary.assertPath(join(getLetraDir(workspaceRoot), "constitution.md"));
|
|
263
|
-
const content = existsSync(path) ? readFileSync(path, "utf-8") : "";
|
|
264
|
-
logEntry(workspaceRoot, "constitution_read", "Constitution read via MCP", {
|
|
265
|
-
details: {
|
|
266
|
-
adapter: "mcp",
|
|
267
|
-
by: "mcp:constitution-resource",
|
|
268
|
-
available: existsSync(path),
|
|
269
|
-
version: content.match(/\*\*Version:\*\*\s*(.+)/)?.[1]?.trim() ?? null
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
return resourceText("letra://constitution", content, "text/markdown");
|
|
273
|
-
}
|
|
274
|
-
);
|
|
275
|
-
server.registerResource(
|
|
276
|
-
"health",
|
|
277
|
-
"letra://health",
|
|
278
|
-
{ title: "Sa\xFAde operacional", mimeType: "application/json" },
|
|
279
|
-
async () => resourceText(
|
|
280
|
-
"letra://health",
|
|
281
|
-
JSON.stringify((auditRead("health"), healthPayload(workspaceRoot)), null, 2)
|
|
282
|
-
)
|
|
283
|
-
);
|
|
284
|
-
const auditHarnessRead = (resource) => {
|
|
285
|
-
const direction = resolveAgentDirection(workspaceRoot);
|
|
286
|
-
const key = `harness:${resource}:${direction.revision}`;
|
|
287
|
-
if (auditedReads.has(key)) return;
|
|
288
|
-
auditedReads.add(key);
|
|
289
|
-
const client = clientIdentity();
|
|
290
|
-
logEntry(workspaceRoot, "agent_harness_read", `MCP harness read: ${resource}`, {
|
|
291
|
-
itemId: direction.item?.id,
|
|
292
|
-
acId: direction.pendingAC?.id,
|
|
293
|
-
details: {
|
|
294
|
-
adapter: "codex",
|
|
295
|
-
by: client.actor,
|
|
296
|
-
clientVersion: client.clientVersion,
|
|
297
|
-
resource,
|
|
298
|
-
revision: direction.revision,
|
|
299
|
-
outcome: "accepted"
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
server.registerResource(
|
|
304
|
-
"harness-templates",
|
|
305
|
-
"letra://harness/templates",
|
|
306
|
-
{ title: "Templates dispon\xEDveis no harness", mimeType: "application/json" },
|
|
307
|
-
async () => {
|
|
308
|
-
auditHarnessRead("templates");
|
|
309
|
-
const workflow = loadWorkflow(workspaceRoot);
|
|
310
|
-
const harness = loadHarnessForWorkflow(workspaceRoot, workflow);
|
|
311
|
-
const templateIds = harness ? Object.keys(harness.flows).sort() : [];
|
|
312
|
-
return resourceText("letra://harness/templates", JSON.stringify(templateIds, null, 2));
|
|
313
|
-
}
|
|
314
|
-
);
|
|
315
|
-
server.resource(
|
|
316
|
-
"harness-template",
|
|
317
|
-
new ResourceTemplate("letra://harness/templates/{flowId}", { list: void 0 }),
|
|
318
|
-
async (uri, variables) => {
|
|
319
|
-
const flowId = variables.flowId;
|
|
320
|
-
auditHarnessRead(`templates/${flowId}`);
|
|
321
|
-
const workflow = loadWorkflow(workspaceRoot);
|
|
322
|
-
const harness = loadHarnessForWorkflow(workspaceRoot, workflow);
|
|
323
|
-
if (!harness) {
|
|
324
|
-
return resourceText(uri.href, JSON.stringify({ error: "Harness not available" }));
|
|
325
|
-
}
|
|
326
|
-
const template = harness.flows[flowId];
|
|
327
|
-
if (!template) {
|
|
328
|
-
return resourceText(
|
|
329
|
-
uri.href,
|
|
330
|
-
JSON.stringify({ error: `Template "${flowId}" not found` })
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
const resolvedStages = template.stages.map((stage) => {
|
|
334
|
-
const gateId = stage.gate ? gateIdFromRef(stage.gate) : null;
|
|
335
|
-
return {
|
|
336
|
-
id: stage.id,
|
|
337
|
-
name: stage.name,
|
|
338
|
-
order: stage.order,
|
|
339
|
-
zone: stage.zone,
|
|
340
|
-
description: stage.description,
|
|
341
|
-
gate: gateId && harness.gates[gateId] ? harness.gates[gateId] : null,
|
|
342
|
-
roles: stage.agents.map((roleId) => harness.roles[roleId]).filter(Boolean),
|
|
343
|
-
phases: stage.phases,
|
|
344
|
-
activity: stage.activity
|
|
345
|
-
};
|
|
346
|
-
});
|
|
347
|
-
const policyId = template.defaultPolicy ? template.defaultPolicy.replace(/^.*[\\/]/, "").replace(/\.json$/, "") : null;
|
|
348
|
-
return resourceText(
|
|
349
|
-
uri.href,
|
|
350
|
-
JSON.stringify(
|
|
351
|
-
{
|
|
352
|
-
id: template.id,
|
|
353
|
-
version: template.version,
|
|
354
|
-
name: template.name,
|
|
355
|
-
description: template.description,
|
|
356
|
-
defaultPolicy: template.defaultPolicy,
|
|
357
|
-
stages: resolvedStages,
|
|
358
|
-
gates: Object.values(harness.gates),
|
|
359
|
-
roles: Object.values(harness.roles),
|
|
360
|
-
policy: policyId && harness.policies[policyId] ? harness.policies[policyId] : null
|
|
361
|
-
},
|
|
362
|
-
null,
|
|
363
|
-
2
|
|
364
|
-
)
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
);
|
|
368
|
-
server.registerResource(
|
|
369
|
-
"harness-gates",
|
|
370
|
-
"letra://harness/gates",
|
|
371
|
-
{ title: "Gates do harness", mimeType: "application/json" },
|
|
372
|
-
async () => {
|
|
373
|
-
auditHarnessRead("gates");
|
|
374
|
-
return resourceText(
|
|
375
|
-
"letra://harness/gates",
|
|
376
|
-
JSON.stringify(collectGates(workspaceRoot), null, 2)
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
server.registerResource(
|
|
381
|
-
"harness-roles",
|
|
382
|
-
"letra://harness/roles",
|
|
383
|
-
{ title: "Roles do harness", mimeType: "application/json" },
|
|
384
|
-
async () => {
|
|
385
|
-
auditHarnessRead("roles");
|
|
386
|
-
return resourceText(
|
|
387
|
-
"letra://harness/roles",
|
|
388
|
-
JSON.stringify(collectRoles(workspaceRoot), null, 2)
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
);
|
|
392
|
-
server.registerTool(
|
|
393
|
-
"list_gates",
|
|
394
|
-
{
|
|
395
|
-
description: "Lista todos os gates do template ativo do harness.",
|
|
396
|
-
annotations: readOnlyAnnotations
|
|
397
|
-
},
|
|
398
|
-
async () => {
|
|
399
|
-
auditHarnessRead("gates");
|
|
400
|
-
return jsonText(collectGates(workspaceRoot));
|
|
401
|
-
}
|
|
402
|
-
);
|
|
403
|
-
server.registerTool(
|
|
404
|
-
"list_roles",
|
|
405
|
-
{
|
|
406
|
-
description: "Lista todos os roles do template ativo do harness.",
|
|
407
|
-
annotations: readOnlyAnnotations
|
|
408
|
-
},
|
|
409
|
-
async () => {
|
|
410
|
-
auditHarnessRead("roles");
|
|
411
|
-
return jsonText(collectRoles(workspaceRoot));
|
|
412
|
-
}
|
|
413
|
-
);
|
|
414
|
-
return server;
|
|
415
|
-
}
|
|
416
|
-
async function startLetraMcpServer(root) {
|
|
417
|
-
const server = createLetraMcpServer(root);
|
|
418
|
-
await server.connect(new StdioServerTransport());
|
|
419
|
-
}
|
|
420
|
-
export {
|
|
421
|
-
createLetraMcpServer,
|
|
422
|
-
startLetraMcpServer
|
|
423
|
-
};
|
package/dist/service-2JN2KI4D.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
activityOperation,
|
|
4
|
-
claimOperation,
|
|
5
|
-
completeAcOperation,
|
|
6
|
-
recordExecutionEvent,
|
|
7
|
-
requestHandoffOperation,
|
|
8
|
-
requestTransitionOperation,
|
|
9
|
-
runValidationOperation,
|
|
10
|
-
submitEvidenceOperation
|
|
11
|
-
} from "./chunk-OIHMDOIN.js";
|
|
12
|
-
import "./chunk-H64RC3YS.js";
|
|
13
|
-
import "./chunk-DMOLJWWW.js";
|
|
14
|
-
import "./chunk-BKAUN5QH.js";
|
|
15
|
-
import "./chunk-JMIC5NKB.js";
|
|
16
|
-
import "./chunk-EDD55PWL.js";
|
|
17
|
-
import "./chunk-MJ2QXNH6.js";
|
|
18
|
-
import "./chunk-6HSUVCTR.js";
|
|
19
|
-
import "./chunk-PDX44BCA.js";
|
|
20
|
-
export {
|
|
21
|
-
activityOperation,
|
|
22
|
-
claimOperation,
|
|
23
|
-
completeAcOperation,
|
|
24
|
-
recordExecutionEvent,
|
|
25
|
-
requestHandoffOperation,
|
|
26
|
-
requestTransitionOperation,
|
|
27
|
-
runValidationOperation,
|
|
28
|
-
submitEvidenceOperation
|
|
29
|
-
};
|
package/dist/sitrep-OKNZJICV.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
sitrep,
|
|
4
|
-
sitrep_default
|
|
5
|
-
} from "./chunk-L6YKDTAQ.js";
|
|
6
|
-
import "./chunk-DMOLJWWW.js";
|
|
7
|
-
import "./chunk-BKAUN5QH.js";
|
|
8
|
-
import "./chunk-JMIC5NKB.js";
|
|
9
|
-
import "./chunk-EDD55PWL.js";
|
|
10
|
-
import "./chunk-MJ2QXNH6.js";
|
|
11
|
-
import "./chunk-6HSUVCTR.js";
|
|
12
|
-
import "./chunk-PDX44BCA.js";
|
|
13
|
-
export {
|
|
14
|
-
sitrep_default as default,
|
|
15
|
-
sitrep
|
|
16
|
-
};
|