@tangle-network/sandbox 1.0.151 → 1.0.153
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 +3 -3
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +1 -1
- package/dist/{agent-run-outcome-YZOY61uG.d.ts → agent-run-outcome-CbQYfrfR.d.ts} +2 -2
- package/dist/auth/index.js +2 -2
- package/dist/{browser-interactive-control-controller-CRCRI6x5.js → browser-interactive-control-controller-C6GiIQZF.js} +15 -15
- package/dist/{browser-interactive-control-controller-DdtXzO5r.d.ts → browser-interactive-control-controller-CP5PDJK8.d.ts} +1 -1
- package/dist/{cli-auth-bundle-DF3PK8iC-DrtpxJ_t.js → cli-auth-bundle-D8Wu1H1c-CIFKakKy.js} +39 -33
- package/dist/cli-auth-bundle-N92SqZUI.js +2 -0
- package/dist/{client-CXoRiPqY.d.ts → client-COEPtvS9.d.ts} +5 -5
- package/dist/{client-BpDtlFDQ.js → client-QgAgHDT4.js} +6 -10
- package/dist/{core-vjPhSRwO.js → core-DHgXejOs.js} +4 -4
- package/dist/core.d.ts +6 -6
- package/dist/core.js +3 -3
- package/dist/{harness-BhAJqO2u.js → harness-DMaNgn0S.js} +4 -4
- package/dist/{index-Vn_rYk5C.d.ts → index-Xfxbbfh8.d.ts} +5 -5
- package/dist/index.d.ts +9 -9
- package/dist/index.js +7 -7
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-C1UItRXC.js → interactive-controller-BVsAnr6o.js} +4 -4
- package/dist/{interactive-controller-gJULGNKn.d.ts → interactive-controller-CNwiIdK5.d.ts} +3 -3
- package/dist/{lines-9g9dTW5t.d.ts → lines-Bfy9d9L9.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/{local-cli-auth-9-yeJf61.js → local-cli-auth-or4kRYUS.js} +1 -1
- package/dist/{preview-D-uzBtP0.d.ts → preview-DKr-qLk6.d.ts} +3 -3
- package/dist/{profile-schema-Y5Xl8aOt.js → profile-schema-C1KpT-wS.js} +13 -16
- package/dist/{public-templates-DAp2vpqB.d.ts → public-templates-B5x_-DED.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +2 -2
- package/dist/{sandbox-DSq5wR-6.js → sandbox-bWRanOKP.js} +192 -40
- package/dist/select-seat-command.d.ts +1 -1
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CZxvfOpr.js → tangle-EconMBgP.js} +1 -1
- package/dist/{terminal-stream-types-5kBchrj3.d.ts → terminal-stream-types-D0caxkTH.d.ts} +14 -14
- package/dist/{types-CeTsbEjb.d.ts → types-D11H6atN.d.ts} +9 -3
- package/package.json +6 -6
- package/dist/cli-auth-bundle-D6NcQKP9.js +0 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { A as mergeRuntimeBackendConfig, C as encodePromptForWire, E as canUseNodeHttp2, G as normalizeEffectiveBackend, I as withoutRuntimeSecrets, L as createAgentRunOutcomeTracker, M as requestedPublicProfileDigest, N as requestedSecretProfilePublicDigest, O as applyRequestedModel, R as deriveAgentResultOutcome, S as validateAcceptedDispatchRunRef, T as runtimeFilesystemPath, _ as TRACE_ID_HEADER, a as assertScopedTokenActive, b as resolveTraceId, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as waitForRetryAfter, h as isRetryableCredentialRefusal, i as terminalUpgradeHeadersSupported, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as isTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as mintTraceId } from "./interactive-controller-
|
|
2
|
-
import { C as boundedIdentifierSchema, E as boundedStringSchema, g as sha256DigestSchema, o as canonicalCandidateDigest, s as canonicalCandidateJson, u as isCanonicalJsonValue } from "./harness-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { A as mergeRuntimeBackendConfig, C as encodePromptForWire, E as canUseNodeHttp2, G as normalizeEffectiveBackend, I as withoutRuntimeSecrets, L as createAgentRunOutcomeTracker, M as requestedPublicProfileDigest, N as requestedSecretProfilePublicDigest, O as applyRequestedModel, R as deriveAgentResultOutcome, S as validateAcceptedDispatchRunRef, T as runtimeFilesystemPath, _ as TRACE_ID_HEADER, a as assertScopedTokenActive, b as resolveTraceId, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as waitForRetryAfter, h as isRetryableCredentialRefusal, i as terminalUpgradeHeadersSupported, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as isTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as mintTraceId } from "./interactive-controller-BVsAnr6o.js";
|
|
2
|
+
import { C as boundedIdentifierSchema, E as boundedStringSchema, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1, u as isCanonicalJsonValue$1 } from "./harness-DMaNgn0S.js";
|
|
3
|
+
import { t as sha256 } from "./sha2-vu4U-x2L.js";
|
|
4
|
+
import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-C6GiIQZF.js";
|
|
5
|
+
import { a as ProxySecretReceiptSchema, o as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
5
6
|
import { C as StateError, E as ValidationError, F as SANDBOX_AGENT_HOME, I as SANDBOX_FILE_API_ABSOLUTE_ROOTS, L as isProfileFileMountOutsideRoots, M as FILE_OPERATION_LIMITS, P as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, R as profileFileMountOutsideRootsMessage, S as ServerError, T as TimeoutError, a as AuthError, c as CompliancePlacementError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, i as readResponseJson, j as SANDBOX_PROXY_REQUEST_MAX_BYTES, l as EdgeNotReadyError, m as NON_RETRYABLE_CREATE_QUOTA_REASONS, n as parseErrorResponse, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-BfR-fBvN.js";
|
|
6
7
|
import { n as combineAbortSignals, r as delayUntilAborted, t as awaitWithAbort } from "./abort-signal-CDxyloxz.js";
|
|
7
8
|
import { t as rewrapResponse } from "./response-rewrap-CpNkboDX.js";
|
|
@@ -10,8 +11,8 @@ import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-5DpLmHeN.
|
|
|
10
11
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
11
12
|
import { s as uploadChunked } from "./chunked-upload-CyP-FOeZ.js";
|
|
12
13
|
import { t as runPreparedProcess } from "./prepared-process-C-rwZPIZ.js";
|
|
13
|
-
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-
|
|
14
|
-
import "./cli-auth-bundle-
|
|
14
|
+
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-D8Wu1H1c-CIFKakKy.js";
|
|
15
|
+
import "./cli-auth-bundle-N92SqZUI.js";
|
|
15
16
|
import { n as SandboxLines } from "./lines-DlLR4pHq.js";
|
|
16
17
|
import { t as downloadFile } from "./file-download-CICuFwGb.js";
|
|
17
18
|
import { z } from "zod";
|
|
@@ -19,10 +20,10 @@ import { createHash } from "node:crypto";
|
|
|
19
20
|
import { constants } from "node:fs";
|
|
20
21
|
import "node:path";
|
|
21
22
|
import "node:fs/promises";
|
|
22
|
-
import {
|
|
23
|
+
import { readTokenUsage } from "@tangle-network/agent-core";
|
|
23
24
|
import "@tangle-network/agent-interface/environment-provider";
|
|
24
25
|
import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlpAttributes, toW3CSpanId, toW3CTraceId } from "@tangle-network/agent-trace-contract/otlp";
|
|
25
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
26
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation.js
|
|
26
27
|
/**
|
|
27
28
|
* Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
|
|
28
29
|
* Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
|
|
@@ -33,11 +34,11 @@ import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlp
|
|
|
33
34
|
*/
|
|
34
35
|
function canonicalAgentProfileDigest(profile) {
|
|
35
36
|
const material = canonicalAgentProfileValue(agentProfileSchema.parse(profile));
|
|
36
|
-
if (material === void 0 || !isCanonicalJsonValue(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
|
|
37
|
-
return canonicalCandidateDigest(material);
|
|
37
|
+
if (material === void 0 || !isCanonicalJsonValue$1(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
|
|
38
|
+
return canonicalCandidateDigest$1(material);
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
40
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
41
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/environment-interactive-start.js
|
|
41
42
|
const AgentInteractiveSessionRunCoordinatesSchema = z.strictObject({
|
|
42
43
|
provider: boundedIdentifierSchema,
|
|
43
44
|
environmentId: boundedIdentifierSchema,
|
|
@@ -54,7 +55,7 @@ const AgentInteractiveSessionRunCoordinatesSchema = z.strictObject({
|
|
|
54
55
|
const AgentInteractiveSessionStartSchema = z.strictObject({
|
|
55
56
|
run: AgentExactRunControlRefSchema,
|
|
56
57
|
profile: agentProfileSchema,
|
|
57
|
-
requestedProfileDigest: sha256DigestSchema,
|
|
58
|
+
requestedProfileDigest: sha256DigestSchema$1,
|
|
58
59
|
authMode: z.literal("oauth").optional(),
|
|
59
60
|
initialPrompt: boundedStringSchema.optional(),
|
|
60
61
|
cwd: boundedStringSchema.min(1).optional(),
|
|
@@ -65,7 +66,7 @@ const AgentInteractiveSessionStartSchema = z.strictObject({
|
|
|
65
66
|
function agentInteractiveSessionRequestDigest(coordinates, input) {
|
|
66
67
|
const exactCoordinates = AgentInteractiveSessionRunCoordinatesSchema.parse(coordinates);
|
|
67
68
|
const exactInput = AgentInteractiveSessionStartSchema.omit({ run: true }).parse(input);
|
|
68
|
-
return canonicalCandidateDigest({
|
|
69
|
+
return canonicalCandidateDigest$1({
|
|
69
70
|
kind: "agent-interactive-session-start.v1",
|
|
70
71
|
run: exactCoordinates,
|
|
71
72
|
requestedProfileDigest: exactInput.requestedProfileDigest,
|
|
@@ -114,7 +115,7 @@ function runCoordinates(run) {
|
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
117
|
//#endregion
|
|
117
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
118
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/environment-terminal.js
|
|
118
119
|
const terminalDimensionSchema = z.number().int().positive().max(1e4);
|
|
119
120
|
/**
|
|
120
121
|
* Provider-neutral handle for one interactive terminal.
|
|
@@ -488,7 +489,7 @@ const PROFILE_IMPORT_PART_BYTES = 512 * 1024;
|
|
|
488
489
|
const MANAGED_PROFILE_TRANSPORT = "managed-profile-reference-v1";
|
|
489
490
|
/** Cache identity follows JSON wire semantics and RFC 8785 key ordering. */
|
|
490
491
|
function profileCacheSha256(profile) {
|
|
491
|
-
return canonicalCandidateDigest(JSON.parse(JSON.stringify(profile))).slice(7);
|
|
492
|
+
return canonicalCandidateDigest$1(JSON.parse(JSON.stringify(profile))).slice(7);
|
|
492
493
|
}
|
|
493
494
|
//#endregion
|
|
494
495
|
//#region ../../../packages/runtime-contracts/dist/direct-read.js
|
|
@@ -763,7 +764,7 @@ async function responseNeedsProfileImport(response) {
|
|
|
763
764
|
}
|
|
764
765
|
/** Upload the public profile only. Runtime grants remain in the turn backend. */
|
|
765
766
|
async function primeManagedProfile(profile, fetchRuntime) {
|
|
766
|
-
const bytes = new TextEncoder().encode(canonicalCandidateJson(profile));
|
|
767
|
+
const bytes = new TextEncoder().encode(canonicalCandidateJson$1(profile));
|
|
767
768
|
const sha256 = profileCacheSha256(profile);
|
|
768
769
|
if (bytes.length > 8388608) throw new ValidationError("Managed profile exceeds the profile import bound");
|
|
769
770
|
const post = async (body) => {
|
|
@@ -2974,6 +2975,10 @@ var DirectRuntimeHttpClient = class {
|
|
|
2974
2975
|
getBaseUrl() {
|
|
2975
2976
|
return this.baseClient.getBaseUrl?.();
|
|
2976
2977
|
}
|
|
2978
|
+
platformFetch(path, options) {
|
|
2979
|
+
const { baseClient } = this;
|
|
2980
|
+
return baseClient.platformFetch ? baseClient.platformFetch(path, options) : Promise.reject(/* @__PURE__ */ new Error("This client has no Platform API"));
|
|
2981
|
+
}
|
|
2977
2982
|
/** Token-refresh subscribers live on the client that created the sandbox. */
|
|
2978
2983
|
_emitTokenRefresh(sandboxId, newToken) {
|
|
2979
2984
|
this.baseClient._emitTokenRefresh?.(sandboxId, newToken);
|
|
@@ -3131,6 +3136,118 @@ async function isRefusedBearer(response) {
|
|
|
3131
3136
|
return false;
|
|
3132
3137
|
}
|
|
3133
3138
|
}
|
|
3139
|
+
//#endregion
|
|
3140
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.11/node_modules/@tangle-network/agent-interface/dist/agent-candidate-schema-common.js
|
|
3141
|
+
const sha256Pattern = /^sha256:[a-f0-9]{64}$/;
|
|
3142
|
+
const gitObjectPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
3143
|
+
const environmentNamePattern = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
3144
|
+
const headerNamePattern = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
3145
|
+
const mediaTypePattern = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/;
|
|
3146
|
+
const githubComponentPattern = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/;
|
|
3147
|
+
const secretNamePattern = /(?:^|[_-])(?:api[_-]?key|access[_-]?key|private[_-]?key|token|secret|password|credentials?|authorization|cookie|database[_-]?url|dsn|pat)(?:[_-]|$)/i;
|
|
3148
|
+
const obviousSecretValuePattern = /(?:\bsk[-_][-_A-Za-z0-9]{10,}\b|\bgh[pousr]_[A-Za-z0-9]{12,}\b|\bgithub_pat_[A-Za-z0-9_]{12,}\b|\bAKIA[A-Z0-9]{12,}\b|-----BEGIN [A-Z ]*PRIVATE KEY-----|\bBearer\s+\S+)/;
|
|
3149
|
+
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
3150
|
+
z.string().regex(sha256Pattern);
|
|
3151
|
+
z.string().regex(gitObjectPattern);
|
|
3152
|
+
const environmentNameSchema = z.string().regex(environmentNamePattern);
|
|
3153
|
+
z.string().regex(headerNamePattern);
|
|
3154
|
+
z.string().regex(mediaTypePattern);
|
|
3155
|
+
function sha256Bytes(value) {
|
|
3156
|
+
const bytes = sha256(value);
|
|
3157
|
+
return `sha256:${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
3158
|
+
}
|
|
3159
|
+
/** RFC 8785 serialization used by every candidate-producing package. */
|
|
3160
|
+
function canonicalCandidateJson(value) {
|
|
3161
|
+
if (!isCanonicalJsonValue(value)) throw new Error("candidate document must be finite, acyclic RFC 8785 JSON");
|
|
3162
|
+
return serializeCanonicalCandidate(value);
|
|
3163
|
+
}
|
|
3164
|
+
function canonicalCandidateBytes(value) {
|
|
3165
|
+
return new TextEncoder().encode(canonicalCandidateJson(value));
|
|
3166
|
+
}
|
|
3167
|
+
function canonicalCandidateDigest(value) {
|
|
3168
|
+
return sha256Bytes(canonicalCandidateBytes(value));
|
|
3169
|
+
}
|
|
3170
|
+
function serializeCanonicalCandidate(value) {
|
|
3171
|
+
if (value === null || typeof value === "boolean" || typeof value === "number") return JSON.stringify(value);
|
|
3172
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
3173
|
+
if (Array.isArray(value)) return `[${value.map(serializeCanonicalCandidate).join(",")}]`;
|
|
3174
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${serializeCanonicalCandidate(value[key])}`).join(",")}}`;
|
|
3175
|
+
}
|
|
3176
|
+
function isWellFormedUnicode(value) {
|
|
3177
|
+
for (let index = 0; index < value.length; index++) {
|
|
3178
|
+
const code = value.charCodeAt(index);
|
|
3179
|
+
if (code >= 55296 && code <= 56319) {
|
|
3180
|
+
const next = value.charCodeAt(index + 1);
|
|
3181
|
+
if (!(next >= 56320 && next <= 57343)) return false;
|
|
3182
|
+
index++;
|
|
3183
|
+
} else if (code >= 56320 && code <= 57343) return false;
|
|
3184
|
+
}
|
|
3185
|
+
return true;
|
|
3186
|
+
}
|
|
3187
|
+
function isCanonicalJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
3188
|
+
if (value === null || typeof value === "boolean") return true;
|
|
3189
|
+
if (typeof value === "string") return isWellFormedUnicode(value);
|
|
3190
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
3191
|
+
if (typeof value !== "object" || ancestors.has(value)) return false;
|
|
3192
|
+
const prototype = Object.getPrototypeOf(value);
|
|
3193
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) return false;
|
|
3194
|
+
const nextAncestors = new Set(ancestors).add(value);
|
|
3195
|
+
if (Array.isArray(value)) {
|
|
3196
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
3197
|
+
if (!(index in value)) return false;
|
|
3198
|
+
if (!isCanonicalJsonValue(value[index], nextAncestors)) return false;
|
|
3199
|
+
}
|
|
3200
|
+
return true;
|
|
3201
|
+
}
|
|
3202
|
+
return Object.entries(value).every(([key, entry]) => isWellFormedUnicode(key) && isCanonicalJsonValue(entry, nextAncestors));
|
|
3203
|
+
}
|
|
3204
|
+
function hasCredentialBearingUrl(value) {
|
|
3205
|
+
try {
|
|
3206
|
+
const url = new URL(value);
|
|
3207
|
+
if (url.username !== "" || url.password !== "") return true;
|
|
3208
|
+
return [...url.searchParams.keys()].some((key) => secretNamePattern.test(key));
|
|
3209
|
+
} catch {
|
|
3210
|
+
return false;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
/**
|
|
3214
|
+
* Whether a string holds an obvious credential: a provider key (`sk-`, `gh*_`,
|
|
3215
|
+
* `github_pat_`, `AKIA`), a PEM private key, a bearer token, or a URL with
|
|
3216
|
+
* userinfo or a credential-named query parameter. The agent-eval redaction
|
|
3217
|
+
* core calls it, so candidate validation and trace redaction agree.
|
|
3218
|
+
*/
|
|
3219
|
+
function looksLikeCredential(value) {
|
|
3220
|
+
return obviousSecretValuePattern.test(value) || hasCredentialBearingUrl(value);
|
|
3221
|
+
}
|
|
3222
|
+
function isPublicConfigValue(value) {
|
|
3223
|
+
return !controlCharacterPattern.test(value) && isWellFormedUnicode(value) && !looksLikeCredential(value);
|
|
3224
|
+
}
|
|
3225
|
+
/** Shared public reference owner; resolution belongs to the trusted executor. */
|
|
3226
|
+
const agentCandidateSecretRefSchema = z.strictObject({
|
|
3227
|
+
kind: z.literal("secret-ref"),
|
|
3228
|
+
key: z.string().min(1).max(500).refine((value) => value.trim().length > 0 && isPublicConfigValue(value), "secret reference key must be a public non-credential identity"),
|
|
3229
|
+
format: z.enum(["raw", "bearer"]).optional()
|
|
3230
|
+
});
|
|
3231
|
+
const agentCandidatePublicValueSchema = z.strictObject({
|
|
3232
|
+
kind: z.literal("public"),
|
|
3233
|
+
value: z.string().refine(isPublicConfigValue, "candidate config cannot carry credentials; the evaluator owns model authorization")
|
|
3234
|
+
});
|
|
3235
|
+
const agentCandidateConfigValueSchema = z.discriminatedUnion("kind", [agentCandidatePublicValueSchema, agentCandidateSecretRefSchema]);
|
|
3236
|
+
function configRecordSchema(keySchema) {
|
|
3237
|
+
return z.record(keySchema, agentCandidateConfigValueSchema).superRefine((config, ctx) => {
|
|
3238
|
+
for (const name of Object.keys(config)) if (secretNamePattern.test(name) && config[name]?.kind !== "secret-ref") ctx.addIssue({
|
|
3239
|
+
code: "custom",
|
|
3240
|
+
path: [name],
|
|
3241
|
+
message: "candidate config cannot declare credential-bearing names"
|
|
3242
|
+
});
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
configRecordSchema(environmentNameSchema);
|
|
3246
|
+
z.object({
|
|
3247
|
+
kind: z.literal("github"),
|
|
3248
|
+
owner: z.string().regex(githubComponentPattern).refine((value) => value !== "." && value !== ".."),
|
|
3249
|
+
repo: z.string().regex(githubComponentPattern).refine((value) => value !== "." && value !== "..")
|
|
3250
|
+
}).strict();
|
|
3134
3251
|
const CODEX_SYSTEM_PROMPT_FILE = ".codex/system-prompt.md";
|
|
3135
3252
|
const OPENCODE_APPEND_SYSTEM_PROMPT_FILE = ".opencode/agent-system-prompt.md";
|
|
3136
3253
|
const OPENCODE_CONFIG_FILE = "opencode.json";
|
|
@@ -6295,7 +6412,7 @@ var InteractiveSessionHandle = class {
|
|
|
6295
6412
|
options?.signal?.throwIfAborted();
|
|
6296
6413
|
const binding = this.requireBinding();
|
|
6297
6414
|
const exactCommand = AgentInteractiveSessionPromptCommandSchema.parse(command);
|
|
6298
|
-
if (canonicalCandidateDigest(exactCommand.ref) !== canonicalCandidateDigest(binding.ref) || canonicalCandidateDigest(exactCommand.control) !== canonicalCandidateDigest(binding.control)) throw new Error(`Interactive session ${this.sessionId} prompt is bound to a different exact ref`);
|
|
6415
|
+
if (canonicalCandidateDigest$1(exactCommand.ref) !== canonicalCandidateDigest$1(binding.ref) || canonicalCandidateDigest$1(exactCommand.control) !== canonicalCandidateDigest$1(binding.control)) throw new Error(`Interactive session ${this.sessionId} prompt is bound to a different exact ref`);
|
|
6299
6416
|
return (options === void 0 ? this.host._sendInteractivePrompt(this.sessionId, exactCommand) : this.host._sendInteractivePrompt(this.sessionId, exactCommand, options)).then((acknowledgement) => {
|
|
6300
6417
|
const exactAcknowledgement = AgentInteractiveSessionPromptAcknowledgementSchema.parse(acknowledgement);
|
|
6301
6418
|
if (!agentInteractiveSessionPromptAcknowledgementMatchesCommand(exactCommand, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} prompt acknowledgement does not match the command`);
|
|
@@ -6373,8 +6490,8 @@ var InteractiveSessionHandle = class {
|
|
|
6373
6490
|
options?.signal?.throwIfAborted();
|
|
6374
6491
|
const binding = this.requireBinding();
|
|
6375
6492
|
const exactRequest = AgentInteractiveSessionAttachSchema.parse(request);
|
|
6376
|
-
if (!agentInteractiveSessionControlClaimMatchesRef(binding.ref, exactRequest.control) || canonicalCandidateDigest(exactRequest.control) !== canonicalCandidateDigest(binding.control)) throw new Error(`Interactive session ${this.sessionId} terminal attach is bound to a different active control claim`);
|
|
6377
|
-
const requestDigest = canonicalCandidateDigest(exactRequest);
|
|
6493
|
+
if (!agentInteractiveSessionControlClaimMatchesRef(binding.ref, exactRequest.control) || canonicalCandidateDigest$1(exactRequest.control) !== canonicalCandidateDigest$1(binding.control)) throw new Error(`Interactive session ${this.sessionId} terminal attach is bound to a different active control claim`);
|
|
6494
|
+
const requestDigest = canonicalCandidateDigest$1(exactRequest);
|
|
6378
6495
|
if (this.agentTerminalAttachInFlight !== void 0) {
|
|
6379
6496
|
if (this.agentTerminalAttachDigest !== requestDigest) throw new Error(`Interactive session ${this.sessionId} cannot attach with a different terminal request while another attach is in flight`);
|
|
6380
6497
|
return awaitWithAbort(this.agentTerminalAttachInFlight, options?.signal);
|
|
@@ -6427,7 +6544,7 @@ var InteractiveSessionHandle = class {
|
|
|
6427
6544
|
options?.signal?.throwIfAborted();
|
|
6428
6545
|
const ref = this.requireRef();
|
|
6429
6546
|
const exactRequest = AgentInteractiveSessionControlClaimRequestSchema.parse(request);
|
|
6430
|
-
if (canonicalCandidateDigest(exactRequest.ref) !== canonicalCandidateDigest(ref)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
|
|
6547
|
+
if (canonicalCandidateDigest$1(exactRequest.ref) !== canonicalCandidateDigest$1(ref)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
|
|
6431
6548
|
return this.host._claimInteractiveControl(this.sessionId, exactRequest, options).then((acknowledgement) => {
|
|
6432
6549
|
const exactAcknowledgement = AgentInteractiveSessionControlClaimAcknowledgementSchema.parse(acknowledgement);
|
|
6433
6550
|
if (!agentInteractiveSessionControlClaimAcknowledgementMatchesRequest(exactRequest, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} control claim acknowledgement does not match the request`);
|
|
@@ -6442,7 +6559,7 @@ var InteractiveSessionHandle = class {
|
|
|
6442
6559
|
options?.signal?.throwIfAborted();
|
|
6443
6560
|
const binding = this.requireBinding();
|
|
6444
6561
|
const exactCommand = AgentInteractiveSessionStopCommandSchema.parse(command);
|
|
6445
|
-
if (canonicalCandidateDigest(exactCommand.ref) !== canonicalCandidateDigest(binding.ref) || canonicalCandidateDigest(exactCommand.control) !== canonicalCandidateDigest(binding.control)) throw new Error(`Interactive session ${this.sessionId} stop is bound to a different exact ref`);
|
|
6562
|
+
if (canonicalCandidateDigest$1(exactCommand.ref) !== canonicalCandidateDigest$1(binding.ref) || canonicalCandidateDigest$1(exactCommand.control) !== canonicalCandidateDigest$1(binding.control)) throw new Error(`Interactive session ${this.sessionId} stop is bound to a different exact ref`);
|
|
6446
6563
|
return (options === void 0 ? this.host._stopInteractive(this.sessionId, exactCommand) : this.host._stopInteractive(this.sessionId, exactCommand, options)).then((acknowledgement) => {
|
|
6447
6564
|
const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema.parse(acknowledgement);
|
|
6448
6565
|
if (!agentInteractiveSessionStopAcknowledgementMatchesCommand(exactCommand, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} stop acknowledgement does not match the command`);
|
|
@@ -6454,7 +6571,7 @@ var InteractiveSessionHandle = class {
|
|
|
6454
6571
|
const ref = this.requireRef();
|
|
6455
6572
|
return (options === void 0 ? this.host._stopInteractiveLifecycle(this.sessionId, ref) : this.host._stopInteractiveLifecycle(this.sessionId, ref, options)).then((acknowledgement) => {
|
|
6456
6573
|
const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema.parse(acknowledgement);
|
|
6457
|
-
if (canonicalCandidateDigest(exactAcknowledgement.ref) !== canonicalCandidateDigest(ref)) throw new Error(`Interactive session ${this.sessionId} lifecycle stop acknowledgement does not match the exact ref`);
|
|
6574
|
+
if (canonicalCandidateDigest$1(exactAcknowledgement.ref) !== canonicalCandidateDigest$1(ref)) throw new Error(`Interactive session ${this.sessionId} lifecycle stop acknowledgement does not match the exact ref`);
|
|
6458
6575
|
if (exactAcknowledgement.status !== "accepted" && exactAcknowledgement.status !== "replayed") throw new Error(`Interactive session ${this.sessionId} lifecycle stop was not confirmed (${exactAcknowledgement.status})`);
|
|
6459
6576
|
if (exactAcknowledgement.effect === "unknown") throw new Error(`Interactive session ${this.sessionId} lifecycle stop returned an unknown outcome`);
|
|
6460
6577
|
return exactAcknowledgement;
|
|
@@ -6469,6 +6586,43 @@ function assertInteractiveRefBelongsToSandbox(ref, sandboxId) {
|
|
|
6469
6586
|
if (ref.run.environmentId !== sandboxId) throw new ValidationError("Interactive session reference does not belong to this sandbox", { "ref.run.environmentId": `Expected ${sandboxId}` });
|
|
6470
6587
|
}
|
|
6471
6588
|
//#endregion
|
|
6589
|
+
//#region src/sandbox-ledger.ts
|
|
6590
|
+
/** What the ledger has charged one sandbox in USD: in all, and its Router-billed model calls. */
|
|
6591
|
+
async function sandboxLedgerUsd(fetch, id) {
|
|
6592
|
+
const response = await fetch(`/v1/billing/transactions?groupBy=resource&limit=200&groupKey=${encodeURIComponent(`sandbox:${id}`)}`);
|
|
6593
|
+
const { ok, status, headers } = response;
|
|
6594
|
+
const body = await response.text();
|
|
6595
|
+
if (!ok) throw parseErrorResponse(status, body, void 0, headers);
|
|
6596
|
+
const lines = JSON.parse(body).data?.items ?? [];
|
|
6597
|
+
const usd = (type) => -lines.filter((line) => type === void 0 || line.type === type).reduce((sum, line) => sum + Number(line.amount ?? 0), 0);
|
|
6598
|
+
return {
|
|
6599
|
+
totalUsd: usd(),
|
|
6600
|
+
modelUsd: usd("inference")
|
|
6601
|
+
};
|
|
6602
|
+
}
|
|
6603
|
+
const activeTurns = /* @__PURE__ */ new WeakMap();
|
|
6604
|
+
/**
|
|
6605
|
+
* Meter one turn: the sandbox's ledger model charges between the turn's start
|
|
6606
|
+
* and the returned function's call. Undefined when the ledger cannot be read or
|
|
6607
|
+
* another turn on the same box overlapped, since the ledger cannot split them.
|
|
6608
|
+
*/
|
|
6609
|
+
function meterTurn(box, fetch, id) {
|
|
6610
|
+
const active = activeTurns.get(box) ?? /* @__PURE__ */ new Set();
|
|
6611
|
+
activeTurns.set(box, active);
|
|
6612
|
+
for (const other of active) other.overlapped = true;
|
|
6613
|
+
const turn = { overlapped: active.size > 0 };
|
|
6614
|
+
active.add(turn);
|
|
6615
|
+
const read = async () => fetch && await sandboxLedgerUsd(fetch, id).then((usd) => usd.modelUsd, () => void 0);
|
|
6616
|
+
const start = read();
|
|
6617
|
+
return async () => {
|
|
6618
|
+
active.delete(turn);
|
|
6619
|
+
if (turn.overlapped) return void 0;
|
|
6620
|
+
const [before, after] = await Promise.all([start, read()]);
|
|
6621
|
+
if (before === void 0 || after === void 0) return void 0;
|
|
6622
|
+
return Math.max(0, Math.round((after - before) * 1e9) / 1e9);
|
|
6623
|
+
};
|
|
6624
|
+
}
|
|
6625
|
+
//#endregion
|
|
6472
6626
|
//#region src/capabilities.ts
|
|
6473
6627
|
function invalidCapabilities(message) {
|
|
6474
6628
|
throw new ServerError(`Capability discovery returned ${message}`, 502, {
|
|
@@ -7512,7 +7666,7 @@ const interactionResolutionDeliveryStateSchema = z.enum([
|
|
|
7512
7666
|
const interactionResolutionAcknowledgementSchema = z.strictObject({
|
|
7513
7667
|
status: z.enum(["accepted", "already_resolved_same"]),
|
|
7514
7668
|
operationId: z.string().min(1),
|
|
7515
|
-
responseDigest: sha256DigestSchema,
|
|
7669
|
+
responseDigest: sha256DigestSchema$1,
|
|
7516
7670
|
interactionId: z.string().min(1),
|
|
7517
7671
|
sessionId: z.string().min(1),
|
|
7518
7672
|
outcome: z.enum([
|
|
@@ -7540,7 +7694,7 @@ const InteractionConflictEnvelopeSchema = z.object({
|
|
|
7540
7694
|
code: z.string().min(1),
|
|
7541
7695
|
message: z.string().min(1),
|
|
7542
7696
|
status: REFUSED_INTERACTION_STATUS,
|
|
7543
|
-
existingResponseDigest: sha256DigestSchema.optional(),
|
|
7697
|
+
existingResponseDigest: sha256DigestSchema$1.optional(),
|
|
7544
7698
|
existingOperationId: z.string().min(1).optional(),
|
|
7545
7699
|
resolvedAt: z.string().min(1).optional()
|
|
7546
7700
|
})
|
|
@@ -7568,7 +7722,7 @@ function bindingsEqual(left, right) {
|
|
|
7568
7722
|
return left.requestDigest === right.requestDigest && left.runId === right.runId && left.provider === right.provider && left.environmentId === right.environmentId && left.sessionId === right.sessionId && left.executionId === right.executionId && left.interactionId === right.interactionId;
|
|
7569
7723
|
}
|
|
7570
7724
|
function assertResolutionMatches(resolution, sessionId, submitted, response, endpoint) {
|
|
7571
|
-
const expectedDigest = canonicalCandidateDigest(submitted);
|
|
7725
|
+
const expectedDigest = canonicalCandidateDigest$1(submitted);
|
|
7572
7726
|
if (resolution.sessionId !== sessionId || resolution.interactionId !== submitted.id || resolution.outcome !== submitted.outcome || resolution.responseDigest !== expectedDigest) throw invalidRuntimeResponse("Sidecar returned a resolution for another interaction response", response, endpoint);
|
|
7573
7727
|
}
|
|
7574
7728
|
/** Parse one interaction response without discarding replay information. */
|
|
@@ -8312,7 +8466,8 @@ var SandboxPromptCapabilities = class extends SandboxPromptTransportCapabilities
|
|
|
8312
8466
|
const outcomeTracker = createAgentRunOutcomeTracker();
|
|
8313
8467
|
let executionId = options?.lastEventId ? options.executionId : void 0;
|
|
8314
8468
|
let usage;
|
|
8315
|
-
|
|
8469
|
+
const { client } = state(this);
|
|
8470
|
+
const meteredCostUsd = meterTurn(this, client.platformFetch?.bind(client), this.id);
|
|
8316
8471
|
const controller = new AbortController();
|
|
8317
8472
|
let interrupted = false;
|
|
8318
8473
|
try {
|
|
@@ -8327,12 +8482,10 @@ var SandboxPromptCapabilities = class extends SandboxPromptTransportCapabilities
|
|
|
8327
8482
|
responseText = applySandboxEventText(responseText, event);
|
|
8328
8483
|
const eventExecutionId = event.data.executionId;
|
|
8329
8484
|
if (typeof eventExecutionId === "string" && eventExecutionId.length > 0) executionId = eventExecutionId;
|
|
8330
|
-
if (event.type === "result" || event.type === "done")
|
|
8331
|
-
usage = readTokenUsage(event.data) ?? usage;
|
|
8332
|
-
costUsd = readTokenCostUsd(event.data) ?? costUsd;
|
|
8333
|
-
}
|
|
8485
|
+
if (event.type === "result" || event.type === "done") usage = readTokenUsage(event.data) ?? usage;
|
|
8334
8486
|
}
|
|
8335
8487
|
const outcome = outcomeTracker.finish();
|
|
8488
|
+
const durationMs = Date.now() - startTime;
|
|
8336
8489
|
return {
|
|
8337
8490
|
success: outcome.success,
|
|
8338
8491
|
status: interrupted ? "unknown" : outcome.status,
|
|
@@ -8348,18 +8501,20 @@ var SandboxPromptCapabilities = class extends SandboxPromptTransportCapabilities
|
|
|
8348
8501
|
question: outcome.question,
|
|
8349
8502
|
plan: outcome.plan,
|
|
8350
8503
|
traceId,
|
|
8351
|
-
durationMs
|
|
8504
|
+
durationMs,
|
|
8352
8505
|
usage,
|
|
8353
|
-
costUsd
|
|
8506
|
+
costUsd: await meteredCostUsd()
|
|
8354
8507
|
};
|
|
8355
8508
|
} catch (err) {
|
|
8509
|
+
const durationMs = Date.now() - startTime;
|
|
8356
8510
|
return {
|
|
8357
8511
|
success: false,
|
|
8358
8512
|
status: "failed",
|
|
8359
8513
|
...executionId ? { executionId } : {},
|
|
8360
8514
|
error: err instanceof Error ? err.message : String(err),
|
|
8361
8515
|
traceId,
|
|
8362
|
-
durationMs
|
|
8516
|
+
durationMs,
|
|
8517
|
+
costUsd: await meteredCostUsd()
|
|
8363
8518
|
};
|
|
8364
8519
|
} finally {
|
|
8365
8520
|
controller.abort();
|
|
@@ -8484,7 +8639,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
8484
8639
|
origin: "runtime",
|
|
8485
8640
|
endpoint: `/agents/sessions/${encodeURIComponent(id)}/interactive`
|
|
8486
8641
|
});
|
|
8487
|
-
if (canonicalCandidateDigest(status.ref) !== canonicalCandidateDigest(exactCommand.ref)) throw new ValidationError("Interactive prompt ref or control does not match the session");
|
|
8642
|
+
if (canonicalCandidateDigest$1(status.ref) !== canonicalCandidateDigest$1(exactCommand.ref)) throw new ValidationError("Interactive prompt ref or control does not match the session");
|
|
8488
8643
|
const endpoint = `/agents/sessions/${encodeURIComponent(id)}/interactive/prompt`;
|
|
8489
8644
|
const response = await this.runtimeFetch(endpoint, {
|
|
8490
8645
|
method: "POST",
|
|
@@ -8662,7 +8817,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
8662
8817
|
origin: "runtime"
|
|
8663
8818
|
});
|
|
8664
8819
|
const acknowledgement = parsed.data.data;
|
|
8665
|
-
if (canonicalCandidateDigest(acknowledgement.ref) !== canonicalCandidateDigest(exactRef)) throw new ServerError("Interactive lifecycle stop acknowledgement does not match the exact ref", 502, {
|
|
8820
|
+
if (canonicalCandidateDigest$1(acknowledgement.ref) !== canonicalCandidateDigest$1(exactRef)) throw new ServerError("Interactive lifecycle stop acknowledgement does not match the exact ref", 502, {
|
|
8666
8821
|
endpoint,
|
|
8667
8822
|
origin: "runtime"
|
|
8668
8823
|
});
|
|
@@ -8837,7 +8992,6 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
8837
8992
|
const outcomeTracker = createAgentRunOutcomeTracker();
|
|
8838
8993
|
let traceId;
|
|
8839
8994
|
let usage;
|
|
8840
|
-
let costUsd;
|
|
8841
8995
|
let modelCalls;
|
|
8842
8996
|
const events = this._executionEvents(id, executionId);
|
|
8843
8997
|
for await (const event of events) {
|
|
@@ -8847,7 +9001,6 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
8847
9001
|
const data = event.data;
|
|
8848
9002
|
if (typeof data.executionId === "string" && data.executionId) resultExecutionId = data.executionId;
|
|
8849
9003
|
usage = readTokenUsage(data) ?? usage;
|
|
8850
|
-
costUsd = readTokenCostUsd(data) ?? costUsd;
|
|
8851
9004
|
modelCalls = readModelCalls(data.modelCalls) ?? modelCalls;
|
|
8852
9005
|
}
|
|
8853
9006
|
if (event.type === "trace.id") traceId = event.data.traceId;
|
|
@@ -8870,7 +9023,6 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
8870
9023
|
traceId,
|
|
8871
9024
|
durationMs: Date.now() - startTime,
|
|
8872
9025
|
usage,
|
|
8873
|
-
costUsd,
|
|
8874
9026
|
...modelCalls ? { modelCalls } : {}
|
|
8875
9027
|
};
|
|
8876
9028
|
}
|
|
@@ -11141,7 +11293,7 @@ var SandboxInteractiveTerminalOperations = class {
|
|
|
11141
11293
|
origin: "runtime",
|
|
11142
11294
|
endpoint: `/agents/sessions/${encodeURIComponent(id)}/interactive`
|
|
11143
11295
|
}, "INTERACTIVE_SESSION_EXITED");
|
|
11144
|
-
if (canonicalCandidateDigest(status.ref) !== canonicalCandidateDigest(exactRef)) throw new ValidationError("Interactive attach ref does not match the current session");
|
|
11296
|
+
if (canonicalCandidateDigest$1(status.ref) !== canonicalCandidateDigest$1(exactRef)) throw new ValidationError("Interactive attach ref does not match the current session");
|
|
11145
11297
|
return exactRef;
|
|
11146
11298
|
}
|
|
11147
11299
|
/**
|
|
@@ -11690,4 +11842,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
|
|
|
11690
11842
|
}
|
|
11691
11843
|
};
|
|
11692
11844
|
//#endregion
|
|
11693
|
-
export {
|
|
11845
|
+
export { normalizeSandboxCreateReceipt as A, createRetryDelayMs as B, SandboxOperationFailedError as C, validateDeferredProfileFileMounts as D, splitInlineProfileSkills as E, normalizeProxySecretReceipt as F, isRetryableCreateError as G, isCapacityShortageCreateError as H, normalizeSandboxShape as I, waitForCreateRetry as K, DEFAULT_CREATE_TIMEOUT_MS as L, parseStopPhase as M, normalizeConnection as N, isRetryableProfileFileMaterializeFailure as O, normalizeEgressPolicyFields as P, DEFAULT_GPU_CREATE_TIMEOUT_MS as R, SandboxOperation as S, splitInlineProfileFileMounts as T, isDeployWindowCreateError as U, generateIdempotencyKey as V, isRateLimitCreateError as W, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, sandboxLedgerUsd as d, InteractiveSessionHandle as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i, normalizeStartupDiagnostics as j, normalizeCaptureProof as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, InteractiveTerminalFrameLog as p, canonicalAgentProfileDigest as q, WorkspaceImages as r, otelTraceIdForTangleTrace as s, SandboxInstance as t, SandboxSession as u, collectAgentResponseText as v, materializeProfileFileMounts as w, ManagedProcessClient as x, getSandboxEventText as y, DEPLOY_WINDOW_RETRY_MS as z };
|
package/dist/tangle/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_JOBS_CONTRACT, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as TANGLE_CHAIN_ID, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TangleSandboxClientConfig, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-
|
|
1
|
+
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_JOBS_CONTRACT, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as TANGLE_CHAIN_ID, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TangleSandboxClientConfig, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-Xfxbbfh8.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JobQuoteDetails, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, QuoteDomain, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, SignedQuote, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-
|
|
1
|
+
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-EconMBgP.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-bWRanOKP.js";
|
|
2
2
|
import { i as readResponseJson } from "./errors-BfR-fBvN.js";
|
|
3
3
|
import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-vaFoyyiO.js";
|
|
4
4
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
|
@@ -410,7 +410,7 @@ declare class TerminalStreamError extends Error {
|
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
//#endregion
|
|
413
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
413
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/plan.d.ts
|
|
414
414
|
/**
|
|
415
415
|
* Typed server-originated continuation. Adapters consume this instead of
|
|
416
416
|
* inferring approval from a free-form user message.
|
|
@@ -446,7 +446,7 @@ declare const PlanContinuationSchema: z.ZodObject<{
|
|
|
446
446
|
}, z.core.$strict>;
|
|
447
447
|
type PlanContinuation = z.infer<typeof PlanContinuationSchema>;
|
|
448
448
|
//#endregion
|
|
449
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
449
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/interaction-data.d.ts
|
|
450
450
|
declare const InteractionSecretReferenceSchema: z.ZodObject<{
|
|
451
451
|
kind: z.ZodLiteral<"secret_handle">;
|
|
452
452
|
handleId: z.ZodString;
|
|
@@ -467,7 +467,7 @@ declare const InteractionResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
467
467
|
}, z.core.$strict>], "outcome">;
|
|
468
468
|
type InteractionResolution = z.infer<typeof InteractionResolutionSchema>;
|
|
469
469
|
//#endregion
|
|
470
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
470
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/proxy-secrets.d.ts
|
|
471
471
|
declare const ProxySecretBindingSchema: z.ZodObject<{
|
|
472
472
|
hosts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
473
473
|
methods: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
@@ -680,7 +680,7 @@ declare const ProxySecretCapabilitiesSchema: z.ZodObject<{
|
|
|
680
680
|
}, z.core.$strict>;
|
|
681
681
|
type ProxySecretCapabilities = z.infer<typeof ProxySecretCapabilitiesSchema>;
|
|
682
682
|
//#endregion
|
|
683
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
683
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/harness.d.ts
|
|
684
684
|
/**
|
|
685
685
|
* Recognized execution identities, not a deployment's list of installed runners.
|
|
686
686
|
* A profile's authored harness remains part of its canonical identity; execution
|
|
@@ -713,7 +713,7 @@ declare const harnessTypeSchema: z.ZodEnum<{
|
|
|
713
713
|
/** One declaration owns runtime validation and the compile-time vocabulary. */
|
|
714
714
|
type HarnessType = z.infer<typeof harnessTypeSchema>;
|
|
715
715
|
//#endregion
|
|
716
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
716
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-profile.d.ts
|
|
717
717
|
/**
|
|
718
718
|
* Permission policy value for a capability.
|
|
719
719
|
*/
|
|
@@ -1189,11 +1189,11 @@ interface AgentProfileValidationResult {
|
|
|
1189
1189
|
normalizedProfile?: AgentProfile;
|
|
1190
1190
|
}
|
|
1191
1191
|
//#endregion
|
|
1192
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
1192
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-candidate.d.ts
|
|
1193
1193
|
/** Full SHA-256 digest with an explicit algorithm prefix. */
|
|
1194
1194
|
type Sha256Digest = `sha256:${string}`;
|
|
1195
1195
|
//#endregion
|
|
1196
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
1196
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/interaction-fields.d.ts
|
|
1197
1197
|
declare const InteractionAnswerSpecSchema: z.ZodObject<{
|
|
1198
1198
|
fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1199
1199
|
type: z.ZodLiteral<"text">;
|
|
@@ -1247,7 +1247,7 @@ declare const InteractionResponseScopeSchema: z.ZodEnum<{
|
|
|
1247
1247
|
persistent: "persistent";
|
|
1248
1248
|
}>;
|
|
1249
1249
|
//#endregion
|
|
1250
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
1250
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/interaction-envelope.d.ts
|
|
1251
1251
|
declare const InteractionSubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1252
1252
|
type: z.ZodLiteral<"tool">;
|
|
1253
1253
|
toolName: z.ZodString;
|
|
@@ -1354,7 +1354,7 @@ declare const InteractionAcknowledgementSchema: z.ZodObject<{
|
|
|
1354
1354
|
}, z.core.$strict>;
|
|
1355
1355
|
type InteractionAcknowledgement = z.infer<typeof InteractionAcknowledgementSchema>;
|
|
1356
1356
|
//#endregion
|
|
1357
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
1357
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/runtime-control.d.ts
|
|
1358
1358
|
/** Provider-neutral coordinates sufficient to recreate control of one run. */
|
|
1359
1359
|
interface AgentRunControlRef {
|
|
1360
1360
|
runId: string;
|
|
@@ -1391,7 +1391,7 @@ interface AgentRunCancellationAcknowledgement {
|
|
|
1391
1391
|
existingRequestDigest?: Sha256Digest;
|
|
1392
1392
|
}
|
|
1393
1393
|
//#endregion
|
|
1394
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
1394
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/environment-terminal.d.ts
|
|
1395
1395
|
/**
|
|
1396
1396
|
* Provider-neutral handle for one interactive terminal.
|
|
1397
1397
|
*
|
|
@@ -1510,7 +1510,7 @@ interface AgentTerminalSession {
|
|
|
1510
1510
|
}): AsyncIterable<TerminalOutputEvent>;
|
|
1511
1511
|
}
|
|
1512
1512
|
//#endregion
|
|
1513
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
1513
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/environment-interactive-control.d.ts
|
|
1514
1514
|
/**
|
|
1515
1515
|
* Durable identity of one coding-agent TUI.
|
|
1516
1516
|
*
|
|
@@ -2235,7 +2235,7 @@ interface AgentInteractiveSessionPromptAcknowledgement {
|
|
|
2235
2235
|
existingRequestDigest?: `sha256:${string}`;
|
|
2236
2236
|
}
|
|
2237
2237
|
//#endregion
|
|
2238
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
2238
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/environment-interactive-start.d.ts
|
|
2239
2239
|
/**
|
|
2240
2240
|
* Start one native coding-agent TUI from caller-owned request material.
|
|
2241
2241
|
*
|
|
@@ -2528,13 +2528,13 @@ declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
|
|
|
2528
2528
|
}, z.core.$strict>;
|
|
2529
2529
|
type AgentInteractiveSessionStart = z.infer<typeof AgentInteractiveSessionStartSchema>;
|
|
2530
2530
|
//#endregion
|
|
2531
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
2531
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/runtime-attachments.d.ts
|
|
2532
2532
|
/** Runtime-owned bindings do not alter the authored AgentProfile or candidate identity. */
|
|
2533
2533
|
interface AgentRuntimeAttachments {
|
|
2534
2534
|
mcp: Record<string, AgentProfileMcpServer>;
|
|
2535
2535
|
}
|
|
2536
2536
|
//#endregion
|
|
2537
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.
|
|
2537
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/sandbox-size.d.ts
|
|
2538
2538
|
/**
|
|
2539
2539
|
* Portable sandbox size vocabulary.
|
|
2540
2540
|
*
|