@leadpoet/client 0.1.3 → 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.
Files changed (36) hide show
  1. package/README.md +59 -35
  2. package/cli.js +47 -2
  3. package/cli.js.map +2 -2
  4. package/client.js +47 -2
  5. package/client.js.map +2 -2
  6. package/mcp.js +3969 -71
  7. package/mcp.js.map +4 -4
  8. package/package.json +13 -2
  9. package/skill/SKILL.md +83 -9
  10. package/types/scripts/leadpoet-mcp.d.ts +1 -7
  11. package/types/shared/account-monitoring.d.ts +1169 -0
  12. package/types/shared/assistant-brief.d.ts +1681 -0
  13. package/types/shared/assistant-memories.d.ts +62 -0
  14. package/types/shared/assistant-send-forecast.d.ts +442 -0
  15. package/types/shared/assistant.d.ts +238 -0
  16. package/types/shared/employee-count.d.ts +90 -0
  17. package/types/shared/gtm-context.d.ts +233 -0
  18. package/types/shared/icp-product-selection.d.ts +27 -0
  19. package/types/shared/icp-profile.d.ts +2625 -0
  20. package/types/shared/industry-taxonomy.d.ts +1 -0
  21. package/types/shared/lead-request-limits.d.ts +4 -0
  22. package/types/shared/leadpoet-client.d.ts +1315 -0
  23. package/types/shared/leadpoet-mcp-server.d.ts +39 -0
  24. package/types/shared/mcp-connect.d.ts +22 -0
  25. package/types/shared/monitor-technologies.d.ts +38 -0
  26. package/types/shared/outreach-analytics.d.ts +334 -0
  27. package/types/shared/outreach-audience-filters.d.ts +156 -0
  28. package/types/shared/outreach-audience-segments.d.ts +135 -0
  29. package/types/shared/outreach-enums.d.ts +22 -0
  30. package/types/shared/outreach-v2-contract.d.ts +253 -0
  31. package/types/shared/plan-entitlements.d.ts +75 -0
  32. package/types/shared/plan-features.d.ts +50 -0
  33. package/types/shared/request-credit-constants.d.ts +13 -0
  34. package/types/shared/website-fact-language.d.ts +9 -0
  35. package/types/shared/workspace-operations.d.ts +1975 -29
  36. package/types/shared/workspace-tool-metadata.d.ts +1083 -0
package/README.md CHANGED
@@ -4,12 +4,10 @@ The shared TypeScript client, CLI, MCP server and skill use `/api/v1`. Each call
4
4
  uses the same API-key permissions and saved workflow as the application. The
5
5
  package is published to npm as `@leadpoet/client`.
6
6
 
7
- ## Request access and install
7
+ ## Access and install
8
8
 
