@indexnetwork/protocol 66.0.0-rc.630.1 → 66.0.0-rc.632.1

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.
@@ -19,7 +19,7 @@ export interface UserInfo {
19
19
  avatar: string | null;
20
20
  }
21
21
  /** Cache namespace for opportunity presentation copy. Bump to invalidate copy safety changes. */
22
- export declare const OPPORTUNITY_PRESENTATION_CACHE_VERSION = "v2";
22
+ export declare const OPPORTUNITY_PRESENTATION_CACHE_VERSION = "v3";
23
23
  export declare function buildOpportunityCardCacheKey(opportunityId: string, viewerId: string, focusedViewerIntentId?: string): string;
24
24
  export declare function buildApiChatCardPresentationCacheKey(opportunityId: string, viewerId: string): string;
25
25
  /**
@@ -26,16 +26,18 @@ import { createStructuredModel } from "../shared/agent/model.config.js";
26
26
  // ── 1. Presentation cache keys ──
27
27
  // ──────────────────────────────────────────────────────────────────────
28
28
  /** Cache namespace for opportunity presentation copy. Bump to invalidate copy safety changes. */
29
- export const OPPORTUNITY_PRESENTATION_CACHE_VERSION = "v2";
29
+ export const OPPORTUNITY_PRESENTATION_CACHE_VERSION = "v3";
30
30
  export function buildOpportunityCardCacheKey(opportunityId, viewerId, focusedViewerIntentId) {
31
31
  const scope = focusedViewerIntentId ? `:intent:${focusedViewerIntentId}` : "";
32
- return `card:${opportunityId}:${viewerId}${scope}`;
32
+ return `card:${OPPORTUNITY_PRESENTATION_CACHE_VERSION}:${opportunityId}:${viewerId}${scope}`;
33
33
  }
34
34
  export function buildApiChatCardPresentationCacheKey(opportunityId, viewerId) {
35
35
  return `chat:${OPPORTUNITY_PRESENTATION_CACHE_VERSION}:card:${opportunityId}:${viewerId}`;
36
36
  }
37
37
  const LLM_TIMEOUT_MS = 20000;
38
38
  const GREETING_DESCRIPTION = "A 2-4 sentence first-person message the viewer could send to the counterpart, in the viewer's voice, referencing what they have in common. Plain prose only — no markdown, no greeting prefix like 'Hey {Name},'. Example body: 'Saw we're both working on regenerative coordination tooling — your post on consent flows resonated. Would love to compare notes if you have time this week.'";
39
+ /** Shown under the person's name on cards and in the morning email, so it carries context, not a button label. */
40
+ const SUGGESTED_ACTION_DESCRIPTION = "One short line (max ~70 chars) on what this connection is about for the viewer: the concrete topic, need, or plan the two share, e.g. 'Coffee in SF on agent verification workflows' or 'Beta-testing your journaling app with her writers circle'. Never open with an instruction or UI verb such as 'Accept', 'Send a message', 'Schedule', 'Connect', 'Reach out', 'Review', or 'Check'; the card's buttons already carry the action.";
39
41
  // ──────────────────────────────────────────────────────────────
40
42
  // SCHEMA & TYPES
41
43
  // ──────────────────────────────────────────────────────────────
@@ -46,7 +48,7 @@ const PresentationSchema = z.object({
46
48
  personalizedSummary: z
47
49
  .string()
48
50
  .describe("2-3 sentence explanation using 'you' language, explaining why this opportunity is specifically valuable for the viewer based on their intents and profile"),
49
- suggestedAction: z.string().describe("Brief suggested next step"),
51
+ suggestedAction: z.string().describe(SUGGESTED_ACTION_DESCRIPTION),
50
52
  greeting: z.string().max(500).describe(GREETING_DESCRIPTION),
51
53
  });
