@agentforge-io/sdk-server 4.20.0 → 4.22.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/client.d.ts CHANGED
@@ -13,6 +13,7 @@ import { MarketplaceResource } from './resources/marketplace';
13
13
  import { TenantConfigResource } from './resources/config';
14
14
  import { PlacesResource } from './resources/places';
15
15
  import { DeliveryResource } from './resources/delivery';
16
+ import { CasesResource } from './resources/cases';
16
17
  import { CatalogResource } from './resources/catalog';
17
18
  import { BusinessRolesResource } from './resources/business-roles';
18
19
  import { ToolsResource } from './resources/tools';
@@ -98,6 +99,8 @@ export declare class AgentForgeClient {
98
99
  readonly config: TenantConfigResource;
99
100
  readonly places: PlacesResource;
100
101
  readonly delivery: DeliveryResource;
102
+ /** AGF-CASES — what customers came for in conversations (orders, bookings…). */
103
+ readonly cases: CasesResource;
101
104
  readonly businessRoles: BusinessRolesResource;
102
105
  readonly catalog: CatalogResource;
103
106
  constructor(opts: AgentForgeClientOptions);
package/dist/client.js CHANGED
@@ -35,6 +35,7 @@ const marketplace_1 = require("./resources/marketplace");
35
35
  const config_1 = require("./resources/config");
36
36
  const places_1 = require("./resources/places");
37
37
  const delivery_1 = require("./resources/delivery");
38
+ const cases_1 = require("./resources/cases");
38
39
  const catalog_1 = require("./resources/catalog");
39
40
  const business_roles_1 = require("./resources/business-roles");
40
41
  const tools_1 = require("./resources/tools");
@@ -80,6 +81,7 @@ class AgentForgeClient {
80
81
  this.config = new config_1.TenantConfigResource(this);
81
82
  this.places = new places_1.PlacesResource(this);
82
83
  this.delivery = new delivery_1.DeliveryResource(this);
84
+ this.cases = new cases_1.CasesResource(this);
83
85
  this.businessRoles = new business_roles_1.BusinessRolesResource(this);
84
86
  this.catalog = new catalog_1.CatalogResource(this);
85
87
  }
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { AgentForgeClient, INSTALLED_TENANT_HEADER } from './client';
2
2
  export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyToolCallbackSignature, } from './webhooks';
