@makine/cli 0.7.0 → 0.9.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.
- package/dist/agents/command.d.ts.map +1 -1
- package/dist/agents/command.js +36 -10
- package/dist/agents/command.js.map +1 -1
- package/dist/batches/command.d.ts +36 -0
- package/dist/batches/command.d.ts.map +1 -0
- package/dist/batches/command.js +133 -0
- package/dist/batches/command.js.map +1 -0
- package/dist/contracts/command.js +11 -4
- package/dist/contracts/command.js.map +1 -1
- package/dist/gov-id/command.d.ts +5 -4
- package/dist/gov-id/command.d.ts.map +1 -1
- package/dist/gov-id/command.js +31 -12
- package/dist/gov-id/command.js.map +1 -1
- package/dist/index.d.ts +30 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +293 -22
- package/dist/index.js.map +1 -1
- package/dist/judge/command.js +2 -2
- package/dist/judge/command.js.map +1 -1
- package/dist/lab/command.js +2 -2
- package/dist/lab/command.js.map +1 -1
- package/dist/lab/gate.js +1 -1
- package/dist/lab/gate.js.map +1 -1
- package/dist/library/command.d.ts +35 -0
- package/dist/library/command.d.ts.map +1 -0
- package/dist/library/command.js +199 -0
- package/dist/library/command.js.map +1 -0
- package/dist/login/command.js +1 -1
- package/dist/migrate/litellm.js +12 -12
- package/dist/migrate/litellm.js.map +1 -1
- package/dist/migrate/nodes.js +1 -1
- package/dist/migrate/nodes.js.map +1 -1
- package/dist/migrate/portkey.js +11 -11
- package/dist/migrate/portkey.js.map +1 -1
- package/dist/migrate/render.d.ts.map +1 -1
- package/dist/migrate/render.js +2 -3
- package/dist/migrate/render.js.map +1 -1
- package/dist/migrate/translate.js +3 -3
- package/dist/migrate/translate.js.map +1 -1
- package/dist/receipts/command.d.ts.map +1 -1
- package/dist/receipts/command.js +17 -0
- package/dist/receipts/command.js.map +1 -1
- package/dist/reviews/command.js +2 -2
- package/dist/reviews/command.js.map +1 -1
- package/dist/runs/command.d.ts +10 -7
- package/dist/runs/command.d.ts.map +1 -1
- package/dist/runs/command.js +223 -8
- package/dist/runs/command.js.map +1 -1
- package/dist/suggestions/command.js +6 -6
- package/dist/suggestions/command.js.map +1 -1
- package/dist/threads/command.d.ts +35 -0
- package/dist/threads/command.d.ts.map +1 -0
- package/dist/threads/command.js +135 -0
- package/dist/threads/command.js.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21,6 +21,9 @@ import { CONNECTIONS_SUBCOMMANDS, runConnections, } from "./connections/command.
|
|
|
21
21
|
import { WORKFLOWS_SUBCOMMANDS, runWorkflows, } from "./workflows/command.js";
|
|
22
22
|
import { AGENTS_SUBCOMMANDS, isAgentsSubcommand, runAgents, } from "./agents/command.js";
|
|
23
23
|
import { RUNS_SUBCOMMANDS, isRunsSubcommand, runRuns, } from "./runs/command.js";
|
|
24
|
+
import { BATCHES_SUBCOMMANDS, isBatchesSubcommand, runBatches, } from "./batches/command.js";
|
|
25
|
+
import { THREADS_SUBCOMMANDS, isThreadsSubcommand, runThreads, } from "./threads/command.js";
|
|
26
|
+
import { LIBRARY_SUBCOMMANDS, isLibrarySubcommand, runLibrary, } from "./library/command.js";
|
|
24
27
|
import { CORRECTIONS_SUBCOMMANDS, DATASETS_SUBCOMMANDS, EXPERIMENTS_SUBCOMMANDS, isCorrectionsSubcommand, isDatasetsSubcommand, isExperimentsSubcommand, runCorrections, runDatasets, runExperiments, } from "./lab/command.js";
|
|
25
28
|
import { runLogin, runLogout } from "./login/command.js";
|
|
26
29
|
import { REVIEWS_SUBCOMMANDS, isReviewAction, isReviewsSubcommand, runReviews, } from "./reviews/command.js";
|
|
@@ -135,6 +138,7 @@ USAGE
|
|
|
135
138
|
makine keys <cmd> Create, list, revoke and rotate this workspace's API keys
|
|
136
139
|
makine contracts <cmd> Define what a good result is, and make it live
|
|
137
140
|
makine use-cases <cmd> Name a job, give it an address, and point it at a model
|
|
141
|
+
makine library <cmd> Search the notes Makine ships and the ones this workspace wrote
|
|
138
142
|
makine judge <cmd> Switch the semantic judge on or off for this workspace
|
|
139
143
|
makine gov-id <cmd> Which cloud vendors may receive government-ID data, and hints
|
|
140
144
|
makine receipts <cmd> Read a run's receipt, and verify the receipts an issuer signed
|
|
@@ -198,7 +202,7 @@ WORKFLOWS
|
|
|
198
202
|
|
|
199
203
|
Approving a host opens it to every container in this workspace, on ports 80 and 443, and a
|
|
200
204
|
container that can reach any host can send data out through DNS lookups. \`approve-host\` prints
|
|
201
|
-
that first and
|
|
205
|
+
that first and waits for --acknowledge-egress before it writes.
|
|
202
206
|
|
|
203
207
|
\`define --header\` and \`credential\` read the step credential from STDIN and from nowhere else:
|
|
204
208
|
|
|
@@ -218,7 +222,7 @@ OUTSIDE AGENTS
|
|
|
218
222
|
makine agents retire <agent_id> Stop new runs; history and running attempts stay
|
|
219
223
|
|
|
220
224
|
Registering an agent sends this workspace's task input to a company Makine has never evaluated.
|
|
221
|
-
\`register\` prints what that means and
|
|
225
|
+
\`register\` prints what that means and waits for --acknowledge-egress before it writes, and the
|
|
222
226
|
agent's host must already be approved with \`makine workflows approve-host\`.
|
|
223
227
|
|
|
224
228
|
--artifact repeats, once per thing the agent must deliver; the A2A artifact name defaults to the
|
|
@@ -238,9 +242,18 @@ OUTSIDE AGENTS
|
|
|
238
242
|
RUNS
|
|
239
243
|
makine runs submit --executor <ref> --contract <id>@<version> --input <file.json> [--wait]
|
|
240
244
|
makine runs show <task_id> The run's state, or its outcome once it settles
|
|
245
|
+
makine runs download <task_id> [--format md|docx|pdf] [--out <path>] [--force]
|
|
246
|
+
|
|
247
|
+
A settled run also prints each tool Makine bought with its supplier and the price charged, and
|
|
248
|
+
what the run cost by part. \`--json\` prints the Task as the API sent it and adds neither.
|
|
249
|
+
|
|
250
|
+
\`download\` saves the run's answer as a Markdown, Word or PDF file and prints the path it wrote.
|
|
251
|
+
It needs \`makine login\`, as reading a run's answer does. Without --out it saves the name the
|
|
252
|
+
server suggests — the agent's name and the run's date — in the current directory; --out takes a
|
|
253
|
+
file to write or a directory to write that name into. An existing file is kept unless --force.
|
|
241
254
|
|
|
242
255
|
\`submit\` sends the file's JSON as the run's input and prints the task id on stdout, so
|
|
243
|
-
\`TASK=$(makine runs submit ...)\` captures it
|
|
256
|
+
\`TASK=$(makine runs submit ...)\` captures it alone. --wait polls until the run
|
|
244
257
|
settles and prints the state it settled in; --timeout-minutes bounds the wait (30 by default),
|
|
245
258
|
and a run still going when that passes keeps going — read it later with \`show\`.
|
|
246
259
|
|
|
@@ -248,6 +261,38 @@ RUNS
|
|
|
248
261
|
was parked for a person, or has not settled yet — in the last case it is still going, so read it
|
|
249
262
|
again rather than submitting a second time. \`show\` reports the same way.
|
|
250
263
|
|
|
264
|
+
THREADS
|
|
265
|
+
makine threads start --agent <agent_id> [--test-run] <message>
|
|
266
|
+
makine threads show <task_id> --agent <agent_id>
|
|
267
|
+
makine threads reply <task_id> --agent <agent_id> <message>
|
|
268
|
+
|
|
269
|
+
A thread is a run somebody started and the replies that continue from its answer. A reply is a
|
|
270
|
+
new run that is given the thread so far: the earlier requests and answers, and what their tools
|
|
271
|
+
returned, within a bounded budget, with the oldest turns cut to their opening and then dropped
|
|
272
|
+
where the whole does not fit. A reply runs on the same access and grants as the turn before it.
|
|
273
|
+
A reply to a live turn runs the version in use when it is sent; a reply to a test run is a
|
|
274
|
+
test run of the version that turn ran, and is refused if that version can no longer run. Only
|
|
275
|
+
the person who started a thread may reply in it, so this needs \`makine login\`; a run a program
|
|
276
|
+
started is not a thread anyone replies in.
|
|
277
|
+
|
|
278
|
+
BATCHES
|
|
279
|
+
makine batches start --agent <agent_id> --instruction <text> --items <file> [--test-run]
|
|
280
|
+
makine batches show <batch_id> --agent <agent_id>
|
|
281
|
+
makine batches retry-failed <batch_id> --agent <agent_id>
|
|
282
|
+
|
|
283
|
+
A batch is one piece of work made of one run each: --items is a file with one thing to work on
|
|
284
|
+
per line, and --instruction is what the agent is told to do with each of them. A batch holds at
|
|
285
|
+
most 500 items and starts them a few at a time, never all at once, so a long batch does not
|
|
286
|
+
spend an allowance in one go. \`start\` prints what it is expected to cost before any run finishes,
|
|
287
|
+
from what this version's own finished runs have charged.
|
|
288
|
+
|
|
289
|
+
\`show\` prints every item with its outcome, what it cost and its run id, failed items first.
|
|
290
|
+
\`retry-failed\` starts the failed ones again and carries on with any the batch never reached. An
|
|
291
|
+
item whose run already made a change outside Makine, began one, or still has one waiting for
|
|
292
|
+
approval is left alone and says so: open that run and answer it instead.
|
|
293
|
+
|
|
294
|
+
--test-run runs the whole batch without anything reaching outside Makine.
|
|
295
|
+
|
|
251
296
|
This is the Runner's path, and the only one an \`agent.\` reference reaches. \`makine run\` is the
|
|
252
297
|
Gateway's chat completion, which never reaches an outside agent.
|
|
253
298
|
|
|
@@ -291,7 +336,7 @@ HUMAN REVIEW
|
|
|
291
336
|
workspace key is refused, and MAKINE_API_KEY is sent in preference to a stored session, so unset
|
|
292
337
|
it first. The text is printed with every control character as a visible \\uXXXX escape, so a
|
|
293
338
|
stored escape sequence cannot make your terminal show something other than what is stored.
|
|
294
|
-
|
|
339
|
+
No file is written to disk. A document input shows its type, size and hash, never its bytes.
|
|
295
340
|
|
|
296
341
|
Accepting or rejecting writes a permanent test case. \`bulk\` asks for confirmation unless
|
|
297
342
|
\`--yes\` is given, and takes at most one page of ids.
|
|
@@ -317,7 +362,7 @@ API KEYS
|
|
|
317
362
|
makine keys rotate [<api_key_id>] Replaces one key and prints the successor
|
|
318
363
|
|
|
319
364
|
\`create\` and \`rotate\` print the key alone on stdout and everything else on stderr, so
|
|
320
|
-
\`MAKINE_API_KEY=$(makine keys create --name ci)\` captures the credential
|
|
365
|
+
\`MAKINE_API_KEY=$(makine keys create --name ci)\` captures the credential alone. The
|
|
321
366
|
key is never written to a file. Creating a key needs \`makine login\`: a workspace key may only
|
|
322
367
|
list keys, and revoke or rotate itself.
|
|
323
368
|
|
|
@@ -353,14 +398,14 @@ CONTRACTS
|
|
|
353
398
|
|
|
354
399
|
An <id> is either the canonical id a read returned or the local part; both resolve. The file
|
|
355
400
|
names its checks and repair plan by their local id. A contract is submitted before anything it
|
|
356
|
-
pins is registered, so a refused contract leaves
|
|
401
|
+
pins is registered, so a refused contract leaves the registry as it was. The API is the only validator:
|
|
357
402
|
refusals are printed as the route worded them. Exit 2 means the request was refused.
|
|
358
403
|
|
|
359
404
|
USE CASES
|
|
360
405
|
makine use-cases list [--include-retired] Display name, address, target and figures
|
|
361
406
|
makine use-cases show <address> Addresses and their traffic, contract, figures
|
|
362
407
|
makine use-cases create <address> [--name <display>] [--model <model>]
|
|
363
|
-
makine use-cases name <address> <display name> What screens show;
|
|
408
|
+
makine use-cases name <address> <display name> What screens show; the rest stays
|
|
364
409
|
makine use-cases point <address> --model <model> Move the job to another model
|
|
365
410
|
makine use-cases rename <address> <new address> The old address keeps resolving
|
|
366
411
|
makine use-cases remove-address <address> Free an older address for someone else
|
|
@@ -373,6 +418,20 @@ USE CASES
|
|
|
373
418
|
how you organise traffic a model is already taking. Removing an address is the only thing that
|
|
374
419
|
frees it for another use case.
|
|
375
420
|
|
|
421
|
+
LIBRARY
|
|
422
|
+
makine library search <words> [--kind template|note] [--scope shipped|workspace]
|
|
423
|
+
makine library show <name> [--scope shipped|workspace] [--version <n>] [--as-skill]
|
|
424
|
+
makine library adopted --agent <agent_id>
|
|
425
|
+
|
|
426
|
+
The library holds reusable notes: what good work looks like for a job, the questions people
|
|
427
|
+
forget, the checks worth running. Makine ships a set with every release; your workspace can
|
|
428
|
+
write its own, and a workspace note with a shipped note's name is the one you get here — read
|
|
429
|
+
the other with --scope. Search reads the title, the search terms, the name, the description,
|
|
430
|
+
every other field and the body, and Turkish and English find each other: \`isik\`, \`ışık\` and
|
|
431
|
+
\`IŞIK\` are one word. \`show\` prints a note with what it links to and what links to it;
|
|
432
|
+
--as-skill prints it as the SKILL.md another tool can read. \`adopted\` lists the notes an
|
|
433
|
+
agent's version in use works to, as that version pinned them.
|
|
434
|
+
|
|
376
435
|
RECEIPTS
|
|
377
436
|
makine receipts show <task_id> [--out <file>] One run's receipt, exactly as signed
|
|
378
437
|
makine receipts trust <name> --origin <https-origin> Anchor an issuer by fetching its key list
|
|
@@ -394,7 +453,7 @@ THE SEMANTIC JUDGE
|
|
|
394
453
|
a rule cannot express. It is off until this workspace switches it on. \`enable\` prints the
|
|
395
454
|
statement you are agreeing to and asks you to type yes; \`--yes\` skips that prompt, and the
|
|
396
455
|
statement is printed either way. Switching it on or off needs a session or a workspace key; a
|
|
397
|
-
bare program key may read \`show\`
|
|
456
|
+
bare program key may read \`show\` alone.
|
|
398
457
|
|
|
399
458
|
\`show\` also reports the deployment operator's own switch. Both must be on for anything to be
|
|
400
459
|
judged, so a workspace that has consented and sees no judgments can tell whose switch is off.
|
|
@@ -404,6 +463,7 @@ GOVERNMENT-ID DATA
|
|
|
404
463
|
makine gov-id acknowledge <vendor> [--yes] Allow one cloud vendor to receive it
|
|
405
464
|
makine gov-id revoke <vendor> Take that permission back
|
|
406
465
|
makine gov-id detection on|off Switch the hints on or off for this workspace
|
|
466
|
+
makine gov-id business-hints on|off Hint a company's own numbers in a public lookup
|
|
407
467
|
|
|
408
468
|
A contract that carries a government identity or tax number is not sent to a cloud model until
|
|
409
469
|
somebody here has allowed that vendor, once. \`acknowledge\` prints the warning and asks you to
|
|
@@ -411,9 +471,14 @@ GOVERNMENT-ID DATA
|
|
|
411
471
|
network is never affected. The vendor is the name a call's address resolves to — \`openai\`,
|
|
412
472
|
\`anthropic\`, or the host name of another endpoint — so allowing one never allows another.
|
|
413
473
|
|
|
414
|
-
Hints are separate and
|
|
415
|
-
|
|
416
|
-
account; switching
|
|
474
|
+
Hints are separate and block no step: Makine says an input may hold a national ID or tax number,
|
|
475
|
+
names the country and the field, and never the number. Allowing a vendor needs a signed-in
|
|
476
|
+
account; switching either kind of hint needs a session or a workspace key.
|
|
477
|
+
|
|
478
|
+
A company's own numbers — a VAT, company or legal-entity registration — found by a public look-up
|
|
479
|
+
raise no hint: they are printed on the company's invoices and sit in a public register.
|
|
480
|
+
\`business-hints on\` hints them there too. A person's number in the same answer, and any number in
|
|
481
|
+
your own input or in an account you connected, is hinted either way.
|
|
417
482
|
|
|
418
483
|
SUGGESTIONS
|
|
419
484
|
makine suggestions show Whether they are on, which model, the statement
|
|
@@ -427,8 +492,8 @@ SUGGESTIONS
|
|
|
427
492
|
makine suggestions dismiss <suggestion_id> Dismiss one
|
|
428
493
|
|
|
429
494
|
Makine suggests four things: instructions to add to your prompt, a further pattern check, a basic
|
|
430
|
-
data schema, and a fix for a failure group. **You approve every one**, and
|
|
431
|
-
writes
|
|
495
|
+
data schema, and a fix for a failure group. **You approve every one**, and what a suggestion
|
|
496
|
+
writes stays out of use — activating a contract is still a separate step.
|
|
432
497
|
|
|
433
498
|
A data schema is computed by Makine from your own accepted answers, with no model call, and a fix
|
|
434
499
|
comes from Makine's fixed rule when suggestions are off. The other two need a model, so they are
|
|
@@ -439,7 +504,7 @@ SUGGESTIONS
|
|
|
439
504
|
pattern that admits them, and a change to what your request asks for. Makine reads the group's
|
|
440
505
|
rejected answers to find them only once this workspace allows it (\`makine diagnosis\`), and only
|
|
441
506
|
when you ask: \`draft\` without \`--kinds\` asks for them. Approving a change to your request marks
|
|
442
|
-
it as done and writes
|
|
507
|
+
it as done and writes no version.
|
|
443
508
|
|
|
444
509
|
Suggestion spend is your own, on your own key. It is **not** counted in usage metering or against
|
|
445
510
|
a budget ceiling. Every subcommand here needs a session or a workspace key; a bare program key is
|
|
@@ -451,7 +516,7 @@ DIAGNOSIS — near misses
|
|
|
451
516
|
|
|
452
517
|
At \`in-workspace\`, when someone asks for suggestions on a failure group, Makine reads up to 20
|
|
453
518
|
of that group's rejected answers inside this workspace to spot a near miss, and stores only what
|
|
454
|
-
kind of mismatch it was.
|
|
519
|
+
kind of mismatch it was. It stays in this workspace. \`level\` prints the statement and sends back
|
|
455
520
|
the version it printed. Changing the level needs \`makine login\`: a workspace key is refused.
|
|
456
521
|
|
|
457
522
|
BASELINE — the before/after report
|
|
@@ -460,7 +525,7 @@ BASELINE — the before/after report
|
|
|
460
525
|
makine baseline show <baseline-set-id> Exclusions, then the three numbers
|
|
461
526
|
makine baseline delete <baseline-set-id> Removes the set and its members
|
|
462
527
|
|
|
463
|
-
A set is drawn from your own past requests — you upload
|
|
528
|
+
A set is drawn from your own past requests — you upload no file and name no request ids. The
|
|
464
529
|
window is [from,to) over when each request was submitted. Both ends are RFC 3339 date-times
|
|
465
530
|
carrying an explicit zone — 2026-09-01T00:00:00Z or 2026-09-01T00:00:00+03:00 — and a zone is
|
|
466
531
|
never guessed, so an entry without one is refused rather than read in the server's zone. The set
|
|
@@ -477,7 +542,7 @@ MIGRATE OPTIONS (offline — reads the file, never calls a provider)
|
|
|
477
542
|
--json Print the settings, the field mapping and the report as JSON.
|
|
478
543
|
|
|
479
544
|
Prints the settings it could produce, then a report naming every construct it did not
|
|
480
|
-
translate and why.
|
|
545
|
+
translate and why. Every value is accounted for, and no credential field is copied. An
|
|
481
546
|
endpoint is copied whole, path included, because the path is the endpoint.
|
|
482
547
|
See docs/developers/migrating-from-portkey-or-litellm.md.
|
|
483
548
|
|
|
@@ -593,8 +658,8 @@ export function parseArgs(argv) {
|
|
|
593
658
|
args.govIdSubcommand = sub;
|
|
594
659
|
const positional = argv[2];
|
|
595
660
|
if (positional !== undefined && !positional.startsWith("-")) {
|
|
596
|
-
if (sub === "detection")
|
|
597
|
-
args.
|
|
661
|
+
if (sub === "detection" || sub === "business-hints")
|
|
662
|
+
args.govIdChoice = positional;
|
|
598
663
|
else
|
|
599
664
|
args.govIdVendor = positional;
|
|
600
665
|
index = 3;
|
|
@@ -687,6 +752,42 @@ export function parseArgs(argv) {
|
|
|
687
752
|
args.runsSubcommand = sub;
|
|
688
753
|
index = 2;
|
|
689
754
|
}
|
|
755
|
+
else if (head === "batches") {
|
|
756
|
+
args.command = head;
|
|
757
|
+
const sub = argv[1];
|
|
758
|
+
if (sub === undefined || !isBatchesSubcommand(sub)) {
|
|
759
|
+
return {
|
|
760
|
+
ok: false,
|
|
761
|
+
message: `\`makine batches\` needs one of ${BATCHES_SUBCOMMANDS.join(", ")}.`,
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
args.batchesSubcommand = sub;
|
|
765
|
+
index = 2;
|
|
766
|
+
}
|
|
767
|
+
else if (head === "threads") {
|
|
768
|
+
args.command = head;
|
|
769
|
+
const sub = argv[1];
|
|
770
|
+
if (sub === undefined || !isThreadsSubcommand(sub)) {
|
|
771
|
+
return {
|
|
772
|
+
ok: false,
|
|
773
|
+
message: `\`makine threads\` needs one of ${THREADS_SUBCOMMANDS.join(", ")}.`,
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
args.threadsSubcommand = sub;
|
|
777
|
+
index = 2;
|
|
778
|
+
}
|
|
779
|
+
else if (head === "library") {
|
|
780
|
+
args.command = head;
|
|
781
|
+
const sub = argv[1];
|
|
782
|
+
if (sub === undefined || !isLibrarySubcommand(sub)) {
|
|
783
|
+
return {
|
|
784
|
+
ok: false,
|
|
785
|
+
message: `\`makine library\` needs one of ${LIBRARY_SUBCOMMANDS.join(", ")}.`,
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
args.librarySubcommand = sub;
|
|
789
|
+
index = 2;
|
|
790
|
+
}
|
|
690
791
|
else if (head === "baseline") {
|
|
691
792
|
args.command = head;
|
|
692
793
|
const sub = argv[1];
|
|
@@ -859,13 +960,27 @@ export function parseArgs(argv) {
|
|
|
859
960
|
case "--out":
|
|
860
961
|
// The flag switch is shared by every command, so another command would otherwise take
|
|
861
962
|
// `--out` and silently drop it.
|
|
862
|
-
if (args.command !== "receipts") {
|
|
863
|
-
throw new CliUsageError("`--out` only applies to `makine receipts show`.");
|
|
963
|
+
if (args.command !== "receipts" && args.command !== "runs") {
|
|
964
|
+
throw new CliUsageError("`--out` only applies to `makine receipts show` and `makine runs download`.");
|
|
864
965
|
}
|
|
865
966
|
if (needsValue(token, next))
|
|
866
967
|
args.out = next;
|
|
867
968
|
index += 1;
|
|
868
969
|
break;
|
|
970
|
+
case "--format":
|
|
971
|
+
if (args.command !== "runs") {
|
|
972
|
+
throw new CliUsageError("`--format` only applies to `makine runs download`.");
|
|
973
|
+
}
|
|
974
|
+
if (needsValue(token, next))
|
|
975
|
+
args.format = next;
|
|
976
|
+
index += 1;
|
|
977
|
+
break;
|
|
978
|
+
case "--force":
|
|
979
|
+
if (args.command !== "runs") {
|
|
980
|
+
throw new CliUsageError("`--force` only applies to `makine runs download`.");
|
|
981
|
+
}
|
|
982
|
+
args.force = true;
|
|
983
|
+
break;
|
|
869
984
|
case "--system":
|
|
870
985
|
if (needsValue(token, next))
|
|
871
986
|
args.system = next;
|
|
@@ -881,6 +996,73 @@ export function parseArgs(argv) {
|
|
|
881
996
|
args.input = next;
|
|
882
997
|
index += 1;
|
|
883
998
|
break;
|
|
999
|
+
case "--agent":
|
|
1000
|
+
if (args.command !== "batches" &&
|
|
1001
|
+
args.command !== "threads" &&
|
|
1002
|
+
args.command !== "library") {
|
|
1003
|
+
throw new CliUsageError("`--agent` only applies to `makine batches`, `makine threads` and `makine library adopted`.");
|
|
1004
|
+
}
|
|
1005
|
+
if (needsValue(token, next))
|
|
1006
|
+
args.agent = next;
|
|
1007
|
+
index += 1;
|
|
1008
|
+
break;
|
|
1009
|
+
case "--kind":
|
|
1010
|
+
if (args.command !== "library") {
|
|
1011
|
+
throw new CliUsageError("`--kind` only applies to `makine library`.");
|
|
1012
|
+
}
|
|
1013
|
+
if (needsValue(token, next))
|
|
1014
|
+
args.libraryKind = next;
|
|
1015
|
+
index += 1;
|
|
1016
|
+
break;
|
|
1017
|
+
case "--scope":
|
|
1018
|
+
if (args.command !== "library") {
|
|
1019
|
+
throw new CliUsageError("`--scope` only applies to `makine library`.");
|
|
1020
|
+
}
|
|
1021
|
+
if (needsValue(token, next))
|
|
1022
|
+
args.libraryScope = next;
|
|
1023
|
+
index += 1;
|
|
1024
|
+
break;
|
|
1025
|
+
case "--as-skill":
|
|
1026
|
+
if (args.command !== "library") {
|
|
1027
|
+
throw new CliUsageError("`--as-skill` only applies to `makine library show`.");
|
|
1028
|
+
}
|
|
1029
|
+
args.asSkill = true;
|
|
1030
|
+
break;
|
|
1031
|
+
// `makine --version` prints the CLI's own version and never reaches here, because that
|
|
1032
|
+
// form is read as the head word before any flag is parsed.
|
|
1033
|
+
case "--version":
|
|
1034
|
+
if (args.command !== "library") {
|
|
1035
|
+
throw new CliUsageError("`--version` only applies to `makine library show`.");
|
|
1036
|
+
}
|
|
1037
|
+
if (needsValue(token, next))
|
|
1038
|
+
args.libraryVersion = next;
|
|
1039
|
+
index += 1;
|
|
1040
|
+
break;
|
|
1041
|
+
case "--instruction":
|
|
1042
|
+
if (args.command !== "batches") {
|
|
1043
|
+
throw new CliUsageError("`--instruction` only applies to `makine batches start`.");
|
|
1044
|
+
}
|
|
1045
|
+
if (needsValue(token, next))
|
|
1046
|
+
args.instruction = next;
|
|
1047
|
+
index += 1;
|
|
1048
|
+
break;
|
|
1049
|
+
case "--items":
|
|
1050
|
+
if (args.command !== "batches") {
|
|
1051
|
+
throw new CliUsageError("`--items` only applies to `makine batches start`.");
|
|
1052
|
+
}
|
|
1053
|
+
if (needsValue(token, next))
|
|
1054
|
+
args.items = next;
|
|
1055
|
+
index += 1;
|
|
1056
|
+
break;
|
|
1057
|
+
// `--try-out` is what this flag was called before a test run was named one; it stays
|
|
1058
|
+
// accepted so a script written against it keeps working.
|
|
1059
|
+
case "--test-run":
|
|
1060
|
+
case "--try-out":
|
|
1061
|
+
if (args.command !== "batches" && args.command !== "threads") {
|
|
1062
|
+
throw new CliUsageError(`\`${token}\` only applies to \`makine batches start\` and \`makine threads start\`.`);
|
|
1063
|
+
}
|
|
1064
|
+
args.tryOut = true;
|
|
1065
|
+
break;
|
|
884
1066
|
case "--max-tokens":
|
|
885
1067
|
if (needsValue(token, next))
|
|
886
1068
|
args.maxTokens = parseNumber(token, next);
|
|
@@ -1360,7 +1542,7 @@ export async function runCli(argv, io) {
|
|
|
1360
1542
|
const outcome = await runGovId({
|
|
1361
1543
|
subcommand: args.govIdSubcommand,
|
|
1362
1544
|
...(args.govIdVendor === undefined ? {} : { vendor: args.govIdVendor }),
|
|
1363
|
-
...(args.
|
|
1545
|
+
...(args.govIdChoice === undefined ? {} : { choice: args.govIdChoice }),
|
|
1364
1546
|
yes: args.yes,
|
|
1365
1547
|
json: args.json,
|
|
1366
1548
|
}, {
|
|
@@ -1509,6 +1691,9 @@ export async function runCli(argv, io) {
|
|
|
1509
1691
|
...(args.executor === undefined ? {} : { executor: args.executor }),
|
|
1510
1692
|
...(args.contract === undefined ? {} : { contract: args.contract }),
|
|
1511
1693
|
...(inputJson === undefined ? {} : { input: inputJson }),
|
|
1694
|
+
...(args.format === undefined ? {} : { format: args.format }),
|
|
1695
|
+
...(args.out === undefined ? {} : { out: args.out }),
|
|
1696
|
+
...(args.force === undefined ? {} : { force: args.force }),
|
|
1512
1697
|
...(args.wait === undefined ? {} : { wait: args.wait }),
|
|
1513
1698
|
...(args.timeoutMinutes === undefined ? {} : { timeoutMinutes: args.timeoutMinutes }),
|
|
1514
1699
|
json: args.json,
|
|
@@ -1525,6 +1710,71 @@ export async function runCli(argv, io) {
|
|
|
1525
1710
|
});
|
|
1526
1711
|
return RUNS_EXIT[outcome];
|
|
1527
1712
|
}
|
|
1713
|
+
if (args.command === "batches") {
|
|
1714
|
+
// The file is read here, as `runs submit` reads its input, so the command module stays a pure
|
|
1715
|
+
// function of what it was given.
|
|
1716
|
+
let itemsFile;
|
|
1717
|
+
if (args.items !== undefined) {
|
|
1718
|
+
try {
|
|
1719
|
+
itemsFile = (io.readFileImpl ?? ((path) => readFileSync(path, "utf8")))(args.items);
|
|
1720
|
+
}
|
|
1721
|
+
catch (error) {
|
|
1722
|
+
io.err(`Cannot read --items ${args.items}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1723
|
+
return EXIT.USAGE;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
const outcome = await runBatches({
|
|
1727
|
+
subcommand: args.batchesSubcommand,
|
|
1728
|
+
...(args.agent === undefined ? {} : { agent: args.agent }),
|
|
1729
|
+
...(args.prompt[0] === undefined ? {} : { batch: args.prompt[0] }),
|
|
1730
|
+
...(args.instruction === undefined ? {} : { input: args.instruction }),
|
|
1731
|
+
...(itemsFile === undefined ? {} : { itemsFile }),
|
|
1732
|
+
...(args.tryOut === undefined ? {} : { tryOut: args.tryOut }),
|
|
1733
|
+
json: args.json,
|
|
1734
|
+
}, {
|
|
1735
|
+
baseUrl,
|
|
1736
|
+
apiKey,
|
|
1737
|
+
...(io.fetchImpl === undefined ? {} : { fetchImpl: io.fetchImpl }),
|
|
1738
|
+
}, { out: io.out, err: io.err });
|
|
1739
|
+
return BATCHES_EXIT[outcome];
|
|
1740
|
+
}
|
|
1741
|
+
if (args.command === "threads") {
|
|
1742
|
+
// `start` takes its message as the free words; `show` and `reply` take the run id first and
|
|
1743
|
+
// the message after it, so one positional list serves all three.
|
|
1744
|
+
const start = args.threadsSubcommand === "start";
|
|
1745
|
+
const said = (start ? args.prompt : args.prompt.slice(1)).join(" ").trim();
|
|
1746
|
+
const outcome = await runThreads({
|
|
1747
|
+
subcommand: args.threadsSubcommand,
|
|
1748
|
+
...(args.agent === undefined ? {} : { agent: args.agent }),
|
|
1749
|
+
...(start || args.prompt[0] === undefined ? {} : { taskId: args.prompt[0] }),
|
|
1750
|
+
...(said.length === 0 ? {} : { input: said }),
|
|
1751
|
+
...(args.tryOut === undefined ? {} : { tryOut: args.tryOut }),
|
|
1752
|
+
json: args.json,
|
|
1753
|
+
}, {
|
|
1754
|
+
baseUrl,
|
|
1755
|
+
apiKey,
|
|
1756
|
+
...(io.fetchImpl === undefined ? {} : { fetchImpl: io.fetchImpl }),
|
|
1757
|
+
}, { out: io.out, err: io.err });
|
|
1758
|
+
return THREADS_EXIT[outcome];
|
|
1759
|
+
}
|
|
1760
|
+
if (args.command === "library") {
|
|
1761
|
+
const words = args.prompt.join(" ").trim();
|
|
1762
|
+
const outcome = await runLibrary({
|
|
1763
|
+
subcommand: args.librarySubcommand,
|
|
1764
|
+
...(words.length === 0 ? {} : { target: words }),
|
|
1765
|
+
...(args.libraryKind === undefined ? {} : { kind: args.libraryKind }),
|
|
1766
|
+
...(args.libraryScope === undefined ? {} : { scope: args.libraryScope }),
|
|
1767
|
+
...(args.libraryVersion === undefined ? {} : { version: args.libraryVersion }),
|
|
1768
|
+
...(args.agent === undefined ? {} : { agent: args.agent }),
|
|
1769
|
+
...(args.asSkill === undefined ? {} : { asSkill: args.asSkill }),
|
|
1770
|
+
json: args.json,
|
|
1771
|
+
}, {
|
|
1772
|
+
baseUrl,
|
|
1773
|
+
apiKey,
|
|
1774
|
+
...(io.fetchImpl === undefined ? {} : { fetchImpl: io.fetchImpl }),
|
|
1775
|
+
}, { out: io.out, err: io.err });
|
|
1776
|
+
return LIBRARY_EXIT[outcome];
|
|
1777
|
+
}
|
|
1528
1778
|
if (args.command === "baseline") {
|
|
1529
1779
|
const baseline = new MakineBaselineClient({
|
|
1530
1780
|
baseUrl,
|
|
@@ -1806,6 +2056,27 @@ const RUNS_EXIT = {
|
|
|
1806
2056
|
auth: EXIT.AUTH,
|
|
1807
2057
|
unavailable: EXIT.UNREACHABLE,
|
|
1808
2058
|
};
|
|
2059
|
+
const BATCHES_EXIT = {
|
|
2060
|
+
ok: EXIT.ACCEPTED,
|
|
2061
|
+
usage: EXIT.USAGE,
|
|
2062
|
+
refused: EXIT.RESULT_NOT_ACCEPTED,
|
|
2063
|
+
auth: EXIT.AUTH,
|
|
2064
|
+
unavailable: EXIT.UNREACHABLE,
|
|
2065
|
+
};
|
|
2066
|
+
const THREADS_EXIT = {
|
|
2067
|
+
ok: EXIT.ACCEPTED,
|
|
2068
|
+
usage: EXIT.USAGE,
|
|
2069
|
+
refused: EXIT.RESULT_NOT_ACCEPTED,
|
|
2070
|
+
auth: EXIT.AUTH,
|
|
2071
|
+
unavailable: EXIT.UNREACHABLE,
|
|
2072
|
+
};
|
|
2073
|
+
const LIBRARY_EXIT = {
|
|
2074
|
+
ok: EXIT.ACCEPTED,
|
|
2075
|
+
usage: EXIT.USAGE,
|
|
2076
|
+
refused: EXIT.RESULT_NOT_ACCEPTED,
|
|
2077
|
+
auth: EXIT.AUTH,
|
|
2078
|
+
unavailable: EXIT.UNREACHABLE,
|
|
2079
|
+
};
|
|
1809
2080
|
const BASELINE_EXIT = {
|
|
1810
2081
|
ok: EXIT.ACCEPTED,
|
|
1811
2082
|
usage: EXIT.USAGE,
|