gtmmaxing 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/gtm.js +91 -13
  2. package/package.json +1 -1
package/dist/gtm.js CHANGED
@@ -18885,6 +18885,7 @@ var TOOL_CATALOG = {
18885
18885
  "google-search": { name: "Google search", credits: 1, unit: "search (up to 20 results)", limit: 20 },
18886
18886
  "linkedin-profile": { name: "LinkedIn profile", credits: 1, unit: "profile", limit: 1 },
18887
18887
  "linkedin-activity": { name: "LinkedIn activity", credits: 1, unit: "profile with posts", limit: 1 },
18888
+ "profile-finder": { name: "Find LinkedIn profile", credits: 1, unit: "profile found", limit: 1 },
18888
18889
  "page-content": { name: "Web page content", credits: 1, unit: "page", limit: 1 }
18889
18890
  };
18890
18891
  var toolIdSchema = external_exports.enum(Object.keys(TOOL_CATALOG));
@@ -18916,6 +18917,7 @@ var toolRequestSchema = external_exports.object({
18916
18917
  if (["website", "page-content", "seo-aeo-audit"].includes(v.tool) && !publicWebsite(websiteUrl(v.query))) reject("Enter a company website, like vercel.com.");
18917
18918
  if (["company", "icp"].includes(v.tool) && !publicWebsite(`https://${v.query.replace(/^https?:\/\//, "").replace(/\/$/, "")}`)) reject("Enter a public company domain.");
18918
18919
  if (v.tool === "local-leads" && !v.location) reject("Add a city or region.");
18920
+ if (v.tool === "profile-finder" && !v.company) c.addIssue({ code: "custom", path: ["company"], message: "Add the person's company." });
18919
18921
  if (v.tool === "verify-email" && !external_exports.string().email().safeParse(v.query).success) reject("Enter an email address.");
18920
18922
  if (["phone-pilot", "linkedin-profile", "linkedin-activity"].includes(v.tool) && !/^https:\/\/(www\.)?linkedin\.com\/in\/[a-zA-Z0-9%_-]+\/?$/.test(v.query)) reject("Enter a LinkedIn profile URL.");
18921
18923
  });
@@ -18983,6 +18985,7 @@ var CAPABILITIES = {
18983
18985
  preview: ["name", "email", "verdict"],
18984
18986
  noun: "contacts",
18985
18987
  price: { credits: 1, unit: "email found", basis: "result", free: "Misses and profiles you already paid for are free." },
18988
+ searchWords: "emails bulk batch list csv contact contacts enrich enrichment",
18986
18989
  example: { people: ["https://www.linkedin.com/in/satyanadella"] }
18987
18990
  }),