5
- export type { 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, 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';
5
+ export type { 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
6
  export { AgentsResource } from './resources/agents';
7
7
  export { AnalyticsResource } from './resources/analytics';
8
8
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -21,6 +21,7 @@ export type { ListMarketplaceCategoriesInput } from './resources/marketplace';
21
21
  export { TenantConfigResource } from './resources/config';
22
22
  export { PlacesResource } from './resources/places';
23
23
  export { DeliveryResource } from './resources/delivery';
24
+ export { CasesResource } from './resources/cases';
24
25
  export { BusinessRolesResource } from './resources/business-roles';
25
26
  export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
26
27
  export type { ListThreadsOptions, SendMessageInput, AssignThreadInput, UnassignThreadInput, SetThreadModeInput, CloseThreadInput, } from './resources/inbox';
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@
28
28
  // const payload = af.tools.verifyCallback({ rawBody, signatureHeader, secretPlaintext });
29
29
  // await af.tools.respondToCallback({ resultUrl: payload.resultUrl, tenantId: payload.tenantId, secret, result });
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.DeliveryResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.verifyToolCallbackSignature = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
31
+ exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.CasesResource = exports.DeliveryResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.verifyToolCallbackSignature = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
32
32
  var client_1 = require("./client");
33
33
  Object.defineProperty(exports, "AgentForgeClient", { enumerable: true, get: function () { return client_1.AgentForgeClient; } });
34
34
  Object.defineProperty(exports, "INSTALLED_TENANT_HEADER", { enumerable: true, get: function () { return client_1.INSTALLED_TENANT_HEADER; } });
@@ -67,6 +67,8 @@ var places_1 = require("./resources/places");
67
67
  Object.defineProperty(exports, "PlacesResource", { enumerable: true, get: function () { return places_1.PlacesResource; } });
68
68
  var delivery_1 = require("./resources/delivery");
69
69
  Object.defineProperty(exports, "DeliveryResource", { enumerable: true, get: function () { return delivery_1.DeliveryResource; } });
70
+ var cases_1 = require("./resources/cases");
71
+ Object.defineProperty(exports, "CasesResource", { enumerable: true, get: function () { return cases_1.CasesResource; } });
70
72
  var business_roles_1 = require("./resources/business-roles");
71
73
  Object.defineProperty(exports, "BusinessRolesResource", { enumerable: true, get: function () { return business_roles_1.BusinessRolesResource; } });
72
74
  var catalog_1 = require("./resources/catalog");
@@ -0,0 +1,18 @@
1
+ import type { AgentForgeClient } from '../client';
2
+ import type { CaseState, CaseView, ListCasesInput } from '../types';
3
+ export declare class CasesResource {
4
+ private readonly client;
5
+ constructor(client: AgentForgeClient);
6
+ /** `GET /api/v1/cases` — most recently active first. */
7
+ list(input?: ListCasesInput): Promise<CaseView[]>;
8
+ /** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
9
+ get(caseId: string): Promise<CaseView>;
10
+ /**
11
+ * `POST /api/v1/cases/:id/transition` — the business moves a case:
12
+ * `accepted` / `rejected` from `submitted`, then the type's states,
13
+ * `completed` or `cancelled`. 400 (with the allowed states) otherwise.
14
+ */
15
+ transition(caseId: string, state: CaseState, opts?: {
16
+ note?: string;
17
+ }): Promise<CaseView>;
18
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // cases resource (AGF-CASES) — what customers came for inside conversations:
3
+ // orders, bookings, complaints… The team's assistants open, fill and submit
4
+ // them; the host App lists them ("Solicitudes") and moves them through the
5
+ // business states of their type.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.CasesResource = void 0;
8
+ class CasesResource {
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /** `GET /api/v1/cases` — most recently active first. */
13
+ async list(input = {}) {
14
+ const qs = new URLSearchParams();
15
+ if (input.state?.length)
16
+ qs.set('state', input.state.join(','));
17
+ if (input.type)
18
+ qs.set('type', input.type);
19
+ if (input.conversationId)
20
+ qs.set('conversationId', input.conversationId);
21
+ if (input.since)
22
+ qs.set('since', input.since instanceof Date ? input.since.toISOString() : input.since);
23
+ if (input.limit !== undefined)
24
+ qs.set('limit', String(input.limit));
25
+ const q = qs.toString();
26
+ return (await this.client.request('GET', `/api/v1/cases${q ? `?${q}` : ''}`)).items;
27
+ }
28
+ /** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
29
+ async get(caseId) {
30
+ return this.client.request('GET', `/api/v1/cases/${encodeURIComponent(caseId)}`);
31
+ }
32
+ /**
33
+ * `POST /api/v1/cases/:id/transition` — the business moves a case:
34
+ * `accepted` / `rejected` from `submitted`, then the type's states,
35
+ * `completed` or `cancelled`. 400 (with the allowed states) otherwise.
36
+ */
37
+ async transition(caseId, state, opts = {}) {
38
+ return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/transition`, {
39
+ state,
40
+ ...(opts.note ? { note: opts.note } : {}),
41
+ });
42
+ }
43
+ }
44
+ exports.CasesResource = CasesResource;
package/dist/types.d.ts CHANGED
@@ -678,6 +678,8 @@ export interface TeamSummary {
678
678
  visibility: 'private' | 'public';
679
679
  orchestratorAgentId: string;
680
680
  orchestrationMode: 'flat' | 'hierarchical';
681
+ /** AGF-CASES. What customers come for in the team's conversations. */
682
+ caseTypes?: CaseType[];
681
683
  [field: string]: unknown;
682
684
  }
683
685
  /** `PATCH /api/v1/teams/:id` body — only the fields sent change. */
@@ -705,6 +707,10 @@ export interface UpdateTeamInput {
705
707
  * sorted, overlapping ones merged. `null` clears it (always open). An
706
708
  * empty `schedule` is a 400 — send `null` instead. */
707
709
  businessHours?: TeamBusinessHours | null;
710
+ /** AGF-CASES. What customers come for (an order, a booking…): the team's
711
+ * assistants open, fill and submit cases of these types. Validated by the
712
+ * platform; `null` or `[]` clears them (no cases). */
713
+ caseTypes?: CaseType[] | null;
708
714
  }
709
715
  /** A team's weekly opening hours (AGF-HOURS). */
710
716
  export interface TeamBusinessHours {
@@ -1513,4 +1519,93 @@ export interface DeliveryQuote {
1513
1519
  /** One line in the business's language, to relay as is. */
1514
1520
  summary: string;
1515
1521
  }
1522
+ /** A field the assistant collects for a case. Keys are lower_snake. */
1523
+ export interface CaseField {
1524
+ key: string;
1525
+ label: string;
1526
+ required: boolean;
1527
+ /** For the model: what to ask, in what form. */
1528
+ hint?: string;
1529
+ }
1530
+ /** A state the business moves an accepted case through ("preparing", "on_the_way"). */
1531
+ export interface CaseBusinessState {
1532
+ key: string;
1533
+ label: string;
1534
+ /** Said to the customer when the business moves the case here. */
1535
+ notifyCustomer?: string;
1536
+ }
1537
+ /** One kind of case a team handles (declared by its template). */
1538
+ export interface CaseType {
1539
+ key: string;
1540
+ label: string;
1541
+ /** Team member slug that handles it. */
1542
+ member?: string;
1543
+ /** One sentence for the model: what done looks like. */
1544
+ goal: string;
1545
+ collect: CaseField[];
1546
+ /** Tools this case may use besides the case tools. */
1547
+ tools?: string[];
1548
+ /** Business states after `accepted`, in order. */
1549
+ states?: CaseBusinessState[];
1550
+ /** false: the case completes when the customer confirms (nothing for the business to act on). Default true. */
1551
+ needsBusiness?: boolean;
1552
+ /** Minutes without a customer message before an unfinished case is abandoned. Default 120. */
1553
+ abandonAfterMinutes?: number;
1554
+ }
1555
+ /**
1556
+ * Lifecycle: `open` → `review` (the customer confirms the summary) →
1557
+ * `submitted` (with the business) → `accepted` → the type's business states →
1558
+ * `completed` | `cancelled` | `rejected` | `abandoned`.
1559
+ */
1560
+ export type CaseState = 'open' | 'review' | 'submitted' | 'accepted' | 'completed' | 'cancelled' | 'rejected' | 'abandoned' | (string & {});
1561
+ export interface CaseView {
1562
+ id: string;
1563
+ /** Per workspace, human-friendly ("Pedido #128"). */
1564
+ number: number;
1565
+ conversationId: string;
1566
+ teamId: string | null;
1567
+ type: string;
1568
+ typeLabel: string;
1569
+ state: CaseState;
1570
+ stateLabel: string;
1571
+ /** What the assistant collected, by field key. */
1572
+ data: Record<string, unknown>;
1573
+ /** What the customer confirmed (written at review). */
1574
+ summary: string | null;
1575
+ /** Last transition note (why it was rejected or cancelled…). */
1576
+ note: string | null;
1577
+ /** The conversation's user (app user id, phone…), when known. */
1578
+ customerRef: string | null;
1579
+ /** States the business can move it to now, each with what the customer is
1580
+ * told when it moves there (AGF-CASES C3; absent when nothing is said). */
1581
+ nextStates: Array<{
1582
+ key: string;
1583
+ label: string;
1584
+ notifyCustomer?: string;
1585
+ }>;
1586
+ /** The collected data as the business reads it, labeled, in the type's order. */
1587
+ fields: Array<{
1588
+ key: string;
1589
+ label: string;
1590
+ value: string;
1591
+ }>;
1592
+ /** The inbox thread that carries the conversation (open the chat with it), when there is one. */
1593
+ threadId: string | null;
1594
+ /** The customer's name on that thread, when known. */
1595
+ customerName: string | null;
1596
+ openedAt: string;
1597
+ reviewedAt: string | null;
1598
+ submittedAt: string | null;
1599
+ closedAt: string | null;
1600
+ lastActivityAt: string;
1601
+ }
1602
+ export interface ListCasesInput {
1603
+ state?: CaseState[];
1604
+ type?: string;
1605
+ conversationId?: string;
1606
+ /** Only cases active after this moment (ISO string or Date): poll for what changed. */
1607
+ since?: string | Date;
1608
+ /** 1–200, default 50. */
1609
+ limit?: number;
1610
+ }
1516
1611
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.20.0",
3
+ "version": "4.22.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",