@tangle-network/sandbox 1.0.232 → 1.0.234
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 +6 -4
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +5 -5
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/agent-execution-preparation-BJChICex.js +18 -0
- package/dist/agent-execution-preparation-receipt-BIFxqyr5.js +250 -0
- package/dist/{agent-run-outcome-MsLkgPNu.d.ts → agent-run-outcome-CEf6hJYp.d.ts} +3 -2
- package/dist/{api-request-B0BPgzdp.js → api-request-DgN02xvN.js} +4 -4
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +2 -2
- package/dist/{browser-interactive-control-controller-Bf-DbRCA.js → browser-interactive-control-controller-Bcn-qNH2.js} +4 -250
- package/dist/{browser-interactive-control-controller-D17JJ8B0.d.ts → browser-interactive-control-controller-CcUjQEfa.d.ts} +1 -1
- package/dist/{chunked-upload-BGwaw5np.js → chunked-upload-BlvgxPWx.js} +3 -3
- package/dist/{chunked-upload-file-BnV8qgwV.js → chunked-upload-file-DOeLpMO0.js} +2 -2
- package/dist/{cli-auth-bundle-BE_EfLUx.d.ts → cli-auth-bundle-B91fSxkR.d.ts} +1 -1
- package/dist/cli-auth-bundle-BLAtE6Dc.js +2 -0
- package/dist/{client-CgZADtPk.js → client-4Myv37Rw.js} +14 -13
- package/dist/{client-BTpWpGs-.d.ts → client-OYkwBKG2.d.ts} +7 -7
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-DneF_7bo.js → collaboration-1xRRxdcU.js} +2 -2
- package/dist/core-CUZyz-U8.js +161 -0
- package/dist/core.d.ts +6 -6
- package/dist/core.js +6 -5
- package/dist/{direct-http2-B5bdFrtg.js → direct-http2-Bgb2lHte.js} +1 -1
- package/dist/{errors-dK3-2RCh.js → errors-nXGKGVFe.js} +2 -2
- package/dist/{file-download-CUNdbymj.js → file-download-BjkrYzy_.js} +1 -1
- package/dist/{index-CHP8U613.d.ts → index-C8YpXh5N.d.ts} +6 -6
- package/dist/index.d.ts +11 -11
- package/dist/index.js +14 -13
- package/dist/intelligence/index.d.ts +41 -109
- package/dist/intelligence/index.js +60 -73
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-DbNjY09X.d.ts → interactive-controller-CJ7BBRpv.d.ts} +3 -3
- package/dist/{interactive-controller-Bs7VQ04W.js → interactive-controller-Cr5s-xqq.js} +9 -6
- package/dist/lib/prepared-evidence.js +1 -1
- package/dist/lib/prepared-process.js +1 -1
- package/dist/{lines-n-mBURry.d.ts → lines-CCJZUrBP.d.ts} +1 -1
- package/dist/{lines-DtssoioA.js → lines-CSGBHEjR.js} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-8Ndf1jRw.js → local-cli-auth-CO0byocv.js} +1 -1
- package/dist/{mcp-local-tA5cB3zq.js → mcp-local-BC2LLdhQ.js} +4 -4
- package/dist/{prepared-evidence-DBE_xYjq.js → prepared-evidence-ibAysmX8.js} +2 -2
- package/dist/{prepared-process-B1kSkhn-.js → prepared-process-DQ_68Ofg.js} +2 -2
- package/dist/{preview-BHee3FzP.d.ts → preview-zpWYtsDJ.d.ts} +3 -3
- package/dist/{public-templates-ZrUJ507X.d.ts → public-templates-DCFFPDEB.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/public-templates.js +1 -1
- package/dist/{raw-evidence-archive-Cfy_3_3y.js → raw-evidence-archive-Cz4j8VMw.js} +2 -2
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +5 -5
- package/dist/{sandbox-DOvm9OvM.js → sandbox-EEF6M32H.js} +27 -38
- package/dist/{secp256k1-DZM5U2gv.js → secp256k1-ZiYFbGjz.js} +1 -1
- package/dist/{core-Cxww35JL.js → select-seat-B4Y-7vIq.js} +40 -171
- package/dist/select-seat-command.d.ts +9 -3
- package/dist/select-seat-command.js +69 -57
- package/dist/session-gateway/index.js +4 -4
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-DFmy_0hM.js → tangle-CVbbgu8Q.js} +5 -5
- package/dist/{types-CuMa305b.d.ts → types-B5GAxo6l.d.ts} +6 -2
- package/package.json +4 -4
- package/dist/cli-auth-bundle-DvmJ71bO.js +0 -2
- /package/dist/{abort-signal-C0_9B1Hm.js → abort-signal-CRxC2dlT.js} +0 -0
- /package/dist/{cli-auth-bundle-C6DtK7GX-Cjs6D-9c.js → cli-auth-bundle-C6DtK7GX-mBUPER0R.js} +0 -0
- /package/dist/{error-catalog-CGhVLVNq.js → error-catalog-CAbzw67O.js} +0 -0
- /package/dist/{file-transfer-CSL53pv9.js → file-transfer-DOSTbUSR.js} +0 -0
- /package/dist/{index-DsX2pOIn.d.ts → index-C-_HY5NY.d.ts} +0 -0
- /package/dist/{index-D0zHNMSe.d.ts → index-o31uwAkX.d.ts} +0 -0
- /package/dist/{keep-alive-fetch-C2DX2_rG.js → keep-alive-fetch-sGVP8skk.js} +0 -0
- /package/dist/{preview-operations-BBF0BNuZ.js → preview-operations-DWL78boI.js} +0 -0
- /package/dist/{retry-after-header-Bt-XvU-x.js → retry-after-header-BZbs5rig.js} +0 -0
- /package/dist/{retry-policy-CI5tyUGr.js → retry-policy-oW3_ljoc.js} +0 -0
- /package/dist/{sidecar-proxy-error-CeNM5eJj.js → sidecar-proxy-error-DTdbCbUM.js} +0 -0
- /package/dist/{sse-parser-CBQzZvkZ.js → sse-parser-BCG3iL9j.js} +0 -0
- /package/dist/{terminal-stream-types-NBdVKKFu.d.ts → terminal-stream-types-eE97lZ-5.d.ts} +0 -0
- /package/dist/{utils-DqiOGAK5.js → utils-BT2q9nkO.js} +0 -0
package/README.md
CHANGED
|
@@ -552,10 +552,12 @@ await box.grantNativeCredential({
|
|
|
552
552
|
```
|
|
553
553
|
|
|
554
554
|
This uses the account-authenticated Sandbox API. The platform verifies personal
|
|
555
|
-
ownership or current team write access
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
555
|
+
ownership or current team write access and names the seat to the runtime; no
|
|
556
|
+
value crosses. Every `cliAuth` seat is held at the box's egress proxy from
|
|
557
|
+
create, and the box holds only placeholders, so the grant installs from the
|
|
558
|
+
box's own placeholder. A grant naming a seat the box was not created with
|
|
559
|
+
answers 409 `NATIVE_CREDENTIAL_SEAT_SWITCH_UNSUPPORTED`. Sandbox-scoped keys and
|
|
560
|
+
isolated sandboxes cannot grant stored credentials.
|
|
559
561
|
|
|
560
562
|
A runtime reporting `claudeTokenContinuations: true` can use a newly granted token
|
|
561
563
|
on a new turn of an idle Claude session. The old adapter releases its lease
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as SandboxTaskSession, O as SandboxInstance, R as SandboxSession } from "../index-
|
|
2
|
-
import { Bt as SandboxFleetParent, Ha as CodeExecutionResult, Ua as CodeLanguage, Ur as CodeExecutionOptions, Wa as CodeResultPart, ga as BackendConfig, ia as SessionListOptions, mo as BackendType, na as SessionInfo } from "../types-
|
|
3
|
-
import { t as Sandbox } from "../client-
|
|
4
|
-
import { u as PreviewAuthorizer } from "../preview-
|
|
1
|
+
import { I as SandboxTaskSession, O as SandboxInstance, R as SandboxSession } from "../index-C8YpXh5N.js";
|
|
2
|
+
import { Bt as SandboxFleetParent, Ha as CodeExecutionResult, Ua as CodeLanguage, Ur as CodeExecutionOptions, Wa as CodeResultPart, ga as BackendConfig, ia as SessionListOptions, mo as BackendType, na as SessionInfo } from "../types-B5GAxo6l.js";
|
|
3
|
+
import { t as Sandbox } from "../client-OYkwBKG2.js";
|
|
4
|
+
import { u as PreviewAuthorizer } from "../preview-zpWYtsDJ.js";
|
|
5
5
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
6
|
import { JSONSchema } from "zod/v4/core";
|
|
7
7
|
import { ToolSet } from "ai";
|
package/dist/agent/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-
|
|
2
|
-
import { D as assertCurrentBackendType } from "../interactive-controller-
|
|
3
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
4
|
-
import { D as ValidationError, _ as NotFoundError, w as StateError } from "../errors-
|
|
5
|
-
import { t as Sandbox } from "../client-
|
|
1
|
+
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-BC2LLdhQ.js";
|
|
2
|
+
import { D as assertCurrentBackendType } from "../interactive-controller-Cr5s-xqq.js";
|
|
3
|
+
import { t as SandboxInstance } from "../sandbox-EEF6M32H.js";
|
|
4
|
+
import { D as ValidationError, _ as NotFoundError, w as StateError } from "../errors-nXGKGVFe.js";
|
|
5
|
+
import { t as Sandbox } from "../client-4Myv37Rw.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/agent/instances.ts
|
|
8
8
|
const managers = /* @__PURE__ */ new WeakMap();
|
package/dist/agent/preview.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as publishAgentPreview, a as previewOperationTool, c as AgentPreviewOptions, d as PreviewExecutionContext, f as PublishAgentPreviewOptions, g as listAgentPreviews, h as getAgentPreview, i as PreviewTool, l as PreviewAuthorizationRequest, m as ensureAgentPreview, n as PREVIEW_MCP_ALIAS, o as previewToolsForProfile, p as assertPreviewId, r as PREVIEW_TOOLS, s as AgentPreviewError, t as servePreviewMcp, u as PreviewAuthorizer, v as removeAgentPreview, y as resolveSelfSandbox } from "../preview-
|
|
1
|
+
import { _ as publishAgentPreview, a as previewOperationTool, c as AgentPreviewOptions, d as PreviewExecutionContext, f as PublishAgentPreviewOptions, g as listAgentPreviews, h as getAgentPreview, i as PreviewTool, l as PreviewAuthorizationRequest, m as ensureAgentPreview, n as PREVIEW_MCP_ALIAS, o as previewToolsForProfile, p as assertPreviewId, r as PREVIEW_TOOLS, s as AgentPreviewError, t as servePreviewMcp, u as PreviewAuthorizer, v as removeAgentPreview, y as resolveSelfSandbox } from "../preview-zpWYtsDJ.js";
|
|
2
2
|
export { AgentPreviewError, AgentPreviewOptions, PREVIEW_MCP_ALIAS, PREVIEW_TOOLS, PreviewAuthorizationRequest, PreviewAuthorizer, PreviewExecutionContext, PreviewTool, PublishAgentPreviewOptions, assertPreviewId, ensureAgentPreview, getAgentPreview, listAgentPreviews, previewOperationTool, previewToolsForProfile, publishAgentPreview, removeAgentPreview, resolveSelfSandbox, servePreviewMcp };
|
package/dist/agent/preview.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "../profile-schema-C1KpT-wS.js";
|
|
2
|
-
import { a as listAgentPreviews, c as resolveSelfSandbox, i as getAgentPreview, n as assertPreviewId, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "../preview-operations-
|
|
2
|
+
import { a as listAgentPreviews, c as resolveSelfSandbox, i as getAgentPreview, n as assertPreviewId, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "../preview-operations-DWL78boI.js";
|
|
3
3
|
//#region src/agent/preview-policy.ts
|
|
4
4
|
/** Channel-neutral preview tool selection from a host-authored profile. */
|
|
5
5
|
const PREVIEW_TOOLS = [
|
|
@@ -66,7 +66,7 @@ async function servePreviewMcp(request, config) {
|
|
|
66
66
|
if (typeof config.authorize !== "function") throw new Error("Preview MCP requires a host authorization callback");
|
|
67
67
|
const tools = config.tools ?? PREVIEW_TOOLS;
|
|
68
68
|
if (!tools.length || tools.some((tool) => !PREVIEW_TOOLS.includes(tool))) throw new Error("Preview MCP requires an explicit nonempty preview-only tool grant");
|
|
69
|
-
const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-
|
|
69
|
+
const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-BC2LLdhQ.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
|
|
70
70
|
const handle = await createMcpServer(config.box, {
|
|
71
71
|
name: "tangle-previews",
|
|
72
72
|
sessionId: config.sessionId,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { o as canonicalCandidateDigest, u as isCanonicalJsonValue } from "./harness-DMaNgn0S.js";
|
|
2
|
+
import { o as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation.js
|
|
4
|
+
/**
|
|
5
|
+
* Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
|
|
6
|
+
* Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
|
|
7
|
+
* and tool text is ordinary public profile data: it may legitimately discuss
|
|
8
|
+
* credentials, security incidents, or examples that resemble credentials, so
|
|
9
|
+
* pattern matching cannot decide whether it is secret. Resolve opaque secret
|
|
10
|
+
* references only after this public identity is fixed.
|
|
11
|
+
*/
|
|
12
|
+
function canonicalAgentProfileDigest(profile) {
|
|
13
|
+
const material = canonicalAgentProfileValue(agentProfileSchema.parse(profile));
|
|
14
|
+
if (material === void 0 || !isCanonicalJsonValue(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
|
|
15
|
+
return canonicalCandidateDigest(material);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { canonicalAgentProfileDigest as t };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { g as sha256DigestSchema, h as omitTopLevelDigest, m as looksLikeCredential, n as REASONING_EFFORTS, o as canonicalCandidateDigest, p as isWellFormedUnicode, s as canonicalCandidateJson, t as harnessTypeSchema, u as isCanonicalJsonValue } from "./harness-DMaNgn0S.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-workspace-source-snapshot.js
|
|
4
|
+
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
5
|
+
/** Shared public identifier used by workspace lifecycle contracts. */
|
|
6
|
+
const agentWorkspacePublicIdentifierSchema = z.string().min(1).max(500).refine((value) => value.trim().length > 0 && isWellFormedUnicode(value) && !controlCharacterPattern.test(value) && !looksLikeCredential(value), "public workspace identity cannot carry credential-like material");
|
|
7
|
+
const agentWorkspaceSourceSnapshotPolicySchema = z.strictObject({
|
|
8
|
+
kind: z.literal("provider-declared"),
|
|
9
|
+
name: agentWorkspacePublicIdentifierSchema,
|
|
10
|
+
version: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
11
|
+
digest: sha256DigestSchema
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-profile-materialization.js
|
|
15
|
+
/**
|
|
16
|
+
* The canonical AgentProfile leaves that can affect one execution.
|
|
17
|
+
*
|
|
18
|
+
* Compound parents such as `model`, `prompt`, and `resources` are deliberately
|
|
19
|
+
* absent. A producer must report the exact requested leaf instead of claiming
|
|
20
|
+
* a parent while silently dropping one of its children. `systemPrompt` and
|
|
21
|
+
* `appendSystemPrompt` are separate leaves for the same reason: a backend that
|
|
22
|
+
* can only add text must report the requested replacement as unsatisfied rather
|
|
23
|
+
* than acknowledge it.
|
|
24
|
+
*/
|
|
25
|
+
const AGENT_PROFILE_MATERIALIZATION_AXES = [
|
|
26
|
+
"name",
|
|
27
|
+
"description",
|
|
28
|
+
"version",
|
|
29
|
+
"tags",
|
|
30
|
+
"systemPrompt",
|
|
31
|
+
"appendSystemPrompt",
|
|
32
|
+
"instructions",
|
|
33
|
+
"modelDefault",
|
|
34
|
+
"modelSmall",
|
|
35
|
+
"modelProvider",
|
|
36
|
+
"modelReasoningEffort",
|
|
37
|
+
"modelMaxVisibleOutputTokens",
|
|
38
|
+
"modelMaxReasoningTokens",
|
|
39
|
+
"modelMaxTotalOutputTokens",
|
|
40
|
+
"modelMetadata",
|
|
41
|
+
"harness",
|
|
42
|
+
"seats",
|
|
43
|
+
"proxySecrets",
|
|
44
|
+
"permissions",
|
|
45
|
+
"tools",
|
|
46
|
+
"mcp",
|
|
47
|
+
"connections",
|
|
48
|
+
"subagents",
|
|
49
|
+
"files",
|
|
50
|
+
"resourceTools",
|
|
51
|
+
"skills",
|
|
52
|
+
"resourceAgents",
|
|
53
|
+
"commands",
|
|
54
|
+
"knowledge",
|
|
55
|
+
"resourceInstructions",
|
|
56
|
+
"resourceFailOnError",
|
|
57
|
+
"hooks",
|
|
58
|
+
"modes",
|
|
59
|
+
"confidential",
|
|
60
|
+
"metadata",
|
|
61
|
+
"extensions"
|
|
62
|
+
];
|
|
63
|
+
[...Object.entries({
|
|
64
|
+
default: "modelDefault",
|
|
65
|
+
small: "modelSmall",
|
|
66
|
+
provider: "modelProvider",
|
|
67
|
+
reasoningEffort: "modelReasoningEffort",
|
|
68
|
+
maxVisibleOutputTokens: "modelMaxVisibleOutputTokens",
|
|
69
|
+
maxReasoningTokens: "modelMaxReasoningTokens",
|
|
70
|
+
maxTotalOutputTokens: "modelMaxTotalOutputTokens",
|
|
71
|
+
metadata: "modelMetadata"
|
|
72
|
+
}).map(([property, axis]) => ({
|
|
73
|
+
axis,
|
|
74
|
+
rootPath: `/model/${property}`,
|
|
75
|
+
value: (profile) => profile.model?.[property]
|
|
76
|
+
}))];
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation-receipt.js
|
|
79
|
+
const nonBlankStringSchema = z.string().refine((value) => value.trim().length > 0, "value cannot be blank");
|
|
80
|
+
const publicMechanismIdentifierSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}$/, "mechanism must be a public identifier, not launch arguments").refine((value) => !looksLikeCredential(value), "mechanism cannot carry credential-like material");
|
|
81
|
+
const publicLifecycleIdentifierSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._~:/+-]{0,499}$/, "lifecycle identity must be a public identifier").refine((value) => !looksLikeCredential(value), "lifecycle identity cannot carry credential-like material");
|
|
82
|
+
const publicReasonSchema = nonBlankStringSchema.max(4e3).refine((value) => !looksLikeCredential(value), "reason cannot carry credential-like material");
|
|
83
|
+
const jsonPointerSchema = z.string().refine(isCanonicalJsonPointer, "path must be a canonical RFC 6901 JSON Pointer");
|
|
84
|
+
const agentExecutionPreparationAxisResultSchema = z.strictObject({
|
|
85
|
+
axis: z.enum(AGENT_PROFILE_MATERIALIZATION_AXES),
|
|
86
|
+
disposition: z.enum([
|
|
87
|
+
"behavior",
|
|
88
|
+
"control",
|
|
89
|
+
"overridden",
|
|
90
|
+
"unsupported"
|
|
91
|
+
]),
|
|
92
|
+
owner: z.enum(["runtime", "executor"]),
|
|
93
|
+
mechanism: publicMechanismIdentifierSchema,
|
|
94
|
+
evidenceDigest: sha256DigestSchema.optional(),
|
|
95
|
+
path: jsonPointerSchema.optional(),
|
|
96
|
+
reason: publicReasonSchema.optional()
|
|
97
|
+
}).superRefine((result, context) => {
|
|
98
|
+
const requiresReason = result.disposition === "overridden" || result.disposition === "unsupported";
|
|
99
|
+
if (requiresReason && result.reason === void 0) context.addIssue({
|
|
100
|
+
code: "custom",
|
|
101
|
+
path: ["reason"],
|
|
102
|
+
message: `${result.disposition} profile coverage requires a reason`
|
|
103
|
+
});
|
|
104
|
+
if (!requiresReason && result.reason !== void 0) context.addIssue({
|
|
105
|
+
code: "custom",
|
|
106
|
+
path: ["reason"],
|
|
107
|
+
message: `${result.disposition} profile coverage cannot carry an override reason`
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
const reasoningEffortSchema = z.enum(REASONING_EFFORTS);
|
|
111
|
+
const agentExecutionPreparationReasoningEffortSchema = z.strictObject({
|
|
112
|
+
requested: reasoningEffortSchema,
|
|
113
|
+
resolved: reasoningEffortSchema.optional(),
|
|
114
|
+
fidelity: z.enum([
|
|
115
|
+
"exact",
|
|
116
|
+
"clamped",
|
|
117
|
+
"unsupported"
|
|
118
|
+
])
|
|
119
|
+
}).superRefine((effort, context) => {
|
|
120
|
+
if (effort.fidelity === "unsupported") {
|
|
121
|
+
if (effort.resolved !== void 0) context.addIssue({
|
|
122
|
+
code: "custom",
|
|
123
|
+
path: ["resolved"],
|
|
124
|
+
message: "unsupported reasoning effort cannot claim a resolved value"
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (effort.resolved === void 0) {
|
|
129
|
+
context.addIssue({
|
|
130
|
+
code: "custom",
|
|
131
|
+
path: ["resolved"],
|
|
132
|
+
message: `${effort.fidelity} reasoning fidelity requires a resolved value`
|
|
133
|
+
});
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (effort.fidelity === "exact" && effort.resolved !== effort.requested) context.addIssue({
|
|
137
|
+
code: "custom",
|
|
138
|
+
path: ["resolved"],
|
|
139
|
+
message: "exact reasoning fidelity must preserve the requested effort"
|
|
140
|
+
});
|
|
141
|
+
if (effort.fidelity === "clamped") {
|
|
142
|
+
if (effort.resolved === effort.requested) context.addIssue({
|
|
143
|
+
code: "custom",
|
|
144
|
+
path: ["resolved"],
|
|
145
|
+
message: "clamped reasoning fidelity must change the requested effort"
|
|
146
|
+
});
|
|
147
|
+
else if (!isDownwardReasoningClamp(effort.requested, effort.resolved)) context.addIssue({
|
|
148
|
+
code: "custom",
|
|
149
|
+
path: ["resolved"],
|
|
150
|
+
message: "reasoning effort may clamp down but must never increase"
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const agentExecutionPreparationReceiptSchema = z.strictObject({
|
|
155
|
+
kind: z.literal("agent-execution-preparation"),
|
|
156
|
+
schemaVersion: z.literal(1),
|
|
157
|
+
preparationId: nonBlankStringSchema.max(500),
|
|
158
|
+
requestDigest: sha256DigestSchema,
|
|
159
|
+
authoredProfileDigest: sha256DigestSchema,
|
|
160
|
+
effectiveProfileDigest: sha256DigestSchema,
|
|
161
|
+
backend: nonBlankStringSchema.max(200),
|
|
162
|
+
harness: harnessTypeSchema,
|
|
163
|
+
harnessVersion: nonBlankStringSchema.max(200),
|
|
164
|
+
resolvedModel: z.strictObject({
|
|
165
|
+
requested: z.string().max(500),
|
|
166
|
+
resolved: nonBlankStringSchema.max(500),
|
|
167
|
+
provider: z.string().max(200).optional(),
|
|
168
|
+
reasoningEffort: agentExecutionPreparationReasoningEffortSchema.optional()
|
|
169
|
+
}),
|
|
170
|
+
workspace: z.strictObject({
|
|
171
|
+
leaseId: publicLifecycleIdentifierSchema,
|
|
172
|
+
provider: publicLifecycleIdentifierSchema,
|
|
173
|
+
identityDigest: sha256DigestSchema,
|
|
174
|
+
isolation: z.enum(["per-run", "shared"]),
|
|
175
|
+
sourceSnapshotDigest: sha256DigestSchema,
|
|
176
|
+
sourceSnapshotPolicy: agentWorkspaceSourceSnapshotPolicySchema,
|
|
177
|
+
preparedWorkspaceDigest: sha256DigestSchema,
|
|
178
|
+
profileActivationDigest: sha256DigestSchema
|
|
179
|
+
}),
|
|
180
|
+
axisResults: z.array(agentExecutionPreparationAxisResultSchema),
|
|
181
|
+
executionPlanDigest: sha256DigestSchema,
|
|
182
|
+
materializer: z.strictObject({
|
|
183
|
+
name: nonBlankStringSchema.max(200),
|
|
184
|
+
version: nonBlankStringSchema.max(200)
|
|
185
|
+
}),
|
|
186
|
+
expiresAtMs: z.number().int().positive().safe(),
|
|
187
|
+
digest: sha256DigestSchema
|
|
188
|
+
}).superRefine((receipt, context) => {
|
|
189
|
+
const seen = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const [index, result] of receipt.axisResults.entries()) {
|
|
191
|
+
const key = agentExecutionPreparationAxisResultKey(result.axis, result.path);
|
|
192
|
+
const previous = seen.get(key);
|
|
193
|
+
if (previous !== void 0) context.addIssue({
|
|
194
|
+
code: "custom",
|
|
195
|
+
path: ["axisResults", index],
|
|
196
|
+
message: agentExecutionPreparationAxisResultsEqual(previous, result) ? "duplicate profile axis/path result" : "conflicting profile axis/path results"
|
|
197
|
+
});
|
|
198
|
+
else seen.set(key, result);
|
|
199
|
+
if (index > 0 && compareAgentExecutionPreparationAxisResults(receipt.axisResults[index - 1], result) >= 0) context.addIssue({
|
|
200
|
+
code: "custom",
|
|
201
|
+
path: ["axisResults", index],
|
|
202
|
+
message: "profile axis/path results must be canonically sorted"
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (!isCanonicalJsonValue(receipt)) context.addIssue({
|
|
206
|
+
code: "custom",
|
|
207
|
+
message: "execution preparation receipt must contain only RFC 8785 JSON values"
|
|
208
|
+
});
|
|
209
|
+
else if (canonicalCandidateDigest(omitTopLevelDigest(receipt)) !== receipt.digest) context.addIssue({
|
|
210
|
+
code: "custom",
|
|
211
|
+
path: ["digest"],
|
|
212
|
+
message: "execution preparation receipt digest is invalid"
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
/** @internal Canonical identity for one preparation axis and path. */
|
|
216
|
+
function agentExecutionPreparationAxisResultKey(axis, path) {
|
|
217
|
+
return `${axis}\u0000${path ?? ""}`;
|
|
218
|
+
}
|
|
219
|
+
/** @internal Exact public equality for preparation axis rows. */
|
|
220
|
+
function agentExecutionPreparationAxisResultsEqual(left, right) {
|
|
221
|
+
try {
|
|
222
|
+
return canonicalCandidateJson(left) === canonicalCandidateJson(right);
|
|
223
|
+
} catch {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const AXIS_ORDER = new Map(AGENT_PROFILE_MATERIALIZATION_AXES.map((axis, index) => [axis, index]));
|
|
228
|
+
/** @internal Canonical order for preparation axis rows. */
|
|
229
|
+
function compareAgentExecutionPreparationAxisResults(left, right) {
|
|
230
|
+
const axisDifference = (AXIS_ORDER.get(left.axis) ?? Number.MAX_SAFE_INTEGER) - (AXIS_ORDER.get(right.axis) ?? Number.MAX_SAFE_INTEGER);
|
|
231
|
+
if (axisDifference !== 0) return axisDifference;
|
|
232
|
+
const leftPath = left.path ?? "";
|
|
233
|
+
const rightPath = right.path ?? "";
|
|
234
|
+
return leftPath < rightPath ? -1 : leftPath > rightPath ? 1 : 0;
|
|
235
|
+
}
|
|
236
|
+
function isCanonicalJsonPointer(value) {
|
|
237
|
+
if (!value.startsWith("/") || !isWellFormedUnicode(value)) return false;
|
|
238
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
239
|
+
if (value[index] !== "~") continue;
|
|
240
|
+
const escape = value[index + 1];
|
|
241
|
+
if (escape !== "0" && escape !== "1") return false;
|
|
242
|
+
index += 1;
|
|
243
|
+
}
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
function isDownwardReasoningClamp(requested, resolved) {
|
|
247
|
+
return REASONING_EFFORTS.indexOf(resolved) < REASONING_EFFORTS.indexOf(requested);
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
export { agentExecutionPreparationReceiptSchema as t };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Ct as InteractionRequest } from "./terminal-stream-types-
|
|
2
|
-
import { Di as SandboxEvent, _i as DurablePlanSnapshot, ci as AgentApprovalRequirement, di as AgentToolInvocation, li as AgentQuestionRequest, ui as AgentRunStatus } from "./types-
|
|
1
|
+
import { Ct as InteractionRequest } from "./terminal-stream-types-eE97lZ-5.js";
|
|
2
|
+
import { Di as SandboxEvent, _i as DurablePlanSnapshot, ci as AgentApprovalRequirement, di as AgentToolInvocation, li as AgentQuestionRequest, ui as AgentRunStatus } from "./types-B5GAxo6l.js";
|
|
3
3
|
|
|
4
4
|
//#region src/agent-run-outcome.d.ts
|
|
5
5
|
interface AgentRunOutcome {
|
|
6
|
+
failure?: Readonly<Record<string, unknown>>;
|
|
6
7
|
success: boolean;
|
|
7
8
|
status: AgentRunStatus;
|
|
8
9
|
error?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as catalogEntry, t as ERROR_CATALOG } from "./error-catalog-
|
|
2
|
-
import { t as parseSandboxRetryAfterHeader } from "./retry-after-header-
|
|
3
|
-
import { c as retryBudget, n as SANDBOX_API_RETRY_SCOPE, o as isUndelivered, r as abortableSleep, s as planResend } from "./retry-policy-
|
|
1
|
+
import { r as catalogEntry, t as ERROR_CATALOG } from "./error-catalog-CAbzw67O.js";
|
|
2
|
+
import { t as parseSandboxRetryAfterHeader } from "./retry-after-header-BZbs5rig.js";
|
|
3
|
+
import { c as retryBudget, n as SANDBOX_API_RETRY_SCOPE, o as isUndelivered, r as abortableSleep, s as planResend } from "./retry-policy-oW3_ljoc.js";
|
|
4
4
|
//#region src/lib/response-rewrap.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Response wrappers that must outlive the fetch Response they wrap.
|
|
@@ -30,7 +30,7 @@ function rewrapResponse(original, headers, body = original.body) {
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/lib/api-request.mjs
|
|
32
32
|
/** The package version tsdown.config.ts defines; unbuilt source reports 0.0.0. */
|
|
33
|
-
const SDK_VERSION = "1.0.
|
|
33
|
+
const SDK_VERSION = "1.0.234";
|
|
34
34
|
function withRequestContextHeaders(response, path, method, body = response.body) {
|
|
35
35
|
const headers = new Headers(response.headers);
|
|
36
36
|
headers.set("x-tangle-request-path", path);
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema, t as CliAuthReference } from "../cli-auth-bundle-
|
|
2
|
-
import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-
|
|
1
|
+
import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema, t as CliAuthReference } from "../cli-auth-bundle-B91fSxkR.js";
|
|
2
|
+
import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-C-_HY5NY.js";
|
|
3
3
|
export { AnyTokenPayload, BatchScopedTokenPayload, CliAuthReference, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, assertCliAuthReferenceSupported, cliAuthReferenceSchema, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, materializeCliAuthBundle, unsafeDecodeToken, verifyToken };
|
package/dist/auth/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-C6DtK7GX-
|
|
2
|
-
import "../cli-auth-bundle-
|
|
1
|
+
import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-C6DtK7GX-mBUPER0R.js";
|
|
2
|
+
import "../cli-auth-bundle-BLAtE6Dc.js";
|
|
3
3
|
//#region src/auth/tokens.ts
|
|
4
4
|
const textEncoder = new TextEncoder();
|
|
5
5
|
const textDecoder = new TextDecoder();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema,
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
1
|
+
import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema, o as canonicalCandidateDigest, w as boundedJsonRecordSchema, x as boundedEventContentRecordSchema, y as CONTRACT_MAX_STRING_LENGTH } from "./harness-DMaNgn0S.js";
|
|
2
|
+
import { t as agentExecutionPreparationReceiptSchema } from "./agent-execution-preparation-receipt-BIFxqyr5.js";
|
|
3
|
+
import { t as awaitWithAbort } from "./abort-signal-CRxC2dlT.js";
|
|
4
|
+
import { i as fetchSandboxApi } from "./api-request-DgN02xvN.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/native-session-event.js
|
|
6
7
|
/**
|
|
@@ -1204,253 +1205,6 @@ z.strictObject({
|
|
|
1204
1205
|
receivedAt: z.iso.datetime().max(64),
|
|
1205
1206
|
event: CanonicalStreamEventSchema
|
|
1206
1207
|
});
|
|
1207
|
-
//#endregion
|
|
1208
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-workspace-source-snapshot.js
|
|
1209
|
-
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
1210
|
-
/** Shared public identifier used by workspace lifecycle contracts. */
|
|
1211
|
-
const agentWorkspacePublicIdentifierSchema = z.string().min(1).max(500).refine((value) => value.trim().length > 0 && isWellFormedUnicode(value) && !controlCharacterPattern.test(value) && !looksLikeCredential(value), "public workspace identity cannot carry credential-like material");
|
|
1212
|
-
const agentWorkspaceSourceSnapshotPolicySchema = z.strictObject({
|
|
1213
|
-
kind: z.literal("provider-declared"),
|
|
1214
|
-
name: agentWorkspacePublicIdentifierSchema,
|
|
1215
|
-
version: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1216
|
-
digest: sha256DigestSchema
|
|
1217
|
-
});
|
|
1218
|
-
//#endregion
|
|
1219
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-profile-materialization.js
|
|
1220
|
-
/**
|
|
1221
|
-
* The canonical AgentProfile leaves that can affect one execution.
|
|
1222
|
-
*
|
|
1223
|
-
* Compound parents such as `model`, `prompt`, and `resources` are deliberately
|
|
1224
|
-
* absent. A producer must report the exact requested leaf instead of claiming
|
|
1225
|
-
* a parent while silently dropping one of its children. `systemPrompt` and
|
|
1226
|
-
* `appendSystemPrompt` are separate leaves for the same reason: a backend that
|
|
1227
|
-
* can only add text must report the requested replacement as unsatisfied rather
|
|
1228
|
-
* than acknowledge it.
|
|
1229
|
-
*/
|
|
1230
|
-
const AGENT_PROFILE_MATERIALIZATION_AXES = [
|
|
1231
|
-
"name",
|
|
1232
|
-
"description",
|
|
1233
|
-
"version",
|
|
1234
|
-
"tags",
|
|
1235
|
-
"systemPrompt",
|
|
1236
|
-
"appendSystemPrompt",
|
|
1237
|
-
"instructions",
|
|
1238
|
-
"modelDefault",
|
|
1239
|
-
"modelSmall",
|
|
1240
|
-
"modelProvider",
|
|
1241
|
-
"modelReasoningEffort",
|
|
1242
|
-
"modelMaxVisibleOutputTokens",
|
|
1243
|
-
"modelMaxReasoningTokens",
|
|
1244
|
-
"modelMaxTotalOutputTokens",
|
|
1245
|
-
"modelMetadata",
|
|
1246
|
-
"harness",
|
|
1247
|
-
"seats",
|
|
1248
|
-
"proxySecrets",
|
|
1249
|
-
"permissions",
|
|
1250
|
-
"tools",
|
|
1251
|
-
"mcp",
|
|
1252
|
-
"connections",
|
|
1253
|
-
"subagents",
|
|
1254
|
-
"files",
|
|
1255
|
-
"resourceTools",
|
|
1256
|
-
"skills",
|
|
1257
|
-
"resourceAgents",
|
|
1258
|
-
"commands",
|
|
1259
|
-
"knowledge",
|
|
1260
|
-
"resourceInstructions",
|
|
1261
|
-
"resourceFailOnError",
|
|
1262
|
-
"hooks",
|
|
1263
|
-
"modes",
|
|
1264
|
-
"confidential",
|
|
1265
|
-
"metadata",
|
|
1266
|
-
"extensions"
|
|
1267
|
-
];
|
|
1268
|
-
[...Object.entries({
|
|
1269
|
-
default: "modelDefault",
|
|
1270
|
-
small: "modelSmall",
|
|
1271
|
-
provider: "modelProvider",
|
|
1272
|
-
reasoningEffort: "modelReasoningEffort",
|
|
1273
|
-
maxVisibleOutputTokens: "modelMaxVisibleOutputTokens",
|
|
1274
|
-
maxReasoningTokens: "modelMaxReasoningTokens",
|
|
1275
|
-
maxTotalOutputTokens: "modelMaxTotalOutputTokens",
|
|
1276
|
-
metadata: "modelMetadata"
|
|
1277
|
-
}).map(([property, axis]) => ({
|
|
1278
|
-
axis,
|
|
1279
|
-
rootPath: `/model/${property}`,
|
|
1280
|
-
value: (profile) => profile.model?.[property]
|
|
1281
|
-
}))];
|
|
1282
|
-
//#endregion
|
|
1283
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation-receipt.js
|
|
1284
|
-
const nonBlankStringSchema = z.string().refine((value) => value.trim().length > 0, "value cannot be blank");
|
|
1285
|
-
const publicMechanismIdentifierSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}$/, "mechanism must be a public identifier, not launch arguments").refine((value) => !looksLikeCredential(value), "mechanism cannot carry credential-like material");
|
|
1286
|
-
const publicLifecycleIdentifierSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._~:/+-]{0,499}$/, "lifecycle identity must be a public identifier").refine((value) => !looksLikeCredential(value), "lifecycle identity cannot carry credential-like material");
|
|
1287
|
-
const publicReasonSchema = nonBlankStringSchema.max(4e3).refine((value) => !looksLikeCredential(value), "reason cannot carry credential-like material");
|
|
1288
|
-
const jsonPointerSchema = z.string().refine(isCanonicalJsonPointer, "path must be a canonical RFC 6901 JSON Pointer");
|
|
1289
|
-
const agentExecutionPreparationAxisResultSchema = z.strictObject({
|
|
1290
|
-
axis: z.enum(AGENT_PROFILE_MATERIALIZATION_AXES),
|
|
1291
|
-
disposition: z.enum([
|
|
1292
|
-
"behavior",
|
|
1293
|
-
"control",
|
|
1294
|
-
"overridden",
|
|
1295
|
-
"unsupported"
|
|
1296
|
-
]),
|
|
1297
|
-
owner: z.enum(["runtime", "executor"]),
|
|
1298
|
-
mechanism: publicMechanismIdentifierSchema,
|
|
1299
|
-
evidenceDigest: sha256DigestSchema.optional(),
|
|
1300
|
-
path: jsonPointerSchema.optional(),
|
|
1301
|
-
reason: publicReasonSchema.optional()
|
|
1302
|
-
}).superRefine((result, context) => {
|
|
1303
|
-
const requiresReason = result.disposition === "overridden" || result.disposition === "unsupported";
|
|
1304
|
-
if (requiresReason && result.reason === void 0) context.addIssue({
|
|
1305
|
-
code: "custom",
|
|
1306
|
-
path: ["reason"],
|
|
1307
|
-
message: `${result.disposition} profile coverage requires a reason`
|
|
1308
|
-
});
|
|
1309
|
-
if (!requiresReason && result.reason !== void 0) context.addIssue({
|
|
1310
|
-
code: "custom",
|
|
1311
|
-
path: ["reason"],
|
|
1312
|
-
message: `${result.disposition} profile coverage cannot carry an override reason`
|
|
1313
|
-
});
|
|
1314
|
-
});
|
|
1315
|
-
const reasoningEffortSchema = z.enum(REASONING_EFFORTS);
|
|
1316
|
-
const agentExecutionPreparationReasoningEffortSchema = z.strictObject({
|
|
1317
|
-
requested: reasoningEffortSchema,
|
|
1318
|
-
resolved: reasoningEffortSchema.optional(),
|
|
1319
|
-
fidelity: z.enum([
|
|
1320
|
-
"exact",
|
|
1321
|
-
"clamped",
|
|
1322
|
-
"unsupported"
|
|
1323
|
-
])
|
|
1324
|
-
}).superRefine((effort, context) => {
|
|
1325
|
-
if (effort.fidelity === "unsupported") {
|
|
1326
|
-
if (effort.resolved !== void 0) context.addIssue({
|
|
1327
|
-
code: "custom",
|
|
1328
|
-
path: ["resolved"],
|
|
1329
|
-
message: "unsupported reasoning effort cannot claim a resolved value"
|
|
1330
|
-
});
|
|
1331
|
-
return;
|
|
1332
|
-
}
|
|
1333
|
-
if (effort.resolved === void 0) {
|
|
1334
|
-
context.addIssue({
|
|
1335
|
-
code: "custom",
|
|
1336
|
-
path: ["resolved"],
|
|
1337
|
-
message: `${effort.fidelity} reasoning fidelity requires a resolved value`
|
|
1338
|
-
});
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
if (effort.fidelity === "exact" && effort.resolved !== effort.requested) context.addIssue({
|
|
1342
|
-
code: "custom",
|
|
1343
|
-
path: ["resolved"],
|
|
1344
|
-
message: "exact reasoning fidelity must preserve the requested effort"
|
|
1345
|
-
});
|
|
1346
|
-
if (effort.fidelity === "clamped") {
|
|
1347
|
-
if (effort.resolved === effort.requested) context.addIssue({
|
|
1348
|
-
code: "custom",
|
|
1349
|
-
path: ["resolved"],
|
|
1350
|
-
message: "clamped reasoning fidelity must change the requested effort"
|
|
1351
|
-
});
|
|
1352
|
-
else if (!isDownwardReasoningClamp(effort.requested, effort.resolved)) context.addIssue({
|
|
1353
|
-
code: "custom",
|
|
1354
|
-
path: ["resolved"],
|
|
1355
|
-
message: "reasoning effort may clamp down but must never increase"
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
});
|
|
1359
|
-
const agentExecutionPreparationReceiptSchema = z.strictObject({
|
|
1360
|
-
kind: z.literal("agent-execution-preparation"),
|
|
1361
|
-
schemaVersion: z.literal(1),
|
|
1362
|
-
preparationId: nonBlankStringSchema.max(500),
|
|
1363
|
-
requestDigest: sha256DigestSchema,
|
|
1364
|
-
authoredProfileDigest: sha256DigestSchema,
|
|
1365
|
-
effectiveProfileDigest: sha256DigestSchema,
|
|
1366
|
-
backend: nonBlankStringSchema.max(200),
|
|
1367
|
-
harness: harnessTypeSchema,
|
|
1368
|
-
harnessVersion: nonBlankStringSchema.max(200),
|
|
1369
|
-
resolvedModel: z.strictObject({
|
|
1370
|
-
requested: z.string().max(500),
|
|
1371
|
-
resolved: nonBlankStringSchema.max(500),
|
|
1372
|
-
provider: z.string().max(200).optional(),
|
|
1373
|
-
reasoningEffort: agentExecutionPreparationReasoningEffortSchema.optional()
|
|
1374
|
-
}),
|
|
1375
|
-
workspace: z.strictObject({
|
|
1376
|
-
leaseId: publicLifecycleIdentifierSchema,
|
|
1377
|
-
provider: publicLifecycleIdentifierSchema,
|
|
1378
|
-
identityDigest: sha256DigestSchema,
|
|
1379
|
-
isolation: z.enum(["per-run", "shared"]),
|
|
1380
|
-
sourceSnapshotDigest: sha256DigestSchema,
|
|
1381
|
-
sourceSnapshotPolicy: agentWorkspaceSourceSnapshotPolicySchema,
|
|
1382
|
-
preparedWorkspaceDigest: sha256DigestSchema,
|
|
1383
|
-
profileActivationDigest: sha256DigestSchema
|
|
1384
|
-
}),
|
|
1385
|
-
axisResults: z.array(agentExecutionPreparationAxisResultSchema),
|
|
1386
|
-
executionPlanDigest: sha256DigestSchema,
|
|
1387
|
-
materializer: z.strictObject({
|
|
1388
|
-
name: nonBlankStringSchema.max(200),
|
|
1389
|
-
version: nonBlankStringSchema.max(200)
|
|
1390
|
-
}),
|
|
1391
|
-
expiresAtMs: z.number().int().positive().safe(),
|
|
1392
|
-
digest: sha256DigestSchema
|
|
1393
|
-
}).superRefine((receipt, context) => {
|
|
1394
|
-
const seen = /* @__PURE__ */ new Map();
|
|
1395
|
-
for (const [index, result] of receipt.axisResults.entries()) {
|
|
1396
|
-
const key = agentExecutionPreparationAxisResultKey(result.axis, result.path);
|
|
1397
|
-
const previous = seen.get(key);
|
|
1398
|
-
if (previous !== void 0) context.addIssue({
|
|
1399
|
-
code: "custom",
|
|
1400
|
-
path: ["axisResults", index],
|
|
1401
|
-
message: agentExecutionPreparationAxisResultsEqual(previous, result) ? "duplicate profile axis/path result" : "conflicting profile axis/path results"
|
|
1402
|
-
});
|
|
1403
|
-
else seen.set(key, result);
|
|
1404
|
-
if (index > 0 && compareAgentExecutionPreparationAxisResults(receipt.axisResults[index - 1], result) >= 0) context.addIssue({
|
|
1405
|
-
code: "custom",
|
|
1406
|
-
path: ["axisResults", index],
|
|
1407
|
-
message: "profile axis/path results must be canonically sorted"
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
if (!isCanonicalJsonValue(receipt)) context.addIssue({
|
|
1411
|
-
code: "custom",
|
|
1412
|
-
message: "execution preparation receipt must contain only RFC 8785 JSON values"
|
|
1413
|
-
});
|
|
1414
|
-
else if (canonicalCandidateDigest(omitTopLevelDigest(receipt)) !== receipt.digest) context.addIssue({
|
|
1415
|
-
code: "custom",
|
|
1416
|
-
path: ["digest"],
|
|
1417
|
-
message: "execution preparation receipt digest is invalid"
|
|
1418
|
-
});
|
|
1419
|
-
});
|
|
1420
|
-
/** @internal Canonical identity for one preparation axis and path. */
|
|
1421
|
-
function agentExecutionPreparationAxisResultKey(axis, path) {
|
|
1422
|
-
return `${axis}\u0000${path ?? ""}`;
|
|
1423
|
-
}
|
|
1424
|
-
/** @internal Exact public equality for preparation axis rows. */
|
|
1425
|
-
function agentExecutionPreparationAxisResultsEqual(left, right) {
|
|
1426
|
-
try {
|
|
1427
|
-
return canonicalCandidateJson(left) === canonicalCandidateJson(right);
|
|
1428
|
-
} catch {
|
|
1429
|
-
return false;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
const AXIS_ORDER = new Map(AGENT_PROFILE_MATERIALIZATION_AXES.map((axis, index) => [axis, index]));
|
|
1433
|
-
/** @internal Canonical order for preparation axis rows. */
|
|
1434
|
-
function compareAgentExecutionPreparationAxisResults(left, right) {
|
|
1435
|
-
const axisDifference = (AXIS_ORDER.get(left.axis) ?? Number.MAX_SAFE_INTEGER) - (AXIS_ORDER.get(right.axis) ?? Number.MAX_SAFE_INTEGER);
|
|
1436
|
-
if (axisDifference !== 0) return axisDifference;
|
|
1437
|
-
const leftPath = left.path ?? "";
|
|
1438
|
-
const rightPath = right.path ?? "";
|
|
1439
|
-
return leftPath < rightPath ? -1 : leftPath > rightPath ? 1 : 0;
|
|
1440
|
-
}
|
|
1441
|
-
function isCanonicalJsonPointer(value) {
|
|
1442
|
-
if (!value.startsWith("/") || !isWellFormedUnicode(value)) return false;
|
|
1443
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
1444
|
-
if (value[index] !== "~") continue;
|
|
1445
|
-
const escape = value[index + 1];
|
|
1446
|
-
if (escape !== "0" && escape !== "1") return false;
|
|
1447
|
-
index += 1;
|
|
1448
|
-
}
|
|
1449
|
-
return true;
|
|
1450
|
-
}
|
|
1451
|
-
function isDownwardReasoningClamp(requested, resolved) {
|
|
1452
|
-
return REASONING_EFFORTS.indexOf(resolved) < REASONING_EFFORTS.indexOf(requested);
|
|
1453
|
-
}
|
|
1454
1208
|
const agentInteractiveDimensionSchema = z.number().int().positive().max(1e4);
|
|
1455
1209
|
/** @internal Compare every coordinate of two exact run references. */
|
|
1456
1210
|
function sameAgentExactRun(left, right) {
|