@agentforge-io/sdk-server 4.5.1 → 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
@@ -362,6 +362,17 @@ export type ChatStreamEvent = {
362
362
  kind: 'error';
363
363
  message: string;
364
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
+ }
365
376
  export interface ConnectorStatus {
366
377
  connectorId: string;
367
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.1",
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",