@general-input/cli 0.21.0 → 0.23.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.
Files changed (3) hide show
  1. package/dist/cli.js +1570 -988
  2. package/dist/cli.js.map +1 -1
  3. package/package.json +5 -4
package/dist/cli.js CHANGED
@@ -2236,17 +2236,17 @@ var require_cipherModes = __commonJS({
2236
2236
  }
2237
2237
  };
2238
2238
  modes.gcm.prototype.tableMultiply = function(x) {
2239
- var z50 = [0, 0, 0, 0];
2239
+ var z52 = [0, 0, 0, 0];
2240
2240
  for (var i = 0; i < 32; ++i) {
2241
2241
  var idx = i / 8 | 0;
2242
2242
  var x_i = x[idx] >>> (7 - i % 8) * 4 & 15;
2243
2243
  var ah = this._m[i][x_i];
2244
- z50[0] ^= ah[0];
2245
- z50[1] ^= ah[1];
2246
- z50[2] ^= ah[2];
2247
- z50[3] ^= ah[3];
2244
+ z52[0] ^= ah[0];
2245
+ z52[1] ^= ah[1];
2246
+ z52[2] ^= ah[2];
2247
+ z52[3] ^= ah[3];
2248
2248
  }
2249
- return z50;
2249
+ return z52;
2250
2250
  };