9
- [Request access](https://leadpoet.com/contact) with your intended workflow and
10
- whether you need the CLI, TypeScript client, MCP or skill. Leadpoet will enable
11
- API access for your workspace. Once enabled,
12
- manage your keys in Account → Developer → API keys.
9
+ Every workspace, Free included, has API access. The workspace owner or a team
10
+ admin manages keys in Settings → Developer → API keys.
13
11
 
14
12
  Agents can start at [the API guide](https://leadpoet.com/docs/api#agents).
15
13
  Request https://leadpoet.com/docs/api with `Accept: text/markdown` for a concise
@@ -38,13 +36,18 @@ leadpoet operations
38
36
  leadpoet call getCredits
39
37
  leadpoet call getContactAllowance
40
38
  leadpoet describe createRequest
41
- leadpoet call createRequest --input request.json --idempotency-key request-0001
42
- leadpoet wait '<returned-query-uuid>' --timeout 300
39
+ leadpoet call createRequest --input request.json --idempotency-key "$IDEMPOTENCY_KEY"
40
+ leadpoet call getRequest --params '{"id":"<returned-query-uuid>"}'
43
41
  leadpoet call getPipeline --query '{"icp_id":"<returned-icp-uuid>"}'
44
42
  leadpoet describe createCampaign
45
- leadpoet call createCampaign --input campaign.json --idempotency-key campaign-0001
43
+ leadpoet call createCampaign --input campaign.json --idempotency-key "$CAMPAIGN_KEY"
46
44
  ```
47
45
 
46
+ Set `IDEMPOTENCY_KEY` and `CAMPAIGN_KEY` to fresh UUIDs (for example from
47
+ `uuidgen`) and save each with its body. Lead requests have a typical turnaround
48
+ of 1–2 days; check `progress.state` with `getRequest` later rather than holding
49
+ a short `leadpoet wait`.
50
+
48
51
  `--input -` reads a bounded JSON body from stdin. `--params` sets UUID path
49
52
  parameters and `--query` sets documented query fields. Output is always JSON,
50
53
  except help. Options apply only to their documented command; unsupported options
@@ -54,8 +57,8 @@ Non-JSON response bodies are not exposed. Exit codes are 0 success, 1 transport/
54
57
  2 invalid input, 3 credentials/permissions, 4 conflict, 5 throttled, and
55
58
  6 pending timeout or terminal request failure, and 130 interrupted. Ctrl-C cancels
56
59
  discovery, polling, response reads and stdin input; an
57
- interrupted write may already have committed. Requests finish as `ready` or
58
- `error`; a successful HTTP response does not imply a successful sourcing result.
60
+ interrupted write may already have committed. A request's `progress.state` ends as
61
+ `ready`, `failed` or `archived`; a successful HTTP response does not imply a successful sourcing result.
59
62
  The current workspace flow may stay `pending` until Leadpoet starts fulfillment.
60
63
  A polling timeout does not cancel the saved request.
61
64
 
@@ -78,7 +81,8 @@ const client = new LeadpoetClient({
78
81
  apiKey: process.env.LEADPOET_API_KEY!,
79
82
  });
80
83
  const result = await client.call('getPipeline', { query: { icp_id: savedIcpId } });
81
- const settled = await client.waitForRequest(savedQueryId, { timeoutMs: 300_000 });
84
+ const status = await client.call('getRequest', { params: { id: savedQueryId } });
85
+ // status.data.progress.state is working, ready, failed or archived.
82
86
  for await (const page of client.requestPages({ limit: 25, maxPages: 20 })) {
83
87
  // Read page.data.queries; preserve IDs and provenance.
84
88
  }
@@ -92,12 +96,51 @@ field. The OpenAPI `x-pagination` extension distinguishes cursor/page lists from
92
96
  bounded snapshots. The `x-query-schema` extension preserves conditional query
93
97
  requirements (for example, account pipeline configuration requires `icp_id`) for
94
98
  MCP validation. Audience contact filters are a JSON-encoded query string.
99
+ MCP `getPipeline` defaults to `limit: 25` and `projection: "summary"`; follow
100
+ `data.pagination.next_cursor` with the same filters and projection. Request
101
+ `card_id` with `projection: "full"` for one company's public details.
102
+ MCP `listQueuedMessages` defaults to `limit: 25`; follow `data.next_cursor`
103
+ and fetch `getQueuedMessage` for full details and current controls. Explicit
104
+ limits remain supported. REST and CLI calls without paging fields retain their
105
+ existing snapshot behavior.
95
106
  Malformed history/status responses, including unknown request statuses, fail with
96
107
  `invalid_response` and retain the request ID. Timeouts and polling intervals use bounded integer milliseconds.
97
108
  Only request history has a built-in page iterator; other
98
109
  cursors must be advanced according to that operation's contract. Preserve
99
110
  partial/degraded/limited markers instead of calling a snapshot a complete export.
100
111
 
112
+ ## Hosted MCP for Claude and ChatGPT
113
+
114
+ Remote MCP clients connect to `https://leadpoet.com/mcp` with OAuth instead of
115
+ an API key. Add it as a custom connector in Claude under Customize → Connectors
116
+ → Add → Add custom connector
117
+ (<https://claude.ai/customize/connectors?modal=add-custom-connector>; Claude
118
+ Code: `claude mcp add --transport http leadpoet https://leadpoet.com/mcp`) or
119
+ as a custom MCP server in ChatGPT under Plugins → Add → Add custom MCP server
120
+ (<https://chatgpt.com/plugins>). The workspace owner or a team admin
121
+ signs in, or creates a free account on the same page, and chooses read-only or
122
+ read-and-edit access, and whether to allow sending.
123
+
124
+ - Discovery: `/.well-known/oauth-protected-resource/mcp` names Leadpoet
125
+ (`https://leadpoet.com`) as the authorization server, whose metadata is at
126
+ `/.well-known/oauth-authorization-server`.
127
+ - Clients register through `/oauth/register`. Redirects are limited to Claude's
128
+ and ChatGPT's published callbacks and loopback addresses (RFC 8252).
129
+ - Authorization code with PKCE (S256) only. Responses carry `iss` (RFC 9207).
130
+ Access tokens last one hour; refresh tokens rotate on every use.
131
+ - Tokens are opaque `lpc_at_…` values that only the Leadpoet API accepts, with
132
+ the approved scopes. They also work as a Bearer credential on `/api/v1`.
133
+ - The endpoint serves the same tools as `leadpoet-mcp`, each with a title and
134
+ explicit `readOnlyHint`, `destructiveHint`, `idempotentHint` and
135
+ `openWorldHint` from `shared/workspace-tool-metadata.ts`. Send tools appear
136
+ only when the user allowed sending.
137
+ - Disconnecting in Settings → Integrations → AI assistants, or revoking a token at
138
+ `/oauth/revoke`, ends the connection on the next request. Reconnecting the
139
+ same app replaces the earlier connection.
140
+
141
+ `/mcp` also accepts a scoped API key as a Bearer token for MCP clients that
142
+ support custom headers; send tools stay hidden for API keys there.
143
+
101
144
  ## MCP
102
145
 
103
146
  Use a local stdio server with an MCP host. `npx` fetches the package, so no
@@ -121,41 +164,22 @@ separate install is needed:
121
164
  The adapter uses the [official MCP TypeScript SDK](https://ts.sdk.modelcontextprotocol.io/server).
122
165
  It discovers the deployment's OpenAPI schemas, exposes only the compiled
123
166
  operation allowlist, validates tool arguments, and calls the shared client.
124
- It uses no listening HTTP port, OAuth impersonation, provider credentials or
125
- database access. Stdout is reserved for MCP protocol messages.
167
+ The stdio server uses no listening HTTP port, provider credentials or database
168
+ access. Stdout is reserved for MCP protocol messages.
126
169
 
127
170
  Send tools are omitted by default. To expose them deliberately, set
128
171
  `LEADPOET_MCP_ALLOW_SEND=1`; each send tool also requires `allowSend: true` and
129
172
  the server-enforced scopes. Client enablement never widens the key's permissions.
130
173
  Errors remain tool errors with actionable status/correlation information.
131
174
 
132
- The package includes `skill/SKILL.md`; its source is
133
- `agent-skills/leadpoet-workspace/SKILL.md`. Install that directory using your
175
+ The package includes `skill/SKILL.md`. Install that directory using your
134
176
  agent's normal skill installation workflow. It teaches sourcing, saved pipeline
135
177
  results, campaign preparation, explicit send authorization and uncertain-outcome
136
178
  recovery. Skill installation does not grant API access or authorize sending.
137
179
 
138
- ## Verification and boundaries
139
-
140
- Focused tests execute actual CLI processes and MCP stdio against an isolated
141
- API HTTP fixture for two workspaces. Native controller tests separately verify
142
- permissions, paid-request creation/replay and held campaign creation/replay.
143
- The migration test runs exact SQL in disposable embedded PostgreSQL. These are
144
- local checks, not evidence that a production deployment has been enabled.
180
+ ## Scope
145
181
 
146
- Account consent/OAuth, provider migration/connection administration, multipart
182
+ Account consent, provider migration/connection administration, multipart
147
183
  uploads, network prospecting and CRM administration remain in their existing
148
184
  application workflows. This package covers the published operation catalog;
149
185
  it does not expose arbitrary private application routes.
150
-
151
- ## Build from source
152
-
153
- For repository contributors with the locked dependencies installed:
154
-
155
- ```sh
156
- npm run build:api-clients
157
- npm pack ./dist/leadpoet
158
- ```
159
-
160
- Releases are published to npm as `@leadpoet/client` from the built
161
- `dist/leadpoet` directory.
package/cli.js CHANGED
@@ -15,11 +15,21 @@ var WORKSPACE_OPERATIONS = [
15
15
  { "method": "patch", "nativePath": "/api/company-pipeline/cards/:id", "path": "/pipeline/companies/:id", "id": "updateCompany", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
16
16
  { "method": "get", "nativePath": "/api/company-pipeline/contact-enrichment/readiness", "path": "/pipeline/contact-enrichment/readiness", "id": "getContactReadiness", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
17
17
  { "method": "post", "nativePath": "/api/company-pipeline/cards/:id/contact-requests", "path": "/pipeline/companies/:id/contact-requests", "id": "requestContacts", "scope": "pipeline:write", "group": "workspace", "retry": "header" },
18
+ { "method": "post", "nativePath": "/api/company-pipeline/leads/:id/contact-enrichment", "path": "/pipeline/contacts/:id/enrich", "id": "enrichContact", "scope": "pipeline:write", "group": "workspace", "retry": "header" },
19
+ { "method": "post", "nativePath": "/api/pipeline/find-person", "path": "/people/find", "id": "findPerson", "scope": "pipeline:write", "group": "workspace", "retry": "header" },
20
+ { "method": "get", "nativePath": "/api/pipeline/contacts/lookup", "path": "/pipeline/contacts/lookup", "id": "lookupContact", "scope": "pipeline:read", "additionalScopes": ["outreach:read"], "group": "workspace", "retry": "none" },
21
+ { "method": "post", "nativePath": "/api/pipeline/leads", "path": "/pipeline/contacts", "id": "addContact", "scope": "pipeline:write", "group": "workspace", "retry": "header_uuid" },
18
22
  { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/contact-requests/:requestId", "path": "/pipeline/companies/:cardId/contact-requests/:requestId", "id": "getContactRequest", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
19
23
  { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/contact-requests/latest", "path": "/pipeline/companies/:cardId/contact-requests/latest", "id": "getLatestContactRequest", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
24
+ { "method": "get", "nativePath": "/api/account-monitoring/alert-groups", "path": "/signals", "id": "listSignals", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
25
+ { "method": "get", "nativePath": "/api/account-monitoring/accounts/:cardId", "path": "/signals/accounts/:cardId", "id": "getAccountWatch", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
26
+ { "method": "post", "nativePath": "/api/account-monitoring/accounts/watch", "path": "/signals/watch", "id": "watchAccounts", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
27
+ { "method": "post", "nativePath": "/api/account-monitoring/monitors/status", "path": "/signals/watch-status", "id": "setWatchStatus", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
28
+ { "method": "post", "nativePath": "/api/account-monitoring/events/state", "path": "/signals/state", "id": "markSignals", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
20
29
  { "method": "get", "nativePath": "/api/icp-profiles", "path": "/icps", "id": "listIcps", "scope": "lead_engine:read", "group": "workspace", "retry": "none" },
21
30
  { "method": "post", "nativePath": "/api/icp-profiles/audiences", "path": "/icps/audiences", "id": "createIcp", "scope": "lead_engine:write", "group": "workspace", "retry": "header" },
22
31
  { "method": "get", "nativePath": "/api/icp-profiles/:icpId", "path": "/icps/:icpId", "id": "getIcp", "scope": "lead_engine:read", "group": "workspace", "retry": "none" },
32
+ { "method": "get", "nativePath": "/api/icp-profiles/:icpId/products", "path": "/icps/:icpId/products", "id": "listIcpProducts", "scope": "lead_engine:read", "group": "workspace", "retry": "none" },
23
33
  { "method": "get", "nativePath": "/api/icp-profiles/:icpId/versions", "path": "/icps/:icpId/versions", "id": "listIcpVersions", "scope": "lead_engine:read", "group": "workspace", "retry": "none" },
24
34
  { "method": "post", "nativePath": "/api/icp-profiles/:icpId/draft", "path": "/icps/:icpId/draft", "id": "createIcpDraft", "scope": "lead_engine:write", "group": "workspace", "retry": "none" },
25
35
  { "method": "patch", "nativePath": "/api/icp-profiles/:icpId/drafts/:draftId", "path": "/icps/:icpId/drafts/:draftId", "id": "updateIcpDraft", "scope": "lead_engine:write", "group": "workspace", "retry": "state" },
@@ -34,6 +44,13 @@ var WORKSPACE_OPERATIONS = [
34
44
  { "method": "patch", "nativePath": "/api/company-pipeline/deals/:dealId/stage", "path": "/pipeline/deals/:dealId/stage", "id": "moveDeal", "scope": "pipeline:write", "group": "workspace", "retry": "body" },
35
45
  { "method": "get", "nativePath": "/api/company-pipeline/pipeline-config", "path": "/pipeline/configuration", "id": "getPipelineConfiguration", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
36
46
  { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/notes", "path": "/pipeline/companies/:cardId/notes", "id": "listCompanyNotes", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
47
+ { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/observations", "path": "/pipeline/companies/:cardId/observations", "id": "getCompanyObservations", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
48
+ { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/fit-ratings", "path": "/pipeline/companies/:cardId/fit-ratings", "id": "listCompanyFitRatings", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
49
+ { "method": "post", "nativePath": "/api/company-pipeline/cards/:cardId/fit-ratings", "path": "/pipeline/companies/:cardId/fit-ratings", "id": "rateCompanyFit", "scope": "pipeline:write", "group": "workspace", "retry": "header_uuid" },
50
+ { "method": "get", "nativePath": "/api/company-pipeline/icps/:icpId/fit-insights", "path": "/pipeline/icps/:icpId/fit-insights", "id": "getIcpFitInsights", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
51
+ { "method": "get", "nativePath": "/api/billing/credits", "path": "/billing/credits", "id": "getCreditBalance", "scope": "credits:read", "group": "workspace", "retry": "none" },
52
+ { "method": "get", "nativePath": "/api/billing/credit-history", "path": "/billing/credit-history", "id": "getCreditHistory", "scope": "credits:read", "group": "workspace", "retry": "none" },
53
+ { "method": "get", "nativePath": "/api/company-pipeline/deal-candidates", "path": "/pipeline/deal-candidates", "id": "listDealCandidates", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
37
54
  { "method": "post", "nativePath": "/api/company-pipeline/cards/:cardId/notes", "path": "/pipeline/companies/:cardId/notes", "id": "createCompanyNote", "scope": "pipeline:write", "group": "workspace", "retry": "header_uuid" },
38
55
  { "method": "get", "nativePath": "/accounts", "path": "/outreach/accounts", "id": "listSendingAccounts", "scope": "outreach:read", "group": "outreach", "retry": "none" },
39
56
  { "method": "get", "nativePath": "/conversations", "path": "/outreach/conversations", "id": "listConversations", "scope": "outreach:read", "group": "outreach", "retry": "none" },
@@ -41,6 +58,7 @@ var WORKSPACE_OPERATIONS = [
41
58
  { "method": "put", "nativePath": "/workspace-profile", "path": "/outreach/profile", "id": "updateOutreachProfile", "scope": "outreach:write", "group": "campaigns", "retry": "state" },
42
59
  { "method": "get", "nativePath": "/audience-sources", "path": "/outreach/audience-sources", "id": "listAudienceSources", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
43
60
  { "method": "get", "nativePath": "/audience-contacts", "path": "/outreach/audience-contacts", "id": "listAudienceContacts", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
61
+ { "method": "post", "nativePath": "/audience-selection/availability", "path": "/outreach/audiences/availability", "id": "checkAudienceAvailability", "scope": "outreach:read", "group": "campaigns", "retry": "safe" },
44
62
  { "method": "post", "nativePath": "/audience-snapshots/preview-selection", "path": "/outreach/audiences/preview", "id": "previewAudience", "scope": "outreach:write", "group": "campaigns", "retry": "operation_id" },
45
63
  { "method": "post", "nativePath": "/audience-snapshots/from-selection", "path": "/outreach/audiences", "id": "createAudience", "scope": "outreach:write", "group": "campaigns", "retry": "operation_id" },
46
64
  { "method": "get", "nativePath": "/strategies", "path": "/outreach/campaigns", "id": "listCampaigns", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
@@ -53,7 +71,9 @@ var WORKSPACE_OPERATIONS = [
53
71
  { "method": "post", "nativePath": "/strategies/:id/launch", "path": "/outreach/campaigns/:id/launch", "id": "launchCampaign", "scope": "outreach:send", "group": "campaigns", "retry": "bound" },
54
72
  { "method": "post", "nativePath": "/strategies/:id/pause", "path": "/outreach/campaigns/:id/pause", "id": "pauseCampaign", "scope": "outreach:write", "group": "campaigns", "retry": "state" },
55
73
  { "method": "post", "nativePath": "/strategies/:id/resume", "path": "/outreach/campaigns/:id/resume", "id": "resumeCampaign", "scope": "outreach:send", "group": "campaigns", "retry": "state" },
74
+ { "method": "get", "nativePath": "/strategies/:id/resume-summary", "path": "/outreach/campaigns/:id/resume-summary", "id": "getCampaignResumeSummary", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
56
75
  { "method": "get", "nativePath": "/review", "path": "/outreach/review", "id": "listReview", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
76
+ { "method": "get", "nativePath": "/review/summary", "path": "/outreach/review/summary", "id": "getReviewSummary", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
57
77
  { "method": "post", "nativePath": "/review/:messageId/deny", "path": "/outreach/review/:messageId/deny", "id": "denyMessage", "scope": "outreach:write", "group": "campaigns", "retry": "bound" },
58
78
  { "method": "post", "nativePath": "/review/:messageId/skip", "path": "/outreach/review/:messageId/skip", "id": "skipMessage", "scope": "outreach:write", "group": "campaigns", "retry": "bound" },
59
79
  { "method": "get", "nativePath": "/replies", "path": "/outreach/replies", "id": "listReplies", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
@@ -74,6 +94,13 @@ var WORKSPACE_OPERATIONS = [
74
94
  { "method": "post", "nativePath": "/api/recurring-requests", "path": "/recurring-requests", "id": "createRecurringRequest", "scope": "lead_engine:write", "group": "workspace", "retry": "operation_id", "additionalScopes": ["outreach:send"] },
75
95
  { "method": "patch", "nativePath": "/api/recurring-requests/setups/:id", "path": "/recurring-requests/setups/:id", "id": "updateRecurringSetup", "scope": "lead_engine:write", "group": "workspace", "retry": "bound", "additionalScopes": ["outreach:send"] },
76
96
  { "method": "patch", "nativePath": "/api/recurring-requests/:id", "path": "/recurring-requests/:id", "id": "updateRecurringRequest", "scope": "lead_engine:write", "group": "workspace", "retry": "bound", "additionalScopes": ["outreach:send"] },
97
+ { "method": "get", "nativePath": "/api/assistant/schedules", "path": "/agent/schedules", "id": "listAgentSchedules", "scope": "outreach:read", "group": "workspace", "retry": "none" },
98
+ { "method": "post", "nativePath": "/api/assistant/schedules", "path": "/agent/schedules", "id": "createAgentSchedule", "scope": "outreach:write", "group": "workspace", "retry": "operation_id", "additionalScopes": ["lead_engine:read", "pipeline:read", "outreach:read"] },
99
+ { "method": "patch", "nativePath": "/api/assistant/schedules/:id", "path": "/agent/schedules/:id", "id": "updateAgentSchedule", "scope": "outreach:write", "group": "workspace", "retry": "state", "additionalScopes": ["lead_engine:read", "pipeline:read", "outreach:read"] },
100
+ { "method": "get", "nativePath": "/api/assistant/schedules/:id/runs", "path": "/agent/schedules/:id/runs", "id": "listAgentScheduleRuns", "scope": "outreach:read", "group": "workspace", "retry": "none" },
101
+ { "method": "get", "nativePath": "/api/assistant/memories", "path": "/agent/memories", "id": "listAgentMemories", "scope": "outreach:read", "group": "workspace", "retry": "none" },
102
+ { "method": "post", "nativePath": "/api/assistant/memories", "path": "/agent/memories", "id": "createAgentMemory", "scope": "outreach:write", "group": "workspace", "retry": "operation_id" },
103
+ { "method": "patch", "nativePath": "/api/assistant/memories/:id", "path": "/agent/memories/:id", "id": "updateAgentMemory", "scope": "outreach:write", "group": "workspace", "retry": "state" },
77
104
  { "method": "get", "nativePath": "/queued", "path": "/outreach/queued", "id": "listQueuedMessages", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
78
105
  { "method": "get", "nativePath": "/queued/:messageId", "path": "/outreach/queued/:messageId", "id": "getQueuedMessage", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
79
106
  { "method": "get", "nativePath": "/queued/:messageId/outcome", "path": "/outreach/queued/:messageId/outcome", "id": "getMessageOutcome", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
@@ -109,6 +136,9 @@ var WORKSPACE_OPERATIONS = [
109
136
  { "method": "get", "nativePath": "/api/company-pipeline/deal-summaries", "path": "/pipeline/deal-summaries", "id": "getDealSummaries", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
110
137
  { "method": "get", "nativePath": "/api/revenue-insights", "path": "/pipeline/revenue-insights", "id": "getRevenueInsights", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
111
138
  { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/deals", "path": "/pipeline/companies/:cardId/deals", "id": "listCompanyDeals", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
139
+ { "method": "get", "nativePath": "/api/company-pipeline/cards/:id/calls", "path": "/pipeline/companies/:id/calls", "id": "listCompanyCalls", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
140
+ { "method": "get", "nativePath": "/api/call-recordings/themes", "path": "/pipeline/call-themes", "id": "getCallThemes", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
141
+ { "method": "get", "nativePath": "/api/call-recordings/upcoming-meetings", "path": "/pipeline/upcoming-meetings", "id": "listUpcomingMeetings", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
112
142
  { "method": "patch", "nativePath": "/api/company-pipeline/deals/:dealId/pin", "path": "/pipeline/deals/:dealId/pin", "id": "pinDeal", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
113
143
  { "method": "patch", "nativePath": "/api/company-pipeline/deals/:dealId/attribution", "path": "/pipeline/deals/:dealId/attribution", "id": "updateDealAttribution", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
114
144
  { "method": "patch", "nativePath": "/api/company-pipeline/deals/actions/bulk-stage", "path": "/pipeline/deals/actions/bulk-stage", "id": "moveDeals", "scope": "pipeline:write", "group": "workspace", "retry": "body" },
@@ -116,10 +146,16 @@ var WORKSPACE_OPERATIONS = [
116
146
  { "method": "post", "nativePath": "/api/company-pipeline/contact-engagements/:engagementId/qualification-deal/undo", "path": "/pipeline/contacts/:engagementId/qualification-deal/undo", "id": "undoContactQualification", "scope": "pipeline:write", "group": "workspace", "retry": "body" },
117
147
  { "method": "get", "nativePath": "/api/company-pipeline/cards/:cardId/note-counts", "path": "/pipeline/companies/:cardId/note-counts", "id": "getCompanyNoteCounts", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
118
148
  { "method": "post", "nativePath": "/api/company-pipeline/cards/:cardId/notes/clear", "path": "/pipeline/companies/:cardId/notes/archive", "id": "archiveCompanyNotes", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
149
+ { "method": "get", "nativePath": "/api/company-pipeline/tasks", "path": "/pipeline/tasks", "id": "listContactTasks", "scope": "pipeline:read", "group": "workspace", "retry": "none" },
150
+ { "method": "post", "nativePath": "/api/company-pipeline/contact-engagements/:engagementId/tasks", "path": "/pipeline/contacts/:engagementId/tasks", "id": "createContactTask", "scope": "pipeline:write", "group": "workspace", "retry": "header_uuid" },
151
+ { "method": "patch", "nativePath": "/api/company-pipeline/tasks/:taskId", "path": "/pipeline/tasks/:taskId", "id": "updateContactTask", "scope": "pipeline:write", "group": "workspace", "retry": "state" },
119
152
  { "method": "post", "nativePath": "/strategies/:id/audience/preview", "path": "/outreach/campaigns/:id/audience/preview", "id": "previewCampaignAudience", "scope": "outreach:write", "group": "campaigns", "retry": "operation_id", "retryIdentity": "campaignAudience" },
120
153
  { "method": "post", "nativePath": "/strategies/:id/audience/add", "path": "/outreach/campaigns/:id/audience/add", "id": "addCampaignAudience", "scope": "outreach:send", "group": "campaigns", "retry": "operation_id", "retryIdentity": "campaignAudience" },
121
154
  { "method": "get", "nativePath": "/strategies/:id/audience/contacts", "path": "/outreach/campaigns/:id/audience/contacts", "id": "listCampaignContacts", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
122
155
  { "method": "post", "nativePath": "/strategies/:id/audience/contacts/:enrollmentId/remove", "path": "/outreach/campaigns/:id/audience/contacts/:enrollmentId/remove", "id": "removePendingCampaignContact", "scope": "outreach:write", "group": "campaigns", "retry": "state" },
156
+ { "method": "get", "nativePath": "/strategies/:id/audience/unmessaged", "path": "/outreach/campaigns/:id/audience/unmessaged", "id": "getUnmessagedCampaignContacts", "scope": "outreach:read", "group": "campaigns", "retry": "none" },
157
+ { "method": "post", "nativePath": "/strategies/:id/audience/unmessaged/remove", "path": "/outreach/campaigns/:id/audience/unmessaged/remove", "id": "removeUnmessagedCampaignContacts", "scope": "outreach:write", "group": "campaigns", "retry": "state" },
158
+ { "method": "post", "nativePath": "/strategies/:id/audience/unmessaged/segment", "path": "/outreach/campaigns/:id/audience/unmessaged/segment", "id": "previewCampaignAudienceSegment", "scope": "outreach:read", "group": "campaigns", "retry": "safe" },
123
159
  { "method": "post", "nativePath": "/conversations/:id/sequence", "path": "/outreach/conversations/:id/sequence", "id": "updateConversationSequence", "scope": "outreach:send", "group": "campaigns", "retry": "state" },
124
160
  { "method": "put", "nativePath": "/strategies/:id/contact-cap", "path": "/outreach/campaigns/:id/contact-cap", "id": "updateCampaignContactCap", "scope": "outreach:send", "group": "campaigns", "retry": "operation_id" },
125
161
  { "method": "put", "nativePath": "/strategies/:id/sender-allocations", "path": "/outreach/campaigns/:id/sender-allocations", "id": "updateSenderAllocations", "scope": "outreach:send", "group": "campaigns", "retry": "state" },
@@ -131,8 +167,13 @@ var WORKSPACE_OPERATIONS = [
131
167
  { "method": "post", "nativePath": "/review/bulk-approve", "path": "/outreach/review/bulk-approve", "id": "bulkApproveMessages", "scope": "outreach:send", "group": "campaigns", "retry": "bound" },
132
168
  { "method": "post", "nativePath": "/review/bulk-deny", "path": "/outreach/review/bulk-deny", "id": "bulkDenyMessages", "scope": "outreach:write", "group": "campaigns", "retry": "bound" },
133
169
  { "method": "post", "nativePath": "/review/bulk-skip", "path": "/outreach/review/bulk-skip", "id": "bulkSkipMessages", "scope": "outreach:write", "group": "campaigns", "retry": "bound" },
134
- { "method": "post", "nativePath": "/review/:messageId/recheck-autopilot", "path": "/outreach/review/:messageId/recheck-autopilot", "id": "recheckMessageAutopilot", "scope": "outreach:send", "group": "campaigns", "retry": "bound" }
170
+ { "method": "post", "nativePath": "/review/:messageId/recheck-autopilot", "path": "/outreach/review/:messageId/recheck-autopilot", "id": "recheckMessageAutopilot", "scope": "outreach:send", "group": "campaigns", "retry": "bound" },
171
+ { "method": "get", "nativePath": "/api/lead-searches", "path": "/lead-searches", "id": "listLeadSearches", "scope": "lead_engine:read", "group": "workspace", "retry": "none" },
172
+ { "method": "post", "nativePath": "/api/lead-searches/:id/actions", "path": "/lead-searches/:id/actions", "id": "changeLeadSearch", "scope": "lead_engine:write", "group": "workspace", "retry": "bound" }
135
173
  ];
174
+ var STAFF_ONLY_OPERATION_IDS = /* @__PURE__ */ new Set(["listLeadSearches", "changeLeadSearch"]);
175
+ var isStaffOnlyOperation = (id) => STAFF_ONLY_OPERATION_IDS.has(id);
176
+ var PUBLIC_WORKSPACE_OPERATIONS = WORKSPACE_OPERATIONS.filter((operation) => !isStaffOnlyOperation(operation.id));
136
177
  var bodyScopeRules = (operation) => Object.entries(operation.bodyScopes ?? {});
137
178
  var requiredScopes = (operation, body) => [
138
179
  operation.scope,
@@ -148,6 +189,7 @@ var LEGACY_API_OPERATIONS = [
148
189
  { method: "get", path: "/reference/cities", id: "listCities", scope: "", retry: "none" },
149
190
  { method: "get", path: "/reference/company-sizes", id: "listCompanySizes", scope: "", retry: "none" },
150
191
  { method: "get", path: "/reference/lead-types", id: "listLeadTypes", scope: "", retry: "none" },
192
+ { method: "get", path: "/playbook", id: "getPlaybook", scope: "", retry: "none" },
151
193
  { method: "get", path: "/lead-requests", id: "listLeadRequests", scope: "lead_requests:read", retry: "none" },
152
194
  { method: "post", path: "/lead-requests", id: "createLeadRequest", scope: "lead_requests:write", additionalScopes: ["leads:read"], retry: "header" },
153
195
  { method: "get", path: "/lead-requests/:id", id: "getLeadRequest", scope: "lead_requests:read", retry: "none" },
@@ -170,7 +212,8 @@ var LeadpoetError = class extends Error {
170
212
  };
171
213
  var object = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
172
214
  var keyRequired = (retry) => ["header", "header_uuid", "operation_id", "request_id", "body"].includes(retry);
173
- var operations = CLIENT_OPERATIONS.map(({ nativePath: _native, group: _group, ...operation }) => operation);
215
+ var allOperations = CLIENT_OPERATIONS.map(({ nativePath: _native, group: _group, ...operation }) => operation);
216
+ var operations = allOperations.filter((operation) => !isStaffOnlyOperation(operation.id));
174
217
  var LeadpoetClient = class {
175
218
  #apiKey;
176
219
  constructor(options) {
@@ -245,6 +288,7 @@ var LeadpoetClient = class {
245
288
  if (!["pending", "processing"].includes(result.data.status)) {
246
289
  throw new LeadpoetError("Invalid request status response", 502, "invalid_response", result.request_id);
247
290
  }
291
+ if (object(result.data.progress) && result.data.progress.state === "archived") return result;
248
292
  await new Promise((resolve, reject) => {
249
293
  const onAbort = () => {
250
294
  clearTimeout(timer);
@@ -428,6 +472,7 @@ async function runCli(args, io, env = process.env) {
428
472
  }
429
473
  if (process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
430
474
  process.exitCode = await runCli(process.argv.slice(2), { out: (text) => process.stdout.write(text + "\n"), err: (text) => process.stderr.write(text + "\n") });
475
+ if (process.exitCode === 130) process.stderr.write("", () => process.exit(130));
431
476
  }
432
477
  export {
433
478
  readCliBody,