@leadpoet/client 0.1.4 → 0.1.5
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/README.md +50 -13
- package/cli.js +46 -2
- package/cli.js.map +2 -2
- package/client.js +47 -2
- package/client.js.map +2 -2
- package/mcp.js +3969 -71
- package/mcp.js.map +4 -4
- package/package.json +13 -2
- package/skill/SKILL.md +73 -6
- package/types/scripts/leadpoet-mcp.d.ts +1 -7
- package/types/shared/account-monitoring.d.ts +1169 -0
- package/types/shared/assistant-brief.d.ts +1681 -0
- package/types/shared/assistant-memories.d.ts +62 -0
- package/types/shared/assistant-send-forecast.d.ts +442 -0
- package/types/shared/assistant.d.ts +238 -0
- package/types/shared/employee-count.d.ts +90 -0
- package/types/shared/gtm-context.d.ts +233 -0
- package/types/shared/icp-product-selection.d.ts +27 -0
- package/types/shared/icp-profile.d.ts +2625 -0
- package/types/shared/industry-taxonomy.d.ts +1 -0
- package/types/shared/lead-request-limits.d.ts +4 -0
- package/types/shared/leadpoet-client.d.ts +1315 -0
- package/types/shared/leadpoet-mcp-server.d.ts +39 -0
- package/types/shared/mcp-connect.d.ts +22 -0
- package/types/shared/monitor-technologies.d.ts +38 -0
- package/types/shared/outreach-analytics.d.ts +334 -0
- package/types/shared/outreach-audience-filters.d.ts +156 -0
- package/types/shared/outreach-audience-segments.d.ts +135 -0
- package/types/shared/outreach-enums.d.ts +22 -0
- package/types/shared/outreach-v2-contract.d.ts +253 -0
- package/types/shared/plan-entitlements.d.ts +75 -0
- package/types/shared/plan-features.d.ts +50 -0
- package/types/shared/request-credit-constants.d.ts +13 -0
- package/types/shared/website-fact-language.d.ts +9 -0
- package/types/shared/workspace-operations.d.ts +1975 -29
- package/types/shared/workspace-tool-metadata.d.ts +1083 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-app assistant's wire contract, shared by its server routes and the
|
|
3
|
+
* dashboard panel. The assistant reads the workspace, writes documents and
|
|
4
|
+
* proposes actions. An action runs only when the user presses Run on its
|
|
5
|
+
* card, sends included.
|
|
6
|
+
*/
|
|
7
|
+
/** Screens the assistant may link to. Anything else renders as plain text. */
|
|
8
|
+
export declare const ASSISTANT_LINKS: {
|
|
9
|
+
readonly requests: "/dashboard/lead-engine";
|
|
10
|
+
readonly pipeline: "/dashboard/pipeline";
|
|
11
|
+
readonly signals: "/dashboard/pipeline?entity=signals";
|
|
12
|
+
readonly review: "/dashboard/outreach?inbox=review";
|
|
13
|
+
readonly replies: "/dashboard/outreach?inbox=conversations";
|
|
14
|
+
readonly queued: "/dashboard/outreach?inbox=queued";
|
|
15
|
+
readonly campaigns: "/dashboard/outreach/campaigns";
|
|
16
|
+
/** Outreach settings, Products & writing, open at the saved offer, proof and writing rules. */
|
|
17
|
+
readonly writing: "/dashboard/outreach/campaigns?settings=writing";
|
|
18
|
+
readonly icps: "/dashboard/account?section=saved-icps";
|
|
19
|
+
readonly analytics: "/dashboard/outreach/analytics";
|
|
20
|
+
readonly network: "/dashboard/outreach/network";
|
|
21
|
+
readonly senders: "/dashboard/account?section=integrations";
|
|
22
|
+
readonly playbook: "/dashboard/account?section=playbook";
|
|
23
|
+
readonly billing: "/dashboard/account?section=billing";
|
|
24
|
+
readonly scheduled: "/dashboard?agent=scheduled";
|
|
25
|
+
readonly memory: "/dashboard?agent=memory";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* One account opened on the pipeline, on its ICP's board when known. With a
|
|
29
|
+
* contact (and an ICP), it opens on that contact's notes and follow-ups.
|
|
30
|
+
*/
|
|
31
|
+
export declare function assistantAccountLink(cardId: string, icpId?: string | null, contactId?: string | null): string;
|
|
32
|
+
/**
|
|
33
|
+
* The in-app path a model-written link may open, or null. Only the screens in
|
|
34
|
+
* ASSISTANT_LINKS qualify, with a plain query string; other hosts, schemes and
|
|
35
|
+
* paths never become links.
|
|
36
|
+
*/
|
|
37
|
+
export declare function safeAssistantHref(href: string): string | null;
|
|
38
|
+
/** Source links one answer may open, at most; reads past it add none. */
|
|
39
|
+
export declare const ASSISTANT_SOURCE_LIMIT = 200;
|
|
40
|
+
/**
|
|
41
|
+
* A source address Leadpoet stored, as the agent may link it: https only,
|
|
42
|
+
* with no sign-in part, as stored, or null. Signals keeps only such links.
|
|
43
|
+
*/
|
|
44
|
+
export declare function assistantSourceUrl(value: unknown): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* The outside address a model-written link may open, or null: only an exact
|
|
47
|
+
* copy of a source link that a read showed the agent in this answer. A model
|
|
48
|
+
* cannot add one, and one character off stays plain text.
|
|
49
|
+
*/
|
|
50
|
+
export declare function verifiedSourceHref(href: string, sources: ReadonlySet<string> | undefined): string | null;
|
|
51
|
+
/** A Markdown link, and a bare web address, as model answers write them. */
|
|
52
|
+
export declare const ASSISTANT_MARKDOWN_LINK: RegExp;
|
|
53
|
+
export declare const ASSISTANT_BARE_ADDRESS: RegExp;
|
|
54
|
+
/**
|
|
55
|
+
* An answer for a place outside Leadpoet, such as Slack, with only Leadpoet's
|
|
56
|
+
* own links, as the panel shows it: a link to one of its screens becomes a
|
|
57
|
+
* full link at `origin`; any other link keeps its words and loses its
|
|
58
|
+
* address; a bare address, often quoted from a prospect, is left out.
|
|
59
|
+
*/
|
|
60
|
+
export declare function assistantOwnLinks(markdown: string, origin: string): string;
|
|
61
|
+
/** Screens the assistant can be told the user has open, with how the model reads each. */
|
|
62
|
+
export declare const ASSISTANT_SCREENS: {
|
|
63
|
+
readonly requests: "the Lead engine (lead requests)";
|
|
64
|
+
readonly pipeline: "the pipeline board";
|
|
65
|
+
readonly review: "Outreach review (drafts waiting for approval)";
|
|
66
|
+
readonly replies: "Outreach conversations (replies)";
|
|
67
|
+
readonly queued: "Outreach queued messages";
|
|
68
|
+
readonly outreach: "Outreach";
|
|
69
|
+
readonly campaigns: "the campaign list";
|
|
70
|
+
readonly analytics: "Outreach analytics";
|
|
71
|
+
readonly network: "the LinkedIn network";
|
|
72
|
+
readonly senders: "sending account settings";
|
|
73
|
+
readonly settings: "account settings";
|
|
74
|
+
};
|
|
75
|
+
export type AssistantScreen = keyof typeof ASSISTANT_SCREENS;
|
|
76
|
+
/** What the user has open when they ask; only IDs and fixed screen names, never page text. */
|
|
77
|
+
export type AssistantPage = {
|
|
78
|
+
screen: AssistantScreen;
|
|
79
|
+
accountId?: string;
|
|
80
|
+
};
|
|
81
|
+
/** The screen a dashboard URL shows, or null for any other page. */
|
|
82
|
+
export declare function assistantPage(pathname: string, search: string): AssistantPage | null;
|
|
83
|
+
export declare const ASSISTANT_LIMITS: {
|
|
84
|
+
/** Turns sent per request; older turns are dropped first. */
|
|
85
|
+
readonly messages: 24;
|
|
86
|
+
readonly messageChars: 4000;
|
|
87
|
+
/** Answers can be longer than questions: a one-pager runs past 4,000 characters. */
|
|
88
|
+
readonly answerChars: 12000;
|
|
89
|
+
/** UTF-8 bytes of all turns sent per request; older turns drop first. Keeps a request under the 100 KB body limit and bounds its cost. */
|
|
90
|
+
readonly historyBytes: 80000;
|
|
91
|
+
/** One confirmed change, server side; the browser waits a little longer. */
|
|
92
|
+
readonly actionMs: 30000;
|
|
93
|
+
/** One answer, every model call and read included; the browser waits a little longer. */
|
|
94
|
+
readonly turnMs: 120000;
|
|
95
|
+
};
|
|
96
|
+
export declare const ASSISTANT_TIMEOUT_MESSAGE = "This answer took too long. Try a narrower question.";
|
|
97
|
+
export type AssistantRole = "user" | "assistant";
|
|
98
|
+
export type AssistantMessage = {
|
|
99
|
+
role: AssistantRole;
|
|
100
|
+
content: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* What running an action does, from the operation's reviewed metadata.
|
|
104
|
+
* "send" is Review's server-built approve card and the listed send cards.
|
|
105
|
+
*/
|
|
106
|
+
export declare const ASSISTANT_ACTION_EFFECTS: readonly ["create", "modify", "spend", "send"];
|
|
107
|
+
export type AssistantActionEffect = (typeof ASSISTANT_ACTION_EFFECTS)[number];
|
|
108
|
+
/** An action the assistant proposes. Nothing runs until the user presses Run. */
|
|
109
|
+
export type AssistantAction = {
|
|
110
|
+
operation: string;
|
|
111
|
+
title: string;
|
|
112
|
+
effect: AssistantActionEffect;
|
|
113
|
+
/** The model's one-line description; the details below come from the arguments themselves. */
|
|
114
|
+
summary: string;
|
|
115
|
+
details: Array<{
|
|
116
|
+
label: string;
|
|
117
|
+
value: string;
|
|
118
|
+
}>;
|
|
119
|
+
arguments: Record<string, unknown>;
|
|
120
|
+
/** A send card's plain statement of what Run does, from the server. */
|
|
121
|
+
consequence?: string;
|
|
122
|
+
/** It can't be undone: Run asks once more, and the server refuses a run without that confirmation. */
|
|
123
|
+
irreversible?: true;
|
|
124
|
+
/** A credit spend's exact charge, priced by the server; the route charges this or refuses. */
|
|
125
|
+
credits?: number;
|
|
126
|
+
/** The server's signed mark of the turn or run that proposed a spend; the browser passes it back unread. */
|
|
127
|
+
origin?: string;
|
|
128
|
+
/** A send card's digest of what it showed, returned on Run so a changed message doesn't go out under it. */
|
|
129
|
+
facts?: string;
|
|
130
|
+
/** Slack only: the id its saved card takes, chosen before it was proposed so a preview it saved and its Run share one key. */
|
|
131
|
+
cardId?: string;
|
|
132
|
+
};
|
|
133
|
+
export type AssistantActionRun = {
|
|
134
|
+
operation: string;
|
|
135
|
+
arguments: Record<string, unknown>;
|
|
136
|
+
key: string;
|
|
137
|
+
credits?: number;
|
|
138
|
+
origin?: string;
|
|
139
|
+
facts?: string;
|
|
140
|
+
confirmed?: true;
|
|
141
|
+
};
|
|
142
|
+
/** What a card's Run sends back: its arguments, and a spend's price and origin as the server gave them. */
|
|
143
|
+
export declare function actionRun(action: AssistantAction, key: string, confirmed?: boolean): AssistantActionRun;
|
|
144
|
+
/** unknown: no answer came back, so the change may have been made; the user checks before running it again. */
|
|
145
|
+
/** A run's outcome. `undo` is a card the server built from what the run returned, such as a qualification's receipt, so the user can reverse it. */
|
|
146
|
+
export type AssistantActionResult = {
|
|
147
|
+
ok: true;
|
|
148
|
+
message: string;
|
|
149
|
+
href?: string;
|
|
150
|
+
undo?: AssistantAction;
|
|
151
|
+
} | {
|
|
152
|
+
ok: false;
|
|
153
|
+
message: string;
|
|
154
|
+
unknown?: true;
|
|
155
|
+
};
|
|
156
|
+
export declare const ASSISTANT_DOCUMENT_KINDS: readonly ["one_pager", "deck", "brief", "email"];
|
|
157
|
+
export type AssistantDocumentKind = (typeof ASSISTANT_DOCUMENT_KINDS)[number];
|
|
158
|
+
/** A document the assistant wrote: a deck shows one section per slide, the rest as a page. */
|
|
159
|
+
export type AssistantDocument = {
|
|
160
|
+
kind: AssistantDocumentKind;
|
|
161
|
+
title: string;
|
|
162
|
+
subtitle?: string;
|
|
163
|
+
sections: Array<{
|
|
164
|
+
heading: string;
|
|
165
|
+
body: string;
|
|
166
|
+
}>;
|
|
167
|
+
};
|
|
168
|
+
export declare const ASSISTANT_DOCUMENT_LIMITS: {
|
|
169
|
+
readonly title: 120;
|
|
170
|
+
readonly subtitle: 200;
|
|
171
|
+
readonly heading: 120;
|
|
172
|
+
readonly body: 4000;
|
|
173
|
+
readonly sections: 14;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Server-sent events on POST /api/assistant/chat. Text arrives as deltas; a
|
|
177
|
+
* step starts a read and discards the text before it. Actions and documents
|
|
178
|
+
* arrive as the model makes them; sources arrive with the read that showed
|
|
179
|
+
* them, before any words can cite them. The turn ends with one message or error.
|
|
180
|
+
*/
|
|
181
|
+
export type AssistantChatEvent = {
|
|
182
|
+
type: "step";
|
|
183
|
+
label: string;
|
|
184
|
+
} | {
|
|
185
|
+
type: "delta";
|
|
186
|
+
text: string;
|
|
187
|
+
} | {
|
|
188
|
+
type: "action";
|
|
189
|
+
action: AssistantAction;
|
|
190
|
+
} | {
|
|
191
|
+
type: "document";
|
|
192
|
+
document: AssistantDocument;
|
|
193
|
+
}
|
|
194
|
+
/** Stored source links a read showed the agent; only these outside links open. */
|
|
195
|
+
| {
|
|
196
|
+
type: "sources";
|
|
197
|
+
urls: string[];
|
|
198
|
+
} | {
|
|
199
|
+
type: "message";
|
|
200
|
+
content: string;
|
|
201
|
+
} | {
|
|
202
|
+
type: "error";
|
|
203
|
+
code: AssistantErrorCode;
|
|
204
|
+
message: string;
|
|
205
|
+
};
|
|
206
|
+
export type AssistantErrorCode = "unavailable" | "rate_limited" | "daily_limit" | "ai_actions_exhausted" | "ai_actions_unavailable" | "failed";
|
|
207
|
+
/** Where the workspace is on the way to its first send. */
|
|
208
|
+
export type AssistantSetupStep = "request" | "delivery" | "sender" | "campaign" | "send" | "done";
|
|
209
|
+
export type AssistantTodayItem = {
|
|
210
|
+
id: string;
|
|
211
|
+
kind: "setup" | "reply" | "review" | "sender" | "signal" | "request" | "campaign" | "task";
|
|
212
|
+
title: string;
|
|
213
|
+
detail?: string;
|
|
214
|
+
href: string;
|
|
215
|
+
action: string;
|
|
216
|
+
};
|
|
217
|
+
/** Accounts shown under "Work these first". */
|
|
218
|
+
export declare const ASSISTANT_FOCUS_LIMIT = 5;
|
|
219
|
+
/** One pipeline account to work now, with every reason it is listed. */
|
|
220
|
+
export type AssistantFocusAccount = {
|
|
221
|
+
id: string;
|
|
222
|
+
name: string;
|
|
223
|
+
/** Plain reasons, strongest first, such as "Dana Lee asked a question · 2 d ago". */
|
|
224
|
+
reasons: string[];
|
|
225
|
+
href: string;
|
|
226
|
+
};
|
|
227
|
+
export type AssistantToday = {
|
|
228
|
+
setup: AssistantSetupStep | null;
|
|
229
|
+
items: AssistantTodayItem[];
|
|
230
|
+
/** Sources that could not be read; their items are missing, not zero. */
|
|
231
|
+
unavailable: string[];
|
|
232
|
+
};
|
|
233
|
+
/** GET /api/assistant/focus: "Work these first". */
|
|
234
|
+
export type AssistantFocus = {
|
|
235
|
+
accounts: AssistantFocusAccount[];
|
|
236
|
+
/** Sources that could not be read, so the ranking may miss accounts. */
|
|
237
|
+
unavailable: string[];
|
|
238
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Inclusive employee-count bands shared by imports, display, and new filters. */
|
|
2
|
+
export declare const EMPLOYEE_COUNT_BANDS: readonly [{
|
|
3
|
+
readonly value: "1_10";
|
|
4
|
+
readonly label: "1-10";
|
|
5
|
+
readonly min: 1;
|
|
6
|
+
readonly max: 10;
|
|
7
|
+
}, {
|
|
8
|
+
readonly value: "11_50";
|
|
9
|
+
readonly label: "11-50";
|
|
10
|
+
readonly min: 11;
|
|
11
|
+
readonly max: 50;
|
|
12
|
+
}, {
|
|
13
|
+
readonly value: "51_200";
|
|
14
|
+
readonly label: "51-200";
|
|
15
|
+
readonly min: 51;
|
|
16
|
+
readonly max: 200;
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: "201_500";
|
|
19
|
+
readonly label: "201-500";
|
|
20
|
+
readonly min: 201;
|
|
21
|
+
readonly max: 500;
|
|
22
|
+
}, {
|
|
23
|
+
readonly value: "501_1000";
|
|
24
|
+
readonly label: "501-1,000";
|
|
25
|
+
readonly min: 501;
|
|
26
|
+
readonly max: 1000;
|
|
27
|
+
}, {
|
|
28
|
+
readonly value: "1001_5000";
|
|
29
|
+
readonly label: "1,001-5,000";
|
|
30
|
+
readonly min: 1001;
|
|
31
|
+
readonly max: 5000;
|
|
32
|
+
}, {
|
|
33
|
+
readonly value: "5001_10000";
|
|
34
|
+
readonly label: "5,001-10,000";
|
|
35
|
+
readonly min: 5001;
|
|
36
|
+
readonly max: 10000;
|
|
37
|
+
}, {
|
|
38
|
+
readonly value: "10001_plus";
|
|
39
|
+
readonly label: "10,001+";
|
|
40
|
+
readonly min: 10001;
|
|
41
|
+
readonly max: number;
|
|
42
|
+
}];
|
|
43
|
+
/** Parse reported counts without guessing a midpoint or accepting partial text. */
|
|
44
|
+
export declare function parseEmployeeCount(raw: unknown): {
|
|
45
|
+
min: number;
|
|
46
|
+
max: number;
|
|
47
|
+
} | null;
|
|
48
|
+
export declare function employeeCountBand(raw: unknown): {
|
|
49
|
+
readonly value: "1_10";
|
|
50
|
+
readonly label: "1-10";
|
|
51
|
+
readonly min: 1;
|
|
52
|
+
readonly max: 10;
|
|
53
|
+
} | {
|
|
54
|
+
readonly value: "11_50";
|
|
55
|
+
readonly label: "11-50";
|
|
56
|
+
readonly min: 11;
|
|
57
|
+
readonly max: 50;
|
|
58
|
+
} | {
|
|
59
|
+
readonly value: "51_200";
|
|
60
|
+
readonly label: "51-200";
|
|
61
|
+
readonly min: 51;
|
|
62
|
+
readonly max: 200;
|
|
63
|
+
} | {
|
|
64
|
+
readonly value: "201_500";
|
|
65
|
+
readonly label: "201-500";
|
|
66
|
+
readonly min: 201;
|
|
67
|
+
readonly max: 500;
|
|
68
|
+
} | {
|
|
69
|
+
readonly value: "501_1000";
|
|
70
|
+
readonly label: "501-1,000";
|
|
71
|
+
readonly min: 501;
|
|
72
|
+
readonly max: 1000;
|
|
73
|
+
} | {
|
|
74
|
+
readonly value: "1001_5000";
|
|
75
|
+
readonly label: "1,001-5,000";
|
|
76
|
+
readonly min: 1001;
|
|
77
|
+
readonly max: 5000;
|
|
78
|
+
} | {
|
|
79
|
+
readonly value: "5001_10000";
|
|
80
|
+
readonly label: "5,001-10,000";
|
|
81
|
+
readonly min: 5001;
|
|
82
|
+
readonly max: 10000;
|
|
83
|
+
} | {
|
|
84
|
+
readonly value: "10001_plus";
|
|
85
|
+
readonly label: "10,001+";
|
|
86
|
+
readonly min: 10001;
|
|
87
|
+
readonly max: number;
|
|
88
|
+
} | undefined;
|
|
89
|
+
/** Empty means absent. Unknown or unsupported cross-band values stay blank. */
|
|
90
|
+
export declare function normalizeEmployeeCount(raw: unknown): string;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* GTM context: what this workspace knows about how it sells, selected for one
|
|
4
|
+
* task. One builder serves the in-app agent, Slack, phone and MCP. Each caller
|
|
5
|
+
* supplies only how to run a workspace read as the user, so auth, team access
|
|
6
|
+
* and scopes stay those of the read itself.
|
|
7
|
+
*
|
|
8
|
+
* It reads the outreach profile, one published ICP, that ICP's fit insights
|
|
9
|
+
* and the user's saved memories, then keeps what matters most for the task
|
|
10
|
+
* within a character budget. An ICP separated from its Products keeps its
|
|
11
|
+
* problems, objections, signals and writing guidance on each Product's
|
|
12
|
+
* connection, so the connected Product is read too. It is the workspace's context, not a campaign's:
|
|
13
|
+
* a campaign can write with its own product, ICP version and guidance.
|
|
14
|
+
* Selection follows what made task-aware context work in evaluations:
|
|
15
|
+
* whole items only (a claim keeps its customer and dates), every
|
|
16
|
+
* relevant section represented before any one section fills up, and what was
|
|
17
|
+
* left out counted, never hidden.
|
|
18
|
+
*
|
|
19
|
+
* Guardrails are always listed in full, outside the budget. If any source of
|
|
20
|
+
* them could not be read, or several ICPs (or an ICP's several Products) are
|
|
21
|
+
* published and none was named, `guardrails_complete` is false, so nothing prospect-facing is written
|
|
22
|
+
* against an unknown rule. Complete covers the outreach profile and the ICP
|
|
23
|
+
* read, never a campaign's own rules. Proof is listed only when it is approved and
|
|
24
|
+
* current, as campaign launch requires. A section with nothing saved is
|
|
25
|
+
* "missing" with the screen that adds it; a read that failed or is not allowed
|
|
26
|
+
* is "unavailable", never "missing".
|
|
27
|
+
*/
|
|
28
|
+
export declare const GTM_CONTEXT_TASKS: readonly ["messaging", "targeting", "objections", "call_prep", "overview"];
|
|
29
|
+
export type GtmContextTask = (typeof GTM_CONTEXT_TASKS)[number];
|
|
30
|
+
export declare const GTM_SECTION_IDS: readonly ["offer", "proof", "voice", "icp", "buyers", "problems", "objections", "signals", "learnings", "memories"];
|
|
31
|
+
export type GtmSectionId = (typeof GTM_SECTION_IDS)[number];
|
|
32
|
+
/** The reads a GTM context makes, each a workspace operation. */
|
|
33
|
+
export declare const GTM_CONTEXT_READS: readonly ["getOutreachProfile", "listIcps", "getIcp", "listIcpProducts", "getIcpFitInsights", "listAgentMemories"];
|
|
34
|
+
export type GtmContextReadId = (typeof GTM_CONTEXT_READS)[number];
|
|
35
|
+
export type GtmReadInput = {
|
|
36
|
+
params?: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
/** A reader's answer when an ICP read was refused because this person's role can't read ICPs, such as a member. */
|
|
39
|
+
export declare const GTM_READ_DENIED: unique symbol;
|
|
40
|
+
/**
|
|
41
|
+
* The reason an ICP route gives a 403 for that role: the route's `code`, and
|
|
42
|
+
* `error.details.reason` through the workspace API. Any other refusal is a
|
|
43
|
+
* failed read, so it never lets the agent draft without the ICP's rules.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ICP_ROLE_REFUSAL = "icp_profile_manager_required";
|
|
46
|
+
/** Runs one workspace read as the user: its data, GTM_READ_DENIED, or null when it failed or this connection can't make it. */
|
|
47
|
+
export type GtmContextReader = (operationId: GtmContextReadId, input: GtmReadInput) => Promise<unknown>;
|
|
48
|
+
/** Sections each task reads, most useful first. Fit insights are read only where a task lists them. */
|
|
49
|
+
export declare const TASK_SECTIONS: Record<GtmContextTask, readonly GtmSectionId[]>;
|
|
50
|
+
export declare const GTM_CONTEXT_CHARS: {
|
|
51
|
+
readonly min: 1500;
|
|
52
|
+
readonly default: 6000;
|
|
53
|
+
readonly max: 10000;
|
|
54
|
+
};
|
|
55
|
+
export declare const gtmContextInputSchema: z.ZodObject<{
|
|
56
|
+
task: z.ZodEnum<["messaging", "targeting", "objections", "call_prep", "overview"]>;
|
|
57
|
+
focus: z.ZodOptional<z.ZodString>;
|
|
58
|
+
icp_id: z.ZodOptional<z.ZodString>;
|
|
59
|
+
product_id: z.ZodOptional<z.ZodString>;
|
|
60
|
+
sections: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodEnum<["offer", "proof", "voice", "icp", "buyers", "problems", "objections", "signals", "learnings", "memories"]>, "many">, ("signals" | "icp" | "problems" | "objections" | "offer" | "proof" | "voice" | "buyers" | "learnings" | "memories")[], ("signals" | "icp" | "problems" | "objections" | "offer" | "proof" | "voice" | "buyers" | "learnings" | "memories")[]>>;
|
|
61
|
+
max_chars: z.ZodDefault<z.ZodNumber>;
|
|
62
|
+
}, "strict", z.ZodTypeAny, {
|
|
63
|
+
task: "messaging" | "objections" | "targeting" | "call_prep" | "overview";
|
|
64
|
+
max_chars: number;
|
|
65
|
+
icp_id?: string | undefined;
|
|
66
|
+
product_id?: string | undefined;
|
|
67
|
+
focus?: string | undefined;
|
|
68
|
+
sections?: ("signals" | "icp" | "problems" | "objections" | "offer" | "proof" | "voice" | "buyers" | "learnings" | "memories")[] | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
task: "messaging" | "objections" | "targeting" | "call_prep" | "overview";
|
|
71
|
+
icp_id?: string | undefined;
|
|
72
|
+
product_id?: string | undefined;
|
|
73
|
+
focus?: string | undefined;
|
|
74
|
+
sections?: ("signals" | "icp" | "problems" | "objections" | "offer" | "proof" | "voice" | "buyers" | "learnings" | "memories")[] | undefined;
|
|
75
|
+
max_chars?: number | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
export type GtmContextInput = z.infer<typeof gtmContextInputSchema>;
|
|
78
|
+
/** One tool definition for the agent and MCP. */
|
|
79
|
+
export declare const GTM_CONTEXT_TOOL: {
|
|
80
|
+
name: string;
|
|
81
|
+
title: string;
|
|
82
|
+
description: string;
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object";
|
|
85
|
+
properties: {
|
|
86
|
+
task: {
|
|
87
|
+
type: string;
|
|
88
|
+
enum: ("messaging" | "objections" | "targeting" | "call_prep" | "overview")[];
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
focus: {
|
|
92
|
+
type: string;
|
|
93
|
+
maxLength: number;
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
icp_id: {
|
|
97
|
+
type: string;
|
|
98
|
+
format: string;
|
|
99
|
+
description: string;
|
|
100
|
+
};
|
|
101
|
+
product_id: {
|
|
102
|
+
type: string;
|
|
103
|
+
format: string;
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
sections: {
|
|
107
|
+
type: string;
|
|
108
|
+
items: {
|
|
109
|
+
type: string;
|
|
110
|
+
enum: ("signals" | "icp" | "problems" | "objections" | "offer" | "proof" | "voice" | "buyers" | "learnings" | "memories")[];
|
|
111
|
+
};
|
|
112
|
+
minItems: number;
|
|
113
|
+
maxItems: 10;
|
|
114
|
+
uniqueItems: boolean;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
max_chars: {
|
|
118
|
+
type: string;
|
|
119
|
+
minimum: 1500;
|
|
120
|
+
maximum: 10000;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
required: string[];
|
|
125
|
+
additionalProperties: boolean;
|
|
126
|
+
};
|
|
127
|
+
inputError: string;
|
|
128
|
+
};
|
|
129
|
+
/** Offered to a connection that can make its core reads: the outreach profile or the ICPs. */
|
|
130
|
+
export declare function offersGtmContext(scopes: readonly string[]): boolean;
|
|
131
|
+
export type GtmItem = {
|
|
132
|
+
ref: string;
|
|
133
|
+
text: string;
|
|
134
|
+
};
|
|
135
|
+
export type GtmSection = {
|
|
136
|
+
id: GtmSectionId | "guardrails";
|
|
137
|
+
title: string;
|
|
138
|
+
/** Where the items come from, as the app names it. */
|
|
139
|
+
source: string;
|
|
140
|
+
items: GtmItem[];
|
|
141
|
+
/** Items left out to stay within the budget. */
|
|
142
|
+
omitted: number;
|
|
143
|
+
};
|
|
144
|
+
export type GtmLink = {
|
|
145
|
+
label: string;
|
|
146
|
+
href: string;
|
|
147
|
+
};
|
|
148
|
+
export type GtmGap = {
|
|
149
|
+
section: GtmSectionId;
|
|
150
|
+
reason: string;
|
|
151
|
+
fix: GtmLink;
|
|
152
|
+
};
|
|
153
|
+
export type GtmContext = {
|
|
154
|
+
task: GtmContextTask;
|
|
155
|
+
focus: string | null;
|
|
156
|
+
icp: {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
version: number | null;
|
|
160
|
+
updated_at: string | null;
|
|
161
|
+
} | null;
|
|
162
|
+
/** Other published ICPs, to read one by its ID. */
|
|
163
|
+
other_icps: {
|
|
164
|
+
id: string;
|
|
165
|
+
name: string;
|
|
166
|
+
}[];
|
|
167
|
+
/** The connected Product read with an ICP that keeps its guidance on its Products. */
|
|
168
|
+
product: {
|
|
169
|
+
id: string;
|
|
170
|
+
name: string;
|
|
171
|
+
} | null;
|
|
172
|
+
/** The ICP's other connected Products, to read one by its ID. */
|
|
173
|
+
other_products: {
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
}[];
|
|
177
|
+
sections: GtmSection[];
|
|
178
|
+
/** True when the outreach profile's and this ICP's guardrails were all read. A campaign's own rules aren't part of it. */
|
|
179
|
+
guardrails_complete: boolean;
|
|
180
|
+
/** True when every guardrail source was read but several ICPs are published and none was named. */
|
|
181
|
+
guardrails_need_icp: boolean;
|
|
182
|
+
/** True when the ICP keeps its guidance on several connected Products and none was named. */
|
|
183
|
+
guardrails_need_product: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* True when the only guardrails left unread are the ICP's, because this
|
|
186
|
+
* person's workspace role can't read ICPs. Everything else was read.
|
|
187
|
+
*/
|
|
188
|
+
guardrails_role_limited: boolean;
|
|
189
|
+
missing: GtmGap[];
|
|
190
|
+
/** Reads that failed or were not allowed; what they hold is unknown, not empty. */
|
|
191
|
+
unavailable: string[];
|
|
192
|
+
/** Facts about the context itself, such as an unconfirmed profile. */
|
|
193
|
+
notes: string[];
|
|
194
|
+
/** max_chars and used_chars cover the items other than guardrails. */
|
|
195
|
+
budget: {
|
|
196
|
+
max_chars: number;
|
|
197
|
+
used_chars: number;
|
|
198
|
+
guardrail_chars: number;
|
|
199
|
+
omitted_items: number;
|
|
200
|
+
};
|
|
201
|
+
generated_at: string;
|
|
202
|
+
};
|
|
203
|
+
/** Screens that add what is missing. Every link is one the agent may show. */
|
|
204
|
+
export declare const GTM_FIX_LINKS: {
|
|
205
|
+
readonly writing: "/dashboard/outreach/campaigns?settings=writing";
|
|
206
|
+
readonly icps: "/dashboard/account?section=saved-icps";
|
|
207
|
+
readonly pipeline: "/dashboard/pipeline";
|
|
208
|
+
};
|
|
209
|
+
/** What each read returned: undefined when not made, null when it failed or is not allowed. */
|
|
210
|
+
export type GtmContextRaw = {
|
|
211
|
+
profile?: unknown;
|
|
212
|
+
icps?: unknown;
|
|
213
|
+
icp?: unknown;
|
|
214
|
+
products?: unknown;
|
|
215
|
+
insights?: unknown;
|
|
216
|
+
memories?: unknown;
|
|
217
|
+
};
|
|
218
|
+
/** The sections a call covers, in the task's order; asked-for sections the task doesn't list go last. */
|
|
219
|
+
export declare function sectionsInScope(input: Pick<GtmContextInput, "task" | "sections">): GtmSectionId[];
|
|
220
|
+
/** Builds a GTM context from its reads. Pure: the same reads always give the same context. */
|
|
221
|
+
export declare function buildGtmContext(input: GtmContextInput, raw: GtmContextRaw, now: Date, options?: {
|
|
222
|
+
memoriesInPrompt?: boolean;
|
|
223
|
+
}): GtmContext;
|
|
224
|
+
/**
|
|
225
|
+
* Runs the reads: what is known up front (with a given icp_id, that ICP too),
|
|
226
|
+
* then the ICP the list points to.
|
|
227
|
+
*/
|
|
228
|
+
export declare function loadGtmContext(input: GtmContextInput, read: GtmContextReader, options?: {
|
|
229
|
+
now?: Date;
|
|
230
|
+
memoriesInPrompt?: boolean;
|
|
231
|
+
}): Promise<GtmContext>;
|
|
232
|
+
/** The context as Markdown, for chat, Slack and MCP. Links are relative to the app unless an origin is given. */
|
|
233
|
+
export declare function gtmContextMarkdown(context: GtmContext, origin?: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const icpProductSelectionRefSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
icp_id: z.ZodString;
|
|
5
|
+
icp_version_id: z.ZodString;
|
|
6
|
+
product_id: z.ZodString;
|
|
7
|
+
product_version_id: z.ZodString;
|
|
8
|
+
link_id: z.ZodString;
|
|
9
|
+
link_version_id: z.ZodString;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
id: string;
|
|
12
|
+
icp_id: string;
|
|
13
|
+
icp_version_id: string;
|
|
14
|
+
product_id: string;
|
|
15
|
+
product_version_id: string;
|
|
16
|
+
link_id: string;
|
|
17
|
+
link_version_id: string;
|
|
18
|
+
}, {
|
|
19
|
+
id: string;
|
|
20
|
+
icp_id: string;
|
|
21
|
+
icp_version_id: string;
|
|
22
|
+
product_id: string;
|
|
23
|
+
product_version_id: string;
|
|
24
|
+
link_id: string;
|
|
25
|
+
link_version_id: string;
|
|
26
|
+
}>;
|
|
27
|
+
export type IcpProductSelectionRef = z.infer<typeof icpProductSelectionRefSchema>;
|