gtmmaxing 0.1.2 → 0.1.4

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 +190 -16
  2. package/package.json +10 -11
package/dist/gtm.js CHANGED
@@ -18885,7 +18885,11 @@ 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
- "page-content": { name: "Web page content", credits: 1, unit: "page", limit: 1 }
18888
+ "profile-finder": { name: "Find LinkedIn profile", credits: 1, unit: "profile found", limit: 1 },
18889
+ "page-content": { name: "Web page content", credits: 1, unit: "page", limit: 1 },
18890
+ "instagram-profile": { name: "Instagram profile", credits: 1, unit: "profile", limit: 1 },
18891
+ "x-search": { name: "X post search", credits: 1, unit: "search (up to 20 posts)", limit: 20 },
18892
+ "reddit-search": { name: "Reddit post search", credits: 1, unit: "search (up to 20 posts)", limit: 20 }
18889
18893
  };
18890
18894
  var toolIdSchema = external_exports.enum(Object.keys(TOOL_CATALOG));
18891
18895
  function publicWebsite(value) {
@@ -18897,6 +18901,13 @@ function publicWebsite(value) {
18897
18901
  return false;
18898
18902
  }
18899
18903
  }
18904
+ var INSTAGRAM_HANDLE = /^[A-Za-z0-9._]{1,30}$/;
18905
+ function instagramHandle(value) {
18906
+ const trimmed = value.trim().replace(/^@/, "");
18907
+ const match = /^(?:https?:\/\/)?(?:www\.)?instagram\.com\/([A-Za-z0-9._]{1,30})\/?(?:[?#].*)?$/i.exec(trimmed);
18908
+ return (match ? match[1] : trimmed).toLowerCase();
18909
+ }
18910
+ var SEARCH_WINDOWS = ["day", "week", "month", "year"];
18900
18911
  var websiteUrl = (value) => /^https:\/\//i.test(value.trim()) ? value.trim() : `https://${value.trim().replace(/^http:\/\//i, "")}`;
18901
18912
  var toolRequestSchema = external_exports.object({
18902
18913
  tool: toolIdSchema,
@@ -18909,6 +18920,8 @@ var toolRequestSchema = external_exports.object({
18909
18920
  titles: external_exports.string().trim().max(200).default(""),
18910
18921
  /** LinkedIn activity: comma-separated topics to look for in posts. Optional so older saved requests keep their hash. */
18911
18922
  keywords: external_exports.string().trim().max(300).optional(),
18923
+ /** X and Reddit search: how far back to look. Optional so older saved requests keep their hash. */
18924
+ within: external_exports.enum(SEARCH_WINDOWS).optional(),
18912
18925
  limit: external_exports.number().int().min(1).max(20).default(10)
18913
18926
  }).strict().superRefine((v, c) => {
18914
18927
  const reject = (message) => c.addIssue({ code: "custom", path: ["query"], message });
@@ -18916,7 +18929,10 @@ var toolRequestSchema = external_exports.object({
18916
18929
  if (["website", "page-content", "seo-aeo-audit"].includes(v.tool) && !publicWebsite(websiteUrl(v.query))) reject("Enter a company website, like vercel.com.");
18917
18930
  if (["company", "icp"].includes(v.tool) && !publicWebsite(`https://${v.query.replace(/^https?:\/\//, "").replace(/\/$/, "")}`)) reject("Enter a public company domain.");
18918
18931
  if (v.tool === "local-leads" && !v.location) reject("Add a city or region.");
18932
+ if (v.tool === "profile-finder" && !v.company) c.addIssue({ code: "custom", path: ["company"], message: "Add the person's company." });
18919
18933
  if (v.tool === "verify-email" && !external_exports.string().email().safeParse(v.query).success) reject("Enter an email address.");
18934
+ if (v.tool === "instagram-profile" && !INSTAGRAM_HANDLE.test(v.query)) reject("Enter an Instagram username, like gymshark.");
18935
+ if (v.within && !["x-search", "reddit-search"].includes(v.tool)) c.addIssue({ code: "custom", path: ["within"], message: "Only post searches take a time window." });
18920
18936
  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
18937
  });
18922
18938
  var toolResultSchema = external_exports.object({
@@ -18983,6 +18999,7 @@ var CAPABILITIES = {
18983
18999
  preview: ["name", "email", "verdict"],
18984
19000
  noun: "contacts",
18985
19001
  price: { credits: 1, unit: "email found", basis: "result", free: "Misses and profiles you already paid for are free." },
19002
+ searchWords: "emails bulk batch list csv contact contacts enrich enrichment",
18986
19003
  example: { people: ["https://www.linkedin.com/in/satyanadella"] }
18987
19004
  }),
18988
19005
  company: capability({
@@ -19092,6 +19109,7 @@ var CAPABILITIES = {
19092
19109
  preview: ["name", "role", "company", "location"],
19093
19110
  noun: "profiles",
19094
19111
  price: toolPrice("linkedin-profile", "Profiles not found are free."),
19112
+ searchWords: "current job title employer moved changed change changes verify bulk batch list",
19095
19113
  example: { profile: "https://www.linkedin.com/in/williamhgates" },
19096
19114
  toolRequest: (input2) => ({ tool: "linkedin-profile", query: linkedinProfileUrl(input2.profile ?? "") }),
19097
19115
  batch: true
@@ -19104,11 +19122,29 @@ var CAPABILITIES = {
19104
19122
  preview: ["name", "lastPostAt", "posts90d", "topicPosts"],
19105
19123
  noun: "profiles",
19106
19124
  price: toolPrice("linkedin-activity", "Profiles with no public posts are free."),
19125
+ searchWords: "posting active activity talk talks talking mentions mentioned engagement social signal signals intent bulk batch list",
19107
19126
  example: { profile: "https://www.linkedin.com/in/williamhgates", topics: ["climate"] },
19108
19127
  // Commas would split a topic, so each is kept whole by dropping them.
19109
19128
  toolRequest: (input2) => ({ tool: "linkedin-activity", query: linkedinProfileUrl(input2.profile ?? ""), ...input2.topics?.length ? { keywords: input2.topics.map((t) => t.replace(/,/g, " ").trim()).join(", ") } : {} }),
19110
19129
  batch: true
19111
19130
  }),
19131
+ "profile-finder": capability({
19132
+ title: "Find LinkedIn profile",
19133
+ description: "A person's LinkedIn profile from their name and company, checked against both. One person or up to 100 people.",
19134
+ input: external_exports.object({
19135
+ name: text(100).optional().describe("Full name, like Pedro Reis"),
19136
+ company: text(100).optional().describe("Company name or domain, like Adyen"),
19137
+ 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`)
19138
+ }).strict(),
19139
+ row: external_exports.object({ name: s, title: s, company: s, location: s, url: s }),
19140
+ preview: ["name", "title", "company", "url"],
19141
+ noun: "profiles",
19142
+ price: toolPrice("profile-finder", "People not found are free."),
19143
+ example: { name: "Pedro Reis", company: "Adyen" },
19144
+ toolRequest: (input2) => ({ tool: "profile-finder", query: input2.name ?? "", company: input2.company ?? "" }),
19145
+ batch: true,
19146
+ searchWords: "linkedin url name names person lookup resolve match who bulk batch list"
19147
+ }),
19112
19148
  "page-content": capability({
19113
19149
  title: "Web page content",
19114
19150
  description: "Readable text of one public web page.",
@@ -19119,19 +19155,57 @@ var CAPABILITIES = {
19119
19155
  price: toolPrice("page-content"),
19120
19156
  example: { url: "vercel.com/pricing" },
19121
19157
  toolRequest: (input2) => ({ tool: "page-content", query: input2.url })
19158
+ }),
19159
+ "instagram-profile": capability({
19160
+ title: "Instagram profile",
19161
+ description: "Public Instagram profile with followers, bio, website and the business email or phone it shows.",
19162
+ input: external_exports.object({ profile: text(200).describe("Instagram username, @handle or profile URL") }).strict(),
19163
+ row: external_exports.object({ handle: s, name: s, bio: s, followers: n, following: n, business: external_exports.boolean(), verified: external_exports.boolean(), website: s, email: s, phone: s, url: s }),
19164
+ preview: ["handle", "followers", "email", "website"],
19165
+ noun: "profiles",
19166
+ price: toolPrice("instagram-profile", "Private and missing accounts are free."),
19167
+ searchWords: "insta ig creator creators influencer influencers brand social contact email phone followers",
19168
+ example: { profile: "gymshark" },
19169
+ toolRequest: (input2) => ({ tool: "instagram-profile", query: instagramHandle(input2.profile) })
19170
+ }),
19171
+ "x-search": capability({
19172
+ title: "X post search",
19173
+ description: "Recent public X (Twitter) posts matching a phrase, newest first, with author and engagement. Every bare word must appear; quote a phrase or use OR.",
19174
+ input: external_exports.object({ query: text(300).describe('Phrase or X search syntax, like "looking for a CRM"'), within: external_exports.enum(SEARCH_WINDOWS).optional(), limit: limit("x-search") }).strict(),
19175
+ row: external_exports.object({ author: s, name: s, followers: n, text: s, postedAt: s, likes: n, replies: n, reposts: n, views: n, reply: external_exports.boolean(), url: s }),
19176
+ preview: ["author", "text", "postedAt"],
19177
+ noun: "posts",
19178
+ price: toolPrice("x-search"),
19179
+ searchWords: "twitter tweets tweet social listening intent buyer buyers asking recommendation mentions",
19180
+ example: { query: '"looking for a CRM"', within: "week" },
19181
+ toolRequest: (input2) => ({ tool: "x-search", query: input2.query, ...input2.within ? { within: input2.within } : {}, ...input2.limit ? { limit: input2.limit } : {} })
19182
+ }),
19183
+ "reddit-search": capability({
19184
+ title: "Reddit post search",
19185
+ description: "Public Reddit posts most relevant to a query, from the past year unless a window is given, with subreddit, score and comments.",
19186
+ input: external_exports.object({ query: text(300), within: external_exports.enum(SEARCH_WINDOWS).optional(), limit: limit("reddit-search") }).strict(),
19187
+ row: external_exports.object({ subreddit: s, title: s, text: s, author: s, postedAt: s, score: n, comments: n, url: s }),
19188
+ preview: ["subreddit", "title", "comments"],
19189
+ noun: "posts",
19190
+ price: toolPrice("reddit-search"),
19191
+ searchWords: "subreddit subreddits threads social listening intent buyer buyers asking recommendation alternatives",
19192
+ example: { query: "best cold email tool", within: "month" },
19193
+ toolRequest: (input2) => ({ tool: "reddit-search", query: input2.query, ...input2.within ? { within: input2.within } : {}, ...input2.limit ? { limit: input2.limit } : {} })
19122
19194
  })
19123
19195
  };
19124
19196
  var CAPABILITY_IDS = Object.keys(CAPABILITIES);
19125
19197
  var capabilityIdSchema = external_exports.enum(CAPABILITY_IDS);
19126
19198
  var paidArgs = {
19127
19199
  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"),
19200
+ // Piped so the published input schema stays a plain string: every agent tool list has a 2k-token budget.
19201
+ idempotency_key: external_exports.string().pipe(external_exports.string().regex(/^[\x21-\x7e]{8,128}$/)).optional().describe("Same key replays the call for free"),
19129
19202
  dry_run: external_exports.boolean().optional().describe("Quote only; nothing runs")
19130
19203
  };
19131
19204
  var price = (id) => TOOL_CATALOG[id].credits;
19132
19205
  var findContactsInput = external_exports.object({
19133
19206
  people: external_exports.array(text(300)).min(1).max(100).optional().describe("LinkedIn profile URLs or handles"),
19134
19207
  run_id: external_exports.string().max(64).optional().describe("Use the people from a gtm_build_list run"),
19208
+ 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
19209
  find: external_exports.array(external_exports.enum(["email", "phone"])).min(1).max(2).optional().describe('Default ["email"]'),
19136
19210
  verify: external_exports.boolean().optional().describe("Mailbox-check found emails"),
19137
19211
  ...paidArgs
@@ -19165,12 +19239,12 @@ var toolsInput = external_exports.object({
19165
19239
  ...paidArgs
19166
19240
  }).strict();
19167
19241
  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")
19242
+ 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
19243
  }).strict();
19170
19244
  var OUTCOME_TOOLS = {
19171
19245
  gtm_find_contacts: {
19172
19246
  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.`,
19247
+ 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
19248
  paid: true,
19175
19249
  capabilities: ["email-finder", "phone-pilot", "verify-email"],
19176
19250
  input: findContactsInput
@@ -19563,6 +19637,7 @@ var SPECS = {
19563
19637
  login: { "no-browser": { type: "boolean" } },
19564
19638
  logout: {},
19565
19639
  whoami: {},
19640
+ "auth-header": {},
19566
19641
  contacts: { file: { type: "string" }, column: { type: "string" }, out: { type: "string" }, "run-id": { type: "string" }, find: { type: "string", multiple: true }, verify: { type: "boolean" }, ...PAID },
19567
19642
  list: { titles: { type: "string", multiple: true }, company: { type: "string" }, location: { type: "string" }, "business-type": { type: "string" }, limit: { type: "string" }, ...PAID },
19568
19643
  research: { ...PAID },
@@ -19636,6 +19711,9 @@ function build2(name, values, positionals) {
19636
19711
  case "whoami":
19637
19712
  none("gtm whoami takes no arguments.");
19638
19713
  return { kind: "whoami" };
19714
+ case "auth-header":
19715
+ none("gtm auth-header takes no arguments.");
19716
+ return { kind: "auth-header" };
19639
19717
  case "contacts": {
19640
19718
  const file2 = str(values, "file");
19641
19719
  const runId = str(values, "run-id");
@@ -19890,6 +19968,58 @@ function profilesFromCsv(text2, column) {
19890
19968
  }
19891
19969
  return list;
19892
19970
  }
19971
+ function peopleFromCsv(text2, column, names) {
19972
+ if (names === "only") return { ...nameListAsProfiles(namesFromCsv(text2)), named: true };
19973
+ try {
19974
+ return { ...profilesFromCsv(text2, column), named: false };
19975
+ } catch (error61) {
19976
+ if (names === "never" || column !== void 0 || !(error61 instanceof FileInputError)) throw error61;
19977
+ return { ...nameListAsProfiles(namesFromCsv(text2)), named: true };
19978
+ }
19979
+ }
19980
+ function nameListAsProfiles(list) {
19981
+ return { profiles: list.people, rows: list.rows, duplicates: list.duplicates, invalid: 0, empty: list.empty, column: `${list.columns.name}, ${list.columns.company}` };
19982
+ }
19983
+ var NAME_HEADER = /^(full[ _-]?name|name|person|contact|contact[ _-]?name|lead|lead[ _-]?name)$/i;
19984
+ var FIRST_HEADER = /^first[ _-]?name$/i;
19985
+ var LAST_HEADER = /^last[ _-]?name$/i;
19986
+ var COMPANY_HEADER = /^(company|company[ _-]?name|organi[sz]ation|account|account[ _-]?name|employer|company[ _-]?domain|domain|website)$/i;
19987
+ var SEPARATOR = "";
19988
+ function namePair(key) {
19989
+ const [name = "", company = ""] = key.split(SEPARATOR);
19990
+ return { name, company };
19991
+ }
19992
+ function namesFromCsv(text2) {
19993
+ const table = parseCsv(text2).filter((row) => row.some((cell2) => cell2.trim() !== ""));
19994
+ if (!table.length) throw new FileInputError("The file has no rows.");
19995
+ const header = table[0].map((cell2) => cell2.trim());
19996
+ const find = (pattern) => header.findIndex((cell2) => pattern.test(cell2));
19997
+ const nameAt = find(NAME_HEADER);
19998
+ const firstAt = find(FIRST_HEADER);
19999
+ const lastAt = find(LAST_HEADER);
20000
+ const companyAt = find(COMPANY_HEADER);
20001
+ if (companyAt < 0 || nameAt < 0 && (firstAt < 0 || lastAt < 0)) {
20002
+ 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(", ")}.`);
20003
+ }
20004
+ const seen = /* @__PURE__ */ new Set();
20005
+ const list = { people: [], rows: table.length - 1, duplicates: 0, empty: 0, columns: { name: nameAt >= 0 ? header[nameAt] : `${header[firstAt]} + ${header[lastAt]}`, company: header[companyAt] } };
20006
+ for (const row of table.slice(1)) {
20007
+ const name = (nameAt >= 0 ? row[nameAt] ?? "" : `${row[firstAt] ?? ""} ${row[lastAt] ?? ""}`).replace(/\s+/g, " ").trim();
20008
+ const company = (row[companyAt] ?? "").trim();
20009
+ if (!name || !company) {
20010
+ list.empty += 1;
20011
+ continue;
20012
+ }
20013
+ const key = `${name}${SEPARATOR}${company}`;
20014
+ if (seen.has(key.toLowerCase())) {
20015
+ list.duplicates += 1;
20016
+ continue;
20017
+ }
20018
+ seen.add(key.toLowerCase());
20019
+ list.people.push(key);
20020
+ }
20021
+ return list;
20022
+ }
19893
20023
 
19894
20024
  // src/output.ts
19895
20025
  var LOGIN_NEXT = { tool: "login", args: {} };
@@ -19935,8 +20065,8 @@ async function contacts(session, command) {
19935
20065
  const answer = await session.settle(await session.gateway.call("gtm_find_contacts", args));
19936
20066
  return finish(session, command, answer, people ? [{ people: args.people, answer, replayed: answer.replayed === true, runCost: 0, cost: answer.cost }] : null, {});
19937
20067
  }
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");
20068
+ const list = peopleFromCsv(await session.readInput(command.file, "contacts"), command.column, "fallback");
20069
+ if (!list.profiles.length) throw new UsageError(`No ${list.named ? "names with companies" : "LinkedIn profiles"} found in ${command.file}.`, "contacts");
19940
20070
  const fileFields = {
19941
20071
  file: command.file,
19942
20072
  column: list.column ?? void 0,
@@ -19946,7 +20076,7 @@ async function contacts(session, command) {
19946
20076
  skipped: list.invalid + list.empty
19947
20077
  };
19948
20078
  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) };
20079
+ 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
20080
  const rerun = (flags) => fileNext(command, options, flags);
19951
20081
  const perCall = await session.gateway.peoplePerCall();
19952
20082
  const maxCredits = args.max_credits;
@@ -20093,7 +20223,7 @@ async function collectRows(session, batches) {
20093
20223
  perBatch.push(data.map((cells) => Object.fromEntries(named.map((name, i) => [name, cells[i] ? cells[i] : null]))));
20094
20224
  }
20095
20225
  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" })));
20226
+ 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
20227
  return { columns: all, rows: rows.map((row) => Object.fromEntries(all.map((name) => [name, row[name] ?? null]))) };
20098
20228
  }
20099
20229
  async function writeOut(session, path, table) {
@@ -20186,9 +20316,10 @@ var plural2 = (n2, one, many = `${one}s`) => `${n2} ${n2 === 1 ? one : many}`;
20186
20316
  async function toolFile(session, command) {
20187
20317
  const definition = CAPABILITIES[command.capability];
20188
20318
  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");
20319
+ if (["people", "profile", "name", "company"].some((field) => field in command.input)) throw new UsageError("Give the people with --file, not in --input.", "tools");
20320
+ const byName = "name" in definition.input.shape;
20321
+ const list = peopleFromCsv(await session.readInput(command.file, "tools"), command.column, byName ? "only" : "never");
20322
+ if (!list.profiles.length) throw new UsageError(`No ${byName ? "names with companies" : "LinkedIn profiles"} found in ${command.file}.`, "tools");
20192
20323
  const fileFields = {
20193
20324
  file: command.file,
20194
20325
  column: list.column ?? void 0,
@@ -20199,7 +20330,7 @@ async function toolFile(session, command) {
20199
20330
  };
20200
20331
  const tool2 = {
20201
20332
  tool: "gtm_tools",
20202
- args: (people2) => ({ action: "run", capability: command.capability, input: { ...command.input, people: people2 } }),
20333
+ args: (people2) => ({ action: "run", capability: command.capability, input: { ...command.input, people: byName ? people2.map(namePair) : people2 } }),
20203
20334
  perPerson: definition.price.credits
20204
20335
  };
20205
20336
  const rerun = (flags) => ({
@@ -20297,7 +20428,7 @@ async function toolFile(session, command) {
20297
20428
  import { randomUUID } from "node:crypto";
20298
20429
 
20299
20430
  // src/version.ts
20300
- var VERSION = "0.1.2";
20431
+ var VERSION = "0.1.4";
20301
20432
 
20302
20433
  // src/gateway.ts
20303
20434
  var CliError = class extends Error {
@@ -20485,6 +20616,17 @@ var TOPICS = {
20485
20616
  },
20486
20617
  logout: { summary: "Delete the saved sign-in", lines: ["Usage: gtm logout", "", "Deletes the saved token. Revoke the agent on your GTMMAXING account page to end its access everywhere."] },
20487
20618
  whoami: { summary: "Show the server, balance and this agent's credit cap", lines: ["Usage: gtm whoami"] },
20619
+ "auth-header": {
20620
+ summary: "Print this login as an MCP Authorization header",
20621
+ lines: [
20622
+ "Usage: gtm auth-header",
20623
+ "",
20624
+ `Prints {"Authorization":"Bearer <token>"} for an MCP client's header helper, so the GTMMAXING MCP connection`,
20625
+ "reuses this CLI login (same agent, same credit cap) instead of a second sign-in. For Claude Code:",
20626
+ ` claude mcp add-json --scope user gtmmaxing '{"type":"http","url":"https://gtmmaxing.com/mcp","headersHelper":"gtm auth-header"}'`,
20627
+ "When run as a helper, the token is printed only for a GTMMAXING server. Exits 1 when signed out."
20628
+ ]
20629
+ },
20488
20630
  contacts: {
20489
20631
  summary: "Work emails or mobiles for LinkedIn profiles, a CSV, or a list run",
20490
20632
  lines: [
@@ -20496,7 +20638,8 @@ var TOPICS = {
20496
20638
  tool("gtm_find_contacts"),
20497
20639
  "",
20498
20640
  "Options:",
20499
- " --file PATH CSV or plain list of LinkedIn profile URLs or handles, any length",
20641
+ " --file PATH CSV or plain list of LinkedIn profile URLs or handles, any length;",
20642
+ " or a CSV with name and company columns, whose profiles are found first",
20500
20643
  " --column NAME Column holding the profiles, when the CLI cannot tell",
20501
20644
  " --run-id RUN The people from a gtm list run",
20502
20645
  " --find email,phone What to find (default email)",
@@ -20598,7 +20741,7 @@ var TOPICS = {
20598
20741
  ]
20599
20742
  }
20600
20743
  };
20601
- var ORDER = ["login", "logout", "whoami", ...Object.values(TOOL_COMMANDS)];
20744
+ var ORDER = ["login", "logout", "whoami", "auth-header", ...Object.values(TOOL_COMMANDS)];
20602
20745
  function helpText(topic) {
20603
20746
  const entry = topic ? TOPICS[topic] : void 0;
20604
20747
  if (entry) return `gtm ${topic}: ${entry.summary}
@@ -20611,7 +20754,7 @@ ${[...entry.lines, "", "Common options:", ...COMMON].join("\n")}
20611
20754
  "Usage: gtm <command> [options]",
20612
20755
  "",
20613
20756
  "Commands:",
20614
- ...ORDER.map((name) => ` ${name.padEnd(10)}${TOPICS[name].summary}`),
20757
+ ...ORDER.map((name) => ` ${name.padEnd(12)}${TOPICS[name].summary}`),
20615
20758
  "",
20616
20759
  "Start with gtm login. Paid commands need --max-credits N; add --dry-run to see the quote first.",
20617
20760
  "Answers are TOON text: a one-sentence summary, cost, balance, up to 5 rows and the next command. Add --json for JSON.",
@@ -20692,6 +20835,35 @@ async function logout(session) {
20692
20835
  function failed(reason, summary) {
20693
20836
  return shapeAnswer({ status: "error", reason, summary, next: LOGIN_NEXT });
20694
20837
  }
20838
+ async function authHeader(session) {
20839
+ const { io, token, apiUrl } = session;
20840
+ if (!token) {
20841
+ io.stderr("Not signed in; run gtm login.\n");
20842
+ return 1;
20843
+ }
20844
+ const target = io.env.CLAUDE_CODE_MCP_SERVER_URL;
20845
+ if (target && !sameService(target, apiUrl)) {
20846
+ io.stderr(`Refusing to send this login to ${target}; it belongs to ${apiUrl}.
20847
+ `);
20848
+ return 1;
20849
+ }
20850
+ io.stdout(`${JSON.stringify({ Authorization: `Bearer ${token}` })}
20851
+ `);
20852
+ return 0;
20853
+ }
20854
+ function sameService(target, apiUrl) {
20855
+ let url2;
20856
+ let api;
20857
+ try {
20858
+ url2 = new URL(target);
20859
+ api = new URL(apiUrl);
20860
+ } catch {
20861
+ return false;
20862
+ }
20863
+ if (url2.protocol !== api.protocol) return false;
20864
+ const site = api.hostname.replace(/^api\./, "");
20865
+ return url2.host === api.host || url2.hostname === site && url2.port === api.port;
20866
+ }
20695
20867
 
20696
20868
  // src/credentials.ts
20697
20869
  import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
@@ -20888,6 +21060,8 @@ async function dispatch(session, command) {
20888
21060
  return logout(session);
20889
21061
  case "whoami":
20890
21062
  return whoami(session);
21063
+ case "auth-header":
21064
+ return authHeader(session);
20891
21065
  case "contacts":
20892
21066
  return contacts(session, command);
20893
21067
  case "tool-file":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtmmaxing",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",
@@ -24,21 +24,20 @@
24
24
  "engines": {
25
25
  "node": ">=20"
26
26
  },
27
- "scripts": {
28
- "build": "node scripts/build.mjs",
29
- "prepublishOnly": "pnpm build",
30
- "typecheck": "tsc --noEmit",
31
- "lint": "eslint src test",
32
- "test": "vitest run"
33
- },
34
27
  "devDependencies": {
35
- "@found/contracts": "workspace:*",
36
28
  "@types/node": "^24.0.0",
37
29
  "@typescript-eslint/eslint-plugin": "^8.46.4",
38
30
  "@typescript-eslint/parser": "^8.46.4",
39
31
  "esbuild": "0.28.1",
40
32
  "eslint": "^9.39.2",
41
33
  "typescript": "^5.9.3",
42
- "vitest": "^4.1.11"
34
+ "vitest": "^4.1.11",
35
+ "@found/contracts": "0.1.0"
36
+ },
37
+ "scripts": {
38
+ "build": "node scripts/build.mjs",
39
+ "typecheck": "tsc --noEmit",
40
+ "lint": "eslint src test",
41
+ "test": "vitest run"
43
42
  }
44
- }
43
+ }