@tangle-network/sandbox 0.64.0 → 0.64.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/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +2 -2
- package/dist/agent/preview.d.ts +1 -1
- package/dist/{agent-run-outcome-LUFfTBdK.d.ts → agent-run-outcome-brwJbH5S.d.ts} +1 -1
- package/dist/{client-Dum1731g.js → client-DB3wP4hO.js} +113 -78
- package/dist/{client-BW5mWBxb.d.ts → client-Dr8qasCR.d.ts} +4 -4
- package/dist/core.d.ts +5 -5
- package/dist/core.js +2 -2
- package/dist/{index-CfoLKgFq.d.ts → index-D5dVNm76.d.ts} +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -3
- package/dist/{interactive-controller-IF4mRCDS.d.ts → interactive-controller-nMhGqXxq.d.ts} +1 -1
- package/dist/{lines-8zW13eqa.d.ts → lines-C5CPSg8n.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/{preview-DngLxMGP.d.ts → preview-COO7TSBk.d.ts} +3 -3
- package/dist/{public-templates-BJGUN0AS.d.ts → public-templates-BDrchm0J.d.ts} +1 -1
- package/dist/public-templates.d.ts +1 -1
- package/dist/runtime.d.ts +3 -3
- package/dist/{sandbox-bXjId_Sc.js → sandbox-BPLzHOZ1.js} +60 -13
- package/dist/session-gateway/index.d.ts +7 -49
- package/dist/session-gateway/index.js +569 -439
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-BpKM5etV.js → tangle-C4Bp5krB.js} +1 -1
- package/dist/{types-BulbFMYO.d.ts → types-CtH0GRql.d.ts} +9 -0
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Sa as BackendConfig, ar as CreateSandboxOptions } from "./types-
|
|
1
|
+
import { Sa as BackendConfig, ar as CreateSandboxOptions } from "./types-CtH0GRql.js";
|
|
2
2
|
|
|
3
3
|
//#region src/line-application.d.ts
|
|
4
4
|
/** Bounded callback request bytes after canonicalization, including JSON framing. */
|
package/dist/lines.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as LineRespondAgent, B as LineVoiceOptions, C as LineMessage, D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, I as LineSenderVerificationStart, L as LineThread, M as LineRole, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, R as LineTransport, S as LineMemberSpec, T as LineProvider, V as LinesHttpClient, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, c as LineAllowanceSubject, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, j as LineRespondView, k as LineReplyGate, l as LineApplicationAttachOptions, m as LineFromConnectionInput, n as SandboxLines, o as LineAgentRolePolicy, p as LineExecutionKey, r as lineInstanceKey, s as LineAllowance, t as LinesClient, u as LineAttachOptions, v as LineLimits, w as LineNumberInventory, x as LineMemberPatch, y as LineMember, z as LineVoice } from "./lines-
|
|
1
|
+
import { A as LineRespondAgent, B as LineVoiceOptions, C as LineMessage, D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, I as LineSenderVerificationStart, L as LineThread, M as LineRole, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, R as LineTransport, S as LineMemberSpec, T as LineProvider, V as LinesHttpClient, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, c as LineAllowanceSubject, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, j as LineRespondView, k as LineReplyGate, l as LineApplicationAttachOptions, m as LineFromConnectionInput, n as SandboxLines, o as LineAgentRolePolicy, p as LineExecutionKey, r as lineInstanceKey, s as LineAllowance, t as LinesClient, u as LineAttachOptions, v as LineLimits, w as LineNumberInventory, x as LineMemberPatch, y as LineMember, z as LineVoice } from "./lines-C5CPSg8n.js";
|
|
2
2
|
export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineApplicationAttachOptions, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineImage, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as SandboxInstance } from "./index-
|
|
2
|
-
import { F as EnsureDevServerOptions, H as PreviewLinkInfo } from "./types-
|
|
3
|
-
import { t as Sandbox } from "./client-
|
|
1
|
+
import { O as SandboxInstance } from "./index-D5dVNm76.js";
|
|
2
|
+
import { F as EnsureDevServerOptions, H as PreviewLinkInfo } from "./types-CtH0GRql.js";
|
|
3
|
+
import { t as Sandbox } from "./client-Dr8qasCR.js";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/preview-operations.d.ts
|
|
6
6
|
type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as SandboxError } from "./terminal-stream-types-ClZCArRg.js";
|
|
2
|
-
import { Pi as HttpClient, ai as PublishPublicTemplateVersionOptions, ii as PublishPublicTemplateOptions, ni as PublicTemplateInfo, ri as PublicTemplateVersionInfo } from "./types-
|
|
2
|
+
import { Pi as HttpClient, ai as PublishPublicTemplateVersionOptions, ii as PublishPublicTemplateOptions, ni as PublicTemplateInfo, ri as PublicTemplateVersionInfo } from "./types-CtH0GRql.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/public-templates.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-
|
|
1
|
+
import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-BDrchm0J.js";
|
|
2
2
|
export { PublicTemplatePublishArtifact, PublicTemplatePublishError, PublicTemplatePublishJob, PublicTemplatePublishRequestOptions, PublicTemplatesClient };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { A as NotFoundError, F as SandboxError, H as TimeoutError, I as SandboxErrorJson, L as SandboxFailureDetail, M as ProfileFileMountPathError, N as QuotaError, R as ServerError, S as CapabilityError, T as FileWriteConflictError, U as ValidationError, b as AuthError, j as PartialFailureError, k as NetworkError, u as ScopedToken, z as StateError } from "./terminal-stream-types-ClZCArRg.js";
|
|
2
|
-
import { Bn as SandboxPortBinding, Br as FileTreeResult, Ct as SessionMessageAdmission, Dt as TaskSessionCommitResult, Er as ChunkedUploadResult, Et as TaskSessionChanges, Gn as SandboxTerminalCreateOptions, Hr as FileUsageResult, Ir as FileRenameResult, Jn as SandboxTerminalRequestOptions, Jr as UploadProgress, Kn as SandboxTerminalInfo, Kr as RenameOptions, Mr as FileReadBatchOptions, Nr as FileReadBatchResult, Q as CommitTaskSessionOptions, St as SessionMessage, Tr as ChunkedUploadOptions, Un as SandboxRuntimeHealth, Ur as FileWriteResult, Vr as FileUsageOptions, Yr as WriteFileOptions, ct as ListMessagesOptions, dt as SendSessionMessageRequest, ft as SentSessionMessage, gt as SessionExecutionStatus, ht as SessionExecutionInfo, it as CreateTaskSessionOptions, kt as TaskSessionInfo, mt as SessionEventStreamOptions, pa as SandboxEvent, qn as SandboxTerminalManager, rr as TerminalStream, rt as CreateSessionOptions, ut as SendSessionMessageOptions, yt as SessionInfo, zr as FileTreeOptions } from "./types-
|
|
2
|
+
import { Bn as SandboxPortBinding, Br as FileTreeResult, Ct as SessionMessageAdmission, Dt as TaskSessionCommitResult, Er as ChunkedUploadResult, Et as TaskSessionChanges, Gn as SandboxTerminalCreateOptions, Hr as FileUsageResult, Ir as FileRenameResult, Jn as SandboxTerminalRequestOptions, Jr as UploadProgress, Kn as SandboxTerminalInfo, Kr as RenameOptions, Mr as FileReadBatchOptions, Nr as FileReadBatchResult, Q as CommitTaskSessionOptions, St as SessionMessage, Tr as ChunkedUploadOptions, Un as SandboxRuntimeHealth, Ur as FileWriteResult, Vr as FileUsageOptions, Yr as WriteFileOptions, ct as ListMessagesOptions, dt as SendSessionMessageRequest, ft as SentSessionMessage, gt as SessionExecutionStatus, ht as SessionExecutionInfo, it as CreateTaskSessionOptions, kt as TaskSessionInfo, mt as SessionEventStreamOptions, pa as SandboxEvent, qn as SandboxTerminalManager, rr as TerminalStream, rt as CreateSessionOptions, ut as SendSessionMessageOptions, yt as SessionInfo, zr as FileTreeOptions } from "./types-CtH0GRql.js";
|
|
3
3
|
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-CvObO_Kf.js";
|
|
4
|
-
import { t as BrowserInteractiveSessionController } from "./interactive-controller-
|
|
5
|
-
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-
|
|
4
|
+
import { t as BrowserInteractiveSessionController } from "./interactive-controller-nMhGqXxq.js";
|
|
5
|
+
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-brwJbH5S.js";
|
|
6
6
|
|
|
7
7
|
//#region src/lib/chunked-upload.d.ts
|
|
8
8
|
/** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
|
|
@@ -658,7 +658,7 @@ var SandboxInfoCapabilities = class {
|
|
|
658
658
|
hasFreshStatus() {
|
|
659
659
|
const statusObservedAt = sandboxStatusObservedAt.get(this) ?? 0;
|
|
660
660
|
const statusAgeMs = Date.now() - statusObservedAt;
|
|
661
|
-
return statusObservedAt > 0 && statusAgeMs >= 0 && statusAgeMs <
|
|
661
|
+
return statusObservedAt > 0 && statusAgeMs >= 0 && statusAgeMs < SANDBOX_STATUS_FRESHNESS_MS;
|
|
662
662
|
}
|
|
663
663
|
/**
|
|
664
664
|
* The check before a runtime call. A handle that has seen the sandbox
|
|
@@ -869,6 +869,7 @@ function readFilesystemIncarnationTuple(value) {
|
|
|
869
869
|
readiness
|
|
870
870
|
};
|
|
871
871
|
}
|
|
872
|
+
const SANDBOX_STATUS_FRESHNESS_MS = 1e3;
|
|
872
873
|
const sandboxStatusObservedAt = /* @__PURE__ */ new WeakMap();
|
|
873
874
|
const REFRESH_REASON_HEADER = "x-tangle-refresh-reason";
|
|
874
875
|
/**
|
|
@@ -3571,13 +3572,49 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
|
|
|
3571
3572
|
};
|
|
3572
3573
|
}
|
|
3573
3574
|
};
|
|
3575
|
+
/**
|
|
3576
|
+
* The platform's typed refusal when one sandbox already has a lifecycle
|
|
3577
|
+
* operation in flight: HTTP 409 from `withSandboxLifecycleClaim`
|
|
3578
|
+
* (products/sandbox/api/src/routes/sandbox-lifecycle-claim.ts).
|
|
3579
|
+
*/
|
|
3580
|
+
const LIFECYCLE_CONFLICT_CODE = "SANDBOX_LIFECYCLE_IN_PROGRESS";
|
|
3581
|
+
/**
|
|
3582
|
+
* How long a lifecycle call re-attempts that refusal before it surfaces.
|
|
3583
|
+
*
|
|
3584
|
+
* MEASURED MOTIVE. `resume`, `stop` and `delete` are the only three routes the
|
|
3585
|
+
* API guards, and they share one lease per sandbox, `lifecycle-<id>`. That
|
|
3586
|
+
* lease outlives the response of the call that took it: the delete handler
|
|
3587
|
+
* registers deferred key-revoke and meta-delete work through
|
|
3588
|
+
* `deferSandboxLifecycleWork`, and the release is chained after that work
|
|
3589
|
+
* through `executionCtx.waitUntil`. So a second lifecycle call landing inside
|
|
3590
|
+
* that window is refused even though nothing is wrong and the caller only has
|
|
3591
|
+
* to wait. The platform's own workflow smoke already hand-rolls this retry and
|
|
3592
|
+
* says why (scripts/platform-workflow-deploy-smoke.mjs: "the worker can still
|
|
3593
|
+
* hold the sandbox lifecycle claim while its final action cleanup completes,
|
|
3594
|
+
* so sandbox-api returns a typed 409 for a short, valid window").
|
|
3595
|
+
*
|
|
3596
|
+
* The number: 2 of 2 provider-seam runs on 2026-09-01 (tangle-network/agent-sdk#280)
|
|
3597
|
+
* lost a completed agent turn to this refusal. `agent-runtime`'s provider
|
|
3598
|
+
* executor destroys one environment twice — once when the stream settles and
|
|
3599
|
+
* once from `teardown()` — and the second DELETE was refused, which discarded
|
|
3600
|
+
* the first one's result. Nothing about the sandbox document tells a client the
|
|
3601
|
+
* lease is held (the response schema is `.strict()` and carries no lifecycle
|
|
3602
|
+
* field), so a status poll cannot replace this retry.
|
|
3603
|
+
*
|
|
3604
|
+
* The ceiling is short on purpose. The lease TTL is 360 s, but the window this
|
|
3605
|
+
* closes is the deferred-cleanup tail of an operation that already answered;
|
|
3606
|
+
* a conflict that outlives ~11 s is a genuinely concurrent operation and
|
|
3607
|
+
* belongs to the caller, not to a longer sleep here.
|
|
3608
|
+
*/
|
|
3609
|
+
const LIFECYCLE_CONFLICT_MAX_ATTEMPTS = 6;
|
|
3610
|
+
const LIFECYCLE_CONFLICT_BASE_DELAY_MS = 500;
|
|
3574
3611
|
const LIFECYCLE_CONFLICT_MAX_DELAY_MS = 4e3;
|
|
3575
3612
|
function isLifecycleConflict(cause) {
|
|
3576
|
-
return cause instanceof SandboxError && cause.status === 409 && cause.code ===
|
|
3613
|
+
return cause instanceof SandboxError && cause.status === 409 && cause.code === LIFECYCLE_CONFLICT_CODE;
|
|
3577
3614
|
}
|
|
3578
3615
|
function lifecycleConflictDelayMs(cause, failedAttempt) {
|
|
3579
3616
|
if (cause instanceof SandboxError && cause.retryAfterMs !== void 0) return cause.retryAfterMs;
|
|
3580
|
-
return Math.min(
|
|
3617
|
+
return Math.min(LIFECYCLE_CONFLICT_BASE_DELAY_MS * 2 ** Math.max(0, failedAttempt - 1), LIFECYCLE_CONFLICT_MAX_DELAY_MS);
|
|
3581
3618
|
}
|
|
3582
3619
|
/**
|
|
3583
3620
|
* Run one lifecycle mutation, re-attempting only the platform's typed
|
|
@@ -3590,7 +3627,7 @@ async function withLifecycleConflictRetry(run, options) {
|
|
|
3590
3627
|
for (let attempt = 1;; attempt += 1) try {
|
|
3591
3628
|
return await run();
|
|
3592
3629
|
} catch (error) {
|
|
3593
|
-
if (!isLifecycleConflict(error) || attempt >=
|
|
3630
|
+
if (!isLifecycleConflict(error) || attempt >= LIFECYCLE_CONFLICT_MAX_ATTEMPTS || options?.signal?.aborted) throw error;
|
|
3594
3631
|
await delayUntilAborted(lifecycleConflictDelayMs(error, attempt), options?.signal);
|
|
3595
3632
|
}
|
|
3596
3633
|
}
|
|
@@ -3634,7 +3671,7 @@ function usableExecutionTtlMs(ttlMs) {
|
|
|
3634
3671
|
* error for the wrong reason.
|
|
3635
3672
|
*/
|
|
3636
3673
|
function timerMsViolation(value) {
|
|
3637
|
-
if (typeof value === "number" && Number.isInteger(value) && value > 0 && value <=
|
|
3674
|
+
if (typeof value === "number" && Number.isInteger(value) && value > 0 && value <= MAX_TIMER_MS) return;
|
|
3638
3675
|
return typeof value === "number" ? String(value) : typeof value;
|
|
3639
3676
|
}
|
|
3640
3677
|
//#endregion
|
|
@@ -4793,6 +4830,10 @@ var SandboxRuntimeOperations = class extends SandboxLifecycleCapabilities {
|
|
|
4793
4830
|
return await readResponseJson(await state(this).client.fetch(`/v1/sandboxes/${this.id}/driver`));
|
|
4794
4831
|
}
|
|
4795
4832
|
};
|
|
4833
|
+
//#endregion
|
|
4834
|
+
//#region src/sandbox-exec.ts
|
|
4835
|
+
const EXEC_DEFAULT_TIMEOUT_MS = 3e4;
|
|
4836
|
+
const EXEC_MIN_TIMEOUT_MS = 100;
|
|
4796
4837
|
const EXEC_MAX_TIMEOUT_MS = 6e5;
|
|
4797
4838
|
const EXEC_TRANSPORT_MARGIN_MS = 15e3;
|
|
4798
4839
|
/**
|
|
@@ -4819,8 +4860,8 @@ var SandboxExecCapabilities = class extends SandboxRuntimeOperations {
|
|
|
4819
4860
|
async exec(command, options) {
|
|
4820
4861
|
const headers = callHeaders(options);
|
|
4821
4862
|
await this.ensureRunning(options?.signal);
|
|
4822
|
-
const timeoutMs = options?.timeoutMs ??
|
|
4823
|
-
if (!Number.isInteger(timeoutMs) || timeoutMs <
|
|
4863
|
+
const timeoutMs = options?.timeoutMs ?? EXEC_DEFAULT_TIMEOUT_MS;
|
|
4864
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < EXEC_MIN_TIMEOUT_MS || timeoutMs > EXEC_MAX_TIMEOUT_MS) throw new ValidationError(`exec timeoutMs must be an integer between ${EXEC_MIN_TIMEOUT_MS} and ${EXEC_MAX_TIMEOUT_MS}`);
|
|
4824
4865
|
const result = (await readResponseJson(await this.runtimeFetch("/process/spawn", {
|
|
4825
4866
|
method: "POST",
|
|
4826
4867
|
headers,
|
|
@@ -5161,7 +5202,7 @@ var SandboxFileWriteCapabilities = class extends SandboxExecCapabilities {
|
|
|
5161
5202
|
break;
|
|
5162
5203
|
} catch (err) {
|
|
5163
5204
|
if (isTransientWriteError(err) && attempt < maxRetries) {
|
|
5164
|
-
const backoff = Math.min(
|
|
5205
|
+
const backoff = Math.min(WRITE_MANY_RETRY_BASE_MS * 2 ** attempt, WRITE_MANY_RETRY_MAX_MS);
|
|
5165
5206
|
await delay((err instanceof SandboxError ? err.retryAfterMs : void 0) ?? backoff);
|
|
5166
5207
|
continue;
|
|
5167
5208
|
}
|
|
@@ -5175,8 +5216,8 @@ var SandboxFileWriteCapabilities = class extends SandboxExecCapabilities {
|
|
|
5175
5216
|
*/
|
|
5176
5217
|
async writeMany(files, options = {}) {
|
|
5177
5218
|
if (files.length === 0) return;
|
|
5178
|
-
const paceMs = options.paceMs ??
|
|
5179
|
-
const maxRetries = options.maxRetries ??
|
|
5219
|
+
const paceMs = options.paceMs ?? WRITE_MANY_DEFAULT_PACE_MS;
|
|
5220
|
+
const maxRetries = options.maxRetries ?? WRITE_MANY_DEFAULT_MAX_RETRIES;
|
|
5180
5221
|
await this.ensureRunning();
|
|
5181
5222
|
if (hasDuplicateWriteManyPaths(files)) {
|
|
5182
5223
|
await this.writeManySequential(files, paceMs, maxRetries);
|
|
@@ -5225,7 +5266,11 @@ var SandboxFileWriteCapabilities = class extends SandboxExecCapabilities {
|
|
|
5225
5266
|
return state(this).filesystemOperations.fs;
|
|
5226
5267
|
}
|
|
5227
5268
|
};
|
|
5269
|
+
const WRITE_MANY_DEFAULT_PACE_MS = 0;
|
|
5270
|
+
const WRITE_MANY_DEFAULT_MAX_RETRIES = 4;
|
|
5271
|
+
const WRITE_MANY_RETRY_BASE_MS = 250;
|
|
5228
5272
|
const WRITE_MANY_RETRY_MAX_MS = 2e3;
|
|
5273
|
+
const WRITE_MANY_BATCH_MAX_FILES = 100;
|
|
5229
5274
|
const WRITE_MANY_BATCH_WIRE_BUDGET_BYTES = SANDBOX_PROXY_REQUEST_MAX_BYTES - 8 * 1024;
|
|
5230
5275
|
function toWriteManyWireFile(file) {
|
|
5231
5276
|
return {
|
|
@@ -5246,7 +5291,7 @@ function splitWriteManyBatches(files) {
|
|
|
5246
5291
|
for (const file of files) {
|
|
5247
5292
|
const candidate = [...current, file];
|
|
5248
5293
|
const candidateBody = serializeWriteManyBatch(candidate);
|
|
5249
|
-
const exceedsCount = candidate.length >
|
|
5294
|
+
const exceedsCount = candidate.length > WRITE_MANY_BATCH_MAX_FILES;
|
|
5250
5295
|
const exceedsWireBudget = new TextEncoder().encode(candidateBody).byteLength > WRITE_MANY_BATCH_WIRE_BUDGET_BYTES;
|
|
5251
5296
|
if (current.length > 0 && (exceedsCount || exceedsWireBudget)) {
|
|
5252
5297
|
batches.push({
|
|
@@ -6314,7 +6359,7 @@ var SandboxPromptTransportCapabilities = class extends SandboxSessionAdmissionCa
|
|
|
6314
6359
|
};
|
|
6315
6360
|
if (typeof request.body === "string" && new TextEncoder().encode(request.body).byteLength > 1048576) throw new ValidationError("Agent run request exceeds the gateway request bound; place large content in resources.files");
|
|
6316
6361
|
response = await this.runtimeFetch(requestEndpoint, request);
|
|
6317
|
-
for (let attempt = 1; !explicitReplay && response.status === 503 && attempt <=
|
|
6362
|
+
for (let attempt = 1; !explicitReplay && response.status === 503 && attempt <= MAX_CREDENTIAL_REFUSAL_RETRIES; attempt += 1) {
|
|
6318
6363
|
const body = await response.clone().text();
|
|
6319
6364
|
const refusal = parseErrorResponse(response.status, body, {
|
|
6320
6365
|
method: request.method,
|
|
@@ -6628,6 +6673,7 @@ function toStreamErrorEvent(err) {
|
|
|
6628
6673
|
}
|
|
6629
6674
|
};
|
|
6630
6675
|
}
|
|
6676
|
+
const MAX_CREDENTIAL_REFUSAL_RETRIES = 3;
|
|
6631
6677
|
//#endregion
|
|
6632
6678
|
//#region src/sandbox-prompt.ts
|
|
6633
6679
|
var SandboxPromptCapabilities = class extends SandboxPromptTransportCapabilities {
|
|
@@ -8020,6 +8066,7 @@ function interpretWorkspaceOperationLookup(body, kind, keyOnly) {
|
|
|
8020
8066
|
};
|
|
8021
8067
|
}
|
|
8022
8068
|
const SNAPSHOT_RESTORE_POLL_INTERVAL_MS = 1e3;
|
|
8069
|
+
const SNAPSHOT_RESTORE_FIRST_POLL_INTERVAL_MS = 200;
|
|
8023
8070
|
const SNAPSHOT_RESTORE_POLL_GROWTH = 1.6;
|
|
8024
8071
|
const SNAPSHOT_RESTORE_TIMEOUT_MS = 600 * 1e3;
|
|
8025
8072
|
/**
|
|
@@ -8034,7 +8081,7 @@ const SNAPSHOT_RESTORE_TIMEOUT_MS = 600 * 1e3;
|
|
|
8034
8081
|
* poll rate is bounded by the ceiling, not by the starting interval.
|
|
8035
8082
|
*/
|
|
8036
8083
|
function nextRestorePollDelayMs(pollsTaken) {
|
|
8037
|
-
const delay =
|
|
8084
|
+
const delay = SNAPSHOT_RESTORE_FIRST_POLL_INTERVAL_MS * SNAPSHOT_RESTORE_POLL_GROWTH ** pollsTaken;
|
|
8038
8085
|
return Math.min(Math.round(delay), SNAPSHOT_RESTORE_POLL_INTERVAL_MS);
|
|
8039
8086
|
}
|
|
8040
8087
|
const SNAPSHOT_VISIBILITY_POLL_INTERVAL_MS = 1e3;
|
|
@@ -431,7 +431,7 @@ interface SessionGatewayStats {
|
|
|
431
431
|
*/
|
|
432
432
|
declare function calculateConnectionQuality(metrics: ConnectionMetrics, isConnected: boolean): ConnectionQuality;
|
|
433
433
|
//#endregion
|
|
434
|
-
//#region ../../../packages/sdk/dist/client-
|
|
434
|
+
//#region ../../../packages/sdk/dist/client-h8AqRerh.d.ts
|
|
435
435
|
//#region src/session-gateway/core-types.d.ts
|
|
436
436
|
interface SubscriptionDenial {
|
|
437
437
|
channel: string;
|
|
@@ -500,38 +500,16 @@ declare const INITIAL_METRICS: ConnectionMetrics; //#endregion
|
|
|
500
500
|
//#region src/session-gateway/core.d.ts
|
|
501
501
|
declare class SessionGatewayClientCore {
|
|
502
502
|
#private;
|
|
503
|
-
private readonly initialMetrics;
|
|
504
503
|
private ws;
|
|
505
504
|
private readonly handlers;
|
|
506
|
-
private readonly replayStateStore;
|
|
507
|
-
private readonly tokenRefresher;
|
|
508
505
|
private state;
|
|
509
|
-
private
|
|
510
|
-
private hasConnectedBefore;
|
|
511
|
-
private connectionEstablishedForSocket;
|
|
512
|
-
private lastPingAt;
|
|
513
|
-
private lastPongAt;
|
|
514
|
-
private lastPingSentAt;
|
|
515
|
-
private missedPongCount;
|
|
516
|
-
private reconnectAttempts;
|
|
517
|
-
private messagesReceived;
|
|
518
|
-
private messagesSent;
|
|
519
|
-
private eventsReceived;
|
|
520
|
-
private duplicatesSkipped;
|
|
521
|
-
private reconnectTimer;
|
|
522
|
-
private pingInterval;
|
|
523
|
-
private pongTimeout;
|
|
524
|
-
private pendingCallbacks;
|
|
506
|
+
private readonly counters;
|
|
525
507
|
private readonly connectionWaiters;
|
|
526
|
-
private
|
|
527
|
-
private
|
|
528
|
-
private
|
|
529
|
-
private
|
|
530
|
-
private
|
|
531
|
-
private currentExecutionId;
|
|
532
|
-
private currentSessionId;
|
|
533
|
-
private isReplaying;
|
|
534
|
-
private replayProgress;
|
|
508
|
+
private readonly reconnects;
|
|
509
|
+
private readonly heartbeat;
|
|
510
|
+
private readonly metrics;
|
|
511
|
+
private readonly replayCursor;
|
|
512
|
+
private readonly inbound;
|
|
535
513
|
constructor(config: SessionGatewayClientConfig$1, initialMetrics?: ConnectionMetrics);
|
|
536
514
|
/**
|
|
537
515
|
* Connect to the session gateway.
|
|
@@ -590,31 +568,11 @@ declare class SessionGatewayClientCore {
|
|
|
590
568
|
*/
|
|
591
569
|
getToken(): string;
|
|
592
570
|
private setState;
|
|
593
|
-
private handleOpen;
|
|
594
571
|
private handleConnectionEstablished;
|
|
595
572
|
private handleClose;
|
|
596
|
-
private handleError;
|
|
597
|
-
private closeBeforeEstablishment;
|
|
598
573
|
private handleMessage;
|
|
599
|
-
private handlePong;
|
|
600
|
-
private dispatchMessage;
|
|
601
|
-
private deliverMessage;
|
|
602
|
-
private trackExecutionContext;
|
|
603
574
|
private send;
|
|
604
575
|
private sendWithResponse;
|
|
605
|
-
private waitForConnectionEstablished;
|
|
606
|
-
private restoreSubscriptions;
|
|
607
|
-
private startPingInterval;
|
|
608
|
-
private stopPingInterval;
|
|
609
|
-
private sendPing;
|
|
610
|
-
private clearPongTimeout;
|
|
611
|
-
private scheduleReconnect;
|
|
612
|
-
private cleanup;
|
|
613
|
-
private updateConnectionMetrics;
|
|
614
|
-
private updateConnectionQuality;
|
|
615
|
-
private trackReconnection;
|
|
616
|
-
private loadReplayState;
|
|
617
|
-
private saveReplayState;
|
|
618
576
|
} //#endregion
|
|
619
577
|
//#region src/session-gateway/client.d.ts
|
|
620
578
|
/** SDK client with its original immediate, synchronous replay commands. */
|