@fuaran-ui/ops 0.19.0 → 0.21.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.d.cts CHANGED
@@ -140,6 +140,13 @@ declare const evalErrorString: (e: EvalError) => string;
140
140
  declare const stepParams: (t: Transform) => readonly string[];
141
141
  /** Every distinct param name a pipeline references — the TS mirror of Core `Transform.paramsOf`. */
142
142
  declare const pipelineParams: (pipeline: readonly Transform[]) => readonly string[];
143
+ /**
144
+ * Substitute every `inParam` bound in `listEnv` with the literal `in` form, through the
145
+ * whole pipeline — the TS mirror of Core `Transform.substituteListParams`. Unbound list
146
+ * params are left intact for the caller's prune to catch. Only `filter` / `derive` carry
147
+ * a `ColExpr`; every other step is returned unchanged.
148
+ */
149
+ declare const substituteListParams: (listEnv: Readonly<Record<string, readonly Cell[]>>, pipeline: readonly Transform[]) => readonly Transform[];
143
150
 
144
151
  /** Stable AI-friendly discriminator for decode-time failures (WIRE_FORMAT.md §6). */
145
152
  type DecodeErrorCode = 'INVALID_JSON' | 'MISSING_FIELD' | 'WRONG_TYPE' | 'UNKNOWN_DU_CASE' | 'WRONG_NODE_KIND' | 'EMPTY_NODE_ID'
