@agentforge-io/sdk-server 4.5.0 → 4.5.2

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
@@ -2,7 +2,7 @@ export { AgentForgeClient } 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, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, AppSelf, AppSelfConnector, AppSelfConnectors, RegisterToolInput, RegisterToolsInput, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, } 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, AppSelf, AppSelfConnector, AppSelfConnectors, RegisterToolInput, RegisterToolsInput, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, } from './types';
6
6
  export { AgentsResource } from './resources/agents';
7
7
  export { AppsResource } from './resources/apps';
8
8
  export { ChatResource } from './resources/chat';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { ChatStreamEvent, ConversationHistory } from '../types';
2
+ import type { ChannelContext, ChatStreamEvent, ConversationHistory } from '../types';
3
3
  export interface AnthropicClientOptions {
4
4
  /** Override de la versión Anthropic. Default: '2023-06-01'. */
5
5
  anthropicVersion?: string;
@@ -8,6 +8,15 @@ export interface StreamMessageInput {
8
8
  content: string;
9
9
  /** Si se omite, el server crea una conversación nueva. */
10
10
  conversationId?: string;
11
+ /**
12
+ * AGF-CHANNEL-CTX PR-2 — which surface this turn is coming through (and
13
+ * who's on the other end). Threads through to the platform's
14
+ * `AgentOverrides.channel` (core), which `resolvePresentationPolicy`
15
+ * consumes to decide whether `OutputSanitizerService` runs this turn.
16
+ * Omit for legacy callers — the resolved policy defaults to `'strict'`
17
+ * (today's behavior), zero regression.
18
+ */
19
+ channel?: ChannelContext;
11
20
  }
12
21
  export interface StreamMessageForAppUserInput {
13
22
  /** Which of the App's tenant agents to run. */
@@ -22,6 +31,17 @@ export interface StreamMessageForAppUserInput {
22
31
  content: string;
23
32
  /** Si se omite, el server crea una conversación nueva. */
24
33
  conversationId?: string;
34
+ /**
35
+ * AGF-CHANNEL-CTX PR-2 — which surface this turn is coming through (and
36
+ * who's on the other end). Threads through to the platform's
37
+ * `AgentOverrides.channel` (core), which `resolvePresentationPolicy`
38
+ * consumes to decide whether `OutputSanitizerService` runs this turn.
39
+ * Omit for legacy callers — the resolved policy defaults to `'strict'`
40
+ * (today's behavior), zero regression. ScrappyDoc's SOP Architect
41
+ * Composer (PR-3) declares `{ id: 'app-operator', audience: 'operator' }`
42
+ * here to turn the sanitizer OFF for this operator-facing surface.
43
+ */
44
+ channel?: ChannelContext;
25
45
  }
26
46
  export declare class ChatResource {
27
47
  private readonly client;
@@ -70,6 +70,7 @@ class ChatResource {
70
70
  const res = await this.client.requestStream('POST', '/api/v1/chat/messages/stream', {
71
71
  content: input.content,
72
72
  ...(input.conversationId ? { conversationId: input.conversationId } : {}),
73
+ ...(input.channel ? { channel: input.channel } : {}),
73
74
  });
74
75
  if (!res.body) {
75
76
  throw new Error('chat.streamMessage: response has no readable body');
@@ -147,6 +148,7 @@ class ChatResource {
147
148
  agentId: input.agentId,
148
149
  externalUserId: input.externalUserId,
149
150
  content: input.content,
151
+ ...(input.channel ? { channel: input.channel } : {}),
150
152
  });
151
153
  if (!res.body) {
152
154
  throw new Error('chat.streamMessageForAppUser: response has no readable body');
package/dist/types.d.ts CHANGED
@@ -139,6 +139,26 @@ export interface AgentSummary {
139
139
  createdAt: string | Date;
140
140
  updatedAt: string | Date;
141
141
  }
142
+ /**
143
+ * Visibilidad del perfil público del agent (`/a/:publicSlug`).
144
+ * Default en el backend: `'private'`.
145
+ */
146
+ export type AgentProfileVisibility = 'private' | 'public';
147
+ /** Template visual del perfil público del agent. */
148
+ export type AgentProfileTemplate = 'minimal' | 'brand' | 'beacons';
149
+ /**
150
+ * Bloque de contenido del perfil público (link, bio, imagen, etc.).
151
+ * Shape exacto por `type` — la validación profunda vive en el backend
152
+ * (`agent-config.service.ts` / `normalizeProfileBlocks`), el SDK solo
153
+ * pasa el objeto tal cual.
154
+ */
155
+ export type ProfileBlock = Record<string, unknown>;
156
+ /**
157
+ * Tema visual del perfil público (colores, fuente, etc.).
158
+ * La validación profunda vive en el backend (`normalizeProfileTheme`);
159
+ * el SDK solo pasa el objeto tal cual.
160
+ */
161
+ export type ProfileTheme = Record<string, unknown>;
142
162
  export interface CreateAgentInput {
143
163
  slug: string;
144
164
  name: string;
@@ -156,6 +176,16 @@ export interface CreateAgentInput {
156
176
  name: string;
157
177
  mode: ToolPermissionMode;
158
178
  }>;
179
+ /**
180
+ * Handle del creador para el perfil público (`/a/:publicSlug`). Formato
181
+ * `/^[a-z0-9][a-z0-9_-]{0,46}[a-z0-9]$/` (2-48, lowercase), único global.
182
+ * Si se omite, el backend auto-mintea uno (`generatePublicSlug()`).
183
+ */
184
+ publicSlug?: string;
185
+ visibility?: AgentProfileVisibility;
186
+ profileTemplate?: AgentProfileTemplate;
187
+ profileBlocks?: ProfileBlock[];
188
+ profileTheme?: ProfileTheme;
159
189
  }
160
190
  export interface UpdateAgentInput {
161
191
  name?: string;
@@ -176,6 +206,16 @@ export interface UpdateAgentInput {
176
206
  name: string;
177
207
  mode: ToolPermissionMode;
178
208
  }>;
209
+ /**
210
+ * Handle del creador para el perfil público (`/a/:publicSlug`). Mismo
211
+ * formato que en `CreateAgentInput`; el backend valida formato +
212
+ * unicidad global y responde 409 si choca.
213
+ */
214
+ publicSlug?: string;
215
+ visibility?: AgentProfileVisibility;
216
+ profileTemplate?: AgentProfileTemplate;
217
+ profileBlocks?: ProfileBlock[];
218
+ profileTheme?: ProfileTheme;
179
219
  }
180
220
  export interface ListAgentsResult {
181
221
  items: AgentSummary[];
@@ -322,6 +362,17 @@ export type ChatStreamEvent = {
322
362
  kind: 'error';
323
363
  message: string;
324
364
  };
365
+ export interface ChannelContext {
366
+ /** Stable channel id. Open enum — hosts pass their own; core only
367
+ * special-cases the ones it ships a default for via `audience`/`sanitize`. */
368
+ id: 'whatsapp' | 'voice' | 'app-operator' | 'public' | 'b2b-console' | (string & {});
369
+ /** Who is on the other end. Drives the DEFAULT presentation policy when
370
+ * `sanitize` isn't set explicitly. */
371
+ audience?: 'customer' | 'operator' | 'internal';
372
+ /** Optional explicit override of the derived policy (escape hatch). Wins
373
+ * over `audience` when present. */
374
+ sanitize?: 'strict' | 'voice' | 'off';
375
+ }
325
376
  export interface ConnectorStatus {
326
377
  connectorId: string;
327
378
  /** ¿El tenant ya completó el OAuth/API-key setup de este connector? */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken or ak_live_ API key.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",