@thedeck/mcp 0.1.7 → 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.
- package/dist/cli.js +19 -1
- package/dist/index.js +23 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -353,6 +353,13 @@ z.object({
|
|
|
353
353
|
rightsConfirmed: z.literal(true)
|
|
354
354
|
});
|
|
355
355
|
z.object({
|
|
356
|
+
phase: z.enum([
|
|
357
|
+
"github",
|
|
358
|
+
"code",
|
|
359
|
+
"sandbox",
|
|
360
|
+
"tests",
|
|
361
|
+
"scan"
|
|
362
|
+
]).optional(),
|
|
356
363
|
sampleRun: z.number().int().nonnegative(),
|
|
357
364
|
hiddenRun: z.number().int().nonnegative(),
|
|
358
365
|
scan: z.enum([
|
|
@@ -601,8 +608,10 @@ var exampleCopyRef = z.object({
|
|
|
601
608
|
pair: z.number().int().positive(),
|
|
602
609
|
role: z.enum(["input", "expected"])
|
|
603
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";
|
|
604
612
|
var proposedTest = z.object({
|
|
605
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."),
|
|
606
615
|
kind: z.enum(["sample", "hidden"]),
|
|
607
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."),
|
|
608
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."),
|
|
@@ -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
|
@@ -371,6 +371,13 @@ z.object({
|
|
|
371
371
|
rightsConfirmed: z.literal(true)
|
|
372
372
|
});
|
|
373
373
|
z.object({
|
|
374
|
+
phase: z.enum([
|
|
375
|
+
"github",
|
|
376
|
+
"code",
|
|
377
|
+
"sandbox",
|
|
378
|
+
"tests",
|
|
379
|
+
"scan"
|
|
380
|
+
]).optional(),
|
|
374
381
|
sampleRun: z.number().int().nonnegative(),
|
|
375
382
|
hiddenRun: z.number().int().nonnegative(),
|
|
376
383
|
scan: z.enum([
|
|
@@ -622,8 +629,10 @@ var exampleCopyRef = z.object({
|
|
|
622
629
|
pair: z.number().int().positive(),
|
|
623
630
|
role: z.enum(["input", "expected"])
|
|
624
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";
|
|
625
633
|
var proposedTest = z.object({
|
|
626
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."),
|
|
627
636
|
kind: z.enum(["sample", "hidden"]),
|
|
628
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."),
|
|
629
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."),
|
|
@@ -1219,7 +1228,7 @@ function withPages(backend, open, now = Date.now) {
|
|
|
1219
1228
|
}
|
|
1220
1229
|
var package_default = {
|
|
1221
1230
|
name: "@thedeck/mcp",
|
|
1222
|
-
version: "0.1.
|
|
1231
|
+
version: "0.1.8",
|
|
1223
1232
|
type: "module",
|
|
1224
1233
|
bin: {
|
|
1225
1234
|
"mcp": "dist/index.js",
|
|
@@ -1518,7 +1527,7 @@ var POSTING_STEPS = [
|
|
|
1518
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.",
|
|
1519
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.",
|
|
1520
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.",
|
|
1521
|
-
"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.",
|
|
1522
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.",
|
|
1523
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."
|
|
1524
1533
|
].join("\n");
|
|
@@ -1732,7 +1741,7 @@ var postDraft = {
|
|
|
1732
1741
|
var proposeTests = {
|
|
1733
1742
|
name: "deck.propose_tests",
|
|
1734
1743
|
title: "Propose tests",
|
|
1735
|
-
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}`,
|
|
1736
1745
|
run: (backend, args) => backend.proposeTests(args),
|
|
1737
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}`
|
|
1738
1747
|
};
|
|
@@ -1937,6 +1946,7 @@ async function stageInputs(tests) {
|
|
|
1937
1946
|
}));
|
|
1938
1947
|
return dir;
|
|
1939
1948
|
}
|
|
1949
|
+
var resultOf = (passed) => passed ? "passed" : "failed";
|
|
1940
1950
|
function groupFailures(failed) {
|
|
1941
1951
|
const counts = /* @__PURE__ */ new Map();
|
|
1942
1952
|
for (const c of failed) counts.set(c, (counts.get(c) ?? 0) + 1);
|
|
@@ -1986,6 +1996,7 @@ async function runTests(options) {
|
|
|
1986
1996
|
hiddenTotal: ordered.filter((t) => t.kind === "hidden").length
|
|
1987
1997
|
};
|
|
1988
1998
|
const failed = [];
|
|
1999
|
+
const finished = {};
|
|
1989
2000
|
await sandbox.upload(root, ENTRY_DIR);
|
|
1990
2001
|
const staged = await stageInputs(ordered);
|
|
1991
2002
|
let timedOut = false;
|
|
@@ -2000,6 +2011,7 @@ async function runTests(options) {
|
|
|
2000
2011
|
timedOut = true;
|
|
2001
2012
|
break;
|
|
2002
2013
|
}
|
|
2014
|
+
finished[test.id] = resultOf(outcome.passed);
|
|
2003
2015
|
if (test.kind === "sample") {
|
|
2004
2016
|
counts.sampleRun++;
|
|
2005
2017
|
if (outcome.passed) counts.samplePassed++;
|
|
@@ -2008,7 +2020,7 @@ async function runTests(options) {
|
|
|
2008
2020
|
if (outcome.passed) counts.hiddenPassed++;
|
|
2009
2021
|
else failed.push(test.category);
|
|
2010
2022
|
}
|
|
2011
|
-
options.onStep({ ...counts });
|
|
2023
|
+
options.onStep({ ...counts }, { ...finished });
|
|
2012
2024
|
}
|
|
2013
2025
|
} finally {
|
|
2014
2026
|
await rm(staged, {
|
|
@@ -2016,9 +2028,14 @@ async function runTests(options) {
|
|
|
2016
2028
|
force: true
|
|
2017
2029
|
});
|
|
2018
2030
|
}
|
|
2031
|
+
const results = {
|
|
2032
|
+
...Object.fromEntries(ordered.map((t) => [t.id, "not_run"])),
|
|
2033
|
+
...finished
|
|
2034
|
+
};
|
|
2019
2035
|
return {
|
|
2020
2036
|
...counts,
|
|
2021
2037
|
failed: groupFailures(failed),
|
|
2038
|
+
results,
|
|
2022
2039
|
timedOut
|
|
2023
2040
|
};
|
|
2024
2041
|
}
|
|
@@ -5924,6 +5941,7 @@ async function stageKit(kit, dir) {
|
|
|
5924
5941
|
if (test.input_folder) await unpack(given, inputFile);
|
|
5925
5942
|
await writeFile(expectedFile, Buffer.from(test.expected, "base64"));
|
|
5926
5943
|
tests.push({
|
|
5944
|
+
id: String(i),
|
|
5927
5945
|
kind: "sample",
|
|
5928
5946
|
category: null,
|
|
5929
5947
|
inputFile,
|
|
@@ -6030,6 +6048,7 @@ async function pairRealData(dataDir) {
|
|
|
6030
6048
|
const [answer] = expected;
|
|
6031
6049
|
if (group.length !== 2 || !input || !answer) continue;
|
|
6032
6050
|
tests.push({
|
|
6051
|
+
id: input,
|
|
6033
6052
|
kind: "sample",
|
|
6034
6053
|
category: null,
|
|
6035
6054
|
inputFile: path.join(dataDir, input),
|