@proteos/sdk 0.86.0 → 0.88.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.
@@ -10,6 +10,7 @@ import type {
10
10
  } from './types.js'
11
11
 
12
12
  const TOOLSETS_BASE_PATH = '/agents/v1/toolsets'
13
+ const PLATFORM_TOOLS_PATH = '/agents/v1/platform-tools'
13
14
 
14
15
  /**
15
16
  * Service for managing Toolsets — the hardcoded platform toolsets (read-only)
@@ -29,6 +30,14 @@ export interface ToolsetService {
29
30
  * @throws {ProteosError} 404.
30
31
  */
31
32
  listTools(key: string): Promise<ToolsetToolSummary[]>
33
+ /**
34
+ * Lists every platform tool once, each with the platform toolset that serves
35
+ * it. An agent may list any of these names in its `tools` as it is: no Tool
36
+ * of that key is needed. A Tool the org saves under the same key replaces the
37
+ * platform tool for its agents. A name several toolsets serve is the first
38
+ * one's, in the order `list({ kind: 'platform' })` returns them.
39
+ */
40
+ listPlatformTools(): Promise<ToolsetToolSummary[]>
32
41
  /** Creates a custom toolset. @throws {ProteosError} 400/409. */
33
42
  create(request: CreateToolsetRequest): Promise<Toolset>
34
43
  /** Fully replaces a custom toolset's definition. @throws {ProteosError} 404/400. */
@@ -62,6 +71,14 @@ export class ToolsetServiceImpl implements ToolsetService {
62
71
  return response.data
63
72
  }
64
73
 
74
+ async listPlatformTools(): Promise<ToolsetToolSummary[]> {
75
+ const response = await this.client.request<{ data: ToolsetToolSummary[] }>(
76
+ 'GET',
77
+ PLATFORM_TOOLS_PATH,
78
+ )
79
+ return response.data
80
+ }
81
+
65
82
  async create(request: CreateToolsetRequest): Promise<Toolset> {
66
83
  return this.client.request<Toolset>('POST', TOOLSETS_BASE_PATH, request)
67
84
  }
@@ -44,6 +44,16 @@ export interface ModelConfig {
44
44
  thinking?: boolean
45
45
  }
46
46
 
47
+ /**
48
+ * How an agent's sessions run. `durable` runs them on a provider that keeps a
49
+ * turn going through restarts and gives the session a sandbox (long-running
50
+ * work; Anthropic Managed Agents today). `embedded` runs the loop inside the
51
+ * agent service: replies stream while the model writes them, and there is no
52
+ * sandbox. The value names the kind of runtime, not the vendor behind it, and
53
+ * `embedded` is about where the loop runs, not about where the chat is shown.
54
+ */
55
+ export type AgentRuntime = 'durable' | 'embedded'
56
+
47
57
  /**
48
58
  * A configured persona: a system prompt + model config + the skills, tools,
49
59
  * sub-agents and MCP servers it can use. All references are by key (immutable):
@@ -75,6 +85,14 @@ export interface Agent extends AuditFields {
75
85
  * navigate / open_record.
76
86
  */
77
87
  has_workspace: boolean
88
+ /**
89
+ * Keeps per-person memory: the agent remembers how each person likes to work
90
+ * and where their last session left off, as notes in that person's own
91
+ * (personal) knowledge space.
92
+ */
93
+ has_memory: boolean
94
+ /** What runs this agent's sessions. A session keeps the runtime it was created with. */
95
+ runtime: AgentRuntime
78
96
  version: number
79
97
  }
80
98
 
@@ -92,6 +110,9 @@ export interface CreateAgentRequest {
92
110
  toolsets?: string[]
93
111
  is_org_default?: boolean
94
112
  has_workspace?: boolean
113
+ has_memory?: boolean
114
+ /** Defaults to `durable`. */
115
+ runtime?: AgentRuntime
95
116
  }
96
117
 
