@agentforge-io/sdk-server 4.30.0 → 4.31.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
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
5
5
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
6
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, SearchPlacesInput, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, 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, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, 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';
6
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, SearchPlacesInput, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, 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, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, 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';
7
7
  export { AgentsResource } from './resources/agents';
8
8
  export { AnalyticsResource } from './resources/analytics';
9
9
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, ListCasesInput } from '../types';
2
+ import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectOrderInput, DirectOrderForm, ListCasesInput } from '../types';
3
3
  export declare class CasesResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -27,6 +27,21 @@ export declare class CasesResource {
27
27
  * it was accepted or once closed. Returns the receipt as it is now.
28
28
  */
29
29
  receiptReceived(token: string): Promise<CaseReceipt>;
30
+ /**
31
+ * `GET /api/v1/cases/direct/form` — what a checkout asks besides the cart, the name
32
+ * and the phone: the order type and its other fields (chips for a closed choice).
33
+ */
34
+ directForm(opts?: {
35
+ type?: string;
36
+ }): Promise<DirectOrderForm>;
37
+ /**
38
+ * `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
39
+ * assistant (the business's chat is off, or the customer chose the checkout, or the
40
+ * assistant cannot answer). Created already sent: units held, receipt issued,
41
+ * `case.submitted` fired — the business sees it in its requests like any other.
42
+ * 400 for a bad order or missing fields, 409 when a product lacks stock.
43
+ */
44
+ createDirect(input: CreateDirectOrderInput): Promise<CaseView>;
30
45
  /**
31
46
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
32
47
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
@@ -56,6 +56,23 @@ class CasesResource {
56
56
  async receiptReceived(token) {
57
57
  return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/received`, {});
58
58
  }
59
+ /**
60
+ * `GET /api/v1/cases/direct/form` — what a checkout asks besides the cart, the name
61
+ * and the phone: the order type and its other fields (chips for a closed choice).
62
+ */
63
+ async directForm(opts = {}) {
64
+ return this.client.request('GET', `/api/v1/cases/direct/form${opts.type ? `?type=${encodeURIComponent(opts.type)}` : ''}`);
65
+ }
66
+ /**
67
+ * `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
68
+ * assistant (the business's chat is off, or the customer chose the checkout, or the
69
+ * assistant cannot answer). Created already sent: units held, receipt issued,
70
+ * `case.submitted` fired — the business sees it in its requests like any other.
71
+ * 400 for a bad order or missing fields, 409 when a product lacks stock.
72
+ */
73
+ async createDirect(input) {
74
+ return this.client.request('POST', '/api/v1/cases/direct', input);
75
+ }
59
76
  /**
60
77
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
61
78
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
@@ -107,6 +107,16 @@ export declare class ChatResource {
107
107
  * }
108
108
  */
109
109
  streamMessage(input: StreamMessageInput): AsyncGenerator<ChatStreamEvent>;
110
+ /**
111
+ * `GET /api/v1/assistant/status` — AGF-ORDER-WITHOUT-AI: can the workspace's
112
+ * assistant answer now? `available: false, reason: 'plan_exceeded'` when its plan
113
+ * quota is used up (the chat would answer 402): a host App takes orders without
114
+ * the chat instead. Unknown reads as available.
115
+ */
116
+ assistantStatus(): Promise<{
117
+ available: boolean;
118
+ reason?: 'plan_exceeded';
119
+ }>;
110
120
  /**
111
121
  * Historial completo de una conversación — `GET
112
122
  * /api/v1/chat/conversations/:id/messages`. Útil para "resumir" un chat
@@ -101,6 +101,15 @@ class ChatResource {
101
101
  reader.releaseLock();
102
102
  }
103
103
  }
104
+ /**
105
+ * `GET /api/v1/assistant/status` — AGF-ORDER-WITHOUT-AI: can the workspace's
106
+ * assistant answer now? `available: false, reason: 'plan_exceeded'` when its plan
107
+ * quota is used up (the chat would answer 402): a host App takes orders without
108
+ * the chat instead. Unknown reads as available.
109
+ */
110
+ async assistantStatus() {
111
+ return this.client.request('GET', '/api/v1/assistant/status');
112
+ }
104
113
  /**
105
114
  * Historial completo de una conversación — `GET
106
115
  * /api/v1/chat/conversations/:id/messages`. Útil para "resumir" un chat
package/dist/types.d.ts CHANGED
@@ -1499,6 +1499,8 @@ export interface PaymentMethodDef {
1499
1499
  fields: PaymentFieldDef[];
1500
1500
  /** One per business (cash): no name to tell accounts apart, a second one is refused. */
1501
1501
  single?: boolean;
1502
+ /** The country's most used methods (CO: Efectivo, Nequi, Daviplata, Bre-B): editors show them first. */
1503
+ popular?: boolean;
1502
1504
  }
