@makine/cli 0.4.9 → 0.6.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.
Files changed (58) hide show
  1. package/dist/accept/command.d.ts +25 -0
  2. package/dist/accept/command.d.ts.map +1 -0
  3. package/dist/accept/command.js +114 -0
  4. package/dist/accept/command.js.map +1 -0
  5. package/dist/connections/command.d.ts +1 -1
  6. package/dist/connections/command.js +2 -1
  7. package/dist/connections/command.js.map +1 -1
  8. package/dist/contracts/command.d.ts +3 -1
  9. package/dist/contracts/command.d.ts.map +1 -1
  10. package/dist/contracts/command.js +63 -0
  11. package/dist/contracts/command.js.map +1 -1
  12. package/dist/diagnosis/command.d.ts +29 -0
  13. package/dist/diagnosis/command.d.ts.map +1 -0
  14. package/dist/diagnosis/command.js +115 -0
  15. package/dist/diagnosis/command.js.map +1 -0
  16. package/dist/index.d.ts +31 -4
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +299 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/judge/command.js +1 -0
  21. package/dist/judge/command.js.map +1 -1
  22. package/dist/keys/command.js +1 -0
  23. package/dist/keys/command.js.map +1 -1
  24. package/dist/lab/command.d.ts +28 -19
  25. package/dist/lab/command.d.ts.map +1 -1
  26. package/dist/lab/command.js +155 -6
  27. package/dist/lab/command.js.map +1 -1
  28. package/dist/lab/gate.d.ts +58 -0
  29. package/dist/lab/gate.d.ts.map +1 -0
  30. package/dist/lab/gate.js +124 -0
  31. package/dist/lab/gate.js.map +1 -0
  32. package/dist/lab/import.d.ts +46 -0
  33. package/dist/lab/import.d.ts.map +1 -0
  34. package/dist/lab/import.js +191 -0
  35. package/dist/lab/import.js.map +1 -0
  36. package/dist/login/command.d.ts.map +1 -1
  37. package/dist/login/command.js +3 -0
  38. package/dist/login/command.js.map +1 -1
  39. package/dist/main.js +7 -3
  40. package/dist/main.js.map +1 -1
  41. package/dist/quality/command.d.ts +47 -0
  42. package/dist/quality/command.d.ts.map +1 -0
  43. package/dist/quality/command.js +85 -0
  44. package/dist/quality/command.js.map +1 -0
  45. package/dist/receipts/command.d.ts +28 -0
  46. package/dist/receipts/command.d.ts.map +1 -0
  47. package/dist/receipts/command.js +220 -0
  48. package/dist/receipts/command.js.map +1 -0
  49. package/dist/reviews/command.d.ts.map +1 -1
  50. package/dist/reviews/command.js +1 -0
  51. package/dist/reviews/command.js.map +1 -1
  52. package/dist/suggestions/command.d.ts +2 -0
  53. package/dist/suggestions/command.d.ts.map +1 -1
  54. package/dist/suggestions/command.js +66 -8
  55. package/dist/suggestions/command.js.map +1 -1
  56. package/dist/workflows/command.js +1 -0
  57. package/dist/workflows/command.js.map +1 -1
  58. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -3,7 +3,9 @@ import { type BaselineSubcommand } from "./baseline/command.js";
3
3
  import { type ChallengerAction, type ContractSubcommand } from "./contracts/command.js";
4
4
  import { type UseCaseSubcommand } from "./use-cases/command.js";
5
5
  import { type JudgeSubcommand } from "./judge/command.js";
6
+ import { type ReceiptsSubcommand } from "./receipts/command.js";
6
7
  import { type SuggestionsSubcommand } from "./suggestions/command.js";
8
+ import { type DiagnosisSubcommand } from "./diagnosis/command.js";
7
9
  import { type KeysSubcommand } from "./keys/command.js";
8
10
  import { type ConnectionsSubcommand } from "./connections/command.js";
9
11
  import { type WorkflowsSubcommand } from "./workflows/command.js";
@@ -38,14 +40,18 @@ export interface CliIo {
38
40
  fetchImpl?: typeof fetch;
39
41
  /** Overridable file read, used by `migrate`. Defaults to `node:fs`. */
40
42
  readFileImpl?: (path: string) => string;
41
- /** The wait between device-code polls, injected so no test sleeps a real interval. */
43
+ /** The wait between device-code polls and Lab run polls, injected so no test sleeps for real. */
42
44
  sleepImpl?: (milliseconds: number) => Promise<void>;
45
+ /** The clock a deadline is measured against, injected so no test waits one out. */
46
+ nowMsImpl?: () => number;
43
47
  /**
44
48
  * Reads a provider key for `connections connect` and `connections rotate`, and stands in for the
45
49
  * confirmation `reviews bulk` and `judge enable` ask for. Defaults to stdin, which is the only
46
50
  * ingress for a key: one passed as an argument reaches `ps` and shell history.
47
51
  */
48
52
  readCredentialImpl?: (prompt: string) => Promise<string>;
53
+ /** What was piped in, for a command whose payload is stdin rather than an argument. */
54
+ stdin?: string;
49
55
  }