97
118
  export interface UpdateAgentRequest {
@@ -107,6 +128,8 @@ export interface UpdateAgentRequest {
107
128
  toolsets?: string[]
108
129
  is_org_default?: boolean
109
130
  has_workspace?: boolean
131
+ has_memory?: boolean
132
+ runtime?: AgentRuntime
110
133
  }
111
134
 
112
135
  export type ListAgentsOptions = AgentResourceListOptions
@@ -280,6 +303,11 @@ export interface Tool extends AuditFields {
280
303
  kind: ToolKind
281
304
  input_schema: Attribute[]
282
305
  binding?: ToolBinding | null
306
+ /**
307
+ * Whether calling the tool is known to change nothing, so that its call may run
308
+ * alongside others. Set on platform tools the platform marks so; absent otherwise.
309
+ */
310
+ is_read_only?: boolean
283
311
  version: number
284
312
  }
285
313
 
@@ -366,6 +394,12 @@ export interface ToolsetToolSummary {
366
394
  name: string
367
395
  title?: string
368
396
  description?: string
397
+ /**
398
+ * The platform toolset that serves the tool. Set where the platform's tools
399
+ * are listed together (`toolsets.listPlatformTools`); absent in the list of
400
+ * one toolset, which the request already names.
401
+ */
402
+ toolset?: string
369
403
  }
370
404
 
371
405
  // ---------------------------------------------------------------------------
package/src/client.ts CHANGED
@@ -211,6 +211,7 @@ export class ProteosClient {
211
211
  headers,
212
212
  body: body !== undefined ? JSON.stringify(body) : null,
213
213
  signal,
214
+ ...(requestOptions?.keepalive ? { keepalive: true } : {}),
214
215
  })
215
216
 
