@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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createFetchTransport, execute, autoMode, commandsForResource, findCommand, renderHelp, listResources, renderInstructions, quoteToken } from './chunk-WNQCFPPN.js';
2
+ import { createFetchTransport, execute, autoMode, commandsForResource, findCommand, renderHelp, listResources, renderInstructions, quoteToken } from './chunk-TYSHO65D.js';
3
3
  import { readFileSync, mkdirSync, writeFileSync, chmodSync, rmSync } from 'fs';
4
4
  import { spawn } from 'child_process';
5
5
  import { dirname, join } from 'path';
@@ -8,7 +8,7 @@ import { createServer } from 'http';
8
8
  import { randomBytes, createHash } from 'crypto';
9
9
 
10
10
  // src/version.ts
11
- var VERSION = "1.8.0";
11
+ var VERSION = "1.9.0";
12
12
  var USER_AGENT = `idapt-cli/${VERSION}`;
13
13
  function canOpenBrowser(env, isTty) {
14
14
  if (!isTty) return false;
@@ -534,7 +534,10 @@ var listCodeRunsRequestSchema = z.object({
534
534
  var executeCodeRequestSchema = z.object({
535
535
  file_id: z.string(),
536
536
  timeout_seconds: z.number().int().min(1).max(300).default(30),
537
- env: z.record(z.string(), z.string()).optional()
537
+ env: z.record(z.string(), z.string()).optional(),
538
+ // Names of workspace secrets to inject as env vars (resolved server-side; the
539
+ // values never appear in the response and are redacted from stdout/stderr).
540
+ secrets: z.array(z.string()).max(50).optional()
538
541
  });
539
542
  var emptyCodeRequestSchema = z.object({});
540
543
  var RUN_COLUMNS = [
@@ -598,7 +601,7 @@ var codeCommands = [
598
601
  async: true,
599
602
  tags: ["Code Runs"],
600
603
  summary: "Execute a code file (js/ts/py/sh) in a sandbox; returns the run.",
601
- description: "Execute a code file (.js, .ts, .py, .sh) in a sandboxed Lambda environment. Returns stdout, stderr, exit code, and timing.",
604
+ 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.",
602
605
  errors: [403, 404, 429],
603
606
  columns: RUN_COLUMNS
604
607
  }),
@@ -685,11 +688,6 @@ var computerEnvVarResponseSchema = z.object({
685
688
  file_id: z.string().nullish(),
686
689
  created_at: z.string()
687
690
  }).meta({ id: "ComputerEnvVar" });
688
- z.object({
689
- port: z.number(),
690
- protocol: z.enum(["tcp", "udp"]),
691
- source: z.string().nullish()
692
- }).meta({ id: "ComputerFirewallRule" });
693
691
  var computerPortResponseSchema = z.object({
694
692
  port: z.number(),
695
693
  protocol: z.string(),
@@ -779,16 +777,6 @@ var envSyncResultSchema = z.object({
779
777
  ),
780
778
  extra_on_disk: z.array(z.string())
781
779
  }).meta({ id: "EnvSyncResult" });
782
- var firewallResultSchema = z.object({
783
- rules: z.array(
784
- z.object({
785
- port: z.number(),
786
- protocol: z.string()
787
- })
788
- ),
789
- query_status: z.string(),
790
- query_error: z.string().nullish()
791
- }).meta({ id: "FirewallResult" });
792
780
  var computerPortsResultSchema = z.object({
793
781
  ports: z.array(computerPortResponseSchema),
794
782
  discovery_status: z.string(),
@@ -830,7 +818,11 @@ var updateComputerRequestSchema = z.object({
830
818
  var computerExecRequestSchema = z.object({
831
819
  command: z.string().min(1).max(8192).describe("Shell command to run."),
832
820
  timeout_seconds: z.number().int().min(1).max(900).optional(),
833
- user: z.string().regex(usernamePattern).optional().describe("Unix user to run the command as.")
821
+ user: z.string().regex(usernamePattern).optional().describe("Unix user to run the command as."),
822
+ secrets: z.array(z.string()).max(50).optional().describe(
823
+ "Names of workspace secrets to inject. Resolved server-side, mounted by the daemon, never returned, and redacted from output."
824
+ ),
825
+ secret_mount_mode: z.enum(["env", "file"]).optional().describe("env (default) exports vars; file writes /run/idapt-secrets/.")
834
826
  });
835
827
  var computerTmuxRequestSchema = z.object({
836
828
  op: z.enum(["list", "run", "capture", "send", "kill"]).describe("Operation discriminator; the response shape depends on `op`."),
@@ -885,14 +877,6 @@ var createUserEnvVarRequestSchema = z.union([
885
877
  )
886
878
  })
887
879
  ]);
888
- var addFirewallRuleRequestSchema = z.object({
889
- port: z.number().int().min(1).max(65535).describe("Port to open."),
890
- protocol: z.enum(["tcp", "udp"]).default("tcp")
891
- });
892
- var removeFirewallRuleRequestSchema = z.object({
893
- port: z.coerce.number().int().describe("Port of the rule to remove."),
894
- protocol: z.enum(["tcp", "udp"]).optional()
895
- });
896
880
  var patchComputerPortRequestSchema = z.object({
897
881
  port: z.number().int().min(1).max(65535),
898
882
  protocol: z.string(),
@@ -1270,47 +1254,7 @@ var computerCommands = [
1270
1254
  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`.",
1271
1255
  errors: [403, 409, 500, 503]
1272
1256
  }),
1273
- // ---- firewall + ports ---------------------------------------------------
1274
- cmd({
1275
- resource: "computer",
1276
- verb: "firewall",
1277
- method: "GET",
1278
- path: "/computers/:id/firewall",
1279
- response: firewallResultSchema,
1280
- permission: P,
1281
- responseKind: "single",
1282
- tags: TAGS,
1283
- summary: "List firewall rules.",
1284
- description: "Query iptables rules (cloud computers only).",
1285
- errors: [403]
1286
- }),
1287
- cmd({
1288
- resource: "computer",
1289
- verb: "firewall-add",
1290
- method: "POST",
1291
- path: "/computers/:id/firewall",
1292
- request: addFirewallRuleRequestSchema,
1293
- response: firewallResultSchema,
1294
- permission: W,
1295
- responseKind: "single",
1296
- tags: TAGS,
1297
- summary: "Add a firewall rule.",
1298
- errors: [403, 409, 500]
1299
- }),
1300
- cmd({
1301
- resource: "computer",
1302
- verb: "firewall-remove",
1303
- method: "DELETE",
1304
- path: "/computers/:id/firewall",
1305
- argLocation: "query",
1306
- request: removeFirewallRuleRequestSchema,
1307
- response: firewallResultSchema,
1308
- permission: W,
1309
- responseKind: "single",
1310
- tags: TAGS,
1311
- summary: "Remove a firewall rule.",
1312
- errors: [403, 409, 500]
1313
- }),
1257
+ // ---- ports --------------------------------------------------------------
1314
1258
  cmd({
1315
1259
  resource: "computer",
1316
1260
  verb: "ports",
@@ -1761,25 +1705,6 @@ var computerCommands = [
1761
1705
  public: false,
1762
1706
  tags: TAGS,
1763
1707
  summary: "Close a computer's public tunnel for a port."
1764
- }),
1765
- // `firewall-edit` is the agent's add-OR-remove verb (it carries a
1766
- // `firewall_action` sub-action) — distinct from the discrete public
1767
- // `firewall-add` (POST) / `firewall-remove` (DELETE). agent-internal.
1768
- cmd({
1769
- resource: "computer",
1770
- verb: "firewall-edit",
1771
- method: "POST",
1772
- path: "/computers/:id/firewall-edit",
1773
- request: z.object({
1774
- firewall_action: z.enum(["add", "remove"]),
1775
- port: z.coerce.number().int().min(1).max(65535),
1776
- protocol: z.enum(["tcp", "udp"]).optional()
1777
- }),
1778
- permission: W,
1779
- responseKind: "single",
1780
- public: false,
1781
- tags: TAGS,
1782
- summary: "Add or remove a firewall rule (agent add-or-remove verb)."
1783
1708
  })
1784
1709
  ];
1785
1710
  var computerPlaybook = {
@@ -1787,14 +1712,14 @@ var computerPlaybook = {
1787
1712
  instructions: `Computers are remote machines. \`computer list\`/\`get\`; lifecycle via
1788
1713
  \`start\`/\`stop\`/\`hibernate\`/\`archive\`. Run commands with \`computer exec <id> --command \u2026\`
1789
1714
  (long-running \u2014 use --background). Transfer files with \`computer download <id> --path \u2026\`
1790
- and \`computer upload\`. Manage \`firewall\`/\`ports\`/\`users\` and Docker \`apps\`
1715
+ and \`computer upload\`. Manage \`ports\`/\`users\` and Docker \`apps\`
1791
1716
  (\`app-run\`, \`app-start\`/\`stop\`, \`app-logs\`, \`app-exec\`).
1792
1717
 
1793
1718
  A computer lives in ONE home workspace (full control). Share its LOCAL INFERENCE
1794
1719
  ONLY into other workspaces with \`computer link <id> --workspace-id <ws>\` (never
1795
1720
  shares shell / files / tunnels); \`computer links <id>\` lists the shares and
1796
- \`computer unlink <id> --workspace-id <ws>\` revokes one. Pair a new machine with
1797
- the \`idapt up\` / \`idapt pair\` daemon flow (defaults to your personal
1721
+ \`computer unlink <id> --workspace-id <ws>\` revokes one. Register a new machine with
1722
+ the \`idapt up\` daemon flow (defaults to your personal
1798
1723
  workspace).`
1799
1724
  };
1800
1725
  var listQuery = z.object({
@@ -1816,7 +1741,6 @@ var agentResponseSchema = z.object({
1816
1741
  workspace_id: z.string().nullish(),
1817
1742
  type: z.string().nullish(),
1818
1743
  permissions: z.array(z.record(z.string(), z.unknown())).nullish(),
1819
- confirmation_required: z.array(z.string()).optional(),
1820
1744
  compaction_preset: z.enum(["minimal", "normal", "detailed"]).nullish(),
1821
1745
  compaction_summary_percent: z.number().nullish(),
1822
1746
  compaction_summary_max_tokens: z.number().nullish(),
@@ -1824,6 +1748,8 @@ var agentResponseSchema = z.object({
1824
1748
  compaction_preserved_max_tokens: z.number().nullish(),
1825
1749
  compaction_msg_percent: z.number().nullish(),
1826
1750
  compaction_msg_max_tokens: z.number().nullish(),
1751
+ compaction_trigger_type: z.enum(["percent", "tokens"]).nullish(),
1752
+ compaction_trigger_value: z.number().nullish(),
1827
1753
  source_template_resource_id: z.string().nullish(),
1828
1754
  memory_folder: z.string().nullish(),
1829
1755
  default_model_id: z.string().nullish(),
@@ -2134,7 +2060,9 @@ var agentCompactionFields = {
2134
2060
  compaction_preserved_percent: z.number().min(0).max(100).nullish(),
2135
2061
  compaction_preserved_max_tokens: z.number().min(0).max(5e5).nullish(),
2136
2062
  compaction_msg_percent: z.number().min(0).max(100).nullish(),
2137
- compaction_msg_max_tokens: z.number().min(0).max(5e5).nullish()
2063
+ compaction_msg_max_tokens: z.number().min(0).max(5e5).nullish(),
2064
+ compaction_trigger_type: z.enum(["percent", "tokens"]).nullish(),
2065
+ compaction_trigger_value: z.number().int().min(0).nullish()
2138
2066
  };
2139
2067
  var createAgentRequestSchema = z.object({
2140
2068
  name: z.string().min(1).max(80),
@@ -2145,7 +2073,6 @@ var createAgentRequestSchema = z.object({
2145
2073
  authorization: z.record(z.string(), z.unknown()).nullish().describe(
2146
2074
  "Agent authorization policy. Null clears explicit policy; omitted uses the default workspace-write policy."
2147
2075
  ),
2148
- confirmation_required: z.array(z.string()).max(200).optional(),
2149
2076
  ...agentCompactionFields,
2150
2077
  type: z.enum(["user", "generated"]).optional().describe("Agent type."),
2151
2078
  memory_folder: z.string().max(500).nullish(),
@@ -2160,7 +2087,6 @@ var updateAgentRequestSchema = z.object({
2160
2087
  description: z.string().max(2e3).nullish(),
2161
2088
  system_prompt: z.string().max(131072).nullish(),
2162
2089
  authorization: z.record(z.string(), z.unknown()).nullish().describe("Agent authorization policy. Null clears explicit policy."),
2163
- confirmation_required: z.array(z.string()).max(200).optional(),
2164
2090
  ...agentCompactionFields,
2165
2091
  type: z.enum(["user", "generated"]).optional(),
2166
2092
  memory_folder: z.string().max(500).nullish(),
@@ -5268,6 +5194,10 @@ var secretResponseSchema = z.object({
5268
5194
  type: z.string().nullish(),
5269
5195
  /** Masked last-4 preview — never reconstructs the value. */
5270
5196
  value_preview: z.string().nullish(),
5197
+ /** ISO-8601 expiry instant, or null. Past expiry blocks injection. */
5198
+ expires_at: z.string().nullish(),
5199
+ /** ISO-8601 of the last reveal/inject, or null if never used. */
5200
+ last_used_at: z.string().nullish(),
5271
5201
  created_at: z.string(),
5272
5202
  updated_at: z.string()
5273
5203
  }).meta({ id: "Secret" });
@@ -5290,11 +5220,14 @@ var createSecretRequestSchema = z.object({
5290
5220
  "ssh_private_key",
5291
5221
  "ssh_public_key"
5292
5222
  ]).optional(),
5223
+ /** ISO-8601 expiry instant; null/omitted = never expires. */
5224
+ expires_at: z.string().datetime({ offset: true }).nullish(),
5293
5225
  workspace_id: z.string().max(64).optional()
5294
5226
  });
5295
5227
  var updateSecretRequestSchema = z.object({
5296
5228
  value: z.string().min(1).optional(),
5297
- description: z.string().max(1e3).nullish()
5229
+ description: z.string().max(1e3).nullish(),
5230
+ expires_at: z.string().datetime({ offset: true }).nullish()
5298
5231
  });
5299
5232
  var secretsCommands = [
5300
5233
  cmd({
@@ -5398,11 +5331,20 @@ var secretsPlaybook = {
5398
5331
  " contents. Don't ask the user to paste a secret into the chat.",
5399
5332
  "",
5400
5333
  "- `create --name OPENAI_API_KEY --value <v>`: prefer ALL_CAPS names (they map",
5401
- " cleanly to env vars). Names are unique per workspace.",
5334
+ " cleanly to env vars). Optional `--expires-at <ISO-8601>`. Unique per workspace.",
5402
5335
  "- `update` ROTATES: the old value is destroyed immediately and anything using",
5403
5336
  " it breaks until re-pointed. There is no rename \u2014 create a new one.",
5404
5337
  "- `delete` is immediate and irreversible.",
5405
5338
  "",
5339
+ "Using a secret at run time (pass the NAME, never the value):",
5340
+ "- `code execute --secrets '[\"GITHUB_TOKEN\"]'` \u2192 the script sees it as the env",
5341
+ " var `GITHUB_TOKEN`; `bash --secrets [...]` and `computer exec --secrets [...]`",
5342
+ " work the same. The value is injected server-side and redacted from output.",
5343
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal ${secret:NAME} reference syntax, not a template placeholder
5344
+ "- Or embed `${secret:NAME}` inside a free-form `env` value (e.g.",
5345
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal example of the ${secret:NAME} syntax
5346
+ " `DATABASE_URL=postgres://app:${secret:DB_PASSWORD}@db`).",
5347
+ "",
5406
5348
  "Anti-patterns: never print, log, or repeat a secret value the user gives you \u2014",
5407
5349
  "create it and move on. Secrets live here, not as Drive files and not in chat."
5408
5350
  ].join("\n")
@@ -5660,9 +5602,12 @@ function argLines(spec) {
5660
5602
  }
5661
5603
  return lines;
5662
5604
  }
5663
- function renderHelp(spec) {
5605
+ function renderHelp(spec, options = {}) {
5664
5606
  const lines = [];
5665
- lines.push(`idapt ${spec.command} \u2014 ${spec.summary}`);
5607
+ const command = options.command ?? spec.command;
5608
+ const summary = options.summary ?? spec.summary;
5609
+ const resource = options.resource ?? spec.resource;
5610
+ lines.push(`idapt ${command} \u2014 ${summary}`);
5666
5611
  lines.push("");
5667
5612
  lines.push(` ${spec.method} /api/v1${spec.path}`);
5668
5613
  if (spec.async) lines.push(" (long-running \u2014 supports --background)");
@@ -5677,7 +5622,7 @@ function renderHelp(spec) {
5677
5622
  lines.push(spec.help);
5678
5623
  }
5679
5624
  lines.push("");
5680
- lines.push(`Playbook: idapt instructions ${spec.resource}`);
5625
+ lines.push(`Playbook: idapt instructions ${resource}`);
5681
5626
  return lines.join("\n");
5682
5627
  }
5683
5628
  function renderInstructions(resource) {
@@ -5756,6 +5701,7 @@ function parseIdaptCommand(cmd2) {
5756
5701
  args: parsedFlags.args,
5757
5702
  timeoutSeconds,
5758
5703
  background: parsedFlags.args.background === true,
5704
+ requiresConfirmation: parsedFlags.args.requiresConfirmation === true || parsedFlags.args["requires-confirmation"] === true || parsedFlags.args.requires_confirmation === true,
5759
5705
  help: parsedFlags.args.help === true,
5760
5706
  instructions: parsedFlags.args.instructions === true
5761
5707
  }
@@ -6038,6 +5984,8 @@ var VERB_OVERRIDES = {
6038
5984
  "trigger read": "trigger get",
6039
5985
  "trigger edit": "trigger update",
6040
5986
  "trigger fire": "trigger test-fire",
5987
+ // secrets — `edit` is the natural verb; the contract op is `update` (rotate).
5988
+ "secret edit": "secret update",
6041
5989
  // utility → catalog
6042
5990
  "utility search-llm-models": "models search",
6043
5991
  "utility search-image-models": "image search",
@@ -6068,9 +6016,6 @@ var VERB_OVERRIDES = {
6068
6016
  "computer file-download": "computer download",
6069
6017
  "computer upload-dir": "computer upload",
6070
6018
  "computer download-dir": "computer download",
6071
- "computer firewall-view": "computer firewall",
6072
- // NB: `firewall-edit` is identity (its own add-or-remove route) — it must NOT
6073
- // map to `firewall-add`, or `--firewall-action remove` would silently ADD.
6074
6019
  "computer user-list": "computer users",
6075
6020
  "computer user-create": "computer create-user",
6076
6021
  "computer user-delete": "computer delete-user",
@@ -6482,5 +6427,5 @@ function createFetchTransport(opts) {
6482
6427
  }
6483
6428
 
6484
6429
  export { VERB_OVERRIDES, autoMode, commandsForResource, createFetchTransport, execute, executeCommand, findCommand, getResourcePlaybook, listCommands, listResources, mapArgsToV1, parseInvocation, quoteToken, reconcileToV1, render, renderHelp, renderInstructions, resolveCommand, toSnakeKey };
6485
- //# sourceMappingURL=chunk-WNQCFPPN.js.map
6486
- //# sourceMappingURL=chunk-WNQCFPPN.js.map
6430
+ //# sourceMappingURL=chunk-TYSHO65D.js.map
6431
+ //# sourceMappingURL=chunk-TYSHO65D.js.map