@axlsdk/axl 0.17.6 → 0.17.8

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
@@ -630,6 +630,68 @@ await runtime.shutdown();
630
630
 
631
631
  `RedisStore.create()` connects before returning, so any connection error surfaces at startup rather than on first use. The runtime's `shutdown()` closes the connection automatically.
632
632
 
633
+ Pass an options object instead of a URL string to set a custom `keyPrefix` (default `'axl:'`) — useful when multiple Axl deployments share a Redis cluster — or to configure TTLs:
634
+
635
+ ```typescript
636
+ const store = await RedisStore.create({
637
+ url: 'redis://localhost:6379',
638
+ keyPrefix: 'axl:prod:', // staging would use 'axl:staging:'
639
+ defaultTtl: 60 * 60 * 24 * 30, // 30 days for everything
640
+ ttls: {
641
+ checkpoint: 60 * 60 * 24 * 7, // shorter for checkpoints
642
+ sessionMeta: null, // explicit opt-out
643
+ },
644
+ });
645
+ ```
646
+
647
+ The prefix is concatenated as-given — no normalization. Include a trailing colon if you want one. Empty string is rejected.
648
+
649
+ **TTLs are strongly recommended in production** — without them every `save*` accumulates forever and Redis eventually OOMs. Sliding window: `memory`, `session`, `sessionMeta` (every write refreshes; reads do NOT). Fixed-creation: `checkpoint`, `streamingEvents`. Fixed-refresh: `executionState`, `executionHistory`, `evalHistory`. `streamingEvents` is opt-in only (does NOT fall back to `defaultTtl`). See [api-reference.md](../../docs/api-reference.md#redisstore-options) for the full table.
650
+
651
+ #### Crash survival: `state.persist: 'streaming'`
652
+
653
+ Opt-in mode that flushes events to the configured store throughout a run, so a mid-execution crash leaves a recoverable trace.
654
+
655
+ ```typescript
656
+ const runtime = new AxlRuntime({
657
+ state: {
658
+ store: await RedisStore.create(redisUrl),
659
+ persist: 'streaming', // default 'terminal' (back-compat)
660
+ streamingBatchSize: 100, // events per flush trigger
661
+ streamingBatchInterval: 1000, // ms
662
+ },
663
+ });
664
+
665
+ // Boot sequence: lazy-load THEN recover THEN accept new work
666
+ await runtime.getExecutions();
667
+ const recovered = await runtime.recoverIncompleteStreams();
668
+ console.log(`Recovered ${recovered.length} crashed executions`);
669
+ app.listen(3000);
670
+ ```
671
+
672
+ Excluded events (never flushed): `token`, `partial_object`, `string_delta` — reconstructable from `agent_call_end.data.response`. Scope: `runtime.execute()` and `runtime.stream()` only — `createContext()` flows are deliberately excluded (no terminal finalize path).
673
+
674
+ Synthesized recovered executions carry `status: 'failed'`, `error: 'process terminated (recovered from streaming buffer)'`, and `workflow: '__axl/recovered'` when no `workflow_start` was captured. Events bounded by `state.maxEventsPerExecution`. SQLite does not implement streaming methods — the runtime warns and falls back to terminal mode.
675
+
676
+ See [docs/migration/state-store-durability.md](../../docs/migration/state-store-durability.md) for the full design.
677
+
678
+ #### Execution lifecycle: `runtime.deleteExecution(id)`
679
+
680
+ GDPR right-to-be-forgotten. One call sweeps every per-execution surface (data + indexes + checkpoints + suspended state + streaming buffer + pending decisions) and emits an `execution_deleted` audit event.
681
+
682
+ ```typescript
683
+ await runtime.deleteExecution(executionId);
684
+
685
+ runtime.on('execution_deleted', (e) => {
686
+ // e: { executionId, wasActive, hadPendingDecision, removed }
687
+ auditLog.write({ event: 'execution.deleted', ...e });
688
+ });
689
+ ```
690
+
691
+ If the execution is still running, the workflow is aborted (and a paused `ctx.awaitHuman()` correctly wakes with `AbortError` — fixed in 0.17.7). The resurrection guard ensures the workflow's eventual `workflow_end` doesn't re-create the row.
692
+
693
+ `ExecutionInfo.metadata` round-trips from `ExecuteOptions.metadata` (`userId`, `tenantId`, etc.) — queryable via `runtime.getExecutions().filter(...)`. Internal control-plane keys (`sessionHistory`, `sessionId`, `resumeMode`) are stripped before persistence; they remain available via `ctx.metadata` for dynamic selectors.
694
+
633
695
  ### Session Options
634
696
 
635
697
  ```typescript