52
54
  const responseFormat = z.object({
@@ -60,9 +62,7 @@ export const CardLLMSchema = z.object({
60
62
  personalizedSummary: z
61
63
  .string()
62
64
  .describe("2-3 sentence explanation in 'you' language for the main card body"),
63
- suggestedAction: z
64
- .string()
65
- .describe("Brief suggested next step (e.g. CTA line)"),
65
+ suggestedAction: z.string().describe(SUGGESTED_ACTION_DESCRIPTION),
66
66
  narratorRemark: z
67
67
  .string()
68
68
  .max(80)
@@ -82,7 +82,9 @@ const homeCardResponseFormat = z.object({
82
82
  const systemPrompt = `
83
83
  You are an expert at presenting connection opportunities to users in a way that feels personal and compelling.
84
84
 
85
- Your goal: Given raw context about the viewer (their profile, intents), the other person(s), and why the system matched them, produce a short headline, a personalized summary, and a suggested action.
85
+ Your goal: Given raw context about the viewer (their profile, intents), the other person(s), and why the system matched them, produce a short headline, a personalized summary, and a suggestedAction.
86
+
87
+ suggestedAction: ${SUGGESTED_ACTION_DESCRIPTION}
86
88
 
87
89
  Rules:
88
90
  1. Address the VIEWER directly using "you" and "your". This is for them.
@@ -104,7 +106,6 @@ Rules:
104
106
  - If this is an introduction: mention who introduced them and frame it as a personal recommendation.
105
107
  - Headline: one short line that hooks (e.g., "[Name] thinks you should meet [Other]" or "A React expert who needs your design skills").
106
108
  - Personalized summary: 2-3 sentences. Why is this opportunity for *them*? If introduced, lead with the introduction.
107
- - Suggested action: encourage action ("Send a message to start the conversation" or "Share this intro").
108
109
 
109
110
  **If viewer is "agent":**
110
111
  - They are seeing this because someone already reached out.
@@ -112,14 +113,12 @@ Rules:
112
113
  - Reference their skills/expertise that make them a match.
113
114
  - Headline: what the other person needs that they can provide.
114
115
  - Personalized summary: 2-3 sentences. Why someone reached out to them.
115
- - Suggested action: "Someone is interested in connecting — check their message" or "Review and respond".
116
116
 
117
117
  **If viewer is "peer":**
118
118
  - Mutual opportunity. Reference shared or complementary interests.
119
119
  - If this is an introduction: mention who connected them.
120
120
  - Headline: the mutual connection angle.
121
121
  - Personalized summary: 2-3 sentences. Why this is mutually valuable.
122
- - Suggested action: "Send an intro to connect" or "Start a conversation".
123
122
  `;
124
123
  const homeCardSystemPrompt = `
125
124
  You are an expert at presenting connection opportunities for an opportunity card.
@@ -127,7 +126,7 @@ You are an expert at presenting connection opportunities for an opportunity card
127
126
  Given context about the viewer, the other person, and why they were matched, produce:
128
127
  1. headline: one short hook line.
129
128
  2. personalizedSummary: 2-3 sentences in "you" language (main body text).
130
- 3. suggestedAction: one brief suggested next step.
129
+ 3. suggestedAction: ${SUGGESTED_ACTION_DESCRIPTION}
131
130
  4. narratorRemark: one short sentence for the narrator chip (who is suggesting and why; max ~80 chars).
132
131
  5. greeting: a 2-4 sentence first-person message the viewer could send to the counterpart. Plain prose, no greeting prefix, no markdown.
133
132
  7. mutualIntentsLabel: short subtitle under the other party's name. Examples: "3 mutual intents", "Shared interests", "Aligned goals" — keep it brief. NEVER output "0 mutual intents" or any zero-count label; use a qualitative phrase instead.
@@ -361,7 +360,7 @@ function buildNegotiatingChip(input) {
361
360
  return {
362
361
  headline: "Agents are talking",
363
362
  personalizedSummary: "Your agent is still talking with theirs to see if this connection makes sense. We'll surface the full match as soon as they converge.",
364
- suggestedAction: "Check back shortly — no action needed yet.",
363
+ suggestedAction: "Your agents are still working out the fit",
365
364
  narratorRemark,
366
365
  mutualIntentsLabel: input.mutualIntentCount && input.mutualIntentCount > 0
367
366
  ? `${input.mutualIntentCount} mutual intent${input.mutualIntentCount !== 1 ? "s" : ""}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "66.0.0-rc.630.1",
3
+ "version": "66.0.0-rc.632.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",