@cmdop/sdk 3.6.1 → 3.7.3

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.
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 292222b7ac86de94, cmdop 0.1.18) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Every error code, in the order Rust declares them. */
3
3
  export const ERROR_CODES = ["other", "denied", "unknown_tool", "bad_args", "not_found", "busy", "permission_missing", "screen_locked", "stale_capture", "element_gone", "app_not_allowed", "lease_paused", "paused", "offline", "rate_limited", "quota_exceeded", "not_dispatched", "display_gone", "timed_out", "cancelled", "too_large", "hash_required", "failed", "needs_presence", "unauthorized", "tool_refused", "sandbox_unavailable"];
4
4
  /** The size limits every carrier keeps. */
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 292222b7ac86de94, cmdop 0.1.18) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Title and description of every server tool, as the server lists them. */
3
3
  export const SERVER_TOOLS = {
4
4
  docs_read: { title: "Read the docs", description: "Call before answering how CMDOP works, is set up or is priced: no `path` lists every page of docs.cmdop.ai (path and title); a `path` returns that page as Markdown." },
@@ -30,6 +30,11 @@ export declare const GROUPS: {
30
30
  readonly read: "fs_read";
31
31
  readonly search: "fs_search";
32
32
  readonly stat: "fs_stat";
33
+ readonly upload_abort: "fs_upload_abort";
34
+ readonly upload_begin: "fs_upload_begin";
35
+ readonly upload_chunk: "fs_upload_chunk";
36
+ readonly upload_commit: "fs_upload_commit";
37
+ readonly upload_status: "fs_upload_status";
33
38
  readonly write: "fs_write";
34
39
  };
35
40
  readonly journal: {
@@ -57,6 +62,7 @@ export declare const GROUPS: {
57
62
  };
58
63
  readonly sys: {
59
64
  readonly info: "sys_info";
65
+ readonly metrics: "sys_metrics";
60
66
  };
61
67
  readonly task: {
62
68
  readonly output: "task_output";
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 292222b7ac86de94, cmdop 0.1.18) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Group, then method, then the tool it calls. */
3
3
  export const GROUPS = {
4
4
  agent: { cancel: "agent_cancel", list: "agent_list", prompt: "agent_prompt", sessions: "agent_sessions" },
@@ -6,14 +6,14 @@ export const GROUPS = {
6
6
  control: { release: "control_release" },
7
7
  disk: { clean: "disk_clean", usage: "disk_usage" },
8
8
  exec: { run: "exec_run" },
9
- fs: { delete: "fs_delete", edit: "fs_edit", list: "fs_list", read: "fs_read", search: "fs_search", stat: "fs_stat", write: "fs_write" },
9
+ fs: { delete: "fs_delete", edit: "fs_edit", list: "fs_list", read: "fs_read", search: "fs_search", stat: "fs_stat", upload_abort: "fs_upload_abort", upload_begin: "fs_upload_begin", upload_chunk: "fs_upload_chunk", upload_commit: "fs_upload_commit", upload_status: "fs_upload_status", write: "fs_write" },
10
10
  journal: { search: "journal_search" },
11
11
  key: { press: "key_press" },
12
12
  pointer: { click: "pointer_click", drag: "pointer_drag", move: "pointer_move", scroll: "pointer_scroll" },
13
13
  proc: { kill: "proc_kill", list: "proc_list" },
14
14
  screen: { capture: "screen_capture", info: "screen_info" },
15
15
  stage: { show: "stage_show" },
16
- sys: { info: "sys_info" },
16
+ sys: { info: "sys_info", metrics: "sys_metrics" },
17
17
  task: { output: "task_output", start: "task_start", stop: "task_stop" },
18
18
  text: { type: "text_type" },
19
19
  ui: { act: "ui_act", snapshot: "ui_snapshot", wait: "ui_wait" },
@@ -45,6 +45,8 @@ export type AgentPromptOut = {
45
45
  agent: string;
46
46
  /** Why there is no answer, when `state` is `failed`. */
47
47
  error?: string | null;
48
+ /** The kind of failure, when the agent's own output names one. */
49
+ reason?: FailReason | null;
48
50
  /** Pass it back as `session` to continue. */
49
51
  session?: string | null;
50
52
  state: RunState;
@@ -314,7 +316,8 @@ export type FsSearchOut = {
314
316
  /** Arguments of `fs_stat`. */
315
317
  export type FsStatArgs = {
316
318
  /**
317
- * Also return the file's SHA-256 (files up to 64 MiB). Pass it as `expect_sha256` to
319
+ * Also return the file's SHA-256: up to 64 MiB on program 0.1.16,
320
+ * or 256 MiB from program 0.1.18. Pass it as `expect_sha256` to
318
321
  * `fs_write` or `fs_edit` to refuse a write when the file changed in between.
319
322
  */
320
323
  hash?: boolean;
@@ -334,13 +337,160 @@ export type FsStatOut = {
334
337
  modified?: number | null;
335
338
  /** Resolved absolute path (symlinks followed). */
336
339
  path: string;
337
- /** Lower-case hex, when `hash` was asked and the path is a file of at most 64 MiB. */
340
+ /**
341
+ * Lower-case hex when `hash` was asked: files up to 64 MiB on program 0.1.16,
342
+ * or 256 MiB from program 0.1.18.
343
+ */
338
344
  sha256?: string | null;
339
345
  /** Bytes; 0 for folders. */
340
346
  size: number;
341
347
  /** Whether the user the machine program runs as may write it. */
342
348
  writable: boolean;
343
349
  };
350
+ /** Arguments of `fs_upload_abort`. Stop an unfinished upload and remove only its owned temporary data. */
351
+ export type FsUploadAbortArgs = {
352
+ /** The id bound by `fs_upload_begin`, owned by this same authenticated caller. */
353
+ transfer: string;
354
+ };
355
+ /** What `fs_upload_abort` returns. */
356
+ export type FsUploadAbortOut = {
357
+ /** Maximum decoded bytes in a chunk. */
358
+ chunk_max_bytes: number;
359
+ /** Fixed expiry as Unix seconds. */
360
+ expires_at: number;
361
+ /** Durable confirmed byte offset. Only continue from this value. */
362
+ offset: number;
363
+ /** Bound canonical absolute destination. */
364
+ path: string;
365
+ /** Present only after verified publication. */
366
+ receipt?: FsWriteOut | null;
367
+ /** Expected whole-file SHA-256; a committed receipt confirms verification. */
368
+ sha256: string;
369
+ /** Expected whole-file decoded bytes. */
370
+ size: number;
371
+ /** Current durable state. */
372
+ state: UploadState;
373
+ /** Client-generated upload id. */
374
+ transfer: string;
375
+ };
376
+ /** Arguments of `fs_upload_begin`. Reserve a new destination and bind the expected content to this caller. */
377
+ export type FsUploadBeginArgs = {
378
+ /** Create missing parent folders. Default: false. */
379
+ mkdirs?: boolean;
380
+ /** Destination on the machine. Existing files are never replaced. */
381
+ path: string;
382
+ /** Expected whole-file SHA-256: 64 lowercase hexadecimal characters. */
383
+ sha256: string;
384
+ /** Exact decoded byte count, at most 268435456 (256 MiB). */
385
+ size: number;
386
+ /** Client-generated id: 32 lowercase hexadecimal characters. Reuse only for this upload. */
387
+ transfer: string;
388
+ };
389
+ /** What `fs_upload_begin` returns. */
390
+ export type FsUploadBeginOut = {
391
+ /** Maximum decoded bytes in a chunk. */
392
+ chunk_max_bytes: number;
393
+ /** Fixed expiry as Unix seconds. */
394
+ expires_at: number;
395
+ /** Durable confirmed byte offset. Only continue from this value. */
396
+ offset: number;
397
+ /** Bound canonical absolute destination. */
398
+ path: string;
399
+ /** Present only after verified publication. */
400
+ receipt?: FsWriteOut | null;
401
+ /** Expected whole-file SHA-256; a committed receipt confirms verification. */
402
+ sha256: string;
403
+ /** Expected whole-file decoded bytes. */
404
+ size: number;
405
+ /** Current durable state. */
406
+ state: UploadState;
407
+ /** Client-generated upload id. */
408
+ transfer: string;
409
+ };
410
+ /** Arguments of `fs_upload_chunk`. Supply the next verified chunk, or reconcile an exact duplicate. */
411
+ export type FsUploadChunkArgs = {
412
+ /** Base64-encoded bytes, at most 1048576 (1 MiB) decoded. Produce them in code, not by hand. */
413
+ data: string;
414
+ /** Start at the receiver-confirmed decoded byte offset. */
415
+ offset: number;
416
+ /** SHA-256 of these decoded bytes: 64 lowercase hexadecimal characters. */
417
+ sha256: string;
418
+ /** The id bound by `fs_upload_begin`, owned by this same authenticated caller. */
419
+ transfer: string;
420
+ };
421
+ /** What `fs_upload_chunk` returns. */
422
+ export type FsUploadChunkOut = {
423
+ /** Maximum decoded bytes in a chunk. */
424
+ chunk_max_bytes: number;
425
+ /** Fixed expiry as Unix seconds. */
426
+ expires_at: number;
427
+ /** Durable confirmed byte offset. Only continue from this value. */
428
+ offset: number;
429
+ /** Bound canonical absolute destination. */
430
+ path: string;
431
+ /** Present only after verified publication. */
432
+ receipt?: FsWriteOut | null;
433
+ /** Expected whole-file SHA-256; a committed receipt confirms verification. */
434
+ sha256: string;
435
+ /** Expected whole-file decoded bytes. */
436
+ size: number;
437
+ /** Current durable state. */
438
+ state: UploadState;
439
+ /** Client-generated upload id. */
440
+ transfer: string;
441
+ };
442
+ /** Arguments of `fs_upload_commit`. Verify the complete file and publish it without replacing a destination. */
443
+ export type FsUploadCommitArgs = {
444
+ /** The id bound by `fs_upload_begin`, owned by this same authenticated caller. */
445
+ transfer: string;
446
+ };
447
+ /** What `fs_upload_commit` returns. */
448
+ export type FsUploadCommitOut = {
449
+ /** Maximum decoded bytes in a chunk. */
450
+ chunk_max_bytes: number;
451
+ /** Fixed expiry as Unix seconds. */
452
+ expires_at: number;
453
+ /** Durable confirmed byte offset. Only continue from this value. */
454
+ offset: number;
455
+ /** Bound canonical absolute destination. */
456
+ path: string;
457
+ /** Present only after verified publication. */
458
+ receipt?: FsWriteOut | null;
459
+ /** Expected whole-file SHA-256; a committed receipt confirms verification. */
460
+ sha256: string;
461
+ /** Expected whole-file decoded bytes. */
462
+ size: number;
463
+ /** Current durable state. */
464
+ state: UploadState;
465
+ /** Client-generated upload id. */
466
+ transfer: string;
467
+ };
468
+ /** Arguments of `fs_upload_status`. Inspect an owned upload's durable offset or terminal receipt. */
469
+ export type FsUploadStatusArgs = {
470
+ /** The id bound by `fs_upload_begin`, owned by this same authenticated caller. */
471
+ transfer: string;
472
+ };
473
+ /** What `fs_upload_status` returns. */
474
+ export type FsUploadStatusOut = {
475
+ /** Maximum decoded bytes in a chunk. */
476
+ chunk_max_bytes: number;
477
+ /** Fixed expiry as Unix seconds. */
478
+ expires_at: number;
479
+ /** Durable confirmed byte offset. Only continue from this value. */
480
+ offset: number;
481
+ /** Bound canonical absolute destination. */
482
+ path: string;
483
+ /** Present only after verified publication. */
484
+ receipt?: FsWriteOut | null;
485
+ /** Expected whole-file SHA-256; a committed receipt confirms verification. */
486
+ sha256: string;
487
+ /** Expected whole-file decoded bytes. */
488
+ size: number;
489
+ /** Current durable state. */
490
+ state: UploadState;
491
+ /** Client-generated upload id. */
492
+ transfer: string;
493
+ };
344
494
  /** Arguments of `fs_write`. */
345
495
  export type FsWriteArgs = {
346
496
  /** Refuse when the file already exists. */
@@ -638,7 +788,14 @@ export type SysInfoArgs = Record<string, never>;
638
788
  export type SysInfoOut = {
639
789
  /** `aarch64`, `x86_64`. */
640
790
  arch: string;
791
+ /**
792
+ * The commit that program was built from, 12 hex digits. Absent from an older program and
793
+ * from a build made outside git.
794
+ */
795
+ commit?: string | null;
641
796
  cpus: number;
797
+ /** That build had changes not in `commit` (a developer's build). */
798
+ dirty?: boolean;
642
799
  /** Mounted file systems with their space, in bytes. */
643
800
  disks: Disk[];
644
801
  home?: string | null;
@@ -650,11 +807,37 @@ export type SysInfoOut = {
650
807
  os: string;
651
808
  /** OS release, for example `15.5` or `Ubuntu 24.04`. */
652
809
  os_version?: string | null;
810
+ /** The version of the cmdop program that answered, `0.1.18`. Absent from an older program. */
811
+ program?: string | null;
653
812
  /** Seconds since boot. */
654
813
  uptime: number;
655
814
  /** The user the machine program runs as. */
656
815
  user?: string | null;
657
816
  };
817
+ /** Arguments of `sys_metrics`. One bounded read; no persistent sampling or caller-selected paths. */
818
+ export type SysMetricsArgs = Record<string, never>;
819
+ /** What `sys_metrics` returns. */
820
+ export type SysMetricsOut = {
821
+ /** Unix milliseconds when the observation request completed. */
822
+ observed_at_ms: number;
823
+ /**
824
+ * Raw charged CPU-time delta and local quota, only for a qualified visible
825
+ * cgroup-v2 root. This is not a host percentage or effective ancestor entitlement.
826
+ */
827
+ visible_cgroup_cpu?: CgroupCpuObservation | null;
828
+ /**
829
+ * Current process's cgroup memory limits across the visible hierarchy, if known.
830
+ * Neither a host memory reading nor a guarantee of all hidden ancestor limits.
831
+ */
832
+ visible_cgroup_memory?: CgroupMemoryObservation | null;
833
+ /**
834
+ * CPU execution percentage across the visible system, not the caller's cgroup quota.
835
+ * Absent if a valid counter delta could not be established.
836
+ */
837
+ visible_system_cpu?: CpuObservation | null;
838
+ /** Visible system memory, as reported by the OS/library; not container entitlement. */
839
+ visible_system_memory?: MemoryObservation | null;
840
+ };
658
841
  /** Arguments of `task_output`. */
659
842
  export type TaskOutputArgs = {
660
843
  /** Return only the last this many lines (default 200, 0 for all the machine keeps). */
@@ -796,6 +979,8 @@ export type AgentRow = {
796
979
  protocol: Protocol;
797
980
  /** A run can be continued by passing back its `session`. */
798
981
  resume: boolean;
982
+ /** Its sign-in as the last run of it showed. */
983
+ sign_in?: SignIn;
799
984
  /** The most a prompt to it may do here. */
800
985
  tier: Tier;
801
986
  };
@@ -809,6 +994,23 @@ export type AgentSession = {
809
994
  updated: number;
810
995
  };
811
996
  export type Button = "left" | "right" | "middle";
997
+ export type CgroupCpuObservation = {
998
+ interval_usec: number;
999
+ period_usec: number;
1000
+ quota_usec: number;
1001
+ usage_usec_delta: number;
1002
+ };
1003
+ export type CgroupMemoryObservation = {
1004
+ /** Remaining charge headroom under the observed limits, not free/reclaimable RAM. */
1005
+ headroom_bytes: number;
1006
+ limit_bytes: number;
1007
+ };
1008
+ export type CpuObservation = {
1009
+ /** Monotonic elapsed time between the two successful reads, in milliseconds. */
1010
+ interval_ms: number;
1011
+ /** Rounded 0–100 percentage spent executing, excluding idle, I/O wait and steal. */
1012
+ percent: number;
1013
+ };
812
1014
  export type Disk = {
813
1015
  available: number;
814
1016
  mount: string;
@@ -857,6 +1059,11 @@ export type Entry = {
857
1059
  size: number;
858
1060
  };
859
1061
  export type EntryKind = "file" | "dir" | "symlink" | "other";
1062
+ /**
1063
+ * Why a `failed` run has no answer, when the agent program said so in a field of its own
1064
+ * output rather than only in words.
1065
+ */
1066
+ export type FailReason = "signed_out";
860
1067
  /**
861
1068
  * How an image's pixels map to the screen. Coordinates an agent sends are pixels of the image
862
1069
  * of the same `display`.
@@ -883,6 +1090,10 @@ export type Image = {
883
1090
  /** Which journal lines [`JournalSearch`] returns. */
884
1091
  export type JournalKind = "call" | "task";
885
1092
  export type KillSignal = "term" | "int" | "hup" | "kill";
1093
+ export type MemoryObservation = {
1094
+ available_bytes: number;
1095
+ total_bytes: number;
1096
+ };
886
1097
  export type Modifier = ("shift" | "ctrl" | "alt") | "meta";
887
1098
  /** The state after an action, as asked with `observe`. */
888
1099
  export type Observation = {
@@ -951,6 +1162,8 @@ export type StageOutcome = "answered" | "closed" | "timeout" | "paused";
951
1162
  export type Tier = "text_only" | "read_only";
952
1163
  export type TypeMethod = "auto" | "keys" | "paste";
953
1164
  export type UiAction = ("focus" | "toggle" | "expand" | "collapse") | "invoke" | "set_value" | "select_text";
1165
+ /** The durable stage of an upload, independent of an individual call. */
1166
+ export type UploadState = "uploading" | "committed" | "aborted" | "expired";
954
1167
  export type WaitFor = ("element_gone" | "text_gone") | "element_appears" | "text_appears" | "window_appears" | "screen_stable";
955
1168
  export type WindowInfo = {
956
1169
  app: string;
@@ -982,6 +1195,8 @@ export type DiskItem = {
982
1195
  };
983
1196
  /** How the machine talks to an agent program (the manifest's `bridge.protocol`). */
984
1197
  export type Protocol = "headless_json" | "acp" | "pty_only";
1198
+ /** The agent's sign-in as this machine last saw a run of it end. */
1199
+ export type SignIn = "ok" | "signed_out" | "unknown";
985
1200
  /** What removing an item costs. */
986
1201
  export type DiskClass = "cache" | "regenerable" | "feature" | "user-data" | "secret";
987
1202
  /** Every machine tool: its arguments and its result. */
@@ -1046,6 +1261,26 @@ export interface ToolMap {
1046
1261
  args: FsStatArgs;
1047
1262
  out: FsStatOut;
1048
1263
  };
1264
+ fs_upload_abort: {
1265
+ args: FsUploadAbortArgs;
1266
+ out: FsUploadAbortOut;
1267
+ };
1268
+ fs_upload_begin: {
1269
+ args: FsUploadBeginArgs;
1270
+ out: FsUploadBeginOut;
1271
+ };
1272
+ fs_upload_chunk: {
1273
+ args: FsUploadChunkArgs;
1274
+ out: FsUploadChunkOut;
1275
+ };
1276
+ fs_upload_commit: {
1277
+ args: FsUploadCommitArgs;
1278
+ out: FsUploadCommitOut;
1279
+ };
1280
+ fs_upload_status: {
1281
+ args: FsUploadStatusArgs;
1282
+ out: FsUploadStatusOut;
1283
+ };
1049
1284
  fs_write: {
1050
1285
  args: FsWriteArgs;
1051
1286
  out: FsWriteOut;
@@ -1098,6 +1333,10 @@ export interface ToolMap {
1098
1333
  args: SysInfoArgs;
1099
1334
  out: SysInfoOut;
1100
1335
  };
1336
+ sys_metrics: {
1337
+ args: SysMetricsArgs;
1338
+ out: SysMetricsOut;
1339
+ };
1101
1340
  task_output: {
1102
1341
  args: TaskOutputArgs;
1103
1342
  out: TaskOutputOut;
@@ -1224,6 +1463,36 @@ export declare const TOOLS: {
1224
1463
  readonly timeoutSecs: 30;
1225
1464
  readonly description: "Facts about a file or folder without reading it: kind, size, times, mode, writable, symlink target. hash=true adds its SHA-256 for expect_sha256. Paths holding keys and credentials are refused.";
1226
1465
  };
1466
+ readonly fs_upload_abort: {
1467
+ readonly risk: "write";
1468
+ readonly added: "0.1.18";
1469
+ readonly timeoutSecs: 60;
1470
+ readonly description: "Stop your unfinished upload and clean its temporary bytes. A completed upload returns its receipt and keeps the destination file.";
1471
+ };
1472
+ readonly fs_upload_begin: {
1473
+ readonly risk: "write";
1474
+ readonly added: "0.1.18";
1475
+ readonly timeoutSecs: 60;
1476
+ readonly description: "Begin a resumable create-only upload, up to 256 MiB. Bind a client-generated id, size and SHA-256; expires in 15 minutes. Use SDK upload helpers for bytes.";
1477
+ };
1478
+ readonly fs_upload_chunk: {
1479
+ readonly risk: "write";
1480
+ readonly added: "0.1.18";
1481
+ readonly timeoutSecs: 60;
1482
+ readonly description: "Supply up to 1 MiB of verified file bytes at the confirmed offset. After an uncertain reply, inspect upload status before continuing; never guess or replay blindly.";
1483
+ };
1484
+ readonly fs_upload_commit: {
1485
+ readonly risk: "write";
1486
+ readonly added: "0.1.18";
1487
+ readonly timeoutSecs: 120;
1488
+ readonly description: "Verify size and whole-file SHA-256, then create the destination without overwriting. A lost reply is reconciled through upload status; success includes a file receipt.";
1489
+ };
1490
+ readonly fs_upload_status: {
1491
+ readonly risk: "write";
1492
+ readonly added: "0.1.18";
1493
+ readonly timeoutSecs: 60;
1494
+ readonly description: "Inspect your upload's durable offset or final receipt, including after a lost reply or machine restart. Requires the original caller and current write permission.";
1495
+ };
1227
1496
  readonly fs_write: {
1228
1497
  readonly risk: "write";
1229
1498
  readonly added: "0.0.1";
@@ -1302,6 +1571,12 @@ export declare const TOOLS: {
1302
1571
  readonly timeoutSecs: 15;
1303
1572
  readonly description: "What the machine is: host name, OS and version, architecture, CPUs, memory, disks with free space, uptime, the user cmdop runs as and its home folder. Call it before choosing commands for a machine.";
1304
1573
  };
1574
+ readonly sys_metrics: {
1575
+ readonly risk: "read";
1576
+ readonly added: "0.1.18";
1577
+ readonly timeoutSecs: 10;
1578
+ readonly description: "CPU and RAM sample on Linux/macOS. System values are not container limits; cgroup quota and memory headroom are separate. Missing fields are unavailable.";
1579
+ };
1305
1580
  readonly task_output: {
1306
1581
  readonly risk: "read";
1307
1582
  readonly added: "0.0.1";
@@ -1351,4 +1626,4 @@ export declare const TOOLS: {
1351
1626
  readonly description: "Windows of the apps on screen, front to back: id, app, title, bounds in screen points, focus, whether visible, and whether `control` is allowed for the app.";
1352
1627
  };
1353
1628
  };
1354
- export declare const TOOL_NAMES: readonly ["agent_cancel", "agent_list", "agent_prompt", "agent_sessions", "app_open", "control_release", "disk_clean", "disk_usage", "exec_run", "fs_delete", "fs_edit", "fs_list", "fs_read", "fs_search", "fs_stat", "fs_write", "journal_search", "key_press", "pointer_click", "pointer_drag", "pointer_move", "pointer_scroll", "proc_kill", "proc_list", "screen_capture", "screen_info", "stage_show", "sys_info", "task_output", "task_start", "task_stop", "text_type", "ui_act", "ui_snapshot", "ui_wait", "window_list"];
1629
+ export declare const TOOL_NAMES: readonly ["agent_cancel", "agent_list", "agent_prompt", "agent_sessions", "app_open", "control_release", "disk_clean", "disk_usage", "exec_run", "fs_delete", "fs_edit", "fs_list", "fs_read", "fs_search", "fs_stat", "fs_upload_abort", "fs_upload_begin", "fs_upload_chunk", "fs_upload_commit", "fs_upload_status", "fs_write", "journal_search", "key_press", "pointer_click", "pointer_drag", "pointer_move", "pointer_scroll", "proc_kill", "proc_list", "screen_capture", "screen_info", "stage_show", "sys_info", "sys_metrics", "task_output", "task_start", "task_stop", "text_type", "ui_act", "ui_snapshot", "ui_wait", "window_list"];
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 292222b7ac86de94, cmdop 0.1.18) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Risk class, version and description of every tool, as the server lists them. */
3
3
  export const TOOLS = {
4
4
  agent_cancel: { risk: "agent", added: "0.1.13", timeoutSecs: 15, description: "Stops a running agent_prompt by its task. What the agent did until then stays done." },
@@ -16,6 +16,11 @@ export const TOOLS = {
16
16
  fs_read: { risk: "read", added: "0.0.1", timeoutSecs: 30, description: "Read a file as stored: text as text, other bytes as base64, 256 KiB per call by default. `truncated` means there is more: read on with offset. Paths holding keys and credentials are refused." },
17
17
  fs_search: { risk: "read", added: "0.0.1", timeoutSecs: 30, description: "Find files under a folder by name pattern (`*`, `?`) and/or plain text inside them: paths, and with content the first matching line. Bounded by depth, match count and 20 s." },
18
18
  fs_stat: { risk: "read", added: "0.0.1", timeoutSecs: 30, description: "Facts about a file or folder without reading it: kind, size, times, mode, writable, symlink target. hash=true adds its SHA-256 for expect_sha256. Paths holding keys and credentials are refused." },
19
+ fs_upload_abort: { risk: "write", added: "0.1.18", timeoutSecs: 60, description: "Stop your unfinished upload and clean its temporary bytes. A completed upload returns its receipt and keeps the destination file." },
20
+ fs_upload_begin: { risk: "write", added: "0.1.18", timeoutSecs: 60, description: "Begin a resumable create-only upload, up to 256 MiB. Bind a client-generated id, size and SHA-256; expires in 15 minutes. Use SDK upload helpers for bytes." },
21
+ fs_upload_chunk: { risk: "write", added: "0.1.18", timeoutSecs: 60, description: "Supply up to 1 MiB of verified file bytes at the confirmed offset. After an uncertain reply, inspect upload status before continuing; never guess or replay blindly." },
22
+ fs_upload_commit: { risk: "write", added: "0.1.18", timeoutSecs: 120, description: "Verify size and whole-file SHA-256, then create the destination without overwriting. A lost reply is reconciled through upload status; success includes a file receipt." },
23
+ fs_upload_status: { risk: "write", added: "0.1.18", timeoutSecs: 60, description: "Inspect your upload's durable offset or final receipt, including after a lost reply or machine restart. Requires the original caller and current write permission." },
19
24
  fs_write: { risk: "write", added: "0.0.1", timeoutSecs: 60, description: "Create a file or replace it whole, atomically; text or base64, up to 8 MiB. Replacing one needs expect_sha256, or the answer is hash_required. Paths holding keys and credentials are refused." },
20
25
  journal_search: { risk: "read", added: "0.0.2", timeoutSecs: 20, description: "What was done on one machine, kept on it: tool calls with their arguments as kept and task starts and ends, by author, tool, task, time and text. No output." },
21
26
  key_press: { risk: "control", added: "0.0.2", timeoutSecs: 20, description: "Press one key with optional modifiers, to the frontmost app. For text use `text_type`. Shortcuts: `key: \"s\", modifiers: [\"meta\"]`." },
@@ -29,6 +34,7 @@ export const TOOLS = {
29
34
  screen_info: { risk: "screen", added: "0.0.2", timeoutSecs: 10, description: "Displays with size and scale, the frontmost app, the cursor, screen lock, whether capture and input are granted and whether control is paused. Text only. Call it first in a session." },
30
35
  stage_show: { risk: "control", added: "0.1.16", timeoutSecs: 55, description: "Plays CMDOP's opening on the machine's screens, then shows your text and question as buttons. Waits up to 45 s for a pick; returns it and the machine's details." },
31
36
  sys_info: { risk: "read", added: "0.0.1", timeoutSecs: 15, description: "What the machine is: host name, OS and version, architecture, CPUs, memory, disks with free space, uptime, the user cmdop runs as and its home folder. Call it before choosing commands for a machine." },
37
+ sys_metrics: { risk: "read", added: "0.1.18", timeoutSecs: 10, description: "CPU and RAM sample on Linux/macOS. System values are not container limits; cgroup quota and memory headroom are separate. Missing fields are unavailable." },
32
38
  task_output: { risk: "read", added: "0.0.1", timeoutSecs: 10, description: "A task's screen as text, whether it runs. The last 200 lines by default; the machine keeps 1000 lines of its last 50 tasks until it restarts. What ran: journal_search." },
33
39
  task_start: { risk: "exec", added: "0.0.1", timeoutSecs: 10, description: "Start a command in a terminal on the machine; it keeps running after the call and the conversation end. Read it with task_output, end it with task_stop. For an exit code, use exec_run." },
34
40
  task_stop: { risk: "exec", added: "0.0.1", timeoutSecs: 10, description: "Stop a task: SIGTERM to its process group, SIGKILL after 5 seconds. The ending shows in tasks_list and history_search a moment later." },
@@ -38,4 +44,4 @@ export const TOOLS = {
38
44
  ui_wait: { risk: "screen", added: "0.0.2", timeoutSecs: 35, description: "Wait until an element, text or window appears or is gone, or the screen is stable, for at most 30 s. A timeout is an answer (`met: false`), not an error." },
39
45
  window_list: { risk: "screen", added: "0.0.2", timeoutSecs: 10, description: "Windows of the apps on screen, front to back: id, app, title, bounds in screen points, focus, whether visible, and whether `control` is allowed for the app." },
40
46
  };
41
- export const TOOL_NAMES = ["agent_cancel", "agent_list", "agent_prompt", "agent_sessions", "app_open", "control_release", "disk_clean", "disk_usage", "exec_run", "fs_delete", "fs_edit", "fs_list", "fs_read", "fs_search", "fs_stat", "fs_write", "journal_search", "key_press", "pointer_click", "pointer_drag", "pointer_move", "pointer_scroll", "proc_kill", "proc_list", "screen_capture", "screen_info", "stage_show", "sys_info", "task_output", "task_start", "task_stop", "text_type", "ui_act", "ui_snapshot", "ui_wait", "window_list"];
47
+ export const TOOL_NAMES = ["agent_cancel", "agent_list", "agent_prompt", "agent_sessions", "app_open", "control_release", "disk_clean", "disk_usage", "exec_run", "fs_delete", "fs_edit", "fs_list", "fs_read", "fs_search", "fs_stat", "fs_upload_abort", "fs_upload_begin", "fs_upload_chunk", "fs_upload_commit", "fs_upload_status", "fs_write", "journal_search", "key_press", "pointer_click", "pointer_drag", "pointer_move", "pointer_scroll", "proc_kill", "proc_list", "screen_capture", "screen_info", "stage_show", "sys_info", "sys_metrics", "task_output", "task_start", "task_stop", "text_type", "ui_act", "ui_snapshot", "ui_wait", "window_list"];
package/dist/index.d.ts CHANGED
@@ -8,3 +8,5 @@ export { GROUPS, type GroupName } from "./generated/surface.gen.ts";
8
8
  export { SERVER_TOOLS, SERVER_TOOL_NAMES, type ServerToolMap, type ServerToolName } from "./generated/server.gen.ts";
9
9
  export { decodeImage, toScreenshot, type DecodedImage, type Screenshot } from "./screen.ts";
10
10
  export { anthropicToCalls, openaiToCalls, performCalls, UnsupportedAction, type Step, type VendorOptions } from "./vendor.ts";
11
+ export { uploadFile, UploadError, type UploadOptions, type UploadProgress } from "./upload.ts";
12
+ export { VERSION } from "./version.ts";
package/dist/index.js CHANGED
@@ -8,3 +8,5 @@ export { GROUPS } from "./generated/surface.gen.js";
8
8
  export { SERVER_TOOLS, SERVER_TOOL_NAMES } from "./generated/server.gen.js";
9
9
  export { decodeImage, toScreenshot } from "./screen.js";
10
10
  export { anthropicToCalls, openaiToCalls, performCalls, UnsupportedAction } from "./vendor.js";
11
+ export { uploadFile, UploadError } from "./upload.js";
12
+ export { VERSION } from "./version.js";
@@ -0,0 +1,41 @@
1
+ /** Bounded local-file upload for Node.js. The generated tools own the wire contract. */
2
+ import { type Machine } from "./client.ts";
3
+ import type { FsUploadBeginOut, FsUploadChunkOut, FsUploadCommitOut, FsUploadStatusOut } from "./generated/tools.gen.ts";
4
+ type UploadOut = FsUploadBeginOut | FsUploadChunkOut | FsUploadCommitOut | FsUploadStatusOut;
5
+ /** Metadata only. "prepared" is local; "committed" requires a verified receiver receipt. */
6
+ export interface UploadProgress {
7
+ readonly transfer: string;
8
+ readonly path: string;
9
+ readonly size: number;
10
+ readonly sha256: string;
11
+ readonly offset: number;
12
+ readonly state: "prepared" | UploadOut["state"];
13
+ }
14
+ export interface UploadOptions {
15
+ /** Save and reuse this 32-character lowercase hex id with the same caller, machine, source and destination. */
16
+ transfer?: string;
17
+ mkdirs?: boolean;
18
+ /** Receives metadata, never file bytes. The first event runs before begin. */
19
+ onProgress?: (progress: UploadProgress) => void;
20
+ /** Per-call deadline in milliseconds, 30 seconds by default. */
21
+ deadline?: number;
22
+ signal?: AbortSignal;
23
+ }
24
+ /** The upload stopped. last is observed metadata, not proof a timed-out mutation did nothing. */
25
+ export declare class UploadError extends Error {
26
+ readonly transfer: string;
27
+ readonly last?: UploadProgress;
28
+ constructor(message: string, transfer: string, last?: UploadProgress, cause?: unknown);
29
+ }
30
+ /**
31
+ * Create a remote file from a local regular file using at most 1 MiB per chunk.
32
+ *
33
+ * Requires Node.js, an upload-capable machine and write authority. Destination must be
34
+ * absolute and must not exist. The file is read twice, never loaded whole. Files above
35
+ * this helper's compiled 256 MiB budget are refused before hashing. Save transfer,
36
+ * or the first progress event, before begin so another process can resume explicitly.
37
+ * A lost chunk/commit answer triggers status; this helper never replays those mutations.
38
+ * Node builtins load only when this helper is called.
39
+ */
40
+ export declare function uploadFile(machine: Machine, sourcePath: string, destinationPath: string, options?: UploadOptions): Promise<FsUploadCommitOut>;
41
+ export {};
package/dist/upload.js ADDED
@@ -0,0 +1,209 @@
1
+ /** Bounded local-file upload for Node.js. The generated tools own the wire contract. */
2
+ import { CmdopError } from "./client.js";
3
+ // Local memory budget; a smaller receiver limit always wins.
4
+ const BLOCK_BYTES = 1024 * 1024;
5
+ // Compiled preflight budget for this helper; the receiver still enforces its own limit.
6
+ const FILE_MAX_BYTES = 256 * BLOCK_BYTES;
7
+ /** The upload stopped. last is observed metadata, not proof a timed-out mutation did nothing. */
8
+ export class UploadError extends Error {
9
+ transfer;
10
+ last;
11
+ constructor(message, transfer, last, cause) {
12
+ super(message, cause === undefined ? undefined : { cause });
13
+ this.name = "UploadError";
14
+ this.transfer = transfer;
15
+ this.last = last;
16
+ }
17
+ }
18
+ function uncertain(error) {
19
+ // Definitive refusals cannot become success of a previous transfer with the same id.
20
+ return !(error instanceof CmdopError) || error.details?.upload_outcome === "unknown"
21
+ || ["timed_out", "cancelled", "failed", "offline"].includes(error.code);
22
+ }
23
+ /**
24
+ * Create a remote file from a local regular file using at most 1 MiB per chunk.
25
+ *
26
+ * Requires Node.js, an upload-capable machine and write authority. Destination must be
27
+ * absolute and must not exist. The file is read twice, never loaded whole. Files above
28
+ * this helper's compiled 256 MiB budget are refused before hashing. Save transfer,
29
+ * or the first progress event, before begin so another process can resume explicitly.
30
+ * A lost chunk/commit answer triggers status; this helper never replays those mutations.
31
+ * Node builtins load only when this helper is called.
32
+ */
33
+ export async function uploadFile(machine, sourcePath, destinationPath, options = {}) {
34
+ const { open } = await import("node:fs/promises");
35
+ const { createHash, randomBytes } = await import("node:crypto");
36
+ const { posix, win32 } = await import("node:path");
37
+ const absolute = (path) => posix.isAbsolute(path) || win32.isAbsolute(path);
38
+ const transfer = options.transfer ?? randomBytes(16).toString("hex");
39
+ if (!/^[0-9a-f]{32}$/.test(transfer))
40
+ throw new TypeError("transfer must be 32 lowercase hexadecimal characters");
41
+ if (!absolute(destinationPath))
42
+ throw new TypeError("upload destination must be an absolute path on the machine");
43
+ const deadline = options.deadline ?? 30_000;
44
+ if (!Number.isFinite(deadline) || deadline <= 0)
45
+ throw new TypeError("upload deadline must be positive and finite");
46
+ const callOptions = { deadline, signal: options.signal };
47
+ let last;
48
+ let boundPath;
49
+ let size = 0;
50
+ let sha256 = "";
51
+ const fail = (message, cause) => new UploadError(message, transfer, last, cause);
52
+ const checkAbort = () => {
53
+ if (options.signal?.aborted)
54
+ throw fail("upload stopped by its caller; inspect status before resuming", options.signal.reason);
55
+ };
56
+ const emit = () => {
57
+ if (last)
58
+ options.onProgress?.(last);
59
+ };
60
+ function accept(out) {
61
+ if (!out || (out.transfer !== transfer || out.size !== size || out.sha256 !== sha256)) {
62
+ throw fail("receiver upload identity does not match the source");
63
+ }
64
+ if (typeof out.path !== "string" || !absolute(out.path) || (boundPath !== undefined && out.path !== boundPath)) {
65
+ throw fail("receiver upload destination changed");
66
+ }
67
+ if (!Number.isSafeInteger(out.offset) || out.offset < 0 || out.offset > size
68
+ || !Number.isSafeInteger(out.chunk_max_bytes) || out.chunk_max_bytes <= 0) {
69
+ throw fail("receiver returned invalid upload limits or offset");
70
+ }
71
+ if (out.state === "committed") {
72
+ const receipt = out.receipt;
73
+ if (!receipt || receipt.path !== out.path || receipt.size !== size || receipt.sha256 !== sha256
74
+ || receipt.created !== true || out.offset !== size) {
75
+ throw fail("receiver commit receipt does not match the source");
76
+ }
77
+ }
78
+ else if (out.receipt != null) {
79
+ throw fail("receiver returned a receipt for an uncommitted upload");
80
+ }
81
+ if (!["uploading", "committed", "aborted", "expired"].includes(out.state)) {
82
+ throw fail("receiver returned an unknown upload state");
83
+ }
84
+ boundPath = out.path;
85
+ last = Object.freeze({ transfer, path: out.path, size, sha256, offset: out.offset, state: out.state });
86
+ if (out.state === "aborted" || out.state === "expired")
87
+ throw fail("upload is " + out.state + "; begin a new authorized transfer");
88
+ return out;
89
+ }
90
+ async function call(operation, mutate, expected) {
91
+ checkAbort();
92
+ try {
93
+ return await mutate();
94
+ }
95
+ catch (error) {
96
+ if (error instanceof CmdopError) {
97
+ const details = error.details ?? {};
98
+ if ("transfer" in details && details.transfer !== transfer)
99
+ throw fail("receiver error names a different transfer", error);
100
+ if (details.upload_outcome === "unknown" && (details.transfer !== transfer || details.action !== "status")) {
101
+ throw fail("receiver returned an invalid upload recovery marker", error);
102
+ }
103
+ }
104
+ if (!uncertain(error))
105
+ throw fail("upload was refused; inspect the original error before resuming", error);
106
+ let out;
107
+ try {
108
+ // A cancelled mutation still needs observation; its aborted signal must not cancel status.
109
+ out = accept(await machine.fs_upload_status({ transfer }, { deadline }));
110
+ }
111
+ catch (statusError) {
112
+ if (statusError instanceof UploadError)
113
+ throw statusError;
114
+ throw fail("upload outcome is unknown; query status with this transfer id", statusError);
115
+ }
116
+ if (out.state === "committed" && operation !== "begin")
117
+ return out;
118
+ checkAbort();
119
+ if (operation === "begin") {
120
+ // Status cannot prove how the requested absolute path resolved. Idempotent begin
121
+ // rechecks that binding only after status confirmed the existing transfer.
122
+ try {
123
+ return await mutate();
124
+ }
125
+ catch (bindingError) {
126
+ throw fail("upload destination binding is unconfirmed; retain this transfer id", bindingError);
127
+ }
128
+ }
129
+ if (operation === "chunk" && out.offset === expected)
130
+ return out;
131
+ throw fail("upload outcome is not confirmed; resume with this transfer id after checking status", error);
132
+ }
133
+ }
134
+ checkAbort();
135
+ let file;
136
+ try {
137
+ file = await open(sourcePath, "r");
138
+ const source = file;
139
+ const initial = await source.stat({ bigint: true });
140
+ if (!initial.isFile())
141
+ throw fail("upload source must be a regular file");
142
+ size = Number(initial.size);
143
+ if (!Number.isSafeInteger(size) || size < 0)
144
+ throw fail("upload source size cannot be represented safely");
145
+ if (size > FILE_MAX_BYTES)
146
+ throw fail("upload source exceeds this helper's 256 MiB file budget");
147
+ const signature = (info) => [info.dev, info.ino, info.size, info.mtimeNs, info.ctimeNs].join(":");
148
+ const unchanged = async () => {
149
+ if (signature(await source.stat({ bigint: true })) !== signature(initial)) {
150
+ throw fail("upload source changed; keep the original file before resuming");
151
+ }
152
+ };
153
+ const buffer = Buffer.alloc(BLOCK_BYTES);
154
+ const digest = createHash("sha256");
155
+ let position = 0;
156
+ while (position < size) {
157
+ checkAbort();
158
+ const { bytesRead } = await source.read(buffer, 0, Math.min(BLOCK_BYTES, size - position), position);
159
+ if (bytesRead === 0)
160
+ throw fail("upload source changed while it was being read");
161
+ digest.update(buffer.subarray(0, bytesRead));
162
+ position += bytesRead;
163
+ }
164
+ await unchanged();
165
+ sha256 = digest.digest("hex");
166
+ last = Object.freeze({ transfer, path: destinationPath, size, sha256, offset: 0, state: "prepared" });
167
+ emit();
168
+ const begin = () => machine.fs_upload_begin({ transfer, path: destinationPath, size, sha256, mkdirs: options.mkdirs ?? false }, callOptions);
169
+ let out = accept(await call("begin", begin));
170
+ emit();
171
+ while (out.state !== "committed" && out.offset < size) {
172
+ checkAbort();
173
+ await unchanged();
174
+ const length = Math.min(BLOCK_BYTES, out.chunk_max_bytes, size - out.offset);
175
+ let read = 0;
176
+ while (read < length) {
177
+ const { bytesRead } = await source.read(buffer, read, length - read, out.offset + read);
178
+ if (bytesRead === 0)
179
+ throw fail("upload source changed while it was being read");
180
+ read += bytesRead;
181
+ }
182
+ await unchanged();
183
+ const data = buffer.subarray(0, length);
184
+ const args = { transfer, offset: out.offset, data: data.toString("base64"), sha256: createHash("sha256").update(data).digest("hex") };
185
+ const end = out.offset + length;
186
+ out = accept(await call("chunk", () => machine.fs_upload_chunk(args, callOptions), end));
187
+ if (out.state !== "committed" && out.offset !== end) {
188
+ throw fail("receiver offset differs from the acknowledged chunk; inspect status before resuming");
189
+ }
190
+ emit();
191
+ }
192
+ if (out.state !== "committed") {
193
+ await unchanged();
194
+ out = accept(await call("commit", () => machine.fs_upload_commit({ transfer }, callOptions)));
195
+ emit();
196
+ }
197
+ if (out.state !== "committed")
198
+ throw fail("commit was not confirmed; inspect status before resuming");
199
+ return out;
200
+ }
201
+ catch (error) {
202
+ if (error instanceof UploadError)
203
+ throw error;
204
+ throw fail("upload stopped locally; retain this transfer id and inspect the original error", error);
205
+ }
206
+ finally {
207
+ await file?.close();
208
+ }
209
+ }
package/dist/version.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * record shows which SDK made a call. The release tool rewrites it together with `package.json`; a test keeps the two
4
4
  * equal.
5
5
  */
6
- export declare const VERSION = "3.6.1";
6
+ export declare const VERSION = "3.7.3";
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * record shows which SDK made a call. The release tool rewrites it together with `package.json`; a test keeps the two
4
4
  * equal.
5
5
  */
6
- export const VERSION = "3.6.1";
6
+ export const VERSION = "3.7.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmdop/sdk",
3
- "version": "3.6.1",
3
+ "version": "3.7.3",
4
4
  "description": "Your machines' tools from a program: the same tools agents use through MCP, typed from Rust.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://cmdop.ai",