@bastani/atomic 0.9.44-alpha.5 → 0.9.44-alpha.7

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 (34) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/broker/broker.ts +13 -1
  4. package/dist/builtin/intercom/index.bundle.mjs +41 -5
  5. package/dist/builtin/intercom/package.json +1 -1
  6. package/dist/builtin/intercom/types.ts +7 -0
  7. package/dist/builtin/intercom/workflow-delivery-states.ts +48 -0
  8. package/dist/builtin/mcp/package.json +1 -1
  9. package/dist/builtin/subagents/package.json +1 -1
  10. package/dist/builtin/web-access/package.json +1 -1
  11. package/dist/builtin/workflows/CHANGELOG.md +20 -0
  12. package/dist/builtin/workflows/builtin/{chunk-zjecnjxx.js → chunk-6901nsd6.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-k8d7ehjx.js → chunk-jvna28mq.js} +381 -130
  14. package/dist/builtin/workflows/builtin/{chunk-qxpymnaf.js → chunk-vwx023ge.js} +1 -1
  15. package/dist/builtin/workflows/builtin/goal.js +2 -2
  16. package/dist/builtin/workflows/builtin/index.js +3 -3
  17. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  18. package/dist/builtin/workflows/package.json +1 -1
  19. package/dist/builtin/workflows/src/durable/journal/internal.d.ts +15 -1
  20. package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +11 -0
  21. package/dist/builtin/workflows/src/extension/index.bundle.mjs +2514 -741
  22. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +2384 -727
  23. package/dist/builtin/workflows/src/index.js +2383 -727
  24. package/dist/builtin/workflows/src/local-worker-entry.mjs +2384 -727
  25. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  26. package/dist/core/agent-session-custom-message-commit.js +16 -0
  27. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  28. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  29. package/dist/core/storage/node-sqlite.js +130 -13
  30. package/dist/core/storage/node-sqlite.js.map +1 -1
  31. package/docs/intercom/reference.md +2 -0
  32. package/docs/workflows/operations.md +1 -1
  33. package/npm-shrinkwrap.json +32 -32
  34. package/package.json +3 -3
@@ -16,8 +16,8 @@ import {
16
16
  } from "./chunk-z3pajrfs.js";
17
17
  import {
18
18
  goal_default
19
- } from "./chunk-qxpymnaf.js";
20
- import"./chunk-k8d7ehjx.js";
19
+ } from "./chunk-vwx023ge.js";
20
+ import"./chunk-jvna28mq.js";
21
21
  import"./chunk-z0d03ktm.js";
22
22
  import {
23
23
  open_claude_design_default
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-dcxscfnb.js";
28
28
  import {
29
29
  ralph_default
30
- } from "./chunk-zjecnjxx.js";
30
+ } from "./chunk-6901nsd6.js";
31
31
  import {
32
32
  tournament_default
33
33
  } from "./chunk-49kkbdpr.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ralph_default
3
- } from "./chunk-zjecnjxx.js";
4
- import"./chunk-k8d7ehjx.js";
3
+ } from "./chunk-6901nsd6.js";
4
+ import"./chunk-jvna28mq.js";
5
5
  import"./chunk-2377r57g.js";
6
6
  import"./chunk-z0d03ktm.js";
7
7
  import"./chunk-n1910xc4.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.44-alpha.5",
3
+ "version": "0.9.44-alpha.7",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -1,5 +1,5 @@
1
1
  import type { SqliteExecutor } from "@bastani/atomic/storage";
2
- import { type JournalEntry, type RunJournal } from "./types.js";
2
+ import { type AppendOutcome, type JournalEntry, type Lease, type RunEvent, type RunJournal } from "./types.js";
3
3
  export declare const JOURNAL_READ_PAGE_SIZE = 256;
4
4
  /** Event types the durable backend folds without replacing the run's handle; every other event carries it. */
5
5
  export declare const NON_SNAPSHOT_EVENT_TYPES: readonly ["CheckpointRecorded", "MessageSettled", "MessageDelivered"];
@@ -32,6 +32,20 @@ export interface RunJournalVersions {
32
32
  export declare function registerRunJournalVersions(journal: RunJournal, versions: RunJournalVersions): void;
33
33
  /** Change tracking for a journal that registered it; other journals are re-read in full. */
34
34
  export declare function runJournalVersions(journal: RunJournal): RunJournalVersions | undefined;
35
+ /**
36
+ * One append of a batch. `context` runs a function in the async context the append was issued from; that context,
37
+ * not the batch's, decides the append's pool append guard.
38
+ */
39
+ export interface JournalBatchAppend {
40
+ readonly event: RunEvent;
41
+ readonly key?: string;
42
+ readonly context: <R>(action: () => R) => R;
43
+ }
44
+ /** Appends to one run in one transaction; each append is settled on its own. Kept off the public journal shape. */
45
+ export type RunJournalAppendMany = (lease: Lease, appends: readonly JournalBatchAppend[]) => Promise<readonly PromiseSettledResult<AppendOutcome>[]>;
46
+ export declare function registerRunJournalAppendMany(journal: RunJournal, appendMany: RunJournalAppendMany): void;
47
+ /** Batched appends for a journal that registered them; other journals append one event at a time. */
48
+ export declare function runJournalAppendMany(journal: RunJournal): RunJournalAppendMany | undefined;
35
49
  export type JournalAppendGuard = (tx: SqliteExecutor, runId: string) => Promise<void>;
36
50
  export interface SqlPoolStorage {
37
51
  transaction<T>(body: (tx: SqliteExecutor) => Promise<T>): Promise<T>;
@@ -51,6 +51,17 @@ export declare class SqlRunJournal implements RunJournal {
51
51
  key?: string;
52
52
  expectSeq?: number;
53
53
  }): Promise<AppendOutcome>;
54
+ /**
55
+ * Append several events to one run in one transaction, checking the lease once and assigning consecutive
56
+ * sequences in order. Each append is checked by the pool append guard of the context that issued it, or by none
57
+ * when that context had none, whatever guard the batch itself runs under. Each runs in its own savepoint, so
58
+ * one append's guard or payload failure is reported for it alone and the rest still commit. A lease or storage
59
+ * failure rejects the whole batch, with nothing written.
60
+ */
61
+ private appendMany;
62
+ /** Validate an append outside any transaction; its payload error is raised where `append` always raised it. */
63
+ private prepare;
64
+ private insert;
54
65
  read(runId: string, fromSeq?: number): AsyncIterable<JournalEntry>;
55
66
  readKey(runId: string, key: string): Promise<JournalEntry | undefined>;
56
67
  deleteRun(runId: string): Promise<void>;