@omni-commerce/cli 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,7 +40,7 @@ Edit campaign promotions and windows with typed flags:
40
40
  ```bash
41
41
  omni campaigns update-offers --campaign-id C --expected-revision 4 --offer-ids OFFER_A,OFFER_B --discount-value 15
42
42
  omni campaigns update-windows --campaign-id C --expected-revision 4 --window-ids WINDOW_A --ends-at 2027-08-04T00:00:00+08:00
43
- omni products list --detail summary --include-summary false
43
+ omni products list --q lamp --detail summary --format json
44
44
  ```
45
45
 
46
46
  Campaign updates preserve omitted fields. Running changes remain proposals until
package/dist/index.js CHANGED
@@ -84,7 +84,7 @@ async function openBrowser(url) {
84
84
  }
85
85
 
86
86
  // src/version.ts
87
- var CLI_VERSION = "0.18.0";
87
+ var CLI_VERSION = "0.20.0";
88
88
 
89
89
  // src/browser-login.ts
90
90
  function loginOrigin(baseUrl) {
@@ -223,10 +223,12 @@ async function clearConfig() {
223
223
  await rm(configPath(), { force: true });
224
224
  }
225
225
  async function resolveCredentials(input2) {
226
- const file = await readConfig();
227
- const apiKey = input2.apiKey || process.env.OMNI_API_KEY || file.apiKey || void 0;
226
+ const explicitKey = input2.apiKey || process.env.OMNI_API_KEY;
227
+ const explicitBaseUrl = input2.baseUrl || process.env.OMNI_BASE_URL;
228
+ const file = explicitKey && explicitBaseUrl ? {} : await readConfig();
229
+ const apiKey = explicitKey || file.apiKey || void 0;
228
230
  const source = input2.apiKey ? "flag" : process.env.OMNI_API_KEY ? "env" : file.apiKey ? "config" : "none";
229
- const baseUrl = input2.baseUrl || process.env.OMNI_BASE_URL || file.baseUrl || "https://omnicommerce.ai";
231
+ const baseUrl = explicitBaseUrl || file.baseUrl || "https://omnicommerce.ai";
230
232
  return { apiKey, baseUrl, source };
231
233
  }
232
234
  function maskSecret(value) {
@@ -439,27 +441,7 @@ var COMMANDS = [
439
441
  httpMethod: "POST",
440
442
  path: "/api/v1/agents/{agentId}/invoke",
441
443
  summary: "Invoke a saved agent",
442
- description: "Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.\n\nRequires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.\n\nSend one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional message IDs follow native LangGraph replacement semantics, not request idempotency; retrying an invocation may run the agent again.\n\nConversations are stored in Omni sessions and checkpoints and isolated by organization, caller, credential, agent and audience. Uploaded HTTP(S) images belong on the latest user message.\n\naudience=customer uses the public storefront tool boundary and accepts user/assistant messages. It does not establish a verified customer identity. audience=member is the default. Saved agents accept user/assistant messages and reject configuration overrides; general/invoke accepts config.\n\nSend decisions instead of messages with the same thread_id and audience to resume approvals. Resolve pending approvals before sending new messages.",
443
- flags: [
444
- {
445
- name: "agentId",
446
- flag: "agent-id",
447
- required: true,
448
- source: "path"
449
- }
450
- ],
451
- acceptsJsonBody: true,
452
- acceptsFile: false,
453
- bodyRequired: true
454
- },
455
- {
456
- trail: ["agents", "messages"],
457
- resourcePath: ["agents"],
458
- methodName: "messages",
459
- httpMethod: "POST",
460
- path: "/api/v1/agents/{agentId}/messages",
461
- summary: "Invoke a saved agent (alias)",
462
- description: "Alias of /agents/{agentId}/invoke with the identical request and response. Prefer /invoke.\n\nInvoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.\n\nRequires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.\n\nSend one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional message IDs follow native LangGraph replacement semantics, not request idempotency; retrying an invocation may run the agent again.\n\nConversations are stored in Omni sessions and checkpoints and isolated by organization, caller, credential, agent and audience. Uploaded HTTP(S) images belong on the latest user message.\n\naudience=customer uses the public storefront tool boundary and accepts user/assistant messages. It does not establish a verified customer identity. audience=member is the default. Saved agents accept user/assistant messages and reject configuration overrides; general/invoke accepts config.\n\nSend decisions instead of messages with the same thread_id and audience to resume approvals. Resolve pending approvals before sending new messages.",
444
+ description: "Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.\n\n### Authorization\n\nRequires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.\n\n### Messages and conversation history\n\nSend one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional message IDs follow native LangGraph replacement semantics, not request idempotency; retrying an invocation may run the agent again.\n\nConversations are stored in Omni sessions and checkpoints and isolated by organization, caller, credential, agent and audience. Uploaded HTTP(S) images belong on the latest user message.\n\naudience=customer uses the public storefront tool boundary and accepts user/assistant messages. It does not establish a verified customer identity. audience=member is the default. Saved agents accept user/assistant messages and reject configuration overrides; general/invoke accepts config.\n\n### Approvals\n\nSend decisions instead of messages with the same thread_id and audience to resume approvals. Resolve pending approvals before sending new messages.",
463
445
  flags: [
464
446
  {
465
447
  name: "agentId",
@@ -479,7 +461,7 @@ var COMMANDS = [
479
461
  httpMethod: "POST",
480
462
  path: "/api/v1/agents/{agentId}/runs",
481
463
  summary: "Start a saved agent run",
482
- description: "Queue durable execution using the identical invocation contract. Poll Location, honoring Retry-After.\n\nInvoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.\n\nRequires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.\n\nSend one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional message IDs follow native LangGraph replacement semantics, not request idempotency; retrying an invocation may run the agent again.\n\nConversations are stored in Omni sessions and checkpoints and isolated by organization, caller, credential, agent and audience. Uploaded HTTP(S) images belong on the latest user message.\n\naudience=customer uses the public storefront tool boundary and accepts user/assistant messages. It does not establish a verified customer identity. audience=member is the default. Saved agents accept user/assistant messages and reject configuration overrides; general/invoke accepts config.\n\nSend decisions instead of messages with the same thread_id and audience to resume approvals. Resolve pending approvals before sending new messages.",
464
+ description: "Queue durable execution using the identical invocation contract. Poll Location, honoring Retry-After.\n\nInvoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.\n\n### Authorization\n\nRequires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.\n\n### Messages and conversation history\n\nSend one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional message IDs follow native LangGraph replacement semantics, not request idempotency; retrying an invocation may run the agent again.\n\nConversations are stored in Omni sessions and checkpoints and isolated by organization, caller, credential, agent and audience. Uploaded HTTP(S) images belong on the latest user message.\n\naudience=customer uses the public storefront tool boundary and accepts user/assistant messages. It does not establish a verified customer identity. audience=member is the default. Saved agents accept user/assistant messages and reject configuration overrides; general/invoke accepts config.\n\n### Approvals\n\nSend decisions instead of messages with the same thread_id and audience to resume approvals. Resolve pending approvals before sending new messages.",
483
465
  flags: [
484
466
  {
485
467
  name: "agentId",
@@ -531,7 +513,7 @@ var COMMANDS = [
531
513
  httpMethod: "POST",
532
514
  path: "/api/v1/agents/general/invoke",
533
515
  summary: "Invoke the Omni agent",
534
- description: 'Run the general Omni agent and wait until it completes, pauses for approval, or fails. Requires `agents:invoke`.\n\nA waiting call can take several minutes; raise the client timeout. Send `decisions` with the same `thread_id` to approve or reject a paused run. Omit `config.enabled_tools` to use the organization\'s agent tools. Send only new messages on each turn; thread_id continues the conversation stored in Omni sessions and checkpoints. Omit thread_id for a new conversation. Optional message IDs use native LangGraph replacement semantics, not run idempotency. audience=customer restricts tools to public storefront access without establishing a verified customer identity. Attach images on the latest user message as `{ type: "image", url }` HTTP(S) URLs.',
516
+ description: 'Run the general Omni agent and wait until it completes, pauses for approval, or fails. Requires `agents:invoke`.\n\n### Waiting and approvals\n\nA waiting call can take several minutes; raise the client timeout. Send `decisions` with the same `thread_id` to approve or reject a paused run.\n\n### Messages and tools\n\nOmit `config.enabled_tools` to use the organization\'s agent tools. Send only new messages on each turn; thread_id continues the conversation stored in Omni sessions and checkpoints. Omit thread_id for a new conversation. Optional message IDs use native LangGraph replacement semantics, not run idempotency. audience=customer restricts tools to public storefront access without establishing a verified customer identity. Attach images on the latest user message as `{ type: "image", url }` HTTP(S) URLs.',
535
517
  flags: [],
536
518
  acceptsJsonBody: true,
537
519
  acceptsFile: false,
@@ -3120,6 +3102,12 @@ var COMMANDS = [
3120
3102
  flag: "offset",
3121
3103
  required: false,
3122
3104
  source: "query"
3105
+ },
3106
+ {
3107
+ name: "includeSummary",
3108
+ flag: "include-summary",
3109
+ required: false,
3110
+ source: "query"
3123
3111
  }
3124
3112
  ],
3125
3113
  acceptsJsonBody: false,
@@ -3133,7 +3121,7 @@ var COMMANDS = [
3133
3121
  httpMethod: "POST",
3134
3122
  path: "/api/v1/orders",
3135
3123
  summary: "Create Order",
3136
- description: "Create a native `agentic` order with line items. This operation uses the same upsert path as agentic checkout completion.\n\n### Authentication\n\nRequires `orders:write`.\n\n### Upsert behavior\n\n- Reusing an `externalOrderId` updates the existing order instead of creating a duplicate.\n- For one-row-per-SKU integrations, use the marketplace order ID as `externalOrderId` and the row ID as `items[].externalOrderItemId`.\n- When `totalAmount` is omitted, OmniCommerce recomputes it from all order lines after the upsert.\n\n### Pricing and catalog defaults\n\n- Each line can provide `price`, `unitPrice`, `paidPrice`, and `costPrice`.\n- When `productId` is provided, missing price or currency values may resolve from the product catalog.\n- An explicit `costPrice` updates `product_data.costPrice` and is snapshotted on the order line. Omitting it never clears an existing product cost.\n\n### Country resolution\n\nWhen `country` is empty, OmniCommerce may derive it from an unambiguous order currency, such as PHP for the Philippines. USD is not used to infer a country.",
3124
+ description: "Create a native `agentic` order with line items. This operation uses the same upsert path as agentic checkout completion.\n\n### Authentication\n\nRequires `orders:write`.\n\n### Upsert behavior\n\n- Reusing an `externalOrderId` updates the existing order instead of creating a duplicate.\n- For one-row-per-SKU integrations, use the marketplace order ID as `externalOrderId` and the row ID as `items[].externalOrderItemId`.\n- When `totalAmount` is omitted, OmniCommerce recomputes it from all order lines after the upsert.\n\n### Pricing and catalog defaults\n\n- Each line can provide `unitPrice`, `paidPrice`, and `costPrice`.\n- When `productId` is provided, missing price or currency values may resolve from the product catalog.\n- An explicit `costPrice` updates `product_data.costPrice` and is snapshotted on the order line. Omitting it never clears an existing product cost.\n\n### Country resolution\n\nWhen `country` is empty, OmniCommerce may derive it from an unambiguous order currency, such as PHP for the Philippines. USD is not used to infer a country.",
3137
3125
  flags: [],
3138
3126
  acceptsJsonBody: true,
3139
3127
  acceptsFile: false,
@@ -3505,7 +3493,7 @@ var COMMANDS = [
3505
3493
  httpMethod: "GET",
3506
3494
  path: "/api/v1/products",
3507
3495
  summary: "List Products",
3508
- description: "List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.\n\n### Stock and variants\n\nRows are in `items`. Read catalog stock from `items[].stockQuantity`: parent rows already aggregate their non-deleted variants, and virtual bundles use component availability with any manual cap. Null means unknown, not zero. A row with `variantCount` above 0 has variants; fetch them from `GET /api/v1/products/{productId}`. List rows do not contain `inventoryQuantity`, `inventory.quantity`, or an embedded `variants` array.\n\n### Duplicate discovery and merge\n\nUse status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root row includes duplicateMatches with peer productIds, names, SKUs and match reasons. Follow pagination; detail=summary omits this evidence. Start or refresh the saved scan with products.scanDuplicates and inspect products.getDuplicateScan. Combine each root ID with its exact_sku peer IDs, deduplicate, then call products.previewDuplicateMerge with 2\u201320 productIds. Inspect every group's masterSelections: a sole allowed product must stay master; multiple allowed products leave the content/price/stock choice to the seller. Preview again with masterProductIds, review all listings, then call products.mergeDuplicates with the reviewed expectedGroups. Content similarity alone is not permission to merge. See /guides/merge-marketplace-listings for CLI and SDK examples.",
3496
+ description: "List products for the authenticated organization with optional filters and pagination. Requires `catalog:read`. The organization comes from the API key or OAuth bearer token.\n\n### Stock and variants\n\nRows are in `items`. Read catalog stock from `items[].stockQuantity`: parent rows already aggregate their non-deleted variants, and virtual bundles use component availability with any manual cap. Null means unknown, not zero. A row with `variantCount` above 0 has variants; fetch them from `GET /api/v1/products/{productId}`. List rows do not contain `inventoryQuantity`, `inventory.quantity`, or an embedded `variants` array.\n\n### Duplicate discovery and merge\n\nUse status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root row includes duplicateMatches with peer productIds, names, SKUs and match reasons. Follow pagination; detail=summary omits this evidence. Start or refresh the saved scan with products.scanDuplicates and inspect products.getDuplicateScan. Combine each root ID with its exact_sku peer IDs, deduplicate, then call products.previewDuplicateMerge with 2\u201320 productIds. Inspect every group's masterSelections: a sole allowed product must stay master; multiple allowed products leave the content/price/stock choice to the seller. Preview again with masterProductIds, review all listings, then call products.mergeDuplicates with the reviewed expectedGroups. Content similarity alone is not permission to merge. See /guides/merge-marketplace-listings for CLI and SDK examples.",
3509
3497
  flags: [
3510
3498
  {
3511
3499
  name: "status",
@@ -3555,12 +3543,6 @@ var COMMANDS = [
3555
3543
  required: false,
3556
3544
  source: "query"
3557
3545
  },
3558
- {
3559
- name: "limit",
3560
- flag: "limit",
3561
- required: false,
3562
- source: "query"
3563
- },
3564
3546
  {
3565
3547
  name: "offset",
3566
3548
  flag: "offset",
@@ -3888,7 +3870,7 @@ var COMMANDS = [
3888
3870
  httpMethod: "POST",
3889
3871
  path: "/api/v1/products/bulk-import",
3890
3872
  summary: "Bulk Import Products from JSON or CSV",
3891
- description: "Queue a bulk product import for the authenticated organization.\n\n### Destinations\n\nSupply targetMarketplaces and marketplaceStoreSelections to prepare for specific connected stores. Set deferStoreSelection=true to choose marketplaces only and assign stores later with POST /api/v1/products/marketplace-stores. Omit marketplaceStoreSelections and leave workflow.publish off when deferring. Automatic publishing requires catalog:sync in addition to catalog:write.\n\nSupply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Enrichment never infers SKU options. At Zalora publish time, a missing required Size defaults to One Size only when valid for the selected category and supplied size system. Supplied sizes are preserved; missing or incompatible size systems and other required options block publishing. Each row remains a standalone product; no child variants are created for the default.\n\n### Input options\n\n- Upload a CSV (2 MiB) or JSON products file (8 MiB) using `multipart/form-data`.\n- Send JSON with a `products` array of 1\u20135,000 flat product objects (8 MiB request maximum).\n- Send JSON with inline `csvText`.\n- Send JSON referencing a stored `documentId`.\n\n### Asynchronous result\n\nThe API creates import rows, then queues draft creation and AI Review through Inngest. Completed import jobs expose `reviewBatchIds`, `reviewUrls`, and `reviewWarnings`. Set workflow.autoApplyHighConfidence=true with independent workflow.enrichmentAutoApplyThreshold and workflow.taxonomyAutoApplyThreshold (0.62\u20131) to apply qualifying proposals; image changes still require visual approval. autoApproveThreshold is a separate import-row setting, not a Review threshold. Set workflow.publish=true to queue publication to saved stores after every required scope for a product is approved and applied. Both automatic and manual approval resume publishing. Pending, rejected, failed and cancelled scopes block that product while eligible products continue. Poll GET /api/v1/jobs/{jobId}; publishing includes ordered per-product/store receipts and verified publish-job status. Import completed does not mean published.\n\nCancel an in-flight import with `POST /api/v1/jobs/{jobId}/cancel`.",
3873
+ description: "Queue a bulk product import for the authenticated organization.\n\n### Destinations\n\nSupply targetMarketplaces and marketplaceStoreSelections to prepare for specific connected stores. Set deferStoreSelection=true to choose marketplaces only and assign stores later with POST /api/v1/products/marketplace-stores. Omit marketplaceStoreSelections and leave workflow.publish off when deferring. Automatic publishing requires catalog:sync in addition to catalog:write.\n\nSupply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Taxonomy enrichment can propose missing required sale attributes in its existing attribute request when supported by product evidence. Supplied values take precedence. At Zalora publish time, a missing required Size defaults to One Size only when valid for the selected category and supplied size system. Missing or incompatible size systems and other required options block publishing. Each row remains a standalone product.\n\n### Input options\n\n- Upload a CSV (2 MiB) or JSON products file (8 MiB) using `multipart/form-data`.\n- Send JSON with a `products` array of 1\u20135,000 flat product objects (8 MiB request maximum).\n- Send JSON with inline `csvText`.\n- Send JSON referencing a stored `documentId`.\n\n### Asynchronous result\n\nThe API creates import rows, then queues draft creation and AI Review through Inngest. Completed import jobs expose `reviewBatchIds`, `reviewUrls`, and `reviewWarnings`. Set workflow.autoApplyHighConfidence=true with independent workflow.enrichmentAutoApplyThreshold and workflow.taxonomyAutoApplyThreshold (0.62\u20131) to apply qualifying proposals; image changes still require visual approval. autoApproveThreshold is a separate import-row setting, not a Review threshold. Set workflow.publish=true to queue publication to saved stores after every required scope for a product is approved and applied. Both automatic and manual approval resume publishing. Pending, rejected, failed and cancelled scopes block that product while eligible products continue. Poll GET /api/v1/jobs/{jobId}; publishing includes ordered per-product/store receipts and verified publish-job status. Import completed does not mean published.\n\nCancel an in-flight import with `POST /api/v1/jobs/{jobId}/cancel`.",
3892
3874
  flags: [],
3893
3875
  acceptsJsonBody: true,
3894
3876
  acceptsFile: true,
@@ -7260,7 +7242,7 @@ Global flags:
7260
7242
  --help Show help
7261
7243
 
7262
7244
  Examples:
7263
- omni products list --q lamp
7245
+ omni products list --q lamp --detail summary
7264
7246
  omni products get --product-id prod_123
7265
7247
  omni products create --json '{"product":{"sku":"SKU-1","title":"Lamp"}}'
7266
7248
  omni jobs wait --job-id prod_123
@@ -7443,6 +7425,12 @@ ${unique.map((line) => ` omni ${line}`).join("\n")}
7443
7425
  `);
7444
7426
  return 0;
7445
7427
  }
7428
+ if (command2.httpMethod === "GET" && command2.path === "/api/v1/products" && Object.hasOwn(parsed.flags, "limit")) {
7429
+ process.stderr.write(
7430
+ "products list no longer accepts --limit. Follow pagination.nextCursor or pagination.nextOffset.\n"
7431
+ );
7432
+ return 1;
7433
+ }
7446
7434
  const body = await parseJsonBody(flagString(parsed.flags, "json"));
7447
7435
  const filePath = command2.acceptsFile ? flagString(parsed.flags, "file") : void 0;
7448
7436
  if (command2.acceptsFile && !command2.fileOptional && !filePath) {
@@ -7484,7 +7472,7 @@ ${unique.map((line) => ` omni ${line}`).join("\n")}
7484
7472
  return 1;
7485
7473
  }
7486
7474
  const timeoutRaw = flagString(parsed.flags, "timeout");
7487
- const timeoutInSeconds = timeoutRaw ? Number(timeoutRaw) : command2.path.startsWith("/api/v1/agents/") && (command2.path.endsWith("/invoke") || command2.path.endsWith("/messages")) ? 780 : void 0;
7475
+ const timeoutInSeconds = timeoutRaw ? Number(timeoutRaw) : command2.path.startsWith("/api/v1/agents/") && command2.path.endsWith("/invoke") ? 780 : void 0;
7488
7476
  const client = new OmniClient({
7489
7477
  apiKey: credentials.apiKey,
7490
7478
  baseUrl: credentials.baseUrl,