@agentforge-io/sdk-server 4.25.0 → 4.26.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, CaseView, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, 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, CaseView, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, 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 { CaseState, CaseView, ListCasesInput } from '../types';
2
+ import type { CaseReceipt, CaseState, CaseView, ListCasesInput } from '../types';
3
3
  export declare class CasesResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -15,4 +15,17 @@ export declare class CasesResource {
15
15
  transition(caseId: string, state: CaseState, opts?: {
16
16
  note?: string;
17
17
  }): Promise<CaseView>;
18
+ /**
19
+ * `GET /api/v1/cases/receipts/:token` — AGF-CASE-RECEIPT: the receipt behind a
20
+ * public token of this workspace (the host App serves its public link). 404
21
+ * when unknown or turned off.
22
+ */
23
+ receipt(token: string): Promise<CaseReceipt>;
24
+ /**
25
+ * `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
26
+ * `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
27
+ */
28
+ receiptImage(token: string, opts?: {
29
+ size?: 'wide' | 'tall';
30
+ }): Promise<Uint8Array>;
18
31
  }
@@ -40,5 +40,23 @@ class CasesResource {
40
40
  ...(opts.note ? { note: opts.note } : {}),
41
41
  });
42
42
  }
43
+ /**
44
+ * `GET /api/v1/cases/receipts/:token` — AGF-CASE-RECEIPT: the receipt behind a
45
+ * public token of this workspace (the host App serves its public link). 404
46
+ * when unknown or turned off.
47
+ */
48
+ async receipt(token) {
49
+ return this.client.request('GET', `/api/v1/cases/receipts/${encodeURIComponent(token)}`);
50
+ }
51
+ /**
52
+ * `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
53
+ * `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
54
+ */
55
+ async receiptImage(token, opts = {}) {
56
+ const res = await this.client.requestRaw('GET', `/api/v1/cases/receipts/${encodeURIComponent(token)}/image.png${opts.size === 'tall' ? '?size=tall' : ''}`, {
57
+ headers: { accept: 'image/png' },
58
+ });
59
+ return new Uint8Array(await res.arrayBuffer());
60
+ }
43
61
  }
44
62
  exports.CasesResource = CasesResource;
package/dist/types.d.ts CHANGED
@@ -1606,12 +1606,79 @@ export interface CaseView {
1606
1606
  key: string;
1607
1607
  label: string;
1608
1608
  }>;
1609
+ /** AGF-CASE-RECEIPT: the receipt issued when the customer sent it — `token` is
1610
+ * its public link's key (read it with `cases.receipt(token)`). Null before. */
1611
+ receipt: {
1612
+ token: string;
1613
+ issuedAt: string;
1614
+ revision: number;
1615
+ } | null;
1616
+ /** What the customer asked after the business took the case (change, cancel), until the business moves it. */
1617
+ customerRequest: {
1618
+ kind: 'change' | 'cancel';
1619
+ text: string;
1620
+ at: string;
1621
+ } | null;
1609
1622
  openedAt: string;
1610
1623
  reviewedAt: string | null;
1611
1624
  submittedAt: string | null;
1612
1625
  closedAt: string | null;
1613
1626
  lastActivityAt: string;
1614
1627
  }
1628
+ /** AGF-CASE-RECEIPT — one product line, with the price it had when the receipt was issued. */
1629
+ export interface CaseReceiptLine {
1630
+ title: string;
1631
+ qty: number;
1632
+ /** Unit price in cents; null when it is to be quoted. */
1633
+ unitCents: number | null;
1634
+ currency: string;
1635
+ priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
1636
+ unit?: string;
1637
+ }
1638
+ /**
1639
+ * AGF-CASE-RECEIPT — a case's receipt as its public link shows it: what the
1640
+ * customer sent (frozen when sent), the live state, and the business's look.
1641
+ * Never contact data: the customer's first name and the public fields only.
1642
+ */
1643
+ export interface CaseReceipt {
1644
+ token: string;
1645
+ /** 1, then +1 each time the customer changed the case and sent it again (same link). */
1646
+ revision: number;
1647
+ /** The business's note on its last move ("listo en 20 min", a rejection reason). */
1648
+ note: string | null;
1649
+ /** The conversation it came from: a host App's "back to the chat" resumes it. */
1650
+ conversationId: string;
1651
+ number: number;
1652
+ typeLabel: string;
1653
+ issuedAt: string;
1654
+ lines: CaseReceiptLine[];
1655
+ /** Σ of the lines; null when a line has no fixed price or there are no lines. */
1656
+ totalCents: number | null;
1657
+ currency: string | null;
1658
+ fields: Array<{
1659
+ label: string;
1660
+ value: string;
1661
+ }>;
1662
+ customerFirstName: string | null;
1663
+ state: CaseState;
1664
+ stateLabel: string;
1665
+ /** The road of the case, each step marked when reached. */
1666
+ path: Array<{
1667
+ key: string;
1668
+ label: string;
1669
+ reached: boolean;
1670
+ }>;
1671
+ /** Closed without being done (rejected, cancelled, abandoned). */
1672
+ stopped: boolean;
1673
+ updatedAt: string;
1674
+ business: {
1675
+ name: string;
1676
+ logoUrl: string | null;
1677
+ primaryColor: string | null;
1678
+ accentColor: string | null;
1679
+ timeZone: string | null;
1680
+ };
1681
+ }
1615
1682
  export interface ListCasesInput {
1616
1683
  state?: CaseState[];
1617
1684
  type?: string;
@@ -1621,7 +1688,7 @@ export interface ListCasesInput {
1621
1688
  /** 1–200, default 50. */
1622
1689
  limit?: number;
1623
1690
  }
1624
- export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed';
1691
+ export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request';
1625
1692
  export interface AppWebhook {
1626
1693
  url: string;
1627
1694
  events: AppWebhookEventName[];
@@ -1643,6 +1710,8 @@ export interface AppWebhookEvent {
1643
1710
  type: string;
1644
1711
  state: string;
1645
1712
  previousState?: string;
1713
+ /** `case.customer_request`: the customer asks to change the case (a sent one was reopened) or to cancel an accepted one. */
1714
+ request?: 'change' | 'cancel';
1646
1715
  by: 'assistant' | 'business' | 'system';
1647
1716
  conversationId: string;
1648
1717
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.25.0",
3
+ "version": "4.26.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",