@proteos/sdk 0.37.0 → 0.39.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteos/sdk",
3
- "version": "0.37.0",
3
+ "version": "0.39.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
@@ -5,6 +5,7 @@ import { type PromptService, PromptServiceImpl } from './prompts.js'
5
5
  import { type SessionService, SessionServiceImpl } from './sessions.js'
6
6
  import { type SkillService, SkillServiceImpl } from './skills.js'
7
7
  import { type ToolService, ToolServiceImpl } from './tools.js'
8
+ import { type ToolsetService, ToolsetServiceImpl } from './toolsets.js'
8
9
 
9
10
  /**
10
11
  * Client for the Proteos Agent Service API.
@@ -33,6 +34,8 @@ export class AgentClient {
33
34
  readonly skills: SkillService
34
35
  /** Service for managing tools. */
35
36
  readonly tools: ToolService
37
+ /** Service for managing toolsets (platform + custom tool groups). */
38
+ readonly toolsets: ToolsetService
36
39
  /** Service for managing MCP server registrations. */
37
40
  readonly mcpServers: McpServerService
38
41
  /** Service for managing chat sessions (conversations + event log + stream). */
@@ -48,6 +51,7 @@ export class AgentClient {
48
51
  this.prompts = new PromptServiceImpl(client)
49
52
  this.skills = new SkillServiceImpl(client)
50
53
  this.tools = new ToolServiceImpl(client)
54
+ this.toolsets = new ToolsetServiceImpl(client)
51
55
  this.mcpServers = new McpServerServiceImpl(client)
52
56
  this.sessions = new SessionServiceImpl(client)
53
57
  }
