@canonmsg/agent-sdk 12.6.1 → 13.0.3
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/README.md +23 -21
- package/dist/chunks/{chunk-S7BV74DN.js → chunk-5WPAB5MB.js} +293 -8
- package/dist/chunks/{chunk-HH7KR22P.js → chunk-DTAWEQCM.js} +2 -2
- package/dist/chunks/{chunk-DAJ7L7TN.js → chunk-XKUG2BQR.js} +378 -663
- package/dist/chunks/{chunk-QK37HAHC.js → chunk-YHDDOADK.js} +1 -1
- package/dist/chunks/{chunk-FVYKLH6I.js → chunk-YJUPKU47.js} +20 -5
- package/dist/chunks/{chunk-5J4YPLNW.js → chunk-ZPBOGOAD.js} +267 -1217
- package/dist/chunks/{mls-crypto-4DZT2UFH.js → mls-crypto-NZVMSUFU.js} +2 -2
- package/dist/cli.js +32 -36
- package/dist/drivers/subprocess.d.ts +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +17 -0
- package/dist/internal/core/completed-output-journal.d.ts +0 -5
- package/dist/internal/core/index.d.ts +3 -9
- package/dist/internal/core/retry.d.ts +2 -89
- package/dist/internal/core/silent-turn.d.ts +4 -33
- package/dist/internal/endpoint/engine.d.ts +3 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +12 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +29 -0
- package/dist/internal/endpoint/transport.d.ts +1 -1
- package/dist/media.js +4 -4
- package/dist/mls-wasm-host.js +3 -3
- package/dist/runner/mls.d.ts +4 -7
- package/dist/runner/runner.d.ts +9 -12
- package/dist/runner/types.d.ts +31 -0
- package/package.json +1 -1
- package/dist/internal/core/approval-manager.d.ts +0 -43
- package/dist/internal/core/runtime-request-manager.d.ts +0 -283
- package/dist/internal/core/turn-verbosity.d.ts +0 -79
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseMlsDevEnrollmentPrincipal,
|
|
10
10
|
parseMlsDevIssuerKeyVersion,
|
|
11
11
|
parseMlsDevReceiptKeyVersion
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5WPAB5MB.js";
|
|
13
13
|
|
|
14
14
|
// ../endpoint/src/mls-crypto.ts
|
|
15
15
|
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
parseMlsDevKeyPackagePreparation,
|
|
44
44
|
parseMlsDevKeyPackagePublicationReceipt,
|
|
45
45
|
parseMlsDevKeyPackagePublish
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-5WPAB5MB.js";
|
|
47
47
|
|
|
48
48
|
// ../endpoint/src/events.ts
|
|
49
49
|
function createEndpointEventHub(input) {
|
|
@@ -611,13 +611,21 @@ __name(validateEndpointContentBoundary, "validateEndpointContentBoundary");
|
|
|
611
611
|
function createHttpEndpointTransport(options) {
|
|
612
612
|
const fetcher = options.fetch ?? globalThis.fetch;
|
|
613
613
|
const clientHeaders = options.client ? { [CANON_CLIENT_HEADER]: formatCanonClientHeader(options.client) } : {};
|
|
614
|
+
let clientUpdateRequired;
|
|
614
615
|
const updateRequired = /* @__PURE__ */ __name((error) => {
|
|
615
|
-
if (error.code === CLIENT_UPDATE_REQUIRED)
|
|
616
|
-
|
|
617
|
-
|
|
616
|
+
if (error.code === CLIENT_UPDATE_REQUIRED) {
|
|
617
|
+
if (clientUpdateRequired) return clientUpdateRequired;
|
|
618
|
+
clientUpdateRequired = error;
|
|
619
|
+
try {
|
|
620
|
+
options.onClientUpdateRequired?.(error);
|
|
621
|
+
} catch {
|
|
622
|
+
}
|
|
618
623
|
}
|
|
619
624
|
return error;
|
|
620
625
|
}, "updateRequired");
|
|
626
|
+
const assertClientSupported = /* @__PURE__ */ __name(() => {
|
|
627
|
+
if (clientUpdateRequired) throw clientUpdateRequired;
|
|
628
|
+
}, "assertClientSupported");
|
|
621
629
|
const baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
622
630
|
let resolvedStreamId;
|
|
623
631
|
function streamIdentity() {
|
|
@@ -639,7 +647,9 @@ function createHttpEndpointTransport(options) {
|
|
|
639
647
|
__name(ownershipHeaders, "ownershipHeaders");
|
|
640
648
|
async function call(path, method, body, signal, origin = baseUrl, groupResponse = false) {
|
|
641
649
|
for (let authAttempt = 0; authAttempt < 2; authAttempt++) {
|
|
650
|
+
if (path !== "/endpoint/capabilities") assertClientSupported();
|
|
642
651
|
const token = await options.credentials.getToken(authAttempt > 0);
|
|
652
|
+
if (path !== "/endpoint/capabilities") assertClientSupported();
|
|
643
653
|
if (!token) throw new EndpointError("Authentication is required", { status: 401, code: "UNAUTHENTICATED", retryable: false });
|
|
644
654
|
const controller = new AbortController();
|
|
645
655
|
const abort = /* @__PURE__ */ __name(() => controller.abort(signal?.reason), "abort");
|
|
@@ -694,9 +704,12 @@ function createHttpEndpointTransport(options) {
|
|
|
694
704
|
},
|
|
695
705
|
...options.streamUrl ? {
|
|
696
706
|
async *events(streamOptions) {
|
|
707
|
+
assertClientSupported();
|
|
697
708
|
const streamId = await streamIdentity();
|
|
698
709
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
710
|
+
assertClientSupported();
|
|
699
711
|
const token = await options.credentials.getToken(attempt > 0);
|
|
712
|
+
assertClientSupported();
|
|
700
713
|
if (!token) throw new EndpointError("Authentication is required", { status: 401, code: "UNAUTHENTICATED", retryable: false });
|
|
701
714
|
const connection = new AbortController();
|
|
702
715
|
const abort = /* @__PURE__ */ __name(() => connection.abort(streamOptions.signal.reason), "abort");
|
|
@@ -717,7 +730,7 @@ function createHttpEndpointTransport(options) {
|
|
|
717
730
|
await response.body?.cancel();
|
|
718
731
|
continue;
|
|
719
732
|
}
|
|
720
|
-
if (!response.ok) throw
|
|
733
|
+
if (!response.ok) throw await readHttpError(response, connection.signal);
|
|
721
734
|
if (!response.headers.get("Content-Type")?.toLowerCase().startsWith("text/event-stream")) {
|
|
722
735
|
await response.body?.cancel();
|
|
723
736
|
throw new EndpointError("Canon returned an invalid event stream", { status: 502, code: "INVALID_EVENT_STREAM" });
|
|
@@ -732,6 +745,8 @@ function createHttpEndpointTransport(options) {
|
|
|
732
745
|
yield event;
|
|
733
746
|
}
|
|
734
747
|
return;
|
|
748
|
+
} catch (error) {
|
|
749
|
+
throw error instanceof EndpointError ? updateRequired(error) : error;
|
|
735
750
|
} finally {
|
|
736
751
|
clearTimeout(handshake);
|
|
737
752
|
streamOptions.signal.removeEventListener("abort", abort);
|