@agentforge-io/sdk-server 4.70.0 → 4.71.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/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { BillingResource } from './resources/billing';
6
6
  export type { BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
7
7
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
8
8
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
9
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
9
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, OpenOrderLine, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentFieldDue, PaymentRequirements, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
10
10
  export { AgentsResource } from './resources/agents';
11
11
  export { AnalyticsResource } from './resources/analytics';
12
12
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput } from '../types';
2
+ import type { CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput } from '../types';
3
3
  export declare class CasesResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -135,8 +135,12 @@ export declare class CasesResource {
135
135
  * assistant cannot answer). Created already sent: units held, receipt issued,
136
136
  * `case.submitted` fired — the business sees it in its requests like any other.
137
137
  * 400 for a bad order or missing fields, 409 when a product lacks stock.
138
+ *
139
+ * PDK-ORDER-INVITE — with `CreateOpenOrderInput` (`origin: { channel: 'link', place: 'open-order' }` +
140
+ * `freeLines` + `totalCents` + `state: 'confirmed'`) it creates an open order instead: free-text lines,
141
+ * the typed total, born `confirmed`, no stock holds.
138
142
  */
139
- createDirect(input: CreateDirectOrderInput): Promise<CaseView>;
143
+ createDirect(input: CreateDirectOrderInput | CreateOpenOrderInput): Promise<CaseView>;
140
144
  /**
141
145
  * `POST /api/v1/cases/bookings` — AGF-AGENDA: a booking from your App's agenda
142
146
  * (hold the time in your own ledger first). Created sent (`submitted`), or
@@ -194,6 +194,10 @@ class CasesResource {
194
194
  * assistant cannot answer). Created already sent: units held, receipt issued,
195
195
  * `case.submitted` fired — the business sees it in its requests like any other.
196
196
  * 400 for a bad order or missing fields, 409 when a product lacks stock.
197
+ *
198
+ * PDK-ORDER-INVITE — with `CreateOpenOrderInput` (`origin: { channel: 'link', place: 'open-order' }` +
199
+ * `freeLines` + `totalCents` + `state: 'confirmed'`) it creates an open order instead: free-text lines,
200
+ * the typed total, born `confirmed`, no stock holds.
197
201
  */
