@adea-ai/sdk 4.1.0 → 4.3.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/client.js CHANGED
@@ -7,6 +7,7 @@ export class ControlPlaneClientError extends Error {
7
7
  retryable;
8
8
  status;
9
9
  reasonCode;
10
+ retryAfterMs;
10
11
  constructor(input) {
11
12
  super(input.message);
12
13
  this.name = 'ControlPlaneClientError';
@@ -16,6 +17,7 @@ export class ControlPlaneClientError extends Error {
16
17
  this.retryable = input.retryable;
17
18
  this.status = input.status;
18
19
  this.reasonCode = input.reasonCode;
20
+ this.retryAfterMs = input.retryAfterMs;
19
21
  }
20
22
  toJSON() {
21
23
  return {
@@ -27,6 +29,7 @@ export class ControlPlaneClientError extends Error {
27
29
  retryable: this.retryable,
28
30
  status: this.status,
29
31
  ...(this.reasonCode === undefined ? {} : { reasonCode: this.reasonCode }),
32
+ ...(this.retryAfterMs === undefined ? {} : { retryAfterMs: this.retryAfterMs }),
30
33
  };
31
34
  }
32
35
  }
@@ -44,221 +47,217 @@ export class ControlPlaneClient {
44
47
  throw new Error('Control Plane client timeout must be a positive integer');
45
48
  }
46
49
  }
47
- createModelConnection(input) {
48
- return this.#request(ControlApiOperations.createModelConnection, input);
50
+ createModelConnection(input, options) {
51
+ return this.#request(ControlApiOperations.createModelConnection, input, options);
49
52
  }
50
- revokeModelConnection(input) {
51
- return this.#request(ControlApiOperations.revokeModelConnection, input);
53
+ revokeModelConnection(input, options) {
54
+ return this.#request(ControlApiOperations.revokeModelConnection, input, options);
52
55
  }
53
- listModelConnections(input) {
54
- return this.#request(ControlApiOperations.listModelConnections, input);
56
+ listModelConnections(input, options) {
57
+ return this.#request(ControlApiOperations.listModelConnections, input, options);
55
58
  }
56
- getModelDefaults(input) {
57
- return this.#request(ControlApiOperations.getModelDefaults, input);
59
+ getModelDefaults(input, options) {
60
+ return this.#request(ControlApiOperations.getModelDefaults, input, options);
58
61
  }
59
- setModelDefaults(input) {
60
- return this.#request(ControlApiOperations.setModelDefaults, input);
62
+ setModelDefaults(input, options) {
63
+ return this.#request(ControlApiOperations.setModelDefaults, input, options);
61
64
  }
62
- resolveModelSelection(input) {
63
- return this.#request(ControlApiOperations.resolveModelSelection, input);
65
+ resolveModelSelection(input, options) {
66
+ return this.#request(ControlApiOperations.resolveModelSelection, input, options);
64
67
  }
65
- getModelSelectionFunding(input) {
66
- return this.#request(ControlApiOperations.getModelSelectionFunding, input);
68
+ getModelSelectionFunding(input, options) {
69
+ return this.#request(ControlApiOperations.getModelSelectionFunding, input, options);
67
70
  }
68
- getPiDurableLeadPublication(input) {
69
- return this.#request(ControlApiOperations.getPiDurableLeadPublication, input);
71
+ getPiDurableLeadPublication(input, options) {
72
+ return this.#request(ControlApiOperations.getPiDurableLeadPublication, input, options);
70
73
  }
71
- getPiDurableChildPublication(input) {
72
- return this.#request(ControlApiOperations.getPiDurableChildPublication, input);
74
+ getPiDurableChildPublication(input, options) {
75
+ return this.#request(ControlApiOperations.getPiDurableChildPublication, input, options);
73
76
  }
74
- createCredential(input) {
75
- return this.#request(ControlApiOperations.createCredential, input);
77
+ createCredential(input, options) {
78
+ return this.#request(ControlApiOperations.createCredential, input, options);
76
79
  }
77
- rotateCredential(input) {
78
- return this.#request(ControlApiOperations.rotateCredential, input);
80
+ rotateCredential(input, options) {
81
+ return this.#request(ControlApiOperations.rotateCredential, input, options);
79
82
  }
80
- revokeCredential(input) {
81
- return this.#request(ControlApiOperations.revokeCredential, input);
83
+ revokeCredential(input, options) {
84
+ return this.#request(ControlApiOperations.revokeCredential, input, options);
82
85
  }
83
- getCredential(input) {
84
- return this.#request(ControlApiOperations.getCredential, input);
86
+ getCredential(input, options) {
87
+ return this.#request(ControlApiOperations.getCredential, input, options);
85
88
  }
86
- listCredentials(input) {
87
- return this.#request(ControlApiOperations.listCredentials, input);
89
+ listCredentials(input, options) {
90
+ return this.#request(ControlApiOperations.listCredentials, input, options);
88
91
  }
89
- listWorkspaceSkills(input) {
90
- return this.#request(ControlApiOperations.listWorkspaceSkills, input);
92
+ listWorkspaceSkills(input, options) {
93
+ return this.#request(ControlApiOperations.listWorkspaceSkills, input, options);
91
94
  }
92
- getWorkspaceSkill(input) {
93
- return this.#request(ControlApiOperations.getWorkspaceSkill, input);
95
+ getWorkspaceSkill(input, options) {
96
+ return this.#request(ControlApiOperations.getWorkspaceSkill, input, options);
94
97
  }
95
- publishWorkspaceSkill(input) {
96
- return this.#request(ControlApiOperations.publishWorkspaceSkill, input);
98
+ publishWorkspaceSkill(input, options) {
99
+ return this.#request(ControlApiOperations.publishWorkspaceSkill, input, options);
97
100
  }
98
- deprecateWorkspaceSkill(input) {
99
- return this.#request(ControlApiOperations.deprecateWorkspaceSkill, input);
101
+ deprecateWorkspaceSkill(input, options) {
102
+ return this.#request(ControlApiOperations.deprecateWorkspaceSkill, input, options);
100
103
  }
101
- revokeWorkspaceSkill(input) {
102
- return this.#request(ControlApiOperations.revokeWorkspaceSkill, input);
104
+ revokeWorkspaceSkill(input, options) {
105
+ return this.#request(ControlApiOperations.revokeWorkspaceSkill, input, options);
103
106
  }
104
- listWorkspaceProfiles(input) {
105
- return this.#request(ControlApiOperations.listWorkspaceProfiles, input);
107
+ listWorkspaceProfiles(input, options) {
108
+ return this.#request(ControlApiOperations.listWorkspaceProfiles, input, options);
106
109
  }
107
- getWorkspaceProfile(input) {
108
- return this.#request(ControlApiOperations.getWorkspaceProfile, input);
110
+ getWorkspaceProfile(input, options) {
111
+ return this.#request(ControlApiOperations.getWorkspaceProfile, input, options);
109
112
  }
110
- publishWorkspaceProfile(input) {
111
- return this.#request(ControlApiOperations.publishWorkspaceProfile, input);
113
+ publishWorkspaceProfile(input, options) {
114
+ return this.#request(ControlApiOperations.publishWorkspaceProfile, input, options);
112
115
  }
113
- deprecateWorkspaceProfile(input) {
114
- return this.#request(ControlApiOperations.deprecateWorkspaceProfile, input);
116
+ deprecateWorkspaceProfile(input, options) {
117
+ return this.#request(ControlApiOperations.deprecateWorkspaceProfile, input, options);
115
118
  }
116
- revokeWorkspaceProfile(input) {
117
- return this.#request(ControlApiOperations.revokeWorkspaceProfile, input);
119
+ revokeWorkspaceProfile(input, options) {
120
+ return this.#request(ControlApiOperations.revokeWorkspaceProfile, input, options);
118
121
  }
119
- verifyAuthentication(input) {
120
- return this.#request(ControlApiOperations.verifyAuthentication, input);
122
+ verifyAuthentication(input, options) {
123
+ return this.#request(ControlApiOperations.verifyAuthentication, input, options);
121
124
  }
122
- resolveDecision(input) {
123
- return this.#request(ControlApiOperations.resolveDecision, input);
125
+ resolveDecision(input, options) {
126
+ return this.#request(ControlApiOperations.resolveDecision, input, options);
124
127
  }
125
- resolveProfile(input) {
126
- return this.#request(ControlApiOperations.resolveProfile, input);
128
+ resolveProfile(input, options) {
129
+ return this.#request(ControlApiOperations.resolveProfile, input, options);
127
130
  }
128
- resolveProjectState(input) {
129
- return this.#request(ControlApiOperations.resolveProjectState, input);
131
+ resolveProjectState(input, options) {
132
+ return this.#request(ControlApiOperations.resolveProjectState, input, options);
130
133
  }
131
- initializeProjectState(input) {
132
- return this.#request(ControlApiOperations.initializeProjectState, input);
134
+ initializeProjectState(input, options) {
135
+ return this.#request(ControlApiOperations.initializeProjectState, input, options);
133
136
  }
134
- resolveContextPackage(input) {
135
- return this.#request(ControlApiOperations.resolveContextPackage, input);
137
+ resolveContextPackage(input, options) {
138
+ return this.#request(ControlApiOperations.resolveContextPackage, input, options);
136
139
  }
137
- listRuntimes(input) {
138
- return this.#request(ControlApiOperations.listRuntimes, input);
140
+ listRuntimes(input, options) {
141
+ return this.#request(ControlApiOperations.listRuntimes, input, options);
139
142
  }
140
- listRuntimeConnections(input) {
141
- return this.#request(ControlApiOperations.listRuntimeConnections, input);
143
+ listRuntimeConnections(input, options) {
144
+ return this.#request(ControlApiOperations.listRuntimeConnections, input, options);
142
145
  }
143
- getRuntimeConnection(input) {
144
- return this.#request(ControlApiOperations.getRuntimeConnection, input);
146
+ getRuntimeConnection(input, options) {
147
+ return this.#request(ControlApiOperations.getRuntimeConnection, input, options);
145
148
  }
146
- listExternalSessions(input) {
147
- return this.#request(ControlApiOperations.listExternalSessions, input);
149
+ listExternalSessions(input, options) {
150
+ return this.#request(ControlApiOperations.listExternalSessions, input, options);
148
151
  }
149
- getExternalSession(input) {
150
- return this.#request(ControlApiOperations.getExternalSession, input);
152
+ getExternalSession(input, options) {
153
+ return this.#request(ControlApiOperations.getExternalSession, input, options);
151
154
  }
152
- uploadDeviceSyncObject(input) {
153
- return this.#request(ControlApiOperations.uploadDeviceSyncObject, input);
155
+ uploadDeviceSyncObject(input, options) {
156
+ return this.#request(ControlApiOperations.uploadDeviceSyncObject, input, options);
154
157
  }
155
- commitDeviceSyncObject(input) {
156
- return this.#request(ControlApiOperations.commitDeviceSyncObject, input);
158
+ commitDeviceSyncObject(input, options) {
159
+ return this.#request(ControlApiOperations.commitDeviceSyncObject, input, options);
157
160
  }
158
- downloadDeviceSyncObjects(input) {
159
- return this.#request(ControlApiOperations.downloadDeviceSyncObjects, input);
161
+ downloadDeviceSyncObjects(input, options) {
162
+ return this.#request(ControlApiOperations.downloadDeviceSyncObjects, input, options);
160
163
  }
161
- releaseDeviceSyncObjects(input) {
162
- return this.#request(ControlApiOperations.releaseDeviceSyncObjects, input);
164
+ releaseDeviceSyncObjects(input, options) {
165
+ return this.#request(ControlApiOperations.releaseDeviceSyncObjects, input, options);
163
166
  }
164
- appendDeviceSyncLog(input) {
165
- return this.#request(ControlApiOperations.appendDeviceSyncLog, input);
167
+ appendDeviceSyncLog(input, options) {
168
+ return this.#request(ControlApiOperations.appendDeviceSyncLog, input, options);
166
169
  }
167
- readDeviceSyncLog(input) {
168
- return this.#request(ControlApiOperations.readDeviceSyncLog, input);
170
+ readDeviceSyncLog(input, options) {
171
+ return this.#request(ControlApiOperations.readDeviceSyncLog, input, options);
169
172
  }
170
- readDeviceSyncUsage(input) {
171
- return this.#request(ControlApiOperations.readDeviceSyncUsage, input);
173
+ readDeviceSyncUsage(input, options) {
174
+ return this.#request(ControlApiOperations.readDeviceSyncUsage, input, options);
172
175
  }
173
- validateExecutionRequest(input) {
174
- return this.#request(ControlApiOperations.validateExecutionRequest, input);
176
+ readDeviceSyncCheckpoint(input, options) {
177
+ return this.#request(ControlApiOperations.readDeviceSyncCheckpoint, input, options);
175
178
  }
176
- acceptExecution(input) {
177
- return this.#request(ControlApiOperations.acceptExecution, input);
179
+ registerDeviceSyncCheckpoint(input, options) {
180
+ return this.#request(ControlApiOperations.registerDeviceSyncCheckpoint, input, options);
178
181
  }
179
- respondToInteraction(input) {
180
- return this.#request(ControlApiOperations.respondToInteraction, input);
182
+ acknowledgeDeviceSyncLog(input, options) {
183
+ return this.#request(ControlApiOperations.acknowledgeDeviceSyncLog, input, options);
181
184
  }
182
- cancelExecution(input) {
183
- return this.#request(ControlApiOperations.cancelExecution, input);
185
+ validateExecutionRequest(input, options) {
186
+ return this.#request(ControlApiOperations.validateExecutionRequest, input, options);
184
187
  }
185
- marketplaceCatalog(input) {
186
- return this.#request(ControlApiOperations.marketplaceCatalog, input);
188
+ acceptExecution(input, options) {
189
+ return this.#request(ControlApiOperations.acceptExecution, input, options);
187
190
  }
188
- marketplaceInstall(input) {
189
- return this.#request(ControlApiOperations.marketplaceInstall, input);
191
+ respondToInteraction(input, options) {
192
+ return this.#request(ControlApiOperations.respondToInteraction, input, options);
190
193
  }
191
- marketplaceInstallPlan(input) {
192
- return this.#request(ControlApiOperations.marketplaceInstallPlan, input);
194
+ cancelExecution(input, options) {
195
+ return this.#request(ControlApiOperations.cancelExecution, input, options);
193
196
  }
194
- marketplaceInstallationGet(input) {
195
- return this.#request(ControlApiOperations.marketplaceInstallationGet, input);
197
+ marketplaceCatalog(input, options) {
198
+ return this.#request(ControlApiOperations.marketplaceCatalog, input, options);
196
199
  }
197
- marketplaceInstallationUninstall(input) {
198
- return this.#request(ControlApiOperations.marketplaceInstallationUninstall, input);
200
+ marketplaceInstall(input, options) {
201
+ return this.#request(ControlApiOperations.marketplaceInstall, input, options);
199
202
  }
200
- async preparePiDurableLead(input) {
201
- const request = ControlApiOperations.preparePiDurableLead.requestSchema.parse(input);
202
- const response = await this.#request(ControlApiOperations.preparePiDurableLead, request);
203
- if (response.data.intentId !== request.payload.intentId ||
204
- response.data.funding.workspaceId !== request.workspaceId) {
205
- throw invalidResponse(request.requestId, 200);
206
- }
207
- return response;
203
+ marketplaceInstallPlan(input, options) {
204
+ return this.#request(ControlApiOperations.marketplaceInstallPlan, input, options);
208
205
  }
209
- dispatchPiDurableLead(input) {
210
- return this.#request(ControlApiOperations.dispatchPiDurableLead, input);
206
+ marketplaceInstallationList(input, options) {
207
+ return this.#request(ControlApiOperations.marketplaceInstallationList, input, options);
211
208
  }
212
- getPiDurableLeadStatus(input) {
213
- return this.#request(ControlApiOperations.getPiDurableLeadStatus, input);
209
+ marketplaceInstallationGet(input, options) {
210
+ return this.#request(ControlApiOperations.marketplaceInstallationGet, input, options);
214
211
  }
215
- async lookupPiDurableLead(input) {
216
- const request = ControlApiOperations.lookupPiDurableLead.requestSchema.parse(input);
217
- const response = await this.#request(ControlApiOperations.lookupPiDurableLead, request);
218
- if (response.data.intentId !== request.parameters.intentId ||
219
- response.data.workspaceId !== request.workspaceId) {
220
- throw invalidResponse(request.requestId, 200);
221
- }
222
- return response;
212
+ marketplaceInstallationUninstall(input, options) {
213
+ return this.#request(ControlApiOperations.marketplaceInstallationUninstall, input, options);
223
214
  }
224
- getPiDurableLeadProgress(input) {
225
- return this.#request(ControlApiOperations.getPiDurableLeadProgress, input);
215
+ preparePiDurableLead(input, options) {
216
+ return this.#request(ControlApiOperations.preparePiDurableLead, input, options, (request, response) => response.data.intentId === request.payload.intentId &&
217
+ response.data.funding.workspaceId === request.workspaceId);
226
218
  }
227
- async getPiDurableLeadChildren(input) {
228
- const request = ControlApiOperations.getPiDurableLeadChildren.requestSchema.parse(input);
229
- const response = await this.#request(ControlApiOperations.getPiDurableLeadChildren, request);
230
- if (response.data.dispatchId !== request.parameters.dispatchId) {
231
- throw invalidResponse(request.requestId, 200);
232
- }
233
- return response;
219
+ dispatchPiDurableLead(input, options) {
220
+ return this.#request(ControlApiOperations.dispatchPiDurableLead, input, options);
221
+ }
222
+ getPiDurableLeadStatus(input, options) {
223
+ return this.#request(ControlApiOperations.getPiDurableLeadStatus, input, options);
234
224
  }
235
- async getPiDurableLeadChildTarget(input) {
236
- const request = ControlApiOperations.getPiDurableLeadChildTarget.requestSchema.parse(input);
237
- const response = await this.#request(ControlApiOperations.getPiDurableLeadChildTarget, request);
238
- if (response.data.dispatchId !== request.parameters.dispatchId ||
239
- response.data.child.delegationId !== request.parameters.delegationId)
240
- throw invalidResponse(request.requestId, 200);
241
- return response;
225
+ lookupPiDurableLead(input, options) {
226
+ return this.#request(ControlApiOperations.lookupPiDurableLead, input, options, (request, response) => response.data.intentId === request.parameters.intentId &&
227
+ response.data.workspaceId === request.workspaceId);
242
228
  }
243
- cancelPiDurableLead(input) {
244
- return this.#request(ControlApiOperations.cancelPiDurableLead, input);
229
+ getPiDurableLeadProgress(input, options) {
230
+ return this.#request(ControlApiOperations.getPiDurableLeadProgress, input, options);
245
231
  }
246
- answerPiDurableLeadQuestion(input) {
247
- return this.#request(ControlApiOperations.answerPiDurableLeadQuestion, input);
232
+ getPiDurableLeadChildren(input, options) {
233
+ return this.#request(ControlApiOperations.getPiDurableLeadChildren, input, options, (request, response) => response.data.dispatchId === request.parameters.dispatchId);
248
234
  }
249
- answerPiDurableLeadApproval(input) {
250
- return this.#request(ControlApiOperations.answerPiDurableLeadApproval, input);
235
+ getPiDurableLeadChildTarget(input, options) {
236
+ return this.#request(ControlApiOperations.getPiDurableLeadChildTarget, input, options, (request, response) => response.data.dispatchId === request.parameters.dispatchId &&
237
+ response.data.child.delegationId === request.parameters.delegationId);
251
238
  }
252
- cancelPiDurableLeadChild(input) {
253
- return this.#request(ControlApiOperations.cancelPiDurableLeadChild, input);
239
+ cancelPiDurableLead(input, options) {
240
+ return this.#request(ControlApiOperations.cancelPiDurableLead, input, options);
254
241
  }
255
- messagePiDurableLeadChild(input) {
256
- return this.#request(ControlApiOperations.messagePiDurableLeadChild, input);
242
+ answerPiDurableLeadQuestion(input, options) {
243
+ return this.#request(ControlApiOperations.answerPiDurableLeadQuestion, input, options);
257
244
  }
258
- async #request(operation, input) {
245
+ answerPiDurableLeadApproval(input, options) {
246
+ return this.#request(ControlApiOperations.answerPiDurableLeadApproval, input, options);
247
+ }
248
+ cancelPiDurableLeadChild(input, options) {
249
+ return this.#request(ControlApiOperations.cancelPiDurableLeadChild, input, options);
250
+ }
251
+ messagePiDurableLeadChild(input, options) {
252
+ return this.#request(ControlApiOperations.messagePiDurableLeadChild, input, options);
253
+ }
254
+ async #request(operation, input, options = {}, answers) {
259
255
  const request = operation.requestSchema.parse(input);
256
+ options.signal?.throwIfAborted();
260
257
  const credential = await resolveCredential(this.#credential);
261
- const signal = AbortSignal.timeout(this.#timeoutMs);
258
+ const timeout = AbortSignal.timeout(this.#timeoutMs);
259
+ const signal = options.signal === undefined ? timeout : AbortSignal.any([options.signal, timeout]);
260
+ signal.throwIfAborted();
262
261
  const response = await this.#fetch(new URL(operation.path.slice(1), this.#baseUrl), {
263
262
  method: operation.method,
264
263
  headers: {
@@ -276,6 +275,8 @@ export class ControlPlaneClient {
276
275
  if (!response.ok) {
277
276
  const parsedError = ErrorResponseEnvelopeSchema.safeParse(body);
278
277
  if (!parsedError.success) {
278
+ if (TRANSIENT_STATUSES.has(response.status))
279
+ throw unavailable(request.requestId, response.status, response.headers);
279
280
  throw invalidResponse(request.requestId, response.status);
280
281
  }
281
282
  assertCompatibleVersion(parsedError.data.contractVersion, request.requestId, response.status);
@@ -284,9 +285,10 @@ export class ControlPlaneClient {
284
285
  errorClass: parsedError.data.error.class,
285
286
  message: parsedError.data.error.message,
286
287
  requestId: parsedError.data.requestId,
287
- retryable: parsedError.data.error.retryable,
288
+ retryable: parsedError.data.error.retryable || response.status === 429,
288
289
  status: response.status,
289
290
  reasonCode: readinessReason(parsedError.data.error.details),
291
+ retryAfterMs: parseRetryAfterMs(response.headers.get('retry-after')),
290
292
  });
291
293
  }
292
294
  const version = ContractVersionSchema.safeParse(versionFrom(body));
@@ -294,8 +296,9 @@ export class ControlPlaneClient {
294
296
  throw invalidResponse(request.requestId, response.status);
295
297
  assertCompatibleVersion(version.data, request.requestId, response.status);
296
298
  const parsedResponse = operation.responseSchema.safeParse(body);
297
- if (!parsedResponse.success)
299
+ if (!parsedResponse.success || (answers && !answers(request, parsedResponse.data))) {
298
300
  throw invalidResponse(request.requestId, response.status);
301
+ }
299
302
  return parsedResponse.data;
300
303
  }
301
304
  }
@@ -317,27 +320,34 @@ async function resolveCredential(provider) {
317
320
  throw new Error('Control Plane service credential is required');
318
321
  return credential;
319
322
  }
323
+ const TRANSIENT_STATUSES = new Set([429, 502, 503, 504]);
320
324
  async function parseResponseBody(response, requestId, signal) {
321
325
  try {
322
326
  return await response.json();
323
327
  }
324
328
  catch {
325
329
  signal.throwIfAborted();
330
+ if (!response.ok)
331
+ return undefined;
326
332
  throw invalidResponse(requestId, response.status);
327
333
  }
328
334
  }
335
+ export function parseRetryAfterMs(header, now = Date.now()) {
336
+ if (header === null)
337
+ return undefined;
338
+ const value = header.trim();
339
+ if (/^\d{1,9}$/.test(value))
340
+ return Number(value) * 1000;
341
+ const date = /^[A-Z][a-z]{2}, /.test(value) ? Date.parse(value) : Number.NaN;
342
+ return Number.isNaN(date) ? undefined : Math.max(0, date - now);
343
+ }
329
344
  function versionFrom(body) {
330
345
  if (typeof body !== 'object' || body === null)
331
346
  return undefined;
332
347
  return Reflect.get(body, 'contractVersion');
333
348
  }
334
- function assertCompatibleVersion(version, requestId, status) {
335
- const producer = ContractVersionSchema.safeParse(version);
336
- if (!producer.success ||
337
- !assessContractCompatibility({
338
- consumer: PublicContractManifest.current,
339
- producer: producer.data,
340
- }).compatible) {
349
+ function assertCompatibleVersion(producer, requestId, status) {
350
+ if (!assessContractCompatibility({ consumer: PublicContractManifest.current, producer }).compatible) {
341
351
  throw new ControlPlaneClientError({
342
352
  code: 'INCOMPATIBLE_CONTRACT_VERSION',
343
353
  errorClass: 'validation',
@@ -352,6 +362,17 @@ function readinessReason(details) {
352
362
  const parsed = ModelReadinessReasonSchema.safeParse(details?.['reasonCode']);
353
363
  return parsed.success && parsed.data !== 'READY' ? parsed.data : undefined;
354
364
  }
365
+ function unavailable(requestId, status, headers) {
366
+ return new ControlPlaneClientError({
367
+ code: 'CONTROL_PLANE_UNAVAILABLE',
368
+ errorClass: 'runtime_unavailable',
369
+ message: 'Control Plane is temporarily unavailable',
370
+ requestId,
371
+ retryable: true,
372
+ status,
373
+ retryAfterMs: parseRetryAfterMs(headers.get('retry-after')),
374
+ });
375
+ }
355
376
  function invalidResponse(requestId, status) {
356
377
  return new ControlPlaneClientError({
357
378
  code: 'INVALID_CONTROL_PLANE_RESPONSE',
@@ -1,6 +1,6 @@
1
1
  import { PiDurableLeadPrepareRequestSchema, PiDurableLeadPrepareResponseSchema, PiDurableLeadLookupRequestSchema, PiDurableLeadLookupResponseSchema, PiDurableLeadDispatchRequestSchema, PiDurableLeadDispatchResponseSchema, PiDurableLeadStatusRequestSchema, PiDurableLeadStatusResponseSchema, PiDurableLeadChildrenRequestSchema, PiDurableLeadChildrenResponseSchema, PiDurableLeadChildTargetRequestSchema, PiDurableLeadChildTargetResponseSchema, PiDurableLeadProgressRequestSchema, PiDurableLeadEventsRequestSchema, PiDurableLeadEventsResponseSchema, PiDurableSessionsRequestSchema, PiDurableSessionsResponseSchema, PiDurableSessionEventsRequestSchema, PiDurableSessionEventsResponseSchema, PiDurableLeadProgressResponseSchema, PiDurableLeadCancelRequestSchema, PiDurableLeadChildCancelRequestSchema, PiDurableLeadQuestionAnswerRequestSchema, PiDurableLeadApprovalAnswerRequestSchema, PiDurableLeadApprovalAnswerResponseSchema, PiDurableLeadQuestionAnswerResponseSchema, PiDurableLeadChildCancelResponseSchema, PiDurableLeadChildMessageRequestSchema, PiDurableLeadChildMessageResponseSchema, PiDurableLeadCancelResponseSchema } from '@adea-ai/runtime-sdk';
2
2
  import { PiLeadPublicationRequestSchema, PiLeadPublicationResponseSchema, PiChildPublicationRequestSchema, PiChildPublicationResponseSchema, ModelSelectionFundingRequestSchema, ModelSelectionFundingResponseSchema, ModelConnectionCreateRequestSchema, ModelConnectionListRequestSchema, ModelConnectionListResponseSchema, ModelConnectionResponseSchema, ModelConnectionRevokeRequestSchema, ModelDefaultsGetRequestSchema, ModelDefaultsResponseSchema, ModelDefaultsSetRequestSchema, ModelSelectionResolveRequestSchema, ModelSelectionResponseSchema } from '@adea-ai/contracts';
3
- import { CredentialCreateRequestSchema, CredentialGetRequestSchema, CredentialListRequestSchema, CredentialListResponseSchema, CredentialResponseSchema, CredentialRevokeRequestSchema, CredentialRotateRequestSchema, ExecutionCancellationCommandSchema, ExecutionCancellationCommandResultSchema, InteractionResponseCommandSchema, InteractionResponseCommandResultSchema, ContextPackageResolutionRequestSchema, ContextPackageResolutionResponseSchema, ExecutionAcceptanceRequestSchema, ExecutionAcceptanceResponseSchema, ExecutionRequestValidationRequestSchema, ExecutionRequestValidationResponseSchema, DecisionResolveRequestSchema, DecisionResolveResponseSchema, ProfileResolutionRequestSchema, ProfileResolutionResponseSchema, ProjectStateInitializationRequestSchema, ProjectStateInitializationResponseSchema, ProjectStateResolutionRequestSchema, ProjectStateResolutionResponseSchema, RuntimeListRequestSchema, RuntimeListResponseSchema, ServiceAuthenticationRequestSchema, ServiceAuthenticationResponseSchema, ExternalSessionGetRequestSchema, ExternalSessionGetResponseSchema, ExternalSessionListRequestSchema, ExternalSessionListResponseSchema, RuntimeConnectionGetRequestSchema, RuntimeConnectionGetResponseSchema, RuntimeConnectionListRequestSchema, RuntimeConnectionListResponseSchema, MarketplaceCatalogRequestSchema, MarketplaceCatalogResponseSchema, MarketplaceInstallPlanRequestSchema, MarketplaceInstallPlanResponseSchema, MarketplaceInstallRequestSchema, MarketplaceInstallResponseSchema, MarketplaceInstallationGetRequestSchema, MarketplaceInstallationGetResponseSchema, MarketplaceInstallationUninstallRequestSchema, MarketplaceInstallationUninstallResponseSchema, WorkspaceAgentProfileDeprecationRequestSchema, WorkspaceAgentProfileGetRequestSchema, WorkspaceAgentProfileGetResponseSchema, WorkspaceAgentProfileLifecycleResponseSchema, WorkspaceAgentProfileListRequestSchema, WorkspaceAgentProfileListResponseSchema, WorkspaceAgentProfilePublishRequestSchema, WorkspaceAgentProfilePublishResponseSchema, WorkspaceAgentProfileRevocationRequestSchema, WorkspaceSkillDeprecationRequestSchema, WorkspaceSkillGetRequestSchema, WorkspaceSkillGetResponseSchema, WorkspaceSkillLifecycleResponseSchema, WorkspaceSkillListRequestSchema, WorkspaceSkillListResponseSchema, WorkspaceSkillPublishRequestSchema, WorkspaceSkillPublishResponseSchema, WorkspaceSkillRevocationRequestSchema, DeviceSyncUploadRequestSchema, DeviceSyncUploadResponseSchema, DeviceSyncCommitRequestSchema, DeviceSyncCommitResponseSchema, DeviceSyncDownloadRequestSchema, DeviceSyncDownloadResponseSchema, DeviceSyncReleaseRequestSchema, DeviceSyncReleaseResponseSchema, DeviceSyncAppendRequestSchema, DeviceSyncAppendResponseSchema, DeviceSyncLogRequestSchema, DeviceSyncLogResponseSchema, DeviceSyncUsageRequestSchema, DeviceSyncUsageResponseSchema } from '@adea-ai/contracts';
3
+ import { CredentialCreateRequestSchema, CredentialGetRequestSchema, CredentialListRequestSchema, CredentialListResponseSchema, CredentialResponseSchema, CredentialRevokeRequestSchema, CredentialRotateRequestSchema, ExecutionCancellationCommandSchema, ExecutionCancellationCommandResultSchema, InteractionResponseCommandSchema, InteractionResponseCommandResultSchema, ContextPackageResolutionRequestSchema, ContextPackageResolutionResponseSchema, ExecutionAcceptanceRequestSchema, ExecutionAcceptanceResponseSchema, ExecutionRequestValidationRequestSchema, ExecutionRequestValidationResponseSchema, DecisionResolveRequestSchema, DecisionResolveResponseSchema, ProfileResolutionRequestSchema, ProfileResolutionResponseSchema, ProjectStateInitializationRequestSchema, ProjectStateInitializationResponseSchema, ProjectStateResolutionRequestSchema, ProjectStateResolutionResponseSchema, RuntimeListRequestSchema, RuntimeListResponseSchema, ServiceAuthenticationRequestSchema, ServiceAuthenticationResponseSchema, ExternalSessionGetRequestSchema, ExternalSessionGetResponseSchema, ExternalSessionListRequestSchema, ExternalSessionListResponseSchema, RuntimeConnectionGetRequestSchema, RuntimeConnectionGetResponseSchema, RuntimeConnectionListRequestSchema, RuntimeConnectionListResponseSchema, MarketplaceCatalogRequestSchema, MarketplaceCatalogResponseSchema, MarketplaceInstallPlanRequestSchema, MarketplaceInstallPlanResponseSchema, MarketplaceInstallRequestSchema, MarketplaceInstallResponseSchema, MarketplaceInstallationGetRequestSchema, MarketplaceInstallationGetResponseSchema, MarketplaceInstallationListRequestSchema, MarketplaceInstallationListResponseSchema, MarketplaceInstallationUninstallRequestSchema, MarketplaceInstallationUninstallResponseSchema, WorkspaceAgentProfileDeprecationRequestSchema, WorkspaceAgentProfileGetRequestSchema, WorkspaceAgentProfileGetResponseSchema, WorkspaceAgentProfileLifecycleResponseSchema, WorkspaceAgentProfileListRequestSchema, WorkspaceAgentProfileListResponseSchema, WorkspaceAgentProfilePublishRequestSchema, WorkspaceAgentProfilePublishResponseSchema, WorkspaceAgentProfileRevocationRequestSchema, WorkspaceSkillDeprecationRequestSchema, WorkspaceSkillGetRequestSchema, WorkspaceSkillGetResponseSchema, WorkspaceSkillLifecycleResponseSchema, WorkspaceSkillListRequestSchema, WorkspaceSkillListResponseSchema, WorkspaceSkillPublishRequestSchema, WorkspaceSkillPublishResponseSchema, WorkspaceSkillRevocationRequestSchema, DeviceSyncUploadRequestSchema, DeviceSyncUploadResponseSchema, DeviceSyncCommitRequestSchema, DeviceSyncCommitResponseSchema, DeviceSyncDownloadRequestSchema, DeviceSyncDownloadResponseSchema, DeviceSyncReleaseRequestSchema, DeviceSyncReleaseResponseSchema, DeviceSyncAppendRequestSchema, DeviceSyncAppendResponseSchema, DeviceSyncLogRequestSchema, DeviceSyncLogResponseSchema, DeviceSyncUsageRequestSchema, DeviceSyncUsageResponseSchema, DeviceSyncCheckpointRequestSchema, DeviceSyncCheckpointResponseSchema, DeviceSyncRegisterCheckpointRequestSchema, DeviceSyncRegisterCheckpointResponseSchema, DeviceSyncAckRequestSchema, DeviceSyncAckResponseSchema } from '@adea-ai/contracts';
4
4
  export declare const ControlApiOperations: Readonly<{
5
5
  readonly getPiDurableLeadPublication: {
6
6
  readonly operation: 'pi-durable.lead.publication.current';
@@ -298,6 +298,13 @@ export declare const ControlApiOperations: Readonly<{
298
298
  readonly requestSchema: typeof MarketplaceInstallPlanRequestSchema;
299
299
  readonly responseSchema: typeof MarketplaceInstallPlanResponseSchema;
300
300
  };
301
+ readonly marketplaceInstallationList: {
302
+ readonly operation: 'marketplace.installation.list';
303
+ readonly method: 'POST';
304
+ readonly path: '/v1/marketplace/installations/list';
305
+ readonly requestSchema: typeof MarketplaceInstallationListRequestSchema;
306
+ readonly responseSchema: typeof MarketplaceInstallationListResponseSchema;
307
+ };
301
308
  readonly marketplaceInstallationGet: {
302
309
  readonly operation: 'marketplace.installation.get';
303
310
  readonly method: 'POST';
@@ -469,5 +476,26 @@ export declare const ControlApiOperations: Readonly<{
469
476
  readonly requestSchema: typeof DeviceSyncUsageRequestSchema;
470
477
  readonly responseSchema: typeof DeviceSyncUsageResponseSchema;
471
478
  };
479
+ readonly readDeviceSyncCheckpoint: {
480
+ readonly operation: 'device-sync.checkpoint';
481
+ readonly method: 'POST';
482
+ readonly path: '/v1/device-sync/log/checkpoint';
483
+ readonly requestSchema: typeof DeviceSyncCheckpointRequestSchema;
484
+ readonly responseSchema: typeof DeviceSyncCheckpointResponseSchema;
485
+ };
486
+ readonly registerDeviceSyncCheckpoint: {
487
+ readonly operation: 'device-sync.register-checkpoint';
488
+ readonly method: 'POST';
489
+ readonly path: '/v1/device-sync/log/checkpoint/register';
490
+ readonly requestSchema: typeof DeviceSyncRegisterCheckpointRequestSchema;
491
+ readonly responseSchema: typeof DeviceSyncRegisterCheckpointResponseSchema;
492
+ };
493
+ readonly acknowledgeDeviceSyncLog: {
494
+ readonly operation: 'device-sync.ack';
495
+ readonly method: 'POST';
496
+ readonly path: '/v1/device-sync/log/ack';
497
+ readonly requestSchema: typeof DeviceSyncAckRequestSchema;
498
+ readonly responseSchema: typeof DeviceSyncAckResponseSchema;
499
+ };
472
500
  }>;
473
501
  export type ControlApiOperationName = keyof typeof ControlApiOperations;
@@ -1,6 +1,6 @@
1
1
  import { PiDurableLeadPrepareRequestSchema, PiDurableLeadPrepareResponseSchema, PiDurableLeadLookupRequestSchema, PiDurableLeadLookupResponseSchema, PiDurableLeadDispatchRequestSchema, PiDurableLeadDispatchResponseSchema, PiDurableLeadStatusRequestSchema, PiDurableLeadStatusResponseSchema, PiDurableLeadChildrenRequestSchema, PiDurableLeadChildrenResponseSchema, PiDurableLeadChildTargetRequestSchema, PiDurableLeadChildTargetResponseSchema, PiDurableLeadProgressRequestSchema, PiDurableLeadEventsRequestSchema, PiDurableLeadEventsResponseSchema, PiDurableSessionsRequestSchema, PiDurableSessionsResponseSchema, PiDurableSessionEventsRequestSchema, PiDurableSessionEventsResponseSchema, PiDurableLeadProgressResponseSchema, PiDurableLeadCancelRequestSchema, PiDurableLeadChildCancelRequestSchema, PiDurableLeadQuestionAnswerRequestSchema, PiDurableLeadApprovalAnswerRequestSchema, PiDurableLeadApprovalAnswerResponseSchema, PiDurableLeadQuestionAnswerResponseSchema, PiDurableLeadChildCancelResponseSchema, PiDurableLeadChildMessageRequestSchema, PiDurableLeadChildMessageResponseSchema, PiDurableLeadCancelResponseSchema, } from '@adea-ai/runtime-sdk';
2
2
  import { PiLeadPublicationRequestSchema, PiLeadPublicationResponseSchema, PiChildPublicationRequestSchema, PiChildPublicationResponseSchema, ModelSelectionFundingRequestSchema, ModelSelectionFundingResponseSchema, ModelConnectionCreateRequestSchema, ModelConnectionListRequestSchema, ModelConnectionListResponseSchema, ModelConnectionResponseSchema, ModelConnectionRevokeRequestSchema, ModelDefaultsGetRequestSchema, ModelDefaultsResponseSchema, ModelDefaultsSetRequestSchema, ModelSelectionResolveRequestSchema, ModelSelectionResponseSchema, } from '@adea-ai/contracts';
3
- import { CredentialCreateRequestSchema, CredentialGetRequestSchema, CredentialListRequestSchema, CredentialListResponseSchema, CredentialResponseSchema, CredentialRevokeRequestSchema, CredentialRotateRequestSchema, ExecutionCancellationCommandSchema, ExecutionCancellationCommandResultSchema, InteractionResponseCommandSchema, InteractionResponseCommandResultSchema, ContextPackageResolutionRequestSchema, ContextPackageResolutionResponseSchema, ExecutionAcceptanceRequestSchema, ExecutionAcceptanceResponseSchema, ExecutionRequestValidationRequestSchema, ExecutionRequestValidationResponseSchema, DecisionResolveRequestSchema, DecisionResolveResponseSchema, ProfileResolutionRequestSchema, ProfileResolutionResponseSchema, ProjectStateInitializationRequestSchema, ProjectStateInitializationResponseSchema, ProjectStateResolutionRequestSchema, ProjectStateResolutionResponseSchema, RuntimeListRequestSchema, RuntimeListResponseSchema, ServiceAuthenticationRequestSchema, ServiceAuthenticationResponseSchema, ExternalSessionGetRequestSchema, ExternalSessionGetResponseSchema, ExternalSessionListRequestSchema, ExternalSessionListResponseSchema, RuntimeConnectionGetRequestSchema, RuntimeConnectionGetResponseSchema, RuntimeConnectionListRequestSchema, RuntimeConnectionListResponseSchema, MarketplaceCatalogRequestSchema, MarketplaceCatalogResponseSchema, MarketplaceInstallPlanRequestSchema, MarketplaceInstallPlanResponseSchema, MarketplaceInstallRequestSchema, MarketplaceInstallResponseSchema, MarketplaceInstallationGetRequestSchema, MarketplaceInstallationGetResponseSchema, MarketplaceInstallationUninstallRequestSchema, MarketplaceInstallationUninstallResponseSchema, WorkspaceAgentProfileDeprecationRequestSchema, WorkspaceAgentProfileGetRequestSchema, WorkspaceAgentProfileGetResponseSchema, WorkspaceAgentProfileLifecycleResponseSchema, WorkspaceAgentProfileListRequestSchema, WorkspaceAgentProfileListResponseSchema, WorkspaceAgentProfilePublishRequestSchema, WorkspaceAgentProfilePublishResponseSchema, WorkspaceAgentProfileRevocationRequestSchema, WorkspaceSkillDeprecationRequestSchema, WorkspaceSkillGetRequestSchema, WorkspaceSkillGetResponseSchema, WorkspaceSkillLifecycleResponseSchema, WorkspaceSkillListRequestSchema, WorkspaceSkillListResponseSchema, WorkspaceSkillPublishRequestSchema, WorkspaceSkillPublishResponseSchema, WorkspaceSkillRevocationRequestSchema, DeviceSyncUploadRequestSchema, DeviceSyncUploadResponseSchema, DeviceSyncCommitRequestSchema, DeviceSyncCommitResponseSchema, DeviceSyncDownloadRequestSchema, DeviceSyncDownloadResponseSchema, DeviceSyncReleaseRequestSchema, DeviceSyncReleaseResponseSchema, DeviceSyncAppendRequestSchema, DeviceSyncAppendResponseSchema, DeviceSyncLogRequestSchema, DeviceSyncLogResponseSchema, DeviceSyncUsageRequestSchema, DeviceSyncUsageResponseSchema, } from '@adea-ai/contracts';
3
+ import { CredentialCreateRequestSchema, CredentialGetRequestSchema, CredentialListRequestSchema, CredentialListResponseSchema, CredentialResponseSchema, CredentialRevokeRequestSchema, CredentialRotateRequestSchema, ExecutionCancellationCommandSchema, ExecutionCancellationCommandResultSchema, InteractionResponseCommandSchema, InteractionResponseCommandResultSchema, ContextPackageResolutionRequestSchema, ContextPackageResolutionResponseSchema, ExecutionAcceptanceRequestSchema, ExecutionAcceptanceResponseSchema, ExecutionRequestValidationRequestSchema, ExecutionRequestValidationResponseSchema, DecisionResolveRequestSchema, DecisionResolveResponseSchema, ProfileResolutionRequestSchema, ProfileResolutionResponseSchema, ProjectStateInitializationRequestSchema, ProjectStateInitializationResponseSchema, ProjectStateResolutionRequestSchema, ProjectStateResolutionResponseSchema, RuntimeListRequestSchema, RuntimeListResponseSchema, ServiceAuthenticationRequestSchema, ServiceAuthenticationResponseSchema, ExternalSessionGetRequestSchema, ExternalSessionGetResponseSchema, ExternalSessionListRequestSchema, ExternalSessionListResponseSchema, RuntimeConnectionGetRequestSchema, RuntimeConnectionGetResponseSchema, RuntimeConnectionListRequestSchema, RuntimeConnectionListResponseSchema, MarketplaceCatalogRequestSchema, MarketplaceCatalogResponseSchema, MarketplaceInstallPlanRequestSchema, MarketplaceInstallPlanResponseSchema, MarketplaceInstallRequestSchema, MarketplaceInstallResponseSchema, MarketplaceInstallationGetRequestSchema, MarketplaceInstallationGetResponseSchema, MarketplaceInstallationListRequestSchema, MarketplaceInstallationListResponseSchema, MarketplaceInstallationUninstallRequestSchema, MarketplaceInstallationUninstallResponseSchema, WorkspaceAgentProfileDeprecationRequestSchema, WorkspaceAgentProfileGetRequestSchema, WorkspaceAgentProfileGetResponseSchema, WorkspaceAgentProfileLifecycleResponseSchema, WorkspaceAgentProfileListRequestSchema, WorkspaceAgentProfileListResponseSchema, WorkspaceAgentProfilePublishRequestSchema, WorkspaceAgentProfilePublishResponseSchema, WorkspaceAgentProfileRevocationRequestSchema, WorkspaceSkillDeprecationRequestSchema, WorkspaceSkillGetRequestSchema, WorkspaceSkillGetResponseSchema, WorkspaceSkillLifecycleResponseSchema, WorkspaceSkillListRequestSchema, WorkspaceSkillListResponseSchema, WorkspaceSkillPublishRequestSchema, WorkspaceSkillPublishResponseSchema, WorkspaceSkillRevocationRequestSchema, DeviceSyncUploadRequestSchema, DeviceSyncUploadResponseSchema, DeviceSyncCommitRequestSchema, DeviceSyncCommitResponseSchema, DeviceSyncDownloadRequestSchema, DeviceSyncDownloadResponseSchema, DeviceSyncReleaseRequestSchema, DeviceSyncReleaseResponseSchema, DeviceSyncAppendRequestSchema, DeviceSyncAppendResponseSchema, DeviceSyncLogRequestSchema, DeviceSyncLogResponseSchema, DeviceSyncUsageRequestSchema, DeviceSyncUsageResponseSchema, DeviceSyncCheckpointRequestSchema, DeviceSyncCheckpointResponseSchema, DeviceSyncRegisterCheckpointRequestSchema, DeviceSyncRegisterCheckpointResponseSchema, DeviceSyncAckRequestSchema, DeviceSyncAckResponseSchema, } from '@adea-ai/contracts';
4
4
  export const ControlApiOperations = Object.freeze({
5
5
  getPiDurableLeadPublication: {
6
6
  operation: 'pi-durable.lead.publication.current',
@@ -298,6 +298,13 @@ export const ControlApiOperations = Object.freeze({
298
298
  requestSchema: MarketplaceInstallPlanRequestSchema,
299
299
  responseSchema: MarketplaceInstallPlanResponseSchema,
300
300
  },
301
+ marketplaceInstallationList: {
302
+ operation: 'marketplace.installation.list',
303
+ method: 'POST',
304
+ path: '/v1/marketplace/installations/list',
305
+ requestSchema: MarketplaceInstallationListRequestSchema,
306
+ responseSchema: MarketplaceInstallationListResponseSchema,
307
+ },
301
308
  marketplaceInstallationGet: {
302
309
  operation: 'marketplace.installation.get',
303
310
  method: 'POST',
@@ -469,4 +476,25 @@ export const ControlApiOperations = Object.freeze({
469
476
  requestSchema: DeviceSyncUsageRequestSchema,
470
477
  responseSchema: DeviceSyncUsageResponseSchema,
471
478
  },
479
+ readDeviceSyncCheckpoint: {
480
+ operation: 'device-sync.checkpoint',
481
+ method: 'POST',
482
+ path: '/v1/device-sync/log/checkpoint',
483
+ requestSchema: DeviceSyncCheckpointRequestSchema,
484
+ responseSchema: DeviceSyncCheckpointResponseSchema,
485
+ },
486
+ registerDeviceSyncCheckpoint: {
487
+ operation: 'device-sync.register-checkpoint',
488
+ method: 'POST',
489
+ path: '/v1/device-sync/log/checkpoint/register',
490
+ requestSchema: DeviceSyncRegisterCheckpointRequestSchema,
491
+ responseSchema: DeviceSyncRegisterCheckpointResponseSchema,
492
+ },
493
+ acknowledgeDeviceSyncLog: {
494
+ operation: 'device-sync.ack',
495
+ method: 'POST',
496
+ path: '/v1/device-sync/log/ack',
497
+ requestSchema: DeviceSyncAckRequestSchema,
498
+ responseSchema: DeviceSyncAckResponseSchema,
499
+ },
472
500
  });