@cognilead/mcp-server 0.1.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/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/api-client.d.ts +7 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +50 -0
- package/dist/api-client.js.map +1 -0
- package/dist/auth.d.ts +25 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +62 -0
- package/dist/auth.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +21 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +5 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +169 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +153 -0
- package/dist/index.js.map +1 -0
- package/dist/rate-limit.d.ts +17 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +80 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/schemas.d.ts +384 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +206 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tools/check-registry-flags.d.ts +2 -0
- package/dist/tools/check-registry-flags.d.ts.map +1 -0
- package/dist/tools/check-registry-flags.js +31 -0
- package/dist/tools/check-registry-flags.js.map +1 -0
- package/dist/tools/draft-pitch.d.ts +15 -0
- package/dist/tools/draft-pitch.d.ts.map +1 -0
- package/dist/tools/draft-pitch.js +69 -0
- package/dist/tools/draft-pitch.js.map +1 -0
- package/dist/tools/evidence-export.d.ts +7 -0
- package/dist/tools/evidence-export.d.ts.map +1 -0
- package/dist/tools/evidence-export.js +42 -0
- package/dist/tools/evidence-export.js.map +1 -0
- package/dist/tools/find-companies-with-triggers.d.ts +2 -0
- package/dist/tools/find-companies-with-triggers.d.ts.map +1 -0
- package/dist/tools/find-companies-with-triggers.js +29 -0
- package/dist/tools/find-companies-with-triggers.js.map +1 -0
- package/dist/tools/generate-seo-content.d.ts +2 -0
- package/dist/tools/generate-seo-content.d.ts.map +1 -0
- package/dist/tools/generate-seo-content.js +14 -0
- package/dist/tools/generate-seo-content.js.map +1 -0
- package/dist/tools/get-business-sheet.d.ts +2 -0
- package/dist/tools/get-business-sheet.d.ts.map +1 -0
- package/dist/tools/get-business-sheet.js +24 -0
- package/dist/tools/get-business-sheet.js.map +1 -0
- package/dist/tools/ingest-lead.d.ts +2 -0
- package/dist/tools/ingest-lead.d.ts.map +1 -0
- package/dist/tools/ingest-lead.js +26 -0
- package/dist/tools/ingest-lead.js.map +1 -0
- package/dist/tools/rank-companies-in-vertical.d.ts +2 -0
- package/dist/tools/rank-companies-in-vertical.d.ts.map +1 -0
- package/dist/tools/rank-companies-in-vertical.js +33 -0
- package/dist/tools/rank-companies-in-vertical.js.map +1 -0
- package/dist/tools/run-campaign.d.ts +2 -0
- package/dist/tools/run-campaign.d.ts.map +1 -0
- package/dist/tools/run-campaign.js +15 -0
- package/dist/tools/run-campaign.js.map +1 -0
- package/dist/tools/score-dd-risk.d.ts +2 -0
- package/dist/tools/score-dd-risk.d.ts.map +1 -0
- package/dist/tools/score-dd-risk.js +22 -0
- package/dist/tools/score-dd-risk.js.map +1 -0
- package/dist/tools/score-signal.d.ts +15 -0
- package/dist/tools/score-signal.d.ts.map +1 -0
- package/dist/tools/score-signal.js +124 -0
- package/dist/tools/score-signal.js.map +1 -0
- package/dist/tools/suppress.d.ts +2 -0
- package/dist/tools/suppress.d.ts.map +1 -0
- package/dist/tools/suppress.js +13 -0
- package/dist/tools/suppress.js.map +1 -0
- package/package.json +70 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @cognilead/mcp-server — stdio entrypoint.
|
|
3
|
+
//
|
|
4
|
+
// Wires the CogniLead tools (2 free, 4 gated) into an MCP server
|
|
5
|
+
// that speaks the stdio transport. Cursor, Claude Desktop and Windsurf
|
|
6
|
+
// all launch this as a child process and exchange JSON-RPC over stdin/
|
|
7
|
+
// stdout.
|
|
8
|
+
//
|
|
9
|
+
// Free tools run locally (no network). Gated tools hit the hosted API
|
|
10
|
+
// at COGNILEAD_API_URL. Missing API key for a gated tool surfaces as a
|
|
11
|
+
// structured MCP error containing the upgrade URL — the IDE renders that
|
|
12
|
+
// directly to the developer, which is the canonical acquisition moment.
|
|
13
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
14
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
15
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
16
|
+
import { DraftPitchJsonSchema, ScoreSignalJsonSchema, IngestLeadJsonSchema, RunCampaignJsonSchema, SuppressJsonSchema, GenerateSeoContentJsonSchema, } from './schemas.js';
|
|
17
|
+
import { draftPitch } from './tools/draft-pitch.js';
|
|
18
|
+
import { scoreSignal } from './tools/score-signal.js';
|
|
19
|
+
import { ingestLead } from './tools/ingest-lead.js';
|
|
20
|
+
import { runCampaign } from './tools/run-campaign.js';
|
|
21
|
+
import { suppress } from './tools/suppress.js';
|
|
22
|
+
import { generateSeoContent } from './tools/generate-seo-content.js';
|
|
23
|
+
import { McpAuthError, McpQuotaError } from './auth.js';
|
|
24
|
+
const SERVER_INFO = {
|
|
25
|
+
name: 'cognilead-mcp',
|
|
26
|
+
version: '0.1.0',
|
|
27
|
+
};
|
|
28
|
+
export const TOOLS = [
|
|
29
|
+
{
|
|
30
|
+
name: 'cognilead.draft_pitch',
|
|
31
|
+
description: 'Draft a cold-outbound pitch for a technical company based on a public signal (job post URL, GitHub repo, HN comment). EU/CH jurisdiction routing — pitches for EU recipients go through EU-resident inference for GDPR. Returns subject_line, email_body_markdown, and a technical_hook_verified flag (false ⇒ the signal lacked a citable hook). Free tier capped at 20 calls/day.',
|
|
32
|
+
inputSchema: DraftPitchJsonSchema,
|
|
33
|
+
handler: draftPitch,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'cognilead.score_signal',
|
|
37
|
+
description: 'Rate a JSON signal for fit against a target product on a 0-100 scale. Deterministic: keyword match × recency × source quality × URL-presence. Returns fit_score, reasoning, and a recommended_action of pitch | enrich | skip. Cheap and instant — no LLM call. Free tier capped at 50 calls/day.',
|
|
38
|
+
inputSchema: ScoreSignalJsonSchema,
|
|
39
|
+
handler: scoreSignal,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'cognilead.ingest_lead',
|
|
43
|
+
description: 'Register a lead in the CogniLead pipeline. Runs through the intersect stage (suppression check, dedup, Chainlog audit anchor). Returns the persisted lead row including its chainlog_event_id. Requires a CogniLead API key.',
|
|
44
|
+
inputSchema: IngestLeadJsonSchema,
|
|
45
|
+
handler: ingestLead,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'cognilead.run_campaign',
|
|
49
|
+
description: 'Kick off a campaign by id, optionally restricted to a set of lead_ids. The hosted API runs the per-step personalize → policy-gate → dispatch pipeline. Returns the dispatch result including send_ids and the AgentGate decision. Requires a CogniLead API key.',
|
|
50
|
+
inputSchema: RunCampaignJsonSchema,
|
|
51
|
+
handler: runCampaign,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'cognilead.suppress',
|
|
55
|
+
description: "Add an email or domain to the suppression list with a reason. Suppressed addresses are filtered by the intersect stage on every future lead. Either 'email' or 'domain' must be provided. Requires a CogniLead API key.",
|
|
56
|
+
inputSchema: SuppressJsonSchema,
|
|
57
|
+
handler: suppress,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'cognilead.generate_seo_content',
|
|
61
|
+
description: 'Generate SEO content via phi-cloud. kind=blog|landing returns a full optimised page (title, slug, meta description, headings, Markdown body, target keywords, internal-link ideas); kind=recommendations returns a prioritised on-page SEO audit of existing_content. Provide product + topic (+ optional target_keywords, audience). Requires a CogniLead API key.',
|
|
62
|
+
inputSchema: GenerateSeoContentJsonSchema,
|
|
63
|
+
handler: generateSeoContent,
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
function toolByName(name) {
|
|
67
|
+
return TOOLS.find((t) => t.name === name);
|
|
68
|
+
}
|
|
69
|
+
function formatToolError(e) {
|
|
70
|
+
if (e instanceof McpAuthError) {
|
|
71
|
+
return {
|
|
72
|
+
error: {
|
|
73
|
+
code: e.code,
|
|
74
|
+
message: e.message,
|
|
75
|
+
upgrade_url: 'https://cognilead.ai/signup?via=mcp',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (e instanceof McpQuotaError) {
|
|
80
|
+
return { error: { code: e.code, message: e.message } };
|
|
81
|
+
}
|
|
82
|
+
if (e instanceof Error) {
|
|
83
|
+
return { error: { code: 'mcp.tool_error', message: e.message } };
|
|
84
|
+
}
|
|
85
|
+
return { error: { code: 'mcp.unknown', message: String(e) } };
|
|
86
|
+
}
|
|
87
|
+
export function createServer() {
|
|
88
|
+
const server = new Server(SERVER_INFO, {
|
|
89
|
+
capabilities: {
|
|
90
|
+
tools: {},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
94
|
+
return {
|
|
95
|
+
tools: TOOLS.map((t) => ({
|
|
96
|
+
name: t.name,
|
|
97
|
+
description: t.description,
|
|
98
|
+
// The SDK casts inputSchema through its own validator; supplying
|
|
99
|
+
// a JSON Schema object is the supported shape.
|
|
100
|
+
inputSchema: t.inputSchema,
|
|
101
|
+
})),
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
105
|
+
const { name, arguments: args } = request.params;
|
|
106
|
+
const tool = toolByName(name);
|
|
107
|
+
if (!tool) {
|
|
108
|
+
return {
|
|
109
|
+
isError: true,
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: 'text',
|
|
113
|
+
text: JSON.stringify({
|
|
114
|
+
error: { code: 'mcp.unknown_tool', message: `Unknown tool: ${name}` },
|
|
115
|
+
}),
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const result = await tool.handler(args ?? {});
|
|
122
|
+
return {
|
|
123
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
const payload = formatToolError(e);
|
|
128
|
+
return {
|
|
129
|
+
isError: true,
|
|
130
|
+
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return server;
|
|
135
|
+
}
|
|
136
|
+
async function main() {
|
|
137
|
+
const server = createServer();
|
|
138
|
+
const transport = new StdioServerTransport();
|
|
139
|
+
await server.connect(transport);
|
|
140
|
+
// Log to stderr (stdout is the JSON-RPC wire — never log there).
|
|
141
|
+
process.stderr.write(`[cognilead-mcp] ${SERVER_INFO.name}@${SERVER_INFO.version} listening on stdio\n`);
|
|
142
|
+
}
|
|
143
|
+
// Run only when invoked directly (not when imported by http.ts or tests).
|
|
144
|
+
const isDirectInvocation = import.meta.url === `file://${process.argv[1]}` ||
|
|
145
|
+
process.argv[1]?.endsWith('/cognilead-mcp') ||
|
|
146
|
+
process.argv[1]?.endsWith('/index.js');
|
|
147
|
+
if (isDirectInvocation) {
|
|
148
|
+
main().catch((err) => {
|
|
149
|
+
process.stderr.write(`[cognilead-mcp] fatal: ${err.message}\n`);
|
|
150
|
+
process.exit(1);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,4CAA4C;AAC5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AA;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface QuotaState {
|
|
2
|
+
date: string;
|
|
3
|
+
counts: Record<string, number>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Increments the counter for `toolName` and throws McpQuotaError if the
|
|
7
|
+
* daily cap would be exceeded. Free tools call this AFTER input validation
|
|
8
|
+
* so we don't burn quota on malformed calls.
|
|
9
|
+
*/
|
|
10
|
+
export declare function consumeFreeQuota(toolName: string): {
|
|
11
|
+
remaining: number;
|
|
12
|
+
limit: number;
|
|
13
|
+
};
|
|
14
|
+
/** For tests / introspection. */
|
|
15
|
+
export declare function _quotaSnapshot(): QuotaState;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=rate-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../src/rate-limit.ts"],"names":[],"mappings":"AAqBA,UAAU,UAAU;IAElB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAuCD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAmBvF;AAED,iCAAiC;AACjC,wBAAgB,cAAc,IAAI,UAAU,CAE3C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// In-process daily quota counter for the free tools. Resets at UTC
|
|
2
|
+
// midnight. Persists to ~/.cognilead/quota.json so the counter survives
|
|
3
|
+
// IDE restarts within the same calendar day; fails open if the FS isn't
|
|
4
|
+
// writable (e.g., read-only containers, sandboxed extensions).
|
|
5
|
+
//
|
|
6
|
+
// This is intentionally not a robust distributed limiter. It exists to
|
|
7
|
+
// keep one developer's IDE from burning through free-tier inference. The
|
|
8
|
+
// hosted /api/v1/* endpoints enforce real per-key quotas.
|
|
9
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { McpQuotaError } from './auth.js';
|
|
12
|
+
import { loadConfig } from './config.js';
|
|
13
|
+
const DAILY_QUOTAS = {
|
|
14
|
+
'cognilead.draft_pitch': 20,
|
|
15
|
+
'cognilead.score_signal': 50,
|
|
16
|
+
'cognilead.check_registry_flags': 50,
|
|
17
|
+
};
|
|
18
|
+
function utcDate() {
|
|
19
|
+
return new Date().toISOString().slice(0, 10);
|
|
20
|
+
}
|
|
21
|
+
function quotaPath() {
|
|
22
|
+
return join(loadConfig().quotaDir, 'quota.json');
|
|
23
|
+
}
|
|
24
|
+
let cache = null;
|
|
25
|
+
function load() {
|
|
26
|
+
if (cache && cache.date === utcDate())
|
|
27
|
+
return cache;
|
|
28
|
+
const today = utcDate();
|
|
29
|
+
try {
|
|
30
|
+
const raw = readFileSync(quotaPath(), 'utf8');
|
|
31
|
+
const parsed = JSON.parse(raw);
|
|
32
|
+
if (parsed.date === today && parsed.counts && typeof parsed.counts === 'object') {
|
|
33
|
+
cache = parsed;
|
|
34
|
+
return cache;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
/* fall through — fresh start */
|
|
39
|
+
}
|
|
40
|
+
cache = { date: today, counts: {} };
|
|
41
|
+
return cache;
|
|
42
|
+
}
|
|
43
|
+
function persist(state) {
|
|
44
|
+
try {
|
|
45
|
+
const dir = loadConfig().quotaDir;
|
|
46
|
+
if (!existsSync(dir))
|
|
47
|
+
mkdirSync(dir, { recursive: true });
|
|
48
|
+
writeFileSync(quotaPath(), JSON.stringify(state, null, 2), 'utf8');
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// fail-open: read-only FS, locked-down sandbox, etc.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Increments the counter for `toolName` and throws McpQuotaError if the
|
|
56
|
+
* daily cap would be exceeded. Free tools call this AFTER input validation
|
|
57
|
+
* so we don't burn quota on malformed calls.
|
|
58
|
+
*/
|
|
59
|
+
export function consumeFreeQuota(toolName) {
|
|
60
|
+
const limit = DAILY_QUOTAS[toolName];
|
|
61
|
+
if (limit === undefined) {
|
|
62
|
+
// Free quota not defined for this tool — treat as unlimited.
|
|
63
|
+
return { remaining: Number.POSITIVE_INFINITY, limit: Number.POSITIVE_INFINITY };
|
|
64
|
+
}
|
|
65
|
+
const state = load();
|
|
66
|
+
const used = state.counts[toolName] ?? 0;
|
|
67
|
+
if (used >= limit) {
|
|
68
|
+
const { signupUrl } = loadConfig();
|
|
69
|
+
throw new McpQuotaError(`Free-tier daily limit hit for ${toolName} (${limit}/day). ` +
|
|
70
|
+
`Resets at UTC midnight. Upgrade for higher limits: ${signupUrl}`);
|
|
71
|
+
}
|
|
72
|
+
state.counts[toolName] = used + 1;
|
|
73
|
+
persist(state);
|
|
74
|
+
return { remaining: limit - state.counts[toolName], limit };
|
|
75
|
+
}
|
|
76
|
+
/** For tests / introspection. */
|
|
77
|
+
export function _quotaSnapshot() {
|
|
78
|
+
return load();
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=rate-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../src/rate-limit.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,wEAAwE;AACxE,wEAAwE;AACxE,+DAA+D;AAC/D,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,M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ZodString;
|
|
4
|
+
company_name: z.ZodString;
|
|
5
|
+
target_product: z.ZodString;
|
|
6
|
+
signal: z.ZodObject<{
|
|
7
|
+
source: z.ZodOptional<z.ZodString>;
|
|
8
|
+
source_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10
|
+
raw_payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
source?: string | undefined;
|
|
13
|
+
source_url?: string | null | undefined;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
source?: string | undefined;
|
|
18
|
+
source_url?: string | null | undefined;
|
|
19
|
+
description?: string | undefined;
|
|
20
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
jurisdiction: z.ZodDefault<z.ZodString>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
company_domain: string;
|
|
25
|
+
company_name: string;
|
|
26
|
+
target_product: string;
|
|
27
|
+
signal: {
|
|
28
|
+
source?: string | undefined;
|
|
29
|
+
source_url?: string | null | undefined;
|
|
30
|
+
description?: string | undefined;
|
|
31
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
32
|
+
};
|
|
33
|
+
jurisdiction: string;
|
|
34
|
+
}, {
|
|
35
|
+
company_domain: string;
|
|
36
|
+
company_name: string;
|
|
37
|
+
target_product: string;
|
|
38
|
+
signal: {
|
|
39
|
+
source?: string | undefined;
|
|
40
|
+
source_url?: string | null | undefined;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
43
|
+
};
|
|
44
|
+
jurisdiction?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type DraftPitchInput = z.infer<typeof DraftPitchInput>;
|
|
47
|
+
export declare const DraftPitchJsonSchema: {
|
|
48
|
+
readonly type: "object";
|
|
49
|
+
readonly required: readonly ["company_domain", "company_name", "target_product", "signal"];
|
|
50
|
+
readonly properties: {
|
|
51
|
+
readonly company_domain: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
readonly minLength: 3;
|
|
54
|
+
readonly description: "Company domain, e.g. acme.com";
|
|
55
|
+
};
|
|
56
|
+
readonly company_name: {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
readonly minLength: 1;
|
|
59
|
+
};
|
|
60
|
+
readonly target_product: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly description: "Your product being pitched, e.g. chainlog, payprimitives";
|
|
63
|
+
};
|
|
64
|
+
readonly signal: {
|
|
65
|
+
readonly type: "object";
|
|
66
|
+
readonly properties: {
|
|
67
|
+
readonly source: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
};
|
|
70
|
+
readonly source_url: {
|
|
71
|
+
readonly type: readonly ["string", "null"];
|
|
72
|
+
readonly format: "uri";
|
|
73
|
+
};
|
|
74
|
+
readonly description: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
};
|
|
77
|
+
readonly raw_payload: {
|
|
78
|
+
readonly type: "object";
|
|
79
|
+
readonly additionalProperties: true;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
readonly additionalProperties: false;
|
|
83
|
+
};
|
|
84
|
+
readonly jurisdiction: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
readonly minLength: 2;
|
|
87
|
+
readonly maxLength: 2;
|
|
88
|
+
readonly default: "US";
|
|
89
|
+
readonly description: "ISO 3166 alpha-2 country code; drives EU/CH model routing";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly additionalProperties: false;
|
|
93
|
+
};
|
|
94
|
+
export declare const ScoreSignalInput: z.ZodObject<{
|
|
95
|
+
signal: z.ZodObject<{
|
|
96
|
+
source_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
description: z.ZodOptional<z.ZodString>;
|
|
98
|
+
raw_payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
99
|
+
} & {
|
|
100
|
+
source: z.ZodString;
|
|
101
|
+
scraped_at: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
source: string;
|
|
104
|
+
source_url?: string | null | undefined;
|
|
105
|
+
description?: string | undefined;
|
|
106
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
107
|
+
scraped_at?: string | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
source: string;
|
|
110
|
+
source_url?: string | null | undefined;
|
|
111
|
+
description?: string | undefined;
|
|
112
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
113
|
+
scraped_at?: string | undefined;
|
|
114
|
+
}>;
|
|
115
|
+
target_product: z.ZodString;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
target_product: string;
|
|
118
|
+
signal: {
|
|
119
|
+
source: string;
|
|
120
|
+
source_url?: string | null | undefined;
|
|
121
|
+
description?: string | undefined;
|
|
122
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
123
|
+
scraped_at?: string | undefined;
|
|
124
|
+
};
|
|
125
|
+
}, {
|
|
126
|
+
target_product: string;
|
|
127
|
+
signal: {
|
|
128
|
+
source: string;
|
|
129
|
+
source_url?: string | null | undefined;
|
|
130
|
+
description?: string | undefined;
|
|
131
|
+
raw_payload?: Record<string, unknown> | undefined;
|
|
132
|
+
scraped_at?: string | undefined;
|
|
133
|
+
};
|
|
134
|
+
}>;
|
|
135
|
+
export type ScoreSignalInput = z.infer<typeof ScoreSignalInput>;
|
|
136
|
+
export declare const ScoreSignalJsonSchema: {
|
|
137
|
+
readonly type: "object";
|
|
138
|
+
readonly required: readonly ["signal", "target_product"];
|
|
139
|
+
readonly properties: {
|
|
140
|
+
readonly signal: {
|
|
141
|
+
readonly type: "object";
|
|
142
|
+
readonly required: readonly ["source"];
|
|
143
|
+
readonly properties: {
|
|
144
|
+
readonly source: {
|
|
145
|
+
readonly type: "string";
|
|
146
|
+
readonly description: "e.g. github_repo, hn_who_hiring, apify_linkedin_jobs";
|
|
147
|
+
};
|
|
148
|
+
readonly source_url: {
|
|
149
|
+
readonly type: readonly ["string", "null"];
|
|
150
|
+
readonly format: "uri";
|
|
151
|
+
};
|
|
152
|
+
readonly description: {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
};
|
|
155
|
+
readonly scraped_at: {
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
readonly format: "date-time";
|
|
158
|
+
};
|
|
159
|
+
readonly raw_payload: {
|
|
160
|
+
readonly type: "object";
|
|
161
|
+
readonly additionalProperties: true;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
readonly additionalProperties: false;
|
|
165
|
+
};
|
|
166
|
+
readonly target_product: {
|
|
167
|
+
readonly type: "string";
|
|
168
|
+
readonly minLength: 1;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
readonly additionalProperties: false;
|
|
172
|
+
};
|
|
173
|
+
export declare const IngestLeadInput: z.ZodObject<{
|
|
174
|
+
company_domain: z.ZodString;
|
|
175
|
+
company_name: z.ZodString;
|
|
176
|
+
target_product: z.ZodString;
|
|
177
|
+
best_contact_email: z.ZodNullable<z.ZodString>;
|
|
178
|
+
contact_role_class: z.ZodNullable<z.ZodEnum<["eng_lead", "cto", "founder", "recruit", "unknown"]>>;
|
|
179
|
+
jurisdiction: z.ZodString;
|
|
180
|
+
technical_hook_text: z.ZodNullable<z.ZodString>;
|
|
181
|
+
technical_hook_verified: z.ZodBoolean;
|
|
182
|
+
signal_ids: z.ZodArray<z.ZodString, "many">;
|
|
183
|
+
fit_score: z.ZodNullable<z.ZodNumber>;
|
|
184
|
+
}, "strip", z.ZodTypeAny, {
|
|
185
|
+
company_domain: string;
|
|
186
|
+
company_name: string;
|
|
187
|
+
target_product: string;
|
|
188
|
+
jurisdiction: string;
|
|
189
|
+
best_contact_email: string | null;
|
|
190
|
+
contact_role_class: "unknown" | "eng_lead" | "cto" | "founder" | "recruit" | null;
|
|
191
|
+
technical_hook_text: string | null;
|
|
192
|
+
technical_hook_verified: boolean;
|
|
193
|
+
signal_ids: string[];
|
|
194
|
+
fit_score: number | null;
|
|
195
|
+
}, {
|
|
196
|
+
company_domain: string;
|
|
197
|
+
company_name: string;
|
|
198
|
+
target_product: string;
|
|
199
|
+
jurisdiction: string;
|
|
200
|
+
best_contact_email: string | null;
|
|
201
|
+
contact_role_class: "unknown" | "eng_lead" | "cto" | "founder" | "recruit" | null;
|
|
202
|
+
technical_hook_text: string | null;
|
|
203
|
+
technical_hook_verified: boolean;
|
|
204
|
+
signal_ids: string[];
|
|
205
|
+
fit_score: number | null;
|
|
206
|
+
}>;
|
|
207
|
+
export type IngestLeadInput = z.infer<typeof IngestLeadInput>;
|
|
208
|
+
export declare const IngestLeadJsonSchema: {
|
|
209
|
+
readonly type: "object";
|
|
210
|
+
readonly required: readonly ["company_domain", "company_name", "target_product", "best_contact_email", "contact_role_class", "jurisdiction", "technical_hook_text", "technical_hook_verified", "signal_ids", "fit_score"];
|
|
211
|
+
readonly properties: {
|
|
212
|
+
readonly company_domain: {
|
|
213
|
+
readonly type: "string";
|
|
214
|
+
readonly minLength: 3;
|
|
215
|
+
};
|
|
216
|
+
readonly company_name: {
|
|
217
|
+
readonly type: "string";
|
|
218
|
+
readonly minLength: 1;
|
|
219
|
+
};
|
|
220
|
+
readonly target_product: {
|
|
221
|
+
readonly type: "string";
|
|
222
|
+
readonly minLength: 1;
|
|
223
|
+
};
|
|
224
|
+
readonly best_contact_email: {
|
|
225
|
+
readonly type: readonly ["string", "null"];
|
|
226
|
+
readonly format: "email";
|
|
227
|
+
};
|
|
228
|
+
readonly contact_role_class: {
|
|
229
|
+
readonly type: readonly ["string", "null"];
|
|
230
|
+
readonly enum: readonly ["eng_lead", "cto", "founder", "recruit", "unknown", null];
|
|
231
|
+
};
|
|
232
|
+
readonly jurisdiction: {
|
|
233
|
+
readonly type: "string";
|
|
234
|
+
readonly minLength: 2;
|
|
235
|
+
readonly maxLength: 2;
|
|
236
|
+
};
|
|
237
|
+
readonly technical_hook_text: {
|
|
238
|
+
readonly type: readonly ["string", "null"];
|
|
239
|
+
};
|
|
240
|
+
readonly technical_hook_verified: {
|
|
241
|
+
readonly type: "boolean";
|
|
242
|
+
};
|
|
243
|
+
readonly signal_ids: {
|
|
244
|
+
readonly type: "array";
|
|
245
|
+
readonly items: {
|
|
246
|
+
readonly type: "string";
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
readonly fit_score: {
|
|
250
|
+
readonly type: readonly ["integer", "null"];
|
|
251
|
+
readonly minimum: 0;
|
|
252
|
+
readonly maximum: 100;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
readonly additionalProperties: false;
|
|
256
|
+
};
|
|
257
|
+
export declare const RunCampaignInput: z.ZodObject<{
|
|
258
|
+
campaign_id: z.ZodString;
|
|
259
|
+
lead_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
campaign_id: string;
|
|
262
|
+
lead_ids?: string[] | undefined;
|
|
263
|
+
}, {
|
|
264
|
+
campaign_id: string;
|
|
265
|
+
lead_ids?: string[] | undefined;
|
|
266
|
+
}>;
|
|
267
|
+
export type RunCampaignInput = z.infer<typeof RunCampaignInput>;
|
|
268
|
+
export declare const RunCampaignJsonSchema: {
|
|
269
|
+
readonly type: "object";
|
|
270
|
+
readonly required: readonly ["campaign_id"];
|
|
271
|
+
readonly properties: {
|
|
272
|
+
readonly campaign_id: {
|
|
273
|
+
readonly type: "string";
|
|
274
|
+
readonly minLength: 1;
|
|
275
|
+
};
|
|
276
|
+
readonly lead_ids: {
|
|
277
|
+
readonly type: "array";
|
|
278
|
+
readonly items: {
|
|
279
|
+
readonly type: "string";
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
readonly additionalProperties: false;
|
|
284
|
+
};
|
|
285
|
+
export declare const SuppressInput: z.ZodEffects<z.ZodObject<{
|
|
286
|
+
email: z.ZodOptional<z.ZodString>;
|
|
287
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
288
|
+
reason: z.ZodEnum<["unsubscribe", "bounce_hard", "bounce_soft_repeat", "reply_negative", "gdpr_request", "manual"]>;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
reason: "unsubscribe" | "bounce_hard" | "bounce_soft_repeat" | "reply_negative" | "gdpr_request" | "manual";
|
|
291
|
+
email?: string | undefined;
|
|
292
|
+
domain?: string | undefined;
|
|
293
|
+
}, {
|
|
294
|
+
reason: "unsubscribe" | "bounce_hard" | "bounce_soft_repeat" | "reply_negative" | "gdpr_request" | "manual";
|
|
295
|
+
email?: string | undefined;
|
|
296
|
+
domain?: string | undefined;
|
|
297
|
+
}>, {
|
|
298
|
+
reason: "unsubscribe" | "bounce_hard" | "bounce_soft_repeat" | "reply_negative" | "gdpr_request" | "manual";
|
|
299
|
+
email?: string | undefined;
|
|
300
|
+
domain?: string | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
reason: "unsubscribe" | "bounce_hard" | "bounce_soft_repeat" | "reply_negative" | "gdpr_request" | "manual";
|
|
303
|
+
email?: string | undefined;
|
|
304
|
+
domain?: string | undefined;
|
|
305
|
+
}>;
|
|
306
|
+
export type SuppressInput = z.infer<typeof SuppressInput>;
|
|
307
|
+
export declare const SuppressJsonSchema: {
|
|
308
|
+
readonly type: "object";
|
|
309
|
+
readonly required: readonly ["reason"];
|
|
310
|
+
readonly properties: {
|
|
311
|
+
readonly email: {
|
|
312
|
+
readonly type: "string";
|
|
313
|
+
readonly format: "email";
|
|
314
|
+
};
|
|
315
|
+
readonly domain: {
|
|
316
|
+
readonly type: "string";
|
|
317
|
+
readonly minLength: 1;
|
|
318
|
+
};
|
|
319
|
+
readonly reason: {
|
|
320
|
+
readonly type: "string";
|
|
321
|
+
readonly enum: readonly ["unsubscribe", "bounce_hard", "bounce_soft_repeat", "reply_negative", "gdpr_request", "manual"];
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
readonly additionalProperties: false;
|
|
325
|
+
readonly description: "Either email or domain must be provided.";
|
|
326
|
+
};
|
|
327
|
+
export declare const GenerateSeoContentInput: z.ZodObject<{
|
|
328
|
+
kind: z.ZodEnum<["blog", "landing", "recommendations"]>;
|
|
329
|
+
product: z.ZodString;
|
|
330
|
+
topic: z.ZodString;
|
|
331
|
+
target_keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
332
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
333
|
+
existing_content: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
kind: "blog" | "landing" | "recommendations";
|
|
336
|
+
product: string;
|
|
337
|
+
topic: string;
|
|
338
|
+
target_keywords?: string[] | undefined;
|
|
339
|
+
audience?: string | undefined;
|
|
340
|
+
existing_content?: string | undefined;
|
|
341
|
+
}, {
|
|
342
|
+
kind: "blog" | "landing" | "recommendations";
|
|
343
|
+
product: string;
|
|
344
|
+
topic: string;
|
|
345
|
+
target_keywords?: string[] | undefined;
|
|
346
|
+
audience?: string | undefined;
|
|
347
|
+
existing_content?: string | undefined;
|
|
348
|
+
}>;
|
|
349
|
+
export type GenerateSeoContentInput = z.infer<typeof GenerateSeoContentInput>;
|
|
350
|
+
export declare const GenerateSeoContentJsonSchema: {
|
|
351
|
+
readonly type: "object";
|
|
352
|
+
readonly required: readonly ["kind", "product", "topic"];
|
|
353
|
+
readonly properties: {
|
|
354
|
+
readonly kind: {
|
|
355
|
+
readonly type: "string";
|
|
356
|
+
readonly enum: readonly ["blog", "landing", "recommendations"];
|
|
357
|
+
};
|
|
358
|
+
readonly product: {
|
|
359
|
+
readonly type: "string";
|
|
360
|
+
readonly minLength: 1;
|
|
361
|
+
readonly description: "The product/brand the content markets.";
|
|
362
|
+
};
|
|
363
|
+
readonly topic: {
|
|
364
|
+
readonly type: "string";
|
|
365
|
+
readonly minLength: 1;
|
|
366
|
+
readonly description: "Primary topic or page intent.";
|
|
367
|
+
};
|
|
368
|
+
readonly target_keywords: {
|
|
369
|
+
readonly type: "array";
|
|
370
|
+
readonly items: {
|
|
371
|
+
readonly type: "string";
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
readonly audience: {
|
|
375
|
+
readonly type: "string";
|
|
376
|
+
};
|
|
377
|
+
readonly existing_content: {
|
|
378
|
+
readonly type: "string";
|
|
379
|
+
readonly description: "For kind=recommendations: the page text to audit.";
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
readonly additionalProperties: false;
|
|
383
|
+
};
|
|
384
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAevB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1B,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BvB,CAAA;AAIV,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBxB,CAAA;AAKV,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa1B,CAAA;AACF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