18988
18991
  company: capability({
@@ -19092,6 +19095,7 @@ var CAPABILITIES = {
19092
19095
  preview: ["name", "role", "company", "location"],
19093
19096
  noun: "profiles",
19094
19097
  price: toolPrice("linkedin-profile", "Profiles not found are free."),
19098
+ searchWords: "current job title employer moved changed change changes verify bulk batch list",
19095
19099
  example: { profile: "https://www.linkedin.com/in/williamhgates" },
19096
19100
  toolRequest: (input2) => ({ tool: "linkedin-profile", query: linkedinProfileUrl(input2.profile ?? "") }),
19097
19101
  batch: true
@@ -19104,11 +19108,29 @@ var CAPABILITIES = {
19104
19108
  preview: ["name", "lastPostAt", "posts90d", "topicPosts"],
19105
19109
  noun: "profiles",
19106
19110
  price: toolPrice("linkedin-activity", "Profiles with no public posts are free."),
19111
+ searchWords: "posting active activity talk talks talking mentions mentioned engagement social signal signals intent bulk batch list",
19107
19112
  example: { profile: "https://www.linkedin.com/in/williamhgates", topics: ["climate"] },
19108
19113
  // Commas would split a topic, so each is kept whole by dropping them.
19109
19114
  toolRequest: (input2) => ({ tool: "linkedin-activity", query: linkedinProfileUrl(input2.profile ?? ""), ...input2.topics?.length ? { keywords: input2.topics.map((t) => t.replace(/,/g, " ").trim()).join(", ") } : {} }),
19110
19115
  batch: true
19111
19116
  }),
19117
+ "profile-finder": capability({
19118
+ title: "Find LinkedIn profile",
19119
+ description: "A person's LinkedIn profile from their name and company, checked against both. One person or up to 100 people.",
19120
+ input: external_exports.object({
19121
+ name: text(100).optional().describe("Full name, like Pedro Reis"),
19122
+ company: text(100).optional().describe("Company name or domain, like Adyen"),
19123
+ 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`)
19124
+ }).strict(),
19125
+ row: external_exports.object({ name: s, title: s, company: s, location: s, url: s }),
19126
+ preview: ["name", "title", "company", "url"],
19127
+ noun: "profiles",
19128
+ price: toolPrice("profile-finder", "People not found are free."),
19129
+ example: { name: "Pedro Reis", company: "Adyen" },
19130
+ toolRequest: (input2) => ({ tool: "profile-finder", query: input2.name ?? "", company: input2.company ?? "" }),
19131
+ batch: true,
19132
+ searchWords: "linkedin url name names person lookup resolve match who bulk batch list"
19133
+ }),
19112
19134
  "page-content": capability({
19113
19135
  title: "Web page content",
19114
19136
  description: "Readable text of one public web page.",
@@ -19125,13 +19147,15 @@ var CAPABILITY_IDS = Object.keys(CAPABILITIES);
19125
19147
  var capabilityIdSchema = external_exports.enum(CAPABILITY_IDS);
19126
19148
  var paidArgs = {
19127
19149
  max_credits: external_exports.number().int().min(0).max(1e5).optional().describe("Most credits this call may spend"),
19128
- idempotency_key: external_exports.string().regex(/^[\x21-\x7e]{8,128}$/).optional().describe("Same key replays the call for free"),
19150
+ // Piped so the published input schema stays a plain string: every agent tool list has a 2k-token budget.
19151
+ idempotency_key: external_exports.string().pipe(external_exports.string().regex(/^[\x21-\x7e]{8,128}$/)).optional().describe("Same key replays the call for free"),
19129
19152
  dry_run: external_exports.boolean().optional().describe("Quote only; nothing runs")
19130
19153
  };
19131
19154
  var price = (id) => TOOL_CATALOG[id].credits;
19132
19155
  var findContactsInput = external_exports.object({
19133
19156
  people: external_exports.array(text(300)).min(1).max(100).optional().describe("LinkedIn profile URLs or handles"),
19134
19157
  run_id: external_exports.string().max(64).optional().describe("Use the people from a gtm_build_list run"),
19158
+ named: external_exports.array(external_exports.object({ name: external_exports.string().pipe(text(100)), company: external_exports.string().pipe(text(100)) }).strict()).min(1).max(100).optional().describe("{name, company} pairs, instead of people"),
19135
19159
  find: external_exports.array(external_exports.enum(["email", "phone"])).min(1).max(2).optional().describe('Default ["email"]'),
19136
19160
  verify: external_exports.boolean().optional().describe("Mailbox-check found emails"),
19137
19161
  ...paidArgs
@@ -19165,12 +19189,12 @@ var toolsInput = external_exports.object({
19165
19189
  ...paidArgs
19166
19190
  }).strict();
19167
19191
  var accountInput = external_exports.object({
19168
- quote: external_exports.object({ capability: capabilityIdSchema, count: external_exports.number().int().min(1).max(1e5) }).strict().optional().describe("Price a planned batch")
19192
+ quote: external_exports.object({ capability: external_exports.string().pipe(capabilityIdSchema).describe("A gtm_tools capability"), count: external_exports.number().int().min(1).max(1e5) }).strict().optional().describe("Price a planned batch")
19169
19193
  }).strict();
19170
19194
  var OUTCOME_TOOLS = {
19171
19195
  gtm_find_contacts: {
19172
19196
  title: "Find contacts",
19173
- description: `Work emails or mobiles for people, by LinkedIn profile or a gtm_build_list run_id. ${CAPABILITIES["email-finder"].price.credits} credit per email found, ${price("phone-pilot")} per phone, ${price("verify-email")} per verified email; misses free.`,
19197
+ description: `Work emails or mobiles for people, by LinkedIn profile, name and company, or a gtm_build_list run_id. ${CAPABILITIES["email-finder"].price.credits} credit per email found, ${price("phone-pilot")} per phone, ${price("verify-email")} per verified email; misses free.`,
19174
19198
  paid: true,
19175
19199
  capabilities: ["email-finder", "phone-pilot", "verify-email"],
19176
19200
  input: findContactsInput
@@ -19890,6 +19914,58 @@ function profilesFromCsv(text2, column) {
19890
19914
  }
19891
19915
  return list;
19892
19916
  }
19917
+ function peopleFromCsv(text2, column, names) {
19918
+ if (names === "only") return { ...nameListAsProfiles(namesFromCsv(text2)), named: true };
19919
+ try {
19920
+ return { ...profilesFromCsv(text2, column), named: false };
19921
+ } catch (error61) {
19922
+ if (names === "never" || column !== void 0 || !(error61 instanceof FileInputError)) throw error61;
19923
+ return { ...nameListAsProfiles(namesFromCsv(text2)), named: true };
19924
+ }
19925
+ }
19926
+ function nameListAsProfiles(list) {
19927
+ return { profiles: list.people, rows: list.rows, duplicates: list.duplicates, invalid: 0, empty: list.empty, column: `${list.columns.name}, ${list.columns.company}` };
19928
+ }
19929
+ var NAME_HEADER = /^(full[ _-]?name|name|person|contact|contact[ _-]?name|lead|lead[ _-]?name)$/i;
19930
+ var FIRST_HEADER = /^first[ _-]?name$/i;
19931
+ var LAST_HEADER = /^last[ _-]?name$/i;
19932
+ var COMPANY_HEADER = /^(company|company[ _-]?name|organi[sz]ation|account|account[ _-]?name|employer|company[ _-]?domain|domain|website)$/i;
19933
+ var SEPARATOR = "";
19934
+ function namePair(key) {
19935
+ const [name = "", company = ""] = key.split(SEPARATOR);
19936
+ return { name, company };
19937
+ }
19938
+ function namesFromCsv(text2) {
19939
+ const table = parseCsv(text2).filter((row) => row.some((cell2) => cell2.trim() !== ""));
19940
+ if (!table.length) throw new FileInputError("The file has no rows.");
19941
+ const header = table[0].map((cell2) => cell2.trim());
19942
+ const find = (pattern) => header.findIndex((cell2) => pattern.test(cell2));
19943
+ const nameAt = find(NAME_HEADER);
19944
+ const firstAt = find(FIRST_HEADER);
19945
+ const lastAt = find(LAST_HEADER);
19946
+ const companyAt = find(COMPANY_HEADER);
19947
+ if (companyAt < 0 || nameAt < 0 && (firstAt < 0 || lastAt < 0)) {
19948
+ throw new FileInputError(`Could not find a column of LinkedIn profile URLs (name it with --column) or name and company columns (head the columns "name" and "company"); the columns are ${header.join(", ")}.`);
19949
+ }
19950
+ const seen = /* @__PURE__ */ new Set();
19951
+ const list = { people: [], rows: table.length - 1, duplicates: 0, empty: 0, columns: { name: nameAt >= 0 ? header[nameAt] : `${header[firstAt]} + ${header[lastAt]}`, company: header[companyAt] } };
19952
+ for (const row of table.slice(1)) {
19953
+ const name = (nameAt >= 0 ? row[nameAt] ?? "" : `${row[firstAt] ?? ""} ${row[lastAt] ?? ""}`).replace(/\s+/g, " ").trim();
19954
+ const company = (row[companyAt] ?? "").trim();
19955
+ if (!name || !company) {
19956
+ list.empty += 1;
19957
+ continue;
19958
+ }
19959
+ const key = `${name}${SEPARATOR}${company}`;
19960
+ if (seen.has(key.toLowerCase())) {
19961
+ list.duplicates += 1;
19962
+ continue;
19963
+ }
19964
+ seen.add(key.toLowerCase());
19965
+ list.people.push(key);
19966
+ }
19967
+ return list;
19968
+ }
19893
19969
 
19894
19970
  // src/output.ts
19895
19971
  var LOGIN_NEXT = { tool: "login", args: {} };
@@ -19935,8 +20011,8 @@ async function contacts(session, command) {
19935
20011
  const answer = await session.settle(await session.gateway.call("gtm_find_contacts", args));
19936
20012
  return finish(session, command, answer, people ? [{ people: args.people, answer, replayed: answer.replayed === true, runCost: 0, cost: answer.cost }] : null, {});
19937
20013
  }
19938
- const list = profilesFromCsv(await session.readInput(command.file, "contacts"), command.column);
19939
- if (!list.profiles.length) throw new UsageError(`No LinkedIn profiles found in ${command.file}.`, "contacts");
20014
+ const list = peopleFromCsv(await session.readInput(command.file, "contacts"), command.column, "fallback");
20015
+ if (!list.profiles.length) throw new UsageError(`No ${list.named ? "names with companies" : "LinkedIn profiles"} found in ${command.file}.`, "contacts");
19940
20016
  const fileFields = {
19941
20017
  file: command.file,
19942
20018
  column: list.column ?? void 0,
@@ -19946,7 +20022,7 @@ async function contacts(session, command) {
19946
20022
  skipped: list.invalid + list.empty
19947
20023
  };
19948
20024
  const options = { ...args.find ? { find: args.find } : {}, ...args.verify ? { verify: true } : {} };
19949
- const tool2 = { tool: "gtm_find_contacts", args: (people) => ({ people, ...options }), perPerson: perPersonCredits(options) };
20025
+ const tool2 = list.named ? { tool: "gtm_find_contacts", args: (people) => ({ named: people.map(namePair), ...options }), perPerson: perPersonCredits(options) + CAPABILITIES["profile-finder"].price.credits } : { tool: "gtm_find_contacts", args: (people) => ({ people, ...options }), perPerson: perPersonCredits(options) };
19950
20026
  const rerun = (flags) => fileNext(command, options, flags);
19951
20027
  const perCall = await session.gateway.peoplePerCall();
19952
20028
  const maxCredits = args.max_credits;
@@ -20093,7 +20169,7 @@ async function collectRows(session, batches) {
20093
20169
  perBatch.push(data.map((cells) => Object.fromEntries(named.map((name, i) => [name, cells[i] ? cells[i] : null]))));
20094
20170
  }
20095
20171
  const all = columns ?? DEFAULT_COLUMNS;
20096
- const rows = batches.flatMap((batch, i) => perBatch[i].length ? perBatch[i] : batch.people.map((url2) => ({ ...Object.fromEntries(all.map((name) => [name, null])), url: url2, status: batch.answer.status === "error" ? "error" : "not_found" })));
20172
+ const rows = batches.flatMap((batch, i) => perBatch[i].length ? perBatch[i] : batch.people.map((person) => ({ ...Object.fromEntries(all.map((name) => [name, null])), ...profileOf(person) ? { url: person } : namePair(person), status: batch.answer.status === "error" ? "error" : "not_found" })));
20097
20173
  return { columns: all, rows: rows.map((row) => Object.fromEntries(all.map((name) => [name, row[name] ?? null]))) };
20098
20174
  }
20099
20175
  async function writeOut(session, path, table) {
@@ -20186,9 +20262,10 @@ var plural2 = (n2, one, many = `${one}s`) => `${n2} ${n2 === 1 ? one : many}`;
20186
20262
  async function toolFile(session, command) {
20187
20263
  const definition = CAPABILITIES[command.capability];
20188
20264
  if (!definition?.batch) throw new UsageError(`gtm tools run ${command.capability} does not take --file; it runs one input at a time.`, "tools");
20189
- if ("people" in command.input || "profile" in command.input) throw new UsageError("Give the people with --file, not in --input.", "tools");
20190
- const list = profilesFromCsv(await session.readInput(command.file, "tools"), command.column);
20191
- if (!list.profiles.length) throw new UsageError(`No LinkedIn profiles found in ${command.file}.`, "tools");
20265
+ if (["people", "profile", "name", "company"].some((field) => field in command.input)) throw new UsageError("Give the people with --file, not in --input.", "tools");
20266
+ const byName = "name" in definition.input.shape;
20267
+ const list = peopleFromCsv(await session.readInput(command.file, "tools"), command.column, byName ? "only" : "never");
20268
+ if (!list.profiles.length) throw new UsageError(`No ${byName ? "names with companies" : "LinkedIn profiles"} found in ${command.file}.`, "tools");
20192
20269
  const fileFields = {
20193
20270
  file: command.file,
20194
20271
  column: list.column ?? void 0,
@@ -20199,7 +20276,7 @@ async function toolFile(session, command) {
20199
20276
  };
20200
20277
  const tool2 = {
20201
20278
  tool: "gtm_tools",
20202
- args: (people2) => ({ action: "run", capability: command.capability, input: { ...command.input, people: people2 } }),
20279
+ args: (people2) => ({ action: "run", capability: command.capability, input: { ...command.input, people: byName ? people2.map(namePair) : people2 } }),
20203
20280
  perPerson: definition.price.credits
20204
20281
  };
20205
20282
  const rerun = (flags) => ({
@@ -20297,7 +20374,7 @@ async function toolFile(session, command) {
20297
20374
  import { randomUUID } from "node:crypto";
20298
20375
 
20299
20376
  // src/version.ts
20300
- var VERSION = "0.1.2";
20377
+ var VERSION = "0.1.3";
20301
20378
 
20302
20379
  // src/gateway.ts
20303
20380
  var CliError = class extends Error {
@@ -20496,7 +20573,8 @@ var TOPICS = {
20496
20573
  tool("gtm_find_contacts"),
20497
20574
  "",
20498
20575
  "Options:",
20499
- " --file PATH CSV or plain list of LinkedIn profile URLs or handles, any length",
20576
+ " --file PATH CSV or plain list of LinkedIn profile URLs or handles, any length;",
20577
+ " or a CSV with name and company columns, whose profiles are found first",
20500
20578
  " --column NAME Column holding the profiles, when the CLI cannot tell",
20501
20579
  " --run-id RUN The people from a gtm list run",
20502
20580
  " --find email,phone What to find (default email)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtmmaxing",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "gtm: the GTMMAXING command line. Find contacts, build lead lists and research companies from a terminal or a coding agent, with credit caps on every paid call.",
5
5
  "keywords": [
6
6
  "gtm",