@oxygen-agent/cli 1.1014.136 → 1.1014.618

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 (292) hide show
  1. package/README.md +1 -1
  2. package/dist/admin-primary-providers-render.js +27 -19
  3. package/dist/cli-output.d.ts +12 -0
  4. package/dist/cli-output.js +395 -0
  5. package/dist/cli-paths.d.ts +1 -0
  6. package/dist/cli-paths.js +3 -0
  7. package/dist/cli-profile-context.d.ts +3 -0
  8. package/dist/cli-profile-context.js +13 -0
  9. package/dist/command-manifest.d.ts +15 -0
  10. package/dist/command-manifest.js +23 -1
  11. package/dist/command-support.d.ts +438 -0
  12. package/dist/command-support.js +1610 -0
  13. package/dist/commands/action-column.d.ts +3 -0
  14. package/dist/commands/action-column.js +43 -0
  15. package/dist/commands/activation.d.ts +3 -0
  16. package/dist/commands/activation.js +24 -0
  17. package/dist/commands/admin.d.ts +3 -0
  18. package/dist/commands/admin.js +347 -0
  19. package/dist/commands/ads.d.ts +3 -0
  20. package/dist/commands/ads.js +62 -0
  21. package/dist/commands/agent.d.ts +3 -0
  22. package/dist/commands/agent.js +274 -0
  23. package/dist/commands/api-keys.d.ts +3 -0
  24. package/dist/commands/api-keys.js +77 -0
  25. package/dist/commands/approvals.d.ts +3 -0
  26. package/dist/commands/approvals.js +518 -0
  27. package/dist/commands/auth.d.ts +3 -0
  28. package/dist/commands/auth.js +230 -0
  29. package/dist/commands/billing.d.ts +3 -0
  30. package/dist/commands/billing.js +357 -0
  31. package/dist/commands/blueprints.d.ts +3 -0
  32. package/dist/commands/blueprints.js +312 -0
  33. package/dist/commands/budget.d.ts +3 -0
  34. package/dist/commands/budget.js +55 -0
  35. package/dist/commands/callables.d.ts +3 -0
  36. package/dist/commands/callables.js +111 -0
  37. package/dist/commands/capabilities.d.ts +3 -0
  38. package/dist/commands/capabilities.js +44 -0
  39. package/dist/commands/cells.d.ts +3 -0
  40. package/dist/commands/cells.js +94 -0
  41. package/dist/commands/columns.d.ts +3 -0
  42. package/dist/commands/columns.js +1628 -0
  43. package/dist/commands/commands.d.ts +3 -0
  44. package/dist/commands/commands.js +45 -0
  45. package/dist/commands/comments.d.ts +3 -0
  46. package/dist/commands/comments.js +188 -0
  47. package/dist/commands/companies.d.ts +3 -0
  48. package/dist/commands/companies.js +312 -0
  49. package/dist/commands/connections.d.ts +3 -0
  50. package/dist/commands/connections.js +39 -0
  51. package/dist/commands/context.d.ts +3 -0
  52. package/dist/commands/context.js +170 -0
  53. package/dist/commands/copilot.d.ts +3 -0
  54. package/dist/commands/copilot.js +565 -0
  55. package/dist/commands/crm.d.ts +3 -0
  56. package/dist/commands/crm.js +1669 -0
  57. package/dist/commands/custom-integrations.d.ts +3 -0
  58. package/dist/commands/custom-integrations.js +140 -0
  59. package/dist/commands/dashboards.d.ts +3 -0
  60. package/dist/commands/dashboards.js +240 -0
  61. package/dist/commands/db.d.ts +3 -0
  62. package/dist/commands/db.js +190 -0
  63. package/dist/commands/deliverability.d.ts +3 -0
  64. package/dist/commands/deliverability.js +90 -0
  65. package/dist/commands/directory.d.ts +3 -0
  66. package/dist/commands/directory.js +101 -0
  67. package/dist/commands/domains.d.ts +3 -0
  68. package/dist/commands/domains.js +604 -0
  69. package/dist/commands/egress.d.ts +3 -0
  70. package/dist/commands/egress.js +130 -0
  71. package/dist/commands/email.d.ts +3 -0
  72. package/dist/commands/email.js +49 -0
  73. package/dist/commands/engagement.d.ts +3 -0
  74. package/dist/commands/engagement.js +189 -0
  75. package/dist/commands/enrich-column.d.ts +3 -0
  76. package/dist/commands/enrich-column.js +149 -0
  77. package/dist/commands/enrichment.d.ts +3 -0
  78. package/dist/commands/enrichment.js +49 -0
  79. package/dist/commands/feedback.d.ts +3 -0
  80. package/dist/commands/feedback.js +96 -0
  81. package/dist/commands/feeds.d.ts +3 -0
  82. package/dist/commands/feeds.js +486 -0
  83. package/dist/commands/find.d.ts +3 -0
  84. package/dist/commands/find.js +159 -0
  85. package/dist/commands/followers.d.ts +3 -0
  86. package/dist/commands/followers.js +39 -0
  87. package/dist/commands/formulas.d.ts +3 -0
  88. package/dist/commands/formulas.js +43 -0
  89. package/dist/commands/home.d.ts +3 -0
  90. package/dist/commands/home.js +22 -0
  91. package/dist/commands/inbox.d.ts +3 -0
  92. package/dist/commands/inbox.js +779 -0
  93. package/dist/commands/integrations.d.ts +3 -0
  94. package/dist/commands/integrations.js +290 -0
  95. package/dist/commands/knowledge.d.ts +3 -0
  96. package/dist/commands/knowledge.js +874 -0
  97. package/dist/commands/lead-sourcing.d.ts +3 -0
  98. package/dist/commands/lead-sourcing.js +52 -0
  99. package/dist/commands/limits.d.ts +3 -0
  100. package/dist/commands/limits.js +54 -0
  101. package/dist/commands/linkedin.d.ts +3 -0
  102. package/dist/commands/linkedin.js +275 -0
  103. package/dist/commands/login.d.ts +3 -0
  104. package/dist/commands/login.js +347 -0
  105. package/dist/commands/logout.d.ts +3 -0
  106. package/dist/commands/logout.js +12 -0
  107. package/dist/commands/mailboxes.d.ts +3 -0
  108. package/dist/commands/mailboxes.js +1290 -0
  109. package/dist/commands/managed-inboxes.d.ts +3 -0
  110. package/dist/commands/managed-inboxes.js +361 -0
  111. package/dist/commands/messages.d.ts +3 -0
  112. package/dist/commands/messages.js +78 -0
  113. package/dist/commands/notetaker.d.ts +3 -0
  114. package/dist/commands/notetaker.js +79 -0
  115. package/dist/commands/observability.d.ts +3 -0
  116. package/dist/commands/observability.js +125 -0
  117. package/dist/commands/orgs.d.ts +3 -0
  118. package/dist/commands/orgs.js +237 -0
  119. package/dist/commands/people.d.ts +3 -0
  120. package/dist/commands/people.js +353 -0
  121. package/dist/commands/posts.d.ts +3 -0
  122. package/dist/commands/posts.js +139 -0
  123. package/dist/commands/profiles.d.ts +3 -0
  124. package/dist/commands/profiles.js +250 -0
  125. package/dist/commands/projects.d.ts +3 -0
  126. package/dist/commands/projects.js +94 -0
  127. package/dist/commands/prompts.d.ts +3 -0
  128. package/dist/commands/prompts.js +84 -0
  129. package/dist/commands/publishing.d.ts +3 -0
  130. package/dist/commands/publishing.js +1419 -0
  131. package/dist/commands/recipes.d.ts +3 -0
  132. package/dist/commands/recipes.js +120 -0
  133. package/dist/commands/reviews.d.ts +3 -0
  134. package/dist/commands/reviews.js +75 -0
  135. package/dist/commands/rows.d.ts +3 -0
  136. package/dist/commands/rows.js +27 -0
  137. package/dist/commands/runs.d.ts +3 -0
  138. package/dist/commands/runs.js +37 -0
  139. package/dist/commands/search.d.ts +3 -0
  140. package/dist/commands/search.js +182 -0
  141. package/dist/commands/senders.d.ts +3 -0
  142. package/dist/commands/senders.js +393 -0
  143. package/dist/commands/sequences.d.ts +3 -0
  144. package/dist/commands/sequences.js +2322 -0
  145. package/dist/commands/session.d.ts +3 -0
  146. package/dist/commands/session.js +109 -0
  147. package/dist/commands/signals.d.ts +3 -0
  148. package/dist/commands/signals.js +289 -0
  149. package/dist/commands/signup-leads.d.ts +3 -0
  150. package/dist/commands/signup-leads.js +46 -0
  151. package/dist/commands/skills.d.ts +3 -0
  152. package/dist/commands/skills.js +50 -0
  153. package/dist/commands/sourcing.d.ts +3 -0
  154. package/dist/commands/sourcing.js +27 -0
  155. package/dist/commands/status.d.ts +3 -0
  156. package/dist/commands/status.js +51 -0
  157. package/dist/commands/supabase.d.ts +3 -0
  158. package/dist/commands/supabase.js +128 -0
  159. package/dist/commands/support.d.ts +3 -0
  160. package/dist/commands/support.js +651 -0
  161. package/dist/commands/suppressions.d.ts +3 -0
  162. package/dist/commands/suppressions.js +577 -0
  163. package/dist/commands/table-ingestions.d.ts +3 -0
  164. package/dist/commands/table-ingestions.js +145 -0
  165. package/dist/commands/table-runs.d.ts +3 -0
  166. package/dist/commands/table-runs.js +277 -0
  167. package/dist/commands/tables.d.ts +3 -0
  168. package/dist/commands/tables.js +3492 -0
  169. package/dist/commands/tags.d.ts +3 -0
  170. package/dist/commands/tags.js +147 -0
  171. package/dist/commands/tools.d.ts +3 -0
  172. package/dist/commands/tools.js +246 -0
  173. package/dist/commands/update.d.ts +3 -0
  174. package/dist/commands/update.js +106 -0
  175. package/dist/commands/verify.d.ts +3 -0
  176. package/dist/commands/verify.js +27 -0
  177. package/dist/commands/viewers.d.ts +3 -0
  178. package/dist/commands/viewers.js +72 -0
  179. package/dist/commands/voice.d.ts +3 -0
  180. package/dist/commands/voice.js +351 -0
  181. package/dist/commands/whatsapp.d.ts +3 -0
  182. package/dist/commands/whatsapp.js +226 -0
  183. package/dist/commands/whoami.d.ts +3 -0
  184. package/dist/commands/whoami.js +110 -0
  185. package/dist/commands/worker.d.ts +3 -0
  186. package/dist/commands/worker.js +60 -0
  187. package/dist/commands/workflows.d.ts +3 -0
  188. package/dist/commands/workflows.js +1752 -0
  189. package/dist/commands/workspace.d.ts +3 -0
  190. package/dist/commands/workspace.js +94 -0
  191. package/dist/compact-list-flags.d.ts +7 -0
  192. package/dist/compact-list-flags.js +12 -0
  193. package/dist/crm-support-flags.js +14 -5
  194. package/dist/customer-operation-commands.js +8 -6
  195. package/dist/diagnostic-uploader.d.ts +3 -1
  196. package/dist/diagnostic-uploader.js +29 -8
  197. package/dist/help.d.ts +5 -0
  198. package/dist/help.js +22 -0
  199. package/dist/index.d.ts +98 -1
  200. package/dist/index.js +331 -30719
  201. package/dist/local-module-loader.d.ts +4 -0
  202. package/dist/local-module-loader.js +156 -0
  203. package/dist/visual-commands.js +9 -5
  204. package/node_modules/@oxygen/cli-ugc/dist/commands.js +2 -2
  205. package/node_modules/@oxygen/shared/dist/agent-session-schedule.d.ts +36 -0
  206. package/node_modules/@oxygen/shared/dist/agent-session-schedule.js +69 -0
  207. package/node_modules/@oxygen/shared/dist/agent-sessions.d.ts +14 -5
  208. package/node_modules/@oxygen/shared/dist/agent-sessions.js +14 -3
  209. package/node_modules/@oxygen/shared/dist/capability-discovery.js +175 -14
  210. package/node_modules/@oxygen/shared/dist/compact-list-result.d.ts +6 -0
  211. package/node_modules/@oxygen/shared/dist/compact-list-result.js +27 -0
  212. package/node_modules/@oxygen/shared/dist/contracts/agent-sessions.d.ts +12 -1
  213. package/node_modules/@oxygen/shared/dist/contracts/agent-sessions.js +5 -2
  214. package/node_modules/@oxygen/shared/dist/contracts/browser-operations.js +4 -2
  215. package/node_modules/@oxygen/shared/dist/contracts/compact-list-reads.d.ts +57 -0
  216. package/node_modules/@oxygen/shared/dist/contracts/compact-list-reads.js +23 -0
  217. package/node_modules/@oxygen/shared/dist/contracts/crm-support.d.ts +52 -0
  218. package/node_modules/@oxygen/shared/dist/contracts/crm-support.js +43 -2
  219. package/node_modules/@oxygen/shared/dist/contracts/customer-operations.js +17 -14
  220. package/node_modules/@oxygen/shared/dist/contracts/knowledge-content-reads.js +1 -1
  221. package/node_modules/@oxygen/shared/dist/contracts/knowledge-proposal-reads.d.ts +49 -0
  222. package/node_modules/@oxygen/shared/dist/contracts/knowledge-proposal-reads.js +14 -0
  223. package/node_modules/@oxygen/shared/dist/contracts/knowledge-sync.js +1 -1
  224. package/node_modules/@oxygen/shared/dist/contracts/limits-read.js +60 -7
  225. package/node_modules/@oxygen/shared/dist/contracts/operations.d.ts +9 -1
  226. package/node_modules/@oxygen/shared/dist/contracts/operations.js +13 -5
  227. package/node_modules/@oxygen/shared/dist/contracts/publishing-reads.js +1 -1
  228. package/node_modules/@oxygen/shared/dist/contracts/teammates.d.ts +16 -0
  229. package/node_modules/@oxygen/shared/dist/contracts/teammates.js +115 -0
  230. package/node_modules/@oxygen/shared/dist/cost-estimate-view.js +21 -3
  231. package/node_modules/@oxygen/shared/dist/cost-estimate.d.ts +31 -1
  232. package/node_modules/@oxygen/shared/dist/cost-estimate.js +56 -15
  233. package/node_modules/@oxygen/shared/dist/diagnostic-credentials.d.ts +2 -0
  234. package/node_modules/@oxygen/shared/dist/diagnostic-credentials.js +2 -0
  235. package/node_modules/@oxygen/shared/dist/diagnostic-lock.js +71 -44
  236. package/node_modules/@oxygen/shared/dist/diagnostic-spool.d.ts +18 -0
  237. package/node_modules/@oxygen/shared/dist/diagnostic-spool.js +348 -0
  238. package/node_modules/@oxygen/shared/dist/diagnostic-storage-failure.d.ts +10 -0
  239. package/node_modules/@oxygen/shared/dist/diagnostic-storage-failure.js +42 -0
  240. package/node_modules/@oxygen/shared/dist/diagnostic-storage.d.ts +1 -1
  241. package/node_modules/@oxygen/shared/dist/diagnostic-storage.js +59 -213
  242. package/node_modules/@oxygen/shared/dist/diagnostics.js +3 -2
  243. package/node_modules/@oxygen/shared/dist/email-dsn.d.ts +16 -5
  244. package/node_modules/@oxygen/shared/dist/email-dsn.js +97 -1
  245. package/node_modules/@oxygen/shared/dist/emailguard-placement-probe.js +5 -0
  246. package/node_modules/@oxygen/shared/dist/enrichment-intents.js +4 -5
  247. package/node_modules/@oxygen/shared/dist/file-import.js +5 -2
  248. package/node_modules/@oxygen/shared/dist/hosted-ai.d.ts +30 -0
  249. package/node_modules/@oxygen/shared/dist/hosted-ai.js +20 -0
  250. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.d.ts +6 -2
  251. package/node_modules/@oxygen/shared/dist/knowledge-seed-content.d.ts +17 -7
  252. package/node_modules/@oxygen/shared/dist/knowledge-seed-content.js +81 -17
  253. package/node_modules/@oxygen/shared/dist/langfuse.js +8 -4
  254. package/node_modules/@oxygen/shared/dist/mailbox-egress-ownership.d.ts +1 -1
  255. package/node_modules/@oxygen/shared/dist/mailbox-import.d.ts +6 -3
  256. package/node_modules/@oxygen/shared/dist/mailbox-import.js +9 -9
  257. package/node_modules/@oxygen/shared/dist/mcp-server-info.d.ts +8 -0
  258. package/node_modules/@oxygen/shared/dist/mcp-server-info.js +10 -0
  259. package/node_modules/@oxygen/shared/dist/object-storage.d.ts +10 -0
  260. package/node_modules/@oxygen/shared/dist/object-storage.js +14 -0
  261. package/node_modules/@oxygen/shared/dist/plan-limits-view.d.ts +5 -0
  262. package/node_modules/@oxygen/shared/dist/plan-limits-view.js +17 -1
  263. package/node_modules/@oxygen/shared/dist/pricing-sheet.d.ts +1 -1
  264. package/node_modules/@oxygen/shared/dist/pricing-sheet.js +1 -1
  265. package/node_modules/@oxygen/shared/dist/provider-selection.d.ts +15 -0
  266. package/node_modules/@oxygen/shared/dist/provider-selection.js +3 -0
  267. package/node_modules/@oxygen/shared/dist/repricing.d.ts +1 -1
  268. package/node_modules/@oxygen/shared/dist/repricing.js +2 -2
  269. package/node_modules/@oxygen/shared/dist/schedule-label.d.ts +6 -0
  270. package/node_modules/@oxygen/shared/dist/schedule-label.js +12 -0
  271. package/node_modules/@oxygen/shared/dist/sequence-failures.d.ts +1 -0
  272. package/node_modules/@oxygen/shared/dist/sequence-failures.js +20 -6
  273. package/node_modules/@oxygen/shared/dist/teammate-groups.d.ts +55 -0
  274. package/node_modules/@oxygen/shared/dist/teammate-groups.js +74 -0
  275. package/node_modules/@oxygen/shared/dist/teammate-messages.d.ts +52 -0
  276. package/node_modules/@oxygen/shared/dist/teammate-messages.js +88 -0
  277. package/node_modules/@oxygen/shared/dist/teammate-notes.d.ts +58 -0
  278. package/node_modules/@oxygen/shared/dist/teammate-notes.js +73 -0
  279. package/node_modules/@oxygen/shared/dist/teammate-routines.d.ts +95 -0
  280. package/node_modules/@oxygen/shared/dist/teammate-routines.js +266 -0
  281. package/node_modules/@oxygen/shared/dist/teammate-tasks.d.ts +56 -0
  282. package/node_modules/@oxygen/shared/dist/teammate-tasks.js +114 -0
  283. package/node_modules/@oxygen/shared/dist/teammates.d.ts +78 -0
  284. package/node_modules/@oxygen/shared/dist/teammates.js +140 -0
  285. package/node_modules/@oxygen/shared/dist/user-capability-routing.js +120 -0
  286. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
  287. package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
  288. package/node_modules/@oxygen/shared/dist/visual-render.d.ts +9 -1
  289. package/node_modules/@oxygen/shared/dist/visual-render.js +12 -5
  290. package/node_modules/@oxygen/shared/dist/warmup-metrics.d.ts +5 -0
  291. package/node_modules/@oxygen/shared/dist/warmup-metrics.js +44 -0
  292. package/package.json +1 -1
