@agentforge-io/sdk-server 4.19.0 → 4.21.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
@@ -11,6 +11,9 @@ import { TeamsResource } from './resources/teams';
11
11
  import { TemplatesResource } from './resources/templates';
12
12
  import { MarketplaceResource } from './resources/marketplace';
13
13
  import { TenantConfigResource } from './resources/config';
14
+ import { PlacesResource } from './resources/places';
15
+ import { DeliveryResource } from './resources/delivery';
16
+ import { CasesResource } from './resources/cases';
14
17
  import { CatalogResource } from './resources/catalog';
15
18
  import { BusinessRolesResource } from './resources/business-roles';
16
19
  import { ToolsResource } from './resources/tools';
@@ -94,6 +97,10 @@ export declare class AgentForgeClient {
94
97
  readonly templates: TemplatesResource;
95
98
  readonly marketplace: MarketplaceResource;
96
99
  readonly config: TenantConfigResource;
100
+ readonly places: PlacesResource;
101
+ readonly delivery: DeliveryResource;
102
+ /** AGF-CASES — what customers came for in conversations (orders, bookings…). */
103
+ readonly cases: CasesResource;
97
104
  readonly businessRoles: BusinessRolesResource;
98
105
  readonly catalog: CatalogResource;
99
106
  constructor(opts: AgentForgeClientOptions);
package/dist/client.js CHANGED
@@ -33,6 +33,9 @@ const teams_1 = require("./resources/teams");
33
33
  const templates_1 = require("./resources/templates");
34
34
  const marketplace_1 = require("./resources/marketplace");
35
35
  const config_1 = require("./resources/config");
36
+ const places_1 = require("./resources/places");
37
+ const delivery_1 = require("./resources/delivery");
38
+ const cases_1 = require("./resources/cases");
36
39
  const catalog_1 = require("./resources/catalog");
37
40
  const business_roles_1 = require("./resources/business-roles");
38
41
  const tools_1 = require("./resources/tools");
@@ -76,6 +79,9 @@ class AgentForgeClient {
76
79
  this.templates = new templates_1.TemplatesResource(this);
77
80
  this.marketplace = new marketplace_1.MarketplaceResource(this);
78
81
  this.config = new config_1.TenantConfigResource(this);
82
+ this.places = new places_1.PlacesResource(this);
83
+ this.delivery = new delivery_1.DeliveryResource(this);
84
+ this.cases = new cases_1.CasesResource(this);
79
85
  this.businessRoles = new business_roles_1.BusinessRolesResource(this);
80
86
  this.catalog = new catalog_1.CatalogResource(this);
81
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, 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';
@@ -19,6 +19,9 @@ export type { ListTemplatesInput } from './resources/templates';
19
19
  export { MarketplaceResource } from './resources/marketplace';
20
20
  export type { ListMarketplaceCategoriesInput } from './resources/marketplace';
21
21
  export { TenantConfigResource } from './resources/config';
22
+ export { PlacesResource } from './resources/places';
23
+ export { DeliveryResource } from './resources/delivery';
24
+ export { CasesResource } from './resources/cases';
22
25
  export { BusinessRolesResource } from './resources/business-roles';
23
26
  export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
24
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.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; } });
@@ -63,6 +63,12 @@ var marketplace_1 = require("./resources/marketplace");
63
63
  Object.defineProperty(exports, "MarketplaceResource", { enumerable: true, get: function () { return marketplace_1.MarketplaceResource; } });
64
64
  var config_1 = require("./resources/config");
65
65
  Object.defineProperty(exports, "TenantConfigResource", { enumerable: true, get: function () { return config_1.TenantConfigResource; } });
66
+ var places_1 = require("./resources/places");
67
+ Object.defineProperty(exports, "PlacesResource", { enumerable: true, get: function () { return places_1.PlacesResource; } });
68
+ var delivery_1 = require("./resources/delivery");
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; } });
66
72
  var business_roles_1 = require("./resources/business-roles");
67
73
  Object.defineProperty(exports, "BusinessRolesResource", { enumerable: true, get: function () { return business_roles_1.BusinessRolesResource; } });