198
202
  async createDirect(input) {
199
203
  return this.client.request('POST', '/api/v1/cases/direct', input);
package/dist/types.d.ts CHANGED
@@ -2102,12 +2102,21 @@ export interface DeliverySettings {
2102
2102
  export type PaymentMethodKind = 'cash' | 'bank_transfer' | 'card_on_delivery' | 'payment_link' | 'card_in_store' | 'other';
2103
2103
  /** AGF-PAYMENT-ACCOUNTS — countries with a payment catalog. */
2104
2104
  export type PaymentCountry = 'CO';
2105
+ /**
2106
+ * PDK-ORDER-PARTICIPANTS D8 — when a field is due (progressive requirements). `save`: the account cannot be
2107
+ * saved without it; `offer`: saved, but not offered to customers until present; `eventually`: saved and offered,
2108
+ * shown to the business as a pending item. Absent: optional.
2109
+ */
2110
+ export type PaymentFieldDue = 'save' | 'offer' | 'eventually';
2105
2111
  /** A field an account of a method asks for. */
2106
2112
  export interface PaymentFieldDef {
2107
2113
  key: string;
2108
2114
  label: string;
2109
2115
  kind: 'text' | 'phone' | 'digits' | 'select' | 'bank';
2116
+ /** Derived from `due` (`due === 'save'`), kept for older clients. */
2110
2117
  required: boolean;
2118
+ /** When the field is due. Absent on an older platform: read `required`. */
2119
+ due?: PaymentFieldDue;
2111
2120
  /** `select` / `bank`: the options. */
2112
2121
  options?: Array<{
2113
2122
  value: string;
@@ -2143,6 +2152,13 @@ export interface PaymentAccount {
2143
2152
  when: 'before' | 'on_delivery';
2144
2153
  /** Paused without deleting. */
2145
2154
  active: boolean;
2155
+ /** PDK-ORDER-PARTICIPANTS D8 — what the account still lacks (field keys); read-only, set by the platform on read. */
2156
+ requirements?: PaymentRequirements;
2157
+ }
2158
+ /** Field keys an account still lacks. `currentlyDue` non-empty: the account is not offered to customers. */
2159
+ export interface PaymentRequirements {
2160
+ currentlyDue: string[];
2161
+ eventuallyDue: string[];
2146
2162
  }
2147
2163
  export interface PaymentSettings {
2148
2164
  locale?: 'es' | 'en';
@@ -2445,6 +2461,12 @@ export interface CasePaymentAccount {
2445
2461
  when: 'before' | 'on_delivery';
2446
2462
  /** "Nequi (Principal): 3001234567 a nombre de Ana Pérez". */
2447
2463
  line: string;
2464
+ /**
2465
+ * PDK-ORDER-PARTICIPANTS-S3b — `line` with the holder unmasked. Business reads only (cases API, never the
2466
+ * public receipt); present only when it differs from `line` (wallets / Bre-B with a titular). Prefer
2467
+ * `ownerLine ?? line` in the business's views.
2468
+ */
2469
+ ownerLine?: string;
2448
2470
  /** What to copy to pay (empty for cash / card terminal). */
2449
2471
  copy: Array<{
2450
2472
  label: string;
@@ -2551,6 +2573,11 @@ export interface CaseReceiptLine {
2551
2573
  coverUrl?: string;
2552
2574
  /** AGF-PRODUCT-SKU — the product's inventory code as it is now (absent: none, or an older platform). */
2553
2575
  sku?: string;
2576
+ /** PDK-ORDER-INVITE — open-order lines (free text: no `productId`, `unitCents` null, `priceKind` `on_request`).
2577
+ * `out`: not delivered («Agotado»), show it struck; `swapText`: delivered as this instead; `note`: the customer's note. */
2578
+ out?: true;
2579
+ swapText?: string;
2580
+ note?: string;
2554
2581
  }
2555
2582
  /** One option group's choice on a proposed alternative: the group and what was picked in it (ids, or names). */
2556
2583
  export interface CaseProposalSwapOption {
@@ -2649,6 +2676,8 @@ export interface CaseReceipt {
2649
2676
  distanceKm?: number;
2650
2677
  };
2651
2678
  totalCents: number | null;
2679
+ /** PDK-ORDER-INVITE — `totalCents` is the amount typed at dispatch (an open order), not Σ of the lines; final, delivery included. */
2680
+ totalManual?: true;
2652
2681
  currency: string | null;
2653
2682
  fields: Array<{
2654
2683
  label: string;
@@ -2770,6 +2799,67 @@ export interface CreateDirectOrderInput {
2770
2799
  */
2771
2800
  reopens?: string;
2772
2801
  }
2802
+ /** PDK-ORDER-INVITE — one free-text line of an open order (no catalog product, no unit price). */
2803
+ export interface OpenOrderLine {
2804
+ title: string;
2805
+ qty: number;
2806
+ unit?: string;
2807
+ note?: string;
2808
+ /** What dispatch decided: `ready` (delivered), `out` («Agotado»: not delivered), `swap` (delivered as `swapText`). */
2809
+ mark: 'ready' | 'out' | 'swap';
2810
+ /** Required with `mark: 'swap'`, refused otherwise. */
2811
+ swapText?: string;
2812
+ }
2813
+ /**
2814
+ * PDK-ORDER-INVITE — an OPEN ORDER: a free-form order a shopkeeper already dispatched (no catalog, no
2815
+ * unit prices), created in a business's tenant once it exists. Same endpoint as `CreateDirectOrderInput`;
2816
+ * the explicit opt-in is `origin = { channel: 'link', place: 'open-order' }` together with `freeLines`
2817
+ * (either one alone → 400). The case is born `confirmed` (dispatch made it final): no holds, no proposals,
2818
+ * no redo. The receipt shows `totalCents` exactly (`totalManual`), `out` lines struck, swaps as dispatched.
2819
+ * Name/phone are optional; `customerContact` is another name for `customer` (`customer.ref` defaults to a
2820
+ * key-derived value). `payment` here is a method snapshot, not a catalog account.
2821
+ */
2822
+ export interface CreateOpenOrderInput {
2823
+ origin: {
2824
+ channel: 'link';
2825
+ place: 'open-order' | {
2826
+ ref: 'open-order';
2827
+ label: string;
2828
+ };
2829
+ };
2830
+ freeLines: OpenOrderLine[];
2831
+ /** The total the business typed at dispatch, in cents (> 0). The receipt and the case read exactly this. */
2832
+ totalCents: number;
2833
+ /** ISO code, default `COP`. */
2834
+ currency?: string;
2835
+ state: 'confirmed';
2836
+ /** How the customer said they pay (a method of the platform's country catalog: `nequi`, `daviplata`, `efectivo`…) and where to. */
2837
+ payment?: {
2838
+ method: string;
2839
+ payTo?: string;
2840
+ label?: string;
2841
+ };
2842
+ customer?: {
2843
+ ref?: string;
2844
+ name?: string;
2845
+ phone?: string;
2846
+ };
2847
+ customerContact?: {
2848
+ name?: string;
2849
+ phone?: string;
2850
+ };
2851
+ /** Delivery address (domicilio). Absent: pickup. The quote, if any, is NOT added to `totalCents`. */
2852
+ destination?: CaseDestination;
2853
+ /** The order type's other fields (entrega, notas…), by key. `entrega` defaults from `destination`. */
2854
+ fields?: Record<string, unknown>;
2855
+ type?: string;
2856
+ conversationId?: string;
2857
+ /** Same key → same order. 8–80 of [A-Za-z0-9_.:-]. */
2858
+ idempotencyKey: string;
2859
+ lines?: never;
2860
+ reopens?: never;
2861
+ place?: never;
2862
+ }
2773
2863
  /** A payment method a checkout offers (no account data — that is on the receipt once the order is sent). */
2774
2864
  export interface DirectPaymentOption {
2775
2865
  accountId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.70.0",
3
+ "version": "4.71.0",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",