@agentforge-io/sdk-server 4.71.0 → 4.73.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/errors.d.ts +5 -0
- package/dist/errors.js +4 -3
- package/dist/index.d.ts +1 -1
- package/dist/resources/cases.d.ts +0 -4
- package/dist/resources/cases.js +0 -4
- package/dist/resources/catalog.d.ts +3 -3
- package/dist/resources/catalog.js +4 -3
- package/dist/resources/templates.d.ts +9 -1
- package/dist/resources/templates.js +8 -0
- package/dist/types.d.ts +91 -60
- package/package.json +1 -1
package/dist/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TemplatePublishIssue } from './types';
|
|
1
2
|
export declare class AgentForgeError extends Error {
|
|
2
3
|
readonly status: number;
|
|
3
4
|
readonly body?: string;
|
|
@@ -15,6 +16,10 @@ export declare class AgentForgeError extends Error {
|
|
|
15
16
|
/** PDK-CONSOLE. `issues` of the response body (publication-issue shape) when
|
|
16
17
|
* present, e.g. on `publisher_policy_violation`. */
|
|
17
18
|
readonly issues?: unknown[];
|
|
19
|
+
/** PDK-PILLARS. `errors` / `warnings` of the response body when present (e.g. 400
|
|
20
|
+
* `template_not_publishable`). Same shape as `TemplatePublishIssue`. */
|
|
21
|
+
readonly errors?: TemplatePublishIssue[];
|
|
22
|
+
readonly warnings?: TemplatePublishIssue[];
|
|
18
23
|
constructor(status: number, message: string, body?: string, code?: string);
|
|
19
24
|
}
|
|
20
25
|
export declare class AgentForgeAuthError extends AgentForgeError {
|
package/dist/errors.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Errores tipados que el SDK lanza. Las apps cliente pueden hacer
|
|
3
|
-
// `instanceof AgentForgeAuthError` para distinguir 401/403 de otros fallos.
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.AgentForgeNetworkError = exports.AgentForgeBillingError = exports.AGENTFORGE_BILLING_ERROR_CODES = exports.AgentForgeDuplicateContactError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = void 0;
|
|
6
4
|
class AgentForgeError extends Error {
|
|
@@ -14,6 +12,8 @@ class AgentForgeError extends Error {
|
|
|
14
12
|
this.code = code ?? parseErrorCode(body) ?? extra.reason;
|
|
15
13
|
this.reason = extra.reason;
|
|
16
14
|
this.issues = extra.issues;
|
|
15
|
+
this.errors = extra.errors;
|
|
16
|
+
this.warnings = extra.warnings;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.AgentForgeError = AgentForgeError;
|
|
@@ -26,7 +26,8 @@ function parseReasonAndIssues(body) {
|
|
|
26
26
|
const inner = parsed.message && typeof parsed.message === 'object' ? parsed.message : undefined;
|
|
27
27
|
const reason = typeof parsed.reason === 'string' ? parsed.reason : typeof inner?.reason === 'string' ? inner.reason : undefined;
|
|
28
28
|
const issues = Array.isArray(parsed.issues) ? parsed.issues : Array.isArray(inner?.issues) ? inner.issues : undefined;
|
|
29
|
-
|
|
29
|
+
const pick = (k) => (Array.isArray(parsed[k]) ? parsed[k] : Array.isArray(inner?.[k]) ? inner?.[k] : undefined);
|
|
30
|
+
return { reason, issues, errors: pick('errors'), warnings: pick('warnings') };
|
|
30
31
|
}
|
|
31
32
|
catch {
|
|
32
33
|
return {};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { BillingResource } from './resources/billing';
|
|
|
6
6
|
export type { BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
|
|
7
7
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
8
8
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
9
|
-
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, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput,
|
|
9
|
+
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, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, CheckSystemTemplateResult, TemplatePublishIssue, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, 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';
|
|
10
10
|
export { AgentsResource } from './resources/agents';
|
|
11
11
|
export { AnalyticsResource } from './resources/analytics';
|
|
12
12
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -135,10 +135,6 @@ export declare class CasesResource {
|
|
|
135
135
|
* assistant cannot answer). Created already sent: units held, receipt issued,
|
|
136
136
|
* `case.submitted` fired — the business sees it in its requests like any other.
|
|
137
137
|
* 400 for a bad order or missing fields, 409 when a product lacks stock.
|
|
138
|
-
*
|
|
139
|
-
* PDK-ORDER-INVITE — with `CreateOpenOrderInput` (`origin: { channel: 'link', place: 'open-order' }` +
|
|
140
|
-
* `freeLines` + `totalCents` + `state: 'confirmed'`) it creates an open order instead: free-text lines,
|
|
141
|
-
* the typed total, born `confirmed`, no stock holds.
|
|
142
138
|
*/
|
|
143
139
|
createDirect(input: CreateDirectOrderInput | CreateOpenOrderInput): Promise<CaseView>;
|
|
144
140
|
/**
|
package/dist/resources/cases.js
CHANGED
|
@@ -194,10 +194,6 @@ class CasesResource {
|
|
|
194
194
|
* assistant cannot answer). Created already sent: units held, receipt issued,
|
|
195
195
|
* `case.submitted` fired — the business sees it in its requests like any other.
|
|
196
196
|
* 400 for a bad order or missing fields, 409 when a product lacks stock.
|
|
197
|
-
*
|
|
198
|
-
* PDK-ORDER-INVITE — with `CreateOpenOrderInput` (`origin: { channel: 'link', place: 'open-order' }` +
|
|
199
|
-
* `freeLines` + `totalCents` + `state: 'confirmed'`) it creates an open order instead: free-text lines,
|
|
200
|
-
* the typed total, born `confirmed`, no stock holds.
|
|
201
197
|
*/
|
|
202
198
|
async createDirect(input) {
|
|
203
199
|
return this.client.request('POST', '/api/v1/cases/direct', input);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
2
|
import { AgentForgeError } from '../errors';
|
|
3
|
-
import type { AttachCatalogCategoryImageInput, AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, CatalogUnit, SaveCatalogUnitInput, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, HideProductReviewInput, ListProductReviewsForOwnerInput, ListProductReviewsInput, ProductLikeResult, ProductReviewOwner, ProductReviewsOwnerPage, ProductReviewsPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
|
|
3
|
+
import type { AttachCatalogCategoryImageInput, AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, CatalogUnit, SaveCatalogUnitInput, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, HideProductReviewInput, ListProductReviewsForOwnerInput, ListProductReviewsInput, ProductLikeResult, ProductReviewOwner, ProductReviewsOwnerPage, ProductReviewsPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
|
|
4
4
|
/** Max structured items per `import.preview/apply` call (platform cap). */
|
|
5
5
|
export declare const CATALOG_IMPORT_MAX_ITEMS = 200;
|
|
6
6
|
/** Thrown client-side, before any request, when `items` exceeds the cap. */
|
|
@@ -11,8 +11,8 @@ export declare class AgentForgeCatalogImportLimitError extends AgentForgeError {
|
|
|
11
11
|
export declare class CatalogCategoriesResource {
|
|
12
12
|
private readonly client;
|
|
13
13
|
constructor(client: AgentForgeClient);
|
|
14
|
-
/** `GET /categories` — ordered by `sortOrder`. */
|
|
15
|
-
list(): Promise<CatalogCategory[]>;
|
|
14
|
+
/** `GET /categories` — ordered by `sortOrder`. `{ kind }` returns that kind plus the kind-less (legacy) categories. */
|
|
15
|
+
list(input?: ListCatalogCategoriesInput): Promise<CatalogCategory[]>;
|
|
16
16
|
/** `POST /categories` */
|
|
17
17
|
create(input: CreateCatalogCategoryInput): Promise<CatalogCategory>;
|
|
18
18
|
/** `PATCH /categories/:id` */
|
|
@@ -58,9 +58,10 @@ class CatalogCategoriesResource {
|
|
|
58
58
|
constructor(client) {
|
|
59
59
|
this.client = client;
|
|
60
60
|
}
|
|
61
|
-
/** `GET /categories` — ordered by `sortOrder`. */
|
|
62
|
-
async list() {
|
|
63
|
-
|
|
61
|
+
/** `GET /categories` — ordered by `sortOrder`. `{ kind }` returns that kind plus the kind-less (legacy) categories. */
|
|
62
|
+
async list(input = {}) {
|
|
63
|
+
const q = input.kind ? `?kind=${encodeURIComponent(input.kind)}` : '';
|
|
64
|
+
return this.client.request('GET', `${BASE}/categories${q}`, undefined, TENANT_AUTH);
|
|
64
65
|
}
|
|
65
66
|
/** `POST /categories` */
|
|
66
67
|
async create(input) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CreateTemplateReportInput, UpsertSystemTemplateInput, UpsertSystemTemplateResult, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateDetail, TemplateInstallResult, TemplateReview, TemplateReviewsPage, TemplateSummary } from '../types';
|
|
2
|
+
import type { CheckSystemTemplateResult, CreateTemplateReportInput, UpsertSystemTemplateInput, UpsertSystemTemplateResult, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateDetail, TemplateInstallResult, TemplateReview, TemplateReviewsPage, TemplateSummary } from '../types';
|
|
3
3
|
export interface ListTemplatesInput {
|
|
4
4
|
kind?: 'agent' | 'team';
|
|
5
5
|
/** Every tag must match (AND), e.g. ['type:food']. */
|
|
@@ -55,6 +55,14 @@ export declare class TemplatesResource {
|
|
|
55
55
|
* });
|
|
56
56
|
*/
|
|
57
57
|
upsertSystem(slug: string, input: UpsertSystemTemplateInput): Promise<UpsertSystemTemplateResult>;
|
|
58
|
+
/**
|
|
59
|
+
* PDK-PILLARS — `POST /api/v1/templates/system/:slug/check[?strict=true]`: runs the publish
|
|
60
|
+
* gate on a definition without writing anything. `strict` promotes warnings to errors.
|
|
61
|
+
* Same body and auth as `upsertSystem`.
|
|
62
|
+
*/
|
|
63
|
+
checkSystem(slug: string, input: UpsertSystemTemplateInput, opts?: {
|
|
64
|
+
strict?: boolean;
|
|
65
|
+
}): Promise<CheckSystemTemplateResult>;
|
|
58
66
|
/** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
|
|
59
67
|
get(templateId: string): Promise<TemplateDetail>;
|
|
60
68
|
/** `POST /api/v1/templates/:id/install` — clone into the caller's tenant. */
|
|
@@ -74,6 +74,14 @@ class TemplatesResource {
|
|
|
74
74
|
async upsertSystem(slug, input) {
|
|
75
75
|
return this.client.request('PUT', `/api/v1/templates/system/${encodeURIComponent(slug)}`, input);
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* PDK-PILLARS — `POST /api/v1/templates/system/:slug/check[?strict=true]`: runs the publish
|
|
79
|
+
* gate on a definition without writing anything. `strict` promotes warnings to errors.
|
|
80
|
+
* Same body and auth as `upsertSystem`.
|
|
81
|
+
*/
|
|
82
|
+
async checkSystem(slug, input, opts = {}) {
|
|
83
|
+
return this.client.request('POST', `/api/v1/templates/system/${encodeURIComponent(slug)}/check${opts.strict ? '?strict=true' : ''}`, input);
|
|
84
|
+
}
|
|
77
85
|
/** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
|
|
78
86
|
async get(templateId) {
|
|
79
87
|
return this.client.request('GET', `/api/v1/templates/${encodeURIComponent(templateId)}`);
|
package/dist/types.d.ts
CHANGED
|
@@ -1037,6 +1037,12 @@ export interface TemplateSummary {
|
|
|
1037
1037
|
createdAt: string;
|
|
1038
1038
|
updatedAt: string;
|
|
1039
1039
|
[field: string]: unknown;
|
|
1040
|
+
/**
|
|
1041
|
+
* PDK-TEMPLATE-PROFILE. The opaque JSON object the CALLING App stored on this template
|
|
1042
|
+
* (`templates.appProfile` in the console), as of the published version. `null` when none,
|
|
1043
|
+
* or when the key is not an App's (`sk_live_`). Other Apps' blobs are never returned.
|
|
1044
|
+
*/
|
|
1045
|
+
appProfile?: Record<string, unknown> | null;
|
|
1040
1046
|
}
|
|
1041
1047
|
/**
|
|
1042
1048
|
* AGF-PDK-SUPERADMIN — `templates.upsertSystem` input: the definition of a
|
|
@@ -1064,6 +1070,34 @@ export interface UpsertSystemTemplateInput {
|
|
|
1064
1070
|
configSchema?: TemplateConfigField[];
|
|
1065
1071
|
/** Force "sells from the catalog" on; omitted = derived from the payload. */
|
|
1066
1072
|
usesCatalog?: boolean;
|
|
1073
|
+
/** PDK-PILLARS. Default `false` (unlisted). `true` lists the template in the marketplace
|
|
1074
|
+
* once it passes the publish gate (see `templates.checkSystem`). */
|
|
1075
|
+
listed?: boolean;
|
|
1076
|
+
/** PDK-PILLARS. Only `'tenant'`; `'public'` is rejected with 400. */
|
|
1077
|
+
visibility?: 'tenant';
|
|
1078
|
+
/** PDK-PILLARS. https URL on an allowed host. Omitted = unchanged, `null` = clear. */
|
|
1079
|
+
logoUrl?: string | null;
|
|
1080
|
+
/** PDK-PILLARS. Same rules as `logoUrl`. */
|
|
1081
|
+
coverUrl?: string | null;
|
|
1082
|
+
/** PDK-PILLARS. Omitted = unchanged, `null` = clear. */
|
|
1083
|
+
locale?: 'es' | 'en' | null;
|
|
1084
|
+
/** PDK-PILLARS. Template guide in Markdown. Omitted = unchanged, `null` = clear. */
|
|
1085
|
+
guideMd?: string | null;
|
|
1086
|
+
/** PDK-PILLARS. 1-3 category slugs; the first is the primary one. */
|
|
1087
|
+
categories?: string[];
|
|
1088
|
+
}
|
|
1089
|
+
/** PDK-PILLARS. One finding of the publish gate. */
|
|
1090
|
+
export interface TemplatePublishIssue {
|
|
1091
|
+
source: 'completeness' | 'hilo' | 'listing';
|
|
1092
|
+
code: string;
|
|
1093
|
+
reason: string;
|
|
1094
|
+
ref?: string;
|
|
1095
|
+
}
|
|
1096
|
+
/** PDK-PILLARS. `templates.checkSystem` result (nothing is written). */
|
|
1097
|
+
export interface CheckSystemTemplateResult {
|
|
1098
|
+
ok: boolean;
|
|
1099
|
+
errors: TemplatePublishIssue[];
|
|
1100
|
+
warnings: TemplatePublishIssue[];
|
|
1067
1101
|
}
|
|
1068
1102
|
/** `created`: new template (v1). `updated`: a new version was published, or
|
|
1069
1103
|
* display fields changed (compare `template.currentVersion`). `unchanged`:
|
|
@@ -1071,6 +1105,8 @@ export interface UpsertSystemTemplateInput {
|
|
|
1071
1105
|
export interface UpsertSystemTemplateResult {
|
|
1072
1106
|
action: 'created' | 'updated' | 'unchanged';
|
|
1073
1107
|
template: TemplateDetail;
|
|
1108
|
+
/** PDK-PILLARS. Non-blocking findings of the publish gate. */
|
|
1109
|
+
warnings: TemplatePublishIssue[];
|
|
1074
1110
|
}
|
|
1075
1111
|
/** `GET /api/v1/templates/:id` — summary + the snapshot it installs. */
|
|
1076
1112
|
export interface TemplateDetail extends TemplateSummary {
|
|
@@ -1274,6 +1310,10 @@ export interface CatalogCategory {
|
|
|
1274
1310
|
/** Storage key backing `imageUrl` (`null` when none). Informational —
|
|
1275
1311
|
* the platform uses it to reclaim the object on replace/remove/delete. */
|
|
1276
1312
|
imageKey: string | null;
|
|
1313
|
+
/** Which kind of item the category groups: `'product'`, `'service'`, or `null`
|
|
1314
|
+
* (legacy / both). Optional on the type so older platform responses still fit;
|
|
1315
|
+
* the platform always returns it (`null` for categories created before it existed). */
|
|
1316
|
+
kind?: CatalogProductKind | null;
|
|
1277
1317
|
createdAt: string;
|
|
1278
1318
|
updatedAt: string;
|
|
1279
1319
|
}
|
|
@@ -1281,10 +1321,18 @@ export interface CreateCatalogCategoryInput {
|
|
|
1281
1321
|
name: string;
|
|
1282
1322
|
/** Derived from `name` when omitted. */
|
|
1283
1323
|
slug?: string;
|
|
1324
|
+
/** `'product' | 'service'`; omitted / `null` = both (legacy). Anything else is 400 `INVALID_KIND`. */
|
|
1325
|
+
kind?: CatalogProductKind | null;
|
|
1284
1326
|
}
|
|
1285
1327
|
export interface UpdateCatalogCategoryInput {
|
|
1286
1328
|
name?: string;
|
|
1287
1329
|
slug?: string;
|
|
1330
|
+
/** Set the kind, or `null` to clear it (applies to both). Omitted = unchanged. 400 `INVALID_KIND` otherwise. */
|
|
1331
|
+
kind?: CatalogProductKind | null;
|
|
1332
|
+
}
|
|
1333
|
+
export interface ListCatalogCategoriesInput {
|
|
1334
|
+
/** Only categories of this kind **plus** the kind-less (legacy) ones. Omitted = all. */
|
|
1335
|
+
kind?: CatalogProductKind;
|
|
1288
1336
|
}
|
|
1289
1337
|
export interface CatalogProductPhoto {
|
|
1290
1338
|
url: string;
|
|
@@ -2102,21 +2150,12 @@ export interface DeliverySettings {
|
|
|
2102
2150
|
export type PaymentMethodKind = 'cash' | 'bank_transfer' | 'card_on_delivery' | 'payment_link' | 'card_in_store' | 'other';
|
|
2103
2151
|
/** AGF-PAYMENT-ACCOUNTS — countries with a payment catalog. */
|
|
2104
2152
|
export type PaymentCountry = 'CO';
|
|
2105
|
-
/**
|
|
2106
|
-
* PDK-ORDER-PARTICIPANTS D8 — when a field is due (progressive requirements). `save`: the account cannot be
|
|
2107
|
-
* saved without it; `offer`: saved, but not offered to customers until present; `eventually`: saved and offered,
|
|
2108
|
-
* shown to the business as a pending item. Absent: optional.
|
|
2109
|
-
*/
|
|
2110
|
-
export type PaymentFieldDue = 'save' | 'offer' | 'eventually';
|
|
2111
2153
|
/** A field an account of a method asks for. */
|
|
2112
2154
|
export interface PaymentFieldDef {
|
|
2113
2155
|
key: string;
|
|
2114
2156
|
label: string;
|
|
2115
2157
|
kind: 'text' | 'phone' | 'digits' | 'select' | 'bank';
|
|
2116
|
-
/** Derived from `due` (`due === 'save'`), kept for older clients. */
|
|
2117
2158
|
required: boolean;
|
|
2118
|
-
/** When the field is due. Absent on an older platform: read `required`. */
|
|
2119
|
-
due?: PaymentFieldDue;
|
|
2120
2159
|
/** `select` / `bank`: the options. */
|
|
2121
2160
|
options?: Array<{
|
|
2122
2161
|
value: string;
|
|
@@ -2152,13 +2191,6 @@ export interface PaymentAccount {
|
|
|
2152
2191
|
when: 'before' | 'on_delivery';
|
|
2153
2192
|
/** Paused without deleting. */
|
|
2154
2193
|
active: boolean;
|
|
2155
|
-
/** PDK-ORDER-PARTICIPANTS D8 — what the account still lacks (field keys); read-only, set by the platform on read. */
|
|
2156
|
-
requirements?: PaymentRequirements;
|
|
2157
|
-
}
|
|
2158
|
-
/** Field keys an account still lacks. `currentlyDue` non-empty: the account is not offered to customers. */
|
|
2159
|
-
export interface PaymentRequirements {
|
|
2160
|
-
currentlyDue: string[];
|
|
2161
|
-
eventuallyDue: string[];
|
|
2162
2194
|
}
|
|
2163
2195
|
export interface PaymentSettings {
|
|
2164
2196
|
locale?: 'es' | 'en';
|
|
@@ -2461,12 +2493,6 @@ export interface CasePaymentAccount {
|
|
|
2461
2493
|
when: 'before' | 'on_delivery';
|
|
2462
2494
|
/** "Nequi (Principal): 3001234567 a nombre de Ana Pérez". */
|
|
2463
2495
|
line: string;
|
|
2464
|
-
/**
|
|
2465
|
-
* PDK-ORDER-PARTICIPANTS-S3b — `line` with the holder unmasked. Business reads only (cases API, never the
|
|
2466
|
-
* public receipt); present only when it differs from `line` (wallets / Bre-B with a titular). Prefer
|
|
2467
|
-
* `ownerLine ?? line` in the business's views.
|
|
2468
|
-
*/
|
|
2469
|
-
ownerLine?: string;
|
|
2470
2496
|
/** What to copy to pay (empty for cash / card terminal). */
|
|
2471
2497
|
copy: Array<{
|
|
2472
2498
|
label: string;
|
|
@@ -2573,8 +2599,7 @@ export interface CaseReceiptLine {
|
|
|
2573
2599
|
coverUrl?: string;
|
|
2574
2600
|
/** AGF-PRODUCT-SKU — the product's inventory code as it is now (absent: none, or an older platform). */
|
|
2575
2601
|
sku?: string;
|
|
2576
|
-
/** PDK-ORDER-INVITE — open-order lines
|
|
2577
|
-
* `out`: not delivered («Agotado»), show it struck; `swapText`: delivered as this instead; `note`: the customer's note. */
|
|
2602
|
+
/** PDK-ORDER-INVITE — open-order lines: `out` = not delivered (never counted), `swapText` = delivered as this instead, `note` = the customer's note. */
|
|
2578
2603
|
out?: true;
|
|
2579
2604
|
swapText?: string;
|
|
2580
2605
|
note?: string;
|
|
@@ -2676,7 +2701,7 @@ export interface CaseReceipt {
|
|
|
2676
2701
|
distanceKm?: number;
|
|
2677
2702
|
};
|
|
2678
2703
|
totalCents: number | null;
|
|
2679
|
-
/** PDK-ORDER-INVITE — `totalCents`
|
|
2704
|
+
/** PDK-ORDER-INVITE — an open order's `totalCents` was typed by the business (some line had no price): it is final, delivery included. Absent when the total is the sum of fixed prices (PDK-ORDER-PRICES). */
|
|
2680
2705
|
totalManual?: true;
|
|
2681
2706
|
currency: string | null;
|
|
2682
2707
|
fields: Array<{
|
|
@@ -2799,27 +2824,52 @@ export interface CreateDirectOrderInput {
|
|
|
2799
2824
|
*/
|
|
2800
2825
|
reopens?: string;
|
|
2801
2826
|
}
|
|
2802
|
-
/** PDK-ORDER-
|
|
2803
|
-
export
|
|
2827
|
+
/** PDK-ORDER-PRICES — how a shopkeeper marked a line of an open order. */
|
|
2828
|
+
export type OpenOrderLineMark = 'ready' | 'out' | 'swap';
|
|
2829
|
+
/** PDK-ORDER-INVITE / PDK-ORDER-PRICES — one free-text line of an open order. */
|
|
2830
|
+
export interface OpenOrderFreeLine {
|
|
2804
2831
|
title: string;
|
|
2832
|
+
/** > 0, at most 3 decimals, <= 100000. */
|
|
2805
2833
|
qty: number;
|
|
2834
|
+
/** What `qty` and `unitPriceCents` are in («kg», «libra»). <= 20 chars. */
|
|
2806
2835
|
unit?: string;
|
|
2836
|
+
/** Price of ONE `unit`, whole cents, 0..1e9. Ignored on an `out` line. */
|
|
2837
|
+
unitPriceCents?: number;
|
|
2807
2838
|
note?: string;
|
|
2808
|
-
|
|
2809
|
-
mark: 'ready' | 'out' | 'swap';
|
|
2839
|
+
mark: OpenOrderLineMark;
|
|
2810
2840
|
/** Required with `mark: 'swap'`, refused otherwise. */
|
|
2811
2841
|
swapText?: string;
|
|
2812
2842
|
}
|
|
2843
|
+
/** PDK-ORDER-INVITE — how the customer pays an open order (no business account yet). */
|
|
2844
|
+
export interface OpenOrderPayment {
|
|
2845
|
+
/** A platform payment method key («efectivo», «nequi», «daviplata»…). */
|
|
2846
|
+
method: string;
|
|
2847
|
+
/** What the customer copies to pay (the shopkeeper's Nequi number). */
|
|
2848
|
+
payTo?: string;
|
|
2849
|
+
label?: string;
|
|
2850
|
+
/**
|
|
2851
|
+
* PDK-ORDER-PRICES — the bill the customer says they pay with: whole cents, 1..1e9, ONLY with
|
|
2852
|
+
* `method: 'efectivo'` (else 400). Below the total is accepted (the customer chose it before prices
|
|
2853
|
+
* existed): the case then stores `cashTenderedCents` with `changeCents: 0` — «faltan» is `totalCents - cashTenderedCents`.
|
|
2854
|
+
*/
|
|
2855
|
+
cashTenderedCents?: number;
|
|
2856
|
+
}
|
|
2813
2857
|
/**
|
|
2814
|
-
* PDK-ORDER-INVITE — an
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2817
|
-
*
|
|
2818
|
-
*
|
|
2819
|
-
*
|
|
2820
|
-
*
|
|
2858
|
+
* PDK-ORDER-INVITE — an open order: a shopkeeper's free-form dispatch (no catalog), created already
|
|
2859
|
+
* `confirmed`, no holds. `cases.createDirect` accepts it with `origin: { channel: 'link', place: 'open-order' }`.
|
|
2860
|
+
*
|
|
2861
|
+
* Total rule (PDK-ORDER-PRICES): when EVERY non-`out` line has `unitPriceCents`, `totalCents` MUST equal
|
|
2862
|
+
* Σ round(qty × unitPriceCents) + (deliveryFeeCents ?? 0), else 400 `{ error: 'total_mismatch', expected }`;
|
|
2863
|
+
* the receipt then has fixed-price lines, a `delivery` row and no `totalManual`. When some non-`out` line has no
|
|
2864
|
+
* price, `totalCents` is the final typed amount (unchecked), lines stay `on_request`, `deliveryFeeCents` is ignored
|
|
2865
|
+
* and the receipt is `totalManual: true`.
|
|
2821
2866
|
*/
|
|
2822
2867
|
export interface CreateOpenOrderInput {
|
|
2868
|
+
customer: {
|
|
2869
|
+
ref?: string;
|
|
2870
|
+
name?: string;
|
|
2871
|
+
phone?: string;
|
|
2872
|
+
};
|
|
2823
2873
|
origin: {
|
|
2824
2874
|
channel: 'link';
|
|
2825
2875
|
place: 'open-order' | {
|
|
@@ -2827,38 +2877,19 @@ export interface CreateOpenOrderInput {
|
|
|
2827
2877
|
label: string;
|
|
2828
2878
|
};
|
|
2829
2879
|
};
|
|
2830
|
-
freeLines:
|
|
2831
|
-
/**
|
|
2880
|
+
freeLines: OpenOrderFreeLine[];
|
|
2881
|
+
/** Whole cents, 1..1e9. */
|
|
2832
2882
|
totalCents: number;
|
|
2833
|
-
/**
|
|
2883
|
+
/** PDK-ORDER-PRICES — the delivery fee on top of the lines, whole cents 0..1e8 (used when every sold line is priced). */
|
|
2884
|
+
deliveryFeeCents?: number;
|
|
2834
2885
|
currency?: string;
|
|
2835
2886
|
state: 'confirmed';
|
|
2836
|
-
|
|
2837
|
-
payment?: {
|
|
2838
|
-
method: string;
|
|
2839
|
-
payTo?: string;
|
|
2840
|
-
label?: string;
|
|
2841
|
-
};
|
|
2842
|
-
customer?: {
|
|
2843
|
-
ref?: string;
|
|
2844
|
-
name?: string;
|
|
2845
|
-
phone?: string;
|
|
2846
|
-
};
|
|
2847
|
-
customerContact?: {
|
|
2848
|
-
name?: string;
|
|
2849
|
-
phone?: string;
|
|
2850
|
-
};
|
|
2851
|
-
/** Delivery address (domicilio). Absent: pickup. The quote, if any, is NOT added to `totalCents`. */
|
|
2887
|
+
payment?: OpenOrderPayment;
|
|
2852
2888
|
destination?: CaseDestination;
|
|
2853
|
-
/** The order type's other fields (entrega, notas…), by key. `entrega` defaults from `destination`. */
|
|
2854
2889
|
fields?: Record<string, unknown>;
|
|
2855
2890
|
type?: string;
|
|
2856
2891
|
conversationId?: string;
|
|
2857
|
-
/** Same key → same order. 8–80 of [A-Za-z0-9_.:-]. */
|
|
2858
2892
|
idempotencyKey: string;
|
|
2859
|
-
lines?: never;
|
|
2860
|
-
reopens?: never;
|
|
2861
|
-
place?: never;
|
|
2862
2893
|
}
|
|
2863
2894
|
/** A payment method a checkout offers (no account data — that is on the receipt once the order is sent). */
|
|
2864
2895
|
export interface DirectPaymentOption {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.73.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",
|