@swirls/looms 0.12.2 → 0.12.3

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.
@@ -22,8 +22,11 @@ export type OnEffectNext = () => Effect.Effect<ReadonlyArray<EventInput>, Error>
22
22
  * Middleware wraps local (in-process) effect dispatch only. Worker-placed effects never see it —
23
23
  * pass a {@link LocalEffectDefinition} so that is a type error rather than a silent no-op.
24
24
  * Prefer {@link EffectAdmission} / {@link onAdmit} for gates that must apply on both paths.
25
+ *
26
+ * `R` and `E` are inferred from the definition and otherwise unused, so an effect that requires
27
+ * host services (`agent.callLLM` needs the LLM and the agent definitions) can be wrapped directly.
25
28
  */
26
- export declare function onEffect<TInput>(definition: LocalEffectDefinition<TInput>, handler: (input: TInput, ctx: LocalEffectContext, next: OnEffectNext) => Effect.Effect<ReadonlyArray<EventInput>, Error>): EffectMiddleware;
29
+ export declare function onEffect<TInput, R = never, E extends EventInput = EventInput>(definition: LocalEffectDefinition<TInput, R, E>, handler: (input: TInput, ctx: LocalEffectContext, next: OnEffectNext) => Effect.Effect<ReadonlyArray<EventInput>, Error>): EffectMiddleware;
27
30
  /**
28
31
  * Identity of an effect attempt before it runs locally or is dispatched to a worker.
29
32
  * Admission hooks see this on both paths; they cannot call `emit` or `heartbeat`.
@@ -46,7 +49,7 @@ export type EffectAdmission = (effect: RuntimeEffect, ctx: EffectAdmissionContex
46
49
  * Admission that runs only for one effect definition (local or worker). Prefer this over
47
50
  * middleware when the gate must apply to worker-placed effects as well as local ones.
48
51
  */
49
- export declare function onAdmit<TInput>(definition: EffectDefinition<TInput>, handler: (input: TInput, ctx: EffectAdmissionContext) => Effect.Effect<void, Error>): EffectAdmission;
52
+ export declare function onAdmit<TInput, R = never, E extends EventInput = EventInput>(definition: EffectDefinition<TInput, R, E>, handler: (input: TInput, ctx: EffectAdmissionContext) => Effect.Effect<void, Error>): EffectAdmission;
50
53
  /**
51
54
  * Names the threads whose in-process effects an admitted signal event interrupts, so a running
52
55
  * effect (such as a model call) can stop early. The runtime also interrupts each named thread's
@@ -9,6 +9,9 @@ export { DEFAULT_DEFINITION_VERSION, definitionKey } from './definition-version.
9
9
  * Middleware wraps local (in-process) effect dispatch only. Worker-placed effects never see it —
10
10
  * pass a {@link LocalEffectDefinition} so that is a type error rather than a silent no-op.
11
11
  * Prefer {@link EffectAdmission} / {@link onAdmit} for gates that must apply on both paths.
12
+ *
13
+ * `R` and `E` are inferred from the definition and otherwise unused, so an effect that requires
14
+ * host services (`agent.callLLM` needs the LLM and the agent definitions) can be wrapped directly.
12
15
  */
13
16
  export function onEffect(definition, handler) {
14
17
  return (effect, ctx, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swirls/looms",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "Pluggable event-sourced runtime for durable agents and workflows",
5
5
  "homepage": "https://github.com/ByteSliceHQ/looms#readme",
6
6
  "bugs": {