@smthrs/core 1.0.0-rc.3 → 1.0.0-rc.5

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/README.md CHANGED
@@ -26,9 +26,9 @@ The root entry point exports these namespaces; each is also importable from `@sm
26
26
  | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
27
27
  | `Annotations` | `empty`, `add`, `merge`, `getOption`, `Placement`, `Effects`, `Priority` | Builds and reads typed lexical annotations carried by flows and plan nodes. |
28
28
  | `Digest` | `provideSync`, `digest`, `canonical` | Synchronous SHA-256 and canonical JSON for pure identity constructors. |
29
- | `Effects` | `Declaration`, `NarrowResult`, `make`, `covers`, `narrow`, `overlaps`, `sealed` | Normalizes effect declarations and checks path coverage, narrowing, and conflicts. |
30
- | `Flow` | `TypeId`, `Flow`, `Any`, `Payload`, `Reference`, `Seat`, `Input`, `Output`, `Error`, `isFlow`, `within`, `annotate`, `withFlows` | Retains Markdown signatures and their metadata combinators. |
31
- | `Graph` | `build`, `nodes`, `edges`, `drafts`, `diagnostics`, `evaluatedFrom`, `maximumGraphDepth`, `Graph`, `GraphNode`, `Edge`, `EdgeReason`, `LayerRequest`, `BuildOptions` | `@smthrs/flow`'s plan-time graph builder, re-exported. |
29
+ | `Effects` | `Declaration`, `NarrowResult`, `make`, `covers`, `narrow`, `overlaps`, `sealed` | Normalizes effect declarations and checks path coverage, narrowing, and conflicts. |
30
+ | `Flow` | `TypeId`, `Flow`, `Any`, `Payload`, `Reference`, `Seat`, `Input`, `Output`, `Error`, `isFlow`, `within`, `annotate`, `withFlows` | Retains Markdown signatures and their metadata combinators. |
31
+ | `Graph` | `build`, `inspect`, `nodes`, `edges`, `drafts`, `diagnostics`, `evaluatedFrom`, `maximumGraphDepth`, `Graph`, `GraphNode`, `Edge`, `EdgeReason`, `LayerRequest`, `BuildOptions`, `Inspection` | `@smthrs/flow`'s plan-time graph builder, re-exported. |
32
32
  | `KeyMaterial` | `InputRef`, `KeyMaterial`, `Entry` | Defines the stable key projection emitted from a built graph. Types only. |
33
33
  | `Markdown` | `splitFrontmatter`, `MarkdownFrontmatter`, `SkillFrontmatter`, `SkillDocument`, `MarkdownErrorCode`, `MarkdownError`, `lowerMarkdown`, `isSkillName`, `validateSkillFrontmatter`, `parseSkill`, `lowerSkill` | Parses and lowers Markdown and Agent Skills declarations to signatures. |
34
34
  | `Node` | `TypeId`, `Ast`, `Node`, `Any`, `Success`, `Error`, `CallMode`, `isNode`, `succeed`, `fail`, `all`, `race`, `any`, `quorum`, `map`, `andThen`, `branch`, `catch`, `capture`, `priority`, `declaredPriority`, `bindPlanned`, `plannedReference`, `branchSubject`, `catchSubject`, `catchFilter`, `continuation`, `mapper`, `predicate`, `declaration`, `flowCall`, `actionCall`, `functionIdentity` | `@smthrs/plan`'s inert, pipeable plan AST, re-exported. |
@@ -1,4 +1,8 @@
1
- /** Metadata projections retained for Markdown and persisted signatures. */
1
+ /**
2
+ * Metadata projections retained for Markdown and persisted signatures.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
  export { annotate, isFlow, TypeId, withFlows, within } from "./internal/Signature.ts";
3
7
  export type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from "./internal/Signature.ts";
4
8
  //# sourceMappingURL=Flow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["../../src/Flow.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrF,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["../../src/Flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrF,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Flow.ts"],
4
- "sourcesContent": ["/** Metadata projections retained for Markdown and persisted signatures. */\nexport { annotate, isFlow, TypeId, withFlows, within } from \"./internal/Signature.ts\"\nexport type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from \"./internal/Signature.ts\"\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAA4D;",
4
+ "sourcesContent": ["/**\n * Metadata projections retained for Markdown and persisted signatures.\n *\n * @since 1.0.0\n */\n\nexport { annotate, isFlow, TypeId, withFlows, within } from \"./internal/Signature.ts\"\nexport type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from \"./internal/Signature.ts\"\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAA4D;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,14 @@
1
- /** Frozen signature projection for Markdown lowering and metadata combinators. */
1
+ /**
2
+ * Frozen signature projection for Markdown lowering and metadata combinators.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
  import { Action, Flow as Durable } from "@smthrs/flow";
3
7
  import type * as Context from "effect/Context";
4
8
  import { type Pipeable } from "effect/Pipeable";
5
9
  import * as Schema from "effect/Schema";
6
10
  import type * as Types from "effect/Types";
7
- import * as Effects from "../Effects.ts";
11
+ import type * as Effects from "../Effects.ts";
8
12
  import * as Node from "../Node.ts";
9
13
  import type * as Placement from "../Placement.ts";
10
14
  /**
@@ -208,6 +212,14 @@ interface Options<I extends Schema.Top, O extends Schema.Top, Err extends Schema
208
212
  readonly action: object | undefined;
209
213
  } | undefined;
210
214
  }
215
+ /**
216
+ * Builds a signature from Markdown-lowered options: annotated capabilities and
217
+ * effects override the declared ones, and a signature without a body becomes the
218
+ * action a host implements later.
219
+ *
220
+ * @since 1.0.0
221
+ * @private
222
+ */
211
223
  export declare const build: <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires = Action.Requirement<string>>(options: Options<I, O, Err, Requires>) => Flow<I, O, Err, Requires>;
212
224
  /**
213
225
  * Returns `true` when a value is a flow signature.
@@ -1 +1 @@
1
- {"version":3,"file":"Signature.d.ts","sourceRoot":"","sources":["../../../src/internal/Signature.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,iBAAiB,CAAA;AAE9D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,MAA2B,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAA;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,CAAA;AAE9B;;;;;;;GAOG;AACH,MAAM,MAAM,SA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,GAAG,EAAE,QAAQ,CAAC,EAC/B,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EACxB,KAAK,EAAE,CAAC,GACP,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;CAW5B,CAAA;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,EAAE;IACtB,CACE,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,SAAS,MAAM,CAAC,GAAG,EAAE,QAAQ,EAC9E,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,KAC5B,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,SAAS,MAAM,CAAC,GAAG,EAAE,QAAQ,EAC3E,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAC/B,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;CAQzB,CAAA"}
@@ -43,7 +43,6 @@ var import_Pipeable = require("effect/Pipeable");
43
43
  var Predicate = __toESM(require("effect/Predicate"), 1);
44
44
  var Schema = __toESM(require("effect/Schema"), 1);
45
45
  var Annotations = __toESM(require("../Annotations.js"), 1);
46
- var Effects = __toESM(require("../Effects.js"), 1);
47
46
  var Node = __toESM(require("../Node.js"), 1);
48
47
  const TypeId = "~flows/core/Flow";
49
48
  const built = /* @__PURE__ */ new WeakMap();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/internal/Signature.ts"],
4
- "sourcesContent": ["/** Frozen signature projection for Markdown lowering and metadata combinators. */\n\nimport { Action, Flow as Durable } from \"@smthrs/flow\"\nimport type * as Context from \"effect/Context\"\nimport { dual, identity } from \"effect/Function\"\nimport * as Option from \"effect/Option\"\nimport { type Pipeable, pipeArguments } from \"effect/Pipeable\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Schema from \"effect/Schema\"\nimport type * as Types from \"effect/Types\"\nimport * as Annotations from \"../Annotations.ts\"\nimport * as Effects from \"../Effects.ts\"\nimport * as Node from \"../Node.ts\"\nimport type * as Placement from \"../Placement.ts\"\n\n/**\n * Runtime type identifier carried by flow values.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport const TypeId: TypeId = \"~flows/core/Flow\"\n\n/**\n * Type-level representation of the flow runtime type identifier.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport type TypeId = \"~flows/core/Flow\"\n\n/**\n * The name of a model seat a flow may run on.\n *\n * Seats are referred to by name, never by provider model id.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Seat = string & {}\n\n/**\n * A collaborator a flow declares: a flow value, or a registry name the harness\n * resolves before execution.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Reference = Any | string\n\n/**\n * The struct payload a declared `input` schema becomes.\n *\n * `@smthrs/flow` requires a struct payload, and a signature may declare any\n * schema, so a non-struct input travels as the one field `input`.\n * {@link Flow.call} takes the declared shape and wraps it, so an author never\n * writes the wrapper.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Payload<I extends Schema.Top> =\n & (I extends Durable.AnyStructSchema ? I : Schema.Struct<{ readonly input: I }>)\n & Durable.AnyStructSchema\n\n/**\n * A schema-described flow signature.\n *\n * The input schema is invariant because it participates in both decoding and\n * encoding. Output and error schemas are covariant.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport interface Flow<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top = typeof Schema.Never,\n Requires = Action.Requirement<string>\n> extends Pipeable {\n readonly [TypeId]: {\n readonly _Input: Types.Invariant<I>\n readonly _Output: Types.Covariant<O>\n readonly _Error: Types.Covariant<Err>\n }\n /** The declared name, which is the tag of the flow and of the action. */\n readonly name: string\n readonly description: string | undefined\n /** The input schema as DECLARED, before {@link Payload} wraps a non-struct. */\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n /**\n * Advisory model seat metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n /**\n * Advisory collaborator metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly flows: ReadonlyArray<Reference> | undefined\n /**\n * Advisory prompt metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly prompt: string | undefined\n /**\n * The annotation bag the lowered flow and action carry, with the declared\n * `capabilities` and `effects` already in it.\n */\n readonly annotations: Context.Context<never>\n /**\n * The `@smthrs/flow` flow this signature IS, tagged with {@link Flow.name}.\n *\n * It is what `Graph.build`, an `Interpreter`, and a registry that checks\n * `@smthrs/flow`'s own type id are handed.\n */\n readonly flow: Durable.Flow<string, Payload<I>, O, Err, Requires>\n /**\n * The declared action a host implements with `toLayer`, on a signature that\n * declared no body. A signature with a body carries `undefined`: its body IS\n * the implementation.\n */\n readonly action: Action.Declared<string, Payload<I>, O, Err, Requires> | undefined\n /**\n * Records a call in the input schema's constructor shape, like the native\n * flow. In particular a class schema accepts its inert field data here.\n *\n * It never runs the body: graph construction evaluates pure bodies at plan\n * time.\n */\n readonly call: (input: I[\"~type.make.in\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n}\n\n/**\n * Marker-only existential type for heterogeneous collections of flows.\n *\n * It names every property a consumer outside this package reads off a\n * signature, so a decorator that holds one erased can still read what it\n * declares.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport interface Any {\n readonly [TypeId]: object\n readonly name: string\n readonly description: string | undefined\n readonly input: Schema.Top\n readonly output: Schema.Top\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly annotations: Context.Context<never>\n readonly flow: Durable.Any\n readonly call: (input: never) => Node.Node<unknown, unknown, unknown>\n}\n\n/**\n * Extracts the decoded input type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Input<F> = F extends { readonly input: infer I extends Schema.Top } ? I[\"Type\"] : never\n\n/**\n * Extracts the decoded output type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Output<F> = F extends { readonly output: infer O extends Schema.Top } ? O[\"Type\"] : never\n\n/**\n * Extracts the decoded error type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Error<F> = F extends { readonly error: infer Err extends Schema.Top } ? Err[\"Type\"] : never\n\n/** Everything a signature is built from, with every default already applied. */\ninterface Options<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires\n> {\n readonly name: string\n readonly description: string | undefined\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly prompt: string | undefined\n /**\n * The annotations the AUTHOR supplied, before the declared `capabilities`\n * and `effects` are lowered onto them.\n *\n * A combinator rebuilds from these rather than from the lowered bag the\n * value exposes, so lowering a declaration twice cannot overwrite an\n * annotation a caller put on top of it.\n */\n readonly annotations: Context.Context<never>\n readonly body:\n | ((input: I[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>)\n | undefined\n /** The original native declarations whose diagnostic source locations survive a rebuild. */\n readonly original?: { readonly flow: object; readonly action: object | undefined } | undefined\n}\n\n/** The options each built signature was built from, for the combinators. */\nconst built = new WeakMap<object, Options<Schema.Top, Schema.Top, Schema.Top, unknown>>()\n\nconst optionsOf = <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n): Options<I, O, Err, Requires> => built.get(self) as unknown as Options<I, O, Err, Requires>\n\n/** Whether a schema is the struct `@smthrs/flow` requires of a payload. */\nconst isStruct = (schema: Schema.Top): schema is Durable.AnyStructSchema => Predicate.hasProperty(schema, \"fields\")\n\nconst payloadOf = <I extends Schema.Top>(input: I): Payload<I> =>\n (isStruct(input) ? input : Schema.Struct({ input })) as Payload<I>\n\n/**\n * The tier a signature's action dispatches under.\n *\n * A declared envelope states it. A signature that declared none is\n * `irreversible`, the conservative default a harness already projects for this\n * case, and never `@smthrs/flow`'s own `sealed` default: a signature that did\n * not state its tier must not content-share another run's result.\n */\nconst tierOf = (effects: Effects.Declaration | undefined): Action.Tier => effects?.tier ?? \"irreversible\"\n\nexport const build = <\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires = Action.Requirement<string>\n>(\n options: Options<I, O, Err, Requires>\n): Flow<I, O, Err, Requires> => {\n const payload = payloadOf(options.input)\n const wrapped = isStruct(options.input)\n // Capabilities is a Context.Reference: getOption supplies its default even\n // when no value was annotated. Only an explicitly stored value overrides\n // the author's declaration.\n const annotatedCapabilities = options.annotations.mapUnsafe.has(Durable.Capabilities.key)\n ? Annotations.getOption(options.annotations, Durable.Capabilities)\n : Option.none<ReadonlyArray<string>>()\n const capabilities = Option.getOrElse(annotatedCapabilities, () => options.capabilities)\n const effects = Option.getOrElse(\n Annotations.getOption(options.annotations, Annotations.Effects),\n () => options.effects\n )\n const declared = {\n payload,\n ...(options.description === undefined ? {} : { description: options.description }),\n ...(capabilities.length === 0 && Option.isNone(annotatedCapabilities) ? {} : { capabilities }),\n ...(effects === undefined ? {} : { effects }),\n success: options.output,\n error: options.error,\n annotations: options.annotations\n }\n const body = options.body\n // A signature without a body IS the action a host implements later; the flow\n // beside it exists because a declared capability ceiling is read off a Flow,\n // and because a caller splices one node either way.\n const action = body === undefined\n ? Action.make(options.name, {\n ...declared,\n declaredFrom: options.original?.action,\n tier: tierOf(effects)\n }) as unknown as Action.Declared<\n string,\n Payload<I>,\n O,\n Err,\n Requires\n >\n : undefined\n type NativeBody = (payload: Payload<I>[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n let nativeBody: NativeBody\n if (body === undefined) {\n nativeBody = (payloadValue) => action!.call(payloadValue as never)\n } else if (wrapped) {\n nativeBody = body\n } else {\n const adapter: NativeBody = (payloadValue) => body((payloadValue as { readonly input: I[\"Type\"] }).input)\n const bodyIdentity = Node.functionIdentity(body)\n // The adapter adds no author behavior. A captured body already names all\n // of its semantics; carry that identity through the wrapping operation.\n // An uncaptured body must keep failing the native stable-callback policy.\n nativeBody = bodyIdentity.algorithm === \"sha256-source-captures/v5\"\n ? Node.capture({ body: bodyIdentity }, adapter)\n : adapter\n }\n const flow = Durable.make(options.name, {\n ...declared,\n declaredFrom: options.original?.flow,\n body: nativeBody\n }) as unknown as Durable.Flow<string, Payload<I>, O, Err, Requires>\n const self: Flow<I, O, Err, Requires> = {\n [TypeId]: {\n _Input: identity,\n _Output: identity,\n _Error: identity\n },\n name: options.name,\n description: options.description,\n input: options.input,\n output: options.output,\n error: options.error,\n capabilities,\n effects,\n model: options.model,\n flows: options.flows,\n prompt: options.prompt,\n annotations: flow.annotations,\n flow,\n action,\n call: (input: I[\"~type.make.in\"]) => flow.call((wrapped ? input : { input }) as never),\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return pipeArguments(this, arguments)\n }\n }\n built.set(self, {\n ...options,\n original: options.original ?? { flow, action }\n })\n return self\n}\n\n/**\n * Returns `true` when a value is a flow signature.\n *\n * @category guards\n * @since 0.0.0\n * @slop\n */\nexport const isFlow = (value: unknown): value is Any => Predicate.hasProperty(value, TypeId)\n\n/**\n * Places a flow within a host directive, returning a fresh flow.\n *\n * @category combinators\n * @since 0.0.0\n * @slop\n */\nexport const within: {\n (\n placement: Placement.Placement\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, Annotations.Placement, placement)\n })\n})\n\n/**\n * Attaches one typed annotation to a flow, returning a fresh flow.\n *\n * Annotations are metadata a host or a decorator reads. A custom key is\n * advisory, so a flow annotated with one plans the same graph as the flow it\n * was built from. The built-in {@link Annotations.Placement} and\n * {@link Annotations.Effects} keys are not advisory: `Graph.build` projects\n * both into node key material, so annotating with either changes the keys the\n * graph plans. {@link within} is the placement-shaped special case of this\n * combinator.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const annotate: {\n <Key, S>(\n key: Context.Key<Key, S>,\n value: S\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n ): Flow<I, O, Err, Requires>\n} = dual(3, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, key, value)\n })\n})\n\n/**\n * Replaces the collaborators a flow declares, returning a fresh flow.\n *\n * Everything else comes across unchanged: name, schemas, capabilities,\n * effects, body, and annotations. That is what lets a decorator rewrite a flow\n * tree without dropping the metadata a host reads back, such as a placement or\n * a lane.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const withFlows: {\n (\n flows: ReadonlyArray<Reference>\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n): Flow<I, O, Err, Requires> =>\n build({\n ...optionsOf(self),\n flows: [...flows]\n }))\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwC;AAExC,sBAA+B;AAC/B,aAAwB;AACxB,sBAA6C;AAC7C,gBAA2B;AAC3B,aAAwB;AAExB,kBAA6B;AAC7B,cAAyB;AACzB,WAAsB;AAUf,MAAM,SAAiB;AAiN9B,MAAM,QAAQ,oBAAI,QAAsE;AAExF,MAAM,YAAY,CAChB,SACiC,MAAM,IAAI,IAAI;AAGjD,MAAM,WAAW,CAAC,WAA0D,UAAU,YAAY,QAAQ,QAAQ;AAElH,MAAM,YAAY,CAAuB,UACtC,SAAS,KAAK,IAAI,QAAQ,OAAO,OAAO,EAAE,MAAM,CAAC;AAUpD,MAAM,SAAS,CAAC,YAA0D,SAAS,QAAQ;AAEpF,MAAM,QAAQ,CAMnB,YAC8B;AAC9B,QAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,QAAM,UAAU,SAAS,QAAQ,KAAK;AAItC,QAAM,wBAAwB,QAAQ,YAAY,UAAU,IA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CAAC,GAAG,KAAK;AAClB,CAAC,CAAC;",
4
+ "sourcesContent": ["/**\n * Frozen signature projection for Markdown lowering and metadata combinators.\n *\n * @since 1.0.0\n */\n\nimport { Action, Flow as Durable } from \"@smthrs/flow\"\nimport type * as Context from \"effect/Context\"\nimport { dual, identity } from \"effect/Function\"\nimport * as Option from \"effect/Option\"\nimport { type Pipeable, pipeArguments } from \"effect/Pipeable\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Schema from \"effect/Schema\"\nimport type * as Types from \"effect/Types\"\nimport * as Annotations from \"../Annotations.ts\"\nimport type * as Effects from \"../Effects.ts\"\nimport * as Node from \"../Node.ts\"\nimport type * as Placement from \"../Placement.ts\"\n\n/**\n * Runtime type identifier carried by flow values.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport const TypeId: TypeId = \"~flows/core/Flow\"\n\n/**\n * Type-level representation of the flow runtime type identifier.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport type TypeId = \"~flows/core/Flow\"\n\n/**\n * The name of a model seat a flow may run on.\n *\n * Seats are referred to by name, never by provider model id.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Seat = string & {}\n\n/**\n * A collaborator a flow declares: a flow value, or a registry name the harness\n * resolves before execution.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Reference = Any | string\n\n/**\n * The struct payload a declared `input` schema becomes.\n *\n * `@smthrs/flow` requires a struct payload, and a signature may declare any\n * schema, so a non-struct input travels as the one field `input`.\n * {@link Flow.call} takes the declared shape and wraps it, so an author never\n * writes the wrapper.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Payload<I extends Schema.Top> =\n & (I extends Durable.AnyStructSchema ? I : Schema.Struct<{ readonly input: I }>)\n & Durable.AnyStructSchema\n\n/**\n * A schema-described flow signature.\n *\n * The input schema is invariant because it participates in both decoding and\n * encoding. Output and error schemas are covariant.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport interface Flow<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top = typeof Schema.Never,\n Requires = Action.Requirement<string>\n> extends Pipeable {\n readonly [TypeId]: {\n readonly _Input: Types.Invariant<I>\n readonly _Output: Types.Covariant<O>\n readonly _Error: Types.Covariant<Err>\n }\n /** The declared name, which is the tag of the flow and of the action. */\n readonly name: string\n readonly description: string | undefined\n /** The input schema as DECLARED, before {@link Payload} wraps a non-struct. */\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n /**\n * Advisory model seat metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n /**\n * Advisory collaborator metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly flows: ReadonlyArray<Reference> | undefined\n /**\n * Advisory prompt metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly prompt: string | undefined\n /**\n * The annotation bag the lowered flow and action carry, with the declared\n * `capabilities` and `effects` already in it.\n */\n readonly annotations: Context.Context<never>\n /**\n * The `@smthrs/flow` flow this signature IS, tagged with {@link Flow.name}.\n *\n * It is what `Graph.build`, an `Interpreter`, and a registry that checks\n * `@smthrs/flow`'s own type id are handed.\n */\n readonly flow: Durable.Flow<string, Payload<I>, O, Err, Requires>\n /**\n * The declared action a host implements with `toLayer`, on a signature that\n * declared no body. A signature with a body carries `undefined`: its body IS\n * the implementation.\n */\n readonly action: Action.Declared<string, Payload<I>, O, Err, Requires> | undefined\n /**\n * Records a call in the input schema's constructor shape, like the native\n * flow. In particular a class schema accepts its inert field data here.\n *\n * It never runs the body: graph construction evaluates pure bodies at plan\n * time.\n */\n readonly call: (input: I[\"~type.make.in\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n}\n\n/**\n * Marker-only existential type for heterogeneous collections of flows.\n *\n * It names every property a consumer outside this package reads off a\n * signature, so a decorator that holds one erased can still read what it\n * declares.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport interface Any {\n readonly [TypeId]: object\n readonly name: string\n readonly description: string | undefined\n readonly input: Schema.Top\n readonly output: Schema.Top\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly annotations: Context.Context<never>\n readonly flow: Durable.Any\n readonly call: (input: never) => Node.Node<unknown, unknown, unknown>\n}\n\n/**\n * Extracts the decoded input type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Input<F> = F extends { readonly input: infer I extends Schema.Top } ? I[\"Type\"] : never\n\n/**\n * Extracts the decoded output type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Output<F> = F extends { readonly output: infer O extends Schema.Top } ? O[\"Type\"] : never\n\n/**\n * Extracts the decoded error type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Error<F> = F extends { readonly error: infer Err extends Schema.Top } ? Err[\"Type\"] : never\n\n/** Everything a signature is built from, with every default already applied. */\ninterface Options<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires\n> {\n readonly name: string\n readonly description: string | undefined\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly prompt: string | undefined\n /**\n * The annotations the AUTHOR supplied, before the declared `capabilities`\n * and `effects` are lowered onto them.\n *\n * A combinator rebuilds from these rather than from the lowered bag the\n * value exposes, so lowering a declaration twice cannot overwrite an\n * annotation a caller put on top of it.\n */\n readonly annotations: Context.Context<never>\n readonly body:\n | ((input: I[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>)\n | undefined\n /** The original native declarations whose diagnostic source locations survive a rebuild. */\n readonly original?: { readonly flow: object; readonly action: object | undefined } | undefined\n}\n\n/** The options each built signature was built from, for the combinators. */\nconst built = new WeakMap<object, Options<Schema.Top, Schema.Top, Schema.Top, unknown>>()\n\nconst optionsOf = <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n): Options<I, O, Err, Requires> => built.get(self) as unknown as Options<I, O, Err, Requires>\n\n/** Whether a schema is the struct `@smthrs/flow` requires of a payload. */\nconst isStruct = (schema: Schema.Top): schema is Durable.AnyStructSchema => Predicate.hasProperty(schema, \"fields\")\n\nconst payloadOf = <I extends Schema.Top>(input: I): Payload<I> =>\n (isStruct(input) ? input : Schema.Struct({ input })) as Payload<I>\n\n/**\n * The tier a signature's action dispatches under.\n *\n * A declared envelope states it. A signature that declared none is\n * `irreversible`, the conservative default a harness already projects for this\n * case, and never `@smthrs/flow`'s own `sealed` default: a signature that did\n * not state its tier must not content-share another run's result.\n */\nconst tierOf = (effects: Effects.Declaration | undefined): Action.Tier => effects?.tier ?? \"irreversible\"\n\n/**\n * Builds a signature from Markdown-lowered options: annotated capabilities and\n * effects override the declared ones, and a signature without a body becomes the\n * action a host implements later.\n *\n * @since 1.0.0\n * @private\n */\nexport const build = <\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires = Action.Requirement<string>\n>(\n options: Options<I, O, Err, Requires>\n): Flow<I, O, Err, Requires> => {\n const payload = payloadOf(options.input)\n const wrapped = isStruct(options.input)\n // Capabilities is a Context.Reference: getOption supplies its default even\n // when no value was annotated. Only an explicitly stored value overrides\n // the author's declaration.\n const annotatedCapabilities = options.annotations.mapUnsafe.has(Durable.Capabilities.key)\n ? Annotations.getOption(options.annotations, Durable.Capabilities)\n : Option.none<ReadonlyArray<string>>()\n const capabilities = Option.getOrElse(annotatedCapabilities, () => options.capabilities)\n const effects = Option.getOrElse(\n Annotations.getOption(options.annotations, Annotations.Effects),\n () => options.effects\n )\n const declared = {\n payload,\n ...(options.description === undefined ? {} : { description: options.description }),\n ...(capabilities.length === 0 && Option.isNone(annotatedCapabilities) ? {} : { capabilities }),\n ...(effects === undefined ? {} : { effects }),\n success: options.output,\n error: options.error,\n annotations: options.annotations\n }\n const body = options.body\n // A signature without a body IS the action a host implements later; the flow\n // beside it exists because a declared capability ceiling is read off a Flow,\n // and because a caller splices one node either way.\n const action = body === undefined\n ? Action.make(options.name, {\n ...declared,\n declaredFrom: options.original?.action,\n tier: tierOf(effects)\n }) as unknown as Action.Declared<\n string,\n Payload<I>,\n O,\n Err,\n Requires\n >\n : undefined\n type NativeBody = (payload: Payload<I>[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n let nativeBody: NativeBody\n if (body === undefined) {\n nativeBody = (payloadValue) => action!.call(payloadValue as never)\n } else if (wrapped) {\n nativeBody = body\n } else {\n const adapter: NativeBody = (payloadValue) => body((payloadValue as { readonly input: I[\"Type\"] }).input)\n const bodyIdentity = Node.functionIdentity(body)\n // The adapter adds no author behavior. A captured body already names all\n // of its semantics; carry that identity through the wrapping operation.\n // An uncaptured body must keep failing the native stable-callback policy.\n nativeBody = bodyIdentity.algorithm === \"sha256-source-captures/v5\"\n ? Node.capture({ body: bodyIdentity }, adapter)\n : adapter\n }\n const flow = Durable.make(options.name, {\n ...declared,\n declaredFrom: options.original?.flow,\n body: nativeBody\n }) as unknown as Durable.Flow<string, Payload<I>, O, Err, Requires>\n const self: Flow<I, O, Err, Requires> = {\n [TypeId]: {\n _Input: identity,\n _Output: identity,\n _Error: identity\n },\n name: options.name,\n description: options.description,\n input: options.input,\n output: options.output,\n error: options.error,\n capabilities,\n effects,\n model: options.model,\n flows: options.flows,\n prompt: options.prompt,\n annotations: flow.annotations,\n flow,\n action,\n call: (input: I[\"~type.make.in\"]) => flow.call((wrapped ? input : { input }) as never),\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return pipeArguments(this, arguments)\n }\n }\n built.set(self, {\n ...options,\n original: options.original ?? { flow, action }\n })\n return self\n}\n\n/**\n * Returns `true` when a value is a flow signature.\n *\n * @category guards\n * @since 0.0.0\n * @slop\n */\nexport const isFlow = (value: unknown): value is Any => Predicate.hasProperty(value, TypeId)\n\n/**\n * Places a flow within a host directive, returning a fresh flow.\n *\n * @category combinators\n * @since 0.0.0\n * @slop\n */\nexport const within: {\n (\n placement: Placement.Placement\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, Annotations.Placement, placement)\n })\n})\n\n/**\n * Attaches one typed annotation to a flow, returning a fresh flow.\n *\n * Annotations are metadata a host or a decorator reads. A custom key is\n * advisory, so a flow annotated with one plans the same graph as the flow it\n * was built from. The built-in {@link Annotations.Placement} and\n * {@link Annotations.Effects} keys are not advisory: `Graph.build` projects\n * both into node key material, so annotating with either changes the keys the\n * graph plans. {@link within} is the placement-shaped special case of this\n * combinator.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const annotate: {\n <Key, S>(\n key: Context.Key<Key, S>,\n value: S\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n ): Flow<I, O, Err, Requires>\n} = dual(3, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, key, value)\n })\n})\n\n/**\n * Replaces the collaborators a flow declares, returning a fresh flow.\n *\n * Everything else comes across unchanged: name, schemas, capabilities,\n * effects, body, and annotations. That is what lets a decorator rewrite a flow\n * tree without dropping the metadata a host reads back, such as a placement or\n * a lane.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const withFlows: {\n (\n flows: ReadonlyArray<Reference>\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n): Flow<I, O, Err, Requires> =>\n build({\n ...optionsOf(self),\n flows: [...flows]\n }))\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,kBAAwC;AAExC,sBAA+B;AAC/B,aAAwB;AACxB,sBAA6C;AAC7C,gBAA2B;AAC3B,aAAwB;AAExB,kBAA6B;AAE7B,WAAsB;AAUf,MAAM,SAAiB;AAiN9B,MAAM,QAAQ,oBAAI,QAAsE;AAExF,MAAM,YAAY,CAChB,SACiC,MAAM,IAAI,IAAI;AAGjD,MAAM,WAAW,CAAC,WAA0D,UAAU,YAAY,QAAQ,QAAQ;AAElH,MAAM,YAAY,CAAuB,UACtC,SAAS,KAAK,IAAI,QAAQ,OAAO,OAAO,EAAE,MAAM,CAAC;AAUpD,MAAM,SAAS,CAAC,YAA0D,SAAS,QAAQ;AAUpF,MAAM,QAAQ,CAMnB,YAC8B;AAC9B,QAAM,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C;AAaM,MAAM,gBAUT,sBAAK,GAAG,CACV,MACA,UAEA,MAAM;AAAA,EACJ,GAAG,UAAU,IAAI;AAAA,EACjB,OAAO,CAAC,GAAG,KAAK;AAClB,CAAC,CAAC;",
6
6
  "names": ["Durable"]
7
7
  }
@@ -1,4 +1,8 @@
1
- /** Metadata projections retained for Markdown and persisted signatures. */
1
+ /**
2
+ * Metadata projections retained for Markdown and persisted signatures.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
  export { annotate, isFlow, TypeId, withFlows, within } from "./internal/Signature.ts";
3
7
  export type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from "./internal/Signature.ts";
4
8
  //# sourceMappingURL=Flow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["../../src/Flow.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrF,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["../../src/Flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrF,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA"}
package/dist/esm/Flow.js CHANGED
@@ -1,3 +1,7 @@
1
- /** Metadata projections retained for Markdown and persisted signatures. */
1
+ /**
2
+ * Metadata projections retained for Markdown and persisted signatures.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
  export { annotate, isFlow, TypeId, withFlows, within } from "./internal/Signature.js";
3
7
  //# sourceMappingURL=Flow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flow.js","sourceRoot":"","sources":["../../src/Flow.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA","sourcesContent":["/** Metadata projections retained for Markdown and persisted signatures. */\nexport { annotate, isFlow, TypeId, withFlows, within } from \"./internal/Signature.ts\"\nexport type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from \"./internal/Signature.ts\"\n"]}
1
+ {"version":3,"file":"Flow.js","sourceRoot":"","sources":["../../src/Flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA","sourcesContent":["/**\n * Metadata projections retained for Markdown and persisted signatures.\n *\n * @since 1.0.0\n */\n\nexport { annotate, isFlow, TypeId, withFlows, within } from \"./internal/Signature.ts\"\nexport type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from \"./internal/Signature.ts\"\n"]}
@@ -1,10 +1,14 @@
1
- /** Frozen signature projection for Markdown lowering and metadata combinators. */
1
+ /**
2
+ * Frozen signature projection for Markdown lowering and metadata combinators.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
  import { Action, Flow as Durable } from "@smthrs/flow";
3
7
  import type * as Context from "effect/Context";
4
8
  import { type Pipeable } from "effect/Pipeable";
5
9
  import * as Schema from "effect/Schema";
6
10
  import type * as Types from "effect/Types";
7
- import * as Effects from "../Effects.ts";
11
+ import type * as Effects from "../Effects.ts";
8
12
  import * as Node from "../Node.ts";
9
13
  import type * as Placement from "../Placement.ts";
10
14
  /**
@@ -208,6 +212,14 @@ interface Options<I extends Schema.Top, O extends Schema.Top, Err extends Schema
208
212
  readonly action: object | undefined;
209
213
  } | undefined;
210
214
  }
215
+ /**
216
+ * Builds a signature from Markdown-lowered options: annotated capabilities and
217
+ * effects override the declared ones, and a signature without a body becomes the
218
+ * action a host implements later.
219
+ *
220
+ * @since 1.0.0
221
+ * @private
222
+ */
211
223
  export declare const build: <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires = Action.Requirement<string>>(options: Options<I, O, Err, Requires>) => Flow<I, O, Err, Requires>;
212
224
  /**
213
225
  * Returns `true` when a value is a flow signature.
@@ -1 +1 @@
1
- {"version":3,"file":"Signature.d.ts","sourceRoot":"","sources":["../../../src/internal/Signature.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,iBAAiB,CAAA;AAE9D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,MAA2B,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAA;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,CAAA;AAE9B;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,MAAM,CAAA;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,IACpC,CAAC,CAAC,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CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;CAW5B,CAAA;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,EAAE;IACtB,CACE,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,SAAS,MAAM,CAAC,GAAG,EAAE,QAAQ,EAC9E,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,KAC5B,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,SAAS,MAAM,CAAC,GAAG,EAAE,QAAQ,EAC3E,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAC/B,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;CAQzB,CAAA"}
@@ -1,4 +1,8 @@
1
- /** Frozen signature projection for Markdown lowering and metadata combinators. */
1
+ /**
2
+ * Frozen signature projection for Markdown lowering and metadata combinators.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
  import { Action, Flow as Durable } from "@smthrs/flow";
3
7
  import { dual, identity } from "effect/Function";
4
8
  import * as Option from "effect/Option";
@@ -6,7 +10,6 @@ import { pipeArguments } from "effect/Pipeable";
6
10
  import * as Predicate from "effect/Predicate";
7
11
  import * as Schema from "effect/Schema";
8
12
  import * as Annotations from "../Annotations.js";
9
- import * as Effects from "../Effects.js";
10
13
  import * as Node from "../Node.js";
11
14
  /**
12
15
  * Runtime type identifier carried by flow values.
@@ -31,6 +34,14 @@ const payloadOf = (input) => (isStruct(input) ? input : Schema.Struct({ input })
31
34
  * not state its tier must not content-share another run's result.
32
35
  */
33
36
  const tierOf = (effects) => effects?.tier ?? "irreversible";
37
+ /**
38
+ * Builds a signature from Markdown-lowered options: annotated capabilities and
39
+ * effects override the declared ones, and a signature without a body becomes the
40
+ * action a host implements later.
41
+ *
42
+ * @since 1.0.0
43
+ * @private
44
+ */
34
45
  export const build = (options) => {
35
46
  const payload = payloadOf(options.input);
36
47
  const wrapped = isStruct(options.input);
@@ -1 +1 @@
1
- {"version":3,"file":"Signature.js","sourceRoot":"","sources":["../../../src/internal/Signature.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAGlC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,kBAAkB,CAAA;AAgNhD,4EAA4E;AAC5E,MAAM,KAAK,GAAG,IAAI,OAAO,EAAgE,CAAA;AAEzF,MAAM,SAAS,GAAG,CAChB,IAA+B,EACD,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAA4C,CAAA;AAE7F,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,CAAC,MAAkB,EAAqC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,C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combinators. */\n\nimport { Action, Flow as Durable } from \"@smthrs/flow\"\nimport type * as Context from \"effect/Context\"\nimport { dual, identity } from \"effect/Function\"\nimport * as Option from \"effect/Option\"\nimport { type Pipeable, pipeArguments } from \"effect/Pipeable\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Schema from \"effect/Schema\"\nimport type * as Types from \"effect/Types\"\nimport * as Annotations from \"../Annotations.ts\"\nimport * as Effects from \"../Effects.ts\"\nimport * as Node from \"../Node.ts\"\nimport type * as Placement from \"../Placement.ts\"\n\n/**\n * Runtime type identifier carried by flow values.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport const TypeId: TypeId = \"~flows/core/Flow\"\n\n/**\n * Type-level representation of the flow runtime type identifier.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport type TypeId = \"~flows/core/Flow\"\n\n/**\n * The name of a model seat a flow may run on.\n *\n * Seats are referred to by name, never by provider model id.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Seat = string & {}\n\n/**\n * A collaborator a flow declares: a flow value, or a registry name the harness\n * resolves before execution.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Reference = Any | string\n\n/**\n * The struct payload a declared `input` schema becomes.\n *\n * `@smthrs/flow` requires a struct payload, and a signature may declare any\n * schema, so a non-struct input travels as the one field `input`.\n * {@link Flow.call} takes the declared shape and wraps it, so an author never\n * writes the wrapper.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Payload<I extends Schema.Top> =\n & (I extends Durable.AnyStructSchema ? I : Schema.Struct<{ readonly input: I }>)\n & Durable.AnyStructSchema\n\n/**\n * A schema-described flow signature.\n *\n * The input schema is invariant because it participates in both decoding and\n * encoding. Output and error schemas are covariant.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport interface Flow<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top = typeof Schema.Never,\n Requires = Action.Requirement<string>\n> extends Pipeable {\n readonly [TypeId]: {\n readonly _Input: Types.Invariant<I>\n readonly _Output: Types.Covariant<O>\n readonly _Error: Types.Covariant<Err>\n }\n /** The declared name, which is the tag of the flow and of the action. */\n readonly name: string\n readonly description: string | undefined\n /** The input schema as DECLARED, before {@link Payload} wraps a non-struct. */\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n /**\n * Advisory model seat metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n /**\n * Advisory collaborator metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly flows: ReadonlyArray<Reference> | undefined\n /**\n * Advisory prompt metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly prompt: string | undefined\n /**\n * The annotation bag the lowered flow and action carry, with the declared\n * `capabilities` and `effects` already in it.\n */\n readonly annotations: Context.Context<never>\n /**\n * The `@smthrs/flow` flow this signature IS, tagged with {@link Flow.name}.\n *\n * It is what `Graph.build`, an `Interpreter`, and a registry that checks\n * `@smthrs/flow`'s own type id are handed.\n */\n readonly flow: Durable.Flow<string, Payload<I>, O, Err, Requires>\n /**\n * The declared action a host implements with `toLayer`, on a signature that\n * declared no body. A signature with a body carries `undefined`: its body IS\n * the implementation.\n */\n readonly action: Action.Declared<string, Payload<I>, O, Err, Requires> | undefined\n /**\n * Records a call in the input schema's constructor shape, like the native\n * flow. In particular a class schema accepts its inert field data here.\n *\n * It never runs the body: graph construction evaluates pure bodies at plan\n * time.\n */\n readonly call: (input: I[\"~type.make.in\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n}\n\n/**\n * Marker-only existential type for heterogeneous collections of flows.\n *\n * It names every property a consumer outside this package reads off a\n * signature, so a decorator that holds one erased can still read what it\n * declares.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport interface Any {\n readonly [TypeId]: object\n readonly name: string\n readonly description: string | undefined\n readonly input: Schema.Top\n readonly output: Schema.Top\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly annotations: Context.Context<never>\n readonly flow: Durable.Any\n readonly call: (input: never) => Node.Node<unknown, unknown, unknown>\n}\n\n/**\n * Extracts the decoded input type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Input<F> = F extends { readonly input: infer I extends Schema.Top } ? I[\"Type\"] : never\n\n/**\n * Extracts the decoded output type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Output<F> = F extends { readonly output: infer O extends Schema.Top } ? O[\"Type\"] : never\n\n/**\n * Extracts the decoded error type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Error<F> = F extends { readonly error: infer Err extends Schema.Top } ? Err[\"Type\"] : never\n\n/** Everything a signature is built from, with every default already applied. */\ninterface Options<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires\n> {\n readonly name: string\n readonly description: string | undefined\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly prompt: string | undefined\n /**\n * The annotations the AUTHOR supplied, before the declared `capabilities`\n * and `effects` are lowered onto them.\n *\n * A combinator rebuilds from these rather than from the lowered bag the\n * value exposes, so lowering a declaration twice cannot overwrite an\n * annotation a caller put on top of it.\n */\n readonly annotations: Context.Context<never>\n readonly body:\n | ((input: I[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>)\n | undefined\n /** The original native declarations whose diagnostic source locations survive a rebuild. */\n readonly original?: { readonly flow: object; readonly action: object | undefined } | undefined\n}\n\n/** The options each built signature was built from, for the combinators. */\nconst built = new WeakMap<object, Options<Schema.Top, Schema.Top, Schema.Top, unknown>>()\n\nconst optionsOf = <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n): Options<I, O, Err, Requires> => built.get(self) as unknown as Options<I, O, Err, Requires>\n\n/** Whether a schema is the struct `@smthrs/flow` requires of a payload. */\nconst isStruct = (schema: Schema.Top): schema is Durable.AnyStructSchema => Predicate.hasProperty(schema, \"fields\")\n\nconst payloadOf = <I extends Schema.Top>(input: I): Payload<I> =>\n (isStruct(input) ? input : Schema.Struct({ input })) as Payload<I>\n\n/**\n * The tier a signature's action dispatches under.\n *\n * A declared envelope states it. A signature that declared none is\n * `irreversible`, the conservative default a harness already projects for this\n * case, and never `@smthrs/flow`'s own `sealed` default: a signature that did\n * not state its tier must not content-share another run's result.\n */\nconst tierOf = (effects: Effects.Declaration | undefined): Action.Tier => effects?.tier ?? \"irreversible\"\n\nexport const build = <\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires = Action.Requirement<string>\n>(\n options: Options<I, O, Err, Requires>\n): Flow<I, O, Err, Requires> => {\n const payload = payloadOf(options.input)\n const wrapped = isStruct(options.input)\n // Capabilities is a Context.Reference: getOption supplies its default even\n // when no value was annotated. Only an explicitly stored value overrides\n // the author's declaration.\n const annotatedCapabilities = options.annotations.mapUnsafe.has(Durable.Capabilities.key)\n ? Annotations.getOption(options.annotations, Durable.Capabilities)\n : Option.none<ReadonlyArray<string>>()\n const capabilities = Option.getOrElse(annotatedCapabilities, () => options.capabilities)\n const effects = Option.getOrElse(\n Annotations.getOption(options.annotations, Annotations.Effects),\n () => options.effects\n )\n const declared = {\n payload,\n ...(options.description === undefined ? {} : { description: options.description }),\n ...(capabilities.length === 0 && Option.isNone(annotatedCapabilities) ? {} : { capabilities }),\n ...(effects === undefined ? {} : { effects }),\n success: options.output,\n error: options.error,\n annotations: options.annotations\n }\n const body = options.body\n // A signature without a body IS the action a host implements later; the flow\n // beside it exists because a declared capability ceiling is read off a Flow,\n // and because a caller splices one node either way.\n const action = body === undefined\n ? Action.make(options.name, {\n ...declared,\n declaredFrom: options.original?.action,\n tier: tierOf(effects)\n }) as unknown as Action.Declared<\n string,\n Payload<I>,\n O,\n Err,\n Requires\n >\n : undefined\n type NativeBody = (payload: Payload<I>[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n let nativeBody: NativeBody\n if (body === undefined) {\n nativeBody = (payloadValue) => action!.call(payloadValue as never)\n } else if (wrapped) {\n nativeBody = body\n } else {\n const adapter: NativeBody = (payloadValue) => body((payloadValue as { readonly input: I[\"Type\"] }).input)\n const bodyIdentity = Node.functionIdentity(body)\n // The adapter adds no author behavior. A captured body already names all\n // of its semantics; carry that identity through the wrapping operation.\n // An uncaptured body must keep failing the native stable-callback policy.\n nativeBody = bodyIdentity.algorithm === \"sha256-source-captures/v5\"\n ? Node.capture({ body: bodyIdentity }, adapter)\n : adapter\n }\n const flow = Durable.make(options.name, {\n ...declared,\n declaredFrom: options.original?.flow,\n body: nativeBody\n }) as unknown as Durable.Flow<string, Payload<I>, O, Err, Requires>\n const self: Flow<I, O, Err, Requires> = {\n [TypeId]: {\n _Input: identity,\n _Output: identity,\n _Error: identity\n },\n name: options.name,\n description: options.description,\n input: options.input,\n output: options.output,\n error: options.error,\n capabilities,\n effects,\n model: options.model,\n flows: options.flows,\n prompt: options.prompt,\n annotations: flow.annotations,\n flow,\n action,\n call: (input: I[\"~type.make.in\"]) => flow.call((wrapped ? input : { input }) as never),\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return pipeArguments(this, arguments)\n }\n }\n built.set(self, {\n ...options,\n original: options.original ?? { flow, action }\n })\n return self\n}\n\n/**\n * Returns `true` when a value is a flow signature.\n *\n * @category guards\n * @since 0.0.0\n * @slop\n */\nexport const isFlow = (value: unknown): value is Any => Predicate.hasProperty(value, TypeId)\n\n/**\n * Places a flow within a host directive, returning a fresh flow.\n *\n * @category combinators\n * @since 0.0.0\n * @slop\n */\nexport const within: {\n (\n placement: Placement.Placement\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, Annotations.Placement, placement)\n })\n})\n\n/**\n * Attaches one typed annotation to a flow, returning a fresh flow.\n *\n * Annotations are metadata a host or a decorator reads. A custom key is\n * advisory, so a flow annotated with one plans the same graph as the flow it\n * was built from. The built-in {@link Annotations.Placement} and\n * {@link Annotations.Effects} keys are not advisory: `Graph.build` projects\n * both into node key material, so annotating with either changes the keys the\n * graph plans. {@link within} is the placement-shaped special case of this\n * combinator.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const annotate: {\n <Key, S>(\n key: Context.Key<Key, S>,\n value: S\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n ): Flow<I, O, Err, Requires>\n} = dual(3, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, key, value)\n })\n})\n\n/**\n * Replaces the collaborators a flow declares, returning a fresh flow.\n *\n * Everything else comes across unchanged: name, schemas, capabilities,\n * effects, body, and annotations. That is what lets a decorator rewrite a flow\n * tree without dropping the metadata a host reads back, such as a placement or\n * a lane.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const withFlows: {\n (\n flows: ReadonlyArray<Reference>\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n): Flow<I, O, Err, Requires> =>\n build({\n ...optionsOf(self),\n flows: [...flows]\n }))\n"]}
1
+ {"version":3,"file":"Signature.js","sourceRoot":"","sources":["../../../src/internal/Signature.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAEhD,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAGlC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,kBAAkB,CAAA;AAgNhD,4EAA4E;AAC5E,MAAM,KAAK,GAAG,IAAI,OAAO,EAAgE,CAAA;AAEzF,MAAM,SAAS,GAAG,CAChB,IAA+B,EACD,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAA4C,CAAA;AAE7F,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,C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ClB,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;CAClB,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Frozen signature projection for Markdown lowering and metadata combinators.\n *\n * @since 1.0.0\n */\n\nimport { Action, Flow as Durable } from \"@smthrs/flow\"\nimport type * as Context from \"effect/Context\"\nimport { dual, identity } from \"effect/Function\"\nimport * as Option from \"effect/Option\"\nimport { type Pipeable, pipeArguments } from \"effect/Pipeable\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Schema from \"effect/Schema\"\nimport type * as Types from \"effect/Types\"\nimport * as Annotations from \"../Annotations.ts\"\nimport type * as Effects from \"../Effects.ts\"\nimport * as Node from \"../Node.ts\"\nimport type * as Placement from \"../Placement.ts\"\n\n/**\n * Runtime type identifier carried by flow values.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport const TypeId: TypeId = \"~flows/core/Flow\"\n\n/**\n * Type-level representation of the flow runtime type identifier.\n *\n * @category type ids\n * @since 0.0.0\n * @slop\n */\nexport type TypeId = \"~flows/core/Flow\"\n\n/**\n * The name of a model seat a flow may run on.\n *\n * Seats are referred to by name, never by provider model id.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Seat = string & {}\n\n/**\n * A collaborator a flow declares: a flow value, or a registry name the harness\n * resolves before execution.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type Reference = Any | string\n\n/**\n * The struct payload a declared `input` schema becomes.\n *\n * `@smthrs/flow` requires a struct payload, and a signature may declare any\n * schema, so a non-struct input travels as the one field `input`.\n * {@link Flow.call} takes the declared shape and wraps it, so an author never\n * writes the wrapper.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Payload<I extends Schema.Top> =\n & (I extends Durable.AnyStructSchema ? I : Schema.Struct<{ readonly input: I }>)\n & Durable.AnyStructSchema\n\n/**\n * A schema-described flow signature.\n *\n * The input schema is invariant because it participates in both decoding and\n * encoding. Output and error schemas are covariant.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport interface Flow<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top = typeof Schema.Never,\n Requires = Action.Requirement<string>\n> extends Pipeable {\n readonly [TypeId]: {\n readonly _Input: Types.Invariant<I>\n readonly _Output: Types.Covariant<O>\n readonly _Error: Types.Covariant<Err>\n }\n /** The declared name, which is the tag of the flow and of the action. */\n readonly name: string\n readonly description: string | undefined\n /** The input schema as DECLARED, before {@link Payload} wraps a non-struct. */\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n /**\n * Advisory model seat metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n /**\n * Advisory collaborator metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly flows: ReadonlyArray<Reference> | undefined\n /**\n * Advisory prompt metadata recorded on the flow.\n *\n * @since 0.1.0\n */\n readonly prompt: string | undefined\n /**\n * The annotation bag the lowered flow and action carry, with the declared\n * `capabilities` and `effects` already in it.\n */\n readonly annotations: Context.Context<never>\n /**\n * The `@smthrs/flow` flow this signature IS, tagged with {@link Flow.name}.\n *\n * It is what `Graph.build`, an `Interpreter`, and a registry that checks\n * `@smthrs/flow`'s own type id are handed.\n */\n readonly flow: Durable.Flow<string, Payload<I>, O, Err, Requires>\n /**\n * The declared action a host implements with `toLayer`, on a signature that\n * declared no body. A signature with a body carries `undefined`: its body IS\n * the implementation.\n */\n readonly action: Action.Declared<string, Payload<I>, O, Err, Requires> | undefined\n /**\n * Records a call in the input schema's constructor shape, like the native\n * flow. In particular a class schema accepts its inert field data here.\n *\n * It never runs the body: graph construction evaluates pure bodies at plan\n * time.\n */\n readonly call: (input: I[\"~type.make.in\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n}\n\n/**\n * Marker-only existential type for heterogeneous collections of flows.\n *\n * It names every property a consumer outside this package reads off a\n * signature, so a decorator that holds one erased can still read what it\n * declares.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport interface Any {\n readonly [TypeId]: object\n readonly name: string\n readonly description: string | undefined\n readonly input: Schema.Top\n readonly output: Schema.Top\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly annotations: Context.Context<never>\n readonly flow: Durable.Any\n readonly call: (input: never) => Node.Node<unknown, unknown, unknown>\n}\n\n/**\n * Extracts the decoded input type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Input<F> = F extends { readonly input: infer I extends Schema.Top } ? I[\"Type\"] : never\n\n/**\n * Extracts the decoded output type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Output<F> = F extends { readonly output: infer O extends Schema.Top } ? O[\"Type\"] : never\n\n/**\n * Extracts the decoded error type of a flow.\n *\n * @category utility types\n * @since 0.0.0\n * @slop\n */\nexport type Error<F> = F extends { readonly error: infer Err extends Schema.Top } ? Err[\"Type\"] : never\n\n/** Everything a signature is built from, with every default already applied. */\ninterface Options<\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires\n> {\n readonly name: string\n readonly description: string | undefined\n readonly input: I\n readonly output: O\n readonly error: Err\n readonly capabilities: ReadonlyArray<string>\n readonly effects: Effects.Declaration | undefined\n readonly model: Seat | readonly [Seat, ...Array<Seat>] | undefined\n readonly flows: ReadonlyArray<Reference> | undefined\n readonly prompt: string | undefined\n /**\n * The annotations the AUTHOR supplied, before the declared `capabilities`\n * and `effects` are lowered onto them.\n *\n * A combinator rebuilds from these rather than from the lowered bag the\n * value exposes, so lowering a declaration twice cannot overwrite an\n * annotation a caller put on top of it.\n */\n readonly annotations: Context.Context<never>\n readonly body:\n | ((input: I[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>)\n | undefined\n /** The original native declarations whose diagnostic source locations survive a rebuild. */\n readonly original?: { readonly flow: object; readonly action: object | undefined } | undefined\n}\n\n/** The options each built signature was built from, for the combinators. */\nconst built = new WeakMap<object, Options<Schema.Top, Schema.Top, Schema.Top, unknown>>()\n\nconst optionsOf = <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n): Options<I, O, Err, Requires> => built.get(self) as unknown as Options<I, O, Err, Requires>\n\n/** Whether a schema is the struct `@smthrs/flow` requires of a payload. */\nconst isStruct = (schema: Schema.Top): schema is Durable.AnyStructSchema => Predicate.hasProperty(schema, \"fields\")\n\nconst payloadOf = <I extends Schema.Top>(input: I): Payload<I> =>\n (isStruct(input) ? input : Schema.Struct({ input })) as Payload<I>\n\n/**\n * The tier a signature's action dispatches under.\n *\n * A declared envelope states it. A signature that declared none is\n * `irreversible`, the conservative default a harness already projects for this\n * case, and never `@smthrs/flow`'s own `sealed` default: a signature that did\n * not state its tier must not content-share another run's result.\n */\nconst tierOf = (effects: Effects.Declaration | undefined): Action.Tier => effects?.tier ?? \"irreversible\"\n\n/**\n * Builds a signature from Markdown-lowered options: annotated capabilities and\n * effects override the declared ones, and a signature without a body becomes the\n * action a host implements later.\n *\n * @since 1.0.0\n * @private\n */\nexport const build = <\n I extends Schema.Top,\n O extends Schema.Top,\n Err extends Schema.Top,\n Requires = Action.Requirement<string>\n>(\n options: Options<I, O, Err, Requires>\n): Flow<I, O, Err, Requires> => {\n const payload = payloadOf(options.input)\n const wrapped = isStruct(options.input)\n // Capabilities is a Context.Reference: getOption supplies its default even\n // when no value was annotated. Only an explicitly stored value overrides\n // the author's declaration.\n const annotatedCapabilities = options.annotations.mapUnsafe.has(Durable.Capabilities.key)\n ? Annotations.getOption(options.annotations, Durable.Capabilities)\n : Option.none<ReadonlyArray<string>>()\n const capabilities = Option.getOrElse(annotatedCapabilities, () => options.capabilities)\n const effects = Option.getOrElse(\n Annotations.getOption(options.annotations, Annotations.Effects),\n () => options.effects\n )\n const declared = {\n payload,\n ...(options.description === undefined ? {} : { description: options.description }),\n ...(capabilities.length === 0 && Option.isNone(annotatedCapabilities) ? {} : { capabilities }),\n ...(effects === undefined ? {} : { effects }),\n success: options.output,\n error: options.error,\n annotations: options.annotations\n }\n const body = options.body\n // A signature without a body IS the action a host implements later; the flow\n // beside it exists because a declared capability ceiling is read off a Flow,\n // and because a caller splices one node either way.\n const action = body === undefined\n ? Action.make(options.name, {\n ...declared,\n declaredFrom: options.original?.action,\n tier: tierOf(effects)\n }) as unknown as Action.Declared<\n string,\n Payload<I>,\n O,\n Err,\n Requires\n >\n : undefined\n type NativeBody = (payload: Payload<I>[\"Type\"]) => Node.Node<O[\"Type\"], Err[\"Type\"], Requires>\n let nativeBody: NativeBody\n if (body === undefined) {\n nativeBody = (payloadValue) => action!.call(payloadValue as never)\n } else if (wrapped) {\n nativeBody = body\n } else {\n const adapter: NativeBody = (payloadValue) => body((payloadValue as { readonly input: I[\"Type\"] }).input)\n const bodyIdentity = Node.functionIdentity(body)\n // The adapter adds no author behavior. A captured body already names all\n // of its semantics; carry that identity through the wrapping operation.\n // An uncaptured body must keep failing the native stable-callback policy.\n nativeBody = bodyIdentity.algorithm === \"sha256-source-captures/v5\"\n ? Node.capture({ body: bodyIdentity }, adapter)\n : adapter\n }\n const flow = Durable.make(options.name, {\n ...declared,\n declaredFrom: options.original?.flow,\n body: nativeBody\n }) as unknown as Durable.Flow<string, Payload<I>, O, Err, Requires>\n const self: Flow<I, O, Err, Requires> = {\n [TypeId]: {\n _Input: identity,\n _Output: identity,\n _Error: identity\n },\n name: options.name,\n description: options.description,\n input: options.input,\n output: options.output,\n error: options.error,\n capabilities,\n effects,\n model: options.model,\n flows: options.flows,\n prompt: options.prompt,\n annotations: flow.annotations,\n flow,\n action,\n call: (input: I[\"~type.make.in\"]) => flow.call((wrapped ? input : { input }) as never),\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return pipeArguments(this, arguments)\n }\n }\n built.set(self, {\n ...options,\n original: options.original ?? { flow, action }\n })\n return self\n}\n\n/**\n * Returns `true` when a value is a flow signature.\n *\n * @category guards\n * @since 0.0.0\n * @slop\n */\nexport const isFlow = (value: unknown): value is Any => Predicate.hasProperty(value, TypeId)\n\n/**\n * Places a flow within a host directive, returning a fresh flow.\n *\n * @category combinators\n * @since 0.0.0\n * @slop\n */\nexport const within: {\n (\n placement: Placement.Placement\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n placement: Placement.Placement\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, Annotations.Placement, placement)\n })\n})\n\n/**\n * Attaches one typed annotation to a flow, returning a fresh flow.\n *\n * Annotations are metadata a host or a decorator reads. A custom key is\n * advisory, so a flow annotated with one plans the same graph as the flow it\n * was built from. The built-in {@link Annotations.Placement} and\n * {@link Annotations.Effects} keys are not advisory: `Graph.build` projects\n * both into node key material, so annotating with either changes the keys the\n * graph plans. {@link within} is the placement-shaped special case of this\n * combinator.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const annotate: {\n <Key, S>(\n key: Context.Key<Key, S>,\n value: S\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n ): Flow<I, O, Err, Requires>\n} = dual(3, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires, Key, S>(\n self: Flow<I, O, Err, Requires>,\n key: Context.Key<Key, S>,\n value: S\n): Flow<I, O, Err, Requires> => {\n const options = optionsOf(self)\n return build({\n ...options,\n annotations: Annotations.add(options.annotations, key, value)\n })\n})\n\n/**\n * Replaces the collaborators a flow declares, returning a fresh flow.\n *\n * Everything else comes across unchanged: name, schemas, capabilities,\n * effects, body, and annotations. That is what lets a decorator rewrite a flow\n * tree without dropping the metadata a host reads back, such as a placement or\n * a lane.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const withFlows: {\n (\n flows: ReadonlyArray<Reference>\n ): <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>\n ) => Flow<I, O, Err, Requires>\n <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n ): Flow<I, O, Err, Requires>\n} = dual(2, <I extends Schema.Top, O extends Schema.Top, Err extends Schema.Top, Requires>(\n self: Flow<I, O, Err, Requires>,\n flows: ReadonlyArray<Reference>\n): Flow<I, O, Err, Requires> =>\n build({\n ...optionsOf(self),\n flows: [...flows]\n }))\n"]}
package/docs/api.md CHANGED
@@ -252,6 +252,13 @@ only way to evaluate bytes is to write them somewhere and import that path;
252
252
  call this before the import, because a declaration captures its site while its
253
253
  module is evaluated and never rewrites it afterwards.
254
254
 
255
+ `Graph.inspect(flow)` returns an `Inspection`: the flow's nodes, edges,
256
+ steps, diagnostics, and its prompt renderer's source, all serializable. It
257
+ builds against an unresolved input reference and runs no action or prompt
258
+ renderer, so a body that branches on its payload in plain JavaScript reports a
259
+ diagnostic instead of a sample graph. Plan-time body code still runs, so call
260
+ it only where loading the declaration is already trusted.
261
+
255
262
  ## Effects
256
263
 
257
264
  Pure effect declarations describing read and write envelopes.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@smthrs/core",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.3",
4
+ "version": "1.0.0-rc.5",
5
5
  "license": "MIT",
6
6
  "smthrs": {
7
7
  "group": "agent"
@@ -165,10 +165,10 @@
165
165
  "tag": "next"
166
166
  },
167
167
  "dependencies": {
168
- "@smthrs/canonical": "1.0.0-rc.3",
169
- "@smthrs/crypto": "1.0.0-rc.3",
170
- "@smthrs/flow": "1.0.0-rc.3",
171
- "@smthrs/plan": "1.0.0-rc.3",
168
+ "@smthrs/canonical": "1.0.0-rc.5",
169
+ "@smthrs/crypto": "1.0.0-rc.5",
170
+ "@smthrs/flow": "1.0.0-rc.5",
171
+ "@smthrs/plan": "1.0.0-rc.5",
172
172
  "yaml": "2.9.0"
173
173
  },
174
174
  "devDependencies": {
@@ -176,7 +176,7 @@
176
176
  "@effect/platform-node": "4.0.0-rc.115",
177
177
  "@effect/vitest": "4.0.0-rc.115",
178
178
  "@eslint/js": "9.39.5",
179
- "@smthrs/engine": "1.0.0-rc.3",
179
+ "@smthrs/engine": "1.0.0-rc.5",
180
180
  "@types/node": "26.4.1",
181
181
  "@vitest/coverage-v8": "5.0.0",
182
182
  "dprint": "0.57.1",
package/src/Flow.ts CHANGED
@@ -1,3 +1,8 @@
1
- /** Metadata projections retained for Markdown and persisted signatures. */
1
+ /**
2
+ * Metadata projections retained for Markdown and persisted signatures.
3
+ *
4
+ * @since 1.0.0
5
+ */
6
+
2
7
  export { annotate, isFlow, TypeId, withFlows, within } from "./internal/Signature.ts"
3
8
  export type { Any, Error, Flow, Input, Output, Payload, Reference, Seat } from "./internal/Signature.ts"
@@ -1,4 +1,8 @@
1
- /** Frozen signature projection for Markdown lowering and metadata combinators. */
1
+ /**
2
+ * Frozen signature projection for Markdown lowering and metadata combinators.
3
+ *
4
+ * @since 1.0.0
5
+ */
2
6
 
3
7
  import { Action, Flow as Durable } from "@smthrs/flow"
4
8
  import type * as Context from "effect/Context"
@@ -9,7 +13,7 @@ import * as Predicate from "effect/Predicate"
9
13
  import * as Schema from "effect/Schema"
10
14
  import type * as Types from "effect/Types"
11
15
  import * as Annotations from "../Annotations.ts"
12
- import * as Effects from "../Effects.ts"
16
+ import type * as Effects from "../Effects.ts"
13
17
  import * as Node from "../Node.ts"
14
18
  import type * as Placement from "../Placement.ts"
15
19
 
@@ -251,6 +255,14 @@ const payloadOf = <I extends Schema.Top>(input: I): Payload<I> =>
251
255
  */
252
256
  const tierOf = (effects: Effects.Declaration | undefined): Action.Tier => effects?.tier ?? "irreversible"
253
257
 
258
+ /**
259
+ * Builds a signature from Markdown-lowered options: annotated capabilities and
260
+ * effects override the declared ones, and a signature without a body becomes the
261
+ * action a host implements later.
262
+ *
263
+ * @since 1.0.0
264
+ * @private
265
+ */
254
266
  export const build = <
255
267
  I extends Schema.Top,
256
268
  O extends Schema.Top,