@omni-commerce/cli 0.17.0 → 0.19.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
@@ -1,5 +1,7 @@
1
1
  # @omni-commerce/cli
2
2
 
3
+ CLI 0.18.0 adds `omni email list-accounts`, `search`, `get-message` and `create-draft` for your own connected mailbox. Run `omni auth login` again to receive the `email:read` and `email:write` scopes; nothing is sent.
4
+
3
5
  CLI 0.17.0 exposes normalized order attribution through `omni orders list`, `omni orders get`, and `omni analytics get-orders`. Use `--from`, `--to`, `--store`, `--currency`, `--time-zone`, and `--format json` for scoped channel/creator reports.
4
6
 
5
7
  CLI 0.16.0 supports marketplace-only bulk import and enrichment, including CSV uploads. Use `omni products assign-marketplace-stores` to save stores before publishing.
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.17.0";
87
+ var CLI_VERSION = "0.19.0";
88
88
 
89
89
  // src/browser-login.ts
90
90
  function loginOrigin(baseUrl) {
@@ -433,13 +433,33 @@ var COMMANDS = [
433
433
  bodyRequired: true
434
434
  },
435
435
  {
436
- trail: ["agents", "messages"],
436
+ trail: ["agents", "invoke"],
437
437
  resourcePath: ["agents"],
438
- methodName: "messages",
438
+ methodName: "invoke",
439
439
  httpMethod: "POST",
440
- path: "/api/v1/agents/{agentId}/messages",
441
- summary: "Send a message to an agent",
442
- description: "Message the exact built-in or custom agent in the URL, using its saved model, instructions, tools, permissions and Programmatic starting mode.\n\n### Authentication\nRequires an API key with `agents:invoke`, or a sign-in session. Organization-owned keys use their recorded creator's current membership and agent access; keys without a valid owner are refused. API keys identify their organization; session requests include `organizationId`.\n\n### Conversation and execution\n- The same caller, agent and `clientThreadKey` continue one conversation. Different callers, agents and organizations are isolated.\n- No model, prompt or tool overrides are accepted.\n- `wait=false` queues durable work and returns 202; `wait=true` returns the final reply or pending approvals.\n- Send `decisions` with the same `clientThreadKey` to approve or reject a paused run.",
440
+ path: "/api/v1/agents/{agentId}/invoke",
441
+ 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\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.",
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", "runs"],
457
+ resourcePath: ["agents"],
458
+ methodName: "runs",
459
+ httpMethod: "POST",
460
+ path: "/api/v1/agents/{agentId}/runs",
461
+ summary: "Start a saved agent run",
462
+ 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.",
443
463
  flags: [
444
464
  {
445
465
  name: "agentId",
@@ -458,8 +478,8 @@ var COMMANDS = [
458
478
  methodName: "getRuns",
459
479
  httpMethod: "GET",
460
480
  path: "/api/v1/agents/{agentId}/runs/{runId}",
461
- summary: "Get an agent message run",
462
- description: "Read an agent message run belonging to the authenticated caller and the exact agent in the URL. Current organization membership and agent sharing are checked again. Requires agents:invoke.",
481
+ summary: "Get a saved agent run",
482
+ description: "Read the canonical run resource. Organization, caller, credential and exact agent access are checked again. Requires agents:invoke.",
463
483
  flags: [
464
484
  {
465
485
  name: "agentId",
@@ -491,7 +511,7 @@ var COMMANDS = [
491
511
  httpMethod: "POST",
492
512
  path: "/api/v1/agents/general/invoke",
493
513
  summary: "Invoke the Omni agent",
494
- 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. Attach images on the latest user message as `{ type: "image", url }` HTTP(S) URLs.',
514
+ 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.',
495
515
  flags: [],
496
516
  acceptsJsonBody: true,
497
517
  acceptsFile: false,
@@ -2297,6 +2317,121 @@ var COMMANDS = [
2297
2317
  acceptsFile: false,
2298
2318
  bodyRequired: false
2299
2319
  },
2320
+ {
2321
+ trail: ["email", "list-accounts"],
2322
+ resourcePath: ["email"],
2323
+ methodName: "listAccounts",
2324
+ httpMethod: "GET",
2325
+ path: "/api/v1/email/accounts",
2326
+ summary: "List Email Accounts",
2327
+ description: "Your connected Gmail and Outlook accounts, default first. Pass an account's `connectionId` to the other email endpoints to choose it.\n\n### Authorization\n\nRequires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.",
2328
+ flags: [
2329
+ {
2330
+ name: "organizationId",
2331
+ flag: "organization-id",
2332
+ required: false,
2333
+ source: "query"
2334
+ }
2335
+ ],
2336
+ acceptsJsonBody: false,
2337
+ acceptsFile: false,
2338
+ bodyRequired: false
2339
+ },
2340
+ {
2341
+ trail: ["email", "create-draft"],
2342
+ resourcePath: ["email"],
2343
+ methodName: "createDraft",
2344
+ httpMethod: "POST",
2345
+ path: "/api/v1/email/drafts",
2346
+ summary: "Create Email Draft",
2347
+ description: "Save a draft in your mailbox; nothing is sent. Pass `replyToMessageId` (and `threadId`) from Search Emails to draft a reply in its conversation. Review and send it from Gmail or Outlook.\n\nWhen the provider saved a draft whose threading could not be verified, the request fails with `unverifiedDraftId` in `data` so you can find or discard it.\n\n### Authorization\n\nRequires `email:write` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.",
2348
+ flags: [],
2349
+ acceptsJsonBody: true,
2350
+ acceptsFile: false,
2351
+ bodyRequired: true
2352
+ },
2353
+ {
2354
+ trail: ["email", "get-message"],
2355
+ resourcePath: ["email"],
2356
+ methodName: "getMessage",
2357
+ httpMethod: "GET",
2358
+ path: "/api/v1/email/messages/{messageId}",
2359
+ summary: "Get Email Message",
2360
+ description: "One message from your mailbox: headers, plain-text body (at most 12,000 characters) and attachment metadata. Use a message `id` from Search Emails; encode it as one path segment.\n\n### Authorization\n\nRequires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.",
2361
+ flags: [
2362
+ {
2363
+ name: "messageId",
2364
+ flag: "message-id",
2365
+ required: true,
2366
+ source: "path"
2367
+ },
2368
+ {
2369
+ name: "connectionId",
2370
+ flag: "connection-id",
2371
+ required: false,
2372
+ source: "query"
2373
+ },
2374
+ {
2375
+ name: "organizationId",
2376
+ flag: "organization-id",
2377
+ required: false,
2378
+ source: "query"
2379
+ }
2380
+ ],
2381
+ acceptsJsonBody: false,
2382
+ acceptsFile: false,
2383
+ bodyRequired: false
2384
+ },
2385
+ {
2386
+ trail: ["email", "search"],
2387
+ resourcePath: ["email"],
2388
+ methodName: "search",
2389
+ httpMethod: "GET",
2390
+ path: "/api/v1/email/search",
2391
+ summary: "Search Emails",
2392
+ description: "One page of message summaries (subject, from, to, date, snippet, read and draft state) from your mailbox. Gmail accepts its search operators (`from:`, `subject:`, `newer_than:`); Outlook takes free text.\n\nPass `nextPageToken` back as `pageToken` with the same mailbox, query, `readState` and `maxResults` until it is null; a token is refused with different search arguments. `readState=unread` filters unread messages, which is not the same as unreplied.\n\n### Authorization\n\nRequires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.",
2393
+ flags: [
2394
+ {
2395
+ name: "query",
2396
+ flag: "query",
2397
+ required: false,
2398
+ source: "query"
2399
+ },
2400
+ {
2401
+ name: "connectionId",
2402
+ flag: "connection-id",
2403
+ required: false,
2404
+ source: "query"
2405
+ },
2406
+ {
2407
+ name: "maxResults",
2408
+ flag: "max-results",
2409
+ required: false,
2410
+ source: "query"
2411
+ },
2412
+ {
2413
+ name: "pageToken",
2414
+ flag: "page-token",
2415
+ required: false,
2416
+ source: "query"
2417
+ },
2418
+ {
2419
+ name: "readState",
2420
+ flag: "read-state",
2421
+ required: false,
2422
+ source: "query"
2423
+ },
2424
+ {
2425
+ name: "organizationId",
2426
+ flag: "organization-id",
2427
+ required: false,
2428
+ source: "query"
2429
+ }
2430
+ ],
2431
+ acceptsJsonBody: false,
2432
+ acceptsFile: false,
2433
+ bodyRequired: false
2434
+ },
2300
2435
  {
2301
2436
  trail: ["evaluate", "run"],
2302
2437
  resourcePath: ["evaluate"],
@@ -2965,6 +3100,12 @@ var COMMANDS = [
2965
3100
  flag: "offset",
2966
3101
  required: false,
2967
3102
  source: "query"
3103
+ },
3104
+ {
3105
+ name: "includeSummary",
3106
+ flag: "include-summary",
3107
+ required: false,
3108
+ source: "query"
2968
3109
  }
2969
3110
  ],
2970
3111
  acceptsJsonBody: false,
@@ -2978,7 +3119,7 @@ var COMMANDS = [
2978
3119
  httpMethod: "POST",
2979
3120
  path: "/api/v1/orders",
2980
3121
  summary: "Create Order",
2981
- 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.",
3122
+ 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.",
2982
3123
  flags: [],
2983
3124
  acceptsJsonBody: true,
2984
3125
  acceptsFile: false,
@@ -3733,7 +3874,7 @@ var COMMANDS = [
3733
3874
  httpMethod: "POST",
3734
3875
  path: "/api/v1/products/bulk-import",
3735
3876
  summary: "Bulk Import Products from JSON or CSV",
3736
- 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`.",
3877
+ 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`.",
3737
3878
  flags: [],
3738
3879
  acceptsJsonBody: true,
3739
3880
  acceptsFile: true,
@@ -6488,6 +6629,12 @@ var CAMPAIGN_INPUTS = {
6488
6629
  type: "string",
6489
6630
  enum: ["general", "shop_follow"]
6490
6631
  },
6632
+ redemptionPoints: {
6633
+ description: "Membership points required per voucher redemption. Required for shopee_redemption and lazada_points_redeemable; unavailable for other voucher types.",
6634
+ type: "integer",
6635
+ exclusiveMinimum: 0,
6636
+ maximum: 9007199254740991
6637
+ },
6491
6638
  repeatPurchaseMinCount: {
6492
6639
  description: "Shopee Repeat Buyer: minimum completed shop orders, 1 or 2. Required for shopee_repeat_buyer.",
6493
6640
  type: "integer",
@@ -7323,7 +7470,7 @@ ${unique.map((line) => ` omni ${line}`).join("\n")}
7323
7470
  return 1;
7324
7471
  }
7325
7472
  const timeoutRaw = flagString(parsed.flags, "timeout");
7326
- const timeoutInSeconds = timeoutRaw ? Number(timeoutRaw) : command2.path === "/api/v1/agents/general/invoke" ? 780 : void 0;
7473
+ const timeoutInSeconds = timeoutRaw ? Number(timeoutRaw) : command2.path.startsWith("/api/v1/agents/") && command2.path.endsWith("/invoke") ? 780 : void 0;
7327
7474
  const client = new OmniClient({
7328
7475
  apiKey: credentials.apiKey,
7329
7476
  baseUrl: credentials.baseUrl,