@agentforge-io/sdk-server 4.61.0 → 4.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +20 -1
- package/dist/index.d.ts +1 -1
- package/dist/resources/templates.d.ts +4 -0
- package/dist/resources/templates.js +2 -0
- package/dist/types.d.ts +48 -0
- package/package.json +1 -1
package/dist/errors.d.ts
CHANGED
|
@@ -5,6 +5,16 @@ export declare class AgentForgeError extends Error {
|
|
|
5
5
|
* legacy `{ error }`), when the platform sent one — e.g. `FILE_EMPTY_FILE`,
|
|
6
6
|
* `INVALID_MAPPING`, `CATALOG_NOT_FOUND`. Also set on 404/401/403 errors. */
|
|
7
7
|
readonly code?: string;
|
|
8
|
+
/** PDK-CONSOLE. Machine-readable `reason` of the response body, for the
|
|
9
|
+
* routes that answer `{ reason, message }` instead of `{ code }`: e.g.
|
|
10
|
+
* `publisher_app_not_found`, `publisher_app_not_live`,
|
|
11
|
+
* `publisher_policy_violation`, `invalid_publisher_app_id`,
|
|
12
|
+
* `invalid_template_policy`. (`invalid_publisher` / `publisher_needs_app`
|
|
13
|
+
* arrive as `code`.) */
|
|
14
|
+
readonly reason?: string;
|
|
15
|
+
/** PDK-CONSOLE. `issues` of the response body (publication-issue shape) when
|
|
16
|
+
* present, e.g. on `publisher_policy_violation`. */
|
|
17
|
+
readonly issues?: unknown[];
|
|
8
18
|
constructor(status: number, message: string, body?: string, code?: string);
|
|
9
19
|
}
|
|
10
20
|
export declare class AgentForgeAuthError extends AgentForgeError {
|
package/dist/errors.js
CHANGED
|
@@ -9,10 +9,29 @@ class AgentForgeError extends Error {
|
|
|
9
9
|
this.name = 'AgentForgeError';
|
|
10
10
|
this.status = status;
|
|
11
11
|
this.body = body;
|
|
12
|
-
|
|
12
|
+
const extra = parseReasonAndIssues(body);
|
|
13
|
+
// `code` falls back to `reason` for routes that only send `{ reason, message }`.
|
|
14
|
+
this.code = code ?? parseErrorCode(body) ?? extra.reason;
|
|
15
|
+
this.reason = extra.reason;
|
|
16
|
+
this.issues = extra.issues;
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
exports.AgentForgeError = AgentForgeError;
|
|
20
|
+
function parseReasonAndIssues(body) {
|
|
21
|
+
if (!body)
|
|
22
|
+
return {};
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(body);
|
|
25
|
+
// Nest may wrap an object payload one level down in `message`.
|
|
26
|
+
const inner = parsed.message && typeof parsed.message === 'object' ? parsed.message : undefined;
|
|
27
|
+
const reason = typeof parsed.reason === 'string' ? parsed.reason : typeof inner?.reason === 'string' ? inner.reason : undefined;
|
|
28
|
+
const issues = Array.isArray(parsed.issues) ? parsed.issues : Array.isArray(inner?.issues) ? inner.issues : undefined;
|
|
29
|
+
return { reason, issues };
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
16
35
|
// `CASE_NOT_FOUND`-style codes, and the lowercase snake_case codes of the
|
|
17
36
|
// contacts / verification routes (`rate_limited`, `invalid_code`). Nest's
|
|
18
37
|
// status text ("Bad Request") matches neither.
|
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, 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';
|
|
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, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, 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';
|
|
@@ -17,6 +17,10 @@ export interface ListTemplatesInput {
|
|
|
17
17
|
categories?: string[];
|
|
18
18
|
/** Templates whose PRIMARY category is this slug. */
|
|
19
19
|
primaryCategory?: string;
|
|
20
|
+
/** PDK-CONSOLE. `'me'`: only templates published under the calling App
|
|
21
|
+
* (sent as `publisher=me`). Needs a platform that supports the filter;
|
|
22
|
+
* older platforms ignore it. */
|
|
23
|
+
publisher?: 'me';
|
|
20
24
|
/** 1–200. */
|
|
21
25
|
limit?: number;
|
|
22
26
|
}
|
|
@@ -42,6 +42,8 @@ class TemplatesResource {
|
|
|
42
42
|
qs.set('categories', input.categories.join(','));
|
|
43
43
|
if (input.primaryCategory)
|
|
44
44
|
qs.set('primaryCategory', input.primaryCategory);
|
|
45
|
+
if (input.publisher)
|
|
46
|
+
qs.set('publisher', input.publisher);
|
|
45
47
|
if (input.limit !== undefined)
|
|
46
48
|
qs.set('limit', String(input.limit));
|
|
47
49
|
const query = qs.toString();
|
package/dist/types.d.ts
CHANGED
|
@@ -48,6 +48,17 @@ export interface PublicAppBranding {
|
|
|
48
48
|
logoUrl: string | null;
|
|
49
49
|
coverUrl: string | null;
|
|
50
50
|
}
|
|
51
|
+
/** PDK-CONSOLE G2. Publication rules an App declares as data; applied when a
|
|
52
|
+
* template / team is published UNDER that App (server:
|
|
53
|
+
* identity/domain/app-template-policy.ts). `*` wildcards, case-insensitive.
|
|
54
|
+
* Editing it (PATCH /apps/:id) is session-only (workspace owner): not in this SDK. */
|
|
55
|
+
export interface AppTemplatePolicy {
|
|
56
|
+
requireUsesCatalog?: boolean;
|
|
57
|
+
forbiddenToolNamePatterns?: string[];
|
|
58
|
+
forbiddenConnectorIds?: string[];
|
|
59
|
+
forbiddenSecretKeyPatterns?: string[];
|
|
60
|
+
blockFixedValuesInPrompts?: boolean;
|
|
61
|
+
}
|
|
51
62
|
export interface AppSelf {
|
|
52
63
|
/**
|
|
53
64
|
* AGF-PDK-SUPERADMIN — the user who owns the App's tenant: who created the
|
|
@@ -63,6 +74,8 @@ export interface AppSelf {
|
|
|
63
74
|
logoUrl: string | null;
|
|
64
75
|
coverUrl: string | null;
|
|
65
76
|
content: string | null;
|
|
77
|
+
/** PDK-CONSOLE G2. Absent on platforms older than the field. */
|
|
78
|
+
templatePolicy?: AppTemplatePolicy | null;
|
|
66
79
|
status: 'draft' | 'published';
|
|
67
80
|
publicKey: string;
|
|
68
81
|
apiSecretPrefix: string;
|
|
@@ -869,6 +882,18 @@ export interface TemplateConfigField {
|
|
|
869
882
|
/** Resource picker for connector-backed fields (e.g. a Google Sheet). */
|
|
870
883
|
picker?: Record<string, unknown>;
|
|
871
884
|
}
|
|
885
|
+
/** PDK-CONSOLE. The App a template is published under. */
|
|
886
|
+
export interface TemplatePublisher {
|
|
887
|
+
appId: string;
|
|
888
|
+
name: string;
|
|
889
|
+
logoUrl: string | null;
|
|
890
|
+
}
|
|
891
|
+
/** PDK-CONSOLE. Who authored a template. */
|
|
892
|
+
export interface TemplateAuthor {
|
|
893
|
+
tenantId: string;
|
|
894
|
+
tenantName: string;
|
|
895
|
+
userDisplayName?: string;
|
|
896
|
+
}
|
|
872
897
|
/** A template as the API-key catalog lists it (`GET /api/v1/templates`). */
|
|
873
898
|
export interface TemplateSummary {
|
|
874
899
|
id: string;
|
|
@@ -888,6 +913,15 @@ export interface TemplateSummary {
|
|
|
888
913
|
categories: TemplateCategoryRef[];
|
|
889
914
|
/** Who published it: the workspace name, or 'AgentForge' for system rows. */
|
|
890
915
|
publisherName?: string;
|
|
916
|
+
/** PDK-CONSOLE. The App the template is published under (its brand), or
|
|
917
|
+
* null when none. Absent on platforms older than the field. */
|
|
918
|
+
publisher?: TemplatePublisher | null;
|
|
919
|
+
/** PDK-CONSOLE. The workspace (and person) that authored it. Absent on
|
|
920
|
+
* platforms older than the field. */
|
|
921
|
+
author?: TemplateAuthor | null;
|
|
922
|
+
/** PDK-CONSOLE. Raw id of the publisher App; null = published by the
|
|
923
|
+
* workspace. Absent on platforms older than the field. */
|
|
924
|
+
publisherAppId?: string | null;
|
|
891
925
|
tags?: string[];
|
|
892
926
|
visibility: 'system' | 'tenant' | 'public';
|
|
893
927
|
/** AGF-PDK-SUPERADMIN. False = an unlisted template: in no list (not even
|
|
@@ -968,6 +1002,20 @@ export interface TemplateDetail extends TemplateSummary {
|
|
|
968
1002
|
guideMd?: string;
|
|
969
1003
|
/** ISO timestamp of the last guide change. */
|
|
970
1004
|
guideUpdatedAt?: string;
|
|
1005
|
+
/** PDK-CONSOLE G4. Only for the template's own workspace and the App that
|
|
1006
|
+
* publishes it (others read `installsCount`). `total` is cumulative; `byVersion`
|
|
1007
|
+
* counts installs that exist now (`version: null` = installed before versions
|
|
1008
|
+
* were recorded). */
|
|
1009
|
+
installs?: TemplateInstallStats;
|
|
1010
|
+
}
|
|
1011
|
+
/** PDK-CONSOLE G4. See {@link TemplateDetail.installs}. */
|
|
1012
|
+
export interface TemplateInstallStats {
|
|
1013
|
+
total: number;
|
|
1014
|
+
active: number;
|
|
1015
|
+
byVersion: Array<{
|
|
1016
|
+
version: number | null;
|
|
1017
|
+
count: number;
|
|
1018
|
+
}>;
|
|
971
1019
|
}
|
|
972
1020
|
/** AGF-PDK-TEMPLATE-PAGE. A person's review of a template (one per person,
|
|
973
1021
|
* editable). Never carries the reviewer's ids. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.62.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",
|