@usenaive-sdk/cli 0.4.1 → 0.4.2

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 (49) hide show
  1. package/dist/client.d.ts +14 -0
  2. package/dist/client.js +47 -1
  3. package/dist/client.js.map +1 -1
  4. package/dist/commands/account-kits.d.ts +2 -0
  5. package/dist/commands/account-kits.js +71 -0
  6. package/dist/commands/account-kits.js.map +1 -0
  7. package/dist/commands/approvals.d.ts +2 -0
  8. package/dist/commands/approvals.js +109 -0
  9. package/dist/commands/approvals.js.map +1 -0
  10. package/dist/commands/cards.js +14 -1
  11. package/dist/commands/cards.js.map +1 -1
  12. package/dist/commands/connections.d.ts +2 -0
  13. package/dist/commands/connections.js +97 -0
  14. package/dist/commands/connections.js.map +1 -0
  15. package/dist/commands/domains.js +8 -1
  16. package/dist/commands/domains.js.map +1 -1
  17. package/dist/commands/formation.js +11 -1
  18. package/dist/commands/formation.js.map +1 -1
  19. package/dist/commands/logs.d.ts +2 -0
  20. package/dist/commands/logs.js +42 -0
  21. package/dist/commands/logs.js.map +1 -0
  22. package/dist/commands/use.d.ts +3 -0
  23. package/dist/commands/use.js +31 -0
  24. package/dist/commands/use.js.map +1 -0
  25. package/dist/commands/users.d.ts +2 -0
  26. package/dist/commands/users.js +63 -0
  27. package/dist/commands/users.js.map +1 -0
  28. package/dist/commands/vault.d.ts +2 -0
  29. package/dist/commands/vault.js +71 -0
  30. package/dist/commands/vault.js.map +1 -0
  31. package/dist/commands/verification.js +8 -1
  32. package/dist/commands/verification.js.map +1 -1
  33. package/dist/config.d.ts +2 -0
  34. package/dist/config.js.map +1 -1
  35. package/dist/index.js +24 -0
  36. package/dist/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/commands/billing-client.d.ts +0 -2
  39. package/dist/commands/billing-client.js +0 -271
  40. package/dist/commands/billing-client.js.map +0 -1
  41. package/dist/commands/crm-app.d.ts +0 -2
  42. package/dist/commands/crm-app.js +0 -306
  43. package/dist/commands/crm-app.js.map +0 -1
  44. package/dist/commands/crm.d.ts +0 -2
  45. package/dist/commands/crm.js +0 -319
  46. package/dist/commands/crm.js.map +0 -1
  47. package/dist/commands/integrations.d.ts +0 -2
  48. package/dist/commands/integrations.js +0 -199
  49. package/dist/commands/integrations.js.map +0 -1
