codex-toys 0.140.2 → 0.140.4

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 (53) hide show
  1. package/README.md +6 -1
  2. package/dist/app-server/stdio-transport.js +0 -2
  3. package/dist/app-server/stdio-transport.js.map +1 -1
  4. package/dist/bin/codex-toys-proxy.js +16 -4
  5. package/dist/cli/args.d.ts +194 -1
  6. package/dist/cli/args.d.ts.map +1 -1
  7. package/dist/cli/args.js +461 -2
  8. package/dist/cli/args.js.map +1 -1
  9. package/dist/cli/index.js +446 -8
  10. package/dist/cli/index.js.map +1 -1
  11. package/dist/cli/pack.d.ts +1 -3
  12. package/dist/cli/pack.d.ts.map +1 -1
  13. package/dist/cli/pack.js +3 -138
  14. package/dist/cli/pack.js.map +1 -1
  15. package/dist/cli/toybox.d.ts.map +1 -1
  16. package/dist/cli/toybox.js +24 -2
  17. package/dist/cli/toybox.js.map +1 -1
  18. package/dist/cli/turn-automation.d.ts +4 -0
  19. package/dist/cli/turn-automation.d.ts.map +1 -1
  20. package/dist/cli/turn-automation.js +17 -0
  21. package/dist/cli/turn-automation.js.map +1 -1
  22. package/dist/cli/workspace-autonomy.d.ts +135 -0
  23. package/dist/cli/workspace-autonomy.d.ts.map +1 -1
  24. package/dist/cli/workspace-autonomy.js +476 -11
  25. package/dist/cli/workspace-autonomy.js.map +1 -1
  26. package/dist/host-overview.d.ts +112 -0
  27. package/dist/host-overview.d.ts.map +1 -0
  28. package/dist/host-overview.js +406 -0
  29. package/dist/host-overview.js.map +1 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/proxy.d.ts.map +1 -1
  35. package/dist/proxy.js +11 -1
  36. package/dist/proxy.js.map +1 -1
  37. package/dist/toybox/deferred-run-methods.d.ts +15 -0
  38. package/dist/toybox/deferred-run-methods.d.ts.map +1 -1
  39. package/dist/toybox/deferred-run-methods.js +261 -1
  40. package/dist/toybox/deferred-run-methods.js.map +1 -1
  41. package/dist/toybox/index.d.ts +2 -1
  42. package/dist/toybox/index.d.ts.map +1 -1
  43. package/dist/toybox/index.js +2 -1
  44. package/dist/toybox/index.js.map +1 -1
  45. package/dist/toybox/protocol.d.ts +1 -1
  46. package/dist/toybox/protocol.d.ts.map +1 -1
  47. package/dist/toybox/protocol.js +1 -0
  48. package/dist/toybox/protocol.js.map +1 -1
  49. package/dist/workspace-overview.d.ts +153 -0
  50. package/dist/workspace-overview.d.ts.map +1 -0
  51. package/dist/workspace-overview.js +584 -0
  52. package/dist/workspace-overview.js.map +1 -0
  53. package/package.json +1 -1