216
217
  if (response.status >= 400) {
package/src/index.ts CHANGED
@@ -41,8 +41,11 @@ export type {
41
41
  AgentArtifactsPayload,
42
42
  AgentMessagePayload,
43
43
  AgentResourceListOptions,
44
+ AgentRuntime,
44
45
  AgentService,
45
46
  AppendEventRequest,
47
+ AppendSpeechRequest,
48
+ AwaitingToolUse,
46
49
  BooleanAnswer,
47
50
  BooleanCriteria,
48
51
  BooleanQuestion,
@@ -65,9 +68,13 @@ export type {
65
68
  DecisionQuestions,
66
69
  DecisionQuestionType,
67
70
  DecisionResult,
71
+ DelegatedSessionUpdatedPayload,
72
+ DeltaBoundaryPayload,
73
+ DeltaEventType,
68
74
  DependentAgent,
69
75
  DependentSyncResult,
70
76
  EmptyPayload,
77
+ EndVoiceRequest,
71
78
  ErrorPayload,
72
79
  EventType,
73
80
  FileBlock,
@@ -88,7 +95,10 @@ export type {
88
95
  McpServerOAuth,
89
96
  McpServerService,
90
97
  McpToolSummary,
98
+ MessageDeltaPayload,
91
99
  ModelConfig,
100
+ ModelInfo,
101
+ ModelProviderName,
92
102
  ModelRequestEndPayload,
93
103
  ModelRequestStartPayload,
94
104
  ModelService,
@@ -99,24 +109,34 @@ export type {
99
109
  PromptService,
100
110
  PromptVersion,
101
111
  QueryBinding,
112
+ ReasoningDeltaPayload,
102
113
  ReasoningPayload,
103
114
  ResultBlock,
104
115
  ScoreAnswer,
105
116
  ScoreQuestion,
106
117
  Session,
118
+ SessionDeltaEntry,
119
+ SessionDeltaFrame,
120
+ SessionDeltaStreamOptions,
107
121
  SessionEvent,
108
122
  SessionEventEnvelope,
109
123
  SessionEventsOptions,
110
124
  SessionIdlePayload,
125
+ SessionRunningPayload,
111
126
  SessionService,
112
127
  SessionStatus,
113
128
  SessionStreamOptions,
129
+ SessionToolKind,
114
130
  SessionUpdatedPayload,
115
131
  Skill,
116
132
  SkillBundle,
117
133
  SkillService,
118
134
  SkillVersion,
135
+ SpeechPayload,
136
+ SpeechSegment,
119
137
  StartMcpOAuthResponse,
138
+ StartVoiceRequest,
139
+ StartVoiceResponse,
120
140
  StopReason,
121
141
  StructuredText,
122
142
  TextBlock,
@@ -130,7 +150,9 @@ export type {
130
150
  ToolsetKind,
131
151
  ToolsetService,
132
152
  ToolsetToolSummary,
153
+ ToolUseDeltaPayload,
133
154
  ToolUsePayload,
155
+ ToolUseStartPayload,
134
156
  Turn,
135
157
  UpdateAgentRequest,
136
158
  UpdateMcpServerRequest,
@@ -138,8 +160,13 @@ export type {
138
160
  UpdateToolRequest,
139
161
  UpdateToolsetRequest,
140
162
  UserMessagePayload,
163
+ VoiceEndedPayload,
164
+ VoiceEndReason,
165
+ VoiceRequestPayload,
166
+ VoiceSession,
167
+ VoiceStartedPayload,
141
168
  } from './agent/index.js'
142
- export { AgentClient } from './agent/index.js'
169
+ export { AgentClient, isDeltaFrame } from './agent/index.js'
143
170
  // Auth types (re-exported from auth/index.ts for convenience)
144
171
  export type {
145
172
  AddTeamMemberRequest,
@@ -739,11 +766,13 @@ export type {
739
766
  SearchContentRequest,
740
767
  SearchContentResponse,
741
768
  SearchNodesRequest,
769
+ SpaceScope,
742
770
  SpaceService,
743
771
  UpdateLabelRequest,
744
772
  UpdateLinkRequest,
745
773
  UpdateNodeRequest,
746
774
  UpdateSpaceRequest,
775
+ WriteContentOptions,
747
776
  WriteContentResponse,
748
777
  } from './knowledge/index.js'
749
778
  // Knowledge client (knowledge-service: graph-native knowledge base)
@@ -96,10 +96,12 @@ export type {
96
96
  SearchContentRequest,
97
97
  SearchContentResponse,
98
98
  SearchNodesRequest,
99
+ SpaceScope,
99
100
  UpdateLabelRequest,
100
101
  UpdateLinkRequest,
101
102
  UpdateNodeRequest,
102
103
  UpdateSpaceRequest,
104
+ WriteContentOptions,
103
105
  WriteContentResponse,
104
106
  } from './types.js'
105
107
  // Re-export the reserved space-filter sentinel (a value, not a type).
@@ -20,6 +20,7 @@ import type {
20
20
  SearchContentResponse,
21
21
  SearchNodesRequest,
22
22
  UpdateNodeRequest,
23
+ WriteContentOptions,
23
24
  WriteContentResponse,
24
25
  } from './types.js'
25
26
 
@@ -62,7 +63,11 @@ export interface NodeService {
62
63
  getContent(id: string): Promise<ContentResponse>
63
64
 
64
65
  /** Overwrites a node's content body. Rejects derived (file/url) nodes. */
65
- writeContent(id: string, content: string): Promise<WriteContentResponse>
66
+ writeContent(
67
+ id: string,
68
+ content: string,
69
+ options?: WriteContentOptions,
70
+ ): Promise<WriteContentResponse>
66
71
 
67
72
  /** Applies a surgical anchored edit to a node's content body. */
68
73
  editContent(id: string, request: EditContentRequest): Promise<EditContentResponse>
@@ -151,9 +156,14 @@ export class NodeServiceImpl implements NodeService {
151
156
  return this.client.request<ContentResponse>('GET', `${NODES_BASE_PATH}/${id}/content`)
152
157
  }
153
158
 
154
- async writeContent(id: string, content: string): Promise<WriteContentResponse> {
159
+ async writeContent(
160
+ id: string,
161
+ content: string,
162
+ options: WriteContentOptions = {},
163
+ ): Promise<WriteContentResponse> {
155
164
  return this.client.request<WriteContentResponse>('PUT', `${NODES_BASE_PATH}/${id}/content`, {
156
165
  content,
166
+ ...options,
157
167
  })
158
168
  }
159
169
 
@@ -37,6 +37,13 @@ export interface SpaceService {
37
37
  /** Creates a space. The slug is permanent. */
38
38
  create(request: CreateSpaceRequest): Promise<KnowledgeSpace>
39
39
 
40
+ /**
41
+ * Returns the calling user's own personal space, creating it on first use.
42
+ * Takes no arguments: whose space it is comes from the token. A personal
43
+ * space is created holding grants for its owner only.
44
+ */
45
+ ensurePersonal(): Promise<KnowledgeSpace>
46
+
40
47
  /** Updates a space's presentation. The slug cannot be changed. */
41
48
  update(slug: string, request: UpdateSpaceRequest): Promise<KnowledgeSpace>
42
49
 
@@ -76,6 +83,13 @@ export class SpaceServiceImpl implements SpaceService {
76
83
  return this.client.request<KnowledgeSpace>('POST', SPACES_BASE_PATH, request)
77
84
  }
78
85
 
86
+ async ensurePersonal(): Promise<KnowledgeSpace> {
87
+ return this.client.request<KnowledgeSpace>(
88
+ 'POST',
89
+ `${SPACES_BASE_PATH}/actions/ensure-personal`,
90
+ )
91
+ }
92
+
79
93
  async update(slug: string, request: UpdateSpaceRequest): Promise<KnowledgeSpace> {
80
94
  return this.client.request<KnowledgeSpace>('PATCH', `${SPACES_BASE_PATH}/${slug}`, request)
81
95
  }
@@ -228,11 +228,25 @@ export interface ContentResponse {
228
228
  id: string
229
229
  content: string
230
230
  lines_total: number
231
+ /** Hex SHA-256 of the body — the version token to pass back as
232
+ * `expected_content_hash` when writing, so a newer change is not overwritten. */
233
+ content_hash: string
234
+ }
235
+
236
+ /**
237
+ * Options for `nodes.writeContent`. `expected_content_hash` makes the write
238
+ * conditional: the server refuses it with 409 `content_conflict` when the
239
+ * stored body no longer hashes to it (someone else wrote it since).
240
+ */
241
+ export interface WriteContentOptions {
242
+ expected_content_hash?: string
231
243
  }
232
244
 
233
245
  export interface WriteContentResponse {
234
246
  id: string
235
247
  lines_total: number
248
+ /** Hash of the body just written. */
249
+ content_hash: string
236
250
  }
237
251
 
238
252
  /** A surgical anchored edit (mirrors Claude Code's `Edit`). */
@@ -500,8 +514,21 @@ export interface KnowledgeSpace extends AuditFields {
500
514
  description?: string | null
501
515
  color?: string | null
502
516
  icon?: string | null
517
+ /**
518
+ * Who the space is for: `shared` (an ordinary org space) or `personal` (one
519
+ * person's own space, where their assistants keep memory notes). Set at
520
+ * creation and never changed.
521
+ */
522
+ scope: SpaceScope
523
+ /**
524
+ * The person a personal space belongs to; absent on a shared space. It says
525
+ * whose space this is — access still comes only from the space's grants.
526
+ */
527
+ owner_user_id?: string | null
503
528
  }
504
529
 
530
+ export type SpaceScope = 'shared' | 'personal'
531
+
505
532
  /**
506
533
  * The reserved filter value meaning "nodes that belong to no space at all".
507
534
  * Deliberately not a legal slug (slugs are kebab-case), so it can never collide
@@ -98,4 +98,10 @@ export interface RequestOptions {
98
98
  headers?: Record<string, string>
99
99
  /** AbortSignal for request cancellation */
100
100
  signal?: AbortSignal
101
+ /**
102
+ * Let the request outlive the page that sent it (fetch `keepalive`): for the
103
+ * last report a page sends as it is closed. Browsers cap the body of such
104
+ * requests at 64 KB in total.
105
+ */
106
+ keepalive?: boolean
101
107
  }