@idapt/cli 1.8.0 → 1.8.1

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-ZCMZH43X.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.8.1";
12
12
  var USER_AGENT = `idapt-cli/${VERSION}`;
13
13
  function canOpenBrowser(env, isTty) {
14
14
  if (!isTty) return false;
@@ -685,11 +685,6 @@ var computerEnvVarResponseSchema = z.object({
685
685
  file_id: z.string().nullish(),
686
686
  created_at: z.string()
687
687
  }).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
688
  var computerPortResponseSchema = z.object({
694
689
  port: z.number(),
695
690
  protocol: z.string(),
@@ -779,16 +774,6 @@ var envSyncResultSchema = z.object({
779
774
  ),
780
775
  extra_on_disk: z.array(z.string())
781
776
  }).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
777
  var computerPortsResultSchema = z.object({
793
778
  ports: z.array(computerPortResponseSchema),
794
779
  discovery_status: z.string(),
@@ -885,14 +870,6 @@ var createUserEnvVarRequestSchema = z.union([
885
870
  )
886
871
  })
887
872
  ]);
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
873
  var patchComputerPortRequestSchema = z.object({
897
874
  port: z.number().int().min(1).max(65535),
898
875
  protocol: z.string(),
@@ -1270,47 +1247,7 @@ var computerCommands = [
1270
1247
  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
1248
  errors: [403, 409, 500, 503]
1272
1249
  }),
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
- }),
1250
+ // ---- ports --------------------------------------------------------------
1314
1251
  cmd({
1315
1252
  resource: "computer",
1316
1253
  verb: "ports",
@@ -1761,25 +1698,6 @@ var computerCommands = [
1761
1698
  public: false,
1762
1699
  tags: TAGS,
1763
1700
  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
1701
  })
1784
1702
  ];
1785
1703
  var computerPlaybook = {
@@ -1787,14 +1705,14 @@ var computerPlaybook = {
1787
1705
  instructions: `Computers are remote machines. \`computer list\`/\`get\`; lifecycle via
1788
1706
  \`start\`/\`stop\`/\`hibernate\`/\`archive\`. Run commands with \`computer exec <id> --command \u2026\`
1789
1707
  (long-running \u2014 use --background). Transfer files with \`computer download <id> --path \u2026\`
1790
- and \`computer upload\`. Manage \`firewall\`/\`ports\`/\`users\` and Docker \`apps\`
1708
+ and \`computer upload\`. Manage \`ports\`/\`users\` and Docker \`apps\`
1791
1709
  (\`app-run\`, \`app-start\`/\`stop\`, \`app-logs\`, \`app-exec\`).
1792
1710
 
1793
1711
  A computer lives in ONE home workspace (full control). Share its LOCAL INFERENCE
1794
1712
  ONLY into other workspaces with \`computer link <id> --workspace-id <ws>\` (never
1795
1713
  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
1714
+ \`computer unlink <id> --workspace-id <ws>\` revokes one. Register a new machine with
1715
+ the \`idapt up\` daemon flow (defaults to your personal
1798
1716
  workspace).`
1799
1717
  };
1800
1718
  var listQuery = z.object({
@@ -1824,6 +1742,8 @@ var agentResponseSchema = z.object({
1824
1742
  compaction_preserved_max_tokens: z.number().nullish(),
1825
1743
  compaction_msg_percent: z.number().nullish(),
1826
1744
  compaction_msg_max_tokens: z.number().nullish(),
1745
+ compaction_trigger_type: z.enum(["percent", "tokens"]).nullish(),
1746
+ compaction_trigger_value: z.number().nullish(),
1827
1747
  source_template_resource_id: z.string().nullish(),
1828
1748
  memory_folder: z.string().nullish(),
1829
1749
  default_model_id: z.string().nullish(),
@@ -2134,7 +2054,9 @@ var agentCompactionFields = {
2134
2054
  compaction_preserved_percent: z.number().min(0).max(100).nullish(),
2135
2055
  compaction_preserved_max_tokens: z.number().min(0).max(5e5).nullish(),
2136
2056
  compaction_msg_percent: z.number().min(0).max(100).nullish(),
2137
- compaction_msg_max_tokens: z.number().min(0).max(5e5).nullish()
2057
+ compaction_msg_max_tokens: z.number().min(0).max(5e5).nullish(),
2058
+ compaction_trigger_type: z.enum(["percent", "tokens"]).nullish(),
2059
+ compaction_trigger_value: z.number().int().min(0).nullish()
2138
2060
  };
2139
2061
  var createAgentRequestSchema = z.object({
2140
2062
  name: z.string().min(1).max(80),
@@ -5660,9 +5582,12 @@ function argLines(spec) {
5660
5582
  }
5661
5583
  return lines;
5662
5584
  }
5663
- function renderHelp(spec) {
5585
+ function renderHelp(spec, options = {}) {
5664
5586
  const lines = [];
5665
- lines.push(`idapt ${spec.command} \u2014 ${spec.summary}`);
5587
+ const command = options.command ?? spec.command;
5588
+ const summary = options.summary ?? spec.summary;
5589
+ const resource = options.resource ?? spec.resource;
5590
+ lines.push(`idapt ${command} \u2014 ${summary}`);
5666
5591
  lines.push("");
5667
5592
  lines.push(` ${spec.method} /api/v1${spec.path}`);
5668
5593
  if (spec.async) lines.push(" (long-running \u2014 supports --background)");
@@ -5677,7 +5602,7 @@ function renderHelp(spec) {
5677
5602
  lines.push(spec.help);
5678
5603
  }
5679
5604
  lines.push("");
5680
- lines.push(`Playbook: idapt instructions ${spec.resource}`);
5605
+ lines.push(`Playbook: idapt instructions ${resource}`);
5681
5606
  return lines.join("\n");
5682
5607
  }
5683
5608
  function renderInstructions(resource) {
@@ -6068,9 +5993,6 @@ var VERB_OVERRIDES = {
6068
5993
  "computer file-download": "computer download",
6069
5994
  "computer upload-dir": "computer upload",
6070
5995
  "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
5996
  "computer user-list": "computer users",
6075
5997
  "computer user-create": "computer create-user",
6076
5998
  "computer user-delete": "computer delete-user",
@@ -6482,5 +6404,5 @@ function createFetchTransport(opts) {
6482
6404
  }
6483
6405
 
6484
6406
  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
6407
+ //# sourceMappingURL=chunk-ZCMZH43X.js.map
6408
+ //# sourceMappingURL=chunk-ZCMZH43X.js.map