@usenaive-sdk/cli 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +53 -6
  2. package/dist/commands/apps.d.ts +2 -0
  3. package/dist/commands/apps.js +424 -0
  4. package/dist/commands/apps.js.map +1 -0
  5. package/dist/commands/billing-client.d.ts +2 -0
  6. package/dist/commands/billing-client.js +271 -0
  7. package/dist/commands/billing-client.js.map +1 -0
  8. package/dist/commands/ceo.d.ts +2 -0
  9. package/dist/commands/ceo.js +369 -0
  10. package/dist/commands/ceo.js.map +1 -0
  11. package/dist/commands/companies.js +105 -0
  12. package/dist/commands/companies.js.map +1 -1
  13. package/dist/commands/crm-app.d.ts +2 -0
  14. package/dist/commands/crm-app.js +306 -0
  15. package/dist/commands/crm-app.js.map +1 -0
  16. package/dist/commands/crm.d.ts +2 -0
  17. package/dist/commands/crm.js +319 -0
  18. package/dist/commands/crm.js.map +1 -0
  19. package/dist/commands/cron-jobs.d.ts +2 -0
  20. package/dist/commands/cron-jobs.js +208 -0
  21. package/dist/commands/cron-jobs.js.map +1 -0
  22. package/dist/commands/employees.d.ts +2 -0
  23. package/dist/commands/employees.js +190 -0
  24. package/dist/commands/employees.js.map +1 -0
  25. package/dist/commands/integrations.d.ts +2 -0
  26. package/dist/commands/integrations.js +199 -0
  27. package/dist/commands/integrations.js.map +1 -0
  28. package/dist/commands/media.d.ts +2 -0
  29. package/dist/commands/media.js +183 -0
  30. package/dist/commands/media.js.map +1 -0
  31. package/dist/commands/memory.d.ts +2 -0
  32. package/dist/commands/memory.js +151 -0
  33. package/dist/commands/memory.js.map +1 -0
  34. package/dist/commands/objectives.d.ts +2 -0
  35. package/dist/commands/objectives.js +243 -0
  36. package/dist/commands/objectives.js.map +1 -0
  37. package/dist/commands/register.js +5 -6
  38. package/dist/commands/register.js.map +1 -1
  39. package/dist/commands/social.js +3 -0
  40. package/dist/commands/social.js.map +1 -1
  41. package/dist/commands/tasks.d.ts +2 -0
  42. package/dist/commands/tasks.js +400 -0
  43. package/dist/commands/tasks.js.map +1 -0
  44. package/dist/commands/usage.js +5 -5
  45. package/dist/commands/video.js +259 -11
  46. package/dist/commands/video.js.map +1 -1
  47. package/dist/config.js +1 -1
  48. package/dist/config.js.map +1 -1
  49. package/dist/index.js +30 -6
  50. package/dist/index.js.map +1 -1
  51. package/package.json +6 -2
