@agentforge-io/sdk-server 4.70.0 → 4.72.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 +2 -2
- package/dist/resources/templates.d.ts +9 -1
- package/dist/resources/templates.js +8 -0
- package/dist/types.d.ts +109 -0
- 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, 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, 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';
|
|
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, 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';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput } from '../types';
|
|
2
|
+
import type { CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -136,7 +136,7 @@ export declare class CasesResource {
|
|
|
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
138
|
*/
|
|
139
|
-
createDirect(input: CreateDirectOrderInput): Promise<CaseView>;
|
|
139
|
+
createDirect(input: CreateDirectOrderInput | CreateOpenOrderInput): Promise<CaseView>;
|
|
140
140
|
/**
|
|
141
141
|
* `POST /api/v1/cases/bookings` — AGF-AGENDA: a booking from your App's agenda
|
|
142
142
|
* (hold the time in your own ledger first). Created sent (`submitted`), or
|
|
@@ -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 {
|
|
@@ -2551,6 +2587,10 @@ export interface CaseReceiptLine {
|
|
|
2551
2587
|
coverUrl?: string;
|
|
2552
2588
|
/** AGF-PRODUCT-SKU — the product's inventory code as it is now (absent: none, or an older platform). */
|
|
2553
2589
|
sku?: string;
|
|
2590
|
+
/** PDK-ORDER-INVITE — open-order lines: `out` = not delivered (never counted), `swapText` = delivered as this instead, `note` = the customer's note. */
|
|
2591
|
+
out?: true;
|
|
2592
|
+
swapText?: string;
|
|
2593
|
+
note?: string;
|
|
2554
2594
|
}
|
|
2555
2595
|
/** One option group's choice on a proposed alternative: the group and what was picked in it (ids, or names). */
|
|
2556
2596
|
export interface CaseProposalSwapOption {
|
|
@@ -2649,6 +2689,8 @@ export interface CaseReceipt {
|
|
|
2649
2689
|
distanceKm?: number;
|
|
2650
2690
|
};
|
|
2651
2691
|
totalCents: number | null;
|
|
2692
|
+
/** 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). */
|
|
2693
|
+
totalManual?: true;
|
|
2652
2694
|
currency: string | null;
|
|
2653
2695
|
fields: Array<{
|
|
2654
2696
|
label: string;
|
|
@@ -2770,6 +2812,73 @@ export interface CreateDirectOrderInput {
|
|
|
2770
2812
|
*/
|
|
2771
2813
|
reopens?: string;
|
|
2772
2814
|
}
|
|
2815
|
+
/** PDK-ORDER-PRICES — how a shopkeeper marked a line of an open order. */
|
|
2816
|
+
export type OpenOrderLineMark = 'ready' | 'out' | 'swap';
|
|
2817
|
+
/** PDK-ORDER-INVITE / PDK-ORDER-PRICES — one free-text line of an open order. */
|
|
2818
|
+
export interface OpenOrderFreeLine {
|
|
2819
|
+
title: string;
|
|
2820
|
+
/** > 0, at most 3 decimals, <= 100000. */
|
|
2821
|
+
qty: number;
|
|
2822
|
+
/** What `qty` and `unitPriceCents` are in («kg», «libra»). <= 20 chars. */
|
|
2823
|
+
unit?: string;
|
|
2824
|
+
/** Price of ONE `unit`, whole cents, 0..1e9. Ignored on an `out` line. */
|
|
2825
|
+
unitPriceCents?: number;
|
|
2826
|
+
note?: string;
|
|
2827
|
+
mark: OpenOrderLineMark;
|
|
2828
|
+
/** Required with `mark: 'swap'`, refused otherwise. */
|
|
2829
|
+
swapText?: string;
|
|
2830
|
+
}
|
|
2831
|
+
/** PDK-ORDER-INVITE — how the customer pays an open order (no business account yet). */
|
|
2832
|
+
export interface OpenOrderPayment {
|
|
2833
|
+
/** A platform payment method key («efectivo», «nequi», «daviplata»…). */
|
|
2834
|
+
method: string;
|
|
2835
|
+
/** What the customer copies to pay (the shopkeeper's Nequi number). */
|
|
2836
|
+
payTo?: string;
|
|
2837
|
+
label?: string;
|
|
2838
|
+
/**
|
|
2839
|
+
* PDK-ORDER-PRICES — the bill the customer says they pay with: whole cents, 1..1e9, ONLY with
|
|
2840
|
+
* `method: 'efectivo'` (else 400). Below the total is accepted (the customer chose it before prices
|
|
2841
|
+
* existed): the case then stores `cashTenderedCents` with `changeCents: 0` — «faltan» is `totalCents - cashTenderedCents`.
|
|
2842
|
+
*/
|
|
2843
|
+
cashTenderedCents?: number;
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* PDK-ORDER-INVITE — an open order: a shopkeeper's free-form dispatch (no catalog), created already
|
|
2847
|
+
* `confirmed`, no holds. `cases.createDirect` accepts it with `origin: { channel: 'link', place: 'open-order' }`.
|
|
2848
|
+
*
|
|
2849
|
+
* Total rule (PDK-ORDER-PRICES): when EVERY non-`out` line has `unitPriceCents`, `totalCents` MUST equal
|
|
2850
|
+
* Σ round(qty × unitPriceCents) + (deliveryFeeCents ?? 0), else 400 `{ error: 'total_mismatch', expected }`;
|
|
2851
|
+
* the receipt then has fixed-price lines, a `delivery` row and no `totalManual`. When some non-`out` line has no
|
|
2852
|
+
* price, `totalCents` is the final typed amount (unchecked), lines stay `on_request`, `deliveryFeeCents` is ignored
|
|
2853
|
+
* and the receipt is `totalManual: true`.
|
|
2854
|
+
*/
|
|
2855
|
+
export interface CreateOpenOrderInput {
|
|
2856
|
+
customer: {
|
|
2857
|
+
ref?: string;
|
|
2858
|
+
name?: string;
|
|
2859
|
+
phone?: string;
|
|
2860
|
+
};
|
|
2861
|
+
origin: {
|
|
2862
|
+
channel: 'link';
|
|
2863
|
+
place: 'open-order' | {
|
|
2864
|
+
ref: 'open-order';
|
|
2865
|
+
label: string;
|
|
2866
|
+
};
|
|
2867
|
+
};
|
|
2868
|
+
freeLines: OpenOrderFreeLine[];
|
|
2869
|
+
/** Whole cents, 1..1e9. */
|
|
2870
|
+
totalCents: number;
|
|
2871
|
+
/** PDK-ORDER-PRICES — the delivery fee on top of the lines, whole cents 0..1e8 (used when every sold line is priced). */
|
|
2872
|
+
deliveryFeeCents?: number;
|
|
2873
|
+
currency?: string;
|
|
2874
|
+
state: 'confirmed';
|
|
2875
|
+
payment?: OpenOrderPayment;
|
|
2876
|
+
destination?: CaseDestination;
|
|
2877
|
+
fields?: Record<string, unknown>;
|
|
2878
|
+
type?: string;
|
|
2879
|
+
conversationId?: string;
|
|
2880
|
+
idempotencyKey: string;
|
|
2881
|
+
}
|
|
2773
2882
|
/** A payment method a checkout offers (no account data — that is on the receipt once the order is sent). */
|
|
2774
2883
|
export interface DirectPaymentOption {
|
|
2775
2884
|
accountId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.72.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",
|