@@ -0,0 +1,145 @@
1
+ import { parseJsonObject, readPositiveInt } from "../cli-values.js";
2
+ import { TABLE_INGESTION_WAIT_DEFAULT_INTERVAL_SECONDS, TABLE_INGESTION_WAIT_DEFAULT_TIMEOUT_SECONDS, buildGetSurfaceRunWaitConfig, isTerminalTableIngestionStatus, readPositiveNumber } from "../command-support.js";
3
+ import { requestOxygen } from "../http-client.js";
4
+ import { waitForCliRun } from "../run-wait.js";
5
+ import { readOption } from "../util.js";
6
+ import { OxygenError } from "@oxygen/shared/cli-result";
7
+ import { Command } from "commander";
8
+ function waitForTableIngestionRun(runId, options) {
9
+ return waitForCliRun(buildGetSurfaceRunWaitConfig({
10
+ runId,
11
+ endpoint: "/api/cli/table-ingestion-runs",
12
+ retryTransientNetworkErrors: true,
13
+ requestedTimeoutSeconds: options.timeoutSeconds,
14
+ requestedIntervalSeconds: options.intervalSeconds,
15
+ defaultTimeoutSeconds: TABLE_INGESTION_WAIT_DEFAULT_TIMEOUT_SECONDS,
16
+ defaultIntervalSeconds: TABLE_INGESTION_WAIT_DEFAULT_INTERVAL_SECONDS,
17
+ isTerminal: isTerminalTableIngestionStatus,
18
+ runKey: "ingestionRun",
19
+ runIdKey: "ingestionRunId",
20
+ timeoutCode: "table_ingestion_wait_timeout",
21
+ timeoutMessage: "Timed out waiting for table ingestion run to finish. Check its latest status with `oxygen table-ingestions get <run_id>`.",
22
+ timeoutDetailIdKey: "ingestion_run_id",
23
+ }));
24
+ }
25
+ export function registerTableIngestionsFamily(program, handleAsyncAction) {
26
+ program
27
+ .command("table-ingestions")
28
+ .description("Durable background table ingestion commands. To find a table's ingestion runs: `runs list --table <table>`.")
29
+ .addCommand(new Command("create-tool-page")
30
+ .description("Create a bounded paged tool-source ingestion. LinkedIn ads: --tool adyntel.linkedin_ads --rows-path response.ads --cursor-path response.continuation_token --cursor-request-key continuation_token --upsert-key ad_id. Completed means the approved bound finished; use table-ingestions items to check whether more pages remain.")
31
+ .argument("<table>", "Table id or slug.")
32
+ .option("--tool <tool_id>", "Tool id such as blitzapi.people_search or hubspot.contacts_list.")
33
+ .option("--tool-id <tool_id>", "Alias for --tool.")
34
+ .requiredOption("--request-json <json>", "Tool request JSON object for the first page.")
35
+ .option("--rows-path <path>", "Path from the whole tool result, including response. Defaults to response.results; LinkedIn/Google ads use response.ads.")
36
+ .option("--row-mapping-json <json>", "Object mapping target column keys to dotted source-row paths.")
37
+ .option("--cursor-path <path>", "Path from the whole tool result; Adyntel ads use response.continuation_token.")
38
+ .option("--cursor-request-key <path>", "Dotted request key to receive the next cursor.")
39
+ .option("--max-pages <n>", "Maximum pages in this item's cursor chain. Defaults to 1; a page limit is not supplier exhaustion.")
40
+ .option("--upsert-key <key>", "Column key used to upsert instead of inserting.")
41
+ .option("--connection-id <connection_id>", "Optional provider integration connection id.")
42
+ .option("--max-concurrency <n>", "Maximum concurrent ingestion items for this run. Defaults to 5.")
43
+ .option("--max-credits <n>", "Maximum credits to reserve for this run; required for paid tools.")
44
+ .option("--metadata-json <json>", "Optional metadata object to attach to the run.")
45
+ .option("--json", "Print a JSON envelope.")
46
+ .action(async (table, options) => {
47
+ await handleAsyncAction("table-ingestions create-tool-page", options, () => {
48
+ const toolId = readOption(options.tool) ?? readOption(options.toolId);
49
+ if (!toolId) {
50
+ throw new OxygenError("invalid_table_ingestion", "Pass --tool or --tool-id.", {
51
+ exitCode: 1,
52
+ });
53
+ }
54
+ const maxPages = readPositiveInt(options.maxPages);
55
+ const maxConcurrency = readPositiveInt(options.maxConcurrency);
56
+ const maxCredits = readPositiveNumber(options.maxCredits);
57
+ const rowMappingJson = readOption(options.rowMappingJson);
58
+ const payload = {
59
+ tool_id: toolId,
60
+ request: parseJsonObject(options.requestJson),
61
+ ...(readOption(options.rowsPath) ? { rows_path: readOption(options.rowsPath) } : {}),
62
+ ...(rowMappingJson ? { row_mapping: parseJsonObject(rowMappingJson) } : {}),
63
+ ...(readOption(options.cursorPath) ? { cursor_path: readOption(options.cursorPath) } : {}),
64
+ ...(readOption(options.cursorRequestKey) ? { cursor_request_key: readOption(options.cursorRequestKey) } : {}),
65
+ ...(maxPages ? { max_pages: maxPages } : {}),
66
+ };
67
+ return requestOxygen("/api/cli/table-ingestion-runs", {
68
+ method: "POST",
69
+ body: {
70
+ table,
71
+ source_type: "tool_page",
72
+ mode: options.upsertKey ? "upsert" : "insert",
73
+ ...(readOption(options.upsertKey) ? { upsert_key: readOption(options.upsertKey) } : {}),
74
+ ...(readOption(options.connectionId) ? { connection_id: readOption(options.connectionId) } : {}),
75
+ ...(maxConcurrency ? { max_concurrency: maxConcurrency } : {}),
76
+ ...(maxCredits !== undefined ? { max_credits: maxCredits } : {}),
77
+ metadata: {
78
+ command: "table-ingestions create-tool-page",
79
+ ...(options.metadataJson ? parseJsonObject(options.metadataJson) : {}),
80
+ },
81
+ items: [
82
+ {
83
+ position: 0,
84
+ payload,
85
+ },
86
+ ],
87
+ },
88
+ });
89
+ });
90
+ }))
91
+ .addCommand(new Command("get")
92
+ .description("Get one durable table ingestion run. For provider pages, completed means its bounded work finished; inspect table-ingestions items for the source cursor and exhaustion.")
93
+ .argument("<run_id>", "Table ingestion run UUID.")
94
+ .option("--json", "Print a JSON envelope.")
95
+ .action(async (runId, options) => {
96
+ await handleAsyncAction("table-ingestions get", options, () => requestOxygen(`/api/cli/table-ingestion-runs/${encodeURIComponent(runId)}`));
97
+ }))
98
+ .addCommand(new Command("items")
99
+ .description("List ingestion items, including completed pages. For tool_page, item.output.has_next_cursor=true means more pages remain; item.output.stopped_by=provider_exhausted records cursor exhaustion. item.nextCursor is the saved continuation: start a new approved create-tool-page run in the same Table with that request cursor, the same filters/mapping/upsert key and a new credit cap. Inspect failed or unknown outcomes before retrying.")
100
+ .argument("<run_id>", "Table ingestion run UUID.")
101
+ .option("--status <status>", "Filter by pending, leased, completed, failed, skipped, or canceled.")
102
+ .option("--limit <n>", "Maximum items to return. Defaults to 100.")
103
+ .option("--json", "Print a JSON envelope.")
104
+ .action(async (runId, options) => {
105
+ await handleAsyncAction("table-ingestions items", options, () => {
106
+ const query = new URLSearchParams();
107
+ if (readOption(options.status))
108
+ query.set("status", readOption(options.status) ?? "");
109
+ const limit = readPositiveInt(options.limit);
110
+ if (limit)
111
+ query.set("limit", String(limit));
112
+ const suffix = query.toString() ? `?${query.toString()}` : "";
113
+ return requestOxygen(`/api/cli/table-ingestion-runs/${encodeURIComponent(runId)}/items${suffix}`);
114
+ });
115
+ }))
116
+ .addCommand(new Command("wait")
117
+ .description("Wait for a table ingestion run (read-only, no credits). A completed bounded run may have more provider pages; inspect table-ingestions items for has_next_cursor, stopped_by and nextCursor. Retries transient network failures, including deploy disconnects, within the same timeout.")
118
+ .argument("<run_id>", "Table ingestion run UUID.")
119
+ .option("--timeout-seconds <n>", "Maximum time to wait. Defaults to 600.")
120
+ .option("--interval-seconds <n>", "Polling interval. Defaults to 5.")
121
+ .option("--json", "Print a JSON envelope.")
122
+ .action(async (runId, options) => {
123
+ await handleAsyncAction("table-ingestions wait", options, () => waitForTableIngestionRun(runId, options));
124
+ }))
125
+ .addCommand(new Command("cancel")
126
+ .description("Request cancellation for a durable table ingestion run.")
127
+ .argument("<run_id>", "Table ingestion run UUID.")
128
+ .option("--json", "Print a JSON envelope.")
129
+ .action(async (runId, options) => {
130
+ await handleAsyncAction("table-ingestions cancel", options, () => requestOxygen(`/api/cli/table-ingestion-runs/${encodeURIComponent(runId)}/cancel`, {
131
+ method: "POST",
132
+ body: {},
133
+ }));
134
+ }))
135
+ .addCommand(new Command("retry-failed")
136
+ .description("Requeue failed items for a durable table ingestion run.")
137
+ .argument("<run_id>", "Table ingestion run UUID.")
138
+ .option("--json", "Print a JSON envelope.")
139
+ .action(async (runId, options) => {
140
+ await handleAsyncAction("table-ingestions retry-failed", options, () => requestOxygen(`/api/cli/table-ingestion-runs/${encodeURIComponent(runId)}/retry-failed`, {
141
+ method: "POST",
142
+ body: {},
143
+ }));
144
+ }));
145
+ }
@@ -0,0 +1,3 @@
1
+ import { ExtractedCommandActionHandler } from "../command-support.js";
2
+ import { Command } from "commander";
3
+ export declare function registerTableRunsFamily(program: Command, handleAsyncAction: ExtractedCommandActionHandler): void;
@@ -0,0 +1,277 @@
1
+ import { parseJsonObject, readPositiveInt } from "../cli-values.js";
2
+ import { formatRows, normalizeExportRowsFormat, parseJsonArray, readCsvOption, readFilterSelectionOption, readFormulaValuesOption, readPositiveNumber, tableRunsListPath, waitForTableActionRun } from "../command-support.js";
3
+ import { requestOxygen } from "../http-client.js";
4
+ import { isRecord, readOption } from "../util.js";
5
+ import { OxygenError } from "@oxygen/shared/cli-result";
6
+ import { tableRunSummary } from "@oxygen/shared/table-run-summary";
7
+ import { Command } from "commander";
8
+ import { writeFileSync } from "node:fs";
9
+ function readTableRunActions(options) {
10
+ if (options.actionsJson && readOption(options.column)) {
11
+ throw new OxygenError("invalid_table_run", "Pass either --actions-json or --column, not both.", {
12
+ exitCode: 1,
13
+ });
14
+ }
15
+ if (options.actionsJson)
16
+ return parseJsonArray(options.actionsJson);
17
+ const column = readOption(options.column);
18
+ if (column)
19
+ return [{ type: "tool_column", column }];
20
+ throw new OxygenError("invalid_table_run", "Pass --column or --actions-json.", {
21
+ exitCode: 1,
22
+ });
23
+ }
24
+ // Parse --then-json into an array of chain steps. Server validates the shape;
25
+ // we only enforce that the top-level value is an array of objects so users get
26
+ // a clear local error before round-tripping to the API.
27
+ function readChainStepsOption(value) {
28
+ if (!value)
29
+ return [];
30
+ const parsed = parseJsonArray(value);
31
+ for (let i = 0; i < parsed.length; i += 1) {
32
+ const entry = parsed[i];
33
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
34
+ throw new OxygenError("invalid_table_run", "--then-json entries must be objects.", {
35
+ details: { index: i },
36
+ exitCode: 1,
37
+ });
38
+ }
39
+ }
40
+ return parsed;
41
+ }
42
+ function readTableRunSelection(options) {
43
+ const hasAll = Boolean(options.all);
44
+ const limit = readPositiveInt(options.limit);
45
+ const rowIds = readCsvOption(options.rowIds);
46
+ const filterSelection = readFilterSelectionOption(options.filterJson);
47
+ const formulaValues = readFormulaValuesOption(options.formulaValues);
48
+ if (formulaValues && !filterSelection) {
49
+ throw new OxygenError("invalid_table_run", "--formula-values requires --filter-json on table-runs create.", { exitCode: 1 });
50
+ }
51
+ const selectedModes = [hasAll, Boolean(limit), rowIds.length > 0, Boolean(filterSelection)].filter(Boolean).length;
52
+ if (selectedModes > 1) {
53
+ throw new OxygenError("invalid_table_run", "Pass only one of --all, --limit, --row-ids, or --filter-json.", {
54
+ exitCode: 1,
55
+ });
56
+ }
57
+ if (hasAll)
58
+ return { mode: "all" };
59
+ if (limit)
60
+ return { mode: "limit", limit };
61
+ if (rowIds.length > 0)
62
+ return { mode: "row_ids", row_ids: rowIds };
63
+ if (filterSelection) {
64
+ return { ...filterSelection, ...(formulaValues ? { formula_values: formulaValues } : {}) };
65
+ }
66
+ throw new OxygenError("invalid_table_run", "Pass --all, --limit, --row-ids, or --filter-json.", {
67
+ exitCode: 1,
68
+ });
69
+ }
70
+ // `table-runs list --format` routes run history through the same serializer
71
+ // `tables export` uses, so csv/jsonl/table run exports behave exactly like row
72
+ // exports (header = union of run keys; nested objects like counts are
73
+ // JSON-stringified by escapeCsvField). Without --format/--output the command
74
+ // keeps its original envelope response untouched.
75
+ async function listTableRuns(options) {
76
+ const rawFormat = readOption(options.format);
77
+ const outputPath = readOption(options.output);
78
+ if (!rawFormat && !outputPath)
79
+ return requestOxygen(tableRunsListPath(options));
80
+ // Validate the format before spending the API call.
81
+ const format = normalizeExportRowsFormat(rawFormat ?? undefined);
82
+ const result = await requestOxygen(tableRunsListPath(options));
83
+ const runs = Array.isArray(result.runs) ? result.runs.filter(isRecord) : [];
84
+ const formatted = formatRows(runs, format);
85
+ if (outputPath)
86
+ writeFileSync(outputPath, formatted.content);
87
+ return {
88
+ table: result.table ?? null,
89
+ status: result.status ?? null,
90
+ format,
91
+ runCount: runs.length,
92
+ output: outputPath ?? null,
93
+ ...(outputPath ? {} : { content: formatted.content }),
94
+ // An empty default listing says which finished runs it hid; keep that
95
+ // pointer when the history is formatted instead of returned as an envelope.
96
+ ...(typeof result.hint === "string"
97
+ ? { hidden_run_count: result.hidden_run_count ?? null, hint: result.hint, next_actions: result.next_actions ?? [] }
98
+ : {}),
99
+ ...(typeof result.web_url === "string" ? { web_url: result.web_url } : {}),
100
+ };
101
+ }
102
+ export function registerTableRunsFamily(program, handleAsyncAction) {
103
+ program
104
+ .command("table-runs")
105
+ .description("Durable background table action run commands. `list --table <table> --status all` is a table's full action-run history, including Function runs launched from it; without --status, list shows only active runs. Imports and other writes: `runs list --table <table>`.")
106
+ .addCommand(new Command("create")
107
+ .description("Create a durable background run for table tool-column actions. Large runs are accepted immediately and their rows are prepared in the background (execution_status 'planning'); follow with `table-runs wait <run_id>`.")
108
+ .argument("<table>", "Table id or slug.")
109
+ .option("--column <column>", "Column id or key for a single tool-column action.")
110
+ .option("--actions-json <json>", "JSON array of actions, each with type tool_column and column.")
111
+ .option("--limit <n>", "Run against the newest n rows.")
112
+ .option("--all", "Run against all rows, up to the server cap.")
113
+ .option("--row-ids <csv>", "Comma-separated row UUIDs to run.")
114
+ .option("--filter-json <json>", "Filter object or array for server-side row selection.")
115
+ .option("--formula-values <mode>", "With --filter-json on a formula column, first refresh that selector with `columns run <table> <column> --force` (0 credits), then pass 'materialized'; the durable row scope filters the stored snapshot and records this freshness acknowledgement.")
116
+ .option("--force", "Run even when the target cell already has a value.")
117
+ .option("--connection-id <connection_id>", "Optional provider integration connection id.")
118
+ .option("--approved", "Confirm the paid table action run after inspecting a dry run or preview.")
119
+ .option("--max-credits <n>", "Maximum OXYGEN credits for this run, including managed calls and own-key provider platform fees. Vendor charges on your own key are outside this ceiling.")
120
+ .option("--max-concurrency <n>", "Maximum concurrent row items for this run (1-1000; a ceiling shared with worker and provider capacity). Defaults to 50 (160 for Firecrawl scrape columns).")
121
+ .option("--metadata-json <json>", "Optional metadata object to attach to the run.")
122
+ .option("--idempotency-key <key>", "Reuse the same scoped run when retrying this exact request.")
123
+ .option("--then-json <json>", "JSON array of sequential follow-up steps. Each step runs after the previous terminates with completed or completed_with_errors. Paid steps require selection and max_credits. Shape: [{actions:[{type:'tool_column',column}],selection,force,max_concurrency,max_credits,metadata,run_on_failure}].")
124
+ .option("--json", "Print a JSON envelope.")
125
+ .action(async (table, options) => {
126
+ const maxCredits = readPositiveNumber(options.maxCredits);
127
+ const maxConcurrency = readPositiveInt(options.maxConcurrency);
128
+ const chainSteps = readChainStepsOption(options.thenJson);
129
+ await handleAsyncAction("table-runs create", options, () => requestOxygen("/api/cli/table-action-runs", {
130
+ method: "POST",
131
+ body: {
132
+ table,
133
+ actions: readTableRunActions(options),
134
+ selection: readTableRunSelection(options),
135
+ ...(options.force ? { force: true } : {}),
136
+ ...(readOption(options.connectionId) ? { connection_id: readOption(options.connectionId) } : {}),
137
+ ...(options.approved ? { approved: true } : {}),
138
+ ...(maxCredits !== undefined ? { max_credits: maxCredits } : {}),
139
+ ...(maxConcurrency ? { max_concurrency: maxConcurrency } : {}),
140
+ ...(options.metadataJson ? { metadata: parseJsonObject(options.metadataJson) } : {}),
141
+ ...(readOption(options.idempotencyKey) ? { idempotency_key: readOption(options.idempotencyKey) } : {}),
142
+ ...(chainSteps.length > 0 ? { then: chainSteps } : {}),
143
+ },
144
+ }));
145
+ }))
146
+ .addCommand(new Command("list")
147
+ .description("List durable table action runs for one table. For every run of the table, imports included, use `runs list --table <table>`.")
148
+ .requiredOption("--table <table>", "Table id or slug.")
149
+ .option("--status <status>", "Filter by all, active, queued, running, paused, completed, completed_with_errors, failed, canceling, or canceled. Defaults to active; pass all for the full action-run history in one call, including Function runs launched from this table.")
150
+ .option("--limit <n>", "Maximum runs to return. Defaults to 20.")
151
+ .option("--format <format>", "Format run history as json, jsonl, csv, or table (same serializer as `tables export`). Omit to keep the default envelope output.")
152
+ .option("--output <path>", "Write the formatted run history to a file instead of embedding it in the response.")
153
+ .option("--json", "Print a JSON envelope.")
154
+ .action(async (options) => {
155
+ await handleAsyncAction("table-runs list", options, () => listTableRuns(options));
156
+ }))
157
+ .addCommand(new Command("get")
158
+ .description("Get one durable table action run. For a Function run, selection.rowIds are rows of the Function's execution table, not the calling table; list the calling table's rows it wrote with `tables query <caller> --filter-tree-json` on the Function column's \"action_run_id\" path.")
159
+ .argument("<run_id>", "Table action run UUID or parent workspace run UUID.")
160
+ .option("--full", "Read the full run, including stored inputs and metadata.")
161
+ .option("--json", "Print a JSON envelope.")
162
+ .action(async (runId, options) => {
163
+ await handleAsyncAction("table-runs get", options, () => requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}?view=${options.full ? "full" : "summary"}`)
164
+ .then((run) => options.full ? run : tableRunSummary(run)));
165
+ }))
166
+ .addCommand(new Command("items")
167
+ .description("List row items for a durable table action run. For a Function run, list the calling table's rows it wrote with `tables query <caller> --filter-tree-json` on the Function column's \"action_run_id\" path instead of joining items.")
168
+ .argument("<run_id>", "Table action run UUID.")
169
+ .option("--status <status>", "Filter by pending, leased, completed, failed, skipped, or canceled.")
170
+ .option("--limit <n>", "Maximum items to return. Defaults to 100.")
171
+ .option("--json", "Print a JSON envelope.")
172
+ .action(async (runId, options) => {
173
+ await handleAsyncAction("table-runs items", options, () => {
174
+ const query = new URLSearchParams();
175
+ if (readOption(options.status))
176
+ query.set("status", readOption(options.status) ?? "");
177
+ const limit = readPositiveInt(options.limit);
178
+ if (limit)
179
+ query.set("limit", String(limit));
180
+ const suffix = query.toString() ? `?${query.toString()}` : "";
181
+ return requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/items${suffix}`);
182
+ });
183
+ }))
184
+ .addCommand(new Command("wait")
185
+ .description("Poll a durable table action run until it finishes.")
186
+ .argument("<run_id>", "Table action run UUID or parent workspace run UUID.")
187
+ .option("--timeout-seconds <n>", "Maximum time to wait. Defaults to 600.")
188
+ .option("--interval-seconds <n>", "Polling interval. Defaults to 5.")
189
+ .option("--full", "Return the full completed run instead of a progress summary.")
190
+ .option("--json", "Print a JSON envelope.")
191
+ .action(async (runId, options) => {
192
+ await handleAsyncAction("table-runs wait", options, () => waitForTableActionRun(runId, options));
193
+ }))
194
+ .addCommand(new Command("provider-summary")
195
+ .description("Summarize provider attempts, upstream request events, and credit capture/release for a table action run.")
196
+ .argument("<run_id>", "Table action run UUID.")
197
+ .option("--json", "Print a JSON envelope.")
198
+ .action(async (runId, options) => {
199
+ await handleAsyncAction("table-runs provider-summary", options, () => requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/provider-summary`));
200
+ }))
201
+ .addCommand(new Command("cancel")
202
+ .description("Request cancellation for a durable table action run.")
203
+ .argument("<run_id>", "Table action run UUID or parent workspace run UUID.")
204
+ .option("--json", "Print a JSON envelope.")
205
+ .action(async (runId, options) => {
206
+ await handleAsyncAction("table-runs cancel", options, () => requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/cancel`, {
207
+ method: "POST",
208
+ body: {},
209
+ }));
210
+ }))
211
+ .addCommand(new Command("pause")
212
+ .description("Pause a durable table action run before it starts more row jobs.")
213
+ .argument("<run_id>", "Table action run UUID.")
214
+ .option("--json", "Print a JSON envelope.")
215
+ .action(async (runId, options) => {
216
+ await handleAsyncAction("table-runs pause", options, () => requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/pause`, {
217
+ method: "POST",
218
+ body: {},
219
+ }));
220
+ }))
221
+ .addCommand(new Command("resume")
222
+ .description("Resume a paused durable table action run.")
223
+ .argument("<run_id>", "Table action run UUID.")
224
+ .option("--json", "Print a JSON envelope.")
225
+ .action(async (runId, options) => {
226
+ await handleAsyncAction("table-runs resume", options, () => requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/resume`, {
227
+ method: "POST",
228
+ body: {},
229
+ }));
230
+ }))
231
+ .addCommand(new Command("effect-unknown")
232
+ .description("List the items of a run whose external write was dispatched but never confirmed. Oxygen will not retry them on its own: verify each destination, then record what you found with `oxygen cells resolve`.")
233
+ .argument("<run_id>", "Table action run UUID.")
234
+ .option("--include-resolved", "Also list items whose outcome a human has already recorded.")
235
+ .option("--limit <n>", "Maximum items to return. Defaults to 200.")
236
+ .option("--json", "Print a JSON envelope.")
237
+ .action(async (runId, options) => {
238
+ await handleAsyncAction("table-runs effect-unknown", options, () => {
239
+ const query = new URLSearchParams();
240
+ const limit = readPositiveInt(options.limit);
241
+ if (limit)
242
+ query.set("limit", String(limit));
243
+ if (options.includeResolved)
244
+ query.set("include_resolved", "true");
245
+ const suffix = query.toString() ? `?${query.toString()}` : "";
246
+ return requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/effect-unknown${suffix}`);
247
+ });
248
+ }))
249
+ .addCommand(new Command("retry-failed")
250
+ .description("Retry failed Table items or wake guarded Function callbacks from completed results at zero additional credits. Review --dry-run and approve its hash and ceiling. Unconfirmed external effects stay blocked.")
251
+ .argument("<run_id>", "Table action run UUID.")
252
+ .option("--dry-run", "Read the exact retry scope and approval hash without requeueing.")
253
+ .option("--approved", "Approve the inspected retry scope and additional-credit ceiling.")
254
+ .option("--retry-plan-hash <hash>", "Hash returned by the retry dry run.")
255
+ .option("--max-additional-credits <n>", "Fresh credit allowance for this recovery; never raises the original lifetime ceiling.")
256
+ .option("--approved-effect-unknown", "After a human verifies every affected destination, explicitly allow re-executing items whose prior external effect could not be confirmed.")
257
+ .option("--json", "Print a JSON envelope.")
258
+ .action(async (runId, options) => {
259
+ if (options.dryRun && (options.approved || options.retryPlanHash || options.maxAdditionalCredits !== undefined || options.approvedEffectUnknown)) {
260
+ throw new OxygenError("invalid_request", "Use --dry-run separately from retry approval flags.", { exitCode: 2 });
261
+ }
262
+ const maxAdditionalCredits = options.maxAdditionalCredits === undefined ? undefined : Number(options.maxAdditionalCredits);
263
+ if (maxAdditionalCredits !== undefined && (!options.maxAdditionalCredits?.trim() || !Number.isFinite(maxAdditionalCredits) || maxAdditionalCredits < 0)) {
264
+ throw new OxygenError("invalid_request", "--max-additional-credits must be a nonnegative number.", { exitCode: 2 });
265
+ }
266
+ await handleAsyncAction("table-runs retry-failed", options, () => options.dryRun
267
+ ? requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/retry-failed`, { method: "GET" })
268
+ : requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/retry-failed`, {
269
+ method: "POST", body: {
270
+ ...(options.approvedEffectUnknown ? { approved_effect_unknown: true } : {}),
271
+ ...(options.approved !== undefined ? { approved: options.approved } : {}),
272
+ ...(options.retryPlanHash !== undefined ? { retry_plan_hash: options.retryPlanHash } : {}),
273
+ ...(maxAdditionalCredits !== undefined ? { max_additional_credits: maxAdditionalCredits } : {}),
274
+ },
275
+ }));
276
+ }));
277
+ }
@@ -0,0 +1,3 @@
1
+ import { ExtractedCommandActionHandler } from "../command-support.js";
2
+ import { Command } from "commander";
3
+ export declare function registerTablesFamily(program: Command, handleAsyncAction: ExtractedCommandActionHandler, binaryName: any): void;