@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/bin.cjs CHANGED
@@ -79,6 +79,7 @@ function parseIdaptCommand(cmd2) {
79
79
  args: parsedFlags.args,
80
80
  timeoutSeconds,
81
81
  background: parsedFlags.args.background === true,
82
+ requiresConfirmation: parsedFlags.args.requiresConfirmation === true || parsedFlags.args["requires-confirmation"] === true || parsedFlags.args.requires_confirmation === true,
82
83
  help: parsedFlags.args.help === true,
83
84
  instructions: parsedFlags.args.instructions === true
84
85
  }
@@ -325,7 +326,7 @@ function createFetchTransport(opts) {
325
326
  }
326
327
 
327
328
  // src/version.ts
328
- var VERSION = "1.8.0";
329
+ var VERSION = "1.9.0";
329
330
  var USER_AGENT = `idapt-cli/${VERSION}`;
330
331
  function canOpenBrowser(env, isTty) {
331
332
  if (!isTty) return false;
@@ -1364,7 +1365,10 @@ var listCodeRunsRequestSchema = zod.z.object({
1364
1365
  var executeCodeRequestSchema = zod.z.object({
1365
1366
  file_id: zod.z.string(),
1366
1367
  timeout_seconds: zod.z.number().int().min(1).max(300).default(30),
1367
- env: zod.z.record(zod.z.string(), zod.z.string()).optional()
1368
+ env: zod.z.record(zod.z.string(), zod.z.string()).optional(),
1369
+ // Names of workspace secrets to inject as env vars (resolved server-side; the
1370
+ // values never appear in the response and are redacted from stdout/stderr).
1371
+ secrets: zod.z.array(zod.z.string()).max(50).optional()
1368
1372
  });
1369
1373
  var emptyCodeRequestSchema = zod.z.object({});
1370
1374
  var RUN_COLUMNS = [
@@ -1428,7 +1432,7 @@ var codeCommands = [
1428
1432
  async: true,
1429
1433
  tags: ["Code Runs"],
1430
1434
  summary: "Execute a code file (js/ts/py/sh) in a sandbox; returns the run.",
1431
- description: "Execute a code file (.js, .ts, .py, .sh) in a sandboxed Lambda environment. Returns stdout, stderr, exit code, and timing.",
1435
+ 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.",
1432
1436
  errors: [403, 404, 429],
1433
1437
  columns: RUN_COLUMNS
1434
1438
  }),
@@ -1515,11 +1519,6 @@ var computerEnvVarResponseSchema = zod.z.object({
1515
1519
  file_id: zod.z.string().nullish(),
1516
1520
  created_at: zod.z.string()
1517
1521
  }).meta({ id: "ComputerEnvVar" });
1518
- zod.z.object({
1519
- port: zod.z.number(),
1520
- protocol: zod.z.enum(["tcp", "udp"]),
1521
- source: zod.z.string().nullish()
1522
- }).meta({ id: "ComputerFirewallRule" });
1523
1522
  var computerPortResponseSchema = zod.z.object({
1524
1523
  port: zod.z.number(),
1525
1524
  protocol: zod.z.string(),
@@ -1609,16 +1608,6 @@ var envSyncResultSchema = zod.z.object({
1609
1608
  ),
1610
1609
  extra_on_disk: zod.z.array(zod.z.string())
1611
1610
  }).meta({ id: "EnvSyncResult" });
1612
- var firewallResultSchema = zod.z.object({
1613
- rules: zod.z.array(
1614
- zod.z.object({
1615
- port: zod.z.number(),
1616
- protocol: zod.z.string()
1617
- })
1618
- ),
1619
- query_status: zod.z.string(),
1620
- query_error: zod.z.string().nullish()
1621
- }).meta({ id: "FirewallResult" });
1622
1611
  var computerPortsResultSchema = zod.z.object({
1623
1612
  ports: zod.z.array(computerPortResponseSchema),
1624
1613
  discovery_status: zod.z.string(),
@@ -1660,7 +1649,11 @@ var updateComputerRequestSchema = zod.z.object({
1660
1649
  var computerExecRequestSchema = zod.z.object({
1661
1650
  command: zod.z.string().min(1).max(8192).describe("Shell command to run."),
1662
1651
  timeout_seconds: zod.z.number().int().min(1).max(900).optional(),
1663
- user: zod.z.string().regex(usernamePattern).optional().describe("Unix user to run the command as.")
1652
+ user: zod.z.string().regex(usernamePattern).optional().describe("Unix user to run the command as."),
1653
+ secrets: zod.z.array(zod.z.string()).max(50).optional().describe(
1654
+ "Names of workspace secrets to inject. Resolved server-side, mounted by the daemon, never returned, and redacted from output."
1655
+ ),
1656
+ secret_mount_mode: zod.z.enum(["env", "file"]).optional().describe("env (default) exports vars; file writes /run/idapt-secrets/.")
1664
1657
  });
1665
1658
  var computerTmuxRequestSchema = zod.z.object({
1666
1659
  op: zod.z.enum(["list", "run", "capture", "send", "kill"]).describe("Operation discriminator; the response shape depends on `op`."),
@@ -1715,14 +1708,6 @@ var createUserEnvVarRequestSchema = zod.z.union([
1715
1708
  )
1716
1709
  })
1717
1710
  ]);
1718
- var addFirewallRuleRequestSchema = zod.z.object({
1719
- port: zod.z.number().int().min(1).max(65535).describe("Port to open."),
1720
- protocol: zod.z.enum(["tcp", "udp"]).default("tcp")
1721
- });
1722
- var removeFirewallRuleRequestSchema = zod.z.object({
1723
- port: zod.z.coerce.number().int().describe("Port of the rule to remove."),
1724
- protocol: zod.z.enum(["tcp", "udp"]).optional()
1725
- });
1726
1711
  var patchComputerPortRequestSchema = zod.z.object({
1727
1712
  port: zod.z.number().int().min(1).max(65535),
1728
1713
  protocol: zod.z.string(),
@@ -2100,47 +2085,7 @@ var computerCommands = [
2100
2085
  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`.",
2101
2086
  errors: [403, 409, 500, 503]
2102
2087
  }),
2103
- // ---- firewall + ports ---------------------------------------------------
2104
- cmd({
2105
- resource: "computer",
2106
- verb: "firewall",
2107
- method: "GET",
2108
- path: "/computers/:id/firewall",
2109
- response: firewallResultSchema,
2110
- permission: P,
2111
- responseKind: "single",
2112
- tags: TAGS,
2113
- summary: "List firewall rules.",
2114
- description: "Query iptables rules (cloud computers only).",
2115
- errors: [403]
2116
- }),
2117
- cmd({
2118
- resource: "computer",
2119
- verb: "firewall-add",
2120
- method: "POST",
2121
- path: "/computers/:id/firewall",
2122
- request: addFirewallRuleRequestSchema,
2123
- response: firewallResultSchema,
2124
- permission: W,
2125
- responseKind: "single",
2126
- tags: TAGS,
2127
- summary: "Add a firewall rule.",
2128
- errors: [403, 409, 500]
2129
- }),
2130
- cmd({
2131
- resource: "computer",
2132
- verb: "firewall-remove",
2133
- method: "DELETE",
2134
- path: "/computers/:id/firewall",
2135
- argLocation: "query",
2136
- request: removeFirewallRuleRequestSchema,
2137
- response: firewallResultSchema,
2138
- permission: W,
2139
- responseKind: "single",
2140
- tags: TAGS,
2141
- summary: "Remove a firewall rule.",
2142
- errors: [403, 409, 500]
2143
- }),
2088
+ // ---- ports --------------------------------------------------------------
2144
2089
  cmd({
2145
2090
  resource: "computer",
2146
2091
  verb: "ports",
@@ -2591,25 +2536,6 @@ var computerCommands = [
2591
2536
  public: false,
2592
2537
  tags: TAGS,
2593
2538
  summary: "Close a computer's public tunnel for a port."
2594
- }),
2595
- // `firewall-edit` is the agent's add-OR-remove verb (it carries a
2596
- // `firewall_action` sub-action) — distinct from the discrete public
2597
- // `firewall-add` (POST) / `firewall-remove` (DELETE). agent-internal.
2598
- cmd({
2599
- resource: "computer",
2600
- verb: "firewall-edit",
2601
- method: "POST",
2602
- path: "/computers/:id/firewall-edit",
2603
- request: zod.z.object({
2604
- firewall_action: zod.z.enum(["add", "remove"]),
2605
- port: zod.z.coerce.number().int().min(1).max(65535),
2606
- protocol: zod.z.enum(["tcp", "udp"]).optional()
2607
- }),
2608
- permission: W,
2609
- responseKind: "single",
2610
- public: false,
2611
- tags: TAGS,
2612
- summary: "Add or remove a firewall rule (agent add-or-remove verb)."
2613
2539
  })
2614
2540
  ];
2615
2541
  var computerPlaybook = {
@@ -2617,14 +2543,14 @@ var computerPlaybook = {
2617
2543
  instructions: `Computers are remote machines. \`computer list\`/\`get\`; lifecycle via
2618
2544
  \`start\`/\`stop\`/\`hibernate\`/\`archive\`. Run commands with \`computer exec <id> --command \u2026\`
2619
2545
  (long-running \u2014 use --background). Transfer files with \`computer download <id> --path \u2026\`
2620
- and \`computer upload\`. Manage \`firewall\`/\`ports\`/\`users\` and Docker \`apps\`
2546
+ and \`computer upload\`. Manage \`ports\`/\`users\` and Docker \`apps\`
2621
2547
  (\`app-run\`, \`app-start\`/\`stop\`, \`app-logs\`, \`app-exec\`).
2622
2548
 
2623
2549
  A computer lives in ONE home workspace (full control). Share its LOCAL INFERENCE
2624
2550
  ONLY into other workspaces with \`computer link <id> --workspace-id <ws>\` (never
2625
2551
  shares shell / files / tunnels); \`computer links <id>\` lists the shares and
2626
- \`computer unlink <id> --workspace-id <ws>\` revokes one. Pair a new machine with
2627
- the \`idapt up\` / \`idapt pair\` daemon flow (defaults to your personal
2552
+ \`computer unlink <id> --workspace-id <ws>\` revokes one. Register a new machine with
2553
+ the \`idapt up\` daemon flow (defaults to your personal
2628
2554
  workspace).`
2629
2555
  };
2630
2556
  var listQuery = zod.z.object({
@@ -2646,7 +2572,6 @@ var agentResponseSchema = zod.z.object({
2646
2572
  workspace_id: zod.z.string().nullish(),
2647
2573
  type: zod.z.string().nullish(),
2648
2574
  permissions: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())).nullish(),
2649
- confirmation_required: zod.z.array(zod.z.string()).optional(),
2650
2575
  compaction_preset: zod.z.enum(["minimal", "normal", "detailed"]).nullish(),
2651
2576
  compaction_summary_percent: zod.z.number().nullish(),
2652
2577
  compaction_summary_max_tokens: zod.z.number().nullish(),
@@ -2654,6 +2579,8 @@ var agentResponseSchema = zod.z.object({
2654
2579
  compaction_preserved_max_tokens: zod.z.number().nullish(),
2655
2580
  compaction_msg_percent: zod.z.number().nullish(),
2656
2581
  compaction_msg_max_tokens: zod.z.number().nullish(),
2582
+ compaction_trigger_type: zod.z.enum(["percent", "tokens"]).nullish(),
2583
+ compaction_trigger_value: zod.z.number().nullish(),
2657
2584
  source_template_resource_id: zod.z.string().nullish(),
2658
2585
  memory_folder: zod.z.string().nullish(),
2659
2586
  default_model_id: zod.z.string().nullish(),
@@ -2964,7 +2891,9 @@ var agentCompactionFields = {
2964
2891
  compaction_preserved_percent: zod.z.number().min(0).max(100).nullish(),
2965
2892
  compaction_preserved_max_tokens: zod.z.number().min(0).max(5e5).nullish(),
2966
2893
  compaction_msg_percent: zod.z.number().min(0).max(100).nullish(),
2967
- compaction_msg_max_tokens: zod.z.number().min(0).max(5e5).nullish()
2894
+ compaction_msg_max_tokens: zod.z.number().min(0).max(5e5).nullish(),
2895
+ compaction_trigger_type: zod.z.enum(["percent", "tokens"]).nullish(),
2896
+ compaction_trigger_value: zod.z.number().int().min(0).nullish()
2968
2897
  };
2969
2898
  var createAgentRequestSchema = zod.z.object({
2970
2899
  name: zod.z.string().min(1).max(80),
@@ -2975,7 +2904,6 @@ var createAgentRequestSchema = zod.z.object({
2975
2904
  authorization: zod.z.record(zod.z.string(), zod.z.unknown()).nullish().describe(
2976
2905
  "Agent authorization policy. Null clears explicit policy; omitted uses the default workspace-write policy."
2977
2906
  ),
2978
- confirmation_required: zod.z.array(zod.z.string()).max(200).optional(),
2979
2907
  ...agentCompactionFields,
2980
2908
  type: zod.z.enum(["user", "generated"]).optional().describe("Agent type."),
2981
2909
  memory_folder: zod.z.string().max(500).nullish(),
@@ -2990,7 +2918,6 @@ var updateAgentRequestSchema = zod.z.object({
2990
2918
  description: zod.z.string().max(2e3).nullish(),
2991
2919
  system_prompt: zod.z.string().max(131072).nullish(),
2992
2920
  authorization: zod.z.record(zod.z.string(), zod.z.unknown()).nullish().describe("Agent authorization policy. Null clears explicit policy."),
2993
- confirmation_required: zod.z.array(zod.z.string()).max(200).optional(),
2994
2921
  ...agentCompactionFields,
2995
2922
  type: zod.z.enum(["user", "generated"]).optional(),
2996
2923
  memory_folder: zod.z.string().max(500).nullish(),
@@ -6098,6 +6025,10 @@ var secretResponseSchema = zod.z.object({
6098
6025
  type: zod.z.string().nullish(),
6099
6026
  /** Masked last-4 preview — never reconstructs the value. */
6100
6027
  value_preview: zod.z.string().nullish(),
6028
+ /** ISO-8601 expiry instant, or null. Past expiry blocks injection. */
6029
+ expires_at: zod.z.string().nullish(),
6030
+ /** ISO-8601 of the last reveal/inject, or null if never used. */
6031
+ last_used_at: zod.z.string().nullish(),
6101
6032
  created_at: zod.z.string(),
6102
6033
  updated_at: zod.z.string()
6103
6034
  }).meta({ id: "Secret" });
@@ -6120,11 +6051,14 @@ var createSecretRequestSchema = zod.z.object({
6120
6051
  "ssh_private_key",
6121
6052
  "ssh_public_key"
6122
6053
  ]).optional(),
6054
+ /** ISO-8601 expiry instant; null/omitted = never expires. */
6055
+ expires_at: zod.z.string().datetime({ offset: true }).nullish(),
6123
6056
  workspace_id: zod.z.string().max(64).optional()
6124
6057
  });
6125
6058
  var updateSecretRequestSchema = zod.z.object({
6126
6059
  value: zod.z.string().min(1).optional(),
6127
- description: zod.z.string().max(1e3).nullish()
6060
+ description: zod.z.string().max(1e3).nullish(),
6061
+ expires_at: zod.z.string().datetime({ offset: true }).nullish()
6128
6062
  });
6129
6063
  var secretsCommands = [
6130
6064
  cmd({
@@ -6228,11 +6162,20 @@ var secretsPlaybook = {
6228
6162
  " contents. Don't ask the user to paste a secret into the chat.",
6229
6163
  "",
6230
6164
  "- `create --name OPENAI_API_KEY --value <v>`: prefer ALL_CAPS names (they map",
6231
- " cleanly to env vars). Names are unique per workspace.",
6165
+ " cleanly to env vars). Optional `--expires-at <ISO-8601>`. Unique per workspace.",
6232
6166
  "- `update` ROTATES: the old value is destroyed immediately and anything using",
6233
6167
  " it breaks until re-pointed. There is no rename \u2014 create a new one.",
6234
6168
  "- `delete` is immediate and irreversible.",
6235
6169
  "",
6170
+ "Using a secret at run time (pass the NAME, never the value):",
6171
+ "- `code execute --secrets '[\"GITHUB_TOKEN\"]'` \u2192 the script sees it as the env",
6172
+ " var `GITHUB_TOKEN`; `bash --secrets [...]` and `computer exec --secrets [...]`",
6173
+ " work the same. The value is injected server-side and redacted from output.",
6174
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal ${secret:NAME} reference syntax, not a template placeholder
6175
+ "- Or embed `${secret:NAME}` inside a free-form `env` value (e.g.",
6176
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal example of the ${secret:NAME} syntax
6177
+ " `DATABASE_URL=postgres://app:${secret:DB_PASSWORD}@db`).",
6178
+ "",
6236
6179
  "Anti-patterns: never print, log, or repeat a secret value the user gives you \u2014",
6237
6180
  "create it and move on. Secrets live here, not as Drive files and not in chat."
6238
6181
  ].join("\n")
@@ -6414,9 +6357,12 @@ function argLines(spec) {
6414
6357
  }
6415
6358
  return lines;
6416
6359
  }
6417
- function renderHelp(spec) {
6360
+ function renderHelp(spec, options = {}) {
6418
6361
  const lines = [];
6419
- lines.push(`idapt ${spec.command} \u2014 ${spec.summary}`);
6362
+ const command = options.command ?? spec.command;
6363
+ const summary = options.summary ?? spec.summary;
6364
+ const resource = options.resource ?? spec.resource;
6365
+ lines.push(`idapt ${command} \u2014 ${summary}`);
6420
6366
  lines.push("");
6421
6367
  lines.push(` ${spec.method} /api/v1${spec.path}`);
6422
6368
  if (spec.async) lines.push(" (long-running \u2014 supports --background)");
@@ -6431,7 +6377,7 @@ function renderHelp(spec) {
6431
6377
  lines.push(spec.help);
6432
6378
  }
6433
6379
  lines.push("");
6434
- lines.push(`Playbook: idapt instructions ${spec.resource}`);
6380
+ lines.push(`Playbook: idapt instructions ${resource}`);
6435
6381
  return lines.join("\n");
6436
6382
  }
6437
6383
  function renderInstructions(resource) {
@@ -6670,6 +6616,8 @@ var VERB_OVERRIDES = {
6670
6616
  "trigger read": "trigger get",
6671
6617
  "trigger edit": "trigger update",
6672
6618
  "trigger fire": "trigger test-fire",
6619
+ // secrets — `edit` is the natural verb; the contract op is `update` (rotate).
6620
+ "secret edit": "secret update",
6673
6621
  // utility → catalog
6674
6622
  "utility search-llm-models": "models search",
6675
6623
  "utility search-image-models": "image search",
@@ -6700,9 +6648,6 @@ var VERB_OVERRIDES = {
6700
6648
  "computer file-download": "computer download",
6701
6649
  "computer upload-dir": "computer upload",
6702
6650
  "computer download-dir": "computer download",
6703
- "computer firewall-view": "computer firewall",
6704
- // NB: `firewall-edit` is identity (its own add-or-remove route) — it must NOT
6705
- // map to `firewall-add`, or `--firewall-action remove` would silently ADD.
6706
6651
  "computer user-list": "computer users",
6707
6652
  "computer user-create": "computer create-user",
6708
6653
  "computer user-delete": "computer delete-user",