@@ -96,6 +100,7 @@ export type {
96
100
  export type { SessionService } from './sessions.js'
97
101
  export type { SkillService } from './skills.js'
98
102
  export type { ToolService } from './tools.js'
103
+ export type { ToolsetService } from './toolsets.js'
99
104
  // Re-export types
100
105
  export type {
101
106
  ActionBinding,
@@ -126,9 +131,16 @@ export type {
126
131
  SkillBundle,
127
132
  SkillVersion,
128
133
  StartMcpOAuthResponse,
134
+ PlatformBinding,
129
135
  Tool,
130
136
  ToolBinding,
131
137
  ToolKind,
138
+ Toolset,
139
+ ToolsetKind,
140
+ ToolsetToolSummary,
141
+ CreateToolsetRequest,
142
+ UpdateToolsetRequest,
143
+ ListToolsetsOptions,
132
144
  UpdateAgentRequest,
133
145
  UpdateMcpServerRequest,
134
146
  UpdatePromptRequest,
@@ -0,0 +1,80 @@
1
+ import type { ProteosClient } from '../client.js'
2
+ import { PageIterator } from '../iterator.js'
3
+ import type { ListResult } from '../types/common.js'
4
+ import type {
5
+ CreateToolsetRequest,
6
+ ListToolsetsOptions,
7
+ Toolset,
8
+ ToolsetToolSummary,
9
+ UpdateToolsetRequest,
10
+ } from './types.js'
11
+
12
+ const TOOLSETS_BASE_PATH = '/agents/v1/toolsets'
13
+
14
+ /**
15
+ * Service for managing Toolsets — the hardcoded platform toolsets (read-only)
16
+ * merged with the org's custom groups of its own tools. Writes apply to custom
17
+ * toolsets only; a platform key is rejected with `toolset_read_only`.
18
+ */
19
+ export interface ToolsetService {
20
+ /** Lists toolsets (platform + custom merged), auto-paginating. Filterable by `kind`. */
21
+ list(options?: ListToolsetsOptions): PageIterator<Toolset, ListToolsetsOptions>
22
+ /** Fetches a single page of toolsets with pagination metadata. */
23
+ listPage(options?: ListToolsetsOptions): Promise<ListResult<Toolset>>
24
+ /** Gets a single toolset by key (platform or custom). @throws {ProteosError} 404. */
25
+ get(key: string): Promise<Toolset>
26
+ /**
27
+ * Lists the tools inside a toolset — platform members proxied from the
28
+ * platform MCP server, custom members summarized from the org's Tool rows.
29
+ * @throws {ProteosError} 404.
30
+ */
31
+ listTools(key: string): Promise<ToolsetToolSummary[]>
32
+ /** Creates a custom toolset. @throws {ProteosError} 400/409. */
33
+ create(request: CreateToolsetRequest): Promise<Toolset>
34
+ /** Fully replaces a custom toolset's definition. @throws {ProteosError} 404/400. */
35
+ update(key: string, request: UpdateToolsetRequest): Promise<Toolset>
36
+ /** Creates or fully replaces a custom toolset (idempotent deploy entry point). */
37
+ upsert(key: string, request: CreateToolsetRequest): Promise<Toolset>
38
+ /** Deletes a custom toolset. @throws {ProteosError} 404/400. */
39
+ delete(key: string): Promise<void>
40
+ }
41
+
42
+ export class ToolsetServiceImpl implements ToolsetService {
43
+ constructor(private readonly client: ProteosClient) {}
44
+
45
+ list(options: ListToolsetsOptions = {}): PageIterator<Toolset, ListToolsetsOptions> {
46
+ return new PageIterator((opts) => this.listPage(opts), options)
47
+ }
48
+
49
+ async listPage(options: ListToolsetsOptions = {}): Promise<ListResult<Toolset>> {
50
+ return this.client.requestWithQuery<ListResult<Toolset>>('GET', TOOLSETS_BASE_PATH, options)
51
+ }
52
+
53
+ async get(key: string): Promise<Toolset> {
54
+ return this.client.request<Toolset>('GET', `${TOOLSETS_BASE_PATH}/${key}`)
55
+ }
56
+
57
+ async listTools(key: string): Promise<ToolsetToolSummary[]> {
58
+ const response = await this.client.request<{ data: ToolsetToolSummary[] }>(
59
+ 'GET',
60
+ `${TOOLSETS_BASE_PATH}/${key}/tools`,
61
+ )
62
+ return response.data
63
+ }
64
+
65
+ async create(request: CreateToolsetRequest): Promise<Toolset> {
66
+ return this.client.request<Toolset>('POST', TOOLSETS_BASE_PATH, request)
67
+ }
68
+
69
+ async update(key: string, request: UpdateToolsetRequest): Promise<Toolset> {
70
+ return this.client.request<Toolset>('PATCH', `${TOOLSETS_BASE_PATH}/${key}`, request)
71
+ }
72
+
73
+ async upsert(key: string, request: CreateToolsetRequest): Promise<Toolset> {
74
+ return this.client.request<Toolset>('PUT', `${TOOLSETS_BASE_PATH}/${key}`, request)
75
+ }
76
+
77
+ async delete(key: string): Promise<void> {
78
+ await this.client.request<void>('DELETE', `${TOOLSETS_BASE_PATH}/${key}`)
79
+ }
80
+ }
@@ -64,6 +64,8 @@ export interface Agent extends AuditFields {
64
64
  tools: string[]
65
65
  subagents: string[]
66
66
  mcp_servers: string[]
67
+ /** Toolset keys (platform or custom) attached as whole tool groups. */
68
+ toolsets: string[]
67
69
  /** Marks the single agent surfaced by default for the org (at most one). */
68
70
  is_org_default: boolean
69
71
  version: number
@@ -80,6 +82,7 @@ export interface CreateAgentRequest {
80
82
  tools?: string[]
81
83
  subagents?: string[]
82
84
  mcp_servers?: string[]
85
+ toolsets?: string[]
83
86
  is_org_default?: boolean
84
87
  }
85
88
 
@@ -93,6 +96,7 @@ export interface UpdateAgentRequest {
93
96
  tools?: string[]
94
97
  subagents?: string[]
95
98
  mcp_servers?: string[]
99
+ toolsets?: string[]
96
100
  is_org_default?: boolean
97
101
  }
98
102
 
@@ -211,8 +215,10 @@ export type ListSkillsOptions = AgentResourceListOptions
211
215
  * - `action` binds to a function-service Action.
212
216
  * - `mcp` binds to one tool on a registered {@link McpServer}.
213
217
  * - `client` is a host-provided builtin and carries no binding.
218
+ * - `platform` binds to one tool of the platform MCP server (mcp-service),
219
+ * executed server-side as the acting user.
214
220
  */
215
- export type ToolKind = 'action' | 'mcp' | 'client'
221
+ export type ToolKind = 'action' | 'mcp' | 'client' | 'platform'
216
222
 
217
223
  /** Binds to a function-service Action by its key (kind=action). */
218
224
  export interface ActionBinding {
@@ -225,8 +231,17 @@ export interface McpBinding {
225
231
  tool_name: string
226
232
  }
227
233
 
234
+ /**
235
+ * Binds to one tool of the platform MCP server (kind=platform). `toolset` pins
236
+ * the server mount the tool lives in.
237
+ */
238
+ export interface PlatformBinding {
239
+ toolset: string
240
+ tool_name: string
241
+ }
242
+
228
243
  /** Kind-discriminated binding payload. `kind=client` carries no binding. */
229
- export type ToolBinding = ActionBinding | McpBinding
244
+ export type ToolBinding = ActionBinding | McpBinding | PlatformBinding
230
245
 
231
246
  /**
232
247
  * A thin registry entry over one of three binding sources. `key` is the wire
@@ -272,6 +287,65 @@ export interface ListToolsOptions extends AgentResourceListOptions {
272
287
  kind?: ToolKind
273
288
  }
274
289
 
290
+ // ---------------------------------------------------------------------------
291
+ // Toolsets
292
+ // ---------------------------------------------------------------------------
293
+
294
+ /**
295
+ * Toolset origin: `platform` toolsets are the hardcoded groups of the platform
296
+ * MCP server (read-only, one per server mount); `custom` toolsets are
297
+ * org-authored groups of the org's own {@link Tool} rows.
298
+ */
299
+ export type ToolsetKind = 'platform' | 'custom'
300
+
301
+ /**
302
+ * A named group of tools an agent attaches as one unit (`Agent.toolsets`).
303
+ * Platform and custom toolsets share one key namespace (platform keys are
304
+ * reserved). For platform toolsets `tools` is empty — the members live in
305
+ * mcp-service and are listed via `toolsets.listTools`; for custom toolsets it
306
+ * carries the member Tool keys. Keyed by (org_id, key).
307
+ */
308
+ export interface Toolset extends AuditFields {
309
+ org_id: string
310
+ key: string
311
+ name: string
312
+ module_slug: string
313
+ description: string
314
+ kind: ToolsetKind
315
+ tools: string[]
316
+ version: number
317
+ }
318
+
319
+ /** Creates a CUSTOM toolset — platform toolsets are hardcoded and read-only. */
320
+ export interface CreateToolsetRequest {
321
+ key: string
322
+ name: string
323
+ module_slug?: string
324
+ description?: string
325
+ /** Member Tool keys; existence is validated on write. */
326
+ tools?: string[]
327
+ }
328
+
329
+ /** Fully replaces the custom toolset's definition (membership is a set). */
330
+ export interface UpdateToolsetRequest {
331
+ name: string
332
+ module_slug?: string
333
+ description?: string
334
+ tools?: string[]
335
+ }
336
+
337
+ export interface ListToolsetsOptions extends AgentResourceListOptions {
338
+ /** Filter the merged listing by origin. */
339
+ kind?: ToolsetKind
340
+ }
341
+
342
+ /** One tool inside a toolset, for pickers: the wire name + display metadata. */
343
+ export interface ToolsetToolSummary {
344
+ name: string
345
+ title?: string
346
+ description?: string
347
+ }
348
+
275
349
  // ---------------------------------------------------------------------------
276
350
  // MCP Servers
277
351
  // ---------------------------------------------------------------------------
@@ -52,6 +52,7 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
52
52
  { slug: 'prompts', name: 'Prompts' },
53
53
  { slug: 'skills', name: 'Skills' },
54
54
  { slug: 'tools', name: 'Tools' },
55
+ { slug: 'toolsets', name: 'Toolsets' },
55
56
  { slug: 'mcp-servers', name: 'MCP Servers' },
56
57
  { slug: 'agent-sessions', name: 'Agent Sessions' },
57
58
  // Messaging bus (event-service)
@@ -415,6 +415,14 @@ export interface AgentListenerAcknowledgementConfig {
415
415
  text?: string
416
416
  }
417
417
 
418
+ /**
419
+ * Where the dispatcher takes its acting user from: 'defined' (the listener's
420
+ * stored acting_user — the default) or 'inferred' (the triggering message
421
+ * sender's resolved platform user, with acting_user as OPTIONAL fallback — no
422
+ * platform user and no fallback means the dispatch is skipped).
423
+ */
424
+ export type AgentListenerActingUserMode = 'defined' | 'inferred'
425
+
418
426
  export interface AgentListener {
419
427
  id: string
420
428
  org_id: string
@@ -444,7 +452,12 @@ export interface AgentListener {
444
452
  */
445
453
  acknowledgement_type: AgentListenerAcknowledgementType
446
454
  acknowledgement_config?: AgentListenerAcknowledgementConfig
447
- /** The user the dispatcher acts as when driving the agent. */
455
+ acting_user_mode: AgentListenerActingUserMode
456
+ /**
457
+ * The user the dispatcher acts as (mode 'defined'), or the optional fallback
458
+ * when the sender has no platform user (mode 'inferred'; an empty ref means
459
+ * no fallback).
460
+ */
448
461
  acting_user: UserRef
449
462
  is_enabled: boolean
450
463
  /**
@@ -561,8 +574,14 @@ export interface CreateAgentListenerRequest {
561
574
  */
562
575
  acknowledgement_type?: AgentListenerAcknowledgementType
563
576
  acknowledgement_config?: AgentListenerAcknowledgementConfig
564
- /** A bare user id; the service wraps it into a person UserRef. */
565
- acting_user_id: string
577
+ /** Omit to default to 'defined'. */
578
+ acting_user_mode?: AgentListenerActingUserMode
579
+ /**
580
+ * A bare user id; the service wraps it into a person UserRef. Required in
581
+ * 'defined' mode (the default); optional in 'inferred' mode, where it is the
582
+ * fallback when the sender has no platform user.
583
+ */
584
+ acting_user_id?: string
566
585
  /** Omit to default to enabled. */
567
586
  is_enabled?: boolean
568
587
  /**
@@ -593,6 +612,9 @@ export interface UpdateAgentListenerRequest {
593
612
  */
594
613
  acknowledgement_type?: AgentListenerAcknowledgementType
595
614
  acknowledgement_config?: AgentListenerAcknowledgementConfig
615
+ /** Switching to 'defined' requires an effective acting user (stored or in this request). */
616
+ acting_user_mode?: AgentListenerActingUserMode
617
+ /** Pass "" to clear the user — only valid when the effective mode is 'inferred'. */
596
618
  acting_user_id?: string
597
619
  is_enabled?: boolean
598
620
  /** Toggle whether the platform auto-forwards the agent's text reply. */
package/src/index.ts CHANGED
@@ -52,6 +52,7 @@ export type {
52
52
  CreatePromptRequest,
53
53
  CreateSessionRequest,
54
54
  CreateToolRequest,
55
+ CreateToolsetRequest,
55
56
  DependentAgent,
56
57
  DependentSyncResult,
57
58
  EmptyPayload,
@@ -64,6 +65,7 @@ export type {
64
65
  ListSessionsOptions,
65
66
  ListSkillsOptions,
66
67
  ListToolsOptions,
68
+ ListToolsetsOptions,
67
69
  McpBinding,
68
70
  McpConnectionState,
69
71
  McpConnectionStatus,
@@ -97,11 +99,16 @@ export type {
97
99
  StartMcpOAuthResponse,
98
100
  StopReason,
99
101
  TextBlock,
102
+ PlatformBinding,
100
103
  Tool,
101
104
  ToolBinding,
102
105
  ToolConfirmationPayload,
103
106
  ToolKind,
104
107
  ToolResultPayload,
108
+ Toolset,
109
+ ToolsetKind,
110
+ ToolsetService,
111
+ ToolsetToolSummary,
105
112
  ToolService,
106
113
  ToolUsePayload,
107
114
  Turn,
@@ -109,6 +116,7 @@ export type {
109
116
  UpdateMcpServerRequest,
110
117
  UpdatePromptRequest,
111
118
  UpdateToolRequest,
119
+ UpdateToolsetRequest,
112
120
  UserMessagePayload,
113
121
  } from './agent/index.js'
114
122
  export { AgentClient } from './agent/index.js'
@@ -187,6 +195,7 @@ export type {
187
195
  AgentListener,
188
196
  AgentListenerAcknowledgementConfig,
189
197
  AgentListenerAcknowledgementType,
198
+ AgentListenerActingUserMode,
190
199
  AgentListenerService,
191
200
  AgentListenerTriggerType,
192
201
  AllFilterConfig,