@agentforge-io/sdk-server 4.30.0 → 4.32.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, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, 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
@@ -1,9 +1,19 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { Place, SearchPlacesInput } from '../types';
2
+ import type { AutocompletePlacesInput, Place, PlaceSuggestion, SearchPlacesInput } from '../types';
3
3
  export declare class PlacesResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
6
- /** `GET /api/v1/places/search` — places matching a text, for an autocomplete. */
6
+ /**
7
+ * `GET /api/v1/places/autocomplete` — suggestions while the customer types
8
+ * (AGF-GEO-GOOGLE). Pick one with `details` and the same `sessionToken`.
9
+ */
10
+ autocomplete(input: AutocompletePlacesInput): Promise<PlaceSuggestion[]>;
11
+ /** `GET /api/v1/places/details/:placeId` — the picked suggestion with its point; null when the id is unknown. */
12
+ details(placeId: string, opts?: {
13
+ sessionToken?: string;
14
+ language?: string;
15
+ }): Promise<Place | null>;
16
+ /** `GET /api/v1/places/search` — places matching a free text (geocoding), with their points. */
7
17
  search(input: SearchPlacesInput): Promise<Place[]>;
8
18
  /** `GET /api/v1/places/reverse` — the place at a dropped pin (its coordinates are kept). */