@@ -1,319 +0,0 @@
1
- import { Command } from "commander";
2
- import { apiRequest, handleApiError } from "../client.js";
3
- import { agentOutput } from "../output.js";
4
- export const crmCmd = new Command("crm")
5
- .description("naive/crm primitive — contacts, companies, and interaction history")
6
- .addHelpText("after", `
7
- Subcommands:
8
- naive crm contacts ... Manage CRM contacts (create, list, find, get, update, merge, log, history)
9
- naive crm companies ... Manage CRM companies (external organizations)
10
-
11
- The CRM primitive is the vertical-agnostic identity graph. Pipelines/deals
12
- live in the CRM template app (naive crm-app). Use this primitive any time
13
- an agent needs to:
14
- - Look up a contact before sending email (dedupe by email/phone)
15
- - Log activity history on a contact (calls, notes, payments)
16
- - Find or create external companies (clients, prospects)
17
-
18
- Examples:
19
- $ naive crm contacts find --email lead@example.com
20
- $ naive crm contacts create --name "Jane Smith" --email jane@acme.com --company Acme
21
- $ naive crm contacts log-interaction <contact-id> --type note --content "Discovery call went well"
22
- $ naive crm contacts history <contact-id> --limit 20
23
- `);
24
- // ── Contacts ──────────────────────────────────────────────────────────────
25
- const contactsCmd = crmCmd.command("contacts").description("CRM contact management");
26
- contactsCmd
27
- .command("list")
28
- .description("List CRM contacts")
29
- .option("--search <term>", "Free-text search on name and emails")
30
- .option("--crm-company <id>", "Filter to a specific CRM company")
31
- .option("--sort <field>", "Sort field: created_at | name", "created_at")
32
- .option("--limit <n>", "Max results (default 50, max 200)", "50")
33
- .option("--offset <n>", "Pagination offset", "0")
34
- .action(async (opts) => {
35
- const params = new URLSearchParams({ limit: opts.limit, offset: opts.offset, sort: opts.sort });
36
- if (opts.search)
37
- params.set("search", opts.search);
38
- if (opts.crmCompany)
39
- params.set("crm_company_id", opts.crmCompany);
40
- const resp = await apiRequest("GET", `/v1/crm/contacts?${params}`);
41
- handleApiError("crm.contacts.list", resp);
42
- const data = resp.data;
43
- agentOutput({
44
- action: "crm.contacts.list",
45
- result: resp.data,
46
- next_steps: [
47
- ...(data.contacts.length > 0
48
- ? [{ command: `naive crm contacts get ${data.contacts[0].id}`, description: "Inspect the first contact" }]
49
- : [{ command: "naive crm contacts create --name <name> --email <email>", description: "Create your first contact" }]),
50
- { command: "naive crm contacts find --email <email>", description: "Find a contact by email before creating to dedupe" },
51
- ],
52
- hints: [`${data.count} contact${data.count === 1 ? "" : "s"} returned`],
53
- related_commands: ["naive crm contacts create", "naive crm contacts find", "naive crm contacts get"],
54
- });
55
- });
56
- contactsCmd
57
- .command("create")
58
- .description("Create a CRM contact (idempotent on email/phone)")
59
- .option("--name <name>", "Contact full name")
60
- .option("--email <email>", "Primary email address")
61
- .option("--phone <phone>", "Primary phone number")
62
- .option("--company <name>", "Company name (auto-creates if no --crm-company-id is provided)")
63
- .option("--crm-company-id <id>", "Existing CRM company UUID to link to")
64
- .option("--source <source>", "Where this contact came from")
65
- .action(async (opts) => {
66
- const resp = await apiRequest("POST", "/v1/crm/contacts", {
67
- name: opts.name,
68
- email: opts.email,
69
- phone: opts.phone,
70
- company: opts.company,
71
- crm_company_id: opts.crmCompanyId,
72
- source: opts.source,
73
- });
74
- handleApiError("crm.contacts.create", resp);
75
- const data = resp.data;
76
- agentOutput({
77
- action: "crm.contacts.create",
78
- result: resp.data,
79
- next_steps: [
80
- { command: `naive crm contacts log-interaction ${data.contact.id} --type note --content "..."`, description: "Log activity on this contact" },
81
- { command: `naive crm contacts history ${data.contact.id}`, description: "View full activity history" },
82
- ],
83
- hints: [
84
- data.created ? "Created new contact" : "Returned existing contact (matched by email/phone)",
85
- `Contact ID: ${data.contact.id}`,
86
- ],
87
- related_commands: ["naive crm contacts find", "naive crm contacts log-interaction"],
88
- });
89
- });
90
- contactsCmd
91
- .command("find")
92
- .description("Find a contact by email, phone, or fuzzy name match — use this BEFORE creating to dedupe")
93
- .option("--email <email>", "Exact match (case-insensitive)")
94
- .option("--phone <phone>", "Exact match (digits-only)")
95
- .option("--name <name>", "Fuzzy match (trigram)")
96
- .option("--limit <n>", "Max results (default 10, max 50)", "10")
97
- .action(async (opts) => {
98
- const resp = await apiRequest("POST", "/v1/crm/contacts/find", {
99
- email: opts.email,
100
- phone: opts.phone,
101
- name: opts.name,
102
- limit: parseInt(opts.limit, 10),
103
- });
104
- handleApiError("crm.contacts.find", resp);
105
- const data = resp.data;
106
- agentOutput({
107
- action: "crm.contacts.find",
108
- result: resp.data,
109
- next_steps: data.contacts.length > 0
110
- ? [
111
- { command: `naive crm contacts get ${data.contacts[0].id}`, description: "Get full contact details" },
112
- { command: `naive crm contacts log-interaction ${data.contacts[0].id} --type note --content "..."`, description: "Log activity on this contact" },
113
- ]
114
- : [{ command: "naive crm contacts create --name <name> --email <email>", description: "Create a new contact" }],
115
- hints: [
116
- data.contacts.length === 0 ? "No match — safe to create a new contact" : `Match type: ${data.match_type}`,
117
- ],
118
- related_commands: ["naive crm contacts create", "naive crm contacts merge"],
119
- });
120
- });
121
- contactsCmd
122
- .command("get <contact_id>")
123
- .description("Get full contact details")
124
- .action(async (contactId) => {
125
- const resp = await apiRequest("GET", `/v1/crm/contacts/${contactId}`);
126
- handleApiError("crm.contacts.get", resp);
127
- agentOutput({
128
- action: "crm.contacts.get",
129
- result: resp.data,
130
- next_steps: [
131
- { command: `naive crm contacts history ${contactId}`, description: "View interaction history" },
132
- { command: `naive crm contacts update ${contactId} --name <name>`, description: "Update contact" },
133
- ],
134
- related_commands: ["naive crm contacts history", "naive crm contacts update"],
135
- });
136
- });
137
- contactsCmd
138
- .command("update <contact_id>")
139
- .description("Update a contact")
140
- .option("--name <name>", "New name")
141
- .option("--emails <list>", "Comma-separated list of emails (replaces existing)")
142
- .option("--phones <list>", "Comma-separated list of phones (replaces existing)")
143
- .option("--crm-company-id <id>", "Link to a CRM company (use 'null' to clear)")
144
- .action(async (contactId, opts) => {
145
- const body = {};
146
- if (opts.name !== undefined)
147
- body.name = opts.name;
148
- if (opts.emails !== undefined)
149
- body.emails = opts.emails.split(",").map((s) => s.trim()).filter(Boolean);
150
- if (opts.phones !== undefined)
151
- body.phones = opts.phones.split(",").map((s) => s.trim()).filter(Boolean);
152
- if (opts.crmCompanyId !== undefined)
153
- body.crm_company_id = opts.crmCompanyId === "null" ? null : opts.crmCompanyId;
154
- const resp = await apiRequest("PATCH", `/v1/crm/contacts/${contactId}`, body);
155
- handleApiError("crm.contacts.update", resp);
156
- agentOutput({
157
- action: "crm.contacts.update",
158
- result: resp.data,
159
- next_steps: [{ command: `naive crm contacts get ${contactId}`, description: "Verify the update" }],
160
- related_commands: ["naive crm contacts get", "naive crm contacts history"],
161
- });
162
- });
163
- contactsCmd
164
- .command("delete <contact_id>")
165
- .description("Delete a CRM contact (cascade-deletes interactions)")
166
- .action(async (contactId) => {
167
- const resp = await apiRequest("DELETE", `/v1/crm/contacts/${contactId}`);
168
- handleApiError("crm.contacts.delete", resp);
169
- agentOutput({
170
- action: "crm.contacts.delete",
171
- result: resp.data,
172
- next_steps: [{ command: "naive crm contacts list", description: "Verify removal" }],
173
- related_commands: ["naive crm contacts list"],
174
- });
175
- });
176
- contactsCmd
177
- .command("merge <primary_id>")
178
- .description("Merge a duplicate contact into the primary contact")
179
- .requiredOption("--duplicate <id>", "The duplicate contact ID to merge into the primary")
180
- .action(async (primaryId, opts) => {
181
- const resp = await apiRequest("POST", `/v1/crm/contacts/${primaryId}/merge`, {
182
- duplicate_id: opts.duplicate,
183
- });
184
- handleApiError("crm.contacts.merge", resp);
185
- agentOutput({
186
- action: "crm.contacts.merge",
187
- result: resp.data,
188
- next_steps: [{ command: `naive crm contacts get ${primaryId}`, description: "Inspect the merged contact" }],
189
- hints: ["All interactions moved to primary, duplicate deleted"],
190
- related_commands: ["naive crm contacts get", "naive crm contacts history"],
191
- });
192
- });
193
- contactsCmd
194
- .command("log-interaction <contact_id>")
195
- .description("Log an interaction (email | call | note | task | payment) on a contact")
196
- .requiredOption("--type <type>", "email | call | note | task | payment")
197
- .option("--direction <dir>", "inbound | outbound | internal", "internal")
198
- .option("--content <text>", "Free-text body")
199
- .option("--refs <json>", "Cross-references as JSON, e.g. '{\"message_id\":\"abc\"}'")
200
- .option("--occurred-at <iso>", "ISO timestamp; defaults to now")
201
- .action(async (contactId, opts) => {
202
- const body = {
203
- type: opts.type,
204
- direction: opts.direction,
205
- };
206
- if (opts.content !== undefined)
207
- body.content = opts.content;
208
- if (opts.refs !== undefined) {
209
- try {
210
- body.refs = JSON.parse(opts.refs);
211
- }
212
- catch {
213
- agentOutput({
214
- action: "crm.contacts.log-interaction",
215
- result: { error: "invalid_input", message: "--refs must be valid JSON" },
216
- hints: ["Wrap in single quotes: --refs '{\"key\":\"value\"}'"],
217
- related_commands: ["naive crm contacts log-interaction"],
218
- });
219
- process.exit(1);
220
- }
221
- }
222
- if (opts.occurredAt !== undefined)
223
- body.occurred_at = opts.occurredAt;
224
- const resp = await apiRequest("POST", `/v1/crm/contacts/${contactId}/interactions`, body);
225
- handleApiError("crm.contacts.log-interaction", resp);
226
- agentOutput({
227
- action: "crm.contacts.log-interaction",
228
- result: resp.data,
229
- next_steps: [{ command: `naive crm contacts history ${contactId}`, description: "View updated history" }],
230
- related_commands: ["naive crm contacts history", "naive crm contacts get"],
231
- });
232
- });
233
- contactsCmd
234
- .command("history <contact_id>")
235
- .description("Get interaction history (most recent first)")
236
- .option("--types <list>", "Comma-separated types to filter: email,call,note,task,payment")
237
- .option("--since <iso>", "Lower bound ISO timestamp")
238
- .option("--until <iso>", "Upper bound ISO timestamp")
239
- .option("--limit <n>", "Max results (default 50, max 200)", "50")
240
- .option("--offset <n>", "Pagination offset", "0")
241
- .action(async (contactId, opts) => {
242
- const params = new URLSearchParams({ limit: opts.limit, offset: opts.offset });
243
- if (opts.types)
244
- params.set("types", opts.types);
245
- if (opts.since)
246
- params.set("since", opts.since);
247
- if (opts.until)
248
- params.set("until", opts.until);
249
- const resp = await apiRequest("GET", `/v1/crm/contacts/${contactId}/interactions?${params}`);
250
- handleApiError("crm.contacts.history", resp);
251
- const data = resp.data;
252
- agentOutput({
253
- action: "crm.contacts.history",
254
- result: resp.data,
255
- hints: [`${data.count} interaction${data.count === 1 ? "" : "s"} returned`],
256
- next_steps: [{ command: `naive crm contacts log-interaction ${contactId} --type note --content "..."`, description: "Log a new interaction" }],
257
- related_commands: ["naive crm contacts log-interaction", "naive crm contacts get"],
258
- });
259
- });
260
- // ── Companies ────────────────────────────────────────────────────────────
261
- const companiesSubCmd = crmCmd.command("companies").description("CRM company (external organization) management");
262
- companiesSubCmd
263
- .command("list")
264
- .description("List CRM companies")
265
- .option("--search <term>", "Free-text search on name/domain")
266
- .option("--limit <n>", "Max results (default 50, max 200)", "50")
267
- .option("--offset <n>", "Pagination offset", "0")
268
- .action(async (opts) => {
269
- const params = new URLSearchParams({ limit: opts.limit, offset: opts.offset });
270
- if (opts.search)
271
- params.set("search", opts.search);
272
- const resp = await apiRequest("GET", `/v1/crm/companies?${params}`);
273
- handleApiError("crm.companies.list", resp);
274
- const data = resp.data;
275
- agentOutput({
276
- action: "crm.companies.list",
277
- result: resp.data,
278
- hints: [`${data.count} compan${data.count === 1 ? "y" : "ies"} returned`],
279
- next_steps: [{ command: "naive crm companies create --name <name> --domain <domain>", description: "Create a new CRM company" }],
280
- related_commands: ["naive crm companies create", "naive crm companies get"],
281
- });
282
- });
283
- companiesSubCmd
284
- .command("create")
285
- .description("Create a CRM company (idempotent on lower(domain))")
286
- .requiredOption("--name <name>", "Company name")
287
- .option("--domain <domain>", "Primary web domain (e.g. acme.com)")
288
- .option("--source <source>", "Where this record came from")
289
- .action(async (opts) => {
290
- const resp = await apiRequest("POST", "/v1/crm/companies", {
291
- name: opts.name,
292
- domain: opts.domain,
293
- source: opts.source,
294
- });
295
- handleApiError("crm.companies.create", resp);
296
- const data = resp.data;
297
- agentOutput({
298
- action: "crm.companies.create",
299
- result: resp.data,
300
- hints: [data.created ? "Created new company" : "Returned existing company (matched by domain)"],
301
- next_steps: [
302
- { command: `naive crm contacts create --crm-company-id ${data.company.id} --name <name> --email <email>`, description: "Link a contact to this company" },
303
- ],
304
- related_commands: ["naive crm contacts create", "naive crm companies get"],
305
- });
306
- });
307
- companiesSubCmd
308
- .command("get <company_id>")
309
- .description("Get CRM company details")
310
- .action(async (companyId) => {
311
- const resp = await apiRequest("GET", `/v1/crm/companies/${companyId}`);
312
- handleApiError("crm.companies.get", resp);
313
- agentOutput({
314
- action: "crm.companies.get",
315
- result: resp.data,
316
- related_commands: ["naive crm companies list", "naive crm contacts list"],
317
- });
318
- });
319
- //# sourceMappingURL=crm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crm.js","sourceRoot":"","sources":["../../src/commands/crm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KACrC,WAAW,CAAC,oEAAoE,CAAC;KACjF,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;CAiBvB,CAAC,CAAC;AAEH,6EAA6E;AAE7E,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;AAErF,WAAW;KACR,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,iBAAiB,EAAE,qCAAqC,CAAC;KAChE,MAAM,CAAC,oBAAoB,EAAE,kCAAkC,CAAC;KAChE,MAAM,CAAC,gBAAgB,EAAE,+BAA+B,EAAE,YAAY,CAAC;KACvE,MAAM,CAAC,aAAa,EAAE,mCAA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sBAAsB,EAAE,IAAI,CAAC,CAAC;IAE7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAqD,CAAC;IACxE,WAAW,CAAC;QACV,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,+CAA+C,CAAC;QAC/F,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,8CAA8C,IAAI,CAAC,OAAO,CAAC,EAAE,gCAAgC,EAAE,WAAW,EAAE,gCAAgC,EAAE;SAC1J;QACD,gBAAgB,EAAE,CAAC,2BAA2B,EAAE,yBAAyB,CAAC;KAC3E,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,eAAe;KACZ,OAAO,CAAC,kBAAkB,CAAC;KAC3B,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,qBAAqB,SAAS,EAAE,CAAC,CAAC;IACvE,cAAc,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAC1C,WAAW,CAAC;QACV,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,gBAAgB,EAAE,CAAC,0BAA0B,EAAE,yBAAyB,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Command } from "commander";
2
- export declare const integrationsCmd: Command;
@@ -1,199 +0,0 @@
1
- import { Command } from "commander";
2
- import { apiRequest, handleApiError } from "../client.js";
3
- import { agentOutput } from "../output.js";
4
- export const integrationsCmd = new Command("integrations")
5
- .alias("integration")
6
- .description("3rd-party integrations — connect 250+ Composio toolkits (Gmail, GitHub, Linear, Notion, ...) and invoke their tools")
7
- .addHelpText("after", `
8
- Subcommands:
9
- naive integrations list List toolkits + connection state
10
- naive integrations connected List only connected toolkits
11
- naive integrations connect <toolkit> Start OAuth/API-key flow → returns a redirect URL
12
- naive integrations disconnect <toolkit> [--purge] Disable (default) or permanently delete connection
13
- naive integrations tools <toolkit> List the tools exposed by a toolkit
14
- naive integrations execute <toolkit> <tool> [--args] Invoke a Composio tool (costs 1 credit on success)
15
-
16
- Common Toolkits:
17
- gmail, googlecalendar, googledrive, github, linear, notion, slack,
18
- airtable, hubspot, salesforce, stripe, shopify, calendly, twilio, zoom
19
-
20
- Example:
21
- $ naive integrations connect gmail
22
- # Open the redirect_url, finish OAuth, then:
23
- $ naive integrations execute gmail GMAIL_SEND_EMAIL \\
24
- --args '{"recipient_email":"me@example.com","subject":"hi","body":"hello"}'
25
-
26
- Cost:
27
- - listing toolkits / tools / connecting / disconnecting: free
28
- - executing a tool: 1 credit per successful call
29
- `);
30
- integrationsCmd
31
- .command("list")
32
- .description("List 3rd-party toolkits available via Composio (paged)")
33
- .option("--search <q>", "Filter by name or slug substring")
34
- .option("--cursor <c>", "Opaque cursor from previous response")
35
- .option("--limit <n>", "Page size (max 50)")
36
- .option("--connected", "Only show connected toolkits")
37
- .action(async (opts) => {
38
- const params = new URLSearchParams();
39
- if (opts.search)
40
- params.set("search", opts.search);
41
- if (opts.cursor)
42
- params.set("cursor", opts.cursor);
43
- if (opts.limit)
44
- params.set("limit", opts.limit);
45
- if (opts.connected)
46
- params.set("connected", "true");
47
- const qs = params.toString();
48
- const resp = await apiRequest("GET", `/v1/integrations${qs ? `?${qs}` : ""}`);
49
- handleApiError("integrations.list", resp);
50
- const data = resp.data;
51
- agentOutput({
52
- action: "integrations.list",
53
- result: resp.data,
54
- next_steps: [
55
- { command: "naive integrations connect <toolkit>", description: "Connect a toolkit by slug" },
56
- ...(data.nextCursor
57
- ? [{ command: `naive integrations list --cursor ${data.nextCursor}`, description: "Fetch the next page" }]
58
- : []),
59
- ],
60
- hints: [`${data.toolkits?.length ?? 0} toolkit(s) on this page`],
61
- });
62
- });
63
- integrationsCmd
64
- .command("connected")
65
- .description("List only the toolkits this company has connected")
66
- .option("--cursor <c>", "Opaque cursor from previous response")
67
- .option("--limit <n>", "Page size (max 50)")
68
- .action(async (opts) => {
69
- const params = new URLSearchParams();
70
- if (opts.cursor)
71
- params.set("cursor", opts.cursor);
72
- if (opts.limit)
73
- params.set("limit", opts.limit);
74
- const qs = params.toString();
75
- const resp = await apiRequest("GET", `/v1/integrations/connected${qs ? `?${qs}` : ""}`);
76
- handleApiError("integrations.connected", resp);
77
- const data = resp.data;
78
- agentOutput({
79
- action: "integrations.connected",
80
- result: resp.data,
81
- next_steps: [
82
- { command: "naive integrations tools <toolkit>", description: "Inspect a connected toolkit's tools" },
83
- { command: "naive integrations execute <toolkit> <tool>", description: "Invoke a tool" },
84
- ],
85
- hints: [`${data.toolkits?.length ?? 0} connected toolkit(s)`],
86
- });
87
- });
88
- integrationsCmd
89
- .command("connect <toolkit>")
90
- .description("Start an OAuth/API-key flow for a toolkit (returns a redirect URL)")
91
- .option("--callback-url <url>", "Where Composio should send the user back after auth")
92
- .action(async (toolkit, opts) => {
93
- const body = { toolkit };
94
- if (opts.callbackUrl)
95
- body.callback_url = opts.callbackUrl;
96
- const resp = await apiRequest("POST", "/v1/integrations/connect", body);
97
- handleApiError("integrations.connect", resp);
98
- const data = resp.data;
99
- agentOutput({
100
- action: "integrations.connect",
101
- result: resp.data,
102
- next_steps: [
103
- { command: `naive integrations connected`, description: "Check connection status after finishing in-browser" },
104
- { command: `naive integrations tools ${toolkit}`, description: "List tools once the connection is ACTIVE" },
105
- ],
106
- hints: [
107
- data.redirectUrl
108
- ? `Open this URL to finish connecting ${toolkit}:`
109
- : `Connection initiated for ${toolkit} (no redirect needed — credentials supplied via API).`,
110
- ...(data.redirectUrl ? [data.redirectUrl] : []),
111
- `connected_account_id: ${data.connectedAccountId} · status: ${data.status}`,
112
- ],
113
- });
114
- });
115
- integrationsCmd
116
- .command("disconnect <toolkit>")
117
- .description("Disconnect a toolkit (soft-disable by default; --purge for permanent delete)")
118
- .option("--purge", "Permanently delete the connection and revoke tokens")
119
- .action(async (toolkit, opts) => {
120
- const qs = opts.purge ? "?purge=true" : "";
121
- const resp = await apiRequest("DELETE", `/v1/integrations/${encodeURIComponent(toolkit)}${qs}`);
122
- handleApiError("integrations.disconnect", resp);
123
- agentOutput({
124
- action: "integrations.disconnect",
125
- result: resp.data,
126
- next_steps: [
127
- { command: `naive integrations connect ${toolkit}`, description: "Reconnect this toolkit later" },
128
- { command: "naive integrations connected", description: "List remaining connected toolkits" },
129
- ],
130
- hints: [opts.purge ? `Toolkit ${toolkit} permanently deleted.` : `Toolkit ${toolkit} disabled (reversible).`],
131
- });
132
- });
133
- integrationsCmd
134
- .command("tools <toolkit>")
135
- .description("List the individual tools exposed by a toolkit")
136
- .option("--search <q>", "Semantic search across tool descriptions")
137
- .option("--limit <n>", "Max tools to return (default 100, max 200)")
138
- .action(async (toolkit, opts) => {
139
- const params = new URLSearchParams();
140
- if (opts.search)
141
- params.set("search", opts.search);
142
- if (opts.limit)
143
- params.set("limit", opts.limit);
144
- const qs = params.toString();
145
- const resp = await apiRequest("GET", `/v1/integrations/${encodeURIComponent(toolkit)}/tools${qs ? `?${qs}` : ""}`);
146
- handleApiError("integrations.tools", resp);
147
- const data = resp.data;
148
- agentOutput({
149
- action: "integrations.tools",
150
- result: resp.data,
151
- next_steps: [
152
- { command: `naive integrations execute ${toolkit} <tool>`, description: "Invoke one of these tools" },
153
- ],
154
- hints: [`${data.tools?.length ?? 0} tool(s) returned for ${toolkit}`],
155
- });
156
- });
157
- integrationsCmd
158
- .command("execute <toolkit> <tool>")
159
- .description("Invoke a Composio tool. Costs 1 credit on success.")
160
- .option("--args <json>", "Tool arguments as JSON object", "{}")
161
- .option("--connected-account-id <id>", "Override which connected account to use")
162
- .action(async (toolkit, tool, opts) => {
163
- let args = {};
164
- try {
165
- args = JSON.parse(opts.args ?? "{}");
166
- }
167
- catch (err) {
168
- console.error(JSON.stringify({
169
- success: false,
170
- action: "integrations.execute",
171
- error: { code: "invalid_input", message: `--args must be valid JSON: ${err.message}` },
172
- recovery_steps: [
173
- { command: `naive integrations execute ${toolkit} ${tool} --args '{"key":"value"}'`, description: "Retry with valid JSON" },
174
- ],
175
- }, null, 2));
176
- process.exit(1);
177
- }
178
- const body = { tool, arguments: args };
179
- if (opts.connectedAccountId)
180
- body.connected_account_id = opts.connectedAccountId;
181
- const resp = await apiRequest("POST", `/v1/integrations/${encodeURIComponent(toolkit)}/execute`, body);
182
- handleApiError("integrations.execute", resp);
183
- const data = resp.data;
184
- const credits = typeof data.creditsRemaining === "number" ? data.creditsRemaining.toFixed(2) : "?";
185
- agentOutput({
186
- action: "integrations.execute",
187
- result: resp.data,
188
- next_steps: data.successful
189
- ? [{ command: `naive integrations tools ${toolkit}`, description: "Discover related tools" }]
190
- : [
191
- { command: `naive integrations connected`, description: "Confirm the toolkit is connected" },
192
- { command: `naive integrations connect ${toolkit}`, description: "Reconnect if the auth lapsed" },
193
- ],
194
- hints: data.successful
195
- ? [`Executed ${tool} successfully. Credits remaining: ${credits}.`]
196
- : [`Tool returned an error: ${data.error ?? "unknown"}`],
197
- });
198
- });
199
- //# sourceMappingURL=integrations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/commands/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;KACvD,KAAK,CAAC,aAAa,CAAC;KACpB,WAAW,CAAC,qHAAqH,CAAC;KAClI,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;CAsBvB,CAAC,CAAC;AAEH,eAAe;KACZ,O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