@proteos/sdk 0.61.0 → 0.75.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.
Files changed (40) hide show
  1. package/dist/{chunk-OOOTPEJK.js → chunk-3VQQEJV6.js} +71 -11
  2. package/dist/chunk-3VQQEJV6.js.map +1 -0
  3. package/dist/{chunk-25PD6TYH.cjs → chunk-C4CH6CEY.cjs} +75 -10
  4. package/dist/chunk-C4CH6CEY.cjs.map +1 -0
  5. package/dist/index.cjs +379 -130
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +813 -81
  8. package/dist/index.d.ts +813 -81
  9. package/dist/index.js +250 -13
  10. package/dist/index.js.map +1 -1
  11. package/dist/meta/index.cjs +109 -89
  12. package/dist/meta/index.d.cts +1 -1
  13. package/dist/meta/index.d.ts +1 -1
  14. package/dist/meta/index.js +1 -1
  15. package/dist/{types-DQmqR_G8.d.cts → types-Dp-AB2QZ.d.cts} +561 -48
  16. package/dist/{types-DQmqR_G8.d.ts → types-Dp-AB2QZ.d.ts} +561 -48
  17. package/package.json +3 -3
  18. package/src/agent/session-types.ts +8 -1
  19. package/src/agent/sessions.ts +6 -4
  20. package/src/agent/types.ts +9 -0
  21. package/src/auth/platform-entities.ts +6 -0
  22. package/src/client.ts +28 -4
  23. package/src/conversation/index.ts +327 -15
  24. package/src/conversation/types.ts +594 -5
  25. package/src/data/entity-indexes.ts +54 -0
  26. package/src/data/index.ts +12 -0
  27. package/src/data/types.ts +66 -0
  28. package/src/errors.ts +5 -0
  29. package/src/index.ts +57 -0
  30. package/src/meta/components.ts +23 -3
  31. package/src/meta/index.ts +8 -0
  32. package/src/meta/layout/common-props.ts +9 -0
  33. package/src/meta/layout/elements.ts +57 -0
  34. package/src/meta/layout/index.ts +5 -0
  35. package/src/meta/layout/page-layout.ts +15 -3
  36. package/src/meta/types.ts +206 -21
  37. package/src/scheduling/types.ts +5 -1
  38. package/src/workflow/types.ts +10 -2
  39. package/dist/chunk-25PD6TYH.cjs.map +0 -1
  40. package/dist/chunk-OOOTPEJK.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteos/sdk",
3
- "version": "0.61.0",
3
+ "version": "0.75.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
@@ -66,8 +66,8 @@
66
66
  "tsup": "^8.3.0",
67
67
  "typescript": "^5.7.0",
68
68
  "vitest": "^3.0.0",
