@idapt/cli 1.8.0 → 1.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/index.cjs CHANGED
@@ -536,7 +536,10 @@ var listCodeRunsRequestSchema = zod.z.object({
536
536
  var executeCodeRequestSchema = zod.z.object({
537
537
  file_id: zod.z.string(),
538
538
  timeout_seconds: zod.z.number().int().min(1).max(300).default(30),
539
- env: zod.z.record(zod.z.string(), zod.z.string()).optional()
539
+ env: zod.z.record(zod.z.string(), zod.z.string()).optional(),
540
+ // Names of workspace secrets to inject as env vars (resolved server-side; the
541
+ // values never appear in the response and are redacted from stdout/stderr).
542
+ secrets: zod.z.array(zod.z.string()).max(50).optional()
540
543
  });
541
544
  var emptyCodeRequestSchema = zod.z.object({});
542
545
  var RUN_COLUMNS = [
@@ -600,7 +603,7 @@ var codeCommands = [
600
603
  async: true,
601
604
  tags: ["Code Runs"],
602
605
  summary: "Execute a code file (js/ts/py/sh) in a sandbox; returns the run.",
603
- description: "Execute a code file (.js, .ts, .py, .sh) in a sandboxed Lambda environment. Returns stdout, stderr, exit code, and timing.",
606
+ description: "Execute a code file (.js, .ts, .py, .sh) in a sandboxed Lambda environment. Returns stdout, stderr, exit code, and timing. Pass `secrets` (workspace secret names) to inject them as env vars \u2014 resolved server-side, never returned, and redacted from output.",
604
607
  errors: [403, 404, 429],
605
608
  columns: RUN_COLUMNS
606
609
  }),
@@ -687,11 +690,6 @@ var computerEnvVarResponseSchema = zod.z.object({
687
690
  file_id: zod.z.string().nullish(),
688
691
  created_at: zod.z.string()
689
692
  }).meta({ id: "ComputerEnvVar" });
690
- zod.z.object({
691
- port: zod.z.number(),
692
- protocol: zod.z.enum(["tcp", "udp"]),
693
- source: zod.z.string().nullish()
694
- }).meta({ id: "ComputerFirewallRule" });
695
693
  var computerPortResponseSchema = zod.z.object({
696
694
  port: zod.z.number(),
697
695
  protocol: zod.z.string(),
@@ -781,16 +779,6 @@ var envSyncResultSchema = zod.z.object({
781
779
  ),
782
780
  extra_on_disk: zod.z.array(zod.z.string())
783
781
  }).meta({ id: "EnvSyncResult" });
784
- var firewallResultSchema = zod.z.object({
785
- rules: zod.z.array(
786
- zod.z.object({
787
- port: zod.z.number(),
788
- protocol: zod.z.string()
789
- })
790
- ),
791
- query_status: zod.z.string(),
792
- query_error: zod.z.string().nullish()
793
- }).meta({ id: "FirewallResult" });
794
782
  var computerPortsResultSchema = zod.z.object({
795
783
  ports: zod.z.array(computerPortResponseSchema),
796
784
  discovery_status: zod.z.string(),
@@ -832,7 +820,11 @@ var updateComputerRequestSchema = zod.z.object({
832
820
  var computerExecRequestSchema = zod.z.object({
833
821
  command: zod.z.string().min(1).max(8192).describe("Shell command to run."),
834
822
  timeout_seconds: zod.z.number().int().min(1).max(900).optional(),
835
- user: zod.z.string().regex(usernamePattern).optional().describe("Unix user to run the command as.")
823
+ user: zod.z.string().regex(usernamePattern).optional().describe("Unix user to run the command as."),
824
+ secrets: zod.z.array(zod.z.string()).max(50).optional().describe(
825
+ "Names of workspace secrets to inject. Resolved server-side, mounted by the daemon, never returned, and redacted from output."
826
+ ),
827
+ secret_mount_mode: zod.z.enum(["env", "file"]).optional().describe("env (default) exports vars; file writes /run/idapt-secrets/.")
836
828
  });
837
829
  var computerTmuxRequestSchema = zod.z.object({
838
830
  op: zod.z.enum(["list", "run", "capture", "send", "kill"]).describe("Operation discriminator; the response shape depends on `op`."),
@@ -887,14 +879,6 @@ var createUserEnvVarRequestSchema = zod.z.union([
887
879
  )
888
880
  })
889
881
  ]);
890
- var addFirewallRuleRequestSchema = zod.z.object({
891
- port: zod.z.number().int().min(1).max(65535).describe("Port to open."),
892
- protocol: zod.z.enum(["tcp", "udp"]).default("tcp")
893
- });
894
- var removeFirewallRuleRequestSchema = zod.z.object({
895
- port: zod.z.coerce.number().int().describe("Port of the rule to remove."),
896
- protocol: zod.z.enum(["tcp", "udp"]).optional()
897
- });
898
882
  var patchComputerPortRequestSchema = zod.z.object({
899
883
  port: zod.z.number().int().min(1).max(65535),
900
884
  protocol: zod.z.string(),
@@ -1272,47 +1256,7 @@ var computerCommands = [
1272
1256
  description: "Operation discriminator on `op`; the response shape depends on `op`. Streaming upload + download have dedicated routes. Daemon-layer failures map to `internal_error`/`conflict`/`not_found`/`forbidden`.",
1273
1257
  errors: [403, 409, 500, 503]
1274
1258
  }),
1275
- // ---- firewall + ports ---------------------------------------------------
1276
- cmd({
1277
- resource: "computer",
1278
- verb: "firewall",
1279
- method: "GET",
1280
- path: "/computers/:id/firewall",
1281
- response: firewallResultSchema,
1282
- permission: P,
1283
- responseKind: "single",
1284
- tags: TAGS,
1285
- summary: "List firewall rules.",
1286
- description: "Query iptables rules (cloud computers only).",
1287
- errors: [403]
1288
- }),
1289
- cmd({
1290
- resource: "computer",
1291
- verb: "firewall-add",
1292
- method: "POST",
1293
- path: "/computers/:id/firewall",
1294
- request: addFirewallRuleRequestSchema,
1295
- response: firewallResultSchema,
1296
- permission: W,
1297
- responseKind: "single",
1298
- tags: TAGS,
1299
- summary: "Add a firewall rule.",
1300
- errors: [403, 409, 500]
1301
- }),
1302
- cmd({
1303
- resource: "computer",
1304
- verb: "firewall-remove",
1305
- method: "DELETE",
1306
- path: "/computers/:id/firewall",
1307
- argLocation: "query",
1308
- request: removeFirewallRuleRequestSchema,
1309
- response: firewallResultSchema,
1310
- permission: W,
1311
- responseKind: "single",
1312
- tags: TAGS,
1313
- summary: "Remove a firewall rule.",
1314
- errors: [403, 409, 500]
1315
- }),
1259
+ // ---- ports --------------------------------------------------------------
1316
1260
  cmd({
1317
1261
  resource: "computer",
1318
1262
  verb: "ports",
@@ -1763,25 +1707,6 @@ var computerCommands = [
1763
1707
  public: false,
1764
1708
  tags: TAGS,
1765
1709
  summary: "Close a computer's public tunnel for a port."
1766
- }),
1767
- // `firewall-edit` is the agent's add-OR-remove verb (it carries a
1768
- // `firewall_action` sub-action) — distinct from the discrete public
1769
- // `firewall-add` (POST) / `firewall-remove` (DELETE). agent-internal.
1770
- cmd({
1771
- resource: "computer",
1772
- verb: "firewall-edit",
1773
- method: "POST",
1774
- path: "/computers/:id/firewall-edit",
1775
- request: zod.z.object({
1776
- firewall_action: zod.z.enum(["add", "remove"]),
1777
- port: zod.z.coerce.number().int().min(1).max(65535),
1778
- protocol: zod.z.enum(["tcp", "udp"]).optional()
1779
- }),
1780
- permission: W,
1781
- responseKind: "single",
1782
- public: false,
1783
- tags: TAGS,
1784
- summary: "Add or remove a firewall rule (agent add-or-remove verb)."
1785
1710
  })
1786
1711
  ];
1787
1712
  var computerPlaybook = {
@@ -1789,14 +1714,14 @@ var computerPlaybook = {
1789
1714
  instructions: `Computers are remote machines. \`computer list\`/\`get\`; lifecycle via
1790
1715
  \`start\`/\`stop\`/\`hibernate\`/\`archive\`. Run commands with \`computer exec <id> --command \u2026\`
1791
1716
  (long-running \u2014 use --background). Transfer files with \`computer download <id> --path \u2026\`
1792
- and \`computer upload\`. Manage \`firewall\`/\`ports\`/\`users\` and Docker \`apps\`
1717
+ and \`computer upload\`. Manage \`ports\`/\`users\` and Docker \`apps\`
1793
1718
  (\`app-run\`, \`app-start\`/\`stop\`, \`app-logs\`, \`app-exec\`).
1794
1719
 
1795
1720
  A computer lives in ONE home workspace (full control). Share its LOCAL INFERENCE
1796
1721
  ONLY into other workspaces with \`computer link <id> --workspace-id <ws>\` (never
1797
1722
  shares shell / files / tunnels); \`computer links <id>\` lists the shares and
1798
- \`computer unlink <id> --workspace-id <ws>\` revokes one. Pair a new machine with
1799
- the \`idapt up\` / \`idapt pair\` daemon flow (defaults to your personal
1723
+ \`computer unlink <id> --workspace-id <ws>\` revokes one. Register a new machine with
1724
+ the \`idapt up\` daemon flow (defaults to your personal
1800
1725
  workspace).`
1801
1726
  };
1802
1727
  var listQuery = zod.z.object({
@@ -1818,7 +1743,6 @@ var agentResponseSchema = zod.z.object({
1818
1743
  workspace_id: zod.z.string().nullish(),
1819
1744
  type: zod.z.string().nullish(),
1820
1745
  permissions: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())).nullish(),
1821
- confirmation_required: zod.z.array(zod.z.string()).optional(),
1822
1746
  compaction_preset: zod.z.enum(["minimal", "normal", "detailed"]).nullish(),
1823
1747
  compaction_summary_percent: zod.z.number().nullish(),
1824
1748
  compaction_summary_max_tokens: zod.z.number().nullish(),
@@ -1826,6 +1750,8 @@ var agentResponseSchema = zod.z.object({
1826
1750
  compaction_preserved_max_tokens: zod.z.number().nullish(),
1827
1751
  compaction_msg_percent: zod.z.number().nullish(),
1828
1752
  compaction_msg_max_tokens: zod.z.number().nullish(),
1753
+ compaction_trigger_type: zod.z.enum(["percent", "tokens"]).nullish(),
1754
+ compaction_trigger_value: zod.z.number().nullish(),
1829
1755
  source_template_resource_id: zod.z.string().nullish(),
1830
1756
  memory_folder: zod.z.string().nullish(),
1831
1757
  default_model_id: zod.z.string().nullish(),
@@ -2136,7 +2062,9 @@ var agentCompactionFields = {
2136
2062
  compaction_preserved_percent: zod.z.number().min(0).max(100).nullish(),
2137
2063
  compaction_preserved_max_tokens: zod.z.number().min(0).max(5e5).nullish(),
2138
2064
  compaction_msg_percent: zod.z.number().min(0).max(100).nullish(),
2139
- compaction_msg_max_tokens: zod.z.number().min(0).max(5e5).nullish()
2065
+ compaction_msg_max_tokens: zod.z.number().min(0).max(5e5).nullish(),
2066
+ compaction_trigger_type: zod.z.enum(["percent", "tokens"]).nullish(),
2067
+ compaction_trigger_value: zod.z.number().int().min(0).nullish()
2140
2068
  };
2141
2069
  var createAgentRequestSchema = zod.z.object({
2142
2070
  name: zod.z.string().min(1).max(80),
@@ -2147,7 +2075,6 @@ var createAgentRequestSchema = zod.z.object({
2147
2075
  authorization: zod.z.record(zod.z.string(), zod.z.unknown()).nullish().describe(
2148
2076
  "Agent authorization policy. Null clears explicit policy; omitted uses the default workspace-write policy."
2149
2077
  ),
2150
- confirmation_required: zod.z.array(zod.z.string()).max(200).optional(),
2151
2078
  ...agentCompactionFields,
2152
2079
  type: zod.z.enum(["user", "generated"]).optional().describe("Agent type."),
2153
2080
  memory_folder: zod.z.string().max(500).nullish(),
@@ -2162,7 +2089,6 @@ var updateAgentRequestSchema = zod.z.object({
2162
2089
  description: zod.z.string().max(2e3).nullish(),
2163
2090
  system_prompt: zod.z.string().max(131072).nullish(),
2164
2091
  authorization: zod.z.record(zod.z.string(), zod.z.unknown()).nullish().describe("Agent authorization policy. Null clears explicit policy."),
2165
- confirmation_required: zod.z.array(zod.z.string()).max(200).optional(),
2166
2092
  ...agentCompactionFields,
2167
2093
  type: zod.z.enum(["user", "generated"]).optional(),
2168
2094
  memory_folder: zod.z.string().max(500).nullish(),
@@ -5270,6 +5196,10 @@ var secretResponseSchema = zod.z.object({
5270
5196
  type: zod.z.string().nullish(),
5271
5197
  /** Masked last-4 preview — never reconstructs the value. */
5272
5198
  value_preview: zod.z.string().nullish(),
5199
+ /** ISO-8601 expiry instant, or null. Past expiry blocks injection. */
5200
+ expires_at: zod.z.string().nullish(),
5201
+ /** ISO-8601 of the last reveal/inject, or null if never used. */
5202
+ last_used_at: zod.z.string().nullish(),
5273
5203
  created_at: zod.z.string(),
5274
5204
  updated_at: zod.z.string()
5275
5205
  }).meta({ id: "Secret" });
@@ -5292,11 +5222,14 @@ var createSecretRequestSchema = zod.z.object({
5292
5222
  "ssh_private_key",
5293
5223
  "ssh_public_key"
5294
5224
  ]).optional(),
5225
+ /** ISO-8601 expiry instant; null/omitted = never expires. */
5226
+ expires_at: zod.z.string().datetime({ offset: true }).nullish(),
5295
5227
  workspace_id: zod.z.string().max(64).optional()
5296
5228
  });
5297
5229
  var updateSecretRequestSchema = zod.z.object({
5298
5230
  value: zod.z.string().min(1).optional(),
5299
- description: zod.z.string().max(1e3).nullish()
5231
+ description: zod.z.string().max(1e3).nullish(),
5232
+ expires_at: zod.z.string().datetime({ offset: true }).nullish()
5300
5233
  });
5301
5234
  var secretsCommands = [
5302
5235
  cmd({
@@ -5400,11 +5333,20 @@ var secretsPlaybook = {
5400
5333
  " contents. Don't ask the user to paste a secret into the chat.",
5401
5334
  "",
5402
5335
  "- `create --name OPENAI_API_KEY --value <v>`: prefer ALL_CAPS names (they map",
5403
- " cleanly to env vars). Names are unique per workspace.",
5336
+ " cleanly to env vars). Optional `--expires-at <ISO-8601>`. Unique per workspace.",
5404
5337
  "- `update` ROTATES: the old value is destroyed immediately and anything using",
5405
5338
  " it breaks until re-pointed. There is no rename \u2014 create a new one.",
5406
5339
  "- `delete` is immediate and irreversible.",
5407
5340
  "",
5341
+ "Using a secret at run time (pass the NAME, never the value):",
5342
+ "- `code execute --secrets '[\"GITHUB_TOKEN\"]'` \u2192 the script sees it as the env",
5343
+ " var `GITHUB_TOKEN`; `bash --secrets [...]` and `computer exec --secrets [...]`",
5344
+ " work the same. The value is injected server-side and redacted from output.",
5345
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal ${secret:NAME} reference syntax, not a template placeholder
5346
+ "- Or embed `${secret:NAME}` inside a free-form `env` value (e.g.",
5347
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal example of the ${secret:NAME} syntax
5348
+ " `DATABASE_URL=postgres://app:${secret:DB_PASSWORD}@db`).",
5349
+ "",
5408
5350
  "Anti-patterns: never print, log, or repeat a secret value the user gives you \u2014",
5409
5351
  "create it and move on. Secrets live here, not as Drive files and not in chat."
5410
5352
  ].join("\n")
@@ -5662,9 +5604,12 @@ function argLines(spec) {
5662
5604
  }
5663
5605
  return lines;
5664
5606
  }
5665
- function renderHelp(spec) {
5607
+ function renderHelp(spec, options = {}) {
5666
5608
  const lines = [];
5667
- lines.push(`idapt ${spec.command} \u2014 ${spec.summary}`);
5609
+ const command = options.command ?? spec.command;
5610
+ const summary = options.summary ?? spec.summary;
5611
+ const resource = options.resource ?? spec.resource;
5612
+ lines.push(`idapt ${command} \u2014 ${summary}`);
5668
5613
  lines.push("");
5669
5614
  lines.push(` ${spec.method} /api/v1${spec.path}`);
5670
5615
  if (spec.async) lines.push(" (long-running \u2014 supports --background)");
@@ -5679,7 +5624,7 @@ function renderHelp(spec) {
5679
5624
  lines.push(spec.help);
5680
5625
  }
5681
5626
  lines.push("");
5682
- lines.push(`Playbook: idapt instructions ${spec.resource}`);
5627
+ lines.push(`Playbook: idapt instructions ${resource}`);
5683
5628
  return lines.join("\n");
5684
5629
  }
5685
5630
  function renderInstructions(resource) {
@@ -5758,6 +5703,7 @@ function parseIdaptCommand(cmd2) {
5758
5703
  args: parsedFlags.args,
5759
5704
  timeoutSeconds,
5760
5705
  background: parsedFlags.args.background === true,
5706
+ requiresConfirmation: parsedFlags.args.requiresConfirmation === true || parsedFlags.args["requires-confirmation"] === true || parsedFlags.args.requires_confirmation === true,
5761
5707
  help: parsedFlags.args.help === true,
5762
5708
  instructions: parsedFlags.args.instructions === true
5763
5709
  }
@@ -6035,6 +5981,8 @@ var VERB_OVERRIDES = {
6035
5981
  "trigger read": "trigger get",
6036
5982
  "trigger edit": "trigger update",
6037
5983
  "trigger fire": "trigger test-fire",
5984
+ // secrets — `edit` is the natural verb; the contract op is `update` (rotate).
5985
+ "secret edit": "secret update",
6038
5986
  // utility → catalog
6039
5987
  "utility search-llm-models": "models search",
6040
5988
  "utility search-image-models": "image search",
@@ -6065,9 +6013,6 @@ var VERB_OVERRIDES = {
6065
6013
  "computer file-download": "computer download",
6066
6014
  "computer upload-dir": "computer upload",
6067
6015
  "computer download-dir": "computer download",
6068
- "computer firewall-view": "computer firewall",
6069
- // NB: `firewall-edit` is identity (its own add-or-remove route) — it must NOT
6070
- // map to `firewall-add`, or `--firewall-action remove` would silently ADD.
6071
6016
  "computer user-list": "computer users",
6072
6017
  "computer user-create": "computer create-user",
6073
6018
  "computer user-delete": "computer delete-user",