@subseam/mcp 0.4.38 → 0.4.40

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.
Files changed (2) hide show
  1. package/dist/main.js +51 -12
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -20259,6 +20259,9 @@ var UNIT_KIND_ACTION = {
20259
20259
  [BUILD_PACKAGE_UNIT_KIND]: "build"
20260
20260
  };
20261
20261
 
20262
+ // ../execution-contract/src/workload/narrowed-units.ts
20263
+ init_esm_shims();
20264
+
20262
20265
  // ../execution-contract/src/report/artifact.ts
20263
20266
  init_esm_shims();
20264
20267
 
@@ -30660,10 +30663,15 @@ var compileError = external_exports.object({
30660
30663
  repair: external_exports.object({ hint: external_exports.string(), candidates: external_exports.array(external_exports.string()).optional() }).optional()
30661
30664
  });
30662
30665
  var compileErrors = external_exports.array(compileError);
30663
- var compileBody = external_exports.discriminatedUnion("ok", [
30666
+ var compiledBody = external_exports.discriminatedUnion("ok", [
30664
30667
  external_exports.object({ ok: external_exports.literal(true), boundAtCommit: external_exports.string(), draft: definitionDraft.optional() }),
30665
30668
  external_exports.object({ ok: external_exports.literal(false), errors: compileErrors })
30666
30669
  ]);
30670
+ var compileJobBody = external_exports.discriminatedUnion("status", [
30671
+ external_exports.object({ jobId: external_exports.string(), status: external_exports.literal("running"), wait: external_exports.string().optional() }),
30672
+ external_exports.object({ jobId: external_exports.string(), status: external_exports.literal("failed"), error: external_exports.string() })
30673
+ ]);
30674
+ var compileBody = external_exports.union([compiledBody, compileJobBody]);
30667
30675
  var sayBody = external_exports.discriminatedUnion("ok", [
30668
30676
  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")]) }),
30669
30677
  external_exports.object({ ok: external_exports.literal(false), errors: compileErrors })
@@ -30695,18 +30703,29 @@ var rungReport = external_exports.object({
30695
30703
  calls: external_exports.number(),
30696
30704
  outcome: external_exports.enum(["admitted", "exhausted"])
30697
30705
  });
30706
+ var cloverLeg = external_exports.object({ outcome: external_exports.enum(["agree", "disagree", "abstain"]), reasoning: external_exports.string() });
30707
+ var ourGap = external_exports.object({
30708
+ leg: external_exports.enum(["nlVsCompiled", "compiledVsWitness", "nlVsWitness"]),
30709
+ kind: external_exports.enum(["mutation-not-yet", "not-run-on-code"]),
30710
+ reason: external_exports.string()
30711
+ });
30698
30712
  var sliceResult = external_exports.union([
30699
30713
  external_exports.object({
30700
30714
  ok: external_exports.literal(true),
30701
30715
  definitionId: external_exports.string(),
30702
30716
  versionId: external_exports.string(),
30703
30717
  version: external_exports.number(),
30704
- clover: external_exports.object({ agreed: external_exports.boolean(), agreeCount: external_exports.number(), routedToHumanQueue: external_exports.boolean() }),
30718
+ clover: external_exports.object({
30719
+ agreed: external_exports.boolean(),
30720
+ agreeCount: external_exports.number(),
30721
+ // Optional so a core that predates per-leg outcomes still parses.
30722
+ legs: external_exports.object({ nlVsCompiled: cloverLeg, compiledVsWitness: cloverLeg, nlVsWitness: cloverLeg }).optional()
30723
+ }),
30705
30724
  iterations: external_exports.number(),
30706
30725
  rungs: external_exports.array(rungReport).optional(),
30707
30726
  draft: definitionDraft.optional()
30708
30727
  }),
30709
- external_exports.object({ ok: external_exports.literal(false), bestFailingCandidate: external_exports.unknown(), errors: compileErrors, iterations: external_exports.number(), rungs: external_exports.array(rungReport).optional() }),
30728
+ external_exports.object({ ok: external_exports.literal(false), bestFailingCandidate: external_exports.unknown(), errors: compileErrors, ourGaps: external_exports.array(ourGap).optional(), iterations: external_exports.number(), rungs: external_exports.array(rungReport).optional() }),
30710
30729
  external_exports.object({ ok: external_exports.literal(false), unavailable: external_exports.string() })
30711
30730
  ]);
30712
30731
  var noteResult = external_exports.discriminatedUnion("kind", [
@@ -30791,11 +30810,13 @@ var input2 = external_exports.object({
30791
30810
  authorJobId: external_exports.string().min(1).optional(),
30792
30811
  // Reads an admission a prior `source` call left running; takes no other arm beside it.
30793
30812
  admitJobId: external_exports.string().min(1).optional(),
30813
+ // Reads a dry-run compile a prior `source` + `dry_run` call left running; takes no other arm beside it.
30814
+ compileJobId: external_exports.string().min(1).optional(),
30794
30815
  gap: external_exports.object({ construct: external_exports.string().min(1), witness: external_exports.string().min(1), issue: external_exports.number().int().positive() }).optional()
30795
30816
  });
30796
30817
  var defineTool = {
30797
30818
  name: "define",
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.",
30819
+ 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`, and a `dry_run` still running with `compileJobId`. `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.",
30799
30820
  capability: "define",
30800
30821
  inputSchema: input2.shape,
30801
30822
  async handler(raw, ctx) {
@@ -30832,6 +30853,12 @@ var defineTool = {
30832
30853
  }
30833
30854
  return admitMode({ admitJobId: args2.admitJobId }, ctx);
30834
30855
  }
30856
+ if (args2.compileJobId !== void 0) {
30857
+ if (args2.source !== void 0 || args2.nlIntent !== void 0) {
30858
+ return { text: "define: `compileJobId` reads a dry run already submitted and takes no `source` or `nlIntent` beside it \u2014 read the job, or submit a new dry run, not both." };
30859
+ }
30860
+ return compileMode({ compileJobId: args2.compileJobId }, ctx);
30861
+ }
30835
30862
  const hasSource = args2.source !== void 0;
30836
30863
  const hasIntent = args2.nlIntent !== void 0;
30837
30864
  if (hasSource === hasIntent) {
@@ -30863,11 +30890,7 @@ var defineTool = {
30863
30890
  }
30864
30891
  if (args2.dry_run === true) {
30865
30892
  const payload2 = { repo: args2.repo, source: args2.source, ...args2.commit !== void 0 ? { commit: args2.commit } : {} };
30866
- const wire = await ctx.gateway.invoke("define-compile", payload2);
30867
- const body2 = readBody(compileBody, wire, "define", "define-compile");
30868
- if (!body2.ok) return { text: body2.text };
30869
- const result = body2.value;
30870
- return { text: renderCompile(result) };
30893
+ return compileMode(payload2, ctx);
30871
30894
  }
30872
30895
  const payload = {
30873
30896
  repo: args2.repo,
@@ -30879,6 +30902,13 @@ var defineTool = {
30879
30902
  return admitMode(payload, ctx);
30880
30903
  }
30881
30904
  };
30905
+ async function compileMode(payload, ctx) {
30906
+ const wire = await ctx.gateway.invoke("define-compile", payload);
30907
+ const isJob = typeof wire === "object" && wire !== null && "status" in wire;
30908
+ const body2 = readBody(isJob ? compileJobBody : compiledBody, wire, "define", "define-compile");
30909
+ if (!body2.ok) return { text: body2.text };
30910
+ return { text: renderCompile(body2.value) };
30911
+ }
30882
30912
  async function admitMode(payload, ctx) {
30883
30913
  const rawAdmit = await ctx.gateway.invoke("define-admit", payload);
30884
30914
  const isJob = typeof rawAdmit === "object" && rawAdmit !== null && "status" in rawAdmit;
@@ -30921,16 +30951,22 @@ function renderAuthorJob(r) {
30921
30951
  return `define: authoring job ${r.jobId} failed: ${r.error}`;
30922
30952
  }
30923
30953
  }
30954
+ function ourGapLines(gaps) {
30955
+ if (gaps === void 0 || gaps.length === 0) return "a check had no evidence to judge, which is a gap on the platform's side, not the author's.";
30956
+ return `each check below had no evidence because of a gap on the platform's side, not something to fix in the definition:
30957
+ ${gaps.map((g3) => ` \u2022 ${g3.leg} \u2014 ours: ${g3.kind}: ${g3.reason}`).join("\n")}`;
30958
+ }
30924
30959
  function renderSlice(r) {
30925
30960
  if ("unavailable" in r) return `could not be authored: ${r.unavailable}`;
30926
30961
  const rungs = r.rungs === void 0 || r.rungs.length === 0 ? "" : `
30927
30962
  Model calls: ${rungLine(r.rungs)}`;
30928
30963
  if (r.ok) {
30929
- const routed = r.clover.routedToHumanQueue ? " (routed to the human decision queue)" : "";
30930
- const head = `admitted definition ${r.definitionId} v${r.version} in ${r.iterations} iteration(s). Clover: ${r.clover.agreeCount} agreeing${r.clover.agreed ? "" : " \u2014 no consensus"}${routed}. It is defaulted until approved.`;
30964
+ const head = `admitted definition ${r.definitionId} v${r.version} in ${r.iterations} iteration(s). Clover: ${r.clover.agreeCount} agreeing${r.clover.agreed ? "" : " \u2014 no consensus"}. It is defaulted until approved.`;
30931
30965
  return (r.draft === void 0 ? head : `${head}
30932
30966
  ${renderDraft(r.draft)}`) + rungs;
30933
30967
  }
30968
+ if (r.errors.some((e) => e.code === "CLOVER_ABSTAINED")) return `not admitted: it needs a person. No check disagreed; ${ourGapLines(r.ourGaps)}
30969
+ ${errorLines(r.errors)}${rungs}`;
30934
30970
  return `could not converge in ${r.iterations} iteration(s). Best-failing candidate's errors \u2014
30935
30971
  ${errorLines(r.errors)}${rungs}`;
30936
30972
  }
@@ -30950,6 +30986,9 @@ ${r.dispatch.resumption}`;
30950
30986
  return lines.join("\n");
30951
30987
  }
30952
30988
  function renderCompile(r) {
30989
+ if ("status" in r) {
30990
+ return r.status === "running" ? `define (dry run): compile job ${r.jobId} is still running (the gates). Call define with compileJobId: "${r.jobId}" to read it.` : `define (dry run): compile job ${r.jobId} failed: ${r.error}`;
30991
+ }
30953
30992
  if (r.ok) {
30954
30993
  const head = "define (dry run): compiles clean, bound at " + r.boundAtCommit + ". Nothing was admitted \u2014 call again without `dry_run` to admit it.";
30955
30994
  return r.draft === void 0 ? head : `${head}
@@ -48728,7 +48767,7 @@ var workReadTools = createWorkReadToolProviders({ capability: "work" });
48728
48767
  var bundledProviders = [src_default2, src_default, tension_default, ...defineTools, ...decisionTools, ...captureTools, ...buildTools, secureTool, ...workTools, ...workReadTools];
48729
48768
 
48730
48769
  // package.json
48731
- var version2 = "0.4.38";
48770
+ var version2 = "0.4.40";
48732
48771
 
48733
48772
  // src/server.ts
48734
48773
  var SERVER_VERSION = version2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subseam/mcp",
3
- "version": "0.4.38",
3
+ "version": "0.4.40",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {