@codex-app-sdk/core 0.15.1 → 0.16.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/chunks/{surface-bridge-B2eH0shg.js → surface-bridge-CUuIfmG5.js} +151 -123
- package/dist/chunks/surface-bridge-CUuIfmG5.js.map +1 -0
- package/dist/conversation-replica.js +9 -0
- package/dist/conversation-replica.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/surface-bridge.d.ts +5 -3
- package/dist/surface-bridge.d.ts.map +1 -1
- package/dist/surface-bridge.js +1 -1
- package/dist/surface.d.ts +56 -0
- package/dist/surface.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/surface-bridge-B2eH0shg.js.map +0 -1
|
@@ -152,12 +152,12 @@ function u(e) {
|
|
|
152
152
|
return typeof e == "string" && l.has(e);
|
|
153
153
|
}
|
|
154
154
|
async function d(e, t, n, r, i = {}) {
|
|
155
|
-
let a =
|
|
155
|
+
let a = R(t, "Conversation id"), [o, s] = _[n];
|
|
156
156
|
if (r.length < o || r.length > s) throw TypeError(`${i.operationLabel ?? n} received an invalid number of arguments`);
|
|
157
157
|
return await y(b(e.conversation(a)), n, r, i);
|
|
158
158
|
}
|
|
159
159
|
function f(e, t, n) {
|
|
160
|
-
let r =
|
|
160
|
+
let r = R(t, "Conversation id"), i = e.conversation(r), a = (e) => {
|
|
161
161
|
e.activeConversationId === r && n({
|
|
162
162
|
type: "snapshot",
|
|
163
163
|
conversationId: r,
|
|
@@ -180,7 +180,7 @@ function f(e, t, n) {
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
function p(e, t, n) {
|
|
183
|
-
let r =
|
|
183
|
+
let r = R(t, "Conversation id"), i = e.conversation(r), a = [], o = !1, s = i.onEvent((e) => {
|
|
184
184
|
e.conversationId === r && (o ? n({
|
|
185
185
|
type: "event",
|
|
186
186
|
conversationId: r,
|
|
@@ -206,7 +206,7 @@ function p(e, t, n) {
|
|
|
206
206
|
}
|
|
207
207
|
return s;
|
|
208
208
|
}
|
|
209
|
-
var m = /* @__PURE__ */ "archiveConversation.cancelLogin.clearGoal.compactConversation.connect.continueInterruptedTurn.createConversation.deleteConversation.deleteTurn.deleteQueuedPrompt.editTurn.forkTurn.getSnapshot.interrupt.listConversations.listModels.loadOlderConversationHistory.logout.readConversationHistory.readConversationPromptHistory.refreshAccount.refreshConversations.renameConversation.respondToClientRequest.resolveApproval.retryTurn.selectConversation.sendMessage.setGoal.startChatGptDeviceCodeLogin.startChatGptLogin.startReview.steerMessage.steerQueuedPrompt.unarchiveConversation.updateConversationSettings.updateQueuedPrompt.startLiveChat.stopLiveChat".split("."), h = new Set(m), g = {
|
|
209
|
+
var m = /* @__PURE__ */ "archiveConversation.cancelLogin.clearGoal.compactConversation.connect.continueInterruptedTurn.createConversation.deleteConversation.deleteTurn.deleteQueuedPrompt.editTurn.forkTurn.getSnapshot.interrupt.listConversations.listModels.loadOlderConversationHistory.logout.readConversationHistory.readConversationPromptHistory.refreshAccount.refreshConversations.renameConversation.respondToClientRequest.resolveApproval.retryTurn.selectConversation.sendMessage.setGoal.startChatGptDeviceCodeLogin.startChatGptLogin.startReview.steerMessage.steerQueuedPrompt.unarchiveConversation.updateConversationSettings.updateQueuedPrompt.startLiveChat.stopLiveChat.readRateLimits.readAccountUsage.consumeRateLimitResetCredit".split("."), h = new Set(m), g = {
|
|
210
210
|
startLiveChat: [2, 2],
|
|
211
211
|
stopLiveChat: [1, 1],
|
|
212
212
|
archiveConversation: [1, 1],
|
|
@@ -230,6 +230,9 @@ var m = /* @__PURE__ */ "archiveConversation.cancelLogin.clearGoal.compactConver
|
|
|
230
230
|
readConversationHistory: [0, 1],
|
|
231
231
|
readConversationPromptHistory: [0, 1],
|
|
232
232
|
refreshAccount: [0, 0],
|
|
233
|
+
readRateLimits: [0, 1],
|
|
234
|
+
readAccountUsage: [0, 0],
|
|
235
|
+
consumeRateLimitResetCredit: [1, 1],
|
|
233
236
|
refreshConversations: [0, 0],
|
|
234
237
|
renameConversation: [1, 1],
|
|
235
238
|
respondToClientRequest: [1, 1],
|
|
@@ -308,50 +311,63 @@ function b(e) {
|
|
|
308
311
|
}
|
|
309
312
|
async function x(e, t, n, r) {
|
|
310
313
|
switch (t) {
|
|
311
|
-
case "startLiveChat": return e.startLiveChat(
|
|
312
|
-
case "stopLiveChat": return e.stopLiveChat(
|
|
313
|
-
case "archiveConversation": return e.archiveConversation(
|
|
314
|
-
case "cancelLogin": return e.cancelLogin(
|
|
314
|
+
case "startLiveChat": return e.startLiveChat(R(n[0], "Conversation id"), S(n[1]));
|
|
315
|
+
case "stopLiveChat": return e.stopLiveChat(R(n[0], "Conversation id"));
|
|
316
|
+
case "archiveConversation": return e.archiveConversation(R(n[0], "Conversation id"));
|
|
317
|
+
case "cancelLogin": return e.cancelLogin(z(n[0], "Login id"));
|
|
315
318
|
case "clearGoal": return e.clearGoal();
|
|
316
319
|
case "compactConversation": return e.compactConversation();
|
|
317
320
|
case "connect": return e.connect();
|
|
318
321
|
case "continueInterruptedTurn": return e.continueInterruptedTurn();
|
|
319
322
|
case "createConversation": return e.createConversation(C(n[0]));
|
|
320
|
-
case "deleteConversation": return e.deleteConversation(
|
|
321
|
-
case "deleteTurn": return e.deleteTurn(
|
|
322
|
-
case "deleteQueuedPrompt": return e.deleteQueuedPrompt(
|
|
323
|
-
case "editTurn": return e.editTurn(
|
|
324
|
-
case "forkTurn": return e.forkTurn(
|
|
323
|
+
case "deleteConversation": return e.deleteConversation(R(n[0], "Conversation id"));
|
|
324
|
+
case "deleteTurn": return e.deleteTurn(R(n[0], "Turn id"));
|
|
325
|
+
case "deleteQueuedPrompt": return e.deleteQueuedPrompt(R(n[0], "Queued prompt id"));
|
|
326
|
+
case "editTurn": return e.editTurn(R(n[0], "Turn id"), R(n[1], "Turn content"));
|
|
327
|
+
case "forkTurn": return e.forkTurn(R(n[0], "Turn id"));
|
|
325
328
|
case "getSnapshot": return e.getSnapshot();
|
|
326
329
|
case "interrupt": return e.interrupt();
|
|
327
330
|
case "listConversations": return e.listConversations(w(n[0]));
|
|
328
|
-
case "listModels": return e.listModels(
|
|
329
|
-
case "loadOlderConversationHistory": return e.loadOlderConversationHistory(
|
|
331
|
+
case "listModels": return e.listModels(D(n[0]));
|
|
332
|
+
case "loadOlderConversationHistory": return e.loadOlderConversationHistory(z(n[0], "Conversation id"));
|
|
330
333
|
case "logout": return e.logout();
|
|
331
|
-
case "readConversationHistory": return e.readConversationHistory(
|
|
332
|
-
case "readConversationPromptHistory": return e.readConversationPromptHistory(
|
|
334
|
+
case "readConversationHistory": return e.readConversationHistory(z(n[0], "Conversation id"));
|
|
335
|
+
case "readConversationPromptHistory": return e.readConversationPromptHistory(z(n[0], "Conversation id"));
|
|
333
336
|
case "refreshAccount": return e.refreshAccount();
|
|
337
|
+
case "readRateLimits": {
|
|
338
|
+
let t = T(n[0]);
|
|
339
|
+
if (!e.readRateLimits) throw Error("Account rate-limit reads are not available.");
|
|
340
|
+
return e.readRateLimits(t);
|
|
341
|
+
}
|
|
342
|
+
case "readAccountUsage":
|
|
343
|
+
if (!e.readAccountUsage) throw Error("Account usage reads are not available.");
|
|
344
|
+
return e.readAccountUsage();
|
|
345
|
+
case "consumeRateLimitResetCredit": {
|
|
346
|
+
let t = E(n[0]);
|
|
347
|
+
if (!e.consumeRateLimitResetCredit) throw Error("Rate-limit reset credits are not available.");
|
|
348
|
+
return e.consumeRateLimitResetCredit(t);
|
|
349
|
+
}
|
|
334
350
|
case "refreshConversations": return e.refreshConversations();
|
|
335
|
-
case "renameConversation": return e.renameConversation(
|
|
336
|
-
case "respondToClientRequest": return e.respondToClientRequest(
|
|
337
|
-
case "resolveApproval": return e.resolveApproval(
|
|
338
|
-
case "retryTurn": return e.retryTurn(
|
|
339
|
-
case "selectConversation": return e.selectConversation(
|
|
340
|
-
case "sendMessage": return e.sendMessage(
|
|
341
|
-
case "setGoal": return e.setGoal(
|
|
351
|
+
case "renameConversation": return e.renameConversation(R(n[0], "Conversation title"));
|
|
352
|
+
case "respondToClientRequest": return e.respondToClientRequest(k(n[0]));
|
|
353
|
+
case "resolveApproval": return e.resolveApproval(R(n[0], "Approval id"), H(n[1]), U(n[2]));
|
|
354
|
+
case "retryTurn": return e.retryTurn(R(n[0], "Turn id"));
|
|
355
|
+
case "selectConversation": return e.selectConversation(R(n[0], "Conversation id"));
|
|
356
|
+
case "sendMessage": return e.sendMessage(R(n[0], "Message prompt"), await j(n[1], r.resolveAttachment));
|
|
357
|
+
case "setGoal": return e.setGoal(R(n[0], "Goal objective"), G(n[1]));
|
|
342
358
|
case "startChatGptDeviceCodeLogin": return e.startChatGptDeviceCodeLogin();
|
|
343
359
|
case "startChatGptLogin": return e.startChatGptLogin();
|
|
344
|
-
case "startReview": return e.startReview(
|
|
345
|
-
case "steerMessage": return e.steerMessage(
|
|
346
|
-
case "steerQueuedPrompt": return e.steerQueuedPrompt(
|
|
347
|
-
case "unarchiveConversation": return e.unarchiveConversation(
|
|
348
|
-
case "updateConversationSettings": return e.updateConversationSettings(
|
|
349
|
-
case "updateQueuedPrompt": return e.updateQueuedPrompt(
|
|
360
|
+
case "startReview": return e.startReview(F(n[0]));
|
|
361
|
+
case "steerMessage": return e.steerMessage(R(n[0], "Steer prompt"), await j(n[1], r.resolveAttachment));
|
|
362
|
+
case "steerQueuedPrompt": return e.steerQueuedPrompt(R(n[0], "Queued prompt id"), z(n[1], "Queued prompt"));
|
|
363
|
+
case "unarchiveConversation": return e.unarchiveConversation(R(n[0], "Conversation id"));
|
|
364
|
+
case "updateConversationSettings": return e.updateConversationSettings(O(n[0]));
|
|
365
|
+
case "updateQueuedPrompt": return e.updateQueuedPrompt(R(n[0], "Queued prompt id"), R(n[1], "Queued prompt"));
|
|
350
366
|
}
|
|
351
367
|
}
|
|
352
368
|
function S(e) {
|
|
353
|
-
let t =
|
|
354
|
-
|
|
369
|
+
let t = I(e, "Live chat options");
|
|
370
|
+
L(t, [
|
|
355
371
|
"sdp",
|
|
356
372
|
"version",
|
|
357
373
|
"voice",
|
|
@@ -360,12 +376,12 @@ function S(e) {
|
|
|
360
376
|
"includeStartupContext",
|
|
361
377
|
"flushTranscriptTailOnSessionEnd"
|
|
362
378
|
], "Live chat options");
|
|
363
|
-
let n = { sdp:
|
|
379
|
+
let n = { sdp: R(t.sdp, "SDP offer") };
|
|
364
380
|
if (t.version !== void 0) {
|
|
365
381
|
if (t.version !== "v1" && t.version !== "v2" && t.version !== "v3") throw TypeError("Invalid realtime version");
|
|
366
382
|
n.version = t.version;
|
|
367
383
|
}
|
|
368
|
-
for (let e of ["voice", "model"]) t[e] !== void 0 && (n[e] =
|
|
384
|
+
for (let e of ["voice", "model"]) t[e] !== void 0 && (n[e] = R(t[e], e));
|
|
369
385
|
if (t.prompt !== void 0) {
|
|
370
386
|
if (t.prompt !== null && typeof t.prompt != "string") throw TypeError("Prompt must be a string or null");
|
|
371
387
|
n.prompt = t.prompt;
|
|
@@ -378,68 +394,80 @@ function S(e) {
|
|
|
378
394
|
}
|
|
379
395
|
function C(e) {
|
|
380
396
|
if (e === void 0) return;
|
|
381
|
-
let t =
|
|
382
|
-
return
|
|
397
|
+
let t = I(e, "Conversation options");
|
|
398
|
+
return L(t, [
|
|
383
399
|
"model",
|
|
384
400
|
"reasoningEffort",
|
|
385
401
|
"serviceTier",
|
|
386
402
|
"approvalPreset"
|
|
387
403
|
], "Conversation options"), {
|
|
388
|
-
...t.model === void 0 ? {} : { model:
|
|
389
|
-
...t.reasoningEffort === void 0 ? {} : { reasoningEffort:
|
|
390
|
-
...t.serviceTier === void 0 ? {} : { serviceTier:
|
|
391
|
-
...t.approvalPreset === void 0 ? {} : { approvalPreset:
|
|
404
|
+
...t.model === void 0 ? {} : { model: R(t.model, "Conversation model") },
|
|
405
|
+
...t.reasoningEffort === void 0 ? {} : { reasoningEffort: R(t.reasoningEffort, "Conversation reasoning effort") },
|
|
406
|
+
...t.serviceTier === void 0 ? {} : { serviceTier: B(t.serviceTier, "Conversation service tier") },
|
|
407
|
+
...t.approvalPreset === void 0 ? {} : { approvalPreset: W(t.approvalPreset) }
|
|
392
408
|
};
|
|
393
409
|
}
|
|
394
410
|
function w(e) {
|
|
395
411
|
if (e === void 0) return;
|
|
396
|
-
let t =
|
|
397
|
-
if (
|
|
412
|
+
let t = I(e, "Conversation list options");
|
|
413
|
+
if (L(t, [
|
|
398
414
|
"archived",
|
|
399
415
|
"cwd",
|
|
400
416
|
"limit",
|
|
401
417
|
"searchTerm"
|
|
402
418
|
], "Conversation list options"), t.archived !== void 0 && typeof t.archived != "boolean") throw TypeError("Conversation list archived flag must be a boolean");
|
|
403
419
|
if (t.limit !== void 0 && (!Number.isInteger(t.limit) || t.limit < 0)) throw TypeError("Conversation list limit must be a non-negative integer");
|
|
404
|
-
let n = t.cwd === void 0 ? void 0 : Array.isArray(t.cwd) ? t.cwd.map((e) =>
|
|
420
|
+
let n = t.cwd === void 0 ? void 0 : Array.isArray(t.cwd) ? t.cwd.map((e) => R(e, "Conversation list cwd")) : R(t.cwd, "Conversation list cwd");
|
|
405
421
|
return {
|
|
406
422
|
...t.archived === void 0 ? {} : { archived: t.archived },
|
|
407
423
|
...n === void 0 ? {} : { cwd: n },
|
|
408
424
|
...t.limit === void 0 ? {} : { limit: t.limit },
|
|
409
|
-
...t.searchTerm === void 0 ? {} : { searchTerm:
|
|
425
|
+
...t.searchTerm === void 0 ? {} : { searchTerm: R(t.searchTerm, "Conversation list search term") }
|
|
410
426
|
};
|
|
411
427
|
}
|
|
412
428
|
function T(e) {
|
|
413
429
|
if (e === void 0) return;
|
|
414
|
-
let t =
|
|
415
|
-
return
|
|
416
|
-
...t.includeHidden === void 0 ? {} : { includeHidden: z(t.includeHidden, "Model list includeHidden") },
|
|
417
|
-
...t.forceReload === void 0 ? {} : { forceReload: z(t.forceReload, "Model list forceReload") }
|
|
418
|
-
};
|
|
430
|
+
let t = I(e, "Rate-limit read options");
|
|
431
|
+
return L(t, ["excludeResetCreditDetails"], "Rate-limit read options"), t.excludeResetCreditDetails === void 0 ? {} : { excludeResetCreditDetails: V(t.excludeResetCreditDetails, "Exclude reset credit details") };
|
|
419
432
|
}
|
|
420
433
|
function E(e) {
|
|
421
|
-
let t =
|
|
422
|
-
return
|
|
434
|
+
let t = I(e, "Reset-credit options");
|
|
435
|
+
return L(t, ["idempotencyKey", "creditId"], "Reset-credit options"), {
|
|
436
|
+
idempotencyKey: R(t.idempotencyKey, "Reset-credit idempotency key"),
|
|
437
|
+
...t.creditId === void 0 ? {} : { creditId: R(t.creditId, "Reset credit id") }
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function D(e) {
|
|
441
|
+
if (e === void 0) return;
|
|
442
|
+
let t = I(e, "Model list options");
|
|
443
|
+
return L(t, ["includeHidden", "forceReload"], "Model list options"), {
|
|
444
|
+
...t.includeHidden === void 0 ? {} : { includeHidden: V(t.includeHidden, "Model list includeHidden") },
|
|
445
|
+
...t.forceReload === void 0 ? {} : { forceReload: V(t.forceReload, "Model list forceReload") }
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function O(e) {
|
|
449
|
+
let t = I(e, "Conversation settings");
|
|
450
|
+
return L(t, [
|
|
423
451
|
"modelId",
|
|
424
452
|
"reasoningEffort",
|
|
425
453
|
"serviceTier",
|
|
426
454
|
"approvalPreset",
|
|
427
455
|
"planMode"
|
|
428
456
|
], "Conversation settings"), {
|
|
429
|
-
...t.modelId === void 0 ? {} : { modelId:
|
|
430
|
-
...t.reasoningEffort === void 0 ? {} : { reasoningEffort:
|
|
431
|
-
...t.serviceTier === void 0 ? {} : { serviceTier:
|
|
432
|
-
...t.approvalPreset === void 0 ? {} : { approvalPreset:
|
|
433
|
-
...t.planMode === void 0 ? {} : { planMode:
|
|
457
|
+
...t.modelId === void 0 ? {} : { modelId: R(t.modelId, "Conversation model id") },
|
|
458
|
+
...t.reasoningEffort === void 0 ? {} : { reasoningEffort: R(t.reasoningEffort, "Conversation reasoning effort") },
|
|
459
|
+
...t.serviceTier === void 0 ? {} : { serviceTier: B(t.serviceTier, "Conversation service tier") },
|
|
460
|
+
...t.approvalPreset === void 0 ? {} : { approvalPreset: W(t.approvalPreset) },
|
|
461
|
+
...t.planMode === void 0 ? {} : { planMode: V(t.planMode, "Conversation plan mode") }
|
|
434
462
|
};
|
|
435
463
|
}
|
|
436
|
-
function
|
|
437
|
-
let t =
|
|
438
|
-
|
|
439
|
-
let n =
|
|
464
|
+
function k(e) {
|
|
465
|
+
let t = I(e, "Client request response");
|
|
466
|
+
L(t, ["id", "payload"], "Client request response");
|
|
467
|
+
let n = R(t.id, "Client request id");
|
|
440
468
|
if (t.payload === void 0) return { id: n };
|
|
441
|
-
let r =
|
|
442
|
-
|
|
469
|
+
let r = I(t.payload, "Client request response payload");
|
|
470
|
+
L(r, [
|
|
443
471
|
"answers",
|
|
444
472
|
"cancelled",
|
|
445
473
|
"decision"
|
|
@@ -452,30 +480,30 @@ function D(e) {
|
|
|
452
480
|
"always_allow",
|
|
453
481
|
"deny"
|
|
454
482
|
].includes(i)) throw TypeError("Client request decision is invalid");
|
|
455
|
-
let a = r.answers === void 0 ? void 0 :
|
|
483
|
+
let a = r.answers === void 0 ? void 0 : A(r.answers);
|
|
456
484
|
return {
|
|
457
485
|
id: n,
|
|
458
486
|
payload: {
|
|
459
487
|
...a === void 0 ? {} : { answers: a },
|
|
460
|
-
...r.cancelled === void 0 ? {} : { cancelled:
|
|
488
|
+
...r.cancelled === void 0 ? {} : { cancelled: V(r.cancelled, "Client request cancelled flag") },
|
|
461
489
|
...i === void 0 ? {} : { decision: i }
|
|
462
490
|
}
|
|
463
491
|
};
|
|
464
492
|
}
|
|
465
|
-
function
|
|
466
|
-
let t =
|
|
493
|
+
function A(e) {
|
|
494
|
+
let t = I(e, "Client request answers"), n = {};
|
|
467
495
|
for (let [e, r] of Object.entries(t)) {
|
|
468
496
|
if (!e.trim()) throw TypeError("Client request question id must be non-empty");
|
|
469
|
-
let t =
|
|
470
|
-
if (
|
|
497
|
+
let t = I(r, "Client request answer");
|
|
498
|
+
if (L(t, ["answers"], "Client request answer"), !Array.isArray(t.answers) || !t.answers.every((e) => typeof e == "string")) throw TypeError("Client request answer values must be an array of strings");
|
|
471
499
|
n[e] = { answers: [...t.answers] };
|
|
472
500
|
}
|
|
473
501
|
return n;
|
|
474
502
|
}
|
|
475
|
-
async function
|
|
503
|
+
async function j(e, t) {
|
|
476
504
|
if (e === void 0) return;
|
|
477
|
-
let n =
|
|
478
|
-
|
|
505
|
+
let n = I(e, "Message options");
|
|
506
|
+
L(n, [
|
|
479
507
|
"attachments",
|
|
480
508
|
"model",
|
|
481
509
|
"reasoningEffort",
|
|
@@ -484,26 +512,26 @@ async function k(e, t) {
|
|
|
484
512
|
"skills",
|
|
485
513
|
"outputSchema"
|
|
486
514
|
], "Message options");
|
|
487
|
-
let r = n.attachments === void 0 ? void 0 : await
|
|
488
|
-
if (n.outputSchema !== void 0 && !
|
|
515
|
+
let r = n.attachments === void 0 ? void 0 : await M(n.attachments, t), i = n.skills === void 0 ? void 0 : P(n.skills);
|
|
516
|
+
if (n.outputSchema !== void 0 && !J(n.outputSchema)) throw TypeError("Message output schema must be JSON-serializable");
|
|
489
517
|
return {
|
|
490
518
|
...r === void 0 ? {} : { attachments: r },
|
|
491
|
-
...n.model === void 0 ? {} : { model:
|
|
492
|
-
...n.reasoningEffort === void 0 ? {} : { reasoningEffort:
|
|
493
|
-
...n.serviceTier === void 0 ? {} : { serviceTier:
|
|
494
|
-
...n.planMode === void 0 ? {} : { planMode:
|
|
519
|
+
...n.model === void 0 ? {} : { model: R(n.model, "Message model") },
|
|
520
|
+
...n.reasoningEffort === void 0 ? {} : { reasoningEffort: R(n.reasoningEffort, "Message reasoning effort") },
|
|
521
|
+
...n.serviceTier === void 0 ? {} : { serviceTier: B(n.serviceTier, "Message service tier") },
|
|
522
|
+
...n.planMode === void 0 ? {} : { planMode: V(n.planMode, "Message plan mode") },
|
|
495
523
|
...i === void 0 ? {} : { skills: i },
|
|
496
524
|
...n.outputSchema === void 0 ? {} : { outputSchema: n.outputSchema }
|
|
497
525
|
};
|
|
498
526
|
}
|
|
499
|
-
async function
|
|
527
|
+
async function M(e, t) {
|
|
500
528
|
if (!Array.isArray(e)) throw TypeError("Message attachments must be an array");
|
|
501
529
|
if (e.length > 0 && !t) throw TypeError("Message attachment references are not supported by this host");
|
|
502
530
|
return Promise.all(e.map(async (e) => {
|
|
503
|
-
let n =
|
|
531
|
+
let n = I(e, "Message attachment");
|
|
504
532
|
if (n.type !== "image" && n.type !== "file") throw TypeError("Message attachment type is invalid");
|
|
505
533
|
let r = n.type === "image";
|
|
506
|
-
if (
|
|
534
|
+
if (L(n, r ? [
|
|
507
535
|
"type",
|
|
508
536
|
"reference",
|
|
509
537
|
"detail"
|
|
@@ -515,107 +543,107 @@ async function A(e, t) {
|
|
|
515
543
|
].includes(String(n.detail))) throw TypeError("Message image detail is invalid");
|
|
516
544
|
let i = r ? {
|
|
517
545
|
type: "image",
|
|
518
|
-
reference:
|
|
546
|
+
reference: R(n.reference, "Message attachment reference"),
|
|
519
547
|
...n.detail === void 0 ? {} : { detail: n.detail }
|
|
520
548
|
} : {
|
|
521
549
|
type: "file",
|
|
522
|
-
reference:
|
|
550
|
+
reference: R(n.reference, "Message attachment reference")
|
|
523
551
|
};
|
|
524
|
-
return
|
|
552
|
+
return N(await t(i), i);
|
|
525
553
|
}));
|
|
526
554
|
}
|
|
527
|
-
function
|
|
528
|
-
let n =
|
|
555
|
+
function N(e, t) {
|
|
556
|
+
let n = I(e, "Resolved message attachment");
|
|
529
557
|
if (n.type !== t.type) throw TypeError("Resolved message attachment type does not match");
|
|
530
558
|
let r = {
|
|
531
|
-
path:
|
|
532
|
-
...n.name === void 0 ? {} : { name:
|
|
533
|
-
...n.mimeType === void 0 ? {} : { mimeType:
|
|
559
|
+
path: R(n.path, "Resolved message attachment path"),
|
|
560
|
+
...n.name === void 0 ? {} : { name: K(n.name, "Resolved message attachment name") },
|
|
561
|
+
...n.mimeType === void 0 ? {} : { mimeType: K(n.mimeType, "Resolved message attachment MIME type") }
|
|
534
562
|
};
|
|
535
563
|
return t.type === "image" ? {
|
|
536
564
|
type: "image",
|
|
537
565
|
...r,
|
|
538
566
|
...t.detail === void 0 ? {} : { detail: t.detail },
|
|
539
|
-
...n.previewUrl === void 0 ? {} : { previewUrl:
|
|
567
|
+
...n.previewUrl === void 0 ? {} : { previewUrl: q(n.previewUrl) }
|
|
540
568
|
} : {
|
|
541
569
|
type: "file",
|
|
542
570
|
...r
|
|
543
571
|
};
|
|
544
572
|
}
|
|
545
|
-
function
|
|
573
|
+
function P(e) {
|
|
546
574
|
if (!Array.isArray(e)) throw TypeError("Message skills must be an array");
|
|
547
575
|
return e.map((e) => {
|
|
548
|
-
let t =
|
|
549
|
-
return
|
|
550
|
-
name:
|
|
551
|
-
path:
|
|
576
|
+
let t = I(e, "Message skill");
|
|
577
|
+
return L(t, ["name", "path"], "Message skill"), {
|
|
578
|
+
name: R(t.name, "Message skill name"),
|
|
579
|
+
path: R(t.path, "Message skill path")
|
|
552
580
|
};
|
|
553
581
|
});
|
|
554
582
|
}
|
|
555
|
-
function
|
|
583
|
+
function F(e) {
|
|
556
584
|
if (e === void 0) return;
|
|
557
|
-
let t =
|
|
558
|
-
if (
|
|
559
|
-
let n =
|
|
560
|
-
if (n.type === "uncommittedChanges") return
|
|
561
|
-
if (n.type === "baseBranch") return
|
|
585
|
+
let t = I(e, "Review options");
|
|
586
|
+
if (L(t, ["target"], "Review options"), t.target === void 0) return {};
|
|
587
|
+
let n = I(t.target, "Review target");
|
|
588
|
+
if (n.type === "uncommittedChanges") return L(n, ["type"], "Review target"), { target: { type: "uncommittedChanges" } };
|
|
589
|
+
if (n.type === "baseBranch") return L(n, ["type", "branch"], "Review target"), { target: {
|
|
562
590
|
type: "baseBranch",
|
|
563
|
-
branch:
|
|
591
|
+
branch: R(n.branch, "Review branch")
|
|
564
592
|
} };
|
|
565
593
|
if (n.type === "commit") {
|
|
566
|
-
if (
|
|
594
|
+
if (L(n, [
|
|
567
595
|
"type",
|
|
568
596
|
"sha",
|
|
569
597
|
"title"
|
|
570
598
|
], "Review target"), n.title !== void 0 && n.title !== null && typeof n.title != "string") throw TypeError("Review commit title must be a string or null");
|
|
571
599
|
return { target: {
|
|
572
600
|
type: "commit",
|
|
573
|
-
sha:
|
|
601
|
+
sha: R(n.sha, "Review commit SHA"),
|
|
574
602
|
...n.title === void 0 ? {} : { title: n.title }
|
|
575
603
|
} };
|
|
576
604
|
}
|
|
577
|
-
if (n.type === "custom") return
|
|
605
|
+
if (n.type === "custom") return L(n, ["type", "instructions"], "Review target"), { target: {
|
|
578
606
|
type: "custom",
|
|
579
|
-
instructions:
|
|
607
|
+
instructions: R(n.instructions, "Review instructions")
|
|
580
608
|
} };
|
|
581
609
|
throw TypeError("Review target type is invalid");
|
|
582
610
|
}
|
|
583
|
-
function
|
|
611
|
+
function I(e, t) {
|
|
584
612
|
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError(`${t} must be an object`);
|
|
585
613
|
let n = Object.getPrototypeOf(e);
|
|
586
614
|
if (n !== Object.prototype && n !== null) throw TypeError(`${t} must be a plain object`);
|
|
587
615
|
if (Reflect.ownKeys(e).some((e) => typeof e == "symbol")) throw TypeError(`${t} must not contain symbol properties`);
|
|
588
616
|
return e;
|
|
589
617
|
}
|
|
590
|
-
function
|
|
618
|
+
function L(e, t, n) {
|
|
591
619
|
let r = new Set(t), i = Object.getOwnPropertyNames(e).find((e) => !r.has(e));
|
|
592
620
|
if (i) throw TypeError(`${n} contains unsupported property "${i}"`);
|
|
593
621
|
}
|
|
594
|
-
function
|
|
622
|
+
function R(e, t) {
|
|
595
623
|
if (typeof e != "string" || !e.trim()) throw TypeError(`${t} must be a non-empty string`);
|
|
596
624
|
return e;
|
|
597
625
|
}
|
|
598
|
-
function
|
|
599
|
-
return e === void 0 ? void 0 :
|
|
626
|
+
function z(e, t) {
|
|
627
|
+
return e === void 0 ? void 0 : R(e, t);
|
|
600
628
|
}
|
|
601
|
-
function
|
|
602
|
-
return e === null ? null :
|
|
629
|
+
function B(e, t) {
|
|
630
|
+
return e === null ? null : R(e, t);
|
|
603
631
|
}
|
|
604
|
-
function
|
|
632
|
+
function V(e, t) {
|
|
605
633
|
if (typeof e != "boolean") throw TypeError(`${t} must be a boolean`);
|
|
606
634
|
return e;
|
|
607
635
|
}
|
|
608
|
-
function
|
|
636
|
+
function H(e) {
|
|
609
637
|
if (e !== "approve" && e !== "deny") throw TypeError("Approval decision is invalid");
|
|
610
638
|
return e;
|
|
611
639
|
}
|
|
612
|
-
function
|
|
640
|
+
function U(e) {
|
|
613
641
|
if (e !== void 0) {
|
|
614
642
|
if (e !== "once" && e !== "session") throw TypeError("Approval scope is invalid");
|
|
615
643
|
return e;
|
|
616
644
|
}
|
|
617
645
|
}
|
|
618
|
-
function
|
|
646
|
+
function W(e) {
|
|
619
647
|
if (![
|
|
620
648
|
"ask-for-approval",
|
|
621
649
|
"approve-for-me",
|
|
@@ -623,21 +651,21 @@ function H(e) {
|
|
|
623
651
|
].includes(String(e))) throw TypeError("Conversation approval preset is invalid");
|
|
624
652
|
return e;
|
|
625
653
|
}
|
|
626
|
-
function
|
|
654
|
+
function G(e) {
|
|
627
655
|
if (e == null) return e;
|
|
628
656
|
if (typeof e != "number" || !Number.isFinite(e) || e <= 0) throw TypeError("Goal token budget must be a positive number or null");
|
|
629
657
|
return e;
|
|
630
658
|
}
|
|
631
|
-
function
|
|
632
|
-
let n =
|
|
659
|
+
function K(e, t) {
|
|
660
|
+
let n = R(e, t);
|
|
633
661
|
if (n.length > 1024) throw RangeError(`${t} is too long`);
|
|
634
662
|
return n;
|
|
635
663
|
}
|
|
636
|
-
function
|
|
664
|
+
function q(e) {
|
|
637
665
|
if (typeof e != "string" || e.length > 16 * 1024 * 1024 || !/^data:image\/(?:avif|bmp|gif|heic|heif|jpe?g|png|webp);base64,[a-z\d+/]+={0,2}$/i.test(e)) throw TypeError("Resolved message attachment preview must be a bounded image data URL");
|
|
638
666
|
return e;
|
|
639
667
|
}
|
|
640
|
-
function
|
|
668
|
+
function J(e, t = /* @__PURE__ */ new Set()) {
|
|
641
669
|
if (e === null || typeof e == "string" || typeof e == "boolean") return !0;
|
|
642
670
|
if (typeof e == "number") return Number.isFinite(e);
|
|
643
671
|
if (typeof e != "object" || t.has(e) || Reflect.ownKeys(e).some((e) => typeof e == "symbol")) return !1;
|
|
@@ -649,10 +677,10 @@ function K(e, t = /* @__PURE__ */ new Set()) {
|
|
|
649
677
|
if (t !== Object.prototype && t !== null || Object.keys(e).length !== Object.getOwnPropertyNames(e).length) return !1;
|
|
650
678
|
}
|
|
651
679
|
t.add(e);
|
|
652
|
-
let n = Array.isArray(e) ? e.every((e) =>
|
|
680
|
+
let n = Array.isArray(e) ? e.every((e) => J(e, t)) : Object.values(e).every((e) => J(e, t));
|
|
653
681
|
return t.delete(e), n;
|
|
654
682
|
}
|
|
655
683
|
//#endregion
|
|
656
684
|
export { y as a, f as c, r as d, t as f, d as i, p as l, i as m, g as n, u as o, e as p, m as r, v as s, c as t, n as u };
|
|
657
685
|
|
|
658
|
-
//# sourceMappingURL=surface-bridge-
|
|
686
|
+
//# sourceMappingURL=surface-bridge-CUuIfmG5.js.map
|