niceeval 0.13.4-canary.48 → 0.14.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/INDEX.md +3 -3
- package/dist/experiment/host/operations.cjs +58 -0
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/inspection/overview.cjs +20 -9
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +5 -0
- package/dist/inspection/overview.d.mts +5 -0
- package/dist/inspection/overview.d.ts +5 -0
- package/dist/inspection/protocol.d.cts +238 -0
- package/dist/inspection/protocol.d.mts +238 -0
- package/dist/inspection/protocol.d.ts +238 -0
- package/dist/inspection/public.mjs +43 -19
- package/dist/inspection/results.cjs +11 -10
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +34 -0
- package/dist/inspection/results.d.mts +34 -0
- package/dist/inspection/results.d.ts +34 -0
- package/dist/record/attachment/protocol.cjs +10 -5
- package/dist/record/attachment/protocol.cjs.map +1 -1
- package/dist/record/attachment/protocol.d.cts +4 -0
- package/dist/record/attachment/protocol.d.mts +4 -0
- package/dist/record/attachment/protocol.d.ts +4 -0
- package/dist/record/family/source-receipt/index.cjs +16 -3
- package/dist/record/family/source-receipt/index.cjs.map +1 -1
- package/dist/record/family/source-receipt/index.d.cts +1 -0
- package/dist/record/family/source-receipt/index.d.mts +1 -0
- package/dist/record/family/source-receipt/index.d.ts +1 -0
- package/dist/record/family/source-receipt/index.js +2 -0
- package/dist/record/host/sqlite-host.cjs +3 -0
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +3 -1
- package/dist/record/host/types.d.mts +3 -1
- package/dist/record/host/types.d.ts +3 -1
- package/dist/record/sqlite/storage.cjs +11 -8
- package/dist/record/sqlite/storage.cjs.map +1 -1
- package/dist/record/writer/current-attachment.cjs +18 -13
- package/dist/record/writer/current-attachment.cjs.map +1 -1
- package/dist/record/writer/errors.cjs +6 -1
- package/dist/record/writer/errors.cjs.map +1 -1
- package/dist/record/writer/errors.d.cts +7 -1
- package/dist/record/writer/errors.d.mts +7 -1
- package/dist/record/writer/errors.d.ts +7 -1
- package/dist/runner/adoption.cjs +1 -1
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/reuse-plan.cjs +1 -1
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/source-receipts/support.cjs +2 -1
- package/dist/runner/source-receipts/support.cjs.map +1 -1
- package/dist/runner/source-receipts/support.d.cts +1 -1
- package/dist/runner/source-receipts/support.d.mts +1 -1
- package/dist/runner/source-receipts/support.d.ts +1 -1
- package/dist/show/contribution.cjs +11 -2
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +7 -0
- package/dist/show/contribution.d.mts +7 -0
- package/dist/show/contribution.d.ts +7 -0
- package/dist/show/model.cjs +1 -0
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +2 -0
- package/dist/show/model.d.mts +2 -0
- package/dist/show/model.d.ts +2 -0
- package/dist/show/render.cjs +149 -81
- package/dist/show/render.cjs.map +1 -1
- package/dist/show/render.d.cts +3 -1
- package/dist/show/render.d.mts +3 -1
- package/dist/show/render.d.ts +3 -1
- package/dist/view/app-dist/.vite/manifest.json +18 -18
- package/dist/view/app-dist/assets/{AttemptDialog-DKEWcS7m.js → AttemptDialog-76dX1VQq.js} +1 -1
- package/dist/view/app-dist/assets/{AttemptRoute-DUs5kic4.js → AttemptRoute-DRHVh2JA.js} +1 -1
- package/dist/view/app-dist/assets/{ResultsPage-VlExJ6F0.js → ResultsPage-9CSI8dvZ.js} +2 -2
- package/dist/view/app-dist/assets/{RunPage-B9Bagswz.js → RunPage-BUF0REv7.js} +1 -1
- package/dist/view/app-dist/assets/{TableContentView-ZL9elUsA.js → TableContentView-_Sbg5wDr.js} +1 -1
- package/dist/view/app-dist/assets/index-BGr_6pGY.js +19 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-BqIAORD4.js → quality-cost-scatter-B5wDa_F1.js} +1 -1
- package/dist/view/app-dist/assets/useSuspenseQuery-D3W8Uy33.js +1 -0
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/function-runtime.mjs +68 -29
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/examples/index.mdx +1 -3
- package/docs-site/zh/explanation/evals.mdx +1 -1
- package/docs-site/zh/explanation/experiment.mdx +3 -1
- package/docs-site/zh/explanation/overview.mdx +6 -4
- package/docs-site/zh/explanation/record.mdx +9 -5
- package/docs-site/zh/explanation/runner.mdx +3 -3
- package/docs-site/zh/index.mdx +4 -8
- package/docs-site/zh/introduction.mdx +2 -2
- package/docs-site/zh/reference/cli.mdx +8 -7
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +5 -5
- package/docs-site/zh/troubleshooting/debugging.mdx +8 -8
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -55
- package/docs-site/zh/tutorials/accept-results.mdx +4 -4
- package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
- package/docs-site/zh/tutorials/authoring.mdx +1 -1
- package/docs-site/zh/tutorials/compare-runs.mdx +3 -3
- package/docs-site/zh/tutorials/concurrency.mdx +6 -6
- package/docs-site/zh/tutorials/connect-your-agent.mdx +2 -2
- package/docs-site/zh/tutorials/docker-in-docker.mdx +1 -1
- package/docs-site/zh/tutorials/experiments.mdx +1 -1
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +1 -1
- package/docs-site/zh/tutorials/quickstart.mdx +2 -2
- package/docs-site/zh/tutorials/reporters.mdx +3 -3
- package/docs-site/zh/tutorials/sandbox-agent.mdx +2 -2
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +3 -3
- package/docs-site/zh/tutorials/viewing-results.mdx +10 -11
- package/package.json +1 -1
- package/dist/view/app-dist/assets/index-C1E4NkG0.js +0 -19
- package/dist/view/app-dist/assets/useSuspenseQuery-BlFuYK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,IAAI,eAAM,CAAC,SAAS,CAAC,OAAO,CAAC;QACzB,OAAO,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAgB,CAAC,CAAC,MAAM;QACtD,OAAO,eAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACrD,OAAO,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAmD,CAAC,CAAC;AACvF,CAAC;AACD,uEAAuE;AACvE,SAAgB,mCAAmC,CAAC,SAA4D,IAA+B,OAAO,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AAC9L,oGAAoG;AACpG,SAAgB,6BAA6B,CAAC,SAA4D;IAKtG,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1C,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;AAC3J,CAAC","sourcesContent":["import { Result, Schema, SchemaAST } from \"effect\";\nimport type { RecordAttachmentOwner } from \"../model/core.ts\";\nimport { isRecordAttachmentName } from \"../model/identifiers.ts\";\nimport { compileRecordSchemaCodec, type RecordSchemaCodec, type RecordSchemaWire } from \"../definition/schema-codec.ts\";\nimport { RecordBytesContentSchema, RecordTextContentSchema, isRecordBytesContentHandle, isRecordContentHandle, isRecordTextContentHandle, recordContentDeclarationMetadata, type RecordContentHandle } from \"./content.ts\";\nimport { RecordAttachmentSpiDefinitionError, type RecordAttachmentIssue } from \"./errors.ts\";\nconst definitionTypeId: unique symbol = Symbol(\"@niceeval/record/RecordAttachmentDefinition\");\nconst persistenceTypeId: unique symbol = Symbol(\"@niceeval/record/RecordAttachmentPersistence\");\nconst referenceTypeId: unique symbol = Symbol(\"@niceeval/record/RecordAttachmentReference\");\nconst definitions = new WeakMap<object, DefinitionRuntime>();\nconst definitionAliases = new WeakMap<object, AnyDefinition>();\nconst persistences = new WeakSet<object>();\nconst references = new WeakMap<object, ReferenceRuntime>();\nconst referenceDeclarations = new WeakMap<object, ReferenceDeclarationRuntime>();\nconst referenceDeclarationRuns = new WeakMap<SchemaAST.DeclarationRun, ReferenceDeclarationRuntime>();\nexport type RecordAttachmentSchema = Schema.Codec<unknown, unknown, never, never>;\ntype AnyDefinition = RecordAttachmentDefinition<RecordAttachmentOwner, string, Schema.Top>;\nexport interface RecordAttachmentReferenceTarget {\n readonly owner: RecordAttachmentOwner;\n readonly family: string;\n readonly schema: Schema.Top;\n}\ntype ResolvedReferenceDefinition<Definition extends RecordAttachmentReferenceTarget> = Definition extends AnyDefinition ? Definition : AnyDefinition;\ninterface DefinitionRuntime {\n readonly codec: RecordSchemaCodec<unknown, RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>;\n}\ninterface ReferenceDeclarationRuntime {\n readonly definition: AnyDefinition;\n readonly valueSchema: Schema.Codec<unknown, unknown, never, never> | undefined;\n}\ninterface ReferenceRuntime extends ReferenceDeclarationRuntime {\n readonly value: unknown;\n}\nfunction mintedReferenceDeclarationRuntime(value: object): ReferenceDeclarationRuntime | undefined {\n const direct = referenceDeclarations.get(value);\n if (direct !== undefined || !SchemaAST.isAST(value) || !SchemaAST.isDeclaration(value))\n return direct;\n if (value.typeParameters.length !== 0 ||\n value.checks !== undefined ||\n value.encoding !== undefined ||\n value.context !== undefined ||\n value.encodingChecks !== undefined ||\n value.encodingRun !== undefined && value.encodingRun !== value.run)\n return undefined;\n return referenceDeclarationRuns.get(value.run);\n}\nexport interface RecordAttachmentDefinition<out Owner extends RecordAttachmentOwner, out Family extends string, ValueSchema extends Schema.Top> {\n readonly owner: Owner;\n readonly family: Family;\n readonly schema: ValueSchema;\n readonly validate: ((value: Schema.Schema.Type<ValueSchema>) => readonly RecordAttachmentIssue[]) | undefined;\n readonly [definitionTypeId]: () => {\n readonly owner: Owner;\n readonly family: Family;\n };\n}\n/** Durable interpretation revision, deliberately separate from the logical fact definition. */\nexport interface RecordAttachmentPersistence<Definition extends AnyDefinition, out Revision extends number> {\n readonly attachment: Definition;\n readonly revision: Revision;\n readonly [persistenceTypeId]: () => {\n readonly attachment: Definition;\n readonly revision: Revision;\n };\n}\n/** Exact-definition reference token. Its wire identity is owner/family only. */\nexport interface RecordAttachmentReference<Definition extends AnyDefinition, Value = unknown> {\n readonly value: Value;\n readonly [referenceTypeId]: typeof referenceTypeId;\n}\nfunction positive(value: unknown): value is number {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value > 0;\n}\nfunction validOwner(value: unknown): value is RecordAttachmentOwner {\n return value === \"run\" || value === \"attempt\";\n}\nfunction invalid(cause?: unknown): never {\n throw new RecordAttachmentSpiDefinitionError(\"invalid-family-definition\", cause);\n}\n/** Record persistence is synchronous; reject declarations that retain a service context. */\nexport function isRecordAttachmentSchema(schema: Schema.Top): schema is RecordAttachmentSchema {\n return schema.ast.context === undefined;\n}\n/** Defines only the current logical fact: no revision, migration, writer or storage selector. */\nexport function defineRecordAttachment<const Owner extends RecordAttachmentOwner, const Family extends string, const ValueSchema extends Schema.Top>(input: {\n readonly owner: Owner;\n readonly family: Family;\n readonly schema: ValueSchema;\n readonly validate?: (value: Schema.Schema.Type<ValueSchema>) => readonly RecordAttachmentIssue[];\n}): RecordAttachmentDefinition<Owner, Family, ValueSchema> {\n if (!validOwner(input.owner) || !isRecordAttachmentName(input.family) || !isRecordAttachmentSchema(input.schema) || typeof input.validate !== \"undefined\" && typeof input.validate !== \"function\")\n invalid();\n const limits = {\n maximumJsonBytes: 1048576, maximumDepth: 64, maximumNodes: 100000,\n maximumObjectKeys: 10000, maximumArrayItems: 100000,\n maximumKeyUtf8Bytes: 16384, maximumStringUtf8Bytes: 1048576,\n };\n const definition = Object.freeze({\n owner: input.owner, family: input.family, schema: input.schema, validate: input.validate,\n [definitionTypeId]: () => ({ owner: input.owner, family: input.family }),\n }) as RecordAttachmentDefinition<Owner, Family, ValueSchema>;\n try {\n definitions.set(definition, Object.freeze({ codec: compileRecordSchemaCodec({\n schema: input.schema,\n limits,\n attachmentDeclarations: [\n { schema: RecordTextContentSchema, isValue: isRecordTextContentHandle, metadata: recordContentDeclarationMetadata(RecordTextContentSchema) },\n { schema: RecordBytesContentSchema, isValue: isRecordBytesContentHandle, metadata: recordContentDeclarationMetadata(RecordBytesContentSchema) },\n ],\n getAttachmentDeclaration: (ast) => {\n const reference = recordAttachmentReferenceDeclarationMetadata(ast);\n if (reference !== undefined)\n return reference;\n const content = recordContentDeclarationMetadata(ast);\n return content === undefined ? undefined : Object.freeze({\n metadata: content,\n accepts: content.kind === \"text\" ? isRecordTextContentHandle : isRecordBytesContentHandle,\n });\n },\n isAttachmentOpaque: (value) => isRecordAttachmentReference(value)\n ? { category: \"reference\" }\n : isRecordContentHandle(value) ? { category: \"content\" } : undefined,\n }) as RecordSchemaCodec<unknown, RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>> }));\n }\n catch (cause) {\n invalid(cause);\n }\n return definition;\n}\n/** Binds a definition to its one current durable interpretation revision. */\nexport function defineRecordAttachmentPersistence<const Definition extends AnyDefinition, const Revision extends number>(input: {\n readonly attachment: Definition;\n readonly revision: Revision;\n}): RecordAttachmentPersistence<Definition, Revision> {\n if (!isRecordAttachmentDefinition(input.attachment) || !positive(input.revision))\n invalid();\n const persistence = Object.freeze({ attachment: input.attachment, revision: input.revision, [persistenceTypeId]: () => ({ attachment: input.attachment, revision: input.revision }) }) as RecordAttachmentPersistence<Definition, Revision>;\n persistences.add(persistence);\n return persistence;\n}\nexport const RecordAttachmentReference = Object.freeze({\n /** Builds a package-owned Schema declaration. Session later mints values matching this exact declaration. */\n to<Definition extends RecordAttachmentReferenceTarget, Value = unknown, Encoded = Value>(definition: Definition, valueSchema?: Schema.Codec<Value, Encoded, never>): Schema.Codec<RecordAttachmentReference<ResolvedReferenceDefinition<Definition>, Value>, RecordAttachmentReference<ResolvedReferenceDefinition<Definition>, Value>, never> {\n const resolved = resolveRecordAttachmentDefinition(definition);\n if (resolved === undefined)\n invalid();\n type Resolved = ResolvedReferenceDefinition<Definition>;\n const declaration = Schema.declare<RecordAttachmentReference<Resolved, Value>>((value): value is RecordAttachmentReference<Resolved, Value> => {\n const runtime = isRecordAttachmentReference(value) ? references.get(value) : undefined;\n return runtime !== undefined && runtime.definition === resolved &&\n (valueSchema === undefined || !Result.isFailure(Schema.decodeUnknownResult(valueSchema)(runtime.value)));\n }, { identifier: `RecordAttachmentReference<${resolved.owner}:${resolved.family}>` });\n referenceDeclarations.set(declaration, Object.freeze({ definition: resolved, valueSchema }));\n referenceDeclarations.set(declaration.ast, Object.freeze({ definition: resolved, valueSchema }));\n referenceDeclarationRuns.set(declaration.ast.run, Object.freeze({ definition: resolved, valueSchema }));\n return declaration;\n },\n});\nexport function isRecordAttachmentDefinition(value: unknown): value is AnyDefinition { return typeof value === \"object\" && value !== null && definitions.has(value); }\n/** @internal High-level collection authoring accepts plain-data item declarations only. */\nexport function recordAttachmentDefinitionHasOpaqueDeclarations(definition: AnyDefinition): boolean {\n return definitions.get(definition)?.codec.opaqueDeclarationMetadata.length !== 0;\n}\n/** @internal Registers one package-owned high-level callable as an alias of its exact Attachment definition. */\nexport function registerRecordAttachmentDefinitionAlias(alias: object, definition: unknown): void {\n if (!isRecordAttachmentDefinition(definition))\n invalid();\n definitionAliases.set(alias, definition);\n}\n/** @internal Resolves exact definitions and package-owned high-level aliases; structural lookalikes never resolve. */\nexport function resolveRecordAttachmentDefinition(value: unknown): AnyDefinition | undefined {\n if (isRecordAttachmentDefinition(value))\n return value;\n return (typeof value === \"object\" && value !== null) || typeof value === \"function\"\n ? definitionAliases.get(value)\n : undefined;\n}\nexport function isRecordAttachmentPersistence(value: unknown): value is RecordAttachmentPersistence<AnyDefinition, number> { return typeof value === \"object\" && value !== null && persistences.has(value); }\nexport function isRecordAttachmentReference(value: unknown): value is RecordAttachmentReference<AnyDefinition, unknown> { return typeof value === \"object\" && value !== null && references.has(value); }\n/** @internal Schema compiler validates and labels only declarations minted by `to`. */\nexport function recordAttachmentReferenceDeclarationMetadata(value: object): {\n readonly metadata: {\n readonly category: \"reference\";\n readonly definition: AnyDefinition;\n readonly valueSchema: Schema.Codec<unknown, unknown, never, never> | undefined;\n };\n readonly accepts: (value: object) => boolean;\n} | undefined {\n const runtime = mintedReferenceDeclarationRuntime(value);\n return runtime === undefined ? undefined : Object.freeze({\n metadata: Object.freeze({ category: \"reference\", definition: runtime.definition, valueSchema: runtime.valueSchema }),\n accepts: (candidate) => isRecordAttachmentReference(candidate) && references.get(candidate)?.definition === runtime.definition &&\n (runtime.valueSchema === undefined || !Result.isFailure(Schema.decodeUnknownResult(runtime.valueSchema)(references.get(candidate)?.value))),\n });\n}\n/** @internal Session-only mint; declaration identity, optional value schema, and exact definition are all checked. */\nexport function mintRecordAttachmentReference<Definition extends AnyDefinition, Value>(declaration: Schema.Codec<RecordAttachmentReference<Definition, Value>, RecordAttachmentReference<Definition, Value>, never>, value: Value): RecordAttachmentReference<Definition, Value> {\n const runtime = referenceDeclarations.get(declaration);\n if (runtime === undefined)\n throw new TypeError(\"Record Attachment reference requires a package-owned declaration\");\n if (runtime.valueSchema !== undefined && Result.isFailure(Schema.decodeUnknownResult(runtime.valueSchema)(value)))\n throw new TypeError(\"Record Attachment reference value is invalid\");\n const token = Object.freeze({ value, [referenceTypeId]: referenceTypeId }) as RecordAttachmentReference<Definition, Value>;\n references.set(token, Object.freeze({ ...runtime, value }));\n return token;\n}\n/** @internal Host uses these to mint/validate closure without leaking storage capabilities. */\nexport function enumerateRecordAttachmentClosure(definition: AnyDefinition, value: unknown): Result.Result<{\n readonly contents: readonly RecordContentHandle[];\n readonly references: readonly RecordAttachmentReference<AnyDefinition, unknown>[];\n}, {\n readonly code: \"exact-decode-failed\" | \"invariant-failed\" | \"content-closure-failed\" | \"reference-closure-failed\";\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-decode-failed\" });\n const encoded = runtime.codec.encode(value as never);\n if (Result.isFailure(encoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n const decoded = runtime.codec.decode(encoded.success);\n if (Result.isFailure(decoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n if (definition.validate?.(decoded.success as never).length)\n return Result.fail({ code: \"invariant-failed\" });\n const contents: RecordContentHandle[] = [], refs: RecordAttachmentReference<AnyDefinition, unknown>[] = [];\n // The Schema compiler's declaration registry is the closure executor: only\n // values inhabiting a package-owned declaration count, never incidental objects.\n for (const entry of runtime.codec.enumerateOpaque(decoded.success)) {\n const metadata = entry.metadata as {\n readonly category?: string;\n } | undefined;\n if (isRecordContentHandle(entry.value) && metadata?.category === \"content\")\n contents.push(entry.value);\n if (isRecordAttachmentReference(entry.value) && metadata?.category === \"reference\")\n refs.push(entry.value);\n }\n if (new Set(contents).size !== contents.length)\n return Result.fail({ code: \"content-closure-failed\" });\n if (new Set(refs).size !== refs.length)\n return Result.fail({ code: \"reference-closure-failed\" });\n return Result.succeed(Object.freeze({ contents: Object.freeze(contents), references: Object.freeze(refs) }));\n}\n/** @internal Host-only diagnostic/closure metadata; family code never receives Schema AST. */\nexport function inspectRecordAttachmentOpaqueClosure(definition: AnyDefinition, value: unknown): Result.Result<readonly {\n readonly value: object;\n readonly metadata: unknown;\n}[], {\n readonly code: \"exact-decode-failed\";\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-decode-failed\" });\n const encoded = runtime.codec.encode(value as never);\n if (Result.isFailure(encoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n const decoded = runtime.codec.decode(encoded.success);\n return Result.isFailure(decoded) ? Result.fail({ code: \"exact-decode-failed\" }) : Result.succeed(runtime.codec.enumerateOpaque(decoded.success));\n}\n/** @internal Exact current codec encode for Core's physical encoder; opaque leaves remain sealed tokens. */\nexport function encodeRecordAttachmentCurrent(definition: AnyDefinition, value: unknown): Result.Result<RecordSchemaWire<RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>, {\n readonly code: \"exact-encode-failed\" | \"invariant-failed\" | \"content-closure-failed\" | \"reference-closure-failed\";\n}> {\n const closure = enumerateRecordAttachmentClosure(definition, value);\n if (Result.isFailure(closure)) {\n switch (closure.failure.code) {\n case \"exact-decode-failed\": return Result.fail({ code: \"exact-encode-failed\" });\n case \"invariant-failed\": return Result.fail({ code: \"invariant-failed\" });\n case \"content-closure-failed\": return Result.fail({ code: \"content-closure-failed\" });\n case \"reference-closure-failed\": return Result.fail({ code: \"reference-closure-failed\" });\n }\n }\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-encode-failed\" });\n const encoded = runtime.codec.encode(value);\n return Result.isFailure(encoded) ? Result.fail({ code: \"exact-encode-failed\" }) : Result.succeed(encoded.success);\n}\n/** @internal Host binds validated storage-neutral leaves by exact declaration, never by paths or marker strings. */\nexport function hydrateRecordAttachmentCurrent<Definition extends AnyDefinition>(definition: Definition, wire: unknown, binder: {\n readonly content: (token: unknown, declaration: {\n readonly kind: \"text\" | \"bytes\";\n readonly maximumBytes: number | undefined;\n }) => Result.Result<RecordContentHandle | undefined, {\n readonly code: \"current-content-bind-failed\";\n }>;\n readonly reference: (token: unknown, declaration: {\n readonly definition: AnyDefinition;\n readonly valueSchema: Schema.Codec<unknown, unknown, never, never> | undefined;\n }) => Result.Result<RecordAttachmentReference<AnyDefinition, unknown> | undefined, {\n readonly code: \"current-reference-bind-failed\";\n }>;\n}): Result.Result<Schema.Schema.Type<Definition[\"schema\"]>, {\n readonly code: \"exact-decode-failed\" | \"invariant-failed\" | \"content-closure-failed\" | \"reference-closure-failed\" | \"current-content-bind-failed\" | \"current-reference-bind-failed\";\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-decode-failed\" });\n let failure: {\n readonly code: \"current-content-bind-failed\";\n } | {\n readonly code: \"current-reference-bind-failed\";\n } | undefined;\n const projected = runtime.codec.mapOpaqueEncoded(wire, (token, metadata) => {\n const declaration = metadata as {\n readonly category?: string;\n readonly kind?: \"text\" | \"bytes\";\n readonly maximumBytes?: number;\n readonly definition?: AnyDefinition;\n readonly valueSchema?: Schema.Codec<unknown, unknown, never, never>;\n };\n if (declaration.category === \"content\" && declaration.kind !== undefined) {\n const bound = binder.content(token, { kind: declaration.kind, maximumBytes: declaration.maximumBytes });\n if (Result.isFailure(bound)) {\n failure = bound.failure;\n return { _tag: \"unmatched\" };\n }\n if (bound.success === undefined || declaration.kind === \"text\" && !isRecordTextContentHandle(bound.success) || declaration.kind === \"bytes\" && !isRecordBytesContentHandle(bound.success))\n return { _tag: \"unmatched\" };\n return { _tag: \"matched\", value: bound.success };\n }\n if (declaration.category === \"reference\" && declaration.definition !== undefined) {\n const bound = binder.reference(token, { definition: declaration.definition, valueSchema: declaration.valueSchema });\n if (Result.isFailure(bound)) {\n failure = bound.failure;\n return { _tag: \"unmatched\" };\n }\n return bound.success === undefined ? { _tag: \"unmatched\" } : { _tag: \"matched\", value: bound.success };\n }\n return { _tag: \"unmatched\" };\n });\n if (failure !== undefined)\n return Result.fail(failure);\n const decoded = runtime.codec.decode(projected);\n if (Result.isFailure(decoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n const closure = enumerateRecordAttachmentClosure(definition, decoded.success);\n if (Result.isFailure(closure))\n return Result.fail(closure.failure);\n if (definition.validate?.(decoded.success as never).length)\n return Result.fail({ code: \"invariant-failed\" });\n return Result.succeed(decoded.success as Schema.Schema.Type<Definition[\"schema\"]>);\n}\n/** @internal exact definition capability held by a reference token. */\nexport function recordAttachmentReferenceDefinition(reference: RecordAttachmentReference<AnyDefinition, unknown>): AnyDefinition | undefined { return references.get(reference)?.definition; }\n/** @internal Durable wire identity intentionally omits definition capability and all I/O detail. */\nexport function recordAttachmentReferenceWire(reference: RecordAttachmentReference<AnyDefinition, unknown>): {\n readonly owner: RecordAttachmentOwner;\n readonly family: string;\n readonly value: unknown;\n} | undefined {\n const runtime = references.get(reference);\n return runtime === undefined ? undefined : Object.freeze({ owner: runtime.definition.owner, family: runtime.definition.family, value: runtime.value });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["protocol.ts"],"names":[],"mappings":";;;AAgFA,4DAEC;AAED,wDA4CC;AAED,8EASC;AAmBD,oEAAsK;AAEtK,0GAEC;AAED,0FAIC;AAED,8EAMC;AACD,sEAA6M;AAC7M,kEAAwM;AAExM,oGAcC;AAED,sEASC;AAED,4EAkCC;AAED,oFAcC;AAED,sEA0BC;AAED,wEA+DC;AAED,kFAA8L;AAE9L,sEAOC;AAzWD,mCAAmD;AAEnD,4DAAiE;AACjE,mEAAwH;AACxH,6CAA2N;AAC3N,2CAA6F;AAC7F,MAAM,gBAAgB,GAAkB,MAAM,CAAC,6CAA6C,CAAC,CAAC;AAC9F,MAAM,iBAAiB,GAAkB,MAAM,CAAC,8CAA8C,CAAC,CAAC;AAChG,MAAM,eAAe,GAAkB,MAAM,CAAC,4CAA4C,CAAC,CAAC;AAC5F,MAAM,WAAW,GAAG,IAAI,OAAO,EAA6B,CAAC;AAC7D,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAyB,CAAC;AAC/D,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU,CAAC;AAC3C,MAAM,UAAU,GAAG,IAAI,OAAO,EAA4B,CAAC;AAC3D,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAuC,CAAC;AACjF,MAAM,wBAAwB,GAAG,IAAI,OAAO,EAAyD,CAAC;AAmBtG,SAAS,iCAAiC,CAAC,KAAa;IACpD,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChD,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AK,EAAE,CAAC,CAAC;AAC3J,CAAC","sourcesContent":["import { Result, Schema, SchemaAST } from \"effect\";\nimport type { RecordAttachmentOwner } from \"../model/core.ts\";\nimport { isRecordAttachmentName } from \"../model/identifiers.ts\";\nimport { compileRecordSchemaCodec, type RecordSchemaCodec, type RecordSchemaWire } from \"../definition/schema-codec.ts\";\nimport { RecordBytesContentSchema, RecordTextContentSchema, isRecordBytesContentHandle, isRecordContentHandle, isRecordTextContentHandle, recordContentDeclarationMetadata, type RecordContentHandle } from \"./content.ts\";\nimport { RecordAttachmentSpiDefinitionError, type RecordAttachmentIssue } from \"./errors.ts\";\nconst definitionTypeId: unique symbol = Symbol(\"@niceeval/record/RecordAttachmentDefinition\");\nconst persistenceTypeId: unique symbol = Symbol(\"@niceeval/record/RecordAttachmentPersistence\");\nconst referenceTypeId: unique symbol = Symbol(\"@niceeval/record/RecordAttachmentReference\");\nconst definitions = new WeakMap<object, DefinitionRuntime>();\nconst definitionAliases = new WeakMap<object, AnyDefinition>();\nconst persistences = new WeakSet<object>();\nconst references = new WeakMap<object, ReferenceRuntime>();\nconst referenceDeclarations = new WeakMap<object, ReferenceDeclarationRuntime>();\nconst referenceDeclarationRuns = new WeakMap<SchemaAST.DeclarationRun, ReferenceDeclarationRuntime>();\nexport type RecordAttachmentSchema = Schema.Codec<unknown, unknown, never, never>;\ntype AnyDefinition = RecordAttachmentDefinition<RecordAttachmentOwner, string, Schema.Top>;\nexport interface RecordAttachmentReferenceTarget {\n readonly owner: RecordAttachmentOwner;\n readonly family: string;\n readonly schema: Schema.Top;\n}\ntype ResolvedReferenceDefinition<Definition extends RecordAttachmentReferenceTarget> = Definition extends AnyDefinition ? Definition : AnyDefinition;\ninterface DefinitionRuntime {\n readonly codec: RecordSchemaCodec<unknown, RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>;\n}\ninterface ReferenceDeclarationRuntime {\n readonly definition: AnyDefinition;\n readonly valueSchema: Schema.Codec<unknown, unknown, never, never> | undefined;\n}\ninterface ReferenceRuntime extends ReferenceDeclarationRuntime {\n readonly value: unknown;\n}\nfunction mintedReferenceDeclarationRuntime(value: object): ReferenceDeclarationRuntime | undefined {\n const direct = referenceDeclarations.get(value);\n if (direct !== undefined || !SchemaAST.isAST(value) || !SchemaAST.isDeclaration(value))\n return direct;\n if (value.typeParameters.length !== 0 ||\n value.checks !== undefined ||\n value.encoding !== undefined ||\n value.context !== undefined ||\n value.encodingChecks !== undefined ||\n value.encodingRun !== undefined && value.encodingRun !== value.run)\n return undefined;\n return referenceDeclarationRuns.get(value.run);\n}\nexport interface RecordAttachmentDefinition<out Owner extends RecordAttachmentOwner, out Family extends string, ValueSchema extends Schema.Top> {\n readonly owner: Owner;\n readonly family: Family;\n readonly schema: ValueSchema;\n readonly validate: ((value: Schema.Schema.Type<ValueSchema>) => readonly RecordAttachmentIssue[]) | undefined;\n readonly [definitionTypeId]: () => {\n readonly owner: Owner;\n readonly family: Family;\n };\n}\n/** Durable interpretation revision, deliberately separate from the logical fact definition. */\nexport interface RecordAttachmentPersistence<Definition extends AnyDefinition, out Revision extends number> {\n readonly attachment: Definition;\n readonly revision: Revision;\n readonly [persistenceTypeId]: () => {\n readonly attachment: Definition;\n readonly revision: Revision;\n };\n}\n/** Exact-definition reference token. Its wire identity is owner/family only. */\nexport interface RecordAttachmentReference<Definition extends AnyDefinition, Value = unknown> {\n readonly value: Value;\n readonly [referenceTypeId]: typeof referenceTypeId;\n}\nfunction positive(value: unknown): value is number {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value > 0;\n}\nfunction validOwner(value: unknown): value is RecordAttachmentOwner {\n return value === \"run\" || value === \"attempt\";\n}\nfunction invalid(cause?: unknown): never {\n throw new RecordAttachmentSpiDefinitionError(\"invalid-family-definition\", cause);\n}\n/** Record persistence is synchronous; reject declarations that retain a service context. */\nexport function isRecordAttachmentSchema(schema: Schema.Top): schema is RecordAttachmentSchema {\n return schema.ast.context === undefined;\n}\n/** Defines only the current logical fact: no revision, migration, writer or storage selector. */\nexport function defineRecordAttachment<const Owner extends RecordAttachmentOwner, const Family extends string, const ValueSchema extends Schema.Top>(input: {\n readonly owner: Owner;\n readonly family: Family;\n readonly schema: ValueSchema;\n readonly validate?: (value: Schema.Schema.Type<ValueSchema>) => readonly RecordAttachmentIssue[];\n}): RecordAttachmentDefinition<Owner, Family, ValueSchema> {\n if (!validOwner(input.owner) || !isRecordAttachmentName(input.family) || !isRecordAttachmentSchema(input.schema) || typeof input.validate !== \"undefined\" && typeof input.validate !== \"function\")\n invalid();\n const limits = {\n maximumJsonBytes: 1048576, maximumDepth: 64, maximumNodes: 100000,\n maximumObjectKeys: 10000, maximumArrayItems: 100000,\n maximumKeyUtf8Bytes: 16384, maximumStringUtf8Bytes: 1048576,\n };\n const definition = Object.freeze({\n owner: input.owner, family: input.family, schema: input.schema, validate: input.validate,\n [definitionTypeId]: () => ({ owner: input.owner, family: input.family }),\n }) as RecordAttachmentDefinition<Owner, Family, ValueSchema>;\n try {\n definitions.set(definition, Object.freeze({ codec: compileRecordSchemaCodec({\n schema: input.schema,\n limits,\n attachmentDeclarations: [\n { schema: RecordTextContentSchema, isValue: isRecordTextContentHandle, metadata: recordContentDeclarationMetadata(RecordTextContentSchema) },\n { schema: RecordBytesContentSchema, isValue: isRecordBytesContentHandle, metadata: recordContentDeclarationMetadata(RecordBytesContentSchema) },\n ],\n getAttachmentDeclaration: (ast) => {\n const reference = recordAttachmentReferenceDeclarationMetadata(ast);\n if (reference !== undefined)\n return reference;\n const content = recordContentDeclarationMetadata(ast);\n return content === undefined ? undefined : Object.freeze({\n metadata: content,\n accepts: content.kind === \"text\" ? isRecordTextContentHandle : isRecordBytesContentHandle,\n });\n },\n isAttachmentOpaque: (value) => isRecordAttachmentReference(value)\n ? { category: \"reference\" }\n : isRecordContentHandle(value) ? { category: \"content\" } : undefined,\n }) as RecordSchemaCodec<unknown, RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>> }));\n }\n catch (cause) {\n invalid(cause);\n }\n return definition;\n}\n/** Binds a definition to its one current durable interpretation revision. */\nexport function defineRecordAttachmentPersistence<const Definition extends AnyDefinition, const Revision extends number>(input: {\n readonly attachment: Definition;\n readonly revision: Revision;\n}): RecordAttachmentPersistence<Definition, Revision> {\n if (!isRecordAttachmentDefinition(input.attachment) || !positive(input.revision))\n invalid();\n const persistence = Object.freeze({ attachment: input.attachment, revision: input.revision, [persistenceTypeId]: () => ({ attachment: input.attachment, revision: input.revision }) }) as RecordAttachmentPersistence<Definition, Revision>;\n persistences.add(persistence);\n return persistence;\n}\nexport const RecordAttachmentReference = Object.freeze({\n /** Builds a package-owned Schema declaration. Session later mints values matching this exact declaration. */\n to<Definition extends RecordAttachmentReferenceTarget, Value = unknown, Encoded = Value>(definition: Definition, valueSchema?: Schema.Codec<Value, Encoded, never>): Schema.Codec<RecordAttachmentReference<ResolvedReferenceDefinition<Definition>, Value>, RecordAttachmentReference<ResolvedReferenceDefinition<Definition>, Value>, never> {\n const resolved = resolveRecordAttachmentDefinition(definition);\n if (resolved === undefined)\n invalid();\n type Resolved = ResolvedReferenceDefinition<Definition>;\n const declaration = Schema.declare<RecordAttachmentReference<Resolved, Value>>((value): value is RecordAttachmentReference<Resolved, Value> => {\n const runtime = isRecordAttachmentReference(value) ? references.get(value) : undefined;\n return runtime !== undefined && runtime.definition === resolved &&\n (valueSchema === undefined || !Result.isFailure(Schema.decodeUnknownResult(valueSchema)(runtime.value)));\n }, { identifier: `RecordAttachmentReference<${resolved.owner}:${resolved.family}>` });\n referenceDeclarations.set(declaration, Object.freeze({ definition: resolved, valueSchema }));\n referenceDeclarations.set(declaration.ast, Object.freeze({ definition: resolved, valueSchema }));\n referenceDeclarationRuns.set(declaration.ast.run, Object.freeze({ definition: resolved, valueSchema }));\n return declaration;\n },\n});\nexport function isRecordAttachmentDefinition(value: unknown): value is AnyDefinition { return typeof value === \"object\" && value !== null && definitions.has(value); }\n/** @internal High-level collection authoring accepts plain-data item declarations only. */\nexport function recordAttachmentDefinitionHasOpaqueDeclarations(definition: AnyDefinition): boolean {\n return definitions.get(definition)?.codec.opaqueDeclarationMetadata.length !== 0;\n}\n/** @internal Registers one package-owned high-level callable as an alias of its exact Attachment definition. */\nexport function registerRecordAttachmentDefinitionAlias(alias: object, definition: unknown): void {\n if (!isRecordAttachmentDefinition(definition))\n invalid();\n definitionAliases.set(alias, definition);\n}\n/** @internal Resolves exact definitions and package-owned high-level aliases; structural lookalikes never resolve. */\nexport function resolveRecordAttachmentDefinition(value: unknown): AnyDefinition | undefined {\n if (isRecordAttachmentDefinition(value))\n return value;\n return (typeof value === \"object\" && value !== null) || typeof value === \"function\"\n ? definitionAliases.get(value)\n : undefined;\n}\nexport function isRecordAttachmentPersistence(value: unknown): value is RecordAttachmentPersistence<AnyDefinition, number> { return typeof value === \"object\" && value !== null && persistences.has(value); }\nexport function isRecordAttachmentReference(value: unknown): value is RecordAttachmentReference<AnyDefinition, unknown> { return typeof value === \"object\" && value !== null && references.has(value); }\n/** @internal Schema compiler validates and labels only declarations minted by `to`. */\nexport function recordAttachmentReferenceDeclarationMetadata(value: object): {\n readonly metadata: {\n readonly category: \"reference\";\n readonly definition: AnyDefinition;\n readonly valueSchema: Schema.Codec<unknown, unknown, never, never> | undefined;\n };\n readonly accepts: (value: object) => boolean;\n} | undefined {\n const runtime = mintedReferenceDeclarationRuntime(value);\n return runtime === undefined ? undefined : Object.freeze({\n metadata: Object.freeze({ category: \"reference\", definition: runtime.definition, valueSchema: runtime.valueSchema }),\n accepts: (candidate) => isRecordAttachmentReference(candidate) && references.get(candidate)?.definition === runtime.definition &&\n (runtime.valueSchema === undefined || !Result.isFailure(Schema.decodeUnknownResult(runtime.valueSchema)(references.get(candidate)?.value))),\n });\n}\n/** @internal Session-only mint; declaration identity, optional value schema, and exact definition are all checked. */\nexport function mintRecordAttachmentReference<Definition extends AnyDefinition, Value>(declaration: Schema.Codec<RecordAttachmentReference<Definition, Value>, RecordAttachmentReference<Definition, Value>, never>, value: Value): RecordAttachmentReference<Definition, Value> {\n const runtime = referenceDeclarations.get(declaration);\n if (runtime === undefined)\n throw new TypeError(\"Record Attachment reference requires a package-owned declaration\");\n if (runtime.valueSchema !== undefined && Result.isFailure(Schema.decodeUnknownResult(runtime.valueSchema)(value)))\n throw new TypeError(\"Record Attachment reference value is invalid\");\n const token = Object.freeze({ value, [referenceTypeId]: referenceTypeId }) as RecordAttachmentReference<Definition, Value>;\n references.set(token, Object.freeze({ ...runtime, value }));\n return token;\n}\n/** @internal Host uses these to mint/validate closure without leaking storage capabilities. */\nexport function enumerateRecordAttachmentClosure(definition: AnyDefinition, value: unknown): Result.Result<{\n readonly contents: readonly RecordContentHandle[];\n readonly references: readonly RecordAttachmentReference<AnyDefinition, unknown>[];\n}, {\n readonly code: \"exact-decode-failed\" | \"invariant-failed\" | \"content-closure-failed\" | \"reference-closure-failed\";\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-decode-failed\" });\n const encoded = runtime.codec.encode(value as never);\n if (Result.isFailure(encoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n const decoded = runtime.codec.decode(encoded.success);\n if (Result.isFailure(decoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n if (definition.validate?.(decoded.success as never).length)\n return Result.fail({ code: \"invariant-failed\" });\n const contents: RecordContentHandle[] = [], refs: RecordAttachmentReference<AnyDefinition, unknown>[] = [];\n // The Schema compiler's declaration registry is the closure executor: only\n // values inhabiting a package-owned declaration count, never incidental objects.\n for (const entry of runtime.codec.enumerateOpaque(decoded.success)) {\n const metadata = entry.metadata as {\n readonly category?: string;\n } | undefined;\n if (isRecordContentHandle(entry.value) && metadata?.category === \"content\")\n contents.push(entry.value);\n if (isRecordAttachmentReference(entry.value) && metadata?.category === \"reference\")\n refs.push(entry.value);\n }\n if (new Set(contents).size !== contents.length)\n return Result.fail({ code: \"content-closure-failed\" });\n if (new Set(refs).size !== refs.length)\n return Result.fail({ code: \"reference-closure-failed\" });\n return Result.succeed(Object.freeze({ contents: Object.freeze(contents), references: Object.freeze(refs) }));\n}\n/** @internal Host-only diagnostic/closure metadata; family code never receives Schema AST. */\nexport function inspectRecordAttachmentOpaqueClosure(definition: AnyDefinition, value: unknown): Result.Result<readonly {\n readonly value: object;\n readonly metadata: unknown;\n}[], {\n readonly code: \"exact-decode-failed\";\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-decode-failed\" });\n const encoded = runtime.codec.encode(value as never);\n if (Result.isFailure(encoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n const decoded = runtime.codec.decode(encoded.success);\n return Result.isFailure(decoded) ? Result.fail({ code: \"exact-decode-failed\" }) : Result.succeed(runtime.codec.enumerateOpaque(decoded.success));\n}\n/** @internal Exact current codec encode for Core's physical encoder; opaque leaves remain sealed tokens. */\nexport function encodeRecordAttachmentCurrent(definition: AnyDefinition, value: unknown): Result.Result<RecordSchemaWire<RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>, {\n readonly code: \"exact-encode-failed\" | \"invariant-failed\" | \"content-closure-failed\" | \"reference-closure-failed\";\n readonly schemaIssues?: readonly {\n readonly path: ReadonlyArray<PropertyKey>;\n readonly message: string;\n }[];\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-encode-failed\" });\n const encoded = runtime.codec.encode(value);\n if (Result.isFailure(encoded)) {\n return Result.fail(encoded.failure.kind === \"schema\"\n ? { code: \"exact-encode-failed\", schemaIssues: encoded.failure.issues }\n : { code: \"exact-encode-failed\" });\n }\n const closure = enumerateRecordAttachmentClosure(definition, value);\n if (Result.isFailure(closure)) {\n switch (closure.failure.code) {\n case \"exact-decode-failed\": return Result.fail({ code: \"exact-encode-failed\" });\n case \"invariant-failed\": return Result.fail({ code: \"invariant-failed\" });\n case \"content-closure-failed\": return Result.fail({ code: \"content-closure-failed\" });\n case \"reference-closure-failed\": return Result.fail({ code: \"reference-closure-failed\" });\n }\n }\n return Result.succeed(encoded.success);\n}\n/** @internal Host binds validated storage-neutral leaves by exact declaration, never by paths or marker strings. */\nexport function hydrateRecordAttachmentCurrent<Definition extends AnyDefinition>(definition: Definition, wire: unknown, binder: {\n readonly content: (token: unknown, declaration: {\n readonly kind: \"text\" | \"bytes\";\n readonly maximumBytes: number | undefined;\n }) => Result.Result<RecordContentHandle | undefined, {\n readonly code: \"current-content-bind-failed\";\n }>;\n readonly reference: (token: unknown, declaration: {\n readonly definition: AnyDefinition;\n readonly valueSchema: Schema.Codec<unknown, unknown, never, never> | undefined;\n }) => Result.Result<RecordAttachmentReference<AnyDefinition, unknown> | undefined, {\n readonly code: \"current-reference-bind-failed\";\n }>;\n}): Result.Result<Schema.Schema.Type<Definition[\"schema\"]>, {\n readonly code: \"exact-decode-failed\" | \"invariant-failed\" | \"content-closure-failed\" | \"reference-closure-failed\" | \"current-content-bind-failed\" | \"current-reference-bind-failed\";\n}> {\n const runtime = definitions.get(definition);\n if (runtime === undefined)\n return Result.fail({ code: \"exact-decode-failed\" });\n let failure: {\n readonly code: \"current-content-bind-failed\";\n } | {\n readonly code: \"current-reference-bind-failed\";\n } | undefined;\n const projected = runtime.codec.mapOpaqueEncoded(wire, (token, metadata) => {\n const declaration = metadata as {\n readonly category?: string;\n readonly kind?: \"text\" | \"bytes\";\n readonly maximumBytes?: number;\n readonly definition?: AnyDefinition;\n readonly valueSchema?: Schema.Codec<unknown, unknown, never, never>;\n };\n if (declaration.category === \"content\" && declaration.kind !== undefined) {\n const bound = binder.content(token, { kind: declaration.kind, maximumBytes: declaration.maximumBytes });\n if (Result.isFailure(bound)) {\n failure = bound.failure;\n return { _tag: \"unmatched\" };\n }\n if (bound.success === undefined || declaration.kind === \"text\" && !isRecordTextContentHandle(bound.success) || declaration.kind === \"bytes\" && !isRecordBytesContentHandle(bound.success))\n return { _tag: \"unmatched\" };\n return { _tag: \"matched\", value: bound.success };\n }\n if (declaration.category === \"reference\" && declaration.definition !== undefined) {\n const bound = binder.reference(token, { definition: declaration.definition, valueSchema: declaration.valueSchema });\n if (Result.isFailure(bound)) {\n failure = bound.failure;\n return { _tag: \"unmatched\" };\n }\n return bound.success === undefined ? { _tag: \"unmatched\" } : { _tag: \"matched\", value: bound.success };\n }\n return { _tag: \"unmatched\" };\n });\n if (failure !== undefined)\n return Result.fail(failure);\n const decoded = runtime.codec.decode(projected);\n if (Result.isFailure(decoded))\n return Result.fail({ code: \"exact-decode-failed\" });\n const closure = enumerateRecordAttachmentClosure(definition, decoded.success);\n if (Result.isFailure(closure))\n return Result.fail(closure.failure);\n if (definition.validate?.(decoded.success as never).length)\n return Result.fail({ code: \"invariant-failed\" });\n return Result.succeed(decoded.success as Schema.Schema.Type<Definition[\"schema\"]>);\n}\n/** @internal exact definition capability held by a reference token. */\nexport function recordAttachmentReferenceDefinition(reference: RecordAttachmentReference<AnyDefinition, unknown>): AnyDefinition | undefined { return references.get(reference)?.definition; }\n/** @internal Durable wire identity intentionally omits definition capability and all I/O detail. */\nexport function recordAttachmentReferenceWire(reference: RecordAttachmentReference<AnyDefinition, unknown>): {\n readonly owner: RecordAttachmentOwner;\n readonly family: string;\n readonly value: unknown;\n} | undefined {\n const runtime = references.get(reference);\n return runtime === undefined ? undefined : Object.freeze({ owner: runtime.definition.owner, family: runtime.definition.family, value: runtime.value });\n}\n"]}
|
|
@@ -93,6 +93,10 @@ export declare function inspectRecordAttachmentOpaqueClosure(definition: AnyDefi
|
|
|
93
93
|
/** @internal Exact current codec encode for Core's physical encoder; opaque leaves remain sealed tokens. */
|
|
94
94
|
export declare function encodeRecordAttachmentCurrent(definition: AnyDefinition, value: unknown): Result.Result<RecordSchemaWire<RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>, {
|
|
95
95
|
readonly code: "exact-encode-failed" | "invariant-failed" | "content-closure-failed" | "reference-closure-failed";
|
|
96
|
+
readonly schemaIssues?: readonly {
|
|
97
|
+
readonly path: ReadonlyArray<PropertyKey>;
|
|
98
|
+
readonly message: string;
|
|
99
|
+
}[];
|
|
96
100
|
}>;
|
|
97
101
|
/** @internal Host binds validated storage-neutral leaves by exact declaration, never by paths or marker strings. */
|
|
98
102
|
export declare function hydrateRecordAttachmentCurrent<Definition extends AnyDefinition>(definition: Definition, wire: unknown, binder: {
|
|
@@ -93,6 +93,10 @@ export declare function inspectRecordAttachmentOpaqueClosure(definition: AnyDefi
|
|
|
93
93
|
/** @internal Exact current codec encode for Core's physical encoder; opaque leaves remain sealed tokens. */
|
|
94
94
|
export declare function encodeRecordAttachmentCurrent(definition: AnyDefinition, value: unknown): Result.Result<RecordSchemaWire<RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>, {
|
|
95
95
|
readonly code: "exact-encode-failed" | "invariant-failed" | "content-closure-failed" | "reference-closure-failed";
|
|
96
|
+
readonly schemaIssues?: readonly {
|
|
97
|
+
readonly path: ReadonlyArray<PropertyKey>;
|
|
98
|
+
readonly message: string;
|
|
99
|
+
}[];
|
|
96
100
|
}>;
|
|
97
101
|
/** @internal Host binds validated storage-neutral leaves by exact declaration, never by paths or marker strings. */
|
|
98
102
|
export declare function hydrateRecordAttachmentCurrent<Definition extends AnyDefinition>(definition: Definition, wire: unknown, binder: {
|
|
@@ -93,6 +93,10 @@ export declare function inspectRecordAttachmentOpaqueClosure(definition: AnyDefi
|
|
|
93
93
|
/** @internal Exact current codec encode for Core's physical encoder; opaque leaves remain sealed tokens. */
|
|
94
94
|
export declare function encodeRecordAttachmentCurrent(definition: AnyDefinition, value: unknown): Result.Result<RecordSchemaWire<RecordContentHandle | RecordAttachmentReference<AnyDefinition, unknown>>, {
|
|
95
95
|
readonly code: "exact-encode-failed" | "invariant-failed" | "content-closure-failed" | "reference-closure-failed";
|
|
96
|
+
readonly schemaIssues?: readonly {
|
|
97
|
+
readonly path: ReadonlyArray<PropertyKey>;
|
|
98
|
+
readonly message: string;
|
|
99
|
+
}[];
|
|
96
100
|
}>;
|
|
97
101
|
/** @internal Host binds validated storage-neutral leaves by exact declaration, never by paths or marker strings. */
|
|
98
102
|
export declare function hydrateRecordAttachmentCurrent<Definition extends AnyDefinition>(definition: Definition, wire: unknown, binder: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NoBlobSourceReceiptBudget = exports.SourceReceiptCollectionSchema = exports.SourceReceiptLimitationSchema = exports.SourceRetentionTargetSchema = exports.SourceReceiptStageSchema = exports.SourceSegmentIdSchema = void 0;
|
|
4
|
+
exports.sourceReceiptLimitationKey = sourceReceiptLimitationKey;
|
|
4
5
|
exports.hasCanonicalSourceSegments = hasCanonicalSourceSegments;
|
|
5
6
|
const effect_1 = require("effect");
|
|
6
7
|
const common_ts_1 = require("../common.cjs");
|
|
@@ -50,14 +51,26 @@ exports.SourceReceiptLimitationSchema = effect_1.Schema.Union([
|
|
|
50
51
|
replacementOrOmittedCount: common_ts_1.PositiveSafeIntegerSchema,
|
|
51
52
|
}),
|
|
52
53
|
]);
|
|
53
|
-
function
|
|
54
|
-
|
|
54
|
+
function sourceReceiptLimitationKey(value) {
|
|
55
|
+
switch (value.code) {
|
|
56
|
+
case "capture-failed":
|
|
57
|
+
case "capture-interrupted":
|
|
58
|
+
return [value.code, value.stage, value.target].join("\u0000");
|
|
59
|
+
case "collection-cap-reached":
|
|
60
|
+
case "unsupported-input":
|
|
61
|
+
return [value.code, value.target, String(value.omittedAtLeast)].join("\u0000");
|
|
62
|
+
case "text-truncated":
|
|
63
|
+
case "redacted":
|
|
64
|
+
case "invalid-utf8-replaced":
|
|
65
|
+
case "unsafe-control-stripped":
|
|
66
|
+
return [value.code, value.target, String(value.replacementOrOmittedCount)].join("\u0000");
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
function canonicalLimitations(values) {
|
|
57
70
|
let previous;
|
|
58
71
|
const seen = new Set();
|
|
59
72
|
for (const value of values) {
|
|
60
|
-
const key =
|
|
73
|
+
const key = sourceReceiptLimitationKey(value);
|
|
61
74
|
if (seen.has(key) || (previous !== undefined && previous >= key))
|
|
62
75
|
return false;
|
|
63
76
|
seen.add(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAiDA,gEAcC;AA4BD,gEASC;AApGD,mCAAgC;AAChC,4CAAkG;AACrF,QAAA,qBAAqB,GAAG,gCAAoB,CAAC;AAC7C,QAAA,wBAAwB,GAAG,eAAM,CAAC,QAAQ,CAAC;IACpD,SAAS;IACT,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,wBAAwB;IACxB,mBAAmB;IACnB,cAAc;CACjB,CAAC,CAAC;AACU,QAAA,2BAA2B,GAAG,eAAM,CAAC,QAAQ,CAAC;IACvD,MAAM;IACN,WAAW;IACX,mBAAmB;IACnB,cAAc;IACd,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,kBAAkB;IAClB,YAAY;IACZ,cAAc;CACjB,CAAC,CAAC;AACU,QAAA,6BAA6B,GAAG,eAAM,CAAC,KAAK,CAAC;IACtD,eAAM,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,eAAM,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QAChE,KAAK,EAAE,gCAAwB;QAC/B,MAAM,EAAE,mCAA2B;KACtC,CAAC;IACF,eAAM,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,eAAM,CAAC,QAAQ,CAAC,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;QACtE,MAAM,EAAE,mCAA2B;QACnC,cAAc,EAAE,qCAAyB;KAC5C,CAAC;IACF,eAAM,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,eAAM,CAAC,QAAQ,CAAC;YAClB,gBAAgB;YAChB,UAAU;YACV,uBAAuB;YACvB,yBAA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GAAG,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AACY,QAAA,6BAA6B,GAAG,eAAM,CAAC,KAAK,CAAC;IACtD,eAAM,CAAC,MAAM,CAAC;QACV,KAAK,EAAE,eAAM,CAAC,OAAO,CAAC,UAAU,CAAC;QACjC,WAAW,EAAE,4BAAgB;KAChC,CAAC;IACF,eAAM,CAAC,MAAM,CAAC;QACV,KAAK,EAAE,eAAM,CAAC,OAAO,CAAC,SAAS,CAAC;QAChC,WAAW,EAAE,eAAM,CAAC,aAAa,CAAC,qCAA6B,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,KAAK,CAAC,eAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC;KAC/H,CAAC;CACL,CAAC,CAAC;AAMH,SAAgB,0BAA0B,CAAC,QAAyC;IAChF,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QAChD,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;YAC1B,OAAO,CAAC,QAAQ,KAAK,KAAK,GAAG,CAAC;YAC9B,OAAO,KAAK,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AACY,QAAA,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,iBAAiB,EAAE,CAAC;CACvB,CAAC,CAAC","sourcesContent":["import { Schema } from \"effect\";\nimport { EmptyArraySchema, PositiveSafeIntegerSchema, SafeIdentifierSchema, } from \"../common.ts\";\nexport const SourceSegmentIdSchema = SafeIdentifierSchema;\nexport const SourceReceiptStageSchema = Schema.Literals([\n \"adapter\",\n \"session-manager\",\n \"sandbox-wrapper\",\n \"runner-clock\",\n \"runner-diagnostic-sink\",\n \"attempt-finalizer\",\n \"run-teardown\",\n]);\nexport const SourceRetentionTargetSchema = Schema.Literals([\n \"turn\",\n \"turn-item\",\n \"usage-observation\",\n \"turn-context\",\n \"command\",\n \"stdout\",\n \"stderr\",\n \"activity\",\n \"diagnostic\",\n \"diagnostic-cause\",\n \"value-byte\",\n \"content-byte\",\n]);\nexport const SourceReceiptLimitationSchema = Schema.Union([\n Schema.Struct({\n code: Schema.Literals([\"capture-failed\", \"capture-interrupted\"]),\n stage: SourceReceiptStageSchema,\n target: SourceRetentionTargetSchema,\n }),\n Schema.Struct({\n code: Schema.Literals([\"collection-cap-reached\", \"unsupported-input\"]),\n target: SourceRetentionTargetSchema,\n omittedAtLeast: PositiveSafeIntegerSchema,\n }),\n Schema.Struct({\n code: Schema.Literals([\n \"text-truncated\",\n \"redacted\",\n \"invalid-utf8-replaced\",\n \"unsafe-control-stripped\",\n ]),\n target: SourceRetentionTargetSchema,\n replacementOrOmittedCount: PositiveSafeIntegerSchema,\n }),\n]);\nexport type SourceReceiptLimitation = Schema.Schema.Type<typeof SourceReceiptLimitationSchema>;\nexport function sourceReceiptLimitationKey(value: SourceReceiptLimitation): string {\n switch (value.code) {\n case \"capture-failed\":\n case \"capture-interrupted\":\n return [value.code, value.stage, value.target].join(\"\\u0000\");\n case \"collection-cap-reached\":\n case \"unsupported-input\":\n return [value.code, value.target, String(value.omittedAtLeast)].join(\"\\u0000\");\n case \"text-truncated\":\n case \"redacted\":\n case \"invalid-utf8-replaced\":\n case \"unsafe-control-stripped\":\n return [value.code, value.target, String(value.replacementOrOmittedCount)].join(\"\\u0000\");\n }\n}\nfunction canonicalLimitations(values: readonly SourceReceiptLimitation[]): boolean {\n let previous: string | undefined;\n const seen = new Set<string>();\n for (const value of values) {\n const key = sourceReceiptLimitationKey(value);\n if (seen.has(key) || (previous !== undefined && previous >= key))\n return false;\n seen.add(key);\n previous = key;\n }\n return true;\n}\nexport const SourceReceiptCollectionSchema = Schema.Union([\n Schema.Struct({\n state: Schema.Literal(\"complete\"),\n limitations: EmptyArraySchema,\n }),\n Schema.Struct({\n state: Schema.Literal(\"partial\"),\n limitations: Schema.NonEmptyArray(SourceReceiptLimitationSchema).pipe(Schema.check(Schema.makeFilter(canonicalLimitations))),\n }),\n]);\nexport type SourceReceiptCollection = Schema.Schema.Type<typeof SourceReceiptCollectionSchema>;\nexport interface SourceReceiptSegment {\n readonly segmentId: string;\n readonly sequence: number;\n}\nexport function hasCanonicalSourceSegments(segments: readonly SourceReceiptSegment[]): boolean {\n const ids = new Set<string>();\n for (const [index, segment] of segments.entries()) {\n if (ids.has(segment.segmentId) ||\n segment.sequence !== index + 1)\n return false;\n ids.add(segment.segmentId);\n }\n return true;\n}\nexport const NoBlobSourceReceiptBudget = Object.freeze({\n maximumBlobs: 1,\n maximumBlobBytes: 1,\n maximumTotalBytes: 1,\n});\n"]}
|
|
@@ -16,6 +16,7 @@ export declare const SourceReceiptLimitationSchema: Schema.Union<readonly [Schem
|
|
|
16
16
|
readonly replacementOrOmittedCount: Schema.Number;
|
|
17
17
|
}>]>;
|
|
18
18
|
export type SourceReceiptLimitation = Schema.Schema.Type<typeof SourceReceiptLimitationSchema>;
|
|
19
|
+
export declare function sourceReceiptLimitationKey(value: SourceReceiptLimitation): string;
|
|
19
20
|
export declare const SourceReceiptCollectionSchema: Schema.Union<readonly [Schema.Struct<{
|
|
20
21
|
readonly state: Schema.Literal<"complete">;
|
|
21
22
|
readonly limitations: Schema.Tuple<readonly []>;
|
|
@@ -16,6 +16,7 @@ export declare const SourceReceiptLimitationSchema: Schema.Union<readonly [Schem
|
|
|
16
16
|
readonly replacementOrOmittedCount: Schema.Number;
|
|
17
17
|
}>]>;
|
|
18
18
|
export type SourceReceiptLimitation = Schema.Schema.Type<typeof SourceReceiptLimitationSchema>;
|
|
19
|
+
export declare function sourceReceiptLimitationKey(value: SourceReceiptLimitation): string;
|
|
19
20
|
export declare const SourceReceiptCollectionSchema: Schema.Union<readonly [Schema.Struct<{
|
|
20
21
|
readonly state: Schema.Literal<"complete">;
|
|
21
22
|
readonly limitations: Schema.Tuple<readonly []>;
|
|
@@ -16,6 +16,7 @@ export declare const SourceReceiptLimitationSchema: Schema.Union<readonly [Schem
|
|
|
16
16
|
readonly replacementOrOmittedCount: Schema.Number;
|
|
17
17
|
}>]>;
|
|
18
18
|
export type SourceReceiptLimitation = Schema.Schema.Type<typeof SourceReceiptLimitationSchema>;
|
|
19
|
+
export declare function sourceReceiptLimitationKey(value: SourceReceiptLimitation): string;
|
|
19
20
|
export declare const SourceReceiptCollectionSchema: Schema.Union<readonly [Schema.Struct<{
|
|
20
21
|
readonly state: Schema.Literal<"complete">;
|
|
21
22
|
readonly limitations: Schema.Tuple<readonly []>;
|
|
@@ -15,4 +15,6 @@ const __niceevalExport5 = __niceevalCanonical["SourceSegmentIdSchema"];
|
|
|
15
15
|
export { __niceevalExport5 as SourceSegmentIdSchema };
|
|
16
16
|
const __niceevalExport6 = __niceevalCanonical["hasCanonicalSourceSegments"];
|
|
17
17
|
export { __niceevalExport6 as hasCanonicalSourceSegments };
|
|
18
|
+
const __niceevalExport7 = __niceevalCanonical["sourceReceiptLimitationKey"];
|
|
19
|
+
export { __niceevalExport7 as sourceReceiptLimitationKey };
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -888,6 +888,9 @@ function makeReadSession(runtime) {
|
|
|
888
888
|
after = summary.runId;
|
|
889
889
|
if (requested !== undefined && !requested.has(summary.runId))
|
|
890
890
|
continue;
|
|
891
|
+
if (summary.logicalSealIdentity.startsWith("published:") &&
|
|
892
|
+
request?.includePublishedActive !== true && requested === undefined)
|
|
893
|
+
continue;
|
|
891
894
|
const runId = summary.runId;
|
|
892
895
|
const core = yield* readCore(runtime, runId);
|
|
893
896
|
if (core === undefined)
|