@makine/cli 0.8.1 → 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.js +2 -2
- 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 +1 -1
- package/dist/contracts/command.js.map +1 -1
- package/dist/gov-id/command.js +3 -3
- package/dist/gov-id/command.js.map +1 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +254 -15
- 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/reviews/command.js +2 -2
- package/dist/reviews/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
|
|
@@ -249,7 +253,7 @@ RUNS
|
|
|
249
253
|
file to write or a directory to write that name into. An existing file is kept unless --force.
|
|
250
254
|
|
|
251
255
|
\`submit\` sends the file's JSON as the run's input and prints the task id on stdout, so
|
|
252
|
-
\`TASK=$(makine runs submit ...)\` captures it
|
|
256
|
+
\`TASK=$(makine runs submit ...)\` captures it alone. --wait polls until the run
|
|
253
257
|
settles and prints the state it settled in; --timeout-minutes bounds the wait (30 by default),
|
|
254
258
|
and a run still going when that passes keeps going — read it later with \`show\`.
|
|
255
259
|
|
|
@@ -257,6 +261,38 @@ RUNS
|
|
|
257
261
|
was parked for a person, or has not settled yet — in the last case it is still going, so read it
|
|
258
262
|
again rather than submitting a second time. \`show\` reports the same way.
|
|
259
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
|
+
|
|
260
296
|
This is the Runner's path, and the only one an \`agent.\` reference reaches. \`makine run\` is the
|
|
261
297
|
Gateway's chat completion, which never reaches an outside agent.
|
|
262
298
|
|
|
@@ -300,7 +336,7 @@ HUMAN REVIEW
|
|
|
300
336
|
workspace key is refused, and MAKINE_API_KEY is sent in preference to a stored session, so unset
|
|
301
337
|
it first. The text is printed with every control character as a visible \\uXXXX escape, so a
|
|
302
338
|
stored escape sequence cannot make your terminal show something other than what is stored.
|
|
303
|
-
|
|
339
|
+
No file is written to disk. A document input shows its type, size and hash, never its bytes.
|
|
304
340
|
|
|
305
341
|
Accepting or rejecting writes a permanent test case. \`bulk\` asks for confirmation unless
|
|
306
342
|
\`--yes\` is given, and takes at most one page of ids.
|
|
@@ -326,7 +362,7 @@ API KEYS
|
|
|
326
362
|
makine keys rotate [<api_key_id>] Replaces one key and prints the successor
|
|
327
363
|
|
|
328
364
|
\`create\` and \`rotate\` print the key alone on stdout and everything else on stderr, so
|
|
329
|
-
\`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
|
|
330
366
|
key is never written to a file. Creating a key needs \`makine login\`: a workspace key may only
|
|
331
367
|
list keys, and revoke or rotate itself.
|
|
332
368
|
|
|
@@ -362,14 +398,14 @@ CONTRACTS
|
|
|
362
398
|
|
|
363
399
|
An <id> is either the canonical id a read returned or the local part; both resolve. The file
|
|
364
400
|
names its checks and repair plan by their local id. A contract is submitted before anything it
|
|
365
|
-
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:
|
|
366
402
|
refusals are printed as the route worded them. Exit 2 means the request was refused.
|
|
367
403
|
|
|
368
404
|
USE CASES
|
|
369
405
|
makine use-cases list [--include-retired] Display name, address, target and figures
|
|
370
406
|
makine use-cases show <address> Addresses and their traffic, contract, figures
|
|
371
407
|
makine use-cases create <address> [--name <display>] [--model <model>]
|
|
372
|
-
makine use-cases name <address> <display name> What screens show;
|
|
408
|
+
makine use-cases name <address> <display name> What screens show; the rest stays
|
|
373
409
|
makine use-cases point <address> --model <model> Move the job to another model
|
|
374
410
|
makine use-cases rename <address> <new address> The old address keeps resolving
|
|
375
411
|
makine use-cases remove-address <address> Free an older address for someone else
|
|
@@ -382,6 +418,20 @@ USE CASES
|
|
|
382
418
|
how you organise traffic a model is already taking. Removing an address is the only thing that
|
|
383
419
|
frees it for another use case.
|
|
384
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
|
+
|
|
385
435
|
RECEIPTS
|
|
386
436
|
makine receipts show <task_id> [--out <file>] One run's receipt, exactly as signed
|
|
387
437
|
makine receipts trust <name> --origin <https-origin> Anchor an issuer by fetching its key list
|
|
@@ -403,7 +453,7 @@ THE SEMANTIC JUDGE
|
|
|
403
453
|
a rule cannot express. It is off until this workspace switches it on. \`enable\` prints the
|
|
404
454
|
statement you are agreeing to and asks you to type yes; \`--yes\` skips that prompt, and the
|
|
405
455
|
statement is printed either way. Switching it on or off needs a session or a workspace key; a
|
|
406
|
-
bare program key may read \`show\`
|
|
456
|
+
bare program key may read \`show\` alone.
|
|
407
457
|
|
|
408
458
|
\`show\` also reports the deployment operator's own switch. Both must be on for anything to be
|
|
409
459
|
judged, so a workspace that has consented and sees no judgments can tell whose switch is off.
|
|
@@ -421,7 +471,7 @@ GOVERNMENT-ID DATA
|
|
|
421
471
|
network is never affected. The vendor is the name a call's address resolves to — \`openai\`,
|
|
422
472
|
\`anthropic\`, or the host name of another endpoint — so allowing one never allows another.
|
|
423
473
|
|
|
424
|
-
Hints are separate and block
|
|
474
|
+
Hints are separate and block no step: Makine says an input may hold a national ID or tax number,
|
|
425
475
|
names the country and the field, and never the number. Allowing a vendor needs a signed-in
|
|
426
476
|
account; switching either kind of hint needs a session or a workspace key.
|
|
427
477
|
|
|
@@ -442,8 +492,8 @@ SUGGESTIONS
|
|
|
442
492
|
makine suggestions dismiss <suggestion_id> Dismiss one
|
|
443
493
|
|
|
444
494
|
Makine suggests four things: instructions to add to your prompt, a further pattern check, a basic
|
|
445
|
-
data schema, and a fix for a failure group. **You approve every one**, and
|
|
446
|
-
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.
|
|
447
497
|
|
|
448
498
|
A data schema is computed by Makine from your own accepted answers, with no model call, and a fix
|
|
449
499
|
comes from Makine's fixed rule when suggestions are off. The other two need a model, so they are
|
|
@@ -454,7 +504,7 @@ SUGGESTIONS
|
|
|
454
504
|
pattern that admits them, and a change to what your request asks for. Makine reads the group's
|
|
455
505
|
rejected answers to find them only once this workspace allows it (\`makine diagnosis\`), and only
|
|
456
506
|
when you ask: \`draft\` without \`--kinds\` asks for them. Approving a change to your request marks
|
|
457
|
-
it as done and writes
|
|
507
|
+
it as done and writes no version.
|
|
458
508
|
|
|
459
509
|
Suggestion spend is your own, on your own key. It is **not** counted in usage metering or against
|
|
460
510
|
a budget ceiling. Every subcommand here needs a session or a workspace key; a bare program key is
|
|
@@ -466,7 +516,7 @@ DIAGNOSIS — near misses
|
|
|
466
516
|
|
|
467
517
|
At \`in-workspace\`, when someone asks for suggestions on a failure group, Makine reads up to 20
|
|
468
518
|
of that group's rejected answers inside this workspace to spot a near miss, and stores only what
|
|
469
|
-
kind of mismatch it was.
|
|
519
|
+
kind of mismatch it was. It stays in this workspace. \`level\` prints the statement and sends back
|
|
470
520
|
the version it printed. Changing the level needs \`makine login\`: a workspace key is refused.
|
|
471
521
|
|
|
472
522
|
BASELINE — the before/after report
|
|
@@ -475,7 +525,7 @@ BASELINE — the before/after report
|
|
|
475
525
|
makine baseline show <baseline-set-id> Exclusions, then the three numbers
|
|
476
526
|
makine baseline delete <baseline-set-id> Removes the set and its members
|
|
477
527
|
|
|
478
|
-
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
|
|
479
529
|
window is [from,to) over when each request was submitted. Both ends are RFC 3339 date-times
|
|
480
530
|
carrying an explicit zone — 2026-09-01T00:00:00Z or 2026-09-01T00:00:00+03:00 — and a zone is
|
|
481
531
|
never guessed, so an entry without one is refused rather than read in the server's zone. The set
|
|
@@ -492,7 +542,7 @@ MIGRATE OPTIONS (offline — reads the file, never calls a provider)
|
|
|
492
542
|
--json Print the settings, the field mapping and the report as JSON.
|
|
493
543
|
|
|
494
544
|
Prints the settings it could produce, then a report naming every construct it did not
|
|
495
|
-
translate and why.
|
|
545
|
+
translate and why. Every value is accounted for, and no credential field is copied. An
|
|
496
546
|
endpoint is copied whole, path included, because the path is the endpoint.
|
|
497
547
|
See docs/developers/migrating-from-portkey-or-litellm.md.
|
|
498
548
|
|
|
@@ -702,6 +752,42 @@ export function parseArgs(argv) {
|
|
|
702
752
|
args.runsSubcommand = sub;
|
|
703
753
|
index = 2;
|
|
704
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
|
+
}
|
|
705
791
|
else if (head === "baseline") {
|
|
706
792
|
args.command = head;
|
|
707
793
|
const sub = argv[1];
|
|
@@ -910,6 +996,73 @@ export function parseArgs(argv) {
|
|
|
910
996
|
args.input = next;
|
|
911
997
|
index += 1;
|
|
912
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;
|
|
913
1066
|
case "--max-tokens":
|
|
914
1067
|
if (needsValue(token, next))
|
|
915
1068
|
args.maxTokens = parseNumber(token, next);
|
|
@@ -1557,6 +1710,71 @@ export async function runCli(argv, io) {
|
|
|
1557
1710
|
});
|
|
1558
1711
|
return RUNS_EXIT[outcome];
|
|
1559
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
|
+
}
|
|
1560
1778
|
if (args.command === "baseline") {
|
|
1561
1779
|
const baseline = new MakineBaselineClient({
|
|
1562
1780
|
baseUrl,
|
|
@@ -1838,6 +2056,27 @@ const RUNS_EXIT = {
|
|
|
1838
2056
|
auth: EXIT.AUTH,
|
|
1839
2057
|
unavailable: EXIT.UNREACHABLE,
|
|
1840
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
|
+
};
|
|
1841
2080
|
const BASELINE_EXIT = {
|
|
1842
2081
|
ok: EXIT.ACCEPTED,
|
|
1843
2082
|
usage: EXIT.USAGE,
|