@agentforge-io/sdk-server 4.25.0 → 4.27.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 +1 -1
- package/dist/resources/cases.d.ts +20 -1
- package/dist/resources/cases.js +26 -0
- package/dist/types.d.ts +81 -3
- package/package.json +1 -1
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,23 @@ 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
|
+
* `POST /api/v1/cases/receipts/:token/received` — the customer got it (the
|
|
26
|
+
* receipt's «Ya lo recibí»): completes a case the business took. 400 before
|
|
27
|
+
* it was accepted or once closed. Returns the receipt as it is now.
|
|
28
|
+
*/
|
|
29
|
+
receiptReceived(token: string): Promise<CaseReceipt>;
|
|
30
|
+
/**
|
|
31
|
+
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
32
|
+
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|
|
33
|
+
*/
|
|
34
|
+
receiptImage(token: string, opts?: {
|
|
35
|
+
size?: 'wide' | 'tall';
|
|
36
|
+
}): Promise<Uint8Array>;
|
|
18
37
|
}
|
package/dist/resources/cases.js
CHANGED
|
@@ -40,5 +40,31 @@ 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
|
+
* `POST /api/v1/cases/receipts/:token/received` — the customer got it (the
|
|
53
|
+
* receipt's «Ya lo recibí»): completes a case the business took. 400 before
|
|
54
|
+
* it was accepted or once closed. Returns the receipt as it is now.
|
|
55
|
+
*/
|
|
56
|
+
async receiptReceived(token) {
|
|
57
|
+
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/received`, {});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
61
|
+
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|
|
62
|
+
*/
|
|
63
|
+
async receiptImage(token, opts = {}) {
|
|
64
|
+
const res = await this.client.requestRaw('GET', `/api/v1/cases/receipts/${encodeURIComponent(token)}/image.png${opts.size === 'tall' ? '?size=tall' : ''}`, {
|
|
65
|
+
headers: { accept: 'image/png' },
|
|
66
|
+
});
|
|
67
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
68
|
+
}
|
|
43
69
|
}
|
|
44
70
|
exports.CasesResource = CasesResource;
|
package/dist/types.d.ts
CHANGED
|
@@ -1568,8 +1568,10 @@ export interface CaseType {
|
|
|
1568
1568
|
export type CaseState = 'open' | 'review' | 'submitted' | 'accepted' | 'completed' | 'cancelled' | 'rejected' | 'abandoned' | (string & {});
|
|
1569
1569
|
export interface CaseView {
|
|
1570
1570
|
id: string;
|
|
1571
|
-
/** Per workspace,
|
|
1571
|
+
/** Per workspace, sequential (ordering). People read `code`. */
|
|
1572
1572
|
number: number;
|
|
1573
|
+
/** What people read it by ("Pedido #K7Q2XM"): 6 capitals and digits; the number for a case from before codes. */
|
|
1574
|
+
code: string;
|
|
1573
1575
|
conversationId: string;
|
|
1574
1576
|
teamId: string | null;
|
|
1575
1577
|
type: string;
|
|
@@ -1606,12 +1608,84 @@ export interface CaseView {
|
|
|
1606
1608
|
key: string;
|
|
1607
1609
|
label: string;
|
|
1608
1610
|
}>;
|
|
1611
|
+
/** AGF-CASE-RECEIPT: the receipt issued when the customer sent it — `token` is
|
|
1612
|
+
* its public link's key (read it with `cases.receipt(token)`). Null before. */
|
|
1613
|
+
receipt: {
|
|
1614
|
+
token: string;
|
|
1615
|
+
issuedAt: string;
|
|
1616
|
+
revision: number;
|
|
1617
|
+
} | null;
|
|
1618
|
+
/** What the customer asked after the business took the case (change, cancel), until the business moves it. */
|
|
1619
|
+
customerRequest: {
|
|
1620
|
+
kind: 'change' | 'cancel';
|
|
1621
|
+
text: string;
|
|
1622
|
+
at: string;
|
|
1623
|
+
} | null;
|
|
1609
1624
|
openedAt: string;
|
|
1610
1625
|
reviewedAt: string | null;
|
|
1611
1626
|
submittedAt: string | null;
|
|
1612
1627
|
closedAt: string | null;
|
|
1613
1628
|
lastActivityAt: string;
|
|
1614
1629
|
}
|
|
1630
|
+
/** AGF-CASE-RECEIPT — one product line, with the price it had when the receipt was issued. */
|
|
1631
|
+
export interface CaseReceiptLine {
|
|
1632
|
+
title: string;
|
|
1633
|
+
qty: number;
|
|
1634
|
+
/** Unit price in cents; null when it is to be quoted. */
|
|
1635
|
+
unitCents: number | null;
|
|
1636
|
+
currency: string;
|
|
1637
|
+
priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
|
|
1638
|
+
unit?: string;
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* AGF-CASE-RECEIPT — a case's receipt as its public link shows it: what the
|
|
1642
|
+
* customer sent (frozen when sent), the live state, and the business's look.
|
|
1643
|
+
* Never contact data: the customer's first name and the public fields only.
|
|
1644
|
+
*/
|
|
1645
|
+
export interface CaseReceipt {
|
|
1646
|
+
token: string;
|
|
1647
|
+
/** What people read it by ("K7Q2XM"); absent on receipts from before codes (use `number`). */
|
|
1648
|
+
code?: string;
|
|
1649
|
+
/** The customer may say they got it now (it is ready or on its way): `cases.receiptReceived`. */
|
|
1650
|
+
receivable: boolean;
|
|
1651
|
+
/** 1, then +1 each time the customer changed the case and sent it again (same link). */
|
|
1652
|
+
revision: number;
|
|
1653
|
+
/** The business's note on its last move ("listo en 20 min", a rejection reason). */
|
|
1654
|
+
note: string | null;
|
|
1655
|
+
/** The conversation it came from: a host App's "back to the chat" resumes it. */
|
|
1656
|
+
conversationId: string;
|
|
1657
|
+
number: number;
|
|
1658
|
+
typeLabel: string;
|
|
1659
|
+
issuedAt: string;
|
|
1660
|
+
lines: CaseReceiptLine[];
|
|
1661
|
+
/** Σ of the lines; null when a line has no fixed price or there are no lines. */
|
|
1662
|
+
totalCents: number | null;
|
|
1663
|
+
currency: string | null;
|
|
1664
|
+
fields: Array<{
|
|
1665
|
+
label: string;
|
|
1666
|
+
value: string;
|
|
1667
|
+
}>;
|
|
1668
|
+
customerFirstName: string | null;
|
|
1669
|
+
state: CaseState;
|
|
1670
|
+
stateLabel: string;
|
|
1671
|
+
/** The road of the case, each step marked when reached. */
|
|
1672
|
+
path: Array<{
|
|
1673
|
+
key: string;
|
|
1674
|
+
label: string;
|
|
1675
|
+
reached: boolean;
|
|
1676
|
+
}>;
|
|
1677
|
+
/** Closed without being done (rejected, cancelled, abandoned). */
|
|
1678
|
+
stopped: boolean;
|
|
1679
|
+
updatedAt: string;
|
|
1680
|
+
business: {
|
|
1681
|
+
name: string;
|
|
1682
|
+
description: string | null;
|
|
1683
|
+
logoUrl: string | null;
|
|
1684
|
+
primaryColor: string | null;
|
|
1685
|
+
accentColor: string | null;
|
|
1686
|
+
timeZone: string | null;
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1615
1689
|
export interface ListCasesInput {
|
|
1616
1690
|
state?: CaseState[];
|
|
1617
1691
|
type?: string;
|
|
@@ -1621,7 +1695,7 @@ export interface ListCasesInput {
|
|
|
1621
1695
|
/** 1–200, default 50. */
|
|
1622
1696
|
limit?: number;
|
|
1623
1697
|
}
|
|
1624
|
-
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed';
|
|
1698
|
+
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request';
|
|
1625
1699
|
export interface AppWebhook {
|
|
1626
1700
|
url: string;
|
|
1627
1701
|
events: AppWebhookEventName[];
|
|
@@ -1643,7 +1717,11 @@ export interface AppWebhookEvent {
|
|
|
1643
1717
|
type: string;
|
|
1644
1718
|
state: string;
|
|
1645
1719
|
previousState?: string;
|
|
1646
|
-
|
|
1720
|
+
/** `case.customer_request`: the customer asks to change the case (a sent one was reopened) or to cancel an accepted one. */
|
|
1721
|
+
request?: 'change' | 'cancel';
|
|
1722
|
+
by: 'assistant' | 'business' | 'system' | 'customer';
|
|
1723
|
+
/** What people read it by ("K7Q2XM"). */
|
|
1724
|
+
caseCode?: string;
|
|
1647
1725
|
conversationId: string;
|
|
1648
1726
|
};
|
|
1649
1727
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.27.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",
|