@general-input/cli 0.23.0 → 0.24.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/cli.js CHANGED
@@ -18149,6 +18149,19 @@ import { Command as Command4 } from "commander";
18149
18149
  // src/commands/sharing.ts
18150
18150
  import { InvalidArgumentError, Option } from "commander";
18151
18151
 
18152
+ // ../../packages/api/dist/types/workspaceBrand.js
18153
+ var DEFAULT_BRAND_SCENE_ID = "horizon";
18154
+ var BRAND_ASSET_RULES = {
18155
+ wordmark: {
18156
+ contentTypes: ["image/svg+xml", "image/png", "image/webp", "image/jpeg"],
18157
+ maxBytes: 1024 * 1024
18158
+ },
18159
+ background: {
18160
+ contentTypes: ["image/jpeg", "image/png", "image/webp"],
18161
+ maxBytes: 5 * 1024 * 1024
18162
+ }
18163
+ };
18164
+
18152
18165
  // ../../packages/api/dist/types/user.js
18153
18166
  import { z } from "zod";
18154
18167
  var UserRoleSchema = z.enum([
@@ -18167,6 +18180,23 @@ function parseRoles(raw) {
18167
18180
  return parsed.length > 0 ? parsed : ["Member"];
18168
18181
  }
18169
18182
 
18183
+ // ../../packages/api/dist/types/clientIdentity.js
18184
+ var CLIENT_IDENTITY_HEADER = "X-GI-Client";
18185
+ var CLIENT_VERSION_PATTERN = /^[0-9A-Za-z.+-]{1,32}$/;
18186
+ function readClientVersion(value) {
18187
+ return value && CLIENT_VERSION_PATTERN.test(value) ? value : null;
18188
+ }
18189
+ function formatClientIdentityHeader(identity) {
18190
+ const version = readClientVersion(identity.version);
18191
+ const build = readClientVersion(identity.build);
18192
+ return [
18193
+ identity.kind,
18194
+ ...version ? [`version=${version}`] : [],
18195
+ ...build ? [`build=${build}`] : [],
18196
+ ...identity.isInBackground ? ["state=background"] : []
18197
+ ].join("; ");
18198
+ }
18199
+
18170
18200
  // ../../packages/api/dist/types/workflowTypeTraits.js
18171
18201
  var WORKFLOW_TYPE_KINDS = ["workflow", "app", "design"];
18172
18202
  var WORKFLOW_TYPE_COLLECTIONS = [
@@ -18524,6 +18554,20 @@ var CLIENT_KNOWN_TYPE_ROWS = {
18524
18554
  known: ["app", "design", "skill", "specialist", "workflow"]
18525
18555
  }
18526
18556
  ],
18557
+ "SharedResourceLeaveApiClient.previewDeclineShareNotice": [
18558
+ {
18559
+ rows: ["dependents", "*"],
18560
+ field: ["workflowType"],
18561
+ known: ["agent", "app", "code", "design"]
18562
+ }
18563
+ ],
18564
+ "SharedResourceLeaveApiClient.previewLeave": [
18565
+ {
18566
+ rows: ["dependents", "*"],
18567
+ field: ["workflowType"],
18568
+ known: ["agent", "app", "code", "design"]
18569
+ }
18570
+ ],
18527
18571
  "SpecialistTemplatesApiClient.getDetail": [
18528
18572
  {
18529
18573
  rows: ["page", "plannedResources", "*"],
@@ -19683,7 +19727,10 @@ var ORG_PERMISSIONS = [
19683
19727
  id: OrgPermission.BILLING_MANAGE_SUBSCRIPTION,
19684
19728
  label: "Manage subscription and seats"
19685
19729
  },
19686
- { id: OrgPermission.ORG_UPDATE_NAME, label: "Update organization name" },
19730
+ {
19731
+ id: OrgPermission.ORG_UPDATE_NAME,
19732
+ label: "Update workspace name and branding"
19733
+ },
19687
19734
  { id: OrgPermission.ORG_UPDATE_AUTOFILL, label: "Update autofill settings" },
19688
19735
  { id: OrgPermission.ORG_DELETE, label: "Delete workspace" },
19689
19736
  { id: OrgPermission.MEMBERS_LIST_INVITES, label: "View pending invites" },
@@ -19829,15 +19876,58 @@ var WORKSPACE_MODEL_MANAGER_RULES = {
19829
19876
  workspace: {
19830
19877
  managePermission: OrgPermission.ORG_MANAGE_MODELS,
19831
19878
  canEveryMemberSeeSettings: true,
19832
- subscriptionSource: "members"
19879
+ subscriptionSharers: "members",
19880
+ subscriptionAsk: "asks"
19833
19881
  },
19834
19882
  "instance-operators": {
19835
19883
  managePermission: OrgPermission.INSTANCE_OPERATE,
19836
19884
  canEveryMemberSeeSettings: false,
19837
- subscriptionSource: "shared-by-instance-operators"
19885
+ subscriptionSharers: "instance-operators",
19886
+ subscriptionAsk: "on-request"
19838
19887
  }
19839
19888
  };
19840
19889
 
19890
+ // ../../packages/utils/dist/privateNetwork.js
19891
+ function ipv4Range(dotted, prefix, scope) {
19892
+ return { base: ipv4Value(dotted) ?? 0, prefix, scope };
19893
+ }
19894
+ var NON_PUBLIC_IPV4_RANGES = [
19895
+ ipv4Range("0.0.0.0", 8, "reserved"),
19896
+ ipv4Range("10.0.0.0", 8, "private"),
19897
+ ipv4Range("100.64.0.0", 10, "private"),
19898
+ // CGNAT
19899
+ ipv4Range("127.0.0.0", 8, "private"),
19900
+ ipv4Range("169.254.0.0", 16, "reserved"),
19901
+ // link-local, cloud metadata
19902
+ ipv4Range("172.16.0.0", 12, "private"),
19903
+ ipv4Range("192.0.0.0", 24, "reserved"),
19904
+ ipv4Range("192.0.2.0", 24, "reserved"),
19905
+ ipv4Range("192.88.99.0", 24, "reserved"),
19906
+ ipv4Range("192.168.0.0", 16, "private"),
19907
+ ipv4Range("198.18.0.0", 15, "private"),
19908
+ ipv4Range("198.51.100.0", 24, "reserved"),
19909
+ ipv4Range("203.0.113.0", 24, "reserved"),
19910
+ ipv4Range("224.0.0.0", 4, "reserved"),
19911
+ // multicast
19912
+ ipv4Range("240.0.0.0", 4, "reserved")
19913
+ // reserved, broadcast
19914
+ ];
19915
+ function ipv4Value(address) {
19916
+ const octets = address.split(".");
19917
+ if (octets.length !== 4)
19918
+ return null;
19919
+ let value = 0;
19920
+ for (const octet of octets) {
19921
+ if (!/^\d{1,3}$/.test(octet))
19922
+ return null;
19923
+ const number = Number(octet);
19924
+ if (number > 255)
19925
+ return null;
19926
+ value = value * 256 + number;
19927
+ }
19928
+ return value;
19929
+ }
19930
+
19841
19931
  // ../../packages/utils/dist/workerAccessories.js
19842
19932
  var WORKER_ACCESSORY_CATALOG = {
19843
19933
  head: {
@@ -20295,6 +20385,41 @@ function fillLegacySpecialistConversationSnoozes(value) {
20295
20385
  }
20296
20386
  }
20297
20387
 
20388
+ // ../../packages/api/dist/types/legacyWorkspaceBrand.js
20389
+ var WORKSPACE_BY_HOST_KEYS = [
20390
+ "organizationId",
20391
+ "slug",
20392
+ "name",
20393
+ "profilePictureUrl"
20394
+ ];
20395
+ function fillLegacyWorkspaceBrand(value) {
20396
+ if ("brand" in value)
20397
+ return;
20398
+ if (!WORKSPACE_BY_HOST_KEYS.every((key) => key in value))
20399
+ return;
20400
+ if (Object.keys(value).length !== WORKSPACE_BY_HOST_KEYS.length)
20401
+ return;
20402
+ const name = Reflect.get(value, "name");
20403
+ const profilePictureUrl = Reflect.get(value, "profilePictureUrl");
20404
+ if (typeof name !== "string")
20405
+ return;
20406
+ Reflect.set(value, "brand", {
20407
+ productName: name,
20408
+ tagline: null,
20409
+ sceneId: DEFAULT_BRAND_SCENE_ID,
20410
+ markUrl: typeof profilePictureUrl === "string" ? profilePictureUrl : null,
20411
+ wordmarkUrl: null,
20412
+ backgroundImageUrl: null
20413
+ });
20414
+ }
20415
+
20416
+ // ../../packages/api/dist/types/legacyDeviceCodePollCredential.js
20417
+ function fillLegacyDeviceCodePollCredential(value) {
20418
+ if ("deviceCode" in value && "verificationUri" in value && !("pollCredential" in value)) {
20419
+ Reflect.set(value, "pollCredential", "user-code");
20420
+ }
20421
+ }
20422
+
20298
20423
  // ../../packages/api/dist/types/legacyApiFields.js
20299
20424
  var LEGACY_FILLS = [
20300
20425
  fillLegacyProjectAvatar,
@@ -20319,7 +20444,9 @@ var LEGACY_FILLS = [
20319
20444
  fillLegacyCrmRecordAccess,
20320
20445
  fillLegacyGettingStartedShown,
20321
20446
  fillLegacySpecialistConversationSnoozes,
20322
- fillLegacyCreditsShown
20447
+ fillLegacyCreditsShown,
20448
+ fillLegacyWorkspaceBrand,
20449
+ fillLegacyDeviceCodePollCredential
20323
20450
  ];
20324
20451
  function fillLegacyApiFields(value) {
20325
20452
  if (Array.isArray(value)) {
@@ -20499,8 +20626,25 @@ var V1AuthApiClient = class {
20499
20626
  body: args
20500
20627
  });
20501
20628
  }
20629
+ /** Collects the session the way the server that started the sign-in said to. */
20502
20630
  async pollDeviceCode(args) {
20503
- return this.http.fetch(`/v1/auth/device-code/${encodeURIComponent(args.userCode)}/poll`, { method: "POST", signal: args.signal });
20631
+ const credential = args.start.pollCredential;
20632
+ switch (credential) {
20633
+ case "device-code":
20634
+ return this.http.fetch("/v1/auth/device-code/poll", {
20635
+ method: "POST",
20636
+ body: {
20637
+ deviceCode: args.start.deviceCode
20638
+ },
20639
+ signal: args.signal
20640
+ });
20641
+ case "user-code":
20642
+ return this.http.fetch(`/v1/auth/device-code/${encodeURIComponent(args.start.userCode)}/poll`, { method: "POST", signal: args.signal });
20643
+ default: {
20644
+ const unknownCredential = credential;
20645
+ throw new Error(`Unknown poll credential: ${String(unknownCredential)}`);
20646
+ }
20647
+ }
20504
20648
  }
20505
20649
  async deviceCodeStatus(args) {
20506
20650
  return this.http.fetch(`/v1/auth/device-code/${encodeURIComponent(args.userCode)}`, { signal: args.signal });
@@ -20802,6 +20946,7 @@ var V1HttpClient = class {
20802
20946
  }
20803
20947
  async request(args) {
20804
20948
  const requestToken = this.args.getAccessToken();
20949
+ const clientIdentity = this.args.getClientIdentity?.() ?? null;
20805
20950
  const controller = new AbortController();
20806
20951
  const externalSignal = args.init.signal;
20807
20952
  const abortFromExternal = () => {
@@ -20827,6 +20972,9 @@ var V1HttpClient = class {
20827
20972
  Accept: "application/json",
20828
20973
  ...this.args.headers,
20829
20974
  ...args.init.headers,
20975
+ ...clientIdentity ? {
20976
+ [CLIENT_IDENTITY_HEADER]: formatClientIdentityHeader(clientIdentity)
20977
+ } : {},
20830
20978
  ...requestToken ? { Authorization: `Bearer ${requestToken}` } : {}
20831
20979
  }
20832
20980
  }).catch((cause) => {
@@ -22079,9 +22227,7 @@ var AuthService = class {
22079
22227
  const hardDeadline = expiresAtMs + 3e4;
22080
22228
  while (Date.now() < hardDeadline) {
22081
22229
  await sleep(intervalMs);
22082
- const status = await client.auth.pollDeviceCode({
22083
- userCode: start.userCode
22084
- });
22230
+ const status = await client.auth.pollDeviceCode({ start });
22085
22231
  if (status.status === "pending") continue;
22086
22232
  return status;
22087
22233
  }
@@ -26065,7 +26211,7 @@ var V1CrmApiClient = class {
26065
26211
  // package.json
26066
26212
  var package_default = {
26067
26213
  name: "@general-input/cli",
26068
- version: "0.23.0",
26214
+ version: "0.24.0",
26069
26215
  type: "module",
26070
26216
  description: "The agent-facing CLI for General Input. Authenticate, manage workflows, run bash with operator credentials injected by the cloud.",
26071
26217
  license: "SEE LICENSE IN LICENSE",
@@ -26666,14 +26812,28 @@ import http from "http";
26666
26812
  import https from "https";
26667
26813
  import net from "net";
26668
26814
  import tls3 from "tls";
26669
- function parseHostPort(authority, defaultPort) {
26670
- const lastColon = authority.lastIndexOf(":");
26671
- if (lastColon === -1)
26672
- return { host: authority, port: defaultPort };
26673
- return {
26674
- host: authority.slice(0, lastColon),
26675
- port: Number(authority.slice(lastColon + 1)) || defaultPort
26676
- };
26815
+
26816
+ // ../../packages/egress-proxy/dist/authority.js
26817
+ var MAX_PORT = 65535;
26818
+ var AUTHORITY_PATTERN = /^(?:\[([0-9A-Fa-f:.]+)\]|([^\s:/?#@[\]]+))(?::(.*))?$/;
26819
+ function parseAuthority(args) {
26820
+ const match = AUTHORITY_PATTERN.exec(args.authority);
26821
+ const host = match?.[1] ?? match?.[2];
26822
+ if (!match || !host)
26823
+ return null;
26824
+ const portText = match[3];
26825
+ if (portText === void 0)
26826
+ return { host, port: args.defaultPort };
26827
+ if (!/^\d+$/.test(portText))
26828
+ return null;
26829
+ const port = Number(portText);
26830
+ return port >= 1 && port <= MAX_PORT ? { host, port } : null;
26831
+ }
26832
+
26833
+ // ../../packages/egress-proxy/dist/proxy.js
26834
+ function refuseMalformedAuthority(res) {
26835
+ res.writeHead(400, { "content-type": "text/plain" });
26836
+ res.end("egress proxy: malformed request authority");
26677
26837
  }
26678
26838
  function createEgressProxy(args) {
26679
26839
  const { ca, policyStore, log } = args;
@@ -26708,8 +26868,13 @@ function createEgressProxy(args) {
26708
26868
  req.pipe(upstream);
26709
26869
  }
26710
26870
  const mitmServer = http.createServer((req, res) => {
26711
- const host = (req.headers.host ?? "").split(":")[0];
26712
- enforceOrForward(host, 443, true, req, res);
26871
+ const authority = parseAuthority({
26872
+ authority: req.headers.host ?? "",
26873
+ defaultPort: 443
26874
+ });
26875
+ if (!authority)
26876
+ return refuseMalformedAuthority(res);
26877
+ enforceOrForward(authority.host, authority.port, true, req, res);
26713
26878
  });
26714
26879
  mitmServer.on("clientError", (_err, socket) => socket.destroy());
26715
26880
  const tlsServer = tls3.createServer({
@@ -26728,14 +26893,27 @@ function createEgressProxy(args) {
26728
26893
  res.end("egress proxy: malformed request URL");
26729
26894
  return;
26730
26895
  }
26731
- const { host, port } = parseHostPort(parsed.host, 80);
26896
+ const authority = parseAuthority({
26897
+ authority: parsed.host,
26898
+ defaultPort: 80
26899
+ });
26900
+ if (!authority)
26901
+ return refuseMalformedAuthority(res);
26732
26902
  req.url = `${parsed.pathname}${parsed.search}`;
26733
- enforceOrForward(host, port, false, req, res);
26903
+ enforceOrForward(authority.host, authority.port, false, req, res);
26734
26904
  });
26735
26905
  connectListener.on("clientError", (_err, socket) => socket.destroy());
26736
26906
  connectListener.on("connect", (req, clientSocket, head) => {
26737
- const { host, port } = parseHostPort(req.url ?? "", 443);
26738
26907
  clientSocket.on("error", () => clientSocket.destroy());
26908
+ const authority = parseAuthority({
26909
+ authority: req.url ?? "",
26910
+ defaultPort: 443
26911
+ });
26912
+ if (!authority) {
26913
+ clientSocket.end("HTTP/1.1 400 Bad Request\r\n\r\n", () => clientSocket.destroy());
26914
+ return;
26915
+ }
26916
+ const { host, port } = authority;
26739
26917
  if (policyStore.isEnforcedHost(host)) {
26740
26918
  clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
26741
26919
  if (head.length > 0)