@peasant-labs/schema 0.17.0 → 0.18.0

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/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./internal/generated/enums.gen.js";
3
3
  export * from "./internal/generated/content-capabilities.gen.js";
4
4
  export * from "./internal/generated/versions.gen.js";
5
5
  import { zNativeMetadataRecord, zTurnDetail, zProjectHash, zServerMessage, zSessionDetailPayload, zTranscriptContent } from "./internal/generated/contract/zod.gen.js";
6
+ import { maxNativeMetadataStringBytes } from "./internal/generated/metadata-limits.gen.js";
6
7
  function assertProjectHash(value, operation) {
7
8
  if (!isProjectHash(value)) {
8
9
  const rendered = renderProjectHashInput(value);
@@ -124,8 +125,8 @@ class RawJsonScanner {
124
125
  const value = this.string();
125
126
  if (path === "/type")
126
127
  this.rootMessageType = value;
127
- if (opaque && new TextEncoder().encode(value).length > 16384)
128
- this.fail("metadata string exceeds 16 KiB");
128
+ if (opaque && new TextEncoder().encode(value).length > maxNativeMetadataStringBytes)
129
+ this.fail(`metadata string exceeds ${maxNativeMetadataStringBytes} UTF-8 bytes`);
129
130
  return;
130
131
  }
131
132
  if (c === "t")
@@ -284,6 +285,8 @@ function validateTurnEvidence(targets) {
284
285
  validateUsage(turn.usage, owners, sources);
285
286
  }
286
287
  for (const tool of turn.toolCalls ?? []) {
288
+ if (tool.namespace !== undefined && !validUnicode(tool.namespace))
289
+ failSemantic("tool namespace contains invalid Unicode; provide a valid string or omit unrecorded namespace");
287
290
  if (!validOptionalRef(tool.id))
288
291
  failSemantic("tool id reference is invalid or exceeds 96 bytes");
289
292
  if (tool.id && toolIds.has(tool.id))
@@ -396,8 +399,8 @@ function validUnicode(value) {
396
399
  function validateMetadataValue(value, depth) {
397
400
  if (depth > 32)
398
401
  failSemantic("metadata data exceeds depth 32");
399
- if (typeof value === "string" && (!validUnicode(value) || new TextEncoder().encode(value).length > 16384))
400
- failSemantic("metadata string is invalid Unicode or exceeds 16 KiB");
402
+ if (typeof value === "string" && (!validUnicode(value) || new TextEncoder().encode(value).length > maxNativeMetadataStringBytes))
403
+ failSemantic(`metadata string is invalid Unicode or exceeds ${maxNativeMetadataStringBytes} UTF-8 bytes`);
401
404
  if (typeof value === "number" && (!Number.isFinite(value) || (Number.isInteger(value) && !Number.isSafeInteger(value))))
402
405
  failSemantic("metadata number is outside the finite JS-safe domain");
403
406
  if (value !== null && !["string", "number", "boolean", "object"].includes(typeof value))
@@ -11,6 +11,7 @@ export declare const KnownContentCapability: Readonly<{
11
11
  readonly DetailedUsageV1: "detailed_usage_v1";
12
12
  readonly NativeMetadataV1: "native_metadata_v1";
13
13
  readonly ObservedModelV1: "observed_model_v1";
14
+ readonly ToolNamespaceV1: "tool_namespace_v1";
14
15
  }>;
15
16
  export type KnownContentCapability = (typeof KnownContentCapability)[keyof typeof KnownContentCapability];
16
17
  export declare const AllContentCapabilities: readonly KnownContentCapability[];
@@ -12,8 +12,9 @@ export const KnownContentCapability = Object.freeze({
12
12
  DetailedUsageV1: "detailed_usage_v1",
13
13
  NativeMetadataV1: "native_metadata_v1",
14
14
  ObservedModelV1: "observed_model_v1",
15
+ ToolNamespaceV1: "tool_namespace_v1",
15
16
  });
16
- export const AllContentCapabilities = Object.freeze([KnownContentCapability.DetailedUsageV1, KnownContentCapability.NativeMetadataV1, KnownContentCapability.ObservedModelV1]);
17
+ export const AllContentCapabilities = Object.freeze([KnownContentCapability.DetailedUsageV1, KnownContentCapability.NativeMetadataV1, KnownContentCapability.ObservedModelV1, KnownContentCapability.ToolNamespaceV1]);
17
18
  export function isContentCapability(value) {
18
19
  return typeof value === "string" && AllContentCapabilities.includes(value);
19
20
  }
@@ -3897,6 +3897,7 @@ export declare const zToolCallDetail: z.ZodObject<{
3897
3897
  id: z.ZodString;
3898
3898
  isError: z.ZodOptional<z.ZodBoolean>;
3899
3899
  name: z.ZodString;
3900
+ namespace: z.ZodOptional<z.ZodString>;
3900
3901
  result: z.ZodString;
3901
3902
  resultEntryRef: z.ZodOptional<z.ZodString>;
3902
3903
  toolKind: z.ZodOptional<z.ZodEnum<{
@@ -3990,6 +3991,7 @@ export declare const zTurnDetail: z.ZodObject<{
3990
3991
  id: z.ZodString;
3991
3992
  isError: z.ZodOptional<z.ZodBoolean>;
3992
3993
  name: z.ZodString;
3994
+ namespace: z.ZodOptional<z.ZodString>;
3993
3995
  result: z.ZodString;
3994
3996
  resultEntryRef: z.ZodOptional<z.ZodString>;
3995
3997
  toolKind: z.ZodOptional<z.ZodEnum<{
@@ -4205,6 +4207,7 @@ export declare const zSessionDetailPayload: z.ZodObject<{
4205
4207
  id: z.ZodString;
4206
4208
  isError: z.ZodOptional<z.ZodBoolean>;
4207
4209
  name: z.ZodString;
4210
+ namespace: z.ZodOptional<z.ZodString>;
4208
4211
  result: z.ZodString;
4209
4212
  resultEntryRef: z.ZodOptional<z.ZodString>;
4210
4213
  toolKind: z.ZodOptional<z.ZodEnum<{
@@ -4427,6 +4430,7 @@ export declare const zTranscriptContent: z.ZodObject<{
4427
4430
  id: z.ZodString;
4428
4431
  isError: z.ZodOptional<z.ZodBoolean>;
4429
4432
  name: z.ZodString;
4433
+ namespace: z.ZodOptional<z.ZodString>;
4430
4434
  result: z.ZodString;
4431
4435
  resultEntryRef: z.ZodOptional<z.ZodString>;
4432
4436
  toolKind: z.ZodOptional<z.ZodEnum<{
@@ -1933,6 +1933,7 @@ export const zToolCallDetail = z.object({
1933
1933
  id: z.string(),
1934
1934
  isError: z.boolean().optional(),
1935
1935
  name: z.string(),
1936
+ namespace: z.string().optional(),
1936
1937
  result: z.string(),
1937
1938
  resultEntryRef: z.string().optional(),
1938
1939
  toolKind: zToolCallKind.optional(),
@@ -0,0 +1 @@
1
+ export declare const maxNativeMetadataStringBytes: 65536;
@@ -0,0 +1,2 @@
1
+ // Code generated from the canonical Go/OpenAPI contract. DO NOT EDIT.
2
+ export const maxNativeMetadataStringBytes = 65536;
@@ -1,4 +1,4 @@
1
1
  export declare const VillageAPIVersion: "0.16.0";
2
- export declare const PeasantLocalAPIVersion: "0.11.0";
3
- export declare const TypesVersion: "0.17.0";
2
+ export declare const PeasantLocalAPIVersion: "0.12.0";
3
+ export declare const TypesVersion: "0.18.0";
4
4
  export declare const MetadataSchemaVersion: 10;
@@ -1,5 +1,5 @@
1
1
  // Code generated from the canonical Go/OpenAPI contract. DO NOT EDIT.
2
2
  export const VillageAPIVersion = "0.16.0";
3
- export const PeasantLocalAPIVersion = "0.11.0";
4
- export const TypesVersion = "0.17.0";
3
+ export const PeasantLocalAPIVersion = "0.12.0";
4
+ export const TypesVersion = "0.18.0";
5
5
  export const MetadataSchemaVersion = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peasant-labs/schema",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Generated TypeScript contract bindings for the peasant-labs schema module",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {