@agents24/client 0.2.0 → 0.2.2
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 +36 -8
- package/compatibility.json +10 -10
- package/dist/adapters/browser.d.ts +83 -1
- package/dist/adapters/browser.js +303 -4
- package/dist/adapters/browser.js.map +1 -1
- package/dist/adapters/cloudflare.js +3 -3
- package/dist/adapters/node.js +3 -3
- package/dist/adapters/worker.js +3 -3
- package/dist/bff.js +39 -10
- package/dist/bff.js.map +1 -1
- package/dist/{chunk-QAIOKNUK.js → chunk-DEXGPNLL.js} +55 -11
- package/dist/chunk-DEXGPNLL.js.map +1 -0
- package/dist/{chunk-NGZUJ3YT.js → chunk-FLTCOJZR.js} +22 -7
- package/dist/chunk-FLTCOJZR.js.map +1 -0
- package/dist/{chunk-SCZMUBXD.js → chunk-LG3ZMQ2W.js} +47 -20
- package/dist/chunk-LG3ZMQ2W.js.map +1 -0
- package/dist/chunk-ZDLWNALI.js +569 -0
- package/dist/chunk-ZDLWNALI.js.map +1 -0
- package/dist/context-window.d.ts +16 -1
- package/dist/errors.d.ts +27 -2
- package/dist/generated/protocol.d.ts +34 -11
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -556
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +2 -2
- package/dist/protocol.js +31 -1
- package/dist/protocol.js.map +1 -1
- package/dist/runtime-types.d.ts +37 -2
- package/dist/types.d.ts +139 -8
- package/package.json +1 -1
- package/dist/chunk-NGZUJ3YT.js.map +0 -1
- package/dist/chunk-QAIOKNUK.js.map +0 -1
- package/dist/chunk-SCZMUBXD.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base64url.ts","../src/dpop.ts","../src/sessions.ts"],"names":[],"mappings":";;;AAAO,SAAS,gBAAgB,KAAA,EAA2B;AACzD,EAAA,MAAM,QAAA,GAAW,kEAAA;AACjB,EAAA,IAAI,MAAA,GAAS,EA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vB,MAAA,IAAI,WAAW,OAAA,CAAQ,SAAA,GAAY,KAAA,CAAM,GAAA,IAAO,OAAO,OAAA;AACvD,MAAA,OAAO,YAAA,CAAa,UAAU,OAAO,CAAA;AAAA,IACvC,CAAA;AAAA,IACA,MAAM,QAAQ,OAAA,EAAS;AACrB,MAAA,OAAO,YAAA,CAAa,UAAU,OAAO,CAAA,IAAK,QAAQ,MAAA,CAAO,IAAI,KAAA,CAAM,qBAAqB,CAAC,CAAA;AAAA,IAC3F,CAAA;AAAA,IACA,MAAM,OAAO,KAAA,EAAO;AAClB,MAAA,MAAM,YAAA,CAAa,SAAS,KAAK,CAAA;AACjC,MAAA,OAAA,GAAU,MAAA;AACV,MAAA,YAAA,GAAe,MAAA;AAAA,IACjB;AAAA,GACF;AACF","file":"chunk-ZDLWNALI.js","sourcesContent":["export function base64UrlEncode(bytes: Uint8Array): string {\n const alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n let output = \"\";\n for (let index = 0; index < bytes.length; index += 3) {\n const first = bytes[index] ?? 0;\n const second = bytes[index + 1];\n const third = bytes[index + 2];\n const packed = (first << 16) | ((second ?? 0) << 8) | (third ?? 0);\n output += alphabet[(packed >>> 18) & 63];\n output += alphabet[(packed >>> 12) & 63];\n output += second === undefined ? \"=\" : alphabet[(packed >>> 6) & 63];\n output += third === undefined ? \"=\" : alphabet[packed & 63];\n }\n return output.replace(/=/g, \"\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n}\n\nexport function utf8Bytes(input: string): Uint8Array {\n const Constructor = (globalThis as unknown as { TextEncoder?: new () => { encode(value: string): Uint8Array } }).TextEncoder;\n if (!Constructor) {\n throw new Error(\"TextEncoder capability is required.\");\n }\n return new Constructor().encode(input);\n}\n","import { base64UrlEncode } from \"./base64url.js\";\nimport { defaultClock, defaultIds, resolveEncoder } from \"./capabilities.js\";\nimport { Agents24ClientError, missingCapability } from \"./errors.js\";\nimport { canonicalHtu } from \"./url.js\";\nimport type { Clock, DpopKeyProvider, DpopProofInput, IdProvider, PublicJwk, TextEncoderLike } from \"./types.js\";\n\ntype CryptoKeyLike = object;\n\ninterface SubtleCryptoLike {\n generateKey(\n algorithm: { name: \"ECDSA\"; namedCurve: \"P-256\" },\n extractable: false,\n usages: readonly [\"sign\", \"verify\"],\n ): Promise<{ privateKey: CryptoKeyLike; publicKey: CryptoKeyLike }>;\n exportKey(format: \"jwk\", key: CryptoKeyLike): Promise<PublicJwk>;\n sign(algorithm: { name: \"ECDSA\"; hash: \"SHA-256\" }, key: CryptoKeyLike, data: Uint8Array): Promise<ArrayBuffer>;\n digest(algorithm: \"SHA-256\", data: Uint8Array): Promise<ArrayBuffer>;\n}\n\nexport interface WebCryptoLike {\n subtle: SubtleCryptoLike;\n getRandomValues?<T extends Uint8Array>(target: T): T;\n}\n\nexport interface DpopKeyHandle {\n privateKey: CryptoKeyLike;\n publicKey: CryptoKeyLike;\n}\n\nexport interface DpopKeyHandleStorage {\n load(): Promise<DpopKeyHandle | null>;\n save(handle: DpopKeyHandle): Promise<void>;\n clear?(): Promise<void>;\n}\n\nexport interface WebCryptoDpopOptions {\n crypto?: WebCryptoLike;\n storage?: DpopKeyHandleStorage;\n clock?: Clock;\n ids?: IdProvider;\n encoder?: TextEncoderLike;\n}\n\nfunction resolveCrypto(injected?: WebCryptoLike): WebCryptoLike {\n const value = injected ?? (globalThis as unknown as { crypto?: WebCryptoLike }).crypto;\n if (!value?.subtle) throw missingCapability(\"crypto.subtle\");\n return value;\n}\n\nfunction publicJwkOnly(jwk: PublicJwk): PublicJwk {\n if (jwk.kty !== \"EC\" || jwk.crv !== \"P-256\" || !jwk.x || !jwk.y) {\n throw new Agents24ClientError(\"DPoP requires a P-256 public key.\", {\n kind: \"configuration\",\n code: \"INVALID_DPOP_KEY\",\n });\n }\n return { kty: \"EC\", crv: \"P-256\", x: jwk.x, y: jwk.y };\n}\n\nasync function hash(subtle: SubtleCryptoLike, encoder: TextEncoderLike, input: string): Promise<string> {\n return base64UrlEncode(new Uint8Array(await subtle.digest(\"SHA-256\", encoder.encode(input))));\n}\n\nexport function createWebCryptoDpopKeyProvider(options: WebCryptoDpopOptions = {}): DpopKeyProvider {\n const crypto = resolveCrypto(options.crypto);\n const clock = options.clock ?? defaultClock();\n const ids = options.ids ?? defaultIds();\n const encoder = resolveEncoder(options.encoder);\n let handlePromise: Promise<DpopKeyHandle> | undefined;\n let jwkPromise: Promise<PublicJwk> | undefined;\n\n const getHandle = (): Promise<DpopKeyHandle> => {\n if (!handlePromise) {\n handlePromise = (async () => {\n const stored = await options.storage?.load();\n if (stored) return stored;\n const generated = await crypto.subtle.generateKey(\n { name: \"ECDSA\", namedCurve: \"P-256\" },\n false,\n [\"sign\", \"verify\"],\n );\n await options.storage?.save(generated);\n return generated;\n })();\n }\n return handlePromise;\n };\n\n const getPublicJwk = (): Promise<PublicJwk> => {\n if (!jwkPromise) {\n jwkPromise = getHandle().then(async (handle) => publicJwkOnly(await crypto.subtle.exportKey(\"jwk\", handle.publicKey)));\n }\n return jwkPromise;\n };\n\n return {\n getPublicJwk,\n async getThumbprint() {\n const jwk = await getPublicJwk();\n return hash(crypto.subtle, encoder, JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y }));\n },\n async signProof(input: DpopProofInput) {\n const jwk = await getPublicJwk();\n const header = base64UrlEncode(encoder.encode(JSON.stringify({ typ: \"dpop+jwt\", alg: \"ES256\", jwk })));\n const claims: Record<string, string | number> = {\n jti: ids.createId(),\n htm: input.method.toUpperCase(),\n htu: canonicalHtu(input.url),\n iat: Math.floor(clock.now() / 1000),\n };\n if (input.accessToken) claims.ath = await hash(crypto.subtle, encoder, input.accessToken);\n if (input.nonce) claims.nonce = input.nonce;\n const payload = base64UrlEncode(encoder.encode(JSON.stringify(claims)));\n const signingInput = `${header}.${payload}`;\n const handle = await getHandle();\n const signature = new Uint8Array(\n await crypto.subtle.sign({ name: \"ECDSA\", hash: \"SHA-256\" }, handle.privateKey, encoder.encode(signingInput)),\n );\n if (signature.byteLength !== 64) {\n throw new Agents24ClientError(\"The WebCrypto provider returned a non-JOSE ECDSA signature.\", {\n kind: \"configuration\",\n code: \"INVALID_DPOP_SIGNATURE\",\n });\n }\n return `${signingInput}.${base64UrlEncode(signature)}`;\n },\n };\n}\n\nexport async function createPkcePair(\n cryptoInput?: WebCryptoLike,\n encoderInput?: TextEncoderLike,\n): Promise<{ verifier: string; challenge: string }> {\n const crypto = resolveCrypto(cryptoInput);\n const encoder = resolveEncoder(encoderInput);\n const random = new Uint8Array(32);\n const getRandomValues = crypto.getRandomValues?.bind(crypto);\n if (!getRandomValues) throw missingCapability(\"crypto.getRandomValues\");\n getRandomValues(random);\n const verifier = base64UrlEncode(random);\n return { verifier, challenge: await hash(crypto.subtle, encoder, verifier) };\n}\n","import { defaultClock, defaultIds, resolveFetch } from \"./capabilities.js\";\nimport { Agents24ClientError } from \"./errors.js\";\nimport { AuthenticatedHttp, dpopTokenRequest, responseError, responseJson } from \"./http.js\";\nimport { absoluteUrl, encodePath, normalizeBaseUrl } from \"./url.js\";\nimport type {\n AbortSignalLike,\n ClientSessionAccess,\n ClientSessionProvider,\n ClientSessionStorage,\n Clock,\n DpopKeyProvider,\n FetchLike,\n IdProvider,\n SessionRefreshCoordinator,\n SessionRefreshFenceRecord,\n SessionRefreshFenceStorage,\n SessionRefreshLease,\n TelemetrySink,\n WaitCapability,\n} from \"./types.js\";\n\ntype SessionTokenBody = {\n access_token?: unknown;\n token_type?: unknown;\n expires_in?: unknown;\n expires_at?: unknown;\n refresh_grant?: unknown;\n refresh_expires_at?: unknown;\n refresh_grant_absolute_expires_at?: unknown;\n session_id?: unknown;\n capabilities?: unknown;\n dpop_nonce?: unknown;\n};\n\nfunction parseSessionToken(\n value: unknown,\n options: { clock: Clock; dpopKeyProvider?: DpopKeyProvider | undefined },\n): { access: ClientSessionAccess; refreshGrant?: string; absoluteExpiresAt?: string } {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n throw new Agents24ClientError(\"The session endpoint returned an invalid response.\", {\n kind: \"protocol\",\n code: \"INVALID_SESSION_RESPONSE\",\n });\n }\n const body = value as SessionTokenBody;\n if (typeof body.access_token !== \"string\" || !body.access_token || /[\\r\\n\\0]/.test(body.access_token)) {\n throw new Agents24ClientError(\"The session endpoint returned an invalid access token.\", {\n kind: \"protocol\",\n code: \"INVALID_SESSION_RESPONSE\",\n });\n }\n const tokenType = body.token_type === \"DPoP\" ? \"DPoP\" : body.token_type === \"Bearer\" ? \"Bearer\" : undefined;\n if (!tokenType || (tokenType === \"DPoP\" && !options.dpopKeyProvider)) {\n throw new Agents24ClientError(\"The session endpoint returned an unsupported token profile.\", {\n kind: \"protocol\",\n code: \"INVALID_TOKEN_PROFILE\",\n });\n }\n const parsedExpiresAt = typeof body.expires_at === \"string\" ? Date.parse(body.expires_at) : Number.NaN;\n const expiresIn = typeof body.expires_in === \"number\" && Number.isFinite(body.expires_in) ? body.expires_in : 0;\n const expiresAt = Number.isFinite(parsedExpiresAt) ? parsedExpiresAt : options.clock.now() + expiresIn * 1000;\n if (!Number.isFinite(expiresAt) || expiresAt <= options.clock.now()) {\n throw new Agents24ClientError(\"The session endpoint returned an expired access token.\", {\n kind: \"protocol\",\n code: \"INVALID_SESSION_EXPIRY\",\n });\n }\n const refreshGrant = typeof body.refresh_grant === \"string\" && body.refresh_grant && !/[\\r\\n\\0]/.test(body.refresh_grant)\n ? body.refresh_grant\n : undefined;\n if (body.refresh_grant !== undefined && !refreshGrant) {\n throw new Agents24ClientError(\"The session endpoint returned an invalid refresh grant.\", {\n kind: \"protocol\",\n code: \"INVALID_SESSION_RESPONSE\",\n });\n }\n if (refreshGrant && (tokenType !== \"DPoP\" || !options.dpopKeyProvider)) {\n throw new Agents24ClientError(\"Persistent sessions require a DPoP-bound token profile.\", {\n kind: \"protocol\",\n code: \"INVALID_TOKEN_PROFILE\",\n });\n }\n return {\n access: {\n accessToken: body.access_token,\n tokenType,\n expiresAt,\n ...(typeof body.session_id === \"string\" ? { sessionId: body.session_id } : {}),\n ...(Array.isArray(body.capabilities) && body.capabilities.every((item) => typeof item === \"string\")\n ? { capabilities: body.capabilities as string[] }\n : {}),\n ...(options.dpopKeyProvider ? { dpopKeyProvider: options.dpopKeyProvider } : {}),\n ...(typeof body.dpop_nonce === \"string\" ? { dpopNonce: body.dpop_nonce } : {}),\n },\n ...(refreshGrant ? { refreshGrant } : {}),\n ...(typeof (body.refresh_expires_at ?? body.refresh_grant_absolute_expires_at) === \"string\"\n ? { absoluteExpiresAt: (body.refresh_expires_at ?? body.refresh_grant_absolute_expires_at) as string }\n : {}),\n };\n}\n\nfunction refreshFenceLost(): Agents24ClientError {\n return new Agents24ClientError(\"Refresh coordination ownership changed before completion.\", {\n kind: \"conflict\",\n code: \"REFRESH_FENCE_LOST\",\n retryable: true,\n });\n}\n\nfunction sessionRequestAborted(): Agents24ClientError {\n return new Agents24ClientError(\"The session request was locally detached.\", {\n kind: \"aborted\",\n code: \"ABORTED\",\n retryable: false,\n });\n}\n\nfunction defaultWait(milliseconds: number): Promise<void> {\n const schedule = (globalThis as unknown as {\n setTimeout?: (callback: () => void, delay: number) => unknown;\n }).setTimeout;\n if (!schedule) {\n throw new Agents24ClientError(\"Cross-runtime refresh coordination requires a wait capability.\", {\n kind: \"missing_capability\",\n code: \"MISSING_WAIT_CAPABILITY\",\n });\n }\n return new Promise((resolve) => schedule(resolve, milliseconds));\n}\n\nexport interface FencedRefreshCoordinatorOptions {\n storage: SessionRefreshFenceStorage;\n clock?: Clock;\n ids?: IdProvider;\n ownerId?: string;\n leaseDurationMs?: number;\n pollIntervalMs?: number;\n wait?: WaitCapability;\n}\n\n/**\n * Coordinates refresh-grant rotation across tabs/processes through an injected\n * atomic compare-and-swap store. Takeovers retain the same operation ID so a\n * timed-out owner and its successor address one server idempotency record.\n */\nexport function createFencedRefreshCoordinator(\n options: FencedRefreshCoordinatorOptions,\n): SessionRefreshCoordinator {\n const clock = options.clock ?? defaultClock();\n const ids = options.ids ?? defaultIds();\n const ownerId = options.ownerId ?? ids.createId();\n const leaseDurationMs = Math.max(1_000, options.leaseDurationMs ?? 60_000);\n const pollIntervalMs = Math.max(10, options.pollIntervalMs ?? 100);\n const wait = options.wait ?? defaultWait;\n let local: Promise<unknown> | undefined;\n\n const assertActive = async (record: SessionRefreshFenceRecord): Promise<void> => {\n const current = await options.storage.load();\n if (\n !current?.active ||\n current.fence !== record.fence ||\n current.operationId !== record.operationId ||\n current.ownerId !== ownerId ||\n current.expiresAt <= clock.now()\n ) {\n throw refreshFenceLost();\n }\n };\n\n const acquire = async (): Promise<SessionRefreshFenceRecord> => {\n while (true) {\n const current = await options.storage.load();\n const now = clock.now();\n if (current?.active && current.expiresAt > now) {\n await wait(Math.max(1, Math.min(pollIntervalMs, current.expiresAt - now)));\n continue;\n }\n const next: SessionRefreshFenceRecord = {\n active: true,\n expiresAt: now + leaseDurationMs,\n fence: (current?.fence ?? 0) + 1,\n operationId: current?.active ? current.operationId : ids.createId(),\n ownerId,\n };\n if (await options.storage.compareAndSwap(current?.fence ?? null, next)) return next;\n }\n };\n\n return {\n async runExclusive<T>(operation: (lease: SessionRefreshLease) => Promise<T>): Promise<T> {\n if (local) return local as Promise<T>;\n const pending = (async () => {\n const record = await acquire();\n const lease: SessionRefreshLease = {\n fence: record.fence,\n operationId: record.operationId,\n assertActive: () => assertActive(record),\n };\n try {\n return await operation(lease);\n } finally {\n const current = await options.storage.load();\n if (\n current?.active &&\n current.fence === record.fence &&\n current.operationId === record.operationId &&\n current.ownerId === ownerId\n ) {\n await options.storage.compareAndSwap(current.fence, {\n ...current,\n active: false,\n expiresAt: clock.now(),\n });\n }\n }\n })();\n local = pending;\n try {\n return await pending;\n } finally {\n if (local === pending) local = undefined;\n }\n },\n };\n}\n\nexport function createInMemoryRefreshCoordinator(): SessionRefreshCoordinator {\n let active: Promise<unknown> | undefined;\n let fence = 0;\n return {\n async runExclusive<T>(operation: (lease: SessionRefreshLease) => Promise<T>): Promise<T> {\n if (active) return active as Promise<T>;\n fence += 1;\n const ownedFence = fence;\n const current = Promise.resolve().then(() => operation({\n fence: ownedFence,\n operationId: `memory-refresh-${ownedFence}`,\n async assertActive() {\n if (active !== current) throw refreshFenceLost();\n },\n }));\n active = current;\n try {\n return await current;\n } finally {\n if (active === current) active = undefined;\n }\n },\n };\n}\n\nexport function createStaticSessionProvider(access: ClientSessionAccess): ClientSessionProvider {\n return {\n async getAccess() {\n return access;\n },\n };\n}\n\nexport interface ManagedSessionProviderOptions {\n baseUrl: string;\n deploymentId: string;\n fetch?: FetchLike;\n dpopKeyProvider?: DpopKeyProvider | undefined;\n storage?: ClientSessionStorage;\n coordinator?: SessionRefreshCoordinator;\n clock?: Clock;\n ids?: IdProvider;\n telemetry?: TelemetrySink;\n mint(input: {\n fetch: FetchLike;\n url: string;\n dpopKeyProvider?: DpopKeyProvider | undefined;\n signal?: AbortSignalLike | undefined;\n }): Promise<unknown>;\n}\n\nfunction createManagedSessionProviderInternal(\n options: ManagedSessionProviderOptions,\n recoverInvalidRefreshWithMint: boolean,\n): ClientSessionProvider {\n if (options.storage && !options.dpopKeyProvider) {\n throw new Agents24ClientError(\"Persistent session storage requires a DPoP key provider.\", {\n kind: \"configuration\",\n code: \"PERSISTENT_SESSION_REQUIRES_DPOP\",\n });\n }\n const baseUrl = normalizeBaseUrl(options.baseUrl);\n const fetch = resolveFetch(options.fetch);\n const clock = options.clock ?? defaultClock();\n const ids = options.ids ?? defaultIds();\n const coordinator = options.coordinator ?? createInMemoryRefreshCoordinator();\n let current: ClientSessionAccess | undefined;\n let refreshGrant: string | undefined;\n let minting: Promise<ClientSessionAccess> | undefined;\n\n const emit = async (event: Parameters<TelemetrySink[\"emit\"]>[0]): Promise<void> => {\n try {\n await options.telemetry?.emit(event);\n } catch {\n // Session telemetry is noncredential and cannot affect authentication.\n }\n };\n\n const loadStored = async (): Promise<Awaited<ReturnType<ClientSessionStorage[\"load\"]>>> => {\n const stored = await options.storage?.load() ?? null;\n if (!stored) return null;\n if (!stored.refreshGrant || /[\\r\\n\\0]/.test(stored.refreshGrant)) {\n throw new Agents24ClientError(\"Stored session state is invalid.\", {\n kind: \"authentication\",\n code: \"INVALID_STORED_SESSION\",\n });\n }\n if (stored.absoluteExpiresAt) {\n const absoluteExpiry = Date.parse(stored.absoluteExpiresAt);\n if (!Number.isFinite(absoluteExpiry) || absoluteExpiry <= clock.now()) {\n await options.storage?.clear();\n throw new Agents24ClientError(\"The persistent session has expired.\", {\n kind: \"authentication\",\n code: \"SESSION_EXPIRED\",\n });\n }\n }\n return stored;\n };\n\n const save = async (parsed: ReturnType<typeof parseSessionToken>): Promise<void> => {\n current = parsed.access;\n if (parsed.refreshGrant) refreshGrant = parsed.refreshGrant;\n if (refreshGrant && options.storage) {\n await options.storage.save({\n refreshGrant,\n ...(current.sessionId ? { sessionId: current.sessionId } : {}),\n ...(parsed.absoluteExpiresAt ? { absoluteExpiresAt: parsed.absoluteExpiresAt } : {}),\n });\n }\n };\n\n const mint = async (signal?: AbortSignalLike): Promise<ClientSessionAccess> => {\n if (signal?.aborted) throw sessionRequestAborted();\n if (!minting) {\n const url = absoluteUrl(baseUrl, `/public/client-runtime/deployments/${encodePath(options.deploymentId)}/sessions/anonymous`);\n minting = options\n // Session establishment is shared infrastructure. Once started, it must\n // finish even if the request which triggered it is disposed by React.\n .mint({ fetch, url, dpopKeyProvider: options.dpopKeyProvider })\n .then(async (value) => {\n const parsed = parseSessionToken(value, { clock, dpopKeyProvider: options.dpopKeyProvider });\n await save(parsed);\n return parsed.access;\n })\n .finally(() => {\n minting = undefined;\n });\n }\n return minting;\n };\n\n const refresh = async (signal?: AbortSignalLike): Promise<ClientSessionAccess> =>\n coordinator.runExclusive(async (lease) => {\n if (signal?.aborted) throw sessionRequestAborted();\n if (options.storage) {\n // Another tab may have rotated while this caller waited for the fence.\n // The persisted record is canonical after lease acquisition.\n const stored = await loadStored();\n if (stored?.refreshGrant) refreshGrant = stored.refreshGrant;\n }\n if (!refreshGrant) return mint(signal);\n await lease.assertActive();\n const response = await dpopTokenRequest({\n fetch,\n url: absoluteUrl(baseUrl, \"/public/client-runtime/sessions/refresh\"),\n body: { refresh_grant: refreshGrant },\n dpopKeyProvider: options.dpopKeyProvider,\n // Refresh grants rotate exactly once. Never abandon the credential\n // transaction because a consuming request was locally cancelled.\n idempotencyKey: lease.operationId,\n });\n if (!response.ok) {\n if (response.status === 400 || response.status === 401 || response.status === 403) {\n await lease.assertActive();\n await options.storage?.clear();\n refreshGrant = undefined;\n current = undefined;\n if (recoverInvalidRefreshWithMint) return mint(signal);\n }\n throw await responseError(response);\n }\n await lease.assertActive();\n const parsed = parseSessionToken(await responseJson(response), { clock, dpopKeyProvider: options.dpopKeyProvider });\n await save(parsed);\n await emit({ type: \"session.refreshed\", operation: \"session\" });\n return parsed.access;\n });\n\n let provider: ClientSessionProvider;\n provider = {\n async getAccess(context) {\n if (current && current.expiresAt > clock.now()) return current;\n if (refreshGrant || (await loadStored())?.refreshGrant) return refresh(context.signal);\n return mint(context.signal);\n },\n async refresh(context) {\n return refresh(context.signal);\n },\n async revoke(input) {\n const authenticated = new AuthenticatedHttp({\n baseUrl,\n sessionProvider: provider,\n fetch,\n clock,\n });\n await authenticated.json<unknown>(\"POST\", \"/public/client-runtime/sessions/revoke\", {\n operation: \"sessions.revoke\",\n idempotencyKey: input?.idempotencyKey ?? ids.createId(),\n ...(input?.signal ? { signal: input.signal } : {}),\n });\n current = undefined;\n refreshGrant = undefined;\n await options.storage?.clear();\n await emit({ type: \"session.revoked\", operation: \"session\" });\n },\n };\n return provider;\n}\n\nexport function createManagedSessionProvider(options: ManagedSessionProviderOptions): ClientSessionProvider {\n return createManagedSessionProviderInternal(options, false);\n}\n\nexport interface AnonymousSessionProviderOptions\n extends Omit<ManagedSessionProviderOptions, \"mint\"> {\n persistent?: boolean;\n nativeProfileId?: string;\n requestedCapabilities?: readonly string[];\n attestation?: string;\n}\n\nexport function createAnonymousSessionProvider(options: AnonymousSessionProviderOptions): ClientSessionProvider {\n if ((options.persistent || options.nativeProfileId) && !options.dpopKeyProvider) {\n throw new Agents24ClientError(\"Persistent and native anonymous sessions require a DPoP key provider.\", {\n kind: \"configuration\",\n code: \"MISSING_DPOP_PROVIDER\",\n });\n }\n return createManagedSessionProviderInternal(\n {\n ...options,\n async mint({ fetch, url, dpopKeyProvider, signal }) {\n const response = await dpopTokenRequest({\n fetch,\n url,\n body: {\n persistent: options.persistent ?? false,\n requested_capabilities: [...(options.requestedCapabilities ?? [])],\n ...(options.nativeProfileId ? { native_profile_id: options.nativeProfileId } : {}),\n ...(dpopKeyProvider ? { dpop_public_jwk: await dpopKeyProvider.getPublicJwk() } : {}),\n ...(options.attestation ? { attestation: options.attestation } : {}),\n },\n dpopKeyProvider,\n prooflessInitialRequest: Boolean(dpopKeyProvider),\n signal,\n });\n if (!response.ok) throw await responseError(response);\n return responseJson(response);\n },\n },\n true,\n );\n}\n\nexport interface HostedOidcSessionProvider extends ClientSessionProvider {\n beginAuthorization(input: {\n redirectUri: string;\n codeChallenge: string;\n nativeProfileId?: string;\n signal?: AbortSignalLike;\n }): Promise<{ authorizationUrl: string }>;\n exchange(input: { code: string; codeVerifier: string; signal?: AbortSignalLike }): Promise<ClientSessionAccess>;\n}\n\nexport interface HostedOidcSessionProviderOptions\n extends Omit<ManagedSessionProviderOptions, \"mint\"> {\n dpopKeyProvider: DpopKeyProvider;\n redirectUri?: string;\n}\n\nexport function createHostedOidcSessionProvider(options: HostedOidcSessionProviderOptions): HostedOidcSessionProvider {\n const baseUrl = normalizeBaseUrl(options.baseUrl);\n const fetch = resolveFetch(options.fetch);\n const clock = options.clock ?? defaultClock();\n let current: ClientSessionAccess | undefined;\n let refreshGrant: string | undefined;\n let enrollmentNonce: string | undefined;\n const ids = options.ids ?? defaultIds();\n let memoryRecord: Awaited<ReturnType<ClientSessionStorage[\"load\"]>> = null;\n const effectiveStorage: ClientSessionStorage = {\n async load() {\n return (await options.storage?.load()) ?? memoryRecord;\n },\n async save(record) {\n memoryRecord = record;\n await options.storage?.save(record);\n },\n async clear() {\n memoryRecord = null;\n await options.storage?.clear();\n },\n };\n const baseProvider = createManagedSessionProvider({\n ...options,\n storage: effectiveStorage,\n async mint() {\n throw new Agents24ClientError(\"Complete the hosted OIDC authorization before requesting access.\", {\n kind: \"authentication\",\n code: \"OIDC_AUTHORIZATION_REQUIRED\",\n });\n },\n });\n\n return {\n async beginAuthorization(input) {\n const url = absoluteUrl(\n baseUrl,\n `/public/client-runtime/deployments/${encodePath(options.deploymentId)}/sessions/oidc/authorize`,\n );\n const response = await dpopTokenRequest({\n fetch,\n url,\n dpopKeyProvider: options.dpopKeyProvider,\n signal: input.signal,\n body: {\n redirect_uri: input.redirectUri,\n code_challenge: input.codeChallenge,\n code_challenge_method: \"S256\",\n persistent: true,\n dpop_public_jwk: await options.dpopKeyProvider.getPublicJwk(),\n ...(input.nativeProfileId ? { native_profile_id: input.nativeProfileId } : {}),\n },\n });\n if (!response.ok) throw await responseError(response);\n const body = (await responseJson(response)) as Record<string, unknown>;\n if (typeof body.authorization_url !== \"string\") {\n throw new Agents24ClientError(\"The OIDC endpoint returned an invalid authorization URL.\", {\n kind: \"protocol\",\n code: \"INVALID_OIDC_RESPONSE\",\n });\n }\n if (typeof body.dpop_nonce !== \"string\" || !body.dpop_nonce) {\n throw new Agents24ClientError(\"The OIDC endpoint did not return a DPoP enrollment nonce.\", {\n kind: \"protocol\",\n code: \"INVALID_OIDC_RESPONSE\",\n });\n }\n enrollmentNonce = body.dpop_nonce;\n return { authorizationUrl: body.authorization_url };\n },\n async exchange(input) {\n const response = await dpopTokenRequest({\n fetch,\n url: absoluteUrl(\n baseUrl,\n `/public/client-runtime/deployments/${encodePath(options.deploymentId)}/sessions/oidc/exchange`,\n ),\n dpopKeyProvider: options.dpopKeyProvider,\n signal: input.signal,\n idempotencyKey: ids.createId(),\n nonce: enrollmentNonce,\n body: { code: input.code, code_verifier: input.codeVerifier },\n });\n if (!response.ok) throw await responseError(response);\n const parsed = parseSessionToken(await responseJson(response), {\n clock,\n dpopKeyProvider: options.dpopKeyProvider,\n });\n current = parsed.access;\n enrollmentNonce = undefined;\n refreshGrant = parsed.refreshGrant;\n if (refreshGrant) {\n await effectiveStorage.save({\n refreshGrant,\n ...(current.sessionId ? { sessionId: current.sessionId } : {}),\n ...(parsed.absoluteExpiresAt ? { absoluteExpiresAt: parsed.absoluteExpiresAt } : {}),\n });\n }\n return current;\n },\n async getAccess(context) {\n if (current && current.expiresAt > clock.now()) return current;\n return baseProvider.getAccess(context);\n },\n async refresh(context) {\n return baseProvider.refresh?.(context) ?? Promise.reject(new Error(\"Refresh unavailable\"));\n },\n async revoke(input) {\n await baseProvider.revoke?.(input);\n current = undefined;\n refreshGrant = undefined;\n },\n };\n}\n"]}
|
package/dist/context-window.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
export type ContextWindowSource = "exact" | "estimated" | "provider_count_api" | "provider_usage" | "provider_cached_estimate" | "runtime_tokenizer" | "hf_tokenizer" | "multimodal_estimate" | "text_estimate" | "tokenizer_estimate" | "heuristic_estimate" | "unknown";
|
|
1
|
+
export type ContextWindowSource = "exact" | "estimated" | "provider_count_api" | "provider_usage" | "provider_cached_estimate" | "runtime_tokenizer" | "hf_tokenizer" | "lab_tokenizer" | "tiktoken" | "multimodal_estimate" | "text_estimate" | "tokenizer_estimate" | "heuristic_estimate" | "unknown";
|
|
2
2
|
export type ContextWindowStage = "preflight" | "sent_prompt" | "final_usage";
|
|
3
3
|
export type ContextWindowConfidence = "exact" | "high" | "medium" | "low" | "unknown";
|
|
4
4
|
export type ContextCompression = {
|
|
5
5
|
active: boolean;
|
|
6
|
+
status?: "started" | "completed" | "failed" | null;
|
|
7
|
+
strategy?: "artifact_references" | "semantic_checkpoint" | null;
|
|
6
8
|
reason?: string | null;
|
|
7
9
|
input_tokens?: number | null;
|
|
8
10
|
max_tokens?: number | null;
|
|
9
11
|
usage_ratio?: number | null;
|
|
12
|
+
admission_input_tokens?: number | null;
|
|
13
|
+
admission_input_tokens_before?: number | null;
|
|
14
|
+
admission_input_tokens_after?: number | null;
|
|
15
|
+
admission_ratio?: number | null;
|
|
16
|
+
admission_confidence?: ContextWindowConfidence | null;
|
|
17
|
+
applied_margin?: number | null;
|
|
10
18
|
full_frame_count?: number | null;
|
|
11
19
|
compact_frame_count?: number | null;
|
|
12
20
|
dropped_frame_count?: number | null;
|
|
13
21
|
artifact_ref_count?: number | null;
|
|
22
|
+
checkpoint_frame_count?: number | null;
|
|
23
|
+
input_tokens_before?: number | null;
|
|
24
|
+
input_tokens_after?: number | null;
|
|
14
25
|
compression_trigger_budget?: number | null;
|
|
15
26
|
compression_target_budget?: number | null;
|
|
16
27
|
compression_target_ratio?: number | null;
|
|
@@ -28,6 +39,10 @@ export type ContextWindow = {
|
|
|
28
39
|
input_tokens?: number | null;
|
|
29
40
|
remaining_tokens?: number | null;
|
|
30
41
|
usage_ratio?: number | null;
|
|
42
|
+
admission_input_tokens?: number | null;
|
|
43
|
+
admission_ratio?: number | null;
|
|
44
|
+
admission_confidence?: ContextWindowConfidence | null;
|
|
45
|
+
applied_margin?: number | null;
|
|
31
46
|
assembly?: Record<string, unknown> | null;
|
|
32
47
|
context_compression?: ContextCompression | null;
|
|
33
48
|
};
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,25 +1,50 @@
|
|
|
1
1
|
export type Agents24ErrorKind = "configuration" | "missing_capability" | "authentication" | "authorization" | "not_found" | "conflict" | "quota" | "rate_limit" | "validation" | "protocol" | "network" | "aborted" | "server";
|
|
2
|
-
export interface
|
|
2
|
+
export interface FailureView {
|
|
3
|
+
schema_version: "agents24.failure.v1";
|
|
4
|
+
failure_id: string;
|
|
3
5
|
code: string;
|
|
6
|
+
category: string;
|
|
4
7
|
message: string;
|
|
5
|
-
request_id: string;
|
|
6
8
|
retryable: boolean;
|
|
9
|
+
request_id: string | null;
|
|
10
|
+
retry_after_ms: number | null;
|
|
11
|
+
details: Readonly<Record<string, unknown>>;
|
|
12
|
+
}
|
|
13
|
+
export interface ResourcePolicyViolation {
|
|
14
|
+
policy_subject_type: "agent" | "client_deployment" | "user";
|
|
15
|
+
rule_type: "allow" | "quota";
|
|
16
|
+
resource_type: "agent" | "model" | "tool" | "toolset" | "knowledge_store";
|
|
17
|
+
resource_name: string;
|
|
18
|
+
aggregation_scope?: "subject" | "consumer";
|
|
19
|
+
quota_unit?: "tokens";
|
|
20
|
+
quota_window?: "monthly";
|
|
21
|
+
limit?: number;
|
|
22
|
+
remaining?: number;
|
|
23
|
+
resets_at?: string;
|
|
7
24
|
}
|
|
8
25
|
export declare class Agents24ClientError extends Error {
|
|
9
26
|
readonly kind: Agents24ErrorKind;
|
|
10
27
|
readonly code: string;
|
|
11
28
|
readonly status: number | undefined;
|
|
29
|
+
readonly failure: FailureView | undefined;
|
|
12
30
|
readonly requestId: string | undefined;
|
|
13
31
|
readonly retryable: boolean;
|
|
32
|
+
readonly violations: readonly ResourcePolicyViolation[];
|
|
14
33
|
readonly cause?: unknown;
|
|
15
34
|
constructor(message: string, options: {
|
|
16
35
|
kind: Agents24ErrorKind;
|
|
17
36
|
code?: string;
|
|
18
37
|
status?: number;
|
|
38
|
+
failure?: FailureView;
|
|
19
39
|
requestId?: string;
|
|
20
40
|
retryable?: boolean;
|
|
41
|
+
violations?: readonly ResourcePolicyViolation[];
|
|
21
42
|
cause?: unknown;
|
|
22
43
|
});
|
|
44
|
+
get failureId(): string | undefined;
|
|
45
|
+
get category(): string | undefined;
|
|
46
|
+
get retryAfterMs(): number | undefined;
|
|
47
|
+
get details(): Readonly<Record<string, unknown>>;
|
|
23
48
|
}
|
|
24
49
|
export declare function missingCapability(name: string): Agents24ClientError;
|
|
25
50
|
export declare function abortedError(cause?: unknown): Agents24ClientError;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @generated by @agents24/sdk-contract; DO NOT EDIT.
|
|
2
|
-
// contract-sha256:
|
|
2
|
+
// contract-sha256: a409af6996d10a8d94e0f6332c9a381c3535a9c8511314b6c42b237d7e057029
|
|
3
3
|
export type ProtocolErrorCategory =
|
|
4
4
|
| "invalid_json"
|
|
5
5
|
| "invalid_envelope"
|
|
@@ -13,32 +13,55 @@ export type JsonScalar = string | number | boolean | null;
|
|
|
13
13
|
export type JsonValue = JsonScalar | JsonValue[] | { [key: string]: JsonValue };
|
|
14
14
|
export type PublicResponseBlock = {
|
|
15
15
|
id: string;
|
|
16
|
-
kind: "assistant_text" | "reasoning_note" | "tool_call" | "ui_blocks" | "hitl_request" | "error" | "source" | "citation" | "attachment" | "mcp_authorization" | "user_message";
|
|
16
|
+
kind: "assistant_text" | "reasoning_note" | "context_compression" | "node_activity" | "tool_call" | "ui_blocks" | "hitl_request" | "error" | "source" | "citation" | "attachment" | "mcp_authorization" | "user_message";
|
|
17
17
|
seq: number;
|
|
18
18
|
status: string;
|
|
19
19
|
[key: string]: unknown;
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
export type RuntimeEventPayload = Record<string, unknown> & {
|
|
22
|
+
response_block?: PublicResponseBlock;
|
|
23
|
+
};
|
|
24
|
+
export type ModelTurnKind = "agent" | "model";
|
|
25
|
+
export type ModelTurnStatus = "running" | "completed" | "failed";
|
|
26
|
+
export type ModelTurnOutcome = "text" | "tool_calls" | "completed";
|
|
27
|
+
export type ModelTurnEventName = "model.turn.started" | "model.turn.completed" | "model.turn.failed";
|
|
28
|
+
export type ModelTurnPayload = Record<string, unknown> & {
|
|
29
|
+
model_turn_id: string;
|
|
30
|
+
kind: ModelTurnKind;
|
|
31
|
+
status: ModelTurnStatus;
|
|
32
|
+
iteration?: number;
|
|
33
|
+
outcome?: ModelTurnOutcome;
|
|
34
|
+
};
|
|
35
|
+
export type RuntimeEventName = "run.accepted" | "run.snapshot" | "run.completed" | "run.cancelled" | "run.paused" | "run.failed" | "run.detached" | "assistant.delta" | "model.turn.started" | "model.turn.completed" | "model.turn.failed" | "reasoning.update" | "node.status.updated" | "tool.started" | "tool.completed" | "tool.failed" | "tool.cancelled" | "tool.child_run_started" | "tool.child_run_finished" | "tool.child_tool_started" | "tool.child_tool_completed" | "tool.child_tool_failed" | "tool.child_tool_cancelled" | "context_window.updated" | "context.compression.updated" | "run_usage.updated" | "hitl.requested" | "hitl.resolved" | "mcp.authorization.required" | "mcp.authorization.completed" | "mcp.authorization.failed" | "attachment.created" | "attachment.updated" | "attachment.ready" | "attachment.failed" | "source.added" | "citation.added" | "ui_blocks.updated";
|
|
36
|
+
export type RuntimeStage = "run" | "assistant" | "model" | "reasoning" | "node" | "tool" | "context" | "usage" | "attachment" | "source" | "system";
|
|
37
|
+
type RuntimeEventEnvelope = {
|
|
38
|
+
version: "run-stream.v3";
|
|
25
39
|
seq: number;
|
|
26
40
|
ts: string;
|
|
27
|
-
event: RuntimeEventName;
|
|
28
41
|
run_id: string;
|
|
29
42
|
stage: RuntimeStage;
|
|
30
|
-
payload: Record<string, unknown>;
|
|
31
43
|
[key: string]: unknown;
|
|
32
44
|
};
|
|
45
|
+
export type ModelTurnRuntimeEvent = RuntimeEventEnvelope & {
|
|
46
|
+
event: ModelTurnEventName;
|
|
47
|
+
stage: "model";
|
|
48
|
+
payload: ModelTurnPayload;
|
|
49
|
+
};
|
|
50
|
+
export type RuntimeEvent =
|
|
51
|
+
| ModelTurnRuntimeEvent
|
|
52
|
+
| (RuntimeEventEnvelope & {
|
|
53
|
+
event: Exclude<RuntimeEventName, ModelTurnEventName>;
|
|
54
|
+
payload: RuntimeEventPayload;
|
|
55
|
+
});
|
|
33
56
|
export type ExtendedRuntimeEvent = {
|
|
34
|
-
version: "run-stream.
|
|
57
|
+
version: "run-stream.v3";
|
|
35
58
|
seq: number;
|
|
36
59
|
ts: string;
|
|
37
60
|
event: string;
|
|
38
61
|
run_id: string;
|
|
39
62
|
stage: string;
|
|
40
63
|
diagnostics?: Array<Record<string, unknown>>;
|
|
41
|
-
payload:
|
|
64
|
+
payload: RuntimeEventPayload;
|
|
42
65
|
[key: string]: unknown;
|
|
43
66
|
};
|
|
44
67
|
export type RuntimeEventValidationOptions = {
|
|
@@ -60,7 +83,7 @@ export interface SseParser {
|
|
|
60
83
|
finish(): Promise<void>;
|
|
61
84
|
}
|
|
62
85
|
export declare const CONTRACT_HASH: string;
|
|
63
|
-
export declare const RUNTIME_PROTOCOL_VERSION: "run-stream.
|
|
86
|
+
export declare const RUNTIME_PROTOCOL_VERSION: "run-stream.v3";
|
|
64
87
|
export declare const THREAD_SUMMARY_PROTOCOL_VERSION: "agents24.thread_summary_event.v1";
|
|
65
88
|
export declare class Agents24ProtocolError extends Error {
|
|
66
89
|
readonly category: ProtocolErrorCategory;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { createPkcePair, createWebCryptoDpopKeyProvider, } from "./dpop.js";
|
|
|
5
5
|
export type { DpopKeyHandle, DpopKeyHandleStorage, WebCryptoDpopOptions, WebCryptoLike, } from "./dpop.js";
|
|
6
6
|
export { createAnonymousSessionProvider, createFencedRefreshCoordinator, createHostedOidcSessionProvider, createInMemoryRefreshCoordinator, createManagedSessionProvider, createStaticSessionProvider, } from "./sessions.js";
|
|
7
7
|
export type { AnonymousSessionProviderOptions, FencedRefreshCoordinatorOptions, HostedOidcSessionProvider, HostedOidcSessionProviderOptions, ManagedSessionProviderOptions, } from "./sessions.js";
|
|
8
|
-
export type { Agents24ErrorKind,
|
|
9
|
-
export type { AgentClient, Agents24ClientOptions, AbortSignalLike, AttachmentResult, BinaryUploadData, BlobLike, ChatStreamInput, ClientBootstrap, ClientHints, ClientSessionAccess, ClientSessionProvider, ClientSessionStorage, ClientSessionStorageRecord, Clock, DpopKeyProvider, DpopProofInput, EncodedMultipart, FetchLike, FetchRequestLike, FetchResponseLike, HeadersLike, HitlAction, HitlResumeResult, IdProvider, McpAuthorizationResult, McpCallbackResult, MultipartEncoder, MultipartPart, PortableUpload, PublicJwk, ReadableBodyLike, ReadableBodyReaderLike, RunAttachInput, RuntimeEventHandler, SessionRefreshCoordinator, SessionRefreshFenceRecord, SessionRefreshFenceStorage, SessionRefreshLease, SessionRequestContext, StreamResult, TelemetryEvent, TelemetrySink, TextDecoderLike, TextEncoderLike, ThreadDetail, ThreadListInput, ThreadListResult, ThreadSummary, ThreadSummaryEventHandler, TransportSelection, WaitCapability, } from "./types.js";
|
|
10
|
-
export type {
|
|
8
|
+
export type { Agents24ErrorKind, FailureView, ResourcePolicyViolation, } from "./errors.js";
|
|
9
|
+
export type { AgentClient, ActiveThreadRun, Agents24ClientOptions, AbortSignalLike, AttachmentResult, BinaryUploadData, BlobLike, ChatStreamInput, ClientBootstrap, ClientInputFeature, ClientInputModalityFeature, ClientAttachmentInputModalityFeature, ClientModelSelectionFeature, ClientHints, ClientSessionAccess, EffectiveResourcePolicy, ClientSessionProvider, ClientSessionStorage, ClientSessionStorageRecord, Clock, DpopKeyProvider, DpopProofInput, EncodedMultipart, FetchLike, FetchRequestLike, FetchResponseLike, HeadersLike, HitlAction, HitlAnswer, HitlResponse, HitlResumeResult, IdProvider, McpAuthorizationResult, McpCallbackResult, MultipartEncoder, MultipartPart, PortableUpload, PublicJwk, FeedbackRating, FeedbackReason, ResponseFeedback, ResponseFeedbackResult, ReadableBodyLike, ReadableBodyReaderLike, RunAttachInput, SetFeedbackInput, RuntimeEventHandler, SessionRefreshCoordinator, SessionRefreshFenceRecord, SessionRefreshFenceStorage, SessionRefreshLease, SessionRequestContext, StreamResult, TelemetryEvent, TelemetrySink, TextDecoderLike, TextEncoderLike, ThreadDetail, ThreadListInput, ThreadListResult, ThreadSummary, ThreadSummaryEventHandler, TransportSelection, WaitCapability, } from "./types.js";
|
|
10
|
+
export type { AttachmentContentAccess } from "./runtime-types.js";
|
|
11
|
+
export type { JsonScalar, JsonValue, ModelTurnEventName, ModelTurnKind, ModelTurnOutcome, ModelTurnPayload, ModelTurnRuntimeEvent, ModelTurnStatus, ProtocolErrorCategory, PublicResponseBlock, ExtendedRuntimeEvent, RuntimeEvent, RuntimeEventValidationOptions, ThreadSummaryEvent, } from "./generated/protocol.js";
|