@agentforge-io/sdk-server 4.60.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 +28 -2
- package/dist/resources/templates.js +32 -1
- package/dist/types.d.ts +104 -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, 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, 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';
|
|
@@ -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']. */
|
|
@@ -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
|
}
|
|
@@ -29,7 +33,29 @@ export declare class TemplatesResource {
|
|
|
29
33
|
constructor(client: AgentForgeClient);
|
|
30
34
|
/** `GET /api/v1/templates` — templates visible to the caller's tenant. */
|
|
31
35
|
list(input?: ListTemplatesInput): Promise<TemplateSummary[]>;
|
|
32
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* `PUT /api/v1/templates/system/:slug` — create or update, by a stable
|
|
38
|
+
* `slug`, a private template in the App's HOME tenant: `visibility='tenant'`,
|
|
39
|
+
* unlisted (`listed: false`), no share link. Needs the App secret (`sk_live_`);
|
|
40
|
+
* a tenant key gets 403. Idempotent: the same definition again publishes no
|
|
41
|
+
* new version (`action: 'unchanged'`); a changed one publishes the next
|
|
42
|
+
* (`'updated'`, `template.currentVersion` + 1). Install it, by the returned
|
|
43
|
+
* `template.id`, with `forTenant(tenantId).templates.install(id)`.
|
|
44
|
+
*
|
|
45
|
+
* 400 `{ code: 'invalid_slug' | 'invalid_definition' }` or `template_incomplete`
|
|
46
|
+
* on a bad definition; 409 `kind_mismatch` when the slug is a template of the
|
|
47
|
+
* other kind.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const { template } = await af.templates.upsertSystem('poodledeck-base-store', {
|
|
51
|
+
* kind: 'team',
|
|
52
|
+
* name: 'Tienda PoodleDeck',
|
|
53
|
+
* tags: ['poodledeck-base-store'],
|
|
54
|
+
* payload: { team, orchestrator, members },
|
|
55
|
+
* });
|
|
56
|
+
*/
|
|
57
|
+
upsertSystem(slug: string, input: UpsertSystemTemplateInput): Promise<UpsertSystemTemplateResult>;
|
|
58
|
+
/** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
|
|
33
59
|
get(templateId: string): Promise<TemplateDetail>;
|
|
34
60
|
/** `POST /api/v1/templates/:id/install` — clone into the caller's tenant. */
|
|
35
61
|
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 {
|
|
@@ -37,13 +42,39 @@ class TemplatesResource {
|
|
|
37
42
|
qs.set('categories', input.categories.join(','));
|
|
38
43
|
if (input.primaryCategory)
|
|
39
44
|
qs.set('primaryCategory', input.primaryCategory);
|
|
45
|
+
if (input.publisher)
|
|
46
|
+
qs.set('publisher', input.publisher);
|
|
40
47
|
if (input.limit !== undefined)
|
|
41
48
|
qs.set('limit', String(input.limit));
|
|
42
49
|
const query = qs.toString();
|
|
43
50
|
const res = await this.client.request('GET', `/api/v1/templates${query ? `?${query}` : ''}`);
|
|
44
51
|
return res.items;
|
|
45
52
|
}
|
|
46
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* `PUT /api/v1/templates/system/:slug` — create or update, by a stable
|
|
55
|
+
* `slug`, a private template in the App's HOME tenant: `visibility='tenant'`,
|
|
56
|
+
* unlisted (`listed: false`), no share link. Needs the App secret (`sk_live_`);
|
|
57
|
+
* a tenant key gets 403. Idempotent: the same definition again publishes no
|
|
58
|
+
* new version (`action: 'unchanged'`); a changed one publishes the next
|
|
59
|
+
* (`'updated'`, `template.currentVersion` + 1). Install it, by the returned
|
|
60
|
+
* `template.id`, with `forTenant(tenantId).templates.install(id)`.
|
|
61
|
+
*
|
|
62
|
+
* 400 `{ code: 'invalid_slug' | 'invalid_definition' }` or `template_incomplete`
|
|
63
|
+
* on a bad definition; 409 `kind_mismatch` when the slug is a template of the
|
|
64
|
+
* other kind.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const { template } = await af.templates.upsertSystem('poodledeck-base-store', {
|
|
68
|
+
* kind: 'team',
|
|
69
|
+
* name: 'Tienda PoodleDeck',
|
|
70
|
+
* tags: ['poodledeck-base-store'],
|
|
71
|
+
* payload: { team, orchestrator, members },
|
|
72
|
+
* });
|
|
73
|
+
*/
|
|
74
|
+
async upsertSystem(slug, input) {
|
|
75
|
+
return this.client.request('PUT', `/api/v1/templates/system/${encodeURIComponent(slug)}`, input);
|
|
76
|
+
}
|
|
77
|
+
/** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
|
|
47
78
|
async get(templateId) {
|
|
48
79
|
return this.client.request('GET', `/api/v1/templates/${encodeURIComponent(templateId)}`);
|
|
49
80
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -48,13 +48,34 @@ 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 {
|
|
63
|
+
/**
|
|
64
|
+
* AGF-PDK-SUPERADMIN — the user who owns the App's tenant: who created the
|
|
65
|
+
* App in AgentForge. Only `GET /apps/me` carries it, and only for the App's
|
|
66
|
+
* own `sk_live_`; no other App route exposes it. `null` when the owner no
|
|
67
|
+
* longer exists. Absent on platforms older than the field, and when the
|
|
68
|
+
* client authenticates with a tenant key (`ak_live_`).
|
|
69
|
+
*/
|
|
70
|
+
owner?: AppOwner | null;
|
|
52
71
|
id: string;
|
|
53
72
|
name: string;
|
|
54
73
|
description: string | null;
|
|
55
74
|
logoUrl: string | null;
|
|
56
75
|
coverUrl: string | null;
|
|
57
76
|
content: string | null;
|
|
77
|
+
/** PDK-CONSOLE G2. Absent on platforms older than the field. */
|
|
78
|
+
templatePolicy?: AppTemplatePolicy | null;
|
|
58
79
|
status: 'draft' | 'published';
|
|
59
80
|
publicKey: string;
|
|
60
81
|
apiSecretPrefix: string;
|
|
@@ -65,6 +86,13 @@ export interface AppSelf {
|
|
|
65
86
|
createdAt: string;
|
|
66
87
|
updatedAt: string;
|
|
67
88
|
}
|
|
89
|
+
/** AGF-PDK-SUPERADMIN — see {@link AppSelf.owner}. */
|
|
90
|
+
export interface AppOwner {
|
|
91
|
+
userId: string;
|
|
92
|
+
/** Null when the owner has no email on file. */
|
|
93
|
+
email: string | null;
|
|
94
|
+
name: string | null;
|
|
95
|
+
}
|
|
68
96
|
export interface AppSelfConnector {
|
|
69
97
|
connectorId: string;
|
|
70
98
|
name: string;
|
|
@@ -854,6 +882,18 @@ export interface TemplateConfigField {
|
|
|
854
882
|
/** Resource picker for connector-backed fields (e.g. a Google Sheet). */
|
|
855
883
|
picker?: Record<string, unknown>;
|
|
856
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
|
+
}
|
|
857
897
|
/** A template as the API-key catalog lists it (`GET /api/v1/templates`). */
|
|
858
898
|
export interface TemplateSummary {
|
|
859
899
|
id: string;
|
|
@@ -873,8 +913,24 @@ export interface TemplateSummary {
|
|
|
873
913
|
categories: TemplateCategoryRef[];
|
|
874
914
|
/** Who published it: the workspace name, or 'AgentForge' for system rows. */
|
|
875
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;
|
|
876
925
|
tags?: string[];
|
|
877
926
|
visibility: 'system' | 'tenant' | 'public';
|
|
927
|
+
/** AGF-PDK-SUPERADMIN. False = an unlisted template: in no list (not even
|
|
928
|
+
* `scope: 'own'`), readable and installable by id only from its own tenant.
|
|
929
|
+
* Absent on platforms older than the field: treat as `true`. */
|
|
930
|
+
listed?: boolean;
|
|
931
|
+
/** AGF-PDK-SUPERADMIN. Stable key of a template kept in sync from code
|
|
932
|
+
* (`templates.upsertSystem`). */
|
|
933
|
+
slug?: string;
|
|
878
934
|
requiresConnectors?: string[];
|
|
879
935
|
requiresSecrets?: string[];
|
|
880
936
|
requiresConfig?: string[];
|
|
@@ -903,6 +959,40 @@ export interface TemplateSummary {
|
|
|
903
959
|
updatedAt: string;
|
|
904
960
|
[field: string]: unknown;
|
|
905
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* AGF-PDK-SUPERADMIN — `templates.upsertSystem` input: the definition of a
|
|
964
|
+
* private template an App keeps in sync from code. `payload` is the agent /
|
|
965
|
+
* team template payload (the same shape `templates.get(id).payload` returns):
|
|
966
|
+
* `{ agent }` for `kind: 'agent'`, `{ team, orchestrator, members }` for
|
|
967
|
+
* `kind: 'team'`. Defaults are filled for what a snapshot always carries
|
|
968
|
+
* (`visibility: 'private'`, `profileTemplate: 'minimal'`, agent `kind`, the
|
|
969
|
+
* orchestrator's `subAgentSlugs` = the members). `visibility` and `listed` are
|
|
970
|
+
* not inputs: the template is always `visibility='tenant'`, `listed=false`.
|
|
971
|
+
*/
|
|
972
|
+
export interface UpsertSystemTemplateInput {
|
|
973
|
+
kind: 'agent' | 'team';
|
|
974
|
+
name: string;
|
|
975
|
+
description?: string;
|
|
976
|
+
icon?: string;
|
|
977
|
+
category?: string;
|
|
978
|
+
tags?: string[];
|
|
979
|
+
/** Release note recorded when this publishes a new version. */
|
|
980
|
+
changelog?: string;
|
|
981
|
+
payload: Record<string, unknown>;
|
|
982
|
+
/** Settings fields the installer is asked for (the definition is
|
|
983
|
+
* authoritative: a field not listed here, and not referenced by a
|
|
984
|
+
* `{{config:KEY}}` in a prompt, is dropped). May also sit in `payload.configSchema`. */
|
|
985
|
+
configSchema?: TemplateConfigField[];
|
|
986
|
+
/** Force "sells from the catalog" on; omitted = derived from the payload. */
|
|
987
|
+
usesCatalog?: boolean;
|
|
988
|
+
}
|
|
989
|
+
/** `created`: new template (v1). `updated`: a new version was published, or
|
|
990
|
+
* display fields changed (compare `template.currentVersion`). `unchanged`:
|
|
991
|
+
* the same definition was already there — nothing written. */
|
|
992
|
+
export interface UpsertSystemTemplateResult {
|
|
993
|
+
action: 'created' | 'updated' | 'unchanged';
|
|
994
|
+
template: TemplateDetail;
|
|
995
|
+
}
|
|
906
996
|
/** `GET /api/v1/templates/:id` — summary + the snapshot it installs. */
|
|
907
997
|
export interface TemplateDetail extends TemplateSummary {
|
|
908
998
|
payload: Record<string, unknown>;
|
|
@@ -912,6 +1002,20 @@ export interface TemplateDetail extends TemplateSummary {
|
|
|
912
1002
|
guideMd?: string;
|
|
913
1003
|
/** ISO timestamp of the last guide change. */
|
|
914
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
|
+
}>;
|
|
915
1019
|
}
|
|
916
1020
|
/** AGF-PDK-TEMPLATE-PAGE. A person's review of a template (one per person,
|
|
917
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",
|