@thedeck/mcp 0.1.6 → 0.1.8

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 (3) hide show
  1. package/dist/cli.js +29 -11
  2. package/dist/index.js +59 -16
  3. package/package.json +38 -38
package/dist/cli.js CHANGED
@@ -331,18 +331,13 @@ var scenarioSchema = z.object({
331
331
  expected: z.string().trim().min(1).max(2e3)
332
332
  });
333
333
  // ../shared/src/schemas/entry.ts
334
- var ENTRY_UPLOAD_MAX_BYTES = 104857600;
335
334
  var DEMO_MAX_BYTES = 209715200;
336
335
  var SETUP_NOTES_MAX = 1e4;
337
336
  var identityKindSchema = z.enum(["username", "tag"]);
338
- var entrySourceSchema = z.discriminatedUnion("kind", [z.object({
339
- kind: z.literal("upload"),
340
- fileName: z.string().trim().min(1).max(255).regex(/\.zip$/i),
341
- size: z.number().int().positive().max(ENTRY_UPLOAD_MAX_BYTES)
342
- }), z.object({
343
- kind: z.literal("repo"),
344
- url: z.url({ protocol: /^https$/ })
345
- })]);
337
+ var entrySourceSchema = z.object({
338
+ kind: z.literal("github"),
339
+ commitSha: z.string().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/)
340
+ });
346
341
  var entryDemoSchema = z.object({
347
342
  fileName: z.string().trim().min(1).max(255),
348
343
  size: z.number().int().positive().max(DEMO_MAX_BYTES),
@@ -358,6 +353,13 @@ z.object({
358
353
  rightsConfirmed: z.literal(true)
359
354
  });
360
355
  z.object({
356
+ phase: z.enum([
357
+ "github",
358
+ "code",
359
+ "sandbox",
360
+ "tests",
361
+ "scan"
362
+ ]).optional(),
361
363
  sampleRun: z.number().int().nonnegative(),
362
364
  hiddenRun: z.number().int().nonnegative(),
363
365
  scan: z.enum([
@@ -606,8 +608,10 @@ var exampleCopyRef = z.object({
606
608
  pair: z.number().int().positive(),
607
609
  role: z.enum(["input", "expected"])
608
610
  }).describe("An example copy already sent with deck.add_example_copy, named by its pair and role, in place of inline text.");
611
+ var DESCRIBE_TEST = "every test needs a description of at most 300 characters: one or two plain sentences on what the poster is looking for in that case, shown to a builder whose entry fails it, never the input, the expected output or anything that gives the answer away";
609
612
  var proposedTest = z.object({
610
613
  name: z.string().trim().min(1),
614
+ description: z.string({ error: DESCRIBE_TEST }).trim().min(1, { error: DESCRIBE_TEST }).max(300, { error: DESCRIBE_TEST }).describe("One or two plain sentences on what the poster is looking for in this case, at most 300 characters. A builder whose entry fails the test reads it; never the input, the expected output or anything that gives the answer away."),
611
615
  kind: z.enum(["sample", "hidden"]),
612
616
  input: z.union([z.string(), exampleCopyRef]).describe("The input as text, or an example copy by its pair and role. For a large input, send the file once with deck.add_example_copy (hidden unless the person shows it) and name it here instead of writing it out. When that example’s input is several files, the program gets a folder holding them."),
613
617
  expected: z.union([z.string(), exampleCopyRef]).describe("The expected output as text, or an example copy by its pair and role. For outcome fails_cleanly, a short note of why the input is bad; it is shown to the person, not compared."),
@@ -855,11 +859,13 @@ var isDeckErrorCode = (code) => DECK_ERROR_CODES.includes(code);
855
859
  var DeckError = class extends Error {
856
860
  code;
857
861
  waitsOnPerson;
862
+ page;
858
863
  constructor(code, message, options) {
859
864
  super(message ?? code, options);
860
865
  this.name = "DeckError";
861
866
  this.code = code;
862
867
  this.waitsOnPerson = options?.waitsOnPerson === true;
868
+ this.page = options?.page;
863
869
  }
864
870
  };
865
871
  var toolCall = (name) => ({
@@ -1115,6 +1121,9 @@ async function readBody(res) {
1115
1121
  throw new DeckError("UNAVAILABLE", `The Deck answered ${res.status} without JSON`, { cause: err });
1116
1122
  }
1117
1123
  }
1124
+ function deckPage(page, deckUrl) {
1125
+ return typeof page === "string" && URL.canParse(page) && new URL(page).origin === new URL(deckUrl).origin ? page : void 0;
1126
+ }
1118
1127
  function createRemoteBackend(options) {
1119
1128
  const fetchFn = options.fetchFn ?? fetch;
1120
1129
  async function post(call, body, fresh) {
@@ -1139,7 +1148,7 @@ function createRemoteBackend(options) {
1139
1148
  let res = await post(name, body, false);
1140
1149
  if (res.status === 401) res = await post(name, body, true);
1141
1150
  const json = await readBody(res);
1142
- if (json.ok !== true) throw new DeckError(isDeckErrorCode(json.code) ? json.code : "UNAVAILABLE", typeof json.message === "string" ? json.message : `The Deck refused ${path} (${res.status})`);
1151
+ if (json.ok !== true) throw new DeckError(isDeckErrorCode(json.code) ? json.code : "UNAVAILABLE", typeof json.message === "string" ? json.message : `The Deck refused ${path} (${res.status})`, { page: deckPage(json.page, options.deckUrl) });
1143
1152
  const parsed = output.safeParse(json.data);
1144
1153
  if (!parsed.success) throw new DeckError("UNAVAILABLE", `The Deck's answer to ${path} did not match the tool contract`, { cause: parsed.error });
1145
1154
  return parsed.data;
@@ -1240,6 +1249,7 @@ async function stageInputs(tests) {
1240
1249
  }));
1241
1250
  return dir;
1242
1251
  }
1252
+ var resultOf = (passed) => passed ? "passed" : "failed";
1243
1253
  function groupFailures(failed) {
1244
1254
  const counts = /* @__PURE__ */ new Map();
1245
1255
  for (const c of failed) counts.set(c, (counts.get(c) ?? 0) + 1);
@@ -1289,6 +1299,7 @@ async function runTests(options) {
1289
1299
  hiddenTotal: ordered.filter((t) => t.kind === "hidden").length
1290
1300
  };
1291
1301
  const failed = [];
1302
+ const finished = {};
1292
1303
  await sandbox.upload(root, ENTRY_DIR);
1293
1304
  const staged = await stageInputs(ordered);
1294
1305
  let timedOut = false;
@@ -1303,6 +1314,7 @@ async function runTests(options) {
1303
1314
  timedOut = true;
1304
1315
  break;
1305
1316
  }
1317
+ finished[test.id] = resultOf(outcome.passed);
1306
1318
  if (test.kind === "sample") {
1307
1319
  counts.sampleRun++;
1308
1320
  if (outcome.passed) counts.samplePassed++;
@@ -1311,7 +1323,7 @@ async function runTests(options) {
1311
1323
  if (outcome.passed) counts.hiddenPassed++;
1312
1324
  else failed.push(test.category);
1313
1325
  }
1314
- options.onStep({ ...counts });
1326
+ options.onStep({ ...counts }, { ...finished });
1315
1327
  }
1316
1328
  } finally {
1317
1329
  await rm(staged, {
@@ -1319,9 +1331,14 @@ async function runTests(options) {
1319
1331
  force: true
1320
1332
  });
1321
1333
  }
1334
+ const results = {
1335
+ ...Object.fromEntries(ordered.map((t) => [t.id, "not_run"])),
1336
+ ...finished
1337
+ };
1322
1338
  return {
1323
1339
  ...counts,
1324
1340
  failed: groupFailures(failed),
1341
+ results,
1325
1342
  timedOut
1326
1343
  };
1327
1344
  }
@@ -5226,6 +5243,7 @@ async function stageKit(kit, dir) {
5226
5243
  if (test.input_folder) await unpack(given, inputFile);
5227
5244
  await writeFile(expectedFile, Buffer.from(test.expected, "base64"));
5228
5245
  tests.push({
5246
+ id: String(i),
5229
5247
  kind: "sample",
5230
5248
  category: null,
5231
5249
  inputFile,
package/dist/index.js CHANGED
@@ -349,18 +349,13 @@ var scenarioSchema = z.object({
349
349
  expected: z.string().trim().min(1).max(2e3)
350
350
  });
351
351
  // ../shared/src/schemas/entry.ts
352
- var ENTRY_UPLOAD_MAX_BYTES = 104857600;
353
352
  var DEMO_MAX_BYTES = 209715200;
354
353
  var SETUP_NOTES_MAX = 1e4;
355
354
  var identityKindSchema = z.enum(["username", "tag"]);
356
- var entrySourceSchema = z.discriminatedUnion("kind", [z.object({
357
- kind: z.literal("upload"),
358
- fileName: z.string().trim().min(1).max(255).regex(/\.zip$/i),
359
- size: z.number().int().positive().max(ENTRY_UPLOAD_MAX_BYTES)
360
- }), z.object({
361
- kind: z.literal("repo"),
362
- url: z.url({ protocol: /^https$/ })
363
- })]);
355
+ var entrySourceSchema = z.object({
356
+ kind: z.literal("github"),
357
+ commitSha: z.string().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/)
358
+ });
364
359
  var entryDemoSchema = z.object({
365
360
  fileName: z.string().trim().min(1).max(255),
366
361
  size: z.number().int().positive().max(DEMO_MAX_BYTES),
@@ -376,6 +371,13 @@ z.object({
376
371
  rightsConfirmed: z.literal(true)
377
372
  });
378
373
  z.object({
374
+ phase: z.enum([
375
+ "github",
376
+ "code",
377
+ "sandbox",
378
+ "tests",
379
+ "scan"
380
+ ]).optional(),
379
381
  sampleRun: z.number().int().nonnegative(),
380
382
  hiddenRun: z.number().int().nonnegative(),
381
383
  scan: z.enum([
@@ -627,8 +629,10 @@ var exampleCopyRef = z.object({
627
629
  pair: z.number().int().positive(),
628
630
  role: z.enum(["input", "expected"])
629
631
  }).describe("An example copy already sent with deck.add_example_copy, named by its pair and role, in place of inline text.");
632
+ var DESCRIBE_TEST = "every test needs a description of at most 300 characters: one or two plain sentences on what the poster is looking for in that case, shown to a builder whose entry fails it, never the input, the expected output or anything that gives the answer away";
630
633
  var proposedTest = z.object({
631
634
  name: z.string().trim().min(1),
635
+ description: z.string({ error: DESCRIBE_TEST }).trim().min(1, { error: DESCRIBE_TEST }).max(300, { error: DESCRIBE_TEST }).describe("One or two plain sentences on what the poster is looking for in this case, at most 300 characters. A builder whose entry fails the test reads it; never the input, the expected output or anything that gives the answer away."),
632
636
  kind: z.enum(["sample", "hidden"]),
633
637
  input: z.union([z.string(), exampleCopyRef]).describe("The input as text, or an example copy by its pair and role. For a large input, send the file once with deck.add_example_copy (hidden unless the person shows it) and name it here instead of writing it out. When that example’s input is several files, the program gets a folder holding them."),
634
638
  expected: z.union([z.string(), exampleCopyRef]).describe("The expected output as text, or an example copy by its pair and role. For outcome fails_cleanly, a short note of why the input is bad; it is shown to the person, not compared."),
@@ -876,11 +880,13 @@ var isDeckErrorCode = (code) => DECK_ERROR_CODES.includes(code);
876
880
  var DeckError = class extends Error {
877
881
  code;
878
882
  waitsOnPerson;
883
+ page;
879
884
  constructor(code, message, options) {
880
885
  super(message ?? code, options);
881
886
  this.name = "DeckError";
882
887
  this.code = code;
883
888
  this.waitsOnPerson = options?.waitsOnPerson === true;
889
+ this.page = options?.page;
884
890
  }
885
891
  };
886
892
  var toolCall = (name) => ({
@@ -1150,6 +1156,9 @@ async function readBody(res) {
1150
1156
  throw new DeckError("UNAVAILABLE", `The Deck answered ${res.status} without JSON`, { cause: err });
1151
1157
  }
1152
1158
  }
1159
+ function deckPage(page, deckUrl) {
1160
+ return typeof page === "string" && URL.canParse(page) && new URL(page).origin === new URL(deckUrl).origin ? page : void 0;
1161
+ }
1153
1162
  function createRemoteBackend(options) {
1154
1163
  const fetchFn = options.fetchFn ?? fetch;
1155
1164
  async function post(call, body, fresh) {
@@ -1174,7 +1183,7 @@ function createRemoteBackend(options) {
1174
1183
  let res = await post(name, body, false);
1175
1184
  if (res.status === 401) res = await post(name, body, true);
1176
1185
  const json = await readBody(res);
1177
- if (json.ok !== true) throw new DeckError(isDeckErrorCode(json.code) ? json.code : "UNAVAILABLE", typeof json.message === "string" ? json.message : `The Deck refused ${path} (${res.status})`);
1186
+ if (json.ok !== true) throw new DeckError(isDeckErrorCode(json.code) ? json.code : "UNAVAILABLE", typeof json.message === "string" ? json.message : `The Deck refused ${path} (${res.status})`, { page: deckPage(json.page, options.deckUrl) });
1178
1187
  const parsed = output.safeParse(json.data);
1179
1188
  if (!parsed.success) throw new DeckError("UNAVAILABLE", `The Deck's answer to ${path} did not match the tool contract`, { cause: parsed.error });
1180
1189
  return parsed.data;
@@ -1193,9 +1202,33 @@ function withAgentClient(backend, client) {
1193
1202
  }
1194
1203
  };
1195
1204
  }
1205
+ var PAGE_AGAIN_MS = 6e5;
1206
+ function withPages(backend, open, now = Date.now) {
1207
+ const opened = /* @__PURE__ */ new Map();
1208
+ async function openPage(err) {
1209
+ if (!(err instanceof DeckError) || !err.page) throw err;
1210
+ const page = err.page;
1211
+ const last = opened.get(page);
1212
+ if (last !== void 0 && now() - last < PAGE_AGAIN_MS) throw err;
1213
+ opened.set(page, now());
1214
+ try {
1215
+ await open(page);
1216
+ } catch (openErr) {
1217
+ console.error("[thedeck-mcp] could not open a browser for the page", openErr);
1218
+ opened.delete(page);
1219
+ throw err;
1220
+ }
1221
+ throw new DeckError(err.code, `${err.message} The page is now open in the person’s browser.`, {
1222
+ cause: err,
1223
+ page,
1224
+ waitsOnPerson: err.waitsOnPerson
1225
+ });
1226
+ }
1227
+ return Object.fromEntries(BACKEND_CALLS.map((name) => [name, (input) => backend[name](input).catch(openPage)]));
1228
+ }
1196
1229
  var package_default = {
1197
1230
  name: "@thedeck/mcp",
1198
- version: "0.1.6",
1231
+ version: "0.1.8",
1199
1232
  type: "module",
1200
1233
  bin: {
1201
1234
  "mcp": "dist/index.js",
@@ -1494,7 +1527,7 @@ var POSTING_STEPS = [
1494
1527
  "2. Describe concrete scenarios back to them (\"when X comes in, it should do Y\") and ask whether that is what they want. Revise until they confirm.",
1495
1528
  "3. Go through the details one question at a time: what comes in, what should come out, the file formats, what counts as right, and any constraints. Sort each requirement as you go. The tests check what has one right answer: the program runs, produces what the brief measurably asks for, refuses bad input and passes the security scan. The person judges quality themselves, among the entries that pass. Tell them which requirements the tests check and which they will judge themselves, and put the ones they will judge in the brief’s judging notes.",
1496
1529
  "4. Ask for the end date: the last day builders can enter, 5 to 60 days from today. Confirm the person’s time zone with them; never assume it. Entries close at 23:59 on that date in their time zone. Then save the draft with deck.post_draft, with the confirmed scenarios. When the person’s specification is longer than the sections can hold, send it whole with deck.attach_specification and keep the sections as the summary.",
1497
- "5. Ask for real example data. If they attach a file in this chat, make the blanked copy yourself: replace names, numbers and anything sensitive, show them the exact blanked copy, and send it with deck.add_example_copy only after they say yes. An example’s input can be several files, like a PDF and a CSV: send each with the same pair, never zipped together. On their own computer, blank names, numbers and anything sensitive in a copy on their computer before anything is sent. The confirmed scenarios are the basis for the examples and tests. Suggest which one or two examples builders should see; the person decides, and the rest stay hidden for judging. Then propose tests with deck.propose_tests. Propose a test plan, not copies of the examples: at least one test for every confirmed scenario, plus edge cases you write yourself (empty input, malformed input with outcome fails_cleanly, large input, boundary values), each with its category. A test proves a requirement on a small input, so use the smallest input that shows it and leave long real-size runs for the person’s own review of the entries that pass. Pick how each test is compared, and raise its time limit only when even a small input needs longer than the default 10 seconds; the time limits of all the tests can add up to at most 30 minutes. For a large input or a hidden test file, send it once with deck.add_example_copy (hidden from builders unless they choose to show it) and name it in the test by its pair and role instead of writing it out. Show them the plan in plain words: what each test checks, which ones builders see, and the pass mark. Send it with person_approved true only after they say yes.",
1530
+ "5. Ask for real example data. If they attach a file in this chat, make the blanked copy yourself: replace names, numbers and anything sensitive, show them the exact blanked copy, and send it with deck.add_example_copy only after they say yes. An example’s input can be several files, like a PDF and a CSV: send each with the same pair, never zipped together. On their own computer, blank names, numbers and anything sensitive in a copy on their computer before anything is sent. The confirmed scenarios are the basis for the examples and tests. Suggest which one or two examples builders should see; the person decides, and the rest stay hidden for judging. Then propose tests with deck.propose_tests. Propose a test plan, not copies of the examples: at least one test for every confirmed scenario, plus edge cases you write yourself (empty input, malformed input with outcome fails_cleanly, large input, boundary values), each with its category. Name each test in one short plain sentence of what it checks: builders see every test’s name with their result, hidden tests too, so a name must never give the expected answer away. Give each test a description too: one or two plain sentences on what the poster is looking for in that case, shown to a builder whose entry fails it; never the input, the expected output or anything that gives the answer away. A test proves a requirement on a small input, so use the smallest input that shows it and leave long real-size runs for the person’s own review of the entries that pass. Pick how each test is compared, and raise its time limit only when even a small input needs longer than the default 10 seconds; the time limits of all the tests can add up to at most 30 minutes. For a large input or a hidden test file, send it once with deck.add_example_copy (hidden from builders unless they choose to show it) and name it in the test by its pair and role instead of writing it out. Show them the plan in plain words: what each test checks, which ones builders see, and the pass mark. Send it with person_approved true only after they say yes.",
1498
1531
  "6. Ask what reward they will pay for the accepted submission, then who can see the task: public, private or invite only. Public is on the board, where anyone can read it and pitch in. With private, every builder can see it and enter, there is no pitching in, and only the person sees the submissions and the solution. With invite only, only the builders the person invites can find it, read it and enter: it never shows on the Board for anyone else, there is no pitching in, and only the person sees the submissions and the solution. Save both on the draft with deck.post_draft. An invite-only task cannot be posted until the person has invited at least one builder, by username, on the review page; you cannot invite builders for them.",
1499
1532
  "7. When deck.post_draft says nothing is missing, send the person its review link first, where they read the draft exactly as builders will see it and can change any part of it, and ask them to read it. Only after they say yes, save the draft once more with person_reviewed true; if they changed it there, deck.post_draft says what it now holds. That answer carries the pay link: give the person only its pay link, no other link. They open it and pay the held deposit, 30% of the reward, on Stripe themselves, which posts the task; the rest is charged only when they accept a submission. Tell them the exact amounts deck.post_draft gives. While something is still missing, the same link opens the review page, which shows what."
1500
1533
  ].join("\n");
@@ -1708,7 +1741,7 @@ var postDraft = {
1708
1741
  var proposeTests = {
1709
1742
  name: "deck.propose_tests",
1710
1743
  title: "Propose tests",
1711
- description: `For posters. Adds tests to a draft task: sample tests builders can see and hidden tests they cannot, each an input and its expected answer, with a suggested pass mark out of the hidden tests. Propose a test plan, like a graded coding assignment, not only copies of the examples: at least one test for every confirmed scenario, plus edge cases you write yourself (empty input, malformed input the program should refuse, large input, boundary values), each with the category it covers. Use the smallest input that proves each requirement; long real-size runs are for the person’s own review of the entries that pass. Choose per test how the output is compared (exact, any line order, numbers within a tolerance, or JSON), a time limit if the default 10 seconds does not fit, and outcome fails_cleanly where the program should reject the input. For a large input, or a hidden test file, send the file once with deck.add_example_copy and name it here by its pair and role instead of writing it out; when that example’s input is several files, the program gets a folder holding them. Show the person the test plan in plain words: what each test checks, which ones builders see, and the pass mark. Send it only after they say yes, with person_approved true; without it nothing is sent. Then it needs no second approval on The Deck. ${ONE_QUESTION}`,
1744
+ description: `For posters. Adds tests to a draft task: sample tests builders can see and hidden tests they cannot, each an input and its expected answer, with a suggested pass mark out of the hidden tests. Propose a test plan, like a graded coding assignment, not only copies of the examples: at least one test for every confirmed scenario, plus edge cases you write yourself (empty input, malformed input the program should refuse, large input, boundary values), each with the category it covers. Name each test in one short plain sentence of what it checks: builders see every test’s name with their result, hidden tests too, so a name must never give the expected answer away. Give each test a description too: one or two plain sentences on what the poster is looking for in that case, shown to a builder whose entry fails it; never the input, the expected output or anything that gives the answer away. Use the smallest input that proves each requirement; long real-size runs are for the person’s own review of the entries that pass. Choose per test how the output is compared (exact, any line order, numbers within a tolerance, or JSON), a time limit if the default 10 seconds does not fit, and outcome fails_cleanly where the program should reject the input. For a large input, or a hidden test file, send the file once with deck.add_example_copy and name it here by its pair and role instead of writing it out; when that example’s input is several files, the program gets a folder holding them. Show the person the test plan in plain words: what each test checks, which ones builders see, and the pass mark. Send it only after they say yes, with person_approved true; without it nothing is sent. Then it needs no second approval on The Deck. ${ONE_QUESTION}`,
1712
1745
  run: (backend, args) => backend.proposeTests(args),
1713
1746
  summary: (out) => `${out.samples + out.hidden} tests on draft quest ${out.quest_id}: ${out.samples} visible to builders, ${out.hidden} hidden, pass mark ${out.pass_mark} of ${out.hidden}. ` + (out.test_time_seconds === void 0 ? "" : `The tests’ time limits add up to ${durationText(out.test_time_seconds)}, of the ${durationText(TEST_PLAN_TIME_CEILING_SECONDS)} a task’s tests can have; tell the person. `) + (out.status === "approved" ? "Approved in the chat: the person said yes to this test plan, so it needs no second approval on The Deck." : "The poster approves them.") + ` Next, save the draft again with deck.post_draft; its answer names the one thing still to ask. ${ONE_QUESTION}`
1714
1747
  };
@@ -1913,6 +1946,7 @@ async function stageInputs(tests) {
1913
1946
  }));
1914
1947
  return dir;
1915
1948
  }
1949
+ var resultOf = (passed) => passed ? "passed" : "failed";
1916
1950
  function groupFailures(failed) {
1917
1951
  const counts = /* @__PURE__ */ new Map();
1918
1952
  for (const c of failed) counts.set(c, (counts.get(c) ?? 0) + 1);
@@ -1962,6 +1996,7 @@ async function runTests(options) {
1962
1996
  hiddenTotal: ordered.filter((t) => t.kind === "hidden").length
1963
1997
  };
1964
1998
  const failed = [];
1999
+ const finished = {};
1965
2000
  await sandbox.upload(root, ENTRY_DIR);
1966
2001
  const staged = await stageInputs(ordered);
1967
2002
  let timedOut = false;
@@ -1976,6 +2011,7 @@ async function runTests(options) {
1976
2011
  timedOut = true;
1977
2012
  break;
1978
2013
  }
2014
+ finished[test.id] = resultOf(outcome.passed);
1979
2015
  if (test.kind === "sample") {
1980
2016
  counts.sampleRun++;
1981
2017
  if (outcome.passed) counts.samplePassed++;
@@ -1984,7 +2020,7 @@ async function runTests(options) {
1984
2020
  if (outcome.passed) counts.hiddenPassed++;
1985
2021
  else failed.push(test.category);
1986
2022
  }
1987
- options.onStep({ ...counts });
2023
+ options.onStep({ ...counts }, { ...finished });
1988
2024
  }
1989
2025
  } finally {
1990
2026
  await rm(staged, {
@@ -1992,9 +2028,14 @@ async function runTests(options) {
1992
2028
  force: true
1993
2029
  });
1994
2030
  }
2031
+ const results = {
2032
+ ...Object.fromEntries(ordered.map((t) => [t.id, "not_run"])),
2033
+ ...finished
2034
+ };
1995
2035
  return {
1996
2036
  ...counts,
1997
2037
  failed: groupFailures(failed),
2038
+ results,
1998
2039
  timedOut
1999
2040
  };
2000
2041
  }
@@ -5900,6 +5941,7 @@ async function stageKit(kit, dir) {
5900
5941
  if (test.input_folder) await unpack(given, inputFile);
5901
5942
  await writeFile(expectedFile, Buffer.from(test.expected, "base64"));
5902
5943
  tests.push({
5944
+ id: String(i),
5903
5945
  kind: "sample",
5904
5946
  category: null,
5905
5947
  inputFile,
@@ -6006,6 +6048,7 @@ async function pairRealData(dataDir) {
6006
6048
  const [answer] = expected;
6007
6049
  if (group.length !== 2 || !input || !answer) continue;
6008
6050
  tests.push({
6051
+ id: input,
6009
6052
  kind: "sample",
6010
6053
  category: null,
6011
6054
  inputFile: path.join(dataDir, input),
@@ -6090,14 +6133,14 @@ process.on("unhandledRejection", fail("unhandled rejection"));
6090
6133
  process.on("uncaughtException", fail("uncaught exception"));
6091
6134
  var server = null;
6092
6135
  var clientName = () => readableClientName(server?.server.getClientVersion());
6093
- server = createDeckServer(withAgentClient(createRemoteBackend({
6136
+ server = createDeckServer(withPages(withAgentClient(createRemoteBackend({
6094
6137
  deckUrl: DECK_URL,
6095
6138
  token: createLogin({
6096
6139
  deckUrl: DECK_URL,
6097
6140
  clientName,
6098
6141
  handBackAfterMs: 45e3
6099
6142
  })
6100
- }), () => server?.server.getClientVersion()), {
6143
+ }), () => server?.server.getClientVersion()), openInBrowser), {
6101
6144
  remote: false,
6102
6145
  localTools: [runPrecheck, tryOnRealData]
6103
6146
  });
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "name": "@thedeck/mcp",
3
- "version": "0.1.6",
4
- "type": "module",
5
- "bin": {
6
- "mcp": "dist/index.js",
7
- "thedeck-mcp": "dist/index.js",
8
- "thedeck": "dist/cli.js"
9
- },
10
- "exports": {
11
- ".": "./src/server.ts",
12
- "./backend": "./src/backend.ts"
13
- },
14
- "files": [
15
- "dist"
16
- ],
17
- "scripts": {
18
- "build": "vite build --ssr src/index.ts --outDir dist && vite build --ssr src/cli.ts --outDir dist --emptyOutDir false",
19
- "typecheck": "tsc --noEmit",
20
- "lint": "eslint .",
21
- "test": "vitest run"
22
- },
23
- "dependencies": {
24
- "@modelcontextprotocol/sdk": "1.32.1",
25
- "zod": "4.6.7"
26
- },
27
- "devDependencies": {
28
- "@modelcontextprotocol/ext-apps": "1.7.5",
29
- "@thedeck/runner": "workspace:*",
30
- "@thedeck/shared": "workspace:*",
31
- "@types/node": "26.6.5",
32
- "@vitest/coverage-v8": "5.0.5",
33
- "happy-dom": "21.0.4",
34
- "typescript": "6.0.3",
35
- "vite": "8.3.5",
36
- "vitest": "5.0.5"
37
- }
38
- }
1
+ {
2
+ "name": "@thedeck/mcp",
3
+ "version": "0.1.8",
4
+ "type": "module",
5
+ "bin": {
6
+ "mcp": "dist/index.js",
7
+ "thedeck-mcp": "dist/index.js",
8
+ "thedeck": "dist/cli.js"
9
+ },
10
+ "exports": {
11
+ ".": "./src/server.ts",
12
+ "./backend": "./src/backend.ts"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "vite build --ssr src/index.ts --outDir dist && vite build --ssr src/cli.ts --outDir dist --emptyOutDir false",
19
+ "typecheck": "tsc --noEmit",
20
+ "lint": "eslint .",
21
+ "test": "vitest run"
22
+ },
23
+ "dependencies": {
24
+ "@modelcontextprotocol/sdk": "1.32.1",
25
+ "zod": "4.6.7"
26
+ },
27
+ "devDependencies": {
28
+ "@modelcontextprotocol/ext-apps": "1.7.5",
29
+ "@thedeck/runner": "workspace:*",
30
+ "@thedeck/shared": "workspace:*",
31
+ "@types/node": "26.6.5",
32
+ "@vitest/coverage-v8": "5.0.5",
33
+ "happy-dom": "21.0.4",
34
+ "typescript": "6.0.3",
35
+ "vite": "8.3.5",
36
+ "vitest": "5.0.5"
37
+ }
38
+ }