@proteos/sdk 0.39.0 → 0.40.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/dist/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -15
- package/dist/index.d.ts +78 -15
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent/index.ts +1 -0
- package/src/agent/session-types.ts +9 -2
- package/src/agent/types.ts +15 -2
- package/src/conversation/index.ts +24 -3
- package/src/conversation/types.ts +45 -6
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/agent/index.ts
CHANGED
|
@@ -224,8 +224,15 @@ export interface StopReason {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
227
|
+
* Ends a turn — published once per turn by the server, not an echo of the upstream
|
|
228
|
+
* provider's session status (which flips idle/running once per server-side tool
|
|
229
|
+
* round, mid-turn).
|
|
230
|
+
*
|
|
231
|
+
* `event_ids` is set only with `stop_reason.type: 'user_action_required'`, and lists
|
|
232
|
+
* the tool_use events still OUTSTANDING — the ones a client must answer. Tools the
|
|
233
|
+
* server executes itself are resolved before this event exists, so seeing this event
|
|
234
|
+
* at all means the turn cannot continue without you: answer each id with a
|
|
235
|
+
* `user.tool_result`.
|
|
229
236
|
*/
|
|
230
237
|
export interface SessionIdlePayload {
|
|
231
238
|
stop_reason: StopReason
|
package/src/agent/types.ts
CHANGED
|
@@ -217,8 +217,10 @@ export type ListSkillsOptions = AgentResourceListOptions
|
|
|
217
217
|
* - `client` is a host-provided builtin and carries no binding.
|
|
218
218
|
* - `platform` binds to one tool of the platform MCP server (mcp-service),
|
|
219
219
|
* executed server-side as the acting user.
|
|
220
|
+
* - `query` stores a SQL query with declared params, executed server-side
|
|
221
|
+
* against data-service as the acting user.
|
|
220
222
|
*/
|
|
221
|
-
export type ToolKind = 'action' | 'mcp' | 'client' | 'platform'
|
|
223
|
+
export type ToolKind = 'action' | 'mcp' | 'client' | 'platform' | 'query'
|
|
222
224
|
|
|
223
225
|
/** Binds to a function-service Action by its key (kind=action). */
|
|
224
226
|
export interface ActionBinding {
|
|
@@ -240,8 +242,19 @@ export interface PlatformBinding {
|
|
|
240
242
|
tool_name: string
|
|
241
243
|
}
|
|
242
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Stores a SELECT-only SQL query (data-service dialect) whose `{{param}}`
|
|
247
|
+
* placeholders are filled from the declared `params` at execution time
|
|
248
|
+
* (kind=query). Params are scalar attribute definitions (string, number,
|
|
249
|
+
* integer, boolean, datetime, enum); they generate the tool's input schema.
|
|
250
|
+
*/
|
|
251
|
+
export interface QueryBinding {
|
|
252
|
+
sql: string
|
|
253
|
+
params?: Attribute[]
|
|
254
|
+
}
|
|
255
|
+
|
|
243
256
|
/** Kind-discriminated binding payload. `kind=client` carries no binding. */
|
|
244
|
-
export type ToolBinding = ActionBinding | McpBinding | PlatformBinding
|
|
257
|
+
export type ToolBinding = ActionBinding | McpBinding | PlatformBinding | QueryBinding
|
|
245
258
|
|
|
246
259
|
/**
|
|
247
260
|
* A thin registry entry over one of three binding sources. `key` is the wire
|
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
CreateConversationTypeRequest,
|
|
20
20
|
CreateGlossaryTermRequest,
|
|
21
21
|
CreateTranscriptionRequest,
|
|
22
|
+
DeleteConnectionQuery,
|
|
22
23
|
DispatchMeetingBotRequest,
|
|
23
24
|
GlossaryTerm,
|
|
24
25
|
InstallConnectionResponse,
|
|
@@ -164,7 +165,14 @@ export interface ConnectionService {
|
|
|
164
165
|
get(id: string): Promise<Connection>
|
|
165
166
|
create(request: CreateConnectionRequest): Promise<Connection>
|
|
166
167
|
update(id: string, request: UpdateConnectionRequest): Promise<Connection>
|
|
167
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Delete a connection. The connector first releases its provider-side
|
|
170
|
+
* registration (a Recall calendar and the OAuth grant behind it); when that
|
|
171
|
+
* fails the delete is refused with a `connector_uninstall_failed` 502 rather
|
|
172
|
+
* than orphaning it. Pass `{ is_forced: true }` to drop the row anyway and
|
|
173
|
+
* clean up at the provider by hand.
|
|
174
|
+
*/
|
|
175
|
+
delete(id: string, query?: DeleteConnectionQuery): Promise<void>
|
|
168
176
|
/** Begin the connector's install flow; open the returned URL in a popup. */
|
|
169
177
|
install(id: string): Promise<InstallConnectionResponse>
|
|
170
178
|
/**
|
|
@@ -211,10 +219,11 @@ class ConnectionServiceImpl implements ConnectionService {
|
|
|
211
219
|
)
|
|
212
220
|
}
|
|
213
221
|
|
|
214
|
-
async delete(id: string): Promise<void> {
|
|
215
|
-
await this.client.
|
|
222
|
+
async delete(id: string, query: DeleteConnectionQuery = {}): Promise<void> {
|
|
223
|
+
await this.client.requestWithQuery(
|
|
216
224
|
'DELETE',
|
|
217
225
|
`${CONVERSATION_BASE_PATH}/connections/${encodeURIComponent(id)}`,
|
|
226
|
+
query,
|
|
218
227
|
)
|
|
219
228
|
}
|
|
220
229
|
|
|
@@ -392,6 +401,11 @@ export interface ConversationService {
|
|
|
392
401
|
/** Patch the user-editable surface (subject, summary, status, metadata). */
|
|
393
402
|
update(id: string, request: UpdateConversationRequest): Promise<Conversation>
|
|
394
403
|
end(id: string): Promise<Conversation>
|
|
404
|
+
/**
|
|
405
|
+
* Hard-delete the conversation, its thread children, and every dependent
|
|
406
|
+
* row (messages, attachments, read markers, transcriptions). Irreversible.
|
|
407
|
+
*/
|
|
408
|
+
delete(id: string): Promise<void>
|
|
395
409
|
/** Upsert the requesting user's read marker to now (open a conversation). */
|
|
396
410
|
markRead(id: string): Promise<void>
|
|
397
411
|
/** Remove the marker — the conversation reads as unread again. */
|
|
@@ -429,6 +443,13 @@ class ConversationServiceImpl implements ConversationService {
|
|
|
429
443
|
)
|
|
430
444
|
}
|
|
431
445
|
|
|
446
|
+
delete(id: string): Promise<void> {
|
|
447
|
+
return this.client.request(
|
|
448
|
+
'DELETE',
|
|
449
|
+
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(id)}`,
|
|
450
|
+
)
|
|
451
|
+
}
|
|
452
|
+
|
|
432
453
|
markRead(id: string): Promise<void> {
|
|
433
454
|
return this.client.request(
|
|
434
455
|
'POST',
|
|
@@ -730,6 +730,17 @@ export interface ListConnectionsQuery extends PaginationQuery {
|
|
|
730
730
|
status?: string
|
|
731
731
|
}
|
|
732
732
|
|
|
733
|
+
/**
|
|
734
|
+
* The delete's escape hatch. A connection delete makes the connector release
|
|
735
|
+
* its provider-side registration first and refuses with a 502
|
|
736
|
+
* `connector_uninstall_failed` when that fails — the row is the only handle on
|
|
737
|
+
* that state. `is_forced` drops the row anyway, leaving the provider-side
|
|
738
|
+
* leftovers as a manual cleanup.
|
|
739
|
+
*/
|
|
740
|
+
export interface DeleteConnectionQuery {
|
|
741
|
+
is_forced?: boolean
|
|
742
|
+
}
|
|
743
|
+
|
|
733
744
|
export interface ListConversationsQuery extends PaginationQuery {
|
|
734
745
|
channel?: string
|
|
735
746
|
status?: string
|
|
@@ -783,18 +794,33 @@ export interface ListAgentListenersQuery extends PaginationQuery {
|
|
|
783
794
|
}
|
|
784
795
|
|
|
785
796
|
/**
|
|
786
|
-
* Conversation filters:
|
|
787
|
-
*
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
797
|
+
* Conversation filters: rules that drop matching inbound messages BEFORE
|
|
798
|
+
* persistence (no message, no contact — only a content-free audit event) and,
|
|
799
|
+
* on meeting calendar connections, gate whether the meeting bot is scheduled
|
|
800
|
+
* at all (pre-join enforcement of the same rules — earliest possible point).
|
|
801
|
+
* Scope-first evaluation: connection-scoped rules are final when one matches;
|
|
802
|
+
* global rules apply otherwise. Specificity within a scope:
|
|
803
|
+
* address > domain > title_keyword > role_based > automated >
|
|
804
|
+
* self_originated > internal_participant > internal_conversations > all,
|
|
805
|
+
* allow beats block within a class; an allow match is a final keep, which is
|
|
806
|
+
* the auto-join composition mechanism (e.g. "organized by me" = a
|
|
807
|
+
* connection-scoped all-block plus a self_originated allow).
|
|
808
|
+
*
|
|
809
|
+
* Channel matrix: address/self_originated/all act on every channel;
|
|
810
|
+
* domain/title_keyword/internal_participant/internal_conversations act on
|
|
811
|
+
* email + meeting connections; role_based/automated are email-only. A
|
|
812
|
+
* connection-scoped rule of a type inert on that connection's channel is
|
|
813
|
+
* rejected (invalid_filter_config); global rules are unrestricted and stay
|
|
814
|
+
* inert where their facts are missing.
|
|
792
815
|
*/
|
|
793
816
|
export type ConversationFilterType =
|
|
794
817
|
| 'address'
|
|
795
818
|
| 'domain'
|
|
819
|
+
| 'title_keyword'
|
|
796
820
|
| 'role_based'
|
|
797
821
|
| 'automated'
|
|
822
|
+
| 'self_originated'
|
|
823
|
+
| 'internal_participant'
|
|
798
824
|
| 'internal_conversations'
|
|
799
825
|
| 'all'
|
|
800
826
|
export type ConversationFilterAction = 'block' | 'allow'
|
|
@@ -827,6 +853,16 @@ export interface RoleBasedFilterConfig {
|
|
|
827
853
|
export interface AutomatedFilterConfig {
|
|
828
854
|
signals?: AutomatedSignal[]
|
|
829
855
|
}
|
|
856
|
+
/** Title/subject contains any keyword (case-insensitive substring; stored lowercased). */
|
|
857
|
+
export interface TitleKeywordFilterConfig {
|
|
858
|
+
keywords: string[]
|
|
859
|
+
}
|
|
860
|
+
/** Conversation originates from the connection owner (meeting organizer / self sender). Empty config. */
|
|
861
|
+
export type SelfOriginatedFilterConfig = Record<string, never>
|
|
862
|
+
/** ≥1 participant OTHER than the connection self is on one of these domains (any-internal). */
|
|
863
|
+
export interface InternalParticipantFilterConfig {
|
|
864
|
+
domains: string[]
|
|
865
|
+
}
|
|
830
866
|
/** Drops only when sender AND every recipient are on these domains. Always block. */
|
|
831
867
|
export interface InternalConversationsFilterConfig {
|
|
832
868
|
domains: string[]
|
|
@@ -837,8 +873,11 @@ export type AllFilterConfig = Record<string, never>
|
|
|
837
873
|
export type ConversationFilterConfig =
|
|
838
874
|
| AddressFilterConfig
|
|
839
875
|
| DomainFilterConfig
|
|
876
|
+
| TitleKeywordFilterConfig
|
|
840
877
|
| RoleBasedFilterConfig
|
|
841
878
|
| AutomatedFilterConfig
|
|
879
|
+
| SelfOriginatedFilterConfig
|
|
880
|
+
| InternalParticipantFilterConfig
|
|
842
881
|
| InternalConversationsFilterConfig
|
|
843
882
|
| AllFilterConfig
|
|
844
883
|
|