@@ -435,6 +442,22 @@ declare const pasteOpWith: <TMsg>(freshIds: FreshIds, targetRoot: Node<TMsg>, in
435
442
  /** `pasteOpWith` under the default derived-suffix id strategy. */
436
443
  declare const pasteOp: <TMsg>(targetRoot: Node<TMsg>, incoming: Node<TMsg>, target: PlaceTarget) => Result<TreeOp<TMsg>, PlaceError>;
437
444
 
445
+ /**
446
+ * Who authored a DAG op. Structurally identical to `Actor` in
447
+ * `@fuaran-ui/op-stream`, and DELIBERATELY declared here rather than imported:
448
+ * op-stream depends on this package, so importing it would invert the package
449
+ * dependency. TypeScript is structurally typed, so an op-stream `Actor` is
450
+ * assignable here and vice versa with no import and no new dependency edge.
451
+ */
452
+ type DagActor = {
453
+ readonly kind: 'human';
454
+ readonly id: string;
455
+ } | {
456
+ readonly kind: 'agent';
457
+ readonly model: string;
458
+ readonly version: string;
459
+ readonly id: string;
460
+ };
438
461
  /** The result envelope captured on a DAG record (closed shape). */
439
462
  type DagResultEnvelope = {
440
463
  readonly $type: 'Success';
@@ -457,7 +480,7 @@ interface DagOpRecord<TMsg = unknown> {
457
480
  readonly op: TreeOp<TMsg>;
458
481
  readonly outcomeHash?: string;
459
482
  readonly promptId?: string;
460
- readonly userId: string;
483
+ readonly actor: DagActor;
461
484
  /** Unix seconds. */
462
485
  readonly timestamp: number;
463
486
  readonly resultEnvelope: DagResultEnvelope;
@@ -465,10 +488,10 @@ interface DagOpRecord<TMsg = unknown> {
465
488
  }
466
489
  /**
467
490
  * Encode a `DagOpRecord` to its canonical JSON wire form. Keys in Ordinal order
468
- * (hash < op < outcomeHash < parents < promptId < resultEnvelope < streamId <
469
- * timestamp < tombstoned < userId); `outcomeHash` / `promptId` omitted when
470
- * absent; `op` nests `encodeOp` verbatim. Byte-identical to the F#
471
- * `DagWire.encodeRecord`.
491
+ * (actor < hash < op < outcomeHash < parents < promptId < resultEnvelope <
492
+ * streamId < timestamp < tombstoned); `outcomeHash` / `promptId` omitted when
493
+ * absent; `op` nests `encodeOp` and `actor` nests the canonical actor form
494
+ * verbatim. Byte-identical to the F# `DagWire.encodeRecord`.
472
495
  */
473
496
  declare const encodeDagRecord: <TMsg>(record: DagOpRecord<TMsg>) => string;
474
497
  type DecodeResult<T> = {
@@ -817,4 +840,4 @@ declare const withStateSeeds: <TMsg, S extends {
817
840
  readonly state?: Readonly<Record<string, unknown>>;
818
841
  }>(tree: Node<TMsg>, sources: S) => S;
819
842
 
820
- export { type Answer, type AnswerContract, type AnswerField, type AnswerSpace, type AnswerValue, type ApplyError, type ApplyErrorCode, type ApplyResult, type Compatibility, type DagOpRecord, type DagResultEnvelope, type DecodeError, type DecodeErrorCode, type Decoded, ELICITATION_KEY, ELICITATION_VERSION, type ElicitationEnvelope, type ElicitationError, type ElicitationErrorCode, type ElicitationOutcome, type ElicitationOutcomeEnvelope, type Envelope, type EnvelopeError, type EnvelopeErrorCode, type EvalEnv, type FreshIds, HOST_RESERVED_PREFIX, type JsonAst, type MergeConflict, type MergeResult, type OpApplyTelemetryRecord, PAYLOAD_KEY, PROFILE_KEY, type ParseError, type PlaceError, type PlaceTarget, type Placement, type Profile, REQUIRED_PROFILE_KEY, type SourceResolver, type TreeOp, type UnknownKind, apply, canPlace, cellString, coerce, collectStateSeeds, coreV1, decodeDagRecord, decodeElicitation, decodeElicitationOutcome, decodeEnvelope, decodeEnvelopeAst, decodeNode, decodeNodeTolerant, decodeOp, decodeTolerant, derivedFreshIds, duplicateOp, duplicateOpWith, encodeCell, encodeColExpr, encodeDagRecord, encodeDataSource, encodeElicitation, encodeElicitationOutcome, encodeEnvelope, encodeNode, encodeOp, encodePipeline, evalErrorString, evalPipeline, evalPipelineInEnv, evalPipelineWith, evalPipelineWithInEnv, evalSource, field as jsonField, liveValueToTable, merge3Way, moveOp, negotiate, negotiateEnvelope, noResolve, nudgeOp, parse, pasteOp, pasteOpWith, pipelineParams, placeOp, reencodeNode, renderAstCanonical, renderProfile, sequentialFreshIds, stepParams, tryParseProfile, validateAnswer, validateAnswerAt, validateAnswerDocument, withStateSeeds };
843
+ export { type Answer, type AnswerContract, type AnswerField, type AnswerSpace, type AnswerValue, type ApplyError, type ApplyErrorCode, type ApplyResult, type Compatibility, type DagActor, type DagOpRecord, type DagResultEnvelope, type DecodeError, type DecodeErrorCode, type Decoded, ELICITATION_KEY, ELICITATION_VERSION, type ElicitationEnvelope, type ElicitationError, type ElicitationErrorCode, type ElicitationOutcome, type ElicitationOutcomeEnvelope, type Envelope, type EnvelopeError, type EnvelopeErrorCode, type EvalEnv, type FreshIds, HOST_RESERVED_PREFIX, type JsonAst, type MergeConflict, type MergeResult, type OpApplyTelemetryRecord, PAYLOAD_KEY, PROFILE_KEY, type ParseError, type PlaceError, type PlaceTarget, type Placement, type Profile, REQUIRED_PROFILE_KEY, type SourceResolver, type TreeOp, type UnknownKind, apply, canPlace, cellString, coerce, collectStateSeeds, coreV1, decodeDagRecord, decodeElicitation, decodeElicitationOutcome, decodeEnvelope, decodeEnvelopeAst, decodeNode, decodeNodeTolerant, decodeOp, decodeTolerant, derivedFreshIds, duplicateOp, duplicateOpWith, encodeCell, encodeColExpr, encodeDagRecord, encodeDataSource, encodeElicitation, encodeElicitationOutcome, encodeEnvelope, encodeNode, encodeOp, encodePipeline, evalErrorString, evalPipeline, evalPipelineInEnv, evalPipelineWith, evalPipelineWithInEnv, evalSource, field as jsonField, liveValueToTable, merge3Way, moveOp, negotiate, negotiateEnvelope, noResolve, nudgeOp, parse, pasteOp, pasteOpWith, pipelineParams, placeOp, reencodeNode, renderAstCanonical, renderProfile, sequentialFreshIds, stepParams, substituteListParams, tryParseProfile, validateAnswer, validateAnswerAt, validateAnswerDocument, withStateSeeds };
package/dist/index.d.ts CHANGED
@@ -140,6 +140,13 @@ declare const evalErrorString: (e: EvalError) => string;
140
140
  declare const stepParams: (t: Transform) => readonly string[];
141
141
  /** Every distinct param name a pipeline references — the TS mirror of Core `Transform.paramsOf`. */
142
142
  declare const pipelineParams: (pipeline: readonly Transform[]) => readonly string[];
143
+ /**
144
+ * Substitute every `inParam` bound in `listEnv` with the literal `in` form, through the
145
+ * whole pipeline — the TS mirror of Core `Transform.substituteListParams`. Unbound list
146
+ * params are left intact for the caller's prune to catch. Only `filter` / `derive` carry
147
+ * a `ColExpr`; every other step is returned unchanged.
148
+ */
149
+ declare const substituteListParams: (listEnv: Readonly<Record<string, readonly Cell[]>>, pipeline: readonly Transform[]) => readonly Transform[];
143
150
 
144
151
  /** Stable AI-friendly discriminator for decode-time failures (WIRE_FORMAT.md §6). */
145
152
  type DecodeErrorCode = 'INVALID_JSON' | 'MISSING_FIELD' | 'WRONG_TYPE' | 'UNKNOWN_DU_CASE' | 'WRONG_NODE_KIND' | 'EMPTY_NODE_ID'
@@ -435,6 +442,22 @@ declare const pasteOpWith: <TMsg>(freshIds: FreshIds, targetRoot: Node<TMsg>, in
435
442
  /** `pasteOpWith` under the default derived-suffix id strategy. */
436
443
  declare const pasteOp: <TMsg>(targetRoot: Node<TMsg>, incoming: Node<TMsg>, target: PlaceTarget) => Result<TreeOp<TMsg>, PlaceError>;
437
444
 
445
+ /**
446
+ * Who authored a DAG op. Structurally identical to `Actor` in
447
+ * `@fuaran-ui/op-stream`, and DELIBERATELY declared here rather than imported:
448
+ * op-stream depends on this package, so importing it would invert the package
449
+ * dependency. TypeScript is structurally typed, so an op-stream `Actor` is
450
+ * assignable here and vice versa with no import and no new dependency edge.
451
+ */
452
+ type DagActor = {
453
+ readonly kind: 'human';
454
+ readonly id: string;
455
+ } | {
456
+ readonly kind: 'agent';
457
+ readonly model: string;
458
+ readonly version: string;
459
+ readonly id: string;
460
+ };
438
461
  /** The result envelope captured on a DAG record (closed shape). */
439
462
  type DagResultEnvelope = {
440
463
  readonly $type: 'Success';
@@ -457,7 +480,7 @@ interface DagOpRecord<TMsg = unknown> {
457
480
  readonly op: TreeOp<TMsg>;
458
481
  readonly outcomeHash?: string;
459
482
  readonly promptId?: string;
460
- readonly userId: string;
483
+ readonly actor: DagActor;
461
484
  /** Unix seconds. */
462
485
  readonly timestamp: number;
463
486
  readonly resultEnvelope: DagResultEnvelope;
@@ -465,10 +488,10 @@ interface DagOpRecord<TMsg = unknown> {
465
488
  }
466
489
  /**
467
490
  * Encode a `DagOpRecord` to its canonical JSON wire form. Keys in Ordinal order
468
- * (hash < op < outcomeHash < parents < promptId < resultEnvelope < streamId <
469
- * timestamp < tombstoned < userId); `outcomeHash` / `promptId` omitted when
470
- * absent; `op` nests `encodeOp` verbatim. Byte-identical to the F#
471
- * `DagWire.encodeRecord`.
491
+ * (actor < hash < op < outcomeHash < parents < promptId < resultEnvelope <
492
+ * streamId < timestamp < tombstoned); `outcomeHash` / `promptId` omitted when
493
+ * absent; `op` nests `encodeOp` and `actor` nests the canonical actor form
494
+ * verbatim. Byte-identical to the F# `DagWire.encodeRecord`.
472
495
  */
473
496
  declare const encodeDagRecord: <TMsg>(record: DagOpRecord<TMsg>) => string;
474
497
  type DecodeResult<T> = {
@@ -817,4 +840,4 @@ declare const withStateSeeds: <TMsg, S extends {
817
840
  readonly state?: Readonly<Record<string, unknown>>;
818
841
  }>(tree: Node<TMsg>, sources: S) => S;
819
842
 
820
- export { type Answer, type AnswerContract, type AnswerField, type AnswerSpace, type AnswerValue, type ApplyError, type ApplyErrorCode, type ApplyResult, type Compatibility, type DagOpRecord, type DagResultEnvelope, type DecodeError, type DecodeErrorCode, type Decoded, ELICITATION_KEY, ELICITATION_VERSION, type ElicitationEnvelope, type ElicitationError, type ElicitationErrorCode, type ElicitationOutcome, type ElicitationOutcomeEnvelope, type Envelope, type EnvelopeError, type EnvelopeErrorCode, type EvalEnv, type FreshIds, HOST_RESERVED_PREFIX, type JsonAst, type MergeConflict, type MergeResult, type OpApplyTelemetryRecord, PAYLOAD_KEY, PROFILE_KEY, type ParseError, type PlaceError, type PlaceTarget, type Placement, type Profile, REQUIRED_PROFILE_KEY, type SourceResolver, type TreeOp, type UnknownKind, apply, canPlace, cellString, coerce, collectStateSeeds, coreV1, decodeDagRecord, decodeElicitation, decodeElicitationOutcome, decodeEnvelope, decodeEnvelopeAst, decodeNode, decodeNodeTolerant, decodeOp, decodeTolerant, derivedFreshIds, duplicateOp, duplicateOpWith, encodeCell, encodeColExpr, encodeDagRecord, encodeDataSource, encodeElicitation, encodeElicitationOutcome, encodeEnvelope, encodeNode, encodeOp, encodePipeline, evalErrorString, evalPipeline, evalPipelineInEnv, evalPipelineWith, evalPipelineWithInEnv, evalSource, field as jsonField, liveValueToTable, merge3Way, moveOp, negotiate, negotiateEnvelope, noResolve, nudgeOp, parse, pasteOp, pasteOpWith, pipelineParams, placeOp, reencodeNode, renderAstCanonical, renderProfile, sequentialFreshIds, stepParams, tryParseProfile, validateAnswer, validateAnswerAt, validateAnswerDocument, withStateSeeds };
843
+ export { type Answer, type AnswerContract, type AnswerField, type AnswerSpace, type AnswerValue, type ApplyError, type ApplyErrorCode, type ApplyResult, type Compatibility, type DagActor, type DagOpRecord, type DagResultEnvelope, type DecodeError, type DecodeErrorCode, type Decoded, ELICITATION_KEY, ELICITATION_VERSION, type ElicitationEnvelope, type ElicitationError, type ElicitationErrorCode, type ElicitationOutcome, type ElicitationOutcomeEnvelope, type Envelope, type EnvelopeError, type EnvelopeErrorCode, type EvalEnv, type FreshIds, HOST_RESERVED_PREFIX, type JsonAst, type MergeConflict, type MergeResult, type OpApplyTelemetryRecord, PAYLOAD_KEY, PROFILE_KEY, type ParseError, type PlaceError, type PlaceTarget, type Placement, type Profile, REQUIRED_PROFILE_KEY, type SourceResolver, type TreeOp, type UnknownKind, apply, canPlace, cellString, coerce, collectStateSeeds, coreV1, decodeDagRecord, decodeElicitation, decodeElicitationOutcome, decodeEnvelope, decodeEnvelopeAst, decodeNode, decodeNodeTolerant, decodeOp, decodeTolerant, derivedFreshIds, duplicateOp, duplicateOpWith, encodeCell, encodeColExpr, encodeDagRecord, encodeDataSource, encodeElicitation, encodeElicitationOutcome, encodeEnvelope, encodeNode, encodeOp, encodePipeline, evalErrorString, evalPipeline, evalPipelineInEnv, evalPipelineWith, evalPipelineWithInEnv, evalSource, field as jsonField, liveValueToTable, merge3Way, moveOp, negotiate, negotiateEnvelope, noResolve, nudgeOp, parse, pasteOp, pasteOpWith, pipelineParams, placeOp, reencodeNode, renderAstCanonical, renderProfile, sequentialFreshIds, stepParams, substituteListParams, tryParseProfile, validateAnswer, validateAnswerAt, validateAnswerDocument, withStateSeeds };