50
56
  /** The stream `readConfirmationLine` reads; `process.stdin` satisfies it. */
51
57
  export interface ConfirmationInput extends NodeJS.ReadableStream {
@@ -60,7 +66,7 @@ export interface ConfirmationInput extends NodeJS.ReadableStream {
60
66
  */
61
67
  export declare function readConfirmationLine(prompt: string, stream?: ConfirmationInput): Promise<string>;
62
68
  interface ParsedArgs {
63
- command: "run" | "models" | "contracts" | "use-cases" | "judge" | "suggestions" | "keys" | "connections" | "workflows" | "baseline" | "datasets" | "experiments" | "corrections" | "reviews" | "migrate" | "login" | "logout" | "help" | "version";
69
+ command: "run" | "accept" | "quality" | "models" | "contracts" | "use-cases" | "judge" | "receipts" | "suggestions" | "diagnosis" | "keys" | "connections" | "workflows" | "baseline" | "datasets" | "experiments" | "corrections" | "reviews" | "migrate" | "login" | "logout" | "help" | "version";
64
70
  /**
65
71
  * `contracts` only: `list`, `show`, `create`, `activate`, `deactivate`, `revert` or
66
72
  * `challengers`.
@@ -76,6 +82,14 @@ interface ParsedArgs {
76
82
  includeRetired?: boolean;
77
83
  /** `models` only: list the names this workspace's application called, with their counts. */
78
84
  used?: boolean;
85
+ /** `receipts` only: `trust`, `verify` or `issuers`. */
86
+ receiptsSubcommand?: ReceiptsSubcommand;
87
+ /** `receipts` only: the issuer name, the anchor, and the file to verify. */
88
+ issuer?: string;
89
+ origin?: string;
90
+ fromFile?: string;
91
+ refresh?: boolean;
92
+ receiptFile?: string;
79
93
  /** `judge` only: `show`, `enable` or `disable`. */
80
94
  judgeSubcommand?: JudgeSubcommand;
81
95
  /** `suggestions` only. */
@@ -84,6 +98,10 @@ interface ParsedArgs {
84
98
  suggestionKinds?: string[];
85
99
  /** `suggestions draft` only: the role a computed schema is inferred for. */
86
100
  artifactRole?: string;
101
+ /** `suggestions approve` only: a relaxed pattern edited before approving. */
102
+ pattern?: string;
103
+ /** `diagnosis` only: `show` or `level`. */
104
+ diagnosisSubcommand?: DiagnosisSubcommand;
87
105
  /** `keys` only: `list`, `create`, `revoke` or `rotate`. */
88
106
  keysSubcommand?: KeysSubcommand;
89
107
  /** `connections` only. */
@@ -119,6 +137,13 @@ interface ParsedArgs {
119
137
  /** `experiments run` only. */
120
138
  variantId?: string;
121
139
  datasetId?: string;
140
+ /** `experiments run` only (ADR 0014 § D14.15). */
141
+ wait?: boolean;
142
+ minPassRate?: number;
143
+ baselineRun?: string;
144
+ timeoutMinutes?: number;
145
+ /** `quality` only: which runs to report on. Production by default. */
146
+ runPurpose?: string;
122
147
  /** Positional arguments: the prompt for `run`, the config file for `migrate`. */
123
148
  prompt: string[];
124
149
  baseUrl?: string;
@@ -131,13 +156,15 @@ interface ParsedArgs {
131
156
  acceptanceContract?: string;
132
157
  name?: string;
133
158
  /**
134
- * `migrate`'s config format, `baseline create`'s window start, and the comma-separated
135
- * correction ids `datasets copy-corrections` copies.
159
+ * `migrate`'s config format, `baseline create`'s and `quality`'s window, the comma-separated
160
+ * correction ids `datasets copy-corrections` copies, and `datasets import`'s source tool.
136
161
  */
137
162
  from?: string;
138
163
  to?: string;
139
164
  shape?: string;
140
165
  file?: string;
166
+ /** `contracts test-check` only: the file holding the answer to run the program against. */
167
+ answerFile?: string;
141
168
  json: boolean;
142
169
  }
143
170
  type ParseResult = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAQL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KA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MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,KAAK,WAAW,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAoa9D;AAmGD,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkdlF"}
package/dist/index.js CHANGED
@@ -11,7 +11,9 @@ import { BASELINE_SUBCOMMANDS, runBaseline, } from "./baseline/command.js";
11
11
  import { CHALLENGER_ACTIONS, CONTRACT_SUBCOMMANDS, runContracts, } from "./contracts/command.js";
12
12
  import { USE_CASE_SUBCOMMANDS, runUseCases, } from "./use-cases/command.js";
13
13
  import { JUDGE_SUBCOMMANDS, runJudge, } from "./judge/command.js";
14
+ import { runReceipts, RECEIPTS_SUBCOMMANDS, } from "./receipts/command.js";
14
15
  import { SUGGESTIONS_SUBCOMMANDS, runSuggestions, } from "./suggestions/command.js";
16
+ import { DIAGNOSIS_SUBCOMMANDS, runDiagnosis, } from "./diagnosis/command.js";
15
17
  import { KEYS_SUBCOMMANDS, runKeys, } from "./keys/command.js";
16
18
  import { CONNECTIONS_SUBCOMMANDS, runConnections, } from "./connections/command.js";
17
19
  import { WORKFLOWS_SUBCOMMANDS, runWorkflows, } from "./workflows/command.js";
@@ -19,6 +21,8 @@ import { CORRECTIONS_SUBCOMMANDS, DATASETS_SUBCOMMANDS, EXPERIMENTS_SUBCOMMANDS,
19
21
  import { runLogin, runLogout } from "./login/command.js";
20
22
  import { REVIEWS_SUBCOMMANDS, isReviewAction, isReviewsSubcommand, runReviews, } from "./reviews/command.js";
21
23
  import { runMigrate } from "./migrate/command.js";
24
+ import { runAccept } from "./accept/command.js";
25
+ import { runQuality } from "./quality/command.js";
22
26
  import { storedSessionFor } from "./session-store.js";
23
27
  /**
24
28
  * Exit codes are the CLI's contract with scripts. `RESULT_NOT_ACCEPTED` is a verdict, not a fault:
@@ -86,18 +90,23 @@ USAGE
86
90
  makine login Sign in as yourself, by approving a code in the dashboard
87
91
  makine logout End that session and delete the stored token
88
92
  makine run [prompt...] Send one buffered chat completion and print the verdict
93
+ makine accept "<input>" Judge an answer your own system produced, with it on stdin
94
+ makine quality Acceptance and failure figures, as Quality in the dashboard
89
95
  makine models [--used] List the model aliases this workspace may call; --used lists only
90
96
  the names your application called in the last 30 days, with counts
91
97
  makine keys <cmd> Create, list, revoke and rotate this workspace's API keys
92
98
  makine contracts <cmd> Define what a good result is, and make it live
93
99
  makine use-cases <cmd> Name a job, give it an address, and point it at a model
94
100
  makine judge <cmd> Switch the semantic judge on or off for this workspace
101
+ makine receipts <cmd> Trust an issuer once, then verify the receipts it signed, offline
95
102
  makine suggestions <cmd> Suggested prompt instructions, checks, schemas and fixes
103
+ makine diagnosis <cmd> Whether Makine may read rejected answers to spot near misses
96
104
  makine connections <cmd> Connect your own model provider, and keep it until you disconnect it
97
105
  makine workflows <cmd> Define an HTTP or container step, and approve the hosts it may reach
98
106
  makine baseline <cmd> Compare your model's first answer with what Makine delivered
99
107
  makine datasets <cmd> Keep the cases you judge a prompt or a contract against
100
108
  makine experiments <cmd> Run variants over a dataset and compare what each got accepted
109
+ run --wait polls to the end and gates on the pass rate
101
110
  makine corrections <cmd> The human corrections this workspace has written
102
111
  makine reviews <cmd> Work through the runs a contract parked for a person
103
112
  makine migrate <file> Translate a Portkey or LiteLLM config into makine.env settings
@@ -235,6 +244,21 @@ CONTRACTS
235
244
  makine contracts challengers register <id>@<version> --model <alias>
236
245
  makine contracts challengers retire <registration_id>
237
246
  makine contracts challengers list --use-case <address>
247
+ makine contracts test-check --file <contract.json> --answer <answer.txt>
248
+
249
+ A \`custom_code\` check runs the Python in your contract against one answer, in a sandbox that
250
+ resolves no hostname — but raw-IP egress is not blocked, so your own code can still reach out.
251
+ \`test-check\` runs it once before you save, so a syntax error is not something you discover from
252
+ a failed production run. It is hosted-only, and needs \`makine login\` rather than a workspace
253
+ key: a CI job holding a bare key cannot post a contract carrying the kind.
254
+
255
+ Python 3.13, the standard library only. No pip, no pandas, no numpy — for those, define a
256
+ container workflow step instead, which takes your own image.
257
+ 30 seconds, 1 vCPU, 512 MiB, and it draws on your workspace's daily sandbox budget.
258
+ \`observed\` takes booleans and finite numbers only, at most 16 keys. No strings: that bag is
259
+ shown in the dashboard and must not be able to carry the answer.
260
+ This runs once per answer. If your code uses the clock or randomness, two runs of the same
261
+ answer can disagree.
238
262
 
239
263
  An <id> is either the canonical id a read returned or the local part; both resolve. The file
240
264
  names its checks and repair plan by their local id. A contract is submitted before anything it
@@ -259,6 +283,12 @@ USE CASES
259
283
  frees it for another use case.
260
284
 
261
285
  THE SEMANTIC JUDGE
286
+ makine receipts trust <name> --origin <https-origin> Anchor an issuer by fetching its key list
287
+ makine receipts trust <name> --from-file <key-set> Anchor one by a hand-over, the stronger form
288
+ makine receipts trust <name> --refresh --origin <o> Refresh a record you already hold
289
+ makine receipts verify <file> [--issuer <name>] Check a receipt. NEVER fetches
290
+ makine receipts issuers The issuers you have anchored
291
+
262
292
  makine judge show Whether it is on, which model, and the statement
263
293
  makine judge enable --model <alias> [--yes] Agree to the statement and switch it on
264
294
  makine judge disable Switch it off for this workspace
@@ -280,6 +310,7 @@ SUGGESTIONS
280
310
  makine suggestions draft <failure_group_key> Ask for suggestions about one failure group
281
311
  [--kinds a,b] [--role <r>] [--yes]
282
312
  makine suggestions approve <suggestion_id> Approve one; writes an inactive version
313
+ [--pattern <p>] A relaxed pattern, edited before approving
283
314
  makine suggestions dismiss <suggestion_id> Dismiss one
284
315
 
285
316
  Makine suggests four things: instructions to add to your prompt, a further pattern check, a basic
@@ -291,10 +322,25 @@ SUGGESTIONS
291
322
  offered only once this workspace switches suggestions on. \`draft\` prints what the batch will cost
292
323
  on your own key and asks you to confirm; \`--yes\` skips that prompt.
293
324
 
325
+ Two more are offered for a group whose pattern check rejected answers that nearly passed: a
326
+ pattern that admits them, and a change to what your request asks for. Makine reads the group's
327
+ rejected answers to find them only once this workspace allows it (\`makine diagnosis\`), and only
328
+ when you ask: \`draft\` without \`--kinds\` asks for them. Approving a change to your request marks
329
+ it as done and writes nothing.
330
+
294
331
  Suggestion spend is your own, on your own key. It is **not** counted in usage metering or against
295
332
  a budget ceiling. Every subcommand here needs a session or a workspace key; a bare program key is
296
333
  refused.
297
334
 
335
+ DIAGNOSIS — near misses
336
+ makine diagnosis show Whether Makine may read rejected answers
337
+ makine diagnosis level <none|in-workspace> [--yes] Agree to the statement and choose a level
338
+
339
+ At \`in-workspace\`, when someone asks for suggestions on a failure group, Makine reads up to 20
340
+ of that group's rejected answers inside this workspace to spot a near miss, and stores only what
341
+ kind of mismatch it was. Nothing is sent anywhere. \`level\` prints the statement and sends back
342
+ the version it printed. Changing the level needs \`makine login\`: a workspace key is refused.
343
+
298
344
  BASELINE — the before/after report
299
345
  makine baseline create --name <name> --from <ts> --to <ts> [--acceptance-contract <id>[@<ver>]]
300
346
  makine baseline list Every set this workspace has created
@@ -340,6 +386,8 @@ export function parseArgs(argv) {
340
386
  return { ok: true, args: { ...args, command: "version" } };
341
387
  }
342
388
  if (head === "run" ||
389
+ head === "accept" ||
390
+ head === "quality" ||
343
391
  head === "models" ||
344
392
  head === "migrate" ||
345
393
  head === "login" ||
@@ -382,6 +430,29 @@ export function parseArgs(argv) {
382
430
  args.useCaseSubcommand = sub;
383
431
  index = argv[1] === undefined ? 1 : 2;
384
432
  }
433
+ else if (head === "receipts") {
434
+ args.command = head;
435
+ const sub = argv[1];
436
+ if (sub === undefined || !RECEIPTS_SUBCOMMANDS.includes(sub)) {
437
+ return {
438
+ ok: false,
439
+ message: `\`makine receipts\` needs one of ${RECEIPTS_SUBCOMMANDS.join(", ")}.`,
440
+ };
441
+ }
442
+ args.receiptsSubcommand = sub;
443
+ // `trust <name>` and `verify <file>` both take one positional after the subcommand.
444
+ const positional = argv[2];
445
+ if (positional !== undefined && !positional.startsWith("--")) {
446
+ if (sub === "verify")
447
+ args.receiptFile = positional;
448
+ else
449
+ args.issuer = positional;
450
+ index = 3;
451
+ }
452
+ else {
453
+ index = 2;
454
+ }
455
+ }
385
456
  else if (head === "judge") {
386
457
  args.command = head;
387
458
  const sub = argv[1];
@@ -406,6 +477,18 @@ export function parseArgs(argv) {
406
477
  args.suggestionsSubcommand = sub;
407
478
  index = 2;
408
479
  }
480
+ else if (head === "diagnosis") {
481
+ args.command = head;
482
+ const sub = argv[1];
483
+ if (sub === undefined || !DIAGNOSIS_SUBCOMMANDS.includes(sub)) {
484
+ return {
485
+ ok: false,
486
+ message: `\`makine diagnosis\` needs one of ${DIAGNOSIS_SUBCOMMANDS.join(", ")}.`,
487
+ };
488
+ }
489
+ args.diagnosisSubcommand = sub;
490
+ index = 2;
491
+ }
409
492
  else if (head === "keys") {
410
493
  args.command = head;
411
494
  const sub = argv[1];
@@ -593,6 +676,24 @@ export function parseArgs(argv) {
593
676
  args.model = next;
594
677
  index += 1;
595
678
  break;
679
+ case "--issuer":
680
+ if (needsValue(token, next))
681
+ args.issuer = next;
682
+ index += 1;
683
+ break;
684
+ case "--origin":
685
+ if (needsValue(token, next))
686
+ args.origin = next;
687
+ index += 1;
688
+ break;
689
+ case "--from-file":
690
+ if (needsValue(token, next))
691
+ args.fromFile = next;
692
+ index += 1;
693
+ break;
694
+ case "--refresh":
695
+ args.refresh = true;
696
+ break;
596
697
  case "--system":
597
698
  if (needsValue(token, next))
598
699
  args.system = next;
@@ -644,11 +745,46 @@ export function parseArgs(argv) {
644
745
  args.artifactRole = next;
645
746
  index += 1;
646
747
  break;
748
+ case "--pattern":
749
+ if (needsValue(token, next))
750
+ args.pattern = next;
751
+ index += 1;
752
+ break;
647
753
  case "--variant":
648
754
  if (needsValue(token, next))
649
755
  args.variantId = next;
650
756
  index += 1;
651
757
  break;
758
+ case "--wait":
759
+ args.wait = true;
760
+ break;
761
+ case "--min-pass-rate": {
762
+ if (!needsValue(token, next))
763
+ break;
764
+ const rate = Number(next);
765
+ if (!Number.isFinite(rate) || rate < 0 || rate > 1) {
766
+ return { ok: false, message: "--min-pass-rate takes a number between 0 and 1." };
767
+ }
768
+ args.minPassRate = rate;
769
+ index += 1;
770
+ break;
771
+ }
772
+ case "--baseline-run":
773
+ if (needsValue(token, next))
774
+ args.baselineRun = next;
775
+ index += 1;
776
+ break;
777
+ case "--timeout-minutes": {
778
+ if (!needsValue(token, next))
779
+ break;
780
+ const minutes = Number(next);
781
+ if (!Number.isInteger(minutes) || minutes <= 0) {
782
+ return { ok: false, message: "--timeout-minutes takes a whole number of minutes." };
783
+ }
784
+ args.timeoutMinutes = minutes;
785
+ index += 1;
786
+ break;
787
+ }
652
788
  case "--dataset":
653
789
  if (needsValue(token, next))
654
790
  args.datasetId = next;
@@ -679,11 +815,21 @@ export function parseArgs(argv) {
679
815
  args.shape = next;
680
816
  index += 1;
681
817
  break;
818
+ case "--run-purpose":
819
+ if (needsValue(token, next))
820
+ args.runPurpose = next;
821
+ index += 1;
822
+ break;
682
823
  case "--file":
683
824
  if (needsValue(token, next))
684
825
  args.file = next;
685
826
  index += 1;
686
827
  break;
828
+ case "--answer":
829
+ if (needsValue(token, next))
830
+ args.answerFile = next;
831
+ index += 1;
832
+ break;
687
833
  case "--header":
688
834
  if (needsValue(token, next))
689
835
  args.header = next;
@@ -767,6 +913,25 @@ function parseOptimizeFor(value) {
767
913
  return value;
768
914
  throw new CliUsageError(`--optimize-for must be cost, latency or balanced, got \`${value}\`.`);
769
915
  }
916
+ /**
917
+ * A non-accepted verdict is `RESULT_NOT_ACCEPTED`, not a fault: Makine judged the answer and it
918
+ * did not clear the gate, which is what a CI step branches on.
919
+ */
920
+ const QUALITY_EXIT = {
921
+ ok: EXIT.ACCEPTED,
922
+ usage: EXIT.USAGE,
923
+ refused: EXIT.RESULT_NOT_ACCEPTED,
924
+ auth: EXIT.AUTH,
925
+ unreachable: EXIT.UNREACHABLE,
926
+ };
927
+ const ACCEPT_EXIT = {
928
+ accepted: EXIT.ACCEPTED,
929
+ not_accepted: EXIT.RESULT_NOT_ACCEPTED,
930
+ auth: EXIT.AUTH,
931
+ gateway: EXIT.GATEWAY,
932
+ unreachable: EXIT.UNREACHABLE,
933
+ usage: EXIT.USAGE,
934
+ };
770
935
  export async function runCli(argv, io) {
771
936
  const parsed = parseArgs(argv);
772
937
  if (!parsed.ok) {
@@ -796,6 +961,26 @@ export async function runCli(argv, io) {
796
961
  });
797
962
  return ok ? EXIT.ACCEPTED : EXIT.USAGE;
798
963
  }
964
+ if (args.command === "receipts") {
965
+ // Offline: the counterparty verifying a receipt has no Makine workspace, so neither a Gateway
966
+ // address nor a key may be demanded. `trust --origin` fetches the issuer's own origin, not ours.
967
+ const outcome = await runReceipts({
968
+ subcommand: args.receiptsSubcommand,
969
+ ...(args.issuer === undefined ? {} : { name: args.issuer }),
970
+ ...(args.origin === undefined ? {} : { origin: args.origin }),
971
+ ...(args.fromFile === undefined ? {} : { fromFile: args.fromFile }),
972
+ refresh: args.refresh === true,
973
+ ...(args.receiptFile === undefined ? {} : { receiptFile: args.receiptFile }),
974
+ json: args.json,
975
+ }, {
976
+ out: io.out,
977
+ err: io.err,
978
+ storeDirectory: receiptsStoreDirectory(),
979
+ // `verify` is never given a fetcher: a verification run is offline by construction.
980
+ ...(args.receiptsSubcommand === "trust" ? { fetchKeySet: fetchReceiptKeySet(io) } : {}),
981
+ });
982
+ return RECEIPTS_EXIT[outcome];
983
+ }
799
984
  const configuredAddress = args.baseUrl ?? io.env.MAKINE_BASE_URL;
800
985
  if (configuredAddress === undefined || configuredAddress.trim().length === 0) {
801
986
  io.err("No Makine address. Set MAKINE_BASE_URL to the dashboard's origin plus /api, as Home's setup step shows it, or pass --base-url.");
@@ -823,6 +1008,44 @@ export async function runCli(argv, io) {
823
1008
  }
824
1009
  const apiKey = credential;
825
1010
  const explicitKey = (args.apiKey ?? io.env.MAKINE_API_KEY ?? "").trim().length > 0;
1011
+ if (args.command === "quality") {
1012
+ const connection = {
1013
+ baseUrl,
1014
+ apiKey,
1015
+ ...(io.fetchImpl === undefined ? {} : { fetchImpl: io.fetchImpl }),
1016
+ };
1017
+ let useCaseId;
1018
+ if (args.useCase !== undefined) {
1019
+ useCaseId = await resolveUseCaseIdByAddress(args.useCase, connection);
1020
+ if (useCaseId === undefined) {
1021
+ io.err(`${args.useCase} reaches no use case in this workspace.`);
1022
+ return EXIT.USAGE;
1023
+ }
1024
+ }
1025
+ const outcome = await runQuality({
1026
+ json: args.json,
1027
+ ...(args.runPurpose === undefined ? {} : { runPurpose: args.runPurpose }),
1028
+ ...(useCaseId === undefined ? {} : { useCaseId }),
1029
+ ...(args.from === undefined ? {} : { from: args.from }),
1030
+ ...(args.to === undefined ? {} : { to: args.to }),
1031
+ }, connection, { out: io.out, err: io.err });
1032
+ return QUALITY_EXIT[outcome];
1033
+ }
1034
+ if (args.command === "accept") {
1035
+ const outcome = await runAccept({
1036
+ input: args.prompt.join(" "),
1037
+ answer: io.stdin ?? "",
1038
+ json: args.json,
1039
+ ...(args.contract === undefined ? {} : { contract: args.contract }),
1040
+ ...(args.useCase === undefined ? {} : { useCase: args.useCase }),
1041
+ ...(args.model === undefined ? {} : { model: args.model }),
1042
+ }, {
1043
+ baseUrl,
1044
+ apiKey,
1045
+ ...(io.fetchImpl === undefined ? {} : { fetchImpl: io.fetchImpl }),
1046
+ }, { out: io.out, err: io.err });
1047
+ return ACCEPT_EXIT[outcome];
1048
+ }
826
1049
  if (args.command === "reviews") {
827
1050
  const outcome = await runReviews({
828
1051
  subcommand: args.reviewsSubcommand,
@@ -862,6 +1085,7 @@ export async function runCli(argv, io) {
862
1085
  ...(args.prompt[0] === undefined ? {} : { target: args.prompt[0] }),
863
1086
  ...(args.model === undefined ? {} : { model: args.model }),
864
1087
  ...(args.file === undefined ? {} : { file: args.file }),
1088
+ ...(args.answerFile === undefined ? {} : { answerFile: args.answerFile }),
865
1089
  ...(args.challengerAction === undefined ? {} : { action: args.challengerAction }),
866
1090
  ...(args.useCase === undefined ? {} : { useCase: args.useCase }),
867
1091
  json: args.json,
@@ -916,6 +1140,7 @@ export async function runCli(argv, io) {
916
1140
  ...(args.prompt[0] === undefined ? {} : { target: args.prompt[0] }),
917
1141
  ...(args.suggestionKinds === undefined ? {} : { kinds: args.suggestionKinds }),
918
1142
  ...(args.artifactRole === undefined ? {} : { artifactRole: args.artifactRole }),
1143
+ ...(args.pattern === undefined ? {} : { pattern: args.pattern }),
919
1144
  yes: args.yes,
920
1145
  json: args.json,
921
1146
  }, {
@@ -929,6 +1154,23 @@ export async function runCli(argv, io) {
929
1154
  });
930
1155
  return SUGGESTIONS_EXIT[outcome];
931
1156
  }
1157
+ if (args.command === "diagnosis") {
1158
+ const outcome = await runDiagnosis({
1159
+ subcommand: args.diagnosisSubcommand,
1160
+ ...(args.prompt[0] === undefined ? {} : { level: args.prompt[0] }),
1161
+ yes: args.yes,
1162
+ json: args.json,
1163
+ }, {
1164
+ baseUrl,
1165
+ apiKey,
1166
+ ...(io.fetchImpl === undefined ? {} : { fetchImpl: io.fetchImpl }),
1167
+ }, {
1168
+ out: io.out,
1169
+ err: io.err,
1170
+ confirm: io.readCredentialImpl ?? ((prompt) => readConfirmationLine(prompt)),
1171
+ });
1172
+ return DIAGNOSIS_EXIT[outcome];
1173
+ }
932
1174
  if (args.command === "keys") {
933
1175
  const outcome = await runKeys({
934
1176
  subcommand: args.keysSubcommand,
@@ -1025,7 +1267,12 @@ export async function runCli(argv, io) {
1025
1267
  ...(args.variantId === undefined ? {} : { variantId: args.variantId }),
1026
1268
  ...(args.datasetId === undefined ? {} : { datasetId: args.datasetId }),
1027
1269
  ...(args.from === undefined ? {} : { from: args.from }),
1270
+ ...(args.file === undefined ? {} : { file: args.file }),
1028
1271
  ...(useCaseId === undefined ? {} : { useCaseId }),
1272
+ ...(args.wait === undefined ? {} : { wait: args.wait }),
1273
+ ...(args.minPassRate === undefined ? {} : { minPassRate: args.minPassRate }),
1274
+ ...(args.baselineRun === undefined ? {} : { baselineRun: args.baselineRun }),
1275
+ ...(args.timeoutMinutes === undefined ? {} : { timeoutMinutes: args.timeoutMinutes }),
1029
1276
  json: args.json,
1030
1277
  };
1031
1278
  const labIo = {
@@ -1034,6 +1281,9 @@ export async function runCli(argv, io) {
1034
1281
  readCases: io.readCredentialImpl === undefined
1035
1282
  ? () => readCredentialFromStdin("")
1036
1283
  : () => io.readCredentialImpl(""),
1284
+ readFile: io.readFileImpl ?? ((path) => readFileSync(path, "utf8")),
1285
+ ...(io.sleepImpl === undefined ? {} : { sleep: io.sleepImpl }),
1286
+ ...(io.nowMsImpl === undefined ? {} : { nowMs: io.nowMsImpl }),
1037
1287
  };
1038
1288
  const outcome = args.command === "datasets"
1039
1289
  ? await runDatasets(invocation, connection, labIo)
@@ -1122,6 +1372,41 @@ const USE_CASES_EXIT = {
1122
1372
  auth: EXIT.AUTH,
1123
1373
  unavailable: EXIT.UNREACHABLE,
1124
1374
  };
1375
+ /**
1376
+ * Where trusted issuer records live: the operator's own machine, beside the session store. They are
1377
+ * the verifier's objects, not Makine's, so they never leave it.
1378
+ */
1379
+ function receiptsStoreDirectory() {
1380
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? ".";
1381
+ return `${home}/.makine`;
1382
+ }
1383
+ /**
1384
+ * The one Part A step that reaches the network, and only for `trust --origin`. The fetch refuses a
1385
+ * redirect to another origin: an origin anchor is exactly as strong as the certificate the web PKI
1386
+ * vouched for at fetch time, and a followed redirect would anchor a host nobody checked.
1387
+ */
1388
+ function fetchReceiptKeySet(io) {
1389
+ return async (origin) => {
1390
+ const url = new URL("/.well-known/makine-receipt-keys.json", origin);
1391
+ if (url.protocol !== "https:") {
1392
+ throw new Error("An origin anchor must be https: there is no certificate to check otherwise.");
1393
+ }
1394
+ const response = await (io.fetchImpl ?? fetch)(url, { redirect: "manual" });
1395
+ if (response.status >= 300 && response.status < 400) {
1396
+ throw new Error("The key set answered a redirect, which is never followed.");
1397
+ }
1398
+ if (!response.ok)
1399
+ throw new Error(`The key set answered ${String(response.status)}.`);
1400
+ return (await response.json());
1401
+ };
1402
+ }
1403
+ const RECEIPTS_EXIT = {
1404
+ ok: EXIT.ACCEPTED,
1405
+ usage: EXIT.USAGE,
1406
+ refused: EXIT.RESULT_NOT_ACCEPTED,
1407
+ // A receipt that did not verify is not an error in the tool; it is the answer.
1408
+ unverified: EXIT.RESULT_NOT_ACCEPTED,
1409
+ };
1125
1410
  const JUDGE_EXIT = {
1126
1411
  ok: EXIT.ACCEPTED,
1127
1412
  usage: EXIT.USAGE,
@@ -1136,6 +1421,13 @@ const SUGGESTIONS_EXIT = {
1136
1421
  auth: EXIT.AUTH,
1137
1422
  unavailable: EXIT.UNREACHABLE,
1138
1423
  };
1424
+ const DIAGNOSIS_EXIT = {
1425
+ ok: EXIT.ACCEPTED,
1426
+ usage: EXIT.USAGE,
1427
+ refused: EXIT.RESULT_NOT_ACCEPTED,
1428
+ auth: EXIT.AUTH,
1429
+ unavailable: EXIT.UNREACHABLE,
1430
+ };
1139
1431
  const KEYS_EXIT = {
1140
1432
  ok: EXIT.ACCEPTED,
1141
1433
  usage: EXIT.USAGE,
@@ -1150,11 +1442,18 @@ const REVIEWS_EXIT = {
1150
1442
  auth: EXIT.AUTH,
1151
1443
  unavailable: EXIT.UNREACHABLE,
1152
1444
  };
1445
+ /**
1446
+ * Under `--wait`, every HTTP refusal other than 401 and 403, the timeout and a `failed` run map to
1447
+ * `gateway`, so a `2` from CI means a gate failure and nothing else. The other subcommands keep
1448
+ * their mapping (ADR 0014 § D14.15).
1449
+ */
1153
1450
  const LAB_EXIT = {
1154
1451
  ok: EXIT.ACCEPTED,
1155
1452
  usage: EXIT.USAGE,
1156
1453
  refused: EXIT.RESULT_NOT_ACCEPTED,
1454
+ gate_failed: EXIT.RESULT_NOT_ACCEPTED,
1157
1455
  auth: EXIT.AUTH,
1456
+ gateway: EXIT.GATEWAY,
1158
1457
  unavailable: EXIT.UNREACHABLE,
1159
1458
  };
1160
1459
  const CONNECTIONS_EXIT = {