@subseam/mcp 0.4.34 → 0.4.37
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/main.js +57 -19
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -30597,11 +30597,26 @@ var definitionDraft = external_exports.object({
|
|
|
30597
30597
|
rung: external_exports.object({ disposition: external_exports.enum(["block", "warn", "off"]), means: external_exports.string() }).optional(),
|
|
30598
30598
|
conflicts: external_exports.literal("not checked")
|
|
30599
30599
|
});
|
|
30600
|
-
|
|
30601
|
-
|
|
30600
|
+
var draftAt = external_exports.discriminatedUnion("state", [
|
|
30601
|
+
external_exports.object({ state: external_exports.literal("current"), sha: external_exports.string(), ordinal: external_exports.number() }),
|
|
30602
|
+
external_exports.object({
|
|
30603
|
+
state: external_exports.literal("computing"),
|
|
30604
|
+
tipSha: external_exports.string(),
|
|
30605
|
+
tipOrdinal: external_exports.number(),
|
|
30606
|
+
banked: external_exports.object({ sha: external_exports.string(), ordinal: external_exports.number() }).nullable()
|
|
30607
|
+
})
|
|
30608
|
+
]);
|
|
30609
|
+
var sha8 = (sha) => sha.slice(0, 8);
|
|
30610
|
+
function draftAtLine(at) {
|
|
30611
|
+
if (at.state === "current") return `verdict at ${sha8(at.sha)} (the tip)`;
|
|
30612
|
+
return at.banked === null ? `computing at ${sha8(at.tipSha)}, no verdict banked yet` : `verdict at ${sha8(at.banked.sha)} (tip is ${sha8(at.tipSha)}, computing)`;
|
|
30613
|
+
}
|
|
30614
|
+
function notComputedLines(uncomputed, atTip) {
|
|
30615
|
+
const at = atTip ? "at tip" : "at that commit";
|
|
30616
|
+
if (uncomputed.length <= 5) return uncomputed.map((u) => ` ${at}, not computed: ${u.path} (${u.reason})`);
|
|
30602
30617
|
const byCause = /* @__PURE__ */ new Map();
|
|
30603
30618
|
for (const u of uncomputed) byCause.set(u.reason, [...byCause.get(u.reason) ?? [], u.path]);
|
|
30604
|
-
return [...byCause].map(([reason, paths]) => ` at
|
|
30619
|
+
return [...byCause].map(([reason, paths]) => ` ${at}, not computed: ${paths.length} file${paths.length === 1 ? "" : "s"} (${reason}), e.g. ${paths.slice(0, 3).join(", ")}`);
|
|
30605
30620
|
}
|
|
30606
30621
|
var FAILURES_SHOWN = 20;
|
|
30607
30622
|
var EXAMPLES_FAILING_SHOWN = 3;
|
|
@@ -30614,7 +30629,7 @@ function exampleLines(examples) {
|
|
|
30614
30629
|
...examples.wouldFail === null ? [] : [` would fail: ${where(examples.wouldFail)} ${examples.wouldFail.does} (no code does this yet)`]
|
|
30615
30630
|
];
|
|
30616
30631
|
}
|
|
30617
|
-
function renderDraft(d) {
|
|
30632
|
+
function renderDraft(d, atTip = true) {
|
|
30618
30633
|
const at = (c) => `${c.sha.slice(0, 9)} (${c.committedAt.slice(0, 10)})`;
|
|
30619
30634
|
const h = d.history;
|
|
30620
30635
|
const since = h === null || h.since === null ? "" : ` since ${at(h.since)}`;
|
|
@@ -30625,10 +30640,10 @@ function renderDraft(d) {
|
|
|
30625
30640
|
const shown = d.atTip.failures.slice(0, FAILURES_SHOWN).map((f) => `${f.path}:${f.line} ${f.cause}`);
|
|
30626
30641
|
const more = d.atTip.failures.length - shown.length;
|
|
30627
30642
|
const notEvaluated = d.atTip.notEvaluated ?? null;
|
|
30628
|
-
const tipAt = ` at tip ${d.atTip.sha.slice(0, 9)}`;
|
|
30643
|
+
const tipAt = ` at ${atTip ? "tip " : ""}${d.atTip.sha.slice(0, 9)}`;
|
|
30629
30644
|
const tip = d.atTip.failures.length > 0 ? `${tipAt}: ${d.atTip.failures.length} failing: ` + shown.join("; ") + (more > 0 ? `; \u2026 and ${more} more` : "") : notEvaluated !== null ? `${tipAt}: not evaluated (${notEvaluated})` : `${tipAt}: holds`;
|
|
30630
30645
|
const tipRest = d.atTip.failures.length > 0 && notEvaluated !== null ? [`${tipAt}, the rest was not evaluated (${notEvaluated})`] : [];
|
|
30631
|
-
const open7 = notComputedLines(d.atTip.uncomputed);
|
|
30646
|
+
const open7 = notComputedLines(d.atTip.uncomputed, atTip);
|
|
30632
30647
|
const rung = d.rung === void 0 ? [] : [` on approval, in force at ${d.rung.means}`];
|
|
30633
30648
|
if (typeof d.gated === "string") return [` ${d.statement}`, ` gated: ${d.gated} This definition is not evaluated.`, ...rung, ` conflicts: ${d.conflicts}`].join("\n");
|
|
30634
30649
|
return [` ${d.statement}`, ...exampleLines(d.examples), ` history: ${history}`, ...floor, tip, ...tipRest, ...open7, ...rung, ` conflicts: ${d.conflicts}`].join("\n");
|
|
@@ -30653,7 +30668,7 @@ var sayBody = external_exports.discriminatedUnion("ok", [
|
|
|
30653
30668
|
external_exports.object({ ok: external_exports.literal(true), canonicalHash: external_exports.string(), deferred: external_exports.tuple([external_exports.literal("bind"), external_exports.literal("capability"), external_exports.literal("strength")]) }),
|
|
30654
30669
|
external_exports.object({ ok: external_exports.literal(false), errors: compileErrors })
|
|
30655
30670
|
]);
|
|
30656
|
-
var
|
|
30671
|
+
var admittedBody = external_exports.discriminatedUnion("ok", [
|
|
30657
30672
|
external_exports.object({
|
|
30658
30673
|
ok: external_exports.literal(true),
|
|
30659
30674
|
definitionId: external_exports.string(),
|
|
@@ -30664,6 +30679,11 @@ var admitBody = external_exports.discriminatedUnion("ok", [
|
|
|
30664
30679
|
}),
|
|
30665
30680
|
external_exports.object({ ok: external_exports.literal(false), errors: compileErrors })
|
|
30666
30681
|
]);
|
|
30682
|
+
var admitJobBody = external_exports.discriminatedUnion("status", [
|
|
30683
|
+
external_exports.object({ jobId: external_exports.string(), status: external_exports.literal("running"), wait: external_exports.string().optional() }),
|
|
30684
|
+
external_exports.object({ jobId: external_exports.string(), status: external_exports.literal("failed"), error: external_exports.string() })
|
|
30685
|
+
]);
|
|
30686
|
+
var admitBody = external_exports.union([admittedBody, admitJobBody]);
|
|
30667
30687
|
var gapBody = external_exports.discriminatedUnion("kind", [
|
|
30668
30688
|
external_exports.object({ kind: external_exports.literal("recorded") }),
|
|
30669
30689
|
external_exports.object({ kind: external_exports.literal("known"), row: gapRow })
|
|
@@ -30769,11 +30789,13 @@ var input2 = external_exports.object({
|
|
|
30769
30789
|
}).optional(),
|
|
30770
30790
|
// Reads an authoring job a prior `nlIntent` call left running; takes no other arm beside it.
|
|
30771
30791
|
authorJobId: external_exports.string().min(1).optional(),
|
|
30792
|
+
// Reads an admission a prior `source` call left running; takes no other arm beside it.
|
|
30793
|
+
admitJobId: external_exports.string().min(1).optional(),
|
|
30772
30794
|
gap: external_exports.object({ construct: external_exports.string().min(1), witness: external_exports.string().min(1), issue: external_exports.number().int().positive() }).optional()
|
|
30773
30795
|
});
|
|
30774
30796
|
var defineTool = {
|
|
30775
30797
|
name: "define",
|
|
30776
|
-
description: "Write a definition into this tenant's governing corpus. Pass exactly one of `source` (the SDL definition object \u2014 deterministic, no LLM) or `nlIntent` (a natural-language note: your own agent decomposes it into slices by pull \u2014 the first call answers with the task to pull, then re-issue the same call unchanged \u2014 and each slice is authored through the CEGIS loop), plus `repo` (org-qualified) and optional `commit` (defaults to resolved tip). Pass `basis` on either arm: free text citing what the definition stood on \u2014 the source doc plus its section (there is no fixed vocabulary), or `capture-note:<id>` for a captured note, which also marks that note formalized. It is required in effect with `source`; an admission that cites nothing is refused. With `nlIntent` it defaults to the note, with the slice number appended. Authoring answers within about 45 s; if it is still queued or iterating it returns a job id: call `define` again with `authorJobId` to read it. `dry_run: true` with `source` validates against the live graph and admits NOTHING, returning per-gate errors with repair hints. `dry_run: true` with `source` and no `repo` answers only whether the language can say it (bind, capability and strength are deferred until a repo is named). `mine: {repo}` submits a whole-repo candidate mining pass instead (async \u2014 poll with `mine: {jobId}`). New versions land defaulted until approved. `gap: { construct, witness, issue }` records a construct the language cannot say yet (witness is the file:line that needed it) and admits nothing.",
|
|
30798
|
+
description: "Write a definition into this tenant's governing corpus. Pass exactly one of `source` (the SDL definition object \u2014 deterministic, no LLM) or `nlIntent` (a natural-language note: your own agent decomposes it into slices by pull \u2014 the first call answers with the task to pull, then re-issue the same call unchanged \u2014 and each slice is authored through the CEGIS loop), plus `repo` (org-qualified) and optional `commit` (defaults to resolved tip). Pass `basis` on either arm: free text citing what the definition stood on \u2014 the source doc plus its section (there is no fixed vocabulary), or `capture-note:<id>` for a captured note, which also marks that note formalized. It is required in effect with `source`; an admission that cites nothing is refused. With `nlIntent` it defaults to the note, with the slice number appended. Authoring answers within about 45 s; if it is still queued or iterating it returns a job id: call `define` again with `authorJobId` to read it. An admission of `source` answers the same way: a job id still running is read with `admitJobId`. `dry_run: true` with `source` validates against the live graph and admits NOTHING, returning per-gate errors with repair hints. `dry_run: true` with `source` and no `repo` answers only whether the language can say it (bind, capability and strength are deferred until a repo is named). `mine: {repo}` submits a whole-repo candidate mining pass instead (async \u2014 poll with `mine: {jobId}`). New versions land defaulted until approved. `gap: { construct, witness, issue }` records a construct the language cannot say yet (witness is the file:line that needed it) and admits nothing.",
|
|
30777
30799
|
capability: "define",
|
|
30778
30800
|
inputSchema: input2.shape,
|
|
30779
30801
|
async handler(raw, ctx) {
|
|
@@ -30804,6 +30826,12 @@ var defineTool = {
|
|
|
30804
30826
|
}
|
|
30805
30827
|
return authorMode({ authorJobId: args2.authorJobId }, ctx);
|
|
30806
30828
|
}
|
|
30829
|
+
if (args2.admitJobId !== void 0) {
|
|
30830
|
+
if (args2.source !== void 0 || args2.nlIntent !== void 0) {
|
|
30831
|
+
return { text: "define: `admitJobId` reads an admission already submitted and takes no `source` or `nlIntent` beside it \u2014 read the job, or submit a new definition, not both." };
|
|
30832
|
+
}
|
|
30833
|
+
return admitMode({ admitJobId: args2.admitJobId }, ctx);
|
|
30834
|
+
}
|
|
30807
30835
|
const hasSource = args2.source !== void 0;
|
|
30808
30836
|
const hasIntent = args2.nlIntent !== void 0;
|
|
30809
30837
|
if (hasSource === hasIntent) {
|
|
@@ -30838,8 +30866,8 @@ var defineTool = {
|
|
|
30838
30866
|
const wire = await ctx.gateway.invoke("define-compile", payload2);
|
|
30839
30867
|
const body2 = readBody(compileBody, wire, "define", "define-compile");
|
|
30840
30868
|
if (!body2.ok) return { text: body2.text };
|
|
30841
|
-
const
|
|
30842
|
-
return { text: renderCompile(
|
|
30869
|
+
const result = body2.value;
|
|
30870
|
+
return { text: renderCompile(result) };
|
|
30843
30871
|
}
|
|
30844
30872
|
const payload = {
|
|
30845
30873
|
repo: args2.repo,
|
|
@@ -30848,13 +30876,16 @@ var defineTool = {
|
|
|
30848
30876
|
...args2.createdBy !== void 0 ? { createdBy: args2.createdBy } : {},
|
|
30849
30877
|
...args2.basis !== void 0 ? { basis: args2.basis } : {}
|
|
30850
30878
|
};
|
|
30851
|
-
|
|
30852
|
-
const admitted = readBody(admitBody, rawAdmit, "define", "define-admit");
|
|
30853
|
-
if (!admitted.ok) return { text: admitted.text };
|
|
30854
|
-
const result = admitted.value;
|
|
30855
|
-
return { text: renderAdmit(result) };
|
|
30879
|
+
return admitMode(payload, ctx);
|
|
30856
30880
|
}
|
|
30857
30881
|
};
|
|
30882
|
+
async function admitMode(payload, ctx) {
|
|
30883
|
+
const rawAdmit = await ctx.gateway.invoke("define-admit", payload);
|
|
30884
|
+
const isJob = typeof rawAdmit === "object" && rawAdmit !== null && "status" in rawAdmit;
|
|
30885
|
+
const admitted = readBody(isJob ? admitJobBody : admittedBody, rawAdmit, "define", "define-admit");
|
|
30886
|
+
if (!admitted.ok) return { text: admitted.text };
|
|
30887
|
+
return { text: renderAdmit(admitted.value) };
|
|
30888
|
+
}
|
|
30858
30889
|
async function mineMode(mine, ctx) {
|
|
30859
30890
|
if (mine.jobId !== void 0 && mine.repo !== void 0) {
|
|
30860
30891
|
return { text: "define: `mine` takes EITHER `repo` (+ optional `commit`) to submit a pass OR `jobId` to poll one \u2014 not both." };
|
|
@@ -30933,6 +30964,9 @@ function renderSay(r) {
|
|
|
30933
30964
|
return "define (dry run): cannot say it: " + first.code + " at " + first.pointer + "\n" + errorLines(r.errors);
|
|
30934
30965
|
}
|
|
30935
30966
|
function renderAdmit(r) {
|
|
30967
|
+
if ("status" in r) {
|
|
30968
|
+
return r.status === "running" ? `define: admission job ${r.jobId} is still running (the gates and the first verdict). Call define with admitJobId: "${r.jobId}" to read it.` : `define: admission job ${r.jobId} failed: ${r.error}`;
|
|
30969
|
+
}
|
|
30936
30970
|
if (r.ok) {
|
|
30937
30971
|
const standing = r.changeClass === "strengthen" ? "carries its predecessor's standing forward" : r.changeClass === "initial" ? "defaulted until approved" : "re-enters review (defaulted until approved)";
|
|
30938
30972
|
const head = `define: admitted ${r.definitionId} v${r.version} [${r.changeClass}] \u2014 ${standing}.`;
|
|
@@ -31315,7 +31349,9 @@ var showBody = external_exports.discriminatedUnion("ok", [
|
|
|
31315
31349
|
bindings: external_exports.array(external_exports.object({ role: external_exports.string(), repo: external_exports.string(), anchorGrain: external_exports.string(), boundAtCommit: external_exports.string() })),
|
|
31316
31350
|
violations: external_exports.array(showViolation),
|
|
31317
31351
|
liveSuppressions: external_exports.array(showSuppression),
|
|
31318
|
-
draft: definitionDraft.nullable()
|
|
31352
|
+
draft: definitionDraft.nullable(),
|
|
31353
|
+
/** Absent from older servers. */
|
|
31354
|
+
draftAt: draftAt.nullable().optional()
|
|
31319
31355
|
}),
|
|
31320
31356
|
external_exports.object({ ok: external_exports.literal(false) })
|
|
31321
31357
|
]);
|
|
@@ -31369,8 +31405,10 @@ function renderObject(definitionId, r) {
|
|
|
31369
31405
|
out2.push("Bindings (current version):");
|
|
31370
31406
|
for (const [line, n] of counts) out2.push(` \u2022 ${line}${n > 1 ? ` (\xD7${n})` : ""}`);
|
|
31371
31407
|
}
|
|
31372
|
-
|
|
31373
|
-
${
|
|
31408
|
+
const at = r.draftAt ?? null;
|
|
31409
|
+
const atLine = at === null ? "" : ` ${draftAtLine(at)}`;
|
|
31410
|
+
out2.push(r.draft === null ? at === null ? "Draft (current version): none \u2014 the version has no subject binding, or canvas has published no version of its repo." : `Draft (current version): ${draftAtLine(at)}` : `Draft (current version):${atLine}
|
|
31411
|
+
${renderDraft(r.draft, at?.state !== "computing")}`);
|
|
31374
31412
|
if (r.violations.length === 0) {
|
|
31375
31413
|
out2.push("Standing violations: none on the ledger.");
|
|
31376
31414
|
} else {
|
|
@@ -48673,7 +48711,7 @@ var workReadTools = createWorkReadToolProviders({ capability: "work" });
|
|
|
48673
48711
|
var bundledProviders = [src_default2, src_default, tension_default, ...defineTools, ...decisionTools, ...captureTools, ...buildTools, secureTool, ...workTools, ...workReadTools];
|
|
48674
48712
|
|
|
48675
48713
|
// package.json
|
|
48676
|
-
var version2 = "0.4.
|
|
48714
|
+
var version2 = "0.4.37";
|
|
48677
48715
|
|
|
48678
48716
|
// src/server.ts
|
|
48679
48717
|
var SERVER_VERSION = version2;
|