1503
1505
  /** One way to pay into the business, with the data a customer needs. Several per method allowed. */
1504
1506
  export interface PaymentAccount {
@@ -1664,8 +1666,10 @@ export interface CaseView {
1664
1666
  }>;
1665
1667
  /** The inbox thread that carries the conversation (open the chat with it), when there is one. */
1666
1668
  threadId: string | null;
1667
- /** The customer's name on that thread, when known. */
1669
+ /** The customer's name on that thread, or the one given at checkout (an order without the chat). */
1668
1670
  customerName: string | null;
1671
+ /** AGF-ORDER-WITHOUT-AI — the phone given at checkout (orders placed without the chat). */
1672
+ customerPhone: string | null;
1669
1673
  /** The road the business walks it: sent, accepted, the type's own phases, completed. */
1670
1674
  path: Array<{
1671
1675
  key: string;
@@ -1827,6 +1831,46 @@ export interface CaseReceipt {
1827
1831
  timeZone: string | null;
1828
1832
  };
1829
1833
  }
1834
+ /**
1835
+ * AGF-ORDER-WITHOUT-AI — an order placed without the assistant: a cart and a
1836
+ * checkout on the host App. Created already sent (holds, receipt, `case.submitted`).
1837
+ */
1838
+ export interface CreateDirectOrderInput {
1839
+ /** Who orders: the App's visitor id, and the name and phone they gave (both required). */
1840
+ customer: {
1841
+ ref: string;
1842
+ name: string;
1843
+ phone: string;
1844
+ };
1845
+ /** Products of the business's catalog and how many of each. */
1846
+ lines: Array<{
1847
+ productId: string;
1848
+ quantity: number;
1849
+ }>;
1850
+ /** The order type's other fields (entrega, direccion, notas…), by key. */
1851
+ fields?: Record<string, unknown>;
1852
+ /** The team's order type; default: its first type with a products field, else the built-in «pedido». */
1853
+ type?: string;
1854
+ /** The visitor's chat conversation, when the chat is on (notices then land there too). */
1855
+ conversationId?: string;
1856
+ /** Same key → same order: a retried submit never makes two. 8–80 of [A-Za-z0-9_.:-]. */
1857
+ idempotencyKey: string;
1858
+ }
1859
+ /** What a checkout asks besides the cart, the name and the phone (AGF-ORDER-WITHOUT-AI). */
1860
+ export interface DirectOrderForm {
1861
+ type: {
1862
+ key: string;
1863
+ label: string;
1864
+ };
1865
+ /** The order type's other fields, in order; `options`: a closed choice (show chips). */
1866
+ fields: Array<{
1867
+ key: string;
1868
+ label: string;
1869
+ required: boolean;
1870
+ hint?: string;
1871
+ options?: string[];
1872
+ }>;
1873
+ }
1830
1874
  export interface ListCasesInput {
1831
1875
  state?: CaseState[];
1832
1876
  type?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.30.0",
3
+ "version": "4.31.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",