@agentforge-io/sdk-server 4.16.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -9,6 +9,7 @@ import { ProvisioningResource } from './resources/provisioning';
9
9
  import { SecretsResource } from './resources/secrets';
10
10
  import { TeamsResource } from './resources/teams';
11
11
  import { TemplatesResource } from './resources/templates';
12
+ import { MarketplaceResource } from './resources/marketplace';
12
13
  import { TenantConfigResource } from './resources/config';
13
14
  import { CatalogResource } from './resources/catalog';
14
15
  import { BusinessRolesResource } from './resources/business-roles';
@@ -91,6 +92,7 @@ export declare class AgentForgeClient {
91
92
  readonly tools: ToolsResource;
92
93
  readonly teams: TeamsResource;
93
94
  readonly templates: TemplatesResource;
95
+ readonly marketplace: MarketplaceResource;
94
96
  readonly config: TenantConfigResource;
95
97
  readonly businessRoles: BusinessRolesResource;
96
98
  readonly catalog: CatalogResource;
package/dist/client.js CHANGED
@@ -31,6 +31,7 @@ const provisioning_1 = require("./resources/provisioning");
31
31
  const secrets_1 = require("./resources/secrets");
32
32
  const teams_1 = require("./resources/teams");
33
33
  const templates_1 = require("./resources/templates");
34
+ const marketplace_1 = require("./resources/marketplace");
34
35
  const config_1 = require("./resources/config");
35
36
  const catalog_1 = require("./resources/catalog");
36
37
  const business_roles_1 = require("./resources/business-roles");
@@ -73,6 +74,7 @@ class AgentForgeClient {
73
74
  this.tools = new tools_1.ToolsResource(this);
74
75
  this.teams = new teams_1.TeamsResource(this);
75
76
  this.templates = new templates_1.TemplatesResource(this);
77
+ this.marketplace = new marketplace_1.MarketplaceResource(this);
76
78
  this.config = new config_1.TenantConfigResource(this);
77
79
  this.businessRoles = new business_roles_1.BusinessRolesResource(this);
78
80
  this.catalog = new catalog_1.CatalogResource(this);
package/dist/index.d.ts CHANGED
@@ -2,20 +2,22 @@ export { AgentForgeClient, INSTALLED_TENANT_HEADER } from './client';
2
2
  export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyToolCallbackSignature, } from './webhooks';
5
- export type { AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallResult, TenantConfigEntry, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
5
+ export type { AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
6
6
  export { AgentsResource } from './resources/agents';
7
7
  export { AnalyticsResource } from './resources/analytics';
8
8
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
9
9
  export { AppsResource } from './resources/apps';
10
10
  export { ChatResource } from './resources/chat';
11
11
  export type { AnthropicClientOptions, AppCallerClaims, StreamMessageInput, StreamMessageForAppUserInput, } from './resources/chat';
12
- export { ConnectorsResource } from './resources/connectors';
12
+ export { ConnectorsResource, parseGoogleSheetsPickerResult } from './resources/connectors';
13
13
  export type { InboxChannelView } from './resources/connectors';
14
14
  export { InboxResource } from './resources/inbox';
15
15
  export { InstallationsResource } from './resources/installations';
16
16
  export type { InstallAppInput } from './resources/installations';
17
17
  export { TemplatesResource } from './resources/templates';
18
18
  export type { ListTemplatesInput } from './resources/templates';
19
+ export { MarketplaceResource } from './resources/marketplace';
20
+ export type { ListMarketplaceCategoriesInput } from './resources/marketplace';
19
21
  export { TenantConfigResource } from './resources/config';
20
22
  export { BusinessRolesResource } from './resources/business-roles';
21
23
  export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@
28
28
  // const payload = af.tools.verifyCallback({ rawBody, signatureHeader, secretPlaintext });
29
29
  // await af.tools.respondToCallback({ resultUrl: payload.resultUrl, tenantId: payload.tenantId, secret, result });
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.TenantConfigResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.verifyToolCallbackSignature = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
31
+ exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.verifyToolCallbackSignature = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
32
32
  var client_1 = require("./client");
33
33
  Object.defineProperty(exports, "AgentForgeClient", { enumerable: true, get: function () { return client_1.AgentForgeClient; } });
34
34
  Object.defineProperty(exports, "INSTALLED_TENANT_HEADER", { enumerable: true, get: function () { return client_1.INSTALLED_TENANT_HEADER; } });
@@ -52,12 +52,15 @@ var chat_1 = require("./resources/chat");
52
52
  Object.defineProperty(exports, "ChatResource", { enumerable: true, get: function () { return chat_1.ChatResource; } });
53
53
  var connectors_1 = require("./resources/connectors");
54
54
  Object.defineProperty(exports, "ConnectorsResource", { enumerable: true, get: function () { return connectors_1.ConnectorsResource; } });
55
+ Object.defineProperty(exports, "parseGoogleSheetsPickerResult", { enumerable: true, get: function () { return connectors_1.parseGoogleSheetsPickerResult; } });
55
56
  var inbox_1 = require("./resources/inbox");
56
57
  Object.defineProperty(exports, "InboxResource", { enumerable: true, get: function () { return inbox_1.InboxResource; } });
57
58
  var installations_1 = require("./resources/installations");
58
59
  Object.defineProperty(exports, "InstallationsResource", { enumerable: true, get: function () { return installations_1.InstallationsResource; } });
59
60
  var templates_1 = require("./resources/templates");
60
61
  Object.defineProperty(exports, "TemplatesResource", { enumerable: true, get: function () { return templates_1.TemplatesResource; } });
62
+ var marketplace_1 = require("./resources/marketplace");
63
+ Object.defineProperty(exports, "MarketplaceResource", { enumerable: true, get: function () { return marketplace_1.MarketplaceResource; } });
61
64
  var config_1 = require("./resources/config");
62
65
  Object.defineProperty(exports, "TenantConfigResource", { enumerable: true, get: function () { return config_1.TenantConfigResource; } });
63
66
  var business_roles_1 = require("./resources/business-roles");
@@ -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, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
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';
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. */
@@ -81,7 +81,9 @@ export declare class CatalogImportResource {
81
81
  preview(items: CatalogImportItem[]): Promise<CatalogImportPreview>;
82
82
  /** `POST /import/apply` — create-only, idempotent per slug. Max 200 per call. */
83
83
  apply(items: CatalogImportItem[]): Promise<CatalogImportApplyResult>;
84
- /** `GET /import/template.xlsx` — the downloadable template (xlsx bytes). */
84
+ /** `GET /import/template.xlsx` — the downloadable template (xlsx bytes):
85
+ * columns codigo, nombre, precio, categoria, descripcion, stock, foto_url,
86
+ * tipo, plus example rows. */
85
87
  template(): Promise<ArrayBuffer>;
86
88
  }
87
89
  export declare class CatalogSourcesResource {
@@ -95,9 +97,30 @@ export declare class CatalogSourcesResource {
95
97
  update(sourceId: string, input: UpdateCatalogImportSourceInput): Promise<CatalogImportSource>;
96
98
  /** `DELETE /import-sources/:id` */
97
99
  delete(sourceId: string): Promise<void>;
100
+ /** `GET /sheets/:spreadsheetId/tabs` — the spreadsheet's tabs (title, size),
101
+ * so the owner can choose one and the caller can build the preview `range`.
102
+ * Throws with `code` `NO_GOOGLE_GRANT` (connect Google Sheets first),
103
+ * `NO_SHEETS_SCOPE` (reconnect), or `SHEET_READ_FAILED` (Google refused:
104
+ * not found / not shared / API disabled). */
105
+ tabs(spreadsheetId: string): Promise<CatalogSheetTab[]>;
106
+ /** `POST /sheets/template` — create a NEW Google Sheet in the tenant's Drive
107
+ * (its google-sheets grant), already laid out as the catalog template: the
108
+ * same columns as `import.template()` (codigo, nombre, precio, categoria,
109
+ * descripcion, stock, foto_url, tipo), header bold + frozen, HEADER ROW
110
+ * ONLY (no example rows — the sheet is a live sync source), codigo as
111
+ * plain text, number formats on precio/stock and a producto|servicio
112
+ * dropdown on tipo. `codigo` maps to `externalId`: a stable product id, so
113
+ * renaming a row updates the same product. Rows synced without a valid
114
+ * price are kept as `priceKind: 'on_request'` (with a warning). The
115
+ * result plugs straight into `create()`. Throws with `code`
116
+ * `NO_GOOGLE_GRANT`, `NO_SHEETS_SCOPE` (reconnect), `SHEET_CREATE_FAILED`
117
+ * (Google refused), `INVALID_LOCALE` or `INVALID_TITLE`. Each call creates
118
+ * a new spreadsheet. */
119
+ createTemplateSheet(input?: CreateCatalogTemplateSheetInput): Promise<CatalogTemplateSheet>;
98
120
  /** `POST /import-sources/preview` — sample a Google Sheet (headers, rows,
99
121
  * suggested mapping) before saving a source. Needs a connected Google grant
100
- * (`NO_GOOGLE_GRANT` otherwise). */
122
+ * (`NO_GOOGLE_GRANT` otherwise). Pass `range` (or at least `sheetTab`, from
123
+ * `tabs()`): the platform's fallback is `Sheet1!A1:Z7`, not the first tab. */
101
124
  preview(input: PreviewCatalogImportSourceInput): Promise<CatalogImportSourcePreview>;
102
125
  /** `POST /import-sources/:id/run` — sync now. Always resolves with `lastResult`;
103
126
  * run-level failures are in `lastResult.error`. */
@@ -195,7 +195,9 @@ class CatalogImportResource {
195
195
  guardItems(items);
196
196
  return this.client.request('POST', `${BASE}/import/apply`, { items }, TENANT_AUTH);
197
197
  }
198
- /** `GET /import/template.xlsx` — the downloadable template (xlsx bytes). */
198
+ /** `GET /import/template.xlsx` — the downloadable template (xlsx bytes):
199
+ * columns codigo, nombre, precio, categoria, descripcion, stock, foto_url,
200
+ * tipo, plus example rows. */
199
201
  async template() {
200
202
  const res = await this.client.requestRaw('GET', `${BASE}/import/template.xlsx`, TENANT_AUTH);
201
203
  return res.arrayBuffer();
@@ -222,9 +224,35 @@ class CatalogSourcesResource {
222
224
  async delete(sourceId) {
223
225
  await this.client.request('DELETE', `${BASE}/import-sources/${seg(sourceId)}`, undefined, TENANT_AUTH);
224
226
  }
227
+ /** `GET /sheets/:spreadsheetId/tabs` — the spreadsheet's tabs (title, size),
228
+ * so the owner can choose one and the caller can build the preview `range`.
229
+ * Throws with `code` `NO_GOOGLE_GRANT` (connect Google Sheets first),
230
+ * `NO_SHEETS_SCOPE` (reconnect), or `SHEET_READ_FAILED` (Google refused:
231
+ * not found / not shared / API disabled). */
232
+ async tabs(spreadsheetId) {
233
+ const res = await this.client.request('GET', `${BASE}/sheets/${seg(spreadsheetId)}/tabs`, undefined, TENANT_AUTH);
234
+ return res.tabs;
235
+ }
236
+ /** `POST /sheets/template` — create a NEW Google Sheet in the tenant's Drive
237
+ * (its google-sheets grant), already laid out as the catalog template: the
238
+ * same columns as `import.template()` (codigo, nombre, precio, categoria,
239
+ * descripcion, stock, foto_url, tipo), header bold + frozen, HEADER ROW
240
+ * ONLY (no example rows — the sheet is a live sync source), codigo as
241
+ * plain text, number formats on precio/stock and a producto|servicio
242
+ * dropdown on tipo. `codigo` maps to `externalId`: a stable product id, so
243
+ * renaming a row updates the same product. Rows synced without a valid
244
+ * price are kept as `priceKind: 'on_request'` (with a warning). The
245
+ * result plugs straight into `create()`. Throws with `code`
246
+ * `NO_GOOGLE_GRANT`, `NO_SHEETS_SCOPE` (reconnect), `SHEET_CREATE_FAILED`
247
+ * (Google refused), `INVALID_LOCALE` or `INVALID_TITLE`. Each call creates
248
+ * a new spreadsheet. */
249
+ async createTemplateSheet(input = {}) {
250
+ return this.client.request('POST', `${BASE}/sheets/template`, input, TENANT_AUTH);
251
+ }
225
252
  /** `POST /import-sources/preview` — sample a Google Sheet (headers, rows,
226
253
  * suggested mapping) before saving a source. Needs a connected Google grant
227
- * (`NO_GOOGLE_GRANT` otherwise). */
254
+ * (`NO_GOOGLE_GRANT` otherwise). Pass `range` (or at least `sheetTab`, from
255
+ * `tabs()`): the platform's fallback is `Sheet1!A1:Z7`, not the first tab. */
228
256
  async preview(input) {
229
257
  return this.client.request('POST', `${BASE}/import-sources/preview`, input, TENANT_AUTH);
230
258
  }
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { AppUserConnectorStatus, ConnectorDefaultsResult, ConnectorStatus, CreateClickupTaskInput, CreateClickupTaskResult, ListConnectorResourcesResult, ToolPermission } from '../types';
2
+ import type { AppUserConnectorStatus, ConnectorDefaultsResult, ConnectorStatus, CreateClickupTaskInput, CreateClickupTaskResult, GoogleSheetsPickerInput, GoogleSheetsPickerResult, GoogleSheetsPickerSession, ListConnectorResourcesResult, ToolPermission } from '../types';
3
3
  export declare class ConnectorsResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -39,6 +39,28 @@ export declare class ConnectorsResource {
39
39
  }): Promise<{
40
40
  url: string;
41
41
  }>;
42
+ /**
43
+ * `POST /api/v1/connectors/google-sheets/picker-session` (AGF-CATALOG-ONB
44
+ * C5c) — a one-time URL (5 min, consumed on first load) of a page hosted by
45
+ * the platform where the business owner picks a spreadsheet in Google's own
46
+ * Picker UI, instead of pasting a link. Open `url` in the owner's browser
47
+ * (e.g. `WebBrowser.openAuthSessionAsync(url, returnTo)`); the page then
48
+ * navigates to `returnTo` with `?spreadsheetId=…&name=…`, or
49
+ * `?pickerError=<code>` (`CANCELLED`, `NO_GOOGLE_GRANT`, `RECONNECT_REQUIRED`
50
+ * — the grant predates the `drive.file` scope: run `authorizeForTenant('google-sheets')`
51
+ * again — …). Read it back with `parseGoogleSheetsPickerResult()`.
52
+ *
53
+ * Tenant-wide credential (`ak_live_`, or App secret + `forTenant`). Throws
54
+ * `AgentForgeError` with `code` `INVALID_RETURN_TO` (origin not allowed by
55
+ * the platform), `INVALID_LOCALE`, or `PICKER_NOT_CONFIGURED` (503).
56
+ *
57
+ * @example
58
+ * const { url } = await af.forTenant(tenantId).connectors.googleSheetsPicker({
59
+ * returnTo: 'https://app.example.com/catalog/sheets',
60
+ * locale: 'es',
61
+ * });
62
+ */
63
+ googleSheetsPicker(input: GoogleSheetsPickerInput): Promise<GoogleSheetsPickerSession>;
42
64
  /**
43
65
  * `POST /connectors/oauth/:id/api-key-for-tenant` — guarda un API key
44
66
  * pegado por el usuario para el tenant del ak_live_ (sin sesión de
@@ -386,3 +408,16 @@ export interface InboxChannelView {
386
408
  createdAt: string;
387
409
  updatedAt: string;
388
410
  }
411
+ /**
412
+ * Reads the Google Sheets Picker outcome from the `returnTo` URL the hosted
413
+ * picker navigated to (`connectors.googleSheetsPicker()`). Accepts the full
414
+ * URL, its search string, `URLSearchParams`, or a plain query object (e.g.
415
+ * Expo Router's `useLocalSearchParams()`). Returns `null` when the URL carries
416
+ * no picker result.
417
+ *
418
+ * @example
419
+ * const r = parseGoogleSheetsPickerResult(result.url);
420
+ * if (r?.ok) await biz.catalog.sources.tabs(r.spreadsheetId);
421
+ * else if (r?.error === 'RECONNECT_REQUIRED') { … }
422
+ */
423
+ export declare function parseGoogleSheetsPickerResult(input: string | URL | URLSearchParams | Record<string, string | string[] | undefined>): GoogleSheetsPickerResult | null;
@@ -14,6 +14,7 @@
14
14
  // llaman `this.client.request()` directo en lugar de `requestWithApiKey()`.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ConnectorsResource = void 0;
17
+ exports.parseGoogleSheetsPickerResult = parseGoogleSheetsPickerResult;
17
18
  class ConnectorsResource {
18
19
  constructor(client) {
19
20
  this.client = client;
@@ -57,6 +58,30 @@ class ConnectorsResource {
57
58
  : '';
58
59
  return this.client.requestWithApiKey('POST', `/connectors/oauth/${encodeURIComponent(connectorId)}/authorize-for-tenant${qs}`);
59
60
  }
61
+ /**
62
+ * `POST /api/v1/connectors/google-sheets/picker-session` (AGF-CATALOG-ONB
63
+ * C5c) — a one-time URL (5 min, consumed on first load) of a page hosted by
64
+ * the platform where the business owner picks a spreadsheet in Google's own
65
+ * Picker UI, instead of pasting a link. Open `url` in the owner's browser
66
+ * (e.g. `WebBrowser.openAuthSessionAsync(url, returnTo)`); the page then
67
+ * navigates to `returnTo` with `?spreadsheetId=…&name=…`, or
68
+ * `?pickerError=<code>` (`CANCELLED`, `NO_GOOGLE_GRANT`, `RECONNECT_REQUIRED`
69
+ * — the grant predates the `drive.file` scope: run `authorizeForTenant('google-sheets')`
70
+ * again — …). Read it back with `parseGoogleSheetsPickerResult()`.
71
+ *
72
+ * Tenant-wide credential (`ak_live_`, or App secret + `forTenant`). Throws
73
+ * `AgentForgeError` with `code` `INVALID_RETURN_TO` (origin not allowed by
74
+ * the platform), `INVALID_LOCALE`, or `PICKER_NOT_CONFIGURED` (503).
75
+ *
76
+ * @example
77
+ * const { url } = await af.forTenant(tenantId).connectors.googleSheetsPicker({
78
+ * returnTo: 'https://app.example.com/catalog/sheets',
79
+ * locale: 'es',
80
+ * });
81
+ */
82
+ async googleSheetsPicker(input) {
83
+ return this.client.requestWithApiKey('POST', '/api/v1/connectors/google-sheets/picker-session', { returnTo: input.returnTo, ...(input.locale ? { locale: input.locale } : {}) });
84
+ }
60
85
  /**
61
86
  * `POST /connectors/oauth/:id/api-key-for-tenant` — guarda un API key
62
87
  * pegado por el usuario para el tenant del ak_live_ (sin sesión de
@@ -448,3 +473,47 @@ class ConnectorsResource {
448
473
  }
449
474
  }
450
475
  exports.ConnectorsResource = ConnectorsResource;
476
+ /**
477
+ * Reads the Google Sheets Picker outcome from the `returnTo` URL the hosted
478
+ * picker navigated to (`connectors.googleSheetsPicker()`). Accepts the full
479
+ * URL, its search string, `URLSearchParams`, or a plain query object (e.g.
480
+ * Expo Router's `useLocalSearchParams()`). Returns `null` when the URL carries
481
+ * no picker result.
482
+ *
483
+ * @example
484
+ * const r = parseGoogleSheetsPickerResult(result.url);
485
+ * if (r?.ok) await biz.catalog.sources.tabs(r.spreadsheetId);
486
+ * else if (r?.error === 'RECONNECT_REQUIRED') { … }
487
+ */
488
+ function parseGoogleSheetsPickerResult(input) {
489
+ const get = toGetter(input);
490
+ const error = get('pickerError');
491
+ if (error)
492
+ return { ok: false, error };
493
+ const spreadsheetId = get('spreadsheetId');
494
+ if (!spreadsheetId)
495
+ return null;
496
+ return { ok: true, spreadsheetId, name: get('name') ?? '' };
497
+ }
498
+ function toGetter(input) {
499
+ let params = null;
500
+ if (input instanceof URLSearchParams)
501
+ params = input;
502
+ else if (input instanceof URL)
503
+ params = input.searchParams;
504
+ else if (typeof input === 'string') {
505
+ const q = input.indexOf('?');
506
+ const query = q >= 0 ? input.slice(q + 1) : input;
507
+ params = new URLSearchParams(query.split('#')[0]);
508
+ }
509
+ if (params) {
510
+ const p = params;
511
+ return (key) => p.get(key) || undefined;
512
+ }
513
+ const obj = input;
514
+ return (key) => {
515
+ const v = obj[key];
516
+ const first = Array.isArray(v) ? v[0] : v;
517
+ return first || undefined;
518
+ };
519
+ }
@@ -0,0 +1,12 @@
1
+ import type { AgentForgeClient } from '../client';
2
+ import type { MarketplaceCategory, MarketplaceCategoryGroup } from '../types';
3
+ export interface ListMarketplaceCategoriesInput {
4
+ /** Only this group; omit for both. */
5
+ group?: MarketplaceCategoryGroup;
6
+ }
7
+ export declare class MarketplaceResource {
8
+ private readonly client;
9
+ constructor(client: AgentForgeClient);
10
+ /** `GET /api/v1/marketplace/categories` — active categories, by sort order. */
11
+ categories(input?: ListMarketplaceCategoriesInput): Promise<MarketplaceCategory[]>;
12
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // marketplace resource — the platform's marketplace category list
3
+ // (AGF-MARKET-LISTING). A host App reads it to render category chips (label
4
+ // per locale + lucide icon name) and to filter `templates.list({ categories })`.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MarketplaceResource = void 0;
7
+ class MarketplaceResource {
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /** `GET /api/v1/marketplace/categories` — active categories, by sort order. */
12
+ async categories(input = {}) {
13
+ const qs = new URLSearchParams();
14
+ if (input.group)
15
+ qs.set('group', input.group);
16
+ const query = qs.toString();
17
+ const res = await this.client.request('GET', `/api/v1/marketplace/categories${query ? `?${query}` : ''}`);
18
+ return res.items;
19
+ }
20
+ }
21
+ exports.MarketplaceResource = MarketplaceResource;
@@ -12,6 +12,11 @@ export interface ListTemplatesInput {
12
12
  scope?: 'own' | 'market';
13
13
  /** Free-text search. */
14
14
  q?: string;
15
+ /** AGF-MARKET-LISTING. Templates linked to ANY of these category slugs
16
+ * (sent as `categories=a,b`). */
17
+ categories?: string[];
18
+ /** Templates whose PRIMARY category is this slug. */
19
+ primaryCategory?: string;
15
20
  /** 1–200. */
16
21
  limit?: number;
17
22
  }
@@ -31,6 +31,10 @@ class TemplatesResource {
31
31
  qs.set('scope', input.scope);
32
32
  if (input.q)
33
33
  qs.set('q', input.q);
34
+ if (input.categories?.length)
35
+ qs.set('categories', input.categories.join(','));
36
+ if (input.primaryCategory)
37
+ qs.set('primaryCategory', input.primaryCategory);
34
38
  if (input.limit !== undefined)
35
39
  qs.set('limit', String(input.limit));
36
40
  const query = qs.toString();
package/dist/types.d.ts CHANGED
@@ -839,7 +839,17 @@ export interface TemplateSummary {
839
839
  name: string;
840
840
  description?: string;
841
841
  icon?: string;
842
+ /** @deprecated Legacy free text; mirrors the primary category slug. Use `categories`. */
842
843
  category?: string;
844
+ /** AGF-MARKET-LISTING. Listing images (platform storage URLs). */
845
+ logoUrl?: string;
846
+ coverUrl?: string;
847
+ /** Language the listing is written in. */
848
+ locale?: MarketplaceLocale;
849
+ /** Category chips; exactly one has `primary: true` when any are linked. */
850
+ categories: TemplateCategoryRef[];
851
+ /** Who published it: the workspace name, or 'AgentForge' for system rows. */
852
+ publisherName?: string;
843
853
  tags?: string[];
844
854
  visibility: 'system' | 'tenant' | 'public';
845
855
  requiresConnectors?: string[];
@@ -848,7 +858,10 @@ export interface TemplateSummary {
848
858
  configSchema?: TemplateConfigField[];
849
859
  installsCount: number;
850
860
  currentVersion: number;
861
+ /** One-time price in cents (USD). 0 / undefined = free. */
851
862
  priceCents?: number;
863
+ /** Marketplace review state. */
864
+ marketplaceStatus?: 'none' | 'pending_review' | 'approved' | 'rejected';
852
865
  createdAt: string;
853
866
  updatedAt: string;
854
867
  [field: string]: unknown;
@@ -856,6 +869,37 @@ export interface TemplateSummary {
856
869
  /** `GET /api/v1/templates/:id` — summary + the snapshot it installs. */
857
870
  export interface TemplateDetail extends TemplateSummary {
858
871
  payload: Record<string, unknown>;
872
+ /** Template guide in Markdown (AGF-TEMPLATE-DETAIL). Detail only — never in
873
+ * lists. Raw HTML is refused on write; a YouTube/Vimeo URL on its own line
874
+ * is an embed; images are https URLs. */
875
+ guideMd?: string;
876
+ /** ISO timestamp of the last guide change. */
877
+ guideUpdatedAt?: string;
878
+ }
879
+ /** AGF-MARKET-LISTING. Languages a listing can be written in. */
880
+ export type MarketplaceLocale = 'es' | 'en';
881
+ /** `industry` = what the business is; `use_case` = what the template does. */
882
+ export type MarketplaceCategoryGroup = 'industry' | 'use_case';
883
+ /** A template's link to a category, as embedded in `TemplateSummary.categories`. */
884
+ export interface TemplateCategoryRef {
885
+ slug: string;
886
+ group: MarketplaceCategoryGroup;
887
+ primary: boolean;
888
+ /** False once an admin deactivated the category; the link stays. */
889
+ active: boolean;
890
+ /** Label per locale, e.g. `{ es: 'Comida', en: 'Food' }`. */
891
+ labels: Record<string, string>;
892
+ }
893
+ /** `GET /api/v1/marketplace/categories` item. */
894
+ export interface MarketplaceCategory {
895
+ id: string;
896
+ slug: string;
897
+ group: MarketplaceCategoryGroup;
898
+ labels: Record<string, string>;
899
+ /** lucide icon name (e.g. 'UtensilsCrossed'), or null. */
900
+ icon: string | null;
901
+ sortOrder: number;
902
+ active: boolean;
859
903
  }
860
904
  /** `POST /api/v1/templates/:id/install` result. */
861
905
  export interface TemplateInstallResult {
@@ -1155,6 +1199,11 @@ export interface CatalogImportColumnMapping {
1155
1199
  externalId?: string;
1156
1200
  description?: string;
1157
1201
  image?: string;
1202
+ /** The "tipo" column: `producto`/`product` → product, `servicio`/`service`
1203
+ * → service (services never carry stock); blank keeps the default, any
1204
+ * other value → product with a warning. Optional; omit for sources
1205
+ * without such a column. */
1206
+ kind?: string;
1158
1207
  }
1159
1208
  export interface CatalogImportRunResult {
1160
1209
  created: number;
@@ -1174,6 +1223,15 @@ export interface CatalogImportSource {
1174
1223
  spreadsheetId?: string | null;
1175
1224
  sheetTab?: string | null;
1176
1225
  range?: string | null;
1226
+ /** The synced file's name, for display (e.g. "Catálogo de prueba
1227
+ * (AgentForge)"): the spreadsheet title for `google-sheets`, the shop
1228
+ * domain for `shopify`. `list()` backfills it from Google when missing;
1229
+ * null when it could not be read (no grant, sheet not shared…) — fall
1230
+ * back to `sheetTab` then. Absent on platforms older than C5f. */
1231
+ name?: string | null;
1232
+ /** Link that opens the source (the Sheets edit URL for `google-sheets`;
1233
+ * null for other connectors). Derived by the platform — don't build it. */
1234
+ url?: string | null;
1177
1235
  columnMapping: CatalogImportColumnMapping;
1178
1236
  /** Per-connector extras, e.g. `{ shop: 'acme.myshopify.com' }`. */
1179
1237
  config: {
@@ -1196,6 +1254,10 @@ export interface CreateCatalogImportSourceInput {
1196
1254
  sheetTab?: string;
1197
1255
  /** A1 range, e.g. "Menu!A1:E999". Required for `google-sheets`. */
1198
1256
  range?: string;
1257
+ /** File name to show (≤255, trimmed; blank = none) — e.g. the `name` from
1258
+ * `createTemplateSheet()` or the Google Picker result. Omit it and
1259
+ * `list()` fills it from Google. */
1260
+ name?: string | null;
1199
1261
  columnMapping?: CatalogImportColumnMapping;
1200
1262
  config?: {
1201
1263
  shop?: string;
@@ -1210,6 +1272,10 @@ export interface UpdateCatalogImportSourceInput {
1210
1272
  spreadsheetId?: string;
1211
1273
  sheetTab?: string | null;
1212
1274
  range?: string;
1275
+ /** File name (≤255, trimmed). `null`/blank clears it (the next `list()`
1276
+ * re-reads it from Google). Changing `spreadsheetId` without `name` also
1277
+ * clears the old file's name. */
1278
+ name?: string | null;
1213
1279
  columnMapping?: CatalogImportColumnMapping;
1214
1280
  config?: {
1215
1281
  shop?: string;
@@ -1221,10 +1287,55 @@ export interface UpdateCatalogImportSourceInput {
1221
1287
  }
1222
1288
  export interface PreviewCatalogImportSourceInput {
1223
1289
  spreadsheetId: string;
1290
+ /** Tab title (see `catalog.sources.tabs()`). Used to build the default
1291
+ * range when `range` is omitted. */
1224
1292
  sheetTab?: string;
1225
- /** Defaults to a small header+sample window of the first tab. */
1293
+ /** A1 range to sample, e.g. `'Hoja 1'!A1:Z7`. Callers SHOULD pass it (or at
1294
+ * least `sheetTab`): when both are omitted the platform reads
1295
+ * `Sheet1!A1:Z7` — NOT the first tab — which fails on sheets whose first
1296
+ * tab has another name (Spanish Google Sheets default to `Hoja 1`). Get
1297
+ * the real tab titles from `catalog.sources.tabs(spreadsheetId)`. */
1226
1298
  range?: string;
1227
1299
  }
1300
+ /** Input of `catalog.sources.createTemplateSheet()`. */
1301
+ export interface CreateCatalogTemplateSheetInput {
1302
+ /** Spreadsheet title (max 200). Default `Catálogo` (es) / `Catalog` (en);
1303
+ * pass e.g. `Catálogo — <business name>`. */
1304
+ title?: string;
1305
+ /** `'es'` (default) or `'en'` (`'es-CO'` etc. accepted): names the tab
1306
+ * `Catálogo` / `Catalog`. The header row is the same in both. */
1307
+ locale?: string;
1308
+ }
1309
+ /** A new Google Sheet laid out as the catalog template (header row only, no
1310
+ * example rows). Pass `spreadsheetId`,
1311
+ * `sheetTab`, `range` and `columnMapping` straight to `catalog.sources.create`
1312
+ * (`connectorId: 'google-sheets'`) — no mapping step needed. */
1313
+ export interface CatalogTemplateSheet {
1314
+ spreadsheetId: string;
1315
+ /** Link to open the sheet in Google Sheets. */
1316
+ url: string;
1317
+ /** Spreadsheet title. */
1318
+ name: string;
1319
+ /** Tab holding the catalog (`Catálogo` / `Catalog`). */
1320
+ sheetTab: string;
1321
+ /** `'<tab>'!A1:<lastColumn>`, e.g. `'Catálogo'!A1:H`. */
1322
+ range: string;
1323
+ /** Exact header → field mapping of the template, e.g. `{ externalId:
1324
+ * 'codigo', title: 'nombre', priceCents: 'precio', kind: 'tipo', … }`. */
1325
+ columnMapping: CatalogImportColumnMapping;
1326
+ /** Present when the sheet was created but its formatting (number formats,
1327
+ * "tipo" dropdown) could not be applied; the sheet is still usable. */
1328
+ warnings?: string[];
1329
+ }
1330
+ /** One tab of a Google Sheet (`catalog.sources.tabs()`). */
1331
+ export interface CatalogSheetTab {
1332
+ sheetId: number;
1333
+ title: string;
1334
+ /** 0-based position of the tab in the spreadsheet. */
1335
+ index: number;
1336
+ rows: number;
1337
+ columns: number;
1338
+ }
1228
1339
  export interface CatalogImportSourcePreview {
1229
1340
  headers: string[];
1230
1341
  sampleRows: string[][];
@@ -1232,4 +1343,31 @@ export interface CatalogImportSourcePreview {
1232
1343
  confidence?: 'high' | 'medium' | 'low';
1233
1344
  notes?: string;
1234
1345
  }
1346
+ export interface GoogleSheetsPickerInput {
1347
+ /** Where the hosted picker sends the owner back. Must be an origin the
1348
+ * platform allows (`CONNECTOR_RETURN_ALLOWED_ORIGINS`, the platform's own
1349
+ * domains, or — outside production — loopback), or a listed custom scheme
1350
+ * (`myapp://…`). Otherwise the call fails with `code: 'INVALID_RETURN_TO'`. */
1351
+ returnTo: string;
1352
+ /** Picker UI language, e.g. `'es'` or `'es-419'`. Defaults to the browser's. */
1353
+ locale?: string;
1354
+ }
1355
+ export interface GoogleSheetsPickerSession {
1356
+ /** One-time URL (valid 5 minutes, consumed on first load) to open in the
1357
+ * owner's browser. */
1358
+ url: string;
1359
+ /** ISO timestamp after which `url` no longer works. */
1360
+ expiresAt: string;
1361
+ }
1362
+ /** `pickerError` values the picker appends to `returnTo`. */
1363
+ export type GoogleSheetsPickerErrorCode = 'CANCELLED' | 'NOTHING_PICKED' | 'PICKER_ERROR' | 'PICKER_LOAD_FAILED' | 'PICKER_NOT_CONFIGURED' | 'NO_GOOGLE_GRANT' | 'RECONNECT_REQUIRED';
1364
+ /** Result read back from the `returnTo` URL (`parseGoogleSheetsPickerResult`). */
1365
+ export type GoogleSheetsPickerResult = {
1366
+ ok: true;
1367
+ spreadsheetId: string;
1368
+ name: string;
1369
+ } | {
1370
+ ok: false;
1371
+ error: GoogleSheetsPickerErrorCode | (string & {});
1372
+ };
1235
1373
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.16.0",
3
+ "version": "4.18.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",