68
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;
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { TenantConfigEntry } from '../types';
2
+ import type { StructuredConfigEntry, StructuredConfigInput, TenantConfigEntry } from '../types';
3
3
  export declare class TenantConfigResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -8,4 +8,14 @@ export declare class TenantConfigResource {
8
8
  /** `PUT /api/v1/config/:key` — set one variable (created when missing).
9
9
  * 409 when the key is a secret, not a config variable. */
10
10
  set(key: string, value: string): Promise<TenantConfigEntry>;
11
+ /**
12
+ * AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
13
+ * `payments`). The variable of the same key holds their readable text.
14
+ */
15
+ readonly structured: {
16
+ /** `GET /api/v1/config/:key/structured` — null when not set. */
17
+ get: (key: string) => Promise<StructuredConfigEntry | null>;
18
+ /** `PUT /api/v1/config/:key/structured` — validated by type; 400 with the reason otherwise. */
19
+ set: (key: string, input: StructuredConfigInput) => Promise<StructuredConfigEntry>;
20
+ };
11
21
  }
@@ -8,6 +8,25 @@ exports.TenantConfigResource = void 0;
8
8
  class TenantConfigResource {
9
9
  constructor(client) {
10
10
  this.client = client;
11
+ /**
12
+ * AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
13
+ * `payments`). The variable of the same key holds their readable text.
14
+ */
15
+ this.structured = {
16
+ /** `GET /api/v1/config/:key/structured` — null when not set. */
17
+ get: async (key) => {
18
+ try {
19
+ return await this.client.request('GET', `/api/v1/config/${encodeURIComponent(key)}/structured`);
20
+ }
21
+ catch (e) {
22
+ if (e.status === 404)
23
+ return null;
24
+ throw e;
25
+ }
26
+ },
27
+ /** `PUT /api/v1/config/:key/structured` — validated by type; 400 with the reason otherwise. */
28
+ set: (key, input) => this.client.request('PUT', `/api/v1/config/${encodeURIComponent(key)}/structured`, input),
29
+ };
11
30
  }
12
31
  /** `GET /api/v1/config` — config variables that have a value. */
13
32
  async list() {
@@ -0,0 +1,8 @@
1
+ import type { AgentForgeClient } from '../client';
2
+ import type { DeliveryQuote, DeliveryQuoteInput } from '../types';
3
+ export declare class DeliveryResource {
4
+ private readonly client;
5
+ constructor(client: AgentForgeClient);
6
+ /** `POST /api/v1/delivery/quote` — 404 when the workspace has no delivery settings. */
7
+ quote(input: DeliveryQuoteInput): Promise<DeliveryQuote>;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // delivery resource (AGF-PDK-DELIVERY) — quote a delivery to an address with
3
+ // the workspace's delivery settings (`config.structured`, type 'delivery').
4
+ // The same quote the assistant's tool gives, for a host App's "try an address".
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DeliveryResource = void 0;
7
+ class DeliveryResource {
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /** `POST /api/v1/delivery/quote` — 404 when the workspace has no delivery settings. */
12
+ async quote(input) {
13
+ return this.client.request('POST', '/api/v1/delivery/quote', input);
14
+ }
15
+ }
16
+ exports.DeliveryResource = DeliveryResource;
@@ -0,0 +1,12 @@
1
+ import type { AgentForgeClient } from '../client';
2
+ import type { Place, SearchPlacesInput } from '../types';
3
+ export declare class PlacesResource {
4
+ private readonly client;
5
+ constructor(client: AgentForgeClient);
6
+ /** `GET /api/v1/places/search` — places matching a text, for an autocomplete. */
7
+ search(input: SearchPlacesInput): Promise<Place[]>;
8
+ /** `GET /api/v1/places/reverse` — the place at a dropped pin (its coordinates are kept). */
9
+ reverse(lat: number, lng: number, opts?: {
10
+ language?: string;
11
+ }): Promise<Place | null>;
12
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ // places resource (AGF-PDK-DELIVERY) — address search and reverse geocoding
3
+ // for the tenant the client acts in. The maps provider and its key stay on
4
+ // the platform; a host App shows suggestions and confirms a pin.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PlacesResource = void 0;
7
+ class PlacesResource {
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /** `GET /api/v1/places/search` — places matching a text, for an autocomplete. */
12
+ async search(input) {
13
+ const qs = new URLSearchParams({ q: input.q });
14
+ if (input.proximity)
15
+ qs.set('proximity', `${input.proximity.lng},${input.proximity.lat}`);
16
+ if (input.country)
17
+ qs.set('country', input.country);
18
+ if (input.language)
19
+ qs.set('language', input.language);
20
+ if (input.limit !== undefined)
21
+ qs.set('limit', String(input.limit));
22
+ const res = await this.client.request('GET', `/api/v1/places/search?${qs.toString()}`);
23
+ return res.items;
24
+ }
25
+ /** `GET /api/v1/places/reverse` — the place at a dropped pin (its coordinates are kept). */
26
+ async reverse(lat, lng, opts = {}) {
27
+ const qs = new URLSearchParams({ lat: String(lat), lng: String(lng) });
28
+ if (opts.language)
29
+ qs.set('language', opts.language);
30
+ const res = await this.client.request('GET', `/api/v1/places/reverse?${qs.toString()}`);
31
+ return res.place;
32
+ }
33
+ }
34
+ exports.PlacesResource = PlacesResource;
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 {
@@ -825,7 +831,9 @@ export interface TemplateConfigField {
825
831
  key: string;
826
832
  label: string;
827
833
  help?: string;
828
- /** 'text' | 'textarea' | 'hours' | 'address' | 'url' | 'phone' | … */
834
+ /** 'text' | 'longtext' | 'phone' | 'address' | 'url' | 'google_sheet' | 'drive_file' | 'hours'
835
+ * | 'delivery' | 'payments' (AGF-PDK-DELIVERY: `address`, `delivery` and `payments` hold
836
+ * structured values — `config.structured`; the variable keeps their readable text). */
829
837
  type: string;
830
838
  required: boolean;
831
839
  /** Resource picker for connector-backed fields (e.g. a Google Sheet). */
@@ -1376,4 +1384,216 @@ export type GoogleSheetsPickerResult = {
1376
1384
  ok: false;
1377
1385
  error: GoogleSheetsPickerErrorCode | (string & {});
1378
1386
  };
1387
+ /** A place as the platform returns it (`places.search` / `places.reverse`). */
1388
+ export interface Place {
1389
+ formatted: string;
1390
+ lat: number;
1391
+ lng: number;
1392
+ placeId?: string;
1393
+ components?: {
1394
+ country?: string;
1395
+ region?: string;
1396
+ city?: string;
1397
+ postcode?: string;
1398
+ };
1399
+ /** 0–1: how sure the provider is. */
1400
+ relevance?: number;
1401
+ }
1402
+ export interface SearchPlacesInput {
1403
+ /** 3–200 characters. */
1404
+ q: string;
1405
+ /** Results near this point first. */
1406
+ proximity?: {
1407
+ lat: number;
1408
+ lng: number;
1409
+ };
1410
+ /** ISO 3166-1 alpha-2 ("co"). */
1411
+ country?: string;
1412
+ language?: string;
1413
+ /** 1–10, default 5. */
1414
+ limit?: number;
1415
+ }
1416
+ /** A geocoded address: a confirmed pin, never static text. */
1417
+ export interface AddressValue {
1418
+ formatted: string;
1419
+ lat: number;
1420
+ lng: number;
1421
+ placeId?: string;
1422
+ components?: Place['components'];
1423
+ notes?: string;
1424
+ }
1425
+ export type DeliveryLocalPricing = {
1426
+ kind: 'fixed';
1427
+ amount: number;
1428
+ } | {
1429
+ kind: 'distance';
1430
+ base: number;
1431
+ perKm: number;
1432
+ roundTo?: number;
1433
+ };
1434
+ /** Delivery coverage and prices (SDD AGF-PDK-DELIVERY §3.2). */
1435
+ export interface DeliverySettings {
1436
+ /** ISO 4217 ("COP"). */
1437
+ currency: string;
1438
+ locale?: 'es' | 'en';
1439
+ pickup: {
1440
+ enabled: boolean;
1441
+ };
1442
+ local: {
1443
+ enabled: boolean;
1444
+ /** The `address` field distances are measured from (usually BUSINESS_ADDRESS). */
1445
+ originKey: string;
1446
+ /** Free up to here; null = never free. */
1447
+ freeRadiusKm: number | null;
1448
+ /** No coverage beyond here. */
1449
+ maxRadiusKm: number;
1450
+ pricing: DeliveryLocalPricing;
1451
+ minOrder?: number;
1452
+ etaText?: string;
1453
+ };
1454
+ national: {
1455
+ enabled: boolean;
1456
+ pricing: {
1457
+ kind: 'flat';
1458
+ amount: number;
1459
+ } | {
1460
+ kind: 'quote';
1461
+ };
1462
+ etaText?: string;
1463
+ };
1464
+ }
1465
+ export type PaymentMethodKind = 'cash' | 'bank_transfer' | 'card_on_delivery' | 'payment_link' | 'card_in_store' | 'other';
1466
+ export interface PaymentSettings {
1467
+ locale?: 'es' | 'en';
1468
+ methods: Array<{
1469
+ kind: PaymentMethodKind;
1470
+ label?: string;
1471
+ notes?: string;
1472
+ }>;
1473
+ notes?: string;
1474
+ }
1475
+ export type StructuredConfigInput = {
1476
+ type: 'address';
1477
+ value: AddressValue;
1478
+ } | {
1479
+ type: 'delivery';
1480
+ value: DeliverySettings;
1481
+ } | {
1482
+ type: 'payments';
1483
+ value: PaymentSettings;
1484
+ };
1485
+ export type StructuredConfigEntry = StructuredConfigInput & {
1486
+ key: string;
1487
+ /** The readable text the `{{config:KEY}}` variable now holds. */
1488
+ text: string;
1489
+ updatedAt: string;
1490
+ };
1491
+ export type DeliveryQuoteStatus = 'free' | 'paid' | 'national' | 'pickup_only' | 'out_of_coverage' | 'no_delivery' | 'needs_confirmation';
1492
+ export interface DeliveryQuoteInput {
1493
+ /** What the customer typed… */
1494
+ address?: string;
1495
+ /** …or a point (a shared location). */
1496
+ lat?: number;
1497
+ lng?: number;
1498
+ /** The delivery settings to use; omitted = the workspace's only one. */
1499
+ deliveryKey?: string;
1500
+ language?: string;
1501
+ }
1502
+ export interface DeliveryQuote {
1503
+ status: DeliveryQuoteStatus;
1504
+ address?: {
1505
+ formatted: string;
1506
+ lat: number;
1507
+ lng: number;
1508
+ };
1509
+ /** `needs_confirmation`: up to three places to choose from. */
1510
+ candidates?: Array<{
1511
+ formatted: string;
1512
+ lat: number;
1513
+ lng: number;
1514
+ }>;
1515
+ distanceKm?: number;
1516
+ price?: number;
1517
+ currency: string;
1518
+ etaText?: string;
1519
+ /** One line in the business's language, to relay as is. */
1520
+ summary: string;
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. */
1580
+ nextStates: Array<{
1581
+ key: string;
1582
+ label: string;
1583
+ }>;
1584
+ openedAt: string;
1585
+ reviewedAt: string | null;
1586
+ submittedAt: string | null;
1587
+ closedAt: string | null;
1588
+ lastActivityAt: string;
1589
+ }
1590
+ export interface ListCasesInput {
1591
+ state?: CaseState[];
1592
+ type?: string;
1593
+ conversationId?: string;
1594
+ /** Only cases active after this moment (ISO string or Date): poll for what changed. */
1595
+ since?: string | Date;
1596
+ /** 1–200, default 50. */
1597
+ limit?: number;
1598
+ }
1379
1599
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.19.0",
3
+ "version": "4.21.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",