@general-input/cli 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -18288,7 +18288,7 @@ import chalk4 from "chalk";
18288
18288
  // package.json
18289
18289
  var package_default = {
18290
18290
  name: "@general-input/cli",
18291
- version: "0.14.0",
18291
+ version: "0.15.0",
18292
18292
  type: "module",
18293
18293
  description: "The agent-facing CLI for General Input. Authenticate, manage workflows, run bash with operator credentials injected by the cloud.",
18294
18294
  license: "SEE LICENSE IN LICENSE",
@@ -19364,6 +19364,10 @@ var SkillAuthoringService = class {
19364
19364
  const { client } = await this.sessionContext.requireAuthed();
19365
19365
  return client.skills.list();
19366
19366
  }
19367
+ async get(id) {
19368
+ const { client } = await this.sessionContext.requireAuthed();
19369
+ return client.skills.get(id);
19370
+ }
19367
19371
  /** Create a skill in the cloud, then scaffold a starter SKILL.md in `dir`. */
19368
19372
  async create(args) {
19369
19373
  const { client } = await this.sessionContext.requireAuthed();
@@ -19786,6 +19790,13 @@ var CrmService = class {
19786
19790
  async enrichPhones(args) {
19787
19791
  return (await this.crm()).enrichPhones(args);
19788
19792
  }
19793
+ // ── Playbooks ──────────────────────────────────────────────────────
19794
+ async listPlaybooks() {
19795
+ return (await this.crm()).listPlaybooks();
19796
+ }
19797
+ async runPlaybook(request) {
19798
+ return (await this.crm()).quickRunPlaybook(request);
19799
+ }
19789
19800
  };
19790
19801
 
19791
19802
  // src/clients/AuthApiClient.ts
@@ -20623,6 +20634,18 @@ var CrmApiClient = class {
20623
20634
  body
20624
20635
  });
20625
20636
  }
20637
+ // ── Playbooks (agent launches — runner-session bearers only) ────────
20638
+ async listPlaybooks() {
20639
+ this.http.requireAuthed();
20640
+ return this.http.fetch(`${CRM}/playbooks`);
20641
+ }
20642
+ async quickRunPlaybook(body) {
20643
+ this.http.requireAuthed();
20644
+ return this.http.fetch(`${CRM}/threads/quick-run`, {
20645
+ method: "POST",
20646
+ body
20647
+ });
20648
+ }
20626
20649
  };
20627
20650
 
20628
20651
  // src/clients/SkillsApiClient.ts
