@agentforge-io/sdk-server 4.34.0 → 4.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
5
5
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
6
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
6
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, 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, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
7
7
  export { AgentsResource } from './resources/agents';
8
8
  export { AnalyticsResource } from './resources/analytics';
9
9
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -26,7 +26,7 @@ export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, A
26
26
  export { DeliveryResource } from './resources/delivery';
27
27
  export { CasesResource } from './resources/cases';
28
28
  export { BusinessRolesResource } from './resources/business-roles';
29
- export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
29
+ export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogMenuImportResource, CatalogOptionGroupsResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
30
30
  export type { ListThreadsOptions, SendMessageInput, AssignThreadInput, UnassignThreadInput, SetThreadModeInput, CloseThreadInput, } from './resources/inbox';
31
31
  export { ProvisioningResource } from './resources/provisioning';
32
32
  export type { ProvisionedTenant, ProvisionedApp, ProvisionedTeam, } from './resources/provisioning';
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.CasesResource = exports.DeliveryResource = exports.ContactVerificationResource = exports.ContactsResource = 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.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_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.CatalogOptionGroupsResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.CasesResource = exports.DeliveryResource = exports.ContactVerificationResource = exports.ContactsResource = 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.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_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; } });
@@ -85,6 +85,8 @@ Object.defineProperty(exports, "CatalogProductsResource", { enumerable: true, ge
85
85
  Object.defineProperty(exports, "CatalogPhotosResource", { enumerable: true, get: function () { return catalog_1.CatalogPhotosResource; } });
86
86
  Object.defineProperty(exports, "CatalogImportResource", { enumerable: true, get: function () { return catalog_1.CatalogImportResource; } });
87
87
  Object.defineProperty(exports, "CatalogFileImportResource", { enumerable: true, get: function () { return catalog_1.CatalogFileImportResource; } });
88
+ Object.defineProperty(exports, "CatalogMenuImportResource", { enumerable: true, get: function () { return catalog_1.CatalogMenuImportResource; } });
89
+ Object.defineProperty(exports, "CatalogOptionGroupsResource", { enumerable: true, get: function () { return catalog_1.CatalogOptionGroupsResource; } });
88
90
  Object.defineProperty(exports, "CatalogSourcesResource", { enumerable: true, get: function () { return catalog_1.CatalogSourcesResource; } });
89
91
  Object.defineProperty(exports, "AgentForgeCatalogImportLimitError", { enumerable: true, get: function () { return catalog_1.AgentForgeCatalogImportLimitError; } });
90
92
  Object.defineProperty(exports, "CATALOG_IMPORT_MAX_ITEMS", { enumerable: true, get: function () { return catalog_1.CATALOG_IMPORT_MAX_ITEMS; } });
@@ -1,6 +1,6 @@
1
1
  import type { AgentForgeClient } from '../client';
2
2
  import { AgentForgeError } from '../errors';
3
- import type { AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
3
+ import type { AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, 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. */
@@ -38,6 +38,29 @@ export declare class CatalogPhotosResource {
38
38
  /** `PATCH …/photos/cover` */
39
39
  setCover(productId: string, url: string): Promise<CatalogProduct>;
40
40
  }
41
+ /**
42
+ * AGF-MENU-OPTIONS M2 — the catalog's option groups library (sauces, sizes,
43
+ * sides, «sin cebolla»), reused by products through `optionGroupIds`.
44
+ */
45
+ export declare class CatalogOptionGroupsResource {
46
+ private readonly client;
47
+ constructor(client: AgentForgeClient);
48
+ /** `GET /option-groups` */
49
+ list(): Promise<CatalogOptionGroup[]>;
50
+ /** `POST /option-groups` — create, or replace the group with the same `id`. 400 `INVALID_OPTION_GROUP`. */
51
+ save(input: SaveCatalogOptionGroupInput): Promise<CatalogOptionGroup>;
52
+ /** `DELETE /option-groups/:id` — also takes it off every product. */
53
+ delete(groupId: string): Promise<{
54
+ removed: boolean;
55
+ products: number;
56
+ }>;
57
+ /** `POST /option-groups/changes/preview` — plan of changes (writes nothing). 400 with the reason. */
58
+ previewChanges(changes: CatalogOptionChange[]): Promise<CatalogOptionChangesPlan>;
59
+ /** `POST /option-groups/changes/apply` — applies the changes the owner confirmed. */
60
+ applyChanges(changes: CatalogOptionChange[]): Promise<CatalogOptionChangesPlan>;
61
+ /** `PATCH /option-groups/:id/availability` — one option on or off («hoy no hay BBQ»). */
62
+ setAvailability(groupId: string, option: string, isAvailable: boolean): Promise<CatalogOptionGroup>;
63
+ }
41
64
  export declare class CatalogProductsResource {
42
65
  private readonly client;
43
66
  readonly photos: CatalogPhotosResource;
@@ -72,9 +95,26 @@ export declare class CatalogFileImportResource {
72
95
  * (field → exact header). Needs a catalog. */
73
96
  apply(input: CatalogFileApplyInput): Promise<CatalogFileApplyResult>;
74
97
  }
98
+ /**
99
+ * AGF-MENU-OPTIONS M1 — a catalog read by AI from what the business has: pasted
100
+ * text, a photo of the menu, a PDF, a Word (.docx), an Excel/CSV. `read` writes
101
+ * nothing (items + what importing them would do); the owner confirms (maybe
102
+ * edits) and `apply` imports them — same name = update. Never quantities.
103
+ */
104
+ export declare class CatalogMenuImportResource {
105
+ private readonly client;
106
+ constructor(client: AgentForgeClient);
107
+ /** `POST /import/menu/read` (multipart) — `text` and/or a `file` (≤10 MB). Can take a minute. */
108
+ read(input: CatalogMenuReadInput): Promise<CatalogMenuRead>;
109
+ /** `POST /import/menu/apply` — the confirmed items (max 200). */
110
+ apply(items: CatalogMenuItem[], opts?: {
111
+ kind?: 'product' | 'service';
112
+ }): Promise<CatalogFileApplyResult>;
113
+ }
75
114
  export declare class CatalogImportResource {
76
115
  private readonly client;
77
116
  readonly file: CatalogFileImportResource;
117
+ readonly menu: CatalogMenuImportResource;
78
118
  constructor(client: AgentForgeClient);
79
119
  /** `POST /import/preview` — validate structured items WITHOUT writing. Max 200
80
120
  * (throws `AgentForgeCatalogImportLimitError` above that, before any request). */
@@ -134,6 +174,7 @@ export declare class CatalogResource {
134
174
  readonly products: CatalogProductsResource;
135
175
  readonly import: CatalogImportResource;
136
176
  readonly sources: CatalogSourcesResource;
177
+ readonly optionGroups: CatalogOptionGroupsResource;
137
178
  constructor(client: AgentForgeClient);
138
179
  /** `GET /api/v1/catalog` — the tenant's catalog, or `null` when it has none yet
139
180
  * (404 `CATALOG_NOT_FOUND`). Other 404s still throw. */
@@ -16,7 +16,7 @@
16
16
  // machine-readable code (`CATALOG_NOT_FOUND`, `FILE_EMPTY_FILE`,
17
17
  // `INVALID_MAPPING`, `TOO_MANY_ITEMS`, …).
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
19
+ exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogOptionGroupsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
20
20
  const errors_1 = require("../errors");
21
21
  const BASE = '/api/v1/catalog';
22
22
  const TENANT_AUTH = { forceApiKey: true };
@@ -110,6 +110,40 @@ class CatalogPhotosResource {
110
110
  }
111
111
  }
112
112
  exports.CatalogPhotosResource = CatalogPhotosResource;
113
+ /**
114
+ * AGF-MENU-OPTIONS M2 — the catalog's option groups library (sauces, sizes,
115
+ * sides, «sin cebolla»), reused by products through `optionGroupIds`.
116
+ */
117
+ class CatalogOptionGroupsResource {
118
+ constructor(client) {
119
+ this.client = client;
120
+ }
121
+ /** `GET /option-groups` */
122
+ async list() {
123
+ return (await this.client.request('GET', `${BASE}/option-groups`, undefined, TENANT_AUTH)).items;
124
+ }
125
+ /** `POST /option-groups` — create, or replace the group with the same `id`. 400 `INVALID_OPTION_GROUP`. */
126
+ async save(input) {
127
+ return this.client.request('POST', `${BASE}/option-groups`, input, TENANT_AUTH);
128
+ }
129
+ /** `DELETE /option-groups/:id` — also takes it off every product. */
130
+ async delete(groupId) {
131
+ return this.client.request('DELETE', `${BASE}/option-groups/${seg(groupId)}`, undefined, TENANT_AUTH);
132
+ }
133
+ /** `POST /option-groups/changes/preview` — plan of changes (writes nothing). 400 with the reason. */
134
+ async previewChanges(changes) {
135
+ return this.client.request('POST', `${BASE}/option-groups/changes/preview`, { changes }, TENANT_AUTH);
136
+ }
137
+ /** `POST /option-groups/changes/apply` — applies the changes the owner confirmed. */
138
+ async applyChanges(changes) {
139
+ return this.client.request('POST', `${BASE}/option-groups/changes/apply`, { changes }, TENANT_AUTH);
140
+ }
141
+ /** `PATCH /option-groups/:id/availability` — one option on or off («hoy no hay BBQ»). */
142
+ async setAvailability(groupId, option, isAvailable) {
143
+ return this.client.request('PATCH', `${BASE}/option-groups/${seg(groupId)}/availability`, { option, isAvailable }, TENANT_AUTH);
144
+ }
145
+ }
146
+ exports.CatalogOptionGroupsResource = CatalogOptionGroupsResource;
113
147
  class CatalogProductsResource {
114
148
  constructor(client) {
115
149
  this.client = client;
@@ -179,10 +213,40 @@ class CatalogFileImportResource {
179
213
  }
180
214
  }
181
215
  exports.CatalogFileImportResource = CatalogFileImportResource;
216
+ /**
217
+ * AGF-MENU-OPTIONS M1 — a catalog read by AI from what the business has: pasted
218
+ * text, a photo of the menu, a PDF, a Word (.docx), an Excel/CSV. `read` writes
219
+ * nothing (items + what importing them would do); the owner confirms (maybe
220
+ * edits) and `apply` imports them — same name = update. Never quantities.
221
+ */
222
+ class CatalogMenuImportResource {
223
+ constructor(client) {
224
+ this.client = client;
225
+ }
226
+ /** `POST /import/menu/read` (multipart) — `text` and/or a `file` (≤10 MB). Can take a minute. */
227
+ async read(input) {
228
+ const form = new FormData();
229
+ if (input.text !== undefined)
230
+ form.append('text', input.text);
231
+ if (input.file !== undefined) {
232
+ const raw = toBlob(input.file);
233
+ const blob = input.mimeType && !raw.type ? new Blob([raw], { type: input.mimeType }) : raw;
234
+ form.append('file', blob, input.filename ?? 'menu');
235
+ }
236
+ const res = await this.client.requestRaw('POST', `${BASE}/import/menu/read`, { ...TENANT_AUTH, formData: form, timeoutMs: 180000 });
237
+ return (await res.json());
238
+ }
239
+ /** `POST /import/menu/apply` — the confirmed items (max 200). */
240
+ async apply(items, opts = {}) {
241
+ return this.client.request('POST', `${BASE}/import/menu/apply`, { items, ...opts }, { ...TENANT_AUTH, timeoutMs: 120000 });
242
+ }
243
+ }
244
+ exports.CatalogMenuImportResource = CatalogMenuImportResource;
182
245
  class CatalogImportResource {
183
246
  constructor(client) {
184
247
  this.client = client;
185
248
  this.file = new CatalogFileImportResource(client);
249
+ this.menu = new CatalogMenuImportResource(client);
186
250
  }
187
251
  /** `POST /import/preview` — validate structured items WITHOUT writing. Max 200
188
252
  * (throws `AgentForgeCatalogImportLimitError` above that, before any request). */
@@ -269,6 +333,7 @@ class CatalogResource {
269
333
  this.categories = new CatalogCategoriesResource(client);
270
334
  this.products = new CatalogProductsResource(client);
271
335
  this.import = new CatalogImportResource(client);
336
+ this.optionGroups = new CatalogOptionGroupsResource(client);
272
337
  this.sources = new CatalogSourcesResource(client);
273
338
  }
274
339
  /** `GET /api/v1/catalog` — the tenant's catalog, or `null` when it has none yet
package/dist/types.d.ts CHANGED
@@ -1045,6 +1045,8 @@ export interface CatalogProduct {
1045
1045
  at: string;
1046
1046
  }>;
1047
1047
  lockedFields: CatalogLockableField[];
1048
+ /** AGF-MENU-OPTIONS M2 — the catalog's option groups this product offers, in order. */
1049
+ optionGroupIds?: string[];
1048
1050
  lastSoldAt?: string | null;
1049
1051
  demandCount: number;
1050
1052
  createdAt: string;
@@ -1073,6 +1075,95 @@ export interface CreateCatalogProductInput {
1073
1075
  }
1074
1076
  export interface UpdateCatalogProductInput extends Partial<CreateCatalogProductInput> {
1075
1077
  sortOrder?: number;
1078
+ /** AGF-MENU-OPTIONS M2 — ids from `catalog.optionGroups.list()`, in order ([] removes them). */
1079
+ optionGroupIds?: string[];
1080
+ }
1081
+ /** AGF-MENU-OPTIONS M2 — one option of a group («BBQ», +1.000). */
1082
+ export interface CatalogOption {
1083
+ id: string;
1084
+ name: string;
1085
+ /** Added to the product's price per unit, in cents (0 = included). */
1086
+ priceDeltaCents: number;
1087
+ /** false: «hoy no hay», hidden from customers. */
1088
+ isAvailable: boolean;
1089
+ }
1090
+ /** AGF-MENU-OPTIONS M2 — a group of the catalog's library («Salsa», «Tamaño»), reused by products. */
1091
+ export interface CatalogOptionGroup {
1092
+ id: string;
1093
+ name: string;
1094
+ /** `single`: one option (a size); `multi`: several. */
1095
+ selection: 'single' | 'multi';
1096
+ required: boolean;
1097
+ min: number;
1098
+ max: number;
1099
+ options: CatalogOption[];
1100
+ }
1101
+ /** Create (no id) or replace (same id) a group. Ids of options kept when given. */
1102
+ export interface SaveCatalogOptionGroupInput {
1103
+ id?: string;
1104
+ name: string;
1105
+ selection: 'single' | 'multi';
1106
+ required?: boolean;
1107
+ min?: number;
1108
+ max?: number;
1109
+ options: Array<{
1110
+ id?: string;
1111
+ name: string;
1112
+ priceDeltaCents?: number;
1113
+ isAvailable?: boolean;
1114
+ }>;
1115
+ }
1116
+ /** AGF-MENU-OPTIONS M3 — one change to the option groups (the owner's chat proposes them). */
1117
+ export type CatalogOptionChange = {
1118
+ op: 'save_group';
1119
+ group: {
1120
+ name: string;
1121
+ selection?: 'single' | 'multi';
1122
+ required?: boolean;
1123
+ max?: number;
1124
+ options: Array<{
1125
+ name: string;
1126
+ priceDeltaCents?: number;
1127
+ isAvailable?: boolean;
1128
+ }>;
1129
+ };
1130
+ } | {
1131
+ op: 'attach' | 'detach';
1132
+ group: string;
1133
+ products: string[];
1134
+ } | {
1135
+ op: 'delete_group';
1136
+ group: string;
1137
+ };
1138
+ /** A plan of option changes as the confirmation card shows it. */
1139
+ export interface CatalogOptionChangesPlan {
1140
+ changes: CatalogOptionChange[];
1141
+ summary: Array<{
1142
+ kind: 'group_created' | 'group_updated';
1143
+ group: string;
1144
+ selection: 'single' | 'multi';
1145
+ required: boolean;
1146
+ max: number;
1147
+ options: Array<{
1148
+ name: string;
1149
+ priceDeltaCents: number;
1150
+ isAvailable: boolean;
1151
+ }>;
1152
+ } | {
1153
+ kind: 'attached' | 'detached';
1154
+ group: string;
1155
+ products: string[];
1156
+ } | {
1157
+ kind: 'group_deleted';
1158
+ group: string;
1159
+ products: number;
1160
+ }>;
1161
+ productsChanged: number;
1162
+ }
1163
+ /** A customer's choice for one group: its name or id and the options' names or ids. */
1164
+ export interface CatalogOptionChoice {
1165
+ group: string;
1166
+ options: string[];
1076
1167
  }
1077
1168
  export interface ListCatalogProductsInput {
1078
1169
  /** Free-text search. */
@@ -1189,6 +1280,60 @@ export interface CatalogFileApplyResult {
1189
1280
  photosImported: number;
1190
1281
  warnings: string[];
1191
1282
  }
1283
+ /** AGF-MENU-OPTIONS M1 — one item of a menu read (never a quantity). */
1284
+ export interface CatalogMenuItem {
1285
+ category?: string;
1286
+ title: string;
1287
+ description?: string;
1288
+ /** Integer cents; null = no price («a consultar»). */
1289
+ priceCents: number | null;
1290
+ /** The price as the menu wrote it. */
1291
+ priceText?: string;
1292
+ /** Look before importing: a price not found in the pasted text, no price, a repeated name. */
1293
+ flags?: Array<'price_not_in_source' | 'no_price' | 'duplicate'>;
1294
+ /** AGF-MENU-OPTIONS M3 — options the menu lists for it; created as library groups on import. */
1295
+ optionGroups?: Array<{
1296
+ name: string;
1297
+ selection: 'single' | 'multi';
1298
+ required: boolean;
1299
+ options: Array<{
1300
+ name: string;
1301
+ priceDeltaCents: number;
1302
+ }>;
1303
+ }>;
1304
+ }
1305
+ export interface CatalogMenuReadInput {
1306
+ /** The pasted menu, or a note to go with the file. */
1307
+ text?: string;
1308
+ /** A photo (JPG/PNG/WebP), PDF, .docx, .xlsx, .csv or .txt (≤10 MB). */
1309
+ file?: CatalogFileInput;
1310
+ filename?: string;
1311
+ mimeType?: string;
1312
+ }
1313
+ export interface CatalogMenuRead {
1314
+ items: CatalogMenuItem[];
1315
+ source: 'text' | 'image' | 'pdf' | 'document' | 'sheet';
1316
+ /** A photo / PDF: prices could not be checked against a text. */
1317
+ pricesUnchecked: boolean;
1318
+ dropped: number;
1319
+ truncated: boolean;
1320
+ note?: string;
1321
+ plan: {
1322
+ willCreate: number;
1323
+ willUpdate: number;
1324
+ unchanged: number;
1325
+ skipped: number;
1326
+ categoriesToCreate: string[];
1327
+ };
1328
+ /** Per item, in order: what importing does. */
1329
+ rows: Array<{
1330
+ title: string;
1331
+ action: 'create' | 'update' | 'unchanged';
1332
+ changes?: string[];
1333
+ }>;
1334
+ warnings: string[];
1335
+ currency: string;
1336
+ }
1192
1337
  /** Binary file accepted by the file-import calls. */
1193
1338
  export type CatalogFileInput = Blob | ArrayBuffer | Uint8Array;
1194
1339
  export interface CatalogFilePreviewInput {
@@ -1847,6 +1992,12 @@ export interface CaseReceiptLine {
1847
1992
  currency: string;
1848
1993
  priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
1849
1994
  unit?: string;
1995
+ /** AGF-MENU-OPTIONS M2 — the options chosen; `unitCents` already includes them. */
1996
+ options?: Array<{
1997
+ group: string;
1998
+ name: string;
1999
+ deltaCents: number;
2000
+ }>;
1850
2001
  }
1851
2002
  /**
1852
2003
  * AGF-CASE-RECEIPT — a case's receipt as its public link shows it: what the
@@ -1916,10 +2067,12 @@ export interface CreateDirectOrderInput {
1916
2067
  name: string;
1917
2068
  phone: string;
1918
2069
  };
1919
- /** Products of the business's catalog and how many of each. */
2070
+ /** Products of the business's catalog and how many of each. `options`: the choice for a
2071
+ * product with option groups (AGF-MENU-OPTIONS M2; a required group left out → 400). */
1920
2072
  lines: Array<{
1921
2073
  productId: string;
1922
2074
  quantity: number;
2075
+ options?: CatalogOptionChoice[];
1923
2076
  }>;
1924
2077
  /** The order type's other fields (entrega, direccion, notas…), by key. */
1925
2078
  fields?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.34.0",
3
+ "version": "4.35.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",