gtmmaxing 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gtm.js +1303 -218
- 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 = (
|
|
3
|
+
var __export = (target2, all) => {
|
|
4
4
|
for (var name in all)
|
|
5
|
-
__defProp(
|
|
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(
|
|
734
|
-
Object.defineProperty(
|
|
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
|
|
920
|
+
let target2;
|
|
918
921
|
return new Proxy({}, {
|
|
919
922
|
get(_, prop, receiver) {
|
|
920
|
-
|
|
921
|
-
return Reflect.get(
|
|
923
|
+
target2 ?? (target2 = getter());
|
|
924
|
+
return Reflect.get(target2, prop, receiver);
|
|
922
925
|
},
|
|
923
926
|
set(_, prop, value, receiver) {
|
|
924
|
-
|
|
925
|
-
return Reflect.set(
|
|
927
|
+
target2 ?? (target2 = getter());
|
|
928
|
+
return Reflect.set(target2, prop, value, receiver);
|
|
926
929
|
},
|
|
927
930
|
has(_, prop) {
|
|
928
|
-
|
|
929
|
-
return Reflect.has(
|
|
931
|
+
target2 ?? (target2 = getter());
|
|
932
|
+
return Reflect.has(target2, prop);
|
|
930
933
|
},
|
|
931
934
|
deleteProperty(_, prop) {
|
|
932
|
-
|
|
933
|
-
return Reflect.deleteProperty(
|
|
935
|
+
target2 ?? (target2 = getter());
|
|
936
|
+
return Reflect.deleteProperty(target2, prop);
|
|
934
937
|
},
|
|
935
938
|
ownKeys(_) {
|
|
936
|
-
|
|
937
|
-
return Reflect.ownKeys(
|
|
939
|
+
target2 ?? (target2 = getter());
|
|
940
|
+
return Reflect.ownKeys(target2);
|
|
938
941
|
},
|
|
939
942
|
getOwnPropertyDescriptor(_, prop) {
|
|
940
|
-
|
|
941
|
-
return Reflect.getOwnPropertyDescriptor(
|
|
943
|
+
target2 ?? (target2 = getter());
|
|
944
|
+
return Reflect.getOwnPropertyDescriptor(target2, prop);
|
|
942
945
|
},
|
|
943
946
|
defineProperty(_, prop, descriptor) {
|
|
944
|
-
|
|
945
|
-
return Reflect.defineProperty(
|
|
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
|
|
1276
|
+
const bytes2 = new Uint8Array(binaryString.length);
|
|
1274
1277
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1275
|
-
|
|
1278
|
+
bytes2[i] = binaryString.charCodeAt(i);
|
|
1276
1279
|
}
|
|
1277
|
-
return
|
|
1280
|
+
return bytes2;
|
|
1278
1281
|
}
|
|
1279
|
-
function uint8ArrayToBase64(
|
|
1282
|
+
function uint8ArrayToBase64(bytes2) {
|
|
1280
1283
|
let binaryString = "";
|
|
1281
|
-
for (let i = 0; i <
|
|
1282
|
-
binaryString += String.fromCharCode(
|
|
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(
|
|
1292
|
-
return uint8ArrayToBase64(
|
|
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
|
|
1302
|
+
const bytes2 = new Uint8Array(cleanHex.length / 2);
|
|
1300
1303
|
for (let i = 0; i < cleanHex.length; i += 2) {
|
|
1301
|
-
|
|
1304
|
+
bytes2[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
|
|
1302
1305
|
}
|
|
1303
|
-
return
|
|
1306
|
+
return bytes2;
|
|
1304
1307
|
}
|
|
1305
|
-
function uint8ArrayToHex(
|
|
1306
|
-
return Array.from(
|
|
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
|
|
1468
|
-
if (!initialized.has(
|
|
1469
|
-
initialized.add(
|
|
1470
|
-
members(
|
|
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(
|
|
3101
|
+
function isValidJWT(token2, algorithm = null) {
|
|
3099
3102
|
try {
|
|
3100
|
-
const tokensParts =
|
|
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 = (
|
|
9091
|
-
return
|
|
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(
|
|
12568
|
-
const targetAny =
|
|
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(
|
|
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(
|
|
15116
|
+
assignProp(target2, key, source[key]);
|
|
15114
15117
|
}
|
|
15115
15118
|
}
|
|
15116
15119
|
}
|
|
15117
|
-
return
|
|
15120
|
+
return target2;
|
|
15118
15121
|
}
|
|
15119
15122
|
function initializeContext(params) {
|
|
15120
|
-
let
|
|
15121
|
-
if (
|
|
15122
|
-
|
|
15123
|
-
if (
|
|
15124
|
-
|
|
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(
|
|
16734
|
-
return pipe(this,
|
|
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
|
|
19508
|
-
if (!
|
|
19509
|
-
const low = Number(
|
|
19510
|
-
const high = Number(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: "
|
|
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
|
-
|
|
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
|
|
21005
|
-
label: "
|
|
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: "
|
|
21291
|
+
role: "Search candidates, checked for relevance and buyer need",
|
|
21017
21292
|
key: "search",
|
|
21018
21293
|
cap: 5e3,
|
|
21019
|
-
maxCalls:
|
|
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: "
|
|
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
|
-
|
|
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
|
|
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: "
|
|
21408
|
+
role: "Full Reddit posts with bounded cursor pagination",
|
|
21113
21409
|
key: "search",
|
|
21114
21410
|
cap: 5e3,
|
|
21115
|
-
maxCalls:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
21876
|
+
var savedToolRequestSchema = external_exports.object({
|
|
21352
21877
|
tool: toolIdSchema,
|
|
21353
21878
|
...toolRequestFields.shape
|
|
21354
|
-
}).strict()
|
|
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:
|
|
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,305 @@ 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/
|
|
21513
|
-
var
|
|
21514
|
-
|
|
21515
|
-
|
|
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
|
+
// Rows read per company: headcount is one by nature, a tech stack read lists every technology it can report.
|
|
22163
|
+
maxPostsPerCompany: signal2 === "headcount" ? 1 : 200
|
|
22164
|
+
};
|
|
22165
|
+
}
|
|
22166
|
+
function watchCheckCeiling(signal2, companies) {
|
|
22167
|
+
const policy = watchPolicy(signal2);
|
|
22168
|
+
const units = signal2 === "topic" ? TOPIC_WATCH_POLICY.maxPostsPerCheck : signal2 === "tech-stack" ? companies : companies * policy.maxPostsPerCompany;
|
|
22169
|
+
return units * policy.changeCredits;
|
|
22170
|
+
}
|
|
22171
|
+
function watchQuoteFigures(signal2, size) {
|
|
22172
|
+
const policy = watchPolicy(signal2);
|
|
22173
|
+
const perCheck = watchCheckCeiling(signal2, size);
|
|
22174
|
+
const checksPerMonth = Math.ceil(31 * 24 * 60 * 60 * 1e3 / policy.intervalMs);
|
|
22175
|
+
return { perChange: policy.changeCredits, perCheck, checksPerMonth, perMonth: perCheck * checksPerMonth };
|
|
22176
|
+
}
|
|
22177
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
21516
22178
|
|
|
21517
|
-
// ../contracts/src/
|
|
22179
|
+
// ../contracts/src/lead-plan.ts
|
|
22180
|
+
var LEAD_PLAN_VERSION_HEADER = "X-GTM-Answer-Version";
|
|
22181
|
+
var LEAD_PLAN_MAX_BYTES = 4096;
|
|
22182
|
+
var AGENT_RESPONSE_VERSION = 3;
|
|
21518
22183
|
var text2 = (max) => external_exports.string().trim().min(1).max(max);
|
|
22184
|
+
var credits = external_exports.number().int().min(0).max(AGENT_MAX_CREDITS);
|
|
22185
|
+
var target = external_exports.number().int().min(1).max(LEAD_MAX_TARGET);
|
|
22186
|
+
var token = (max) => external_exports.string().regex(/^[A-Za-z0-9_-]+$/).min(1).max(max);
|
|
22187
|
+
var planId = token(64);
|
|
22188
|
+
var optionId = token(24);
|
|
22189
|
+
var timestamp = external_exports.number().int().nonnegative();
|
|
22190
|
+
var contactsPerCompany = external_exports.number().int().min(1).max(LEAD_MAX_CONTACTS_PER_COMPANY);
|
|
22191
|
+
var leadTargetUnitSchema = external_exports.enum(["people_with_email", "companies"]);
|
|
22192
|
+
var leadSourceFamilySchema = external_exports.enum(["directory", "company_signal", "company", "local", "engagers"]);
|
|
22193
|
+
var leadIcpSchema = external_exports.object({
|
|
22194
|
+
titles: external_exports.array(text2(60)).min(1).max(5).optional(),
|
|
22195
|
+
location: text2(100).optional(),
|
|
22196
|
+
industries: external_exports.array(text2(100)).min(1).max(10).optional().describe("Like SaaS"),
|
|
22197
|
+
company_sizes: external_exports.array(text2(20)).min(1).max(9).optional().describe("Like 20-99"),
|
|
22198
|
+
keywords: external_exports.array(text2(60)).min(1).max(10).optional().describe("In company description")
|
|
22199
|
+
}).strict();
|
|
22200
|
+
var signal = external_exports.discriminatedUnion("kind", [
|
|
22201
|
+
external_exports.object({ kind: external_exports.literal("hiring"), roles: external_exports.array(text2(100)).min(1).max(5) }).strict(),
|
|
22202
|
+
external_exports.object({ kind: external_exports.literal("funding") }).strict(),
|
|
22203
|
+
external_exports.object({ kind: external_exports.literal("lookalike"), domains: external_exports.array(text2(100)).min(1).max(5) }).strict(),
|
|
22204
|
+
external_exports.object({ kind: external_exports.literal("engagers"), post_urls: external_exports.array(external_exports.url().max(500)).min(1).max(5) }).strict()
|
|
22205
|
+
]);
|
|
22206
|
+
var leadIntentSchema = external_exports.discriminatedUnion("kind", [
|
|
22207
|
+
external_exports.object({ kind: external_exports.literal("people"), icp: leadIcpSchema.optional(), signal: signal.optional() }).strict(),
|
|
22208
|
+
external_exports.object({ kind: external_exports.literal("company"), domains: external_exports.array(text2(100)).min(1).max(100), icp: leadIcpSchema.optional() }).strict(),
|
|
22209
|
+
external_exports.object({ kind: external_exports.literal("local"), business_type: text2(100), location: text2(100), icp: leadIcpSchema.optional() }).strict()
|
|
22210
|
+
]);
|
|
22211
|
+
var leadPlanInput = external_exports.object({
|
|
22212
|
+
intent: leadIntentSchema,
|
|
22213
|
+
target: target.optional(),
|
|
22214
|
+
target_unit: leadTargetUnitSchema.default("people_with_email"),
|
|
22215
|
+
contacts_per_company: contactsPerCompany.optional(),
|
|
22216
|
+
quality: external_exports.literal("checked").default("checked"),
|
|
22217
|
+
extra_recheck: external_exports.boolean().default(false)
|
|
22218
|
+
}).strict().superRefine((request, ctx) => {
|
|
22219
|
+
if (request.target_unit === "companies" && (request.intent.kind === "people" || request.contacts_per_company === void 0)) {
|
|
22220
|
+
ctx.addIssue({ code: "custom", message: "Company targets require company or local intent and contacts_per_company." });
|
|
22221
|
+
}
|
|
22222
|
+
});
|
|
22223
|
+
var leadPlanChoiceSchema = external_exports.object({
|
|
22224
|
+
plan_id: planId,
|
|
22225
|
+
option_id: optionId,
|
|
22226
|
+
max_credits: credits,
|
|
22227
|
+
idempotency_key: external_exports.string().regex(/^[\x21-\x7e]{8,128}$/)
|
|
22228
|
+
}).strict();
|
|
22229
|
+
var confidence = external_exports.enum(["low", "medium", "high"]);
|
|
22230
|
+
var range = (bound) => external_exports.tuple([bound, bound]).refine(([min, max]) => min <= max, "Range must be ordered.");
|
|
22231
|
+
var leadPlanEtaSchema = external_exports.discriminatedUnion("basis", [
|
|
22232
|
+
external_exports.object({ basis: external_exports.literal("unavailable") }).strict(),
|
|
22233
|
+
external_exports.object({ basis: external_exports.literal("measured"), seconds: range(external_exports.number().int().nonnegative()), sample_size: external_exports.number().int().positive(), confidence }).strict(),
|
|
22234
|
+
external_exports.object({ basis: external_exports.literal("conservative_model"), seconds: range(external_exports.number().int().nonnegative()), assumptions: text2(160), confidence }).strict()
|
|
22235
|
+
]);
|
|
22236
|
+
var leadQualityPricesSchema = external_exports.object({
|
|
22237
|
+
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(),
|
|
22238
|
+
extra_recheck: external_exports.object({ optional: external_exports.literal(true), credits: external_exports.literal(EMAIL_RECHECK_CREDITS) }).strict(),
|
|
22239
|
+
unchecked: external_exports.object({ availability: external_exports.literal("not_offered_under_current_policy"), email_credits: external_exports.null() }).strict()
|
|
22240
|
+
}).strict();
|
|
22241
|
+
var leadEstimateSchema = external_exports.object({
|
|
22242
|
+
target: target.nullable(),
|
|
22243
|
+
credits: range(credits).nullable(),
|
|
22244
|
+
with_recheck: range(credits).nullable(),
|
|
22245
|
+
cap_remaining: external_exports.number().int().nonnegative(),
|
|
22246
|
+
affordable_target: external_exports.number().int().min(0).max(LEAD_MAX_TARGET),
|
|
22247
|
+
affordable_with_recheck: external_exports.number().int().min(0).max(LEAD_MAX_TARGET),
|
|
22248
|
+
email_credits: external_exports.literal(EMAIL_LOOKUP_CREDITS),
|
|
22249
|
+
recheck_credits: external_exports.literal(EMAIL_RECHECK_CREDITS)
|
|
22250
|
+
}).strict();
|
|
22251
|
+
var leadStopSchema = external_exports.enum(["sources_exhausted", "budget_reached", "agent_cap", "out_of_credits", "search_limit", "agent_stopped", "tool_unavailable"]);
|
|
22252
|
+
var leadProgressSchema = external_exports.object({
|
|
22253
|
+
found: external_exports.number().int().nonnegative(),
|
|
22254
|
+
target,
|
|
22255
|
+
spent: credits,
|
|
22256
|
+
budget_left: credits,
|
|
22257
|
+
state: external_exports.enum(["running", "done", "stopped"]),
|
|
22258
|
+
/** Present when the list stopped short of its target. */
|
|
22259
|
+
stop: leadStopSchema.optional()
|
|
22260
|
+
}).strict();
|
|
22261
|
+
var leadPlanOptionSchema = external_exports.object({
|
|
22262
|
+
id: optionId,
|
|
22263
|
+
target,
|
|
22264
|
+
quality: external_exports.literal("checked"),
|
|
22265
|
+
extra_recheck: external_exports.boolean(),
|
|
22266
|
+
estimated_credits: credits,
|
|
22267
|
+
max_credits: credits,
|
|
22268
|
+
estimated_results: range(external_exports.number().int().min(0).max(LEAD_MAX_TARGET)),
|
|
22269
|
+
eta: leadPlanEtaSchema,
|
|
22270
|
+
availability: external_exports.enum(["available", "cap_change_required", "insufficient_balance", "source_unavailable", "capacity_exceeded"]),
|
|
22271
|
+
reason: text2(160).optional()
|
|
22272
|
+
}).strict().superRefine((option, ctx) => {
|
|
22273
|
+
if (option.estimated_credits > option.max_credits) ctx.addIssue({ code: "custom", message: "Estimate exceeds spending ceiling." });
|
|
22274
|
+
if (option.availability !== "available" && !option.reason) ctx.addIssue({ code: "custom", message: "Blocked options require a reason." });
|
|
22275
|
+
});
|
|
22276
|
+
var planTimes = { plan_id: planId, created_at: timestamp, expires_at: timestamp };
|
|
22277
|
+
var laterExpiry = (value) => value.expires_at > value.created_at;
|
|
22278
|
+
var leadPlanIdentitySchema = external_exports.object({
|
|
22279
|
+
...planTimes,
|
|
22280
|
+
account_id: token(64),
|
|
22281
|
+
catalog_version: token(64),
|
|
22282
|
+
price_version: token(64),
|
|
22283
|
+
workspace_version: token(64),
|
|
22284
|
+
exclusion_version: token(64)
|
|
22285
|
+
}).strict().refine(laterExpiry, "Plan expiry must follow creation.");
|
|
22286
|
+
var quoteObject = external_exports.object({
|
|
22287
|
+
kind: external_exports.literal("lead_plan"),
|
|
22288
|
+
version: external_exports.literal(1),
|
|
22289
|
+
status: external_exports.literal("quote"),
|
|
22290
|
+
...planTimes,
|
|
22291
|
+
cost: external_exports.literal(0),
|
|
22292
|
+
requires_confirmation: external_exports.literal(true),
|
|
22293
|
+
target_unit: leadTargetUnitSchema,
|
|
22294
|
+
contacts_per_company: contactsPerCompany.optional(),
|
|
22295
|
+
recommended_option: optionId,
|
|
22296
|
+
options: external_exports.array(leadPlanOptionSchema).length(3),
|
|
22297
|
+
estimate_basis: external_exports.object({ method: external_exports.enum(["heuristic", "measured", "conservative_model"]), sample_size: external_exports.number().int().nonnegative(), confidence }).strict(),
|
|
22298
|
+
quality_prices: leadQualityPricesSchema,
|
|
22299
|
+
/** Mandatory host instruction: show this text and every option before requesting a choice. */
|
|
22300
|
+
relay: text2(240),
|
|
22301
|
+
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(),
|
|
22302
|
+
/** Largest currently affordable quantity, not a replacement for a blocked option. */
|
|
22303
|
+
affordable_target: external_exports.number().int().min(0).max(LEAD_MAX_TARGET).optional(),
|
|
22304
|
+
top_up: external_exports.object({ url: external_exports.url().max(256), credits }).strict().optional()
|
|
22305
|
+
}).strict();
|
|
22306
|
+
var bytes = (value) => new TextEncoder().encode(value).length;
|
|
22307
|
+
function leadPlanText(quote2) {
|
|
22308
|
+
const lines = ["Choose how many contacts."];
|
|
22309
|
+
for (const [key, value] of Object.entries(quote2)) {
|
|
22310
|
+
if (key === "relay") continue;
|
|
22311
|
+
if (key === "options") {
|
|
22312
|
+
for (const option of quote2.options) lines.push(`option: ${JSON.stringify(option)}${option.eta.basis === "unavailable" ? " (time estimate unavailable)" : ""}`);
|
|
22313
|
+
} else lines.push(`${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
22314
|
+
}
|
|
22315
|
+
lines.push(`relay: ${quote2.relay}`);
|
|
22316
|
+
return lines.join("\n");
|
|
22317
|
+
}
|
|
22318
|
+
function legacyLeadPlanFields(quote2) {
|
|
22319
|
+
return {
|
|
22320
|
+
status: "quote",
|
|
22321
|
+
summary: `Choose how many contacts; live check included; extra recheck ${EMAIL_RECHECK_CREDITS} credits/email; unchecked unavailable. Update CLI for details and selection.`,
|
|
22322
|
+
run_id: null,
|
|
22323
|
+
cost: 0,
|
|
22324
|
+
balance: null,
|
|
22325
|
+
total: quote2.options.length,
|
|
22326
|
+
label: "options",
|
|
22327
|
+
columns: ["option", "target", "est/max_credits", "time_s", "extra_recheck", "availability"],
|
|
22328
|
+
rows: quote2.options.map((option) => [
|
|
22329
|
+
option.id,
|
|
22330
|
+
option.target,
|
|
22331
|
+
`${option.estimated_credits}/${option.max_credits}`,
|
|
22332
|
+
option.eta.basis === "unavailable" ? "unavailable" : option.eta.seconds.join("-"),
|
|
22333
|
+
option.extra_recheck,
|
|
22334
|
+
option.availability
|
|
22335
|
+
]),
|
|
22336
|
+
report: quote2.relay,
|
|
22337
|
+
next: { tool: "human", args: {} }
|
|
22338
|
+
};
|
|
22339
|
+
}
|
|
22340
|
+
var leadPlanQuoteSchema = quoteObject.superRefine((quote2, ctx) => {
|
|
22341
|
+
if (!laterExpiry(quote2)) ctx.addIssue({ code: "custom", message: "Plan expiry must follow creation." });
|
|
22342
|
+
if (new Set(quote2.options.map((option) => option.id)).size !== 3 || new Set(quote2.options.map((option) => option.target)).size !== 3) {
|
|
22343
|
+
ctx.addIssue({ code: "custom", message: "Three distinct volume options are required." });
|
|
22344
|
+
}
|
|
22345
|
+
if (!quote2.options.some((option) => option.id === quote2.recommended_option)) ctx.addIssue({ code: "custom", message: "Recommendation must identify an option." });
|
|
22346
|
+
if (quote2.target_unit === "companies" && quote2.contacts_per_company === void 0) ctx.addIssue({ code: "custom", message: "Company targets require contacts_per_company." });
|
|
22347
|
+
if (quote2.estimate_basis.method === "measured" && quote2.estimate_basis.sample_size === 0) ctx.addIssue({ code: "custom", message: "Measured estimates require samples." });
|
|
22348
|
+
if (bytes(JSON.stringify(legacyLeadPlanFields(quote2))) > AGENT_ANSWER_MAX_BYTES) {
|
|
22349
|
+
ctx.addIssue({ code: "custom", message: "Mandatory choices and relay exceed the version 1 projection budget." });
|
|
22350
|
+
}
|
|
22351
|
+
if (bytes(JSON.stringify(quote2)) > LEAD_PLAN_MAX_BYTES || bytes(leadPlanText(quote2)) > LEAD_PLAN_MAX_BYTES) {
|
|
22352
|
+
ctx.addIssue({ code: "custom", message: "Planning payload exceeds its UTF-8 byte budget." });
|
|
22353
|
+
}
|
|
22354
|
+
});
|
|
22355
|
+
var leadPlanSnapshotSchema = leadPlanIdentitySchema.safeExtend({
|
|
22356
|
+
request: leadPlanInput,
|
|
22357
|
+
source_family: leadSourceFamilySchema,
|
|
22358
|
+
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(),
|
|
22359
|
+
quote: leadPlanQuoteSchema
|
|
22360
|
+
}).superRefine((snapshot, ctx) => {
|
|
22361
|
+
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)) {
|
|
22362
|
+
ctx.addIssue({ code: "custom", message: "Snapshot and quote must describe the same immutable plan." });
|
|
22363
|
+
}
|
|
22364
|
+
});
|
|
22365
|
+
|
|
22366
|
+
// ../contracts/src/email-finder.ts
|
|
22367
|
+
var text3 = (max) => external_exports.string().trim().min(1).max(max);
|
|
21519
22368
|
var s2 = external_exports.string();
|
|
21520
22369
|
var EMAIL_SUPPLIER_STEPS = [
|
|
21521
22370
|
{
|
|
@@ -21562,7 +22411,8 @@ var EMAIL_VERIFICATION_STEP = {
|
|
|
21562
22411
|
var EMAIL_FINDER_DEFINITION = {
|
|
21563
22412
|
title: "Email finder",
|
|
21564
22413
|
description: "Work email for each LinkedIn profile, checked before it is returned.",
|
|
21565
|
-
input: external_exports.object({ people: external_exports.array(
|
|
22414
|
+
input: external_exports.object({ people: external_exports.array(text3(300)).min(1).max(MAX_BATCH_PEOPLE) }).strict(),
|
|
22415
|
+
accepts: { person: "people" },
|
|
21566
22416
|
row: external_exports.object({
|
|
21567
22417
|
name: s2.nullable(),
|
|
21568
22418
|
title: s2.nullable(),
|
|
@@ -21593,12 +22443,12 @@ var EMAIL_FINDER_DEFINITION = {
|
|
|
21593
22443
|
};
|
|
21594
22444
|
|
|
21595
22445
|
// ../contracts/src/capabilities.ts
|
|
21596
|
-
var
|
|
22446
|
+
var text4 = (max) => external_exports.string().trim().min(1).max(max);
|
|
21597
22447
|
var companyFilters2 = {
|
|
21598
|
-
industries: external_exports.array(
|
|
21599
|
-
company_sizes: external_exports.array(
|
|
22448
|
+
industries: external_exports.array(text4(100)).min(1).max(10).optional(),
|
|
22449
|
+
company_sizes: external_exports.array(text4(20)).min(1).max(9).optional()
|
|
21600
22450
|
};
|
|
21601
|
-
var keywordsField2 = external_exports.array(
|
|
22451
|
+
var keywordsField2 = external_exports.array(text4(60)).min(1).max(10).optional();
|
|
21602
22452
|
var pageField2 = external_exports.number().int().min(1).max(100).optional();
|
|
21603
22453
|
var CAPABILITIES = {
|
|
21604
22454
|
"seo-aeo-audit": TOOL_DEFINITIONS["seo-aeo-audit"],
|
|
@@ -21613,6 +22463,7 @@ var CAPABILITIES = {
|
|
|
21613
22463
|
"people-search": TOOL_DEFINITIONS["people-search"],
|
|
21614
22464
|
"funding-signals": TOOL_DEFINITIONS["funding-signals"],
|
|
21615
22465
|
"lookalike-companies": TOOL_DEFINITIONS["lookalike-companies"],
|
|
22466
|
+
"tech-stack": TOOL_DEFINITIONS["tech-stack"],
|
|
21616
22467
|
"post-engagers": TOOL_DEFINITIONS["post-engagers"],
|
|
21617
22468
|
"google-search": TOOL_DEFINITIONS["google-search"],
|
|
21618
22469
|
"linkedin-profile": TOOL_DEFINITIONS["linkedin-profile"],
|
|
@@ -21627,63 +22478,60 @@ var CAPABILITY_IDS = Object.keys(CAPABILITIES);
|
|
|
21627
22478
|
var capabilityIdSchema = external_exports.enum(CAPABILITY_IDS);
|
|
21628
22479
|
var paidArgs = {
|
|
21629
22480
|
// 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(
|
|
22481
|
+
max_credits: external_exports.number().int().min(0).max(AGENT_MAX_CREDITS).optional(),
|
|
21631
22482
|
idempotency_key: external_exports.string().pipe(external_exports.string().regex(/^[\x21-\x7e]{8,128}$/)).optional(),
|
|
21632
22483
|
dry_run: external_exports.boolean().optional()
|
|
21633
22484
|
};
|
|
21634
22485
|
var price = (id) => TOOL_CATALOG[id].credits;
|
|
21635
22486
|
var findContactsInput = external_exports.object({
|
|
21636
|
-
people: external_exports.array(
|
|
21637
|
-
run_id: external_exports.string().max(64).optional().describe("
|
|
21638
|
-
named: external_exports.array(external_exports.object({ name: external_exports.string().pipe(
|
|
22487
|
+
people: external_exports.array(text4(300)).min(1).max(MAX_BATCH_PEOPLE).optional(),
|
|
22488
|
+
run_id: external_exports.string().max(64).optional().describe("People from a list run"),
|
|
22489
|
+
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
22490
|
find: external_exports.array(external_exports.enum(["email", "phone"])).min(1).max(2).optional().describe('Default ["email"]'),
|
|
21640
|
-
verify: external_exports.boolean().optional().describe("
|
|
22491
|
+
verify: external_exports.boolean().optional().describe("Extra recheck"),
|
|
22492
|
+
target: external_exports.number().int().min(1).max(MAX_BATCH_PEOPLE).optional().describe("Required for run_id"),
|
|
21641
22493
|
...paidArgs
|
|
21642
22494
|
}).strict();
|
|
21643
22495
|
var buildListInput = external_exports.object({
|
|
21644
|
-
titles: external_exports.array(
|
|
21645
|
-
company:
|
|
21646
|
-
companies: external_exports.array(
|
|
21647
|
-
location:
|
|
22496
|
+
titles: external_exports.array(text4(60)).min(1).max(5).optional(),
|
|
22497
|
+
company: text4(100).optional().describe("Company domain: decision-makers there"),
|
|
22498
|
+
companies: external_exports.array(text4(100)).min(1).max(100).optional(),
|
|
22499
|
+
location: text4(100).optional(),
|
|
21648
22500
|
...companyFilters2,
|
|
21649
22501
|
keywords: keywordsField2,
|
|
21650
|
-
business_type:
|
|
22502
|
+
business_type: text4(100).optional(),
|
|
21651
22503
|
page: pageField2,
|
|
21652
22504
|
limit: external_exports.number().int().min(1).max(100).optional(),
|
|
21653
22505
|
...paidArgs
|
|
21654
22506
|
}).strict();
|
|
21655
|
-
var researchCompanyInput = external_exports.object({ company:
|
|
22507
|
+
var researchCompanyInput = external_exports.object({ company: text4(100), ...paidArgs }).strict();
|
|
21656
22508
|
var findSignalsInput = external_exports.object({
|
|
21657
|
-
role:
|
|
21658
|
-
location:
|
|
21659
|
-
company:
|
|
22509
|
+
role: text4(200),
|
|
22510
|
+
location: text4(100).optional(),
|
|
22511
|
+
company: text4(100).optional(),
|
|
21660
22512
|
...companyFilters2,
|
|
21661
22513
|
page: pageField2,
|
|
21662
22514
|
limit: external_exports.number().int().min(1).max(50).optional(),
|
|
21663
22515
|
...paidArgs
|
|
21664
22516
|
}).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
|
-
};
|
|
22517
|
+
var icpFields = leadIcpSchema.shape;
|
|
21671
22518
|
var findLeadsInput = external_exports.object({
|
|
21672
22519
|
...icpFields,
|
|
21673
|
-
hiring_roles: external_exports.array(
|
|
21674
|
-
recently_funded: external_exports.boolean().optional()
|
|
21675
|
-
like_companies: external_exports.array(
|
|
21676
|
-
post_urls: external_exports.array(
|
|
21677
|
-
target: external_exports.number().int().min(1).max(
|
|
21678
|
-
max_per_company: external_exports.number().int().min(1).max(
|
|
22520
|
+
hiring_roles: external_exports.array(text4(100)).min(1).max(5).optional().describe("Signal; a tool's name finds its users"),
|
|
22521
|
+
recently_funded: external_exports.boolean().optional(),
|
|
22522
|
+
like_companies: external_exports.array(text4(100)).min(1).max(5).optional(),
|
|
22523
|
+
post_urls: external_exports.array(text4(500)).min(1).max(5).optional(),
|
|
22524
|
+
target: external_exports.number().int().min(1).max(LEAD_MAX_TARGET).optional().describe("Ask the user"),
|
|
22525
|
+
max_per_company: external_exports.number().int().min(1).max(LEAD_MAX_CONTACTS_PER_COMPANY).optional().describe("Default 2"),
|
|
22526
|
+
verify: external_exports.boolean().optional(),
|
|
21679
22527
|
...paidArgs
|
|
21680
22528
|
}).strict();
|
|
21681
22529
|
var workspaceIcpInput = external_exports.object({ ...icpFields, notes: external_exports.string().trim().max(2e3).optional() }).strict();
|
|
21682
22530
|
var workspaceInput = external_exports.object({
|
|
21683
22531
|
action: external_exports.enum(["get", "set_icp", "exclude", "forget_seen"]),
|
|
21684
|
-
icp: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
21685
|
-
domains: external_exports.array(
|
|
21686
|
-
profiles: external_exports.array(
|
|
22532
|
+
icp: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
22533
|
+
domains: external_exports.array(text4(100)).min(1).max(500).optional(),
|
|
22534
|
+
profiles: external_exports.array(text4(300)).min(1).max(500).optional()
|
|
21687
22535
|
}).strict();
|
|
21688
22536
|
var resultsInput = external_exports.object({
|
|
21689
22537
|
run_id: external_exports.string().min(1).max(64),
|
|
@@ -21698,68 +22546,69 @@ var toolsInput = external_exports.object({
|
|
|
21698
22546
|
...paidArgs
|
|
21699
22547
|
}).strict();
|
|
21700
22548
|
var accountInput = external_exports.object({
|
|
21701
|
-
quote: external_exports.object({ capability: external_exports.string().pipe(capabilityIdSchema.
|
|
22549
|
+
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
22550
|
}).strict();
|
|
21703
22551
|
var OUTCOME_TOOLS = {
|
|
22552
|
+
gtm_watch: { title: "Company watch", description: `Hiring/funding/topic ${HIRING_WATCH_POLICY.changeCredits}, headcount ${watchPolicy("headcount").changeCredits}/change, tech-stack ${watchPolicy("tech-stack").changeCredits}/company. Quote first.`, paid: true, capabilities: ["signals"], input: watchInput },
|
|
21704
22553
|
gtm_find_contacts: {
|
|
21705
22554
|
title: "Find contacts",
|
|
21706
|
-
description: `
|
|
22555
|
+
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
22556
|
paid: true,
|
|
21708
22557
|
capabilities: ["email-finder", "phone-pilot", "verify-email"],
|
|
21709
22558
|
input: findContactsInput
|
|
21710
22559
|
},
|
|
21711
22560
|
gtm_build_list: {
|
|
21712
22561
|
title: "Build a lead list",
|
|
21713
|
-
description: `People
|
|
22562
|
+
description: `People ${price("people-search")} cr/100; decision-makers ${price("icp")} cr/domain; local businesses ${price("local-leads")} cr. Empty free.`,
|
|
21714
22563
|
paid: true,
|
|
21715
22564
|
capabilities: ["people-search", "icp", "local-leads"],
|
|
21716
22565
|
input: buildListInput
|
|
21717
22566
|
},
|
|
21718
22567
|
gtm_find_leads: {
|
|
21719
22568
|
title: "Find leads",
|
|
21720
|
-
description: "
|
|
22569
|
+
description: "Ask target; absent plans free; dry_run quotes. Run with max_credits.",
|
|
21721
22570
|
paid: true,
|
|
21722
22571
|
capabilities: ["people-search", "signals", "funding-signals", "lookalike-companies", "post-engagers", "icp", "email-finder"],
|
|
21723
22572
|
input: findLeadsInput
|
|
21724
22573
|
},
|
|
21725
22574
|
gtm_research_company: {
|
|
21726
22575
|
title: "Research a company",
|
|
21727
|
-
description: `
|
|
22576
|
+
description: `Domain profile, sales brief: up to ${price("company") + price("website")} cr; misses free.`,
|
|
21728
22577
|
paid: true,
|
|
21729
22578
|
capabilities: ["company", "website"],
|
|
21730
22579
|
input: researchCompanyInput
|
|
21731
22580
|
},
|
|
21732
22581
|
gtm_find_signals: {
|
|
21733
22582
|
title: "Find hiring signals",
|
|
21734
|
-
description: `Companies hiring
|
|
22583
|
+
description: `Companies hiring a role, last 30 days. ${price("signals")} cr/nonempty search.`,
|
|
21735
22584
|
paid: true,
|
|
21736
22585
|
capabilities: ["signals"],
|
|
21737
22586
|
input: findSignalsInput
|
|
21738
22587
|
},
|
|
21739
22588
|
gtm_results: {
|
|
21740
22589
|
title: "Get results",
|
|
21741
|
-
description: "Free
|
|
22590
|
+
description: "Free rows, status, CSV.",
|
|
21742
22591
|
paid: false,
|
|
21743
22592
|
capabilities: [],
|
|
21744
22593
|
input: resultsInput
|
|
21745
22594
|
},
|
|
21746
22595
|
gtm_tools: {
|
|
21747
22596
|
title: "Other tools",
|
|
21748
|
-
description: "Search
|
|
22597
|
+
description: "Search/describe capabilities free; run with max_credits.",
|
|
21749
22598
|
paid: true,
|
|
21750
22599
|
capabilities: CAPABILITY_IDS,
|
|
21751
22600
|
input: toolsInput
|
|
21752
22601
|
},
|
|
21753
22602
|
gtm_workspace: {
|
|
21754
22603
|
title: "Workspace memory",
|
|
21755
|
-
description: "Free
|
|
22604
|
+
description: "Free ICP, exclusions and seen-lead memory.",
|
|
21756
22605
|
paid: false,
|
|
21757
22606
|
capabilities: [],
|
|
21758
22607
|
input: workspaceInput
|
|
21759
22608
|
},
|
|
21760
22609
|
gtm_account: {
|
|
21761
22610
|
title: "Account",
|
|
21762
|
-
description: "Free
|
|
22611
|
+
description: "Free balance, cap, spend, quote.",
|
|
21763
22612
|
paid: false,
|
|
21764
22613
|
capabilities: [],
|
|
21765
22614
|
input: accountInput
|
|
@@ -21768,7 +22617,6 @@ var OUTCOME_TOOLS = {
|
|
|
21768
22617
|
var OUTCOME_TOOL_NAMES = Object.keys(OUTCOME_TOOLS);
|
|
21769
22618
|
|
|
21770
22619
|
// ../contracts/src/agent-answer.ts
|
|
21771
|
-
var AGENT_ANSWER_MAX_BYTES = 1024;
|
|
21772
22620
|
var AGENT_PREVIEW_ROWS = 5;
|
|
21773
22621
|
var SUMMARY_MAX_WORDS = 24;
|
|
21774
22622
|
var SUMMARY_MAX_CHARS = 200;
|
|
@@ -21803,7 +22651,10 @@ var agentAnswerSchema = external_exports.object({
|
|
|
21803
22651
|
top_up: external_exports.object({ url: external_exports.string().max(256), credits: external_exports.number().int().positive() }).optional(),
|
|
21804
22652
|
replayed: external_exports.literal(true).optional(),
|
|
21805
22653
|
/** Lead searches: what was rejected and why the search stopped. */
|
|
21806
|
-
report: external_exports.string().max(240).optional()
|
|
22654
|
+
report: external_exports.string().max(240).optional(),
|
|
22655
|
+
estimate: leadEstimateSchema.optional(),
|
|
22656
|
+
/** Lead lists: found so far, target, credits spent and left, and whether it is still running. */
|
|
22657
|
+
progress: leadProgressSchema.optional()
|
|
21807
22658
|
}).strict();
|
|
21808
22659
|
var byteLength = (value) => new TextEncoder().encode(value).length;
|
|
21809
22660
|
var DEFAULT_NEXT = { tool: "gtm_account", args: {} };
|
|
@@ -21826,9 +22677,12 @@ function build(draft, rowCount, columnCount, cellMax) {
|
|
|
21826
22677
|
const allColumns = (draft.columns ?? Object.keys(draft.rows?.[0] ?? {})).slice(0, 6);
|
|
21827
22678
|
const columns = allColumns.slice(0, columnCount);
|
|
21828
22679
|
const rows = (draft.rows ?? []).slice(0, rowCount).map((row) => columns.map((column) => cell(row[column], cellMax)));
|
|
22680
|
+
const end = (draft.pageOffset ?? 0) + rows.length;
|
|
22681
|
+
const total = draft.total ?? draft.rows?.length ?? 0;
|
|
22682
|
+
const paging = draft.pageOffset !== void 0 && (draft.pageOffset > 0 || rows.length < (draft.rows?.length ?? 0));
|
|
21829
22683
|
return {
|
|
21830
22684
|
status: draft.status,
|
|
21831
|
-
summary: speakable(draft.summary),
|
|
22685
|
+
summary: paging && !draft.reason ? rows.length ? `Rows ${draft.pageOffset + 1} to ${end} of ${total}.` : `No rows after ${total}.` : speakable(draft.summary),
|
|
21832
22686
|
...draft.reason ? { reason: draft.reason.slice(0, 40) } : {},
|
|
21833
22687
|
run_id: draft.run_id ?? null,
|
|
21834
22688
|
cost: draft.cost ?? 0,
|
|
@@ -21839,16 +22693,19 @@ function build(draft, rowCount, columnCount, cellMax) {
|
|
|
21839
22693
|
label: (draft.label ?? "rows").slice(0, 24),
|
|
21840
22694
|
columns: rows.length ? columns : [],
|
|
21841
22695
|
rows,
|
|
21842
|
-
next: draft.next ?? DEFAULT_NEXT,
|
|
22696
|
+
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
22697
|
...draft.fields?.length ? { fields: draft.fields.slice(0, 12).map((field) => field.slice(0, 40)) } : {},
|
|
21844
22698
|
...draft.link ? { link: draft.link } : {},
|
|
21845
22699
|
...draft.top_up ? { top_up: draft.top_up } : {},
|
|
21846
22700
|
...draft.replayed ? { replayed: true } : {},
|
|
21847
|
-
...draft.report ? { report: draft.report.slice(0, 240) } : {}
|
|
22701
|
+
...draft.report ? { report: draft.report.slice(0, 240) } : {},
|
|
22702
|
+
...draft.estimate ? { estimate: draft.estimate } : {},
|
|
22703
|
+
...draft.progress ? { progress: draft.progress } : {}
|
|
21848
22704
|
};
|
|
21849
22705
|
}
|
|
21850
22706
|
var fits = (answer) => byteLength(JSON.stringify(answer)) <= AGENT_ANSWER_MAX_BYTES && byteLength(answerText(answer)) <= AGENT_ANSWER_MAX_BYTES;
|
|
21851
22707
|
function shapeAnswer(draft) {
|
|
22708
|
+
if ("kind" in draft) return leadPlanQuoteSchema.parse(draft);
|
|
21852
22709
|
const columnCount = Math.min(6, (draft.columns ?? Object.keys(draft.rows?.[0] ?? {})).length);
|
|
21853
22710
|
const next = draft.next ?? DEFAULT_NEXT;
|
|
21854
22711
|
for (let rowCount = AGENT_PREVIEW_ROWS; rowCount >= 1; rowCount -= 1) {
|
|
@@ -21881,6 +22738,8 @@ function answerLines(answer) {
|
|
|
21881
22738
|
if (answer.quote !== void 0) lines.push(`quote: ${answer.quote}`);
|
|
21882
22739
|
if (answer.replayed) lines.push("replayed: true");
|
|
21883
22740
|
if (answer.report) lines.push(`report: ${answer.report}`);
|
|
22741
|
+
if (answer.estimate) lines.push(`estimate: ${JSON.stringify(answer.estimate)}`);
|
|
22742
|
+
if (answer.progress) lines.push(`progress: ${progressText(answer.progress)}`);
|
|
21884
22743
|
if (answer.total || answer.rows.length) lines.push(`total: ${answer.total}`);
|
|
21885
22744
|
if (answer.rows.length) {
|
|
21886
22745
|
lines.push(`${answer.label}[${answer.rows.length}]{${answer.columns.join(",")}}:`);
|
|
@@ -21891,11 +22750,17 @@ function answerLines(answer) {
|
|
|
21891
22750
|
if (answer.top_up) lines.push(`top_up: ${answer.top_up.credits} credits at ${answer.top_up.url}`);
|
|
21892
22751
|
return lines;
|
|
21893
22752
|
}
|
|
22753
|
+
function progressText(progress) {
|
|
22754
|
+
const state = progress.state === "stopped" && progress.stop ? `stopped: ${progress.stop}` : progress.state;
|
|
22755
|
+
return `${progress.found} of ${progress.target} found, ${progress.spent} credits spent, ${progress.budget_left} left, ${state}`;
|
|
22756
|
+
}
|
|
21894
22757
|
function answerText(answer) {
|
|
22758
|
+
if ("kind" in answer) return leadPlanText(leadPlanQuoteSchema.parse(answer));
|
|
21895
22759
|
const lines = answerLines(answer);
|
|
21896
22760
|
if (answer.next) lines.push(`next: ${answer.next.tool}(${JSON.stringify(answer.next.args)})`);
|
|
21897
22761
|
return lines.join("\n");
|
|
21898
22762
|
}
|
|
22763
|
+
var agentResponseSchema = external_exports.union([agentAnswerSchema, leadPlanQuoteSchema]);
|
|
21899
22764
|
|
|
21900
22765
|
// ../contracts/src/device-code.ts
|
|
21901
22766
|
var USER_CODE_LENGTH = 8;
|
|
@@ -22238,7 +23103,7 @@ var lookupJobPendingSchema = external_exports.object({ status: external_exports.
|
|
|
22238
23103
|
// ../contracts/src/contact-pricing.ts
|
|
22239
23104
|
function contactCredits(options) {
|
|
22240
23105
|
const find = options.find ?? ["email"];
|
|
22241
|
-
return (find.includes("email") ?
|
|
23106
|
+
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
23107
|
}
|
|
22243
23108
|
|
|
22244
23109
|
// ../contracts/src/topup-chains.ts
|
|
@@ -22417,6 +23282,7 @@ var UsageError = class extends Error {
|
|
|
22417
23282
|
name = "UsageError";
|
|
22418
23283
|
};
|
|
22419
23284
|
var TOOL_COMMANDS = {
|
|
23285
|
+
gtm_watch: "watch",
|
|
22420
23286
|
gtm_find_contacts: "contacts",
|
|
22421
23287
|
gtm_build_list: "list",
|
|
22422
23288
|
gtm_research_company: "research",
|
|
@@ -22438,13 +23304,14 @@ var GLOBAL = {
|
|
|
22438
23304
|
var PAID = { "max-credits": { type: "string" }, "dry-run": { type: "boolean" }, "idempotency-key": { type: "string" } };
|
|
22439
23305
|
var FILTERS = { industry: { type: "string", multiple: true }, size: { type: "string", multiple: true } };
|
|
22440
23306
|
var SPECS = {
|
|
23307
|
+
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
23308
|
login: { "no-browser": { type: "boolean" } },
|
|
22442
23309
|
logout: {},
|
|
22443
23310
|
whoami: {},
|
|
22444
23311
|
"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 },
|
|
23312
|
+
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
23313
|
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 },
|
|
23314
|
+
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
23315
|
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
23316
|
research: { ...PAID },
|
|
22450
23317
|
signals: { location: { type: "string" }, company: { type: "string" }, ...FILTERS, page: { type: "string" }, limit: { type: "string" }, ...PAID },
|
|
@@ -22508,6 +23375,9 @@ var ARGUMENT_NAMES = {
|
|
|
22508
23375
|
like: "like_companies",
|
|
22509
23376
|
post: "post_urls",
|
|
22510
23377
|
domain: "domains",
|
|
23378
|
+
hiring: "role",
|
|
23379
|
+
source: "sources",
|
|
23380
|
+
watch: "watch_id",
|
|
22511
23381
|
profile: "profiles"
|
|
22512
23382
|
};
|
|
22513
23383
|
function argumentFlag(key) {
|
|
@@ -22521,6 +23391,25 @@ function build2(name, values, positionals) {
|
|
|
22521
23391
|
if (positionals.length) throw new UsageError(message, name);
|
|
22522
23392
|
};
|
|
22523
23393
|
switch (name) {
|
|
23394
|
+
case "watch": {
|
|
23395
|
+
const [action, id, ...extra] = positionals;
|
|
23396
|
+
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);
|
|
23397
|
+
const mutating = ["show", "pause", "resume", "delete"].includes(action) || action.startsWith("webhook_");
|
|
23398
|
+
if (mutating && !id || !mutating && id) throw new UsageError("Show, pause, resume and delete take one watch id; other actions take flags.", name);
|
|
23399
|
+
const file2 = str(values, "file"), column = str(values, "column");
|
|
23400
|
+
if (file2 && values.company) throw new UsageError("Give --company or --file, not both.", name);
|
|
23401
|
+
if (column && !file2) throw new UsageError("--column needs --file.", name);
|
|
23402
|
+
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);
|
|
23403
|
+
const topic = str(values, "topic"), sources = values.source;
|
|
23404
|
+
if (topic === void 0 && sources) throw new UsageError("--source needs --topic.", name);
|
|
23405
|
+
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);
|
|
23406
|
+
const chosen = sources ? sources.flatMap((source) => source === "both" ? ["x", "reddit"] : [source]) : ["x", "reddit"];
|
|
23407
|
+
if (chosen.some((source) => source !== "x" && source !== "reddit")) throw new UsageError("Use --source x, --source reddit or --source both.", name);
|
|
23408
|
+
if (action !== "changes" && ["new", "csv", "since", "watch"].some((flag) => values[flag] !== void 0)) throw new UsageError("Feed flags need gtm watch changes.", name);
|
|
23409
|
+
if (values.new && values.since !== void 0) throw new UsageError("Use --new or --since, not both.", name);
|
|
23410
|
+
const since = int2(values, "since", name), offset = int2(values, "offset", name);
|
|
23411
|
+
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 } : {} };
|
|
23412
|
+
}
|
|
22524
23413
|
case "login":
|
|
22525
23414
|
none("gtm login takes no arguments.");
|
|
22526
23415
|
return { kind: "login", browser: values["no-browser"] !== true };
|
|
@@ -22536,6 +23425,8 @@ function build2(name, values, positionals) {
|
|
|
22536
23425
|
case "contacts": {
|
|
22537
23426
|
const file2 = str(values, "file");
|
|
22538
23427
|
const runId = str(values, "run-id");
|
|
23428
|
+
const target2 = int2(values, "target", name);
|
|
23429
|
+
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
23430
|
if (file2 !== void 0 && positionals.length) throw new UsageError("Give profiles or --file, not both.", name);
|
|
22540
23431
|
if (runId !== void 0 && (file2 !== void 0 || positionals.length)) throw new UsageError("Give --run-id on its own, without profiles or --file.", name);
|
|
22541
23432
|
if (values.column !== void 0 && file2 === void 0) throw new UsageError("--column needs --file.", name);
|
|
@@ -22543,6 +23434,7 @@ function build2(name, values, positionals) {
|
|
|
22543
23434
|
const args = {
|
|
22544
23435
|
...positionals.length ? { people: positionals } : {},
|
|
22545
23436
|
...runId !== void 0 ? { run_id: runId } : {},
|
|
23437
|
+
...target2 !== void 0 ? { target: target2 } : {},
|
|
22546
23438
|
...find?.length ? { find } : {},
|
|
22547
23439
|
...values.verify ? { verify: true } : {},
|
|
22548
23440
|
...paid(values, name)
|
|
@@ -22559,10 +23451,10 @@ function build2(name, values, positionals) {
|
|
|
22559
23451
|
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
23452
|
}
|
|
22561
23453
|
case "leads": {
|
|
22562
|
-
none("gtm leads takes flags only, like --titles 'Head of Sales' --target
|
|
22563
|
-
const
|
|
23454
|
+
none("gtm leads takes flags only, like --titles 'Head of Sales' --target N.");
|
|
23455
|
+
const target2 = int2(values, "target", name);
|
|
22564
23456
|
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 } : {}, ...
|
|
23457
|
+
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
23458
|
}
|
|
22567
23459
|
case "workspace": {
|
|
22568
23460
|
const action = positionals[0] ?? "get";
|
|
@@ -22659,12 +23551,27 @@ function commandArgv(next) {
|
|
|
22659
23551
|
if (value !== void 0) words.push(...(Array.isArray(value) ? value : [value]).map(String));
|
|
22660
23552
|
};
|
|
22661
23553
|
switch (tool2) {
|
|
23554
|
+
case "gtm_watch": {
|
|
23555
|
+
const action = take("action");
|
|
23556
|
+
push(action);
|
|
23557
|
+
if (["pause", "resume", "delete"].includes(String(action)) || String(action).startsWith("webhook_")) push(take("watch_id"));
|
|
23558
|
+
const companies = take("companies");
|
|
23559
|
+
if (Array.isArray(companies)) for (const company of companies) words.push("--company", String(company));
|
|
23560
|
+
if (action === "create" && args.quote_id !== void 0 && args.max_credits !== void 0) args.yes = true;
|
|
23561
|
+
break;
|
|
23562
|
+
}
|
|
22662
23563
|
case "gtm_find_contacts":
|
|
22663
23564
|
push(take("people"));
|
|
22664
23565
|
break;
|
|
22665
23566
|
case "gtm_research_company":
|
|
22666
23567
|
push(take("company"));
|
|
22667
23568
|
break;
|
|
23569
|
+
// `gtm list` takes many companies as repeated --company flags.
|
|
23570
|
+
case "gtm_build_list": {
|
|
23571
|
+
const companies = take("companies");
|
|
23572
|
+
if (Array.isArray(companies)) for (const company of companies) words.push("--company", String(company));
|
|
23573
|
+
break;
|
|
23574
|
+
}
|
|
22668
23575
|
case "gtm_find_signals":
|
|
22669
23576
|
push(take("role"));
|
|
22670
23577
|
break;
|
|
@@ -22706,13 +23613,13 @@ function commandFor(next) {
|
|
|
22706
23613
|
var FileInputError = class extends Error {
|
|
22707
23614
|
name = "FileInputError";
|
|
22708
23615
|
};
|
|
22709
|
-
function parseCsv(
|
|
23616
|
+
function parseCsv(text5) {
|
|
22710
23617
|
const rows = [];
|
|
22711
23618
|
let row = [];
|
|
22712
23619
|
let cell2 = "";
|
|
22713
23620
|
let quoted = false;
|
|
22714
23621
|
let started = false;
|
|
22715
|
-
const source =
|
|
23622
|
+
const source = text5.charCodeAt(0) === 65279 ? text5.slice(1) : text5;
|
|
22716
23623
|
const endRow = () => {
|
|
22717
23624
|
row.push(cell2);
|
|
22718
23625
|
rows.push(row);
|
|
@@ -22757,8 +23664,8 @@ var HEADER_WORDS = /^(linkedin|linkedin[ _-]?(url|profile|profile[ _-]?url|handl
|
|
|
22757
23664
|
function profileOf(value) {
|
|
22758
23665
|
return cliProfileUrl(value);
|
|
22759
23666
|
}
|
|
22760
|
-
function profilesFromCsv(
|
|
22761
|
-
const table = parseCsv(
|
|
23667
|
+
function profilesFromCsv(text5, column) {
|
|
23668
|
+
const table = parseCsv(text5).filter((row) => row.some((cell2) => cell2.trim() !== ""));
|
|
22762
23669
|
if (!table.length) throw new FileInputError("The file has no rows.");
|
|
22763
23670
|
const first = table[0];
|
|
22764
23671
|
const width = Math.max(...table.map((row) => row.length));
|
|
@@ -22797,13 +23704,13 @@ function profilesFromCsv(text4, column) {
|
|
|
22797
23704
|
}
|
|
22798
23705
|
return list;
|
|
22799
23706
|
}
|
|
22800
|
-
function peopleFromCsv(
|
|
22801
|
-
if (names === "only") return { ...nameListAsProfiles(namesFromCsv(
|
|
23707
|
+
function peopleFromCsv(text5, column, names) {
|
|
23708
|
+
if (names === "only") return { ...nameListAsProfiles(namesFromCsv(text5)), named: true };
|
|
22802
23709
|
try {
|
|
22803
|
-
return { ...profilesFromCsv(
|
|
23710
|
+
return { ...profilesFromCsv(text5, column), named: false };
|
|
22804
23711
|
} catch (error61) {
|
|
22805
23712
|
if (names === "never" || column !== void 0 || !(error61 instanceof FileInputError)) throw error61;
|
|
22806
|
-
return { ...nameListAsProfiles(namesFromCsv(
|
|
23713
|
+
return { ...nameListAsProfiles(namesFromCsv(text5)), named: true };
|
|
22807
23714
|
}
|
|
22808
23715
|
}
|
|
22809
23716
|
function nameListAsProfiles(list) {
|
|
@@ -22818,8 +23725,8 @@ function namePair(person) {
|
|
|
22818
23725
|
if (typeof person === "string") throw new TypeError("Expected a name and company pair");
|
|
22819
23726
|
return person;
|
|
22820
23727
|
}
|
|
22821
|
-
function namesFromCsv(
|
|
22822
|
-
const table = parseCsv(
|
|
23728
|
+
function namesFromCsv(text5) {
|
|
23729
|
+
const table = parseCsv(text5).filter((row) => row.some((cell2) => cell2.trim() !== ""));
|
|
22823
23730
|
if (!table.length) throw new FileInputError("The file has no rows.");
|
|
22824
23731
|
const header = table[0].map((cell2) => cell2.trim());
|
|
22825
23732
|
const find = (pattern) => header.findIndex((cell2) => pattern.test(cell2));
|
|
@@ -22850,6 +23757,121 @@ function namesFromCsv(text4) {
|
|
|
22850
23757
|
return list;
|
|
22851
23758
|
}
|
|
22852
23759
|
|
|
23760
|
+
// src/watch.ts
|
|
23761
|
+
async function watchCommand(session, command) {
|
|
23762
|
+
const args = { ...command.args };
|
|
23763
|
+
if (args.action === "create") {
|
|
23764
|
+
if (command.file) {
|
|
23765
|
+
const [headers = [], ...rows] = parseCsv(
|
|
23766
|
+
await session.readInput(command.file, "watch")
|
|
23767
|
+
);
|
|
23768
|
+
const column = command.column ?? headers.find(
|
|
23769
|
+
(h) => ["domain", "company_domain", "website"].includes(h.toLowerCase())
|
|
23770
|
+
);
|
|
23771
|
+
const at = column ? headers.indexOf(column) : -1;
|
|
23772
|
+
if (at < 0)
|
|
23773
|
+
throw new UsageError(
|
|
23774
|
+
"Company CSV needs a domain column, or --column NAME.",
|
|
23775
|
+
"watch"
|
|
23776
|
+
);
|
|
23777
|
+
args.companies = rows.map((row) => row[at]?.trim()).filter(Boolean);
|
|
23778
|
+
}
|
|
23779
|
+
const validated = args.signal === "topic" ? topicWatchQuote.safeParse({ name: args.name, signal: "topic", topic: args.topic, sources: args.sources }) : hiringWatchQuote.safeParse({
|
|
23780
|
+
name: args.name,
|
|
23781
|
+
companies: args.companies,
|
|
23782
|
+
...args.role ? { role: args.role } : {},
|
|
23783
|
+
...args.signal ? { signal: args.signal } : {}
|
|
23784
|
+
});
|
|
23785
|
+
if (!validated.success)
|
|
23786
|
+
throw new UsageError(
|
|
23787
|
+
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.",
|
|
23788
|
+
"watch"
|
|
23789
|
+
);
|
|
23790
|
+
Object.assign(args, validated.data);
|
|
23791
|
+
const figures = watchQuoteFigures(args.signal ?? "hiring", Array.isArray(args.companies) ? args.companies.length : 0);
|
|
23792
|
+
const asked = await session.gateway.call("gtm_watch", {
|
|
23793
|
+
...args,
|
|
23794
|
+
dry_run: true
|
|
23795
|
+
});
|
|
23796
|
+
const quote2 = asked.status === "quote" ? {
|
|
23797
|
+
...asked,
|
|
23798
|
+
next: {
|
|
23799
|
+
tool: "gtm_watch",
|
|
23800
|
+
args: {
|
|
23801
|
+
action: "create",
|
|
23802
|
+
quote_id: asked.run_id,
|
|
23803
|
+
name: args.name,
|
|
23804
|
+
...args.signal === "topic" ? { signal: "topic", topic: args.topic, sources: args.sources } : {
|
|
23805
|
+
...command.file ? { file: command.file, ...command.column ? { column: command.column } : {} } : { companies: args.companies },
|
|
23806
|
+
...args.role ? { role: args.role } : {},
|
|
23807
|
+
...args.signal && args.signal !== "hiring" ? { signal: args.signal } : {}
|
|
23808
|
+
},
|
|
23809
|
+
max_credits: args.max_credits ?? Math.min(figures.perCheck, HIRING_WATCH_POLICY.maxMonthlyCredits)
|
|
23810
|
+
}
|
|
23811
|
+
}
|
|
23812
|
+
} : asked;
|
|
23813
|
+
if (quote2.status !== "quote" || args.dry_run || args.max_credits === void 0)
|
|
23814
|
+
return session.emit(quote2);
|
|
23815
|
+
session.emit(quote2, {}, { stream: "stderr" });
|
|
23816
|
+
if (!command.yes && !await session.io.confirm?.(
|
|
23817
|
+
`Create this watch with a monthly limit of ${args.max_credits} credits?`
|
|
23818
|
+
)) {
|
|
23819
|
+
return session.emit(
|
|
23820
|
+
shapeAnswer({
|
|
23821
|
+
status: "refused",
|
|
23822
|
+
reason: "confirmation_required",
|
|
23823
|
+
summary: "No watch saved; repeat with --yes to agree to this monthly limit.",
|
|
23824
|
+
balance: quote2.balance,
|
|
23825
|
+
next: { tool: "gtm_watch", args: { action: "list" } }
|
|
23826
|
+
})
|
|
23827
|
+
);
|
|
23828
|
+
}
|
|
23829
|
+
return session.emit(
|
|
23830
|
+
await session.gateway.call("gtm_watch", {
|
|
23831
|
+
...args,
|
|
23832
|
+
dry_run: false,
|
|
23833
|
+
quote_id: quote2.run_id
|
|
23834
|
+
})
|
|
23835
|
+
);
|
|
23836
|
+
}
|
|
23837
|
+
const key = createHash("sha256").update(
|
|
23838
|
+
JSON.stringify([session.apiUrl, session.token, args.watch_id ?? "all"])
|
|
23839
|
+
).digest("hex");
|
|
23840
|
+
if (args.action === "changes" && command.fresh)
|
|
23841
|
+
args.since = await session.store.loadWatchCursor(key);
|
|
23842
|
+
if (args.action === "changes" && command.csv) {
|
|
23843
|
+
let cursor = Number(args.since ?? 0), header;
|
|
23844
|
+
const output2 = [];
|
|
23845
|
+
for (; ; ) {
|
|
23846
|
+
const page = await session.gateway.watchCsv(
|
|
23847
|
+
cursor,
|
|
23848
|
+
typeof args.watch_id === "string" ? args.watch_id : void 0
|
|
23849
|
+
);
|
|
23850
|
+
const [columns = [], ...rows] = parseCsv(page.csv);
|
|
23851
|
+
header ??= columns;
|
|
23852
|
+
output2.push(...rows);
|
|
23853
|
+
if (page.more && page.cursor <= cursor)
|
|
23854
|
+
throw new UsageError(
|
|
23855
|
+
"Watch export did not advance its cursor.",
|
|
23856
|
+
"watch"
|
|
23857
|
+
);
|
|
23858
|
+
cursor = page.cursor;
|
|
23859
|
+
if (!page.more) break;
|
|
23860
|
+
}
|
|
23861
|
+
session.io.stdout(toCsv([header ?? [], ...output2]));
|
|
23862
|
+
if (command.fresh) await session.store.saveWatchCursor(key, cursor);
|
|
23863
|
+
return 0;
|
|
23864
|
+
}
|
|
23865
|
+
const answer = await session.gateway.call("gtm_watch", args);
|
|
23866
|
+
const result = session.emit(answer);
|
|
23867
|
+
if (args.action === "changes" && command.fresh && ["completed", "not_found"].includes(answer.status)) {
|
|
23868
|
+
const cursor = answer.next.args.since;
|
|
23869
|
+
if (typeof cursor === "number")
|
|
23870
|
+
await session.store.saveWatchCursor(key, cursor);
|
|
23871
|
+
}
|
|
23872
|
+
return result;
|
|
23873
|
+
}
|
|
23874
|
+
|
|
22853
23875
|
// src/file-rows.ts
|
|
22854
23876
|
var FILE_ROW_FALLBACK = {
|
|
22855
23877
|
columns: ["name", "title", "email", "verdict", "url", "status"],
|
|
@@ -22859,7 +23881,7 @@ var FILE_ROW_FALLBACK = {
|
|
|
22859
23881
|
};
|
|
22860
23882
|
|
|
22861
23883
|
// src/file-batches.ts
|
|
22862
|
-
import { createHash } from "node:crypto";
|
|
23884
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
22863
23885
|
async function quote(session, profiles, perCall, tool2) {
|
|
22864
23886
|
let total = 0;
|
|
22865
23887
|
let balance = null;
|
|
@@ -22872,16 +23894,16 @@ async function quote(session, profiles, perCall, tool2) {
|
|
|
22872
23894
|
return { quote: total, balance };
|
|
22873
23895
|
}
|
|
22874
23896
|
function batchKey(base, args) {
|
|
22875
|
-
const hash2 =
|
|
23897
|
+
const hash2 = createHash2("sha256").update(JSON.stringify(args)).digest("hex");
|
|
22876
23898
|
if (!base) return `gtm-file-${hash2.slice(0, 32)}`;
|
|
22877
23899
|
const key = `${base}-${hash2.slice(0, 16)}`;
|
|
22878
|
-
return key.length <= 128 ? key : `gtm-${
|
|
23900
|
+
return key.length <= 128 ? key : `gtm-${createHash2("sha256").update(key).digest("hex").slice(0, 40)}`;
|
|
22879
23901
|
}
|
|
22880
23902
|
function runIdsOf(run) {
|
|
22881
23903
|
return [run, ...run.recovery ? [run.recovery] : []].flatMap((part) => part.batches.map((batch) => batch.answer.run_id).filter((id) => !!id));
|
|
22882
23904
|
}
|
|
22883
23905
|
function retryKey(key, runId) {
|
|
22884
|
-
return `gtm-retry-${
|
|
23906
|
+
return `gtm-retry-${createHash2("sha256").update(`${key}|${runId}`).digest("hex").slice(0, 40)}`;
|
|
22885
23907
|
}
|
|
22886
23908
|
async function runBatches(session, profiles, perCall, budget, tool2, baseKey) {
|
|
22887
23909
|
const perPerson = tool2.perPerson;
|
|
@@ -22953,7 +23975,7 @@ async function collectRows(session, batches, fallback) {
|
|
|
22953
23975
|
async function recoverErroredRows(session, run, table, perCall, tool2, budgetLeft) {
|
|
22954
23976
|
const errored = table.rows.filter((row) => row.status === "error" && row.url).map((row) => row.url);
|
|
22955
23977
|
if (!errored.length || run.stop) return;
|
|
22956
|
-
const keyBase = `gtm-retry-${
|
|
23978
|
+
const keyBase = `gtm-retry-${createHash2("sha256").update(runIdsOf(run).join(",")).digest("hex").slice(0, 32)}`;
|
|
22957
23979
|
const retry = await runBatches(session, errored, perCall, budgetLeft, tool2, keyBase);
|
|
22958
23980
|
run.recovery = retry;
|
|
22959
23981
|
const again = retry.batches.length && !retry.running ? await collectRows(session, retry.batches, FILE_ROW_FALLBACK) : null;
|
|
@@ -22991,6 +24013,20 @@ function exitCode(answer) {
|
|
|
22991
24013
|
}
|
|
22992
24014
|
function renderText(answer, fields = {}) {
|
|
22993
24015
|
const lines = answerLines(answer);
|
|
24016
|
+
if (answer.estimate) {
|
|
24017
|
+
const estimate = answer.estimate;
|
|
24018
|
+
const index = lines.findIndex((line) => line.startsWith("estimate:"));
|
|
24019
|
+
lines.splice(
|
|
24020
|
+
index,
|
|
24021
|
+
1,
|
|
24022
|
+
`target: ${estimate.target ?? "ask the user"}`,
|
|
24023
|
+
`credits_without_recheck: ${estimate.credits ? `expected ${estimate.credits[0]}, ceiling ${estimate.credits[1]}` : "choose a target"}`,
|
|
24024
|
+
`credits_with_recheck: ${estimate.with_recheck ? `expected ${estimate.with_recheck[0]}, ceiling ${estimate.with_recheck[1]}` : "choose a target"}`,
|
|
24025
|
+
`cap_remaining: ${estimate.cap_remaining}`,
|
|
24026
|
+
`affordable_target: ${estimate.affordable_target} (${estimate.affordable_with_recheck} with recheck)`,
|
|
24027
|
+
`email_price: ${estimate.email_credits} credits, live check included; optional recheck ${estimate.recheck_credits}`
|
|
24028
|
+
);
|
|
24029
|
+
}
|
|
22994
24030
|
for (const [key, value] of Object.entries(fields)) {
|
|
22995
24031
|
if (value === void 0) continue;
|
|
22996
24032
|
lines.push(Array.isArray(value) ? `${key}[${value.length}]: ${value.join(",")}` : `${key}: ${String(value)}`);
|
|
@@ -23125,7 +24161,7 @@ async function combined(session, command, run, total, budget, rerun, fileFields)
|
|
|
23125
24161
|
const wantsEmail = find.includes("email");
|
|
23126
24162
|
const wantsPhone = find.includes("phone");
|
|
23127
24163
|
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);
|
|
24164
|
+
const verdicts = ["verified", "deliverable", "invalid"].map((verdict) => [verdict, table?.rows.filter((row) => row.verdict === verdict).length ?? 0]).filter(([, n2]) => n2 > 0);
|
|
23129
24165
|
let summary;
|
|
23130
24166
|
if (run.running) {
|
|
23131
24167
|
summary = `Batch ${batches.length} is still running after ${sent} of ${total} people; rerun this command to wait and continue.`;
|
|
@@ -23275,7 +24311,7 @@ async function toolFile(session, command) {
|
|
|
23275
24311
|
import { randomUUID } from "node:crypto";
|
|
23276
24312
|
|
|
23277
24313
|
// src/version.ts
|
|
23278
|
-
var VERSION = "0.1.
|
|
24314
|
+
var VERSION = "0.1.9";
|
|
23279
24315
|
|
|
23280
24316
|
// src/gateway.ts
|
|
23281
24317
|
var CliError = class extends Error {
|
|
@@ -23315,9 +24351,9 @@ var RATE_LIMIT_RETRIES = 3;
|
|
|
23315
24351
|
var TRANSIENT_RETRIES = 3;
|
|
23316
24352
|
var TRANSIENT_STATUSES = /* @__PURE__ */ new Set([500, 502, 503, 504]);
|
|
23317
24353
|
var Gateway = class {
|
|
23318
|
-
constructor(apiUrl,
|
|
24354
|
+
constructor(apiUrl, token2, io) {
|
|
23319
24355
|
this.apiUrl = apiUrl;
|
|
23320
|
-
this.token =
|
|
24356
|
+
this.token = token2;
|
|
23321
24357
|
this.io = io;
|
|
23322
24358
|
}
|
|
23323
24359
|
apiUrl;
|
|
@@ -23329,6 +24365,15 @@ var Gateway = class {
|
|
|
23329
24365
|
* call is safe to resend: free tools and quotes change nothing, and a paid
|
|
23330
24366
|
* run always carries an idempotency key, one-off when none was given.
|
|
23331
24367
|
*/
|
|
24368
|
+
async watchCsv(since, watch) {
|
|
24369
|
+
if (!this.token) throw new CliError("not_signed_in", "Not signed in; run gtm login.");
|
|
24370
|
+
const query = new URLSearchParams({ since: String(since), ...watch ? { watch_id: watch } : {} });
|
|
24371
|
+
const { response } = await this.send(`/v1/agent/watches/changes.csv?${query}`, { headers: { authorization: `Bearer ${this.token}` } }, "safe");
|
|
24372
|
+
if (!response.ok) throw await this.failure(response);
|
|
24373
|
+
const cursor = Number(response.headers.get("x-gtm-cursor"));
|
|
24374
|
+
if (!Number.isSafeInteger(cursor) || cursor < since) throw new CliError("invalid_response", "Invalid watch cursor.");
|
|
24375
|
+
return { csv: await response.text(), cursor, more: response.headers.get("x-gtm-more") === "true" };
|
|
24376
|
+
}
|
|
23332
24377
|
async call(tool2, args) {
|
|
23333
24378
|
if (!this.token) throw new CliError("not_signed_in", "Not signed in; run gtm login.");
|
|
23334
24379
|
const ownKey = args.max_credits !== void 0 && args.dry_run !== true && args.idempotency_key === void 0 ? `gtm-${randomUUID()}` : null;
|
|
@@ -23336,7 +24381,7 @@ var Gateway = class {
|
|
|
23336
24381
|
const replay = keyed || args.dry_run === true || args.max_credits === void 0 ? "safe" : "once";
|
|
23337
24382
|
const { response, resent } = await this.send(`/v1/agent/tools/${tool2}`, {
|
|
23338
24383
|
method: "POST",
|
|
23339
|
-
headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", accept: "application/json" },
|
|
24384
|
+
headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", accept: "application/json", [LEAD_PLAN_VERSION_HEADER]: String(AGENT_RESPONSE_VERSION) },
|
|
23340
24385
|
body: JSON.stringify(ownKey ? { ...args, idempotency_key: ownKey } : args)
|
|
23341
24386
|
}, replay);
|
|
23342
24387
|
if (!response.ok) throw await this.failure(response);
|
|
@@ -23470,6 +24515,7 @@ var DEPLOYMENT = {
|
|
|
23470
24515
|
telemetry: TELEMETRY_ROUTES,
|
|
23471
24516
|
agentGateway: { webFlag: "PUBLIC_AGENT_GATEWAY", webValue: "1", runtimeFlag: "AGENT_GATEWAY_ENABLED", runtimeValue: "true" },
|
|
23472
24517
|
cache: { productionMode: "live", namespacePrefix: "mode:", historicalLiveNamespace: "mode:live:blitz" },
|
|
24518
|
+
watchWorkflow: { binding: "GTM_WATCH_WORKFLOW", name: "gtm-hiring-watches", class_name: "GtmWatchWorkflow" },
|
|
23473
24519
|
keeper: {
|
|
23474
24520
|
crons: ["0 * * * *"],
|
|
23475
24521
|
rpcUrls: BASE_RPC_URLS,
|
|
@@ -23519,6 +24565,10 @@ var COMMON = [
|
|
|
23519
24565
|
];
|
|
23520
24566
|
var tool = (name) => `${OUTCOME_TOOLS[name].description} (Agent tool: ${name}.)`;
|
|
23521
24567
|
var TOPICS = {
|
|
24568
|
+
watch: {
|
|
24569
|
+
summary: "Company and topic watches; quote first, charge only changes",
|
|
24570
|
+
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", " gtm watch webhook_set ID --url https://hooks.acme.com/signals Save or replace the address; prints a signing secret once", " gtm watch webhook_show ID Show the address and whether delivery is active or failing; never the secret", " gtm watch webhook_test ID Send a signed test delivery that carries no changes", " gtm watch webhook_rotate ID Make a new signing secret, printed once", " gtm watch webhook_remove ID Stop delivering to the address", "", "Webhook deliveries and tests use no credits. Setup and signature check: docs/watch-webhooks.md.", "", 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."]
|
|
24571
|
+
},
|
|
23522
24572
|
login: {
|
|
23523
24573
|
summary: "Sign in with a code you confirm in the browser",
|
|
23524
24574
|
lines: [
|
|
@@ -23549,9 +24599,10 @@ var TOPICS = {
|
|
|
23549
24599
|
"Usage:",
|
|
23550
24600
|
" gtm contacts <profile>... --max-credits N [--verify] [--find email,phone]",
|
|
23551
24601
|
" gtm contacts --file leads.csv --max-credits N [--column NAME] [--verify] [--out enriched.csv]",
|
|
23552
|
-
" gtm contacts --run-id RUN --max-credits N",
|
|
24602
|
+
" gtm contacts --run-id RUN --target N --max-credits N",
|
|
23553
24603
|
"",
|
|
23554
24604
|
tool("gtm_find_contacts"),
|
|
24605
|
+
`${CAPABILITIES["email-finder"].price.credits} ${creditWord(CAPABILITIES["email-finder"].price.credits)} per email found, including the live mailbox check.`,
|
|
23555
24606
|
"",
|
|
23556
24607
|
"Options:",
|
|
23557
24608
|
" --file PATH CSV or plain list of LinkedIn profile URLs or handles, any length;",
|
|
@@ -23559,7 +24610,8 @@ var TOPICS = {
|
|
|
23559
24610
|
" --column NAME Column holding the profiles, when the CLI cannot tell",
|
|
23560
24611
|
" --run-id RUN The people from a gtm list run",
|
|
23561
24612
|
" --find email,phone What to find (default email)",
|
|
23562
|
-
" --verify
|
|
24613
|
+
" --verify Optional extra recheck; finding already includes the live check",
|
|
24614
|
+
" --target N Required count to enrich from --run-id",
|
|
23563
24615
|
" --out PATH Write every row to a CSV file when done",
|
|
23564
24616
|
...PAID2,
|
|
23565
24617
|
"",
|
|
@@ -23596,11 +24648,13 @@ var TOPICS = {
|
|
|
23596
24648
|
summary: "Find a target number of new leads with emails and why each fits",
|
|
23597
24649
|
lines: [
|
|
23598
24650
|
"Usage:",
|
|
23599
|
-
" gtm leads --titles 'Head of Sales' --industry SaaS --size 20-99 --location 'United States' --target
|
|
23600
|
-
" gtm leads --hiring-role 'Founding SDR' --industry SaaS --size 5-99 --target
|
|
23601
|
-
" gtm leads --funded | --like vercel.com | --post <linkedin post url> ... --target
|
|
24651
|
+
" gtm leads --titles 'Head of Sales' --industry SaaS --size 20-99 --location 'United States' --target N --dry-run",
|
|
24652
|
+
" gtm leads --hiring-role 'Founding SDR' --industry SaaS --size 5-99 --target N --max-credits B",
|
|
24653
|
+
" gtm leads --funded | --like vercel.com | --post <linkedin post url> ... --target N --max-credits B",
|
|
23602
24654
|
"",
|
|
23603
24655
|
tool("gtm_find_leads"),
|
|
24656
|
+
"Missing --target asks for a count for free, even with a budget. --dry-run shows costs, balance, cap and affordable volume.",
|
|
24657
|
+
"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
24658
|
"",
|
|
23605
24659
|
"Options:",
|
|
23606
24660
|
" --titles TITLE Job titles of the people to reach; repeat for up to 5",
|
|
@@ -23612,7 +24666,8 @@ var TOPICS = {
|
|
|
23612
24666
|
" --funded Signal: companies that just raised",
|
|
23613
24667
|
" --like DOMAIN Signal: companies similar to this one; repeat for up to 5",
|
|
23614
24668
|
" --post URL Signal: people engaging with this LinkedIn post; repeat for up to 5",
|
|
23615
|
-
" --target N Leads with emails
|
|
24669
|
+
" --target N Leads with emails the user wants; required to run",
|
|
24670
|
+
" --verify Optional extra paid recheck of found emails",
|
|
23616
24671
|
" --max-per-company N Default 2",
|
|
23617
24672
|
...PAID2
|
|
23618
24673
|
]
|
|
@@ -23796,26 +24851,26 @@ function failed(reason, summary) {
|
|
|
23796
24851
|
return shapeAnswer({ status: "error", reason, summary, next: LOGIN_NEXT });
|
|
23797
24852
|
}
|
|
23798
24853
|
async function authHeader(session) {
|
|
23799
|
-
const { io, token, apiUrl } = session;
|
|
23800
|
-
if (!
|
|
24854
|
+
const { io, token: token2, apiUrl } = session;
|
|
24855
|
+
if (!token2) {
|
|
23801
24856
|
io.stderr("Not signed in; run gtm login.\n");
|
|
23802
24857
|
return 1;
|
|
23803
24858
|
}
|
|
23804
|
-
const
|
|
23805
|
-
if (
|
|
23806
|
-
io.stderr(`Refusing to send this login to ${
|
|
24859
|
+
const target2 = io.env.CLAUDE_CODE_MCP_SERVER_URL;
|
|
24860
|
+
if (target2 && !sameService(target2, apiUrl)) {
|
|
24861
|
+
io.stderr(`Refusing to send this login to ${target2}; it belongs to ${apiUrl}.
|
|
23807
24862
|
`);
|
|
23808
24863
|
return 1;
|
|
23809
24864
|
}
|
|
23810
|
-
io.stdout(`${JSON.stringify({ Authorization: `Bearer ${
|
|
24865
|
+
io.stdout(`${JSON.stringify({ Authorization: `Bearer ${token2}` })}
|
|
23811
24866
|
`);
|
|
23812
24867
|
return 0;
|
|
23813
24868
|
}
|
|
23814
|
-
function sameService(
|
|
24869
|
+
function sameService(target2, apiUrl) {
|
|
23815
24870
|
let url2;
|
|
23816
24871
|
let api;
|
|
23817
24872
|
try {
|
|
23818
|
-
url2 = new URL(
|
|
24873
|
+
url2 = new URL(target2);
|
|
23819
24874
|
api = new URL(apiUrl);
|
|
23820
24875
|
} catch {
|
|
23821
24876
|
return false;
|
|
@@ -23841,7 +24896,7 @@ function longTimeout(callback, ms) {
|
|
|
23841
24896
|
return () => clearTimeout(timer);
|
|
23842
24897
|
}
|
|
23843
24898
|
async function pollUntil(options) {
|
|
23844
|
-
const { policy, signal, read, isDone } = options;
|
|
24899
|
+
const { policy, signal: signal2, read, isDone } = options;
|
|
23845
24900
|
if (!Number.isFinite(policy.maxDurationMs) && !Number.isFinite(policy.maxAttempts)) throw new Error("Polling requires a finite limit.");
|
|
23846
24901
|
const now = options.now ?? Date.now;
|
|
23847
24902
|
const deadline = now() + (policy.maxDurationMs ?? Infinity);
|
|
@@ -23862,8 +24917,8 @@ async function pollUntil(options) {
|
|
|
23862
24917
|
stop = "cancelled";
|
|
23863
24918
|
interrupt();
|
|
23864
24919
|
};
|
|
23865
|
-
|
|
23866
|
-
if (
|
|
24920
|
+
signal2?.addEventListener("abort", abort, { once: true });
|
|
24921
|
+
if (signal2?.aborted) abort();
|
|
23867
24922
|
const acceptLate = policy.acceptLateRead === true;
|
|
23868
24923
|
if (policy.maxDurationMs !== void 0 && !acceptLate) cancelDeadline = longTimeout(() => {
|
|
23869
24924
|
stop = "limit";
|
|
@@ -23917,7 +24972,7 @@ async function pollUntil(options) {
|
|
|
23917
24972
|
} finally {
|
|
23918
24973
|
cancelDeadline?.();
|
|
23919
24974
|
clearTimeout(sleepTimer);
|
|
23920
|
-
|
|
24975
|
+
signal2?.removeEventListener("abort", abort);
|
|
23921
24976
|
}
|
|
23922
24977
|
}
|
|
23923
24978
|
|
|
@@ -23935,6 +24990,15 @@ var CredentialStore = class {
|
|
|
23935
24990
|
this.dir = dir;
|
|
23936
24991
|
}
|
|
23937
24992
|
dir;
|
|
24993
|
+
async loadWatchCursor(key) {
|
|
24994
|
+
if (!/^[a-f0-9]{64}$/.test(key)) throw new Error("invalid cursor key");
|
|
24995
|
+
const saved = await this.read(`watch-${key}.json`, (value) => Number.isSafeInteger(value.cursor) && Number(value.cursor) >= 0);
|
|
24996
|
+
return saved?.cursor ?? 0;
|
|
24997
|
+
}
|
|
24998
|
+
async saveWatchCursor(key, cursor) {
|
|
24999
|
+
if (!/^[a-f0-9]{64}$/.test(key) || !Number.isSafeInteger(cursor) || cursor < 0) throw new Error("invalid cursor");
|
|
25000
|
+
await this.write(`watch-${key}.json`, { cursor });
|
|
25001
|
+
}
|
|
23938
25002
|
load() {
|
|
23939
25003
|
return this.read("credentials.json", (value) => typeof value.token === "string" && typeof value.api_url === "string");
|
|
23940
25004
|
}
|
|
@@ -23960,15 +25024,15 @@ var CredentialStore = class {
|
|
|
23960
25024
|
* caller must see, not a silent sign-out.
|
|
23961
25025
|
*/
|
|
23962
25026
|
async read(name, valid) {
|
|
23963
|
-
let
|
|
25027
|
+
let text5;
|
|
23964
25028
|
try {
|
|
23965
|
-
|
|
25029
|
+
text5 = await readFile(join(this.dir, name), "utf8");
|
|
23966
25030
|
} catch (error61) {
|
|
23967
25031
|
if (isAbsent(error61)) return null;
|
|
23968
25032
|
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
25033
|
}
|
|
23970
25034
|
try {
|
|
23971
|
-
const value = JSON.parse(
|
|
25035
|
+
const value = JSON.parse(text5);
|
|
23972
25036
|
return value && typeof value === "object" && valid(value) ? value : null;
|
|
23973
25037
|
} catch {
|
|
23974
25038
|
return null;
|
|
@@ -24011,14 +25075,14 @@ function resolveApiUrl(flag, env, saved) {
|
|
|
24011
25075
|
return url2.origin + url2.pathname.replace(/\/+$/, "");
|
|
24012
25076
|
}
|
|
24013
25077
|
var Session = class _Session {
|
|
24014
|
-
constructor(io, options, apiUrl,
|
|
25078
|
+
constructor(io, options, apiUrl, token2, tokenSource) {
|
|
24015
25079
|
this.io = io;
|
|
24016
25080
|
this.options = options;
|
|
24017
25081
|
this.apiUrl = apiUrl;
|
|
24018
|
-
this.token =
|
|
25082
|
+
this.token = token2;
|
|
24019
25083
|
this.tokenSource = tokenSource;
|
|
24020
25084
|
this.store = new CredentialStore(io.configDir);
|
|
24021
|
-
this.gateway = new Gateway(apiUrl,
|
|
25085
|
+
this.gateway = new Gateway(apiUrl, token2, io);
|
|
24022
25086
|
}
|
|
24023
25087
|
io;
|
|
24024
25088
|
options;
|
|
@@ -24038,13 +25102,13 @@ var Session = class _Session {
|
|
|
24038
25102
|
return new _Session(io, options, apiUrl, envToken ?? savedToken, envToken ? "env" : savedToken ? "saved" : null);
|
|
24039
25103
|
}
|
|
24040
25104
|
/** A session for the same server with a newly issued token. */
|
|
24041
|
-
withToken(
|
|
24042
|
-
return new _Session(this.io, this.options, this.apiUrl,
|
|
25105
|
+
withToken(token2) {
|
|
25106
|
+
return new _Session(this.io, this.options, this.apiUrl, token2, "saved");
|
|
24043
25107
|
}
|
|
24044
25108
|
/** Prints an answer as TOON text or JSON and returns its exit code. */
|
|
24045
25109
|
emit(answer, fields = {}, options = {}) {
|
|
24046
|
-
const
|
|
24047
|
-
this.io[options.stream ?? "stdout"](
|
|
25110
|
+
const text5 = this.options.json ? renderJson(answer, fields) : renderText(answer, fields);
|
|
25111
|
+
this.io[options.stream ?? "stdout"](text5);
|
|
24048
25112
|
return options.exit ?? exitCode(answer);
|
|
24049
25113
|
}
|
|
24050
25114
|
async readInput(path, topic) {
|
|
@@ -24064,13 +25128,22 @@ var Session = class _Session {
|
|
|
24064
25128
|
if (first.status !== "running" || !first.run_id) return first;
|
|
24065
25129
|
let answer = first;
|
|
24066
25130
|
if (this.options.wait) {
|
|
25131
|
+
let shown = "";
|
|
25132
|
+
const report = (value) => {
|
|
25133
|
+
const line = value.status === "running" && value.progress ? progressText(value.progress) : "";
|
|
25134
|
+
if (line && line !== shown) this.io.stderr(`progress: ${line}
|
|
25135
|
+
`);
|
|
25136
|
+
shown = line || shown;
|
|
25137
|
+
};
|
|
25138
|
+
report(first);
|
|
24067
25139
|
const outcome = await pollUntil({
|
|
24068
25140
|
policy: { ...CLI_POLL_POLICY, maxDurationMs: this.options.timeoutSeconds * 1e3 },
|
|
24069
25141
|
initial: first,
|
|
24070
25142
|
read: () => this.gateway.call("gtm_results", { run_id: first.run_id }),
|
|
24071
25143
|
isDone: (value) => value.status !== "running",
|
|
24072
25144
|
now: () => this.io.now(),
|
|
24073
|
-
sleep: (ms) => this.io.sleep(ms)
|
|
25145
|
+
sleep: (ms) => this.io.sleep(ms),
|
|
25146
|
+
onValue: report
|
|
24074
25147
|
});
|
|
24075
25148
|
if (outcome.reason === "error") throw outcome.error;
|
|
24076
25149
|
answer = outcome.value ?? first;
|
|
@@ -24131,6 +25204,8 @@ Run gtm ${error61.topic ? `${error61.topic} ` : ""}--help for usage.
|
|
|
24131
25204
|
}
|
|
24132
25205
|
async function dispatch(session, command) {
|
|
24133
25206
|
switch (command.kind) {
|
|
25207
|
+
case "watch":
|
|
25208
|
+
return watchCommand(session, command);
|
|
24134
25209
|
case "login":
|
|
24135
25210
|
return login(session, command.browser);
|
|
24136
25211
|
case "logout":
|
|
@@ -24200,6 +25275,7 @@ async function quoteFile(session, command) {
|
|
|
24200
25275
|
}
|
|
24201
25276
|
|
|
24202
25277
|
// src/node.ts
|
|
25278
|
+
import { createInterface } from "node:readline/promises";
|
|
24203
25279
|
import { spawn } from "node:child_process";
|
|
24204
25280
|
import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
24205
25281
|
import { homedir } from "node:os";
|
|
@@ -24223,11 +25299,20 @@ function openUrl(url2) {
|
|
|
24223
25299
|
function nodeIo() {
|
|
24224
25300
|
return {
|
|
24225
25301
|
env: process.env,
|
|
24226
|
-
|
|
24227
|
-
process.
|
|
25302
|
+
confirm: async (prompt) => {
|
|
25303
|
+
if (!process.stdin.isTTY) return false;
|
|
25304
|
+
const reader = createInterface({ input: process.stdin, output: process.stderr });
|
|
25305
|
+
try {
|
|
25306
|
+
return /^(y|yes)$/i.test((await reader.question(`${prompt} [y/N] `)).trim());
|
|
25307
|
+
} finally {
|
|
25308
|
+
reader.close();
|
|
25309
|
+
}
|
|
25310
|
+
},
|
|
25311
|
+
stdout: (text5) => {
|
|
25312
|
+
process.stdout.write(text5);
|
|
24228
25313
|
},
|
|
24229
|
-
stderr: (
|
|
24230
|
-
process.stderr.write(
|
|
25314
|
+
stderr: (text5) => {
|
|
25315
|
+
process.stderr.write(text5);
|
|
24231
25316
|
},
|
|
24232
25317
|
fetch: (input2, init) => fetch(input2, init),
|
|
24233
25318
|
readFile: (path) => readFile2(path, "utf8"),
|