@agentforge-io/sdk-server 4.59.0 → 4.61.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, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, 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, DeliveryRoute, DeliveryRouteInput, 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, 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';
6
+ 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, 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, 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, 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';
7
7
  export { AgentsResource } from './resources/agents';
8
8
  export { AnalyticsResource } from './resources/analytics';
9
9
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CreateTemplateReportInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateDetail, TemplateInstallResult, TemplateReview, TemplateReviewsPage, TemplateSummary } from '../types';
2
+ import type { 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']. */
@@ -29,7 +29,29 @@ export declare class TemplatesResource {
29
29
  constructor(client: AgentForgeClient);
30
30
  /** `GET /api/v1/templates` — templates visible to the caller's tenant. */
31
31
  list(input?: ListTemplatesInput): Promise<TemplateSummary[]>;
32
- /** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. */
32
+ /**
33
+ * `PUT /api/v1/templates/system/:slug` — create or update, by a stable
34
+ * `slug`, a private template in the App's HOME tenant: `visibility='tenant'`,
35
+ * unlisted (`listed: false`), no share link. Needs the App secret (`sk_live_`);
36
+ * a tenant key gets 403. Idempotent: the same definition again publishes no
37
+ * new version (`action: 'unchanged'`); a changed one publishes the next
38
+ * (`'updated'`, `template.currentVersion` + 1). Install it, by the returned
39
+ * `template.id`, with `forTenant(tenantId).templates.install(id)`.
40
+ *
41
+ * 400 `{ code: 'invalid_slug' | 'invalid_definition' }` or `template_incomplete`
42
+ * on a bad definition; 409 `kind_mismatch` when the slug is a template of the
43
+ * other kind.
44
+ *
45
+ * @example
46
+ * const { template } = await af.templates.upsertSystem('poodledeck-base-store', {
47
+ * kind: 'team',
48
+ * name: 'Tienda PoodleDeck',
49
+ * tags: ['poodledeck-base-store'],
50
+ * payload: { team, orchestrator, members },
51
+ * });
52
+ */
53
+ upsertSystem(slug: string, input: UpsertSystemTemplateInput): Promise<UpsertSystemTemplateResult>;
54
+ /** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
33
55
  get(templateId: string): Promise<TemplateDetail>;
34
56
  /** `POST /api/v1/templates/:id/install` — clone into the caller's tenant. */
35
57
  install(templateId: string, input?: {
@@ -12,6 +12,11 @@
12
12
  // Installing copies the team, members, orchestrator, skills and tools, and
13
13
  // creates the template's config variables EMPTY (`configCreated`); fill them
14
14
  // with `config.set`. Rows created by an App secret are owned by the App.
15
+ //
16
+ // AGF-PDK-SUPERADMIN: an App can keep a PRIVATE template of its own in its home
17
+ // tenant from code (`upsertSystem`). It is unlisted — in no `list` (not even
18
+ // `scope: 'own'`) — and reachable only by id (`get` / `install`) from the App
19
+ // and its own tenant, so a host installs it for exactly the people it chooses.
15
20
  Object.defineProperty(exports, "__esModule", { value: true });
16
21
  exports.TemplateReportsResource = exports.TemplateReviewsResource = exports.TemplatesResource = void 0;
17
22
  class TemplatesResource {
@@ -43,7 +48,31 @@ class TemplatesResource {
43
48
  const res = await this.client.request('GET', `/api/v1/templates${query ? `?${query}` : ''}`);
44
49
  return res.items;
45
50
  }
46
- /** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. */
51
+ /**
52
+ * `PUT /api/v1/templates/system/:slug` — create or update, by a stable
53
+ * `slug`, a private template in the App's HOME tenant: `visibility='tenant'`,
54
+ * unlisted (`listed: false`), no share link. Needs the App secret (`sk_live_`);
55
+ * a tenant key gets 403. Idempotent: the same definition again publishes no
56
+ * new version (`action: 'unchanged'`); a changed one publishes the next
57
+ * (`'updated'`, `template.currentVersion` + 1). Install it, by the returned
58
+ * `template.id`, with `forTenant(tenantId).templates.install(id)`.
59
+ *
60
+ * 400 `{ code: 'invalid_slug' | 'invalid_definition' }` or `template_incomplete`
61
+ * on a bad definition; 409 `kind_mismatch` when the slug is a template of the
62
+ * other kind.
63
+ *
64
+ * @example
65
+ * const { template } = await af.templates.upsertSystem('poodledeck-base-store', {
66
+ * kind: 'team',
67
+ * name: 'Tienda PoodleDeck',
68
+ * tags: ['poodledeck-base-store'],
69
+ * payload: { team, orchestrator, members },
70
+ * });
71
+ */
72
+ async upsertSystem(slug, input) {
73
+ return this.client.request('PUT', `/api/v1/templates/system/${encodeURIComponent(slug)}`, input);
74
+ }
75
+ /** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
47
76
  async get(templateId) {
48
77
  return this.client.request('GET', `/api/v1/templates/${encodeURIComponent(templateId)}`);
49
78
  }
package/dist/types.d.ts CHANGED
@@ -49,6 +49,14 @@ export interface PublicAppBranding {
49
49
  coverUrl: string | null;
50
50
  }
51
51
  export interface AppSelf {
52
+ /**
53
+ * AGF-PDK-SUPERADMIN — the user who owns the App's tenant: who created the
54
+ * App in AgentForge. Only `GET /apps/me` carries it, and only for the App's
55
+ * own `sk_live_`; no other App route exposes it. `null` when the owner no
56
+ * longer exists. Absent on platforms older than the field, and when the
57
+ * client authenticates with a tenant key (`ak_live_`).
58
+ */
59
+ owner?: AppOwner | null;
52
60
  id: string;
53
61
  name: string;
54
62
  description: string | null;
@@ -65,6 +73,13 @@ export interface AppSelf {
65
73
  createdAt: string;
66
74
  updatedAt: string;
67
75
  }
76
+ /** AGF-PDK-SUPERADMIN — see {@link AppSelf.owner}. */
77
+ export interface AppOwner {
78
+ userId: string;
79
+ /** Null when the owner has no email on file. */
80
+ email: string | null;
81
+ name: string | null;
82
+ }
68
83
  export interface AppSelfConnector {
69
84
  connectorId: string;
70
85
  name: string;
@@ -875,6 +890,13 @@ export interface TemplateSummary {
875
890
  publisherName?: string;
876
891
  tags?: string[];
877
892
  visibility: 'system' | 'tenant' | 'public';
893
+ /** AGF-PDK-SUPERADMIN. False = an unlisted template: in no list (not even
894
+ * `scope: 'own'`), readable and installable by id only from its own tenant.
895
+ * Absent on platforms older than the field: treat as `true`. */
896
+ listed?: boolean;
897
+ /** AGF-PDK-SUPERADMIN. Stable key of a template kept in sync from code
898
+ * (`templates.upsertSystem`). */
899
+ slug?: string;
878
900
  requiresConnectors?: string[];
879
901
  requiresSecrets?: string[];
880
902
  requiresConfig?: string[];
@@ -903,6 +925,40 @@ export interface TemplateSummary {
903
925
  updatedAt: string;
904
926
  [field: string]: unknown;
905
927
  }
928
+ /**
929
+ * AGF-PDK-SUPERADMIN — `templates.upsertSystem` input: the definition of a
930
+ * private template an App keeps in sync from code. `payload` is the agent /
931
+ * team template payload (the same shape `templates.get(id).payload` returns):
932
+ * `{ agent }` for `kind: 'agent'`, `{ team, orchestrator, members }` for
933
+ * `kind: 'team'`. Defaults are filled for what a snapshot always carries
934
+ * (`visibility: 'private'`, `profileTemplate: 'minimal'`, agent `kind`, the
935
+ * orchestrator's `subAgentSlugs` = the members). `visibility` and `listed` are
936
+ * not inputs: the template is always `visibility='tenant'`, `listed=false`.
937
+ */
938
+ export interface UpsertSystemTemplateInput {
939
+ kind: 'agent' | 'team';
940
+ name: string;
941
+ description?: string;
942
+ icon?: string;
943
+ category?: string;
944
+ tags?: string[];
945
+ /** Release note recorded when this publishes a new version. */
946
+ changelog?: string;
947
+ payload: Record<string, unknown>;
948
+ /** Settings fields the installer is asked for (the definition is
949
+ * authoritative: a field not listed here, and not referenced by a
950
+ * `{{config:KEY}}` in a prompt, is dropped). May also sit in `payload.configSchema`. */
951
+ configSchema?: TemplateConfigField[];
952
+ /** Force "sells from the catalog" on; omitted = derived from the payload. */
953
+ usesCatalog?: boolean;
954
+ }
955
+ /** `created`: new template (v1). `updated`: a new version was published, or
956
+ * display fields changed (compare `template.currentVersion`). `unchanged`:
957
+ * the same definition was already there — nothing written. */
958
+ export interface UpsertSystemTemplateResult {
959
+ action: 'created' | 'updated' | 'unchanged';
960
+ template: TemplateDetail;
961
+ }
906
962
  /** `GET /api/v1/templates/:id` — summary + the snapshot it installs. */
907
963
  export interface TemplateDetail extends TemplateSummary {
908
964
  payload: Record<string, unknown>;
@@ -2316,6 +2372,11 @@ export interface CaseReceiptLine {
2316
2372
  /** AGF-PRODUCT-SKU — the product's inventory code as it is now (absent: none, or an older platform). */
2317
2373
  sku?: string;
2318
2374
  }
2375
+ /** One option group's choice on a proposed alternative: the group and what was picked in it (ids, or names). */
2376
+ export interface CaseProposalSwapOption {
2377
+ group: string;
2378
+ options: string[];
2379
+ }
2319
2380
  /** AGF-PDK-DISPATCH-PROPOSAL — one change to a line: out of stock, or swapped for another product. */
2320
2381
  export interface CaseProposalChange {
2321
2382
  /** The receipt line's `key`. */
@@ -2332,8 +2393,12 @@ export interface CaseProposalChange {
2332
2393
  unitCents: number | null;
2333
2394
  currency: string;
2334
2395
  coverUrl: string | null;
2335
- /** What it costs for the line's quantity; null when that cannot be said. */
2396
+ /** What it costs for the line's quantity, options included; null when that cannot be said. */
2336
2397
  amountCents: number | null;
2398
+ /** The choice made on the alternative (group id → option ids). Absent: none, or an older platform. */
2399
+ options?: CaseProposalSwapOption[];
2400
+ /** The choice as the customer reads it («Arroz, Sin cebolla»). */
2401
+ optionsLabel?: string;
2337
2402
  };
2338
2403
  /** The answer to an alternative (an out-of-stock line is always `drop`); absent while pending. */
2339
2404
  answer?: 'keep' | 'drop';
@@ -2365,8 +2430,10 @@ export interface CaseProposalInput {
2365
2430
  out: true;
2366
2431
  } | {
2367
2432
  line: string;
2433
+ /** `options`: required when the alternative has a required option group (refused at propose time otherwise). */
2368
2434
  swap: {
2369
2435
  productId: string;
2436
+ options?: CaseProposalSwapOption[];
2370
2437
  };
2371
2438
  }>;
2372
2439
  /** Words for the customer (≤ 500). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.59.0",
3
+ "version": "4.61.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",