@autonome-research/thread-phase 3.1.0 → 3.2.1

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.
Files changed (2) hide show
  1. package/README.md +14 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -146,7 +146,9 @@ Memory across runs is outsourced: `MemoryProvider` is just a TypeScript interfac
146
146
 
147
147
  `Trigger<TInput>` is the protocol every signal source implements: timers, webhooks, queue consumers, file watchers, message brokers. Each trigger yields `TriggerEvent<TInput>` with `{ id, occurredAt, input, metadata }`. `runTrigger(trigger, factory, options)` is the canonical consumer — it reads events, dispatches pipelines (optionally through a `JobRunner`), enforces a concurrency cap with backpressure, and isolates per-event failures.
148
148
 
149
- Core ships `TimerTrigger` only. HTTP/queue/file-watch transports stay in `examples/triggers/` as recipes — wrap your favorite framework into the protocol, don't make thread-phase ship transports.
149
+ Core ships two built-in triggers: `TimerTrigger` (interval-driven) and `CronTrigger` (cron-expression-driven, lazy-loaded). HTTP/queue/file-watch transports stay in `examples/triggers/` as recipes — wrap your favorite framework into the protocol, don't make thread-phase ship transports.
150
+
151
+ For most automation, reach for the higher-level helpers on the main index (`schedule`, `hook`, `oneShot`) — they construct the underlying trigger and wire it through `runTrigger` in one call. The lower-level API is below if you need it:
150
152
 
151
153
  ```ts
152
154
  import { TimerTrigger, runTrigger } from '@autonome-research/thread-phase/triggers';
@@ -155,13 +157,23 @@ const trigger = new TimerTrigger({ intervalMs: 15 * 60_000, name: 'every-15m' })
155
157
  const handle = runTrigger(
156
158
  trigger,
157
159
  () => ({ phases: [myPipeline], ctx: { cache: new PipelineCache() } }),
158
- { jobRunner: runner, jobStore: store },
160
+ { jobRunner: runner },
159
161
  );
160
162
 
161
163
  process.on('SIGTERM', () => void handle.stop());
162
164
  await handle.done;
163
165
  ```
164
166
 
167
+ Equivalent with the helper (when you don't need the lower-level pieces):
168
+
169
+ ```ts
170
+ import { schedule } from '@autonome-research/thread-phase';
171
+
172
+ export default schedule({ intervalMs: 15 * 60_000 }, async () => {
173
+ await doStuff();
174
+ });
175
+ ```
176
+
165
177
  ## Patterns
166
178
 
167
179
  In `@autonome-research/thread-phase/patterns`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autonome-research/thread-phase",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "description": "TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.",
5
5
  "license": "MIT",
6
6
  "type": "module",