@pellux/goodvibes-sdk 0.33.2 → 0.33.4
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/contracts/artifacts/operator-contract.json +2 -2
- package/dist/platform/control-plane/gateway-utils.js +1 -1
- package/dist/platform/control-plane/method-catalog-runtime.js +1 -1
- package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-state.js +179 -45
- package/dist/platform/runtime/integration/helpers.d.ts +2 -1
- package/dist/platform/runtime/integration/helpers.d.ts.map +1 -1
- package/dist/platform/runtime/integration/helpers.js +16 -34
- package/dist/platform/runtime/remote/distributed-runtime-store.d.ts.map +1 -1
- package/dist/platform/runtime/remote/distributed-runtime-store.js +3 -25
- package/dist/platform/version.js +1 -1
- package/package.json +9 -9
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"product": {
|
|
4
4
|
"id": "goodvibes",
|
|
5
5
|
"surface": "operator",
|
|
6
|
-
"version": "0.33.
|
|
6
|
+
"version": "0.33.4"
|
|
7
7
|
},
|
|
8
8
|
"auth": {
|
|
9
9
|
"modes": [
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
{
|
|
264
264
|
"id": "accounts.snapshot",
|
|
265
265
|
"title": "Accounts Snapshot",
|
|
266
|
-
"description": "Return provider
|
|
266
|
+
"description": "Return provider account posture.",
|
|
267
267
|
"category": "accounts",
|
|
268
268
|
"source": "builtin",
|
|
269
269
|
"access": "authenticated",
|
|
@@ -27,7 +27,7 @@ const MAX_DISCONNECTED_CLIENTS = 200;
|
|
|
27
27
|
export function serializeEnvelope(envelope) {
|
|
28
28
|
return {
|
|
29
29
|
type: envelope.type,
|
|
30
|
-
|
|
30
|
+
ts: envelope.ts,
|
|
31
31
|
traceId: envelope.traceId,
|
|
32
32
|
sessionId: envelope.sessionId,
|
|
33
33
|
source: envelope.source,
|
|
@@ -143,7 +143,7 @@ export const builtinGatewayRuntimeMethodDescriptors = [
|
|
|
143
143
|
methodDescriptor({
|
|
144
144
|
id: 'accounts.snapshot',
|
|
145
145
|
title: 'Accounts Snapshot',
|
|
146
|
-
description: 'Return provider
|
|
146
|
+
description: 'Return provider account posture.',
|
|
147
147
|
category: 'accounts',
|
|
148
148
|
scopes: ['read:accounts'],
|
|
149
149
|
http: { method: 'GET', path: '/api/accounts' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-broker-state.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-broker-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"session-broker-state.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-broker-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AA2Q9G,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,EAAE,CAE1F;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,EAAE,CAE5F;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,EAAE,CAElG;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GAAG;IAC/F,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC;CAC1D,CAsCA;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE;IACL,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC5D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC,CAAC;IACxE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,wBAAwB,EAAE,CAAC,CAAC;CAC3E,EACD,oBAAoB,EAAE,MAAM,GAC3B,0BAA0B,CAQ5B;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,SAAS,wBAAwB,EAAE,EACjD,WAAW,EAAE,wBAAwB,GACpC,wBAAwB,EAAE,CAM5B;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,GAAG,MAAM,CAI9F"}
|
|
@@ -22,64 +22,166 @@ function validateOptionalNumber(value) {
|
|
|
22
22
|
if (value !== undefined && !isFiniteNumber(value))
|
|
23
23
|
throwInvalidSessionSnapshot();
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function hasSessionRecordPayload(value) {
|
|
26
|
+
return [
|
|
27
|
+
'kind',
|
|
28
|
+
'title',
|
|
29
|
+
'status',
|
|
30
|
+
'createdAt',
|
|
31
|
+
'updatedAt',
|
|
32
|
+
'lastActivityAt',
|
|
33
|
+
'messageCount',
|
|
34
|
+
'pendingInputCount',
|
|
35
|
+
'lastMessageAt',
|
|
36
|
+
'closedAt',
|
|
37
|
+
'activeAgentId',
|
|
38
|
+
'lastAgentId',
|
|
39
|
+
'lastError',
|
|
40
|
+
'routeIds',
|
|
41
|
+
'surfaceKinds',
|
|
42
|
+
'participants',
|
|
43
|
+
'metadata',
|
|
44
|
+
].some((key) => value[key] !== undefined);
|
|
45
|
+
}
|
|
46
|
+
function normalizeSessionParticipant(value) {
|
|
26
47
|
if (!isRecord(value)
|
|
27
48
|
|| typeof value['surfaceKind'] !== 'string'
|
|
28
|
-
|| typeof value['surfaceId'] !== 'string'
|
|
29
|
-
|| !isFiniteNumber(value['lastSeenAt'])) {
|
|
49
|
+
|| typeof value['surfaceId'] !== 'string') {
|
|
30
50
|
throwInvalidSessionSnapshot();
|
|
31
51
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
const lastSeenAt = isFiniteNumber(value['lastSeenAt']) ? value['lastSeenAt'] : Date.now();
|
|
53
|
+
const externalId = typeof value['externalId'] === 'string' ? value['externalId'] : undefined;
|
|
54
|
+
const userId = typeof value['userId'] === 'string' ? value['userId'] : undefined;
|
|
55
|
+
const displayName = typeof value['displayName'] === 'string' ? value['displayName'] : undefined;
|
|
56
|
+
const routeId = typeof value['routeId'] === 'string' ? value['routeId'] : undefined;
|
|
57
|
+
return {
|
|
58
|
+
surfaceKind: value['surfaceKind'],
|
|
59
|
+
surfaceId: value['surfaceId'],
|
|
60
|
+
...(externalId ? { externalId } : {}),
|
|
61
|
+
...(userId ? { userId } : {}),
|
|
62
|
+
...(displayName ? { displayName } : {}),
|
|
63
|
+
...(routeId ? { routeId } : {}),
|
|
64
|
+
lastSeenAt,
|
|
65
|
+
};
|
|
36
66
|
}
|
|
37
|
-
function
|
|
67
|
+
function normalizeSessionRecord(value, messages, inputs) {
|
|
38
68
|
if (!isRecord(value)
|
|
39
69
|
|| typeof value['id'] !== 'string'
|
|
40
|
-
||
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|| !isFiniteNumber(value['lastActivityAt'])
|
|
48
|
-
|| !isFiniteNumber(value['messageCount'])
|
|
49
|
-
|| !isFiniteNumber(value['pendingInputCount'])
|
|
50
|
-
|| !isStringArray(value['routeIds'])
|
|
51
|
-
|| !isStringArray(value['surfaceKinds'])
|
|
52
|
-
|| !Array.isArray(value['participants'])
|
|
53
|
-
|| !isRecord(value['metadata'])) {
|
|
70
|
+
|| !hasSessionRecordPayload(value)) {
|
|
71
|
+
throwInvalidSessionSnapshot();
|
|
72
|
+
}
|
|
73
|
+
if (value['kind'] !== undefined && (typeof value['kind'] !== 'string' || !SESSION_KINDS.has(value['kind']))) {
|
|
74
|
+
throwInvalidSessionSnapshot();
|
|
75
|
+
}
|
|
76
|
+
if (value['status'] !== undefined && (typeof value['status'] !== 'string' || !SESSION_STATUSES.has(value['status']))) {
|
|
54
77
|
throwInvalidSessionSnapshot();
|
|
55
78
|
}
|
|
79
|
+
validateOptionalNumber(value['createdAt']);
|
|
80
|
+
validateOptionalNumber(value['updatedAt']);
|
|
81
|
+
validateOptionalNumber(value['lastActivityAt']);
|
|
82
|
+
validateOptionalNumber(value['messageCount']);
|
|
83
|
+
validateOptionalNumber(value['pendingInputCount']);
|
|
56
84
|
validateOptionalNumber(value['lastMessageAt']);
|
|
57
85
|
validateOptionalNumber(value['closedAt']);
|
|
58
86
|
validateOptionalString(value['activeAgentId']);
|
|
59
87
|
validateOptionalString(value['lastAgentId']);
|
|
60
88
|
validateOptionalString(value['lastError']);
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
if (value['routeIds'] !== undefined && !isStringArray(value['routeIds']))
|
|
90
|
+
throwInvalidSessionSnapshot();
|
|
91
|
+
if (value['surfaceKinds'] !== undefined && !isStringArray(value['surfaceKinds']))
|
|
92
|
+
throwInvalidSessionSnapshot();
|
|
93
|
+
if (value['participants'] !== undefined && !Array.isArray(value['participants']))
|
|
94
|
+
throwInvalidSessionSnapshot();
|
|
95
|
+
if (value['metadata'] !== undefined && !isRecord(value['metadata']))
|
|
96
|
+
throwInvalidSessionSnapshot();
|
|
97
|
+
const now = Date.now();
|
|
98
|
+
const id = value['id'];
|
|
99
|
+
const participants = (value['participants'] ?? []).map(normalizeSessionParticipant);
|
|
100
|
+
const routeIds = isStringArray(value['routeIds']) ? [...new Set(value['routeIds'])] : [];
|
|
101
|
+
const surfaceKinds = isStringArray(value['surfaceKinds'])
|
|
102
|
+
? [...new Set(value['surfaceKinds'])]
|
|
103
|
+
: [...new Set(participants.map((participant) => participant.surfaceKind))];
|
|
104
|
+
const latestMessageAt = messages.reduce((latest, message) => latest === undefined || message.createdAt > latest ? message.createdAt : latest, undefined);
|
|
105
|
+
const latestInputAt = inputs.reduce((latest, input) => latest === undefined || input.updatedAt > latest ? input.updatedAt : latest, undefined);
|
|
106
|
+
const createdAt = isFiniteNumber(value['createdAt'])
|
|
107
|
+
? value['createdAt']
|
|
108
|
+
: isFiniteNumber(value['updatedAt'])
|
|
109
|
+
? value['updatedAt']
|
|
110
|
+
: now;
|
|
111
|
+
const updatedAt = isFiniteNumber(value['updatedAt']) ? value['updatedAt'] : createdAt;
|
|
112
|
+
const lastMessageAt = isFiniteNumber(value['lastMessageAt']) ? value['lastMessageAt'] : latestMessageAt;
|
|
113
|
+
const lastActivityAt = isFiniteNumber(value['lastActivityAt'])
|
|
114
|
+
? value['lastActivityAt']
|
|
115
|
+
: Math.max(updatedAt, lastMessageAt ?? 0, latestInputAt ?? 0);
|
|
116
|
+
const activeAgentId = typeof value['activeAgentId'] === 'string' ? value['activeAgentId'] : undefined;
|
|
117
|
+
const lastAgentId = typeof value['lastAgentId'] === 'string' ? value['lastAgentId'] : undefined;
|
|
118
|
+
const lastError = typeof value['lastError'] === 'string' ? value['lastError'] : undefined;
|
|
119
|
+
const closedAt = isFiniteNumber(value['closedAt']) ? value['closedAt'] : undefined;
|
|
120
|
+
return {
|
|
121
|
+
id,
|
|
122
|
+
kind: typeof value['kind'] === 'string' && SESSION_KINDS.has(value['kind'])
|
|
123
|
+
? value['kind']
|
|
124
|
+
: 'tui',
|
|
125
|
+
title: typeof value['title'] === 'string' && value['title'].trim().length > 0 ? value['title'] : `Session ${id}`,
|
|
126
|
+
status: typeof value['status'] === 'string' && SESSION_STATUSES.has(value['status'])
|
|
127
|
+
? value['status']
|
|
128
|
+
: 'active',
|
|
129
|
+
createdAt,
|
|
130
|
+
updatedAt,
|
|
131
|
+
...(lastMessageAt !== undefined ? { lastMessageAt } : {}),
|
|
132
|
+
...(closedAt !== undefined ? { closedAt } : {}),
|
|
133
|
+
lastActivityAt,
|
|
134
|
+
messageCount: Math.max(isFiniteNumber(value['messageCount']) ? value['messageCount'] : 0, messages.length),
|
|
135
|
+
pendingInputCount: Math.max(isFiniteNumber(value['pendingInputCount']) ? value['pendingInputCount'] : 0, countPendingSessionInputs(inputs)),
|
|
136
|
+
routeIds,
|
|
137
|
+
surfaceKinds,
|
|
138
|
+
participants,
|
|
139
|
+
...(activeAgentId ? { activeAgentId } : {}),
|
|
140
|
+
...(lastAgentId ? { lastAgentId } : {}),
|
|
141
|
+
...(lastError ? { lastError } : {}),
|
|
142
|
+
metadata: isRecord(value['metadata']) ? value['metadata'] : {},
|
|
143
|
+
};
|
|
63
144
|
}
|
|
64
|
-
function
|
|
145
|
+
function normalizeSessionMessage(value) {
|
|
65
146
|
if (!isRecord(value)
|
|
66
147
|
|| typeof value['id'] !== 'string'
|
|
67
148
|
|| typeof value['sessionId'] !== 'string'
|
|
68
149
|
|| typeof value['role'] !== 'string'
|
|
69
150
|
|| !MESSAGE_ROLES.has(value['role'])
|
|
70
151
|
|| typeof value['body'] !== 'string'
|
|
71
|
-
|| !isFiniteNumber(value['createdAt'])
|
|
72
|
-
|| !isRecord(value['metadata'])) {
|
|
152
|
+
|| !isFiniteNumber(value['createdAt'])) {
|
|
73
153
|
throwInvalidSessionSnapshot();
|
|
74
154
|
}
|
|
155
|
+
if (value['metadata'] !== undefined && !isRecord(value['metadata']))
|
|
156
|
+
throwInvalidSessionSnapshot();
|
|
75
157
|
validateOptionalString(value['surfaceKind']);
|
|
76
158
|
validateOptionalString(value['surfaceId']);
|
|
77
159
|
validateOptionalString(value['routeId']);
|
|
78
160
|
validateOptionalString(value['agentId']);
|
|
79
161
|
validateOptionalString(value['userId']);
|
|
80
162
|
validateOptionalString(value['displayName']);
|
|
163
|
+
const surfaceKind = typeof value['surfaceKind'] === 'string' ? value['surfaceKind'] : undefined;
|
|
164
|
+
const surfaceId = typeof value['surfaceId'] === 'string' ? value['surfaceId'] : undefined;
|
|
165
|
+
const routeId = typeof value['routeId'] === 'string' ? value['routeId'] : undefined;
|
|
166
|
+
const agentId = typeof value['agentId'] === 'string' ? value['agentId'] : undefined;
|
|
167
|
+
const userId = typeof value['userId'] === 'string' ? value['userId'] : undefined;
|
|
168
|
+
const displayName = typeof value['displayName'] === 'string' ? value['displayName'] : undefined;
|
|
169
|
+
return {
|
|
170
|
+
id: value['id'],
|
|
171
|
+
sessionId: value['sessionId'],
|
|
172
|
+
role: value['role'],
|
|
173
|
+
body: value['body'],
|
|
174
|
+
createdAt: value['createdAt'],
|
|
175
|
+
...(surfaceKind ? { surfaceKind } : {}),
|
|
176
|
+
...(surfaceId ? { surfaceId } : {}),
|
|
177
|
+
...(routeId ? { routeId } : {}),
|
|
178
|
+
...(agentId ? { agentId } : {}),
|
|
179
|
+
...(userId ? { userId } : {}),
|
|
180
|
+
...(displayName ? { displayName } : {}),
|
|
181
|
+
metadata: isRecord(value['metadata']) ? value['metadata'] : {},
|
|
182
|
+
};
|
|
81
183
|
}
|
|
82
|
-
function
|
|
184
|
+
function normalizeSessionInput(value) {
|
|
83
185
|
if (!isRecord(value)
|
|
84
186
|
|| typeof value['id'] !== 'string'
|
|
85
187
|
|| typeof value['sessionId'] !== 'string'
|
|
@@ -90,10 +192,11 @@ function validateSessionInput(value) {
|
|
|
90
192
|
|| typeof value['correlationId'] !== 'string'
|
|
91
193
|
|| typeof value['body'] !== 'string'
|
|
92
194
|
|| !isFiniteNumber(value['createdAt'])
|
|
93
|
-
|| !isFiniteNumber(value['updatedAt'])
|
|
94
|
-
|| !isRecord(value['metadata'])) {
|
|
195
|
+
|| !isFiniteNumber(value['updatedAt'])) {
|
|
95
196
|
throwInvalidSessionSnapshot();
|
|
96
197
|
}
|
|
198
|
+
if (value['metadata'] !== undefined && !isRecord(value['metadata']))
|
|
199
|
+
throwInvalidSessionSnapshot();
|
|
97
200
|
validateOptionalString(value['causationId']);
|
|
98
201
|
validateOptionalString(value['routeId']);
|
|
99
202
|
validateOptionalString(value['surfaceKind']);
|
|
@@ -106,6 +209,38 @@ function validateSessionInput(value) {
|
|
|
106
209
|
validateOptionalString(value['error']);
|
|
107
210
|
if (value['routing'] !== undefined && !isRecord(value['routing']))
|
|
108
211
|
throwInvalidSessionSnapshot();
|
|
212
|
+
const causationId = typeof value['causationId'] === 'string' ? value['causationId'] : undefined;
|
|
213
|
+
const routeId = typeof value['routeId'] === 'string' ? value['routeId'] : undefined;
|
|
214
|
+
const surfaceKind = typeof value['surfaceKind'] === 'string' ? value['surfaceKind'] : undefined;
|
|
215
|
+
const surfaceId = typeof value['surfaceId'] === 'string' ? value['surfaceId'] : undefined;
|
|
216
|
+
const externalId = typeof value['externalId'] === 'string' ? value['externalId'] : undefined;
|
|
217
|
+
const threadId = typeof value['threadId'] === 'string' ? value['threadId'] : undefined;
|
|
218
|
+
const userId = typeof value['userId'] === 'string' ? value['userId'] : undefined;
|
|
219
|
+
const displayName = typeof value['displayName'] === 'string' ? value['displayName'] : undefined;
|
|
220
|
+
const activeAgentId = typeof value['activeAgentId'] === 'string' ? value['activeAgentId'] : undefined;
|
|
221
|
+
const error = typeof value['error'] === 'string' ? value['error'] : undefined;
|
|
222
|
+
return {
|
|
223
|
+
id: value['id'],
|
|
224
|
+
sessionId: value['sessionId'],
|
|
225
|
+
intent: value['intent'],
|
|
226
|
+
state: value['state'],
|
|
227
|
+
correlationId: value['correlationId'],
|
|
228
|
+
...(causationId ? { causationId } : {}),
|
|
229
|
+
body: value['body'],
|
|
230
|
+
createdAt: value['createdAt'],
|
|
231
|
+
updatedAt: value['updatedAt'],
|
|
232
|
+
...(routeId ? { routeId } : {}),
|
|
233
|
+
...(surfaceKind ? { surfaceKind } : {}),
|
|
234
|
+
...(surfaceId ? { surfaceId } : {}),
|
|
235
|
+
...(externalId ? { externalId } : {}),
|
|
236
|
+
...(threadId ? { threadId } : {}),
|
|
237
|
+
...(userId ? { userId } : {}),
|
|
238
|
+
...(displayName ? { displayName } : {}),
|
|
239
|
+
...(activeAgentId ? { activeAgentId } : {}),
|
|
240
|
+
metadata: isRecord(value['metadata']) ? value['metadata'] : {},
|
|
241
|
+
...(isRecord(value['routing']) ? { routing: value['routing'] } : {}),
|
|
242
|
+
...(error ? { error } : {}),
|
|
243
|
+
};
|
|
109
244
|
}
|
|
110
245
|
export function sortSessions(records) {
|
|
111
246
|
return [...records].sort((a, b) => (b.updatedAt - a.updatedAt) || a.id.localeCompare(b.id));
|
|
@@ -121,28 +256,21 @@ export function loadSessionBrokerState(snapshot) {
|
|
|
121
256
|
if (!isRecord(snapshot) || !Array.isArray(snapshot.sessions) || !Array.isArray(snapshot.messages) || !Array.isArray(snapshot.inputs)) {
|
|
122
257
|
throwInvalidSessionSnapshot();
|
|
123
258
|
}
|
|
124
|
-
for (const session of snapshot.sessions)
|
|
125
|
-
validateSessionRecord(session);
|
|
126
|
-
for (const message of snapshot.messages)
|
|
127
|
-
validateSessionMessage(message);
|
|
128
|
-
for (const input of snapshot.inputs)
|
|
129
|
-
validateSessionInput(input);
|
|
130
259
|
}
|
|
131
260
|
const sessions = new Map();
|
|
132
261
|
const messages = new Map();
|
|
133
262
|
const inputs = new Map();
|
|
134
|
-
for (const session of snapshot?.sessions ?? []) {
|
|
135
|
-
sessions.set(session.id, session);
|
|
136
|
-
}
|
|
137
263
|
for (const message of snapshot?.messages ?? []) {
|
|
138
|
-
const
|
|
139
|
-
bucket.
|
|
140
|
-
|
|
264
|
+
const normalized = normalizeSessionMessage(message);
|
|
265
|
+
const bucket = messages.get(normalized.sessionId) ?? [];
|
|
266
|
+
bucket.push(normalized);
|
|
267
|
+
messages.set(normalized.sessionId, bucket);
|
|
141
268
|
}
|
|
142
269
|
for (const input of snapshot?.inputs ?? []) {
|
|
143
|
-
const
|
|
144
|
-
bucket.
|
|
145
|
-
|
|
270
|
+
const normalized = normalizeSessionInput(input);
|
|
271
|
+
const bucket = inputs.get(normalized.sessionId) ?? [];
|
|
272
|
+
bucket.push(normalized);
|
|
273
|
+
inputs.set(normalized.sessionId, bucket);
|
|
146
274
|
}
|
|
147
275
|
for (const [sessionId, bucket] of messages.entries()) {
|
|
148
276
|
messages.set(sessionId, sortMessages(bucket));
|
|
@@ -150,6 +278,12 @@ export function loadSessionBrokerState(snapshot) {
|
|
|
150
278
|
for (const [sessionId, bucket] of inputs.entries()) {
|
|
151
279
|
inputs.set(sessionId, sortInputs(bucket));
|
|
152
280
|
}
|
|
281
|
+
for (const session of snapshot?.sessions ?? []) {
|
|
282
|
+
if (!isRecord(session) || typeof session.id !== 'string') {
|
|
283
|
+
throwInvalidSessionSnapshot();
|
|
284
|
+
}
|
|
285
|
+
sessions.set(session.id, normalizeSessionRecord(session, messages.get(session.id) ?? [], inputs.get(session.id) ?? []));
|
|
286
|
+
}
|
|
153
287
|
return { sessions, messages, inputs };
|
|
154
288
|
}
|
|
155
289
|
export function createSessionBrokerSnapshot(state, maxPersistedMessages) {
|
|
@@ -11,6 +11,7 @@ import type { RemoteSupervisor } from '../remote/supervisor.js';
|
|
|
11
11
|
import type { ProviderRegistry } from '../../providers/registry.js';
|
|
12
12
|
import type { RuntimeStore } from '../store/index.js';
|
|
13
13
|
import type { RuntimeEventBus, RuntimeEventDomain } from '../events/index.js';
|
|
14
|
+
import type { ProviderAccountSnapshot } from '../provider-accounts/registry.js';
|
|
14
15
|
import type { UserAuthManager } from '../../security/user-auth.js';
|
|
15
16
|
import { type RecoveryFileInfo } from '../session-persistence.js';
|
|
16
17
|
import { type ManagedWorktreeMeta, type WorktreeOwnershipSummary } from '../worktree/registry.js';
|
|
@@ -100,7 +101,7 @@ export declare class IntegrationHelperService {
|
|
|
100
101
|
getDeliverySnapshot(): Record<string, unknown>;
|
|
101
102
|
getRemoteSnapshot(): Record<string, unknown>;
|
|
102
103
|
getHealthSnapshot(): Record<string, unknown>;
|
|
103
|
-
getAccountsSnapshot(): Promise<
|
|
104
|
+
getAccountsSnapshot(): Promise<ProviderAccountSnapshot>;
|
|
104
105
|
getSettingsSnapshot(): SettingsSnapshot;
|
|
105
106
|
getSecuritySettingsReport(): readonly SecuritySettingReport[];
|
|
106
107
|
getLocalAuthSnapshot(): Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/integration/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD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AAO,CAAC;IAsB3C,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAe9C,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYnD,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiB9C,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAgF5C,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAqCtC,mBAAmB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAS7D,mBAAmB,IAAI,gBAAgB;IAkBvC,yBAAyB,IAAI,SAAS,qBAAqB,EAAE;IAI7D,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAa/C,qBAAqB,IAAI,kBAAkB;IAmB3C,mBAAmB,IAAI,gBAAgB;IAQvC,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAclD,UAAU,IAAI,aAAa,EAAE;IAkB7B,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO;IASvD,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,kBAAkB,EAAE,GAAG,QAAQ;CA0CtF"}
|
|
@@ -25,7 +25,7 @@ const EVENT_DOMAINS = [
|
|
|
25
25
|
function serializeEnvelope(envelope) {
|
|
26
26
|
return {
|
|
27
27
|
type: envelope.type,
|
|
28
|
-
|
|
28
|
+
ts: envelope.ts,
|
|
29
29
|
traceId: envelope.traceId,
|
|
30
30
|
sessionId: envelope.sessionId,
|
|
31
31
|
source: envelope.source,
|
|
@@ -269,20 +269,21 @@ export class IntegrationHelperService {
|
|
|
269
269
|
const contracts = remoteRegistry.listContracts();
|
|
270
270
|
const pools = remoteRegistry.listPools();
|
|
271
271
|
const artifacts = remoteRegistry.listArtifacts();
|
|
272
|
+
const acpLastError = [...state.acp.connections.values()].find((connection) => connection.lastError)?.lastError;
|
|
272
273
|
return {
|
|
273
274
|
daemon: {
|
|
274
275
|
transportState: state.daemon.transportState,
|
|
275
276
|
isRunning: state.daemon.isRunning,
|
|
276
277
|
reconnectAttempts: state.daemon.reconnectAttempts,
|
|
277
278
|
runningJobCount: state.daemon.runningJobCount,
|
|
278
|
-
lastError: state.daemon.lastError,
|
|
279
|
+
...(state.daemon.lastError ? { lastError: state.daemon.lastError } : {}),
|
|
279
280
|
},
|
|
280
281
|
acp: {
|
|
281
282
|
transportState: state.acp.managerTransportState,
|
|
282
283
|
activeConnectionIds: state.acp.activeConnectionIds,
|
|
283
284
|
totalSpawned: state.acp.totalSpawned,
|
|
284
285
|
totalFailed: state.acp.totalFailed,
|
|
285
|
-
lastError:
|
|
286
|
+
...(acpLastError ? { lastError: acpLastError } : {}),
|
|
286
287
|
},
|
|
287
288
|
registry: {
|
|
288
289
|
pools: pools.length,
|
|
@@ -301,15 +302,15 @@ export class IntegrationHelperService {
|
|
|
301
302
|
runnerId: contract.runnerId,
|
|
302
303
|
label: contract.label,
|
|
303
304
|
template: contract.template,
|
|
304
|
-
poolId: contract.poolId,
|
|
305
|
-
taskId: contract.taskId,
|
|
305
|
+
...(contract.poolId ? { poolId: contract.poolId } : {}),
|
|
306
|
+
...(contract.taskId ? { taskId: contract.taskId } : {}),
|
|
306
307
|
sourceTransport: contract.sourceTransport,
|
|
307
308
|
trustClass: contract.trustClass,
|
|
308
309
|
executionProtocol: contract.capabilityCeiling.executionProtocol,
|
|
309
310
|
reviewMode: contract.capabilityCeiling.reviewMode,
|
|
310
311
|
communicationLane: contract.capabilityCeiling.communicationLane,
|
|
311
312
|
transportState: contract.transport.state,
|
|
312
|
-
lastError: contract.transport.lastError,
|
|
313
|
+
...(contract.transport.lastError ? { lastError: contract.transport.lastError } : {}),
|
|
313
314
|
})),
|
|
314
315
|
artifactEntries: artifacts.map((artifact) => ({
|
|
315
316
|
id: artifact.id,
|
|
@@ -317,7 +318,7 @@ export class IntegrationHelperService {
|
|
|
317
318
|
createdAt: artifact.createdAt,
|
|
318
319
|
status: artifact.task.status,
|
|
319
320
|
summary: artifact.task.summary,
|
|
320
|
-
error: artifact.task.error,
|
|
321
|
+
...(artifact.task.error ? { error: artifact.task.error } : {}),
|
|
321
322
|
})),
|
|
322
323
|
},
|
|
323
324
|
supervisor: {
|
|
@@ -329,10 +330,15 @@ export class IntegrationHelperService {
|
|
|
329
330
|
label: entry.label,
|
|
330
331
|
transportState: entry.transportState,
|
|
331
332
|
heartbeat: entry.heartbeat.status,
|
|
332
|
-
taskId: entry.taskId,
|
|
333
|
+
...(entry.taskId ? { taskId: entry.taskId } : {}),
|
|
333
334
|
})),
|
|
334
335
|
},
|
|
335
|
-
distributed:
|
|
336
|
+
distributed: {
|
|
337
|
+
pairRequests: this.context.distributedRuntime.listPairRequests(100),
|
|
338
|
+
peers: this.context.distributedRuntime.listPeers(undefined, 500),
|
|
339
|
+
work: this.context.distributedRuntime.listWork(500),
|
|
340
|
+
audit: this.context.distributedRuntime.listAudit(100),
|
|
341
|
+
},
|
|
336
342
|
};
|
|
337
343
|
}
|
|
338
344
|
getHealthSnapshot() {
|
|
@@ -378,36 +384,12 @@ export class IntegrationHelperService {
|
|
|
378
384
|
};
|
|
379
385
|
}
|
|
380
386
|
async getAccountsSnapshot() {
|
|
381
|
-
|
|
387
|
+
return await buildProviderAccountSnapshot({
|
|
382
388
|
providerRegistry: this.context.providerRegistry,
|
|
383
389
|
serviceRegistry: this.context.serviceRegistry,
|
|
384
390
|
subscriptionManager: this.context.subscriptionManager,
|
|
385
391
|
secretsManager: this.context.secretsManager,
|
|
386
392
|
});
|
|
387
|
-
return {
|
|
388
|
-
capturedAt: snapshot.capturedAt,
|
|
389
|
-
configuredCount: snapshot.configuredCount,
|
|
390
|
-
issueCount: snapshot.issueCount,
|
|
391
|
-
providers: snapshot.providers.map((provider) => ({
|
|
392
|
-
providerId: provider.providerId,
|
|
393
|
-
active: provider.active,
|
|
394
|
-
activeRoute: provider.activeRoute,
|
|
395
|
-
preferredRoute: provider.preferredRoute,
|
|
396
|
-
authFreshness: provider.authFreshness,
|
|
397
|
-
availableRoutes: provider.availableRoutes,
|
|
398
|
-
modelCount: provider.modelCount,
|
|
399
|
-
configured: provider.configured,
|
|
400
|
-
oauthReady: provider.oauthReady,
|
|
401
|
-
pendingLogin: provider.pendingLogin,
|
|
402
|
-
expiresAt: provider.expiresAt,
|
|
403
|
-
fallbackRoute: provider.fallbackRoute,
|
|
404
|
-
fallbackRisk: provider.fallbackRisk,
|
|
405
|
-
activeRouteReason: provider.activeRouteReason,
|
|
406
|
-
issues: provider.issues,
|
|
407
|
-
recommendedActions: provider.recommendedActions,
|
|
408
|
-
usageWindows: provider.usageWindows,
|
|
409
|
-
})),
|
|
410
|
-
};
|
|
411
393
|
}
|
|
412
394
|
getSettingsSnapshot() {
|
|
413
395
|
if (!this.context.configManager) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distributed-runtime-store.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/remote/distributed-runtime-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAE7B,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AA8LxC,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,8BAA8B,EACrC,KAAK,EAAE;IACL,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IACrF,QAAQ,CAAC,cAAc,CAAC,EAAE,8BAA8B,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IACvF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,8BAA8B,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC;IAC3F,QAAQ,CAAC,cAAc,CAAC,EAAE,8BAA8B,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;CACxF,GACA,IAAI,CAKN;AAED,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBlG;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,8BAA8B,EACrC,KAAK,SAAM,GACV,6BAA6B,EAAE,CAGjC;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,8BAA8B,EACrC,IAAI,CAAC,EAAE,mBAAmB,EAC1B,KAAK,SAAM,GACV,qBAAqB,EAAE,CAKzB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,8BAA8B,EACrC,KAAK,SAAM,EACX,MAAM,CAAC,EAAE,MAAM,GACd,sBAAsB,EAAE,CAK1B;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,8BAA8B,EACrC,KAAK,SAAM,GACV,6BAA6B,EAAE,CAEjC;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"distributed-runtime-store.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/remote/distributed-runtime-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAE7B,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AA8LxC,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,8BAA8B,EACrC,KAAK,EAAE;IACL,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IACrF,QAAQ,CAAC,cAAc,CAAC,EAAE,8BAA8B,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IACvF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,8BAA8B,CAAC,kBAAkB,CAAC,GAAG,SAAS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BAAsB,GAAG,IAAI,CAAC,CAexC;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAQ1H;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,8BAA8B,EACrC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,GAC3C,IAAI,CAMN;AAED,wBAAsB,iCAAiC,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5G;AAED,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpG"}
|
|
@@ -233,32 +233,10 @@ export function listDistributedRuntimeAudit(state, limit = 100) {
|
|
|
233
233
|
export function getDistributedRuntimeSnapshot(state) {
|
|
234
234
|
expireDistributedPairRequests(state);
|
|
235
235
|
requeueDistributedExpiredClaims(state);
|
|
236
|
-
const peers = listDistributedRuntimePeers(state, undefined, 500);
|
|
237
|
-
const work = listDistributedRuntimeWork(state, 500);
|
|
238
236
|
return {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
pending: [...state.pairRequests.values()].filter((request) => request.status === 'pending').length,
|
|
243
|
-
approved: [...state.pairRequests.values()].filter((request) => request.status === 'approved').length,
|
|
244
|
-
entries: listDistributedRuntimePairRequests(state, 100),
|
|
245
|
-
},
|
|
246
|
-
peers: {
|
|
247
|
-
total: peers.length,
|
|
248
|
-
connected: peers.filter((peer) => peer.status === 'connected').length,
|
|
249
|
-
nodes: peers.filter((peer) => peer.kind === 'node').length,
|
|
250
|
-
devices: peers.filter((peer) => peer.kind === 'device').length,
|
|
251
|
-
entries: peers,
|
|
252
|
-
},
|
|
253
|
-
work: {
|
|
254
|
-
total: work.length,
|
|
255
|
-
queued: work.filter((item) => item.status === 'queued').length,
|
|
256
|
-
claimed: work.filter((item) => item.status === 'claimed').length,
|
|
257
|
-
completed: work.filter((item) => item.status === 'completed').length,
|
|
258
|
-
failed: work.filter((item) => item.status === 'failed').length,
|
|
259
|
-
cancelled: work.filter((item) => item.status === 'cancelled').length,
|
|
260
|
-
entries: work.slice(0, 100),
|
|
261
|
-
},
|
|
237
|
+
pairRequests: listDistributedRuntimePairRequests(state, 100),
|
|
238
|
+
peers: listDistributedRuntimePeers(state, undefined, 500),
|
|
239
|
+
work: listDistributedRuntimeWork(state, 500),
|
|
262
240
|
audit: listDistributedRuntimeAudit(state, 100),
|
|
263
241
|
};
|
|
264
242
|
}
|
package/dist/platform/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
let version = '0.33.
|
|
3
|
+
let version = '0.33.4';
|
|
4
4
|
try {
|
|
5
5
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', '..', 'package.json'), 'utf-8'));
|
|
6
6
|
version = pkg.version ?? version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-sdk",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.4",
|
|
4
4
|
"description": "TypeScript SDK for building GoodVibes operator, peer, web, mobile, and daemon-connected apps with typed contracts, auth, realtime events, and transport layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goodvibes",
|
|
@@ -441,14 +441,14 @@
|
|
|
441
441
|
"sideEffects": false,
|
|
442
442
|
"type": "module",
|
|
443
443
|
"dependencies": {
|
|
444
|
-
"@pellux/goodvibes-contracts": "0.33.
|
|
445
|
-
"@pellux/goodvibes-daemon-sdk": "0.33.
|
|
446
|
-
"@pellux/goodvibes-errors": "0.33.
|
|
447
|
-
"@pellux/goodvibes-operator-sdk": "0.33.
|
|
448
|
-
"@pellux/goodvibes-peer-sdk": "0.33.
|
|
449
|
-
"@pellux/goodvibes-transport-core": "0.33.
|
|
450
|
-
"@pellux/goodvibes-transport-http": "0.33.
|
|
451
|
-
"@pellux/goodvibes-transport-realtime": "0.33.
|
|
444
|
+
"@pellux/goodvibes-contracts": "0.33.4",
|
|
445
|
+
"@pellux/goodvibes-daemon-sdk": "0.33.4",
|
|
446
|
+
"@pellux/goodvibes-errors": "0.33.4",
|
|
447
|
+
"@pellux/goodvibes-operator-sdk": "0.33.4",
|
|
448
|
+
"@pellux/goodvibes-peer-sdk": "0.33.4",
|
|
449
|
+
"@pellux/goodvibes-transport-core": "0.33.4",
|
|
450
|
+
"@pellux/goodvibes-transport-http": "0.33.4",
|
|
451
|
+
"@pellux/goodvibes-transport-realtime": "0.33.4"
|
|
452
452
|
},
|
|
453
453
|
"optionalDependencies": {
|
|
454
454
|
"@agentclientprotocol/sdk": "^0.21.0",
|