9
19
  reverse(lat: number, lng: number, opts?: {
@@ -8,7 +8,40 @@ class PlacesResource {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
- /** `GET /api/v1/places/search` — places matching a text, for an autocomplete. */
11
+ /**
12
+ * `GET /api/v1/places/autocomplete` — suggestions while the customer types
13
+ * (AGF-GEO-GOOGLE). Pick one with `details` and the same `sessionToken`.
14
+ */
15
+ async autocomplete(input) {
16
+ const qs = new URLSearchParams({ q: input.q });
17
+ if (input.sessionToken)
18
+ qs.set('sessionToken', input.sessionToken);
19
+ if (input.near)
20
+ qs.set('near', `${input.near.lat},${input.near.lng}`);
21
+ if (input.language)
22
+ qs.set('language', input.language);
23
+ const res = await this.client.request('GET', `/api/v1/places/autocomplete?${qs.toString()}`);
24
+ return res.items;
25
+ }
26
+ /** `GET /api/v1/places/details/:placeId` — the picked suggestion with its point; null when the id is unknown. */
27
+ async details(placeId, opts = {}) {
28
+ const qs = new URLSearchParams();
29
+ if (opts.sessionToken)
30
+ qs.set('sessionToken', opts.sessionToken);
31
+ if (opts.language)
32
+ qs.set('language', opts.language);
33
+ const tail = qs.toString() ? `?${qs.toString()}` : '';
34
+ try {
35
+ const res = await this.client.request('GET', `/api/v1/places/details/${encodeURIComponent(placeId)}${tail}`);
36
+ return res.place;
37
+ }
38
+ catch (e) {
39
+ if (e.status === 404)
40
+ return null;
41
+ throw e;
42
+ }
43
+ }
44
+ /** `GET /api/v1/places/search` — places matching a free text (geocoding), with their points. */
12
45
  async search(input) {
13
46
  const qs = new URLSearchParams({ q: input.q });
14
47
  if (input.proximity)
package/dist/types.d.ts CHANGED
@@ -1421,6 +1421,35 @@ export interface SearchPlacesInput {
1421
1421
  /** 1–10, default 5. */
1422
1422
  limit?: number;
1423
1423
  }
1424
+ /**
1425
+ * A suggestion while the customer types (`places.autocomplete`, AGF-GEO-GOOGLE):
1426
+ * no coordinates until it is picked with `places.details`.
1427
+ */
1428
+ export interface PlaceSuggestion {
1429
+ placeId: string;
1430
+ /** The whole suggestion ("Calle 45 #13-31, Bogotá, Colombia"). */
1431
+ text: string;
1432
+ /** First line ("Calle 45 #13-31"). */
1433
+ main?: string;
1434
+ /** The rest ("Bogotá, Colombia"). */
1435
+ secondary?: string;
1436
+ }
1437
+ export interface AutocompletePlacesInput {
1438
+ /** 3–200 characters. */
1439
+ q: string;
1440
+ /**
1441
+ * A UUID the App creates when the customer starts typing and passes to every
1442
+ * call and to the `details` call that ends it (the provider bills the
1443
+ * session, not each keystroke). A new one per address search.
1444
+ */
1445
+ sessionToken?: string;
1446
+ /** Suggestions near this point first; default: the business's own address. */
1447
+ near?: {
1448
+ lat: number;
1449
+ lng: number;
1450
+ };
1451
+ language?: string;
1452
+ }
1424
1453
  /** A geocoded address: a confirmed pin, never static text. */
1425
1454
  export interface AddressValue {
1426
1455
  formatted: string;
@@ -1429,6 +1458,14 @@ export interface AddressValue {
1429
1458
  placeId?: string;
1430
1459
  components?: Place['components'];
1431
1460
  notes?: string;
1461
+ /**
1462
+ * Whose point this is (AGF-GEO-GOOGLE D2): 'google' = as `places.details`
1463
+ * gave it (requires `placeId`; the platform refreshes it before the
1464
+ * provider's 30-day limit); 'pin' = the owner moved or confirmed the pin.
1465
+ */
1466
+ source?: 'google' | 'pin';
1467
+ /** ISO time the point was taken from the provider (set by the platform for 'google'). */
1468
+ geocodedAt?: string;
1432
1469
  }
1433
1470
  export type DeliveryLocalPricing = {
1434
1471
  kind: 'fixed';
@@ -1499,6 +1536,8 @@ export interface PaymentMethodDef {
1499
1536
  fields: PaymentFieldDef[];
1500
1537
  /** One per business (cash): no name to tell accounts apart, a second one is refused. */
1501
1538
  single?: boolean;
1539
+ /** The country's most used methods (CO: Efectivo, Nequi, Daviplata, Bre-B): editors show them first. */
1540
+ popular?: boolean;
1502
1541
  }
1503
1542
  /** One way to pay into the business, with the data a customer needs. Several per method allowed. */
1504
1543
  export interface PaymentAccount {
@@ -1664,8 +1703,10 @@ export interface CaseView {
1664
1703
  }>;
1665
1704
  /** The inbox thread that carries the conversation (open the chat with it), when there is one. */
1666
1705
  threadId: string | null;
1667
- /** The customer's name on that thread, when known. */
1706
+ /** The customer's name on that thread, or the one given at checkout (an order without the chat). */
1668
1707
  customerName: string | null;
1708
+ /** AGF-ORDER-WITHOUT-AI — the phone given at checkout (orders placed without the chat). */
1709
+ customerPhone: string | null;
1669
1710
  /** The road the business walks it: sent, accepted, the type's own phases, completed. */
1670
1711
  path: Array<{
1671
1712
  key: string;
@@ -1827,6 +1868,46 @@ export interface CaseReceipt {
1827
1868
  timeZone: string | null;
1828
1869
  };
1829
1870
  }
1871
+ /**
1872
+ * AGF-ORDER-WITHOUT-AI — an order placed without the assistant: a cart and a
1873
+ * checkout on the host App. Created already sent (holds, receipt, `case.submitted`).
1874
+ */
1875
+ export interface CreateDirectOrderInput {
1876
+ /** Who orders: the App's visitor id, and the name and phone they gave (both required). */
1877
+ customer: {
1878
+ ref: string;
1879
+ name: string;
1880
+ phone: string;
1881
+ };
1882
+ /** Products of the business's catalog and how many of each. */
1883
+ lines: Array<{
1884
+ productId: string;
1885
+ quantity: number;
1886
+ }>;
1887
+ /** The order type's other fields (entrega, direccion, notas…), by key. */
1888
+ fields?: Record<string, unknown>;
1889
+ /** The team's order type; default: its first type with a products field, else the built-in «pedido». */
1890
+ type?: string;
1891
+ /** The visitor's chat conversation, when the chat is on (notices then land there too). */
1892
+ conversationId?: string;
1893
+ /** Same key → same order: a retried submit never makes two. 8–80 of [A-Za-z0-9_.:-]. */
1894
+ idempotencyKey: string;
1895
+ }
1896
+ /** What a checkout asks besides the cart, the name and the phone (AGF-ORDER-WITHOUT-AI). */
1897
+ export interface DirectOrderForm {
1898
+ type: {
1899
+ key: string;
1900
+ label: string;
1901
+ };
1902
+ /** The order type's other fields, in order; `options`: a closed choice (show chips). */
1903
+ fields: Array<{
1904
+ key: string;
1905
+ label: string;
1906
+ required: boolean;
1907
+ hint?: string;
1908
+ options?: string[];
1909
+ }>;
1910
+ }
1830
1911
  export interface ListCasesInput {
1831
1912
  state?: CaseState[];
1832
1913
  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.32.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",