@tangle-network/agent-interface 5.10.0 → 5.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,9 +18,14 @@ export declare function isBoundedJsonValue(value: unknown): boolean;
|
|
|
18
18
|
export declare function isBoundedEventContentJson(value: unknown, { omitUndefinedObjectFields }?: {
|
|
19
19
|
omitUndefinedObjectFields?: boolean;
|
|
20
20
|
}): boolean;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Digest material omits undefined object fields; portable profile values require data properties.
|
|
23
|
+
* `content` bounds strings by the serialized UTF-8 budget instead of each string's length, for
|
|
24
|
+
* opaque values that may legitimately copy unbounded typed fields such as inline file content.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isBoundedJsonMaterial(value: unknown, { dataPropertiesOnly, content }?: {
|
|
23
27
|
dataPropertiesOnly?: boolean;
|
|
28
|
+
content?: boolean;
|
|
24
29
|
}): boolean;
|
|
25
30
|
export declare const boundedJsonSchema: z.ZodCustom<unknown, unknown>;
|
|
26
31
|
export declare const boundedJsonRecordSchema: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
package/dist/contract-limits.js
CHANGED
|
@@ -63,9 +63,13 @@ function serializedJsonStringBytes(value) {
|
|
|
63
63
|
export function isBoundedEventContentJson(value, { omitUndefinedObjectFields = false } = {}) {
|
|
64
64
|
return boundedJson(value, { content: true, omitUndefinedObjectFields });
|
|
65
65
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Digest material omits undefined object fields; portable profile values require data properties.
|
|
68
|
+
* `content` bounds strings by the serialized UTF-8 budget instead of each string's length, for
|
|
69
|
+
* opaque values that may legitimately copy unbounded typed fields such as inline file content.
|
|
70
|
+
*/
|
|
71
|
+
export function isBoundedJsonMaterial(value, { dataPropertiesOnly = false, content = false } = {}) {
|
|
72
|
+
return boundedJson(value, { material: true, omitUndefinedObjectFields: true, dataPropertiesOnly, content });
|
|
69
73
|
}
|
|
70
74
|
/** One iterative walker owns structural admission; typed domains keep their own schema limits. */
|
|
71
75
|
function boundedJson(value, options = {}) {
|
|
@@ -52,7 +52,13 @@ export function ownPropertyRecordSchema(valueSchema, { maxEntries = CONTRACT_MAX
|
|
|
52
52
|
return encoded;
|
|
53
53
|
}, z.record(z
|
|
54
54
|
.string()
|
|
55
|
-
.regex(/^u(?:[0-9a-f]{4})*$/, "record keys must contain valid Unicode"), valueSchema).
|
|
55
|
+
.regex(/^u(?:[0-9a-f]{4})*$/, "record keys must contain valid Unicode"), valueSchema).superRefine((_record, context) => {
|
|
56
|
+
for (const issue of context.issues) {
|
|
57
|
+
const key = issue.path?.[0];
|
|
58
|
+
if (typeof key === "string" && /^[ui](?:[0-9a-f]{4})*$/.test(key))
|
|
59
|
+
issue.path[0] = decodeRecordKey(key);
|
|
60
|
+
}
|
|
61
|
+
}, { when: () => true }).transform((record) => {
|
|
56
62
|
const restored = {};
|
|
57
63
|
for (const [encodedKey, value] of Object.entries(record)) {
|
|
58
64
|
Object.defineProperty(restored, decodeRecordKey(encodedKey), {
|
package/dist/profile-schema.js
CHANGED
|
@@ -12,7 +12,7 @@ import { AgentProfileValueError, assertAgentProfileValue, canonicalAgentProfileJ
|
|
|
12
12
|
import { harnessHonorsEffort, harnessHonorsModel, harnessModelSupport, harnessReasoningEfforts, harnessSystemPromptIntents, resolveModelProvider, } from "./harness-capabilities.js";
|
|
13
13
|
import { SANDBOX_SIZE_PRESET_NAMES, } from "./sandbox-size.js";
|
|
14
14
|
const profileOpaqueValueSchema = z.unknown().transform((value, context) => {
|
|
15
|
-
if (value === undefined || isBoundedJsonMaterial(value, { dataPropertiesOnly: true }))
|
|
15
|
+
if (value === undefined || isBoundedJsonMaterial(value, { dataPropertiesOnly: true, content: true }))
|
|
16
16
|
return structuredClone(value);
|
|
17
17
|
try {
|
|
18
18
|
assertAgentProfileValue(value, []);
|
|
@@ -376,7 +376,7 @@ export const agentProfileMetadataSchema = ownPropertyRecordSchema(z.unknown(), {
|
|
|
376
376
|
prepareValue: (key, value) => {
|
|
377
377
|
if (key === "training")
|
|
378
378
|
return value;
|
|
379
|
-
if (value === undefined || isBoundedJsonMaterial(value, { dataPropertiesOnly: true }))
|
|
379
|
+
if (value === undefined || isBoundedJsonMaterial(value, { dataPropertiesOnly: true, content: true }))
|
|
380
380
|
return structuredClone(value);
|
|
381
381
|
assertAgentProfileValue(value, [key]);
|
|
382
382
|
return z.NEVER;
|