gtmmaxing 0.1.7 → 0.1.8

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 (2) hide show
  1. package/dist/gtm.js +1271 -218
  2. package/package.json +1 -1
package/dist/gtm.js CHANGED
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
3
+ var __export = (target2, all) => {
4
4
  for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: true });
5
+ __defProp(target2, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
+ // src/watch.ts
9
+ import { createHash } from "node:crypto";
10
+
8
11
  // ../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/external.js
9
12
  var external_exports = {};
10
13
  __export(external_exports, {
@@ -730,8 +733,8 @@ function defineLazy(object2, key, getter) {
730
733
  function objectClone(obj) {
731
734
  return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
732
735
  }
733
- function assignProp(target, prop, value) {
734
- Object.defineProperty(target, prop, {
736
+ function assignProp(target2, prop, value) {
737
+ Object.defineProperty(target2, prop, {
735
738
  value,
736
739
  writable: true,
737
740
  enumerable: true,
@@ -914,35 +917,35 @@ function normalizeParams(_params) {
914
917
  return params;
915
918
  }
916
919
  function createTransparentProxy(getter) {
917
- let target;
920
+ let target2;
918
921
  return new Proxy({}, {
919
922
  get(_, prop, receiver) {
920
- target ?? (target = getter());
921
- return Reflect.get(target, prop, receiver);
923
+ target2 ?? (target2 = getter());
924
+ return Reflect.get(target2, prop, receiver);
922
925
  },
923
926
  set(_, prop, value, receiver) {
924
- target ?? (target = getter());
925
- return Reflect.set(target, prop, value, receiver);
927
+ target2 ?? (target2 = getter());
928
+ return Reflect.set(target2, prop, value, receiver);
926
929
  },
927
930
  has(_, prop) {
928
- target ?? (target = getter());
929
- return Reflect.has(target, prop);
931
+ target2 ?? (target2 = getter());
932
+ return Reflect.has(target2, prop);
930
933
  },
931
934
  deleteProperty(_, prop) {
932
- target ?? (target = getter());
933
- return Reflect.deleteProperty(target, prop);
935
+ target2 ?? (target2 = getter());
936
+ return Reflect.deleteProperty(target2, prop);
934
937
  },
935
938
  ownKeys(_) {
936
- target ?? (target = getter());
937
- return Reflect.ownKeys(target);
939
+ target2 ?? (target2 = getter());
940
+ return Reflect.ownKeys(target2);
938
941
  },
939
942
  getOwnPropertyDescriptor(_, prop) {
940
- target ?? (target = getter());
941
- return Reflect.getOwnPropertyDescriptor(target, prop);
943
+ target2 ?? (target2 = getter());
944
+ return Reflect.getOwnPropertyDescriptor(target2, prop);
942
945
  },
943
946
  defineProperty(_, prop, descriptor) {
944
- target ?? (target = getter());
945
- return Reflect.defineProperty(target, prop, descriptor);
947
+ target2 ?? (target2 = getter());
948
+ return Reflect.defineProperty(target2, prop, descriptor);
946
949
  }
947
950
  });
948
951
  }
@@ -1270,16 +1273,16 @@ function cleanEnum(obj) {
1270
1273
  }
1271
1274
  function base64ToUint8Array(base643) {
1272
1275
  const binaryString = atob(base643);
1273
- const bytes = new Uint8Array(binaryString.length);
1276
+ const bytes2 = new Uint8Array(binaryString.length);
1274
1277
  for (let i = 0; i < binaryString.length; i++) {
1275
- bytes[i] = binaryString.charCodeAt(i);
1278
+ bytes2[i] = binaryString.charCodeAt(i);
1276
1279
  }
1277
- return bytes;
1280
+ return bytes2;
1278
1281
  }
1279
- function uint8ArrayToBase64(bytes) {
1282
+ function uint8ArrayToBase64(bytes2) {
1280
1283
  let binaryString = "";
1281
- for (let i = 0; i < bytes.length; i++) {
1282
- binaryString += String.fromCharCode(bytes[i]);
1284
+ for (let i = 0; i < bytes2.length; i++) {
1285
+ binaryString += String.fromCharCode(bytes2[i]);
1283
1286
  }
1284
1287
  return btoa(binaryString);
1285
1288
  }
@@ -1288,22 +1291,22 @@ function base64urlToUint8Array(base64url3) {
1288
1291
  const padding = "=".repeat((4 - base643.length % 4) % 4);
1289
1292
  return base64ToUint8Array(base643 + padding);
1290
1293
  }
1291
- function uint8ArrayToBase64url(bytes) {
1292
- return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
1294
+ function uint8ArrayToBase64url(bytes2) {
1295
+ return uint8ArrayToBase64(bytes2).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
1293
1296
  }
1294
1297
  function hexToUint8Array(hex3) {
1295
1298
  const cleanHex = hex3.replace(/^0x/, "");
1296
1299
  if (cleanHex.length % 2 !== 0) {
1297
1300
  throw new Error("Invalid hex string length");
1298
1301
  }
1299
- const bytes = new Uint8Array(cleanHex.length / 2);
1302
+ const bytes2 = new Uint8Array(cleanHex.length / 2);
1300
1303
  for (let i = 0; i < cleanHex.length; i += 2) {
1301
- bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
1304
+ bytes2[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
1302
1305
  }
1303
- return bytes;
1306
+ return bytes2;
1304
1307
  }
1305
- function uint8ArrayToHex(bytes) {
1306
- return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
1308
+ function uint8ArrayToHex(bytes2) {
1309
+ return Array.from(bytes2).map((b) => b.toString(16).padStart(2, "0")).join("");
1307
1310
  }
1308
1311
  var Class = class {
1309
1312
  constructor(..._args) {
@@ -1464,10 +1467,10 @@ function $constructor(name, initializer3, proto, params) {
1464
1467
  let up = own2;
1465
1468
  while (up && up !== ctorProto)
1466
1469
  up = Object.getPrototypeOf(up);
1467
- const target = up ?? own2;
1468
- if (!initialized.has(target)) {
1469
- initialized.add(target);
1470
- members(target, protoMembers);
1470
+ const target2 = up ?? own2;
1471
+ if (!initialized.has(target2)) {
1472
+ initialized.add(target2);
1473
+ members(target2, protoMembers);
1471
1474
  }
1472
1475
  }
1473
1476
  const proto2 = _.prototype;
@@ -3095,9 +3098,9 @@ var $ZodCreditCard = /* @__PURE__ */ $constructor("$ZodCreditCard", (inst, def)
3095
3098
  });
3096
3099
  };
3097
3100
  });
3098
- function isValidJWT(token, algorithm = null) {
3101
+ function isValidJWT(token2, algorithm = null) {
3099
3102
  try {
3100
- const tokensParts = token.split(".");
3103
+ const tokensParts = token2.split(".");
3101
3104
  if (tokensParts.length !== 3)
3102
3105
  return false;
3103
3106
  const [header] = tokensParts;
@@ -9087,8 +9090,8 @@ function ko_default() {
9087
9090
  }
9088
9091
 
9089
9092
  // ../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/lt.js
9090
- var capitalizeFirstCharacter = (text4) => {
9091
- return text4.charAt(0).toUpperCase() + text4.slice(1);
9093
+ var capitalizeFirstCharacter = (text5) => {
9094
+ return text5.charAt(0).toUpperCase() + text5.slice(1);
9092
9095
  };
9093
9096
  function getUnitTypeFromNumber(number4) {
9094
9097
  const abs = Math.abs(number4);
@@ -12564,8 +12567,8 @@ function compile(schema, options) {
12564
12567
  return schema;
12565
12568
  }
12566
12569
  }
12567
- function installCompiledUserMethods(target, source, parser) {
12568
- const targetAny = target;
12570
+ function installCompiledUserMethods(target2, source, parser) {
12571
+ const targetAny = target2;
12569
12572
  const sourceAny = source;
12570
12573
  if (typeof sourceAny.safeParse === "function") {
12571
12574
  const originalSafeParse = sourceAny.safeParse;
@@ -15106,26 +15109,26 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
15106
15109
  }
15107
15110
 
15108
15111
  // ../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
15109
- function assignProps(target, ...sources) {
15112
+ function assignProps(target2, ...sources) {
15110
15113
  for (const source of sources) {
15111
15114
  for (const key of Reflect.ownKeys(source)) {
15112
15115
  if (Object.prototype.propertyIsEnumerable.call(source, key)) {
15113
- assignProp(target, key, source[key]);
15116
+ assignProp(target2, key, source[key]);
15114
15117
  }
15115
15118
  }
15116
15119
  }
15117
- return target;
15120
+ return target2;
15118
15121
  }
15119
15122
  function initializeContext(params) {
15120
- let target = params?.target ?? "draft-2020-12";
15121
- if (target === "draft-4")
15122
- target = "draft-04";
15123
- if (target === "draft-7")
15124
- target = "draft-07";
15123
+ let target2 = params?.target ?? "draft-2020-12";
15124
+ if (target2 === "draft-4")
15125
+ target2 = "draft-04";
15126
+ if (target2 === "draft-7")
15127
+ target2 = "draft-07";
15125
15128
  return {
15126
15129
  processors: params.processors ?? {},
15127
15130
  metadataRegistry: params?.metadata ?? globalRegistry,
15128
- target,
15131
+ target: target2,
15129
15132
  unrepresentable: params?.unrepresentable ?? "throw",
15130
15133
  override: params?.override ?? (() => {
15131
15134
  }),
@@ -15629,8 +15632,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
15629
15632
  return finalize(ctx, schema);
15630
15633
  };
15631
15634
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
15632
- const { libraryOptions, target } = params ?? {};
15633
- const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
15635
+ const { libraryOptions, target: target2 } = params ?? {};
15636
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
15634
15637
  process2(schema, ctx);
15635
15638
  extractDefs(ctx, schema);
15636
15639
  return finalize(ctx, schema);
@@ -16730,8 +16733,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
16730
16733
  catch(params) {
16731
16734
  return _catch2(this, params);
16732
16735
  },
16733
- pipe(target) {
16734
- return pipe(this, target);
16736
+ pipe(target2) {
16737
+ return pipe(this, target2);
16735
16738
  },
16736
16739
  readonly() {
16737
16740
  return readonly(this);
@@ -18942,6 +18945,8 @@ var toolRequestFields = external_exports.object({
18942
18945
  keywords: external_exports.string().trim().max(300).optional(),
18943
18946
  /** X and Reddit search: how far back to look. Optional so older saved requests keep their hash. */
18944
18947
  within: external_exports.enum(SEARCH_WINDOWS).optional(),
18948
+ /** X and Reddit search: qualify buyer needs, or enforce a literal post query. Omitted on historical runs. */
18949
+ intent: external_exports.enum(["buyers", "posts"]).optional(),
18945
18950
  /** People search and hiring signals: exact directory labels from filters.ts. Optional so older saved requests keep their hash. */
18946
18951
  industries: external_exports.array(external_exports.string().trim().min(1).max(400)).max(20).optional(),
18947
18952
  companySizes: external_exports.array(external_exports.string().trim().min(1).max(20)).max(9).optional(),
@@ -18992,6 +18997,21 @@ var machineJobLifecycle = defineLifecycle({
18992
18997
  });
18993
18998
  var AGENT_RUN_STATUSES = ["running", "completed", "not_found", "error"];
18994
18999
 
19000
+ // ../contracts/src/product-policy.ts
19001
+ var CREDIT_ATOMIC = 1e4;
19002
+ var EMAIL_LOOKUP_CREDITS = 1;
19003
+ var EMAIL_RECHECK_CREDITS = 2;
19004
+ var EMAIL_LOOKUP_ATOMIC = EMAIL_LOOKUP_CREDITS * CREDIT_ATOMIC;
19005
+ var AGENT_MAX_CREDITS = 1e5;
19006
+ var LEAD_MAX_TARGET = 500;
19007
+ var LEAD_MAX_CONTACTS_PER_COMPANY = 5;
19008
+ var AGENT_ANSWER_MAX_BYTES = 1024;
19009
+
19010
+ // ../contracts/src/format.ts
19011
+ function creditWord(value) {
19012
+ return value === 1 ? "credit" : "credits";
19013
+ }
19014
+
18995
19015
  // ../contracts/src/result-presentation.ts
18996
19016
  var RESULT_FIELD_LABELS = {
18997
19017
  url: "URL",
@@ -19003,6 +19023,197 @@ var RESULT_FIELD_LABELS = {
19003
19023
  postAt: "Posted",
19004
19024
  mainCta: "Main call to action"
19005
19025
  };
19026
+ var RESULT_DISPLAY_SPECS = {
19027
+ "seo-aeo-audit": { view: "card", primary: ["url", "status", "reportUrl"] },
19028
+ company: {
19029
+ view: "card",
19030
+ primary: ["name", "domain", "industry", "employees"],
19031
+ identity: { field: "name", link: "url" }
19032
+ },
19033
+ "local-leads": {
19034
+ view: "table",
19035
+ primary: ["name", "address", "phone", "website"],
19036
+ identity: { field: "name", link: "url" }
19037
+ },
19038
+ website: {
19039
+ view: "document",
19040
+ primary: [
19041
+ "company",
19042
+ "whatTheyDo",
19043
+ "sellsTo",
19044
+ "pricing",
19045
+ "url",
19046
+ "fetchedAt"
19047
+ ],
19048
+ identity: { field: "company", link: "url" }
19049
+ },
19050
+ icp: {
19051
+ view: "table",
19052
+ primary: ["name", "title", "company", "domain"],
19053
+ identity: { field: "name", link: "url" }
19054
+ },
19055
+ signals: {
19056
+ view: "table",
19057
+ primary: ["company", "role", "location", "posted", "url"],
19058
+ identity: { field: "company", link: "domain" }
19059
+ },
19060
+ "verify-email": {
19061
+ view: "card",
19062
+ primary: ["email", "verdict", "score", "checkedAt"]
19063
+ },
19064
+ "phone-pilot": { view: "card", primary: ["phone", "type", "country"] },
19065
+ "people-search": {
19066
+ view: "table",
19067
+ primary: ["name", "title", "company", "domain"],
19068
+ identity: { field: "name", link: "url" }
19069
+ },
19070
+ "google-search": {
19071
+ view: "table",
19072
+ primary: ["position", "title", "domain", "snippet"]
19073
+ },
19074
+ "linkedin-profile": {
19075
+ view: "card",
19076
+ primary: ["name", "headline", "role", "company", "location", "url"],
19077
+ identity: { field: "name", link: "url" }
19078
+ },
19079
+ "linkedin-activity": {
19080
+ view: "card",
19081
+ primary: ["name", "lastPostAt", "posts90d", "posts365d", "topicPosts"],
19082
+ identity: { field: "name", link: "url" }
19083
+ },
19084
+ "profile-finder": {
19085
+ view: "card",
19086
+ primary: ["name", "title", "company", "url"],
19087
+ identity: { field: "name", link: "url" }
19088
+ },
19089
+ "page-content": {
19090
+ view: "document",
19091
+ primary: ["title", "url", "words", "content"]
19092
+ },
19093
+ "instagram-profile": {
19094
+ view: "card",
19095
+ primary: ["name", "handle", "bio", "followers", "website"],
19096
+ identity: { field: "name", secondary: "handle", link: "url" },
19097
+ overrides: { handle: { platform: "instagram" } }
19098
+ },
19099
+ "x-search": {
19100
+ view: "table",
19101
+ primary: ["name", "evidence", "signal", "postedAt", "url"],
19102
+ identity: { field: "name", secondary: "author" },
19103
+ overrides: {
19104
+ author: { platform: "x" },
19105
+ name: { sourceField: null, fallback: "author" },
19106
+ evidence: { fallback: "text" }
19107
+ }
19108
+ },
19109
+ "reddit-search": {
19110
+ view: "table",
19111
+ primary: ["subreddit", "evidence", "signal", "postedAt", "url"],
19112
+ overrides: {
19113
+ subreddit: { platform: "reddit-community" },
19114
+ evidence: { fallback: "title" },
19115
+ author: { platform: "reddit-user" },
19116
+ score: { type: "count", unit: "votes" }
19117
+ }
19118
+ },
19119
+ "funding-signals": {
19120
+ view: "table",
19121
+ primary: ["company", "domain", "amount", "announced", "source"],
19122
+ identity: { field: "company", link: "domain" }
19123
+ },
19124
+ "lookalike-companies": {
19125
+ view: "table",
19126
+ primary: ["company", "domain", "industry"],
19127
+ identity: { field: "company", link: "domain" }
19128
+ },
19129
+ "tech-stack": {
19130
+ view: "table",
19131
+ primary: ["technology", "category", "lastSeen"],
19132
+ identity: { field: "technology" }
19133
+ },
19134
+ "post-engagers": {
19135
+ view: "table",
19136
+ primary: ["name", "headline", "engagement", "comment"],
19137
+ identity: { field: "name", link: "url" }
19138
+ }
19139
+ };
19140
+ var DATES = /* @__PURE__ */ new Set([
19141
+ "posted",
19142
+ "postedAt",
19143
+ "checkedAt",
19144
+ "fetchedAt",
19145
+ "when",
19146
+ "lastPostAt",
19147
+ "postAt",
19148
+ "announced",
19149
+ "lastSeen"
19150
+ ]);
19151
+ var COUNTS = /* @__PURE__ */ new Set([
19152
+ "followers",
19153
+ "following",
19154
+ "likes",
19155
+ "replies",
19156
+ "reposts",
19157
+ "views",
19158
+ "comments",
19159
+ "words",
19160
+ "posts90d",
19161
+ "posts365d",
19162
+ "topicPosts"
19163
+ ]);
19164
+ var URLS = /* @__PURE__ */ new Set([
19165
+ "url",
19166
+ "website",
19167
+ "linkedin",
19168
+ "companyPage",
19169
+ "reportUrl",
19170
+ "postUrl",
19171
+ "source"
19172
+ ]);
19173
+ function createResultDisplay(spec, fields, findEmails) {
19174
+ const columns = Object.fromEntries(
19175
+ Object.entries(fields).map(([field, column]) => {
19176
+ const type = DATES.has(field) ? "date" : COUNTS.has(field) ? "count" : ["reply", "business", "verified"].includes(field) ? "boolean" : field === "domain" ? "domain" : URLS.has(field) ? "url" : field === "amount" ? "currency" : field === "email" ? "email" : field === "phone" ? "phone" : ["author", "handle", "subreddit"].includes(field) ? "handle" : column.kind === "entity" || field === spec.identity?.field ? "entity" : column.kind === "status" ? "status" : ["position", "rating", "score"].includes(field) ? "number" : "text";
19177
+ const role = spec.identity?.field === field ? "identity" : ["text", "evidence", "snippet", "reason", "comment"].includes(field) ? "evidence" : ["count", "number", "currency"].includes(type) ? "metric" : ["url", "domain"].includes(type) ? "source" : "detail";
19178
+ return [
19179
+ field,
19180
+ {
19181
+ label: column.label,
19182
+ type,
19183
+ role,
19184
+ visibility: spec.primary.includes(field) ? "primary" : "secondary",
19185
+ unit: type === "count" ? "count" : type === "currency" ? "currency" : null,
19186
+ nullDisplay: "Unknown",
19187
+ sortKey: field,
19188
+ sourceField: field === spec.identity?.field ? spec.identity.link ?? null : type === "entity" || field === "title" ? "url" in fields ? "url" : null : null,
19189
+ ...type === "currency" ? { currencyField: "currency" } : {},
19190
+ ...field === "reply" ? { booleanLabels: ["Original post", "Reply"] } : {},
19191
+ ...field === "business" ? {
19192
+ booleanLabels: [
19193
+ "Personal account",
19194
+ "Business account"
19195
+ ]
19196
+ } : {},
19197
+ ...field === "verified" ? { booleanLabels: ["Not verified", "Verified account"] } : {},
19198
+ ...spec.overrides?.[field]
19199
+ }
19200
+ ];
19201
+ })
19202
+ );
19203
+ return {
19204
+ ...spec,
19205
+ columns,
19206
+ actions: [
19207
+ ...Object.values(columns).some(
19208
+ (c) => c.type === "url" || c.type === "domain"
19209
+ ) ? ["open-source"] : [],
19210
+ ...Object.values(columns).some(
19211
+ (c) => c.type === "email" || c.type === "phone"
19212
+ ) ? ["copy-contact"] : [],
19213
+ ...findEmails ? ["find-emails"] : []
19214
+ ]
19215
+ };
19216
+ }
19006
19217
 
19007
19218
  // ../contracts/src/filters.ts
19008
19219
  var COMPANY_SIZE_BANDS = [
@@ -19504,10 +19715,10 @@ function companySizeLabels(value) {
19504
19715
  if (over) return bands(Number(over[1] ?? over[2]), Number.MAX_SAFE_INTEGER);
19505
19716
  const under = /^(?:<|under |less than )\s*(\d+)$/.exec(plain);
19506
19717
  if (under) return bands(1, Number(under[1]) - 1);
19507
- const range = SIZE_PLAIN.exec(plain);
19508
- if (!range) return null;
19509
- const low = Number(range[1]);
19510
- const high = Number(range[2]);
19718
+ const range2 = SIZE_PLAIN.exec(plain);
19719
+ if (!range2) return null;
19720
+ const low = Number(range2[1]);
19721
+ const high = Number(range2[2]);
19511
19722
  return low <= high ? bands(low, high) : null;
19512
19723
  }
19513
19724
  function bands(low, high) {
@@ -19545,6 +19756,7 @@ function defineTool(identity, build3) {
19545
19756
  return {
19546
19757
  ...identity,
19547
19758
  ...definition,
19759
+ display: createResultDisplay(definition.display, definition.columns, definition.actions?.some((action) => action.target === "email-finder") ?? false),
19548
19760
  title: definition.title ?? identity.name,
19549
19761
  price: {
19550
19762
  credits: identity.credits,
@@ -19599,6 +19811,7 @@ var TOOL_DEFINITIONS = {
19599
19811
  description: "RankAI website audit for search engine and answer engine optimization, with a report URL when complete.",
19600
19812
  input: external_exports.object({ url: text(300) }).strict(),
19601
19813
  row: external_exports.object({ url: s, auditId: s, status: s, reportUrl: s }),
19814
+ display: RESULT_DISPLAY_SPECS["seo-aeo-audit"],
19602
19815
  preview: ["url", "status", "reportUrl"],
19603
19816
  noun: "audits",
19604
19817
  free: "Failed audits and empty results are free.",
@@ -19654,7 +19867,7 @@ var TOOL_DEFINITIONS = {
19654
19867
  },
19655
19868
  reservationHeadroom: 0,
19656
19869
  badges: [],
19657
- followUp: null
19870
+ accepts: { website: "url", company: "url" }
19658
19871
  })
19659
19872
  ),
19660
19873
  company: defineTool(
@@ -19663,6 +19876,7 @@ var TOOL_DEFINITIONS = {
19663
19876
  description: "Company details from a domain: industry, size, country and about.",
19664
19877
  input: external_exports.object({ domain: text(100) }).strict(),
19665
19878
  row: external_exports.object({ name: s, domain: s, industry: s, employees: s, country: s, about: s, url: s }),
19879
+ display: RESULT_DISPLAY_SPECS["company"],
19666
19880
  preview: ["name", "industry", "employees", "country"],
19667
19881
  noun: "companies",
19668
19882
  free: "Empty results are free.",
@@ -19729,7 +19943,9 @@ var TOOL_DEFINITIONS = {
19729
19943
  },
19730
19944
  reservationHeadroom: 1e3,
19731
19945
  badges: [{ name: "Blitz", logo: "blitz.png" }],
19732
- followUp: null
19946
+ carries: { company: "domain" },
19947
+ accepts: { company: "domain" },
19948
+ actions: [{ entity: "company", target: "icp" }, { entity: "company", target: "website" }, { entity: "company", target: "lookalike-companies" }, { entity: "company", target: "tech-stack" }]
19733
19949
  })
19734
19950
  ),
19735
19951
  "local-leads": defineTool(
@@ -19738,6 +19954,7 @@ var TOOL_DEFINITIONS = {
19738
19954
  description: "Local businesses by type and city, with address, website and listed phone.",
19739
19955
  input: external_exports.object({ business_type: text(100), location: text(100), limit }).strict(),
19740
19956
  row: external_exports.object({ name: s, address: s, phone: s, website: s, rating: n, url: s }),
19957
+ display: RESULT_DISPLAY_SPECS["local-leads"],
19741
19958
  preview: ["name", "address", "phone", "website"],
19742
19959
  noun: "businesses",
19743
19960
  free: "Empty results are free.",
@@ -19824,7 +20041,8 @@ var TOOL_DEFINITIONS = {
19824
20041
  },
19825
20042
  reservationHeadroom: 500,
19826
20043
  badges: [{ name: "Google Maps", logo: "google-maps.png" }],
19827
- followUp: null
20044
+ carries: { website: "website" },
20045
+ actions: [{ entity: "website", target: "website" }, { entity: "website", target: "page-content" }]
19828
20046
  })
19829
20047
  ),
19830
20048
  website: defineTool(
@@ -19843,6 +20061,7 @@ var TOOL_DEFINITIONS = {
19843
20061
  url: s,
19844
20062
  fetchedAt: s
19845
20063
  }),
20064
+ display: RESULT_DISPLAY_SPECS["website"],
19846
20065
  preview: ["company", "whatTheyDo", "sellsTo", "pricing"],
19847
20066
  noun: "briefs",
19848
20067
  free: "Empty results are free.",
@@ -19915,7 +20134,7 @@ var TOOL_DEFINITIONS = {
19915
20134
  },
19916
20135
  reservationHeadroom: 0,
19917
20136
  badges: [{ name: "Crawl4AI", logo: "crawl4ai.png" }],
19918
- followUp: null
20137
+ accepts: { company: "url", website: "url" }
19919
20138
  })
19920
20139
  ),
19921
20140
  icp: defineTool(
@@ -19924,6 +20143,7 @@ var TOOL_DEFINITIONS = {
19924
20143
  description: "People at one company domain, optionally narrowed to job titles.",
19925
20144
  input: external_exports.object({ company: text(100), titles: external_exports.array(text(60)).max(5).optional(), limit }).strict(),
19926
20145
  row: external_exports.object({ name: s, title: s, company: s, domain: s, country: s.optional(), url: s }),
20146
+ display: RESULT_DISPLAY_SPECS["icp"],
19927
20147
  preview: ["name", "title", "company"],
19928
20148
  noun: "people",
19929
20149
  free: "Empty results are free.",
@@ -19990,6 +20210,15 @@ var TOOL_DEFINITIONS = {
19990
20210
  cap: 0,
19991
20211
  maxCalls: 1
19992
20212
  },
20213
+ "people-search": {
20214
+ endpoint: "crawl4ai.people.search",
20215
+ provider: "Crawl4AI",
20216
+ via: "Treg",
20217
+ role: "Second source: people by exact company domain",
20218
+ key: "people-search",
20219
+ cap: 500,
20220
+ maxCalls: 1
20221
+ },
19993
20222
  "company-domain": {
19994
20223
  endpoint: "blitzapi.companies.domain-to-linkedin",
19995
20224
  provider: "Blitz",
@@ -20030,9 +20259,12 @@ var TOOL_DEFINITIONS = {
20030
20259
  reservationHeadroom: 2500,
20031
20260
  badges: [
20032
20261
  { name: "QuickEnrich", logo: "quickenrich.png" },
20262
+ { name: "Crawl4AI", logo: "crawl4ai.png" },
20033
20263
  { name: "Blitz", logo: "blitz.png" }
20034
20264
  ],
20035
- followUp: { action: "find-emails", field: "url" }
20265
+ carries: { person: "url", company: "domain" },
20266
+ accepts: { company: "company" },
20267
+ actions: [{ entity: "person", target: "email-finder" }, { entity: "person", target: "linkedin-activity" }, { entity: "person", target: "linkedin-profile" }, { entity: "person", target: "phone-pilot" }]
20036
20268
  })
20037
20269
  ),
20038
20270
  signals: defineTool(
@@ -20048,6 +20280,7 @@ var TOOL_DEFINITIONS = {
20048
20280
  limit
20049
20281
  }).strict(),
20050
20282
  row: external_exports.object({ company: s, role: s, location: s, posted: s, domain: s, industry: s, employees: s, url: s }),
20283
+ display: RESULT_DISPLAY_SPECS["signals"],
20051
20284
  preview: ["company", "domain", "role", "posted"],
20052
20285
  noun: "signals",
20053
20286
  free: "Empty results are free.",
@@ -20141,15 +20374,17 @@ var TOOL_DEFINITIONS = {
20141
20374
  },
20142
20375
  reservationHeadroom: 0,
20143
20376
  badges: [{ name: "LinkedIn", logo: "linkedin.png" }],
20144
- followUp: null
20377
+ carries: { company: "domain" },
20378
+ actions: [{ entity: "company", target: "icp" }, { entity: "company", target: "company" }, { entity: "company", target: "website" }, { entity: "company", target: "lookalike-companies" }, { entity: "company", target: "tech-stack" }]
20145
20379
  })
20146
20380
  ),
20147
20381
  "verify-email": defineTool(
20148
- { name: "Email verification", credits: 2, unit: "definitive verification", limit: 1 },
20382
+ { name: "Email verification", credits: EMAIL_RECHECK_CREDITS, unit: "definitive verification", limit: 1 },
20149
20383
  () => toolDefinition({
20150
20384
  description: "Mailbox check for one email address.",
20151
20385
  input: external_exports.object({ email: text(254) }).strict(),
20152
20386
  row: external_exports.object({ email: s, verdict: s, score: n, checkedAt: s }),
20387
+ display: RESULT_DISPLAY_SPECS["verify-email"],
20153
20388
  preview: ["email", "verdict", "score"],
20154
20389
  noun: "verifications",
20155
20390
  free: "Unknown, webmail and disposable results are free.",
@@ -20206,7 +20441,8 @@ var TOOL_DEFINITIONS = {
20206
20441
  },
20207
20442
  reservationHeadroom: 0,
20208
20443
  badges: [],
20209
- followUp: null
20444
+ carries: { email: "email" },
20445
+ accepts: { email: "email" }
20210
20446
  })
20211
20447
  ),
20212
20448
  "phone-pilot": defineTool(
@@ -20215,6 +20451,7 @@ var TOOL_DEFINITIONS = {
20215
20451
  description: "Mobile number for one LinkedIn profile you have permission to enrich.",
20216
20452
  input: external_exports.object({ profile: text(300) }).strict(),
20217
20453
  row: external_exports.object({ phone: s, type: s, country: s, url: s }),
20454
+ display: RESULT_DISPLAY_SPECS["phone-pilot"],
20218
20455
  preview: ["phone", "type", "country"],
20219
20456
  noun: "phones",
20220
20457
  free: "No number found is free.",
@@ -20269,7 +20506,9 @@ var TOOL_DEFINITIONS = {
20269
20506
  },
20270
20507
  reservationHeadroom: 0,
20271
20508
  badges: [],
20272
- followUp: null
20509
+ carries: { person: "url" },
20510
+ accepts: { person: "profile" },
20511
+ actions: [{ entity: "person", target: "email-finder" }]
20273
20512
  })
20274
20513
  ),
20275
20514
  "people-search": defineTool(
@@ -20285,6 +20524,7 @@ var TOOL_DEFINITIONS = {
20285
20524
  limit
20286
20525
  }).strict(),
20287
20526
  row: external_exports.object({ name: s, title: s, company: s, domain: s, industry: s, employees: s, location: s, url: s }),
20527
+ display: RESULT_DISPLAY_SPECS["people-search"],
20288
20528
  preview: ["name", "title", "company", "location"],
20289
20529
  noun: "people",
20290
20530
  free: "Empty results are free.",
@@ -20351,7 +20591,8 @@ var TOOL_DEFINITIONS = {
20351
20591
  },
20352
20592
  reservationHeadroom: 1e3,
20353
20593
  badges: [{ name: "QuickEnrich", logo: "quickenrich.png" }],
20354
- followUp: { action: "find-emails", field: "url" }
20594
+ carries: { person: "url", company: "domain" },
20595
+ actions: [{ entity: "person", target: "email-finder" }, { entity: "person", target: "linkedin-activity" }, { entity: "person", target: "linkedin-profile" }, { entity: "person", target: "phone-pilot" }, { entity: "company", target: "icp" }, { entity: "company", target: "company" }]
20355
20596
  })
20356
20597
  ),
20357
20598
  "google-search": defineTool(
@@ -20360,6 +20601,7 @@ var TOOL_DEFINITIONS = {
20360
20601
  description: "Top Google organic results for a query (United States, English).",
20361
20602
  input: external_exports.object({ query: text(500), limit }).strict(),
20362
20603
  row: external_exports.object({ position: n, title: s, domain: s, snippet: s, url: s }),
20604
+ display: RESULT_DISPLAY_SPECS["google-search"],
20363
20605
  preview: ["position", "title", "domain"],
20364
20606
  noun: "results",
20365
20607
  free: "Empty results are free.",
@@ -20427,11 +20669,13 @@ var TOOL_DEFINITIONS = {
20427
20669
  cap: 3e3,
20428
20670
  maxCalls: 1,
20429
20671
  method: "POST"
20430
- }
20672
+ },
20673
+ depth: { endpoint: "dataforseo.google.serp.organic", provider: "DataForSEO", via: "Treg", role: "Up to 20 organic results or missing-page fallback", key: "serp-depth", cap: 2e4, maxCalls: 1, method: "POST" }
20431
20674
  },
20432
20675
  reservationHeadroom: 0,
20433
20676
  badges: [{ name: "Google", logo: "google.png" }],
20434
- followUp: null
20677
+ carries: { website: "url" },
20678
+ actions: [{ entity: "website", target: "page-content" }]
20435
20679
  })
20436
20680
  ),
20437
20681
  "linkedin-profile": defineTool(
@@ -20450,6 +20694,7 @@ var TOOL_DEFINITIONS = {
20450
20694
  companyPage: s,
20451
20695
  url: s
20452
20696
  }),
20697
+ display: RESULT_DISPLAY_SPECS["linkedin-profile"],
20453
20698
  preview: ["name", "role", "company", "location"],
20454
20699
  noun: "profiles",
20455
20700
  free: "Profiles not found are free.",
@@ -20517,7 +20762,9 @@ var TOOL_DEFINITIONS = {
20517
20762
  },
20518
20763
  reservationHeadroom: 0,
20519
20764
  badges: [],
20520
- followUp: null
20765
+ carries: { person: "url" },
20766
+ accepts: { person: "profile" },
20767
+ actions: [{ entity: "person", target: "email-finder" }, { entity: "person", target: "linkedin-activity" }, { entity: "person", target: "phone-pilot" }]
20521
20768
  })
20522
20769
  ),
20523
20770
  "linkedin-activity": defineTool(
@@ -20543,6 +20790,7 @@ var TOOL_DEFINITIONS = {
20543
20790
  postUrl: s,
20544
20791
  url: s
20545
20792
  }),
20793
+ display: RESULT_DISPLAY_SPECS["linkedin-activity"],
20546
20794
  preview: ["name", "lastPostAt", "posts90d", "topicPosts"],
20547
20795
  noun: "profiles",
20548
20796
  free: "Profiles with no public posts are free.",
@@ -20638,7 +20886,9 @@ var TOOL_DEFINITIONS = {
20638
20886
  },
20639
20887
  reservationHeadroom: 0,
20640
20888
  badges: [],
20641
- followUp: null
20889
+ carries: { person: "url", post: "postUrl" },
20890
+ accepts: { person: "profile" },
20891
+ actions: [{ entity: "person", target: "email-finder" }, { entity: "person", target: "linkedin-profile" }, { entity: "person", target: "phone-pilot" }, { entity: "post", target: "post-engagers" }]
20642
20892
  })
20643
20893
  ),
20644
20894
  "profile-finder": defineTool(
@@ -20651,6 +20901,7 @@ var TOOL_DEFINITIONS = {
20651
20901
  people: external_exports.array(external_exports.object({ name: text(100), company: text(100) }).strict()).min(1).max(MAX_BATCH_PEOPLE).optional().describe(`Up to ${MAX_BATCH_PEOPLE} {name, company} pairs, instead of name and company`)
20652
20902
  }).strict(),
20653
20903
  row: external_exports.object({ name: s, title: s, company: s, location: s, url: s }),
20904
+ display: RESULT_DISPLAY_SPECS["profile-finder"],
20654
20905
  preview: ["name", "title", "company", "url"],
20655
20906
  noun: "profiles",
20656
20907
  free: "People not found are free.",
@@ -20727,7 +20978,8 @@ var TOOL_DEFINITIONS = {
20727
20978
  },
20728
20979
  reservationHeadroom: 0,
20729
20980
  badges: [],
20730
- followUp: { action: "find-emails", field: "url" }
20981
+ carries: { person: "url" },
20982
+ actions: [{ entity: "person", target: "email-finder" }, { entity: "person", target: "linkedin-activity" }, { entity: "person", target: "linkedin-profile" }, { entity: "person", target: "phone-pilot" }]
20731
20983
  })
20732
20984
  ),
20733
20985
  "page-content": defineTool(
@@ -20736,6 +20988,7 @@ var TOOL_DEFINITIONS = {
20736
20988
  description: "Readable text of one public web page.",
20737
20989
  input: external_exports.object({ url: text(300) }).strict(),
20738
20990
  row: external_exports.object({ title: s, url: s, words: external_exports.number(), content: s }),
20991
+ display: RESULT_DISPLAY_SPECS["page-content"],
20739
20992
  preview: ["title", "url", "words"],
20740
20993
  noun: "pages",
20741
20994
  free: "Empty results are free.",
@@ -20795,7 +21048,8 @@ var TOOL_DEFINITIONS = {
20795
21048
  },
20796
21049
  reservationHeadroom: 5e3,
20797
21050
  badges: [],
20798
- followUp: null
21051
+ carries: { website: "url" },
21052
+ accepts: { website: "url" }
20799
21053
  })
20800
21054
  ),
20801
21055
  "instagram-profile": defineTool(
@@ -20816,6 +21070,7 @@ var TOOL_DEFINITIONS = {
20816
21070
  phone: s,
20817
21071
  url: s
20818
21072
  }),
21073
+ display: RESULT_DISPLAY_SPECS["instagram-profile"],
20819
21074
  preview: ["handle", "followers", "email", "website"],
20820
21075
  noun: "profiles",
20821
21076
  free: "Private and missing accounts are free.",
@@ -20899,16 +21154,18 @@ var TOOL_DEFINITIONS = {
20899
21154
  },
20900
21155
  reservationHeadroom: 0,
20901
21156
  badges: [{ name: "Instagram", logo: "instagram.png" }],
20902
- followUp: null
21157
+ carries: { email: "email", website: "website" },
21158
+ actions: [{ entity: "email", target: "verify-email" }, { entity: "website", target: "website" }]
20903
21159
  })
20904
21160
  ),
20905
21161
  "x-search": defineTool(
20906
21162
  { name: "X post search", credits: 1, unit: "search (up to 20 posts)", limit: 20 },
20907
21163
  ({ limit }) => toolDefinition({
20908
- description: "Recent public X (Twitter) posts matching a phrase, newest first, with author and engagement. Every bare word must appear; quote a phrase or use OR.",
21164
+ description: "X buyer needs with quoted evidence; plain topics expand, X syntax stays literal. intent=posts skips buyer qualification. Empty results are free.",
20909
21165
  input: external_exports.object({
20910
21166
  query: text(300).describe('Phrase or X search syntax, like "looking for a CRM"'),
20911
21167
  within: external_exports.enum(SEARCH_WINDOWS).optional(),
21168
+ intent: external_exports.enum(["buyers", "posts"]).optional().describe("buyers (default): qualified needs; posts: literal keyword search"),
20912
21169
  limit
20913
21170
  }).strict(),
20914
21171
  row: external_exports.object({
@@ -20922,9 +21179,13 @@ var TOOL_DEFINITIONS = {
20922
21179
  reposts: n,
20923
21180
  views: n,
20924
21181
  reply: external_exports.boolean(),
20925
- url: s
21182
+ url: s,
21183
+ signal: s.default(""),
21184
+ evidence: s.default(""),
21185
+ reason: s.default("")
20926
21186
  }),
20927
- preview: ["author", "text", "postedAt"],
21187
+ display: RESULT_DISPLAY_SPECS["x-search"],
21188
+ preview: ["author", "signal", "evidence", "url"],
20928
21189
  noun: "posts",
20929
21190
  free: "Empty results are free.",
20930
21191
  searchWords: "twitter tweets tweet social listening intent buyer buyers asking recommendation mentions",
@@ -20933,6 +21194,7 @@ var TOOL_DEFINITIONS = {
20933
21194
  tool: "x-search",
20934
21195
  query: input2.query,
20935
21196
  ...input2.within ? { within: input2.within } : {},
21197
+ ...input2.intent ? { intent: input2.intent } : {},
20936
21198
  ...input2.limit ? { limit: input2.limit } : {}
20937
21199
  }),
20938
21200
  web: {
@@ -20958,13 +21220,19 @@ var TOOL_DEFINITIONS = {
20958
21220
  reposts: { label: "Reposts", kind: "text" },
20959
21221
  views: { label: "Views", kind: "text" },
20960
21222
  reply: { label: "Reply", kind: "text" },
20961
- url: { label: "Post link", kind: "text" }
21223
+ url: { label: "Post link", kind: "text" },
21224
+ signal: { label: "Signal", kind: "text" },
21225
+ evidence: { label: "Evidence of need", kind: "text" },
21226
+ reason: { label: "Why this matched", kind: "text" }
20962
21227
  },
20963
21228
  output: [
20964
21229
  "author",
20965
21230
  "name",
20966
21231
  "followers",
20967
21232
  "text",
21233
+ "signal",
21234
+ "evidence",
21235
+ "reason",
20968
21236
  "postedAt",
20969
21237
  "likes",
20970
21238
  "replies",
@@ -20979,6 +21247,13 @@ var TOOL_DEFINITIONS = {
20979
21247
  normalize: "trim",
20980
21248
  validation: "text",
20981
21249
  fields: [
21250
+ {
21251
+ key: "intent",
21252
+ label: "Find",
21253
+ placeholder: "",
21254
+ maxLength: 0,
21255
+ options: [{ value: "buyers", label: "Buyer needs" }, { value: "posts", label: "All matching posts" }]
21256
+ },
20982
21257
  {
20983
21258
  key: "within",
20984
21259
  label: "Posted in",
@@ -21001,8 +21276,8 @@ var TOOL_DEFINITIONS = {
21001
21276
  progress: ""
21002
21277
  },
21003
21278
  presentation: {
21004
- description: "Find recent X posts where people ask for a tool, compare vendors or complain about one. Quote a phrase so every word matches together.",
21005
- label: "Phrase or X search",
21279
+ description: "Find people asking for help, comparing options or describing a problem. Each buyer match includes the words that show their need. Use All matching posts for literal X search.",
21280
+ label: "What buyers need, or X search",
21006
21281
  example: '"looking for a CRM"',
21007
21282
  action: "Search X",
21008
21283
  icon: "search",
@@ -21013,24 +21288,34 @@ var TOOL_DEFINITIONS = {
21013
21288
  endpoint: "anyapi.x.search.posts",
21014
21289
  provider: "AnyAPI",
21015
21290
  via: "Treg",
21016
- role: "Recent public X posts",
21291
+ role: "Search candidates, checked for relevance and buyer need",
21017
21292
  key: "search",
21018
21293
  cap: 5e3,
21019
- maxCalls: 1
21294
+ maxCalls: 3
21295
+ },
21296
+ alternative: {
21297
+ endpoint: "tikhub.x.twitter-web-fetch-search-timeline",
21298
+ provider: "TikHub",
21299
+ via: "Treg",
21300
+ role: "Independent X search candidates",
21301
+ key: "alternative",
21302
+ cap: 1e3,
21303
+ maxCalls: 3,
21304
+ method: "GET"
21020
21305
  }
21021
21306
  },
21022
21307
  reservationHeadroom: 0,
21023
- badges: [{ name: "X", logo: "twitter.png" }],
21024
- followUp: null
21308
+ badges: [{ name: "X", logo: "twitter.png" }]
21025
21309
  })
21026
21310
  ),
21027
21311
  "reddit-search": defineTool(
21028
21312
  { name: "Reddit post search", credits: 1, unit: "search (up to 20 posts)", limit: 20 },
21029
21313
  ({ limit }) => toolDefinition({
21030
- description: "Public Reddit posts most relevant to a query, from the past year unless a window is given, with subreddit, score and comments.",
21031
- input: external_exports.object({ query: text(300), within: external_exports.enum(SEARCH_WINDOWS).optional(), limit }).strict(),
21032
- row: external_exports.object({ subreddit: s, title: s, text: s, author: s, postedAt: s, score: n, comments: n, url: s }),
21033
- preview: ["subreddit", "title", "comments"],
21314
+ description: "Reddit buyer needs with quoted evidence; intent:posts for all matches. Full text and dates checked, up to 3 pages, past year by default.",
21315
+ input: external_exports.object({ query: text(300), intent: external_exports.enum(["buyers", "posts"]).optional(), within: external_exports.enum(SEARCH_WINDOWS).optional(), limit }).strict(),
21316
+ row: external_exports.object({ subreddit: s, title: s, text: s, author: s, postedAt: s, score: n, comments: n, url: s, signal: s, evidence: s, reason: s }),
21317
+ display: RESULT_DISPLAY_SPECS["reddit-search"],
21318
+ preview: ["subreddit", "evidence", "url"],
21034
21319
  noun: "posts",
21035
21320
  free: "Empty results are free.",
21036
21321
  searchWords: "subreddit subreddits threads social listening intent buyer buyers asking recommendation alternatives",
@@ -21038,6 +21323,7 @@ var TOOL_DEFINITIONS = {
21038
21323
  toolRequest: (input2) => ({
21039
21324
  tool: "reddit-search",
21040
21325
  query: input2.query,
21326
+ ...input2.intent ? { intent: input2.intent } : {},
21041
21327
  ...input2.within ? { within: input2.within } : {},
21042
21328
  ...input2.limit ? { limit: input2.limit } : {}
21043
21329
  }),
@@ -21066,15 +21352,25 @@ var TOOL_DEFINITIONS = {
21066
21352
  postedAt: { label: "Posted", kind: "text" },
21067
21353
  score: { label: "Score", kind: "text" },
21068
21354
  comments: { label: "Comments", kind: "text" },
21069
- url: { label: "Thread", kind: "text" }
21355
+ url: { label: "Thread", kind: "text" },
21356
+ signal: { label: "Signal", kind: "text" },
21357
+ evidence: { label: "Evidence of need", kind: "text" },
21358
+ reason: { label: "Why this matched", kind: "text" }
21070
21359
  },
21071
- output: ["subreddit", "title", "text", "author", "postedAt", "score", "comments", "url"],
21360
+ output: ["subreddit", "title", "text", "author", "signal", "evidence", "reason", "postedAt", "score", "comments", "url"],
21072
21361
  form: {
21073
21362
  inputMode: "text",
21074
21363
  mono: false,
21075
21364
  normalize: "trim",
21076
21365
  validation: "text",
21077
21366
  fields: [
21367
+ {
21368
+ key: "intent",
21369
+ label: "Find",
21370
+ placeholder: "",
21371
+ maxLength: 0,
21372
+ options: [{ value: "buyers", label: "Buyer needs" }, { value: "posts", label: "All matching posts" }]
21373
+ },
21078
21374
  {
21079
21375
  key: "within",
21080
21376
  label: "Posted in",
@@ -21097,7 +21393,7 @@ var TOOL_DEFINITIONS = {
21097
21393
  progress: ""
21098
21394
  },
21099
21395
  presentation: {
21100
- description: "Find Reddit threads where buyers ask for recommendations or alternatives, ranked by relevance.",
21396
+ description: "Find stated needs with quoted evidence, or choose All matching posts for topic research. Full posts and the selected date window are checked across up to three candidate pages.",
21101
21397
  label: "Search query",
21102
21398
  example: "best cold email tool",
21103
21399
  action: "Search Reddit",
@@ -21109,16 +21405,15 @@ var TOOL_DEFINITIONS = {
21109
21405
  endpoint: "scrapecreators.reddit.search.posts",
21110
21406
  provider: "Scrape Creators",
21111
21407
  via: "Treg",
21112
- role: "Public Reddit posts by relevance",
21408
+ role: "Full Reddit posts with bounded cursor pagination",
21113
21409
  key: "search",
21114
21410
  cap: 5e3,
21115
- maxCalls: 1,
21411
+ maxCalls: 3,
21116
21412
  method: "GET"
21117
21413
  }
21118
21414
  },
21119
21415
  reservationHeadroom: 0,
21120
- badges: [{ name: "Reddit", logo: "reddit.png" }],
21121
- followUp: null
21416
+ badges: [{ name: "Reddit", logo: "reddit.png" }]
21122
21417
  })
21123
21418
  ),
21124
21419
  "funding-signals": defineTool(
@@ -21142,6 +21437,7 @@ var TOOL_DEFINITIONS = {
21142
21437
  employees: s,
21143
21438
  source: s
21144
21439
  }),
21440
+ display: RESULT_DISPLAY_SPECS["funding-signals"],
21145
21441
  preview: ["company", "domain", "amount", "announced"],
21146
21442
  noun: "companies",
21147
21443
  free: "Empty results are free.",
@@ -21212,7 +21508,8 @@ var TOOL_DEFINITIONS = {
21212
21508
  },
21213
21509
  reservationHeadroom: 0,
21214
21510
  badges: [],
21215
- followUp: null
21511
+ carries: { company: "domain" },
21512
+ actions: [{ entity: "company", target: "icp" }, { entity: "company", target: "company" }, { entity: "company", target: "website" }, { entity: "company", target: "lookalike-companies" }, { entity: "company", target: "tech-stack" }]
21216
21513
  })
21217
21514
  ),
21218
21515
  "lookalike-companies": defineTool(
@@ -21221,6 +21518,7 @@ var TOOL_DEFINITIONS = {
21221
21518
  description: "Companies similar to one you name, from its domain, for finding more accounts like your best customers.",
21222
21519
  input: external_exports.object({ company: text(100).describe("Company domain, like vercel.com"), limit }).strict(),
21223
21520
  row: external_exports.object({ company: s, domain: s, industry: s }),
21521
+ display: RESULT_DISPLAY_SPECS["lookalike-companies"],
21224
21522
  preview: ["company", "domain", "industry"],
21225
21523
  noun: "companies",
21226
21524
  free: "Empty results are free.",
@@ -21274,7 +21572,94 @@ var TOOL_DEFINITIONS = {
21274
21572
  },
21275
21573
  reservationHeadroom: 0,
21276
21574
  badges: [],
21277
- followUp: null
21575
+ carries: { company: "domain" },
21576
+ accepts: { company: "company" },
21577
+ actions: [{ entity: "company", target: "icp" }, { entity: "company", target: "company" }, { entity: "company", target: "website" }, { entity: "company", target: "tech-stack" }]
21578
+ })
21579
+ ),
21580
+ "tech-stack": defineTool(
21581
+ { name: "Company tech stack", credits: 3, unit: "company tech stack", limit: 100 },
21582
+ ({ limit, maxResults }) => toolDefinition({
21583
+ description: "Technologies a company uses, from its domain: sales, marketing, data and engineering tools, grouped by category, each with when it was last detected.",
21584
+ input: external_exports.object({
21585
+ domain: text(100).describe("Company domain, like vercel.com"),
21586
+ technologies: external_exports.array(text(30)).min(1).max(8).optional().describe("Only these, like HubSpot"),
21587
+ limit
21588
+ }).strict(),
21589
+ row: external_exports.object({ technology: s, category: s, lastSeen: s, domain: s }),
21590
+ display: RESULT_DISPLAY_SPECS["tech-stack"],
21591
+ preview: ["technology", "category", "lastSeen"],
21592
+ noun: "technologies",
21593
+ free: "Empty results are free, including when none of the named technologies is detected.",
21594
+ example: { domain: "vercel.com" },
21595
+ // Commas would split a name, so each is kept whole by dropping them.
21596
+ toolRequest: (input2) => ({
21597
+ tool: "tech-stack",
21598
+ query: input2.domain,
21599
+ ...input2.technologies?.length ? { keywords: input2.technologies.map((t) => t.replace(/,/g, " ").trim()).join(", ") } : {},
21600
+ limit: input2.limit ?? maxResults
21601
+ }),
21602
+ searchWords: "technographics technologies technology stack tools software uses using crm martech built with",
21603
+ web: {
21604
+ route: "tech-stack",
21605
+ description: "Start with a domain. See the sales, marketing, data and engineering tools a company uses, and when each was last detected.",
21606
+ group: "profile-enrichment",
21607
+ section: "Enrichment",
21608
+ order: 7
21609
+ },
21610
+ columns: {
21611
+ technology: { label: "Technology", kind: "entity", sample: ["Salesforce", "HubSpot"], demo: "main" },
21612
+ category: { label: "Category", kind: "pill", sample: ["Sales", "Marketing"], demo: "sub" },
21613
+ lastSeen: { label: "Last detected", kind: "date", sample: ["2026-11-10", "2026-06-12"], demo: "end" },
21614
+ domain: { label: "Company domain", kind: "mono" }
21615
+ },
21616
+ output: ["technology", "category", "lastSeen", "domain"],
21617
+ form: {
21618
+ inputMode: "url",
21619
+ mono: true,
21620
+ normalize: "trim",
21621
+ validation: "domain",
21622
+ fields: [
21623
+ {
21624
+ key: "keywords",
21625
+ label: "Only these technologies (optional, comma separated)",
21626
+ placeholder: "Salesforce, HubSpot",
21627
+ maxLength: 300
21628
+ }
21629
+ ],
21630
+ grid: false,
21631
+ gate: "tools",
21632
+ example: "catalog",
21633
+ exampleLabel: "Try an example",
21634
+ exampleValues: {},
21635
+ exampleMono: true,
21636
+ progress: "",
21637
+ limitNoun: "technologies"
21638
+ },
21639
+ presentation: {
21640
+ description: "Start with a domain. See the sales, marketing, data and engineering tools a company uses, and when each was last detected.",
21641
+ label: "Company domain",
21642
+ example: "vercel.com",
21643
+ action: "Read tech stack",
21644
+ icon: "search",
21645
+ demo: "vercel.com"
21646
+ },
21647
+ suppliers: {
21648
+ technologies: {
21649
+ endpoint: "findymail.technologies",
21650
+ provider: "Findymail",
21651
+ via: "Treg",
21652
+ role: "Technologies detected for the domain, with last-detected dates; charged only when some are found",
21653
+ key: "technologies",
21654
+ cap: 2e4,
21655
+ maxCalls: 1
21656
+ }
21657
+ },
21658
+ reservationHeadroom: 0,
21659
+ badges: [{ name: "Findymail", logo: "findymail.png" }],
21660
+ carries: { company: "domain" },
21661
+ accepts: { company: "domain" },
21662
+ actions: [{ entity: "company", target: "icp" }, { entity: "company", target: "company" }, { entity: "company", target: "website" }]
21278
21663
  })
21279
21664
  ),
21280
21665
  "post-engagers": defineTool(
@@ -21284,6 +21669,7 @@ var TOOL_DEFINITIONS = {
21284
21669
  description: "Who commented on or reacted to one post URL; a competitor's post finds warm leads.",
21285
21670
  input: external_exports.object({ post: text(500).describe("LinkedIn post URL"), page: pageField, limit }).strict(),
21286
21671
  row: external_exports.object({ name: s, headline: s, engagement: s, comment: s, url: s }),
21672
+ display: RESULT_DISPLAY_SPECS["post-engagers"],
21287
21673
  preview: ["name", "headline", "engagement"],
21288
21674
  noun: "people",
21289
21675
  free: "Empty results are free.",
@@ -21340,19 +21726,172 @@ var TOOL_DEFINITIONS = {
21340
21726
  },
21341
21727
  reservationHeadroom: 0,
21342
21728
  badges: [],
21343
- followUp: null
21729
+ carries: { person: "url" },
21730
+ accepts: { post: "post" },
21731
+ actions: [{ entity: "person", target: "email-finder" }, { entity: "person", target: "linkedin-activity" }, { entity: "person", target: "linkedin-profile" }, { entity: "person", target: "phone-pilot" }]
21344
21732
  })
21345
21733
  )
21346
21734
  };
21347
21735
 
21736
+ // ../contracts/src/reddit-search-query.ts
21737
+ function parseRedditSearchQuery(query) {
21738
+ const source = query.replace(/[“”]/g, '"');
21739
+ const tokens = [];
21740
+ const pattern = /\s+|(?:([a-z_]+):)?"([^"]+)"|[()\-]|[^\s()"\-][^\s()"]*/gy;
21741
+ let at = 0;
21742
+ while (at < source.length) {
21743
+ pattern.lastIndex = at;
21744
+ const match = pattern.exec(source);
21745
+ if (!match) throw new Error("Close each Reddit quoted phrase.");
21746
+ at = pattern.lastIndex;
21747
+ if (match[0].trim()) tokens.push({ value: match[2] === void 0 ? match[0] : `${match[1] ? `${match[1]}:` : ""}${match[2]}`, quoted: match[2] !== void 0, ...match[1] ? { field: match[1] } : {} });
21748
+ }
21749
+ if (!tokens.length || tokens.length > 100) throw new Error("Use between 1 and 100 Reddit search terms.");
21750
+ let index = 0, positives = 0;
21751
+ const peek = (value) => tokens[index]?.value === value && !tokens[index]?.quoted;
21752
+ function atom(depth, negative = false) {
21753
+ if (depth > 12) throw new Error("Use fewer nested Reddit search groups.");
21754
+ if (peek("-") || peek("NOT")) {
21755
+ index++;
21756
+ return { kind: "not", child: atom(depth + 1, !negative) };
21757
+ }
21758
+ if (peek("(")) {
21759
+ index++;
21760
+ const child = or(depth + 1, negative);
21761
+ if (!peek(")")) throw new Error("Close each Reddit search group.");
21762
+ index++;
21763
+ return child;
21764
+ }
21765
+ const token2 = tokens[index++];
21766
+ if (!token2 || !token2.quoted && [")", "AND", "OR"].includes(token2.value)) throw new Error("Put a term on each side of Reddit AND or OR.");
21767
+ const colon = token2.value.indexOf(":");
21768
+ let field;
21769
+ let value = token2.value;
21770
+ if (colon !== -1 && (!token2.quoted || token2.field)) {
21771
+ const name = value.slice(0, colon), argument = value.slice(colon + 1);
21772
+ if (!["subreddit", "author", "title", "selftext"].includes(name) || !argument || argument.includes(":")) throw new Error("Reddit search supports words, phrases, AND, OR, NOT, exclusions, subreddit:, author:, title: and selftext:.");
21773
+ field = name;
21774
+ value = argument;
21775
+ if ((field === "subreddit" || field === "author") && !/^(?:[ru]\/)?[a-zA-Z0-9_-]{1,30}$/.test(value)) throw new Error("Use a Reddit community or username after subreddit: or author:.");
21776
+ }
21777
+ if (!negative) positives++;
21778
+ return { kind: "term", value, ...field ? { field } : {} };
21779
+ }
21780
+ function and(depth, negative) {
21781
+ const children = [atom(depth, negative)];
21782
+ while (index < tokens.length && !peek(")") && !peek("OR")) {
21783
+ if (peek("AND")) index++;
21784
+ children.push(atom(depth, negative));
21785
+ }
21786
+ return children.length === 1 ? children[0] : { kind: "and", children };
21787
+ }
21788
+ function or(depth, negative) {
21789
+ const children = [and(depth, negative)];
21790
+ while (peek("OR")) {
21791
+ index++;
21792
+ children.push(and(depth, negative));
21793
+ }
21794
+ return children.length === 1 ? children[0] : { kind: "or", children };
21795
+ }
21796
+ const expression = or(0, false);
21797
+ if (index !== tokens.length || !positives) throw new Error("Include a positive Reddit topic, phrase or community and check the parentheses.");
21798
+ return expression;
21799
+ }
21800
+
21801
+ // ../contracts/src/x-search-query.ts
21802
+ var OPERATORS = /* @__PURE__ */ new Set(["from", "to", "lang", "since", "until", "min_faves", "min_retweets", "min_replies", "filter"]);
21803
+ function validateTerm(value, quoted) {
21804
+ if (quoted || !value.includes(":")) return;
21805
+ const [operator, argument, ...rest] = value.split(":");
21806
+ if (!OPERATORS.has(operator) || !argument || rest.length) throw new Error(`Unsupported X operator: ${operator}. Use words, quoted phrases, OR, parentheses, exclusions, from:, to:, lang:, since:, until:, min_faves:, min_retweets:, min_replies: or filter:.`);
21807
+ if (operator === "filter" && !["replies", "retweets", "nativeretweets", "links", "media"].includes(argument)) throw new Error("Use filter:replies, filter:retweets, filter:links or filter:media.");
21808
+ if (operator === "since" || operator === "until") {
21809
+ const time3 = Date.parse(argument);
21810
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(argument) || !Number.isFinite(time3) || new Date(time3).toISOString().slice(0, 10) !== argument) throw new Error("Use a real calendar date in since:YYYY-MM-DD or until:YYYY-MM-DD.");
21811
+ }
21812
+ if (operator.startsWith("min_") && !/^\d{1,9}$/.test(argument)) throw new Error("Engagement filters need a nonnegative whole number.");
21813
+ if (["from", "to"].includes(operator) && !/^@?[a-zA-Z0-9_]{1,15}$/.test(argument)) throw new Error("Use an X username after from: or to:.");
21814
+ if (operator === "lang" && !/^[a-z]{2,3}$/i.test(argument)) throw new Error("Use a language code such as lang:en.");
21815
+ }
21816
+ function parseXSearchQuery(query) {
21817
+ const tokens = [];
21818
+ const source = query.replace(/[“”]/g, '"');
21819
+ const pattern = /\s+|"([^"]+)"|[()\-]|[^\s()"\-][^\s()"]*/gy;
21820
+ let at = 0;
21821
+ while (at < source.length) {
21822
+ pattern.lastIndex = at;
21823
+ const match = pattern.exec(source);
21824
+ if (!match) throw new Error("Close each quoted phrase and use complete search terms.");
21825
+ at = pattern.lastIndex;
21826
+ if (match[0].trim()) tokens.push({ value: match[1] ?? match[0], quoted: match[1] !== void 0 });
21827
+ }
21828
+ if (!tokens.length || tokens.length > 100) throw new Error("Use between 1 and 100 search terms.");
21829
+ let index = 0;
21830
+ let positives = 0;
21831
+ const peek = (value) => tokens[index]?.value === value && !tokens[index]?.quoted;
21832
+ function atom(depth, negative = false) {
21833
+ if (depth > 12) throw new Error("Use fewer nested search groups.");
21834
+ if (peek("-")) {
21835
+ index++;
21836
+ return { kind: "not", child: atom(depth + 1, !negative) };
21837
+ }
21838
+ if (peek("(")) {
21839
+ index++;
21840
+ const child = or(depth + 1);
21841
+ if (!peek(")")) throw new Error("Close each search group with a parenthesis.");
21842
+ index++;
21843
+ return child;
21844
+ }
21845
+ const token2 = tokens[index++];
21846
+ if (!token2 || !token2.quoted && [")", "OR", "AND"].includes(token2.value)) throw new Error("Put a search term on each side of OR or AND.");
21847
+ validateTerm(token2.value, token2.quoted);
21848
+ if (!negative && (token2.quoted || !token2.value.includes(":"))) positives++;
21849
+ return { kind: "term", ...token2 };
21850
+ }
21851
+ function and(depth) {
21852
+ const children = [atom(depth)];
21853
+ while (index < tokens.length && !peek(")") && !peek("OR")) {
21854
+ if (peek("AND")) index++;
21855
+ children.push(atom(depth));
21856
+ }
21857
+ return children.length === 1 ? children[0] : { kind: "and", children };
21858
+ }
21859
+ function or(depth) {
21860
+ const children = [and(depth)];
21861
+ while (peek("OR")) {
21862
+ index++;
21863
+ children.push(and(depth));
21864
+ }
21865
+ return children.length === 1 ? children[0] : { kind: "or", children };
21866
+ }
21867
+ const expression = or(0);
21868
+ if (index !== tokens.length) throw new Error("Check the search parentheses.");
21869
+ if (!positives && !tokens.some((t) => /^(from|to):/.test(t.value))) throw new Error("Include a topic, phrase or author to search for.");
21870
+ return expression;
21871
+ }
21872
+
21348
21873
  // ../contracts/src/tools.ts
21349
- var TOOL_CATALOG = Object.fromEntries(Object.entries(TOOL_DEFINITIONS).map(([id, { name, credits, unit, limit }]) => [id, { name, credits, unit, limit }]));
21874
+ var TOOL_CATALOG = Object.fromEntries(Object.entries(TOOL_DEFINITIONS).map(([id, { name, credits: credits2, unit, limit }]) => [id, { name, credits: credits2, unit, limit }]));
21350
21875
  var toolIdSchema = external_exports.enum(Object.keys(TOOL_CATALOG));
21351
- var toolRequestSchema = external_exports.object({
21876
+ var savedToolRequestSchema = external_exports.object({
21352
21877
  tool: toolIdSchema,
21353
21878
  ...toolRequestFields.shape
21354
- }).strict().superRefine((v, c) => {
21879
+ }).strict();
21880
+ var toolRequestSchema = savedToolRequestSchema.superRefine((v, c) => {
21355
21881
  const reject = (message) => c.addIssue({ code: "custom", path: ["query"], message });
21882
+ if (v.tool === "x-search") {
21883
+ try {
21884
+ parseXSearchQuery(v.query);
21885
+ } catch (error61) {
21886
+ reject(error61 instanceof Error ? error61.message : "Check your X search syntax.");
21887
+ }
21888
+ } else if (v.tool === "reddit-search") {
21889
+ try {
21890
+ parseRedditSearchQuery(v.query);
21891
+ } catch (error61) {
21892
+ reject(error61 instanceof Error ? error61.message : "Check your Reddit search syntax.");
21893
+ }
21894
+ } else if (v.intent) c.addIssue({ code: "custom", path: ["intent"], message: "Only X and Reddit search take a search intent." });
21356
21895
  if (v.careerBoard && !/^https:\/\/(boards\.greenhouse\.io|jobs\.lever\.co)\/[a-zA-Z0-9_-]+\/?$/.test(v.careerBoard)) reject("Use a public Greenhouse or Lever company board URL.");
21357
21896
  const form2 = TOOL_DEFINITIONS[v.tool].form;
21358
21897
  const validators = {
@@ -21385,7 +21924,19 @@ var toolResultSchema = external_exports.object({
21385
21924
  /** There are more results: the next page and, when the source says, how many match in all. */
21386
21925
  more: external_exports.object({ page: external_exports.number().int().positive(), total: external_exports.number().int().nonnegative().optional() }).optional(),
21387
21926
  /** Companies dropped before the rows, by why. */
21388
- left: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional()
21927
+ left: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional(),
21928
+ /** Social search quality, before the requested result limit. Also retained when no post qualifies. */
21929
+ search: external_exports.object({
21930
+ version: external_exports.literal(2),
21931
+ mode: external_exports.enum(["buyers", "posts"]),
21932
+ queries: external_exports.array(external_exports.string()).max(3),
21933
+ retrieved: external_exports.number().int().nonnegative(),
21934
+ unique: external_exports.number().int().nonnegative(),
21935
+ matched: external_exports.number().int().nonnegative(),
21936
+ qualified: external_exports.number().int().nonnegative(),
21937
+ returned: external_exports.number().int().nonnegative(),
21938
+ sources: external_exports.array(external_exports.object({ source: external_exports.string(), calls: external_exports.number().int().nonnegative(), retrieved: external_exports.number().int().nonnegative(), matched: external_exports.number().int().nonnegative(), qualified: external_exports.number().int().nonnegative(), failed: external_exports.number().int().nonnegative() })).max(2)
21939
+ }).optional()
21389
21940
  });
21390
21941
  var TOOL_RUN_STATUSES = ["queued", "running", "completed", "not_found", "error", "reconciliation_needed"];
21391
21942
  var TOOL_RUN_TRANSITIONS = {
@@ -21404,12 +21955,18 @@ var TOOL_CALL_TRANSITIONS = {
21404
21955
  expired: []
21405
21956
  };
21406
21957
  var toolCallLifecycle = defineLifecycle({ states: TOOL_CALL_STATUSES, transitions: TOOL_CALL_TRANSITIONS });
21958
+ var toolRunFailureSchema = external_exports.object({
21959
+ kind: external_exports.enum(["provider_refused", "provider_unavailable", "supplier_transport_failed", "supplier_empty_response", "supplier_response_too_large", "supplier_malformed_json", "billing_evidence_missing", "supplier_cost_exceeds_cap", "invalid_response", "supplier_budget_exceeded", "submission_ambiguous", "settlement_failed", "internal_error"]),
21960
+ stage: external_exports.enum(["discovery", "people-search", "company-domain", "qualify", "title-cascade", "title-function", "supplier", "execution", "settlement"]),
21961
+ retryable: external_exports.boolean()
21962
+ });
21407
21963
  var toolRunSchema = external_exports.object({
21408
21964
  id: external_exports.string(),
21409
21965
  tool: toolIdSchema,
21410
21966
  status: external_exports.enum(TOOL_RUN_STATUSES),
21411
- input: toolRequestSchema,
21967
+ input: savedToolRequestSchema,
21412
21968
  result: toolResultSchema.nullable(),
21969
+ failure: toolRunFailureSchema.nullable().optional(),
21413
21970
  creditsCharged: external_exports.number().int().nonnegative(),
21414
21971
  creditsReserved: external_exports.number().int().nonnegative(),
21415
21972
  createdAt: external_exports.number(),
@@ -21509,13 +22066,293 @@ var leaderboardSchema = external_exports.object({
21509
22066
  you: external_exports.object({ rank: external_exports.number().nullable(), credits: external_exports.number() }).nullable()
21510
22067
  });
21511
22068
 
21512
- // ../contracts/src/product-policy.ts
21513
- var CREDIT_ATOMIC = 1e4;
21514
- var EMAIL_LOOKUP_CREDITS = 1;
21515
- var EMAIL_LOOKUP_ATOMIC = EMAIL_LOOKUP_CREDITS * CREDIT_ATOMIC;
22069
+ // ../contracts/src/watches.ts
22070
+ var HIRING_WATCH_POLICY = {
22071
+ changeCredits: 5,
22072
+ maxMonthlyCredits: 1e5,
22073
+ maxCompanies: 200,
22074
+ maxAccountCompanies: 500,
22075
+ maxActiveWatches: 10,
22076
+ intervalMs: 7 * 24 * 60 * 60 * 1e3,
22077
+ maxFailedChecks: 3,
22078
+ supplierChecksPerMonth: 5,
22079
+ supplierCheckAtomic: TOOL_DEFINITIONS.signals.supplierReserve,
22080
+ maxPostsPerCompany: TOOL_DEFINITIONS.signals.limit
22081
+ };
22082
+ var FUNDING_ALERT_CREDITS = 5;
22083
+ var TOPIC_WATCH_SOURCES = ["reddit", "x"];
22084
+ var TOPIC_WATCH_POLICY = {
22085
+ /** Credits per new qualifying post. The only price: checks and baselines are free. */
22086
+ postCredits: 5,
22087
+ /** New posts reported (and charged) by one check; the rest is left out and says so in the feed. */
22088
+ maxPostsPerCheck: 10,
22089
+ /** Topic watches per account, inside the overall limit on watches. */
22090
+ maxTopicWatches: 5,
22091
+ intervalMs: 7 * 24 * 60 * 60 * 1e3,
22092
+ supplierChecksPerMonth: 5,
22093
+ /** The first (baseline) check looks back this long; later checks widen it to overlap the previous check. */
22094
+ within: "week",
22095
+ /** Posts asked of each search, the most the tool returns. */
22096
+ postsPerSearch: TOOL_DEFINITIONS["x-search"].limit
22097
+ };
22098
+ var companyDomain = external_exports.string().trim().toLowerCase().max(100).regex(
22099
+ /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,
22100
+ "Use a company domain such as acme.com"
22101
+ ).transform((domain2) => domain2.replace(/^www\./, ""));
22102
+ var hiringWatchQuote = external_exports.object({
22103
+ name: external_exports.string().trim().min(1).max(100),
22104
+ companies: external_exports.array(companyDomain).min(1).max(HIRING_WATCH_POLICY.maxCompanies).transform((domains) => [...new Set(domains)]),
22105
+ signal: external_exports.enum(["hiring", "headcount", "tech-stack", "funding"]).default("hiring"),
22106
+ role: external_exports.string().trim().max(200).default("")
22107
+ }).strict().superRefine((data, ctx) => {
22108
+ if (data.signal === "hiring" && data.role.length < 2)
22109
+ ctx.addIssue({ code: "custom", path: ["role"], message: "Hiring watches require a role" });
22110
+ });
22111
+ var hiringWatchCreate = hiringWatchQuote.safeExtend({
22112
+ max_credits: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER)
22113
+ });
22114
+ var topicWatchQuote = external_exports.object({
22115
+ name: external_exports.string().trim().min(1).max(100),
22116
+ signal: external_exports.literal("topic"),
22117
+ topic: external_exports.string().trim().min(3).max(300),
22118
+ sources: external_exports.array(external_exports.enum(TOPIC_WATCH_SOURCES)).min(1).max(8).transform((sources) => TOPIC_WATCH_SOURCES.filter((source) => sources.includes(source)))
22119
+ }).strict().superRefine((data, ctx) => {
22120
+ const parsers = { x: parseXSearchQuery, reddit: parseRedditSearchQuery };
22121
+ for (const source of data.sources) {
22122
+ try {
22123
+ parsers[source](data.topic);
22124
+ } catch (error61) {
22125
+ ctx.addIssue({ code: "custom", path: ["topic"], message: error61 instanceof Error ? error61.message : "Check the topic." });
22126
+ }
22127
+ }
22128
+ });
22129
+ var topicWatchCreate = topicWatchQuote.safeExtend({
22130
+ max_credits: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER)
22131
+ });
22132
+ var watchInput = external_exports.object({
22133
+ action: external_exports.enum(["create", "list", "show", "changes", "pause", "resume", "delete", "webhook_set", "webhook_show", "webhook_rotate", "webhook_remove", "webhook_test"]),
22134
+ url: external_exports.string().max(400).optional(),
22135
+ name: external_exports.string().max(100).optional(),
22136
+ companies: external_exports.array(external_exports.string().max(253)).max(HIRING_WATCH_POLICY.maxCompanies).optional(),
22137
+ signal: external_exports.enum(["hiring", "headcount", "tech-stack", "funding", "topic"]).optional(),
22138
+ role: external_exports.string().max(200).optional(),
22139
+ topic: external_exports.string().max(300).optional(),
22140
+ sources: external_exports.array(external_exports.enum(TOPIC_WATCH_SOURCES)).max(2).optional(),
22141
+ max_credits: external_exports.number().int().positive().max(HIRING_WATCH_POLICY.maxMonthlyCredits).optional(),
22142
+ quote_id: external_exports.string().max(64).optional(),
22143
+ watch_id: external_exports.string().max(64).optional(),
22144
+ since: external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
22145
+ offset: external_exports.number().int().nonnegative().max(10).optional(),
22146
+ dry_run: external_exports.boolean().optional(),
22147
+ idempotency_key: external_exports.string().max(128).optional()
22148
+ }).strict();
22149
+ function watchPolicy(signal2) {
22150
+ if (signal2 === "hiring") return HIRING_WATCH_POLICY;
22151
+ if (signal2 === "topic")
22152
+ return { ...HIRING_WATCH_POLICY, changeCredits: TOPIC_WATCH_POLICY.postCredits, intervalMs: TOPIC_WATCH_POLICY.intervalMs, supplierChecksPerMonth: TOPIC_WATCH_POLICY.supplierChecksPerMonth, supplierCheckAtomic: 0, maxPostsPerCompany: TOPIC_WATCH_POLICY.maxPostsPerCheck };
22153
+ if (signal2 === "funding")
22154
+ return { ...HIRING_WATCH_POLICY, changeCredits: FUNDING_ALERT_CREDITS, intervalMs: 24 * 60 * 60 * 1e3, supplierChecksPerMonth: 1, supplierCheckAtomic: 0, maxPostsPerCompany: 1 };
22155
+ const tool2 = signal2 === "headcount" ? "company" : "tech-stack";
22156
+ return {
22157
+ ...HIRING_WATCH_POLICY,
22158
+ changeCredits: 15,
22159
+ intervalMs: 31 * 24 * 60 * 60 * 1e3,
22160
+ supplierChecksPerMonth: 1,
22161
+ supplierCheckAtomic: TOOL_DEFINITIONS[tool2].supplierReserve,
22162
+ maxPostsPerCompany: signal2 === "headcount" ? 1 : 200
22163
+ };
22164
+ }
22165
+ var DAY_MS = 24 * 60 * 60 * 1e3;
21516
22166
 
21517
- // ../contracts/src/email-finder.ts
22167
+ // ../contracts/src/lead-plan.ts
22168
+ var LEAD_PLAN_VERSION_HEADER = "X-GTM-Answer-Version";
22169
+ var LEAD_PLAN_MAX_BYTES = 4096;
22170
+ var AGENT_RESPONSE_VERSION = 3;
21518
22171
  var text2 = (max) => external_exports.string().trim().min(1).max(max);
22172
+ var credits = external_exports.number().int().min(0).max(AGENT_MAX_CREDITS);
22173
+ var target = external_exports.number().int().min(1).max(LEAD_MAX_TARGET);
22174
+ var token = (max) => external_exports.string().regex(/^[A-Za-z0-9_-]+$/).min(1).max(max);
22175
+ var planId = token(64);
22176
+ var optionId = token(24);
22177
+ var timestamp = external_exports.number().int().nonnegative();
22178
+ var contactsPerCompany = external_exports.number().int().min(1).max(LEAD_MAX_CONTACTS_PER_COMPANY);
22179
+ var leadTargetUnitSchema = external_exports.enum(["people_with_email", "companies"]);
22180
+ var leadSourceFamilySchema = external_exports.enum(["directory", "company_signal", "company", "local", "engagers"]);
22181
+ var leadIcpSchema = external_exports.object({
22182
+ titles: external_exports.array(text2(60)).min(1).max(5).optional(),
22183
+ location: text2(100).optional(),
22184
+ industries: external_exports.array(text2(100)).min(1).max(10).optional().describe("Like SaaS"),
22185
+ company_sizes: external_exports.array(text2(20)).min(1).max(9).optional().describe("Like 20-99"),
22186
+ keywords: external_exports.array(text2(60)).min(1).max(10).optional().describe("In company description")
22187
+ }).strict();
22188
+ var signal = external_exports.discriminatedUnion("kind", [
22189
+ external_exports.object({ kind: external_exports.literal("hiring"), roles: external_exports.array(text2(100)).min(1).max(5) }).strict(),
22190
+ external_exports.object({ kind: external_exports.literal("funding") }).strict(),
22191
+ external_exports.object({ kind: external_exports.literal("lookalike"), domains: external_exports.array(text2(100)).min(1).max(5) }).strict(),
22192
+ external_exports.object({ kind: external_exports.literal("engagers"), post_urls: external_exports.array(external_exports.url().max(500)).min(1).max(5) }).strict()
22193
+ ]);
22194
+ var leadIntentSchema = external_exports.discriminatedUnion("kind", [
22195
+ external_exports.object({ kind: external_exports.literal("people"), icp: leadIcpSchema.optional(), signal: signal.optional() }).strict(),
22196
+ external_exports.object({ kind: external_exports.literal("company"), domains: external_exports.array(text2(100)).min(1).max(100), icp: leadIcpSchema.optional() }).strict(),
22197
+ external_exports.object({ kind: external_exports.literal("local"), business_type: text2(100), location: text2(100), icp: leadIcpSchema.optional() }).strict()
22198
+ ]);
22199
+ var leadPlanInput = external_exports.object({
22200
+ intent: leadIntentSchema,
22201
+ target: target.optional(),
22202
+ target_unit: leadTargetUnitSchema.default("people_with_email"),
22203
+ contacts_per_company: contactsPerCompany.optional(),
22204
+ quality: external_exports.literal("checked").default("checked"),
22205
+ extra_recheck: external_exports.boolean().default(false)
22206
+ }).strict().superRefine((request, ctx) => {
22207
+ if (request.target_unit === "companies" && (request.intent.kind === "people" || request.contacts_per_company === void 0)) {
22208
+ ctx.addIssue({ code: "custom", message: "Company targets require company or local intent and contacts_per_company." });
22209
+ }
22210
+ });
22211
+ var leadPlanChoiceSchema = external_exports.object({
22212
+ plan_id: planId,
22213
+ option_id: optionId,
22214
+ max_credits: credits,
22215
+ idempotency_key: external_exports.string().regex(/^[\x21-\x7e]{8,128}$/)
22216
+ }).strict();
22217
+ var confidence = external_exports.enum(["low", "medium", "high"]);
22218
+ var range = (bound) => external_exports.tuple([bound, bound]).refine(([min, max]) => min <= max, "Range must be ordered.");
22219
+ var leadPlanEtaSchema = external_exports.discriminatedUnion("basis", [
22220
+ external_exports.object({ basis: external_exports.literal("unavailable") }).strict(),
22221
+ external_exports.object({ basis: external_exports.literal("measured"), seconds: range(external_exports.number().int().nonnegative()), sample_size: external_exports.number().int().positive(), confidence }).strict(),
22222
+ external_exports.object({ basis: external_exports.literal("conservative_model"), seconds: range(external_exports.number().int().nonnegative()), assumptions: text2(160), confidence }).strict()
22223
+ ]);
22224
+ var leadQualityPricesSchema = external_exports.object({
22225
+ checked: external_exports.object({ email_credits: external_exports.literal(EMAIL_LOOKUP_CREDITS), mailbox_check_included: external_exports.literal(true), definitive_verdict_guaranteed: external_exports.literal(false) }).strict(),
22226
+ extra_recheck: external_exports.object({ optional: external_exports.literal(true), credits: external_exports.literal(EMAIL_RECHECK_CREDITS) }).strict(),
22227
+ unchecked: external_exports.object({ availability: external_exports.literal("not_offered_under_current_policy"), email_credits: external_exports.null() }).strict()
22228
+ }).strict();
22229
+ var leadEstimateSchema = external_exports.object({
22230
+ target: target.nullable(),
22231
+ credits: range(credits).nullable(),
22232
+ with_recheck: range(credits).nullable(),
22233
+ cap_remaining: external_exports.number().int().nonnegative(),
22234
+ affordable_target: external_exports.number().int().min(0).max(LEAD_MAX_TARGET),
22235
+ affordable_with_recheck: external_exports.number().int().min(0).max(LEAD_MAX_TARGET),
22236
+ email_credits: external_exports.literal(EMAIL_LOOKUP_CREDITS),
22237
+ recheck_credits: external_exports.literal(EMAIL_RECHECK_CREDITS)
22238
+ }).strict();
22239
+ var leadStopSchema = external_exports.enum(["sources_exhausted", "budget_reached", "agent_cap", "out_of_credits", "search_limit", "agent_stopped", "tool_unavailable"]);
22240
+ var leadProgressSchema = external_exports.object({
22241
+ found: external_exports.number().int().nonnegative(),
22242
+ target,
22243
+ spent: credits,
22244
+ budget_left: credits,
22245
+ state: external_exports.enum(["running", "done", "stopped"]),
22246
+ /** Present when the list stopped short of its target. */
22247
+ stop: leadStopSchema.optional()
22248
+ }).strict();
22249
+ var leadPlanOptionSchema = external_exports.object({
22250
+ id: optionId,
22251
+ target,
22252
+ quality: external_exports.literal("checked"),
22253
+ extra_recheck: external_exports.boolean(),
22254
+ estimated_credits: credits,
22255
+ max_credits: credits,
22256
+ estimated_results: range(external_exports.number().int().min(0).max(LEAD_MAX_TARGET)),
22257
+ eta: leadPlanEtaSchema,
22258
+ availability: external_exports.enum(["available", "cap_change_required", "insufficient_balance", "source_unavailable", "capacity_exceeded"]),
22259
+ reason: text2(160).optional()
22260
+ }).strict().superRefine((option, ctx) => {
22261
+ if (option.estimated_credits > option.max_credits) ctx.addIssue({ code: "custom", message: "Estimate exceeds spending ceiling." });
22262
+ if (option.availability !== "available" && !option.reason) ctx.addIssue({ code: "custom", message: "Blocked options require a reason." });
22263
+ });
22264
+ var planTimes = { plan_id: planId, created_at: timestamp, expires_at: timestamp };
22265
+ var laterExpiry = (value) => value.expires_at > value.created_at;
22266
+ var leadPlanIdentitySchema = external_exports.object({
22267
+ ...planTimes,
22268
+ account_id: token(64),
22269
+ catalog_version: token(64),
22270
+ price_version: token(64),
22271
+ workspace_version: token(64),
22272
+ exclusion_version: token(64)
22273
+ }).strict().refine(laterExpiry, "Plan expiry must follow creation.");
22274
+ var quoteObject = external_exports.object({
22275
+ kind: external_exports.literal("lead_plan"),
22276
+ version: external_exports.literal(1),
22277
+ status: external_exports.literal("quote"),
22278
+ ...planTimes,
22279
+ cost: external_exports.literal(0),
22280
+ requires_confirmation: external_exports.literal(true),
22281
+ target_unit: leadTargetUnitSchema,
22282
+ contacts_per_company: contactsPerCompany.optional(),
22283
+ recommended_option: optionId,
22284
+ options: external_exports.array(leadPlanOptionSchema).length(3),
22285
+ estimate_basis: external_exports.object({ method: external_exports.enum(["heuristic", "measured", "conservative_model"]), sample_size: external_exports.number().int().nonnegative(), confidence }).strict(),
22286
+ quality_prices: leadQualityPricesSchema,
22287
+ /** Mandatory host instruction: show this text and every option before requesting a choice. */
22288
+ relay: text2(240),
22289
+ next: external_exports.object({ tool: external_exports.literal("human"), args: external_exports.object({ message: external_exports.literal("Show all options and obtain a selection and credit limit before executing.") }).strict() }).strict(),
22290
+ /** Largest currently affordable quantity, not a replacement for a blocked option. */
22291
+ affordable_target: external_exports.number().int().min(0).max(LEAD_MAX_TARGET).optional(),
22292
+ top_up: external_exports.object({ url: external_exports.url().max(256), credits }).strict().optional()
22293
+ }).strict();
22294
+ var bytes = (value) => new TextEncoder().encode(value).length;
22295
+ function leadPlanText(quote2) {
22296
+ const lines = ["Choose how many contacts."];
22297
+ for (const [key, value] of Object.entries(quote2)) {
22298
+ if (key === "relay") continue;
22299
+ if (key === "options") {
22300
+ for (const option of quote2.options) lines.push(`option: ${JSON.stringify(option)}${option.eta.basis === "unavailable" ? " (time estimate unavailable)" : ""}`);
22301
+ } else lines.push(`${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`);
22302
+ }
22303
+ lines.push(`relay: ${quote2.relay}`);
22304
+ return lines.join("\n");
22305
+ }
22306
+ function legacyLeadPlanFields(quote2) {
22307
+ return {
22308
+ status: "quote",
22309
+ summary: `Choose how many contacts; live check included; extra recheck ${EMAIL_RECHECK_CREDITS} credits/email; unchecked unavailable. Update CLI for details and selection.`,
22310
+ run_id: null,
22311
+ cost: 0,
22312
+ balance: null,
22313
+ total: quote2.options.length,
22314
+ label: "options",
22315
+ columns: ["option", "target", "est/max_credits", "time_s", "extra_recheck", "availability"],
22316
+ rows: quote2.options.map((option) => [
22317
+ option.id,
22318
+ option.target,
22319
+ `${option.estimated_credits}/${option.max_credits}`,
22320
+ option.eta.basis === "unavailable" ? "unavailable" : option.eta.seconds.join("-"),
22321
+ option.extra_recheck,
22322
+ option.availability
22323
+ ]),
22324
+ report: quote2.relay,
22325
+ next: { tool: "human", args: {} }
22326
+ };
22327
+ }
22328
+ var leadPlanQuoteSchema = quoteObject.superRefine((quote2, ctx) => {
22329
+ if (!laterExpiry(quote2)) ctx.addIssue({ code: "custom", message: "Plan expiry must follow creation." });
22330
+ if (new Set(quote2.options.map((option) => option.id)).size !== 3 || new Set(quote2.options.map((option) => option.target)).size !== 3) {
22331
+ ctx.addIssue({ code: "custom", message: "Three distinct volume options are required." });
22332
+ }
22333
+ if (!quote2.options.some((option) => option.id === quote2.recommended_option)) ctx.addIssue({ code: "custom", message: "Recommendation must identify an option." });
22334
+ if (quote2.target_unit === "companies" && quote2.contacts_per_company === void 0) ctx.addIssue({ code: "custom", message: "Company targets require contacts_per_company." });
22335
+ if (quote2.estimate_basis.method === "measured" && quote2.estimate_basis.sample_size === 0) ctx.addIssue({ code: "custom", message: "Measured estimates require samples." });
22336
+ if (bytes(JSON.stringify(legacyLeadPlanFields(quote2))) > AGENT_ANSWER_MAX_BYTES) {
22337
+ ctx.addIssue({ code: "custom", message: "Mandatory choices and relay exceed the version 1 projection budget." });
22338
+ }
22339
+ if (bytes(JSON.stringify(quote2)) > LEAD_PLAN_MAX_BYTES || bytes(leadPlanText(quote2)) > LEAD_PLAN_MAX_BYTES) {
22340
+ ctx.addIssue({ code: "custom", message: "Planning payload exceeds its UTF-8 byte budget." });
22341
+ }
22342
+ });
22343
+ var leadPlanSnapshotSchema = leadPlanIdentitySchema.safeExtend({
22344
+ request: leadPlanInput,
22345
+ source_family: leadSourceFamilySchema,
22346
+ source_bounds: external_exports.object({ max_pages: external_exports.number().int().positive(), max_profiles: external_exports.number().int().positive(), max_seconds: external_exports.number().int().positive(), max_children: external_exports.number().int().positive() }).strict(),
22347
+ quote: leadPlanQuoteSchema
22348
+ }).superRefine((snapshot, ctx) => {
22349
+ if (snapshot.plan_id !== snapshot.quote.plan_id || snapshot.created_at !== snapshot.quote.created_at || snapshot.expires_at !== snapshot.quote.expires_at || snapshot.request.target_unit !== snapshot.quote.target_unit || snapshot.request.contacts_per_company !== snapshot.quote.contacts_per_company || snapshot.quote.options.some((option) => option.quality !== snapshot.request.quality || option.extra_recheck !== snapshot.request.extra_recheck)) {
22350
+ ctx.addIssue({ code: "custom", message: "Snapshot and quote must describe the same immutable plan." });
22351
+ }
22352
+ });
22353
+
22354
+ // ../contracts/src/email-finder.ts
22355
+ var text3 = (max) => external_exports.string().trim().min(1).max(max);
21519
22356
  var s2 = external_exports.string();
21520
22357
  var EMAIL_SUPPLIER_STEPS = [
21521
22358
  {
@@ -21562,7 +22399,8 @@ var EMAIL_VERIFICATION_STEP = {
21562
22399
  var EMAIL_FINDER_DEFINITION = {
21563
22400
  title: "Email finder",
21564
22401
  description: "Work email for each LinkedIn profile, checked before it is returned.",
21565
- input: external_exports.object({ people: external_exports.array(text2(300)).min(1).max(MAX_BATCH_PEOPLE) }).strict(),
22402
+ input: external_exports.object({ people: external_exports.array(text3(300)).min(1).max(MAX_BATCH_PEOPLE) }).strict(),
22403
+ accepts: { person: "people" },
21566
22404
  row: external_exports.object({
21567
22405
  name: s2.nullable(),
21568
22406
  title: s2.nullable(),
@@ -21593,12 +22431,12 @@ var EMAIL_FINDER_DEFINITION = {
21593
22431
  };
21594
22432
 
21595
22433
  // ../contracts/src/capabilities.ts
21596
- var text3 = (max) => external_exports.string().trim().min(1).max(max);
22434
+ var text4 = (max) => external_exports.string().trim().min(1).max(max);
21597
22435
  var companyFilters2 = {
21598
- industries: external_exports.array(text3(100)).min(1).max(10).optional().describe("Like SaaS"),
21599
- company_sizes: external_exports.array(text3(20)).min(1).max(9).optional().describe("Like 20-99")
22436
+ industries: external_exports.array(text4(100)).min(1).max(10).optional(),
22437
+ company_sizes: external_exports.array(text4(20)).min(1).max(9).optional()
21600
22438
  };
21601
- var keywordsField2 = external_exports.array(text3(60)).min(1).max(10).optional().describe("In company description");
22439
+ var keywordsField2 = external_exports.array(text4(60)).min(1).max(10).optional();
21602
22440
  var pageField2 = external_exports.number().int().min(1).max(100).optional();
21603
22441
  var CAPABILITIES = {
21604
22442
  "seo-aeo-audit": TOOL_DEFINITIONS["seo-aeo-audit"],
@@ -21613,6 +22451,7 @@ var CAPABILITIES = {
21613
22451
  "people-search": TOOL_DEFINITIONS["people-search"],
21614
22452
  "funding-signals": TOOL_DEFINITIONS["funding-signals"],
21615
22453
  "lookalike-companies": TOOL_DEFINITIONS["lookalike-companies"],
22454
+ "tech-stack": TOOL_DEFINITIONS["tech-stack"],
21616
22455
  "post-engagers": TOOL_DEFINITIONS["post-engagers"],
21617
22456
  "google-search": TOOL_DEFINITIONS["google-search"],
21618
22457
  "linkedin-profile": TOOL_DEFINITIONS["linkedin-profile"],
@@ -21627,63 +22466,60 @@ var CAPABILITY_IDS = Object.keys(CAPABILITIES);
21627
22466
  var capabilityIdSchema = external_exports.enum(CAPABILITY_IDS);
21628
22467
  var paidArgs = {
21629
22468
  // No descriptions: these three repeat on every paid tool, and every agent tool list has a 2k-token budget. The server instructions explain them.
21630
- max_credits: external_exports.number().int().min(0).max(1e5).optional(),
22469
+ max_credits: external_exports.number().int().min(0).max(AGENT_MAX_CREDITS).optional(),
21631
22470
  idempotency_key: external_exports.string().pipe(external_exports.string().regex(/^[\x21-\x7e]{8,128}$/)).optional(),
21632
22471
  dry_run: external_exports.boolean().optional()
21633
22472
  };
21634
22473
  var price = (id) => TOOL_CATALOG[id].credits;
21635
22474
  var findContactsInput = external_exports.object({
21636
- people: external_exports.array(text3(300)).min(1).max(MAX_BATCH_PEOPLE).optional().describe("LinkedIn profile URLs or handles"),
21637
- run_id: external_exports.string().max(64).optional().describe("Use the people from a gtm_build_list run"),
21638
- named: external_exports.array(external_exports.object({ name: external_exports.string().pipe(text3(100)), company: external_exports.string().pipe(text3(100)) }).strict()).min(1).max(MAX_BATCH_PEOPLE).optional().describe("{name, company} pairs, instead of people"),
22475
+ people: external_exports.array(text4(300)).min(1).max(MAX_BATCH_PEOPLE).optional(),
22476
+ run_id: external_exports.string().max(64).optional().describe("People from a list run"),
22477
+ named: external_exports.array(external_exports.object({ name: external_exports.string().pipe(text4(100)), company: external_exports.string().pipe(text4(100)) }).strict()).min(1).max(MAX_BATCH_PEOPLE).optional(),
21639
22478
  find: external_exports.array(external_exports.enum(["email", "phone"])).min(1).max(2).optional().describe('Default ["email"]'),
21640
- verify: external_exports.boolean().optional().describe("Mailbox-check found emails"),
22479
+ verify: external_exports.boolean().optional().describe("Extra recheck"),
22480
+ target: external_exports.number().int().min(1).max(MAX_BATCH_PEOPLE).optional().describe("Required for run_id"),
21641
22481
  ...paidArgs
21642
22482
  }).strict();
21643
22483
  var buildListInput = external_exports.object({
21644
- titles: external_exports.array(text3(60)).min(1).max(5).optional(),
21645
- company: text3(100).optional().describe("Company domain: decision-makers there"),
21646
- companies: external_exports.array(text3(100)).min(1).max(100).optional().describe("Many domains"),
21647
- location: text3(100).optional().describe("Country or city"),
22484
+ titles: external_exports.array(text4(60)).min(1).max(5).optional(),
22485
+ company: text4(100).optional().describe("Company domain: decision-makers there"),
22486
+ companies: external_exports.array(text4(100)).min(1).max(100).optional(),
22487
+ location: text4(100).optional(),
21648
22488
  ...companyFilters2,
21649
22489
  keywords: keywordsField2,
21650
- business_type: text3(100).optional().describe("Local businesses, with location"),
22490
+ business_type: text4(100).optional(),
21651
22491
  page: pageField2,
21652
22492
  limit: external_exports.number().int().min(1).max(100).optional(),
21653
22493
  ...paidArgs
21654
22494
  }).strict();
21655
- var researchCompanyInput = external_exports.object({ company: text3(100).describe("Company domain, like vercel.com"), ...paidArgs }).strict();
22495
+ var researchCompanyInput = external_exports.object({ company: text4(100), ...paidArgs }).strict();
21656
22496
  var findSignalsInput = external_exports.object({
21657
- role: text3(200).describe("Role being hired"),
21658
- location: text3(100).optional(),
21659
- company: text3(100).optional().describe("Watch one company"),
22497
+ role: text4(200),
22498
+ location: text4(100).optional(),
22499
+ company: text4(100).optional(),
21660
22500
  ...companyFilters2,
21661
22501
  page: pageField2,
21662
22502
  limit: external_exports.number().int().min(1).max(50).optional(),
21663
22503
  ...paidArgs
21664
22504
  }).strict();
21665
- var icpFields = {
21666
- titles: external_exports.array(text3(60)).min(1).max(5).optional(),
21667
- location: text3(100).optional(),
21668
- ...companyFilters2,
21669
- keywords: keywordsField2
21670
- };
22505
+ var icpFields = leadIcpSchema.shape;
21671
22506
  var findLeadsInput = external_exports.object({
21672
22507
  ...icpFields,
21673
- hiring_roles: external_exports.array(text3(100)).min(1).max(5).optional().describe("Signal; a tool's name finds its users"),
21674
- recently_funded: external_exports.boolean().optional().describe("Signal"),
21675
- like_companies: external_exports.array(text3(100)).min(1).max(5).optional().describe("Signal: domains"),
21676
- post_urls: external_exports.array(text3(500)).min(1).max(5).optional().describe("Signal: LinkedIn posts"),
21677
- target: external_exports.number().int().min(1).max(500).optional().describe("Default 25"),
21678
- max_per_company: external_exports.number().int().min(1).max(5).optional().describe("Default 2"),
22508
+ hiring_roles: external_exports.array(text4(100)).min(1).max(5).optional().describe("Signal; a tool's name finds its users"),
22509
+ recently_funded: external_exports.boolean().optional(),
22510
+ like_companies: external_exports.array(text4(100)).min(1).max(5).optional(),
22511
+ post_urls: external_exports.array(text4(500)).min(1).max(5).optional(),
22512
+ target: external_exports.number().int().min(1).max(LEAD_MAX_TARGET).optional().describe("Ask the user"),
22513
+ max_per_company: external_exports.number().int().min(1).max(LEAD_MAX_CONTACTS_PER_COMPANY).optional().describe("Default 2"),
22514
+ verify: external_exports.boolean().optional(),
21679
22515
  ...paidArgs
21680
22516
  }).strict();
21681
22517
  var workspaceIcpInput = external_exports.object({ ...icpFields, notes: external_exports.string().trim().max(2e3).optional() }).strict();
21682
22518
  var workspaceInput = external_exports.object({
21683
22519
  action: external_exports.enum(["get", "set_icp", "exclude", "forget_seen"]),
21684
- icp: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Fields of gtm_find_leads, plus notes"),
21685
- domains: external_exports.array(text3(100)).min(1).max(500).optional(),
21686
- profiles: external_exports.array(text3(300)).min(1).max(500).optional()
22520
+ icp: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
22521
+ domains: external_exports.array(text4(100)).min(1).max(500).optional(),
22522
+ profiles: external_exports.array(text4(300)).min(1).max(500).optional()
21687
22523
  }).strict();
21688
22524
  var resultsInput = external_exports.object({
21689
22525
  run_id: external_exports.string().min(1).max(64),
@@ -21698,68 +22534,69 @@ var toolsInput = external_exports.object({
21698
22534
  ...paidArgs
21699
22535
  }).strict();
21700
22536
  var accountInput = external_exports.object({
21701
- quote: external_exports.object({ capability: external_exports.string().pipe(capabilityIdSchema.describe("From catalog search").meta({ "x-gtm-catalog": true })).describe("A gtm_tools capability"), count: external_exports.number().int().min(1).max(1e5) }).strict().optional().describe("Price a planned batch")
22537
+ quote: external_exports.object({ capability: external_exports.string().pipe(capabilityIdSchema.meta({ "x-gtm-catalog": true })), count: external_exports.number().int().min(1).max(1e5) }).strict().optional()
21702
22538
  }).strict();
21703
22539
  var OUTCOME_TOOLS = {
22540
+ gtm_watch: { title: "Company watch", description: `Hiring/funding/topic ${HIRING_WATCH_POLICY.changeCredits}, headcount/tech-stack ${watchPolicy("tech-stack").changeCredits} cr/change. Quote first.`, paid: true, capabilities: ["signals"], input: watchInput },
21704
22541
  gtm_find_contacts: {
21705
22542
  title: "Find contacts",
21706
- description: `Work emails or mobiles for people, by LinkedIn profile, name and company, or a gtm_build_list run_id. ${CAPABILITIES["email-finder"].price.credits} credit per email found, ${price("phone-pilot")} per phone, ${price("verify-email")} per verified email; misses free.`,
22543
+ description: `Profiles/names/run_id: ${CAPABILITIES["email-finder"].price.credits} cr/email; mailbox check included, ${price("phone-pilot")} cr/phone, recheck ${price("verify-email")}. Misses free.`,
21707
22544
  paid: true,
21708
22545
  capabilities: ["email-finder", "phone-pilot", "verify-email"],
21709
22546
  input: findContactsInput
21710
22547
  },
21711
22548
  gtm_build_list: {
21712
22549
  title: "Build a lead list",
21713
- description: `People by titles, location, company industry and size (${price("people-search")} cr per 100); decision-makers at company domains (${price("icp")} cr each); local businesses (${price("local-leads")} cr). Empty lists free.`,
22550
+ description: `People ${price("people-search")} cr/100; decision-makers ${price("icp")} cr/domain; local businesses ${price("local-leads")} cr. Empty free.`,
21714
22551
  paid: true,
21715
22552
  capabilities: ["people-search", "icp", "local-leads"],
21716
22553
  input: buildListInput
21717
22554
  },
21718
22555
  gtm_find_leads: {
21719
22556
  title: "Find leads",
21720
- description: "Finds a target number of new leads with emails and why each fits, from your ICP and one optional signal. Normal tool prices, never past max_credits.",
22557
+ description: "Ask target; absent plans free; dry_run quotes. Run with max_credits.",
21721
22558
  paid: true,
21722
22559
  capabilities: ["people-search", "signals", "funding-signals", "lookalike-companies", "post-engagers", "icp", "email-finder"],
21723
22560
  input: findLeadsInput
21724
22561
  },
21725
22562
  gtm_research_company: {
21726
22563
  title: "Research a company",
21727
- description: `Company profile and website sales brief for one domain. Up to ${price("company") + price("website")} credits; misses free.`,
22564
+ description: `Domain profile, sales brief: up to ${price("company") + price("website")} cr; misses free.`,
21728
22565
  paid: true,
21729
22566
  capabilities: ["company", "website"],
21730
22567
  input: researchCompanyInput
21731
22568
  },
21732
22569
  gtm_find_signals: {
21733
22570
  title: "Find hiring signals",
21734
- description: `Companies hiring for a role in the past 30 days, with website and size. ${price("signals")} credit per nonempty search.`,
22571
+ description: `Companies hiring a role, last 30 days. ${price("signals")} cr/nonempty search.`,
21735
22572
  paid: true,
21736
22573
  capabilities: ["signals"],
21737
22574
  input: findSignalsInput
21738
22575
  },
21739
22576
  gtm_results: {
21740
22577
  title: "Get results",
21741
- description: "Free: run rows, job status or CSV link.",
22578
+ description: "Free rows, status, CSV.",
21742
22579
  paid: false,
21743
22580
  capabilities: [],
21744
22581
  input: resultsInput
21745
22582
  },
21746
22583
  gtm_tools: {
21747
22584
  title: "Other tools",
21748
- description: "Search, describe or run any catalog capability, like LinkedIn activity or SEO/AEO audits. Runs need max_credits.",
22585
+ description: "Search/describe capabilities free; run with max_credits.",
21749
22586
  paid: true,
21750
22587
  capabilities: CAPABILITY_IDS,
21751
22588
  input: toolsInput
21752
22589
  },
21753
22590
  gtm_workspace: {
21754
22591
  title: "Workspace memory",
21755
- description: "Free: saved ICP and exclusions gtm_find_leads uses; it also skips people already found.",
22592
+ description: "Free ICP, exclusions and seen-lead memory.",
21756
22593
  paid: false,
21757
22594
  capabilities: [],
21758
22595
  input: workspaceInput
21759
22596
  },
21760
22597
  gtm_account: {
21761
22598
  title: "Account",
21762
- description: "Free: balance, agent cap, recent spend or batch quote.",
22599
+ description: "Free balance, cap, spend, quote.",
21763
22600
  paid: false,
21764
22601
  capabilities: [],
21765
22602
  input: accountInput
@@ -21768,7 +22605,6 @@ var OUTCOME_TOOLS = {
21768
22605
  var OUTCOME_TOOL_NAMES = Object.keys(OUTCOME_TOOLS);
21769
22606
 
21770
22607
  // ../contracts/src/agent-answer.ts
21771
- var AGENT_ANSWER_MAX_BYTES = 1024;
21772
22608
  var AGENT_PREVIEW_ROWS = 5;
21773
22609
  var SUMMARY_MAX_WORDS = 24;
21774
22610
  var SUMMARY_MAX_CHARS = 200;
@@ -21803,7 +22639,10 @@ var agentAnswerSchema = external_exports.object({
21803
22639
  top_up: external_exports.object({ url: external_exports.string().max(256), credits: external_exports.number().int().positive() }).optional(),
21804
22640
  replayed: external_exports.literal(true).optional(),
21805
22641
  /** Lead searches: what was rejected and why the search stopped. */
21806
- report: external_exports.string().max(240).optional()
22642
+ report: external_exports.string().max(240).optional(),
22643
+ estimate: leadEstimateSchema.optional(),
22644
+ /** Lead lists: found so far, target, credits spent and left, and whether it is still running. */
22645
+ progress: leadProgressSchema.optional()
21807
22646
  }).strict();
21808
22647
  var byteLength = (value) => new TextEncoder().encode(value).length;
21809
22648
  var DEFAULT_NEXT = { tool: "gtm_account", args: {} };
@@ -21826,9 +22665,12 @@ function build(draft, rowCount, columnCount, cellMax) {
21826
22665
  const allColumns = (draft.columns ?? Object.keys(draft.rows?.[0] ?? {})).slice(0, 6);
21827
22666
  const columns = allColumns.slice(0, columnCount);
21828
22667
  const rows = (draft.rows ?? []).slice(0, rowCount).map((row) => columns.map((column) => cell(row[column], cellMax)));
22668
+ const end = (draft.pageOffset ?? 0) + rows.length;
22669
+ const total = draft.total ?? draft.rows?.length ?? 0;
22670
+ const paging = draft.pageOffset !== void 0 && (draft.pageOffset > 0 || rows.length < (draft.rows?.length ?? 0));
21829
22671
  return {
21830
22672
  status: draft.status,
21831
- summary: speakable(draft.summary),
22673
+ summary: paging && !draft.reason ? rows.length ? `Rows ${draft.pageOffset + 1} to ${end} of ${total}.` : `No rows after ${total}.` : speakable(draft.summary),
21832
22674
  ...draft.reason ? { reason: draft.reason.slice(0, 40) } : {},
21833
22675
  run_id: draft.run_id ?? null,
21834
22676
  cost: draft.cost ?? 0,
@@ -21839,16 +22681,19 @@ function build(draft, rowCount, columnCount, cellMax) {
21839
22681
  label: (draft.label ?? "rows").slice(0, 24),
21840
22682
  columns: rows.length ? columns : [],
21841
22683
  rows,
21842
- next: draft.next ?? DEFAULT_NEXT,
22684
+ next: paging ? end < total ? { tool: "gtm_results", args: { run_id: draft.run_id, offset: end } } : draft.pageEndNext ?? { tool: "gtm_results", args: { run_id: draft.run_id, format: "csv" } } : draft.next ?? DEFAULT_NEXT,
21843
22685
  ...draft.fields?.length ? { fields: draft.fields.slice(0, 12).map((field) => field.slice(0, 40)) } : {},
21844
22686
  ...draft.link ? { link: draft.link } : {},
21845
22687
  ...draft.top_up ? { top_up: draft.top_up } : {},
21846
22688
  ...draft.replayed ? { replayed: true } : {},
21847
- ...draft.report ? { report: draft.report.slice(0, 240) } : {}
22689
+ ...draft.report ? { report: draft.report.slice(0, 240) } : {},
22690
+ ...draft.estimate ? { estimate: draft.estimate } : {},
22691
+ ...draft.progress ? { progress: draft.progress } : {}
21848
22692
  };
21849
22693
  }
21850
22694
  var fits = (answer) => byteLength(JSON.stringify(answer)) <= AGENT_ANSWER_MAX_BYTES && byteLength(answerText(answer)) <= AGENT_ANSWER_MAX_BYTES;
21851
22695
  function shapeAnswer(draft) {
22696
+ if ("kind" in draft) return leadPlanQuoteSchema.parse(draft);
21852
22697
  const columnCount = Math.min(6, (draft.columns ?? Object.keys(draft.rows?.[0] ?? {})).length);
21853
22698
  const next = draft.next ?? DEFAULT_NEXT;
21854
22699
  for (let rowCount = AGENT_PREVIEW_ROWS; rowCount >= 1; rowCount -= 1) {
@@ -21881,6 +22726,8 @@ function answerLines(answer) {
21881
22726
  if (answer.quote !== void 0) lines.push(`quote: ${answer.quote}`);
21882
22727
  if (answer.replayed) lines.push("replayed: true");
21883
22728
  if (answer.report) lines.push(`report: ${answer.report}`);
22729
+ if (answer.estimate) lines.push(`estimate: ${JSON.stringify(answer.estimate)}`);
22730
+ if (answer.progress) lines.push(`progress: ${progressText(answer.progress)}`);
21884
22731
  if (answer.total || answer.rows.length) lines.push(`total: ${answer.total}`);
21885
22732
  if (answer.rows.length) {
21886
22733
  lines.push(`${answer.label}[${answer.rows.length}]{${answer.columns.join(",")}}:`);
@@ -21891,11 +22738,17 @@ function answerLines(answer) {
21891
22738
  if (answer.top_up) lines.push(`top_up: ${answer.top_up.credits} credits at ${answer.top_up.url}`);
21892
22739
  return lines;
21893
22740
  }
22741
+ function progressText(progress) {
22742
+ const state = progress.state === "stopped" && progress.stop ? `stopped: ${progress.stop}` : progress.state;
22743
+ return `${progress.found} of ${progress.target} found, ${progress.spent} credits spent, ${progress.budget_left} left, ${state}`;
22744
+ }
21894
22745
  function answerText(answer) {
22746
+ if ("kind" in answer) return leadPlanText(leadPlanQuoteSchema.parse(answer));
21895
22747
  const lines = answerLines(answer);
21896
22748
  if (answer.next) lines.push(`next: ${answer.next.tool}(${JSON.stringify(answer.next.args)})`);
21897
22749
  return lines.join("\n");
21898
22750
  }
22751
+ var agentResponseSchema = external_exports.union([agentAnswerSchema, leadPlanQuoteSchema]);
21899
22752
 
21900
22753
  // ../contracts/src/device-code.ts
21901
22754
  var USER_CODE_LENGTH = 8;
@@ -22238,7 +23091,7 @@ var lookupJobPendingSchema = external_exports.object({ status: external_exports.
22238
23091
  // ../contracts/src/contact-pricing.ts
22239
23092
  function contactCredits(options) {
22240
23093
  const find = options.find ?? ["email"];
22241
- return (find.includes("email") ? CAPABILITIES["email-finder"].price.credits : 0) + (options.verify ? CAPABILITIES["verify-email"].price.credits : 0) + (find.includes("phone") ? CAPABILITIES["phone-pilot"].price.credits : 0) + (options.named ? CAPABILITIES["profile-finder"].price.credits : 0);
23094
+ return (find.includes("email") ? EMAIL_LOOKUP_CREDITS : 0) + (options.verify ? TOOL_DEFINITIONS["verify-email"].price.credits : 0) + (find.includes("phone") ? TOOL_DEFINITIONS["phone-pilot"].price.credits : 0) + (options.named ? TOOL_DEFINITIONS["profile-finder"].price.credits : 0);
22242
23095
  }
22243
23096
 
22244
23097
  // ../contracts/src/topup-chains.ts
@@ -22417,6 +23270,7 @@ var UsageError = class extends Error {
22417
23270
  name = "UsageError";
22418
23271
  };
22419
23272
  var TOOL_COMMANDS = {
23273
+ gtm_watch: "watch",
22420
23274
  gtm_find_contacts: "contacts",
22421
23275
  gtm_build_list: "list",
22422
23276
  gtm_research_company: "research",
@@ -22438,13 +23292,14 @@ var GLOBAL = {
22438
23292
  var PAID = { "max-credits": { type: "string" }, "dry-run": { type: "boolean" }, "idempotency-key": { type: "string" } };
22439
23293
  var FILTERS = { industry: { type: "string", multiple: true }, size: { type: "string", multiple: true } };
22440
23294
  var SPECS = {
23295
+ watch: { signal: { type: "string" }, topic: { type: "string" }, source: { type: "string", multiple: true }, url: { type: "string" }, name: { type: "string" }, company: { type: "string", multiple: true }, hiring: { type: "string" }, file: { type: "string" }, column: { type: "string" }, watch: { type: "string" }, since: { type: "string" }, offset: { type: "string" }, "quote-id": { type: "string" }, yes: { type: "boolean" }, new: { type: "boolean" }, csv: { type: "boolean" }, ...PAID },
22441
23296
  login: { "no-browser": { type: "boolean" } },
22442
23297
  logout: {},
22443
23298
  whoami: {},
22444
23299
  "auth-header": {},
22445
- contacts: { file: { type: "string" }, column: { type: "string" }, out: { type: "string" }, "run-id": { type: "string" }, find: { type: "string", multiple: true }, verify: { type: "boolean" }, ...PAID },
23300
+ contacts: { file: { type: "string" }, column: { type: "string" }, out: { type: "string" }, "run-id": { type: "string" }, target: { type: "string" }, find: { type: "string", multiple: true }, verify: { type: "boolean" }, ...PAID },
22446
23301
  list: { titles: { type: "string", multiple: true }, company: { type: "string", multiple: true }, location: { type: "string" }, "business-type": { type: "string" }, ...FILTERS, keywords: { type: "string", multiple: true }, page: { type: "string" }, limit: { type: "string" }, ...PAID },
22447
- leads: { titles: { type: "string", multiple: true }, location: { type: "string" }, ...FILTERS, keywords: { type: "string", multiple: true }, "hiring-role": { type: "string", multiple: true }, funded: { type: "boolean" }, like: { type: "string", multiple: true }, post: { type: "string", multiple: true }, target: { type: "string" }, "max-per-company": { type: "string" }, ...PAID },
23302
+ leads: { titles: { type: "string", multiple: true }, location: { type: "string" }, ...FILTERS, keywords: { type: "string", multiple: true }, "hiring-role": { type: "string", multiple: true }, funded: { type: "boolean" }, like: { type: "string", multiple: true }, post: { type: "string", multiple: true }, target: { type: "string" }, "max-per-company": { type: "string" }, verify: { type: "boolean" }, ...PAID },
22448
23303
  workspace: { titles: { type: "string", multiple: true }, location: { type: "string" }, ...FILTERS, keywords: { type: "string", multiple: true }, notes: { type: "string" }, domain: { type: "string", multiple: true }, profile: { type: "string", multiple: true } },
22449
23304
  research: { ...PAID },
22450
23305
  signals: { location: { type: "string" }, company: { type: "string" }, ...FILTERS, page: { type: "string" }, limit: { type: "string" }, ...PAID },
@@ -22508,6 +23363,8 @@ var ARGUMENT_NAMES = {
22508
23363
  like: "like_companies",
22509
23364
  post: "post_urls",
22510
23365
  domain: "domains",
23366
+ hiring: "role",
23367
+ watch: "watch_id",
22511
23368
  profile: "profiles"
22512
23369
  };
22513
23370
  function argumentFlag(key) {
@@ -22521,6 +23378,25 @@ function build2(name, values, positionals) {
22521
23378
  if (positionals.length) throw new UsageError(message, name);
22522
23379
  };
22523
23380
  switch (name) {
23381
+ case "watch": {
23382
+ const [action, id, ...extra] = positionals;
23383
+ if (!action || !["create", "list", "show", "changes", "pause", "resume", "delete", "webhook_set", "webhook_show", "webhook_rotate", "webhook_remove", "webhook_test"].includes(action) || extra.length) throw new UsageError("Use gtm watch create|list|show|changes|pause|resume|delete.", name);
23384
+ const mutating = ["show", "pause", "resume", "delete"].includes(action) || action.startsWith("webhook_");
23385
+ if (mutating && !id || !mutating && id) throw new UsageError("Show, pause, resume and delete take one watch id; other actions take flags.", name);
23386
+ const file2 = str(values, "file"), column = str(values, "column");
23387
+ if (file2 && values.company) throw new UsageError("Give --company or --file, not both.", name);
23388
+ if (column && !file2) throw new UsageError("--column needs --file.", name);
23389
+ if (action !== "create" && ["signal", "name", "company", "hiring", "topic", "source", "file", "column", "yes", "max-credits", "dry-run", "quote-id"].some((flag) => values[flag] !== void 0)) throw new UsageError("Creation flags need gtm watch create.", name);
23390
+ const topic = str(values, "topic"), sources = values.source;
23391
+ if (topic === void 0 && sources) throw new UsageError("--source needs --topic.", name);
23392
+ if (topic !== void 0 && (values.company || file2 || values.hiring !== void 0 || (str(values, "signal") ?? "topic") !== "topic")) throw new UsageError("A topic watch takes --topic and --source only, not companies, a role or another signal.", name);
23393
+ const chosen = sources ? sources.flatMap((source) => source === "both" ? ["x", "reddit"] : [source]) : ["x", "reddit"];
23394
+ if (chosen.some((source) => source !== "x" && source !== "reddit")) throw new UsageError("Use --source x, --source reddit or --source both.", name);
23395
+ if (action !== "changes" && ["new", "csv", "since", "watch"].some((flag) => values[flag] !== void 0)) throw new UsageError("Feed flags need gtm watch changes.", name);
23396
+ if (values.new && values.since !== void 0) throw new UsageError("Use --new or --since, not both.", name);
23397
+ const since = int2(values, "since", name), offset = int2(values, "offset", name);
23398
+ return { kind: "watch", args: { action, ...topic !== void 0 ? { signal: "topic", topic, sources: [...new Set(chosen)] } : {}, ...str(values, "signal") && topic === void 0 ? { signal: str(values, "signal") } : {}, ...str(values, "url") ? { url: str(values, "url") } : {}, ...id ? { watch_id: id } : {}, ...str(values, "watch") ? { watch_id: str(values, "watch") } : {}, ...str(values, "name") ? { name: str(values, "name") } : {}, ...values.company ? { companies: values.company } : {}, ...str(values, "hiring") ? { role: str(values, "hiring") } : {}, ...str(values, "quote-id") ? { quote_id: str(values, "quote-id") } : {}, ...since !== void 0 ? { since } : {}, ...offset !== void 0 ? { offset } : {}, ...paid(values, name) }, yes: values.yes === true, fresh: values.new === true, csv: values.csv === true, ...file2 ? { file: file2 } : {}, ...column ? { column } : {} };
23399
+ }
22524
23400
  case "login":
22525
23401
  none("gtm login takes no arguments.");
22526
23402
  return { kind: "login", browser: values["no-browser"] !== true };
@@ -22536,6 +23412,8 @@ function build2(name, values, positionals) {
22536
23412
  case "contacts": {
22537
23413
  const file2 = str(values, "file");
22538
23414
  const runId = str(values, "run-id");
23415
+ const target2 = int2(values, "target", name);
23416
+ if (target2 !== void 0 && runId === void 0) throw new UsageError("--target selects profiles from --run-id; a profile list or file supplies its own count.", name);
22539
23417
  if (file2 !== void 0 && positionals.length) throw new UsageError("Give profiles or --file, not both.", name);
22540
23418
  if (runId !== void 0 && (file2 !== void 0 || positionals.length)) throw new UsageError("Give --run-id on its own, without profiles or --file.", name);
22541
23419
  if (values.column !== void 0 && file2 === void 0) throw new UsageError("--column needs --file.", name);
@@ -22543,6 +23421,7 @@ function build2(name, values, positionals) {
22543
23421
  const args = {
22544
23422
  ...positionals.length ? { people: positionals } : {},
22545
23423
  ...runId !== void 0 ? { run_id: runId } : {},
23424
+ ...target2 !== void 0 ? { target: target2 } : {},
22546
23425
  ...find?.length ? { find } : {},
22547
23426
  ...values.verify ? { verify: true } : {},
22548
23427
  ...paid(values, name)
@@ -22559,10 +23438,10 @@ function build2(name, values, positionals) {
22559
23438
  return { kind: "tool", tool: "gtm_build_list", args: { ...pick2(values, ["titles", "location", "business-type", "industry", "size", "keywords"]), ...companies.length === 1 ? { company: companies[0] } : companies.length ? { companies } : {}, ...page !== void 0 ? { page } : {}, ...limit !== void 0 ? { limit } : {}, ...paid(values, name) } };
22560
23439
  }
22561
23440
  case "leads": {
22562
- none("gtm leads takes flags only, like --titles 'Head of Sales' --target 25.");
22563
- const target = int2(values, "target", name);
23441
+ none("gtm leads takes flags only, like --titles 'Head of Sales' --target N.");
23442
+ const target2 = int2(values, "target", name);
22564
23443
  const perCompany = int2(values, "max-per-company", name);
22565
- return { kind: "tool", tool: "gtm_find_leads", args: { ...pick2(values, ["titles", "location", "industry", "size", "keywords", "hiring-role", "like", "post"]), ...values.funded ? { recently_funded: true } : {}, ...target !== void 0 ? { target } : {}, ...perCompany !== void 0 ? { max_per_company: perCompany } : {}, ...paid(values, name) } };
23444
+ return { kind: "tool", tool: "gtm_find_leads", args: { ...pick2(values, ["titles", "location", "industry", "size", "keywords", "hiring-role", "like", "post"]), ...values.funded ? { recently_funded: true } : {}, ...target2 !== void 0 ? { target: target2 } : {}, ...perCompany !== void 0 ? { max_per_company: perCompany } : {}, ...values.verify ? { verify: true } : {}, ...paid(values, name) } };
22566
23445
  }
22567
23446
  case "workspace": {
22568
23447
  const action = positionals[0] ?? "get";
@@ -22659,12 +23538,26 @@ function commandArgv(next) {
22659
23538
  if (value !== void 0) words.push(...(Array.isArray(value) ? value : [value]).map(String));
22660
23539
  };
22661
23540
  switch (tool2) {
23541
+ case "gtm_watch": {
23542
+ const action = take("action");
23543
+ push(action);
23544
+ if (["pause", "resume", "delete"].includes(String(action)) || String(action).startsWith("webhook_")) push(take("watch_id"));
23545
+ const companies = take("companies");
23546
+ if (Array.isArray(companies)) for (const company of companies) words.push("--company", String(company));
23547
+ break;
23548
+ }
22662
23549
  case "gtm_find_contacts":
22663
23550
  push(take("people"));
22664
23551
  break;
22665
23552
  case "gtm_research_company":
22666
23553
  push(take("company"));
22667
23554
  break;
23555
+ // `gtm list` takes many companies as repeated --company flags.
23556
+ case "gtm_build_list": {
23557
+ const companies = take("companies");
23558
+ if (Array.isArray(companies)) for (const company of companies) words.push("--company", String(company));
23559
+ break;
23560
+ }
22668
23561
  case "gtm_find_signals":
22669
23562
  push(take("role"));
22670
23563
  break;
@@ -22706,13 +23599,13 @@ function commandFor(next) {
22706
23599
  var FileInputError = class extends Error {
22707
23600
  name = "FileInputError";
22708
23601
  };
22709
- function parseCsv(text4) {
23602
+ function parseCsv(text5) {
22710
23603
  const rows = [];
22711
23604
  let row = [];
22712
23605
  let cell2 = "";
22713
23606
  let quoted = false;
22714
23607
  let started = false;
22715
- const source = text4.charCodeAt(0) === 65279 ? text4.slice(1) : text4;
23608
+ const source = text5.charCodeAt(0) === 65279 ? text5.slice(1) : text5;
22716
23609
  const endRow = () => {
22717
23610
  row.push(cell2);
22718
23611
  rows.push(row);
@@ -22757,8 +23650,8 @@ var HEADER_WORDS = /^(linkedin|linkedin[ _-]?(url|profile|profile[ _-]?url|handl
22757
23650
  function profileOf(value) {
22758
23651
  return cliProfileUrl(value);
22759
23652
  }
22760
- function profilesFromCsv(text4, column) {
22761
- const table = parseCsv(text4).filter((row) => row.some((cell2) => cell2.trim() !== ""));
23653
+ function profilesFromCsv(text5, column) {
23654
+ const table = parseCsv(text5).filter((row) => row.some((cell2) => cell2.trim() !== ""));
22762
23655
  if (!table.length) throw new FileInputError("The file has no rows.");
22763
23656
  const first = table[0];
22764
23657
  const width = Math.max(...table.map((row) => row.length));
@@ -22797,13 +23690,13 @@ function profilesFromCsv(text4, column) {
22797
23690
  }
22798
23691
  return list;
22799
23692
  }
22800
- function peopleFromCsv(text4, column, names) {
22801
- if (names === "only") return { ...nameListAsProfiles(namesFromCsv(text4)), named: true };
23693
+ function peopleFromCsv(text5, column, names) {
23694
+ if (names === "only") return { ...nameListAsProfiles(namesFromCsv(text5)), named: true };
22802
23695
  try {
22803
- return { ...profilesFromCsv(text4, column), named: false };
23696
+ return { ...profilesFromCsv(text5, column), named: false };
22804
23697
  } catch (error61) {
22805
23698
  if (names === "never" || column !== void 0 || !(error61 instanceof FileInputError)) throw error61;
22806
- return { ...nameListAsProfiles(namesFromCsv(text4)), named: true };
23699
+ return { ...nameListAsProfiles(namesFromCsv(text5)), named: true };
22807
23700
  }
22808
23701
  }
22809
23702
  function nameListAsProfiles(list) {
@@ -22818,8 +23711,8 @@ function namePair(person) {
22818
23711
  if (typeof person === "string") throw new TypeError("Expected a name and company pair");
22819
23712
  return person;
22820
23713
  }
22821
- function namesFromCsv(text4) {
22822
- const table = parseCsv(text4).filter((row) => row.some((cell2) => cell2.trim() !== ""));
23714
+ function namesFromCsv(text5) {
23715
+ const table = parseCsv(text5).filter((row) => row.some((cell2) => cell2.trim() !== ""));
22823
23716
  if (!table.length) throw new FileInputError("The file has no rows.");
22824
23717
  const header = table[0].map((cell2) => cell2.trim());
22825
23718
  const find = (pattern) => header.findIndex((cell2) => pattern.test(cell2));
@@ -22850,6 +23743,103 @@ function namesFromCsv(text4) {
22850
23743
  return list;
22851
23744
  }
22852
23745
 
23746
+ // src/watch.ts
23747
+ async function watchCommand(session, command) {
23748
+ const args = { ...command.args };
23749
+ if (args.action === "create") {
23750
+ if (command.file) {
23751
+ const [headers = [], ...rows] = parseCsv(
23752
+ await session.readInput(command.file, "watch")
23753
+ );
23754
+ const column = command.column ?? headers.find(
23755
+ (h) => ["domain", "company_domain", "website"].includes(h.toLowerCase())
23756
+ );
23757
+ const at = column ? headers.indexOf(column) : -1;
23758
+ if (at < 0)
23759
+ throw new UsageError(
23760
+ "Company CSV needs a domain column, or --column NAME.",
23761
+ "watch"
23762
+ );
23763
+ args.companies = rows.map((row) => row[at]?.trim()).filter(Boolean);
23764
+ }
23765
+ const validated = args.signal === "topic" ? topicWatchQuote.safeParse({ name: args.name, signal: "topic", topic: args.topic, sources: args.sources }) : hiringWatchQuote.safeParse({
23766
+ name: args.name,
23767
+ companies: args.companies,
23768
+ ...args.role ? { role: args.role } : {},
23769
+ ...args.signal ? { signal: args.signal } : {}
23770
+ });
23771
+ if (!validated.success)
23772
+ throw new UsageError(
23773
+ args.signal === "topic" ? "Give --name and --topic as a phrase or search syntax that X and Reddit accept, with --source x, reddit or both." : "Give --name, up to 200 company domains through --company or --file, and --hiring ROLE or --signal headcount, tech-stack or funding.",
23774
+ "watch"
23775
+ );
23776
+ Object.assign(args, validated.data);
23777
+ const quote2 = await session.gateway.call("gtm_watch", {
23778
+ ...args,
23779
+ dry_run: true
23780
+ });
23781
+ if (quote2.status !== "quote" || args.dry_run || args.max_credits === void 0)
23782
+ return session.emit(quote2);
23783
+ session.emit(quote2, {}, { stream: "stderr" });
23784
+ if (!command.yes && !await session.io.confirm?.(
23785
+ `Create this watch with a monthly limit of ${args.max_credits} credits?`
23786
+ )) {
23787
+ return session.emit(
23788
+ shapeAnswer({
23789
+ status: "refused",
23790
+ reason: "confirmation_required",
23791
+ summary: "No watch saved; repeat with --yes to agree to this monthly limit.",
23792
+ balance: quote2.balance,
23793
+ next: { tool: "gtm_watch", args: { action: "list" } }
23794
+ })
23795
+ );
23796
+ }
23797
+ return session.emit(
23798
+ await session.gateway.call("gtm_watch", {
23799
+ ...args,
23800
+ dry_run: false,
23801
+ quote_id: quote2.run_id
23802
+ })
23803
+ );
23804
+ }
23805
+ const key = createHash("sha256").update(
23806
+ JSON.stringify([session.apiUrl, session.token, args.watch_id ?? "all"])
23807
+ ).digest("hex");
23808
+ if (args.action === "changes" && command.fresh)
23809
+ args.since = await session.store.loadWatchCursor(key);
23810
+ if (args.action === "changes" && command.csv) {
23811
+ let cursor = Number(args.since ?? 0), header;
23812
+ const output2 = [];
23813
+ for (; ; ) {
23814
+ const page = await session.gateway.watchCsv(
23815
+ cursor,
23816
+ typeof args.watch_id === "string" ? args.watch_id : void 0
23817
+ );
23818
+ const [columns = [], ...rows] = parseCsv(page.csv);
23819
+ header ??= columns;
23820
+ output2.push(...rows);
23821
+ if (page.more && page.cursor <= cursor)
23822
+ throw new UsageError(
23823
+ "Watch export did not advance its cursor.",
23824
+ "watch"
23825
+ );
23826
+ cursor = page.cursor;
23827
+ if (!page.more) break;
23828
+ }
23829
+ session.io.stdout(toCsv([header ?? [], ...output2]));
23830
+ if (command.fresh) await session.store.saveWatchCursor(key, cursor);
23831
+ return 0;
23832
+ }
23833
+ const answer = await session.gateway.call("gtm_watch", args);
23834
+ const result = session.emit(answer);
23835
+ if (args.action === "changes" && command.fresh && ["completed", "not_found"].includes(answer.status)) {
23836
+ const cursor = answer.next.args.since;
23837
+ if (typeof cursor === "number")
23838
+ await session.store.saveWatchCursor(key, cursor);
23839
+ }
23840
+ return result;
23841
+ }
23842
+
22853
23843
  // src/file-rows.ts
22854
23844
  var FILE_ROW_FALLBACK = {
22855
23845
  columns: ["name", "title", "email", "verdict", "url", "status"],
@@ -22859,7 +23849,7 @@ var FILE_ROW_FALLBACK = {
22859
23849
  };
22860
23850
 
22861
23851
  // src/file-batches.ts
22862
- import { createHash } from "node:crypto";
23852
+ import { createHash as createHash2 } from "node:crypto";
22863
23853
  async function quote(session, profiles, perCall, tool2) {
22864
23854
  let total = 0;
22865
23855
  let balance = null;
@@ -22872,16 +23862,16 @@ async function quote(session, profiles, perCall, tool2) {
22872
23862
  return { quote: total, balance };
22873
23863
  }
22874
23864
  function batchKey(base, args) {
22875
- const hash2 = createHash("sha256").update(JSON.stringify(args)).digest("hex");
23865
+ const hash2 = createHash2("sha256").update(JSON.stringify(args)).digest("hex");
22876
23866
  if (!base) return `gtm-file-${hash2.slice(0, 32)}`;
22877
23867
  const key = `${base}-${hash2.slice(0, 16)}`;
22878
- return key.length <= 128 ? key : `gtm-${createHash("sha256").update(key).digest("hex").slice(0, 40)}`;
23868
+ return key.length <= 128 ? key : `gtm-${createHash2("sha256").update(key).digest("hex").slice(0, 40)}`;
22879
23869
  }
22880
23870
  function runIdsOf(run) {
22881
23871
  return [run, ...run.recovery ? [run.recovery] : []].flatMap((part) => part.batches.map((batch) => batch.answer.run_id).filter((id) => !!id));
22882
23872
  }
22883
23873
  function retryKey(key, runId) {
22884
- return `gtm-retry-${createHash("sha256").update(`${key}|${runId}`).digest("hex").slice(0, 40)}`;
23874
+ return `gtm-retry-${createHash2("sha256").update(`${key}|${runId}`).digest("hex").slice(0, 40)}`;
22885
23875
  }
22886
23876
  async function runBatches(session, profiles, perCall, budget, tool2, baseKey) {
22887
23877
  const perPerson = tool2.perPerson;
@@ -22953,7 +23943,7 @@ async function collectRows(session, batches, fallback) {
22953
23943
  async function recoverErroredRows(session, run, table, perCall, tool2, budgetLeft) {
22954
23944
  const errored = table.rows.filter((row) => row.status === "error" && row.url).map((row) => row.url);
22955
23945
  if (!errored.length || run.stop) return;
22956
- const keyBase = `gtm-retry-${createHash("sha256").update(runIdsOf(run).join(",")).digest("hex").slice(0, 32)}`;
23946
+ const keyBase = `gtm-retry-${createHash2("sha256").update(runIdsOf(run).join(",")).digest("hex").slice(0, 32)}`;
22957
23947
  const retry = await runBatches(session, errored, perCall, budgetLeft, tool2, keyBase);
22958
23948
  run.recovery = retry;
22959
23949
  const again = retry.batches.length && !retry.running ? await collectRows(session, retry.batches, FILE_ROW_FALLBACK) : null;
@@ -22991,6 +23981,20 @@ function exitCode(answer) {
22991
23981
  }
22992
23982
  function renderText(answer, fields = {}) {
22993
23983
  const lines = answerLines(answer);
23984
+ if (answer.estimate) {
23985
+ const estimate = answer.estimate;
23986
+ const index = lines.findIndex((line) => line.startsWith("estimate:"));
23987
+ lines.splice(
23988
+ index,
23989
+ 1,
23990
+ `target: ${estimate.target ?? "ask the user"}`,
23991
+ `credits_without_recheck: ${estimate.credits ? `expected ${estimate.credits[0]}, ceiling ${estimate.credits[1]}` : "choose a target"}`,
23992
+ `credits_with_recheck: ${estimate.with_recheck ? `expected ${estimate.with_recheck[0]}, ceiling ${estimate.with_recheck[1]}` : "choose a target"}`,
23993
+ `cap_remaining: ${estimate.cap_remaining}`,
23994
+ `affordable_target: ${estimate.affordable_target} (${estimate.affordable_with_recheck} with recheck)`,
23995
+ `email_price: ${estimate.email_credits} credits, live check included; optional recheck ${estimate.recheck_credits}`
23996
+ );
23997
+ }
22994
23998
  for (const [key, value] of Object.entries(fields)) {
22995
23999
  if (value === void 0) continue;
22996
24000
  lines.push(Array.isArray(value) ? `${key}[${value.length}]: ${value.join(",")}` : `${key}: ${String(value)}`);
@@ -23125,7 +24129,7 @@ async function combined(session, command, run, total, budget, rerun, fileFields)
23125
24129
  const wantsEmail = find.includes("email");
23126
24130
  const wantsPhone = find.includes("phone");
23127
24131
  const foundText = [...wantsEmail ? [`${emails} of ${sent} emails`] : [], ...wantsPhone ? [`${phones} of ${sent} mobiles`] : []].join(" and ");
23128
- const verdicts = ["deliverable", "invalid"].map((verdict) => [verdict, table?.rows.filter((row) => row.verdict === verdict).length ?? 0]).filter(([, n2]) => n2 > 0);
24132
+ const verdicts = ["verified", "deliverable", "invalid"].map((verdict) => [verdict, table?.rows.filter((row) => row.verdict === verdict).length ?? 0]).filter(([, n2]) => n2 > 0);
23129
24133
  let summary;
23130
24134
  if (run.running) {
23131
24135
  summary = `Batch ${batches.length} is still running after ${sent} of ${total} people; rerun this command to wait and continue.`;
@@ -23275,7 +24279,7 @@ async function toolFile(session, command) {
23275
24279
  import { randomUUID } from "node:crypto";
23276
24280
 
23277
24281
  // src/version.ts
23278
- var VERSION = "0.1.7";
24282
+ var VERSION = "0.1.8";
23279
24283
 
23280
24284
  // src/gateway.ts
23281
24285
  var CliError = class extends Error {
@@ -23315,9 +24319,9 @@ var RATE_LIMIT_RETRIES = 3;
23315
24319
  var TRANSIENT_RETRIES = 3;
23316
24320
  var TRANSIENT_STATUSES = /* @__PURE__ */ new Set([500, 502, 503, 504]);
23317
24321
  var Gateway = class {
23318
- constructor(apiUrl, token, io) {
24322
+ constructor(apiUrl, token2, io) {
23319
24323
  this.apiUrl = apiUrl;
23320
- this.token = token;
24324
+ this.token = token2;
23321
24325
  this.io = io;
23322
24326
  }
23323
24327
  apiUrl;
@@ -23329,6 +24333,15 @@ var Gateway = class {
23329
24333
  * call is safe to resend: free tools and quotes change nothing, and a paid
23330
24334
  * run always carries an idempotency key, one-off when none was given.
23331
24335
  */
24336
+ async watchCsv(since, watch) {
24337
+ if (!this.token) throw new CliError("not_signed_in", "Not signed in; run gtm login.");
24338
+ const query = new URLSearchParams({ since: String(since), ...watch ? { watch_id: watch } : {} });
24339
+ const { response } = await this.send(`/v1/agent/watches/changes.csv?${query}`, { headers: { authorization: `Bearer ${this.token}` } }, "safe");
24340
+ if (!response.ok) throw await this.failure(response);
24341
+ const cursor = Number(response.headers.get("x-gtm-cursor"));
24342
+ if (!Number.isSafeInteger(cursor) || cursor < since) throw new CliError("invalid_response", "Invalid watch cursor.");
24343
+ return { csv: await response.text(), cursor, more: response.headers.get("x-gtm-more") === "true" };
24344
+ }
23332
24345
  async call(tool2, args) {
23333
24346
  if (!this.token) throw new CliError("not_signed_in", "Not signed in; run gtm login.");
23334
24347
  const ownKey = args.max_credits !== void 0 && args.dry_run !== true && args.idempotency_key === void 0 ? `gtm-${randomUUID()}` : null;
@@ -23336,7 +24349,7 @@ var Gateway = class {
23336
24349
  const replay = keyed || args.dry_run === true || args.max_credits === void 0 ? "safe" : "once";
23337
24350
  const { response, resent } = await this.send(`/v1/agent/tools/${tool2}`, {
23338
24351
  method: "POST",
23339
- headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", accept: "application/json" },
24352
+ headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", accept: "application/json", [LEAD_PLAN_VERSION_HEADER]: String(AGENT_RESPONSE_VERSION) },
23340
24353
  body: JSON.stringify(ownKey ? { ...args, idempotency_key: ownKey } : args)
23341
24354
  }, replay);
23342
24355
  if (!response.ok) throw await this.failure(response);
@@ -23470,6 +24483,7 @@ var DEPLOYMENT = {
23470
24483
  telemetry: TELEMETRY_ROUTES,
23471
24484
  agentGateway: { webFlag: "PUBLIC_AGENT_GATEWAY", webValue: "1", runtimeFlag: "AGENT_GATEWAY_ENABLED", runtimeValue: "true" },
23472
24485
  cache: { productionMode: "live", namespacePrefix: "mode:", historicalLiveNamespace: "mode:live:blitz" },
24486
+ watchWorkflow: { binding: "GTM_WATCH_WORKFLOW", name: "gtm-hiring-watches", class_name: "GtmWatchWorkflow" },
23473
24487
  keeper: {
23474
24488
  crons: ["0 * * * *"],
23475
24489
  rpcUrls: BASE_RPC_URLS,
@@ -23519,6 +24533,10 @@ var COMMON = [
23519
24533
  ];
23520
24534
  var tool = (name) => `${OUTCOME_TOOLS[name].description} (Agent tool: ${name}.)`;
23521
24535
  var TOPICS = {
24536
+ watch: {
24537
+ summary: "Company and topic watches; quote first, charge only changes",
24538
+ lines: ["Usage:", " gtm watch create --name Sales --company acme.com --hiring SDR --dry-run", " gtm watch create --name Sales --file companies.csv --hiring SDR --max-credits N --yes", " gtm watch create --name Stack --company acme.com --signal tech-stack --max-credits N --yes", " gtm watch create --name Growth --company acme.com --signal headcount --max-credits N --yes", " gtm watch create --name Rounds --file companies.csv --signal funding --max-credits N --yes", " gtm watch create --name Buyers --topic 'CRM for agencies' [--source x|reddit|both] --max-credits N --yes", " gtm watch list [--offset N]", " gtm watch show ID", " gtm watch changes [--watch ID] [--since N | --new] [--csv]", " gtm watch pause|resume|delete ID", "", tool("gtm_watch"), "A monthly limit is mandatory. The first check is a free baseline. No cadence option.", "A topic watch checks X and Reddit weekly and charges only new qualifying posts.", "--yes confirms after the free quote; without it, interactive terminals ask for confirmation.", "--new saves a cursor per server, credential and watch under GTM_CONFIG_DIR.", "CSV contains full rows; the ordinary answer is a compact preview."]
24539
+ },
23522
24540
  login: {
23523
24541
  summary: "Sign in with a code you confirm in the browser",
23524
24542
  lines: [
@@ -23549,9 +24567,10 @@ var TOPICS = {
23549
24567
  "Usage:",
23550
24568
  " gtm contacts <profile>... --max-credits N [--verify] [--find email,phone]",
23551
24569
  " gtm contacts --file leads.csv --max-credits N [--column NAME] [--verify] [--out enriched.csv]",
23552
- " gtm contacts --run-id RUN --max-credits N",
24570
+ " gtm contacts --run-id RUN --target N --max-credits N",
23553
24571
  "",
23554
24572
  tool("gtm_find_contacts"),
24573
+ `${CAPABILITIES["email-finder"].price.credits} ${creditWord(CAPABILITIES["email-finder"].price.credits)} per email found, including the live mailbox check.`,
23555
24574
  "",
23556
24575
  "Options:",
23557
24576
  " --file PATH CSV or plain list of LinkedIn profile URLs or handles, any length;",
@@ -23559,7 +24578,8 @@ var TOPICS = {
23559
24578
  " --column NAME Column holding the profiles, when the CLI cannot tell",
23560
24579
  " --run-id RUN The people from a gtm list run",
23561
24580
  " --find email,phone What to find (default email)",
23562
- " --verify Mailbox-check found emails",
24581
+ " --verify Optional extra recheck; finding already includes the live check",
24582
+ " --target N Required count to enrich from --run-id",
23563
24583
  " --out PATH Write every row to a CSV file when done",
23564
24584
  ...PAID2,
23565
24585
  "",
@@ -23596,11 +24616,13 @@ var TOPICS = {
23596
24616
  summary: "Find a target number of new leads with emails and why each fits",
23597
24617
  lines: [
23598
24618
  "Usage:",
23599
- " gtm leads --titles 'Head of Sales' --industry SaaS --size 20-99 --location 'United States' --target 25 --max-credits N",
23600
- " gtm leads --hiring-role 'Founding SDR' --industry SaaS --size 5-99 --target 25 --max-credits N",
23601
- " gtm leads --funded | --like vercel.com | --post <linkedin post url> ... --target 25 --max-credits N",
24619
+ " gtm leads --titles 'Head of Sales' --industry SaaS --size 20-99 --location 'United States' --target N --dry-run",
24620
+ " gtm leads --hiring-role 'Founding SDR' --industry SaaS --size 5-99 --target N --max-credits B",
24621
+ " gtm leads --funded | --like vercel.com | --post <linkedin post url> ... --target N --max-credits B",
23602
24622
  "",
23603
24623
  tool("gtm_find_leads"),
24624
+ "Missing --target asks for a count for free, even with a budget. --dry-run shows costs, balance, cap and affordable volume.",
24625
+ "A list larger than 100 runs in the background: gtm waits and prints its progress; gtm results <run_id> --csv > leads.csv downloads every row.",
23604
24626
  "",
23605
24627
  "Options:",
23606
24628
  " --titles TITLE Job titles of the people to reach; repeat for up to 5",
@@ -23612,7 +24634,8 @@ var TOPICS = {
23612
24634
  " --funded Signal: companies that just raised",
23613
24635
  " --like DOMAIN Signal: companies similar to this one; repeat for up to 5",
23614
24636
  " --post URL Signal: people engaging with this LinkedIn post; repeat for up to 5",
23615
- " --target N Leads with emails to find (default 25)",
24637
+ " --target N Leads with emails the user wants; required to run",
24638
+ " --verify Optional extra paid recheck of found emails",
23616
24639
  " --max-per-company N Default 2",
23617
24640
  ...PAID2
23618
24641
  ]
@@ -23796,26 +24819,26 @@ function failed(reason, summary) {
23796
24819
  return shapeAnswer({ status: "error", reason, summary, next: LOGIN_NEXT });
23797
24820
  }
23798
24821
  async function authHeader(session) {
23799
- const { io, token, apiUrl } = session;
23800
- if (!token) {
24822
+ const { io, token: token2, apiUrl } = session;
24823
+ if (!token2) {
23801
24824
  io.stderr("Not signed in; run gtm login.\n");
23802
24825
  return 1;
23803
24826
  }
23804
- const target = io.env.CLAUDE_CODE_MCP_SERVER_URL;
23805
- if (target && !sameService(target, apiUrl)) {
23806
- io.stderr(`Refusing to send this login to ${target}; it belongs to ${apiUrl}.
24827
+ const target2 = io.env.CLAUDE_CODE_MCP_SERVER_URL;
24828
+ if (target2 && !sameService(target2, apiUrl)) {
24829
+ io.stderr(`Refusing to send this login to ${target2}; it belongs to ${apiUrl}.
23807
24830
  `);
23808
24831
  return 1;
23809
24832
  }
23810
- io.stdout(`${JSON.stringify({ Authorization: `Bearer ${token}` })}
24833
+ io.stdout(`${JSON.stringify({ Authorization: `Bearer ${token2}` })}
23811
24834
  `);
23812
24835
  return 0;
23813
24836
  }
23814
- function sameService(target, apiUrl) {
24837
+ function sameService(target2, apiUrl) {
23815
24838
  let url2;
23816
24839
  let api;
23817
24840
  try {
23818
- url2 = new URL(target);
24841
+ url2 = new URL(target2);
23819
24842
  api = new URL(apiUrl);
23820
24843
  } catch {
23821
24844
  return false;
@@ -23841,7 +24864,7 @@ function longTimeout(callback, ms) {
23841
24864
  return () => clearTimeout(timer);
23842
24865
  }
23843
24866
  async function pollUntil(options) {
23844
- const { policy, signal, read, isDone } = options;
24867
+ const { policy, signal: signal2, read, isDone } = options;
23845
24868
  if (!Number.isFinite(policy.maxDurationMs) && !Number.isFinite(policy.maxAttempts)) throw new Error("Polling requires a finite limit.");
23846
24869
  const now = options.now ?? Date.now;
23847
24870
  const deadline = now() + (policy.maxDurationMs ?? Infinity);
@@ -23862,8 +24885,8 @@ async function pollUntil(options) {
23862
24885
  stop = "cancelled";
23863
24886
  interrupt();
23864
24887
  };
23865
- signal?.addEventListener("abort", abort, { once: true });
23866
- if (signal?.aborted) abort();
24888
+ signal2?.addEventListener("abort", abort, { once: true });
24889
+ if (signal2?.aborted) abort();
23867
24890
  const acceptLate = policy.acceptLateRead === true;
23868
24891
  if (policy.maxDurationMs !== void 0 && !acceptLate) cancelDeadline = longTimeout(() => {
23869
24892
  stop = "limit";
@@ -23917,7 +24940,7 @@ async function pollUntil(options) {
23917
24940
  } finally {
23918
24941
  cancelDeadline?.();
23919
24942
  clearTimeout(sleepTimer);
23920
- signal?.removeEventListener("abort", abort);
24943
+ signal2?.removeEventListener("abort", abort);
23921
24944
  }
23922
24945
  }
23923
24946
 
@@ -23935,6 +24958,15 @@ var CredentialStore = class {
23935
24958
  this.dir = dir;
23936
24959
  }
23937
24960
  dir;
24961
+ async loadWatchCursor(key) {
24962
+ if (!/^[a-f0-9]{64}$/.test(key)) throw new Error("invalid cursor key");
24963
+ const saved = await this.read(`watch-${key}.json`, (value) => Number.isSafeInteger(value.cursor) && Number(value.cursor) >= 0);
24964
+ return saved?.cursor ?? 0;
24965
+ }
24966
+ async saveWatchCursor(key, cursor) {
24967
+ if (!/^[a-f0-9]{64}$/.test(key) || !Number.isSafeInteger(cursor) || cursor < 0) throw new Error("invalid cursor");
24968
+ await this.write(`watch-${key}.json`, { cursor });
24969
+ }
23938
24970
  load() {
23939
24971
  return this.read("credentials.json", (value) => typeof value.token === "string" && typeof value.api_url === "string");
23940
24972
  }
@@ -23960,15 +24992,15 @@ var CredentialStore = class {
23960
24992
  * caller must see, not a silent sign-out.
23961
24993
  */
23962
24994
  async read(name, valid) {
23963
- let text4;
24995
+ let text5;
23964
24996
  try {
23965
- text4 = await readFile(join(this.dir, name), "utf8");
24997
+ text5 = await readFile(join(this.dir, name), "utf8");
23966
24998
  } catch (error61) {
23967
24999
  if (isAbsent(error61)) return null;
23968
25000
  throw new CliError("credentials_unreadable", `Could not read ${join(this.dir, name)}: ${describe3(error61)}. Fix its permissions or remove it, then run gtm login.`);
23969
25001
  }
23970
25002
  try {
23971
- const value = JSON.parse(text4);
25003
+ const value = JSON.parse(text5);
23972
25004
  return value && typeof value === "object" && valid(value) ? value : null;
23973
25005
  } catch {
23974
25006
  return null;
@@ -24011,14 +25043,14 @@ function resolveApiUrl(flag, env, saved) {
24011
25043
  return url2.origin + url2.pathname.replace(/\/+$/, "");
24012
25044
  }
24013
25045
  var Session = class _Session {
24014
- constructor(io, options, apiUrl, token, tokenSource) {
25046
+ constructor(io, options, apiUrl, token2, tokenSource) {
24015
25047
  this.io = io;
24016
25048
  this.options = options;
24017
25049
  this.apiUrl = apiUrl;
24018
- this.token = token;
25050
+ this.token = token2;
24019
25051
  this.tokenSource = tokenSource;
24020
25052
  this.store = new CredentialStore(io.configDir);
24021
- this.gateway = new Gateway(apiUrl, token, io);
25053
+ this.gateway = new Gateway(apiUrl, token2, io);
24022
25054
  }
24023
25055
  io;
24024
25056
  options;
@@ -24038,13 +25070,13 @@ var Session = class _Session {
24038
25070
  return new _Session(io, options, apiUrl, envToken ?? savedToken, envToken ? "env" : savedToken ? "saved" : null);
24039
25071
  }
24040
25072
  /** A session for the same server with a newly issued token. */
24041
- withToken(token) {
24042
- return new _Session(this.io, this.options, this.apiUrl, token, "saved");
25073
+ withToken(token2) {
25074
+ return new _Session(this.io, this.options, this.apiUrl, token2, "saved");
24043
25075
  }
24044
25076
  /** Prints an answer as TOON text or JSON and returns its exit code. */
24045
25077
  emit(answer, fields = {}, options = {}) {
24046
- const text4 = this.options.json ? renderJson(answer, fields) : renderText(answer, fields);
24047
- this.io[options.stream ?? "stdout"](text4);
25078
+ const text5 = this.options.json ? renderJson(answer, fields) : renderText(answer, fields);
25079
+ this.io[options.stream ?? "stdout"](text5);
24048
25080
  return options.exit ?? exitCode(answer);
24049
25081
  }
24050
25082
  async readInput(path, topic) {
@@ -24064,13 +25096,22 @@ var Session = class _Session {
24064
25096
  if (first.status !== "running" || !first.run_id) return first;
24065
25097
  let answer = first;
24066
25098
  if (this.options.wait) {
25099
+ let shown = "";
25100
+ const report = (value) => {
25101
+ const line = value.status === "running" && value.progress ? progressText(value.progress) : "";
25102
+ if (line && line !== shown) this.io.stderr(`progress: ${line}
25103
+ `);
25104
+ shown = line || shown;
25105
+ };
25106
+ report(first);
24067
25107
  const outcome = await pollUntil({
24068
25108
  policy: { ...CLI_POLL_POLICY, maxDurationMs: this.options.timeoutSeconds * 1e3 },
24069
25109
  initial: first,
24070
25110
  read: () => this.gateway.call("gtm_results", { run_id: first.run_id }),
24071
25111
  isDone: (value) => value.status !== "running",
24072
25112
  now: () => this.io.now(),
24073
- sleep: (ms) => this.io.sleep(ms)
25113
+ sleep: (ms) => this.io.sleep(ms),
25114
+ onValue: report
24074
25115
  });
24075
25116
  if (outcome.reason === "error") throw outcome.error;
24076
25117
  answer = outcome.value ?? first;
@@ -24131,6 +25172,8 @@ Run gtm ${error61.topic ? `${error61.topic} ` : ""}--help for usage.
24131
25172
  }
24132
25173
  async function dispatch(session, command) {
24133
25174
  switch (command.kind) {
25175
+ case "watch":
25176
+ return watchCommand(session, command);
24134
25177
  case "login":
24135
25178
  return login(session, command.browser);
24136
25179
  case "logout":
@@ -24200,6 +25243,7 @@ async function quoteFile(session, command) {
24200
25243
  }
24201
25244
 
24202
25245
  // src/node.ts
25246
+ import { createInterface } from "node:readline/promises";
24203
25247
  import { spawn } from "node:child_process";
24204
25248
  import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
24205
25249
  import { homedir } from "node:os";
@@ -24223,11 +25267,20 @@ function openUrl(url2) {
24223
25267
  function nodeIo() {
24224
25268
  return {
24225
25269
  env: process.env,
24226
- stdout: (text4) => {
24227
- process.stdout.write(text4);
25270
+ confirm: async (prompt) => {
25271
+ if (!process.stdin.isTTY) return false;
25272
+ const reader = createInterface({ input: process.stdin, output: process.stderr });
25273
+ try {
25274
+ return /^(y|yes)$/i.test((await reader.question(`${prompt} [y/N] `)).trim());
25275
+ } finally {
25276
+ reader.close();
25277
+ }
25278
+ },
25279
+ stdout: (text5) => {
25280
+ process.stdout.write(text5);
24228
25281
  },
24229
- stderr: (text4) => {
24230
- process.stderr.write(text4);
25282
+ stderr: (text5) => {
25283
+ process.stderr.write(text5);
24231
25284
  },
24232
25285
  fetch: (input2, init) => fetch(input2, init),
24233
25286
  readFile: (path) => readFile2(path, "utf8"),