@@ -22733,6 +22756,20 @@ function registerResourceGet(parent) {
22733
22756
  const dir = resolve3(opts.dir ?? ".");
22734
22757
  const workflowId = resolveResourceId({ id, dir });
22735
22758
  try {
22759
+ if (workflowId.startsWith("skl_")) {
22760
+ const skill = await skillAuthoringService.get(workflowId);
22761
+ if (opts.json) {
22762
+ printJson(skill);
22763
+ return;
22764
+ }
22765
+ printInfo(`id: ${skill.id}`);
22766
+ printInfo(`name: ${skill.name}`);
22767
+ printInfo("type: skill");
22768
+ printInfo(`enabled: ${skill.isEnabled ? "yes" : "no"}`);
22769
+ printInfo(`valid: ${skill.isValid ? "yes" : "no"}`);
22770
+ printInfo(`version: ${skill.version}`);
22771
+ return;
22772
+ }
22736
22773
  const detail = await workflowAuthoringService.get(workflowId);
22737
22774
  if (opts.json) {
22738
22775
  printJson(detail);
@@ -24374,6 +24411,10 @@ var CrmSubjectTypeSchema = z14.enum([
24374
24411
  "pipeline",
24375
24412
  "card"
24376
24413
  ]);
24414
+ var CrmSubjectRefSchema = z14.object({
24415
+ type: CrmSubjectTypeSchema,
24416
+ id: z14.uuid()
24417
+ });
24377
24418
 
24378
24419
  // ../../packages/crm-api/dist/types/company.js
24379
24420
  import { z as z15 } from "zod";
@@ -25554,6 +25595,183 @@ var PlaybookCampaignTargetValueSchema = z35.union([
25554
25595
  ]);
25555
25596
  var PlaybookSeedValueSchema = z35.string().trim().min(1).max(2e3);
25556
25597
  var PlaybookBriefValueSchema = z35.string().trim().min(1).max(2e3);
25598
+ var PLAYBOOK_META = {
25599
+ "fill-in-person": {
25600
+ name: "Enrich person",
25601
+ description: "Researches a person online and fills in their record: role, links, location, skills, education, and contact info.",
25602
+ subjectRequired: true,
25603
+ pinsToSubject: true,
25604
+ inputs: []
25605
+ },
25606
+ "fill-in-company": {
25607
+ name: "Enrich company",
25608
+ description: "Researches a company online, fills in its record (industry, size, funding, tech stack), and adds its key stakeholders.",
25609
+ subjectRequired: true,
25610
+ pinsToSubject: true,
25611
+ inputs: []
25612
+ },
25613
+ "fill-in-list": {
25614
+ name: "Grow list",
25615
+ description: "Researches new matches for a list\u2019s purpose, saves them with verified details, and adds them to the list.",
25616
+ subjectRequired: true,
25617
+ pinsToSubject: true,
25618
+ inputs: []
25619
+ },
25620
+ "draft-sequence-person": {
25621
+ name: "Draft sequence",
25622
+ description: "Researches a person and drafts a short, personalized email sequence into a campaign, left in draft for review.",
25623
+ subjectRequired: true,
25624
+ pinsToSubject: true,
25625
+ inputs: [
25626
+ {
25627
+ key: "brief",
25628
+ label: "What's this sequence for?",
25629
+ kind: "brief",
25630
+ placeholder: "e.g. book a 15-min intro about automating their candidate syncs; lead with the October contract renewal",
25631
+ optional: true
25632
+ },
25633
+ {
25634
+ key: "campaign",
25635
+ label: "Campaign",
25636
+ kind: "campaign_target"
25637
+ }
25638
+ ]
25639
+ },
25640
+ "lookalike-person": {
25641
+ name: "Person lookalike list",
25642
+ description: "Distills what defines a seed person, finds people in the same seat at similar companies, and builds them into a list.",
25643
+ subjectRequired: false,
25644
+ pinsToSubject: false,
25645
+ inputs: [
25646
+ {
25647
+ key: "seed",
25648
+ label: "Seed person",
25649
+ kind: "seed",
25650
+ entityType: "person"
25651
+ },
25652
+ {
25653
+ key: "destination",
25654
+ label: "Add to list",
25655
+ kind: "list_target",
25656
+ entityType: "person"
25657
+ }
25658
+ ]
25659
+ },
25660
+ "lookalike-company": {
25661
+ name: "Company lookalike list",
25662
+ description: "Distills what defines a seed company, finds similar companies, and builds them into a list.",
25663
+ subjectRequired: false,
25664
+ pinsToSubject: false,
25665
+ inputs: [
25666
+ {
25667
+ key: "seed",
25668
+ label: "Seed company",
25669
+ kind: "seed",
25670
+ entityType: "company"
25671
+ },
25672
+ {
25673
+ key: "destination",
25674
+ label: "Add to list",
25675
+ kind: "list_target",
25676
+ entityType: "company"
25677
+ }
25678
+ ]
25679
+ },
25680
+ "add-enrich": {
25681
+ name: "Add & enrich",
25682
+ description: "Takes a name, domain, or short description, works out whether it\u2019s a person or a company, saves the record, and enriches it fully.",
25683
+ subjectRequired: false,
25684
+ pinsToSubject: false,
25685
+ inputs: [
25686
+ {
25687
+ key: "seed",
25688
+ label: "Who or what to add",
25689
+ kind: "seed",
25690
+ entityType: null
25691
+ }
25692
+ ]
25693
+ },
25694
+ "build-list-person": {
25695
+ name: "Create people list",
25696
+ description: "Turns a description of who you want into a new list: decodes the target, hunts account-first, and fills it with verified people.",
25697
+ subjectRequired: false,
25698
+ pinsToSubject: false,
25699
+ inputs: [
25700
+ {
25701
+ key: "brief",
25702
+ label: "Who should be on it",
25703
+ kind: "brief",
25704
+ placeholder: "e.g. Heads of RevOps at Series A\u2013B fintechs in the US, ideally hiring SDRs\u2026"
25705
+ }
25706
+ ]
25707
+ },
25708
+ "build-list-company": {
25709
+ name: "Create company list",
25710
+ description: "Turns a description of the companies you want into a new list: decodes the target and fills it with verified matches.",
25711
+ subjectRequired: false,
25712
+ pinsToSubject: false,
25713
+ inputs: [
25714
+ {
25715
+ key: "brief",
25716
+ label: "What companies to find",
25717
+ kind: "brief",
25718
+ placeholder: "e.g. B2B SaaS, 50\u2013200 people, selling to finance teams, raised in the last year\u2026"
25719
+ }
25720
+ ]
25721
+ }
25722
+ };
25723
+ function quickRunPlaybookId(action, subjectType) {
25724
+ if (action === "fill_in") {
25725
+ if (subjectType === "person")
25726
+ return "fill-in-person";
25727
+ if (subjectType === "company")
25728
+ return "fill-in-company";
25729
+ if (subjectType === "list")
25730
+ return "fill-in-list";
25731
+ return null;
25732
+ }
25733
+ if (action === "draft_sequence" && subjectType === "person")
25734
+ return "draft-sequence-person";
25735
+ if (action === "create_lookalikes") {
25736
+ if (subjectType === "person")
25737
+ return "lookalike-person";
25738
+ if (subjectType === "company")
25739
+ return "lookalike-company";
25740
+ return null;
25741
+ }
25742
+ if (action === "add_enrich")
25743
+ return "add-enrich";
25744
+ if (action === "build_list") {
25745
+ if (subjectType === "person")
25746
+ return "build-list-person";
25747
+ if (subjectType === "company")
25748
+ return "build-list-company";
25749
+ return null;
25750
+ }
25751
+ return null;
25752
+ }
25753
+ function playbookQuickRunLaunch(playbookId) {
25754
+ for (const action of AgentQuickActionSchema.options) {
25755
+ for (const subjectType of [null, ...CrmSubjectTypeSchema.options]) {
25756
+ if (quickRunPlaybookId(action, subjectType) === playbookId) {
25757
+ return { action, subjectType };
25758
+ }
25759
+ }
25760
+ }
25761
+ throw new Error(`No quick-run launch resolves to playbook "${playbookId}"`);
25762
+ }
25763
+ var CrmQuickRunRequestSchema = z35.object({
25764
+ action: AgentQuickActionSchema,
25765
+ subject: CrmSubjectRefSchema.optional(),
25766
+ // Playbook resolution for subject-free launches of typed playbooks (Hub
25767
+ // brief/seed runs); absent = a type-inferring playbook.
25768
+ subjectType: CrmSubjectTypeSchema.optional(),
25769
+ inputs: z35.record(z35.string(), z35.unknown()).optional(),
25770
+ // Workspace skills riding along on this run; become the playbook's
25771
+ // remembered set for the next launch.
25772
+ skillIds: z35.array(z35.string().trim().min(1).max(32)).max(10).optional(),
25773
+ modelId: z35.string().optional()
25774
+ });
25557
25775
 
25558
25776
  // ../../packages/api/dist/types/user.js
25559
25777
  import { z as z36 } from "zod";
@@ -28126,10 +28344,181 @@ function registerCrmEnrich(parent) {
28126
28344
  });
28127
28345
  }
28128
28346
 
28347
+ // src/commands/crm/playbooks.ts
28348
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
28349
+ var INPUT_FLAGS = {
28350
+ seed: "--seed",
28351
+ brief: "--brief",
28352
+ list_target: "--into-list",
28353
+ campaign_target: "--campaign"
28354
+ };
28355
+ function playbookIdOrExit(value) {
28356
+ const parsed = PlaybookIdSchema.safeParse(value);
28357
+ if (!parsed.success) {
28358
+ printError(
28359
+ `Unknown playbook "${value}". Available: ${PlaybookIdSchema.options.join(", ")}.`
28360
+ );
28361
+ exit(ExitCode.InvalidArgs);
28362
+ }
28363
+ return parsed.data;
28364
+ }
28365
+ function subjectOrExit(playbookId, opts) {
28366
+ const provided = [];
28367
+ if (opts.person) provided.push({ type: "person", id: opts.person });
28368
+ if (opts.company) provided.push({ type: "company", id: opts.company });
28369
+ if (opts.list) provided.push({ type: "list", id: opts.list });
28370
+ if (provided.length > 1) {
28371
+ printError("Pass at most one of --person, --company, --list.");
28372
+ exit(ExitCode.InvalidArgs);
28373
+ }
28374
+ const subject = provided[0];
28375
+ const meta = PLAYBOOK_META[playbookId];
28376
+ const launch = playbookQuickRunLaunch(playbookId);
28377
+ if (meta.subjectRequired && !subject) {
28378
+ printError(
28379
+ `"${playbookId}" runs on a pinned record. Pass --${launch.subjectType} <id>.`
28380
+ );
28381
+ exit(ExitCode.InvalidArgs);
28382
+ }
28383
+ if (subject && launch.subjectType && subject.type !== launch.subjectType) {
28384
+ printError(
28385
+ `"${playbookId}" takes --${launch.subjectType}, not --${subject.type}.`
28386
+ );
28387
+ exit(ExitCode.InvalidArgs);
28388
+ }
28389
+ return subject;
28390
+ }
28391
+ async function inputsOrExit(playbookId, opts) {
28392
+ const provided = [];
28393
+ if (opts.seed !== void 0) provided.push({ kind: "seed", value: opts.seed });
28394
+ if (opts.brief !== void 0) {
28395
+ provided.push({ kind: "brief", value: opts.brief });
28396
+ }
28397
+ if (opts.intoList !== void 0) {
28398
+ provided.push({ kind: "list_target", value: opts.intoList });
28399
+ }
28400
+ if (opts.campaign !== void 0) {
28401
+ provided.push({ kind: "campaign_target", value: opts.campaign });
28402
+ }
28403
+ const specs = PLAYBOOK_META[playbookId].inputs;
28404
+ const inputs = {};
28405
+ for (const { kind, value } of provided) {
28406
+ const spec = specs.find((candidate) => candidate.kind === kind);
28407
+ if (!spec) {
28408
+ printError(`"${playbookId}" does not take ${INPUT_FLAGS[kind]}.`);
28409
+ exit(ExitCode.InvalidArgs);
28410
+ }
28411
+ inputs[spec.key] = await resolveInputValue(spec, value);
28412
+ }
28413
+ return Object.keys(inputs).length > 0 ? inputs : void 0;
28414
+ }
28415
+ async function resolveInputValue(spec, value) {
28416
+ if (spec.kind === "seed" || spec.kind === "brief") return value;
28417
+ if (spec.kind === "list_target") {
28418
+ if (!UUID_PATTERN.test(value)) return { newListName: value };
28419
+ const list = await crmService.getList(value);
28420
+ return { listId: list.id, listName: list.name };
28421
+ }
28422
+ if (!UUID_PATTERN.test(value)) return { newCampaignName: value };
28423
+ const campaign = await crmService.getCampaign(value);
28424
+ return { campaignId: campaign.id, campaignName: campaign.name };
28425
+ }
28426
+ async function executePlaybooksList(opts) {
28427
+ try {
28428
+ const summaries = await crmService.listPlaybooks();
28429
+ const rows = summaries.map((summary) => {
28430
+ const meta = PLAYBOOK_META[summary.id];
28431
+ const launch = playbookQuickRunLaunch(summary.id);
28432
+ return {
28433
+ id: summary.id,
28434
+ name: meta.name,
28435
+ description: meta.description,
28436
+ runsOn: launch.subjectType,
28437
+ subjectRequired: meta.subjectRequired,
28438
+ inputs: meta.inputs.map((spec) => ({
28439
+ flag: INPUT_FLAGS[spec.kind],
28440
+ label: spec.label,
28441
+ optional: spec.kind === "brief" && spec.optional === true
28442
+ })),
28443
+ attachedSkills: summary.attachedSkills
28444
+ };
28445
+ });
28446
+ if (opts.json) {
28447
+ printJson({ playbooks: rows });
28448
+ return;
28449
+ }
28450
+ printTable(
28451
+ ["PLAYBOOK", "NAME", "RUNS ON", "INPUTS", "REMEMBERED SKILLS"],
28452
+ rows.map((row) => [
28453
+ row.id,
28454
+ row.name,
28455
+ row.runsOn ? `--${row.runsOn}${row.subjectRequired ? "" : " (optional)"}` : "",
28456
+ row.inputs.map((input) => `${input.flag}${input.optional ? "?" : ""}`).join(" "),
28457
+ row.attachedSkills.map((skill) => skill.skillName).join(", ")
28458
+ ]),
28459
+ { colorFn: dimColumn(0) }
28460
+ );
28461
+ } catch (error) {
28462
+ exitOnApiError(error);
28463
+ }
28464
+ }
28465
+ function registerCrmPlaybooks(parent) {
28466
+ const playbooks = parent.command("playbooks").description(
28467
+ "List the one-click agent playbooks (default) or run one. Runs execute asynchronously as CRM agent threads; watch them in the dashboard."
28468
+ ).option("--json", "Machine-readable output (includes descriptions).").action((opts) => executePlaybooksList(opts));
28469
+ playbooks.command("run").argument("<playbookId>", "Playbook id (see `geni crm playbooks`).").description(
28470
+ "Launch a playbook as a fresh agent run. The record flag (--person/--company/--list) pins or seeds it; attached --skill sets become the remembered defaults for the next launch."
28471
+ ).option("--person <id>", "The person record it runs on.").option("--company <id>", "The company record it runs on.").option("--list <id>", "The list record it runs on.").option("--seed <text>", "Free-text seed when no record is pinned.").option("--brief <text>", "Free-text instructions for the run.").option(
28472
+ "--into-list <idOrName>",
28473
+ "Destination list: an existing list id, or a name to create."
28474
+ ).option(
28475
+ "--campaign <idOrName>",
28476
+ "Campaign to work inside: an existing campaign id, or a name to create."
28477
+ ).option(
28478
+ "--skill <id>",
28479
+ "Workspace skill to attach (repeatable, max 10). Replaces the remembered set.",
28480
+ (value, previous) => [...previous, value],
28481
+ []
28482
+ ).option("--json", "Machine-readable output.").action(async (playbookIdArg, opts) => {
28483
+ const playbookId = playbookIdOrExit(playbookIdArg);
28484
+ const meta = PLAYBOOK_META[playbookId];
28485
+ const launch = playbookQuickRunLaunch(playbookId);
28486
+ const subject = subjectOrExit(playbookId, opts);
28487
+ try {
28488
+ const inputs = await inputsOrExit(playbookId, opts);
28489
+ const result = await crmService.runPlaybook({
28490
+ action: launch.action,
28491
+ subject,
28492
+ subjectType: !subject && launch.subjectType ? launch.subjectType : void 0,
28493
+ inputs,
28494
+ skillIds: opts.skill.length > 0 ? opts.skill : void 0
28495
+ });
28496
+ if (opts.json) {
28497
+ printJson({ ...result, playbookId });
28498
+ return;
28499
+ }
28500
+ printSuccess(`Started "${meta.name}" (${playbookId})`);
28501
+ printInfo(`thread: ${result.id}`);
28502
+ printInfo(`run: ${result.runId}`);
28503
+ if (result.isQueued) {
28504
+ printInfo(
28505
+ "queued behind your running agents; it starts automatically"
28506
+ );
28507
+ }
28508
+ if (opts.skill.length > 0) {
28509
+ printInfo(`skills attached: ${opts.skill.join(", ")}`);
28510
+ }
28511
+ printInfo("Runs async. Watch it in the dashboard CRM hub.");
28512
+ } catch (error) {
28513
+ exitOnApiError(error);
28514
+ }
28515
+ });
28516
+ }
28517
+
28129
28518
  // src/commands/crm/index.ts
28130
28519
  function registerCrmCommands(program2) {
28131
28520
  const crm = program2.command("crm").description(
28132
- "Read and write the workspace's CRM: people, companies, pipelines, lists, tags, notes, tasks, and enrichment. Requires CRM access on the workspace."
28521
+ "Read and write the workspace's CRM: people, companies, pipelines, lists, tags, notes, tasks, enrichment, and playbook runs. Requires CRM access on the workspace."
28133
28522
  );
28134
28523
  registerCrmSearch(crm);
28135
28524
  registerCrmPeople(crm);
@@ -28150,6 +28539,7 @@ function registerCrmCommands(program2) {
28150
28539
  registerCrmSequences(crm);
28151
28540
  registerCrmWaterfalls(crm);
28152
28541
  registerCrmEnrich(crm);
28542
+ registerCrmPlaybooks(crm);
28153
28543
  crm.action(() => crm.help());
28154
28544
  crm.enablePositionalOptions();
28155
28545
  for (const noun of crm.commands) noun.enablePositionalOptions();