2251
2251
  modes.gcm.prototype.ghash = function(h, y, x) {
2252
2252
  y[0] ^= x[0];
@@ -4511,36 +4511,36 @@ var require_pbkdf2 = __commonJS({
4511
4511
  require_md();
4512
4512
  require_util();
4513
4513
  var pkcs5 = forge2.pkcs5 = forge2.pkcs5 || {};
4514
- var crypto;
4514
+ var crypto2;
4515
4515
  if (forge2.util.isNodejs && !forge2.options.usePureJavaScript) {
4516
- crypto = __require("crypto");
4516
+ crypto2 = __require("crypto");
4517
4517
  }
4518
4518
  module.exports = forge2.pbkdf2 = pkcs5.pbkdf2 = function(p2, s, c, dkLen, md, callback) {
4519
4519
  if (typeof md === "function") {
4520
4520
  callback = md;
4521
4521
  md = null;
4522
4522
  }
4523
- if (forge2.util.isNodejs && !forge2.options.usePureJavaScript && crypto.pbkdf2 && (md === null || typeof md !== "object") && (crypto.pbkdf2Sync.length > 4 || (!md || md === "sha1"))) {
4523
+ if (forge2.util.isNodejs && !forge2.options.usePureJavaScript && crypto2.pbkdf2 && (md === null || typeof md !== "object") && (crypto2.pbkdf2Sync.length > 4 || (!md || md === "sha1"))) {
4524
4524
  if (typeof md !== "string") {
4525
4525
  md = "sha1";
4526
4526
  }
4527
4527
  p2 = Buffer.from(p2, "binary");
4528
4528
  s = Buffer.from(s, "binary");
4529
4529
  if (!callback) {
4530
- if (crypto.pbkdf2Sync.length === 4) {
4531
- return crypto.pbkdf2Sync(p2, s, c, dkLen).toString("binary");
4530
+ if (crypto2.pbkdf2Sync.length === 4) {
4531
+ return crypto2.pbkdf2Sync(p2, s, c, dkLen).toString("binary");
4532
4532
  }
4533
- return crypto.pbkdf2Sync(p2, s, c, dkLen, md).toString("binary");
4533
+ return crypto2.pbkdf2Sync(p2, s, c, dkLen, md).toString("binary");
4534
4534
  }
4535
- if (crypto.pbkdf2Sync.length === 4) {
4536
- return crypto.pbkdf2(p2, s, c, dkLen, function(err2, key) {
4535
+ if (crypto2.pbkdf2Sync.length === 4) {
4536
+ return crypto2.pbkdf2(p2, s, c, dkLen, function(err2, key) {
4537
4537
  if (err2) {
4538
4538
  return callback(err2);
4539
4539
  }
4540
4540
  callback(null, key.toString("binary"));
4541
4541
  });
4542
4542
  }
4543
- return crypto.pbkdf2(p2, s, c, dkLen, md, function(err2, key) {
4543
+ return crypto2.pbkdf2(p2, s, c, dkLen, md, function(err2, key) {
4544
4544
  if (err2) {
4545
4545
  return callback(err2);
4546
4546
  }
@@ -6139,26 +6139,26 @@ var require_jsbn = __commonJS({
6139
6139
  function bnpIsEven() {
6140
6140
  return (this.t > 0 ? this.data[0] & 1 : this.s) == 0;
6141
6141
  }
6142
- function bnpExp(e, z50) {
6142
+ function bnpExp(e, z52) {
6143
6143
  if (e > 4294967295 || e < 1) return BigInteger.ONE;
6144
- var r = nbi(), r2 = nbi(), g = z50.convert(this), i = nbits(e) - 1;
6144
+ var r = nbi(), r2 = nbi(), g = z52.convert(this), i = nbits(e) - 1;
6145
6145
  g.copyTo(r);
6146
6146
  while (--i >= 0) {
6147
- z50.sqrTo(r, r2);
6148
- if ((e & 1 << i) > 0) z50.mulTo(r2, g, r);
6147
+ z52.sqrTo(r, r2);
6148
+ if ((e & 1 << i) > 0) z52.mulTo(r2, g, r);
6149
6149
  else {
6150
6150
  var t = r;
6151
6151
  r = r2;
6152
6152
  r2 = t;
6153
6153
  }
6154
6154
  }
6155
- return z50.revert(r);
6155
+ return z52.revert(r);
6156
6156
  }
6157
6157
  function bnModPowInt(e, m) {
6158
- var z50;
6159
- if (e < 256 || m.isEven()) z50 = new Classic(m);
6160
- else z50 = new Montgomery(m);
6161
- return this.exp(e, z50);
6158
+ var z52;
6159
+ if (e < 256 || m.isEven()) z52 = new Classic(m);
6160
+ else z52 = new Montgomery(m);
6161
+ return this.exp(e, z52);
6162
6162
  }
6163
6163
  BigInteger.prototype.copyTo = bnpCopyTo;
6164
6164
  BigInteger.prototype.fromInt = bnpFromInt;
@@ -6216,13 +6216,13 @@ var require_jsbn = __commonJS({
6216
6216
  if (this.signum() == 0 || b < 2 || b > 36) return "0";
6217
6217
  var cs = this.chunkSize(b);
6218
6218
  var a = Math.pow(b, cs);
6219
- var d = nbv(a), y = nbi(), z50 = nbi(), r = "";
6220
- this.divRemTo(d, y, z50);
6219
+ var d = nbv(a), y = nbi(), z52 = nbi(), r = "";
6220
+ this.divRemTo(d, y, z52);
6221
6221
  while (y.signum() > 0) {
6222
- r = (a + z50.intValue()).toString(b).substr(1) + r;
6223
- y.divRemTo(d, y, z50);
6222
+ r = (a + z52.intValue()).toString(b).substr(1) + r;
6223
+ y.divRemTo(d, y, z52);
6224
6224
  }
6225
- return z50.intValue().toString(b) + r;
6225
+ return z52.intValue().toString(b) + r;
6226
6226
  }
6227
6227
  function bnpFromRadix(s, b) {
6228
6228
  this.fromInt(0);
@@ -6595,7 +6595,7 @@ var require_jsbn = __commonJS({
6595
6595
  Barrett.prototype.mulTo = barrettMulTo;
6596
6596
  Barrett.prototype.sqrTo = barrettSqrTo;
6597
6597
  function bnModPow(e, m) {
6598
- var i = e.bitLength(), k, r = nbv(1), z50;
6598
+ var i = e.bitLength(), k, r = nbv(1), z52;
6599
6599
  if (i <= 0) return r;
6600
6600
  else if (i < 18) k = 1;
6601
6601
  else if (i < 48) k = 3;
@@ -6603,19 +6603,19 @@ var require_jsbn = __commonJS({
6603
6603
  else if (i < 768) k = 5;
6604
6604
  else k = 6;
6605
6605
  if (i < 8)
6606
- z50 = new Classic(m);
6606
+ z52 = new Classic(m);
6607
6607
  else if (m.isEven())
6608
- z50 = new Barrett(m);
6608
+ z52 = new Barrett(m);
6609
6609
  else
6610
- z50 = new Montgomery(m);
6610
+ z52 = new Montgomery(m);
6611
6611
  var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;
6612
- g[1] = z50.convert(this);
6612
+ g[1] = z52.convert(this);
6613
6613
  if (k > 1) {
6614
6614
  var g2 = nbi();
6615
- z50.sqrTo(g[1], g2);
6615
+ z52.sqrTo(g[1], g2);
6616
6616
  while (n <= km) {
6617
6617
  g[n] = nbi();
6618
- z50.mulTo(g2, g[n - 2], g[n]);
6618
+ z52.mulTo(g2, g[n - 2], g[n]);
6619
6619
  n += 2;
6620
6620
  }
6621
6621
  }
@@ -6641,20 +6641,20 @@ var require_jsbn = __commonJS({
6641
6641
  is1 = false;
6642
6642
  } else {
6643
6643
  while (n > 1) {
6644
- z50.sqrTo(r, r2);
6645
- z50.sqrTo(r2, r);
6644
+ z52.sqrTo(r, r2);
6645
+ z52.sqrTo(r2, r);
6646
6646
  n -= 2;
6647
6647
  }
6648
- if (n > 0) z50.sqrTo(r, r2);
6648
+ if (n > 0) z52.sqrTo(r, r2);
6649
6649
  else {
6650
6650
  t = r;
6651
6651
  r = r2;
6652
6652
  r2 = t;
6653
6653
  }
6654
- z50.mulTo(r2, g[w], r);
6654
+ z52.mulTo(r2, g[w], r);
6655
6655
  }
6656
6656
  while (j >= 0 && (e.data[j] & 1 << i) == 0) {
6657
- z50.sqrTo(r, r2);
6657
+ z52.sqrTo(r, r2);
6658
6658
  t = r;
6659
6659
  r = r2;
6660
6660
  r2 = t;
@@ -6664,7 +6664,7 @@ var require_jsbn = __commonJS({
6664
6664
  }
6665
6665
  }
6666
6666
  }
6667
- return z50.revert(r);
6667
+ return z52.revert(r);
6668
6668
  }
6669
6669
  function bnGCD(a) {
6670
6670
  var x = this.s < 0 ? this.negate() : this.clone();
@@ -18149,6 +18149,24 @@ 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/user.js
18153
+ import { z } from "zod";
18154
+ var UserRoleSchema = z.enum([
18155
+ "InstanceOperator",
18156
+ "Owner",
18157
+ "Admin",
18158
+ "Member"
18159
+ ]);
18160
+ function parseRoles(raw) {
18161
+ if (!raw)
18162
+ return ["Member"];
18163
+ const parsed = raw.split(",").map((s) => s.trim()).flatMap((s) => {
18164
+ const role = UserRoleSchema.safeParse(s);
18165
+ return role.success ? [role.data] : [];
18166
+ });
18167
+ return parsed.length > 0 ? parsed : ["Member"];
18168
+ }
18169
+
18152
18170
  // ../../packages/api/dist/types/workflowTypeTraits.js
18153
18171
  var WORKFLOW_TYPE_KINDS = ["workflow", "app", "design"];
18154
18172
  var WORKFLOW_TYPE_COLLECTIONS = [
@@ -18840,18 +18858,19 @@ function admitKnownRows(value, method) {
18840
18858
  }
18841
18859
 
18842
18860
  // ../../packages/core/dist/types/platform.js
18843
- import { z } from "zod";
18844
- var CredentialTypeSchema = z.enum([
18861
+ import { z as z2 } from "zod";
18862
+ var CredentialTypeSchema = z2.enum([
18845
18863
  "oauth2",
18846
18864
  "apiKey",
18847
18865
  "platform",
18848
18866
  "platformResource",
18849
18867
  "noAuth"
18850
18868
  ]);
18851
- var PlatformServiceSchema = z.enum([
18869
+ var PlatformServiceSchema = z2.enum([
18852
18870
  "chat-completion",
18853
18871
  "decision",
18854
18872
  "search-internet",
18873
+ "image-search",
18855
18874
  "proxy-scrape",
18856
18875
  "generate-image",
18857
18876
  "geolocation",
@@ -18862,75 +18881,75 @@ var PlatformServiceSchema = z.enum([
18862
18881
  "workspace-members",
18863
18882
  "notifications"
18864
18883
  ]);
18865
- var PlatformResourceKindSchema = z.enum([
18884
+ var PlatformResourceKindSchema = z2.enum([
18866
18885
  "user-database",
18867
18886
  "browser-profile",
18868
18887
  "user-storage"
18869
18888
  ]);
18870
18889
 
18871
18890
  // ../../packages/core/dist/types/proxyScrape.js
18872
- import { z as z2 } from "zod";
18873
- var ProxyScrapeResponseSchema = z2.object({
18874
- content: z2.string(),
18875
- statusCode: z2.number(),
18891
+ import { z as z3 } from "zod";
18892
+ var ProxyScrapeResponseSchema = z3.object({
18893
+ content: z3.string(),
18894
+ statusCode: z3.number(),
18876
18895
  /** Fetched without JS rendering and the page came back as an empty app shell. */
18877
- isLikelyJsShell: z2.boolean().optional()
18896
+ isLikelyJsShell: z3.boolean().optional()
18878
18897
  });
18879
- var ProxyScrapeFailureReasonSchema = z2.enum([
18898
+ var ProxyScrapeFailureReasonSchema = z3.enum([
18880
18899
  "blocked",
18881
18900
  "bad-request",
18882
18901
  "provider-error",
18883
18902
  "timeout",
18884
18903
  "not-offered"
18885
18904
  ]);
18886
- var ProxyScrapeErrorBodySchema = z2.object({
18887
- error: z2.string(),
18905
+ var ProxyScrapeErrorBodySchema = z3.object({
18906
+ error: z3.string(),
18888
18907
  reason: ProxyScrapeFailureReasonSchema
18889
18908
  });
18890
18909
 
18891
18910
  // ../../packages/core/dist/types/trigger.js
18892
- import { z as z3 } from "zod";
18893
- var TriggerTypeSchema = z3.enum(["webhook", "cron", "poll"]);
18894
- var TriggerConfigSchema = z3.discriminatedUnion("type", [
18895
- z3.object({
18896
- type: z3.literal("webhook"),
18897
- payloadSchema: z3.record(z3.string(), z3.unknown()).optional()
18911
+ import { z as z4 } from "zod";
18912
+ var TriggerTypeSchema = z4.enum(["webhook", "cron", "poll"]);
18913
+ var TriggerConfigSchema = z4.discriminatedUnion("type", [
18914
+ z4.object({
18915
+ type: z4.literal("webhook"),
18916
+ payloadSchema: z4.record(z4.string(), z4.unknown()).optional()
18898
18917
  }),
18899
- z3.object({
18900
- type: z3.literal("cron"),
18901
- schedule: z3.string(),
18902
- timezone: z3.string().optional()
18918
+ z4.object({
18919
+ type: z4.literal("cron"),
18920
+ schedule: z4.string(),
18921
+ timezone: z4.string().optional()
18903
18922
  }),
18904
- z3.object({
18905
- type: z3.literal("poll"),
18906
- triggerId: z3.string()
18923
+ z4.object({
18924
+ type: z4.literal("poll"),
18925
+ triggerId: z4.string()
18907
18926
  })
18908
18927
  ]);
18909
18928
 
18910
18929
  // ../../packages/core/dist/types/artifact.js
18911
- import { z as z4 } from "zod";
18912
- var ArtifactMetaSchema = z4.object({
18913
- filename: z4.string(),
18914
- mimeType: z4.string(),
18915
- label: z4.string(),
18916
- sizeBytes: z4.number().nullable()
18930
+ import { z as z5 } from "zod";
18931
+ var ArtifactMetaSchema = z5.object({
18932
+ filename: z5.string(),
18933
+ mimeType: z5.string(),
18934
+ label: z5.string(),
18935
+ sizeBytes: z5.number().nullable()
18917
18936
  });
18918
- var WriteArtifactOptionsSchema = z4.object({
18919
- filename: z4.string(),
18920
- mimeType: z4.string(),
18921
- label: z4.string(),
18937
+ var WriteArtifactOptionsSchema = z5.object({
18938
+ filename: z5.string(),
18939
+ mimeType: z5.string(),
18940
+ label: z5.string(),
18922
18941
  // `z.instanceof(Buffer)` evaluates the `Buffer` constructor at module
18923
18942
  // load — that crashes in the browser, where `Buffer` is undefined,
18924
18943
  // any time something pulls in `@general-input/core` transitively (e.g.
18925
18944
  // a value re-export from `@packages/api`). Use a guarded predicate
18926
18945
  // instead so the schema is safe to define anywhere; the check still
18927
18946
  // runs correctly when actually parsed in Node.
18928
- data: z4.custom((value) => typeof Buffer !== "undefined" && value instanceof Buffer, "Expected a Buffer")
18947
+ data: z5.custom((value) => typeof Buffer !== "undefined" && value instanceof Buffer, "Expected a Buffer")
18929
18948
  });
18930
18949
 
18931
18950
  // ../../packages/core/dist/types/run.js
18932
- import { z as z5 } from "zod";
18933
- var RunStatusSchema = z5.enum([
18951
+ import { z as z6 } from "zod";
18952
+ var RunStatusSchema = z6.enum([
18934
18953
  "pending",
18935
18954
  "running",
18936
18955
  "awaiting_input",
@@ -18940,57 +18959,57 @@ var RunStatusSchema = z5.enum([
18940
18959
  "filtered",
18941
18960
  "skipped"
18942
18961
  ]);
18943
- var LogEntrySchema = z5.object({
18944
- timestamp: z5.string(),
18945
- level: z5.enum(["debug", "info", "warn", "error"]),
18946
- message: z5.string(),
18947
- data: z5.unknown().optional()
18962
+ var LogEntrySchema = z6.object({
18963
+ timestamp: z6.string(),
18964
+ level: z6.enum(["debug", "info", "warn", "error"]),
18965
+ message: z6.string(),
18966
+ data: z6.unknown().optional()
18948
18967
  });
18949
- var ExecutionStepSchema = z5.object({
18950
- message: z5.string(),
18951
- timestamp: z5.string()
18968
+ var ExecutionStepSchema = z6.object({
18969
+ message: z6.string(),
18970
+ timestamp: z6.string()
18952
18971
  });
18953
- var CredentialSnapshotEntrySchema = z5.object({
18954
- inputKey: z5.string(),
18955
- service: z5.string(),
18956
- credentialId: z5.string(),
18957
- credentialTitle: z5.string(),
18958
- iconUrl: z5.string().optional()
18972
+ var CredentialSnapshotEntrySchema = z6.object({
18973
+ inputKey: z6.string(),
18974
+ service: z6.string(),
18975
+ credentialId: z6.string(),
18976
+ credentialTitle: z6.string(),
18977
+ iconUrl: z6.string().optional()
18959
18978
  });
18960
- var PlatformIntegrationSnapshotEntrySchema = z5.object({
18961
- service: z5.string(),
18962
- title: z5.string(),
18963
- iconUrl: z5.string(),
18964
- estimatedCostDisplay: z5.string()
18979
+ var PlatformIntegrationSnapshotEntrySchema = z6.object({
18980
+ service: z6.string(),
18981
+ title: z6.string(),
18982
+ iconUrl: z6.string(),
18983
+ estimatedCostDisplay: z6.string()
18965
18984
  });
18966
- var ConstSnapshotEntrySchema = z5.object({
18967
- key: z5.string(),
18968
- title: z5.string(),
18969
- value: z5.unknown()
18985
+ var ConstSnapshotEntrySchema = z6.object({
18986
+ key: z6.string(),
18987
+ title: z6.string(),
18988
+ value: z6.unknown()
18970
18989
  });
18971
- var WorkflowSnapshotSchema = z5.object({
18972
- id: z5.string(),
18973
- name: z5.string(),
18974
- description: z5.string()
18990
+ var WorkflowSnapshotSchema = z6.object({
18991
+ id: z6.string(),
18992
+ name: z6.string(),
18993
+ description: z6.string()
18975
18994
  });
18976
- var WorkflowTypeSchema = z5.enum(["code", "agent", "app", "design"]);
18977
- var HumanInLoopNotifyChannelSchema = z5.enum([
18995
+ var WorkflowTypeSchema = z6.enum(["code", "agent", "app", "design"]);
18996
+ var HumanInLoopNotifyChannelSchema = z6.enum([
18978
18997
  "email",
18979
18998
  "slack",
18980
18999
  "push",
18981
19000
  "browser"
18982
19001
  ]);
18983
19002
  var ALL_CONNECTED_NOTIFY = "all-connected";
18984
- var HumanInLoopNotifySchema = z5.union([
18985
- z5.literal(ALL_CONNECTED_NOTIFY),
18986
- z5.array(HumanInLoopNotifyChannelSchema)
19003
+ var HumanInLoopNotifySchema = z6.union([
19004
+ z6.literal(ALL_CONNECTED_NOTIFY),
19005
+ z6.array(HumanInLoopNotifyChannelSchema)
18987
19006
  ]);
18988
- var AgentHumanInLoopConfigSchema = z5.object({
18989
- enabled: z5.boolean(),
19007
+ var AgentHumanInLoopConfigSchema = z6.object({
19008
+ enabled: z6.boolean(),
18990
19009
  // Defaults to empty so `{ "enabled": false }` — the natural shorthand for a
18991
19010
  // fully autonomous workflow — validates without the ceremony of an empty
18992
19011
  // string the author has no reason to type.
18993
- instructions: z5.string().default(""),
19012
+ instructions: z6.string().default(""),
18994
19013
  // The default also covers configs written before the field, so a paused run reaches someone who never opens the app.
18995
19014
  notify: HumanInLoopNotifySchema.default(ALL_CONNECTED_NOTIFY)
18996
19015
  });
@@ -19001,200 +19020,200 @@ function autonomousHumanInLoopConfig() {
19001
19020
  notify: ALL_CONNECTED_NOTIFY
19002
19021
  };
19003
19022
  }
19004
- var AgentConfigSnapshotSchema = z5.object({
19005
- model: z5.string(),
19006
- modelDisplayName: z5.string(),
19023
+ var AgentConfigSnapshotSchema = z6.object({
19024
+ model: z6.string(),
19025
+ modelDisplayName: z6.string(),
19007
19026
  // Default keeps snapshots written before iconId was captured parseable.
19008
- modelIconId: z5.string().default("custom"),
19009
- maxTimeMinutes: z5.number(),
19010
- effort: z5.string().optional(),
19027
+ modelIconId: z6.string().default("custom"),
19028
+ maxTimeMinutes: z6.number(),
19029
+ effort: z6.string().optional(),
19011
19030
  // Default keeps run files written before HITL existed parseable.
19012
19031
  humanInLoop: AgentHumanInLoopConfigSchema.default(autonomousHumanInLoopConfig)
19013
19032
  });
19014
- var WorkflowRunStatusSchema = z5.object({
19015
- id: z5.string(),
19016
- workflowId: z5.string(),
19033
+ var WorkflowRunStatusSchema = z6.object({
19034
+ id: z6.string(),
19035
+ workflowId: z6.string(),
19017
19036
  workflowType: WorkflowTypeSchema.default("code"),
19018
19037
  workflow: WorkflowSnapshotSchema,
19019
19038
  status: RunStatusSchema,
19020
- trigger: z5.object({
19021
- id: z5.string(),
19022
- payload: z5.unknown()
19039
+ trigger: z6.object({
19040
+ id: z6.string(),
19041
+ payload: z6.unknown()
19023
19042
  }).optional(),
19024
19043
  // What the workflow received (trigger is what fired it; absent for
19025
19044
  // manual runs). Optional: run files written before this field exist.
19026
- input: z5.unknown().optional(),
19027
- startedAt: z5.string().optional(),
19028
- completedAt: z5.string().optional(),
19029
- error: z5.string().optional(),
19030
- steps: z5.array(ExecutionStepSchema).optional(),
19031
- logs: z5.array(LogEntrySchema),
19032
- artifacts: z5.array(ArtifactMetaSchema),
19033
- constSnapshot: z5.array(ConstSnapshotEntrySchema).optional(),
19034
- credentialSnapshot: z5.array(CredentialSnapshotEntrySchema).optional(),
19035
- platformIntegrationSnapshot: z5.array(PlatformIntegrationSnapshotEntrySchema).optional(),
19045
+ input: z6.unknown().optional(),
19046
+ startedAt: z6.string().optional(),
19047
+ completedAt: z6.string().optional(),
19048
+ error: z6.string().optional(),
19049
+ steps: z6.array(ExecutionStepSchema).optional(),
19050
+ logs: z6.array(LogEntrySchema),
19051
+ artifacts: z6.array(ArtifactMetaSchema),
19052
+ constSnapshot: z6.array(ConstSnapshotEntrySchema).optional(),
19053
+ credentialSnapshot: z6.array(CredentialSnapshotEntrySchema).optional(),
19054
+ platformIntegrationSnapshot: z6.array(PlatformIntegrationSnapshotEntrySchema).optional(),
19036
19055
  agentConfigSnapshot: AgentConfigSnapshotSchema.optional()
19037
19056
  });
19038
19057
 
19039
19058
  // ../../packages/core/dist/types/execution.js
19040
- import { z as z8 } from "zod";
19059
+ import { z as z9 } from "zod";
19041
19060
 
19042
19061
  // ../../packages/core/dist/types/filter.js
19043
- import { z as z6 } from "zod";
19044
- var WorkflowExecutionModeSchema = z6.enum(["run", "filter", "sources"]);
19045
- var WorkflowFilterDecisionSchema = z6.discriminatedUnion("decision", [
19046
- z6.object({
19047
- decision: z6.literal("skip"),
19048
- reason: z6.string().min(1)
19062
+ import { z as z7 } from "zod";
19063
+ var WorkflowExecutionModeSchema = z7.enum(["run", "filter", "sources"]);
19064
+ var WorkflowFilterDecisionSchema = z7.discriminatedUnion("decision", [
19065
+ z7.object({
19066
+ decision: z7.literal("skip"),
19067
+ reason: z7.string().min(1)
19049
19068
  }),
19050
- z6.object({
19051
- decision: z6.literal("run"),
19052
- reason: z6.string().optional(),
19069
+ z7.object({
19070
+ decision: z7.literal("run"),
19071
+ reason: z7.string().optional(),
19053
19072
  /** Replaces the trigger payload for the run. Omit to pass it through. */
19054
- input: z6.unknown().optional()
19073
+ input: z7.unknown().optional()
19055
19074
  })
19056
19075
  ]);
19057
19076
 
19058
19077
  // ../../packages/core/dist/types/designSources.js
19059
- import { z as z7 } from "zod";
19078
+ import { z as z8 } from "zod";
19060
19079
  var MAX_DESIGN_SOURCE_BYTES = 5 * 1024 * 1024;
19061
19080
  var DESIGN_SOURCE_TIMEOUT_MS = 2 * 6e4;
19062
- var DesignSourceOutcomeSchema = z7.discriminatedUnion("status", [
19063
- z7.object({
19064
- status: z7.literal("ok"),
19065
- value: z7.unknown(),
19066
- durationMs: z7.number()
19081
+ var DesignSourceOutcomeSchema = z8.discriminatedUnion("status", [
19082
+ z8.object({
19083
+ status: z8.literal("ok"),
19084
+ value: z8.unknown(),
19085
+ durationMs: z8.number()
19067
19086
  }),
19068
- z7.object({
19069
- status: z7.literal("failed"),
19070
- error: z7.string(),
19071
- durationMs: z7.number()
19087
+ z8.object({
19088
+ status: z8.literal("failed"),
19089
+ error: z8.string(),
19090
+ durationMs: z8.number()
19072
19091
  })
19073
19092
  ]);
19074
- var DesignSourceResultsSchema = z7.record(z7.string(), DesignSourceOutcomeSchema);
19093
+ var DesignSourceResultsSchema = z8.record(z8.string(), DesignSourceOutcomeSchema);
19075
19094
 
19076
19095
  // ../../packages/core/dist/types/execution.js
19077
- var EgressRequesterAllowerSchema = z8.object({ kind: z8.literal("requester") });
19078
- var EgressBlockSourceSchema = z8.discriminatedUnion("layer", [
19079
- z8.object({
19080
- layer: z8.literal("workspace"),
19081
- settingsUrl: z8.string(),
19082
- allower: z8.discriminatedUnion("kind", [
19096
+ var EgressRequesterAllowerSchema = z9.object({ kind: z9.literal("requester") });
19097
+ var EgressBlockSourceSchema = z9.discriminatedUnion("layer", [
19098
+ z9.object({
19099
+ layer: z9.literal("workspace"),
19100
+ settingsUrl: z9.string(),
19101
+ allower: z9.discriminatedUnion("kind", [
19083
19102
  EgressRequesterAllowerSchema,
19084
- z8.object({ kind: z8.literal("workspace_admins") })
19103
+ z9.object({ kind: z9.literal("workspace_admins") })
19085
19104
  ])
19086
19105
  }),
19087
- z8.object({
19088
- layer: z8.literal("credential"),
19089
- settingsUrl: z8.string(),
19090
- allower: z8.discriminatedUnion("kind", [
19106
+ z9.object({
19107
+ layer: z9.literal("credential"),
19108
+ settingsUrl: z9.string(),
19109
+ allower: z9.discriminatedUnion("kind", [
19091
19110
  EgressRequesterAllowerSchema,
19092
- z8.object({ kind: z8.literal("connection_owner"), name: z8.string() })
19111
+ z9.object({ kind: z9.literal("connection_owner"), name: z9.string() })
19093
19112
  ])
19094
19113
  })
19095
19114
  ]);
19096
- var ExecutionEgressPolicySchema = z8.object({
19097
- unmatched: z8.literal("allow_log"),
19098
- credentials: z8.array(z8.object({
19099
- inputKey: z8.string(),
19100
- service: z8.string(),
19101
- hosts: z8.array(z8.string()),
19102
- deny: z8.array(z8.object({
19103
- method: z8.string(),
19104
- pathTemplate: z8.string(),
19105
- opId: z8.string(),
19106
- title: z8.string(),
19115
+ var ExecutionEgressPolicySchema = z9.object({
19116
+ unmatched: z9.literal("allow_log"),
19117
+ credentials: z9.array(z9.object({
19118
+ inputKey: z9.string(),
19119
+ service: z9.string(),
19120
+ hosts: z9.array(z9.string()),
19121
+ deny: z9.array(z9.object({
19122
+ method: z9.string(),
19123
+ pathTemplate: z9.string(),
19124
+ opId: z9.string(),
19125
+ title: z9.string(),
19107
19126
  // Description only: missing (older server) or unreadable (newer one)
19108
19127
  // drops to [] so it can never void the policy and stop enforcement.
19109
- blockedBy: z8.array(EgressBlockSourceSchema).catch([])
19128
+ blockedBy: z9.array(EgressBlockSourceSchema).catch([])
19110
19129
  }))
19111
19130
  }))
19112
19131
  });
19113
- var ExecutionPayloadSchema = z8.object({
19114
- executionId: z8.string(),
19115
- workflowId: z8.string(),
19116
- input: z8.unknown(),
19117
- credentials: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())),
19118
- platformCredentials: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())),
19119
- consts: z8.record(z8.string(), z8.unknown()),
19120
- platformAuth: z8.object({
19121
- platformApiKey: z8.string(),
19122
- platformBaseUrl: z8.string(),
19123
- membershipId: z8.string(),
19132
+ var ExecutionPayloadSchema = z9.object({
19133
+ executionId: z9.string(),
19134
+ workflowId: z9.string(),
19135
+ input: z9.unknown(),
19136
+ credentials: z9.record(z9.string(), z9.record(z9.string(), z9.unknown())),
19137
+ platformCredentials: z9.record(z9.string(), z9.record(z9.string(), z9.unknown())),
19138
+ consts: z9.record(z9.string(), z9.unknown()),
19139
+ platformAuth: z9.object({
19140
+ platformApiKey: z9.string(),
19141
+ platformBaseUrl: z9.string(),
19142
+ membershipId: z9.string(),
19124
19143
  // The resources this key may touch. Null means the run declared no
19125
19144
  // resource slots and keeps unscoped access.
19126
- boundResourceIds: z8.array(z8.string()).nullable()
19145
+ boundResourceIds: z9.array(z9.string()).nullable()
19127
19146
  }),
19128
- trigger: z8.object({
19129
- id: z8.string(),
19130
- key: z8.string(),
19131
- payload: z8.unknown()
19147
+ trigger: z9.object({
19148
+ id: z9.string(),
19149
+ key: z9.string(),
19150
+ payload: z9.unknown()
19132
19151
  }).optional(),
19133
19152
  egressPolicy: ExecutionEgressPolicySchema.optional()
19134
19153
  });
19135
- var ExecutionEventSchema = z8.discriminatedUnion("type", [
19136
- z8.object({
19137
- type: z8.literal("run:started"),
19138
- executionId: z8.string(),
19139
- workflowId: z8.string()
19154
+ var ExecutionEventSchema = z9.discriminatedUnion("type", [
19155
+ z9.object({
19156
+ type: z9.literal("run:started"),
19157
+ executionId: z9.string(),
19158
+ workflowId: z9.string()
19140
19159
  }),
19141
- z8.object({ type: z8.literal("run:completed"), executionId: z8.string() }),
19142
- z8.object({
19143
- type: z8.literal("run:failed"),
19144
- executionId: z8.string(),
19145
- error: z8.string()
19160
+ z9.object({ type: z9.literal("run:completed"), executionId: z9.string() }),
19161
+ z9.object({
19162
+ type: z9.literal("run:failed"),
19163
+ executionId: z9.string(),
19164
+ error: z9.string()
19146
19165
  }),
19147
- z8.object({
19148
- type: z8.literal("step"),
19149
- executionId: z8.string(),
19150
- message: z8.string()
19166
+ z9.object({
19167
+ type: z9.literal("step"),
19168
+ executionId: z9.string(),
19169
+ message: z9.string()
19151
19170
  }),
19152
- z8.object({
19153
- type: z8.literal("artifact:written"),
19154
- executionId: z8.string(),
19171
+ z9.object({
19172
+ type: z9.literal("artifact:written"),
19173
+ executionId: z9.string(),
19155
19174
  artifact: ArtifactMetaSchema
19156
19175
  }),
19157
- z8.object({
19158
- type: z8.literal("log"),
19159
- executionId: z8.string(),
19176
+ z9.object({
19177
+ type: z9.literal("log"),
19178
+ executionId: z9.string(),
19160
19179
  entry: LogEntrySchema
19161
19180
  }),
19162
- z8.object({
19163
- type: z8.literal("filter:decision"),
19164
- executionId: z8.string(),
19181
+ z9.object({
19182
+ type: z9.literal("filter:decision"),
19183
+ executionId: z9.string(),
19165
19184
  decision: WorkflowFilterDecisionSchema
19166
19185
  }),
19167
19186
  // A large decision spills to an artifact rather than the stdout event stream:
19168
19187
  // a line long enough to span chunks can arrive corrupted, and one the consumer
19169
19188
  // cannot parse reads as "no decision" and fails the filter open.
19170
- z8.object({
19171
- type: z8.literal("filter:decision-artifact"),
19172
- executionId: z8.string(),
19173
- filename: z8.string()
19189
+ z9.object({
19190
+ type: z9.literal("filter:decision-artifact"),
19191
+ executionId: z9.string(),
19192
+ filename: z9.string()
19174
19193
  }),
19175
- z8.object({
19176
- type: z8.literal("sources:results"),
19177
- executionId: z8.string(),
19194
+ z9.object({
19195
+ type: z9.literal("sources:results"),
19196
+ executionId: z9.string(),
19178
19197
  results: DesignSourceResultsSchema
19179
19198
  }),
19180
19199
  // Large results spill to an artifact for the same reason a filter decision does.
19181
- z8.object({
19182
- type: z8.literal("sources:results-artifact"),
19183
- executionId: z8.string(),
19184
- filename: z8.string()
19200
+ z9.object({
19201
+ type: z9.literal("sources:results-artifact"),
19202
+ executionId: z9.string(),
19203
+ filename: z9.string()
19185
19204
  }),
19186
19205
  // An event line arrived unparseable. Emitted by the provider, never by the
19187
19206
  // sandbox: it means bytes were lost in transport, which is not the same thing
19188
19207
  // as the workflow having produced nothing.
19189
- z8.object({
19190
- type: z8.literal("stream:corrupt"),
19191
- executionId: z8.string(),
19192
- byteLength: z8.number()
19208
+ z9.object({
19209
+ type: z9.literal("stream:corrupt"),
19210
+ executionId: z9.string(),
19211
+ byteLength: z9.number()
19193
19212
  })
19194
19213
  ]);
19195
19214
 
19196
19215
  // ../../packages/core/dist/types/manifest.js
19197
- import { z as z9 } from "zod";
19216
+ import { z as z10 } from "zod";
19198
19217
 
19199
19218
  // ../../packages/workflow-doc-schema/dist/nodeTypes.js
19200
19219
  var WORKFLOW_CUSTOM_NODE_TYPES = {
@@ -19223,69 +19242,69 @@ var ALLOWED_NODE_TYPES = /* @__PURE__ */ new Set([
19223
19242
  ]);
19224
19243
 
19225
19244
  // ../../packages/core/dist/types/manifest.js
19226
- var TriggerBlockSchema = z9.object({
19227
- type: z9.literal(WORKFLOW_CUSTOM_NODE_TYPES.trigger),
19228
- attrs: z9.object({
19229
- id: z9.string(),
19230
- triggerId: z9.string().optional(),
19231
- service: z9.string(),
19232
- event: z9.string()
19245
+ var TriggerBlockSchema = z10.object({
19246
+ type: z10.literal(WORKFLOW_CUSTOM_NODE_TYPES.trigger),
19247
+ attrs: z10.object({
19248
+ id: z10.string(),
19249
+ triggerId: z10.string().optional(),
19250
+ service: z10.string(),
19251
+ event: z10.string()
19233
19252
  })
19234
19253
  });
19235
- var InputSchemaBlockSchema = z9.object({
19236
- type: z9.literal(WORKFLOW_CUSTOM_NODE_TYPES.inputSchema),
19237
- attrs: z9.object({
19238
- schema: z9.record(z9.string(), z9.unknown())
19254
+ var InputSchemaBlockSchema = z10.object({
19255
+ type: z10.literal(WORKFLOW_CUSTOM_NODE_TYPES.inputSchema),
19256
+ attrs: z10.object({
19257
+ schema: z10.record(z10.string(), z10.unknown())
19239
19258
  })
19240
19259
  });
19241
- var CredentialBlockSchema = z9.object({
19242
- type: z9.literal(WORKFLOW_CUSTOM_NODE_TYPES.credential),
19243
- attrs: z9.object({
19244
- service: z9.string(),
19245
- inputKey: z9.string(),
19260
+ var CredentialBlockSchema = z10.object({
19261
+ type: z10.literal(WORKFLOW_CUSTOM_NODE_TYPES.credential),
19262
+ attrs: z10.object({
19263
+ service: z10.string(),
19264
+ inputKey: z10.string(),
19246
19265
  // Absent or false = required. Optional credentials may be left unconnected;
19247
19266
  // the workflow handles their absence at runtime (hasCredential).
19248
- optional: z9.boolean().optional()
19267
+ optional: z10.boolean().optional()
19249
19268
  })
19250
19269
  });
19251
- var PlatformCredentialBlockSchema = z9.object({
19252
- type: z9.literal(WORKFLOW_CUSTOM_NODE_TYPES.platformCredential),
19253
- attrs: z9.object({
19270
+ var PlatformCredentialBlockSchema = z10.object({
19271
+ type: z10.literal(WORKFLOW_CUSTOM_NODE_TYPES.platformCredential),
19272
+ attrs: z10.object({
19254
19273
  service: PlatformServiceSchema,
19255
- inputKey: z9.string()
19274
+ inputKey: z10.string()
19256
19275
  })
19257
19276
  });
19258
- var ConstBlockSchema = z9.object({
19259
- type: z9.literal(WORKFLOW_CUSTOM_NODE_TYPES.const),
19260
- attrs: z9.object({
19261
- key: z9.string(),
19262
- schema: z9.record(z9.string(), z9.unknown())
19277
+ var ConstBlockSchema = z10.object({
19278
+ type: z10.literal(WORKFLOW_CUSTOM_NODE_TYPES.const),
19279
+ attrs: z10.object({
19280
+ key: z10.string(),
19281
+ schema: z10.record(z10.string(), z10.unknown())
19263
19282
  })
19264
19283
  });
19265
- var WorkflowManifestSchema = z9.object({
19266
- name: z9.string().optional(),
19267
- description: z9.string().optional(),
19284
+ var WorkflowManifestSchema = z10.object({
19285
+ name: z10.string().optional(),
19286
+ description: z10.string().optional(),
19268
19287
  /** The document declares a filter, so `filter.ts` gates every run. */
19269
- hasFilter: z9.boolean(),
19270
- triggers: z9.array(z9.object({
19271
- id: z9.string(),
19272
- triggerId: z9.string().optional(),
19273
- service: z9.string(),
19274
- event: z9.string()
19288
+ hasFilter: z10.boolean(),
19289
+ triggers: z10.array(z10.object({
19290
+ id: z10.string(),
19291
+ triggerId: z10.string().optional(),
19292
+ service: z10.string(),
19293
+ event: z10.string()
19275
19294
  })),
19276
- inputSchema: z9.record(z9.string(), z9.unknown()).optional(),
19277
- credentials: z9.array(z9.object({
19278
- service: z9.string(),
19279
- inputKey: z9.string(),
19280
- optional: z9.boolean().optional()
19295
+ inputSchema: z10.record(z10.string(), z10.unknown()).optional(),
19296
+ credentials: z10.array(z10.object({
19297
+ service: z10.string(),
19298
+ inputKey: z10.string(),
19299
+ optional: z10.boolean().optional()
19281
19300
  })),
19282
- platformCredentials: z9.array(z9.object({
19301
+ platformCredentials: z10.array(z10.object({
19283
19302
  service: PlatformServiceSchema,
19284
- inputKey: z9.string()
19303
+ inputKey: z10.string()
19285
19304
  })),
19286
- consts: z9.array(z9.object({
19287
- key: z9.string(),
19288
- schema: z9.record(z9.string(), z9.unknown())
19305
+ consts: z10.array(z10.object({
19306
+ key: z10.string(),
19307
+ schema: z10.record(z10.string(), z10.unknown())
19289
19308
  }))
19290
19309
  });
19291
19310
 
@@ -19486,6 +19505,10 @@ var Scrubber = class {
19486
19505
  redact(text) {
19487
19506
  return this.stream().redact(text, { final: true });
19488
19507
  }
19508
+ /** For a redactor that runs where this object cannot, such as inside a sandbox. */
19509
+ entries() {
19510
+ return [...this.redactions].map(([secret, marker]) => ({ secret, marker }));
19511
+ }
19489
19512
  /** Test-only: how many secrets are registered. */
19490
19513
  get size() {
19491
19514
  return this.redactions.size;
@@ -19606,6 +19629,8 @@ var OrgPermission = {
19606
19629
  MEMBERS_ARCHIVE: "members:archive",
19607
19630
  MEMBERS_DEMOTE_ADMIN: "members:demote_admin",
19608
19631
  MEMBERS_TRANSFER_OWNERSHIP: "members:transfer_ownership",
19632
+ // Teams: create, rename, delete, and choose who is on each and who leads
19633
+ TEAMS_MANAGE: "teams:manage",
19609
19634
  // OAuth connections
19610
19635
  ORG_MANAGE_OAUTH_CONNECTIONS: "org:manage_oauth_connections",
19611
19636
  // Notification channels — connect Slack/etc and match members to accounts
@@ -19620,6 +19645,8 @@ var OrgPermission = {
19620
19645
  MEMORY_MODIFY: "memory:modify",
19621
19646
  // CRM — order the enrichment provider waterfalls (org-wide chains)
19622
19647
  CRM_CONFIGURE_WATERFALLS: "crm:configure_waterfalls",
19648
+ // CRM: see and manage every record, whoever owns it and however it's shared
19649
+ CRM_ACCESS_ALL_RECORDS: "crm:access_all_records",
19623
19650
  INSTANCE_OPERATE: "instance:operate",
19624
19651
  // Security audit
19625
19652
  ORG_SECURITY_ACCESS: "audit:org_security_access",
@@ -19668,6 +19695,7 @@ var ORG_PERMISSIONS = [
19668
19695
  { id: OrgPermission.MEMBERS_ARCHIVE, label: "Deactivate members" },
19669
19696
  { id: OrgPermission.MEMBERS_DEMOTE_ADMIN, label: "Demote admins" },
19670
19697
  { id: OrgPermission.MEMBERS_TRANSFER_OWNERSHIP, label: "Transfer ownership" },
19698
+ { id: OrgPermission.TEAMS_MANAGE, label: "Manage teams" },
19671
19699
  {
19672
19700
  id: OrgPermission.ORG_MANAGE_OAUTH_CONNECTIONS,
19673
19701
  label: "Manage OAuth integrations"
@@ -19692,6 +19720,10 @@ var ORG_PERMISSIONS = [
19692
19720
  id: OrgPermission.CRM_CONFIGURE_WATERFALLS,
19693
19721
  label: "Configure CRM waterfalls"
19694
19722
  },
19723
+ {
19724
+ id: OrgPermission.CRM_ACCESS_ALL_RECORDS,
19725
+ label: "See and manage every CRM record"
19726
+ },
19695
19727
  {
19696
19728
  id: OrgPermission.MEMORY_MODIFY,
19697
19729
  label: "Modify workspace memory"
@@ -19750,12 +19782,14 @@ var ROLES_BY_PERMISSION = {
19750
19782
  [OrgPermission.MEMBERS_ARCHIVE]: ["Admin", "Owner"],
19751
19783
  [OrgPermission.MEMBERS_DEMOTE_ADMIN]: ["Owner"],
19752
19784
  [OrgPermission.MEMBERS_TRANSFER_OWNERSHIP]: ["Owner"],
19785
+ [OrgPermission.TEAMS_MANAGE]: ["Admin", "Owner"],
19753
19786
  [OrgPermission.ORG_MANAGE_OAUTH_CONNECTIONS]: ["Admin", "Owner"],
19754
19787
  [OrgPermission.ORG_MANAGE_NOTIFICATION_CHANNELS]: ["Admin", "Owner"],
19755
19788
  [OrgPermission.ORG_MANAGE_EGRESS_POLICY]: ["Admin", "Owner"],
19756
19789
  [OrgPermission.ORG_MANAGE_MODELS]: ["Admin", "Owner"],
19757
19790
  [OrgPermission.ORG_MANAGE_PLATFORM_SERVICES]: ["Admin", "Owner"],
19758
19791
  [OrgPermission.CRM_CONFIGURE_WATERFALLS]: ["Admin", "Owner"],
19792
+ [OrgPermission.CRM_ACCESS_ALL_RECORDS]: ["Admin", "Owner"],
19759
19793
  [OrgPermission.MEMORY_MODIFY]: ["Admin", "Owner"],
19760
19794
  [OrgPermission.INSTANCE_OPERATE]: ["InstanceOperator"],
19761
19795
  [OrgPermission.ORG_SECURITY_ACCESS]: ["Admin", "Owner"],
@@ -19768,17 +19802,25 @@ var ROLES_BY_PERMISSION = {
19768
19802
  [OrgPermission.VIEW_ANY_SKILL]: ["Admin", "Owner"],
19769
19803
  [OrgPermission.MEMBERS_TRANSFER_RESOURCES]: ["Admin", "Owner"]
19770
19804
  };
19771
- var WORKFLOW_PERMISSION_ROLE_FLOOR = {
19772
- [OrgPermission.EDIT_ANY_WORKFLOW]: "editor"
19773
- };
19805
+ var ORG_PERMISSION_VALUES = Object.values(OrgPermission);
19806
+ var OWNER_OR_INSTANCE_PERMISSIONS = /* @__PURE__ */ new Set([
19807
+ OrgPermission.ORG_DELETE,
19808
+ OrgPermission.MEMBERS_TRANSFER_OWNERSHIP,
19809
+ OrgPermission.MEMBERS_DEMOTE_ADMIN,
19810
+ OrgPermission.INSTANCE_OPERATE
19811
+ ]);
19812
+ var ASSIGNABLE_ORG_PERMISSIONS = ORG_PERMISSION_VALUES.filter((permission) => !OWNER_OR_INSTANCE_PERMISSIONS.has(permission));
19813
+ function baseRolePermissions(roles) {
19814
+ return ORG_PERMISSION_VALUES.filter((permission) => roles.some((role) => ROLES_BY_PERMISSION[permission].includes(role)));
19815
+ }
19774
19816
 
19775
19817
  // ../../packages/api/dist/types/workspaceModelPolicy.js
19776
- import { z as z10 } from "zod";
19777
- var WorkspaceModelManagerSchema = z10.enum([
19818
+ import { z as z11 } from "zod";
19819
+ var WorkspaceModelManagerSchema = z11.enum([
19778
19820
  "workspace",
19779
19821
  "instance-operators"
19780
19822
  ]);
19781
- var AgentModelChoiceSchema = z10.enum(["any", "auto-only"]);
19823
+ var AgentModelChoiceSchema = z11.enum(["any", "auto-only"]);
19782
19824
  var DEFAULT_WORKSPACE_MODEL_POLICY = {
19783
19825
  managedBy: "workspace",
19784
19826
  agentModelChoice: "any"
@@ -19936,6 +19978,13 @@ function workspaceDepartureOwnedKindsQuery() {
19936
19978
  return WORKSPACE_DEPARTURE_OWNED_KINDS.join(",");
19937
19979
  }
19938
19980
 
19981
+ // ../../packages/api/dist/types/legacyCreditsShown.js
19982
+ function fillLegacyCreditsShown(value) {
19983
+ if ("billingEnabled" in value && !("shouldShowCredits" in value)) {
19984
+ Reflect.set(value, "shouldShowCredits", true);
19985
+ }
19986
+ }
19987
+
19939
19988
  // ../../packages/api/dist/types/legacyOnboardingFirstSpecialist.js
19940
19989
  function fillLegacyOnboardingFirstSpecialist(state) {
19941
19990
  if (!("stage" in state) || !("stages" in state))
@@ -20091,6 +20140,31 @@ function fillLegacyWorkspaceModelPolicy(value) {
20091
20140
  }
20092
20141
  }
20093
20142
 
20143
+ // ../../packages/api/dist/types/legacyWorkspacePermissions.js
20144
+ function rolesOf(value) {
20145
+ if ("roles" in value && Array.isArray(value.roles)) {
20146
+ return value.roles.flatMap((role) => {
20147
+ const parsed = UserRoleSchema.safeParse(role);
20148
+ return parsed.success ? [parsed.data] : [];
20149
+ });
20150
+ }
20151
+ if ("role" in value && typeof value.role === "string") {
20152
+ return parseRoles(value.role);
20153
+ }
20154
+ return null;
20155
+ }
20156
+ function fillLegacyWorkspacePermissions(value) {
20157
+ const isMembership = "modelDefaults" in value && "organizationId" in value;
20158
+ const isActiveWorkspace = "onboardingStage" in value && "membershipId" in value;
20159
+ if (!isMembership && !isActiveWorkspace)
20160
+ return;
20161
+ if ("permissions" in value)
20162
+ return;
20163
+ const roles = rolesOf(value);
20164
+ if (roles)
20165
+ Reflect.set(value, "permissions", baseRolePermissions(roles));
20166
+ }
20167
+
20094
20168
  // ../../packages/api/dist/types/legacyHostedTunnelShareBlocker.js
20095
20169
  function fillLegacyHostedTunnelShareBlocker(value) {
20096
20170
  const isShareListWorkspace = "isShared" in value && "organizationId" in value && "organizationProfilePictureUrl" in value;
@@ -20178,6 +20252,33 @@ function fillLegacyMemberNames(value) {
20178
20252
  }
20179
20253
  }
20180
20254
 
20255
+ // ../../packages/api/dist/types/legacyMemberTeams.js
20256
+ function fillLegacyMemberTeams(value) {
20257
+ const isMember = "memberRoles" in value && "membershipId" in value;
20258
+ if (isMember && !("teams" in value))
20259
+ Reflect.set(value, "teams", []);
20260
+ }
20261
+
20262
+ // ../../packages/api/dist/types/legacyCrmRecordAccess.js
20263
+ function fillLegacyCrmRecordAccess(value) {
20264
+ if ("access" in value)
20265
+ return;
20266
+ const isPersonDetail = "person" in value && "employments" in value && "contactPoints" in value;
20267
+ const isCompanyDetail = "company" in value && "peopleCount" in value && "tags" in value;
20268
+ const isDeal = "pipelineId" in value && "boardPosition" in value && "staleness" in value;
20269
+ if (!isPersonDetail && !isCompanyDetail && !isDeal)
20270
+ return;
20271
+ const owner = (field) => isDeal ? Reflect.get(value, field) ?? null : null;
20272
+ Reflect.set(value, "access", {
20273
+ ownerMembershipId: owner("ownerMembershipId"),
20274
+ ownerName: owner("ownerName"),
20275
+ teamId: null,
20276
+ teamName: null,
20277
+ visibility: "workspace",
20278
+ canManage: false
20279
+ });
20280
+ }
20281
+
20181
20282
  // ../../packages/api/dist/types/legacyGettingStartedShown.js
20182
20283
  function fillLegacyGettingStartedShown(value) {
20183
20284
  if ("steps" in value && "completedCount" in value && "totalCount" in value && !("isShown" in value) && typeof value.completedCount === "number" && typeof value.totalCount === "number") {
@@ -20205,6 +20306,7 @@ var LEGACY_FILLS = [
20205
20306
  fillLegacyCredentialOutage,
20206
20307
  fillLegacyCredentialConnection,
20207
20308
  fillLegacyWorkspaceModelPolicy,
20309
+ fillLegacyWorkspacePermissions,
20208
20310
  fillLegacyHostedTunnelShareBlocker,
20209
20311
  fillLegacyDesignCounts,
20210
20312
  fillLegacySearchRecentDesigns,
@@ -20213,8 +20315,11 @@ var LEGACY_FILLS = [
20213
20315
  fillLegacyDesignVideo,
20214
20316
  fillLegacySpecialistFolders,
20215
20317
  fillLegacyMemberNames,
20318
+ fillLegacyMemberTeams,
20319
+ fillLegacyCrmRecordAccess,
20216
20320
  fillLegacyGettingStartedShown,
20217
- fillLegacySpecialistConversationSnoozes
20321
+ fillLegacySpecialistConversationSnoozes,
20322
+ fillLegacyCreditsShown
20218
20323
  ];
20219
20324
  function fillLegacyApiFields(value) {
20220
20325
  if (Array.isArray(value)) {
@@ -20242,7 +20347,7 @@ var SPECIALIST_TEMPLATE_SCOPES = [
20242
20347
  ];
20243
20348
 
20244
20349
  // ../../packages/api/dist/types/organizationCustomIntegration.js
20245
- import { z as z11 } from "zod";
20350
+ import { z as z12 } from "zod";
20246
20351
  var CUSTOM_API_AUTHORING_ACTIONS = defineCustomApiAuthoringActions({
20247
20352
  list: {
20248
20353
  toolId: "list_custom_apis",
@@ -20283,45 +20388,45 @@ var TOOL_ID_UPSERT_CUSTOM_API_OPERATION = CUSTOM_API_AUTHORING_ACTIONS.upsertOpe
20283
20388
  var TOOL_ID_DELETE_CUSTOM_API_OPERATION = CUSTOM_API_AUTHORING_ACTIONS.deleteOperation.toolId;
20284
20389
  var TOOL_ID_SET_CUSTOM_API_STATUS = CUSTOM_API_AUTHORING_ACTIONS.setStatus.toolId;
20285
20390
  var DEFAULT_CUSTOM_INTEGRATION_ICON_URL = "/icons/custom-api.svg";
20286
- var CustomIntegrationIconUrlSchema = z11.string().refine((value) => {
20391
+ var CustomIntegrationIconUrlSchema = z12.string().refine((value) => {
20287
20392
  if (value === DEFAULT_CUSTOM_INTEGRATION_ICON_URL)
20288
20393
  return true;
20289
- const parsed = z11.url().safeParse(value);
20394
+ const parsed = z12.url().safeParse(value);
20290
20395
  if (!parsed.success)
20291
20396
  return false;
20292
20397
  const protocol = new URL(value).protocol;
20293
20398
  return protocol === "http:" || protocol === "https:";
20294
20399
  }, "Icon URL must be the stock icon path or use HTTP or HTTPS");
20295
- var CustomIntegrationSecretFieldSchema = z11.object({
20296
- key: z11.string().regex(/^[A-Za-z][A-Za-z0-9]*$/).describe("Camel-case credential field key, e.g. apiKey"),
20297
- label: z11.string().trim().min(1).describe("Label shown in the credential form"),
20298
- description: z11.string().trim().min(1).optional().describe("Optional guidance about where to find the value"),
20299
- secret: z11.boolean().describe("Whether the value is masked and scrubbed")
20400
+ var CustomIntegrationSecretFieldSchema = z12.object({
20401
+ key: z12.string().regex(/^[A-Za-z][A-Za-z0-9]*$/).describe("Camel-case credential field key, e.g. apiKey"),
20402
+ label: z12.string().trim().min(1).describe("Label shown in the credential form"),
20403
+ description: z12.string().trim().min(1).optional().describe("Optional guidance about where to find the value"),
20404
+ secret: z12.boolean().describe("Whether the value is masked and scrubbed")
20300
20405
  });
20301
- var CreateCustomApiDraftRequestSchema = z11.object({
20302
- title: z11.string().trim().min(1),
20303
- description: z11.string().trim().min(1),
20406
+ var CreateCustomApiDraftRequestSchema = z12.object({
20407
+ title: z12.string().trim().min(1),
20408
+ description: z12.string().trim().min(1),
20304
20409
  iconUrl: CustomIntegrationIconUrlSchema.optional()
20305
20410
  });
20306
- var PatchOrganizationCustomIntegrationRequestSchema = z11.object({
20307
- title: z11.string().trim().min(1).optional(),
20308
- description: z11.string().trim().min(1).optional(),
20411
+ var PatchOrganizationCustomIntegrationRequestSchema = z12.object({
20412
+ title: z12.string().trim().min(1).optional(),
20413
+ description: z12.string().trim().min(1).optional(),
20309
20414
  iconUrl: CustomIntegrationIconUrlSchema.optional(),
20310
- credentialType: z11.enum(["apiKey", "noAuth"]).optional(),
20311
- secretFields: z11.array(CustomIntegrationSecretFieldSchema).optional(),
20312
- commonDocs: z11.string().nullable().optional(),
20313
- setupGuide: z11.string().nullable().optional()
20415
+ credentialType: z12.enum(["apiKey", "noAuth"]).optional(),
20416
+ secretFields: z12.array(CustomIntegrationSecretFieldSchema).optional(),
20417
+ commonDocs: z12.string().nullable().optional(),
20418
+ setupGuide: z12.string().nullable().optional()
20314
20419
  }).refine(hasCustomIntegrationDefinitionPatch, {
20315
20420
  message: "At least one field is required"
20316
20421
  });
20317
- var SetCustomIntegrationStatusRequestSchema = z11.object({
20318
- status: z11.enum(["draft", "live"])
20422
+ var SetCustomIntegrationStatusRequestSchema = z12.object({
20423
+ status: z12.enum(["draft", "live"])
20319
20424
  });
20320
- var UpsertCustomIntegrationOperationRequestSchema = z11.object({
20321
- operationId: z11.string().min(1).optional(),
20322
- title: z11.string().trim().min(1).optional(),
20323
- description: z11.string().trim().min(1).optional(),
20324
- documentation: z11.string().trim().min(1).optional()
20425
+ var UpsertCustomIntegrationOperationRequestSchema = z12.object({
20426
+ operationId: z12.string().min(1).optional(),
20427
+ title: z12.string().trim().min(1).optional(),
20428
+ description: z12.string().trim().min(1).optional(),
20429
+ documentation: z12.string().trim().min(1).optional()
20325
20430
  }).superRefine((value, context) => {
20326
20431
  if (value.operationId) {
20327
20432
  if (!value.title && !value.description && !value.documentation) {
@@ -20358,28 +20463,28 @@ function defineCustomApiAuthoringActions(actions) {
20358
20463
  }
20359
20464
 
20360
20465
  // ../../packages/api/dist/types/cli/resourceOperations.js
20361
- import { z as z12 } from "zod";
20362
- var FilterPreviewRequestSchema = z12.object({
20363
- triggerPayload: z12.record(z12.string(), z12.unknown()).optional(),
20364
- triggerKey: z12.string().min(1).optional(),
20365
- bundleKey: z12.string().min(1).max(1024).optional()
20466
+ import { z as z13 } from "zod";
20467
+ var FilterPreviewRequestSchema = z13.object({
20468
+ triggerPayload: z13.record(z13.string(), z13.unknown()).optional(),
20469
+ triggerKey: z13.string().min(1).optional(),
20470
+ bundleKey: z13.string().min(1).max(1024).optional()
20366
20471
  });
20367
- var AppScreenshotsRequestSchema = z12.object({
20368
- routes: z12.array(z12.string().min(1).max(2048)).min(1).max(6).default(["/"]),
20369
- viewport: z12.enum(["mobile", "desktop", "both"]).default("both")
20472
+ var AppScreenshotsRequestSchema = z13.object({
20473
+ routes: z13.array(z13.string().min(1).max(2048)).min(1).max(6).default(["/"]),
20474
+ viewport: z13.enum(["mobile", "desktop", "both"]).default("both")
20370
20475
  });
20371
- var TriggerActivityRequestSchema = z12.object({
20372
- limit: z12.coerce.number().int().min(1).max(100).default(20),
20373
- cursor: z12.string().optional(),
20374
- search: z12.string().optional()
20476
+ var TriggerActivityRequestSchema = z13.object({
20477
+ limit: z13.coerce.number().int().min(1).max(100).default(20),
20478
+ cursor: z13.string().optional(),
20479
+ search: z13.string().optional()
20375
20480
  });
20376
- var TriggerSyncRequestSchema = z12.object({
20377
- triggerId: z12.string().min(1).optional()
20481
+ var TriggerSyncRequestSchema = z13.object({
20482
+ triggerId: z13.string().min(1).optional()
20378
20483
  });
20379
- var TriggerReplayRequestSchema = z12.object({
20380
- itemId: z12.string().min(1),
20381
- kind: z12.enum(["execution", "poll_item"]),
20382
- triggerKey: z12.string().min(1).optional()
20484
+ var TriggerReplayRequestSchema = z13.object({
20485
+ itemId: z13.string().min(1),
20486
+ kind: z13.enum(["execution", "poll_item"]),
20487
+ triggerKey: z13.string().min(1).optional()
20383
20488
  });
20384
20489
 
20385
20490
  // ../../packages/api/dist/clients/v1/V1AuthApiClient.js
@@ -20679,19 +20784,6 @@ var V1HttpClient = class {
20679
20784
  read: async (response) => new Uint8Array(await response.arrayBuffer())
20680
20785
  });
20681
20786
  }
20682
- async sendBinary(path, options) {
20683
- return this.request({
20684
- path,
20685
- timeoutMs: options.timeoutMs,
20686
- init: {
20687
- method: options.method,
20688
- headers: { "Content-Type": options.contentType },
20689
- body: new Uint8Array(options.body),
20690
- signal: options.signal
20691
- },
20692
- read: (response) => response.json()
20693
- });
20694
- }
20695
20787
  get isAuthed() {
20696
20788
  return this.args.getAccessToken() !== null;
20697
20789
  }
@@ -20892,7 +20984,6 @@ var V1OperationsApiClient = class {
20892
20984
  };
20893
20985
 
20894
20986
  // ../../packages/api/dist/clients/v1/V1ProjectsApiClient.js
20895
- var BUNDLE_CONTENT_TYPE = "application/gzip";
20896
20987
  var FILE_UPLOAD_COMMIT_TIMEOUT_MS = 12e4;
20897
20988
  var V1ProjectsApiClient = class {
20898
20989
  http;
@@ -20973,16 +21064,6 @@ var V1ProjectsApiClient = class {
20973
21064
  this.http.requireAuthed();
20974
21065
  return this.http.fetch(`/v1/projects/${encodeURIComponent(args.projectId)}/files/link?path=${encodeURIComponent(args.path)}`, { signal: args.signal });
20975
21066
  }
20976
- /** Every project file as one gzipped tar. */
20977
- async downloadFilesBundle(id) {
20978
- this.http.requireAuthed();
20979
- return this.http.fetchBinary(`/v1/projects/${encodeURIComponent(id)}/files/bundle`);
20980
- }
20981
- /** Add or replace the paths the bundle carries; other files stay put. */
20982
- async uploadFilesBundle(id, bundle) {
20983
- this.http.requireAuthed();
20984
- return this.http.sendBinary(`/v1/projects/${encodeURIComponent(id)}/files/bundle`, { method: "POST", body: bundle, contentType: BUNDLE_CONTENT_TYPE });
20985
- }
20986
21067
  async deleteFile(id, path) {
20987
21068
  this.http.requireAuthed();
20988
21069
  return this.http.fetch(`/v1/projects/${encodeURIComponent(id)}/files?path=${encodeURIComponent(path)}`, { method: "DELETE" });
@@ -21001,7 +21082,11 @@ var V1ProjectsApiClient = class {
21001
21082
  this.http.requireAuthed();
21002
21083
  return this.http.fetch(`/v1/projects/${encodeURIComponent(args.projectId)}/files/uploads/${encodeURIComponent(args.uploadId)}`, {
21003
21084
  method: "POST",
21004
- body: { folderPath: args.folderPath, name: args.name },
21085
+ body: {
21086
+ folderPath: args.folderPath,
21087
+ name: args.name,
21088
+ onNameTaken: args.onNameTaken
21089
+ },
21005
21090
  signal: args.signal,
21006
21091
  timeoutMs: FILE_UPLOAD_COMMIT_TIMEOUT_MS
21007
21092
  });
@@ -21147,10 +21232,10 @@ var V1SkillsApiClient = class {
21147
21232
  this.http.requireAuthed();
21148
21233
  return this.http.fetch(`/v1/skills/${encodeURIComponent(id)}`);
21149
21234
  }
21150
- /** Presigned GET for the live bundle (pull). */
21151
- async bundleUrl(id) {
21235
+ /** Links to the live files (pull). */
21236
+ async treeUrl(id) {
21152
21237
  this.http.requireAuthed();
21153
- return this.http.fetch(`/v1/skills/${encodeURIComponent(id)}/bundle-url`);
21238
+ return this.http.fetch(`/v1/skills/${encodeURIComponent(id)}/tree-url`);
21154
21239
  }
21155
21240
  /** Presigned PUT + staged `bundleKey` for a push bundle (validate/publish). */
21156
21241
  async bundleUploadUrl(id) {
@@ -21222,9 +21307,9 @@ var V1WorkflowsApiClient = class {
21222
21307
  body
21223
21308
  });
21224
21309
  }
21225
- async bundleUrl(id) {
21310
+ async treeUrl(id) {
21226
21311
  this.http.requireAuthed();
21227
- return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/bundle-url`);
21312
+ return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/tree-url`);
21228
21313
  }
21229
21314
  async bundleUploadUrl(id) {
21230
21315
  this.http.requireAuthed();
@@ -21519,6 +21604,10 @@ var V1WorkspacesApiClient = class {
21519
21604
  this.http.requireAuthed();
21520
21605
  return this.http.fetch("/v1/workspaces");
21521
21606
  }
21607
+ async teams() {
21608
+ this.http.requireAuthed();
21609
+ return this.http.fetch("/v1/workspaces/teams");
21610
+ }
21522
21611
  async members(args) {
21523
21612
  this.http.requireAuthed();
21524
21613
  const params = new URLSearchParams();
@@ -21587,7 +21676,19 @@ var V1SharingApiClient = class {
21587
21676
  }
21588
21677
  async inspect(kind, id) {
21589
21678
  this.http.requireAuthed();
21590
- return this.http.fetch(`${subjectPath(kind, id)}/sharing`);
21679
+ const [direct, teamGrants] = await Promise.all([
21680
+ this.http.fetch(`${subjectPath(kind, id)}/sharing`),
21681
+ this.http.fetch(`${teamGrantsPath(kind, id)}`)
21682
+ ]);
21683
+ return {
21684
+ ...direct,
21685
+ teams: teamGrants.teamGrants.map((grant) => ({
21686
+ teamId: grant.team.id,
21687
+ name: grant.team.name,
21688
+ memberCount: grant.team.memberCount,
21689
+ role: grant.role
21690
+ }))
21691
+ };
21591
21692
  }
21592
21693
  async grant(args) {
21593
21694
  this.http.requireAuthed();
@@ -21601,24 +21702,31 @@ var V1SharingApiClient = class {
21601
21702
  throw new Error(`Role ${args.role} is not offered on ${noun.plural}; use ${collaboratorRoles.join(" or ")}.`);
21602
21703
  }
21603
21704
  const path = subjectPath(args.kind, args.id);
21604
- if (args.audience.type === "organization") {
21605
- await this.http.fetch(`${path}/org-grant`, {
21606
- method: "PUT",
21607
- body: { role: args.role }
21608
- });
21609
- } else {
21610
- await this.http.fetch(`${path}/collaborators`, {
21611
- method: "POST",
21612
- body: { membershipId: args.audience.membershipId, role: args.role }
21613
- });
21705
+ switch (args.audience.type) {
21706
+ case "organization":
21707
+ await this.http.fetch(`${path}/org-grant`, {
21708
+ method: "PUT",
21709
+ body: { role: args.role }
21710
+ });
21711
+ return;
21712
+ case "member":
21713
+ await this.http.fetch(`${path}/collaborators`, {
21714
+ method: "POST",
21715
+ body: { membershipId: args.audience.membershipId, role: args.role }
21716
+ });
21717
+ return;
21718
+ case "team":
21719
+ await this.http.fetch(`${teamGrantsPath(args.kind, args.id)}/${encodeURIComponent(args.audience.teamId)}`, { method: "PUT", body: { role: args.role } });
21720
+ return;
21721
+ default: {
21722
+ const exhaustive = args.audience;
21723
+ throw new Error(`Unknown audience ${JSON.stringify(exhaustive)}`);
21724
+ }
21614
21725
  }
21615
21726
  }
21616
21727
  async revoke(args) {
21617
21728
  this.http.requireAuthed();
21618
- const suffix = args.audience.type === "organization" ? "org-grant" : `collaborators/${encodeURIComponent(args.audience.membershipId)}`;
21619
- await this.http.fetch(`${subjectPath(args.kind, args.id)}/${suffix}`, {
21620
- method: "DELETE"
21621
- });
21729
+ await this.http.fetch(revokePath(args), { method: "DELETE" });
21622
21730
  }
21623
21731
  };
21624
21732
  var OTHER_SHARING_PATHS = {
@@ -21630,6 +21738,31 @@ function subjectPath(kind, id) {
21630
21738
  const path = isWorkflowTypeKind(kind) ? "workflows" : OTHER_SHARING_PATHS[kind];
21631
21739
  return `/v1/${path}/${encodeURIComponent(id)}`;
21632
21740
  }
21741
+ var OTHER_GRANT_TYPES = {
21742
+ specialist: "project",
21743
+ skill: "skill",
21744
+ credential: "credential"
21745
+ };
21746
+ function sharingGrantResourceType(kind) {
21747
+ return isWorkflowTypeKind(kind) ? "workflow" : OTHER_GRANT_TYPES[kind];
21748
+ }
21749
+ function teamGrantsPath(kind, id) {
21750
+ return `/v1/resource-grants/${sharingGrantResourceType(kind)}/${encodeURIComponent(id)}/teams`;
21751
+ }
21752
+ function revokePath(args) {
21753
+ switch (args.audience.type) {
21754
+ case "organization":
21755
+ return `${subjectPath(args.kind, args.id)}/org-grant`;
21756
+ case "member":
21757
+ return `${subjectPath(args.kind, args.id)}/collaborators/${encodeURIComponent(args.audience.membershipId)}`;
21758
+ case "team":
21759
+ return `${teamGrantsPath(args.kind, args.id)}/${encodeURIComponent(args.audience.teamId)}`;
21760
+ default: {
21761
+ const exhaustive = args.audience;
21762
+ throw new Error(`Unknown audience ${JSON.stringify(exhaustive)}`);
21763
+ }
21764
+ }
21765
+ }
21633
21766
 
21634
21767
  // src/lib/output.ts
21635
21768
  import chalk from "chalk";
@@ -21963,9 +22096,256 @@ function sleep(ms) {
21963
22096
  }
21964
22097
 
21965
22098
  // src/lib/bundleArchive.ts
21966
- import { mkdirSync as mkdirSync2 } from "fs";
22099
+ import { randomUUID } from "crypto";
22100
+ import {
22101
+ lstatSync,
22102
+ mkdirSync as mkdirSync2,
22103
+ readFileSync as readFileSync2,
22104
+ renameSync,
22105
+ rmSync,
22106
+ writeFileSync as writeFileSync2
22107
+ } from "fs";
22108
+ import { dirname, join as join2 } from "path";
21967
22109
  import { Readable } from "stream";
21968
- import { create, extract } from "tar";
22110
+
22111
+ // ../../packages/bundler/dist/archiveLimits.js
22112
+ var MIB = 1024 * 1024;
22113
+ var UNTRUSTED_ARCHIVE_LIMITS = {
22114
+ maxBytes: 512 * MIB,
22115
+ maxEntries: 5e4
22116
+ };
22117
+ var STORED_ARCHIVE_LIMITS = {
22118
+ maxBytes: 1024 * MIB,
22119
+ maxEntries: 2e5
22120
+ };
22121
+ function isUnsafeArchivePath(path) {
22122
+ if (path.startsWith("/") || path.includes("\\"))
22123
+ return true;
22124
+ return path.split("/").some((segment) => segment === ".." || segment === "." || segment === "");
22125
+ }
22126
+ function leavesItsFolder(path) {
22127
+ if (path.startsWith("/") || path.includes("\\"))
22128
+ return true;
22129
+ return path.split("/").includes("..");
22130
+ }
22131
+ var EXPANSION_BUDGET_BYTES = 1536 * MIB;
22132
+ var EXPANSION_WAIT_MS = 3e4;
22133
+ var ArchiveBusyError = class extends Error {
22134
+ constructor() {
22135
+ super("Too many archives are being unpacked; try again shortly");
22136
+ this.name = "ArchiveBusyError";
22137
+ }
22138
+ };
22139
+ var ExpansionBudget = class {
22140
+ reserved = 0;
22141
+ waiting = [];
22142
+ async reserve(bytes) {
22143
+ if (this.waiting.length > 0 || !this.hasRoom(bytes)) {
22144
+ await this.waitFor(bytes);
22145
+ } else {
22146
+ this.reserved += bytes;
22147
+ }
22148
+ let isReleased = false;
22149
+ return () => {
22150
+ if (isReleased)
22151
+ return;
22152
+ isReleased = true;
22153
+ this.reserved -= bytes;
22154
+ this.admitWaiting();
22155
+ };
22156
+ }
22157
+ hasRoom(bytes) {
22158
+ return this.reserved === 0 || this.reserved + bytes <= EXPANSION_BUDGET_BYTES;
22159
+ }
22160
+ async waitFor(bytes) {
22161
+ await new Promise((resolve32, reject) => {
22162
+ const expansion = {
22163
+ bytes,
22164
+ admit: () => {
22165
+ clearTimeout(timer);
22166
+ resolve32();
22167
+ }
22168
+ };
22169
+ const timer = setTimeout(() => {
22170
+ this.waiting.splice(this.waiting.indexOf(expansion), 1);
22171
+ this.admitWaiting();
22172
+ reject(new ArchiveBusyError());
22173
+ }, EXPANSION_WAIT_MS);
22174
+ this.waiting.push(expansion);
22175
+ });
22176
+ }
22177
+ admitWaiting() {
22178
+ for (; ; ) {
22179
+ const next = this.waiting[0];
22180
+ if (!next || !this.hasRoom(next.bytes))
22181
+ return;
22182
+ this.waiting.shift();
22183
+ this.reserved += next.bytes;
22184
+ next.admit();
22185
+ }
22186
+ }
22187
+ };
22188
+ var archiveExpansionBudget = new ExpansionBudget();
22189
+
22190
+ // ../../packages/bundler/dist/workspaceCas.js
22191
+ import crypto from "crypto";
22192
+ var CAS_PACK_THRESHOLD_BYTES = 1024 * 1024;
22193
+ function hashWorkspaceContent(content) {
22194
+ const buffer = typeof content === "string" ? Buffer.from(content, "utf-8") : content;
22195
+ return crypto.createHash("sha256").update(buffer).digest("hex");
22196
+ }
22197
+
22198
+ // ../../packages/bundler/dist/resourceTree.js
22199
+ var RESOURCE_TREE_FORMAT = "gi-tree/1";
22200
+ var MAX_PACK_BYTES = 32 * 1024 * 1024;
22201
+ var HASH_YIELD_BYTES = 16 * 1024 * 1024;
22202
+ var RANGE_MERGE_GAP_BYTES = 256 * 1024;
22203
+ var SHA256_HEX = /^[0-9a-f]{64}$/;
22204
+ var LINKED_READ_CONCURRENCY = 8;
22205
+ var ResourceTreeFetchError = class extends Error {
22206
+ constructor(status) {
22207
+ super(`Failed to fetch files (${status})`);
22208
+ this.name = "ResourceTreeFetchError";
22209
+ }
22210
+ };
22211
+ var ResourceTreeCorruptError = class extends Error {
22212
+ constructor(message) {
22213
+ super(message);
22214
+ this.name = "ResourceTreeCorruptError";
22215
+ }
22216
+ };
22217
+ function compareCodePoints(a, b) {
22218
+ if (a === b)
22219
+ return 0;
22220
+ return a < b ? -1 : 1;
22221
+ }
22222
+ function packResourceTree(args) {
22223
+ let offset = 0;
22224
+ const chunks = [];
22225
+ const entries = [];
22226
+ for (const path of [...args.files.keys()].sort(compareCodePoints)) {
22227
+ const content = args.files.get(path);
22228
+ if (content === void 0)
22229
+ continue;
22230
+ entries.push({
22231
+ path,
22232
+ hash: hashWorkspaceContent(content),
22233
+ size: content.length,
22234
+ object: args.object,
22235
+ offset
22236
+ });
22237
+ chunks.push(content);
22238
+ offset += content.length;
22239
+ }
22240
+ return {
22241
+ manifest: { format: RESOURCE_TREE_FORMAT, entries },
22242
+ content: Buffer.concat(chunks)
22243
+ };
22244
+ }
22245
+ function serializeResourceTreeManifest(manifest) {
22246
+ return Buffer.from(JSON.stringify(manifest), "utf-8");
22247
+ }
22248
+ function isByteCount(value) {
22249
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
22250
+ }
22251
+ function isTreeEntry(value) {
22252
+ return typeof value === "object" && value !== null && "path" in value && typeof value.path === "string" && value.path.length > 0 && "hash" in value && typeof value.hash === "string" && SHA256_HEX.test(value.hash) && "size" in value && isByteCount(value.size) && "object" in value && typeof value.object === "string" && SHA256_HEX.test(value.object) && "offset" in value && isByteCount(value.offset);
22253
+ }
22254
+ function parseResourceTreeManifest(serialized) {
22255
+ const parsed = JSON.parse(serialized.toString("utf-8"));
22256
+ if (typeof parsed !== "object" || parsed === null || !("format" in parsed) || parsed.format !== RESOURCE_TREE_FORMAT || !("entries" in parsed) || !Array.isArray(parsed.entries)) {
22257
+ throw new ResourceTreeCorruptError("Not a resource tree manifest");
22258
+ }
22259
+ const entries = [];
22260
+ for (const entry of parsed.entries) {
22261
+ if (!isTreeEntry(entry)) {
22262
+ throw new ResourceTreeCorruptError("Resource tree entry is malformed");
22263
+ }
22264
+ entries.push(entry);
22265
+ }
22266
+ return { format: RESOURCE_TREE_FORMAT, entries };
22267
+ }
22268
+ function planResourceTreeRanges(entries) {
22269
+ const byObject = /* @__PURE__ */ new Map();
22270
+ for (const entry of entries) {
22271
+ if (entry.size === 0)
22272
+ continue;
22273
+ const inObject = byObject.get(entry.object);
22274
+ if (inObject)
22275
+ inObject.push(entry);
22276
+ else
22277
+ byObject.set(entry.object, [entry]);
22278
+ }
22279
+ const ranges = [];
22280
+ for (const [object, inObject] of byObject) {
22281
+ inObject.sort((a, b) => a.offset - b.offset);
22282
+ let current = null;
22283
+ for (const entry of inObject) {
22284
+ const end = current ? current.offset + current.length : 0;
22285
+ if (current && entry.offset - end <= RANGE_MERGE_GAP_BYTES) {
22286
+ current.length = Math.max(current.length, entry.offset + entry.size - current.offset);
22287
+ current.entries.push(entry);
22288
+ continue;
22289
+ }
22290
+ current = {
22291
+ object,
22292
+ offset: entry.offset,
22293
+ length: entry.size,
22294
+ entries: [entry]
22295
+ };
22296
+ ranges.push(current);
22297
+ }
22298
+ }
22299
+ return ranges;
22300
+ }
22301
+ function sliceResourceTreeEntry(args) {
22302
+ const start = args.entry.offset - args.range.offset;
22303
+ const content = args.bytes.subarray(start, start + args.entry.size);
22304
+ if (content.length !== args.entry.size || hashWorkspaceContent(content) !== args.entry.hash) {
22305
+ throw new ResourceTreeCorruptError(`Stored bytes for ${args.entry.path} do not match the manifest`);
22306
+ }
22307
+ return content;
22308
+ }
22309
+ async function fetchLinked(args) {
22310
+ const response = await fetch(args.url, { headers: args.headers });
22311
+ if (!response.ok)
22312
+ throw new ResourceTreeFetchError(response.status);
22313
+ return Buffer.from(await response.arrayBuffer());
22314
+ }
22315
+ async function fetchResourceTree(args) {
22316
+ const manifest = parseResourceTreeManifest(await fetchLinked({ url: args.tree.manifestUrl, headers: {} }));
22317
+ const wanted = manifest.entries.filter((entry) => args.isWanted(entry.path));
22318
+ const files = /* @__PURE__ */ new Map();
22319
+ for (const entry of wanted) {
22320
+ if (leavesItsFolder(entry.path)) {
22321
+ throw new ResourceTreeCorruptError(`Unsafe path: ${entry.path}`);
22322
+ }
22323
+ if (entry.size === 0)
22324
+ files.set(entry.path, Buffer.alloc(0));
22325
+ }
22326
+ const ranges = planResourceTreeRanges(wanted);
22327
+ const readNext = async () => {
22328
+ for (let range = ranges.pop(); range; range = ranges.pop()) {
22329
+ const url = args.tree.objectUrls[range.object];
22330
+ if (!url)
22331
+ throw new ResourceTreeCorruptError(`No link for ${range.object}`);
22332
+ const bytes = await fetchLinked({
22333
+ url,
22334
+ headers: {
22335
+ range: `bytes=${range.offset}-${range.offset + range.length - 1}`
22336
+ }
22337
+ });
22338
+ for (const entry of range.entries) {
22339
+ files.set(entry.path, sliceResourceTreeEntry({ range, bytes, entry }));
22340
+ }
22341
+ }
22342
+ };
22343
+ await Promise.all(Array.from({ length: LINKED_READ_CONCURRENCY }, readNext));
22344
+ return files;
22345
+ }
22346
+
22347
+ // src/lib/bundleArchive.ts
22348
+ import { extract } from "tar";
21969
22349
 
21970
22350
  // src/lib/resourceFiles.ts
21971
22351
  import {
@@ -22070,15 +22450,6 @@ function dirHasResourceFiles(dir) {
22070
22450
  }
22071
22451
 
22072
22452
  // src/lib/bundleArchive.ts
22073
- async function packResourceDir(dir) {
22074
- const files = listResourceRelPaths(dir);
22075
- const stream = create({ gzip: true, cwd: dir, portable: true }, files);
22076
- const chunks = [];
22077
- for await (const chunk of stream) {
22078
- chunks.push(Buffer.from(chunk));
22079
- }
22080
- return Buffer.concat(chunks);
22081
- }
22082
22453
  async function extractBundle(dir, buffer) {
22083
22454
  mkdirSync2(dir, { recursive: true });
22084
22455
  await new Promise((resolve32, reject) => {
@@ -22091,26 +22462,86 @@ async function extractBundle(dir, buffer) {
22091
22462
  Readable.from(buffer).on("error", reject).pipe(unpack);
22092
22463
  });
22093
22464
  }
22094
- async function uploadResourceBundle(args) {
22095
- const buffer = await packResourceDir(args.dir);
22096
- const response = await fetch(args.uploadUrl, {
22465
+ async function putBytes(args) {
22466
+ const response = await fetch(args.url, {
22097
22467
  method: "PUT",
22098
22468
  headers: { "Content-Type": args.contentType },
22099
- body: new Uint8Array(buffer)
22469
+ body: new Uint8Array(args.body)
22100
22470
  });
22101
22471
  if (!response.ok) {
22102
- throw new Error(`Bundle upload failed (HTTP ${response.status}).`);
22472
+ throw new Error(`Upload failed (HTTP ${response.status}).`);
22103
22473
  }
22104
22474
  }
22105
- async function downloadResourceBundle(args) {
22106
- const response = await fetch(args.downloadUrl);
22107
- if (!response.ok) {
22108
- throw new Error(`Bundle download failed (HTTP ${response.status}).`);
22475
+ function readResourceFiles(dir) {
22476
+ return new Map(
22477
+ listResourceRelPaths(dir).map((path) => [
22478
+ path,
22479
+ readFileSync2(join2(dir, path))
22480
+ ])
22481
+ );
22482
+ }
22483
+ async function stageResourceDir(args) {
22484
+ const { tree } = args.target;
22485
+ const { manifest, content } = packResourceTree({
22486
+ files: readResourceFiles(args.dir),
22487
+ object: tree.object
22488
+ });
22489
+ await putBytes({
22490
+ url: tree.packUploadUrl,
22491
+ body: content,
22492
+ contentType: "application/octet-stream"
22493
+ });
22494
+ await putBytes({
22495
+ url: tree.manifestUploadUrl,
22496
+ body: serializeResourceTreeManifest(manifest),
22497
+ contentType: "application/json"
22498
+ });
22499
+ return tree.bundleKey;
22500
+ }
22501
+ function assertNoLinkOnPath(args) {
22502
+ let current = args.dir;
22503
+ for (const segment of args.path.split("/")) {
22504
+ current = join2(current, segment);
22505
+ if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink()) {
22506
+ throw new Error(
22507
+ `Not writing ${args.path}: ${current} is a link. Remove it and pull again.`
22508
+ );
22509
+ }
22510
+ }
22511
+ }
22512
+ function writeResourceFile(args) {
22513
+ assertNoLinkOnPath(args);
22514
+ const target = join2(args.dir, args.path);
22515
+ mkdirSync2(dirname(target), { recursive: true });
22516
+ const existing = lstatSync(target, { throwIfNoEntry: false });
22517
+ const staged = join2(dirname(target), `.gi-${randomUUID()}.tmp`);
22518
+ try {
22519
+ writeFileSync2(staged, args.content, {
22520
+ mode: existing ? existing.mode & 511 : void 0
22521
+ });
22522
+ renameSync(staged, target);
22523
+ } finally {
22524
+ rmSync(staged, { force: true });
22525
+ }
22526
+ }
22527
+ async function downloadResourceTree(args) {
22528
+ const files = await fetchResourceTree({
22529
+ tree: args.tree,
22530
+ isWanted: (path) => !SKIP_DIRS.has(path.split("/")[0] ?? "")
22531
+ });
22532
+ mkdirSync2(args.dir, { recursive: true });
22533
+ for (const [path, content] of files) {
22534
+ writeResourceFile({ dir: args.dir, path, content });
22109
22535
  }
22110
- const buffer = Buffer.from(await response.arrayBuffer());
22111
- await extractBundle(args.dir, buffer);
22112
22536
  return listResourceRelPaths(args.dir).length;
22113
22537
  }
22538
+ async function pullResourceDir(args) {
22539
+ const pulled = await args.treeUrl();
22540
+ return {
22541
+ pulled,
22542
+ fileCount: await downloadResourceTree({ tree: pulled.tree, dir: args.dir })
22543
+ };
22544
+ }
22114
22545
 
22115
22546
  // src/services/MemoryService.ts
22116
22547
  var MemoryService = class {
@@ -22158,6 +22589,11 @@ var WorkspaceService = class {
22158
22589
  const { client } = await this.sessionContext.requireAuthed();
22159
22590
  return client.workspaces.list();
22160
22591
  }
22592
+ /** The active workspace's teams, with what each carries and who is on it. */
22593
+ async teams() {
22594
+ const { client } = await this.sessionContext.requireAuthed();
22595
+ return client.workspaces.teams();
22596
+ }
22161
22597
  /** Active members of the active workspace; optional substring filter. */
22162
22598
  async members(args) {
22163
22599
  const { client } = await this.sessionContext.requireAuthed();
@@ -22220,26 +22656,26 @@ import chalk4 from "chalk";
22220
22656
 
22221
22657
  // src/lib/execEnv.ts
22222
22658
  import { existsSync as existsSync2, statSync as statSync2 } from "fs";
22223
- import { join as join3 } from "path";
22659
+ import { join as join4 } from "path";
22224
22660
  import tls from "tls";
22225
22661
 
22226
22662
  // src/lib/paths.ts
22227
22663
  import { homedir } from "os";
22228
- import { join as join2 } from "path";
22664
+ import { join as join3 } from "path";
22229
22665
  function configDir() {
22230
- return process.env.GENI_CONFIG_DIR ?? join2(homedir(), ".config", "geni");
22666
+ return process.env.GENI_CONFIG_DIR ?? join3(homedir(), ".config", "geni");
22231
22667
  }
22232
22668
  function cacheDir() {
22233
- return process.env.GENI_CACHE_DIR ?? join2(homedir(), ".cache", "geni");
22669
+ return process.env.GENI_CACHE_DIR ?? join3(homedir(), ".cache", "geni");
22234
22670
  }
22235
22671
  function sessionFilePath() {
22236
- return join2(configDir(), "runner-session.json");
22672
+ return join3(configDir(), "runner-session.json");
22237
22673
  }
22238
22674
  function configFilePath() {
22239
- return join2(configDir(), "config.json");
22675
+ return join3(configDir(), "config.json");
22240
22676
  }
22241
22677
  function browserSessionFilePath() {
22242
- return join2(configDir(), "browser-session.json");
22678
+ return join3(configDir(), "browser-session.json");
22243
22679
  }
22244
22680
 
22245
22681
  // src/lib/cache.ts
@@ -22251,11 +22687,11 @@ function ensureCacheDir() {
22251
22687
  }
22252
22688
 
22253
22689
  // src/lib/atomicWrite.ts
22254
- import { writeFileSync as writeFileSync2, renameSync } from "fs";
22690
+ import { writeFileSync as writeFileSync3, renameSync as renameSync2 } from "fs";
22255
22691
  function atomicWriteFileSync(args) {
22256
22692
  const partial = `${args.path}.${process.pid}.tmp`;
22257
- writeFileSync2(partial, args.data, { mode: args.mode });
22258
- renameSync(partial, args.path);
22693
+ writeFileSync3(partial, args.data, { mode: args.mode });
22694
+ renameSync2(partial, args.path);
22259
22695
  }
22260
22696
 
22261
22697
  // src/lib/execEnv.ts
@@ -22300,7 +22736,7 @@ function buildCaTrustEnv() {
22300
22736
  };
22301
22737
  }
22302
22738
  function ensureCaBundleFile() {
22303
- const path = join3(cacheDir(), `ca-certs-${process.version}.pem`);
22739
+ const path = join4(cacheDir(), `ca-certs-${process.version}.pem`);
22304
22740
  try {
22305
22741
  if (existsSync2(path) && statSync2(path).size > 0) return path;
22306
22742
  ensureCacheDir();
@@ -22709,22 +23145,22 @@ function rankOperations(operations, query) {
22709
23145
  }
22710
23146
 
22711
23147
  // src/types/config.ts
22712
- import { z as z13 } from "zod";
22713
- var CliConfigSchema = z13.object({
22714
- version: z13.literal(1),
23148
+ import { z as z14 } from "zod";
23149
+ var CliConfigSchema = z14.object({
23150
+ version: z14.literal(1),
22715
23151
  /**
22716
23152
  * Override for the cloud API base URL used at fresh `geni login`
22717
23153
  * time. Once a session exists, the URL stored on it takes
22718
23154
  * precedence — switching `apiUrl` after login does NOT reroute
22719
23155
  * existing tokens (the session knows which server minted it).
22720
23156
  */
22721
- apiUrl: z13.url().optional(),
23157
+ apiUrl: z14.url().optional(),
22722
23158
  /**
22723
23159
  * Override for the dashboard base URL used by browser-opening
22724
23160
  * commands (`geni credential connect`). Independent of `apiUrl`
22725
23161
  * because in dev they live on different ports.
22726
23162
  */
22727
- dashboardUrl: z13.url().optional()
23163
+ dashboardUrl: z14.url().optional()
22728
23164
  });
22729
23165
  var SETTABLE_CONFIG_KEYS = ["apiUrl", "dashboardUrl"];
22730
23166
  var SETTABLE_CONFIG_KEY_SET = new Set(
@@ -22866,7 +23302,7 @@ var ConfigService = class {
22866
23302
  };
22867
23303
 
22868
23304
  // src/services/WorkflowAuthoringService.ts
22869
- import { readFileSync as readFileSync2 } from "fs";
23305
+ import { readFileSync as readFileSync3 } from "fs";
22870
23306
  import { basename } from "path";
22871
23307
  var WorkflowAuthoringService = class {
22872
23308
  constructor(sessionContext) {
@@ -22881,10 +23317,13 @@ var WorkflowAuthoringService = class {
22881
23317
  name: args.name,
22882
23318
  projectId: args.projectId
22883
23319
  });
22884
- const { downloadUrl, checkoutId } = await client.workflows.bundleUrl(
22885
- detail.id
22886
- );
22887
- const fileCount = await this.downloadBundleInto(downloadUrl, args.dir);
23320
+ const {
23321
+ pulled: { checkoutId },
23322
+ fileCount
23323
+ } = await pullResourceDir({
23324
+ dir: args.dir,
23325
+ treeUrl: () => client.workflows.treeUrl(detail.id)
23326
+ });
22888
23327
  writeMarker(args.dir, {
22889
23328
  resourceId: detail.id,
22890
23329
  resourceType: detail.workflowType,
@@ -22907,8 +23346,13 @@ var WorkflowAuthoringService = class {
22907
23346
  /** Download a workflow's live files into `dir` + write its marker. */
22908
23347
  async pull(args) {
22909
23348
  const { client } = await this.sessionContext.requireAuthed();
22910
- const { workflowType, downloadUrl, checkoutId } = await client.workflows.bundleUrl(args.id);
22911
- const fileCount = await this.downloadBundleInto(downloadUrl, args.dir);
23349
+ const {
23350
+ pulled: { workflowType, checkoutId },
23351
+ fileCount
23352
+ } = await pullResourceDir({
23353
+ dir: args.dir,
23354
+ treeUrl: () => client.workflows.treeUrl(args.id)
23355
+ });
22912
23356
  writeMarker(args.dir, {
22913
23357
  resourceId: args.id,
22914
23358
  resourceType: workflowType,
@@ -22936,16 +23380,13 @@ var WorkflowAuthoringService = class {
22936
23380
  }
22937
23381
  return result;
22938
23382
  }
22939
- /** Tar `dir`, PUT it to a presigned URL, return the staged `bundleKey`. */
23383
+ /** Stage `dir` for validate or publish, returning its `bundleKey`. */
22940
23384
  async uploadBundle(id, dir) {
22941
23385
  const { client } = await this.sessionContext.requireAuthed();
22942
- const { uploadUrl, bundleKey, contentType } = await client.workflows.bundleUploadUrl(id);
22943
- await uploadResourceBundle({ dir, uploadUrl, contentType });
22944
- return bundleKey;
22945
- }
22946
- /** GET a presigned bundle URL, extract it into `dir`, return the file count. */
22947
- async downloadBundleInto(downloadUrl, dir) {
22948
- return downloadResourceBundle({ downloadUrl, dir });
23386
+ return stageResourceDir({
23387
+ dir,
23388
+ target: await client.workflows.bundleUploadUrl(id)
23389
+ });
22949
23390
  }
22950
23391
  async getConfig(id) {
22951
23392
  const { client } = await this.sessionContext.requireAuthed();
@@ -22989,7 +23430,7 @@ var WorkflowAuthoringService = class {
22989
23430
  */
22990
23431
  async stageInput(args) {
22991
23432
  const { client } = await this.sessionContext.requireAuthed();
22992
- const bytes = readFileSync2(args.localPath);
23433
+ const bytes = readFileSync3(args.localPath);
22993
23434
  const filename = basename(args.localPath);
22994
23435
  const mimeType = guessMimeType(args.localPath);
22995
23436
  const { uploadUrl, storageUri } = await client.workflows.inputUploadUrl(
@@ -23106,8 +23547,8 @@ var WorkflowAuthoringService = class {
23106
23547
  };
23107
23548
 
23108
23549
  // src/services/SkillAuthoringService.ts
23109
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "fs";
23110
- import { dirname, relative as relative2, isAbsolute, resolve } from "path";
23550
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
23551
+ import { dirname as dirname2, relative as relative2, isAbsolute, resolve } from "path";
23111
23552
 
23112
23553
  // src/lib/slugifySkillName.ts
23113
23554
  function slugifySkillName(name) {
@@ -23156,10 +23597,12 @@ Write the instructions the loading agent should follow.
23156
23597
  /** Download a skill's live bundle into `dir` + write its marker. */
23157
23598
  async pull(args) {
23158
23599
  const { client } = await this.sessionContext.requireAuthed();
23159
- const { downloadUrl, checkoutId } = await client.skills.bundleUrl(args.id);
23160
- const fileCount = await downloadResourceBundle({
23161
- downloadUrl,
23162
- dir: args.dir
23600
+ const {
23601
+ pulled: { checkoutId },
23602
+ fileCount
23603
+ } = await pullResourceDir({
23604
+ dir: args.dir,
23605
+ treeUrl: () => client.skills.treeUrl(args.id)
23163
23606
  });
23164
23607
  writeMarker(args.dir, {
23165
23608
  resourceId: args.id,
@@ -23203,12 +23646,13 @@ Write the instructions the loading agent should follow.
23203
23646
  }
23204
23647
  return { fileCount: skill.files.length, description: skill.description };
23205
23648
  }
23206
- /** Tar `dir`, PUT it to a presigned URL, return the staged `bundleKey`. */
23649
+ /** Stage `dir` for a push, return the staged `bundleKey`. */
23207
23650
  async uploadBundle(id, dir) {
23208
23651
  const { client } = await this.sessionContext.requireAuthed();
23209
- const { uploadUrl, bundleKey, contentType } = await client.skills.bundleUploadUrl(id);
23210
- await uploadResourceBundle({ dir, uploadUrl, contentType });
23211
- return bundleKey;
23652
+ return stageResourceDir({
23653
+ dir,
23654
+ target: await client.skills.bundleUploadUrl(id)
23655
+ });
23212
23656
  }
23213
23657
  writeFileInto(dir, relPath, content) {
23214
23658
  const base = resolve(dir);
@@ -23219,8 +23663,8 @@ Write the instructions the loading agent should follow.
23219
23663
  `Refusing to write outside the target directory: ${relPath}`
23220
23664
  );
23221
23665
  }
23222
- mkdirSync4(dirname(absolute), { recursive: true });
23223
- writeFileSync3(absolute, content);
23666
+ mkdirSync4(dirname2(absolute), { recursive: true });
23667
+ writeFileSync4(absolute, content);
23224
23668
  }
23225
23669
  };
23226
23670
 
@@ -23332,6 +23776,9 @@ var CrmService = class {
23332
23776
  async deleteTag(id) {
23333
23777
  return (await this.crm()).deleteTag(id);
23334
23778
  }
23779
+ async setRecordAccess(entityType, entityId, body) {
23780
+ return (await this.crm()).setRecordAccess(entityType, entityId, body);
23781
+ }
23335
23782
  async assignTag(id, entityIds) {
23336
23783
  return (await this.crm()).assignTag(id, entityIds);
23337
23784
  }
@@ -23651,6 +24098,9 @@ var CrmService = class {
23651
24098
  };
23652
24099
 
23653
24100
  // src/services/ProjectService.ts
24101
+ var PUSHED_FILE_TYPE = "application/octet-stream";
24102
+ var PUSH_TIMEOUT_MS = 30 * 6e4;
24103
+ var PULL_LINK_TIMEOUT_MS = 3e4;
23654
24104
  var ProjectService = class {
23655
24105
  constructor(sessionContext) {
23656
24106
  this.sessionContext = sessionContext;
@@ -23696,17 +24146,60 @@ var ProjectService = class {
23696
24146
  /** Download every specialist file into `dir`; returns how many landed. */
23697
24147
  async pullFiles(args) {
23698
24148
  const { client } = await this.sessionContext.requireAuthed();
23699
- const bundle = await client.projects.downloadFilesBundle(args.id);
23700
- await extractBundle(args.dir, Buffer.from(bundle));
24149
+ const { files } = await client.projects.listFiles(args.id);
24150
+ for (const { path } of files) {
24151
+ const { url } = await client.projects.fileLink({
24152
+ projectId: args.id,
24153
+ path,
24154
+ signal: AbortSignal.timeout(PULL_LINK_TIMEOUT_MS)
24155
+ });
24156
+ const response = await fetch(url);
24157
+ if (!response.ok) {
24158
+ throw new Error(`Download failed (HTTP ${response.status}).`);
24159
+ }
24160
+ if (isUnsafeArchivePath(path)) throw new Error(`Unsafe path: ${path}`);
24161
+ writeResourceFile({
24162
+ dir: args.dir,
24163
+ path,
24164
+ content: Buffer.from(await response.arrayBuffer())
24165
+ });
24166
+ }
23701
24167
  return { fileCount: listResourceRelPaths(args.dir).length };
23702
24168
  }
23703
- /** Upload `dir` into the specialist, adding or replacing the paths it holds. */
24169
+ /**
24170
+ * Upload `dir` into the specialist, adding or replacing the paths it holds. Each
24171
+ * file goes straight to storage, so the server never unpacks anything of ours.
24172
+ */
23704
24173
  async pushFiles(args) {
23705
24174
  const { client } = await this.sessionContext.requireAuthed();
23706
- return client.projects.uploadFilesBundle(
23707
- args.id,
23708
- await packResourceDir(args.dir)
23709
- );
24175
+ const signal = AbortSignal.timeout(PUSH_TIMEOUT_MS);
24176
+ for (const [path, content] of readResourceFiles(args.dir)) {
24177
+ const { uploadId, uploadUrl } = await client.projects.prepareFileUpload({
24178
+ projectId: args.id,
24179
+ mimeType: PUSHED_FILE_TYPE,
24180
+ signal
24181
+ });
24182
+ await putBytes({
24183
+ url: uploadUrl,
24184
+ body: content,
24185
+ contentType: PUSHED_FILE_TYPE
24186
+ });
24187
+ const slash = path.lastIndexOf("/");
24188
+ const committed = await client.projects.commitFileUpload({
24189
+ projectId: args.id,
24190
+ uploadId,
24191
+ folderPath: slash === -1 ? null : path.slice(0, slash),
24192
+ name: path.slice(slash + 1),
24193
+ onNameTaken: "replace",
24194
+ signal
24195
+ });
24196
+ if (committed.path !== path) {
24197
+ throw new Error(
24198
+ `Your server filed ${path} as ${committed.path}. Update the server before pushing with this CLI.`
24199
+ );
24200
+ }
24201
+ }
24202
+ return client.projects.listFiles(args.id);
23710
24203
  }
23711
24204
  async deleteFile(args) {
23712
24205
  const { client } = await this.sessionContext.requireAuthed();
@@ -23787,21 +24280,21 @@ var CustomApiService = class {
23787
24280
  };
23788
24281
 
23789
24282
  // ../../packages/crm-api/dist/types/enums.js
23790
- import { z as z14 } from "zod";
23791
- var LeadSortDirectionSchema = z14.enum(["asc", "desc"]);
23792
- var ContactPointKindSchema = z14.enum([
24283
+ import { z as z15 } from "zod";
24284
+ var LeadSortDirectionSchema = z15.enum(["asc", "desc"]);
24285
+ var ContactPointKindSchema = z15.enum([
23793
24286
  "work_email",
23794
24287
  "personal_email",
23795
24288
  "mobile",
23796
24289
  "phone"
23797
24290
  ]);
23798
- var ContactPointStatusSchema = z14.enum([
24291
+ var ContactPointStatusSchema = z15.enum([
23799
24292
  "verified",
23800
24293
  "unverified",
23801
24294
  "unavailable",
23802
24295
  "bounced"
23803
24296
  ]);
23804
- var EnrichmentOutcomeSchema = z14.enum([
24297
+ var EnrichmentOutcomeSchema = z15.enum([
23805
24298
  "matched",
23806
24299
  "no_match",
23807
24300
  "no_contact",
@@ -23811,8 +24304,8 @@ var EnrichmentOutcomeSchema = z14.enum([
23811
24304
  ]);
23812
24305
 
23813
24306
  // ../../packages/crm-api/dist/types/entity.js
23814
- import { z as z15 } from "zod";
23815
- var CrmEntityTypeSchema = z15.enum([
24307
+ import { z as z16 } from "zod";
24308
+ var CrmEntityTypeSchema = z16.enum([
23816
24309
  "person",
23817
24310
  "company",
23818
24311
  "pipeline_card"
@@ -23820,14 +24313,14 @@ var CrmEntityTypeSchema = z15.enum([
23820
24313
  var CRM_ENTITY_TYPES = CrmEntityTypeSchema.options;
23821
24314
 
23822
24315
  // ../../packages/crm-api/dist/types/recordEvent.js
23823
- import { z as z16 } from "zod";
23824
- var CrmActorKindSchema = z16.enum([
24316
+ import { z as z17 } from "zod";
24317
+ var CrmActorKindSchema = z17.enum([
23825
24318
  "user",
23826
24319
  "agent",
23827
24320
  "automation",
23828
24321
  "system"
23829
24322
  ]);
23830
- var CrmRecordEventKindSchema = z16.enum([
24323
+ var CrmRecordEventKindSchema = z17.enum([
23831
24324
  "created",
23832
24325
  "field_changed",
23833
24326
  "stage_changed",
@@ -23841,6 +24334,7 @@ var CrmRecordEventKindSchema = z16.enum([
23841
24334
  "tag_removed",
23842
24335
  "list_added",
23843
24336
  "list_removed",
24337
+ "access_changed",
23844
24338
  "file_added",
23845
24339
  "file_removed",
23846
24340
  "task_created",
@@ -23849,21 +24343,32 @@ var CrmRecordEventKindSchema = z16.enum([
23849
24343
  "task_dismissed",
23850
24344
  "task_deleted"
23851
24345
  ]);
23852
- var CrmRecordEventFeedQuerySchema = z16.object({
24346
+ var CrmRecordEventFeedQuerySchema = z17.object({
23853
24347
  /** The cursor a previous read returned; omitted, the read returns the latest events. */
23854
- after: z16.string().regex(/^\d+$/).optional(),
23855
- limit: z16.coerce.number().int().min(1).max(500).default(100)
24348
+ after: z17.string().regex(/^\d+$/).optional(),
24349
+ limit: z17.coerce.number().int().min(1).max(500).default(100)
24350
+ });
24351
+
24352
+ // ../../packages/crm-api/dist/types/access.js
24353
+ import { z as z18 } from "zod";
24354
+ var CRM_RECORD_VISIBILITIES = ["private", "team", "workspace"];
24355
+ var CrmRecordVisibilitySchema = z18.enum(CRM_RECORD_VISIBILITIES);
24356
+ var SetCrmRecordAccessRequestSchema = z18.object({
24357
+ /** Null only for a pipeline card, which may be unassigned. */
24358
+ ownerMembershipId: z18.uuid().nullable(),
24359
+ teamId: z18.uuid().nullable(),
24360
+ visibility: CrmRecordVisibilitySchema
23856
24361
  });
23857
24362
 
23858
24363
  // ../../packages/crm-api/dist/types/concurrency.js
23859
- import { z as z17 } from "zod";
23860
- var ExpectedUpdatedAtSchema = z17.object({
23861
- expectedUpdatedAt: z17.string()
24364
+ import { z as z19 } from "zod";
24365
+ var ExpectedUpdatedAtSchema = z19.object({
24366
+ expectedUpdatedAt: z19.string()
23862
24367
  });
23863
24368
 
23864
24369
  // ../../packages/crm-api/dist/types/company.js
23865
- import { z as z18 } from "zod";
23866
- var CompanyTypeSchema = z18.enum([
24370
+ import { z as z20 } from "zod";
24371
+ var CompanyTypeSchema = z20.enum([
23867
24372
  "public",
23868
24373
  "private",
23869
24374
  "nonprofit",
@@ -23873,11 +24378,11 @@ var CompanyTypeSchema = z18.enum([
23873
24378
  ]);
23874
24379
 
23875
24380
  // ../../packages/crm-api/dist/types/customField.js
23876
- import { z as z20 } from "zod";
24381
+ import { z as z22 } from "zod";
23877
24382
 
23878
24383
  // ../../packages/crm-api/dist/types/tag.js
23879
- import { z as z19 } from "zod";
23880
- var TagColorSchema = z19.enum([
24384
+ import { z as z21 } from "zod";
24385
+ var TagColorSchema = z21.enum([
23881
24386
  "stone",
23882
24387
  "charcoal",
23883
24388
  "red",
@@ -23909,23 +24414,23 @@ var TagColorSchema = z19.enum([
23909
24414
  "plum",
23910
24415
  "tyrian"
23911
24416
  ]);
23912
- var CreateTagRequestSchema = z19.object({
23913
- name: z19.string().min(1).max(100),
24417
+ var CreateTagRequestSchema = z21.object({
24418
+ name: z21.string().min(1).max(100),
23914
24419
  color: TagColorSchema.default("stone"),
23915
24420
  entityType: CrmEntityTypeSchema
23916
24421
  });
23917
- var UpdateTagRequestSchema = z19.object({
23918
- name: z19.string().min(1).max(100).optional(),
24422
+ var UpdateTagRequestSchema = z21.object({
24423
+ name: z21.string().min(1).max(100).optional(),
23919
24424
  color: TagColorSchema.optional()
23920
24425
  }).refine((req) => req.name !== void 0 || req.color !== void 0, {
23921
24426
  message: "Nothing to update"
23922
24427
  });
23923
- var TagEntitiesRequestSchema = z19.object({
23924
- entityIds: z19.array(z19.uuid()).min(1).max(1e3)
24428
+ var TagEntitiesRequestSchema = z21.object({
24429
+ entityIds: z21.array(z21.uuid()).min(1).max(1e3)
23925
24430
  });
23926
24431
 
23927
24432
  // ../../packages/crm-api/dist/types/customField.js
23928
- var CustomFieldTypeSchema = z20.enum([
24433
+ var CustomFieldTypeSchema = z22.enum([
23929
24434
  "text",
23930
24435
  "long_text",
23931
24436
  "number",
@@ -23944,91 +24449,91 @@ var CustomFieldTypeSchema = z20.enum([
23944
24449
  function customFieldScopeKind(entityType) {
23945
24450
  return entityType === "pipeline_card" ? "pipeline" : null;
23946
24451
  }
23947
- var CustomFieldOptionSchema = z20.object({
23948
- value: z20.string().min(1).max(120),
23949
- label: z20.string().min(1).max(120),
24452
+ var CustomFieldOptionSchema = z22.object({
24453
+ value: z22.string().min(1).max(120),
24454
+ label: z22.string().min(1).max(120),
23950
24455
  color: TagColorSchema.optional()
23951
24456
  });
23952
- var CustomFieldOptionInputSchema = z20.object({
23953
- value: z20.string().max(120).optional(),
23954
- label: z20.string().min(1).max(120),
24457
+ var CustomFieldOptionInputSchema = z22.object({
24458
+ value: z22.string().max(120).optional(),
24459
+ label: z22.string().min(1).max(120),
23955
24460
  color: TagColorSchema.optional()
23956
24461
  });
23957
- var CreateCustomFieldRequestSchema = z20.object({
24462
+ var CreateCustomFieldRequestSchema = z22.object({
23958
24463
  entityType: CrmEntityTypeSchema,
23959
- scopeId: z20.uuid().nullish(),
23960
- label: z20.string().min(1).max(80),
24464
+ scopeId: z22.uuid().nullish(),
24465
+ label: z22.string().min(1).max(80),
23961
24466
  fieldType: CustomFieldTypeSchema,
23962
- options: z20.array(CustomFieldOptionInputSchema).max(100).optional(),
23963
- isRequired: z20.boolean().optional(),
23964
- helpText: z20.string().max(200).nullish(),
23965
- description: z20.string().max(1e3).nullish()
24467
+ options: z22.array(CustomFieldOptionInputSchema).max(100).optional(),
24468
+ isRequired: z22.boolean().optional(),
24469
+ helpText: z22.string().max(200).nullish(),
24470
+ description: z22.string().max(1e3).nullish()
23966
24471
  }).refine((req) => customFieldScopeKind(req.entityType) === "pipeline" === !!req.scopeId, {
23967
24472
  message: "A pipeline_card field needs its pipeline; no other field takes one"
23968
24473
  });
23969
- var UpdateCustomFieldRequestSchema = z20.object({
23970
- label: z20.string().min(1).max(80).optional(),
23971
- options: z20.array(CustomFieldOptionInputSchema).max(100).optional(),
23972
- isRequired: z20.boolean().optional(),
23973
- helpText: z20.string().max(200).nullish(),
23974
- description: z20.string().max(1e3).nullish(),
23975
- position: z20.number().int().min(0).optional()
24474
+ var UpdateCustomFieldRequestSchema = z22.object({
24475
+ label: z22.string().min(1).max(80).optional(),
24476
+ options: z22.array(CustomFieldOptionInputSchema).max(100).optional(),
24477
+ isRequired: z22.boolean().optional(),
24478
+ helpText: z22.string().max(200).nullish(),
24479
+ description: z22.string().max(1e3).nullish(),
24480
+ position: z22.number().int().min(0).optional()
23976
24481
  }).refine((req) => Object.keys(req).length > 0, {
23977
24482
  message: "Nothing to update"
23978
24483
  });
23979
- var ReorderCustomFieldsRequestSchema = z20.object({
23980
- orderedIds: z20.array(z20.uuid()).min(1)
24484
+ var ReorderCustomFieldsRequestSchema = z22.object({
24485
+ orderedIds: z22.array(z22.uuid()).min(1)
23981
24486
  });
23982
- var CustomFieldValuesSchema = z20.record(z20.string(), z20.unknown());
24487
+ var CustomFieldValuesSchema = z22.record(z22.string(), z22.unknown());
23983
24488
 
23984
24489
  // ../../packages/crm-api/dist/types/list.js
23985
- import { z as z21 } from "zod";
23986
- var ListSearchSortSchema = z21.enum([
24490
+ import { z as z23 } from "zod";
24491
+ var ListSearchSortSchema = z23.enum([
23987
24492
  "relevance",
23988
24493
  "recent",
23989
24494
  "updated",
23990
24495
  "name",
23991
24496
  "members"
23992
24497
  ]);
23993
- var ListSearchFiltersSchema = z21.object({
24498
+ var ListSearchFiltersSchema = z23.object({
23994
24499
  entityType: CrmEntityTypeSchema.optional()
23995
24500
  });
23996
- var ListSearchRequestSchema = z21.object({
23997
- query: z21.string().optional(),
24501
+ var ListSearchRequestSchema = z23.object({
24502
+ query: z23.string().optional(),
23998
24503
  filters: ListSearchFiltersSchema.optional(),
23999
24504
  sort: ListSearchSortSchema.default("relevance"),
24000
24505
  // Direction for the column sort; omitted falls back to the sort's default.
24001
24506
  direction: LeadSortDirectionSchema.optional(),
24002
- cursor: z21.string().nullable().optional(),
24003
- limit: z21.number().int().min(1).max(100).default(25)
24507
+ cursor: z23.string().nullable().optional(),
24508
+ limit: z23.number().int().min(1).max(100).default(25)
24004
24509
  });
24005
- var CreateListRequestSchema = z21.object({
24006
- name: z21.string().min(1).max(200),
24007
- purpose: z21.string().max(2e3).nullish(),
24510
+ var CreateListRequestSchema = z23.object({
24511
+ name: z23.string().min(1).max(200),
24512
+ purpose: z23.string().max(2e3).nullish(),
24008
24513
  entityType: CrmEntityTypeSchema
24009
24514
  });
24010
- var UpdateListRequestSchema = z21.object({
24011
- name: z21.string().min(1).max(200).optional(),
24012
- purpose: z21.string().max(2e3).nullable().optional()
24515
+ var UpdateListRequestSchema = z23.object({
24516
+ name: z23.string().min(1).max(200).optional(),
24517
+ purpose: z23.string().max(2e3).nullable().optional()
24013
24518
  }).refine((req) => req.name !== void 0 || req.purpose !== void 0, {
24014
24519
  message: "Nothing to update"
24015
24520
  });
24016
- var AddListMembersRequestSchema = z21.object({
24017
- entityIds: z21.array(z21.uuid()).min(1).max(1e3)
24521
+ var AddListMembersRequestSchema = z23.object({
24522
+ entityIds: z23.array(z23.uuid()).min(1).max(1e3)
24018
24523
  });
24019
- var DeleteListsRequestSchema = z21.object({
24020
- ids: z21.array(z21.uuid()).min(1).max(100)
24524
+ var DeleteListsRequestSchema = z23.object({
24525
+ ids: z23.array(z23.uuid()).min(1).max(100)
24021
24526
  });
24022
24527
 
24023
24528
  // ../../packages/crm-api/dist/types/pipeline.js
24024
- import { z as z22 } from "zod";
24025
- var PipelineKindSchema = z22.enum(["sales", "recruiting", "custom"]);
24026
- var PipelineTemplateKindSchema = z22.enum(["sales", "recruiting"]);
24027
- var StagePhaseSchema = z22.enum(["acquisition", "fulfillment"]);
24028
- var BallInCourtSchema = z22.enum(["us", "them", "mutual"]);
24029
- var StageOutcomeSchema = z22.enum(["won", "lost"]);
24030
- var CardStatusSchema = z22.enum(["open", "won", "lost"]);
24031
- var CardEventFieldSchema = z22.enum([
24529
+ import { z as z24 } from "zod";
24530
+ var PipelineKindSchema = z24.enum(["sales", "recruiting", "custom"]);
24531
+ var PipelineTemplateKindSchema = z24.enum(["sales", "recruiting"]);
24532
+ var StagePhaseSchema = z24.enum(["acquisition", "fulfillment"]);
24533
+ var BallInCourtSchema = z24.enum(["us", "them", "mutual"]);
24534
+ var StageOutcomeSchema = z24.enum(["won", "lost"]);
24535
+ var CardStatusSchema = z24.enum(["open", "won", "lost"]);
24536
+ var CardEventFieldSchema = z24.enum([
24032
24537
  "title",
24033
24538
  "amount",
24034
24539
  "currency",
@@ -24037,162 +24542,162 @@ var CardEventFieldSchema = z22.enum([
24037
24542
  "close_date",
24038
24543
  "attribution"
24039
24544
  ]);
24040
- var CardLinkedEntityTypeSchema = z22.enum(["person", "company"]);
24041
- var CreatePipelineFromTemplateRequestSchema = z22.object({
24545
+ var CardLinkedEntityTypeSchema = z24.enum(["person", "company"]);
24546
+ var CreatePipelineFromTemplateRequestSchema = z24.object({
24042
24547
  kind: PipelineTemplateKindSchema,
24043
- name: z22.string().min(1).max(200).optional()
24548
+ name: z24.string().min(1).max(200).optional()
24044
24549
  });
24045
- var StageInputSchema = z22.object({
24046
- name: z22.string().min(1).max(80),
24550
+ var StageInputSchema = z24.object({
24551
+ name: z24.string().min(1).max(80),
24047
24552
  phase: StagePhaseSchema.default("acquisition"),
24048
24553
  ballInCourt: BallInCourtSchema.default("us"),
24049
- isCommitted: z22.boolean().default(false),
24554
+ isCommitted: z24.boolean().default(false),
24050
24555
  outcome: StageOutcomeSchema.nullish(),
24051
- weight: z22.number().int().min(0).max(100).default(0),
24556
+ weight: z24.number().int().min(0).max(100).default(0),
24052
24557
  color: TagColorSchema.default("stone")
24053
24558
  });
24054
- var CreatePipelineRequestSchema = z22.object({
24055
- name: z22.string().min(1).max(200),
24056
- cardLabel: z22.string().min(1).max(60),
24057
- stages: z22.array(StageInputSchema).min(1).max(20)
24559
+ var CreatePipelineRequestSchema = z24.object({
24560
+ name: z24.string().min(1).max(200),
24561
+ cardLabel: z24.string().min(1).max(60),
24562
+ stages: z24.array(StageInputSchema).min(1).max(20)
24058
24563
  });
24059
- var UpdatePipelineRequestSchema = z22.object({
24060
- name: z22.string().min(1).max(200).optional(),
24061
- cardLabel: z22.string().min(1).max(60).optional(),
24062
- archived: z22.boolean().optional()
24564
+ var UpdatePipelineRequestSchema = z24.object({
24565
+ name: z24.string().min(1).max(200).optional(),
24566
+ cardLabel: z24.string().min(1).max(60).optional(),
24567
+ archived: z24.boolean().optional()
24063
24568
  }).refine((req) => req.name !== void 0 || req.cardLabel !== void 0 || req.archived !== void 0, { message: "Nothing to update" });
24064
24569
  var AddStageRequestSchema = StageInputSchema.extend({
24065
24570
  // 0-indexed insert position; appended when omitted.
24066
- position: z22.number().int().min(0).optional()
24571
+ position: z24.number().int().min(0).optional()
24067
24572
  });
24068
- var UpdateStageRequestSchema = z22.object({
24069
- name: z22.string().min(1).max(80).optional(),
24573
+ var UpdateStageRequestSchema = z24.object({
24574
+ name: z24.string().min(1).max(80).optional(),
24070
24575
  phase: StagePhaseSchema.optional(),
24071
24576
  ballInCourt: BallInCourtSchema.optional(),
24072
- isCommitted: z22.boolean().optional(),
24577
+ isCommitted: z24.boolean().optional(),
24073
24578
  outcome: StageOutcomeSchema.nullable().optional(),
24074
- weight: z22.number().int().min(0).max(100).optional(),
24579
+ weight: z24.number().int().min(0).max(100).optional(),
24075
24580
  color: TagColorSchema.optional()
24076
24581
  }).refine((req) => Object.keys(req).length > 0, {
24077
24582
  message: "Nothing to update"
24078
24583
  });
24079
- var ReorderStagesRequestSchema = z22.object({
24080
- stageIds: z22.array(z22.uuid()).min(1)
24584
+ var ReorderStagesRequestSchema = z24.object({
24585
+ stageIds: z24.array(z24.uuid()).min(1)
24081
24586
  });
24082
- var CardPersonInputSchema = z22.object({
24083
- personId: z22.uuid(),
24084
- role: z22.string().max(120).nullish(),
24085
- isPrimary: z22.boolean().default(false)
24587
+ var CardPersonInputSchema = z24.object({
24588
+ personId: z24.uuid(),
24589
+ role: z24.string().max(120).nullish(),
24590
+ isPrimary: z24.boolean().default(false)
24086
24591
  });
24087
- var CreateCardRequestSchema = z22.object({
24088
- title: z22.string().min(1).max(200),
24592
+ var CreateCardRequestSchema = z24.object({
24593
+ title: z24.string().min(1).max(200),
24089
24594
  // Defaults to the pipeline's first stage when omitted.
24090
- stageId: z22.uuid().optional(),
24091
- ownerMembershipId: z22.uuid().nullish(),
24092
- primaryCompanyId: z22.uuid().nullish(),
24093
- people: z22.array(CardPersonInputSchema).max(50).default([]),
24094
- amount: z22.number().min(0).nullish(),
24095
- currency: z22.string().max(8).nullish(),
24096
- expectedCloseAt: z22.string().nullish(),
24097
- attributionSourceId: z22.uuid().nullish()
24595
+ stageId: z24.uuid().optional(),
24596
+ ownerMembershipId: z24.uuid().nullish(),
24597
+ primaryCompanyId: z24.uuid().nullish(),
24598
+ people: z24.array(CardPersonInputSchema).max(50).default([]),
24599
+ amount: z24.number().min(0).nullish(),
24600
+ currency: z24.string().max(8).nullish(),
24601
+ expectedCloseAt: z24.string().nullish(),
24602
+ attributionSourceId: z24.uuid().nullish()
24098
24603
  });
24099
- var UpdateCardRequestSchema = z22.object({
24100
- title: z22.string().min(1).max(200).optional(),
24101
- ownerMembershipId: z22.uuid().nullable().optional(),
24102
- primaryCompanyId: z22.uuid().nullable().optional(),
24103
- amount: z22.number().min(0).nullable().optional(),
24104
- currency: z22.string().max(8).nullable().optional(),
24105
- expectedCloseAt: z22.string().nullable().optional(),
24106
- attributionSourceId: z22.uuid().nullable().optional(),
24604
+ var UpdateCardRequestSchema = z24.object({
24605
+ title: z24.string().min(1).max(200).optional(),
24606
+ ownerMembershipId: z24.uuid().nullable().optional(),
24607
+ primaryCompanyId: z24.uuid().nullable().optional(),
24608
+ amount: z24.number().min(0).nullable().optional(),
24609
+ currency: z24.string().max(8).nullable().optional(),
24610
+ expectedCloseAt: z24.string().nullable().optional(),
24611
+ attributionSourceId: z24.uuid().nullable().optional(),
24107
24612
  // Registry-defined custom fields; validated + merged server-side.
24108
24613
  custom: CustomFieldValuesSchema.optional()
24109
24614
  }).refine((req) => Object.keys(req).length > 0, {
24110
24615
  message: "Nothing to update"
24111
24616
  });
24112
- var MoveCardRequestSchema = z22.object({
24113
- toStageId: z22.uuid(),
24114
- boardPosition: z22.number().optional()
24617
+ var MoveCardRequestSchema = z24.object({
24618
+ toStageId: z24.uuid(),
24619
+ boardPosition: z24.number().optional()
24115
24620
  });
24116
- var SetCardStatusRequestSchema = z22.object({
24621
+ var SetCardStatusRequestSchema = z24.object({
24117
24622
  status: CardStatusSchema,
24118
- lostReason: z22.string().max(2e3).nullish()
24623
+ lostReason: z24.string().max(2e3).nullish()
24119
24624
  });
24120
- var AddCardContactRequestSchema = z22.object({
24121
- personId: z22.uuid()
24625
+ var AddCardContactRequestSchema = z24.object({
24626
+ personId: z24.uuid()
24122
24627
  });
24123
24628
  var CARD_BATCH_MAX = 100;
24124
- var DeleteCardsRequestSchema = z22.strictObject({
24125
- ids: z22.array(z22.uuid()).min(1).max(CARD_BATCH_MAX)
24629
+ var DeleteCardsRequestSchema = z24.strictObject({
24630
+ ids: z24.array(z24.uuid()).min(1).max(CARD_BATCH_MAX)
24126
24631
  });
24127
- var SetCardCreditsRequestSchema = z22.object({
24632
+ var SetCardCreditsRequestSchema = z24.object({
24128
24633
  /** Replaces every credit. Shares add up to 100, or the list is empty. */
24129
- credits: z22.array(z22.object({
24130
- membershipId: z22.uuid(),
24131
- role: z22.string().min(1).max(50),
24132
- percent: z22.number().positive().max(100)
24634
+ credits: z24.array(z24.object({
24635
+ membershipId: z24.uuid(),
24636
+ role: z24.string().min(1).max(50),
24637
+ percent: z24.number().positive().max(100)
24133
24638
  })).max(10)
24134
24639
  });
24135
24640
 
24136
24641
  // ../../packages/crm-api/dist/types/attribution.js
24137
- import { z as z23 } from "zod";
24138
- var CreateAttributionSourceRequestSchema = z23.object({
24139
- name: z23.string().min(1).max(100)
24642
+ import { z as z25 } from "zod";
24643
+ var CreateAttributionSourceRequestSchema = z25.object({
24644
+ name: z25.string().min(1).max(100)
24140
24645
  });
24141
- var UpdateAttributionSourceRequestSchema = z23.object({
24142
- name: z23.string().min(1).max(100).optional(),
24143
- isArchived: z23.boolean().optional()
24646
+ var UpdateAttributionSourceRequestSchema = z25.object({
24647
+ name: z25.string().min(1).max(100).optional(),
24648
+ isArchived: z25.boolean().optional()
24144
24649
  }).refine((req) => req.name !== void 0 || req.isArchived !== void 0, {
24145
24650
  message: "Nothing to update"
24146
24651
  });
24147
- var ReorderAttributionSourcesRequestSchema = z23.object({
24148
- orderedIds: z23.array(z23.uuid()).min(1)
24652
+ var ReorderAttributionSourcesRequestSchema = z25.object({
24653
+ orderedIds: z25.array(z25.uuid()).min(1)
24149
24654
  });
24150
24655
 
24151
24656
  // ../../packages/crm-api/dist/types/note.js
24152
- import { z as z24 } from "zod";
24153
- var CreateNoteRequestSchema = z24.object({
24154
- body: z24.string().min(1).max(1e4),
24657
+ import { z as z26 } from "zod";
24658
+ var CreateNoteRequestSchema = z26.object({
24659
+ body: z26.string().min(1).max(1e4),
24155
24660
  // Stamped by the engine for agent writes — never user-supplied in the UI.
24156
- draftedBy: z24.string().max(50).nullish()
24661
+ draftedBy: z26.string().max(50).nullish()
24157
24662
  });
24158
- var UpdateNoteRequestSchema = z24.object({
24159
- body: z24.string().min(1).max(1e4)
24663
+ var UpdateNoteRequestSchema = z26.object({
24664
+ body: z26.string().min(1).max(1e4)
24160
24665
  });
24161
24666
 
24162
24667
  // ../../packages/crm-api/dist/types/task.js
24163
- import { z as z25 } from "zod";
24164
- var TaskStatusSchema = z25.enum(["open", "done", "dismissed"]);
24165
- var TaskPrioritySchema = z25.enum(["low", "medium", "high"]);
24166
- var TaskEntityRefRequestSchema = z25.object({
24668
+ import { z as z27 } from "zod";
24669
+ var TaskStatusSchema = z27.enum(["open", "done", "dismissed"]);
24670
+ var TaskPrioritySchema = z27.enum(["low", "medium", "high"]);
24671
+ var TaskEntityRefRequestSchema = z27.object({
24167
24672
  type: CrmEntityTypeSchema,
24168
- id: z25.uuid()
24673
+ id: z27.uuid()
24169
24674
  });
24170
- var CreateTaskRequestSchema = z25.object({
24171
- title: z25.string().min(1).max(500),
24172
- description: z25.string().max(1e4).nullish(),
24173
- dueAt: z25.iso.datetime().nullish(),
24675
+ var CreateTaskRequestSchema = z27.object({
24676
+ title: z27.string().min(1).max(500),
24677
+ description: z27.string().max(1e4).nullish(),
24678
+ dueAt: z27.iso.datetime().nullish(),
24174
24679
  // Omitted or null = no priority.
24175
24680
  priority: TaskPrioritySchema.nullish(),
24176
24681
  // Defaults to the calling member when omitted.
24177
- ownerMembershipId: z25.uuid().nullish(),
24682
+ ownerMembershipId: z27.uuid().nullish(),
24178
24683
  entity: TaskEntityRefRequestSchema.nullish(),
24179
24684
  // Stamped by the engine for agent writes — never user-supplied in the UI.
24180
- createdByProvider: z25.string().max(50).nullish()
24685
+ createdByProvider: z27.string().max(50).nullish()
24181
24686
  });
24182
- var UpdateTaskRequestSchema = z25.object({
24183
- title: z25.string().min(1).max(500).optional(),
24184
- description: z25.string().max(1e4).nullable().optional(),
24185
- dueAt: z25.iso.datetime().nullable().optional(),
24687
+ var UpdateTaskRequestSchema = z27.object({
24688
+ title: z27.string().min(1).max(500).optional(),
24689
+ description: z27.string().max(1e4).nullable().optional(),
24690
+ dueAt: z27.iso.datetime().nullable().optional(),
24186
24691
  priority: TaskPrioritySchema.nullable().optional(),
24187
- ownerMembershipId: z25.uuid().optional()
24692
+ ownerMembershipId: z27.uuid().optional()
24188
24693
  });
24189
- var SetTaskStatusRequestSchema = z25.object({
24694
+ var SetTaskStatusRequestSchema = z27.object({
24190
24695
  status: TaskStatusSchema
24191
24696
  });
24192
24697
 
24193
24698
  // ../../packages/crm-api/dist/types/activity.js
24194
- import { z as z26 } from "zod";
24195
- var ActivityKindSchema = z26.enum([
24699
+ import { z as z28 } from "zod";
24700
+ var ActivityKindSchema = z28.enum([
24196
24701
  "note",
24197
24702
  "email",
24198
24703
  "slack",
@@ -24202,47 +24707,47 @@ var ActivityKindSchema = z26.enum([
24202
24707
  "linkedin",
24203
24708
  "other"
24204
24709
  ]);
24205
- var ActivityDirectionSchema = z26.enum(["inbound", "outbound"]);
24206
- var ActivitySourceSchema = z26.enum(["manual", "agent", "sync"]);
24207
- var ActivityUrlSchema = z26.url().max(2e3).refine((value) => /^https?:\/\//i.test(value), {
24710
+ var ActivityDirectionSchema = z28.enum(["inbound", "outbound"]);
24711
+ var ActivitySourceSchema = z28.enum(["manual", "agent", "sync"]);
24712
+ var ActivityUrlSchema = z28.url().max(2e3).refine((value) => /^https?:\/\//i.test(value), {
24208
24713
  message: "Link must be an http or https URL"
24209
24714
  });
24210
- var ActivityLinkRequestSchema = z26.object({
24715
+ var ActivityLinkRequestSchema = z28.object({
24211
24716
  type: CrmEntityTypeSchema,
24212
- id: z26.uuid()
24717
+ id: z28.uuid()
24213
24718
  });
24214
- var ActivityFieldsSchema = z26.object({
24719
+ var ActivityFieldsSchema = z28.object({
24215
24720
  kind: ActivityKindSchema,
24216
24721
  direction: ActivityDirectionSchema.nullish(),
24217
24722
  /** When it happened; a future time is a scheduled meeting or call. Omitted, now. */
24218
- occurredAt: z26.iso.datetime().nullish(),
24219
- subject: z26.string().max(500).nullish(),
24220
- body: z26.string().max(2e4).nullish(),
24723
+ occurredAt: z28.iso.datetime().nullish(),
24724
+ subject: z28.string().max(500).nullish(),
24725
+ body: z28.string().max(2e4).nullish(),
24221
24726
  externalUrl: ActivityUrlSchema.nullish(),
24222
- links: z26.array(ActivityLinkRequestSchema).min(1).max(25),
24727
+ links: z28.array(ActivityLinkRequestSchema).min(1).max(25),
24223
24728
  // Stamped by the engine for agent writes; never user-supplied in the UI.
24224
- draftedBy: z26.string().max(50).nullish()
24729
+ draftedBy: z28.string().max(50).nullish()
24225
24730
  });
24226
24731
  var CreateActivityRequestSchema = ActivityFieldsSchema.extend({
24227
- externalRef: z26.string().min(1).max(500).nullish()
24732
+ externalRef: z28.string().min(1).max(500).nullish()
24228
24733
  });
24229
24734
  var UpsertActivityRequestSchema = ActivityFieldsSchema.extend({
24230
- externalRef: z26.string().min(1).max(500)
24735
+ externalRef: z28.string().min(1).max(500)
24231
24736
  });
24232
- var UpdateActivityRequestSchema = z26.object({
24737
+ var UpdateActivityRequestSchema = z28.object({
24233
24738
  kind: ActivityKindSchema.optional(),
24234
24739
  direction: ActivityDirectionSchema.nullable().optional(),
24235
- occurredAt: z26.iso.datetime().optional(),
24236
- subject: z26.string().max(500).nullable().optional(),
24237
- body: z26.string().max(2e4).nullable().optional(),
24740
+ occurredAt: z28.iso.datetime().optional(),
24741
+ subject: z28.string().max(500).nullable().optional(),
24742
+ body: z28.string().max(2e4).nullable().optional(),
24238
24743
  externalUrl: ActivityUrlSchema.nullable().optional(),
24239
24744
  /** Replaces every link. */
24240
- links: z26.array(ActivityLinkRequestSchema).min(1).max(25).optional()
24745
+ links: z28.array(ActivityLinkRequestSchema).min(1).max(25).optional()
24241
24746
  });
24242
24747
 
24243
24748
  // ../../packages/crm-api/dist/types/recordFile.js
24244
- import { z as z27 } from "zod";
24245
- var CrmFileKindSchema = z27.enum([
24749
+ import { z as z29 } from "zod";
24750
+ var CrmFileKindSchema = z29.enum([
24246
24751
  "document",
24247
24752
  "resume",
24248
24753
  "contract",
@@ -24250,48 +24755,48 @@ var CrmFileKindSchema = z27.enum([
24250
24755
  "other"
24251
24756
  ]);
24252
24757
  var CRM_FILE_MAX_BYTES = 25 * 1024 * 1024;
24253
- var PrepareCrmFileUploadRequestSchema = z27.object({
24758
+ var PrepareCrmFileUploadRequestSchema = z29.object({
24254
24759
  entityType: CrmEntityTypeSchema,
24255
- entityId: z27.uuid(),
24256
- mimeType: z27.string().min(1).max(200)
24760
+ entityId: z29.uuid(),
24761
+ mimeType: z29.string().min(1).max(200)
24257
24762
  });
24258
- var CommitCrmFileUploadRequestSchema = z27.object({
24259
- uploadId: z27.uuid(),
24763
+ var CommitCrmFileUploadRequestSchema = z29.object({
24764
+ uploadId: z29.uuid(),
24260
24765
  entityType: CrmEntityTypeSchema,
24261
- entityId: z27.uuid(),
24262
- name: z27.string().min(1).max(255),
24263
- mimeType: z27.string().min(1).max(200),
24766
+ entityId: z29.uuid(),
24767
+ name: z29.string().min(1).max(255),
24768
+ mimeType: z29.string().min(1).max(200),
24264
24769
  kind: CrmFileKindSchema
24265
24770
  });
24266
24771
 
24267
24772
  // ../../packages/crm-api/dist/types/touchpoint.js
24268
- import { z as z28 } from "zod";
24269
- var CreateTouchpointRequestSchema = z28.object({
24773
+ import { z as z30 } from "zod";
24774
+ var CreateTouchpointRequestSchema = z30.object({
24270
24775
  channel: ActivityKindSchema,
24271
24776
  direction: ActivityDirectionSchema.nullish(),
24272
- occurredAt: z28.iso.datetime(),
24273
- summary: z28.string().max(1e4).nullish(),
24274
- subject: z28.string().max(500).nullish(),
24777
+ occurredAt: z30.iso.datetime(),
24778
+ summary: z30.string().max(1e4).nullish(),
24779
+ subject: z30.string().max(500).nullish(),
24275
24780
  // The contact this was with; company is derived from the card server-side.
24276
- personId: z28.uuid().nullish(),
24277
- externalRef: z28.string().max(500).nullish(),
24781
+ personId: z30.uuid().nullish(),
24782
+ externalRef: z30.string().max(500).nullish(),
24278
24783
  externalUrl: ActivityUrlSchema.nullish(),
24279
24784
  // Stamped by the engine for agent writes — never user-supplied in the UI.
24280
- loggedByProvider: z28.string().max(50).nullish()
24785
+ loggedByProvider: z30.string().max(50).nullish()
24281
24786
  });
24282
- var UpdateTouchpointRequestSchema = z28.object({
24787
+ var UpdateTouchpointRequestSchema = z30.object({
24283
24788
  channel: ActivityKindSchema.optional(),
24284
24789
  direction: ActivityDirectionSchema.nullable().optional(),
24285
- occurredAt: z28.iso.datetime().optional(),
24286
- summary: z28.string().max(1e4).nullable().optional(),
24287
- subject: z28.string().max(500).nullable().optional(),
24288
- personId: z28.uuid().nullable().optional(),
24790
+ occurredAt: z30.iso.datetime().optional(),
24791
+ summary: z30.string().max(1e4).nullable().optional(),
24792
+ subject: z30.string().max(500).nullable().optional(),
24793
+ personId: z30.uuid().nullable().optional(),
24289
24794
  externalUrl: ActivityUrlSchema.nullable().optional()
24290
24795
  });
24291
24796
 
24292
24797
  // ../../packages/crm-api/dist/types/leadFilters.js
24293
- import { z as z29 } from "zod";
24294
- var LeadFilterFieldTypeSchema = z29.enum([
24798
+ import { z as z31 } from "zod";
24799
+ var LeadFilterFieldTypeSchema = z31.enum([
24295
24800
  "text",
24296
24801
  "number",
24297
24802
  "date",
@@ -24299,7 +24804,7 @@ var LeadFilterFieldTypeSchema = z29.enum([
24299
24804
  "stringArray",
24300
24805
  "boolean"
24301
24806
  ]);
24302
- var LeadFilterOperatorSchema = z29.enum([
24807
+ var LeadFilterOperatorSchema = z31.enum([
24303
24808
  // text
24304
24809
  "contains",
24305
24810
  "not_contains",
@@ -24332,16 +24837,16 @@ var LeadFilterOperatorSchema = z29.enum([
24332
24837
  "is_empty",
24333
24838
  "is_not_empty"
24334
24839
  ]);
24335
- var LeadFilterConditionSchema = z29.object({
24336
- field: z29.string().min(1).max(200),
24840
+ var LeadFilterConditionSchema = z31.object({
24841
+ field: z31.string().min(1).max(200),
24337
24842
  operator: LeadFilterOperatorSchema,
24338
24843
  // Single-value operators (contains, gt, before, in_last_days, …).
24339
- value: z29.union([z29.string().max(500), z29.number()]).optional(),
24844
+ value: z31.union([z31.string().max(500), z31.number()]).optional(),
24340
24845
  // Multi-value operators (any_of, includes_any, …).
24341
- values: z29.array(z29.string().max(500)).max(100).optional(),
24846
+ values: z31.array(z31.string().max(500)).max(100).optional(),
24342
24847
  // `between` bounds — numbers, or ISO dates for date fields.
24343
- min: z29.union([z29.string().max(100), z29.number()]).optional(),
24344
- max: z29.union([z29.string().max(100), z29.number()]).optional()
24848
+ min: z31.union([z31.string().max(100), z31.number()]).optional(),
24849
+ max: z31.union([z31.string().max(100), z31.number()]).optional()
24345
24850
  });
24346
24851
  function staticOptions(values) {
24347
24852
  return values.map((value) => ({
@@ -24516,8 +25021,8 @@ var COMPANY_FILTER_FIELDS = [
24516
25021
  { key: "createdAt", label: "Added", type: "date", group: "Activity" },
24517
25022
  { key: "updatedAt", label: "Updated", type: "date", group: "Activity" }
24518
25023
  ];
24519
- var LeadFilterOptionsQuerySchema = z29.object({
24520
- listId: z29.uuid().optional()
25024
+ var LeadFilterOptionsQuerySchema = z31.object({
25025
+ listId: z31.uuid().optional()
24521
25026
  });
24522
25027
  function leadFilterConditionsDescription(fields) {
24523
25028
  const summary = fields.map((field) => `${field.key} (${field.type})`).join(", ");
@@ -24525,98 +25030,98 @@ function leadFilterConditionsDescription(fields) {
24525
25030
  }
24526
25031
 
24527
25032
  // ../../packages/crm-api/dist/types/savedView.js
24528
- import { z as z30 } from "zod";
24529
- var SavedViewConfigSchema = z30.object({
24530
- filters: z30.array(LeadFilterConditionSchema).max(50),
24531
- sort: z30.object({
24532
- field: z30.string().min(1).max(100),
25033
+ import { z as z32 } from "zod";
25034
+ var SavedViewConfigSchema = z32.object({
25035
+ filters: z32.array(LeadFilterConditionSchema).max(50),
25036
+ sort: z32.object({
25037
+ field: z32.string().min(1).max(100),
24533
25038
  direction: LeadSortDirectionSchema
24534
25039
  }).nullable(),
24535
- columns: z30.array(z30.string().min(1).max(100)).max(100).nullable(),
24536
- layout: z30.enum(["table", "board"]).nullable()
25040
+ columns: z32.array(z32.string().min(1).max(100)).max(100).nullable(),
25041
+ layout: z32.enum(["table", "board"]).nullable()
24537
25042
  });
24538
- var SavedViewListQuerySchema = z30.object({
25043
+ var SavedViewListQuerySchema = z32.object({
24539
25044
  entityType: CrmEntityTypeSchema,
24540
- pipelineId: z30.uuid().optional()
25045
+ pipelineId: z32.uuid().optional()
24541
25046
  });
24542
- var CreateSavedViewRequestSchema = z30.object({
25047
+ var CreateSavedViewRequestSchema = z32.object({
24543
25048
  entityType: CrmEntityTypeSchema,
24544
- pipelineId: z30.uuid().nullish(),
24545
- name: z30.string().min(1).max(100),
24546
- isShared: z30.boolean(),
25049
+ pipelineId: z32.uuid().nullish(),
25050
+ name: z32.string().min(1).max(100),
25051
+ isShared: z32.boolean(),
24547
25052
  config: SavedViewConfigSchema
24548
25053
  });
24549
- var UpdateSavedViewRequestSchema = z30.object({
24550
- name: z30.string().min(1).max(100).optional(),
24551
- isShared: z30.boolean().optional(),
25054
+ var UpdateSavedViewRequestSchema = z32.object({
25055
+ name: z32.string().min(1).max(100).optional(),
25056
+ isShared: z32.boolean().optional(),
24552
25057
  config: SavedViewConfigSchema.optional(),
24553
- position: z30.number().int().min(0).optional()
25058
+ position: z32.number().int().min(0).optional()
24554
25059
  });
24555
25060
 
24556
25061
  // ../../packages/crm-api/dist/types/privacy.js
24557
- import { z as z31 } from "zod";
24558
- var MergeRecordsRequestSchema = z31.object({
24559
- keepId: z31.uuid(),
24560
- mergeIds: z31.array(z31.uuid()).min(1).max(20)
25062
+ import { z as z33 } from "zod";
25063
+ var MergeRecordsRequestSchema = z33.object({
25064
+ keepId: z33.uuid(),
25065
+ mergeIds: z33.array(z33.uuid()).min(1).max(20)
24561
25066
  });
24562
- var SetDoNotContactRequestSchema = z31.object({
24563
- isDoNotContact: z31.boolean(),
24564
- reason: z31.string().max(500).nullish()
25067
+ var SetDoNotContactRequestSchema = z33.object({
25068
+ isDoNotContact: z33.boolean(),
25069
+ reason: z33.string().max(500).nullish()
24565
25070
  });
24566
- var SetContactPointOptOutRequestSchema = z31.object({
24567
- isOptedOut: z31.boolean(),
24568
- reason: z31.string().max(500).nullish()
25071
+ var SetContactPointOptOutRequestSchema = z33.object({
25072
+ isOptedOut: z33.boolean(),
25073
+ reason: z33.string().max(500).nullish()
24569
25074
  });
24570
- var ContactChannelSchema = z31.enum(["email", "phone"]);
24571
- var ContactConsentQuerySchema = z31.object({
24572
- personId: z31.uuid(),
25075
+ var ContactChannelSchema = z33.enum(["email", "phone"]);
25076
+ var ContactConsentQuerySchema = z33.object({
25077
+ personId: z33.uuid(),
24573
25078
  channel: ContactChannelSchema
24574
25079
  });
24575
25080
 
24576
25081
  // ../../packages/crm-api/dist/types/import.js
24577
- import { z as z32 } from "zod";
25082
+ import { z as z34 } from "zod";
24578
25083
  var CRM_IMPORT_MAX_BYTES = 10 * 1024 * 1024;
24579
- var ImportEntityTypeSchema = z32.enum(["person", "company"]);
24580
- var ImportMappingSchema = z32.record(z32.string(), z32.string().max(120));
24581
- var PreviewImportRequestSchema = z32.object({
25084
+ var ImportEntityTypeSchema = z34.enum(["person", "company"]);
25085
+ var ImportMappingSchema = z34.record(z34.string(), z34.string().max(120));
25086
+ var PreviewImportRequestSchema = z34.object({
24582
25087
  entityType: ImportEntityTypeSchema,
24583
- csv: z32.string().min(1).max(CRM_IMPORT_MAX_BYTES),
25088
+ csv: z34.string().min(1).max(CRM_IMPORT_MAX_BYTES),
24584
25089
  /** Omitted, the preview suggests one from the column names. */
24585
25090
  mapping: ImportMappingSchema.optional()
24586
25091
  });
24587
- var StartImportRequestSchema = z32.object({
25092
+ var StartImportRequestSchema = z34.object({
24588
25093
  entityType: ImportEntityTypeSchema,
24589
- csv: z32.string().min(1).max(CRM_IMPORT_MAX_BYTES),
25094
+ csv: z34.string().min(1).max(CRM_IMPORT_MAX_BYTES),
24590
25095
  mapping: ImportMappingSchema,
24591
25096
  /** A list of the same record type each imported record joins. */
24592
- listId: z32.uuid().nullish(),
24593
- tagIds: z32.array(z32.uuid()).max(20).optional()
25097
+ listId: z34.uuid().nullish(),
25098
+ tagIds: z34.array(z34.uuid()).max(20).optional()
24594
25099
  });
24595
- var ImportRunStatusSchema = z32.enum([
25100
+ var ImportRunStatusSchema = z34.enum([
24596
25101
  "pending",
24597
25102
  "running",
24598
25103
  "completed",
24599
25104
  "failed"
24600
25105
  ]);
24601
- var MatchPeopleRequestSchema = z32.object({
24602
- emails: z32.array(z32.string().min(3).max(320)).min(1).max(200)
25106
+ var MatchPeopleRequestSchema = z34.object({
25107
+ emails: z34.array(z34.string().min(3).max(320)).min(1).max(200)
24603
25108
  });
24604
25109
 
24605
25110
  // ../../packages/crm-api/dist/types/search.js
24606
- import { z as z33 } from "zod";
24607
- var PersonSearchFiltersSchema = z33.object({
25111
+ import { z as z35 } from "zod";
25112
+ var PersonSearchFiltersSchema = z35.object({
24608
25113
  // Scope to one company's people (the company detail People tab).
24609
- companyId: z33.uuid().optional(),
25114
+ companyId: z35.uuid().optional(),
24610
25115
  // Scope to a person list's members.
24611
- listId: z33.uuid().optional(),
25116
+ listId: z35.uuid().optional(),
24612
25117
  // Carrying ANY of these tags (OR-within, like the other array facets).
24613
- tagIds: z33.array(z33.uuid()).optional(),
24614
- minEmployeeCount: z33.number().int().min(0).optional(),
24615
- maxEmployeeCount: z33.number().int().min(0).optional(),
25118
+ tagIds: z35.array(z35.uuid()).optional(),
25119
+ minEmployeeCount: z35.number().int().min(0).optional(),
25120
+ maxEmployeeCount: z35.number().int().min(0).optional(),
24616
25121
  // Column conditions, ANDed together and with the keys above.
24617
- conditions: z33.array(LeadFilterConditionSchema).max(20).optional().describe(leadFilterConditionsDescription(PERSON_FILTER_FIELDS))
25122
+ conditions: z35.array(LeadFilterConditionSchema).max(20).optional().describe(leadFilterConditionsDescription(PERSON_FILTER_FIELDS))
24618
25123
  });
24619
- var PersonSearchSortSchema = z33.enum([
25124
+ var PersonSearchSortSchema = z35.enum([
24620
25125
  "relevance",
24621
25126
  "recent",
24622
25127
  "updated",
@@ -24628,30 +25133,30 @@ var PersonSearchSortSchema = z33.enum([
24628
25133
  "phone",
24629
25134
  "linkedin"
24630
25135
  ]);
24631
- var PersonSearchRequestSchema = z33.object({
25136
+ var PersonSearchRequestSchema = z35.object({
24632
25137
  // Free-text keyword query (FTS + fuzzy fallback). Omit for pure facet browse.
24633
- query: z33.string().optional(),
25138
+ query: z35.string().optional(),
24634
25139
  filters: PersonSearchFiltersSchema.optional(),
24635
25140
  sort: PersonSearchSortSchema.default("relevance"),
24636
25141
  // Direction for the column sort; omitted falls back to the sort's default.
24637
25142
  direction: LeadSortDirectionSchema.optional(),
24638
25143
  // Keyset pagination — opaque cursor from the previous response.
24639
- cursor: z33.string().nullable().optional(),
24640
- limit: z33.number().int().min(1).max(100).default(25)
25144
+ cursor: z35.string().nullable().optional(),
25145
+ limit: z35.number().int().min(1).max(100).default(25)
24641
25146
  });
24642
- var CompanySearchFiltersSchema = z33.object({
25147
+ var CompanySearchFiltersSchema = z35.object({
24643
25148
  // Scope to a company list's members.
24644
- listId: z33.uuid().optional(),
25149
+ listId: z35.uuid().optional(),
24645
25150
  // Carrying ANY of these tags (OR-within, like the other array facets).
24646
- tagIds: z33.array(z33.uuid()).optional(),
24647
- industry: z33.array(z33.string()).optional(),
24648
- hqCountry: z33.array(z33.string()).optional(),
24649
- minEmployeeCount: z33.number().int().min(0).optional(),
24650
- maxEmployeeCount: z33.number().int().min(0).optional(),
25151
+ tagIds: z35.array(z35.uuid()).optional(),
25152
+ industry: z35.array(z35.string()).optional(),
25153
+ hqCountry: z35.array(z35.string()).optional(),
25154
+ minEmployeeCount: z35.number().int().min(0).optional(),
25155
+ maxEmployeeCount: z35.number().int().min(0).optional(),
24651
25156
  // Column conditions, ANDed together and with the keys above.
24652
- conditions: z33.array(LeadFilterConditionSchema).max(20).optional().describe(leadFilterConditionsDescription(COMPANY_FILTER_FIELDS))
25157
+ conditions: z35.array(LeadFilterConditionSchema).max(20).optional().describe(leadFilterConditionsDescription(COMPANY_FILTER_FIELDS))
24653
25158
  });
24654
- var CompanySearchSortSchema = z33.enum([
25159
+ var CompanySearchSortSchema = z35.enum([
24655
25160
  "relevance",
24656
25161
  "employee_count",
24657
25162
  "recent",
@@ -24661,211 +25166,211 @@ var CompanySearchSortSchema = z33.enum([
24661
25166
  "industry",
24662
25167
  "hq"
24663
25168
  ]);
24664
- var CompanySearchRequestSchema = z33.object({
24665
- query: z33.string().optional(),
25169
+ var CompanySearchRequestSchema = z35.object({
25170
+ query: z35.string().optional(),
24666
25171
  filters: CompanySearchFiltersSchema.optional(),
24667
25172
  sort: CompanySearchSortSchema.default("relevance"),
24668
25173
  direction: LeadSortDirectionSchema.optional(),
24669
- cursor: z33.string().nullable().optional(),
24670
- limit: z33.number().int().min(1).max(100).default(25),
24671
- includeFacets: z33.boolean().default(false)
25174
+ cursor: z35.string().nullable().optional(),
25175
+ limit: z35.number().int().min(1).max(100).default(25),
25176
+ includeFacets: z35.boolean().default(false)
24672
25177
  });
24673
25178
 
24674
25179
  // ../../packages/crm-api/dist/types/globalSearch.js
24675
- import { z as z34 } from "zod";
24676
- var GlobalSearchRequestSchema = z34.object({
24677
- query: z34.string().min(1).max(200),
25180
+ import { z as z36 } from "zod";
25181
+ var GlobalSearchRequestSchema = z36.object({
25182
+ query: z36.string().min(1).max(200),
24678
25183
  // Per-entity cap; the response holds up to 3 × this many results.
24679
- limitPerType: z34.number().int().min(1).max(20).default(6)
25184
+ limitPerType: z36.number().int().min(1).max(20).default(6)
24680
25185
  });
24681
25186
 
24682
25187
  // ../../packages/crm-api/dist/types/leadTools.js
24683
- import { z as z35 } from "zod";
25188
+ import { z as z37 } from "zod";
24684
25189
  var LEAD_BATCH_MAX = 100;
24685
25190
  var companyEnrichmentFields = {
24686
- legalName: z35.string().nullish(),
24687
- tagline: z35.string().nullish(),
24688
- linkedinUrl: z35.string().nullish(),
24689
- logoUrl: z35.string().nullish(),
25191
+ legalName: z37.string().nullish(),
25192
+ tagline: z37.string().nullish(),
25193
+ linkedinUrl: z37.string().nullish(),
25194
+ logoUrl: z37.string().nullish(),
24690
25195
  companyType: CompanyTypeSchema.nullish(),
24691
- industry: z35.string().nullish(),
24692
- subIndustry: z35.string().nullish(),
24693
- keywords: z35.array(z35.string()).max(50).nullish(),
24694
- description: z35.string().nullish(),
24695
- employeeCount: z35.number().int().min(0).nullish(),
24696
- foundedYear: z35.number().int().nullish(),
24697
- ticker: z35.string().nullish(),
24698
- annualRevenueUsd: z35.number().min(0).nullish(),
24699
- totalFundingUsd: z35.number().min(0).nullish(),
24700
- lastFundingRound: z35.string().nullish(),
25196
+ industry: z37.string().nullish(),
25197
+ subIndustry: z37.string().nullish(),
25198
+ keywords: z37.array(z37.string()).max(50).nullish(),
25199
+ description: z37.string().nullish(),
25200
+ employeeCount: z37.number().int().min(0).nullish(),
25201
+ foundedYear: z37.number().int().nullish(),
25202
+ ticker: z37.string().nullish(),
25203
+ annualRevenueUsd: z37.number().min(0).nullish(),
25204
+ totalFundingUsd: z37.number().min(0).nullish(),
25205
+ lastFundingRound: z37.string().nullish(),
24701
25206
  // ISO date, e.g. 2025-03-01
24702
- lastFundingAt: z35.string().nullish(),
24703
- investors: z35.array(z35.string()).max(50).nullish(),
24704
- hqCity: z35.string().nullish(),
24705
- hqRegion: z35.string().nullish(),
24706
- hqCountry: z35.string().nullish(),
24707
- hqAddress: z35.string().nullish(),
24708
- phone: z35.string().nullish(),
24709
- twitterUrl: z35.string().nullish(),
24710
- githubUrl: z35.string().nullish(),
24711
- facebookUrl: z35.string().nullish(),
24712
- youtubeUrl: z35.string().nullish(),
24713
- instagramUrl: z35.string().nullish(),
24714
- crunchbaseUrl: z35.string().nullish(),
24715
- techStack: z35.array(z35.string()).max(100).nullish()
25207
+ lastFundingAt: z37.string().nullish(),
25208
+ investors: z37.array(z37.string()).max(50).nullish(),
25209
+ hqCity: z37.string().nullish(),
25210
+ hqRegion: z37.string().nullish(),
25211
+ hqCountry: z37.string().nullish(),
25212
+ hqAddress: z37.string().nullish(),
25213
+ phone: z37.string().nullish(),
25214
+ twitterUrl: z37.string().nullish(),
25215
+ githubUrl: z37.string().nullish(),
25216
+ facebookUrl: z37.string().nullish(),
25217
+ youtubeUrl: z37.string().nullish(),
25218
+ instagramUrl: z37.string().nullish(),
25219
+ crunchbaseUrl: z37.string().nullish(),
25220
+ techStack: z37.array(z37.string()).max(100).nullish()
24716
25221
  };
24717
- var CreateLeadCompanyRequestSchema = z35.strictObject({
24718
- name: z35.string().min(1),
24719
- domain: z35.string().optional(),
25222
+ var CreateLeadCompanyRequestSchema = z37.strictObject({
25223
+ name: z37.string().min(1),
25224
+ domain: z37.string().optional(),
24720
25225
  ...companyEnrichmentFields
24721
25226
  });
24722
- var LeadPersonEducationInputSchema = z35.strictObject({
24723
- school: z35.string().min(1),
24724
- degree: z35.string().optional(),
24725
- field: z35.string().optional(),
24726
- startYear: z35.number().int().optional(),
24727
- endYear: z35.number().int().optional()
25227
+ var LeadPersonEducationInputSchema = z37.strictObject({
25228
+ school: z37.string().min(1),
25229
+ degree: z37.string().optional(),
25230
+ field: z37.string().optional(),
25231
+ startYear: z37.number().int().optional(),
25232
+ endYear: z37.number().int().optional()
24728
25233
  });
24729
25234
  var personEnrichmentFields = {
24730
- title: z35.string().nullish(),
24731
- headline: z35.string().nullish(),
24732
- bio: z35.string().nullish(),
24733
- department: z35.string().nullish(),
24734
- yearsExperience: z35.number().int().min(0).max(80).nullish(),
24735
- skills: z35.array(z35.string()).max(50).nullish(),
24736
- languages: z35.array(z35.string()).max(20).nullish(),
24737
- photoUrl: z35.string().nullish(),
24738
- linkedinUrl: z35.string().nullish(),
24739
- twitterUrl: z35.string().nullish(),
24740
- githubUrl: z35.string().nullish(),
24741
- facebookUrl: z35.string().nullish(),
24742
- youtubeUrl: z35.string().nullish(),
24743
- instagramUrl: z35.string().nullish(),
24744
- personalWebsiteUrl: z35.string().nullish(),
24745
- email: z35.string().nullish(),
24746
- locationCity: z35.string().nullish(),
24747
- locationRegion: z35.string().nullish(),
24748
- locationCountry: z35.string().nullish(),
25235
+ title: z37.string().nullish(),
25236
+ headline: z37.string().nullish(),
25237
+ bio: z37.string().nullish(),
25238
+ department: z37.string().nullish(),
25239
+ yearsExperience: z37.number().int().min(0).max(80).nullish(),
25240
+ skills: z37.array(z37.string()).max(50).nullish(),
25241
+ languages: z37.array(z37.string()).max(20).nullish(),
25242
+ photoUrl: z37.string().nullish(),
25243
+ linkedinUrl: z37.string().nullish(),
25244
+ twitterUrl: z37.string().nullish(),
25245
+ githubUrl: z37.string().nullish(),
25246
+ facebookUrl: z37.string().nullish(),
25247
+ youtubeUrl: z37.string().nullish(),
25248
+ instagramUrl: z37.string().nullish(),
25249
+ personalWebsiteUrl: z37.string().nullish(),
25250
+ email: z37.string().nullish(),
25251
+ locationCity: z37.string().nullish(),
25252
+ locationRegion: z37.string().nullish(),
25253
+ locationCountry: z37.string().nullish(),
24749
25254
  // IANA timezone, e.g. America/New_York
24750
- timezone: z35.string().nullish(),
25255
+ timezone: z37.string().nullish(),
24751
25256
  // Full education history — REPLACES any previously saved entries.
24752
- educations: z35.array(LeadPersonEducationInputSchema).max(10).optional()
25257
+ educations: z37.array(LeadPersonEducationInputSchema).max(10).optional()
24753
25258
  };
24754
- var CreateLeadPersonRequestSchema = z35.strictObject({
24755
- fullName: z35.string().min(1),
25259
+ var CreateLeadPersonRequestSchema = z37.strictObject({
25260
+ fullName: z37.string().min(1),
24756
25261
  ...personEnrichmentFields,
24757
- companyId: z35.string().optional(),
24758
- companyName: z35.string().optional(),
24759
- companyDomain: z35.string().optional()
25262
+ companyId: z37.string().optional(),
25263
+ companyName: z37.string().optional(),
25264
+ companyDomain: z37.string().optional()
24760
25265
  });
24761
- var UpdateLeadCompanyRequestSchema = z35.strictObject({
24762
- id: z35.uuid(),
24763
- name: z35.string().min(1).optional(),
24764
- domain: z35.string().optional(),
25266
+ var UpdateLeadCompanyRequestSchema = z37.strictObject({
25267
+ id: z37.uuid(),
25268
+ name: z37.string().min(1).optional(),
25269
+ domain: z37.string().optional(),
24765
25270
  ...companyEnrichmentFields,
24766
25271
  // Registry-defined custom fields; validated + merged server-side.
24767
25272
  custom: CustomFieldValuesSchema.optional()
24768
25273
  });
24769
- var UpdateLeadPersonRequestSchema = z35.strictObject({
24770
- id: z35.uuid(),
24771
- fullName: z35.string().min(1).optional(),
25274
+ var UpdateLeadPersonRequestSchema = z37.strictObject({
25275
+ id: z37.uuid(),
25276
+ fullName: z37.string().min(1).optional(),
24772
25277
  ...personEnrichmentFields,
24773
25278
  // (re)assign current employment — companyId, or companyName/companyDomain
24774
25279
  // to find-or-create the company first
24775
- companyId: z35.string().optional(),
24776
- companyName: z35.string().optional(),
24777
- companyDomain: z35.string().optional(),
25280
+ companyId: z37.string().optional(),
25281
+ companyName: z37.string().optional(),
25282
+ companyDomain: z37.string().optional(),
24778
25283
  // Set the primary company directly (the people.current_company_id cache shown
24779
25284
  // in lists/header). Independent of the employment rows that hold the full set
24780
25285
  // of current roles; null clears it. Recompute overwrites it when the current
24781
25286
  // employment set changes.
24782
- primaryCompanyId: z35.string().nullish(),
25287
+ primaryCompanyId: z37.string().nullish(),
24783
25288
  // Registry-defined custom fields; validated + merged server-side.
24784
25289
  custom: CustomFieldValuesSchema.optional()
24785
25290
  });
24786
- var LeadEmploymentInputSchema = z35.strictObject({
24787
- companyId: z35.uuid().nullish(),
24788
- companyName: z35.string().nullish(),
24789
- title: z35.string().nullish(),
24790
- startDate: z35.string().nullish(),
24791
- endDate: z35.string().nullish(),
24792
- isCurrent: z35.boolean().default(false)
25291
+ var LeadEmploymentInputSchema = z37.strictObject({
25292
+ companyId: z37.uuid().nullish(),
25293
+ companyName: z37.string().nullish(),
25294
+ title: z37.string().nullish(),
25295
+ startDate: z37.string().nullish(),
25296
+ endDate: z37.string().nullish(),
25297
+ isCurrent: z37.boolean().default(false)
24793
25298
  });
24794
- var UpdateLeadEmploymentRequestSchema = z35.strictObject({
24795
- companyId: z35.uuid().nullish(),
24796
- companyName: z35.string().nullish(),
24797
- title: z35.string().nullish(),
24798
- startDate: z35.string().nullish(),
24799
- endDate: z35.string().nullish(),
24800
- isCurrent: z35.boolean().optional()
25299
+ var UpdateLeadEmploymentRequestSchema = z37.strictObject({
25300
+ companyId: z37.uuid().nullish(),
25301
+ companyName: z37.string().nullish(),
25302
+ title: z37.string().nullish(),
25303
+ startDate: z37.string().nullish(),
25304
+ endDate: z37.string().nullish(),
25305
+ isCurrent: z37.boolean().optional()
24801
25306
  });
24802
- var LeadContactPointInputSchema = z35.strictObject({
25307
+ var LeadContactPointInputSchema = z37.strictObject({
24803
25308
  kind: ContactPointKindSchema,
24804
- value: z35.string().min(1),
25309
+ value: z37.string().min(1),
24805
25310
  status: ContactPointStatusSchema.optional(),
24806
- isPrimary: z35.boolean().optional()
25311
+ isPrimary: z37.boolean().optional()
24807
25312
  });
24808
- var UpdateLeadContactPointRequestSchema = z35.strictObject({
25313
+ var UpdateLeadContactPointRequestSchema = z37.strictObject({
24809
25314
  kind: ContactPointKindSchema.optional(),
24810
- value: z35.string().min(1).optional(),
25315
+ value: z37.string().min(1).optional(),
24811
25316
  status: ContactPointStatusSchema.optional(),
24812
- isPrimary: z35.boolean().optional()
25317
+ isPrimary: z37.boolean().optional()
24813
25318
  });
24814
- var LeadCompanyPeopleRequestSchema = z35.object({
24815
- limit: z35.coerce.number().int().min(1).max(100).default(50),
24816
- cursor: z35.string().optional(),
25319
+ var LeadCompanyPeopleRequestSchema = z37.object({
25320
+ limit: z37.coerce.number().int().min(1).max(100).default(50),
25321
+ cursor: z37.string().optional(),
24817
25322
  sort: PersonSearchSortSchema.default("recent"),
24818
25323
  direction: LeadSortDirectionSchema.optional()
24819
25324
  });
24820
- var CreateLeadCompaniesRequestSchema = z35.strictObject({
24821
- companies: z35.array(CreateLeadCompanyRequestSchema).min(1).max(LEAD_BATCH_MAX)
25325
+ var CreateLeadCompaniesRequestSchema = z37.strictObject({
25326
+ companies: z37.array(CreateLeadCompanyRequestSchema).min(1).max(LEAD_BATCH_MAX)
24822
25327
  });
24823
- var CreateLeadPeopleRequestSchema = z35.strictObject({
24824
- people: z35.array(CreateLeadPersonRequestSchema).min(1).max(LEAD_BATCH_MAX)
25328
+ var CreateLeadPeopleRequestSchema = z37.strictObject({
25329
+ people: z37.array(CreateLeadPersonRequestSchema).min(1).max(LEAD_BATCH_MAX)
24825
25330
  });
24826
- var UpdateLeadCompaniesRequestSchema = z35.strictObject({
24827
- companies: z35.array(UpdateLeadCompanyRequestSchema).min(1).max(LEAD_BATCH_MAX)
25331
+ var UpdateLeadCompaniesRequestSchema = z37.strictObject({
25332
+ companies: z37.array(UpdateLeadCompanyRequestSchema).min(1).max(LEAD_BATCH_MAX)
24828
25333
  });
24829
- var UpdateLeadPeopleRequestSchema = z35.strictObject({
24830
- people: z35.array(UpdateLeadPersonRequestSchema).min(1).max(LEAD_BATCH_MAX)
25334
+ var UpdateLeadPeopleRequestSchema = z37.strictObject({
25335
+ people: z37.array(UpdateLeadPersonRequestSchema).min(1).max(LEAD_BATCH_MAX)
24831
25336
  });
24832
- var DeleteLeadCompaniesRequestSchema = z35.strictObject({
24833
- ids: z35.array(z35.uuid()).min(1).max(LEAD_BATCH_MAX)
25337
+ var DeleteLeadCompaniesRequestSchema = z37.strictObject({
25338
+ ids: z37.array(z37.uuid()).min(1).max(LEAD_BATCH_MAX)
24834
25339
  });
24835
- var DeleteLeadPeopleRequestSchema = z35.strictObject({
24836
- ids: z35.array(z35.uuid()).min(1).max(LEAD_BATCH_MAX)
25340
+ var DeleteLeadPeopleRequestSchema = z37.strictObject({
25341
+ ids: z37.array(z37.uuid()).min(1).max(LEAD_BATCH_MAX)
24837
25342
  });
24838
25343
 
24839
25344
  // ../../packages/crm-api/dist/types/enrichment.js
24840
- import { z as z36 } from "zod";
25345
+ import { z as z38 } from "zod";
24841
25346
  var ENRICHMENT_BATCH_LIMIT = 25;
24842
- var EnrichPeopleRequestSchema = z36.object({
24843
- personIds: z36.array(z36.uuid()).min(1).max(ENRICHMENT_BATCH_LIMIT),
25347
+ var EnrichPeopleRequestSchema = z38.object({
25348
+ personIds: z38.array(z38.uuid()).min(1).max(ENRICHMENT_BATCH_LIMIT),
24844
25349
  // A person with only an UNVERIFIED contact reruns the chain, excluding the
24845
25350
  // providers that sourced it. Verified contacts always short-circuit.
24846
- retryUnverified: z36.boolean().optional()
25351
+ retryUnverified: z38.boolean().optional()
24847
25352
  });
24848
25353
  var ENRICHMENT_RUN_PERSON_LIMIT = 500;
24849
- var EnrichmentRunActionSchema = z36.enum([
25354
+ var EnrichmentRunActionSchema = z38.enum([
24850
25355
  "emails",
24851
25356
  "validate",
24852
25357
  "phones"
24853
25358
  ]);
24854
- var StartEnrichmentRunRequestSchema = z36.object({
24855
- personIds: z36.array(z36.uuid()).min(1).max(ENRICHMENT_RUN_PERSON_LIMIT),
24856
- actions: z36.array(EnrichmentRunActionSchema).min(1),
24857
- retryUnverified: z36.boolean()
25359
+ var StartEnrichmentRunRequestSchema = z38.object({
25360
+ personIds: z38.array(z38.uuid()).min(1).max(ENRICHMENT_RUN_PERSON_LIMIT),
25361
+ actions: z38.array(EnrichmentRunActionSchema).min(1),
25362
+ retryUnverified: z38.boolean()
24858
25363
  });
24859
- var EnrichmentCoverageRequestSchema = z36.object({
24860
- personIds: z36.array(z36.uuid()).min(1).max(ENRICHMENT_RUN_PERSON_LIMIT)
25364
+ var EnrichmentCoverageRequestSchema = z38.object({
25365
+ personIds: z38.array(z38.uuid()).min(1).max(ENRICHMENT_RUN_PERSON_LIMIT)
24861
25366
  });
24862
- var UpdateContactPointStatusRequestSchema = z36.object({
24863
- status: z36.enum(["verified", "unverified"])
25367
+ var UpdateContactPointStatusRequestSchema = z38.object({
25368
+ status: z38.enum(["verified", "unverified"])
24864
25369
  });
24865
25370
 
24866
25371
  // ../../packages/crm-api/dist/types/providers.js
24867
- import { z as z37 } from "zod";
24868
- var EmailEnrichmentProviderIdSchema = z37.enum([
25372
+ import { z as z39 } from "zod";
25373
+ var EmailEnrichmentProviderIdSchema = z39.enum([
24869
25374
  "hunter",
24870
25375
  "apollo",
24871
25376
  "prospeo",
@@ -24880,7 +25385,7 @@ var EmailEnrichmentProviderIdSchema = z37.enum([
24880
25385
  "wiza",
24881
25386
  "crustdata"
24882
25387
  ]);
24883
- var EmailValidationProviderIdSchema = z37.enum([
25388
+ var EmailValidationProviderIdSchema = z39.enum([
24884
25389
  "zerobounce",
24885
25390
  "neverbounce",
24886
25391
  "hunter",
@@ -24888,7 +25393,7 @@ var EmailValidationProviderIdSchema = z37.enum([
24888
25393
  "leadmagic",
24889
25394
  "snov"
24890
25395
  ]);
24891
- var PhoneEnrichmentProviderIdSchema = z37.enum([
25396
+ var PhoneEnrichmentProviderIdSchema = z39.enum([
24892
25397
  "prospeo",
24893
25398
  "findymail",
24894
25399
  "leadmagic",
@@ -24900,7 +25405,7 @@ var PhoneEnrichmentProviderIdSchema = z37.enum([
24900
25405
  "wiza",
24901
25406
  "crustdata"
24902
25407
  ]);
24903
- var IntegrationProviderIdSchema = z37.enum([
25408
+ var IntegrationProviderIdSchema = z39.enum([
24904
25409
  "hunter",
24905
25410
  "apollo",
24906
25411
  "prospeo",
@@ -24917,10 +25422,10 @@ var IntegrationProviderIdSchema = z37.enum([
24917
25422
  "wiza",
24918
25423
  "crustdata"
24919
25424
  ]);
24920
- var UpdateEnrichmentWaterfallsRequestSchema = z37.object({
24921
- emailEnrichment: z37.array(EmailEnrichmentProviderIdSchema).optional(),
24922
- emailValidation: z37.array(EmailValidationProviderIdSchema).optional(),
24923
- phoneEnrichment: z37.array(PhoneEnrichmentProviderIdSchema).optional()
25425
+ var UpdateEnrichmentWaterfallsRequestSchema = z39.object({
25426
+ emailEnrichment: z39.array(EmailEnrichmentProviderIdSchema).optional(),
25427
+ emailValidation: z39.array(EmailValidationProviderIdSchema).optional(),
25428
+ phoneEnrichment: z39.array(PhoneEnrichmentProviderIdSchema).optional()
24924
25429
  });
24925
25430
 
24926
25431
  // ../../packages/crm-api/dist/clients/V1CrmApiClient.js
@@ -25496,6 +26001,14 @@ var V1CrmApiClient = class {
25496
26001
  method: "DELETE"
25497
26002
  });
25498
26003
  }
26004
+ // ── Record access ──────────────────────────────────────────────────
26005
+ async setRecordAccess(entityType, entityId, body) {
26006
+ this.http.requireAuthed();
26007
+ return this.http.fetch(`${CRM}/access/${entityType}/${enc(entityId)}`, {
26008
+ method: "PUT",
26009
+ body
26010
+ });
26011
+ }
25499
26012
  // ── Custom fields ──────────────────────────────────────────────────
25500
26013
  async createCustomField(body) {
25501
26014
  this.http.requireAuthed();
@@ -25552,7 +26065,7 @@ var V1CrmApiClient = class {
25552
26065
  // package.json
25553
26066
  var package_default = {
25554
26067
  name: "@general-input/cli",
25555
- version: "0.21.0",
26068
+ version: "0.23.0",
25556
26069
  type: "module",
25557
26070
  description: "The agent-facing CLI for General Input. Authenticate, manage workflows, run bash with operator credentials injected by the cloud.",
25558
26071
  license: "SEE LICENSE IN LICENSE",
@@ -25603,6 +26116,7 @@ var package_default = {
25603
26116
  devDependencies: {
25604
26117
  "@general-input/core": "workspace:*",
25605
26118
  "@packages/api": "workspace:*",
26119
+ "@packages/bundler": "workspace:*",
25606
26120
  "@packages/crm-api": "workspace:*",
25607
26121
  "@packages/egress-proxy": "workspace:*",
25608
26122
  "@packages/eslint-config": "workspace:*",
@@ -25654,27 +26168,27 @@ var ApiClientFactory = class {
25654
26168
  import { mkdir, readFile, writeFile, unlink, chmod } from "fs/promises";
25655
26169
 
25656
26170
  // src/types/session.ts
25657
- import { z as z38 } from "zod";
25658
- var RunnerSessionFileSchema = z38.object({
25659
- version: z38.literal(1),
25660
- server: z38.url(),
26171
+ import { z as z40 } from "zod";
26172
+ var RunnerSessionFileSchema = z40.object({
26173
+ version: z40.literal(1),
26174
+ server: z40.url(),
25661
26175
  /** Plaintext runner-session token (`geni_rs_…`). */
25662
- token: z38.string().startsWith("geni_rs_"),
25663
- user: z38.object({
25664
- id: z38.string(),
25665
- email: z38.string().nullable(),
25666
- name: z38.string().nullable()
26176
+ token: z40.string().startsWith("geni_rs_"),
26177
+ user: z40.object({
26178
+ id: z40.string(),
26179
+ email: z40.string().nullable(),
26180
+ name: z40.string().nullable()
25667
26181
  }),
25668
- workspace: z38.object({
25669
- membershipId: z38.string(),
25670
- organizationId: z38.string(),
25671
- slug: z38.string(),
25672
- name: z38.string(),
25673
- profilePictureUrl: z38.string().nullable().optional(),
25674
- role: z38.string()
26182
+ workspace: z40.object({
26183
+ membershipId: z40.string(),
26184
+ organizationId: z40.string(),
26185
+ slug: z40.string(),
26186
+ name: z40.string(),
26187
+ profilePictureUrl: z40.string().nullable().optional(),
26188
+ role: z40.string()
25675
26189
  }),
25676
26190
  /** ISO 8601 — when the file was last written by login or workspace switch. */
25677
- savedAt: z38.string()
26191
+ savedAt: z40.string()
25678
26192
  });
25679
26193
 
25680
26194
  // src/clients/SessionStore.ts
@@ -25763,16 +26277,16 @@ function isErrnoCode(err, expected) {
25763
26277
  import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, unlink as unlink2 } from "fs/promises";
25764
26278
 
25765
26279
  // src/types/browserSession.ts
25766
- import { z as z39 } from "zod";
25767
- var BrowserSessionFileSchema = z39.object({
25768
- token: z39.string(),
25769
- cdpUrl: z39.string(),
25770
- provider: z39.string(),
25771
- liveViewUrl: z39.string().nullable(),
26280
+ import { z as z41 } from "zod";
26281
+ var BrowserSessionFileSchema = z41.object({
26282
+ token: z41.string(),
26283
+ cdpUrl: z41.string(),
26284
+ provider: z41.string(),
26285
+ liveViewUrl: z41.string().nullable(),
25772
26286
  /** API server the session was opened against, for diagnostics. */
25773
- server: z39.string(),
25774
- openedAt: z39.string(),
25775
- keepalivePid: z39.number().nullable()
26287
+ server: z41.string(),
26288
+ openedAt: z41.string(),
26289
+ keepalivePid: z41.number().nullable()
25776
26290
  });
25777
26291
 
25778
26292
  // src/clients/BrowserSessionStore.ts
@@ -25824,9 +26338,9 @@ function isErrnoCode2(err, expected) {
25824
26338
  }
25825
26339
 
25826
26340
  // src/clients/ConfigStore.ts
25827
- import { readFileSync as readFileSync3 } from "fs";
26341
+ import { readFileSync as readFileSync4 } from "fs";
25828
26342
  import { mkdir as mkdir3, writeFile as writeFile3, unlink as unlink3 } from "fs/promises";
25829
- import { dirname as dirname2 } from "path";
26343
+ import { dirname as dirname3 } from "path";
25830
26344
  var ConfigStore = class {
25831
26345
  constructor(filePath) {
25832
26346
  this.filePath = filePath;
@@ -25840,7 +26354,7 @@ var ConfigStore = class {
25840
26354
  loadSync() {
25841
26355
  let raw;
25842
26356
  try {
25843
- raw = readFileSync3(this.filePath, "utf8");
26357
+ raw = readFileSync4(this.filePath, "utf8");
25844
26358
  } catch {
25845
26359
  return null;
25846
26360
  }
@@ -25858,7 +26372,7 @@ var ConfigStore = class {
25858
26372
  * config is non-secret, unlike the session file.
25859
26373
  */
25860
26374
  async save(config) {
25861
- await mkdir3(dirname2(this.filePath), { recursive: true });
26375
+ await mkdir3(dirname3(this.filePath), { recursive: true });
25862
26376
  await writeFile3(this.filePath, JSON.stringify(config, null, 2) + "\n", {
25863
26377
  mode: 420
25864
26378
  });
@@ -26019,7 +26533,7 @@ function signalNumber(signal) {
26019
26533
  // src/clients/EgressProxyHost.ts
26020
26534
  import { mkdtemp, writeFile as writeFile4, rm } from "fs/promises";
26021
26535
  import { tmpdir } from "os";
26022
- import { join as join5 } from "path";
26536
+ import { join as join6 } from "path";
26023
26537
  import tls4 from "tls";
26024
26538
 
26025
26539
  // ../../packages/egress-proxy/dist/ca.js
@@ -26106,7 +26620,7 @@ function createEgressCa(material) {
26106
26620
  }
26107
26621
 
26108
26622
  // ../../packages/egress-proxy/dist/policyStore.js
26109
- import { readFileSync as readFileSync4, statSync as statSync3 } from "fs";
26623
+ import { readFileSync as readFileSync5, statSync as statSync3 } from "fs";
26110
26624
  var EMPTY_POLICY = {
26111
26625
  unmatched: "allow_log",
26112
26626
  credentials: []
@@ -26139,7 +26653,7 @@ var EgressPolicyStore = class {
26139
26653
  return;
26140
26654
  this.loadedMtimeMs = mtimeMs;
26141
26655
  try {
26142
- const parsed = ExecutionEgressPolicySchema.safeParse(JSON.parse(readFileSync4(this.filePath, "utf-8")));
26656
+ const parsed = ExecutionEgressPolicySchema.safeParse(JSON.parse(readFileSync5(this.filePath, "utf-8")));
26143
26657
  this.policy = parsed.success ? parsed.data : EMPTY_POLICY;
26144
26658
  } catch {
26145
26659
  this.policy = EMPTY_POLICY;
@@ -26242,18 +26756,18 @@ function createEgressProxy(args) {
26242
26756
  }
26243
26757
 
26244
26758
  // src/lib/egressCa.ts
26245
- import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
26246
- import { join as join4 } from "path";
26247
- import { z as z40 } from "zod";
26759
+ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
26760
+ import { join as join5 } from "path";
26761
+ import { z as z42 } from "zod";
26248
26762
  var EGRESS_CA_CACHE_VERSION = 3;
26249
- var EgressCaCacheSchema = z40.object({
26250
- version: z40.literal(EGRESS_CA_CACHE_VERSION),
26251
- caKeyPem: z40.string().min(1),
26252
- caCertPem: z40.string().min(1),
26253
- leafKeyPem: z40.string().min(1)
26763
+ var EgressCaCacheSchema = z42.object({
26764
+ version: z42.literal(EGRESS_CA_CACHE_VERSION),
26765
+ caKeyPem: z42.string().min(1),
26766
+ caCertPem: z42.string().min(1),
26767
+ leafKeyPem: z42.string().min(1)
26254
26768
  });
26255
26769
  function loadOrCreateEgressCa() {
26256
- const path = join4(ensureCacheDir(), "egress-ca.json");
26770
+ const path = join5(ensureCacheDir(), "egress-ca.json");
26257
26771
  const cached = readMaterial(path);
26258
26772
  if (cached !== null) {
26259
26773
  try {
@@ -26276,7 +26790,7 @@ function readMaterial(path) {
26276
26790
  if (!existsSync3(path)) return null;
26277
26791
  try {
26278
26792
  const parsed = EgressCaCacheSchema.safeParse(
26279
- JSON.parse(readFileSync5(path, "utf-8"))
26793
+ JSON.parse(readFileSync6(path, "utf-8"))
26280
26794
  );
26281
26795
  if (!parsed.success) return null;
26282
26796
  const { caKeyPem, caCertPem, leafKeyPem } = parsed.data;
@@ -26289,10 +26803,10 @@ function readMaterial(path) {
26289
26803
  // src/clients/EgressProxyHost.ts
26290
26804
  var EgressProxyHost = class {
26291
26805
  async start(policy) {
26292
- const dir = await mkdtemp(join5(tmpdir(), "gi-egress-"));
26293
- const caFile = join5(dir, "ca.pem");
26294
- const bundleFile = join5(dir, "bundle.pem");
26295
- const policyFile = join5(dir, "policy.json");
26806
+ const dir = await mkdtemp(join6(tmpdir(), "gi-egress-"));
26807
+ const caFile = join6(dir, "ca.pem");
26808
+ const bundleFile = join6(dir, "bundle.pem");
26809
+ const policyFile = join6(dir, "policy.json");
26296
26810
  const ca = loadOrCreateEgressCa();
26297
26811
  await writeFile4(caFile, ca.caCertPem);
26298
26812
  await writeFile4(
@@ -26455,14 +26969,21 @@ function subject(command) {
26455
26969
  );
26456
26970
  }
26457
26971
  function audienceOptions(command) {
26458
- return command.option("--organization", "Apply to every workspace member.").option("--member <membershipId>", "Apply to one workspace membership id.");
26972
+ return command.option("--organization", "Apply to every workspace member.").option("--member <membershipId>", "Apply to one workspace membership id.").option(
26973
+ "--team <teamId>",
26974
+ "Apply to everyone on a team, now and later (`geni workspace teams` lists ids)."
26975
+ );
26459
26976
  }
26460
26977
  function audience(options) {
26461
- if (Boolean(options.organization) === Boolean(options.member))
26978
+ const chosen = [options.organization, options.member, options.team].filter(
26979
+ Boolean
26980
+ );
26981
+ if (chosen.length !== 1)
26462
26982
  throw new Error(
26463
- "Choose exactly one of --organization or --member <membershipId>."
26983
+ "Choose exactly one of --organization, --member <membershipId> or --team <teamId>."
26464
26984
  );
26465
26985
  if (options.member) return { type: "member", membershipId: options.member };
26986
+ if (options.team) return { type: "team", teamId: options.team };
26466
26987
  return { type: "organization" };
26467
26988
  }
26468
26989
  async function execute(action) {
@@ -26474,7 +26995,7 @@ async function execute(action) {
26474
26995
  }
26475
26996
  function registerSharingCommands(program2) {
26476
26997
  const sharing = program2.command("sharing").description(
26477
- "Inspect, grant and revoke direct specialist, resource and credential permissions. A specialist's grants also apply to everything inside it."
26998
+ "Inspect, grant and revoke who a specialist, resource or credential is shared with: one member, a team, or the whole workspace. A specialist's grants also apply to everything inside it."
26478
26999
  );
26479
27000
  subject(sharing.command("inspect <id>")).action(
26480
27001
  (id, options) => execute(
@@ -26504,7 +27025,7 @@ function registerSharingCommands(program2) {
26504
27025
  await (await sessionContextService.requireAuthed()).client.sharing.revoke({ id, kind: options.kind, audience: target });
26505
27026
  return {
26506
27027
  isRevoked: true,
26507
- note: "Other direct or inherited specialist grants may still provide access."
27028
+ note: "Other direct, team or inherited specialist grants may still provide access."
26508
27029
  };
26509
27030
  })
26510
27031
  );
@@ -26801,7 +27322,7 @@ async function run(opts) {
26801
27322
  // src/commands/workspace/members.ts
26802
27323
  function registerWorkspaceMembers(parent) {
26803
27324
  parent.command("members").description(
26804
- "List active members of the active workspace (name + email). Use to resolve a person to an exact address before emailing, assigning, or sharing."
27325
+ "List active members of the active workspace (name, email, and the teams each is on). Use to resolve a person to an exact address before emailing, assigning, or sharing."
26805
27326
  ).option("-q, --query <text>", "Substring filter on name and email.").option("--page <n>", "1-based page of 25. Default 1.").option("--json", "Machine-readable output.").action(async (opts) => {
26806
27327
  const page = opts.page ? Number.parseInt(opts.page, 10) : void 0;
26807
27328
  try {
@@ -26821,10 +27342,11 @@ function registerWorkspaceMembers(parent) {
26821
27342
  exit(ExitCode.Ok);
26822
27343
  }
26823
27344
  printTable(
26824
- ["NAME", "EMAIL"],
27345
+ ["NAME", "EMAIL", "TEAMS"],
26825
27346
  result.members.map((member) => [
26826
27347
  member.name ?? "(no name)",
26827
- member.email
27348
+ member.email,
27349
+ member.teams.length > 0 ? member.teams.join(", ") : "-"
26828
27350
  ])
26829
27351
  );
26830
27352
  if (result.hasMore) {
@@ -26840,6 +27362,44 @@ function registerWorkspaceMembers(parent) {
26840
27362
  });
26841
27363
  }
26842
27364
 
27365
+ // src/commands/workspace/teams.ts
27366
+ var PERMISSION_LABELS = new Map(
27367
+ ORG_PERMISSIONS.map((definition) => [definition.id, definition.label])
27368
+ );
27369
+ function registerWorkspaceTeams(parent) {
27370
+ parent.command("teams").description(
27371
+ "List the active workspace's teams: each team's id, the permissions everyone on it holds beyond their role, and who is on it. A team's id is what `geni sharing grant --team` takes. Admins change teams in Settings \u2192 Members."
27372
+ ).option("--json", "Machine-readable output.").action(async (opts) => {
27373
+ try {
27374
+ const { teams } = await workspaceService.teams();
27375
+ if (opts.json) {
27376
+ printJson({ teams });
27377
+ exit(ExitCode.Ok);
27378
+ }
27379
+ if (teams.length === 0) {
27380
+ process.stdout.write(
27381
+ "This workspace has no teams yet. Admins make them in Settings \u2192 Members.\n"
27382
+ );
27383
+ exit(ExitCode.Ok);
27384
+ }
27385
+ printTable(
27386
+ ["TEAM", "ID", "PERMISSIONS", "MEMBERS"],
27387
+ teams.map((team) => [
27388
+ team.name,
27389
+ team.id,
27390
+ team.permissions.length > 0 ? team.permissions.map(
27391
+ (permission) => PERMISSION_LABELS.get(permission) ?? permission
27392
+ ).join(", ") : "-",
27393
+ team.members.length > 0 ? team.members.map((member) => member.name ?? member.email).join(", ") : "-"
27394
+ ])
27395
+ );
27396
+ exit(ExitCode.Ok);
27397
+ } catch (error) {
27398
+ exitOnApiError(error);
27399
+ }
27400
+ });
27401
+ }
27402
+
26843
27403
  // src/commands/workspace/index.ts
26844
27404
  function registerWorkspaceCommands(program2) {
26845
27405
  const workspace = program2.command("workspace").alias("workspaces").description(
@@ -26849,10 +27409,11 @@ function registerWorkspaceCommands(program2) {
26849
27409
  registerWorkspaceSwitch(workspace);
26850
27410
  registerWorkspaceCurrent(workspace);
26851
27411
  registerWorkspaceMembers(workspace);
27412
+ registerWorkspaceTeams(workspace);
26852
27413
  }
26853
27414
 
26854
27415
  // src/commands/exec/bash.ts
26855
- import { readFileSync as readFileSync6 } from "fs";
27416
+ import { readFileSync as readFileSync7 } from "fs";
26856
27417
  function registerExecBash(parent) {
26857
27418
  parent.command("bash").description(
26858
27419
  "Run `bash -lc <cmd>` locally with cloud-resolved credentials injected as env vars. Output is streamed back through a scrubber that replaces every registered secret with [REDACTED:credential_<id>]."
@@ -26952,7 +27513,7 @@ async function resolveCommand(opts, positional) {
26952
27513
  }
26953
27514
  if (opts.file === "-") return readStdin();
26954
27515
  try {
26955
- return readFileSync6(opts.file, "utf-8");
27516
+ return readFileSync7(opts.file, "utf-8");
26956
27517
  } catch (error) {
26957
27518
  const detail = error instanceof Error ? error.message : String(error);
26958
27519
  printError(`Could not read --file ${opts.file}: ${detail}`);
@@ -27870,7 +28431,7 @@ function registerIntegrationCommands(program2) {
27870
28431
  }
27871
28432
 
27872
28433
  // src/commands/customApi/index.ts
27873
- import { readFileSync as readFileSync7 } from "fs";
28434
+ import { readFileSync as readFileSync8 } from "fs";
27874
28435
  import { resolve as resolve2 } from "path";
27875
28436
 
27876
28437
  // src/lib/jsonArg.ts
@@ -28029,7 +28590,7 @@ function parseBody(opts) {
28029
28590
  }
28030
28591
  let contents;
28031
28592
  try {
28032
- contents = readFileSync7(resolve2(file), "utf8");
28593
+ contents = readFileSync8(resolve2(file), "utf8");
28033
28594
  } catch (error) {
28034
28595
  const message = error instanceof Error ? error.message : String(error);
28035
28596
  printError(`Could not read JSON file: ${message}`);
@@ -28145,7 +28706,7 @@ function registerResourceLifecycle(parent) {
28145
28706
  // src/commands/resource/create.ts
28146
28707
  import { Option as Option2 } from "commander";
28147
28708
  import { resolve as resolve4 } from "path";
28148
- import { z as z41 } from "zod";
28709
+ import { z as z43 } from "zod";
28149
28710
 
28150
28711
  // src/lib/resourceTypeWords.ts
28151
28712
  var RESOURCE_TYPE_FLAG = {
@@ -28168,9 +28729,9 @@ var RESOURCE_KIND_WORD = {
28168
28729
  };
28169
28730
 
28170
28731
  // src/commands/resource/create.ts
28171
- var ResourceCreateTypeSchema = z41.preprocess(
28732
+ var ResourceCreateTypeSchema = z43.preprocess(
28172
28733
  (value) => value === "deliverable" ? "design" : value,
28173
- z41.union([WorkflowTypeSchema, z41.literal("skill")])
28734
+ z43.union([WorkflowTypeSchema, z43.literal("skill")])
28174
28735
  );
28175
28736
  function authoringSkillFor(workflowType) {
28176
28737
  switch (workflowType) {
@@ -28521,7 +29082,7 @@ function printConfig(snapshot) {
28521
29082
 
28522
29083
  // src/commands/resource/config/set.ts
28523
29084
  import { resolve as resolve9 } from "path";
28524
- import { z as z42 } from "zod";
29085
+ import { z as z44 } from "zod";
28525
29086
  function registerConfigSet(parent) {
28526
29087
  parent.command("set [id]").description(
28527
29088
  "Wire config. Repeat each flag as needed. Credentials: --cred <service>=<credentialId>. Consts: --const <key>=<value> (value JSON-parsed, else string). Schedules: --schedule <triggerId>=<cron>, --timezone <triggerId>=<tz>."
@@ -28639,7 +29200,7 @@ function buildPartial(opts) {
28639
29200
  } catch {
28640
29201
  inputValues = null;
28641
29202
  }
28642
- const parsed = z42.record(z42.string(), z42.unknown()).safeParse(inputValues);
29203
+ const parsed = z44.record(z44.string(), z44.unknown()).safeParse(inputValues);
28643
29204
  if (!parsed.success) {
28644
29205
  printError("--trigger-input expects <triggerId>=<JSON object>.");
28645
29206
  exit(ExitCode.InvalidArgs);
@@ -28857,7 +29418,7 @@ Commands accept the resource id as a positional, or infer it from the
28857
29418
 
28858
29419
  // src/commands/workflow/executionControls.ts
28859
29420
  import { resolve as resolve12 } from "path";
28860
- import { z as z43 } from "zod";
29421
+ import { z as z45 } from "zod";
28861
29422
  function registerExecutionControls(parent) {
28862
29423
  for (const action of [
28863
29424
  "pending-input",
@@ -28902,7 +29463,7 @@ function registerExecutionControls(parent) {
28902
29463
  if (action === "resume") {
28903
29464
  const answers = parseJson(
28904
29465
  options.answers,
28905
- z43.record(z43.string(), z43.string()),
29466
+ z45.record(z45.string(), z45.string()),
28906
29467
  "--answers"
28907
29468
  );
28908
29469
  await workflowAuthoringService.resumeExecution(
@@ -28940,7 +29501,7 @@ function registerExecutionControls(parent) {
28940
29501
 
28941
29502
  // src/commands/workflow/previewFilter.ts
28942
29503
  import { resolve as resolve13 } from "path";
28943
- import { z as z44 } from "zod";
29504
+ import { z as z46 } from "zod";
28944
29505
  function registerPreviewFilter(parent) {
28945
29506
  parent.command("preview-filter [id]").description(
28946
29507
  "Run filter.ts once and inspect its decision, transformed input and logs. Uses live credentials and persists any dedup state it writes; does not run the workflow body."
@@ -28959,7 +29520,7 @@ function registerPreviewFilter(parent) {
28959
29520
  const workflowId = resolveResourceId({ id, dir });
28960
29521
  const triggerPayload = parseJson(
28961
29522
  options.payload ?? "{}",
28962
- z44.record(z44.string(), z44.unknown()),
29523
+ z46.record(z46.string(), z46.unknown()),
28963
29524
  "--payload"
28964
29525
  );
28965
29526
  try {
@@ -29105,7 +29666,7 @@ function registerWorkflowSetType(parent) {
29105
29666
 
29106
29667
  // src/commands/workflow/test.ts
29107
29668
  import { resolve as resolve16 } from "path";
29108
- import { z as z45 } from "zod";
29669
+ import { z as z47 } from "zod";
29109
29670
  var TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "awaiting_input"]);
29110
29671
  var POLL_INTERVAL_MS = 2e3;
29111
29672
  function registerWorkflowTest(parent) {
@@ -29232,7 +29793,7 @@ function parsePayload(raw) {
29232
29793
  printError("--payload must be a JSON object, not an array.");
29233
29794
  exit(ExitCode.InvalidArgs);
29234
29795
  }
29235
- const result = z45.record(z45.string(), z45.unknown()).safeParse(parsed);
29796
+ const result = z47.record(z47.string(), z47.unknown()).safeParse(parsed);
29236
29797
  if (!result.success) {
29237
29798
  printError(`--payload must be a JSON object (e.g. '{"days":7}').`);
29238
29799
  exit(ExitCode.InvalidArgs);
@@ -29362,16 +29923,16 @@ function registerWorkflowExecutions(parent) {
29362
29923
  import { resolve as resolve21 } from "path";
29363
29924
 
29364
29925
  // src/lib/executionTrace.ts
29365
- import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync4 } from "fs";
29366
- import { join as join6, resolve as resolve20 } from "path";
29926
+ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
29927
+ import { join as join7, resolve as resolve20 } from "path";
29367
29928
  function writeExecutionTraceBundle(args) {
29368
29929
  const { baseDir, trace } = args;
29369
29930
  const dir = resolve20(baseDir, trace.id);
29370
29931
  mkdirSync5(dir, { recursive: true });
29371
29932
  const files = [];
29372
29933
  const write = (name, content) => {
29373
- const path = join6(dir, name);
29374
- writeFileSync4(path, content);
29934
+ const path = join7(dir, name);
29935
+ writeFileSync5(path, content);
29375
29936
  files.push(path);
29376
29937
  };
29377
29938
  if (trace.run !== null && trace.run !== void 0) {
@@ -29501,8 +30062,8 @@ function registerWorkflowCommands(program2) {
29501
30062
  }
29502
30063
 
29503
30064
  // src/commands/app/screenshots.ts
29504
- import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync5 } from "fs";
29505
- import { resolve as resolve22, join as join7 } from "path";
30065
+ import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync6 } from "fs";
30066
+ import { resolve as resolve22, join as join8 } from "path";
29506
30067
  function registerAppScreenshots(parent) {
29507
30068
  parent.command("screenshots [id]").alias("screenshot").description(
29508
30069
  "Capture authenticated pages of the published app at mobile/desktop widths. Page loads run live handlers."
@@ -29548,8 +30109,8 @@ function registerAppScreenshots(parent) {
29548
30109
  const dir = resolve22(options.out ?? "app-screenshots");
29549
30110
  mkdirSync6(dir, { recursive: true });
29550
30111
  const shots = result.shots.map(({ pngBase64, ...shot }, index) => {
29551
- const path = join7(dir, `${index + 1}-${shot.width}px.png`);
29552
- writeFileSync5(path, Buffer.from(pngBase64, "base64"));
30112
+ const path = join8(dir, `${index + 1}-${shot.width}px.png`);
30113
+ writeFileSync6(path, Buffer.from(pngBase64, "base64"));
29553
30114
  return { ...shot, path };
29554
30115
  });
29555
30116
  printJson({ status: "captured", shots });
@@ -29587,7 +30148,7 @@ function registerAppBuildStatus(parent) {
29587
30148
 
29588
30149
  // src/commands/app/runHandler.ts
29589
30150
  import { resolve as resolve24 } from "path";
29590
- import { z as z46 } from "zod";
30151
+ import { z as z48 } from "zod";
29591
30152
  function registerAppRunHandler(parent) {
29592
30153
  parent.command("run-handler <name> [id]").description(
29593
30154
  "Dispatch a handler against the live app with --input JSON (bypasses cache) and print the result. Publish first. Exits nonzero on handler error."
@@ -29642,7 +30203,7 @@ function parseInput(raw) {
29642
30203
  printError("--input must be a JSON object, not an array.");
29643
30204
  exit(ExitCode.InvalidArgs);
29644
30205
  }
29645
- const result = z46.record(z46.string(), z46.unknown()).safeParse(parsed);
30206
+ const result = z48.record(z48.string(), z48.unknown()).safeParse(parsed);
29646
30207
  if (!result.success) {
29647
30208
  printError(`--input must be a JSON object (e.g. '{"limit":50}').`);
29648
30209
  exit(ExitCode.InvalidArgs);
@@ -29661,7 +30222,7 @@ function parseTimeout2(raw) {
29661
30222
 
29662
30223
  // src/commands/app/runAgent.ts
29663
30224
  import { resolve as resolve25 } from "path";
29664
- import { z as z47 } from "zod";
30225
+ import { z as z49 } from "zod";
29665
30226
  function registerAppRunAgent(parent) {
29666
30227
  parent.command("run-agent <name> [id]").description(
29667
30228
  "Trigger a declared app agent (agents/<name>/ in app.json) as a test execution against the live app. Async: prints the execution id; poll `geni workflow executions [id]` and `geni workflow execution <executionId>` for the outcome. Publish first."
@@ -29713,7 +30274,7 @@ function parseVariables(raw) {
29713
30274
  printError(`--variables must be valid JSON. Got: ${raw}`);
29714
30275
  exit(ExitCode.InvalidArgs);
29715
30276
  }
29716
- const result = z47.record(z47.string(), z47.unknown()).safeParse(parsed);
30277
+ const result = z49.record(z49.string(), z49.unknown()).safeParse(parsed);
29717
30278
  if (!result.success) {
29718
30279
  printError(`--variables must be a JSON object (e.g. '{"limit":50}').`);
29719
30280
  exit(ExitCode.InvalidArgs);
@@ -30034,21 +30595,21 @@ logout (or use \`geni login --server <url>\`) to switch in one step.
30034
30595
 
30035
30596
  // src/lib/skills.ts
30036
30597
  import { homedir as homedir2 } from "os";
30037
- import { join as join8 } from "path";
30598
+ import { join as join9 } from "path";
30038
30599
  import {
30039
30600
  mkdirSync as mkdirSync7,
30040
- writeFileSync as writeFileSync6,
30601
+ writeFileSync as writeFileSync7,
30041
30602
  existsSync as existsSync5,
30042
- readFileSync as readFileSync8,
30603
+ readFileSync as readFileSync9,
30043
30604
  unlinkSync,
30044
- rmSync
30605
+ rmSync as rmSync2
30045
30606
  } from "fs";
30046
30607
 
30047
30608
  // src/skills/geni.md
30048
- var geni_default = "---\nname: geni\ndescription: Use the user's connected services (Slack, Gmail, GitHub, Stripe, anything they've authorized in General Input) to fulfill their request, or build them a saved workflow (scheduled or event-driven automation). Load this whenever the user wants you to take an action on their behalf against an external SaaS account, fetch data from one of their tools, wire something up that crosses service boundaries, or set up a recurring/triggered automation.\n---\n\n# geni\n\n`geni` is a CLI that gives you credentialed access to the user's\nconnected accounts. The cloud injects their tokens into a fresh bash\nsubprocess as env vars; you write the `curl`, you never see the\nsecret. Run `geni --help` for the full command surface.\n\n## How to talk about geni\n\nTreat geni as a colleague \u2014 the integration expert who picks the\nright operation and runs the credentialed call. You're the one\nsynthesizing and replying.\n\nIn summaries of multi-step work, credit geni naturally: \"Geni pulled\nthe last 30 days of charges from Stripe; I rolled them into the report\nbelow.\" Skip the credit on trivial single calls; don't manufacture\nteam language (\"with geni's help\u2026\") to fill space. Lowercase `geni`\nin commands; capitalize \"Geni\" when personifying.\n\n## Request flow\n\nDiscovery first. Don't guess URLs, params, or env var names \u2014 the\noperation docs have them.\n\n1. `geni credential list [--service <slug>]` \u2014 find a connected\n credential id. If nothing's connected for the service, run\n `geni integration list -q \"<keyword>\"` to confirm the slug, then\n `geni credential connect <service>` (see \"Connecting a missing\n credential\" below).\n2. `geni integration operations <service> [-q \"<keyword>\"]` \u2014 find\n the operation you need. Not sure which service does it?\n `geni integration search \"<capability>\"` searches operations across\n every integration at once, grouped by service.\n3. `geni integration operation <id> --format markdown` \u2014 read the\n HTTP shape, params, and **exact env var names** this call will set.\n4. `geni exec bash --cred <cred_id> --reason \"<what + why>\" -- '<curl>'`\n\nNeed a workspace member's exact email (to notify, assign, or share to)? `geni\nworkspace members -q \"<name>\"`. General Input notifies members only\n(`POST $PLATFORM_BASE_URL/notifications`); anyone else is emailed from a\nconnected Gmail or Outlook.\n\nFor connection health, introspection refresh, labels, notes, dependent\nworkflows, access history, or disconnecting an account, use the dedicated\ncommands in `geni credential --help`. Inspect dependents before disconnecting.\n`geni sharing --help` covers direct member and organization grants on\nspecialists, resources, and credentials; inherited specialist access remains\nwhen a direct resource grant is removed.\n\n## Complex commands: write a file, don't fight quotes\n\nThe `-- '<command>'` form goes through a shell-quoting layer. For a\none-line `curl` that's fine. The moment the command has nested quotes\nor newlines \u2014 a `curl` piped into `jq` or `python3 -c`, a JSON body\nwith `\"keys\"` \u2014 that quoting silently mangles and the call fails in\nconfusing ways. Don't escalate escaping. Write the script to a file\nwith your normal editor, then run it as data:\n\n```\ngeni exec bash --cred <id> --reason \"<why>\" --file ./query.sh\n```\n\n`--file -` reads the script from stdin (heredoc / `< script.sh`).\n`jq` is available in the exec environment \u2014 prefer it over inline\n`python3 -c` for shaping JSON.\n\n## Connecting a missing credential\n\n`geni credential connect <service>` opens the integration's\ndashboard page in the user's browser. Tell the user to\nfinish the connection there and come back \u2014 then re-run `geni\ncredential list --service <service>` to pick up the new id. Don't\npoll, don't loop. In non-interactive shells, add `--print-url` so\nthe URL prints to stdout instead.\n\n## Env vars\n\nRead the names off the operation docs; never derive them. Two flavors\nemitted per credential:\n\n- **Suffixed**: `<SERVICE>_<FIELD>_<id>` (e.g. `$SLACK_BOT_TOKEN_ABC`,\n `$SALESFORCE_INSTANCE_URL_KG`). The `<id>` is the credential id with\n `cred_` stripped, uppercased. Use these when fanning out across\n multiple credentials of the same service in one call.\n- **Canonical aliases**: well-known SDK names (`$GH_TOKEN`,\n `$SLACK_BOT_TOKEN`, `$OPENAI_API_KEY`, `$STRIPE_API_KEY`, \u2026) for\n tools that hardcode them.\n\nPlus `$PLATFORM_API_KEY` and `$PLATFORM_BASE_URL` on every exec \u2014 use\nthem to call General Input's first-party services (web search, image\ngen, weather, notifications) without `--cred`.\n\n## --reason is per-call\n\nEvery `geni exec bash --cred ...` requires `--reason`. It lands in\nthe user's audit log and is shown to them. Be specific\n(\"Posting daily digest to #engineering\"), not generic (\"Slack call\").\nRe-state it on every call \u2014 the log is per-call, not per-session.\n\n## Output is scrubbed\n\nstdout and stderr pass through a streaming scrubber that replaces\nevery registered secret with `[REDACTED:credential_<id>]`. Don't try\nto exfiltrate via `echo $TOKEN | base64`; common encodings are\ncaught too. You don't need to see the secret to use it \u2014 the\nsubprocess can.\n\n## Building resources (workflows, apps, and skills)\n\n`geni exec bash` is for one-off actions. When the user wants something\nsaved and reusable, build a **resource**. A resource is one of four\ntypes: a `code` **workflow** (deterministic, fixed steps, runs on a\nschedule or trigger), an `agent` **workflow** (LLM-driven, variable-length\ntasks like research or triage), an `app` (an interactive React mini-app\nwith server-side handlers, like a dashboard or internal tool), or a\n`skill` (a SKILL.md instruction bundle the platform's cloud agents load\nas context \u2014 not executed). The shared lifecycle lives under `geni\nresource`; type-specific tools under `geni workflow` and `geni app`.\n\nYou author the files locally with your own editor; the cloud validates,\nconfigures, publishes, and runs them. This is the same build loop as a\nconversation with a specialist, just on the user's machine with your\nbrain driving it. Same\nloop for every type; apps add a build step and handler tools (see\n\"Building apps\" below), skills drop the config step (see \"Building\nskills\" below).\n\n**Load the authoring skill first.** `geni skills load\n<code-workflow|agent-workflow|app|skill-authoring>` writes the platform's\nauthoring skill for that type into `geni-skills/<name>/`: `SKILL.md` (the\nmethod), `references/spec.md` (the full contract \u2014 required files, the\nruntime API, allowed and forbidden patterns), and `references/example/`\n(a complete, validated example to mirror). Read SKILL.md and the spec,\nand copy shapes from the example. (`skill-authoring` is the one type\nwhose short spec is inline in SKILL.md, with no example.) Don't write a\nsingle file before loading it.\n\nThe loop:\n\n1. `geni resource create --type code --specialist <specialistId> --name \"Daily Digest\"`:\n creates the resource in that specialist (`geni specialist list` shows the ones\n you can edit, `geni specialist create` makes one) and scaffolds its files\n into the current directory, with a `.geni-resource.json` marker so later\n commands here resolve the id automatically.\n2. Edit the files (`workflow.json`, `main.ts`, `package.json`) with your\n normal Read/Write/Edit tools. **Don't run `npm install`, `tsc`, or\n `bun` locally**: `@general-input/core` only resolves server-side, so\n a local compile always fails on the missing module. That's not a real\n error.\n3. `geni resource validate`: server-side spec + wiring + (code\n workflows) TypeScript check. Exit 9 means invalid; fix what it\n reports and re-run. For apps the compile gate is the publish build,\n not validate.\n4. `geni resource config set`: wire what the workflow needs. Find\n credential ids with `geni credential list`; set them with\n `--cred <service>=<credentialId>`. Set consts with `--const k=v`,\n schedules with `--schedule <triggerId>=<cron>`. `geni resource config\nget` shows the current state. Find trigger providers with\n `geni trigger list`. Poll triggers also need `--trigger-cred\n <triggerId>=<credentialId>` and `--trigger-input '<triggerId>={...}'`;\n clear a poll binding with `--trigger-cred-clear <triggerId>`.\n Resource credential slots and poll trigger bindings are separate.\n5. `geni resource publish --summary \"<one plain sentence>\"`: promote\n your local files to the live version. Required before a test reflects\n your latest edits.\n6. `geni workflow test --trigger <key> --payload '{...}'`: run a real cloud test\n execution and wait for the result, output, and logs. Iterate from\n step 2 until it does what the user asked.\n7. `geni resource enable`: turn it on once it is verified. A workflow is\n validated first and the command exits 9 with the blockers when it is\n not ready; `geni resource disable` turns it off. Works for skills too.\n\nWhen a run misbehaves, `geni workflow execution <id> --download` writes\nits full trace to `executions/<id>/` (run.json, logs.txt, input.json, and\nthread.json). For an agent workflow, read `thread.json` to see every step\nthe agent took. Use `--thread` or `--input` to print those inline instead.\n\nFor a paused run, inspect `geni workflow pending-input <executionId>` and\nanswer every open question with `geni workflow resume <executionId>\n--answers '{\"toolCallId\":\"answer\"}'`. Finished and paused agent runs support\n`continue <executionId> --message \"...\"` (on a paused run it skips the open\nquestions); `cancel` stops active runs and `retry`\nrepeats a finished run with its original input and trigger. These commands\ninfer the workflow from the local marker or accept `--workflow <id>`.\n\n`geni resource versions` lists published snapshots; `geni resource revert\n<versionId>` restores one and rebuilds apps when needed. Pull fresh files\nbefore editing after a revert. `geni resource delete` archives one owned\nresource.\n\nUse the same discovery tools as exec: `geni integration operations\n<service>` and `geni integration operation <id>` to learn an API's shape\nbefore you write the `fetch` call in `main.ts`.\n\nFor a poll-triggered workflow, `geni workflow trigger-sample` returns\nlive sample records so you see the exact shape `input` receives before\nwriting `main.ts` (wire the trigger's credential and inputs with\n`config set` first). To test a file-type input, `geni workflow\nstage-input <file>` uploads a local file and prints a `store://` URI to\npass as that field's value in `--payload`.\n\nPass `--trigger <key>` to select the trigger for samples, tests and filter\npreviews. `geni workflow preview-filter --payload '{...}'` executes only\nthe filter; add `--draft` to preview local edits. It uses live credentials\nand can persist filter deduplication state. `trigger-activity` inspects live\npolling, filter decisions and captured events; `trigger-sync` polls now,\nand `trigger-replay` starts a real run from a captured event. Use each\ncommand's `--help` for selectors and pagination. Sync, retry and replay can\nrepeat external actions.\n\n## Building apps\n\nAn `app` workflow is a React SPA (rendered in the dashboard's iframe)\nthat calls server-side handlers. Create it with `geni resource create\n--type app --specialist <specialistId>`; load the authoring skill with `geni skills load app` (its\n`references/` hold the contract, the component catalog, and a complete\nexample app). The shared commands work the same (validate, config set\nfor credential slots, publish), with these differences:\n\n- The scaffold is a whole Vite project. Edit only `app.json`, `src/App.tsx`,\n `src/pages/*`, your own `src/components/*`, and `handlers/*.ts`. Leave\n the platform-owned files alone.\n- `geni resource publish` builds the app; the result's `build` reports\n whether the Vite build passed. `geni app screenshots` saves authenticated\n mobile and desktop captures; page loads can invoke live handlers.\n- `geni app run-handler <name> --input '{...}'` runs a handler\n against the live app (publish first). `geni app invocations`\n shows recent handler runs, `geni app errors` shows browser\n errors the iframe reported, `geni app build-status` shows the\n build, and `geni app clear-cache` flushes the handler cache.\n- `geni app run-agent <name> --variables '{...}'` triggers a declared\n app agent (`agents/<name>/` in app.json) as a test execution. Async:\n poll `geni workflow executions`, then `geni workflow execution <id>`.\n\nThe loop: create --type app -> edit handlers + pages -> validate ->\nconfig set (wire credential slots) -> publish (builds) -> app run-handler\nto verify -> tell the user to open it in their dashboard.\n\n## Building skills\n\nA `skill` is a SKILL.md bundle (frontmatter `name` slug + `description`,\nthen the instructions body; optional `scripts/`, `references/`,\n`assets/`) that the platform's cloud agents load as context. It is not\nexecuted, so the loop is shorter: create --type skill -> edit SKILL.md ->\nvalidate -> publish. No `config set` (nothing to wire) and publish needs\nno `--summary`. The frontmatter `description` is the only thing agents\nsee before deciding to load it, so it must say what the skill does AND\nwhen to use it. Skill ids are `skl_`-prefixed; pull/validate/publish\nwork on them like any resource.\n\nA skill is never run and has no triggers. Once published, tell the user\nit's in their dashboard Skills page, ready for their agents to load into\nfuture work. Commands accept the skill id as a positional or infer it\nfrom the marker in the current directory.\n\n## Building custom API integrations\n\nWhen the integration catalog has no service for an API-key or public REST\nAPI, load its authoring contract with `geni skills load custom-api`. Read that\nskill before creating anything. Gather the provider's official documentation,\nshow the user the proposed title and description, and wait for approval.\n\nCreate the private draft with\n`geni custom-api create --title \"...\" --description \"...\" --confirm`. The\n`--confirm` flag means the user approved those exact\ndetails. Then use `geni custom-api update`, `upsert-operation`,\n`delete-operation`, and `set-status`; each accepts the same fields as the\ncorresponding cloud-agent tool. Prefer `--file` for documentation-heavy JSON.\nPublish with `set-status <id> live --confirm` only after the user explicitly\nasks and the loaded skill's source inventory has no unresolved assumptions.\nOAuth-only services need an integration request in the dashboard instead.\n\n## Hosted browser (login-walled sites)\n\nFor sites with no API \u2014 or data behind a login wall \u2014 drive a hosted\nbrowser with a Playwright script, exactly like the platform's agents do.\n\n1. `geni browser profiles` \u2014 saved browsers and their logins. The\n user's own browser is always listed; shared ones appear too.\n2. `geni browser open [--profile <id>] [--url <url>]` \u2014 open a hosted session, on that page when given.\n With `--profile` it arrives signed in (cookies + storage); without,\n it's logged out. One session at a time.\n3. While it's open, `geni exec bash` exports `GI_BROWSER_CDP_URL`.\n Write a playwright-core script that\n `chromium.connectOverCDP(process.env.GI_BROWSER_CDP_URL)` and run it\n with `node` (not bun). No `--cred` needed for the browser itself.\n4. `geni browser close` \u2014 ALWAYS, including after failures: it saves\n the login back onto the profile and stops billing. A forgotten\n session auto-closes after 2 hours.\n\nWhen a script hits a real login wall (a restricted page bounced to a\nsign-in form \u2014 a homepage merely showing a Sign in button doesn't\ncount), first sign in with a provider: if the login is listed as\n\"signed in with github.com\", or the sign-in page offers a provider\nthe browser lists as signed in (\"Continue with GitHub\"), click that\nbutton once. If it lands signed in, carry on and record the way in\nwith `geni browser report-login <domain> active --signed-in-with\ngithub.com`. Stop at anything it asks for (a password, a code, an\nemail, a choice of account, approval for an app). Otherwise:\n\n- On the user's own browser: `geni browser request-login <domain>`\n opens a live view in their real browser; they sign in (2FA and all),\n the browser saves as they go, and the next `open --profile` arrives\n signed in.\n- On a shared browser: `geni browser report-login <domain> logged_out`\n and tell the user to ask its owner to reconnect it. Use\n `... active` when you confirmed a listed login works.\n\n## Workspace memory\n\nThe workspace carries a memory: standing instructions, conventions,\nand reference material the workspace's agents have accumulated. It is\nnot optional context \u2014 it holds decisions you would otherwise\nre-derive or contradict.\n\n**Read it at the start of any non-trivial task:**\n\n```\ngeni memory show # the workspace's\ngeni memory show --personal # the user's own preferences\n```\n\nUse `geni memory files` to list referenced files and `geni memory read\n<path>` to read one. `read <path> --out <file>` downloads an original\nupload without changing its bytes; `geni memory pull --dir <directory>`\ndownloads a side's guide, references and originals. Add `--personal` for\nthe user's own memory.\n\nStanding instructions there override your defaults. If memory says\nreports go in a specific format, or a service is off-limits, follow it\nwithout re-asking.\n\n**File what you learn back:**\n\n```\ngeni memory remember \"invoices are reconciled against Stripe, never the ledger\"\ngeni memory remember --personal \"prefers terse summaries, no preamble\"\n```\n\nThis does not edit memory. It queues the change for the workspace's\nmemory agent, which folds it in on its next run and reconciles it\nagainst everything else it knows. `geni memory show` lists what is\nalready queued, so you don't file the same thing twice.\n\nReach for `remember` when a correction or convention would still\nmatter next week and isn't already recorded. Skip it for one-off\ndetails, anything already in `geni memory show`, and anything you only\nhalf-know \u2014 a wrong memory is worse than a missing one. Most tasks\nneed no call at all. Phrase the note as the change you want made\n(\"deploys go out Tuesdays\"), not a summary of the session (\"we talked\nabout deploys\").\n\nWorkspace memory is shared with the whole team, so keep it about the\nbusiness and the work, never about a person. Anything specific to this\nuser goes to `--personal`. Workspace proposals require Admin or Owner;\nevery member can propose changes to their own personal memory.\n\n## Specialist files and portability\n\n`geni specialist files --help` covers shared text and binary files, and the\nfolders people see them in (`mkdir`, `mv`, `rename`, `rmdir`): a specialist's\nworkflows, apps, and skills sit in those folders beside its files. Specialist\nimport/export and template commands are listed in `geni specialist --help`.\nReview archive contents and template versions before installing. Exports\nand publications carry only the files and memory explicitly selected;\nchoose the intended publication audience before publishing a template.\n\n## Exit codes worth knowing\n\n- `0` \u2014 success; `1\u2013125` \u2014 subprocess's own exit (curl, jq, etc.)\n- `4` \u2014 resource not found (bad cred id, slug, operation id)\n- `77` \u2014 server refused to resolve a credential. Don't retry; surface\n to the user.\n- `78` \u2014 session expired. Tell the user to run `geni login`.\n- `79` \u2014 this geni is below the server's minimum version. Run\n `geni upgrade`, then `geni skills install`, and retry.\n\n## Don't\n\n- Don't construct a curl without reading the operation docs first.\n Guessing at URLs and env var names is the most common failure mode.\n- Don't hand-write resource files before loading the authoring skill\n (`geni skills load <code-workflow|agent-workflow|app|skill-authoring>`)\n and reading its spec + example. Don't try to compile or `npm install`\n them locally; let `geni resource validate` be the gate.\n- Don't create or publish a custom API before loading `custom-api`, reviewing\n sources, and getting the user's explicit approval.\n- Don't re-derive a convention `geni memory show` already states, and\n don't put anything about a named person into workspace memory.\n- Use `--json` on list/get commands when you're going to parse the\n output. Table output is for humans.\n";
30609
+ var geni_default = "---\nname: geni\ndescription: Use the user's connected services (Slack, Gmail, GitHub, Stripe, anything they've authorized in General Input) to fulfill their request, or build them a saved workflow (scheduled or event-driven automation). Load this whenever the user wants you to take an action on their behalf against an external SaaS account, fetch data from one of their tools, wire something up that crosses service boundaries, or set up a recurring/triggered automation.\n---\n\n# geni\n\n`geni` is a CLI that gives you credentialed access to the user's\nconnected accounts. The cloud injects their tokens into a fresh bash\nsubprocess as env vars; you write the `curl`, you never see the\nsecret. Run `geni --help` for the full command surface.\n\n## How to talk about geni\n\nTreat geni as a colleague \u2014 the integration expert who picks the\nright operation and runs the credentialed call. You're the one\nsynthesizing and replying.\n\nIn summaries of multi-step work, credit geni naturally: \"Geni pulled\nthe last 30 days of charges from Stripe; I rolled them into the report\nbelow.\" Skip the credit on trivial single calls; don't manufacture\nteam language (\"with geni's help\u2026\") to fill space. Lowercase `geni`\nin commands; capitalize \"Geni\" when personifying.\n\n## Request flow\n\nDiscovery first. Don't guess URLs, params, or env var names \u2014 the\noperation docs have them.\n\n1. `geni credential list [--service <slug>]` \u2014 find a connected\n credential id. If nothing's connected for the service, run\n `geni integration list -q \"<keyword>\"` to confirm the slug, then\n `geni credential connect <service>` (see \"Connecting a missing\n credential\" below).\n2. `geni integration operations <service> [-q \"<keyword>\"]` \u2014 find\n the operation you need. Not sure which service does it?\n `geni integration search \"<capability>\"` searches operations across\n every integration at once, grouped by service.\n3. `geni integration operation <id> --format markdown` \u2014 read the\n HTTP shape, params, and **exact env var names** this call will set.\n4. `geni exec bash --cred <cred_id> --reason \"<what + why>\" -- '<curl>'`\n\nNeed a workspace member's exact email (to notify, assign, or share to)? `geni\nworkspace members -q \"<name>\"`. General Input notifies members only\n(`POST $PLATFORM_BASE_URL/notifications`); anyone else is emailed from a\nconnected Gmail or Outlook.\n\nFor connection health, introspection refresh, labels, notes, dependent\nworkflows, access history, or disconnecting an account, use the dedicated\ncommands in `geni credential --help`. Inspect dependents before disconnecting.\n`geni sharing --help` covers member, team, and organization grants on\nspecialists, resources, and credentials (`inspect` lists all three); inherited\nspecialist access remains when a direct resource grant is removed. `geni\nworkspace teams` lists each team's id, what it carries, and who is on it.\n\n## Complex commands: write a file, don't fight quotes\n\nThe `-- '<command>'` form goes through a shell-quoting layer. For a\none-line `curl` that's fine. The moment the command has nested quotes\nor newlines \u2014 a `curl` piped into `jq` or `python3 -c`, a JSON body\nwith `\"keys\"` \u2014 that quoting silently mangles and the call fails in\nconfusing ways. Don't escalate escaping. Write the script to a file\nwith your normal editor, then run it as data:\n\n```\ngeni exec bash --cred <id> --reason \"<why>\" --file ./query.sh\n```\n\n`--file -` reads the script from stdin (heredoc / `< script.sh`).\n`jq` is available in the exec environment \u2014 prefer it over inline\n`python3 -c` for shaping JSON.\n\n## Connecting a missing credential\n\n`geni credential connect <service>` opens the integration's\ndashboard page in the user's browser. Tell the user to\nfinish the connection there and come back \u2014 then re-run `geni\ncredential list --service <service>` to pick up the new id. Don't\npoll, don't loop. In non-interactive shells, add `--print-url` so\nthe URL prints to stdout instead.\n\n## Env vars\n\nRead the names off the operation docs; never derive them. Two flavors\nemitted per credential:\n\n- **Suffixed**: `<SERVICE>_<FIELD>_<id>` (e.g. `$SLACK_BOT_TOKEN_ABC`,\n `$SALESFORCE_INSTANCE_URL_KG`). The `<id>` is the credential id with\n `cred_` stripped, uppercased. Use these when fanning out across\n multiple credentials of the same service in one call.\n- **Canonical aliases**: well-known SDK names (`$GH_TOKEN`,\n `$SLACK_BOT_TOKEN`, `$OPENAI_API_KEY`, `$STRIPE_API_KEY`, \u2026) for\n tools that hardcode them.\n\nPlus `$PLATFORM_API_KEY` and `$PLATFORM_BASE_URL` on every exec \u2014 use\nthem to call General Input's first-party services (web search, image\ngen, weather, notifications) without `--cred`.\n\n## --reason is per-call\n\nEvery `geni exec bash --cred ...` requires `--reason`. It lands in\nthe user's audit log and is shown to them. Be specific\n(\"Posting daily digest to #engineering\"), not generic (\"Slack call\").\nRe-state it on every call \u2014 the log is per-call, not per-session.\n\n## Output is scrubbed\n\nstdout and stderr pass through a streaming scrubber that replaces\nevery registered secret with `[REDACTED:credential_<id>]`. Don't try\nto exfiltrate via `echo $TOKEN | base64`; common encodings are\ncaught too. You don't need to see the secret to use it \u2014 the\nsubprocess can.\n\n## Building resources (workflows, apps, and skills)\n\n`geni exec bash` is for one-off actions. When the user wants something\nsaved and reusable, build a **resource**. A resource is one of four\ntypes: a `code` **workflow** (deterministic, fixed steps, runs on a\nschedule or trigger), an `agent` **workflow** (LLM-driven, variable-length\ntasks like research or triage), an `app` (an interactive React mini-app\nwith server-side handlers, like a dashboard or internal tool), or a\n`skill` (a SKILL.md instruction bundle the platform's cloud agents load\nas context \u2014 not executed). The shared lifecycle lives under `geni\nresource`; type-specific tools under `geni workflow` and `geni app`.\n\nYou author the files locally with your own editor; the cloud validates,\nconfigures, publishes, and runs them. This is the same build loop as a\nconversation with a specialist, just on the user's machine with your\nbrain driving it. Same\nloop for every type; apps add a build step and handler tools (see\n\"Building apps\" below), skills drop the config step (see \"Building\nskills\" below).\n\n**Load the authoring skill first.** `geni skills load\n<code-workflow|agent-workflow|app|skill-authoring>` writes the platform's\nauthoring skill for that type into `geni-skills/<name>/`: `SKILL.md` (the\nmethod), `references/spec.md` (the full contract \u2014 required files, the\nruntime API, allowed and forbidden patterns), and `references/example/`\n(a complete, validated example to mirror). Read SKILL.md and the spec,\nand copy shapes from the example. (`skill-authoring` is the one type\nwhose short spec is inline in SKILL.md, with no example.) Don't write a\nsingle file before loading it.\n\nThe loop:\n\n1. `geni resource create --type code --specialist <specialistId> --name \"Daily Digest\"`:\n creates the resource in that specialist (`geni specialist list` shows the ones\n you can edit, `geni specialist create` makes one) and scaffolds its files\n into the current directory, with a `.geni-resource.json` marker so later\n commands here resolve the id automatically.\n2. Edit the files (`workflow.json`, `main.ts`, `package.json`) with your\n normal Read/Write/Edit tools. **Don't run `npm install`, `tsc`, or\n `bun` locally**: `@general-input/core` only resolves server-side, so\n a local compile always fails on the missing module. That's not a real\n error.\n3. `geni resource validate`: server-side spec + wiring + (code\n workflows) TypeScript check. Exit 9 means invalid; fix what it\n reports and re-run. For apps the compile gate is the publish build,\n not validate.\n4. `geni resource config set`: wire what the workflow needs. Find\n credential ids with `geni credential list`; set them with\n `--cred <service>=<credentialId>`. Set consts with `--const k=v`,\n schedules with `--schedule <triggerId>=<cron>`. `geni resource config\nget` shows the current state. Find trigger providers with\n `geni trigger list`. Poll triggers also need `--trigger-cred\n <triggerId>=<credentialId>` and `--trigger-input '<triggerId>={...}'`;\n clear a poll binding with `--trigger-cred-clear <triggerId>`.\n Resource credential slots and poll trigger bindings are separate.\n5. `geni resource publish --summary \"<one plain sentence>\"`: promote\n your local files to the live version. Required before a test reflects\n your latest edits.\n6. `geni workflow test --trigger <key> --payload '{...}'`: run a real cloud test\n execution and wait for the result, output, and logs. Iterate from\n step 2 until it does what the user asked.\n7. `geni resource enable`: turn it on once it is verified. A workflow is\n validated first and the command exits 9 with the blockers when it is\n not ready; `geni resource disable` turns it off. Works for skills too.\n\nWhen a run misbehaves, `geni workflow execution <id> --download` writes\nits full trace to `executions/<id>/` (run.json, logs.txt, input.json, and\nthread.json). For an agent workflow, read `thread.json` to see every step\nthe agent took. Use `--thread` or `--input` to print those inline instead.\n\nFor a paused run, inspect `geni workflow pending-input <executionId>` and\nanswer every open question with `geni workflow resume <executionId>\n--answers '{\"toolCallId\":\"answer\"}'`. Finished and paused agent runs support\n`continue <executionId> --message \"...\"` (on a paused run it skips the open\nquestions); `cancel` stops active runs and `retry`\nrepeats a finished run with its original input and trigger. These commands\ninfer the workflow from the local marker or accept `--workflow <id>`.\n\n`geni resource versions` lists published snapshots; `geni resource revert\n<versionId>` restores one and rebuilds apps when needed. Pull fresh files\nbefore editing after a revert. `geni resource delete` archives one owned\nresource.\n\nUse the same discovery tools as exec: `geni integration operations\n<service>` and `geni integration operation <id>` to learn an API's shape\nbefore you write the `fetch` call in `main.ts`.\n\nFor a poll-triggered workflow, `geni workflow trigger-sample` returns\nlive sample records so you see the exact shape `input` receives before\nwriting `main.ts` (wire the trigger's credential and inputs with\n`config set` first). To test a file-type input, `geni workflow\nstage-input <file>` uploads a local file and prints a `store://` URI to\npass as that field's value in `--payload`.\n\nPass `--trigger <key>` to select the trigger for samples, tests and filter\npreviews. `geni workflow preview-filter --payload '{...}'` executes only\nthe filter; add `--draft` to preview local edits. It uses live credentials\nand can persist filter deduplication state. `trigger-activity` inspects live\npolling, filter decisions and captured events; `trigger-sync` polls now,\nand `trigger-replay` starts a real run from a captured event. Use each\ncommand's `--help` for selectors and pagination. Sync, retry and replay can\nrepeat external actions.\n\n## Building apps\n\nAn `app` workflow is a React SPA (rendered in the dashboard's iframe)\nthat calls server-side handlers. Create it with `geni resource create\n--type app --specialist <specialistId>`; load the authoring skill with `geni skills load app` (its\n`references/` hold the contract, the component catalog, and a complete\nexample app). The shared commands work the same (validate, config set\nfor credential slots, publish), with these differences:\n\n- The scaffold is a whole Vite project. Edit only `app.json`, `src/App.tsx`,\n `src/pages/*`, your own `src/components/*`, and `handlers/*.ts`. Leave\n the platform-owned files alone.\n- `geni resource publish` builds the app; the result's `build` reports\n whether the Vite build passed. `geni app screenshots` saves authenticated\n mobile and desktop captures; page loads can invoke live handlers.\n- `geni app run-handler <name> --input '{...}'` runs a handler\n against the live app (publish first). `geni app invocations`\n shows recent handler runs, `geni app errors` shows browser\n errors the iframe reported, `geni app build-status` shows the\n build, and `geni app clear-cache` flushes the handler cache.\n- `geni app run-agent <name> --variables '{...}'` triggers a declared\n app agent (`agents/<name>/` in app.json) as a test execution. Async:\n poll `geni workflow executions`, then `geni workflow execution <id>`.\n\nThe loop: create --type app -> edit handlers + pages -> validate ->\nconfig set (wire credential slots) -> publish (builds) -> app run-handler\nto verify -> tell the user to open it in their dashboard.\n\n## Building skills\n\nA `skill` is a SKILL.md bundle (frontmatter `name` slug + `description`,\nthen the instructions body; optional `scripts/`, `references/`,\n`assets/`) that the platform's cloud agents load as context. It is not\nexecuted, so the loop is shorter: create --type skill -> edit SKILL.md ->\nvalidate -> publish. No `config set` (nothing to wire) and publish needs\nno `--summary`. The frontmatter `description` is the only thing agents\nsee before deciding to load it, so it must say what the skill does AND\nwhen to use it. Skill ids are `skl_`-prefixed; pull/validate/publish\nwork on them like any resource.\n\nA skill is never run and has no triggers. Once published, tell the user\nit's in their dashboard Skills page, ready for their agents to load into\nfuture work. Commands accept the skill id as a positional or infer it\nfrom the marker in the current directory.\n\n## Building custom API integrations\n\nWhen the integration catalog has no service for an API-key or public REST\nAPI, load its authoring contract with `geni skills load custom-api`. Read that\nskill before creating anything. Gather the provider's official documentation,\nshow the user the proposed title and description, and wait for approval.\n\nCreate the private draft with\n`geni custom-api create --title \"...\" --description \"...\" --confirm`. The\n`--confirm` flag means the user approved those exact\ndetails. Then use `geni custom-api update`, `upsert-operation`,\n`delete-operation`, and `set-status`; each accepts the same fields as the\ncorresponding cloud-agent tool. Prefer `--file` for documentation-heavy JSON.\nPublish with `set-status <id> live --confirm` only after the user explicitly\nasks and the loaded skill's source inventory has no unresolved assumptions.\nOAuth-only services need an integration request in the dashboard instead.\n\n## Hosted browser (login-walled sites)\n\nFor sites with no API \u2014 or data behind a login wall \u2014 drive a hosted\nbrowser with a Playwright script, exactly like the platform's agents do.\n\n1. `geni browser profiles` \u2014 saved browsers and their logins. The\n user's own browser is always listed; shared ones appear too.\n2. `geni browser open [--profile <id>] [--url <url>]` \u2014 open a hosted session, on that page when given.\n With `--profile` it arrives signed in (cookies + storage); without,\n it's logged out. One session at a time.\n3. While it's open, `geni exec bash` exports `GI_BROWSER_CDP_URL`.\n Write a playwright-core script that\n `chromium.connectOverCDP(process.env.GI_BROWSER_CDP_URL)` and run it\n with `node` (not bun). No `--cred` needed for the browser itself.\n4. `geni browser close` \u2014 ALWAYS, including after failures: it saves\n the login back onto the profile and stops billing. A forgotten\n session auto-closes after 2 hours.\n\nWhen a script hits a real login wall (a restricted page bounced to a\nsign-in form \u2014 a homepage merely showing a Sign in button doesn't\ncount), first sign in with a provider: if the login is listed as\n\"signed in with github.com\", or the sign-in page offers a provider\nthe browser lists as signed in (\"Continue with GitHub\"), click that\nbutton once. If it lands signed in, carry on and record the way in\nwith `geni browser report-login <domain> active --signed-in-with\ngithub.com`. Stop at anything it asks for (a password, a code, an\nemail, a choice of account, approval for an app). Otherwise:\n\n- On the user's own browser: `geni browser request-login <domain>`\n opens a live view in their real browser; they sign in (2FA and all),\n the browser saves as they go, and the next `open --profile` arrives\n signed in.\n- On a shared browser: `geni browser report-login <domain> logged_out`\n and tell the user to ask its owner to reconnect it. Use\n `... active` when you confirmed a listed login works.\n\n## Workspace memory\n\nThe workspace carries a memory: standing instructions, conventions,\nand reference material the workspace's agents have accumulated. It is\nnot optional context \u2014 it holds decisions you would otherwise\nre-derive or contradict.\n\n**Read it at the start of any non-trivial task:**\n\n```\ngeni memory show # the workspace's\ngeni memory show --personal # the user's own preferences\n```\n\nUse `geni memory files` to list referenced files and `geni memory read\n<path>` to read one. `read <path> --out <file>` downloads an original\nupload without changing its bytes; `geni memory pull --dir <directory>`\ndownloads a side's guide, references and originals. Add `--personal` for\nthe user's own memory.\n\nStanding instructions there override your defaults. If memory says\nreports go in a specific format, or a service is off-limits, follow it\nwithout re-asking.\n\n**File what you learn back:**\n\n```\ngeni memory remember \"invoices are reconciled against Stripe, never the ledger\"\ngeni memory remember --personal \"prefers terse summaries, no preamble\"\n```\n\nThis does not edit memory. It queues the change for the workspace's\nmemory agent, which folds it in on its next run and reconciles it\nagainst everything else it knows. `geni memory show` lists what is\nalready queued, so you don't file the same thing twice.\n\nReach for `remember` when a correction or convention would still\nmatter next week and isn't already recorded. Skip it for one-off\ndetails, anything already in `geni memory show`, and anything you only\nhalf-know \u2014 a wrong memory is worse than a missing one. Most tasks\nneed no call at all. Phrase the note as the change you want made\n(\"deploys go out Tuesdays\"), not a summary of the session (\"we talked\nabout deploys\").\n\nWorkspace memory is shared with the whole team, so keep it about the\nbusiness and the work, never about a person. Anything specific to this\nuser goes to `--personal`. Workspace proposals require Admin or Owner;\nevery member can propose changes to their own personal memory.\n\n## Specialist files and portability\n\n`geni specialist files --help` covers shared text and binary files, and the\nfolders people see them in (`mkdir`, `mv`, `rename`, `rmdir`): a specialist's\nworkflows, apps, and skills sit in those folders beside its files. Specialist\nimport/export and template commands are listed in `geni specialist --help`.\nReview archive contents and template versions before installing. Exports\nand publications carry only the files and memory explicitly selected;\nchoose the intended publication audience before publishing a template.\n\n## Exit codes worth knowing\n\n- `0` \u2014 success; `1\u2013125` \u2014 subprocess's own exit (curl, jq, etc.)\n- `4` \u2014 resource not found (bad cred id, slug, operation id)\n- `77` \u2014 server refused to resolve a credential. Don't retry; surface\n to the user.\n- `78` \u2014 session expired. Tell the user to run `geni login`.\n- `79` \u2014 this geni is below the server's minimum version. Run\n `geni upgrade`, then `geni skills install`, and retry.\n\n## Don't\n\n- Don't construct a curl without reading the operation docs first.\n Guessing at URLs and env var names is the most common failure mode.\n- Don't hand-write resource files before loading the authoring skill\n (`geni skills load <code-workflow|agent-workflow|app|skill-authoring>`)\n and reading its spec + example. Don't try to compile or `npm install`\n them locally; let `geni resource validate` be the gate.\n- Don't create or publish a custom API before loading `custom-api`, reviewing\n sources, and getting the user's explicit approval.\n- Don't re-derive a convention `geni memory show` already states, and\n don't put anything about a named person into workspace memory.\n- Use `--json` on list/get commands when you're going to parse the\n output. Table output is for humans.\n";
30049
30610
 
30050
30611
  // src/skills/geni-crm.md
30051
- var geni_crm_default = '---\nname: geni-crm\ndescription: Read and write the user\'s General Input CRM from the command line. Load this whenever the user wants you to look something up in their CRM, pull a list of people or companies, check a deal pipeline, find or verify someone\'s email or phone (enrichment), OR change CRM data (create or update people/companies, manage lists and tags, add notes, create and resolve tasks, move deals through stages, log touchpoints). Full read/write access to people, companies, pipelines, deals, lists, tags, notes, tasks, and enrichment.\n---\n\n# geni crm\n\n`geni crm` reads and writes the user\'s General Input CRM: the lead database\n(people and companies), deal pipelines and their cards, lists, tags, notes,\ntasks, touchpoints, and custom fields. It is part of the same `geni` CLI, so it\nuses the same session and active workspace. The workspace must have CRM access,\nor these commands return a 403. Run `geni crm --help` for the full surface, and\n`geni crm <noun> --help` for a noun\'s verbs.\n\nThe shape is `geni crm <noun> <verb>`. Each noun is a group: `people`,\n`companies`, `lists`, `tags`, `notes`, `tasks`, `pipelines`, `stages`, `cards`,\n`touchpoints`, `fields`, `employments`, `contact-points`, `waterfalls`,\n`enrich`, `history`, `activities`, `files`, `views`, `merge`,\n`consent`, `privacy`, `credits`, `import`, plus top-level `search` and `match`.\n\nEvery command that names a record by type takes one of three record types:\n`person`, `company`, or `pipeline_card` (a card in any pipeline: a deal, or a\ncandidate in a recruiting pipeline). Tags, lists, notes, tasks, and custom\nfields work on all three.\n\nEveryone in the workspace sees and edits every person, company, and pipeline\ncard.\n\n## Finding things, then acting on them\n\nThe same two-step flow as the rest of geni: find an id, then read or write it.\n\n1. Find by name with one query across everything:\n `geni crm search "<text>" [--type person|company|list|pipeline|pipeline_card]`. Or\n list one kind: `geni crm people "<text>"`, `geni crm companies "<text>"`,\n `geni crm pipelines`, `geni crm lists`, `geni crm tags`, `geni crm tasks`.\n `people` and `companies` also take `--filter`, a JSON array of column\n conditions, e.g. `--filter \'[{"field":"title","operator":"contains","value":"vp"},{"field":"companyEmployeeCount","operator":"gte","value":50}]\'` \u2014\n see `--help` for the field and operator lists (custom fields filter as\n `custom.<key>`).\n2. Read one record: `geni crm people get <id>`, `geni crm companies get <id>`,\n `geni crm cards get <id>`, `geni crm pipelines get <id>` (add `--board` for\n its cards), `geni crm tasks get <id>`.\n\n## Activities\n\nNotes, calls, emails, meetings, Slack and LinkedIn messages are activities, and\none activity links to every record it concerns (a call with Ada about the\nAcme deal links Ada, Acme, and the deal card). Someone sees an activity only\nwhen they can see every record it links.\n\n- `geni crm activities list <entityType> <id> [--kind call email]` lists a record\'s activities, newest first.\n- `geni crm activities log --json \'{"kind":"call","direction":"outbound","body":"Walked through the offer","links":[{"type":"person","id":"<id>"},{"type":"pipeline_card","id":"<id>"}]}\'`. A future `occurredAt` schedules a meeting or call.\n- `geni crm activities sync --json \'{...,"externalRef":"<Message-ID>"}\'` creates or updates the activity that `externalRef` names and merges its links, so re-syncing a mailbox never duplicates a message. A message a teammate already logged stays as they logged it.\n- Only an activity\'s author edits or deletes it. Notes (`geni crm notes`) and card touchpoints are the same activities seen through one record.\n\n## Files\n\nA record can carry files (a resume on a person, a contract on a card), up to\n25 MB each. `geni crm files upload person <id> ./resume.pdf --kind resume`\nattaches one; `geni crm files list <entityType> <id>` lists them;\n`geni crm files text <fileId>` prints a text file\'s contents and\n`geni crm files download <fileId>` prints a short-lived link to any file.\nSomeone sees a file only when they can see its record.\n\n## Custom fields and saved views\n\nCustom fields (`geni crm fields`) can be text, long text, number, currency\n(`{"amount":1200,"currency":"USD"}`), checkbox, date, date and time (ISO),\nsingle select, multi-select, status, URL, email, phone, or member (a\nmembership id). Write values through the record\'s `custom` object.\n\nSaved views (`geni crm views`) are named filters, sort, and columns for one\nrecord type\'s table or board, personal or shared with the workspace.\n\n## Duplicates, consent, and privacy\n\n- **Merge duplicates**: `geni crm merge people <keepId> <dupeId...>` (and `companies`). The kept record takes every link, contact, file, and history line, and fills its empty fields from the duplicates.\n- **Before any outreach**, run `geni crm consent check <personId> --channel email` (or `phone`). Contact only the `reachable` values it returns, and nobody when `isAllowed` is false. Record a request with `geni crm consent do-not-contact <personId> --reason "..."` or `geni crm consent opt-out <contactPointId>`.\n- **Data requests**: `geni crm privacy export <personId>` returns everything held about them; `geni crm privacy erase <personId> --yes` deletes them for good, with anything merged into them.\n- **Credit splits** on a card: `geni crm credits set <cardId> --json \'{"credits":[{"membershipId":"<id>","role":"Recruiter","percent":60},{"membershipId":"<id>","role":"Account manager","percent":40}]}\'`.\n\n## Importing and syncing\n\n- **Import a CSV**: `geni crm import people leads.csv --dry-run` prints the suggested mapping (column to field, `custom.<key>` for a custom field) and the first rows that would fail. Then run it without `--dry-run`, optionally with `--map \'{...}\'`, `--list <listId>`, `--tag <tagId>`, and `--wait`. Rows match existing records by email, LinkedIn, or domain; a match only fills fields that are empty and never overwrites. `geni crm import status <importId>` shows counts and failed rows.\n- **Match addresses** before logging mail or meetings: `geni crm match a@x.com b@y.com` returns the person each address belongs to (any spelling, `+tags` ignored). Then log with `geni crm activities sync`.\n\n## History and triggers\n\nEvery change to a record is in its history: created, field changes (with the\nold and new value), stage and status moves, tags and lists, tasks, and\ndeletes. `geni crm history <entityType> <id>` prints one record\'s history,\nnewest first. `geni crm history feed [--after <cursor>]` reads the workspace\'s\nevents oldest first, and prints a cursor to pass back as `--after`.\n\nTo act when the CRM changes, build a workflow on a `general-input-crm` trigger\n(record created, field changed, card entered stage, tag added, task created,\nfile attached).\nIts payload is one history event: `entityType`, `entityId`, `kind`, `field`,\n`fromLabel`/`toLabel`, and `details` (stage ids for a stage move, the tag or\nlist id for a membership).\n\n## Writing\n\nCreates and updates take the record body as `--json`; the server validates it,\nso a 400 means the body was wrong (read the error and fix the JSON). Run\n`geni crm <noun> <verb> --help` to see the expected fields.\n\n- **Create / update records** (JSON body):\n - `geni crm people create --json \'[{"fullName":"Ada Lovelace","companyName":"Acme","email":"ada@acme.com"}]\'` (batch, find-or-create, deduped). `companies create` mirrors it. A `"created": false` result matched an existing record by identity key (email/LinkedIn; domain for companies) \u2014 the CLI warns on stderr when the matched name differs, e.g. a shared inbox collapsing distinct people.\n - `geni crm people update --json \'[{"id":"<id>","title":"VP Eng","linkedinUrl":"https://\u2026"}]\'` (batch, ids inline). `companies update` mirrors it. Writes take the create field names (`title`, `linkedinUrl`), not the read names you see on `get` (`currentTitle`, `primaryLinkedinUrl`); unknown keys are rejected with a 400 naming them.\n - `geni crm lists create --json \'{"name":"Q3 ICP","entityType":"company"}\'`, `geni crm tags create --json \'{"name":"Customer","entityType":"company"}\'`, `geni crm tasks create --json \'{"title":"Follow up","entity":{"type":"person","id":"<id>"}}\'`, `geni crm cards create <pipelineId> --json \'{"title":"Acme renewal","amount":50000}\'`.\n- **Notes** take the text directly: `geni crm notes create person <id> --body "Met at the conference"`.\n- **State-change verbs** (no JSON, just flags/ids):\n - Lists/tags: `geni crm lists add <listId> <entityIds...>`, `geni crm tags assign <tagId> <entityIds...>` (and `remove` / `unassign`).\n - Tasks: `geni crm tasks done <id>` (also `dismiss`, `reopen`, `delete`).\n - Cards: `geni crm cards move <id> --stage <stageId>`, `geni crm cards status <id> --status won|lost|open [--reason "..."]`, `geni crm cards archive <id>`, `geni crm cards add-contact <cardId> <personId>`.\n- **Deals/touchpoints**: `geni crm touchpoints log <cardId> --json \'{"channel":"call","occurredAt":"2026-07-01T15:00:00Z","summary":"Pricing call"}\'`.\n- **Delete** is `<noun> delete <id...>` (people/companies/lists/cards take multiple ids; most others take one). `geni crm cards delete <ids...>` is permanent \u2014 it takes the card\'s contacts, activity, notes, touchpoints, tasks, tags, and list entries with it, and reports which ids it actually matched. Prefer `cards archive <id>` when the record should survive.\n\nCard edits, moves, and status changes use optimistic concurrency. Pass\n`--expected-updated-at <ts>` to enforce it; omit it and the CLI reads the card\'s\ncurrent version first (last-write-wins), which is usually what you want from a\nscript. With the token, a stale card fails with an HTTP 409 conflict; re-read\nthe card and retry.\n\n## Output\n\nList commands print a table; pass `--json` to parse. `get` commands and all\nwrites print the affected record as JSON (state-change verbs print a short\nconfirmation). The single-record `get` commands take `--field <path>` to pull\none value, e.g. `geni crm cards get <id> --field status`.\n\nJSON shapes vary by verb: searches print `{"results": [...]}` (people/companies\nadd `nextCursor`), `people get` prints `{person, company, contactPoints, ...}`,\nand bare noun lists wrap in a named key (e.g. `{"lists": [...]}`) \u2014 check before\npiping into a parser.\n\n## Enrichment\n\nFind and verify contact info for people through the workspace\'s configured\nprovider waterfalls. This is **paid** (it spends credits per provider call), so\nevery verb requires `--yes` and a run is capped at 25 people. Only enrich when\nthe user has asked you to. Found emails and numbers save onto the person\'s\ncontact points automatically.\n\n- See what\'s wired first: `geni crm waterfalls` lists the provider chain for each\n capability (email-enrichment, email-validation, phone-enrichment). An empty\n chain finds nothing and spends nothing.\n- `geni crm enrich emails <personIds...> --yes` finds work emails;\n `geni crm enrich phones <personIds...> --yes` finds mobile numbers (both take\n `--retry-unverified`).\n- `geni crm enrich validate <personIds...> --yes` checks deliverability \u2014 run it\n before any outreach so nothing goes to a bad address.\n\n## Composing with the rest of geni\n\nThe CRM is the source of who and what; connected credentials are how you act on\nthe outside world. To add contact info, prefer `geni crm enrich` (it runs the\nworkspace\'s provider waterfalls and saves results). For anything else, pull\npeople or a company from the CRM, reach a service through `geni exec bash` (send\nan email, update an external system), and write the result back to the CRM (a\nnote, a task, a touchpoint, a moved card). Credit each tool naturally in your\nsummary.\n\n## Exit codes worth knowing\n\n- `0` success.\n- `4` not found (bad id, or it is not in the active workspace).\n- `5` forbidden (the workspace lacks CRM access, or the record is out of scope).\n- `9` stale write (a card changed since you read it; re-read and retry, or pass `--expected-updated-at`).\n- `78` session expired. Tell the user to run `geni login`.\n';
30612
+ var geni_crm_default = '---\nname: geni-crm\ndescription: Read and write the user\'s General Input CRM from the command line. Load this whenever the user wants you to look something up in their CRM, pull a list of people or companies, check a deal pipeline, find or verify someone\'s email or phone (enrichment), OR change CRM data (create or update people/companies, manage lists and tags, add notes, create and resolve tasks, move deals through stages, log touchpoints). Full read/write access to people, companies, pipelines, deals, lists, tags, notes, tasks, and enrichment.\n---\n\n# geni crm\n\n`geni crm` reads and writes the user\'s General Input CRM: the lead database\n(people and companies), deal pipelines and their cards, lists, tags, notes,\ntasks, touchpoints, and custom fields. It is part of the same `geni` CLI, so it\nuses the same session and active workspace. The workspace must have CRM access,\nor these commands return a 403. Run `geni crm --help` for the full surface, and\n`geni crm <noun> --help` for a noun\'s verbs.\n\nThe shape is `geni crm <noun> <verb>`. Each noun is a group: `people`,\n`companies`, `lists`, `tags`, `notes`, `tasks`, `pipelines`, `stages`, `cards`,\n`touchpoints`, `fields`, `employments`, `contact-points`, `waterfalls`,\n`enrich`, `access`, `history`, `activities`, `files`, `views`, `merge`,\n`consent`, `privacy`, `credits`, `import`, plus top-level `search` and `match`.\n\nEvery command that names a record by type takes one of three record types:\n`person`, `company`, or `pipeline_card` (a card in any pipeline: a deal, or a\ncandidate in a recruiting pipeline). Tags, lists, notes, tasks, custom fields,\nand access work on all three.\n\nPeople, companies, and pipeline cards have an owner and a visibility: everyone in the\nworkspace, a team, or only the owner (and admins, who see every record). You\nonly see records you have access to; a record you can\'t see is a 404, and\ncreating one whose email, LinkedIn, or domain is already on a record you can\'t\nsee fails with a 409 `record_not_shared` instead of merging into it.\n\n## Finding things, then acting on them\n\nThe same two-step flow as the rest of geni: find an id, then read or write it.\n\n1. Find by name with one query across everything:\n `geni crm search "<text>" [--type person|company|list|pipeline|pipeline_card]`. Or\n list one kind: `geni crm people "<text>"`, `geni crm companies "<text>"`,\n `geni crm pipelines`, `geni crm lists`, `geni crm tags`, `geni crm tasks`.\n `people` and `companies` also take `--filter`, a JSON array of column\n conditions, e.g. `--filter \'[{"field":"title","operator":"contains","value":"vp"},{"field":"companyEmployeeCount","operator":"gte","value":50}]\'` \u2014\n see `--help` for the field and operator lists (custom fields filter as\n `custom.<key>`).\n2. Read one record: `geni crm people get <id>`, `geni crm companies get <id>`,\n `geni crm cards get <id>`, `geni crm pipelines get <id>` (add `--board` for\n its cards), `geni crm tasks get <id>`.\n\n## Activities\n\nNotes, calls, emails, meetings, Slack and LinkedIn messages are activities, and\none activity links to every record it concerns (a call with Ada about the\nAcme deal links Ada, Acme, and the deal card). Someone sees an activity only\nwhen they can see every record it links.\n\n- `geni crm activities list <entityType> <id> [--kind call email]` lists a record\'s activities, newest first.\n- `geni crm activities log --json \'{"kind":"call","direction":"outbound","body":"Walked through the offer","links":[{"type":"person","id":"<id>"},{"type":"pipeline_card","id":"<id>"}]}\'`. A future `occurredAt` schedules a meeting or call.\n- `geni crm activities sync --json \'{...,"externalRef":"<Message-ID>"}\'` creates or updates the activity that `externalRef` names and merges its links, so re-syncing a mailbox never duplicates a message. A message a teammate already logged stays as they logged it; one logged on a record you can\'t see answers 409 `activity_not_shared`, which a sync treats as done.\n- Only an activity\'s author (or an admin) edits or deletes it. Notes (`geni crm notes`) and card touchpoints are the same activities seen through one record.\n\n## Files\n\nA record can carry files (a resume on a person, a contract on a card), up to\n25 MB each. `geni crm files upload person <id> ./resume.pdf --kind resume`\nattaches one; `geni crm files list <entityType> <id>` lists them;\n`geni crm files text <fileId>` prints a text file\'s contents and\n`geni crm files download <fileId>` prints a short-lived link to any file.\nSomeone sees a file only when they can see its record.\n\n## Custom fields and saved views\n\nCustom fields (`geni crm fields`) can be text, long text, number, currency\n(`{"amount":1200,"currency":"USD"}`), checkbox, date, date and time (ISO),\nsingle select, multi-select, status, URL, email, phone, or member (a\nmembership id). Write values through the record\'s `custom` object.\n\nSaved views (`geni crm views`) are named filters, sort, and columns for one\nrecord type\'s table or board, personal or shared with the workspace.\n\n## Duplicates, consent, and privacy\n\n- **Merge duplicates**: `geni crm merge people <keepId> <dupeId...>` (and `companies`). The kept record takes every link, contact, file, and history line, and fills its empty fields from the duplicates. It needs the owner or an admin.\n- **Before any outreach**, run `geni crm consent check <personId> --channel email` (or `phone`). Contact only the `reachable` values it returns, and nobody when `isAllowed` is false. Record a request with `geni crm consent do-not-contact <personId> --reason "..."` or `geni crm consent opt-out <contactPointId>`.\n- **Data requests**: `geni crm privacy export <personId>` returns everything held about them; `geni crm privacy erase <personId> --yes` deletes them for good, with anything merged into them.\n- **Credit splits** on a card: `geni crm credits set <cardId> --json \'{"credits":[{"membershipId":"<id>","role":"Recruiter","percent":60},{"membershipId":"<id>","role":"Account manager","percent":40}]}\'`.\n\n## Importing and syncing\n\n- **Import a CSV**: `geni crm import people leads.csv --dry-run` prints the suggested mapping (column to field, `custom.<key>` for a custom field) and the first rows that would fail. Then run it without `--dry-run`, optionally with `--map \'{...}\'`, `--list <listId>`, `--tag <tagId>`, and `--wait`. Rows match existing records by email, LinkedIn, or domain; a match only fills fields that are empty and never overwrites. `geni crm import status <importId>` shows counts and failed rows.\n- **Match addresses** before logging mail or meetings: `geni crm match a@x.com b@y.com` returns the person each address belongs to (any spelling, `+tags` ignored). Then log with `geni crm activities sync`.\n\n## History and triggers\n\nEvery change to a record is in its history: created, field changes (with the\nold and new value), stage and status moves, tags and lists, tasks, access, and\ndeletes. `geni crm history <entityType> <id>` prints one record\'s history,\nnewest first. `geni crm history feed [--after <cursor>]` reads the workspace\'s\nevents oldest first, and prints a cursor to pass back as `--after`.\n\nTo act when the CRM changes, build a workflow on a `general-input-crm` trigger\n(record created, field changed, card entered stage, tag added, task created,\nfile attached).\nIts payload is one history event: `entityType`, `entityId`, `kind`, `field`,\n`fromLabel`/`toLabel`, and `details` (stage ids for a stage move, the tag or\nlist id for a membership).\n\n## Writing\n\nCreates and updates take the record body as `--json`; the server validates it,\nso a 400 means the body was wrong (read the error and fix the JSON). Run\n`geni crm <noun> <verb> --help` to see the expected fields.\n\n- **Create / update records** (JSON body):\n - `geni crm people create --json \'[{"fullName":"Ada Lovelace","companyName":"Acme","email":"ada@acme.com"}]\'` (batch, find-or-create, deduped). `companies create` mirrors it. A `"created": false` result matched an existing record by identity key (email/LinkedIn; domain for companies) \u2014 the CLI warns on stderr when the matched name differs, e.g. a shared inbox collapsing distinct people.\n - `geni crm people update --json \'[{"id":"<id>","title":"VP Eng","linkedinUrl":"https://\u2026"}]\'` (batch, ids inline). `companies update` mirrors it. Writes take the create field names (`title`, `linkedinUrl`), not the read names you see on `get` (`currentTitle`, `primaryLinkedinUrl`); unknown keys are rejected with a 400 naming them.\n - `geni crm lists create --json \'{"name":"Q3 ICP","entityType":"company"}\'`, `geni crm tags create --json \'{"name":"Customer","entityType":"company"}\'`, `geni crm tasks create --json \'{"title":"Follow up","entity":{"type":"person","id":"<id>"}}\'`, `geni crm cards create <pipelineId> --json \'{"title":"Acme renewal","amount":50000}\'`.\n- **Notes** take the text directly: `geni crm notes create person <id> --body "Met at the conference"`.\n- **State-change verbs** (no JSON, just flags/ids):\n - Lists/tags: `geni crm lists add <listId> <entityIds...>`, `geni crm tags assign <tagId> <entityIds...>` (and `remove` / `unassign`).\n - Tasks: `geni crm tasks done <id>` (also `dismiss`, `reopen`, `delete`).\n - Cards: `geni crm cards move <id> --stage <stageId>`, `geni crm cards status <id> --status won|lost|open [--reason "..."]`, `geni crm cards archive <id>`, `geni crm cards add-contact <cardId> <personId>`.\n- **Access** (owner, team, and who sees it; the owner or an admin): `geni crm access person <id> --json \'{"ownerMembershipId":"<membershipId>","teamId":null,"visibility":"private"}\'`. `company` and `pipeline_card` work the same; `visibility` is `private`, `team` (needs `teamId`), or `workspace`. Deleting a record also needs this access.\n- **Deals/touchpoints**: `geni crm touchpoints log <cardId> --json \'{"channel":"call","occurredAt":"2026-07-01T15:00:00Z","summary":"Pricing call"}\'`.\n- **Delete** is `<noun> delete <id...>` (people/companies/lists/cards take multiple ids; most others take one). `geni crm cards delete <ids...>` is permanent \u2014 it takes the card\'s contacts, activity, notes, touchpoints, tasks, tags, and list entries with it, and reports which ids it actually matched. Prefer `cards archive <id>` when the record should survive.\n\nCard edits, moves, and status changes use optimistic concurrency. Pass\n`--expected-updated-at <ts>` to enforce it; omit it and the CLI reads the card\'s\ncurrent version first (last-write-wins), which is usually what you want from a\nscript. With the token, a stale card fails with an HTTP 409 conflict; re-read\nthe card and retry.\n\n## Output\n\nList commands print a table; pass `--json` to parse. `get` commands and all\nwrites print the affected record as JSON (state-change verbs print a short\nconfirmation). The single-record `get` commands take `--field <path>` to pull\none value, e.g. `geni crm cards get <id> --field status`.\n\nJSON shapes vary by verb: searches print `{"results": [...]}` (people/companies\nadd `nextCursor`), `people get` prints `{person, company, contactPoints, ...}`,\nand bare noun lists wrap in a named key (e.g. `{"lists": [...]}`) \u2014 check before\npiping into a parser.\n\n## Enrichment\n\nFind and verify contact info for people through the workspace\'s configured\nprovider waterfalls. This is **paid** (it spends credits per provider call), so\nevery verb requires `--yes` and a run is capped at 25 people. Only enrich when\nthe user has asked you to. Found emails and numbers save onto the person\'s\ncontact points automatically.\n\n- See what\'s wired first: `geni crm waterfalls` lists the provider chain for each\n capability (email-enrichment, email-validation, phone-enrichment). An empty\n chain finds nothing and spends nothing.\n- `geni crm enrich emails <personIds...> --yes` finds work emails;\n `geni crm enrich phones <personIds...> --yes` finds mobile numbers (both take\n `--retry-unverified`).\n- `geni crm enrich validate <personIds...> --yes` checks deliverability \u2014 run it\n before any outreach so nothing goes to a bad address.\n\n## Composing with the rest of geni\n\nThe CRM is the source of who and what; connected credentials are how you act on\nthe outside world. To add contact info, prefer `geni crm enrich` (it runs the\nworkspace\'s provider waterfalls and saves results). For anything else, pull\npeople or a company from the CRM, reach a service through `geni exec bash` (send\nan email, update an external system), and write the result back to the CRM (a\nnote, a task, a touchpoint, a moved card). Credit each tool naturally in your\nsummary.\n\n## Exit codes worth knowing\n\n- `0` success.\n- `4` not found (bad id, or it is not in the active workspace).\n- `5` forbidden (the workspace lacks CRM access, or the record is out of scope).\n- `9` stale write (a card changed since you read it; re-read and retry, or pass `--expected-updated-at`).\n- `78` session expired. Tell the user to run `geni login`.\n';
30052
30613
 
30053
30614
  // src/lib/skills.ts
30054
30615
  var GENI_SKILL_NAME = "geni";
@@ -30058,23 +30619,23 @@ var SKILLS = [
30058
30619
  { name: GENI_CRM_SKILL_NAME, md: geni_crm_default }
30059
30620
  ];
30060
30621
  var home = homedir2();
30061
- var claudeSkillsDir = join8(home, ".claude", "skills");
30062
- var agentSkillsDir = join8(home, ".agents", "skills");
30622
+ var claudeSkillsDir = join9(home, ".claude", "skills");
30623
+ var agentSkillsDir = join9(home, ".agents", "skills");
30063
30624
  var TARGETS = [
30064
30625
  {
30065
30626
  name: "Claude Code",
30066
- detect: () => existsSync5(join8(home, ".claude")),
30627
+ detect: () => existsSync5(join9(home, ".claude")),
30067
30628
  skillsBaseDir: claudeSkillsDir,
30068
30629
  // Earlier versions wrote a loose `~/.claude/skills/<skill>.md`, which
30069
30630
  // Claude Code silently ignores. Clean it up so upgraders aren't left
30070
30631
  // with a stale sibling that confuses `doctor`.
30071
- legacyPaths: (skillName) => [join8(claudeSkillsDir, `${skillName}.md`)]
30632
+ legacyPaths: (skillName) => [join9(claudeSkillsDir, `${skillName}.md`)]
30072
30633
  },
30073
30634
  {
30074
30635
  name: "Codex CLI / Gemini CLI / VS Code Copilot",
30075
30636
  // Detection: any supporting agent has touched disk, or the shared
30076
30637
  // `~/.agents/` dir already exists (likely written by another installer).
30077
- detect: () => existsSync5(join8(home, ".codex")) || existsSync5(join8(home, ".gemini")) || existsSync5(join8(home, ".agents")),
30638
+ detect: () => existsSync5(join9(home, ".codex")) || existsSync5(join9(home, ".gemini")) || existsSync5(join9(home, ".agents")),
30078
30639
  skillsBaseDir: agentSkillsDir,
30079
30640
  legacyPaths: () => []
30080
30641
  }
@@ -30087,7 +30648,7 @@ function detectSkillTargets() {
30087
30648
  out.push({
30088
30649
  name: target.name,
30089
30650
  skill: skill.name,
30090
- path: join8(target.skillsBaseDir, skill.name, "SKILL.md"),
30651
+ path: join9(target.skillsBaseDir, skill.name, "SKILL.md"),
30091
30652
  expectedMd: skill.md
30092
30653
  });
30093
30654
  }
@@ -30099,13 +30660,13 @@ function installSkills() {
30099
30660
  for (const target of TARGETS) {
30100
30661
  if (!target.detect()) continue;
30101
30662
  for (const skill of SKILLS) {
30102
- const dir = join8(target.skillsBaseDir, skill.name);
30103
- const path = join8(dir, "SKILL.md");
30663
+ const dir = join9(target.skillsBaseDir, skill.name);
30664
+ const path = join9(dir, "SKILL.md");
30104
30665
  try {
30105
30666
  mkdirSync7(dir, { recursive: true });
30106
- const previous = existsSync5(path) ? readFileSync8(path, "utf-8") : null;
30667
+ const previous = existsSync5(path) ? readFileSync9(path, "utf-8") : null;
30107
30668
  const changed = previous !== skill.md;
30108
- writeFileSync6(path, skill.md);
30669
+ writeFileSync7(path, skill.md);
30109
30670
  for (const legacy of target.legacyPaths(skill.name)) {
30110
30671
  if (existsSync5(legacy)) unlinkSync(legacy);
30111
30672
  }
@@ -30133,8 +30694,8 @@ function uninstallSkills() {
30133
30694
  for (const target of TARGETS) {
30134
30695
  if (!target.detect()) continue;
30135
30696
  for (const skill of SKILLS) {
30136
- const dir = join8(target.skillsBaseDir, skill.name);
30137
- const path = join8(dir, "SKILL.md");
30697
+ const dir = join9(target.skillsBaseDir, skill.name);
30698
+ const path = join9(dir, "SKILL.md");
30138
30699
  const legacies = target.legacyPaths(skill.name).filter((p2) => existsSync5(p2));
30139
30700
  if (!existsSync5(dir) && legacies.length === 0) {
30140
30701
  results.push({
@@ -30146,7 +30707,7 @@ function uninstallSkills() {
30146
30707
  continue;
30147
30708
  }
30148
30709
  try {
30149
- rmSync(dir, { recursive: true, force: true });
30710
+ rmSync2(dir, { recursive: true, force: true });
30150
30711
  for (const legacy of legacies) unlinkSync(legacy);
30151
30712
  results.push({
30152
30713
  name: target.name,
@@ -30230,7 +30791,7 @@ function registerSkillsUninstall(parent) {
30230
30791
  }
30231
30792
 
30232
30793
  // src/commands/skills/load.ts
30233
- import { resolve as resolve29, join as join9 } from "path";
30794
+ import { resolve as resolve29, join as join10 } from "path";
30234
30795
  function registerSkillsLoad(parent) {
30235
30796
  parent.command("load <name>").description(
30236
30797
  "Download a platform skill (SKILL.md + references/) into a local directory. Load the matching authoring skill (code-workflow, agent-workflow, app, skill-authoring, custom-api) before building."
@@ -30238,13 +30799,13 @@ function registerSkillsLoad(parent) {
30238
30799
  "--dir <path>",
30239
30800
  "Destination directory. Defaults to ./geni-skills/<name>."
30240
30801
  ).action(async (name, opts) => {
30241
- const dir = resolve29(opts.dir ?? join9("geni-skills", name));
30802
+ const dir = resolve29(opts.dir ?? join10("geni-skills", name));
30242
30803
  try {
30243
30804
  const { fileCount, description } = await skillAuthoringService.loadPlatformSkill({ name, dir });
30244
30805
  printSuccess(`Loaded ${name} (${fileCount} file(s)) into ${dir}`);
30245
30806
  printInfo(description);
30246
30807
  printInfo(
30247
- `Start with ${join9(dir, "SKILL.md")}; the spec and worked example (when the skill ships them) are under ${join9(dir, "references")}/.`
30808
+ `Start with ${join10(dir, "SKILL.md")}; the spec and worked example (when the skill ships them) are under ${join10(dir, "references")}/.`
30248
30809
  );
30249
30810
  } catch (error) {
30250
30811
  exitOnApiError(error, {
@@ -30528,7 +31089,7 @@ function printJsonOrField(record, field) {
30528
31089
  }
30529
31090
 
30530
31091
  // src/lib/leadFilterArg.ts
30531
- import { z as z48 } from "zod";
31092
+ import { z as z50 } from "zod";
30532
31093
  var FILTER_EXAMPLE = `--filter '[{"field":"title","operator":"contains","value":"vp"}]'`;
30533
31094
  function parseLeadFilterArg(raw) {
30534
31095
  let value;
@@ -30538,7 +31099,7 @@ function parseLeadFilterArg(raw) {
30538
31099
  printError(`Invalid --filter: not valid JSON. Example: ${FILTER_EXAMPLE}`);
30539
31100
  exit(ExitCode.InternalError);
30540
31101
  }
30541
- const parsed = z48.array(LeadFilterConditionSchema).safeParse(value);
31102
+ const parsed = z50.array(LeadFilterConditionSchema).safeParse(value);
30542
31103
  if (!parsed.success) {
30543
31104
  const issue = parsed.error.issues[0];
30544
31105
  const path = issue?.path.map(String).join(".");
@@ -31840,6 +32401,26 @@ function registerCrmEnrich(parent) {
31840
32401
  });
31841
32402
  }
31842
32403
 
32404
+ // src/commands/crm/access.ts
32405
+ function registerCrmAccess(parent) {
32406
+ parent.command("access").argument("<entityType>", `${CRM_ENTITY_TYPE_WORDS}.`).argument("<id>", "Record id.").description(
32407
+ "Set a record's owner, team, and visibility. --json: { ownerMembershipId, teamId, visibility: private|team|workspace } (ownerMembershipId and teamId may be null; a pipeline_card may have no owner)."
32408
+ ).requiredOption("--json <body>", "JSON access settings.").action(async (entityType, id, opts) => {
32409
+ const parsedType = crmEntityTypeOrExit(entityType);
32410
+ try {
32411
+ printJson(
32412
+ await crmService.setRecordAccess(
32413
+ parsedType,
32414
+ id,
32415
+ parseJsonArg(opts.json)
32416
+ )
32417
+ );
32418
+ } catch (error) {
32419
+ exitOnApiError(error);
32420
+ }
32421
+ });
32422
+ }
32423
+
31843
32424
  // src/commands/crm/history.ts
31844
32425
  function describeChange(event) {
31845
32426
  const field = event.field ? `${event.field} ` : "";
@@ -32489,6 +33070,7 @@ function registerCrmCommands(program2) {
32489
33070
  registerCrmContactPoints(crm);
32490
33071
  registerCrmWaterfalls(crm);
32491
33072
  registerCrmEnrich(crm);
33073
+ registerCrmAccess(crm);
32492
33074
  crm.action(() => crm.help());
32493
33075
  crm.enablePositionalOptions();
32494
33076
  for (const noun of crm.commands) noun.enablePositionalOptions();
@@ -33111,7 +33693,7 @@ function registerSpecialistCommands(program2) {
33111
33693
  import chalk9 from "chalk";
33112
33694
 
33113
33695
  // src/lib/preflight.ts
33114
- import { delimiter, join as join10 } from "path";
33696
+ import { delimiter, join as join11 } from "path";
33115
33697
  import { accessSync, constants } from "fs";
33116
33698
  var REQUIRED_RUNTIME_DEPS = ["bash", "curl", "jq"];
33117
33699
  function findOnPath(name) {
@@ -33119,7 +33701,7 @@ function findOnPath(name) {
33119
33701
  if (!path) return null;
33120
33702
  for (const dir of path.split(delimiter)) {
33121
33703
  if (dir.length === 0) continue;
33122
- const candidate = join10(dir, name);
33704
+ const candidate = join11(dir, name);
33123
33705
  try {
33124
33706
  accessSync(candidate, constants.X_OK);
33125
33707
  return candidate;
@@ -33158,7 +33740,7 @@ function installHint(deps) {
33158
33740
  }
33159
33741
 
33160
33742
  // src/commands/doctor.ts
33161
- import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
33743
+ import { existsSync as existsSync7, readFileSync as readFileSync10 } from "fs";
33162
33744
  function registerDoctorCommand(program2) {
33163
33745
  program2.command("doctor").description(
33164
33746
  "Diagnose your geni setup: required system tools, active session, network reach to the cloud, and skill installation across detected AI agents. Prints a checklist with \u2713/\u2717 for each."
@@ -33269,7 +33851,7 @@ function skillsCheck() {
33269
33851
  });
33270
33852
  continue;
33271
33853
  }
33272
- const onDisk = readFileSync9(target.path, "utf-8");
33854
+ const onDisk = readFileSync10(target.path, "utf-8");
33273
33855
  if (onDisk === target.expectedMd) {
33274
33856
  out.push({
33275
33857
  label: `${target.name}: ${target.skill} skill installed`,
@@ -33311,10 +33893,10 @@ function printReport(checks) {
33311
33893
  import { spawn as spawn3, execFileSync } from "child_process";
33312
33894
  import { realpathSync } from "fs";
33313
33895
  import { sep as sep2 } from "path";
33314
- import { z as z49 } from "zod";
33896
+ import { z as z51 } from "zod";
33315
33897
  import semver from "semver";
33316
33898
  var PACKAGE_NAME = "@general-input/cli";
33317
- var registryLatestSchema = z49.object({ version: z49.string() });
33899
+ var registryLatestSchema = z51.object({ version: z51.string() });
33318
33900
  function registerUpgradeCommand(program2) {
33319
33901
  program2.command("upgrade").description(
33320
33902
  "Upgrade geni to the latest published version. Checks the npm registry and reinstalls via `npm install -g` when this install is npm-managed. Use --check to only report whether a newer version exists."