package/dist/cli/args.js CHANGED
@@ -40,7 +40,21 @@ export function parseArgs(argv, env = process.env) {
40
40
  let includeOutput = false;
41
41
  let olderThanDays;
42
42
  let cursor;
43
+ let runAt;
43
44
  let model;
45
+ let serviceTier;
46
+ let effort;
47
+ let queue;
48
+ let promptQueue;
49
+ let afterIntentId;
50
+ let afterStatus;
51
+ let status;
52
+ let limit;
53
+ let targetHost;
54
+ let hostId;
55
+ let requesterHost;
56
+ let requesterThreadId;
57
+ let materialize = false;
44
58
  let paramsJson;
45
59
  let paramsFile;
46
60
  let cwd = env.CODEX_TOYS_REMOTE_CWD;
@@ -55,6 +69,8 @@ export function parseArgs(argv, env = process.env) {
55
69
  let permissions;
56
70
  const include = [];
57
71
  const exclude = [];
72
+ const labels = [];
73
+ const capabilities = [];
58
74
  for (let index = 0; index < argv.length; index += 1) {
59
75
  const arg = argv[index];
60
76
  if (!arg) {
@@ -323,6 +339,118 @@ export function parseArgs(argv, env = process.env) {
323
339
  cursor = arg.slice("--cursor=".length);
324
340
  continue;
325
341
  }
342
+ if (arg === "--run-at") {
343
+ runAt = required(argv, ++index, arg);
344
+ continue;
345
+ }
346
+ if (arg.startsWith("--run-at=")) {
347
+ runAt = arg.slice("--run-at=".length);
348
+ continue;
349
+ }
350
+ if (arg === "--queue") {
351
+ queue = required(argv, ++index, arg);
352
+ continue;
353
+ }
354
+ if (arg.startsWith("--queue=")) {
355
+ queue = arg.slice("--queue=".length);
356
+ continue;
357
+ }
358
+ if (arg === "--prompt-queue") {
359
+ promptQueue = required(argv, ++index, arg);
360
+ continue;
361
+ }
362
+ if (arg.startsWith("--prompt-queue=")) {
363
+ promptQueue = arg.slice("--prompt-queue=".length);
364
+ continue;
365
+ }
366
+ if (arg === "--label") {
367
+ labels.push(required(argv, ++index, arg));
368
+ continue;
369
+ }
370
+ if (arg.startsWith("--label=")) {
371
+ labels.push(arg.slice("--label=".length));
372
+ continue;
373
+ }
374
+ if (arg === "--capability" || arg === "--required-capability") {
375
+ capabilities.push(required(argv, ++index, arg));
376
+ continue;
377
+ }
378
+ if (arg.startsWith("--capability=")) {
379
+ capabilities.push(arg.slice("--capability=".length));
380
+ continue;
381
+ }
382
+ if (arg.startsWith("--required-capability=")) {
383
+ capabilities.push(arg.slice("--required-capability=".length));
384
+ continue;
385
+ }
386
+ if (arg === "--target-host") {
387
+ targetHost = required(argv, ++index, arg);
388
+ continue;
389
+ }
390
+ if (arg.startsWith("--target-host=")) {
391
+ targetHost = arg.slice("--target-host=".length);
392
+ continue;
393
+ }
394
+ if (arg === "--host-id") {
395
+ hostId = required(argv, ++index, arg);
396
+ continue;
397
+ }
398
+ if (arg.startsWith("--host-id=")) {
399
+ hostId = arg.slice("--host-id=".length);
400
+ continue;
401
+ }
402
+ if (arg === "--requester-host") {
403
+ requesterHost = required(argv, ++index, arg);
404
+ continue;
405
+ }
406
+ if (arg.startsWith("--requester-host=")) {
407
+ requesterHost = arg.slice("--requester-host=".length);
408
+ continue;
409
+ }
410
+ if (arg === "--requester-thread-id") {
411
+ requesterThreadId = required(argv, ++index, arg);
412
+ continue;
413
+ }
414
+ if (arg.startsWith("--requester-thread-id=")) {
415
+ requesterThreadId = arg.slice("--requester-thread-id=".length);
416
+ continue;
417
+ }
418
+ if (arg === "--materialize") {
419
+ materialize = true;
420
+ continue;
421
+ }
422
+ if (arg === "--after") {
423
+ afterIntentId = required(argv, ++index, arg);
424
+ continue;
425
+ }
426
+ if (arg.startsWith("--after=")) {
427
+ afterIntentId = arg.slice("--after=".length);
428
+ continue;
429
+ }
430
+ if (arg === "--after-status") {
431
+ afterStatus = parseDeferredDependencyStatus(required(argv, ++index, arg));
432
+ continue;
433
+ }
434
+ if (arg.startsWith("--after-status=")) {
435
+ afterStatus = parseDeferredDependencyStatus(arg.slice("--after-status=".length));
436
+ continue;
437
+ }
438
+ if (arg === "--status") {
439
+ status = parseDeferredRunStatus(required(argv, ++index, arg));
440
+ continue;
441
+ }
442
+ if (arg.startsWith("--status=")) {
443
+ status = parseDeferredRunStatus(arg.slice("--status=".length));
444
+ continue;
445
+ }
446
+ if (arg === "--limit") {
447
+ limit = positiveInteger(required(argv, ++index, arg), arg);
448
+ continue;
449
+ }
450
+ if (arg.startsWith("--limit=")) {
451
+ limit = positiveInteger(arg.slice("--limit=".length), "--limit");
452
+ continue;
453
+ }
326
454
  if (arg === "--allow-absolute-cwd") {
327
455
  allowAbsoluteCwd = true;
328
456
  continue;
@@ -335,6 +463,22 @@ export function parseArgs(argv, env = process.env) {
335
463
  model = arg.slice("--model=".length);
336
464
  continue;
337
465
  }
466
+ if (arg === "--service-tier") {
467
+ serviceTier = required(argv, ++index, arg);
468
+ continue;
469
+ }
470
+ if (arg.startsWith("--service-tier=")) {
471
+ serviceTier = arg.slice("--service-tier=".length);
472
+ continue;
473
+ }
474
+ if (arg === "--effort") {
475
+ effort = parseReasoningEffort(required(argv, ++index, arg));
476
+ continue;
477
+ }
478
+ if (arg.startsWith("--effort=")) {
479
+ effort = parseReasoningEffort(arg.slice("--effort=".length));
480
+ continue;
481
+ }
338
482
  if (arg === "--via") {
339
483
  via = parseRemoteVia(required(argv, ++index, arg));
340
484
  continue;
@@ -499,7 +643,31 @@ export function parseArgs(argv, env = process.env) {
499
643
  ...remoteFields(),
500
644
  };
501
645
  }
502
- throw new Error("remote supports only preflight; use --ssh with fetch, app, workspace, automation, functions, or turn run");
646
+ if (subcommand === "host-overview" || subcommand === "host") {
647
+ return {
648
+ type: "host-overview",
649
+ url: workspaceUrl,
650
+ timeoutMs,
651
+ json,
652
+ pretty,
653
+ ...remoteFields(),
654
+ };
655
+ }
656
+ throw new Error("remote supports only preflight or host-overview; use --ssh with fetch, app, workspace, automation, functions, or turn run");
657
+ }
658
+ if (command === "host") {
659
+ const subcommand = positionals[1];
660
+ if (subcommand !== "overview") {
661
+ throw new Error("host requires overview");
662
+ }
663
+ return {
664
+ type: "host-overview",
665
+ url: workspaceUrl,
666
+ timeoutMs,
667
+ json,
668
+ pretty,
669
+ ...remoteFields(),
670
+ };
503
671
  }
504
672
  if (command === "turn") {
505
673
  const subcommand = positionals[1];
@@ -642,6 +810,18 @@ export function parseArgs(argv, env = process.env) {
642
810
  ...remoteFields(),
643
811
  };
644
812
  }
813
+ if (subcommand === "overview") {
814
+ return {
815
+ type: "workspace-overview",
816
+ mode,
817
+ workspaceRoot,
818
+ url: workspaceUrl,
819
+ timeoutMs: timeoutMs === defaultTimeoutMs ? 5_000 : timeoutMs,
820
+ json,
821
+ pretty,
822
+ ...remoteFields(),
823
+ };
824
+ }
645
825
  if (subcommand === "delegate" || subcommand === "delegation") {
646
826
  const action = positionals[2] ?? "list";
647
827
  if (action === "list" || action === "ls") {
@@ -692,6 +872,242 @@ export function parseArgs(argv, env = process.env) {
692
872
  ...remoteFields(),
693
873
  };
694
874
  }
875
+ if (subcommand === "prompt" || subcommand === "prompts" || subcommand === "prompt-queue") {
876
+ const action = positionals[2] ?? "list";
877
+ if (action === "enqueue" || action === "queue" || action === "add" || action === "create") {
878
+ const positionalPrompt = positionals.slice(3).join(" ");
879
+ return {
880
+ type: "workspace-prompt-enqueue",
881
+ prompt: prompt ?? (positionalPrompt || requiredPositional(positionals, 3, "workspace prompt enqueue requires <prompt> or --prompt <text>")),
882
+ title,
883
+ queue,
884
+ labels,
885
+ runAt,
886
+ afterIntentId,
887
+ afterStatus,
888
+ threadId,
889
+ cwd: targetCwd ?? (!sshTarget ? cwd : undefined),
890
+ model,
891
+ serviceTier,
892
+ effort,
893
+ sandbox,
894
+ approvalPolicy,
895
+ permissions,
896
+ mode,
897
+ workspaceRoot,
898
+ url: workspaceUrl,
899
+ timeoutMs,
900
+ pretty,
901
+ ...remoteFields(),
902
+ };
903
+ }
904
+ if (action === "list" || action === "ls") {
905
+ return {
906
+ type: "workspace-prompt-list",
907
+ status,
908
+ queue,
909
+ limit,
910
+ mode,
911
+ workspaceRoot,
912
+ url: workspaceUrl,
913
+ timeoutMs,
914
+ json,
915
+ pretty,
916
+ ...remoteFields(),
917
+ };
918
+ }
919
+ if (action === "read" || action === "show" || action === "pull") {
920
+ return {
921
+ type: "workspace-prompt-read",
922
+ intentId: requiredPositional(positionals, 3, `workspace prompt ${action} requires <intent-id>`),
923
+ includeOutput: includeOutput || action === "pull",
924
+ mode,
925
+ workspaceRoot,
926
+ url: workspaceUrl,
927
+ timeoutMs,
928
+ json,
929
+ pretty,
930
+ ...remoteFields(),
931
+ };
932
+ }
933
+ if (action === "collect") {
934
+ return {
935
+ type: "workspace-prompt-collect",
936
+ cursor,
937
+ queue,
938
+ mode,
939
+ workspaceRoot,
940
+ url: workspaceUrl,
941
+ timeoutMs,
942
+ json,
943
+ pretty,
944
+ ...remoteFields(),
945
+ };
946
+ }
947
+ if (action === "cancel") {
948
+ return {
949
+ type: "workspace-prompt-cancel",
950
+ intentId: requiredPositional(positionals, 3, "workspace prompt cancel requires <intent-id>"),
951
+ mode,
952
+ workspaceRoot,
953
+ url: workspaceUrl,
954
+ timeoutMs,
955
+ pretty,
956
+ ...remoteFields(),
957
+ };
958
+ }
959
+ if (action === "retry" || action === "requeue") {
960
+ return {
961
+ type: "workspace-prompt-retry",
962
+ intentId: requiredPositional(positionals, 3, `workspace prompt ${action} requires <intent-id>`),
963
+ runAt,
964
+ mode,
965
+ workspaceRoot,
966
+ url: workspaceUrl,
967
+ timeoutMs,
968
+ pretty,
969
+ ...remoteFields(),
970
+ };
971
+ }
972
+ if (action === "run-due" || action === "run") {
973
+ return {
974
+ type: "workspace-prompt-run-due",
975
+ queue,
976
+ limit,
977
+ mode,
978
+ workspaceRoot,
979
+ url: workspaceUrl,
980
+ timeoutMs,
981
+ pretty,
982
+ ...remoteFields(),
983
+ };
984
+ }
985
+ throw new Error("workspace prompt requires enqueue, list, read, collect, cancel, retry, or run-due");
986
+ }
987
+ if (subcommand === "handoff" || subcommand === "handoffs" || subcommand === "local-handoff") {
988
+ const action = positionals[2] ?? "list";
989
+ if (action === "enqueue" || action === "queue" || action === "add" || action === "create") {
990
+ const positionalPrompt = positionals.slice(3).join(" ");
991
+ return {
992
+ type: "workspace-handoff-enqueue",
993
+ prompt: prompt ?? (positionalPrompt || requiredPositional(positionals, 3, "workspace handoff enqueue requires <prompt> or --prompt <text>")),
994
+ title,
995
+ queue,
996
+ labels,
997
+ runAt,
998
+ afterIntentId,
999
+ afterStatus,
1000
+ targetHost,
1001
+ requiredCapabilities: capabilities,
1002
+ requesterHost,
1003
+ requesterThreadId,
1004
+ threadId,
1005
+ cwd: targetCwd ?? (!sshTarget ? cwd : undefined),
1006
+ model,
1007
+ serviceTier,
1008
+ effort,
1009
+ sandbox,
1010
+ approvalPolicy,
1011
+ permissions,
1012
+ mode,
1013
+ workspaceRoot,
1014
+ url: workspaceUrl,
1015
+ timeoutMs,
1016
+ pretty,
1017
+ ...remoteFields(),
1018
+ };
1019
+ }
1020
+ if (action === "list" || action === "ls") {
1021
+ return {
1022
+ type: "workspace-handoff-list",
1023
+ status,
1024
+ queue,
1025
+ targetHost,
1026
+ capabilities,
1027
+ limit,
1028
+ mode,
1029
+ workspaceRoot,
1030
+ url: workspaceUrl,
1031
+ timeoutMs,
1032
+ json,
1033
+ pretty,
1034
+ ...remoteFields(),
1035
+ };
1036
+ }
1037
+ if (action === "read" || action === "show" || action === "pull") {
1038
+ return {
1039
+ type: "workspace-handoff-read",
1040
+ intentId: requiredPositional(positionals, 3, `workspace handoff ${action} requires <intent-id>`),
1041
+ includeOutput: includeOutput || action === "pull",
1042
+ mode,
1043
+ workspaceRoot,
1044
+ url: workspaceUrl,
1045
+ timeoutMs,
1046
+ json,
1047
+ pretty,
1048
+ ...remoteFields(),
1049
+ };
1050
+ }
1051
+ if (action === "collect") {
1052
+ return {
1053
+ type: "workspace-handoff-collect",
1054
+ cursor,
1055
+ queue,
1056
+ targetHost,
1057
+ capabilities,
1058
+ mode,
1059
+ workspaceRoot,
1060
+ url: workspaceUrl,
1061
+ timeoutMs,
1062
+ json,
1063
+ pretty,
1064
+ ...remoteFields(),
1065
+ };
1066
+ }
1067
+ if (action === "cancel") {
1068
+ return {
1069
+ type: "workspace-handoff-cancel",
1070
+ intentId: requiredPositional(positionals, 3, "workspace handoff cancel requires <intent-id>"),
1071
+ mode,
1072
+ workspaceRoot,
1073
+ url: workspaceUrl,
1074
+ timeoutMs,
1075
+ pretty,
1076
+ ...remoteFields(),
1077
+ };
1078
+ }
1079
+ if (action === "retry" || action === "requeue") {
1080
+ return {
1081
+ type: "workspace-handoff-retry",
1082
+ intentId: requiredPositional(positionals, 3, `workspace handoff ${action} requires <intent-id>`),
1083
+ runAt,
1084
+ mode,
1085
+ workspaceRoot,
1086
+ url: workspaceUrl,
1087
+ timeoutMs,
1088
+ pretty,
1089
+ ...remoteFields(),
1090
+ };
1091
+ }
1092
+ if (action === "drain" || action === "run-due" || action === "run") {
1093
+ return {
1094
+ type: "workspace-handoff-drain",
1095
+ queue,
1096
+ hostId,
1097
+ capabilities,
1098
+ limit,
1099
+ materialize,
1100
+ promptQueue,
1101
+ mode,
1102
+ workspaceRoot,
1103
+ url: workspaceUrl,
1104
+ timeoutMs,
1105
+ pretty,
1106
+ ...remoteFields(),
1107
+ };
1108
+ }
1109
+ throw new Error("workspace handoff requires enqueue, list, read, collect, cancel, retry, or drain");
1110
+ }
695
1111
  if (subcommand === "deferred" || subcommand === "defer") {
696
1112
  const action = positionals[2] ?? "list";
697
1113
  if (action === "create" || action === "add") {
@@ -757,6 +1173,19 @@ export function parseArgs(argv, env = process.env) {
757
1173
  ...remoteFields(),
758
1174
  };
759
1175
  }
1176
+ if (action === "retry" || action === "requeue") {
1177
+ return {
1178
+ type: "workspace-deferred-retry",
1179
+ intentId: requiredPositional(positionals, 3, `workspace deferred ${action} requires <intent-id>`),
1180
+ runAt,
1181
+ mode,
1182
+ workspaceRoot,
1183
+ url: workspaceUrl,
1184
+ timeoutMs,
1185
+ pretty,
1186
+ ...remoteFields(),
1187
+ };
1188
+ }
760
1189
  if (action === "run-due" || action === "run") {
761
1190
  return {
762
1191
  type: "workspace-deferred-run-due",
@@ -784,7 +1213,7 @@ export function parseArgs(argv, env = process.env) {
784
1213
  ...remoteFields(),
785
1214
  };
786
1215
  }
787
- throw new Error("workspace deferred requires create, list, read, collect, cancel, run-due, or prune");
1216
+ throw new Error("workspace deferred requires create, list, read, collect, cancel, retry, run-due, or prune");
788
1217
  }
789
1218
  if (subcommand === "run") {
790
1219
  return {
@@ -995,6 +1424,36 @@ function parseRemoteTurnApprovalPolicy(value) {
995
1424
  }
996
1425
  throw new Error("--approval-policy must be never, on-failure, on-request, or untrusted");
997
1426
  }
1427
+ function parseReasoningEffort(value) {
1428
+ if (value === "none" ||
1429
+ value === "minimal" ||
1430
+ value === "low" ||
1431
+ value === "medium" ||
1432
+ value === "high" ||
1433
+ value === "xhigh") {
1434
+ return value;
1435
+ }
1436
+ throw new Error("--effort must be none, minimal, low, medium, high, or xhigh");
1437
+ }
1438
+ function parseDeferredDependencyStatus(value) {
1439
+ if (value === "completed" ||
1440
+ value === "failed" ||
1441
+ value === "canceled" ||
1442
+ value === "terminal") {
1443
+ return value;
1444
+ }
1445
+ throw new Error("--after-status must be completed, failed, canceled, or terminal");
1446
+ }
1447
+ function parseDeferredRunStatus(value) {
1448
+ if (value === "pending" ||
1449
+ value === "running" ||
1450
+ value === "completed" ||
1451
+ value === "failed" ||
1452
+ value === "canceled") {
1453
+ return value;
1454
+ }
1455
+ throw new Error("--status must be pending, running, completed, failed, or canceled");
1456
+ }
998
1457
  function parseDelegationReturnMode(value) {
999
1458
  if (value === "detached" ||
1000
1459
  value === "record_only" ||