@agentforge-io/sdk-server 4.24.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 +1 -1
- package/dist/resources/cases.d.ts +14 -1
- package/dist/resources/cases.js +18 -0
- package/dist/resources/connectors.d.ts +7 -1
- package/dist/resources/connectors.js +7 -2
- package/dist/types.d.ts +78 -1
- 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,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
|
}
|
package/dist/resources/cases.js
CHANGED
|
@@ -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;
|
|
@@ -21,8 +21,14 @@ export declare class ConnectorsResource {
|
|
|
21
21
|
* Drive…). Si el connector está conectado pero no tiene selector
|
|
22
22
|
* implementado todavía, devuelve `{ items: [], unsupported: true }` en vez
|
|
23
23
|
* de tirar — no es un error, es un estado a mostrar en la UI.
|
|
24
|
+
*
|
|
25
|
+
* `opts.q` (AGF-SHEETS-SEARCH) busca por nombre en Google Drive / Sheets
|
|
26
|
+
* (los demás connectors lo ignoran). Con un grant de Sheets sin
|
|
27
|
+
* `drive.readonly` el resultado trae `limited: true`.
|
|
24
28
|
*/
|
|
25
|
-
listResources(connectorId: string
|
|
29
|
+
listResources(connectorId: string, opts?: {
|
|
30
|
+
q?: string;
|
|
31
|
+
}): Promise<ListConnectorResourcesResult>;
|
|
26
32
|
/**
|
|
27
33
|
* `POST /connectors/oauth/:id/authorize-for-tenant` — arranca el OAuth
|
|
28
34
|
* authorize del connector para el tenant del ak_live_ (sin sesión de
|
|
@@ -37,9 +37,14 @@ class ConnectorsResource {
|
|
|
37
37
|
* Drive…). Si el connector está conectado pero no tiene selector
|
|
38
38
|
* implementado todavía, devuelve `{ items: [], unsupported: true }` en vez
|
|
39
39
|
* de tirar — no es un error, es un estado a mostrar en la UI.
|
|
40
|
+
*
|
|
41
|
+
* `opts.q` (AGF-SHEETS-SEARCH) busca por nombre en Google Drive / Sheets
|
|
42
|
+
* (los demás connectors lo ignoran). Con un grant de Sheets sin
|
|
43
|
+
* `drive.readonly` el resultado trae `limited: true`.
|
|
40
44
|
*/
|
|
41
|
-
async listResources(connectorId) {
|
|
42
|
-
|
|
45
|
+
async listResources(connectorId, opts) {
|
|
46
|
+
const q = opts?.q?.trim();
|
|
47
|
+
return this.client.requestWithApiKey('GET', `/connector-resources/${encodeURIComponent(connectorId)}${q ? `?q=${encodeURIComponent(q)}` : ''}`);
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* `POST /connectors/oauth/:id/authorize-for-tenant` — arranca el OAuth
|
package/dist/types.d.ts
CHANGED
|
@@ -460,6 +460,10 @@ export interface ListConnectorResourcesResult {
|
|
|
460
460
|
* `items` igual trae lo que SÍ se pudo listar (ej. los canales); la UI
|
|
461
461
|
* debe ofrecer un CTA de reconectar en vez de tratarlo como error. */
|
|
462
462
|
needsReconnectForDms?: true;
|
|
463
|
+
/** AGF-SHEETS-SEARCH: el grant de Google no puede listar todo el Drive (sin
|
|
464
|
+
* `drive.readonly`); `items` solo trae archivos que la app ya recibió (creados
|
|
465
|
+
* por ella o elegidos en el selector de Google). Ofrecer el selector o reconectar. */
|
|
466
|
+
limited?: true;
|
|
463
467
|
}
|
|
464
468
|
export interface CreateClickupTaskInput {
|
|
465
469
|
/** Id de la lista de ClickUp (`ConnectorResourceItem.id` del picker). */
|
|
@@ -1248,8 +1252,10 @@ export interface CatalogImportSource {
|
|
|
1248
1252
|
url?: string | null;
|
|
1249
1253
|
columnMapping: CatalogImportColumnMapping;
|
|
1250
1254
|
/** Per-connector extras, e.g. `{ shop: 'acme.myshopify.com' }`. */
|
|
1255
|
+
/** `linked`: a Google Sheet synced both ways with the catalog (AGF-SHEET-LIVE-SOURCE). */
|
|
1251
1256
|
config: {
|
|
1252
1257
|
shop?: string;
|
|
1258
|
+
linked?: boolean;
|
|
1253
1259
|
};
|
|
1254
1260
|
currency?: string | null;
|
|
1255
1261
|
/** Cron string; null = manual only. */
|
|
@@ -1275,6 +1281,7 @@ export interface CreateCatalogImportSourceInput {
|
|
|
1275
1281
|
columnMapping?: CatalogImportColumnMapping;
|
|
1276
1282
|
config?: {
|
|
1277
1283
|
shop?: string;
|
|
1284
|
+
linked?: boolean;
|
|
1278
1285
|
};
|
|
1279
1286
|
currency?: string;
|
|
1280
1287
|
schedule?: string | null;
|
|
@@ -1293,6 +1300,7 @@ export interface UpdateCatalogImportSourceInput {
|
|
|
1293
1300
|
columnMapping?: CatalogImportColumnMapping;
|
|
1294
1301
|
config?: {
|
|
1295
1302
|
shop?: string;
|
|
1303
|
+
linked?: boolean;
|
|
1296
1304
|
};
|
|
1297
1305
|
currency?: string | null;
|
|
1298
1306
|
schedule?: string | null;
|
|
@@ -1598,12 +1606,79 @@ export interface CaseView {
|
|
|
1598
1606
|
key: string;
|
|
1599
1607
|
label: string;
|
|
1600
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;
|
|
1601
1622
|
openedAt: string;
|
|
1602
1623
|
reviewedAt: string | null;
|
|
1603
1624
|
submittedAt: string | null;
|
|
1604
1625
|
closedAt: string | null;
|
|
1605
1626
|
lastActivityAt: string;
|
|
1606
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
|
+
}
|
|
1607
1682
|
export interface ListCasesInput {
|
|
1608
1683
|
state?: CaseState[];
|
|
1609
1684
|
type?: string;
|
|
@@ -1613,7 +1688,7 @@ export interface ListCasesInput {
|
|
|
1613
1688
|
/** 1–200, default 50. */
|
|
1614
1689
|
limit?: number;
|
|
1615
1690
|
}
|
|
1616
|
-
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed';
|
|
1691
|
+
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request';
|
|
1617
1692
|
export interface AppWebhook {
|
|
1618
1693
|
url: string;
|
|
1619
1694
|
events: AppWebhookEventName[];
|
|
@@ -1635,6 +1710,8 @@ export interface AppWebhookEvent {
|
|
|
1635
1710
|
type: string;
|
|
1636
1711
|
state: string;
|
|
1637
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';
|
|
1638
1715
|
by: 'assistant' | 'business' | 'system';
|
|
1639
1716
|
conversationId: string;
|
|
1640
1717
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
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",
|