@agentforge-io/sdk-server 4.53.0 → 4.55.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, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseReportPage, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryRoute, DeliveryRouteInput, 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, 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';
|
|
6
|
+
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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, 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, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryRoute, DeliveryRouteInput, 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, 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';
|
|
7
7
|
export { AgentsResource } from './resources/agents';
|
|
8
8
|
export { AnalyticsResource } from './resources/analytics';
|
|
9
9
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -11,7 +11,7 @@ export { AppsResource } from './resources/apps';
|
|
|
11
11
|
export { ChatResource } from './resources/chat';
|
|
12
12
|
export type { AnthropicClientOptions, AppCallerClaims, StreamMessageInput, StreamMessageForAppUserInput, } from './resources/chat';
|
|
13
13
|
export { ConnectorsResource, parseGoogleSheetsPickerResult } from './resources/connectors';
|
|
14
|
-
export type { AppCreateInboxChannelInput, CreateInboxChannelInput, InboxChannelLinkMethod, InboxChannelReplyMode, InboxChannelView, RelinkInboxChannelInput, StartWhatsAppCloudLinkInput, WhatsAppCloudConnectionType, WhatsAppCloudLinkResult, WhatsAppCloudLinkStart, WhatsAppCloudNumber, } from './resources/connectors';
|
|
14
|
+
export type { AppCreateInboxChannelInput, CreateInboxChannelInput, InboxChannelLinkMethod, InboxChannelReplyMode, InboxChannelView, RelinkInboxChannelInput, StartWhatsAppCloudLinkInput, WhatsAppCloudConnectionType, WhatsAppCloudLinkResult, WhatsAppCloudLinkStart, WhatsAppCloudLinkState, WhatsAppCloudLinkStatus, WhatsAppCloudNumber, } from './resources/connectors';
|
|
15
15
|
export { InboxResource } from './resources/inbox';
|
|
16
16
|
export { InstallationsResource } from './resources/installations';
|
|
17
17
|
export type { InstallAppInput } from './resources/installations';
|
|
@@ -29,7 +29,7 @@ export { DeliveryResource } from './resources/delivery';
|
|
|
29
29
|
export { CasesResource } from './resources/cases';
|
|
30
30
|
export { BusinessRolesResource } from './resources/business-roles';
|
|
31
31
|
export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogMenuImportResource, CatalogOptionGroupsResource, CatalogUnitsResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
|
|
32
|
-
export type { ListThreadsOptions, SendMessageInput, AssignThreadInput, UnassignThreadInput, SetThreadModeInput, CloseThreadInput, } from './resources/inbox';
|
|
32
|
+
export type { ListThreadsOptions, ListNewestMessagesOptions, NewestMessagesPage, SendMessageInput, AssignThreadInput, UnassignThreadInput, SetThreadModeInput, CloseThreadInput, } from './resources/inbox';
|
|
33
33
|
export { ProvisioningResource } from './resources/provisioning';
|
|
34
34
|
export type { ProvisionedTenant, ProvisionedApp, ProvisionedTeam, } from './resources/provisioning';
|
|
35
35
|
export { SecretsResource } from './resources/secrets';
|
|
@@ -293,6 +293,8 @@ export declare class ConnectorsResource {
|
|
|
293
293
|
/**
|
|
294
294
|
* `POST …/inbox/whatsapp-cloud/poll` — `{ channel }` once the number is
|
|
295
295
|
* connected, with `replyMode: 'human'`, else `{ channel: null }`. Safe to repeat.
|
|
296
|
+
* `link` says how the link stands (see `WhatsAppCloudLinkStatus`); a poll with no
|
|
297
|
+
* session reads as `expired`.
|
|
296
298
|
*
|
|
297
299
|
* Throws `AgentForgeError` with `code`: `whatsapp_cloud_number_limit` (409),
|
|
298
300
|
* `whatsapp_cloud_unavailable` (503).
|
|
@@ -557,8 +559,26 @@ export interface WhatsAppCloudLinkStart {
|
|
|
557
559
|
/** Numbers that existed before this link. Pass them to `pollWhatsAppCloudLink`. */
|
|
558
560
|
excludeIds: string[];
|
|
559
561
|
}
|
|
562
|
+
export type WhatsAppCloudLinkState = 'waiting' | 'finished_no_number' | 'failed' | 'expired';
|
|
563
|
+
export interface WhatsAppCloudLinkStatus {
|
|
564
|
+
state: WhatsAppCloudLinkState;
|
|
565
|
+
/**
|
|
566
|
+
* Why. `failed`: `login_cancelled`, `phone_verification_failed`, `account_limit_reached`,
|
|
567
|
+
* `authorization_failed`, `browser_blocked`, `link_expired`, `link_already_used`,
|
|
568
|
+
* `link_replaced`, `number_limit_reached`, `number_in_use`, `setup_failed`.
|
|
569
|
+
* `finished_no_number`: `number_not_found`, `several_numbers`. `expired`: `session_expired`.
|
|
570
|
+
* A string, as the platform may add more.
|
|
571
|
+
*/
|
|
572
|
+
reason?: string;
|
|
573
|
+
}
|
|
560
574
|
export interface WhatsAppCloudLinkResult {
|
|
561
575
|
channel: InboxChannelView | null;
|
|
576
|
+
/**
|
|
577
|
+
* How the link stands. `null` once there is a channel; absent on a platform from
|
|
578
|
+
* before it. `failed` and `finished_no_number` are not final: keep polling, a number
|
|
579
|
+
* can still arrive and wins. Stop on a channel or `expired`.
|
|
580
|
+
*/
|
|
581
|
+
link?: WhatsAppCloudLinkStatus | null;
|
|
562
582
|
}
|
|
563
583
|
export interface WhatsAppCloudNumber {
|
|
564
584
|
phoneNumberId: string;
|
|
@@ -301,6 +301,8 @@ class ConnectorsResource {
|
|
|
301
301
|
/**
|
|
302
302
|
* `POST …/inbox/whatsapp-cloud/poll` — `{ channel }` once the number is
|
|
303
303
|
* connected, with `replyMode: 'human'`, else `{ channel: null }`. Safe to repeat.
|
|
304
|
+
* `link` says how the link stands (see `WhatsAppCloudLinkStatus`); a poll with no
|
|
305
|
+
* session reads as `expired`.
|
|
304
306
|
*
|
|
305
307
|
* Throws `AgentForgeError` with `code`: `whatsapp_cloud_number_limit` (409),
|
|
306
308
|
* `whatsapp_cloud_unavailable` (503).
|
|
@@ -6,6 +6,18 @@ export interface ListThreadsOptions {
|
|
|
6
6
|
/** Also the history of disconnected channels, marked `channelDisconnected`. */
|
|
7
7
|
includeDisconnected?: boolean;
|
|
8
8
|
}
|
|
9
|
+
export interface ListNewestMessagesOptions {
|
|
10
|
+
/** 1–100. Default 50. */
|
|
11
|
+
limit?: number;
|
|
12
|
+
/** `nextCursor` of the previous page, for older messages. */
|
|
13
|
+
cursor?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface NewestMessagesPage {
|
|
16
|
+
/** Newest first. */
|
|
17
|
+
items: InboxMessageView[];
|
|
18
|
+
/** Absent on the last page. */
|
|
19
|
+
nextCursor?: string;
|
|
20
|
+
}
|
|
9
21
|
export interface SendMessageInput {
|
|
10
22
|
/** The operator's text. */
|
|
11
23
|
text: string;
|
|
@@ -70,6 +82,18 @@ export declare class InboxResource {
|
|
|
70
82
|
listMessages: (threadId: string) => Promise<{
|
|
71
83
|
items: InboxMessageView[];
|
|
72
84
|
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Pages from the newest message. `listMessages` returns the OLDEST 100, so
|
|
87
|
+
* past 100 a thread's new messages are not in it. Needs the platform's
|
|
88
|
+
* AGF-WA-LIVE; an older platform ignores the query and answers `listMessages`.
|
|
89
|
+
*/
|
|
90
|
+
listNewestMessages: (threadId: string, opts?: ListNewestMessagesOptions) => Promise<NewestMessagesPage>;
|
|
91
|
+
/**
|
|
92
|
+
* The App read this thread: its unread count goes back to 0. A reply does
|
|
93
|
+
* not do this, so call it when a person opens the thread. Needs the
|
|
94
|
+
* platform's AGF-WA-LIVE.
|
|
95
|
+
*/
|
|
96
|
+
markRead: (threadId: string) => Promise<void>;
|
|
73
97
|
sendMessage: (threadId: string, input: SendMessageInput) => Promise<void>;
|
|
74
98
|
assign: (threadId: string, input: AssignThreadInput) => Promise<void>;
|
|
75
99
|
unassign: (threadId: string, input: UnassignThreadInput) => Promise<void>;
|
package/dist/resources/inbox.js
CHANGED
|
@@ -61,6 +61,27 @@ class InboxResource {
|
|
|
61
61
|
listMessages: async (threadId) => {
|
|
62
62
|
return this.client.request('GET', `${base}/threads/${encodeURIComponent(threadId)}/messages`);
|
|
63
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* Pages from the newest message. `listMessages` returns the OLDEST 100, so
|
|
66
|
+
* past 100 a thread's new messages are not in it. Needs the platform's
|
|
67
|
+
* AGF-WA-LIVE; an older platform ignores the query and answers `listMessages`.
|
|
68
|
+
*/
|
|
69
|
+
listNewestMessages: async (threadId, opts = {}) => {
|
|
70
|
+
const params = [
|
|
71
|
+
'order=desc',
|
|
72
|
+
...(opts.limit !== undefined ? [`limit=${opts.limit}`] : []),
|
|
73
|
+
...(opts.cursor ? [`cursor=${encodeURIComponent(opts.cursor)}`] : []),
|
|
74
|
+
];
|
|
75
|
+
return this.client.request('GET', `${base}/threads/${encodeURIComponent(threadId)}/messages?${params.join('&')}`);
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* The App read this thread: its unread count goes back to 0. A reply does
|
|
79
|
+
* not do this, so call it when a person opens the thread. Needs the
|
|
80
|
+
* platform's AGF-WA-LIVE.
|
|
81
|
+
*/
|
|
82
|
+
markRead: async (threadId) => {
|
|
83
|
+
await this.client.request('POST', `${base}/threads/${encodeURIComponent(threadId)}/read`);
|
|
84
|
+
},
|
|
64
85
|
sendMessage: async (threadId, input) => {
|
|
65
86
|
await this.client.request('POST', `${base}/threads/${encodeURIComponent(threadId)}/messages`, input);
|
|
66
87
|
},
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
// returns it. Idempotent: calling it on every boot is fine. `receiptLink`
|
|
9
9
|
// (AGF-CASE-RECEIPT R5) is where the App shows a receipt; the platform puts
|
|
10
10
|
// it under case notices on channels without the receipt card (WhatsApp…).
|
|
11
|
+
// A `set` REPLACES the webhook: list every event you want, and send
|
|
12
|
+
// `receiptLink` again or it clears. `conversation.message` and
|
|
13
|
+
// `channel.status_changed` need the platform's AGF-WA-LIVE; before it, a `set`
|
|
14
|
+
// naming them answers 400 and the stored webhook stays as it was.
|
|
11
15
|
// - `get()` — the current webhook (url, events, active), or null.
|
|
12
16
|
// - `remove()` — stop receiving events.
|
|
13
17
|
//
|
package/dist/types.d.ts
CHANGED
|
@@ -560,6 +560,8 @@ export interface InboxThreadView {
|
|
|
560
560
|
unreadCount: number;
|
|
561
561
|
lastMessageAt?: string;
|
|
562
562
|
lastMessagePreview?: string;
|
|
563
|
+
/** When the customer last wrote: what a messaging window counts from. Absent if they never did. Needs the platform's AGF-WA-LIVE. */
|
|
564
|
+
lastInboundAt?: string;
|
|
563
565
|
/** Workspace user currently responsible for the thread. */
|
|
564
566
|
assignedHumanUserId?: string;
|
|
565
567
|
/** AGF-ASSIGN-P1-CLOSE. ISO timestamp when the human conversation was
|
|
@@ -2040,6 +2042,9 @@ export interface CaseBusinessState {
|
|
|
2040
2042
|
label: string;
|
|
2041
2043
|
/** Said to the customer when the business moves the case here. */
|
|
2042
2044
|
notifyCustomer?: string;
|
|
2045
|
+
/** AGF-ORDER-STATE-TYPES D1/D3 — what the phase is for, and whom (absent: both pickup and delivery). */
|
|
2046
|
+
type?: 'preparing' | 'ready' | 'out_for_delivery';
|
|
2047
|
+
fulfillment?: 'pickup' | 'delivery';
|
|
2043
2048
|
}
|
|
2044
2049
|
/** One kind of case a team handles (declared by its template). */
|
|
2045
2050
|
export interface CaseType {
|
|
@@ -2064,6 +2069,11 @@ export interface CaseType {
|
|
|
2064
2069
|
* `submitted` (with the business) → `accepted` → the type's business states →
|
|
2065
2070
|
* `completed` | `cancelled` | `rejected` | `abandoned`.
|
|
2066
2071
|
*/
|
|
2072
|
+
/**
|
|
2073
|
+
* AGF-ORDER-STATE-TYPES D1 — what a state is for, whatever the template calls it. Features
|
|
2074
|
+
* (the courier section, dispatch) read the type, never the label.
|
|
2075
|
+
*/
|
|
2076
|
+
export type CaseStateType = 'draft' | 'received' | 'preparing' | 'ready' | 'out_for_delivery' | 'completed' | 'canceled';
|
|
2067
2077
|
/** `no_show`: a booking whose customer did not come (AGF-AGENDA-LIFECYCLE). */
|
|
2068
2078
|
export type CaseState = 'open' | 'review' | 'submitted' | 'accepted' | 'completed' | 'cancelled' | 'rejected' | 'abandoned' | 'no_show' | (string & {});
|
|
2069
2079
|
/** One state a case reached (AGF-CASE-TRACKING). */
|
|
@@ -2102,6 +2112,8 @@ export interface CaseView {
|
|
|
2102
2112
|
typeLabel: string;
|
|
2103
2113
|
state: CaseState;
|
|
2104
2114
|
stateLabel: string;
|
|
2115
|
+
/** AGF-ORDER-STATE-TYPES D5 — what the state is for; absent on a platform from before types. */
|
|
2116
|
+
stateType?: CaseStateType;
|
|
2105
2117
|
/** What the assistant collected, by field key. */
|
|
2106
2118
|
data: Record<string, unknown>;
|
|
2107
2119
|
/** What the customer confirmed (written at review). */
|
|
@@ -2114,7 +2126,8 @@ export interface CaseView {
|
|
|
2114
2126
|
* told when it moves there (AGF-CASES C3; absent when nothing is said). */
|
|
2115
2127
|
nextStates: Array<{
|
|
2116
2128
|
key: string;
|
|
2117
|
-
label: string;
|
|
2129
|
+
label: string; /** AGF-ORDER-STATE-TYPES D5 */
|
|
2130
|
+
type?: CaseStateType;
|
|
2118
2131
|
notifyCustomer?: string;
|
|
2119
2132
|
}>;
|
|
2120
2133
|
/** The collected data as the business reads it, labeled, in the type's order. */
|
|
@@ -2321,6 +2334,8 @@ export interface CaseReceipt {
|
|
|
2321
2334
|
customerFirstName: string | null;
|
|
2322
2335
|
state: CaseState;
|
|
2323
2336
|
stateLabel: string;
|
|
2337
|
+
/** AGF-ORDER-STATE-TYPES D5 — what the state is for; absent on a platform from before types. */
|
|
2338
|
+
stateType?: CaseStateType;
|
|
2324
2339
|
/** The road of the case, each step marked when reached. */
|
|
2325
2340
|
path: Array<{
|
|
2326
2341
|
key: string;
|
|
@@ -2637,7 +2652,8 @@ export interface MoveCaseSlotInput {
|
|
|
2637
2652
|
assigneeRef?: string | null;
|
|
2638
2653
|
assigneeName?: string;
|
|
2639
2654
|
}
|
|
2640
|
-
export type
|
|
2655
|
+
export type AppCaseWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed';
|
|
2656
|
+
export type AppWebhookEventName = AppCaseWebhookEventName | 'conversation.message' | 'channel.status_changed';
|
|
2641
2657
|
export interface AppWebhook {
|
|
2642
2658
|
url: string;
|
|
2643
2659
|
events: AppWebhookEventName[];
|
|
@@ -2647,13 +2663,47 @@ export interface AppWebhook {
|
|
|
2647
2663
|
createdAt: string;
|
|
2648
2664
|
updatedAt: string;
|
|
2649
2665
|
}
|
|
2650
|
-
/** What
|
|
2651
|
-
|
|
2652
|
-
/** Delivery id — dedupe on it (retries keep it). */
|
|
2666
|
+
/** What every delivery has. `id` is the delivery id: dedupe on it (retries keep it). */
|
|
2667
|
+
interface AppWebhookEventBase {
|
|
2653
2668
|
id: string;
|
|
2654
|
-
type: AppWebhookEventName;
|
|
2655
2669
|
createdAt: string;
|
|
2656
2670
|
tenantId: string;
|
|
2671
|
+
}
|
|
2672
|
+
/**
|
|
2673
|
+
* What the platform POSTs. No customer data: read with your own credential. Narrow on `type`.
|
|
2674
|
+
* A new event only arrives once the App lists it in `webhook.set({ events })`.
|
|
2675
|
+
*/
|
|
2676
|
+
export type AppWebhookEvent = AppCaseWebhookEvent | AppConversationMessageWebhookEvent | AppChannelStatusWebhookEvent;
|
|
2677
|
+
/**
|
|
2678
|
+
* A message was committed on a thread of one of this App's agents, on any inbox channel. Only to the App that owns the
|
|
2679
|
+
* agent. No text, sender name or phone: read it with `forTenant(tenantId).inbox.forAgent(agentId)`. A burst on one thread
|
|
2680
|
+
* is coalesced (first at once, then at most one per second, per direction and source), so treat it as "this thread changed
|
|
2681
|
+
* up to `at`", not as one event per message. Delivery can fail for good: read again when your client reconnects.
|
|
2682
|
+
*/
|
|
2683
|
+
export interface AppConversationMessageWebhookEvent extends AppWebhookEventBase {
|
|
2684
|
+
type: 'conversation.message';
|
|
2685
|
+
data: {
|
|
2686
|
+
threadId: string;
|
|
2687
|
+
channelId: string;
|
|
2688
|
+
agentId: string;
|
|
2689
|
+
direction: InboxMessageDirection;
|
|
2690
|
+
source: InboxMessageSource;
|
|
2691
|
+
at: string;
|
|
2692
|
+
};
|
|
2693
|
+
}
|
|
2694
|
+
/** A channel of one of this App's agents changed status. Only to the App that owns the agent; the last status of a burst wins. */
|
|
2695
|
+
export interface AppChannelStatusWebhookEvent extends AppWebhookEventBase {
|
|
2696
|
+
type: 'channel.status_changed';
|
|
2697
|
+
data: {
|
|
2698
|
+
channelId: string;
|
|
2699
|
+
agentId: string;
|
|
2700
|
+
status: string;
|
|
2701
|
+
at: string;
|
|
2702
|
+
};
|
|
2703
|
+
}
|
|
2704
|
+
/** Read the case with `forTenant(tenantId).cases.get(caseId)`. */
|
|
2705
|
+
export interface AppCaseWebhookEvent extends AppWebhookEventBase {
|
|
2706
|
+
type: AppCaseWebhookEventName;
|
|
2657
2707
|
data: {
|
|
2658
2708
|
caseId: string;
|
|
2659
2709
|
caseNumber: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.55.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",
|