@@ -0,0 +1,319 @@
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
@@ -0,0 +1 @@
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,CAA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AAE,mBAAmB;QAC3B,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,gBAAgB,EAAE,CAAC,0BAA0B,EAAE,yBAAyB,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const cronCmd: Command;
@@ -0,0 +1,208 @@
1
+ import { Command } from "commander";
2
+ import { apiRequest, handleApiError } from "../client.js";
3
+ import { agentOutput } from "../output.js";
4
+ export const cronCmd = new Command("cron")
5
+ .description("Schedule recurring jobs — create, list, trigger, pause, and remove cron jobs")
6
+ .addHelpText("after", `
7
+ Subcommands:
8
+ naive cron create <schedule> <prompt> Create a new cron job
9
+ naive cron list List all cron jobs
10
+ naive cron trigger <id> Manually trigger a cron job now
11
+ naive cron pause <id> Pause a cron job
12
+ naive cron remove <id> Delete a cron job permanently
13
+
14
+ Schedule format (cron expression):
15
+ "0 9 * * *" → every day at 9:00 AM UTC
16
+ "0 */6 * * *" → every 6 hours
17
+ "0 9 * * 1" → every Monday at 9:00 AM UTC
18
+ "0 0 1 * *" → first day of every month at midnight
19
+
20
+ Workflow:
21
+ 1. naive cron create "0 9 * * *" "Check inbox and summarize new emails"
22
+ 2. naive cron list → see all scheduled jobs
23
+ 3. naive cron trigger <id> → test-fire immediately
24
+ 4. naive cron pause <id> → temporarily disable
25
+ 5. naive cron remove <id> → delete permanently
26
+
27
+ Examples:
28
+ $ naive cron create "0 9 * * 1" "Generate weekly social media content" --skill naive-social --name "Weekly Social"
29
+ $ naive cron list
30
+ $ naive cron trigger cron-abc-123
31
+ $ naive cron pause cron-abc-123
32
+ $ naive cron remove cron-abc-123
33
+ `);
34
+ cronCmd
35
+ .command("create <schedule> <prompt>")
36
+ .description("Create a new cron job that runs a prompt on a schedule")
37
+ .option("--skill <name>", "Skill to invoke when the job fires (e.g., naive-social, naive-email)")
38
+ .option("--name <name>", "Human-readable name for the cron job")
39
+ .addHelpText("after", `
40
+ Examples:
41
+ $ naive cron create "0 9 * * *" "Check email and respond to urgent messages"
42
+ $ naive cron create "0 */6 * * *" "Monitor social media mentions" --skill naive-social
43
+ $ naive cron create "0 0 * * 1" "Generate weekly analytics report" --name "Weekly Report"
44
+
45
+ What this does:
46
+ Creates a scheduled job that fires at the specified cron interval.
47
+ Each firing:
48
+ 1. Sends the prompt to the CEO (or directly to the specified skill)
49
+ 2. The CEO creates tasks and dispatches them
50
+ 3. Results are logged and accessible via 'naive jobs'
51
+
52
+ Cost: Each cron firing costs credits based on the work performed.
53
+ `)
54
+ .action(async (schedule, prompt, opts) => {
55
+ const resp = await apiRequest("POST", "/v1/cron", {
56
+ schedule,
57
+ prompt,
58
+ ...(opts.skill && { skill: opts.skill }),
59
+ ...(opts.name && { name: opts.name }),
60
+ });
61
+ handleApiError("cron.create", resp);
62
+ const raw = resp.data;
63
+ const job = (raw.job ?? raw);
64
+ const jobId = job.id ?? "unknown";
65
+ const scheduleDisplay = job.schedule_display ?? (typeof job.schedule === "string" ? job.schedule : schedule);
66
+ agentOutput({
67
+ action: "cron.create",
68
+ result: resp.data,
69
+ next_steps: [
70
+ { command: `naive cron trigger ${jobId}`, description: "Test-fire this job immediately" },
71
+ { command: "naive cron list", description: "View all scheduled jobs" },
72
+ ],
73
+ hints: [
74
+ `Cron job created (id: ${jobId})`,
75
+ `Schedule: ${scheduleDisplay}`,
76
+ ...(job.name ? [`Name: ${job.name}`] : []),
77
+ ...(job.next_run_at ? [`Next run: ${job.next_run_at}`] : []),
78
+ "The job will fire automatically at the next scheduled interval",
79
+ ],
80
+ related_commands: ["naive cron list", "naive cron trigger", "naive cron pause"],
81
+ });
82
+ });
83
+ cronCmd
84
+ .command("list")
85
+ .description("List all cron jobs — active, paused, and their schedules")
86
+ .addHelpText("after", `
87
+ Examples:
88
+ $ naive cron list
89
+
90
+ Returns cron job details:
91
+ - id, name, schedule (cron expression)
92
+ - Status (active, paused)
93
+ - Prompt that fires on each run
94
+ - Last run timestamp and result
95
+ - Next scheduled run time
96
+ `)
97
+ .action(async () => {
98
+ const resp = await apiRequest("GET", "/v1/cron");
99
+ handleApiError("cron.list", resp);
100
+ const data = resp.data;
101
+ const count = data.cron_jobs?.length ?? 0;
102
+ const active = data.cron_jobs?.filter((j) => j.status === "active") ?? [];
103
+ agentOutput({
104
+ action: "cron.list",
105
+ result: resp.data,
106
+ next_steps: [
107
+ ...(count > 0
108
+ ? [{ command: `naive cron trigger ${data.cron_jobs[0].id}`, description: "Manually trigger the first job" }]
109
+ : []),
110
+ { command: 'naive cron create "<schedule>" "<prompt>"', description: "Create a new cron job" },
111
+ ],
112
+ hints: [
113
+ `${count} cron job${count !== 1 ? "s" : ""} total, ${active.length} active`,
114
+ ],
115
+ related_commands: ["naive cron create", "naive cron trigger", "naive cron pause", "naive cron remove"],
116
+ });
117
+ });
118
+ cronCmd
119
+ .command("trigger <id>")
120
+ .description("Manually trigger a cron job immediately — useful for testing")
121
+ .addHelpText("after", `
122
+ Examples:
123
+ $ naive cron trigger cron-abc-123
124
+
125
+ Fires the job's prompt immediately, regardless of its schedule.
126
+ The job's schedule is not affected — it will still fire at its next
127
+ scheduled interval.
128
+
129
+ Cost: Same as a regular cron firing (credits based on work performed).
130
+ `)
131
+ .action(async (id) => {
132
+ const resp = await apiRequest("POST", `/v1/cron/${id}/trigger`);
133
+ handleApiError("cron.trigger", resp);
134
+ const data = resp.data;
135
+ agentOutput({
136
+ action: "cron.trigger",
137
+ result: resp.data,
138
+ next_steps: [
139
+ ...(data.run_id
140
+ ? [{ command: `naive ceo stream ${data.run_id}`, description: "Stream the triggered run" }]
141
+ : []),
142
+ { command: "naive cron list", description: "View all cron jobs" },
143
+ { command: "naive tasks list", description: "See tasks created by this trigger" },
144
+ ],
145
+ hints: [
146
+ `Cron job ${id} triggered manually`,
147
+ "This does not affect the regular schedule",
148
+ ],
149
+ related_commands: ["naive cron list", "naive ceo stream", "naive tasks list"],
150
+ });
151
+ });
152
+ cronCmd
153
+ .command("pause <id>")
154
+ .description("Pause a cron job — it will not fire until resumed")
155
+ .addHelpText("after", `
156
+ Examples:
157
+ $ naive cron pause cron-abc-123
158
+
159
+ Pauses the cron job. It remains configured but will not fire on schedule.
160
+ Use 'naive cron trigger <id>' to still fire it manually while paused.
161
+ Resume by updating the job status (re-create with same config if needed).
162
+ `)
163
+ .action(async (id) => {
164
+ const resp = await apiRequest("POST", `/v1/cron/${id}/pause`);
165
+ handleApiError("cron.pause", resp);
166
+ agentOutput({
167
+ action: "cron.pause",
168
+ result: resp.data,
169
+ next_steps: [
170
+ { command: `naive cron trigger ${id}`, description: "Manually trigger while paused" },
171
+ { command: "naive cron list", description: "View all cron jobs" },
172
+ { command: `naive cron remove ${id}`, description: "Delete this job permanently" },
173
+ ],
174
+ hints: [
175
+ `Cron job ${id} paused — will not fire on schedule`,
176
+ "You can still trigger it manually",
177
+ ],
178
+ related_commands: ["naive cron list", "naive cron trigger", "naive cron remove"],
179
+ });
180
+ });
181
+ cronCmd
182
+ .command("remove <id>")
183
+ .description("Permanently delete a cron job")
184
+ .addHelpText("after", `
185
+ Examples:
186
+ $ naive cron remove cron-abc-123
187
+
188
+ Permanently removes the cron job. This cannot be undone.
189
+ Past executions and their results remain in job history.
190
+ `)
191
+ .action(async (id) => {
192
+ const resp = await apiRequest("DELETE", `/v1/cron/${id}`);
193
+ handleApiError("cron.remove", resp);
194
+ agentOutput({
195
+ action: "cron.remove",
196
+ result: resp.data,
197
+ next_steps: [
198
+ { command: "naive cron list", description: "View remaining cron jobs" },
199
+ { command: 'naive cron create "<schedule>" "<prompt>"', description: "Create a replacement job" },
200
+ ],
201
+ hints: [
202
+ `Cron job ${id} deleted permanently`,
203
+ "Historical execution results remain in job history",
204
+ ],
205
+ related_commands: ["naive cron list", "naive cron create"],
206
+ });
207
+ });
208
+ //# sourceMappingURL=cron-jobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-jobs.js","sourceRoot":"","sources":["../../src/commands/cron-jobs.ts"],"names":[],"mappings":"AAAA,OA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