@agentforge-io/sdk-server 4.5.1 → 4.5.3
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 +2 -2
- package/dist/resources/apps.d.ts +18 -1
- package/dist/resources/apps.js +19 -0
- package/dist/resources/chat.d.ts +21 -1
- package/dist/resources/chat.js +2 -0
- package/dist/resources/provisioning.d.ts +31 -0
- package/dist/resources/provisioning.js +25 -0
- package/dist/types.d.ts +21 -0
- package/package.json +1 -1
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, AppSelfConnectorTools, AppSelfConnectorToolsResponse, 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';
|
|
@@ -10,7 +10,7 @@ export type { AnthropicClientOptions, StreamMessageInput } from './resources/cha
|
|
|
10
10
|
export { ConnectorsResource } from './resources/connectors';
|
|
11
11
|
export type { InboxChannelView } from './resources/connectors';
|
|
12
12
|
export { ProvisioningResource } from './resources/provisioning';
|
|
13
|
-
export type { ProvisionedTenant, ProvisionedApp, } from './resources/provisioning';
|
|
13
|
+
export type { ProvisionedTenant, ProvisionedApp, ProvisionedTeam, } from './resources/provisioning';
|
|
14
14
|
export { SecretsResource } from './resources/secrets';
|
|
15
15
|
export { ToolsResource } from './resources/tools';
|
|
16
16
|
export type { RespondToCallbackInput, VerifyCallbackInput } from './resources/tools';
|
package/dist/resources/apps.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { PublicAppBranding, AppSelf, AppSelfConnectors } from '../types';
|
|
2
|
+
import type { PublicAppBranding, AppSelf, AppSelfConnectors, AppSelfConnectorToolsResponse } from '../types';
|
|
3
3
|
export declare class AppsResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -41,5 +41,22 @@ export declare class AppsResource {
|
|
|
41
41
|
* by the App at runtime.
|
|
42
42
|
*/
|
|
43
43
|
list: () => Promise<AppSelfConnectors>;
|
|
44
|
+
/**
|
|
45
|
+
* `GET /apps/me/connector-tools` (AGF-CTG-1) — flat tool-name catalog
|
|
46
|
+
* contributed by the connectors ENABLED for the App this client
|
|
47
|
+
* authenticated AS. App-level granularity ONLY: this is NOT narrowed
|
|
48
|
+
* per-end-user — that narrowing already happens downstream at runtime
|
|
49
|
+
* via `toolsForAppUser ∩ agent.tools[]`.
|
|
50
|
+
*
|
|
51
|
+
* Intended for a consumer bootstrap to DERIVE its connector-tool
|
|
52
|
+
* whitelist from the App's actually-enabled connectors instead of
|
|
53
|
+
* hardcoding tool names by hand — the top-level `toolNames` is the
|
|
54
|
+
* flat, de-duplicated union across every enabled connector.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* const { toolNames } = await af.apps.connectors.tools();
|
|
58
|
+
* const allowed = new Set(toolNames);
|
|
59
|
+
*/
|
|
60
|
+
tools: () => Promise<AppSelfConnectorToolsResponse>;
|
|
44
61
|
};
|
|
45
62
|
}
|
package/dist/resources/apps.js
CHANGED
|
@@ -35,6 +35,25 @@ class AppsResource {
|
|
|
35
35
|
list: async () => {
|
|
36
36
|
return this.client.request('GET', '/apps/me/connectors');
|
|
37
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* `GET /apps/me/connector-tools` (AGF-CTG-1) — flat tool-name catalog
|
|
40
|
+
* contributed by the connectors ENABLED for the App this client
|
|
41
|
+
* authenticated AS. App-level granularity ONLY: this is NOT narrowed
|
|
42
|
+
* per-end-user — that narrowing already happens downstream at runtime
|
|
43
|
+
* via `toolsForAppUser ∩ agent.tools[]`.
|
|
44
|
+
*
|
|
45
|
+
* Intended for a consumer bootstrap to DERIVE its connector-tool
|
|
46
|
+
* whitelist from the App's actually-enabled connectors instead of
|
|
47
|
+
* hardcoding tool names by hand — the top-level `toolNames` is the
|
|
48
|
+
* flat, de-duplicated union across every enabled connector.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const { toolNames } = await af.apps.connectors.tools();
|
|
52
|
+
* const allowed = new Set(toolNames);
|
|
53
|
+
*/
|
|
54
|
+
tools: async () => {
|
|
55
|
+
return this.client.request('GET', '/apps/me/connector-tools');
|
|
56
|
+
},
|
|
38
57
|
};
|
|
39
58
|
}
|
|
40
59
|
/**
|
package/dist/resources/chat.d.ts
CHANGED
|
@@ -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;
|
package/dist/resources/chat.js
CHANGED
|
@@ -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');
|
|
@@ -11,6 +11,14 @@ export interface ProvisionedApp {
|
|
|
11
11
|
publicKey: string;
|
|
12
12
|
appSecret: string;
|
|
13
13
|
}
|
|
14
|
+
/** `POST /platform/host-teams` result — a team-orchestrator's identity
|
|
15
|
+
* (AGF-SD-6a). No secret to reveal here (unlike `tenant()`/`app()`) — a
|
|
16
|
+
* team has no credential of its own, it's addressed through the
|
|
17
|
+
* tenant's `ak_live_` / App's `sk_live_`. */
|
|
18
|
+
export interface ProvisionedTeam {
|
|
19
|
+
teamId: string;
|
|
20
|
+
orchestratorAgentId: string;
|
|
21
|
+
}
|
|
14
22
|
export declare class ProvisioningResource {
|
|
15
23
|
private readonly client;
|
|
16
24
|
constructor(client: AgentForgeClient);
|
|
@@ -49,4 +57,27 @@ export declare class ProvisioningResource {
|
|
|
49
57
|
hostApp: string;
|
|
50
58
|
hostRef?: string;
|
|
51
59
|
}): Promise<ProvisionedApp>;
|
|
60
|
+
/**
|
|
61
|
+
* `POST /platform/host-teams` (AGF-SD-6a) — find-or-create a
|
|
62
|
+
* team-orchestrator for an EXISTING tenant on behalf of a trusted host
|
|
63
|
+
* app. Idempotent by `(tenantId, hostRef)`: a re-provision returns the
|
|
64
|
+
* SAME `teamId`/`orchestratorAgentId`, never a duplicate orchestrator.
|
|
65
|
+
*
|
|
66
|
+
* @param input.tenantId the tenant the team belongs to (host provisions
|
|
67
|
+
* it first via `tenant()`)
|
|
68
|
+
* @param input.hostApp short host id (e.g. "scrappydoc") — recorded
|
|
69
|
+
* for parity with `tenant()`/`app()`, not part of
|
|
70
|
+
* the idempotency key here (a team already lives
|
|
71
|
+
* under one tenant, so `(tenantId, hostRef)`
|
|
72
|
+
* alone is unambiguous)
|
|
73
|
+
* @param input.hostRef host reference (e.g. the workspaceId) — the
|
|
74
|
+
* idempotency key together with `tenantId`
|
|
75
|
+
* @param input.name display name, only used on first provision
|
|
76
|
+
*/
|
|
77
|
+
team(input: {
|
|
78
|
+
tenantId: string;
|
|
79
|
+
hostApp: string;
|
|
80
|
+
hostRef: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
}): Promise<ProvisionedTeam>;
|
|
52
83
|
}
|
|
@@ -51,5 +51,30 @@ class ProvisioningResource {
|
|
|
51
51
|
async app(input) {
|
|
52
52
|
return this.client.request('POST', '/platform/host-apps', { tenantId: input.tenantId, hostApp: input.hostApp, hostRef: input.hostRef }, { headers: this.headers() });
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* `POST /platform/host-teams` (AGF-SD-6a) — find-or-create a
|
|
56
|
+
* team-orchestrator for an EXISTING tenant on behalf of a trusted host
|
|
57
|
+
* app. Idempotent by `(tenantId, hostRef)`: a re-provision returns the
|
|
58
|
+
* SAME `teamId`/`orchestratorAgentId`, never a duplicate orchestrator.
|
|
59
|
+
*
|
|
60
|
+
* @param input.tenantId the tenant the team belongs to (host provisions
|
|
61
|
+
* it first via `tenant()`)
|
|
62
|
+
* @param input.hostApp short host id (e.g. "scrappydoc") — recorded
|
|
63
|
+
* for parity with `tenant()`/`app()`, not part of
|
|
64
|
+
* the idempotency key here (a team already lives
|
|
65
|
+
* under one tenant, so `(tenantId, hostRef)`
|
|
66
|
+
* alone is unambiguous)
|
|
67
|
+
* @param input.hostRef host reference (e.g. the workspaceId) — the
|
|
68
|
+
* idempotency key together with `tenantId`
|
|
69
|
+
* @param input.name display name, only used on first provision
|
|
70
|
+
*/
|
|
71
|
+
async team(input) {
|
|
72
|
+
return this.client.request('POST', '/platform/host-teams', {
|
|
73
|
+
tenantId: input.tenantId,
|
|
74
|
+
hostApp: input.hostApp,
|
|
75
|
+
hostRef: input.hostRef,
|
|
76
|
+
name: input.name,
|
|
77
|
+
}, { headers: this.headers() });
|
|
78
|
+
}
|
|
54
79
|
}
|
|
55
80
|
exports.ProvisioningResource = ProvisioningResource;
|
package/dist/types.d.ts
CHANGED
|
@@ -84,6 +84,16 @@ export interface AppSelfConnectors {
|
|
|
84
84
|
mode: 'whitelist' | 'legacy';
|
|
85
85
|
connectors: AppSelfConnector[];
|
|
86
86
|
}
|
|
87
|
+
export interface AppSelfConnectorTools {
|
|
88
|
+
connectorId: string;
|
|
89
|
+
toolNames: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface AppSelfConnectorToolsResponse {
|
|
92
|
+
connectors: AppSelfConnectorTools[];
|
|
93
|
+
/** Flat, de-duplicated union of every `toolNames` entry above — this is
|
|
94
|
+
* what a whitelist consumer actually wants. */
|
|
95
|
+
toolNames: string[];
|
|
96
|
+
}
|
|
87
97
|
export interface RegisterToolInput {
|
|
88
98
|
name: string;
|
|
89
99
|
description: string;
|
|
@@ -362,6 +372,17 @@ export type ChatStreamEvent = {
|
|
|
362
372
|
kind: 'error';
|
|
363
373
|
message: string;
|
|
364
374
|
};
|
|
375
|
+
export interface ChannelContext {
|
|
376
|
+
/** Stable channel id. Open enum — hosts pass their own; core only
|
|
377
|
+
* special-cases the ones it ships a default for via `audience`/`sanitize`. */
|
|
378
|
+
id: 'whatsapp' | 'voice' | 'app-operator' | 'public' | 'b2b-console' | (string & {});
|
|
379
|
+
/** Who is on the other end. Drives the DEFAULT presentation policy when
|
|
380
|
+
* `sanitize` isn't set explicitly. */
|
|
381
|
+
audience?: 'customer' | 'operator' | 'internal';
|
|
382
|
+
/** Optional explicit override of the derived policy (escape hatch). Wins
|
|
383
|
+
* over `audience` when present. */
|
|
384
|
+
sanitize?: 'strict' | 'voice' | 'off';
|
|
385
|
+
}
|
|
365
386
|
export interface ConnectorStatus {
|
|
366
387
|
connectorId: string;
|
|
367
388
|
/** ¿El tenant ya completó el OAuth/API-key setup de este connector? */
|
package/package.json
CHANGED