69
- "@proteos/biome-config": "0.0.0",
70
- "@proteos/tsconfig": "0.0.0"
69
+ "@proteos/tsconfig": "0.0.0",
70
+ "@proteos/biome-config": "0.0.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "tsup",
@@ -149,9 +149,16 @@ export interface ResultBlock {
149
149
  // Event payloads (discriminated by the sibling event `type`)
150
150
  // ---------------------------------------------------------------------------
151
151
 
152
- /** A user message body (text + file blocks). */
152
+ /**
153
+ * A user message body (text + file blocks). `context` is what the launching
154
+ * surface hands the model alongside the message (a call's summary and linked
155
+ * records, say): stored with the event, sent to the model as an extra text
156
+ * block, never rendered as part of the person's message. Not for secrets —
157
+ * the session owner can read it back through the events API.
158
+ */
153
159
  export interface UserMessagePayload {
154
160
  content: ContentBlock[]
161
+ context?: string
155
162
  }
156
163
 
157
164
  /** An agent message body (text blocks only). */
@@ -61,11 +61,12 @@ export interface SessionService {
61
61
  * attachments. Each {@link FileBlock} carries the storage-service `file_id`; the
62
62
  * backend uploads it to the model provider and mounts it into the agent's sandbox
63
63
  * at send time. Pass `turnId` (a UUID) for optimistic rendering. At least one of
64
- * `text` / `files` should be present.
64
+ * `text` / `files` should be present. `context` rides the payload for the model
65
+ * only (see {@link UserMessagePayload.context}).
65
66
  */
66
67
  sendUserMessage(
67
68
  id: string,
68
- input: { text?: string; files?: FileBlock[]; turnId?: string },
69
+ input: { text?: string; files?: FileBlock[]; turnId?: string; context?: string },
69
70
  ): Promise<SessionEvent>
70
71
  /** Convenience: appends a `user.interrupt` to halt the running turn. */
71
72
  interrupt(id: string): Promise<SessionEvent>
@@ -149,7 +150,7 @@ export class SessionServiceImpl implements SessionService {
149
150
 
150
151
  async sendUserMessage(
151
152
  id: string,
152
- input: { text?: string; files?: FileBlock[]; turnId?: string },
153
+ input: { text?: string; files?: FileBlock[]; turnId?: string; context?: string },
153
154
  ): Promise<SessionEvent> {
154
155
  const content: ContentBlock[] = []
155
156
  const text = input.text?.trim()
@@ -157,10 +158,11 @@ export class SessionServiceImpl implements SessionService {
157
158
  for (const file of input.files ?? []) {
158
159
  content.push({ type: 'file', ...file })
159
160
  }
161
+ const context = input.context?.trim()
160
162
  return this.appendEvent(id, {
161
163
  type: 'user.message',
162
164
  ...(input.turnId ? { turn_id: input.turnId } : {}),
163
- payload: { content },
165
+ payload: { content, ...(context ? { context } : {}) },
164
166
  })
165
167
  }
166
168
 
@@ -68,6 +68,13 @@ export interface Agent extends AuditFields {
68
68
  toolsets: string[]
69
69
  /** Marks the single agent surfaced by default for the org (at most one). */
70
70
  is_org_default: boolean
71
+ /**
72
+ * Runs beside the tabbed workspace in the web app: the platform appends the
73
+ * workspace-mode instructions (open_tab / switch_tab / close_tab, app context) to
74
+ * the synced system prompt and the web client offers the tab tools instead of
75
+ * navigate / open_record.
76
+ */
77
+ has_workspace: boolean
71
78
  version: number
72
79
  }
73
80
 
@@ -84,6 +91,7 @@ export interface CreateAgentRequest {
84
91
  mcp_servers?: string[]
85
92
  toolsets?: string[]
86
93
  is_org_default?: boolean
94
+ has_workspace?: boolean
87
95
  }
88
96
 
89
97
  export interface UpdateAgentRequest {
@@ -98,6 +106,7 @@ export interface UpdateAgentRequest {
98
106
  mcp_servers?: string[]
99
107
  toolsets?: string[]
100
108
  is_org_default?: boolean
109
+ has_workspace?: boolean
101
110
  }
102
111
 
103
112
  export type ListAgentsOptions = AgentResourceListOptions
@@ -107,12 +107,18 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
107
107
  { slug: 'channel-events', name: 'Channel Events' },
108
108
  // Conversation briefs: guidance prepared ahead of a conversation (call, meeting) with a contact.
109
109
  { slug: 'conversation-briefs', name: 'Conversation Briefs' },
110
+ // Conversation notes: what a person recorded about a conversation (append log, author-stamped).
111
+ { slug: 'conversation-notes', name: 'Conversation Notes' },
110
112
  // Conversation intelligence: the typed questions asked of conversations
111
113
  // (definitions), where/when they are evaluated (sets), and the observations
112
114
  // they produce incl. their evaluation history (tags).
113
115
  { slug: 'conversation-tag-definitions', name: 'Conversation Tag Definitions' },
114
116
  { slug: 'conversation-tag-sets', name: 'Conversation Tag Sets' },
115
117
  { slug: 'conversation-tags', name: 'Conversation Tags' },
118
+ // Conversation objectives: what a conversation should achieve (definitions)
119
+ // and each definition's standing per conversation (objectives, read-only ledger).
120
+ { slug: 'conversation-objective-definitions', name: 'Conversation Objective Definitions' },
121
+ { slug: 'conversation-objectives', name: 'Conversation Objectives' },
116
122
  // Connectors (connector-service). `connections` above is shared; this is the
117
123
  // manifest catalog.
118
124
  { slug: 'connectors', name: 'Connectors' },
package/src/client.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type EventSourceMessage, fetchEventSource } from '@microsoft/fetch-event-source'
2
- import { ProteosError, parseErrorResponse } from './errors.js'
2
+ import { ErrorCode, ProteosError, parseErrorResponse } from './errors.js'
3
3
  import { toQueryParams } from './http/query-params.js'
4
4
  import {
5
5
  type ClientOptions,
@@ -132,6 +132,30 @@ export class ProteosClient {
132
132
  return AbortSignal.timeout(timeout)
133
133
  }
134
134
 
135
+ /**
136
+ * Runs fetch and turns a transport failure — DNS, connection refused, the
137
+ * network being down, the timeout signal firing — into a ProteosError with
138
+ * httpStatus 0, so callers can tell "the server said no" from "the server
139
+ * was never reached" (the latter is worth retrying). An abort the caller
140
+ * asked for is theirs and passes through untouched.
141
+ */
142
+ private async send(url: string, init: RequestInit): Promise<Response> {
143
+ try {
144
+ return await this.options.fetch(url, init)
145
+ } catch (error) {
146
+ if (error instanceof Error && error.name === 'AbortError') throw error
147
+ const message = error instanceof Error ? error.message : 'Network request failed'
148
+ const isTimeout =
149
+ error instanceof Error &&
150
+ (error.name === 'TimeoutError' || error.message.startsWith('Request timeout'))
151
+ throw new ProteosError(
152
+ message,
153
+ 0,
154
+ isTimeout ? ErrorCode.REQUEST_TIMEOUT : ErrorCode.NETWORK_ERROR,
155
+ )
156
+ }
157
+ }
158
+
135
159
  /**
136
160
  * Performs an HTTP request and decodes the JSON response.
137
161
  *
@@ -182,7 +206,7 @@ export class ProteosClient {
182
206
  const headers = await this.buildHeaders(requestOptions)
183
207
  const signal = this.createTimeoutSignal(requestOptions)
184
208
 
185
- const response = await this.options.fetch(url, {
209
+ const response = await this.send(url, {
186
210
  method,
187
211
  headers,
188
212
  body: body !== undefined ? JSON.stringify(body) : null,
@@ -247,7 +271,7 @@ export class ProteosClient {
247
271
 
248
272
  const signal = this.createTimeoutSignal(requestOptions)
249
273
 
250
- const response = await this.options.fetch(url, {
274
+ const response = await this.send(url, {
251
275
  method,
252
276
  headers,
253
277
  body: formData,
@@ -287,7 +311,7 @@ export class ProteosClient {
287
311
  const headers = await this.buildHeaders(requestOptions)
288
312
  const signal = this.createTimeoutSignal(requestOptions)
289
313
 
290
- const response = await this.options.fetch(url, {
314
+ const response = await this.send(url, {
291
315
  method,
292
316
  headers,
293
317
  body: body !== undefined ? JSON.stringify(body) : null,