@synap-core/workspace-templates 0.37.0 → 0.38.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/workspace-templates",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
6
6
  "repository": {
@@ -256,18 +256,21 @@ describe("CRM messages and cadence — catalog contract", () => {
256
256
  expect(slugs).not.toContain("linkedinInvitedAt");
257
257
  });
258
258
 
259
- it("'Find their LinkedIn': one lead, linkedin_find_profile, a proposal or up to 3 candidates, nothing sent", () => {
259
+ it("'Find their LinkedIn': one person (a lead or not), linkedin_find_profile, a proposal or up to 5 candidates, nothing sent", () => {
260
260
  const name = "Find their LinkedIn";
261
261
  const pb = playbookOf(name);
262
- expect(pb.subjectProfile?.profileSlug).toBe("lead");
263
- // The CRM app starts it for one lead, as "Draft a first message": params.lead.
264
- expect(pb.params?.find((p) => p.name === "lead")).toMatchObject({ type: "entity", required: true });
265
- expect(pb.params?.find((p) => p.name === "lead")).toEqual(playbookOf("Draft a first message").params?.find((p) => p.name === "lead"));
262
+ // A lookup on a PERSON, never on a lead (founder, 9 Nov 2026: a company is the lead, its contact is who is looked up).
263
+ expect(pb.subjectProfile?.profileSlug).toBe("person");
264
+ expect(pb.params?.find((p) => p.name === "person")).toMatchObject({ type: "entity", required: true });
265
+ expect(pb.params?.find((p) => p.name === "lead")).toBeUndefined();
266
+ expect(goalOf(name)).not.toContain("{lead}");
266
267
  expect(pb.requiredIntents).toEqual(["enrich_entity"]);
267
268
  const goal = goalOf(name);
268
- expect(goal).toContain("run linkedin_find_profile with their full name, their company");
269
+ expect(goal).toContain("run linkedin_find_profile with their full name, their");
270
+ expect(goal).toContain("company when known");
271
+ expect(goal).toContain("search by their name alone");
269
272
  expect(goal).toContain("propose its linkedinUrl and linkedinProviderId on the person");
270
- expect(goal).toContain("at most 3");
273
+ expect(goal).toContain("at most 5");
271
274
  expect(goal).toContain("never set linkedinConnection or linkedinInvitedAt");
272
275
  // A reader: it never asks to connect nor drafts (those are the other steps).
273
276
  const named = [...goal.matchAll(/\b((?:linkedin|unipile)_[a-z_]+)\b/g)].map((m) => m[1]);
package/src/crm.yaml CHANGED
@@ -1623,37 +1623,40 @@ playbooks:
1623
1623
  # CRM Messages contract (decision b603d75e, build map ca310f27): the first of
1624
1624
  # the steps a LinkedIn lead walks (Find their LinkedIn, Ask to connect,
1625
1625
  # Waiting, Send). The CRM app runs linkedin_find_profile itself through the
1626
- # actions door (enrich_entity, input { name, company }; founder 7 Nov 2026:
1626
+ # actions door (enrich_entity, input { name, company? }; founder 7 Nov 2026:
1627
1627
  # "no need for ai" for a tool with a parameter), and offers this process
1628
1628
  # only as "Ask Synap AI to search" when the lookup finds nothing, for one
1629
- # lead (`params.lead`, as "Draft a first message"). On a strict match
1630
- # it PROPOSES linkedinUrl and linkedinProviderId on the person; on none or
1631
- # several it hands the person up to 3 candidates. The reach fields stay the
1629
+ # person (`params.person`: a contact of a company lead is looked up as
1630
+ # themselves, no lead role needed). On a strict match it PROPOSES
1631
+ # linkedinUrl and linkedinProviderId on the person; on none, several or a
1632
+ # name-only search it hands the person up to 5 candidates. The reach fields stay the
1632
1633
  # pod's (backend#786). A lifecycle READER of leadStage: no stage moves.
1633
1634
  - name: Find their LinkedIn
1634
- description: Find one lead's LinkedIn profile by their full name and company and propose its URL and member id on the person for a person to approve, or offer up to 3 candidates to choose from; nothing is sent.
1635
+ description: Find one person's LinkedIn profile by their full name and, when known, their company, and propose its URL and member id on the person for a person to approve, or offer up to 5 candidates to choose from; nothing is sent. The person need not be a lead.
1635
1636
  goalTemplate: >-
1636
- Find the LinkedIn profile of the lead {lead}. WHO: a person lead is
1637
- looked up themselves; for a company lead, the person who decides there,
1638
- from the pod; when no decider is known, ask the person who it is. When
1639
- that person already has a linkedinUrl, say so and stop. FIND: run
1640
- linkedin_find_profile with their full name, their company and the
1641
- LinkedIn account unipile_list_accounts lists (when several are
1642
- connected, ask the person which one reads). On a match, propose its
1643
- linkedinUrl and linkedinProviderId on the person through the entity
1644
- door, for a person to approve; never write them directly, and never set
1645
- linkedinConnection or linkedinInvitedAt, which only the pod writes. On
1646
- none, several or more results than it read, ask the person to choose
1647
- among its candidates (at most 3, each with its name, headline and
1648
- profile URL) or to give the URL themselves, then propose the one chosen
1649
- the same way. Never send a message or a connection request, never draft
1650
- one, and never move the lead's stage.
1637
+ Find the LinkedIn profile of {person}. WHO: the person themselves,
1638
+ whether or not they are a lead (a contact of a company lead is looked up
1639
+ as themselves). When they already have a linkedinUrl, say so and stop.
1640
+ COMPANY: use where they work when it is known (their own company field,
1641
+ else the company they work at); when none is known, search by their name
1642
+ alone. FIND: run linkedin_find_profile with their full name, their
1643
+ company when known, and the LinkedIn account unipile_list_accounts lists
1644
+ (when several are connected, ask the person which one reads). On a
1645
+ strict match, propose its linkedinUrl and linkedinProviderId on the
1646
+ person through the entity door, for a person to approve; never write
1647
+ them directly, and never set linkedinConnection or linkedinInvitedAt,
1648
+ which only the pod writes. On none, several, more results than it read,
1649
+ or a name-only search, ask the person to choose among its candidates (at
1650
+ most 5, each with its name, headline, location and profile URL) or to
1651
+ give the URL themselves, then propose the one chosen the same way. Never
1652
+ send a message or a connection request, never draft one, and never move
1653
+ a lead's stage.
1651
1654
  subjectProfile:
1652
- profileSlug: lead
1655
+ profileSlug: person
1653
1656
  activators:
1654
1657
  - { on: manual, mode: propose }
1655
1658
  params:
1656
- - { name: lead, type: entity, label: Lead, required: true }
1659
+ - { name: person, type: entity, label: Person, required: true }
1657
1660
  executor: is-agent
1658
1661
  status: active
1659
1662
  requiredIntents: [enrich_entity]
@@ -1661,13 +1664,13 @@ playbooks:
1661
1664
  - key: find
1662
1665
  name: Find the profile
1663
1666
  category: started
1664
- goal: Run linkedin_find_profile for the lead (a company lead's decider) with their full name and company; on a match propose linkedinUrl and linkedinProviderId on the person, otherwise ask the person to choose among up to 3 candidates or give the URL.
1667
+ goal: Run linkedin_find_profile for the person with their full name and company when known; on a strict match propose linkedinUrl and linkedinProviderId on the person, otherwise ask the person to choose among up to 5 candidates or give the URL.
1665
1668
  criteria:
1666
1669
  - key: find-linkedin-proposed
1667
- statement: The person's linkedinUrl and linkedinProviderId are proposed on them for a person to approve (a strict match, or the candidate the person chose), or the person was asked to choose among at most 3 candidates; nothing was written directly.
1670
+ statement: The person's linkedinUrl and linkedinProviderId are proposed on them for a person to approve (a strict match, or the candidate the person chose), or the person was asked to choose among at most 5 candidates; nothing was written directly.
1668
1671
  check: { kind: judge }
1669
1672
  - key: find-linkedin-reader-only
1670
- statement: No message or connection request was sent or drafted, linkedinConnection and linkedinInvitedAt were not set, and the lead's stage was not moved.
1673
+ statement: No message or connection request was sent or drafted, linkedinConnection and linkedinInvitedAt were not set, and no lead's stage was moved.
1671
1674
  check: { kind: judge }
1672
1675
  - key: confirm
1673
1676
  name: Person confirms
package/src/templates.ts CHANGED
@@ -15248,10 +15248,10 @@ const DATA = {
15248
15248
  },
15249
15249
  {
15250
15250
  "name": "Find their LinkedIn",
15251
- "description": "Find one lead's LinkedIn profile by their full name and company and propose its URL and member id on the person for a person to approve, or offer up to 3 candidates to choose from; nothing is sent.",
15252
- "goalTemplate": "Find the LinkedIn profile of the lead {lead}. WHO: a person lead is looked up themselves; for a company lead, the person who decides there, from the pod; when no decider is known, ask the person who it is. When that person already has a linkedinUrl, say so and stop. FIND: run linkedin_find_profile with their full name, their company and the LinkedIn account unipile_list_accounts lists (when several are connected, ask the person which one reads). On a match, propose its linkedinUrl and linkedinProviderId on the person through the entity door, for a person to approve; never write them directly, and never set linkedinConnection or linkedinInvitedAt, which only the pod writes. On none, several or more results than it read, ask the person to choose among its candidates (at most 3, each with its name, headline and profile URL) or to give the URL themselves, then propose the one chosen the same way. Never send a message or a connection request, never draft one, and never move the lead's stage.",
15251
+ "description": "Find one person's LinkedIn profile by their full name and, when known, their company, and propose its URL and member id on the person for a person to approve, or offer up to 5 candidates to choose from; nothing is sent. The person need not be a lead.",
15252
+ "goalTemplate": "Find the LinkedIn profile of {person}. WHO: the person themselves, whether or not they are a lead (a contact of a company lead is looked up as themselves). When they already have a linkedinUrl, say so and stop. COMPANY: use where they work when it is known (their own company field, else the company they work at); when none is known, search by their name alone. FIND: run linkedin_find_profile with their full name, their company when known, and the LinkedIn account unipile_list_accounts lists (when several are connected, ask the person which one reads). On a strict match, propose its linkedinUrl and linkedinProviderId on the person through the entity door, for a person to approve; never write them directly, and never set linkedinConnection or linkedinInvitedAt, which only the pod writes. On none, several, more results than it read, or a name-only search, ask the person to choose among its candidates (at most 5, each with its name, headline, location and profile URL) or to give the URL themselves, then propose the one chosen the same way. Never send a message or a connection request, never draft one, and never move a lead's stage.",
15253
15253
  "subjectProfile": {
15254
- "profileSlug": "lead"
15254
+ "profileSlug": "person"
15255
15255
  },
15256
15256
  "activators": [
15257
15257
  {
@@ -15261,9 +15261,9 @@ const DATA = {
15261
15261
  ],
15262
15262
  "params": [
15263
15263
  {
15264
- "name": "lead",
15264
+ "name": "person",
15265
15265
  "type": "entity",
15266
- "label": "Lead",
15266
+ "label": "Person",
15267
15267
  "required": true
15268
15268
  }
15269
15269
  ],
@@ -15277,18 +15277,18 @@ const DATA = {
15277
15277
  "key": "find",
15278
15278
  "name": "Find the profile",
15279
15279
  "category": "started",
15280
- "goal": "Run linkedin_find_profile for the lead (a company lead's decider) with their full name and company; on a match propose linkedinUrl and linkedinProviderId on the person, otherwise ask the person to choose among up to 3 candidates or give the URL.",
15280
+ "goal": "Run linkedin_find_profile for the person with their full name and company when known; on a strict match propose linkedinUrl and linkedinProviderId on the person, otherwise ask the person to choose among up to 5 candidates or give the URL.",
15281
15281
  "criteria": [
15282
15282
  {
15283
15283
  "key": "find-linkedin-proposed",
15284
- "statement": "The person's linkedinUrl and linkedinProviderId are proposed on them for a person to approve (a strict match, or the candidate the person chose), or the person was asked to choose among at most 3 candidates; nothing was written directly.",
15284
+ "statement": "The person's linkedinUrl and linkedinProviderId are proposed on them for a person to approve (a strict match, or the candidate the person chose), or the person was asked to choose among at most 5 candidates; nothing was written directly.",
15285
15285
  "check": {
15286
15286
  "kind": "judge"
15287
15287
  }
15288
15288
  },
15289
15289
  {
15290
15290
  "key": "find-linkedin-reader-only",
15291
- "statement": "No message or connection request was sent or drafted, linkedinConnection and linkedinInvitedAt were not set, and the lead's stage was not moved.",
15291
+ "statement": "No message or connection request was sent or drafted, linkedinConnection and linkedinInvitedAt were not set, and no lead's stage was moved.",
15292
15292
  "check": {
15293
15293
  "kind": "judge"
15294
15294
  }
@@ -72,7 +72,7 @@ describe("linkedin_find_profile — a strict match or none", () => {
72
72
  expect(verb.intent).toBe("enrich_entity");
73
73
  // Declared read-only: the pod runs it with no review (plan 87088d2d W3c).
74
74
  expect(verb.metadata).toEqual({ verbType: "read", readOnly: true });
75
- expect(verb.parameters).toEqual({ fullName: "string", company: "string", accountId: "string" });
75
+ expect(verb.parameters).toEqual({ fullName: "string", company: "string?", accountId: "string" });
76
76
  expect(verb.requires).toEqual(["unipile_linkedin"]);
77
77
  expect(verb.code).not.toMatch(/\{\{\w+\}\}/);
78
78
  // It writes nothing: the match is the caller's proposal (decision 7).
@@ -132,7 +132,7 @@ describe("linkedin_find_profile — a strict match or none", () => {
132
132
  ]);
133
133
  });
134
134
 
135
- it("a different name with the right company is never a match, and at most 3 candidates come back, closest first", async () => {
135
+ it("a different name with the right company is never a match, and the closest candidates come back first, at most 5", async () => {
136
136
  const rows = [
137
137
  row("a", "Ada Lovelace", "CEO at Analytical Engines"),
138
138
  row("b", "Bob Smith", "Sales"),
@@ -141,7 +141,24 @@ describe("linkedin_find_profile — a strict match or none", () => {
141
141
  ];
142
142
  const { result } = await run("linkedin_find_profile", ARGS, [{ data: rows }]);
143
143
  expect(result).toMatchObject({ matched: false, reason: "none" });
144
- expect(result.candidates.map((c: any) => c.providerId)).toEqual(["c", "a", "d"]);
144
+ expect(result.candidates.map((c: any) => c.providerId)).toEqual(["c", "a", "d", "b"]);
145
+ const many = Array.from({ length: 8 }, (_, i) => row(`m${i}`, `Person ${i}`, "Analytical Engines"));
146
+ const capped = await run("linkedin_find_profile", ARGS, [{ data: many }]);
147
+ expect(capped.result.candidates).toHaveLength(5);
148
+ });
149
+
150
+ // The company is optional (CRM, founder 9 Nov 2026: "if you just have the name then you send the name, and if the tool
151
+ // answers with a list then the UI shows the list"): a name alone is never a strict match, so the answer is always the
152
+ // closest candidates, even when one result carries the exact name; the search sends no company filter.
153
+ it("no company: the search carries the name only, and the answer is candidates (name_only), never a match", async () => {
154
+ const { company: _omit, ...NO_COMPANY } = ARGS;
155
+ for (const args of [NO_COMPANY, { ...NO_COMPANY, company: " " }, { ...NO_COMPANY, company: undefined }]) {
156
+ const { result, calls } = await run("linkedin_find_profile", args, [{ data: [ADA, row("u-bob", "Bob Smith", "Sales")] }]);
157
+ expect(calls[0].body).toEqual({ keywords: "adele LOVELACE" });
158
+ expect(result).toMatchObject({ matched: false, reason: "name_only" });
159
+ expect(result.candidates.map((c: any) => c.providerId)).toEqual(["u-ada", "u-bob"]);
160
+ expect(result.searched.company).toBeNull();
161
+ }
145
162
  });
146
163
 
147
164
  it("pages by cursor: a match on page 2 with no page after it is the match", async () => {
@@ -168,9 +185,8 @@ describe("linkedin_find_profile — a strict match or none", () => {
168
185
  expect(result).toEqual({ matched: false, reason: "proposed", proposed: true, proposalId: "p-1", candidates: [] });
169
186
  });
170
187
 
171
- it("a failed search throws; a missing company or name is refused before any call", async () => {
188
+ it("a failed search throws; a missing name is refused before any call (a missing company is not)", async () => {
172
189
  await expect(run("linkedin_find_profile", ARGS, [{ proposed: false, status: 429 } as any])).rejects.toThrow(/status 429/);
173
- await expect(run("linkedin_find_profile", { ...ARGS, company: " " }, [{ data: [] }])).rejects.toThrow(/company is required/);
174
190
  await expect(run("linkedin_find_profile", { ...ARGS, fullName: "" }, [{ data: [] }])).rejects.toThrow(/fullName/);
175
191
  });
176
192
  });