@tangle-network/sandbox 1.0.31 → 1.0.32

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.
Files changed (39) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +3 -3
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +1 -1
  5. package/dist/{agent-run-outcome-DXGjmPhJ.d.ts → agent-run-outcome-9BtP7NBt.d.ts} +2 -2
  6. package/dist/auth/index.js +1 -1
  7. package/dist/{browser-interactive-control-controller-BujauBOG.js → browser-interactive-control-controller-BvtNDWql.js} +15 -15
  8. package/dist/{browser-interactive-control-controller-CE_Sm_NP.d.ts → browser-interactive-control-controller-DLqCjRF4.d.ts} +1 -1
  9. package/dist/{cli-auth-bundle-CP67k1J2.js → cli-auth-bundle-CP1BXoLR.js} +1 -1
  10. package/dist/{client-CRRBS-R5.d.ts → client-DsK0Ea5d.d.ts} +5 -5
  11. package/dist/{client-CWcpIyB1.js → client-kk6pKXCu.js} +5 -5
  12. package/dist/{core-CD_K08bh.js → core-B6BFSxJC.js} +3 -3
  13. package/dist/core.d.ts +6 -6
  14. package/dist/core.js +3 -3
  15. package/dist/{harness-DkCl2wJv.js → harness-BnGz2Wng.js} +71 -126
  16. package/dist/{index-CKK1V65I.d.ts → index-Dma53Dv-.d.ts} +5 -5
  17. package/dist/index.d.ts +9 -9
  18. package/dist/index.js +7 -7
  19. package/dist/interactive-control.d.ts +1 -1
  20. package/dist/interactive-control.js +1 -1
  21. package/dist/{interactive-controller-B0g65BjC.js → interactive-controller-BdFyhsao.js} +4 -4
  22. package/dist/{interactive-controller-BVGahfQh.d.ts → interactive-controller-kj6pSOCi.d.ts} +3 -3
  23. package/dist/{lines-CT6ZQ8Tq.d.ts → lines-DAuBNRwu.d.ts} +1 -1
  24. package/dist/lines.d.ts +1 -1
  25. package/dist/{local-cli-auth-tQ_m92Kz.js → local-cli-auth-CNh4Oy17.js} +1 -1
  26. package/dist/{preview-CLzh6Zpn.d.ts → preview-Dv6LSRvg.d.ts} +3 -3
  27. package/dist/{profile-schema-1WmjXjE9.js → profile-schema-DFZTAn1S.js} +171 -73
  28. package/dist/{public-templates-DMyZOU0k.d.ts → public-templates-C-AGDnNh.d.ts} +2 -2
  29. package/dist/public-templates.d.ts +1 -1
  30. package/dist/runtime.d.ts +5 -5
  31. package/dist/runtime.js +2 -2
  32. package/dist/{sandbox-DFT2Z7UT.js → sandbox-DcnMQd34.js} +26 -131
  33. package/dist/select-seat-command.d.ts +1 -1
  34. package/dist/tangle/index.d.ts +1 -1
  35. package/dist/tangle/index.js +1 -1
  36. package/dist/{tangle-BpJVw3gd.js → tangle-DbGX5au3.js} +1 -1
  37. package/dist/{terminal-stream-types-BcZxAiU-.d.ts → terminal-stream-types-IbpWmEvd.d.ts} +16 -16
  38. package/dist/{types-CYyhRYez.d.ts → types-D1wY611n.d.ts} +1 -1
  39. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
- import { C as boundedIdentifierSchema, a as agentCandidateSecretRefSchema, c as environmentNameSchema, d as isSafeExecutable, f as isSafeRelativePath, g as sha256DigestSchema, i as trainedModelIdForArtifact, l as headerNameSchema, m as looksLikeCredential, n as REASONING_EFFORTS, o as canonicalCandidateDigest, p as isWellFormedUnicode, s as canonicalCandidateJson, t as harnessTypeSchema, v as CONTRACT_MAX_ARRAY_LENGTH } from "./harness-DkCl2wJv.js";
1
+ import { C as boundedIdentifierSchema, O as isBoundedJsonMaterial, _ as CONTRACT_MAX_ARRAY_LENGTH, a as agentCandidateSecretRefSchema, c as environmentNameSchema, d as isSafeExecutable, f as isSafeRelativePath, g as sha256DigestSchema, i as trainedModelIdForArtifact, l as headerNameSchema, m as looksLikeCredential, n as REASONING_EFFORTS, o as canonicalCandidateDigest, p as isWellFormedUnicode, s as canonicalCandidateJson, t as harnessTypeSchema, v as CONTRACT_MAX_JSON_NODES } from "./harness-BnGz2Wng.js";
2
2
  import { z } from "zod";
