@graphorin/core 0.5.0

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 (134) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +21 -0
  3. package/README.md +70 -0
  4. package/dist/channels/channels.d.ts +156 -0
  5. package/dist/channels/channels.d.ts.map +1 -0
  6. package/dist/channels/channels.js +90 -0
  7. package/dist/channels/channels.js.map +1 -0
  8. package/dist/channels/directive.d.ts +34 -0
  9. package/dist/channels/directive.d.ts.map +1 -0
  10. package/dist/channels/directive.js +29 -0
  11. package/dist/channels/directive.js.map +1 -0
  12. package/dist/channels/dispatch.d.ts +26 -0
  13. package/dist/channels/dispatch.d.ts.map +1 -0
  14. package/dist/channels/dispatch.js +32 -0
  15. package/dist/channels/dispatch.js.map +1 -0
  16. package/dist/channels/index.d.ts +5 -0
  17. package/dist/channels/index.js +6 -0
  18. package/dist/channels/pause.d.ts +84 -0
  19. package/dist/channels/pause.d.ts.map +1 -0
  20. package/dist/channels/pause.js +90 -0
  21. package/dist/channels/pause.js.map +1 -0
  22. package/dist/contracts/auth-token-store.d.ts +45 -0
  23. package/dist/contracts/auth-token-store.d.ts.map +1 -0
  24. package/dist/contracts/checkpoint-store.d.ts +90 -0
  25. package/dist/contracts/checkpoint-store.d.ts.map +1 -0
  26. package/dist/contracts/embedder.d.ts +45 -0
  27. package/dist/contracts/embedder.d.ts.map +1 -0
  28. package/dist/contracts/eval-scorer.d.ts +46 -0
  29. package/dist/contracts/eval-scorer.d.ts.map +1 -0
  30. package/dist/contracts/index.d.ts +22 -0
  31. package/dist/contracts/index.js +6 -0
  32. package/dist/contracts/local-provider-trust.d.ts +36 -0
  33. package/dist/contracts/local-provider-trust.d.ts.map +1 -0
  34. package/dist/contracts/logger.d.ts +53 -0
  35. package/dist/contracts/logger.d.ts.map +1 -0
  36. package/dist/contracts/logger.js +21 -0
  37. package/dist/contracts/logger.js.map +1 -0
  38. package/dist/contracts/memory-store.d.ts +106 -0
  39. package/dist/contracts/memory-store.d.ts.map +1 -0
  40. package/dist/contracts/oauth-server-store.d.ts +81 -0
  41. package/dist/contracts/oauth-server-store.d.ts.map +1 -0
  42. package/dist/contracts/preferred-model.d.ts +60 -0
  43. package/dist/contracts/preferred-model.d.ts.map +1 -0
  44. package/dist/contracts/preferred-model.js +15 -0
  45. package/dist/contracts/preferred-model.js.map +1 -0
  46. package/dist/contracts/provider.d.ts +272 -0
  47. package/dist/contracts/provider.d.ts.map +1 -0
  48. package/dist/contracts/reasoning-retention.d.ts +53 -0
  49. package/dist/contracts/reasoning-retention.d.ts.map +1 -0
  50. package/dist/contracts/redaction-validator.d.ts +59 -0
  51. package/dist/contracts/redaction-validator.d.ts.map +1 -0
  52. package/dist/contracts/sandbox.d.ts +73 -0
  53. package/dist/contracts/sandbox.d.ts.map +1 -0
  54. package/dist/contracts/secret-ref.d.ts +26 -0
  55. package/dist/contracts/secret-ref.d.ts.map +1 -0
  56. package/dist/contracts/secret-value.d.ts +112 -0
  57. package/dist/contracts/secret-value.d.ts.map +1 -0
  58. package/dist/contracts/secret-value.js +24 -0
  59. package/dist/contracts/secret-value.js.map +1 -0
  60. package/dist/contracts/secrets-store.d.ts +87 -0
  61. package/dist/contracts/secrets-store.d.ts.map +1 -0
  62. package/dist/contracts/session-store.d.ts +142 -0
  63. package/dist/contracts/session-store.d.ts.map +1 -0
  64. package/dist/contracts/token-counter.d.ts +28 -0
  65. package/dist/contracts/token-counter.d.ts.map +1 -0
  66. package/dist/contracts/tool.d.ts +264 -0
  67. package/dist/contracts/tool.d.ts.map +1 -0
  68. package/dist/contracts/tracer.d.ts +84 -0
  69. package/dist/contracts/tracer.d.ts.map +1 -0
  70. package/dist/contracts/tracer.js +34 -0
  71. package/dist/contracts/tracer.js.map +1 -0
  72. package/dist/contracts/trigger-store.d.ts +43 -0
  73. package/dist/contracts/trigger-store.d.ts.map +1 -0
  74. package/dist/index.d.ts +59 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +38 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/types/agent-event.d.ts +449 -0
  79. package/dist/types/agent-event.d.ts.map +1 -0
  80. package/dist/types/handoff.d.ts +112 -0
  81. package/dist/types/handoff.d.ts.map +1 -0
  82. package/dist/types/index.d.ts +13 -0
  83. package/dist/types/index.js +6 -0
  84. package/dist/types/memory.d.ts +354 -0
  85. package/dist/types/memory.d.ts.map +1 -0
  86. package/dist/types/message.d.ts +162 -0
  87. package/dist/types/message.d.ts.map +1 -0
  88. package/dist/types/run.d.ts +155 -0
  89. package/dist/types/run.d.ts.map +1 -0
  90. package/dist/types/run.js +31 -0
  91. package/dist/types/run.js.map +1 -0
  92. package/dist/types/sensitivity.d.ts +35 -0
  93. package/dist/types/sensitivity.d.ts.map +1 -0
  94. package/dist/types/sensitivity.js +29 -0
  95. package/dist/types/sensitivity.js.map +1 -0
  96. package/dist/types/session-scope.d.ts +22 -0
  97. package/dist/types/session-scope.d.ts.map +1 -0
  98. package/dist/types/stop-condition.d.ts +62 -0
  99. package/dist/types/stop-condition.d.ts.map +1 -0
  100. package/dist/types/stop-condition.js +81 -0
  101. package/dist/types/stop-condition.js.map +1 -0
  102. package/dist/types/tool-call.d.ts +27 -0
  103. package/dist/types/tool-call.d.ts.map +1 -0
  104. package/dist/types/tool.d.ts +260 -0
  105. package/dist/types/tool.d.ts.map +1 -0
  106. package/dist/types/usage.d.ts +82 -0
  107. package/dist/types/usage.d.ts.map +1 -0
  108. package/dist/types/usage.js +17 -0
  109. package/dist/types/usage.js.map +1 -0
  110. package/dist/types/workflow-event.d.ts +108 -0
  111. package/dist/types/workflow-event.d.ts.map +1 -0
  112. package/dist/utils/assert-never.d.ts +26 -0
  113. package/dist/utils/assert-never.d.ts.map +1 -0
  114. package/dist/utils/assert-never.js +29 -0
  115. package/dist/utils/assert-never.js.map +1 -0
  116. package/dist/utils/async-context.d.ts +37 -0
  117. package/dist/utils/async-context.d.ts.map +1 -0
  118. package/dist/utils/async-context.js +33 -0
  119. package/dist/utils/async-context.js.map +1 -0
  120. package/dist/utils/hash.d.ts +30 -0
  121. package/dist/utils/hash.d.ts.map +1 -0
  122. package/dist/utils/hash.js +102 -0
  123. package/dist/utils/hash.js.map +1 -0
  124. package/dist/utils/index.d.ts +6 -0
  125. package/dist/utils/index.js +7 -0
  126. package/dist/utils/streams.d.ts +59 -0
  127. package/dist/utils/streams.d.ts.map +1 -0
  128. package/dist/utils/streams.js +169 -0
  129. package/dist/utils/streams.js.map +1 -0
  130. package/dist/utils/validation.d.ts +67 -0
  131. package/dist/utils/validation.d.ts.map +1 -0
  132. package/dist/utils/validation.js +36 -0
  133. package/dist/utils/validation.js.map +1 -0
  134. package/package.json +82 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # @graphorin/core
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Initial release of the dependency-free root package for the Graphorin
8
+ framework. Ships the public type system (`Message`, `AgentEvent`,
9
+ `WorkflowEvent`, `RunContext`, `RunState`, `Usage`, `Sensitivity`,
10
+ `MemoryKind`, `MemoryMetadata`, `Handoff`, `StopCondition`, …), every
11
+ cross-package contract interface (`Provider`, `Tool`, `Logger`,
12
+ `MemoryStore`, `CheckpointStore`, `SessionStore`, `TriggerStore`,
13
+ `AuthTokenStore`, `EmbedderProvider`, `TokenCounter`, `Tracer`,
14
+ `AISpan`, `RedactionValidator`, `SecretsStore`, `SecretValue`,
15
+ `SecretRef`, `SecretResolver`, `Sandbox`, `EvalScorer`, …) and a small
16
+ set of dependency-free utilities (`collect`, `mapStream`, `merge`,
17
+ `withSignal`, `assertNever`, `md5`, `xxhash`, …).
18
+ - Workflow channel primitives under `@graphorin/core/channels`:
19
+ `Directive`, `Dispatch`, `pause`, `LatestValue`, `Reducer`, `Stream`,
20
+ `Barrier`, `Ephemeral`, `AnyValue`, `ListAggregate` — Graphorin's own
21
+ vocabulary; names are part of the public API.
22
+ - Typed no-op defaults `NOOP_TRACER` and `NOOP_LOGGER` so downstream
23
+ packages can carry a non-null observability surface without taking the
24
+ observability dependency.
25
+ - `zod` is declared as a peer dependency (`^3.23 || ^4`); `@graphorin/core`
26
+ has no other runtime dependencies and no internal dependencies on any
27
+ other `@graphorin/*` package.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oleksiy Stepurenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @graphorin/core
2
+
3
+ > The dependency-free root package every other `@graphorin/*` package builds on.
4
+
5
+ `@graphorin/core` defines the **public type system** and the **cross-package
6
+ contracts** for the Graphorin framework. It contains no runtime: every
7
+ implementation (sandbox, secrets store, memory store, provider adapters,
8
+ agent runtime, workflow engine, server, …) lives in a sibling package and
9
+ depends on the interfaces declared here.
10
+
11
+ - **Status:** v0.5.0 — type and contract surface for the v0.1 release line.
12
+ - **License:** [MIT](./LICENSE) — © 2026 Oleksiy Stepurenko.
13
+ - **Engines:** Node.js 22+ (ESM only).
14
+ - **Runtime dependencies:** none.
15
+ - **Peer dependency:** `zod` (`^3.23 || ^4`) — used for schema-typed values
16
+ (`stateSchema`, `inputSchema`, `outputSchema`, `EvalScorer`, …). Bring
17
+ whichever Zod version your application already uses.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pnpm add @graphorin/core zod
23
+ ```
24
+
25
+ ## What is in here?
26
+
27
+ The package is organized into four sub-modules with their own `exports`
28
+ sub-paths so that consumers can import only what they need:
29
+
30
+ | Sub-path | Contents |
31
+ | ------------------------- | ------------------------------------------------------------------------------------------------------- |
32
+ | `@graphorin/core` | Re-export of the entire surface (types + contracts + utilities + channels). |
33
+ | `@graphorin/core/types` | Plain TypeScript types: `Message`, `AgentEvent`, `WorkflowEvent`, `RunContext`, `RunState`, `Usage`, … |
34
+ | `@graphorin/core/contracts` | Interfaces consumed by other `@graphorin/*` packages: `Provider`, `MemoryStore`, `Tracer`, `Sandbox`, … |
35
+ | `@graphorin/core/utils` | Tiny dependency-free helpers: `collect`, `mapStream`, `merge`, `withSignal`, `md5`, `xxhash`, … |
36
+ | `@graphorin/core/channels`| Workflow channel types: `LatestValue`, `Reducer`, `Stream`, `Barrier`, `Ephemeral`, `AnyValue`. |
37
+
38
+ ## Naming notes
39
+
40
+ - The workflow primitive set in `@graphorin/core/channels` is **Graphorin's
41
+ own design**: `Directive` for control flow, `Dispatch` for dynamic tasks,
42
+ `pause(value)` for programmatic suspension, plus the channel kinds
43
+ `LatestValue`, `Reducer`, `Stream`, `Barrier`, `Ephemeral`, `AnyValue`.
44
+ These names are part of the public API and must not be aliased to terms
45
+ from other workflow libraries (a dedicated lint rule lands later in the
46
+ release).
47
+ - `SecretValue` is exposed here as an **interface**, not a class: the runtime
48
+ implementation lives in `@graphorin/security`. Downstream packages typing
49
+ parameters as `SecretValue` therefore depend only on `@graphorin/core`.
50
+
51
+ ## Stability
52
+
53
+ Every exported type is annotated with one of two TSDoc tags:
54
+
55
+ - `@stable` — covered by semver guarantees for the `v0.x` line.
56
+ - `@experimental` — may change between minor versions; a deprecation note
57
+ in the `CHANGELOG.md` will accompany every removal.
58
+
59
+ The vast majority of the surface ships as `@stable`; the deliberately
60
+ loose `@experimental` corners exist because their underlying decision
61
+ records are still being refined for v0.2.
62
+
63
+ ## Versioning
64
+
65
+ `@graphorin/core` follows the same lockstep release as the rest of the
66
+ `@graphorin/*` packages while the framework is on the `0.x` line.
67
+
68
+ ---
69
+
70
+ **Graphorin** · v0.5.0 · MIT License · © 2026 Oleksiy Stepurenko · <https://github.com/o-stepper/graphorin>
@@ -0,0 +1,156 @@
1
+ //#region src/channels/channels.d.ts
2
+ /**
3
+ * Workflow channel kinds. Every state field declared on a workflow's
4
+ * `stateSchema` is bound to a channel that decides the merge strategy
5
+ * applied when multiple writers update the same field within a single
6
+ * execution step.
7
+ *
8
+ * The names are **Graphorin's own design** and must not be aliased to
9
+ * terms from other workflow libraries. A dedicated lint rule lands later
10
+ * in the release line to enforce this.
11
+ *
12
+ * @stable
13
+ */
14
+ type ChannelKind = 'latest-value' | 'any-value' | 'reducer' | 'list-aggregate' | 'stream' | 'barrier' | 'ephemeral';
15
+ /**
16
+ * Discriminated union of every channel descriptor.
17
+ *
18
+ * Channels are a *description* of the merge strategy, not a runtime
19
+ * value: the engine reads the `kind` field plus optional auxiliary
20
+ * fields (`reduce`, `from`, `unique`) to decide how to combine writes.
21
+ *
22
+ * @stable
23
+ */
24
+ type Channel<T = unknown> = LatestValue<T> | AnyValue<T> | Reducer<T> | ListAggregate<T> | Stream<T> | Barrier<T> | Ephemeral<T>;
25
+ /**
26
+ * Overwrite-on-write. Multiple writes within the same execution step
27
+ * raise `MultiWriteError` (use `AnyValue` if collisions are acceptable).
28
+ *
29
+ * @stable
30
+ */
31
+ interface LatestValue<T = unknown> {
32
+ readonly kind: 'latest-value';
33
+ readonly default?: T;
34
+ }
35
+ /**
36
+ * Overwrite-on-write — collisions are silently allowed (last-write-wins
37
+ * semantics within a step).
38
+ *
39
+ * @stable
40
+ */
41
+ interface AnyValue<T = unknown> {
42
+ readonly kind: 'any-value';
43
+ readonly default?: T;
44
+ }
45
+ /**
46
+ * Fold writes via a user-provided `reduce` function. The reducer is
47
+ * invoked left-to-right over the writes collected within an execution
48
+ * step.
49
+ *
50
+ * @stable
51
+ */
52
+ interface Reducer<T = unknown> {
53
+ readonly kind: 'reducer';
54
+ readonly default?: T;
55
+ readonly reduce: (prev: T, next: T) => T;
56
+ }
57
+ /**
58
+ * Specialization of `Reducer<T[]>` that appends each write to a list.
59
+ *
60
+ * @stable
61
+ */
62
+ interface ListAggregate<T = unknown> {
63
+ readonly kind: 'list-aggregate';
64
+ readonly default?: ReadonlyArray<T>;
65
+ }
66
+ /**
67
+ * Append-only queue. Used for dynamic task creation via `Dispatch(...)`
68
+ * and for application-defined event streams.
69
+ *
70
+ * @stable
71
+ */
72
+ interface Stream<T = unknown> {
73
+ readonly kind: 'stream';
74
+ readonly unique?: boolean;
75
+ readonly default?: ReadonlyArray<T>;
76
+ }
77
+ /**
78
+ * Barrier — completes when every writer in `from` has produced a value.
79
+ *
80
+ * @stable
81
+ */
82
+ interface Barrier<T = unknown> {
83
+ readonly kind: 'barrier';
84
+ readonly from: ReadonlyArray<string>;
85
+ readonly default?: T;
86
+ }
87
+ /**
88
+ * Value scoped to a single execution step — discarded when the step
89
+ * ends.
90
+ *
91
+ * @stable
92
+ */
93
+ interface Ephemeral<T = unknown> {
94
+ readonly kind: 'ephemeral';
95
+ readonly default?: T;
96
+ }
97
+ /**
98
+ * Construct a `LatestValue` channel.
99
+ *
100
+ * @stable
101
+ */
102
+ declare function latestValue<T>(opts?: {
103
+ readonly default?: T;
104
+ }): LatestValue<T>;
105
+ /**
106
+ * Construct an `AnyValue` channel.
107
+ *
108
+ * @stable
109
+ */
110
+ declare function anyValue<T>(opts?: {
111
+ readonly default?: T;
112
+ }): AnyValue<T>;
113
+ /**
114
+ * Construct a `Reducer` channel.
115
+ *
116
+ * @stable
117
+ */
118
+ declare function reducer<T>(reduce: (prev: T, next: T) => T, opts?: {
119
+ readonly default?: T;
120
+ }): Reducer<T>;
121
+ /**
122
+ * Construct a `ListAggregate` channel.
123
+ *
124
+ * @stable
125
+ */
126
+ declare function listAggregate<T>(opts?: {
127
+ readonly default?: ReadonlyArray<T>;
128
+ }): ListAggregate<T>;
129
+ /**
130
+ * Construct a `Stream` channel.
131
+ *
132
+ * @stable
133
+ */
134
+ declare function stream<T>(opts?: {
135
+ readonly unique?: boolean;
136
+ readonly default?: ReadonlyArray<T>;
137
+ }): Stream<T>;
138
+ /**
139
+ * Construct a `Barrier` channel.
140
+ *
141
+ * @stable
142
+ */
143
+ declare function barrier<T>(from: ReadonlyArray<string>, opts?: {
144
+ readonly default?: T;
145
+ }): Barrier<T>;
146
+ /**
147
+ * Construct an `Ephemeral` channel.
148
+ *
149
+ * @stable
150
+ */
151
+ declare function ephemeral<T>(opts?: {
152
+ readonly default?: T;
153
+ }): Ephemeral<T>;
154
+ //#endregion
155
+ export { AnyValue, Barrier, Channel, ChannelKind, Ephemeral, LatestValue, ListAggregate, Reducer, Stream, anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream };
156
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","names":[],"sources":["../../src/channels/channels.ts"],"sourcesContent":[],"mappings":";;AAYA;AAkBA;;;;;;;;;;AAKI,KAvBQ,WAAA,GAuBR,cAAA,GAAA,WAAA,GAAA,SAAA,GAAA,gBAAA,GAAA,QAAA,GAAA,SAAA,GAAA,WAAA;;;;;;AAUJ;AAWA;AAYA;;AAG0B,KAzCd,OAyCc,CAAA,IAAA,OAAA,CAAA,GAxCtB,WAwCsB,CAxCV,CAwCU,CAAA,GAvCtB,QAuCsB,CAvCb,CAuCa,CAAA,GAtCtB,OAsCsB,CAtCd,CAsCc,CAAA,GArCtB,aAqCsB,CArCR,CAqCQ,CAAA,GApCtB,MAoCsB,CApCf,CAoCe,CAAA,GAnCtB,OAmCsB,CAnCd,CAmCc,CAAA,GAlCtB,SAkCsB,CAlCZ,CAkCY,CAAA;;;;AAQ1B;AAWA;AAWA;AAYiB,UApEA,WAoES,CAAA,IAEJ,OAAA,CAAA,CAAA;EAQN,SAAA,IAAA,EAAW,cAAA;EAAgC,SAAA,OAAA,CAAA,EA5EtC,CA4EsC;;;;AAW3D;;;;AAAsE,UA9ErD,QA8EqD,CAAA,IAAA,OAAA,CAAA,CAAA;EAWtD,SAAA,IAAO,EAAA,WAAA;EACN,SAAA,OAAA,CAAA,EAxFI,CAwFJ;;;;;;;AAajB;;AAA6D,UA3F5C,OA2F4C,CAAA,IAAA,OAAA,CAAA,CAAA;EAAmC,SAAA,IAAA,EAAA,SAAA;EAAd,SAAA,OAAA,CAAA,EAzF7D,CAyF6D;EAAa,SAAA,MAAA,EAAA,CAAA,IAAA,EAxFrE,CAwFqE,EAAA,IAAA,EAxF5D,CAwF4D,EAAA,GAxFtD,CAwFsD;AAW/F;;;;;;AAiBgB,UA5GC,aA4GM,CAAA,IAAA,OAAA,CAAA,CAAA;EACf,SAAA,IAAA,EAAA,gBAAA;EACsB,SAAA,OAAA,CAAA,EA5GT,aA4GS,CA5GK,CA4GL,CAAA;;;;AAY9B;;;;AAAwE,UA/GvD,MA+GuD,CAAA,IAAA,OAAA,CAAA,CAAA;;;qBA5GnD,cAAc;;;;;;;UAQlB;;iBAEA;qBACI;;;;;;;;UASJ;;qBAEI;;;;;;;iBAQL;qBAA2C;IAAM,YAAY;;;;;;iBAW7D;qBAAwC;IAAM,SAAS;;;;;;iBAWvD,0BACC,SAAS,MAAM;qBACF;IAC3B,QAAQ;;;;;;iBAWK;qBAA6C,cAAc;IAAO,cAAc;;;;;;iBAWhF;;qBAEK,cAAc;IAC/B,OAAO;;;;;;iBAcK,iBACR;qBACsB;IAC3B,QAAQ;;;;;;iBAWK;qBAAyC;IAAM,UAAU"}
@@ -0,0 +1,90 @@
1
+ //#region src/channels/channels.ts
2
+ /**
3
+ * Construct a `LatestValue` channel.
4
+ *
5
+ * @stable
6
+ */
7
+ function latestValue(opts) {
8
+ return opts !== void 0 && "default" in opts && opts.default !== void 0 ? {
9
+ kind: "latest-value",
10
+ default: opts.default
11
+ } : { kind: "latest-value" };
12
+ }
13
+ /**
14
+ * Construct an `AnyValue` channel.
15
+ *
16
+ * @stable
17
+ */
18
+ function anyValue(opts) {
19
+ return opts !== void 0 && "default" in opts && opts.default !== void 0 ? {
20
+ kind: "any-value",
21
+ default: opts.default
22
+ } : { kind: "any-value" };
23
+ }
24
+ /**
25
+ * Construct a `Reducer` channel.
26
+ *
27
+ * @stable
28
+ */
29
+ function reducer(reduce, opts) {
30
+ return opts !== void 0 && "default" in opts && opts.default !== void 0 ? {
31
+ kind: "reducer",
32
+ reduce,
33
+ default: opts.default
34
+ } : {
35
+ kind: "reducer",
36
+ reduce
37
+ };
38
+ }
39
+ /**
40
+ * Construct a `ListAggregate` channel.
41
+ *
42
+ * @stable
43
+ */
44
+ function listAggregate(opts) {
45
+ return opts !== void 0 && "default" in opts && opts.default !== void 0 ? {
46
+ kind: "list-aggregate",
47
+ default: opts.default
48
+ } : { kind: "list-aggregate" };
49
+ }
50
+ /**
51
+ * Construct a `Stream` channel.
52
+ *
53
+ * @stable
54
+ */
55
+ function stream(opts) {
56
+ const out = { kind: "stream" };
57
+ if (opts?.unique !== void 0) out.unique = opts.unique;
58
+ if (opts?.default !== void 0) out.default = opts.default;
59
+ return out;
60
+ }
61
+ /**
62
+ * Construct a `Barrier` channel.
63
+ *
64
+ * @stable
65
+ */
66
+ function barrier(from, opts) {
67
+ return opts !== void 0 && "default" in opts && opts.default !== void 0 ? {
68
+ kind: "barrier",
69
+ from,
70
+ default: opts.default
71
+ } : {
72
+ kind: "barrier",
73
+ from
74
+ };
75
+ }
76
+ /**
77
+ * Construct an `Ephemeral` channel.
78
+ *
79
+ * @stable
80
+ */
81
+ function ephemeral(opts) {
82
+ return opts !== void 0 && "default" in opts && opts.default !== void 0 ? {
83
+ kind: "ephemeral",
84
+ default: opts.default
85
+ } : { kind: "ephemeral" };
86
+ }
87
+
88
+ //#endregion
89
+ export { anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream };
90
+ //# sourceMappingURL=channels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.js","names":["out: { kind: 'stream'; unique?: boolean; default?: ReadonlyArray<T> }"],"sources":["../../src/channels/channels.ts"],"sourcesContent":["/**\n * Workflow channel kinds. Every state field declared on a workflow's\n * `stateSchema` is bound to a channel that decides the merge strategy\n * applied when multiple writers update the same field within a single\n * execution step.\n *\n * The names are **Graphorin's own design** and must not be aliased to\n * terms from other workflow libraries. A dedicated lint rule lands later\n * in the release line to enforce this.\n *\n * @stable\n */\nexport type ChannelKind =\n | 'latest-value'\n | 'any-value'\n | 'reducer'\n | 'list-aggregate'\n | 'stream'\n | 'barrier'\n | 'ephemeral';\n\n/**\n * Discriminated union of every channel descriptor.\n *\n * Channels are a *description* of the merge strategy, not a runtime\n * value: the engine reads the `kind` field plus optional auxiliary\n * fields (`reduce`, `from`, `unique`) to decide how to combine writes.\n *\n * @stable\n */\nexport type Channel<T = unknown> =\n | LatestValue<T>\n | AnyValue<T>\n | Reducer<T>\n | ListAggregate<T>\n | Stream<T>\n | Barrier<T>\n | Ephemeral<T>;\n\n/**\n * Overwrite-on-write. Multiple writes within the same execution step\n * raise `MultiWriteError` (use `AnyValue` if collisions are acceptable).\n *\n * @stable\n */\nexport interface LatestValue<T = unknown> {\n readonly kind: 'latest-value';\n readonly default?: T;\n}\n\n/**\n * Overwrite-on-write — collisions are silently allowed (last-write-wins\n * semantics within a step).\n *\n * @stable\n */\nexport interface AnyValue<T = unknown> {\n readonly kind: 'any-value';\n readonly default?: T;\n}\n\n/**\n * Fold writes via a user-provided `reduce` function. The reducer is\n * invoked left-to-right over the writes collected within an execution\n * step.\n *\n * @stable\n */\nexport interface Reducer<T = unknown> {\n readonly kind: 'reducer';\n readonly default?: T;\n readonly reduce: (prev: T, next: T) => T;\n}\n\n/**\n * Specialization of `Reducer<T[]>` that appends each write to a list.\n *\n * @stable\n */\nexport interface ListAggregate<T = unknown> {\n readonly kind: 'list-aggregate';\n readonly default?: ReadonlyArray<T>;\n}\n\n/**\n * Append-only queue. Used for dynamic task creation via `Dispatch(...)`\n * and for application-defined event streams.\n *\n * @stable\n */\nexport interface Stream<T = unknown> {\n readonly kind: 'stream';\n readonly unique?: boolean;\n readonly default?: ReadonlyArray<T>;\n}\n\n/**\n * Barrier — completes when every writer in `from` has produced a value.\n *\n * @stable\n */\nexport interface Barrier<T = unknown> {\n readonly kind: 'barrier';\n readonly from: ReadonlyArray<string>;\n readonly default?: T;\n}\n\n/**\n * Value scoped to a single execution step — discarded when the step\n * ends.\n *\n * @stable\n */\nexport interface Ephemeral<T = unknown> {\n readonly kind: 'ephemeral';\n readonly default?: T;\n}\n\n/**\n * Construct a `LatestValue` channel.\n *\n * @stable\n */\nexport function latestValue<T>(opts?: { readonly default?: T }): LatestValue<T> {\n return opts !== undefined && 'default' in opts && opts.default !== undefined\n ? { kind: 'latest-value', default: opts.default }\n : { kind: 'latest-value' };\n}\n\n/**\n * Construct an `AnyValue` channel.\n *\n * @stable\n */\nexport function anyValue<T>(opts?: { readonly default?: T }): AnyValue<T> {\n return opts !== undefined && 'default' in opts && opts.default !== undefined\n ? { kind: 'any-value', default: opts.default }\n : { kind: 'any-value' };\n}\n\n/**\n * Construct a `Reducer` channel.\n *\n * @stable\n */\nexport function reducer<T>(\n reduce: (prev: T, next: T) => T,\n opts?: { readonly default?: T },\n): Reducer<T> {\n return opts !== undefined && 'default' in opts && opts.default !== undefined\n ? { kind: 'reducer', reduce, default: opts.default }\n : { kind: 'reducer', reduce };\n}\n\n/**\n * Construct a `ListAggregate` channel.\n *\n * @stable\n */\nexport function listAggregate<T>(opts?: { readonly default?: ReadonlyArray<T> }): ListAggregate<T> {\n return opts !== undefined && 'default' in opts && opts.default !== undefined\n ? { kind: 'list-aggregate', default: opts.default }\n : { kind: 'list-aggregate' };\n}\n\n/**\n * Construct a `Stream` channel.\n *\n * @stable\n */\nexport function stream<T>(opts?: {\n readonly unique?: boolean;\n readonly default?: ReadonlyArray<T>;\n}): Stream<T> {\n const out: { kind: 'stream'; unique?: boolean; default?: ReadonlyArray<T> } = {\n kind: 'stream',\n };\n if (opts?.unique !== undefined) out.unique = opts.unique;\n if (opts?.default !== undefined) out.default = opts.default;\n return out;\n}\n\n/**\n * Construct a `Barrier` channel.\n *\n * @stable\n */\nexport function barrier<T>(\n from: ReadonlyArray<string>,\n opts?: { readonly default?: T },\n): Barrier<T> {\n return opts !== undefined && 'default' in opts && opts.default !== undefined\n ? { kind: 'barrier', from, default: opts.default }\n : { kind: 'barrier', from };\n}\n\n/**\n * Construct an `Ephemeral` channel.\n *\n * @stable\n */\nexport function ephemeral<T>(opts?: { readonly default?: T }): Ephemeral<T> {\n return opts !== undefined && 'default' in opts && opts.default !== undefined\n ? { kind: 'ephemeral', default: opts.default }\n : { kind: 'ephemeral' };\n}\n"],"mappings":";;;;;;AA2HA,SAAgB,YAAe,MAAiD;AAC9E,QAAO,SAAS,UAAa,aAAa,QAAQ,KAAK,YAAY,SAC/D;EAAE,MAAM;EAAgB,SAAS,KAAK;EAAS,GAC/C,EAAE,MAAM,gBAAgB;;;;;;;AAQ9B,SAAgB,SAAY,MAA8C;AACxE,QAAO,SAAS,UAAa,aAAa,QAAQ,KAAK,YAAY,SAC/D;EAAE,MAAM;EAAa,SAAS,KAAK;EAAS,GAC5C,EAAE,MAAM,aAAa;;;;;;;AAQ3B,SAAgB,QACd,QACA,MACY;AACZ,QAAO,SAAS,UAAa,aAAa,QAAQ,KAAK,YAAY,SAC/D;EAAE,MAAM;EAAW;EAAQ,SAAS,KAAK;EAAS,GAClD;EAAE,MAAM;EAAW;EAAQ;;;;;;;AAQjC,SAAgB,cAAiB,MAAkE;AACjG,QAAO,SAAS,UAAa,aAAa,QAAQ,KAAK,YAAY,SAC/D;EAAE,MAAM;EAAkB,SAAS,KAAK;EAAS,GACjD,EAAE,MAAM,kBAAkB;;;;;;;AAQhC,SAAgB,OAAU,MAGZ;CACZ,MAAMA,MAAwE,EAC5E,MAAM,UACP;AACD,KAAI,MAAM,WAAW,OAAW,KAAI,SAAS,KAAK;AAClD,KAAI,MAAM,YAAY,OAAW,KAAI,UAAU,KAAK;AACpD,QAAO;;;;;;;AAQT,SAAgB,QACd,MACA,MACY;AACZ,QAAO,SAAS,UAAa,aAAa,QAAQ,KAAK,YAAY,SAC/D;EAAE,MAAM;EAAW;EAAM,SAAS,KAAK;EAAS,GAChD;EAAE,MAAM;EAAW;EAAM;;;;;;;AAQ/B,SAAgB,UAAa,MAA+C;AAC1E,QAAO,SAAS,UAAa,aAAa,QAAQ,KAAK,YAAY,SAC/D;EAAE,MAAM;EAAa,SAAS,KAAK;EAAS,GAC5C,EAAE,MAAM,aAAa"}
@@ -0,0 +1,34 @@
1
+ //#region src/channels/directive.d.ts
2
+ /**
3
+ * Workflow control-flow primitive: a single value handed to
4
+ * `Workflow.resume(threadId, directive?)` (or returned from a node's
5
+ * `pause(...)` resolution) carrying any combination of:
6
+ *
7
+ * - `goto` — jump to a named node, bypassing the edge graph.
8
+ * - `resume` — value supplied to the `pause(value)` call that suspended.
9
+ * - `update` — additional channel writes applied before the next step.
10
+ *
11
+ * The shape is **Graphorin's own design** (the name `Directive` is part
12
+ * of the public API).
13
+ *
14
+ * @stable
15
+ */
16
+ declare class Directive<TUpdate = Record<string, unknown>, TResume = unknown> {
17
+ readonly goto?: string;
18
+ readonly resume?: TResume;
19
+ readonly update?: TUpdate;
20
+ constructor(opts: DirectiveOptions<TUpdate, TResume>);
21
+ }
22
+ /**
23
+ * Constructor parameters for `Directive`.
24
+ *
25
+ * @stable
26
+ */
27
+ interface DirectiveOptions<TUpdate = Record<string, unknown>, TResume = unknown> {
28
+ readonly goto?: string;
29
+ readonly resume?: TResume;
30
+ readonly update?: TUpdate;
31
+ }
32
+ //#endregion
33
+ export { Directive, DirectiveOptions };
34
+ //# sourceMappingURL=directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive.d.ts","names":[],"sources":["../../src/channels/directive.ts"],"sourcesContent":[],"mappings":";;AAcA;;;;;;;;AAiBA;;;;;cAjBa,oBAAoB;;oBAEb;oBACA;oBAEA,iBAAiB,SAAS;;;;;;;UAY7B,2BAA2B;;oBAExB;oBACA"}
@@ -0,0 +1,29 @@
1
+ //#region src/channels/directive.ts
2
+ /**
3
+ * Workflow control-flow primitive: a single value handed to
4
+ * `Workflow.resume(threadId, directive?)` (or returned from a node's
5
+ * `pause(...)` resolution) carrying any combination of:
6
+ *
7
+ * - `goto` — jump to a named node, bypassing the edge graph.
8
+ * - `resume` — value supplied to the `pause(value)` call that suspended.
9
+ * - `update` — additional channel writes applied before the next step.
10
+ *
11
+ * The shape is **Graphorin's own design** (the name `Directive` is part
12
+ * of the public API).
13
+ *
14
+ * @stable
15
+ */
16
+ var Directive = class {
17
+ goto;
18
+ resume;
19
+ update;
20
+ constructor(opts) {
21
+ if (opts.goto !== void 0) this.goto = opts.goto;
22
+ if ("resume" in opts && opts.resume !== void 0) this.resume = opts.resume;
23
+ if (opts.update !== void 0) this.update = opts.update;
24
+ }
25
+ };
26
+
27
+ //#endregion
28
+ export { Directive };
29
+ //# sourceMappingURL=directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive.js","names":[],"sources":["../../src/channels/directive.ts"],"sourcesContent":["/**\n * Workflow control-flow primitive: a single value handed to\n * `Workflow.resume(threadId, directive?)` (or returned from a node's\n * `pause(...)` resolution) carrying any combination of:\n *\n * - `goto` — jump to a named node, bypassing the edge graph.\n * - `resume` — value supplied to the `pause(value)` call that suspended.\n * - `update` — additional channel writes applied before the next step.\n *\n * The shape is **Graphorin's own design** (the name `Directive` is part\n * of the public API).\n *\n * @stable\n */\nexport class Directive<TUpdate = Record<string, unknown>, TResume = unknown> {\n readonly goto?: string;\n readonly resume?: TResume;\n readonly update?: TUpdate;\n\n constructor(opts: DirectiveOptions<TUpdate, TResume>) {\n if (opts.goto !== undefined) this.goto = opts.goto;\n if ('resume' in opts && opts.resume !== undefined) this.resume = opts.resume;\n if (opts.update !== undefined) this.update = opts.update;\n }\n}\n\n/**\n * Constructor parameters for `Directive`.\n *\n * @stable\n */\nexport interface DirectiveOptions<TUpdate = Record<string, unknown>, TResume = unknown> {\n readonly goto?: string;\n readonly resume?: TResume;\n readonly update?: TUpdate;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAa,YAAb,MAA6E;CAC3E,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,MAA0C;AACpD,MAAI,KAAK,SAAS,OAAW,MAAK,OAAO,KAAK;AAC9C,MAAI,YAAY,QAAQ,KAAK,WAAW,OAAW,MAAK,SAAS,KAAK;AACtE,MAAI,KAAK,WAAW,OAAW,MAAK,SAAS,KAAK"}
@@ -0,0 +1,26 @@
1
+ //#region src/channels/dispatch.d.ts
2
+ /**
3
+ * Workflow dynamic-task primitive. A node returns one or more
4
+ * `Dispatch(nodeName, args)` values to schedule additional tasks in the
5
+ * next execution step.
6
+ *
7
+ * The class is intentionally tiny — the engine inspects only the public
8
+ * `nodeName` and `args` fields. The shape is **Graphorin's own design**
9
+ * (the name `Dispatch` is part of the public API).
10
+ *
11
+ * @stable
12
+ */
13
+ declare class Dispatch<TArgs = unknown> {
14
+ readonly nodeName: string;
15
+ readonly args: TArgs;
16
+ constructor(nodeName: string, args: TArgs);
17
+ }
18
+ /**
19
+ * Convenience factory equivalent to `new Dispatch(nodeName, args)`.
20
+ *
21
+ * @stable
22
+ */
23
+ declare function dispatch<TArgs>(nodeName: string, args: TArgs): Dispatch<TArgs>;
24
+ //#endregion
25
+ export { Dispatch, dispatch };
26
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.d.ts","names":[],"sources":["../../src/channels/dispatch.ts"],"sourcesContent":[],"mappings":";;AAWA;AAeA;;;;;;;;;cAfa;;iBAEI;sCAEqB;;;;;;;iBAWtB,wCAAwC,QAAQ,SAAS"}
@@ -0,0 +1,32 @@
1
+ //#region src/channels/dispatch.ts
2
+ /**
3
+ * Workflow dynamic-task primitive. A node returns one or more
4
+ * `Dispatch(nodeName, args)` values to schedule additional tasks in the
5
+ * next execution step.
6
+ *
7
+ * The class is intentionally tiny — the engine inspects only the public
8
+ * `nodeName` and `args` fields. The shape is **Graphorin's own design**
9
+ * (the name `Dispatch` is part of the public API).
10
+ *
11
+ * @stable
12
+ */
13
+ var Dispatch = class {
14
+ nodeName;
15
+ args;
16
+ constructor(nodeName, args) {
17
+ this.nodeName = nodeName;
18
+ this.args = args;
19
+ }
20
+ };
21
+ /**
22
+ * Convenience factory equivalent to `new Dispatch(nodeName, args)`.
23
+ *
24
+ * @stable
25
+ */
26
+ function dispatch(nodeName, args) {
27
+ return new Dispatch(nodeName, args);
28
+ }
29
+
30
+ //#endregion
31
+ export { Dispatch, dispatch };
32
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","names":[],"sources":["../../src/channels/dispatch.ts"],"sourcesContent":["/**\n * Workflow dynamic-task primitive. A node returns one or more\n * `Dispatch(nodeName, args)` values to schedule additional tasks in the\n * next execution step.\n *\n * The class is intentionally tiny — the engine inspects only the public\n * `nodeName` and `args` fields. The shape is **Graphorin's own design**\n * (the name `Dispatch` is part of the public API).\n *\n * @stable\n */\nexport class Dispatch<TArgs = unknown> {\n readonly nodeName: string;\n readonly args: TArgs;\n\n constructor(nodeName: string, args: TArgs) {\n this.nodeName = nodeName;\n this.args = args;\n }\n}\n\n/**\n * Convenience factory equivalent to `new Dispatch(nodeName, args)`.\n *\n * @stable\n */\nexport function dispatch<TArgs>(nodeName: string, args: TArgs): Dispatch<TArgs> {\n return new Dispatch(nodeName, args);\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAa,WAAb,MAAuC;CACrC,AAAS;CACT,AAAS;CAET,YAAY,UAAkB,MAAa;AACzC,OAAK,WAAW;AAChB,OAAK,OAAO;;;;;;;;AAShB,SAAgB,SAAgB,UAAkB,MAA8B;AAC9E,QAAO,IAAI,SAAS,UAAU,KAAK"}
@@ -0,0 +1,5 @@
1
+ import { AnyValue, Barrier, Channel, ChannelKind, Ephemeral, LatestValue, ListAggregate, Reducer, Stream, anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream } from "./channels.js";
2
+ import { Directive, DirectiveOptions } from "./directive.js";
3
+ import { Dispatch, dispatch } from "./dispatch.js";
4
+ import { PAUSE_SIGNAL_BRAND, PauseResumeScope, PauseSignal, isPauseSignal, pause, runWithPauseResume } from "./pause.js";
5
+ export { type AnyValue, type Barrier, type Channel, type ChannelKind, Directive, type DirectiveOptions, Dispatch, type Ephemeral, type LatestValue, type ListAggregate, PAUSE_SIGNAL_BRAND, type PauseResumeScope, PauseSignal, type Reducer, type Stream, anyValue, barrier, dispatch, ephemeral, isPauseSignal, latestValue, listAggregate, pause, reducer, runWithPauseResume, stream };
@@ -0,0 +1,6 @@
1
+ import { anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream } from "./channels.js";
2
+ import { Directive } from "./directive.js";
3
+ import { Dispatch, dispatch } from "./dispatch.js";
4
+ import { PAUSE_SIGNAL_BRAND, PauseSignal, isPauseSignal, pause, runWithPauseResume } from "./pause.js";
5
+
6
+ export { Directive, Dispatch, PAUSE_SIGNAL_BRAND, PauseSignal, anyValue, barrier, dispatch, ephemeral, isPauseSignal, latestValue, listAggregate, pause, reducer, runWithPauseResume, stream };
@@ -0,0 +1,84 @@
1
+ //#region src/channels/pause.d.ts
2
+ /**
3
+ * Brand attached to the signal thrown by `pause(value)` so that the
4
+ * workflow runtime can recognise it across realms (Worker threads,
5
+ * sandboxes, …) without `instanceof`.
6
+ *
7
+ * @stable
8
+ */
9
+ declare const PAUSE_SIGNAL_BRAND: unique symbol;
10
+ /**
11
+ * Thrown by `pause(value)` from inside a workflow node. The runtime
12
+ * catches it, persists state with a pending pause, and suspends the
13
+ * thread until `Workflow.resume(threadId, directive)` is called.
14
+ *
15
+ * Application code should never construct or catch this directly —
16
+ * always go through `pause(...)`.
17
+ *
18
+ * @stable
19
+ */
20
+ declare class PauseSignal<TValue = unknown> extends Error {
21
+ readonly [PAUSE_SIGNAL_BRAND]: true;
22
+ readonly value: TValue;
23
+ constructor(value: TValue);
24
+ }
25
+ /**
26
+ * Resume-injection scope set by the workflow runtime around the second
27
+ * (and later) invocations of a paused node body. When the scope is
28
+ * present, `pause(...)` consults it to decide whether to throw a fresh
29
+ * {@link PauseSignal} or return the injected value the runtime supplied
30
+ * via `Workflow.resume(threadId, new Directive({ resume }))`.
31
+ *
32
+ * This is the storage mechanism that gives `pause()` its symmetric
33
+ * pair semantics (`pause` ↔ `resume`) without forcing every node body
34
+ * to be re-architected as a state machine.
35
+ *
36
+ * @internal
37
+ */
38
+ interface PauseResumeScope {
39
+ /** Ordered resume values replayed to successive `pause()` calls (WF-2). */
40
+ readonly values: ReadonlyArray<unknown>;
41
+ cursor: number;
42
+ }
43
+ /**
44
+ * Run `fn` inside a scope where successive `pause(...)` calls return the
45
+ * supplied `values` in order instead of throwing a fresh
46
+ * {@link PauseSignal} (WF-2: a node body re-executes from the top on
47
+ * every resume, so earlier pauses must replay their already-delivered
48
+ * values and only the FIRST unsatisfied `pause()` suspends again). An
49
+ * empty `values` array behaves exactly like no scope — every `pause()`
50
+ * suspends — which is what a static-gate resume needs so a programmatic
51
+ * `pause()` inside the node is never silently satisfied.
52
+ *
53
+ * This helper is the contract between the runtime and `pause(...)`.
54
+ * Consumers of `pause(...)` never call it directly — only the workflow
55
+ * engine wires it up around the resumed node body.
56
+ *
57
+ * @internal
58
+ */
59
+ declare function runWithPauseResume<R>(values: ReadonlyArray<unknown>, fn: () => R | Promise<R>): Promise<R>;
60
+ /**
61
+ * Programmatically suspend the current workflow node. The `value` is
62
+ * surfaced to callers via the `WorkflowSuspendedEvent.value` field; the
63
+ * eventual `Directive({ resume })` is delivered as the return value of
64
+ * this call once the runtime resumes the thread.
65
+ *
66
+ * Implementation note: when the call is made outside a runtime-managed
67
+ * resume scope, `pause(...)` throws a fresh {@link PauseSignal} so the
68
+ * engine can catch it, persist state, and suspend. When the runtime
69
+ * later resumes the node body, it wraps the second invocation in
70
+ * {@link runWithPauseResume}, which causes the same `pause(...)` call to
71
+ * return the operator-supplied resume value instead of throwing.
72
+ *
73
+ * @stable
74
+ */
75
+ declare function pause<TValue, TResume = unknown>(value: TValue): TResume;
76
+ /**
77
+ * Cross-realm safe type guard for `PauseSignal`.
78
+ *
79
+ * @stable
80
+ */
81
+ declare function isPauseSignal(err: unknown): err is PauseSignal;
82
+ //#endregion
83
+ export { PAUSE_SIGNAL_BRAND, PauseResumeScope, PauseSignal, isPauseSignal, pause, runWithPauseResume };
84
+ //# sourceMappingURL=pause.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pause.d.ts","names":[],"sources":["../../src/channels/pause.ts"],"sourcesContent":[],"mappings":";;AASA;AAYA;;;;;AAAwD,cAZ3C,kBAY2C,EAAA,OAAA,MAAA;AAwBxD;AAwBA;;;;;;;;AAuBA;AAegB,cAtFH,WAsFgB,CAAuB,SAAA,OAAW,CAAA,SAtFZ,KAAA,CAsFY;YArFnD,kBAAA;kBACM;qBAEG;;;;;;;;;;;;;;;UAoBJ,gBAAA;;mBAEE;;;;;;;;;;;;;;;;;;;iBAsBH,8BACN,kCACE,IAAI,QAAQ,KACrB,QAAQ;;;;;;;;;;;;;;;;iBAoBK,wCAAwC,SAAS;;;;;;iBAejD,aAAA,uBAAoC"}