3
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/profile-knowledge.js
3
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/profile-knowledge.js
4
4
  /** Immutable Hub generation identities, never aliases such as latest or a caller's scope. */
5
5
  const agentProfileKnowledgeRefSchema = z.strictObject({
6
6
  sourceId: z.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
@@ -18,7 +18,16 @@ const agentProfileKnowledgeRefsSchema = z.array(agentProfileKnowledgeRefSchema).
18
18
  });
19
19
  });
20
20
  //#endregion
21
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/agent-profile-canonical.js
21
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/agent-profile-canonical.js
22
+ /** Why a value cannot be AgentProfile JSON, with the path of the offending entry. */
23
+ var AgentProfileValueError = class extends Error {
24
+ path;
25
+ constructor(path, reason) {
26
+ super(`AgentProfile ${renderPath(path)} ${reason}`);
27
+ this.path = path;
28
+ this.name = "AgentProfileValueError";
29
+ }
30
+ };
22
31
  /**
23
32
  * Normalize profile-shaped data into the canonical JSON domain used for public
24
33
  * profile identity. Undefined object entries are omitted; unsupported values,
@@ -30,34 +39,48 @@ const agentProfileKnowledgeRefsSchema = z.array(agentProfileKnowledgeRefSchema).
30
39
  function canonicalAgentProfileValue(value) {
31
40
  return normalizeAgentProfileValue(value, [], /* @__PURE__ */ new Set());
32
41
  }
42
+ /**
43
+ * Throw the path-specific reason a value refused by the bounded admission walker is
44
+ * not profile JSON. Reads no accessor and throws at the contract node and depth
45
+ * bounds, so hostile input stays cheap; returns only when the refusal was a bound
46
+ * this walker does not model, such as string or entry length.
47
+ */
48
+ function assertAgentProfileValue(value, path) {
49
+ normalizeAgentProfileValue(value, path, /* @__PURE__ */ new Set(), {
50
+ nodes: CONTRACT_MAX_JSON_NODES,
51
+ base: path.length
52
+ });
53
+ }
33
54
  /** Canonical serialization after applying AgentProfile normalization rules. */
34
55
  function canonicalAgentProfileJson(value) {
35
56
  const normalized = canonicalAgentProfileValue(value);
36
57
  return normalized === void 0 ? void 0 : canonicalCandidateJson(normalized);
37
58
  }
38
- function normalizeAgentProfileValue(value, path, ancestors) {
39
- if (value === void 0) return void 0;
40
- if (value === null || typeof value === "boolean" || typeof value === "string") return value;
41
- if (typeof value === "number") {
42
- if (!Number.isFinite(value)) throw new Error(`AgentProfile ${renderPath(path)} must be finite`);
43
- return value;
44
- }
45
- if (typeof value !== "object") throw new Error(`AgentProfile ${renderPath(path)} is not JSON serializable`);
46
- if (ancestors.has(value)) throw new Error(`AgentProfile ${renderPath(path)} must be acyclic`);
59
+ function normalizeAgentProfileValue(value, path, ancestors, bounds) {
60
+ const refuse = (reason, at = path) => {
61
+ throw new AgentProfileValueError(at, reason);
62
+ };
63
+ if (bounds && --bounds.nodes < 0) refuse("exceeds the contract node bound");
64
+ if (value === void 0 || value === null || typeof value === "boolean" || typeof value === "string") return value;
65
+ if (typeof value === "number") return Number.isFinite(value) ? value : refuse("must be finite");
66
+ if (typeof value !== "object") return refuse("is not JSON serializable");
67
+ if (ancestors.has(value)) refuse("must be acyclic");
47
68
  const prototype = Object.getPrototypeOf(value);
48
- if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) throw new Error(`AgentProfile ${renderPath(path)} must be a plain JSON object`);
69
+ if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) refuse("must be a plain JSON object");
70
+ if (bounds && path.length - bounds.base >= 16) refuse("exceeds the contract depth");
49
71
  const nextAncestors = new Set(ancestors).add(value);
50
- if (Array.isArray(value)) return Array.from({ length: value.length }, (_, index) => {
51
- if (!Object.prototype.hasOwnProperty.call(value, index)) throw new Error(`AgentProfile ${renderPath([...path, index])} cannot be a sparse array hole`);
52
- const entry = value[index];
53
- const normalized = normalizeAgentProfileValue(entry, [...path, index], nextAncestors);
54
- if (normalized === void 0) throw new Error(`AgentProfile ${renderPath([...path, index])} cannot be undefined`);
55
- return normalized;
56
- });
72
+ const entry = (key) => {
73
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
74
+ if (!descriptor) return refuse("cannot be a sparse array hole", [...path, key]);
75
+ if (!("value" in descriptor)) return refuse("must be a data property", [...path, key]);
76
+ const normalized = normalizeAgentProfileValue(descriptor.value, [...path, key], nextAncestors, bounds);
77
+ return normalized === void 0 && typeof key === "number" ? refuse("cannot be undefined", [...path, key]) : normalized;
78
+ };
79
+ if (Array.isArray(value)) return Array.from({ length: value.length }, (_, index) => entry(index));
57
80
  const material = Object.create(null);
58
- for (const [key, entry] of Object.entries(value)) {
59
- if (!isWellFormedUnicode(key)) throw new Error(`AgentProfile ${renderPath(path)} has a record key that is not valid Unicode`);
60
- const normalized = normalizeAgentProfileValue(entry, [...path, key], nextAncestors);
81
+ for (const key of Object.keys(value)) {
82
+ if (!isWellFormedUnicode(key)) refuse("has a record key that is not valid Unicode");
83
+ const normalized = entry(key);
61
84
  if (normalized !== void 0) Object.defineProperty(material, key, {
62
85
  value: normalized,
63
86
  enumerable: true,
@@ -71,7 +94,7 @@ function renderPath(path) {
71
94
  return path.length === 0 ? "root" : path.join(".");
72
95
  }
73
96
  //#endregion
74
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/own-property-record.js
97
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/own-property-record.js
75
98
  /**
76
99
  * Zod records currently assign parsed values onto an ordinary object. The
77
100
  * special own key `__proto__` therefore invokes the legacy prototype setter
@@ -79,8 +102,60 @@ function renderPath(path) {
79
102
  * sees it, then restore the exact UTF-16 key with defineProperty so all string
80
103
  * keys allowed by `Record<string, ...>` remain data rather than object syntax.
81
104
  */
82
- function ownPropertyRecordSchema(valueSchema) {
83
- return z.preprocess(encodeOwnRecordKeys, z.record(z.string().regex(/^u(?:[0-9a-f]{4})*$/, "record keys must contain valid Unicode"), valueSchema).transform((record) => {
105
+ function ownPropertyRecordSchema(valueSchema, { maxEntries = 256, prepareValue } = {}) {
106
+ return z.preprocess((value, context) => {
107
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
108
+ const prototype = Object.getPrototypeOf(value);
109
+ if (prototype !== Object.prototype && prototype !== null) return [];
110
+ let entries = 0;
111
+ for (const key in value) {
112
+ if (!Object.hasOwn(value, key)) continue;
113
+ if (++entries > maxEntries || key.length > 512) {
114
+ context.addIssue({
115
+ code: "custom",
116
+ message: "record exceeds the contract bounds"
117
+ });
118
+ return z.NEVER;
119
+ }
120
+ }
121
+ const encoded = Object.create(null);
122
+ for (const key of Object.keys(value)) {
123
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
124
+ if (!descriptor || !("value" in descriptor)) {
125
+ context.addIssue({
126
+ code: "custom",
127
+ message: "record entries must be data properties"
128
+ });
129
+ return z.NEVER;
130
+ }
131
+ let entry;
132
+ try {
133
+ entry = prepareValue ? prepareValue(key, descriptor.value) : descriptor.value;
134
+ } catch (error) {
135
+ if (!(error instanceof AgentProfileValueError)) throw error;
136
+ context.addIssue({
137
+ code: "custom",
138
+ path: [...error.path],
139
+ message: error.message
140
+ });
141
+ return z.NEVER;
142
+ }
143
+ if (entry === z.NEVER) {
144
+ context.addIssue({
145
+ code: "custom",
146
+ message: "record value exceeds the contract bounds or is not portable JSON"
147
+ });
148
+ return z.NEVER;
149
+ }
150
+ encoded[encodeRecordKey(key)] = entry;
151
+ }
152
+ return encoded;
153
+ }, z.record(z.string().regex(/^u(?:[0-9a-f]{4})*$/, "record keys must contain valid Unicode"), valueSchema).superRefine((_record, context) => {
154
+ for (const issue of context.issues) {
155
+ const key = issue.path?.[0];
156
+ if (typeof key === "string" && /^[ui](?:[0-9a-f]{4})*$/.test(key)) issue.path[0] = decodeRecordKey(key);
157
+ }
158
+ }, { when: () => true }).transform((record) => {
84
159
  const restored = {};
85
160
  for (const [encodedKey, value] of Object.entries(record)) Object.defineProperty(restored, decodeRecordKey(encodedKey), {
86
161
  value,
@@ -91,14 +166,6 @@ function ownPropertyRecordSchema(valueSchema) {
91
166
  return restored;
92
167
  }));
93
168
  }
94
- function encodeOwnRecordKeys(value) {
95
- if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
96
- const prototype = Object.getPrototypeOf(value);
97
- if (prototype !== Object.prototype && prototype !== null) return [];
98
- const encoded = Object.create(null);
99
- for (const [key, entry] of Object.entries(value)) encoded[encodeRecordKey(key)] = entry;
100
- return encoded;
101
- }
102
169
  function encodeRecordKey(value) {
103
170
  let encoded = isWellFormedUnicode(value) ? "u" : "i";
104
171
  for (let index = 0; index < value.length; index += 1) encoded += value.charCodeAt(index).toString(16).padStart(4, "0");
@@ -110,7 +177,7 @@ function decodeRecordKey(value) {
110
177
  return decoded;
111
178
  }
112
179
  //#endregion
113
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/proxy-secrets.js
180
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/proxy-secrets.js
114
181
  /**
115
182
  * Declarations request authority, never grant it. Trusted resolution uses authenticated tenant
116
183
  * and issuer authority, with no personal/team fallback, and pins immutable secret ID/revision.
@@ -184,7 +251,7 @@ const ProxySecretBindingSchema = ProxySecretScopeSchema.extend({
184
251
  ttlSeconds: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional()
185
252
  });
186
253
  const ProxySecretsSchema = z.array(ProxySecretBindingSchema).max(CONTRACT_MAX_ARRAY_LENGTH).refine((bindings) => unique(bindings.map((binding) => binding.envName)), "proxy secret env names must be unique");
187
- ownPropertyRecordSchema(boundedIdentifierSchema.nullable()).refine((parents) => Object.keys(parents).length <= 1024 && Object.keys(parents).every((name) => envNameSchema.safeParse(name).success), "invalid parent selection keys");
254
+ ownPropertyRecordSchema(boundedIdentifierSchema.nullable(), { maxEntries: CONTRACT_MAX_ARRAY_LENGTH }).refine((parents) => Object.keys(parents).every((name) => envNameSchema.safeParse(name).success), "invalid parent selection keys");
188
255
  z.literal(1);
189
256
  const ProxySecretResolvedIdentitySchema = z.strictObject({
190
257
  tenantId: boundedIdentifierSchema,
@@ -276,7 +343,7 @@ z.strictObject({
276
343
  requireInPlace: z.boolean().optional()
277
344
  });
278
345
  //#endregion
279
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/harness-capabilities.js
346
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/harness-capabilities.js
280
347
  /** Canonical harness/model, effort and prompt controls. Model-specific capability comes from the serving catalog. */
281
348
  /** low → high. `none` = thinking off; `ultracode` = max (claude-code mode). */
282
349
  const reasoningLadder = REASONING_EFFORTS;
@@ -574,7 +641,7 @@ function harnessSystemPromptIntents(harness) {
574
641
  return harnessSystemPromptControls[harness] ?? noSystemPromptControls;
575
642
  }
576
643
  //#endregion
577
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/sandbox-size.js
644
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/sandbox-size.js
578
645
  /**
579
646
  * Portable sandbox size vocabulary.
580
647
  *
@@ -597,7 +664,29 @@ const SANDBOX_SIZE_PRESET_NAMES = [
597
664
  "large"
598
665
  ];
599
666
  //#endregion
600
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.9.0/node_modules/@tangle-network/agent-interface/dist/profile-schema.js
667
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/profile-schema.js
668
+ const profileOpaqueValueSchema = z.unknown().transform((value, context) => {
669
+ if (value === void 0 || isBoundedJsonMaterial(value, {
670
+ dataPropertiesOnly: true,
671
+ content: true
672
+ })) return structuredClone(value);
673
+ try {
674
+ assertAgentProfileValue(value, []);
675
+ } catch (error) {
676
+ if (!(error instanceof AgentProfileValueError)) throw error;
677
+ context.addIssue({
678
+ code: "custom",
679
+ path: [...error.path],
680
+ message: error.message
681
+ });
682
+ return z.NEVER;
683
+ }
684
+ context.addIssue({
685
+ code: "custom",
686
+ message: "profile metadata exceeds contract bounds or is not portable JSON"
687
+ });
688
+ return z.NEVER;
689
+ });
601
690
  const agentProfilePermissionValueSchema = z.enum([
602
691
  "allow",
603
692
  "deny",
@@ -622,11 +711,11 @@ const agentProfileFileMountSchema = z.strictObject({
622
711
  });
623
712
  const agentProfileResourcesSchema = z.strictObject({
624
713
  knowledge: agentProfileKnowledgeRefsSchema.optional(),
625
- files: z.array(agentProfileFileMountSchema).optional(),
626
- tools: z.array(agentProfileResourceRefSchema).optional(),
627
- skills: z.array(agentProfileResourceRefSchema).optional(),
628
- agents: z.array(agentProfileResourceRefSchema).optional(),
629
- commands: z.array(agentProfileResourceRefSchema).optional(),
714
+ files: z.array(agentProfileFileMountSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
715
+ tools: z.array(agentProfileResourceRefSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
716
+ skills: z.array(agentProfileResourceRefSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
717
+ agents: z.array(agentProfileResourceRefSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
718
+ commands: z.array(agentProfileResourceRefSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
630
719
  instructions: z.union([z.string(), agentProfileResourceRefSchema]).optional(),
631
720
  failOnError: z.boolean().optional()
632
721
  });
@@ -658,7 +747,7 @@ const agentProfileModelHintsSchema = z.strictObject({
658
747
  maxVisibleOutputTokens: z.number().int().positive().optional(),
659
748
  maxReasoningTokens: z.number().int().positive().optional(),
660
749
  maxTotalOutputTokens: z.number().int().positive().optional(),
661
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
750
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
662
751
  }).superRefine(enforceModelTokenBounds);
663
752
  /** Ordered account selection policy, without credentials or ambient model defaults. */
664
753
  const agentProfileSeatSchema = z.strictObject({
@@ -682,7 +771,7 @@ const agentProfileSeatSchema = z.strictObject({
682
771
  const agentProfilePromptSchema = z.strictObject({
683
772
  systemPrompt: z.string().optional(),
684
773
  appendSystemPrompt: z.string().optional(),
685
- instructions: z.array(z.string()).optional()
774
+ instructions: z.array(z.string()).max(CONTRACT_MAX_ARRAY_LENGTH).optional()
686
775
  });
687
776
  const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
688
777
  const secretCapableNamePattern = /(?:^|[_-])(?:api[_-]?key|access[_-]?key|private[_-]?key|token|secret|password|credentials?|authorization|cookie|database[_-]?url|dsn|pat)(?:[_-]|$)/i;
@@ -722,7 +811,7 @@ const agentSubagentProfileSchema = z.strictObject({
722
811
  tools: ownPropertyRecordSchema(z.boolean()).optional(),
723
812
  permissions: ownPropertyRecordSchema(agentProfilePermissionSchema).optional(),
724
813
  maxSteps: z.number().optional(),
725
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
814
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
726
815
  });
727
816
  const agentProfileHookCommandSchema = z.strictObject({
728
817
  command: z.string(),
@@ -737,7 +826,7 @@ const agentProfileModeSchema = z.strictObject({
737
826
  prompt: z.string().optional(),
738
827
  tools: ownPropertyRecordSchema(z.boolean()).optional(),
739
828
  permissions: ownPropertyRecordSchema(agentProfilePermissionSchema).optional(),
740
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
829
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
741
830
  });
742
831
  const agentProfileConfidentialSchema = z.strictObject({
743
832
  tee: z.string().optional(),
@@ -757,13 +846,13 @@ const remoteMcpUrlSchema = nonBlankMcpValueSchema.refine((value) => {
757
846
  const agentProfileLocalMcpServerSchema = z.strictObject({
758
847
  transport: z.literal("stdio").optional(),
759
848
  command: nonBlankMcpValueSchema.refine(isSafeExecutable, "local MCP command must be a canonical public executable"),
760
- args: z.array(agentProfileConfigValueSchema).optional(),
849
+ args: z.array(agentProfileConfigValueSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
761
850
  env: agentProfileEnvironmentSchema.optional(),
762
851
  cwd: z.string().refine((value) => isSafeRelativePath(value, true), "local MCP cwd must be a canonical workspace-relative path").optional(),
763
852
  url: z.undefined().optional(),
764
853
  headers: z.undefined().optional(),
765
854
  enabled: z.literal(true).optional(),
766
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
855
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
767
856
  });
768
857
  const agentProfileRemoteMcpServerSchema = z.strictObject({
769
858
  transport: z.enum(["sse", "http"]).optional(),
@@ -774,7 +863,7 @@ const agentProfileRemoteMcpServerSchema = z.strictObject({
774
863
  url: remoteMcpUrlSchema,
775
864
  headers: agentProfileHeaderSchema.optional(),
776
865
  enabled: z.literal(true).optional(),
777
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
866
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
778
867
  });
779
868
  const agentProfileDisabledMcpServerSchema = z.strictObject({
780
869
  enabled: z.literal(false),
@@ -785,7 +874,7 @@ const agentProfileDisabledMcpServerSchema = z.strictObject({
785
874
  cwd: z.undefined().optional(),
786
875
  url: z.undefined().optional(),
787
876
  headers: z.undefined().optional(),
788
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
877
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
789
878
  });
790
879
  const agentProfileMcpServerSchema = z.union([
791
880
  agentProfileLocalMcpServerSchema,
@@ -794,10 +883,10 @@ const agentProfileMcpServerSchema = z.union([
794
883
  ]);
795
884
  const agentProfileConnectionSchema = z.strictObject({
796
885
  connectionId: z.string().min(1),
797
- capabilities: z.array(z.string().min(1)).min(1),
886
+ capabilities: z.array(z.string().min(1)).max(CONTRACT_MAX_ARRAY_LENGTH).min(1),
798
887
  alias: z.string().min(1).optional()
799
888
  });
800
- const removeListSchema = z.union([z.literal(true), z.array(z.string().min(1))]);
889
+ const removeListSchema = z.union([z.literal(true), z.array(z.string().min(1)).max(CONTRACT_MAX_ARRAY_LENGTH)]);
801
890
  const agentProfilePromptRemovalSchema = z.strictObject({
802
891
  systemPrompt: z.literal(true).optional(),
803
892
  appendSystemPrompt: z.literal(true).optional(),
@@ -869,11 +958,7 @@ const agentTrainingParametersSchema = ownPropertyRecordSchema(z.union([
869
958
  z.number().finite(),
870
959
  z.boolean(),
871
960
  z.null()
872
- ])).superRefine((parameters, context) => {
873
- if (Object.keys(parameters).length > 100) context.addIssue({
874
- code: "custom",
875
- message: "at most 100 public training parameters are allowed"
876
- });
961
+ ]), { maxEntries: 100 }).superRefine((parameters, context) => {
877
962
  for (const name of Object.keys(parameters)) if (!trainingIdentitySchema.safeParse(name).success || isCredentialBearingProfileConfigName(name)) context.addIssue({
878
963
  code: "custom",
879
964
  path: [name],
@@ -920,14 +1005,27 @@ const agentProfileTrainingSchema = z.strictObject({
920
1005
  message: "training receipt ancestry is incomplete or has been altered"
921
1006
  });
922
1007
  });
923
- const agentProfileMetadataSchema = ownPropertyRecordSchema(z.unknown()).superRefine((metadata, context) => {
1008
+ const agentProfileMetadataSchema = ownPropertyRecordSchema(z.unknown(), { prepareValue: (key, value) => {
1009
+ if (key === "training") return value;
1010
+ if (value === void 0 || isBoundedJsonMaterial(value, {
1011
+ dataPropertiesOnly: true,
1012
+ content: true
1013
+ })) return structuredClone(value);
1014
+ assertAgentProfileValue(value, [key]);
1015
+ return z.NEVER;
1016
+ } }).superRefine((metadata, context) => {
924
1017
  if (!Object.hasOwn(metadata, "training")) return;
925
1018
  const result = agentProfileTrainingSchema.safeParse(metadata.training);
926
- if (!result.success) for (const issue of result.error.issues) context.addIssue({
927
- code: "custom",
928
- path: ["training", ...issue.path],
929
- message: issue.message
930
- });
1019
+ if (result.success) metadata.training = result.data;
1020
+ else {
1021
+ delete metadata.training;
1022
+ for (const issue of result.error.issues) context.addIssue({
1023
+ code: "custom",
1024
+ path: ["training", ...issue.path],
1025
+ message: issue.message,
1026
+ continue: false
1027
+ });
1028
+ }
931
1029
  });
932
1030
  /**
933
1031
  * The complete provider-neutral agent profile schema — the runtime validator for
@@ -938,23 +1036,23 @@ const agentProfileSchema = z.strictObject({
938
1036
  name: z.string().optional(),
939
1037
  description: z.string().optional(),
940
1038
  version: z.string().optional(),
941
- tags: z.array(z.string()).optional(),
1039
+ tags: z.array(z.string()).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
942
1040
  prompt: agentProfilePromptSchema.optional(),
943
1041
  model: agentProfileModelHintsSchema.optional(),
944
1042
  harness: harnessTypeSchema.optional(),
945
- seats: z.array(agentProfileSeatSchema).nonempty().optional(),
1043
+ seats: z.array(agentProfileSeatSchema).max(CONTRACT_MAX_ARRAY_LENGTH).nonempty().optional(),
946
1044
  proxySecrets: ProxySecretsSchema.optional(),
947
1045
  permissions: ownPropertyRecordSchema(agentProfilePermissionSchema).optional(),
948
1046
  tools: ownPropertyRecordSchema(z.boolean()).optional(),
949
1047
  mcp: ownPropertyRecordSchema(agentProfileMcpServerSchema).optional(),
950
- connections: z.array(agentProfileConnectionSchema).optional(),
1048
+ connections: z.array(agentProfileConnectionSchema).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
951
1049
  subagents: ownPropertyRecordSchema(agentSubagentProfileSchema).optional(),
952
1050
  resources: agentProfileResourcesSchema.optional(),
953
- hooks: ownPropertyRecordSchema(z.array(agentProfileHookCommandSchema)).optional(),
1051
+ hooks: ownPropertyRecordSchema(z.array(agentProfileHookCommandSchema).max(CONTRACT_MAX_ARRAY_LENGTH)).optional(),
954
1052
  modes: ownPropertyRecordSchema(agentProfileModeSchema).optional(),
955
1053
  confidential: agentProfileConfidentialSchema.optional(),
956
1054
  metadata: agentProfileMetadataSchema.optional(),
957
- extensions: ownPropertyRecordSchema(z.union([ownPropertyRecordSchema(z.unknown()), z.undefined()])).optional()
1055
+ extensions: ownPropertyRecordSchema(z.union([ownPropertyRecordSchema(profileOpaqueValueSchema), z.undefined()])).optional()
958
1056
  }).superRefine((profile, context) => {
959
1057
  validateNestedRecordKeys(profile, context, [], /* @__PURE__ */ new Set());
960
1058
  if (profile.seats?.length) {
@@ -1130,12 +1228,12 @@ z.strictObject({
1130
1228
  "optimizer",
1131
1229
  "compound"
1132
1230
  ]),
1133
- artifacts: z.array(z.string().min(1)).optional(),
1134
- notes: z.array(z.string()).optional()
1231
+ artifacts: z.array(z.string().min(1)).max(CONTRACT_MAX_ARRAY_LENGTH).optional(),
1232
+ notes: z.array(z.string()).max(CONTRACT_MAX_ARRAY_LENGTH).optional()
1135
1233
  }).optional(),
1136
1234
  set: agentProfileSchema.optional(),
1137
1235
  remove: agentProfileDiffRemovalSchema.optional(),
1138
- metadata: ownPropertyRecordSchema(z.unknown()).optional()
1236
+ metadata: ownPropertyRecordSchema(profileOpaqueValueSchema).optional()
1139
1237
  });
1140
1238
  z.strictObject({
1141
1239
  id: z.string().min(1),
@@ -1,5 +1,5 @@
1
- import { Ot as SandboxError } from "./terminal-stream-types-BcZxAiU-.js";
2
- import { Pi as HttpClient, ai as PublishPublicTemplateVersionOptions, ii as PublishPublicTemplateOptions, ni as PublicTemplateInfo, ri as PublicTemplateVersionInfo } from "./types-CYyhRYez.js";
1
+ import { Ot as SandboxError } from "./terminal-stream-types-IbpWmEvd.js";
2
+ import { Pi as HttpClient, ai as PublishPublicTemplateVersionOptions, ii as PublishPublicTemplateOptions, ni as PublicTemplateInfo, ri as PublicTemplateVersionInfo } from "./types-D1wY611n.js";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/public-templates.d.ts
@@ -1,2 +1,2 @@
1
- import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-DMyZOU0k.js";
1
+ import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-C-AGDnNh.js";
2
2
  export { PublicTemplatePublishArtifact, PublicTemplatePublishError, PublicTemplatePublishJob, PublicTemplatePublishRequestOptions, PublicTemplatesClient };
package/dist/runtime.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { At as SandboxFailureDetail, Ct as NotFoundError, Et as QuotaError, Ft as TimeoutError, It as ValidationError, Mt as StateError, Ot as SandboxError, St as NetworkError, Tt as ProfileFileMountPathError, ft as AuthError, jt as ServerError, kt as SandboxErrorJson, mt as CapabilityError, u as ScopedToken, vt as FileWriteConflictError, wt as PartialFailureError } from "./terminal-stream-types-BcZxAiU-.js";
2
- import { Bn as SandboxPortBinding, Br as FileTreeResult, Ct as SessionMessageAdmission, Dt as TaskSessionCommitResult, Er as ChunkedUploadResult, Et as TaskSessionChanges, Gn as SandboxTerminalCreateOptions, Hr as FileUsageResult, Ir as FileRenameResult, Jn as SandboxTerminalRequestOptions, Jr as UploadProgress, Kn as SandboxTerminalInfo, Kr as RenameOptions, Mr as FileReadBatchOptions, Nr as FileReadBatchResult, Q as CommitTaskSessionOptions, St as SessionMessage, Tr as ChunkedUploadOptions, Un as SandboxRuntimeHealth, Ur as FileWriteResult, Vr as FileUsageOptions, Yr as WriteFileOptions, ct as ListMessagesOptions, da as SandboxEvent, dt as SendSessionMessageRequest, ft as SentSessionMessage, gt as SessionExecutionStatus, ht as SessionExecutionInfo, it as CreateTaskSessionOptions, kt as TaskSessionInfo, mt as SessionEventStreamOptions, qn as SandboxTerminalManager, rr as TerminalStream, rt as CreateSessionOptions, ut as SendSessionMessageOptions, yt as SessionInfo, zr as FileTreeOptions } from "./types-CYyhRYez.js";
3
- import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-CE_Sm_NP.js";
4
- import { t as BrowserInteractiveSessionController } from "./interactive-controller-BVGahfQh.js";
5
- import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-DXGjmPhJ.js";
1
+ import { At as SandboxFailureDetail, Ct as NotFoundError, Et as QuotaError, Ft as TimeoutError, It as ValidationError, Mt as StateError, Ot as SandboxError, St as NetworkError, Tt as ProfileFileMountPathError, ft as AuthError, jt as ServerError, kt as SandboxErrorJson, mt as CapabilityError, u as ScopedToken, vt as FileWriteConflictError, wt as PartialFailureError } from "./terminal-stream-types-IbpWmEvd.js";
2
+ import { Bn as SandboxPortBinding, Br as FileTreeResult, Ct as SessionMessageAdmission, Dt as TaskSessionCommitResult, Er as ChunkedUploadResult, Et as TaskSessionChanges, Gn as SandboxTerminalCreateOptions, Hr as FileUsageResult, Ir as FileRenameResult, Jn as SandboxTerminalRequestOptions, Jr as UploadProgress, Kn as SandboxTerminalInfo, Kr as RenameOptions, Mr as FileReadBatchOptions, Nr as FileReadBatchResult, Q as CommitTaskSessionOptions, St as SessionMessage, Tr as ChunkedUploadOptions, Un as SandboxRuntimeHealth, Ur as FileWriteResult, Vr as FileUsageOptions, Yr as WriteFileOptions, ct as ListMessagesOptions, da as SandboxEvent, dt as SendSessionMessageRequest, ft as SentSessionMessage, gt as SessionExecutionStatus, ht as SessionExecutionInfo, it as CreateTaskSessionOptions, kt as TaskSessionInfo, mt as SessionEventStreamOptions, qn as SandboxTerminalManager, rr as TerminalStream, rt as CreateSessionOptions, ut as SendSessionMessageOptions, yt as SessionInfo, zr as FileTreeOptions } from "./types-D1wY611n.js";
3
+ import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-DLqCjRF4.js";
4
+ import { t as BrowserInteractiveSessionController } from "./interactive-controller-kj6pSOCi.js";
5
+ import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-9BtP7NBt.js";
6
6
 
7
7
  //#region src/lib/chunked-upload.d.ts
8
8
  /** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
- import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-B0g65BjC.js";
2
- import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BujauBOG.js";
1
+ import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-BdFyhsao.js";
2
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BvtNDWql.js";
3
3
  import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, d as FileWriteConflictError, g as NotFoundError, h as NetworkError, s as CapabilityError, v as ProfileFileMountPathError, x as SandboxError, y as QuotaError } from "./errors-BuPtQ91K.js";
4
4
  import { t as fetchSandboxApi } from "./api-request-B7cnX489.js";
5
5
  import { s as uploadChunked } from "./chunked-upload-BC-0EYSR.js";