effect-durable-agent 0.1.0-alpha.1 → 0.1.0-alpha.4
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/CHANGELOG.md +25 -1
- package/README.md +131 -128
- package/SECURITY.md +3 -4
- package/dist/{command-queues-CQ9cwRP7.d.ts → command-queues-CV7O-51r.d.ts} +7 -6
- package/dist/{compaction-YayFKo_1.d.ts → compaction-zbvLREI8.d.ts} +8 -6
- package/dist/context-projection-n6Rdup0N.d.ts +140 -0
- package/dist/{core-Hv3cFydL.d.ts → core-CYT6DBaS.d.ts} +2 -2
- package/dist/domain/command-queues.d.ts +1 -1
- package/dist/domain/context-projection.d.ts +2 -0
- package/dist/domain/context-projection.js +32 -0
- package/dist/domain/context-projection.js.map +1 -0
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/reduced-state-schema.d.ts +2 -0
- package/dist/domain/reduced-state-schema.js +2 -1
- package/dist/domain/reduced-state-schema.js.map +1 -1
- package/dist/domain/reduced-state.d.ts +1 -1
- package/dist/domain/reduced-state.js +1 -1
- package/dist/{durable-DlScwmCy.d.ts → durable-B7M6TD_0.d.ts} +341 -2
- package/dist/{durable-C3Rz7kg3.js → durable-DsV9PxZC.js} +13 -2
- package/dist/durable-DsV9PxZC.js.map +1 -0
- package/dist/{keep-alive-DYDsH6qN.d.ts → event-factory-CLJcyymV.d.ts} +5 -29
- package/dist/{keep-alive-p8dIcSVy.js → event-factory-tcpLgdMN.js} +3 -10
- package/dist/event-factory-tcpLgdMN.js.map +1 -0
- package/dist/host/websocket-protocol.d.ts +229 -0
- package/dist/host/websocket-protocol.js +99 -0
- package/dist/host/websocket-protocol.js.map +1 -0
- package/dist/host/websocket-wire.d.ts +2 -2
- package/dist/host/websocket-wire.js +37 -20
- package/dist/host/websocket-wire.js.map +1 -1
- package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-Ckl8_XWW.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/keep-alive-Chl5SJxy.d.ts +29 -0
- package/dist/{message-transcript-BCHdHAe2.d.ts → message-transcript-DiOPBY3l.d.ts} +3 -3
- package/dist/{prompt-projector-9_02lk5-.d.ts → prompt-projector-C1IbkHr0.d.ts} +15 -16
- package/dist/{reduced-state-C4nVVzz9.js → reduced-state-TMi7ISla.js} +20 -4
- package/dist/reduced-state-TMi7ISla.js.map +1 -0
- package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-CjSJBPKo.d.ts} +2 -2
- package/dist/{runtime-C56FQxiL.d.ts → runtime-DOgmAKsO.d.ts} +7 -6
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/compaction.js +4 -3
- package/dist/services/compaction.js.map +1 -1
- package/dist/services/id-generator.d.ts +1 -1
- package/dist/services/keep-alive.d.ts +2 -0
- package/dist/services/keep-alive.js +13 -0
- package/dist/services/keep-alive.js.map +1 -0
- package/dist/services/prompt-projector.d.ts +2 -2
- package/dist/services/prompt-projector.js +20 -10
- package/dist/services/prompt-projector.js.map +1 -1
- package/dist/services/reducer-registry.d.ts +1 -1
- package/dist/services/runtime-layer.d.ts +58 -0
- package/dist/services/runtime-layer.js +42 -0
- package/dist/services/runtime-layer.js.map +1 -0
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +4 -3
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/session-query.d.ts +1 -1
- package/dist/services/session-query.js +76 -1
- package/dist/services/session-query.js.map +1 -0
- package/dist/services/session-state.d.ts +2 -0
- package/dist/services/session-state.js +2 -0
- package/dist/services/session-store.d.ts +2 -2
- package/dist/services/session-store.js +181 -2
- package/dist/services/session-store.js.map +1 -0
- package/dist/services/sink-checkpoint-store.d.ts +2 -0
- package/dist/services/sink-checkpoint-store.js +49 -0
- package/dist/services/sink-checkpoint-store.js.map +1 -0
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/tool-registry.d.ts +1 -1
- package/dist/services/websocket-subscriber.d.ts +54 -0
- package/dist/services/websocket-subscriber.js +190 -0
- package/dist/services/websocket-subscriber.js.map +1 -0
- package/dist/session-query-C-C4m1eq.d.ts +38 -0
- package/dist/{session-query-DlRo5Ufc.d.ts → session-state-CjOSvWbe.d.ts} +132 -40
- package/dist/{session-query-DOc1KanA.js → session-state-SStf0KUo.js} +43 -146
- package/dist/session-state-SStf0KUo.js.map +1 -0
- package/dist/{session-store-D2Ore1QC.d.ts → session-store-DZZUffUy.d.ts} +5 -94
- package/dist/sink-checkpoint-store-BZmQFTRE.d.ts +40 -0
- package/dist/{sink-registry-CIU0LD3m.d.ts → sink-registry-Cf79ICdW.d.ts} +11 -40
- package/dist/{sink-registry-CFC6xjsN.js → sink-registry-D13eUO_c.js} +9 -47
- package/dist/sink-registry-D13eUO_c.js.map +1 -0
- package/dist/testkit/layers.d.ts +14 -11
- package/dist/testkit/layers.js +8 -5
- package/dist/testkit/layers.js.map +1 -1
- package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-B7Wona6N.d.ts} +3 -3
- package/dist/types/core.d.ts +1 -1
- package/dist/types/core.js +1 -1
- package/dist/types/core.js.map +1 -1
- package/dist/types/events/durable.d.ts +2 -2
- package/dist/types/events/durable.js +2 -2
- package/dist/types/events.d.ts +2 -2
- package/dist/types/events.js +2 -2
- package/dist/websocket-wire-QD2SquQE.d.ts +2244 -0
- package/docs/assets/architecture.svg +170 -60
- package/docs/assets/event-sequence.svg +68 -78
- package/docs/assets/hero.svg +33 -0
- package/docs/message-steering.md +1 -1
- package/docs/releasing.md +96 -39
- package/docs/spec.md +15 -12
- package/docs/websocket-protocol.md +35 -9
- package/package.json +55 -35
- package/dist/durable-C3Rz7kg3.js.map +0 -1
- package/dist/durable-object-runtime-B7jwBY2R.js +0 -1494
- package/dist/durable-object-runtime-B7jwBY2R.js.map +0 -1
- package/dist/durable-object-runtime-pWv0ohlz.d.ts +0 -257
- package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
- package/dist/host/durable-object-runtime.d.ts +0 -2
- package/dist/host/durable-object-runtime.js +0 -2
- package/dist/host/durable-object-storage.d.ts +0 -2
- package/dist/host/durable-object-storage.js +0 -0
- package/dist/host/durable-object.d.ts +0 -83
- package/dist/host/durable-object.js +0 -191
- package/dist/host/durable-object.js.map +0 -1
- package/dist/keep-alive-p8dIcSVy.js.map +0 -1
- package/dist/reduced-state-C4nVVzz9.js.map +0 -1
- package/dist/session-query-DOc1KanA.js.map +0 -1
- package/dist/session-store-pYxQW9qh.js +0 -214
- package/dist/session-store-pYxQW9qh.js.map +0 -1
- package/dist/sink-registry-CFC6xjsN.js.map +0 -1
- package/dist/websocket-wire-DvOu_6BJ.d.ts +0 -16773
- package/examples/001-no-tools/README.md +0 -65
- package/examples/001-no-tools/worker.ts +0 -79
- package/examples/002-slack-bridge/README.md +0 -134
- package/examples/002-slack-bridge/events.ts +0 -115
- package/examples/002-slack-bridge/reducer.ts +0 -216
- package/examples/002-slack-bridge/scenario.test.ts +0 -223
- package/examples/002-slack-bridge/sinks.ts +0 -109
- package/examples/002-slack-bridge/worker.ts +0 -140
- package/examples/003-sandbox-lifecycle/README.md +0 -78
- package/examples/003-sandbox-lifecycle/events.ts +0 -203
- package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
- package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
- package/examples/_shared/event-id.ts +0 -12
- package/examples/_shared/http.ts +0 -27
- package/examples/_shared/openai.ts +0 -33
package/docs/releasing.md
CHANGED
|
@@ -1,57 +1,114 @@
|
|
|
1
1
|
# Releasing Effect Durable Agent
|
|
2
2
|
|
|
3
|
-
Releases publish
|
|
4
|
-
`
|
|
3
|
+
Releases publish `effect-durable-agent`, `effect-durable-agent-cloudflare`, and
|
|
4
|
+
`effect-durable-agent-celld` together from the public
|
|
5
|
+
[`advait/effect-durable-agent`](https://github.com/advait/effect-durable-agent) repository. The
|
|
6
|
+
three packages always use the same version, and host packages depend on that exact core version in
|
|
7
|
+
their published manifests.
|
|
5
8
|
|
|
6
|
-
##
|
|
9
|
+
## Current public baseline
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
The current core baseline is `0.1.0-alpha.3`. The `alpha` npm dist-tag resolves to that version;
|
|
12
|
+
`latest` remains on `0.1.0-alpha.1`. The Cloudflare and celld packages are introduced by the next
|
|
13
|
+
lockstep release.
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
4. Confirm that `goguardian/gia` consumes this repository as a submodule pinned to an audited
|
|
14
|
-
commit.
|
|
15
|
+
Do not reuse a published version or create a GitHub release for an older tag: publishing that
|
|
16
|
+
release would run the npm workflow against an immutable registry version. The Git tag alone does
|
|
17
|
+
not trigger the workflow.
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
## One-time trusted-publisher setup
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
npm requires a package to exist before it can be connected to a trusted publisher. The first
|
|
21
|
-
release is therefore a one-time interactive bootstrap:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm install --frozen-lockfile
|
|
25
|
-
pnpm run release:check
|
|
26
|
-
npm publish
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
The package metadata makes the scoped package public and publishes this prerelease under the
|
|
30
|
-
`alpha` tag. This command requires an authenticated npm account with publishing rights and its
|
|
31
|
-
configured two-factor authentication.
|
|
32
|
-
|
|
33
|
-
After `0.1.0-alpha.1` exists, configure its npm trusted publisher:
|
|
21
|
+
Configure the same trusted publisher for each package in its npm package settings:
|
|
34
22
|
|
|
35
23
|
- Provider: GitHub Actions
|
|
36
24
|
- Organization or user: `advait`
|
|
37
25
|
- Repository: `effect-durable-agent`
|
|
38
26
|
- Workflow filename: `publish.yml`
|
|
39
27
|
- Allowed action: `npm publish`
|
|
40
|
-
- Environment: leave blank unless
|
|
28
|
+
- Environment: leave blank unless `.github/workflows/publish.yml` is updated to use one
|
|
41
29
|
|
|
42
|
-
The
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
The two new package names must exist on npm before their trusted-publisher settings are available.
|
|
31
|
+
For the first three-package release only, an authenticated maintainer must run `release:check` and
|
|
32
|
+
then `pnpm run publish:workspace`. Publish all three manifests at the same version, and configure
|
|
33
|
+
the trusted publisher on both new packages immediately after that bootstrap. The publish script is
|
|
34
|
+
idempotent: it verifies and skips an identical artifact already in the registry, but refuses an
|
|
35
|
+
existing version with different bytes. All subsequent versions use the release workflow. Do not
|
|
36
|
+
add a long-lived npm publishing token to the repository.
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
The workflow uses a GitHub-hosted runner, grants `id-token: write`, and runs a recent Node/npm pair.
|
|
39
|
+
npm uses the workflow's short-lived OIDC identity and automatically attaches provenance because
|
|
40
|
+
both the repository and packages are public.
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
After one automated release succeeds, configure npm publishing access to require two-factor
|
|
43
|
+
authentication and disallow tokens, then revoke any automation tokens that are no longer needed.
|
|
44
|
+
See npm's [trusted publishing guide](https://docs.npmjs.com/trusted-publishers/) for the current
|
|
45
|
+
registry requirements.
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
## Release channels
|
|
48
|
+
|
|
49
|
+
While the API is in alpha, every package's `publishConfig.tag` remains `alpha`. The workflow also
|
|
50
|
+
passes `--tag alpha` explicitly for prerelease versions, because package-manager support for the
|
|
51
|
+
manifest default is not consistent. Consumers should install the same version of core and host; an
|
|
52
|
+
alpha-tagged publish advances only `alpha` and does not automatically move `latest`.
|
|
53
|
+
|
|
54
|
+
If an alpha has been verified and should also become the default for unqualified installs, an
|
|
55
|
+
authenticated maintainer can move `latest` explicitly:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm dist-tag add effect-durable-agent@0.1.0-alpha.4 latest
|
|
59
|
+
npm dist-tag add effect-durable-agent-cloudflare@0.1.0-alpha.4 latest
|
|
60
|
+
npm dist-tag add effect-durable-agent-celld@0.1.0-alpha.4 latest
|
|
61
|
+
```
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
Trusted publishing authorizes `npm publish`, not `npm dist-tag`, so changing a dist-tag is an
|
|
64
|
+
interactive maintainer operation and may require two-factor authentication. Always name the exact
|
|
65
|
+
version being promoted.
|
|
66
|
+
|
|
67
|
+
For the first stable release, remove the prerelease suffix and change `publishConfig.tag` to
|
|
68
|
+
`latest` in the version PR. Leave `alpha` pointing to the final alpha unless there is a deliberate
|
|
69
|
+
reason to move or remove it.
|
|
70
|
+
|
|
71
|
+
## Release checklist
|
|
72
|
+
|
|
73
|
+
1. Choose a new version that has never been published for any of the three packages.
|
|
74
|
+
2. Update all three `package.json` files to that exact version and refresh `pnpm-lock.yaml`.
|
|
75
|
+
3. Add the release notes to `CHANGELOG.md`.
|
|
76
|
+
4. Run the complete release validation:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pnpm install --frozen-lockfile
|
|
80
|
+
pnpm run release:check
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
5. Merge the version PR and confirm `CI` passes on `master`.
|
|
84
|
+
6. Create a GitHub release targeting the merged commit. Its tag must be exactly
|
|
85
|
+
`v<package version>`; for example, `v0.1.0-alpha.4`.
|
|
86
|
+
7. Wait for the `Publish to npm` workflow to pass. The workflow independently reruns the full
|
|
87
|
+
release check and rejects a tag that does not match `package.json`.
|
|
88
|
+
8. Verify the registry metadata and dist-tags:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
for package_name in effect-durable-agent effect-durable-agent-cloudflare effect-durable-agent-celld; do
|
|
92
|
+
npm view "$package_name@0.1.0-alpha.4" name version repository.url dist.integrity --json
|
|
93
|
+
npm dist-tag ls "$package_name"
|
|
94
|
+
done
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
9. Install from the public registry in a clean consumer and run its typecheck and bundle. Do not
|
|
98
|
+
validate only against the repository or a local tarball.
|
|
99
|
+
10. If desired for the alpha channel, move `latest` only after the registry install succeeds.
|
|
100
|
+
11. Update downstream consumers, including the `goguardian/gia` submodule pin, in a separate PR.
|
|
101
|
+
|
|
102
|
+
## Failure handling
|
|
103
|
+
|
|
104
|
+
- npm package versions are immutable. Never try to reuse a version after any successful publish;
|
|
105
|
+
increment the version and release again.
|
|
106
|
+
- npm does not provide a multi-package transaction. If any package uploads before a later publish
|
|
107
|
+
fails, rerun `pnpm run publish:workspace` from the exact same commit: it verifies identical
|
|
108
|
+
published bytes, skips them, and continues the remaining packages. If the bytes differ, increment
|
|
109
|
+
every package and release a new version.
|
|
110
|
+
- If the workflow fails before any package publishes, fix the cause on `master` and create a release
|
|
111
|
+
for the corrected, incremented version. Do not move an existing release tag to another commit.
|
|
112
|
+
- If only a dist-tag is wrong, correct the tag instead of republishing the package.
|
|
113
|
+
- Avoid unpublishing except for a genuine security or legal incident. Coordinate through the
|
|
114
|
+
process in [`SECURITY.md`](../SECURITY.md).
|
package/docs/spec.md
CHANGED
|
@@ -51,7 +51,7 @@ Important version facts:
|
|
|
51
51
|
- Services use `Context.Service<Self, Shape>()("key")`, not newer `ServiceMap.Service` examples.
|
|
52
52
|
- Effect AI is imported from `effect/unstable/ai`; there is no separate local `@effect/ai` package.
|
|
53
53
|
- EDA exposes model tools through upstream `Tool` / `Toolkit` values and calls `LanguageModel.streamText(..., { disableToolCallResolution: true })` so the harness owns tool lifecycle.
|
|
54
|
-
- UUIDv7
|
|
54
|
+
- Newly minted lifecycle ids are UUIDv7; session ids also accept UUIDv4 for migrated callers.
|
|
55
55
|
|
|
56
56
|
---
|
|
57
57
|
|
|
@@ -61,7 +61,7 @@ Important version facts:
|
|
|
61
61
|
Host route / RPC / WebSocket
|
|
62
62
|
|
|
|
63
63
|
v
|
|
64
|
-
|
|
64
|
+
Host adapter (`effect-durable-agent-cloudflare` or `effect-durable-agent-celld`)
|
|
65
65
|
|
|
|
66
66
|
v
|
|
67
67
|
ManagedRuntime<Effect services> for one session
|
|
@@ -83,17 +83,17 @@ ManagedRuntime<Effect services> for one session
|
|
|
83
83
|
|
|
84
84
|
| Area | Files |
|
|
85
85
|
| --- | --- |
|
|
86
|
-
| Public runtime | `services/runtime.ts`, `
|
|
87
|
-
| Durable store port +
|
|
86
|
+
| Public runtime | `src/services/runtime.ts`, `src/services/runtime-layer.ts` |
|
|
87
|
+
| Durable store port + Cloudflare/celld implementation | `src/services/session-store.ts`, `packages/cloudflare/src/durable-object-storage.ts`, `packages/cloudflare/src/durable-object-store.ts` |
|
|
88
88
|
| Session authority | `services/session-state.ts` |
|
|
89
89
|
| Query/read APIs | `services/session-query.ts` |
|
|
90
|
-
| Live stream/WebSocket | `services/live-event-bus.ts`, `services/websocket-subscriber.ts`, `host/websocket-wire.ts`, `host/websocket-protocol.ts` |
|
|
90
|
+
| Live stream/WebSocket | `src/services/live-event-bus.ts`, `src/services/websocket-subscriber.ts`, `src/host/websocket-wire.ts`, `src/host/websocket-protocol.ts` |
|
|
91
91
|
| Pure reducers/policies | `domain/reduced-state.ts`, `domain/command-queues.ts`, `domain/dispatch-policy.ts`, `domain/run-continuation-policy.ts`, `domain/inference-state.ts` |
|
|
92
92
|
| Model/turn/tool execution | `services/turn-runner.ts`, `services/inference-runner.ts`, `services/tool-executor.ts`, `services/tool-registry.ts` |
|
|
93
93
|
| Extension points | `services/reducer-registry.ts`, `services/sink-registry.ts` |
|
|
94
94
|
| Compaction | `services/compaction.ts`, `domain/context-projection.ts` |
|
|
95
|
-
| Cloudflare host | `
|
|
96
|
-
| Examples | `examples/` |
|
|
95
|
+
| Cloudflare/celld host adapters | `packages/cloudflare/src/durable-object-runtime.ts`, `packages/cloudflare/src/durable-object-keepalive.ts`, `packages/cloudflare/src/durable-object-sink-checkpoints.ts` |
|
|
96
|
+
| Examples | `packages/cloudflare/examples/` |
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
@@ -499,7 +499,10 @@ Current extension points:
|
|
|
499
499
|
Apps bind their custom durable-event union to the live protocol once with
|
|
500
500
|
`makeEDAWebSocketWireProtocol({ appEvents })`. The binding automatically includes
|
|
501
501
|
all framework durable and ephemeral events, configures strict host encoding, and
|
|
502
|
-
exports
|
|
502
|
+
exports explicit `domain` and `wire` event/frame schema surfaces. Apps pass the
|
|
503
|
+
binding's `host` adapter to the EDA host and share its `wire` schemas with browser
|
|
504
|
+
or other WebSocket consumers. Its typed `encodeServerFrame` accepts only the
|
|
505
|
+
app-bound domain frame type.
|
|
503
506
|
Framework-only hosts reject unregistered app events rather than widening their
|
|
504
507
|
payloads to `unknown`.
|
|
505
508
|
|
|
@@ -527,8 +530,8 @@ snapshot union.
|
|
|
527
530
|
|
|
528
531
|
The current examples show the intended shape:
|
|
529
532
|
|
|
530
|
-
- `examples/002-slack-bridge` — idempotent Slack ingress, reducer correlation across framework/app events, and durable sink delivery.
|
|
531
|
-
- `examples/003-sandbox-lifecycle` — framework tool events + app sandbox events reduced into one UI model, including SSR handoff math.
|
|
533
|
+
- `packages/cloudflare/examples/002-slack-bridge` — idempotent Slack ingress, reducer correlation across framework/app events, and durable sink delivery.
|
|
534
|
+
- `packages/cloudflare/examples/003-sandbox-lifecycle` — framework tool events + app sandbox events reduced into one UI model, including SSR handoff math.
|
|
532
535
|
|
|
533
536
|
### Sinks
|
|
534
537
|
|
|
@@ -692,7 +695,7 @@ Current production host:
|
|
|
692
695
|
|
|
693
696
|
The Cloudflare host imports Cloudflare APIs. Core domain/runtime code depends on services such as `EDASessionStore`, `SessionContext`, `IdGenerator`, `EDAKeepAlive`, model/tool layers, and live subscriber abstractions.
|
|
694
697
|
|
|
695
|
-
The host boundary
|
|
698
|
+
The host boundary supports multiple deployments. The Cloudflare and celld packages provide the same semantics: one ordered durable session log, atomic append, per-session coordination, resumable live delivery, durable sink checkpoints, clock/id services, and wakeup/keep-alive hooks.
|
|
696
699
|
|
|
697
700
|
---
|
|
698
701
|
|
|
@@ -761,7 +764,7 @@ EDA currently does **not** provide:
|
|
|
761
764
|
- provider-executed tool projection/replay;
|
|
762
765
|
- durable stdout/stderr chunks or file-change artifacts for sandbox tools;
|
|
763
766
|
- app-side physical payload sidecars/chunking;
|
|
764
|
-
-
|
|
767
|
+
- additional production hosts beyond the Cloudflare-compatible contract.
|
|
765
768
|
|
|
766
769
|
---
|
|
767
770
|
|
|
@@ -116,21 +116,47 @@ export const counterWebSocketProtocol = makeEDAWebSocketWireProtocol({
|
|
|
116
116
|
appEvents: CounterIncrementedEvent,
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
export const CounterWebSocketServerFrame = counterWebSocketProtocol.serverFrame;
|
|
119
|
+
export const CounterWebSocketServerFrame = counterWebSocketProtocol.wire.serverFrame;
|
|
120
120
|
export type CounterWebSocketServerFrame = typeof CounterWebSocketServerFrame.Type;
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
`makeEDAWebSocketWireProtocol` automatically unions the app events with all EDA durable and ephemeral events. The returned value
|
|
123
|
+
`makeEDAWebSocketWireProtocol` automatically unions the app events with all EDA durable and ephemeral events. The returned value makes the two schema directions explicit:
|
|
124
124
|
|
|
125
|
-
-
|
|
126
|
-
|
|
125
|
+
- `domain.event`, `domain.positionedEvent`, `domain.eventsFrame`, and `domain.serverFrame`
|
|
126
|
+
describe decoded in-memory values. Schema transformations have already run on their `Type` side.
|
|
127
|
+
- `wire.event`, `wire.positionedEvent`, `wire.eventsFrame`, and `wire.serverFrame` describe
|
|
128
|
+
the UTF-8 JSON representation. Browser and other external consumers decode with these schemas
|
|
129
|
+
when they need validated wire values without hydrating domain transformations.
|
|
130
|
+
- `wire.clientFrame` validates client-to-server ACK messages.
|
|
131
|
+
- `encodeServerFrame` accepts only the exact app-bound domain server-frame type and serializes it to
|
|
132
|
+
one JSON text message.
|
|
133
|
+
- `host` is the adapter passed as `webSocketProtocol` to the EDA host. It validates and encodes the
|
|
134
|
+
host's broad event envelope against the registered app/framework union at runtime.
|
|
127
135
|
|
|
128
|
-
|
|
136
|
+
For example, a transformed message content field may be a prompt-part array in
|
|
137
|
+
`domain.serverFrame.Type` and a string in `wire.serverFrame.Type`. TypeScript rejects passing the
|
|
138
|
+
wire frame to `encodeServerFrame`; callers must decode external input through the domain schema
|
|
139
|
+
before treating it as an in-memory value. Both surfaces are derived from the same event schemas, so
|
|
140
|
+
there is still one logical contract rather than parallel hand-maintained models. Switching on
|
|
141
|
+
`event.type` narrows `event.payload` to that event's exact schema on either surface.
|
|
142
|
+
|
|
143
|
+
The EDA host binding is therefore explicit:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
const options = {
|
|
147
|
+
// Other host options omitted.
|
|
148
|
+
webSocketProtocol: counterWebSocketProtocol.host,
|
|
149
|
+
};
|
|
150
|
+
```
|
|
129
151
|
|
|
130
152
|
The app event union is the registration point: adding a custom event there changes the WebSocket union everywhere it is imported. Consumers that use an exhaustive event policy or `assertNever` then receive a TypeScript error until they explicitly apply or ignore the new event.
|
|
131
153
|
|
|
132
154
|
Hosts without custom events use the strict framework-only protocol. The default host encoder does not accept an arbitrary `EventEnvelope`; an app event must be registered explicitly or outbound encoding fails. This prevents an omitted app binding from silently degrading payloads back to `unknown`.
|
|
133
155
|
|
|
156
|
+
This API separation does not change protocol version `1` or any serialized frame shape. It makes the
|
|
157
|
+
existing domain-to-wire transformation direction visible in TypeScript and tests it through a full
|
|
158
|
+
domain frame → JSON text → wire/domain decode round trip.
|
|
159
|
+
|
|
134
160
|
## 3. Schema sketch
|
|
135
161
|
|
|
136
162
|
Frame variants are plain `Schema.Struct` values with literal `_tag` fields. Client and server protocols compose those variants with `Schema.Union`. This keeps the wire contract data-only; class constructors are reserved for domain values that benefit from behavior.
|
|
@@ -588,7 +614,7 @@ Future hardening tests should add:
|
|
|
588
614
|
- Oversized outbound frame behavior and inbound text-frame byte cap before JSON parse.
|
|
589
615
|
- Explicit client reducer reset/de-duplication behavior after active-turn replay overflow.
|
|
590
616
|
|
|
591
|
-
|
|
617
|
+
Shared conformance tests exercise this flow against real workerd and celld processes.
|
|
592
618
|
|
|
593
619
|
## 12. Implemented artifacts and remaining work
|
|
594
620
|
|
|
@@ -599,8 +625,8 @@ Implemented artifacts:
|
|
|
599
625
|
3. `src/services/live-event-bus.ts` owns bounded active-turn ephemeral replay: open on `TurnStarted`, append active-turn ephemerals, drop on `TurnCompleted`/`TurnStopped`/`TurnFailed`, expose `activeTurnReplay()`.
|
|
600
626
|
4. `src/services/session-query.ts` / `EDARuntime.eventsAfter(...)` merge durable replay, active-turn ephemerals, already-buffered live events, and follow-live delivery.
|
|
601
627
|
5. `src/services/websocket-subscriber.ts` defines typed subscriber errors and `runWebSocketSubscriber(...)` over `EDARuntime.eventsAfter`, `Queue.dropping`, ACK refs, scoped cancellation, and ACK timeouts.
|
|
602
|
-
6. `src/
|
|
603
|
-
7. `src/
|
|
628
|
+
6. `packages/cloudflare/src/durable-object-runtime.ts` adapts Durable Object WebSockets to the transport, persists ACKs in `serializeAttachment`, restores accepted sockets, and maps typed errors to close codes for Cloudflare and celld.
|
|
629
|
+
7. `packages/cloudflare/src/durable-object.ts` and the consuming application's routes expose a WebSocket-only events endpoint with `426` for non-upgrade requests.
|
|
604
630
|
8. Tests cover typed custom-event bindings, normal subscriber delivery, subscriber overflow lag, active-turn replay retention/drop, reconnect ordering, and fake DO WebSocket streaming.
|
|
605
631
|
|
|
606
632
|
Remaining hardening:
|
|
@@ -610,4 +636,4 @@ Remaining hardening:
|
|
|
610
636
|
3. Focused ACK-timeout and protocol-error tests.
|
|
611
637
|
4. Micro-batching (`maxFrameEvents > 1`, optional frame delay) once token volume needs it.
|
|
612
638
|
5. Explicit client-visible behavior for active-turn replay overflow.
|
|
613
|
-
6.
|
|
639
|
+
6. Broader host conformance coverage for lag/timeout failure paths.
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-durable-agent",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
|
+
"description": "A host-independent, event-sourced durable state-management and execution layer for agentic applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
7
|
-
"cloudflare",
|
|
8
|
-
"durable-objects",
|
|
9
7
|
"effect",
|
|
10
8
|
"event-sourcing",
|
|
11
9
|
"state-machine"
|
|
@@ -24,14 +22,12 @@
|
|
|
24
22
|
"sideEffects": false,
|
|
25
23
|
"main": "./dist/index.js",
|
|
26
24
|
"types": "./dist/index.d.ts",
|
|
27
|
-
"packageManager": "pnpm@10.33.2",
|
|
28
25
|
"files": [
|
|
29
26
|
"CHANGELOG.md",
|
|
30
27
|
"CONTRIBUTING.md",
|
|
31
28
|
"SECURITY.md",
|
|
32
29
|
"dist",
|
|
33
30
|
"docs",
|
|
34
|
-
"examples",
|
|
35
31
|
"testing/offline-trace/README.md",
|
|
36
32
|
"tooling/oxlint/index.mjs",
|
|
37
33
|
"tooling/oxlint/rules/*.mjs"
|
|
@@ -57,22 +53,18 @@
|
|
|
57
53
|
"types": "./dist/domain/reduced-state-schema.d.ts",
|
|
58
54
|
"import": "./dist/domain/reduced-state-schema.js"
|
|
59
55
|
},
|
|
60
|
-
"./host/durable-object": {
|
|
61
|
-
"types": "./dist/host/durable-object.d.ts",
|
|
62
|
-
"import": "./dist/host/durable-object.js"
|
|
63
|
-
},
|
|
64
|
-
"./host/durable-object-runtime": {
|
|
65
|
-
"types": "./dist/host/durable-object-runtime.d.ts",
|
|
66
|
-
"import": "./dist/host/durable-object-runtime.js"
|
|
67
|
-
},
|
|
68
|
-
"./host/durable-object-storage": {
|
|
69
|
-
"types": "./dist/host/durable-object-storage.d.ts",
|
|
70
|
-
"import": "./dist/host/durable-object-storage.js"
|
|
71
|
-
},
|
|
72
56
|
"./host/websocket-wire": {
|
|
73
57
|
"types": "./dist/host/websocket-wire.d.ts",
|
|
74
58
|
"import": "./dist/host/websocket-wire.js"
|
|
75
59
|
},
|
|
60
|
+
"./host/websocket-protocol": {
|
|
61
|
+
"types": "./dist/host/websocket-protocol.d.ts",
|
|
62
|
+
"import": "./dist/host/websocket-protocol.js"
|
|
63
|
+
},
|
|
64
|
+
"./services/keep-alive": {
|
|
65
|
+
"types": "./dist/services/keep-alive.d.ts",
|
|
66
|
+
"import": "./dist/services/keep-alive.js"
|
|
67
|
+
},
|
|
76
68
|
"./services/compaction": {
|
|
77
69
|
"types": "./dist/services/compaction.d.ts",
|
|
78
70
|
"import": "./dist/services/compaction.js"
|
|
@@ -93,6 +85,10 @@
|
|
|
93
85
|
"types": "./dist/services/runtime.d.ts",
|
|
94
86
|
"import": "./dist/services/runtime.js"
|
|
95
87
|
},
|
|
88
|
+
"./services/runtime-layer": {
|
|
89
|
+
"types": "./dist/services/runtime-layer.d.ts",
|
|
90
|
+
"import": "./dist/services/runtime-layer.js"
|
|
91
|
+
},
|
|
96
92
|
"./services/session-query": {
|
|
97
93
|
"types": "./dist/services/session-query.d.ts",
|
|
98
94
|
"import": "./dist/services/session-query.js"
|
|
@@ -101,6 +97,14 @@
|
|
|
101
97
|
"types": "./dist/services/session-store.d.ts",
|
|
102
98
|
"import": "./dist/services/session-store.js"
|
|
103
99
|
},
|
|
100
|
+
"./services/session-state": {
|
|
101
|
+
"types": "./dist/services/session-state.d.ts",
|
|
102
|
+
"import": "./dist/services/session-state.js"
|
|
103
|
+
},
|
|
104
|
+
"./services/sink-checkpoint-store": {
|
|
105
|
+
"types": "./dist/services/sink-checkpoint-store.d.ts",
|
|
106
|
+
"import": "./dist/services/sink-checkpoint-store.js"
|
|
107
|
+
},
|
|
104
108
|
"./services/sink-registry": {
|
|
105
109
|
"types": "./dist/services/sink-registry.d.ts",
|
|
106
110
|
"import": "./dist/services/sink-registry.js"
|
|
@@ -117,6 +121,14 @@
|
|
|
117
121
|
"types": "./dist/services/tracing.d.ts",
|
|
118
122
|
"import": "./dist/services/tracing.js"
|
|
119
123
|
},
|
|
124
|
+
"./services/websocket-subscriber": {
|
|
125
|
+
"types": "./dist/services/websocket-subscriber.d.ts",
|
|
126
|
+
"import": "./dist/services/websocket-subscriber.js"
|
|
127
|
+
},
|
|
128
|
+
"./domain/context-projection": {
|
|
129
|
+
"types": "./dist/domain/context-projection.d.ts",
|
|
130
|
+
"import": "./dist/domain/context-projection.js"
|
|
131
|
+
},
|
|
120
132
|
"./testkit/layers": {
|
|
121
133
|
"types": "./dist/testkit/layers.d.ts",
|
|
122
134
|
"import": "./dist/testkit/layers.js"
|
|
@@ -144,38 +156,46 @@
|
|
|
144
156
|
},
|
|
145
157
|
"./package.json": "./package.json"
|
|
146
158
|
},
|
|
147
|
-
"scripts": {
|
|
148
|
-
"build": "vp pack",
|
|
149
|
-
"check": "pnpm run lint && pnpm run typecheck",
|
|
150
|
-
"ci": "pnpm run check && pnpm run test",
|
|
151
|
-
"lint": "vp fmt --check && vp lint",
|
|
152
|
-
"lint:fix": "vp fmt && vp lint --fix",
|
|
153
|
-
"package:check": "node scripts/check-package.mjs",
|
|
154
|
-
"prepack": "pnpm run build",
|
|
155
|
-
"release:check": "pnpm run ci && pnpm run build && pnpm run package:check",
|
|
156
|
-
"test": "vp test run --passWithNoTests",
|
|
157
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
158
|
-
},
|
|
159
159
|
"publishConfig": {
|
|
160
160
|
"access": "public",
|
|
161
161
|
"registry": "https://registry.npmjs.org/",
|
|
162
162
|
"tag": "alpha"
|
|
163
163
|
},
|
|
164
164
|
"peerDependencies": {
|
|
165
|
-
"@effect/ai-openai": "4.0.0-beta.102",
|
|
166
165
|
"effect": "4.0.0-beta.102"
|
|
167
166
|
},
|
|
168
167
|
"devDependencies": {
|
|
169
|
-
"@cloudflare/workers-types": "5.
|
|
168
|
+
"@cloudflare/workers-types": "5.20260813.1",
|
|
170
169
|
"@effect/ai-openai": "4.0.0-beta.102",
|
|
170
|
+
"@effect/tsgo": "0.31.0",
|
|
171
171
|
"@types/node": "^25.7.0",
|
|
172
172
|
"effect": "4.0.0-beta.102",
|
|
173
|
+
"esbuild": "^0.28.1",
|
|
173
174
|
"fast-check": "^4.8.0",
|
|
174
|
-
"oxlint": "1.
|
|
175
|
+
"oxlint": "1.77.0",
|
|
176
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
175
177
|
"publint": "^0.3.22",
|
|
176
178
|
"tsx": "4.21.0",
|
|
177
179
|
"typescript": "^6.0.3",
|
|
178
180
|
"vite-plus": "^0.1.21",
|
|
179
|
-
"vitest": "^4.1.8"
|
|
181
|
+
"vitest": "^4.1.8",
|
|
182
|
+
"wrangler": "^4.114.0"
|
|
183
|
+
},
|
|
184
|
+
"scripts": {
|
|
185
|
+
"build": "pnpm run build:core && pnpm --filter effect-durable-agent-cloudflare run build && pnpm --filter effect-durable-agent-celld run build",
|
|
186
|
+
"build:core": "vp pack",
|
|
187
|
+
"check": "pnpm run lint && pnpm run typecheck && pnpm --filter effect-durable-agent-cloudflare run check && pnpm --filter effect-durable-agent-celld run check",
|
|
188
|
+
"ci": "pnpm run build && pnpm run check && pnpm run test && pnpm run release:versions && pnpm run package:check",
|
|
189
|
+
"lint": "vp fmt --check && vp lint --deny-warnings",
|
|
190
|
+
"lint:fix": "vp fmt && vp lint --fix",
|
|
191
|
+
"package:check": "node scripts/check-package.mjs",
|
|
192
|
+
"publish:workspace": "node scripts/publish-workspace.mjs",
|
|
193
|
+
"publish:workspace:dry-run": "node scripts/publish-workspace.mjs --dry-run",
|
|
194
|
+
"release:versions": "node scripts/check-workspace-versions.mjs",
|
|
195
|
+
"release:check": "pnpm run ci",
|
|
196
|
+
"test": "pnpm run test:core && pnpm --filter effect-durable-agent-cloudflare run test && pnpm --filter effect-durable-agent-celld run test && pnpm run test:integration",
|
|
197
|
+
"test:core": "vp test run --passWithNoTests src testing/offline-trace",
|
|
198
|
+
"test:integration": "pnpm run build && vp test run testing/host-conformance/hosts.integration.test.ts",
|
|
199
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
180
200
|
}
|
|
181
|
-
}
|
|
201
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"durable-C3Rz7kg3.js","names":[],"sources":["../src/types/events/envelope.ts","../src/types/events/internal.ts","../src/types/events/durable.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { CorrelationId, EventId, Position, SessionId } from \"../core\";\nimport { EDAEventTrace, makeRootEDAEventTrace } from \"../tracing\";\n\n/** Event namespace, such as `effect-durable-agent`, `sandbox`, or `gia`. */\nexport const EventNamespace = Schema.NonEmptyString;\nexport type EventNamespace = typeof EventNamespace.Type;\n\n/** Event type within a namespace, such as `CommandAdmitted` or `TextDelta`. */\nexport const EventType = Schema.NonEmptyString;\nexport type EventType = typeof EventType.Type;\n\n/** Build a non-empty event type while preserving its string literal for exhaustive unions. */\nexport const makeEventType = <const Value extends string>(\n value: Value extends \"\" ? never : Value,\n) => value;\n\n/** Extract the literal name retained by `makeEventType`. */\nexport type EventTypeName<Type extends EventType> = Type;\n\n/** Provider-supplied stream part identity, preserved for correlation/debugging. */\nexport const ProviderPartId = Schema.NonEmptyString.pipe(Schema.brand(\"ProviderPartId\"));\nexport type ProviderPartId = typeof ProviderPartId.Type;\n\n/** Positive schema version for one namespace/type payload contract. */\nexport const SchemaVersion = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));\nexport type SchemaVersion = typeof SchemaVersion.Type;\n\n/** Milliseconds since unix epoch, represented as a non-negative integer. */\nexport const UnixEpochMillis = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(\n Schema.brand(\"UnixEpochMillis\"),\n);\nexport type UnixEpochMillis = typeof UnixEpochMillis.Type;\n\n/** Whether an event is persisted or live-only. */\nexport const EventDurability = Schema.Literals([\"durable\", \"ephemeral\"]);\nexport type EventDurability = typeof EventDurability.Type;\n\n/** Common event envelope decoded before payload-specific schemas. */\nexport const EventEnvelope = Schema.Struct({\n namespace: EventNamespace,\n type: EventType,\n schemaVersion: SchemaVersion,\n durability: EventDurability,\n eventId: EventId,\n sessionId: SessionId,\n correlationId: Schema.optionalKey(CorrelationId),\n createdAtMs: UnixEpochMillis,\n trace: EDAEventTrace.pipe(Schema.withConstructorDefault(Effect.sync(makeRootEDAEventTrace))),\n payload: Schema.Unknown,\n});\nexport type EventEnvelope = typeof EventEnvelope.Type;\n\n/** Common envelope narrowed to committed durable events. */\nexport const DurableEventEnvelope = Schema.Struct({\n ...EventEnvelope.fields,\n durability: Schema.Literal(\"durable\"),\n});\nexport type DurableEventEnvelope = typeof DurableEventEnvelope.Type;\n\n/** Common envelope narrowed to live-only ephemeral events. */\nexport const EphemeralEventEnvelope = Schema.Struct({\n ...EventEnvelope.fields,\n durability: Schema.Literal(\"ephemeral\"),\n});\nexport type EphemeralEventEnvelope = typeof EphemeralEventEnvelope.Type;\n\n/** Event delivered to live subscribers with its durable/ephemeral position. */\nexport const PositionedEvent = Schema.Struct({\n position: Position,\n event: EventEnvelope,\n});\nexport type PositionedEvent = typeof PositionedEvent.Type;\n\n/** Built-in framework event namespace. */\nexport const effectDurableAgentNamespace = EventNamespace.make(\"effect-durable-agent\");\n\n/** Initial schema version for built-in event payloads. */\nexport const schemaV1 = SchemaVersion.make(1);\n\n/** Non-negative integer used by token counts and similar counters. */\nexport const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\nexport type NonNegativeInt = typeof NonNegativeInt.Type;\n\n/** Registered tool name; plain non-empty text, not a lifecycle identity. */\nexport const ToolName = Schema.NonEmptyString;\nexport type ToolName = typeof ToolName.Type;\n\n/** Error details stored on failed lifecycle events. */\nexport const FailurePayload = Schema.Struct({\n message: Schema.String,\n code: Schema.optionalKey(Schema.String),\n details: Schema.optionalKey(Schema.Unknown),\n});\nexport type FailurePayload = typeof FailurePayload.Type;\n\n/** Token usage reported by a model provider when available. */\nexport const UsagePayload = Schema.Struct({\n inputTokens: Schema.optionalKey(NonNegativeInt),\n cachedInputTokens: Schema.optionalKey(NonNegativeInt),\n outputTokens: Schema.optionalKey(NonNegativeInt),\n textTokens: Schema.optionalKey(NonNegativeInt),\n reasoningTokens: Schema.optionalKey(NonNegativeInt),\n});\nexport type UsagePayload = typeof UsagePayload.Type;\n\n/** Intended provider/model selection known before a model request starts. */\nexport const ModelSelectionPayload = Schema.Struct({\n provider: Schema.NonEmptyString,\n modelId: Schema.NonEmptyString,\n settings: Schema.optionalKey(Schema.Unknown),\n});\nexport type ModelSelectionPayload = typeof ModelSelectionPayload.Type;\n\n/** App-owned instructions inserted into model context as a system message. */\nexport const SystemPromptText = Schema.NonEmptyString;\nexport type SystemPromptText = typeof SystemPromptText.Type;\n","import * as Schema from \"effect/Schema\";\n\nimport {\n DurableEventEnvelope,\n EphemeralEventEnvelope,\n EventType,\n effectDurableAgentNamespace,\n schemaV1,\n} from \"./envelope\";\n\n/** Build a built-in durable event schema from its fixed event type and payload schema. */\nexport const durableEventSchema = <const Type extends EventType, Payload extends Schema.Top>(\n type: Type,\n payload: Payload,\n) =>\n Schema.Struct({\n ...DurableEventEnvelope.fields,\n namespace: Schema.Literal(effectDurableAgentNamespace),\n type: Schema.Literal(type),\n schemaVersion: Schema.Literal(schemaV1),\n payload,\n });\n\n/** Build a built-in ephemeral event schema from its fixed event type and payload schema. */\nexport const ephemeralEventSchema = <const Type extends EventType, Payload extends Schema.Top>(\n type: Type,\n payload: Payload,\n) =>\n Schema.Struct({\n ...EphemeralEventEnvelope.fields,\n namespace: Schema.Literal(effectDurableAgentNamespace),\n type: Schema.Literal(type),\n schemaVersion: Schema.Literal(schemaV1),\n payload,\n });\n","import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\nimport * as Prompt from \"effect/unstable/ai/Prompt\";\n\nimport { EDACommand, UserMessageContent } from \"../commands\";\nimport {\n BaseStateId,\n CommandId,\n CompactionId,\n ContextVersion,\n InferenceId,\n MessageId,\n RunId,\n SequenceNumber,\n SummaryId,\n ToolCallId,\n TurnId,\n} from \"../core\";\nimport {\n DurableEventEnvelope,\n FailurePayload,\n ModelSelectionPayload,\n ProviderPartId,\n SystemPromptText,\n ToolName,\n UsagePayload,\n effectDurableAgentNamespace,\n makeEventType,\n schemaV1,\n} from \"./envelope\";\nimport { durableEventSchema } from \"./internal\";\nimport { EDARunTrace, makeEDARunTrace } from \"../tracing\";\n\n/** Event type values for durable command lifecycle events. */\nexport const commandAdmittedEventType = makeEventType(\"CommandAdmitted\");\nexport const commandStartedEventType = makeEventType(\"CommandStarted\");\nexport const commandCompletedEventType = makeEventType(\"CommandCompleted\");\nexport const commandFailedEventType = makeEventType(\"CommandFailed\");\nexport const commandCancelledEventType = makeEventType(\"CommandCancelled\");\n\n/** Payload recorded when a command enters the durable session log. */\nexport const CommandAdmittedPayload = Schema.Struct({ command: EDACommand });\nexport type CommandAdmittedPayload = typeof CommandAdmittedPayload.Type;\nexport const CommandAdmittedEvent = durableEventSchema(\n commandAdmittedEventType,\n CommandAdmittedPayload,\n);\nexport type CommandAdmittedEvent = typeof CommandAdmittedEvent.Type;\n\n/** Payload recorded when command execution starts. */\nexport const CommandStartedPayload = Schema.Struct({ commandId: CommandId });\nexport type CommandStartedPayload = typeof CommandStartedPayload.Type;\nexport const CommandStartedEvent = durableEventSchema(\n commandStartedEventType,\n CommandStartedPayload,\n);\nexport type CommandStartedEvent = typeof CommandStartedEvent.Type;\n\n/** Payload recorded when command execution completes normally. */\nexport const CommandCompletedPayload = Schema.Struct({ commandId: CommandId });\nexport type CommandCompletedPayload = typeof CommandCompletedPayload.Type;\nexport const CommandCompletedEvent = durableEventSchema(\n commandCompletedEventType,\n CommandCompletedPayload,\n);\nexport type CommandCompletedEvent = typeof CommandCompletedEvent.Type;\n\n/** Payload recorded when command execution fails. */\nexport const CommandFailedPayload = Schema.Struct({ commandId: CommandId, error: FailurePayload });\nexport type CommandFailedPayload = typeof CommandFailedPayload.Type;\nexport const CommandFailedEvent = durableEventSchema(commandFailedEventType, CommandFailedPayload);\nexport type CommandFailedEvent = typeof CommandFailedEvent.Type;\n\n/** Payload recorded when a command is cancelled before completion. */\nexport const CommandCancelledPayload = Schema.Struct({\n commandId: CommandId,\n reason: Schema.String,\n});\nexport type CommandCancelledPayload = typeof CommandCancelledPayload.Type;\nexport const CommandCancelledEvent = durableEventSchema(\n commandCancelledEventType,\n CommandCancelledPayload,\n);\nexport type CommandCancelledEvent = typeof CommandCancelledEvent.Type;\n\n/** Durable event union for the command lifecycle. */\nexport const CommandEvent = Schema.Union([\n CommandAdmittedEvent,\n CommandStartedEvent,\n CommandCompletedEvent,\n CommandFailedEvent,\n CommandCancelledEvent,\n]);\nexport type CommandEvent = typeof CommandEvent.Type;\n\n/** Event type values for durable message lifecycle events. */\nexport const systemMessageCommittedEventType = makeEventType(\"SystemMessageCommitted\");\nexport const userMessageCommittedEventType = makeEventType(\"UserMessageCommitted\");\nexport const steeringMessageQueuedEventType = makeEventType(\"SteeringMessageQueued\");\nexport const steeringMessageCancelledEventType = makeEventType(\"SteeringMessageCancelled\");\nexport const userMessageSubmittedEventType = makeEventType(\"UserMessageSubmitted\");\nexport const userMessagePromotedEventType = makeEventType(\"UserMessagePromoted\");\nexport const userMessageCancelledEventType = makeEventType(\"UserMessageCancelled\");\nexport const messageQueuePausedEventType = makeEventType(\"MessageQueuePaused\");\nexport const pendingMessagesPausedEventType = makeEventType(\"PendingMessagesPaused\");\nexport const assistantMessageCommittedEventType = makeEventType(\"AssistantMessageCommitted\");\nexport const assistantPartialCommittedEventType = makeEventType(\"AssistantPartialCommitted\");\n\n/** Semantic assistant content derived from canonical prompt parts for query convenience. */\nexport const AssistantMessageContent = Schema.Struct({\n text: Schema.String,\n reasoning: Schema.optionalKey(Schema.String),\n});\nexport type AssistantMessageContent = typeof AssistantMessageContent.Type;\n\n/** Exact assistant-role prompt parts sent to the model for cache-faithful replay. */\nexport const AssistantPromptPart = Schema.Union([\n Prompt.TextPart,\n Prompt.FilePart,\n Prompt.ReasoningPart,\n Prompt.ToolCallPart,\n Prompt.ToolResultPart,\n Prompt.ToolApprovalRequestPart,\n]);\nexport type AssistantPromptPart = typeof AssistantPromptPart.Type;\n\n/** Exact non-empty assistant-role prompt content sent to the model. */\nexport const AssistantPromptParts = Schema.NonEmptyArray(AssistantPromptPart);\nexport type AssistantPromptParts = typeof AssistantPromptParts.Type;\n\n/** Exact assistant tool-call prompt part with EDA-branded provider identity. */\nexport const ToolCallPromptPart = Schema.Struct({\n ...Prompt.ToolCallPart.fields,\n id: ProviderPartId,\n name: ToolName,\n});\nexport type ToolCallPromptPart = typeof ToolCallPromptPart.Type;\n\n/** Exact tool-role prompt part sent to the model with EDA-branded provider identity. */\nexport const ToolPromptPart = Schema.Struct({\n ...Prompt.ToolResultPart.fields,\n id: ProviderPartId,\n name: ToolName,\n});\nexport type ToolPromptPart = typeof ToolPromptPart.Type;\n\n/** Payload recorded when app instructions become durable system-message context. */\nexport const SystemMessageCommittedPayload = Schema.Struct({\n messageId: MessageId,\n content: SystemPromptText,\n});\nexport type SystemMessageCommittedPayload = typeof SystemMessageCommittedPayload.Type;\nexport const SystemMessageCommittedEvent = durableEventSchema(\n systemMessageCommittedEventType,\n SystemMessageCommittedPayload,\n);\nexport type SystemMessageCommittedEvent = typeof SystemMessageCommittedEvent.Type;\n\n/** Payload recorded when a user message becomes durable session context. */\nexport const UserMessageCommittedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n content: UserMessageContent,\n});\nexport type UserMessageCommittedPayload = typeof UserMessageCommittedPayload.Type;\nexport const UserMessageCommittedEvent = durableEventSchema(\n userMessageCommittedEventType,\n UserMessageCommittedPayload,\n);\nexport type UserMessageCommittedEvent = typeof UserMessageCommittedEvent.Type;\n\n/** Payload recorded when steering context is queued for a future turn. */\nexport const SteeringMessageQueuedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n runId: RunId,\n content: UserMessageContent,\n});\nexport type SteeringMessageQueuedPayload = typeof SteeringMessageQueuedPayload.Type;\nexport const SteeringMessageQueuedEvent = durableEventSchema(\n steeringMessageQueuedEventType,\n SteeringMessageQueuedPayload,\n);\nexport type SteeringMessageQueuedEvent = typeof SteeringMessageQueuedEvent.Type;\n\n/** Payload recorded when queued steering will never be consumed by its target run. */\nexport const SteeringMessageCancelledPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n reason: Schema.String,\n});\nexport type SteeringMessageCancelledPayload = typeof SteeringMessageCancelledPayload.Type;\nexport const SteeringMessageCancelledEvent = durableEventSchema(\n steeringMessageCancelledEventType,\n SteeringMessageCancelledPayload,\n);\nexport type SteeringMessageCancelledEvent = typeof SteeringMessageCancelledEvent.Type;\n\nexport const UserMessageDisposition = Schema.Literals([\"queue\", \"steer\"]);\nexport type UserMessageDisposition = typeof UserMessageDisposition.Type;\n\nexport const UserMessageSubmittedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n disposition: UserMessageDisposition,\n content: UserMessageContent,\n});\nexport type UserMessageSubmittedPayload = typeof UserMessageSubmittedPayload.Type;\nexport const UserMessageSubmittedEvent = durableEventSchema(\n userMessageSubmittedEventType,\n UserMessageSubmittedPayload,\n);\nexport type UserMessageSubmittedEvent = typeof UserMessageSubmittedEvent.Type;\n\nexport const UserMessagePromotedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n from: Schema.Literal(\"queue\"),\n to: Schema.Literal(\"steer\"),\n});\nexport type UserMessagePromotedPayload = typeof UserMessagePromotedPayload.Type;\nexport const UserMessagePromotedEvent = durableEventSchema(\n userMessagePromotedEventType,\n UserMessagePromotedPayload,\n);\nexport type UserMessagePromotedEvent = typeof UserMessagePromotedEvent.Type;\n\nexport const UserMessageCancellationReason = Schema.Literals([\n \"edit\",\n \"user-cancel\",\n \"clear-paused-queue\",\n]);\nexport type UserMessageCancellationReason = typeof UserMessageCancellationReason.Type;\nexport const UserMessageCancelledPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n reason: UserMessageCancellationReason,\n});\nexport type UserMessageCancelledPayload = typeof UserMessageCancelledPayload.Type;\nexport const UserMessageCancelledEvent = durableEventSchema(\n userMessageCancelledEventType,\n UserMessageCancelledPayload,\n);\nexport type UserMessageCancelledEvent = typeof UserMessageCancelledEvent.Type;\n\n/** Legacy V1 pause fact retained for replay compatibility. */\nexport const MessageQueuePausedPayload = Schema.Struct({\n stopCommandId: CommandId,\n runId: RunId,\n messageIds: Schema.Array(MessageId),\n reason: Schema.Literal(\"user-interrupted\"),\n});\nexport type MessageQueuePausedPayload = typeof MessageQueuePausedPayload.Type;\nexport const MessageQueuePausedEvent = durableEventSchema(\n messageQueuePausedEventType,\n MessageQueuePausedPayload,\n);\nexport type MessageQueuePausedEvent = typeof MessageQueuePausedEvent.Type;\n\nexport const PendingMessagesPausedPayload = Schema.Struct({\n interruptionCommandId: CommandId,\n runId: RunId,\n messageIds: Schema.NonEmptyArray(MessageId),\n reason: Schema.Literal(\"user-interrupted\"),\n});\nexport type PendingMessagesPausedPayload = typeof PendingMessagesPausedPayload.Type;\nexport const PendingMessagesPausedEvent = durableEventSchema(\n pendingMessagesPausedEventType,\n PendingMessagesPausedPayload,\n);\nexport type PendingMessagesPausedEvent = typeof PendingMessagesPausedEvent.Type;\n\n/** Payload recorded when an assistant message is durably finalized. */\nexport const AssistantMessageCommittedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n});\nexport type AssistantMessageCommittedPayload = typeof AssistantMessageCommittedPayload.Type;\nexport const AssistantMessageCommittedEvent = durableEventSchema(\n assistantMessageCommittedEventType,\n AssistantMessageCommittedPayload,\n);\nexport type AssistantMessageCommittedEvent = typeof AssistantMessageCommittedEvent.Type;\n\n/** Payload recorded when a partial assistant message is preserved durably. */\nexport const AssistantPartialCommittedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n reason: Schema.String,\n});\nexport type AssistantPartialCommittedPayload = typeof AssistantPartialCommittedPayload.Type;\nexport const AssistantPartialCommittedEvent = durableEventSchema(\n assistantPartialCommittedEventType,\n AssistantPartialCommittedPayload,\n);\nexport type AssistantPartialCommittedEvent = typeof AssistantPartialCommittedEvent.Type;\n\n/** Durable event union for message commit/queue boundaries. */\nexport const MessageEvent = Schema.Union([\n SystemMessageCommittedEvent,\n UserMessageCommittedEvent,\n SteeringMessageQueuedEvent,\n SteeringMessageCancelledEvent,\n UserMessageSubmittedEvent,\n UserMessagePromotedEvent,\n UserMessageCancelledEvent,\n MessageQueuePausedEvent,\n PendingMessagesPausedEvent,\n AssistantMessageCommittedEvent,\n AssistantPartialCommittedEvent,\n]);\nexport type MessageEvent = typeof MessageEvent.Type;\n\n/** Event type values for durable run lifecycle events. */\nexport const runStartedEventType = makeEventType(\"RunStarted\");\nexport const runCompletedEventType = makeEventType(\"RunCompleted\");\nexport const runFailedEventType = makeEventType(\"RunFailed\");\n/** @deprecated Legacy terminal retained for durable replay. Emit `RunFailed` with an interruption-coded `FailurePayload` instead. */\nexport const runInterruptedEventType = makeEventType(\"RunInterrupted\");\n\n/** Payload recorded when a run starts with its intended model selection. */\nexport const RunStartedPayload = Schema.Struct({\n runId: RunId,\n commandIds: Schema.Array(CommandId),\n modelSelection: ModelSelectionPayload,\n trace: EDARunTrace.pipe(Schema.withConstructorDefault(Effect.sync(() => makeEDARunTrace()))),\n});\nexport type RunStartedPayload = typeof RunStartedPayload.Type;\nexport const RunStartedEvent = durableEventSchema(runStartedEventType, RunStartedPayload);\nexport type RunStartedEvent = typeof RunStartedEvent.Type;\n\n/** Payload recorded when a run completes. */\nexport const RunCompletedPayload = Schema.Struct({ runId: RunId });\nexport type RunCompletedPayload = typeof RunCompletedPayload.Type;\nexport const RunCompletedEvent = durableEventSchema(runCompletedEventType, RunCompletedPayload);\nexport type RunCompletedEvent = typeof RunCompletedEvent.Type;\n\n/** Payload recorded when a run fails. */\nexport const RunFailedPayload = Schema.Struct({ runId: RunId, error: FailurePayload });\nexport type RunFailedPayload = typeof RunFailedPayload.Type;\nexport const RunFailedEvent = durableEventSchema(runFailedEventType, RunFailedPayload);\nexport type RunFailedEvent = typeof RunFailedEvent.Type;\n\n/** @deprecated Legacy payload retained for durable replay. New interruptions use `RunFailedPayload` with `error.code = \"run.interrupted\"`. */\nexport const RunInterruptedPayload = Schema.Struct({ runId: RunId, reason: Schema.String });\n/** @deprecated Use `RunFailedPayload` with interruption metadata. */\nexport type RunInterruptedPayload = typeof RunInterruptedPayload.Type;\n/** @deprecated Legacy event schema retained for durable replay; new producers emit `RunFailedEvent`. */\nexport const RunInterruptedEvent = durableEventSchema(\n runInterruptedEventType,\n RunInterruptedPayload,\n);\n/** @deprecated Use `RunFailedEvent` with interruption metadata. */\nexport type RunInterruptedEvent = typeof RunInterruptedEvent.Type;\n\n/** Durable event union for run lifecycle boundaries. */\nexport const RunEvent = Schema.Union([\n RunStartedEvent,\n RunCompletedEvent,\n RunFailedEvent,\n RunInterruptedEvent,\n]);\nexport type RunEvent = typeof RunEvent.Type;\n\n/** Event type value for the durable barrier written after real startup recovery work. */\nexport const recoveryCompletedEventType = makeEventType(\"RecoveryCompleted\");\n\n/** Explicit relationship between an interrupted run and its startup-recovery replacement. */\nexport const RecoveryContinuation = Schema.Struct({\n commandId: CommandId,\n interruptedRunId: RunId,\n replacementRunId: RunId,\n});\nexport type RecoveryContinuation = typeof RecoveryContinuation.Type;\n\n/**\n * Durable completion barrier for a startup recovery transaction that repaired\n * unfinished state. Idle runtime construction does not emit this event.\n */\nexport const RecoveryCompletedPayload = Schema.Struct({\n trigger: Schema.Literal(\"runtime-restart\"),\n continuation: Schema.optionalKey(RecoveryContinuation),\n});\nexport type RecoveryCompletedPayload = typeof RecoveryCompletedPayload.Type;\nexport const RecoveryCompletedEvent = durableEventSchema(\n recoveryCompletedEventType,\n RecoveryCompletedPayload,\n);\nexport type RecoveryCompletedEvent = typeof RecoveryCompletedEvent.Type;\n\n/** Durable facts written only by the framework startup-recovery transaction. */\nexport const RecoveryEvent = RecoveryCompletedEvent;\nexport type RecoveryEvent = typeof RecoveryEvent.Type;\n\n/** Event type values for durable turn lifecycle events. */\nexport const turnStartedEventType = makeEventType(\"TurnStarted\");\nexport const turnCompletedEventType = makeEventType(\"TurnCompleted\");\nexport const turnFailedEventType = makeEventType(\"TurnFailed\");\n/** @deprecated Legacy terminal retained for durable replay. Emit `TurnFailed` with an interruption-coded `FailurePayload` instead. */\nexport const turnStoppedEventType = makeEventType(\"TurnStopped\");\n\n/** Payload recorded when one turn starts inside a run. */\nexport const TurnStartedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inputMessageIds: Schema.optionalKey(Schema.Array(MessageId)),\n});\nexport type TurnStartedPayload = typeof TurnStartedPayload.Type;\nexport const TurnStartedEvent = durableEventSchema(turnStartedEventType, TurnStartedPayload);\nexport type TurnStartedEvent = typeof TurnStartedEvent.Type;\n\n/** Payload recorded when one turn completes. */\nexport const TurnCompletedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type TurnCompletedPayload = typeof TurnCompletedPayload.Type;\nexport const TurnCompletedEvent = durableEventSchema(turnCompletedEventType, TurnCompletedPayload);\nexport type TurnCompletedEvent = typeof TurnCompletedEvent.Type;\n\n/** Payload recorded when one turn fails. */\nexport const TurnFailedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n error: FailurePayload,\n});\nexport type TurnFailedPayload = typeof TurnFailedPayload.Type;\nexport const TurnFailedEvent = durableEventSchema(turnFailedEventType, TurnFailedPayload);\nexport type TurnFailedEvent = typeof TurnFailedEvent.Type;\n\n/** @deprecated Legacy payload retained for durable replay. New stops use `TurnFailedPayload` with `error.code = \"turn.interrupted\"`. */\nexport const TurnStoppedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n reason: Schema.String,\n});\n/** @deprecated Use `TurnFailedPayload` with interruption metadata. */\nexport type TurnStoppedPayload = typeof TurnStoppedPayload.Type;\n/** @deprecated Legacy event schema retained for durable replay; new producers emit `TurnFailedEvent`. */\nexport const TurnStoppedEvent = durableEventSchema(turnStoppedEventType, TurnStoppedPayload);\n/** @deprecated Use `TurnFailedEvent` with interruption metadata. */\nexport type TurnStoppedEvent = typeof TurnStoppedEvent.Type;\n\n/** Durable event union for turn lifecycle boundaries. */\nexport const TurnEvent = Schema.Union([\n TurnStartedEvent,\n TurnCompletedEvent,\n TurnFailedEvent,\n TurnStoppedEvent,\n]);\nexport type TurnEvent = typeof TurnEvent.Type;\n\n/** Event type values for durable model-inference lifecycle events. */\nexport const inferenceStartedEventType = makeEventType(\"InferenceStarted\");\nexport const inferenceCompletedEventType = makeEventType(\"InferenceCompleted\");\nexport const inferenceFailedEventType = makeEventType(\"InferenceFailed\");\n\n/** Payload recorded when one model inference starts for a turn. */\nexport const InferenceStartedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n});\nexport type InferenceStartedPayload = typeof InferenceStartedPayload.Type;\nexport const InferenceStartedEvent = durableEventSchema(\n inferenceStartedEventType,\n InferenceStartedPayload,\n);\nexport type InferenceStartedEvent = typeof InferenceStartedEvent.Type;\n\n/** Payload recorded when one model inference completes. */\nexport const InferenceCompletedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n finishReason: Schema.optionalKey(Schema.String),\n usage: Schema.optionalKey(UsagePayload),\n responseMetadata: Schema.optionalKey(Schema.Unknown),\n finishMetadata: Schema.optionalKey(Schema.Unknown),\n});\nexport type InferenceCompletedPayload = typeof InferenceCompletedPayload.Type;\nexport const InferenceCompletedEvent = durableEventSchema(\n inferenceCompletedEventType,\n InferenceCompletedPayload,\n);\nexport type InferenceCompletedEvent = typeof InferenceCompletedEvent.Type;\n\n/** Payload recorded when one model inference fails or is interrupted. */\nexport const InferenceFailedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n error: FailurePayload,\n});\nexport type InferenceFailedPayload = typeof InferenceFailedPayload.Type;\nexport const InferenceFailedEvent = durableEventSchema(\n inferenceFailedEventType,\n InferenceFailedPayload,\n);\nexport type InferenceFailedEvent = typeof InferenceFailedEvent.Type;\n\n/** Durable event union for canonical model-inference lifecycle boundaries. */\nexport const InferenceEvent = Schema.Union([\n InferenceStartedEvent,\n InferenceCompletedEvent,\n InferenceFailedEvent,\n]);\nexport type InferenceEvent = typeof InferenceEvent.Type;\n\n/** Event type values for durable tool lifecycle events. */\nexport const toolCallCreatedEventType = makeEventType(\"ToolCallCreated\");\nexport const toolCallRejectedEventType = makeEventType(\"ToolCallRejected\");\nexport const toolCallStartedEventType = makeEventType(\"ToolCallStarted\");\nexport const toolCallCompletedEventType = makeEventType(\"ToolCallCompleted\");\nexport const toolCallFailedEventType = makeEventType(\"ToolCallFailed\");\n\n/** Reason a model-requested tool call was rejected before execution. */\nexport const ToolCallRejectionReason = Schema.Literals([\"unknown-tool\", \"invalid-params\"]);\nexport type ToolCallRejectionReason = typeof ToolCallRejectionReason.Type;\n\n/** Exact synthetic tool-result feedback for a rejected model-requested tool call. */\nexport const ToolCallRejectionFeedback = Schema.Struct({\n message: Schema.String,\n reason: ToolCallRejectionReason,\n modelFeedback: Schema.NonEmptyString,\n});\nexport type ToolCallRejectionFeedback = typeof ToolCallRejectionFeedback.Type;\n\n/** Exact prompt part for a rejected model-requested tool call. */\nexport const ToolRejectionPromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(true),\n result: ToolCallRejectionFeedback,\n});\nexport type ToolRejectionPromptPart = typeof ToolRejectionPromptPart.Type;\n\n/** Exact prompt part for a successful framework-owned tool result. */\nexport const ToolSuccessPromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(false),\n result: Schema.Unknown,\n});\nexport type ToolSuccessPromptPart = typeof ToolSuccessPromptPart.Type;\n\n/** Exact prompt part for a failed framework-owned tool result. */\nexport const ToolFailurePromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(true),\n result: FailurePayload,\n});\nexport type ToolFailurePromptPart = typeof ToolFailurePromptPart.Type;\n\n/** Payload recorded once streamed tool parameters validate and become executable. */\nexport const ToolCallCreatedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolCallPromptPart,\n});\nexport type ToolCallCreatedPayload = typeof ToolCallCreatedPayload.Type;\nexport const ToolCallCreatedEvent = durableEventSchema(\n toolCallCreatedEventType,\n ToolCallCreatedPayload,\n);\nexport type ToolCallCreatedEvent = typeof ToolCallCreatedEvent.Type;\n\n/** Payload recorded when a model-requested tool call is not executable. */\nexport const ToolCallRejectedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolRejectionPromptPart,\n});\nexport type ToolCallRejectedPayload = typeof ToolCallRejectedPayload.Type;\nexport const ToolCallRejectedEvent = durableEventSchema(\n toolCallRejectedEventType,\n ToolCallRejectedPayload,\n);\nexport type ToolCallRejectedEvent = typeof ToolCallRejectedEvent.Type;\n\n/** Payload recorded when framework-owned tool execution starts. */\nexport const ToolCallStartedPayload = Schema.Struct({ toolCallId: ToolCallId });\nexport type ToolCallStartedPayload = typeof ToolCallStartedPayload.Type;\nexport const ToolCallStartedEvent = durableEventSchema(\n toolCallStartedEventType,\n ToolCallStartedPayload,\n);\nexport type ToolCallStartedEvent = typeof ToolCallStartedEvent.Type;\n\n/** Payload recorded when a tool call completes with a result. */\nexport const ToolCallCompletedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n promptPart: ToolSuccessPromptPart,\n});\nexport type ToolCallCompletedPayload = typeof ToolCallCompletedPayload.Type;\nexport const ToolCallCompletedEvent = durableEventSchema(\n toolCallCompletedEventType,\n ToolCallCompletedPayload,\n);\nexport type ToolCallCompletedEvent = typeof ToolCallCompletedEvent.Type;\n\n/** Payload recorded when a tool call fails. */\nexport const ToolCallFailedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n error: Schema.optionalKey(FailurePayload),\n promptPart: ToolFailurePromptPart,\n});\nexport type ToolCallFailedPayload = typeof ToolCallFailedPayload.Type;\nexport const ToolCallFailedEvent = durableEventSchema(\n toolCallFailedEventType,\n ToolCallFailedPayload,\n);\nexport type ToolCallFailedEvent = typeof ToolCallFailedEvent.Type;\n\n/** Durable event union for tool lifecycle boundaries. */\nexport const ToolCallEvent = Schema.Union([\n ToolCallCreatedEvent,\n ToolCallRejectedEvent,\n ToolCallStartedEvent,\n ToolCallCompletedEvent,\n ToolCallFailedEvent,\n]);\nexport type ToolCallEvent = typeof ToolCallEvent.Type;\n\n/** Event type values for durable stop-control events. */\nexport const stopTurnRequestedEventType = makeEventType(\"StopTurnRequested\");\nexport const stopTurnAppliedEventType = makeEventType(\"StopTurnApplied\");\n\n/** Payload recorded when a stop command targets active or future turn work. */\nexport const StopTurnRequestedPayload = Schema.Struct({\n commandId: CommandId,\n runId: Schema.optionalKey(RunId),\n turnId: Schema.optionalKey(TurnId),\n});\nexport type StopTurnRequestedPayload = typeof StopTurnRequestedPayload.Type;\nexport const StopTurnRequestedEvent = durableEventSchema(\n stopTurnRequestedEventType,\n StopTurnRequestedPayload,\n);\nexport type StopTurnRequestedEvent = typeof StopTurnRequestedEvent.Type;\n\n/** Payload recorded when a stop request has affected runtime work. */\nexport const StopTurnAppliedPayload = Schema.Struct({\n commandId: CommandId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: Schema.optionalKey(InferenceId),\n});\nexport type StopTurnAppliedPayload = typeof StopTurnAppliedPayload.Type;\nexport const StopTurnAppliedEvent = durableEventSchema(\n stopTurnAppliedEventType,\n StopTurnAppliedPayload,\n);\nexport type StopTurnAppliedEvent = typeof StopTurnAppliedEvent.Type;\n\n/** Durable event union for stop-request lifecycle boundaries. */\nexport const StopControlEvent = Schema.Union([StopTurnRequestedEvent, StopTurnAppliedEvent]);\nexport type StopControlEvent = typeof StopControlEvent.Type;\n\n/** Event type values for durable context and compaction events. */\nexport const contextProjectedEventType = makeEventType(\"ContextProjected\");\nexport const compactionRequestedEventType = makeEventType(\"CompactionRequested\");\nexport const compactionStartedEventType = makeEventType(\"CompactionStarted\");\nexport const summaryCreatedEventType = makeEventType(\"SummaryCreated\");\nexport const compactionCompletedEventType = makeEventType(\"CompactionCompleted\");\nexport const contextRebasedEventType = makeEventType(\"ContextRebased\");\nexport const compactionFailedEventType = makeEventType(\"CompactionFailed\");\n\n/** Payload recorded when the prompt context projection advances. */\nexport const ContextProjectedPayload = Schema.Struct({\n contextVersion: ContextVersion,\n throughSeq: SequenceNumber,\n});\nexport type ContextProjectedPayload = typeof ContextProjectedPayload.Type;\nexport const ContextProjectedEvent = durableEventSchema(\n contextProjectedEventType,\n ContextProjectedPayload,\n);\nexport type ContextProjectedEvent = typeof ContextProjectedEvent.Type;\n\n/** Payload recorded when compaction is requested for a durable range. */\nexport const CompactionRequestedPayload = Schema.Struct({\n compactionId: CompactionId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n});\nexport type CompactionRequestedPayload = typeof CompactionRequestedPayload.Type;\nexport const CompactionRequestedEvent = durableEventSchema(\n compactionRequestedEventType,\n CompactionRequestedPayload,\n);\nexport type CompactionRequestedEvent = typeof CompactionRequestedEvent.Type;\n\n/** Payload recorded when compaction starts. */\nexport const CompactionStartedPayload = Schema.Struct({ compactionId: CompactionId });\nexport type CompactionStartedPayload = typeof CompactionStartedPayload.Type;\nexport const CompactionStartedEvent = durableEventSchema(\n compactionStartedEventType,\n CompactionStartedPayload,\n);\nexport type CompactionStartedEvent = typeof CompactionStartedEvent.Type;\n\n/** Payload recorded when a summary artifact is created. */\nexport const SummaryCreatedPayload = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n summary: Schema.Unknown,\n});\nexport type SummaryCreatedPayload = typeof SummaryCreatedPayload.Type;\nexport const SummaryCreatedEvent = durableEventSchema(\n summaryCreatedEventType,\n SummaryCreatedPayload,\n);\nexport type SummaryCreatedEvent = typeof SummaryCreatedEvent.Type;\n\n/** Payload recorded when compaction completes. */\nexport const CompactionCompletedPayload = Schema.Struct({ compactionId: CompactionId });\nexport type CompactionCompletedPayload = typeof CompactionCompletedPayload.Type;\nexport const CompactionCompletedEvent = durableEventSchema(\n compactionCompletedEventType,\n CompactionCompletedPayload,\n);\nexport type CompactionCompletedEvent = typeof CompactionCompletedEvent.Type;\n\n/** Payload recorded when durable context is rebased onto a summary. */\nexport const ContextRebasedPayload = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n contextVersion: ContextVersion,\n retainedFromContextSeq: SequenceNumber,\n});\nexport type ContextRebasedPayload = typeof ContextRebasedPayload.Type;\nexport const ContextRebasedEvent = durableEventSchema(\n contextRebasedEventType,\n ContextRebasedPayload,\n);\nexport type ContextRebasedEvent = typeof ContextRebasedEvent.Type;\n\n/** Payload recorded when compaction fails. */\nexport const CompactionFailedPayload = Schema.Struct({\n compactionId: CompactionId,\n error: FailurePayload,\n});\nexport type CompactionFailedPayload = typeof CompactionFailedPayload.Type;\nexport const CompactionFailedEvent = durableEventSchema(\n compactionFailedEventType,\n CompactionFailedPayload,\n);\nexport type CompactionFailedEvent = typeof CompactionFailedEvent.Type;\n\n/** Durable event union for context projection and compaction boundaries. */\nexport const ContextAndCompactionEvent = Schema.Union([\n ContextProjectedEvent,\n CompactionRequestedEvent,\n CompactionStartedEvent,\n SummaryCreatedEvent,\n CompactionCompletedEvent,\n ContextRebasedEvent,\n CompactionFailedEvent,\n]);\nexport type ContextAndCompactionEvent = typeof ContextAndCompactionEvent.Type;\n\n/** Event type values for durable BaseState lifecycle events. */\nexport const baseStateRequestedEventType = makeEventType(\"BaseStateRequested\");\nexport const baseStateCreatedEventType = makeEventType(\"BaseStateCreated\");\nexport const baseStateFailedEventType = makeEventType(\"BaseStateFailed\");\n\n/** Payload recorded when durable BaseState generation is requested. */\nexport const BaseStateRequestedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n requestedThroughSeq: SequenceNumber,\n});\nexport type BaseStateRequestedPayload = typeof BaseStateRequestedPayload.Type;\nexport const BaseStateRequestedEvent = durableEventSchema(\n baseStateRequestedEventType,\n BaseStateRequestedPayload,\n);\nexport type BaseStateRequestedEvent = typeof BaseStateRequestedEvent.Type;\n\n/** Payload recorded when a BaseState snapshot is created. */\nexport const BaseStateCreatedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n coversThroughSeq: SequenceNumber,\n});\nexport type BaseStateCreatedPayload = typeof BaseStateCreatedPayload.Type;\nexport const BaseStateCreatedEvent = durableEventSchema(\n baseStateCreatedEventType,\n BaseStateCreatedPayload,\n);\nexport type BaseStateCreatedEvent = typeof BaseStateCreatedEvent.Type;\n\n/** Payload recorded when BaseState generation fails. */\nexport const BaseStateFailedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n error: FailurePayload,\n});\nexport type BaseStateFailedPayload = typeof BaseStateFailedPayload.Type;\nexport const BaseStateFailedEvent = durableEventSchema(\n baseStateFailedEventType,\n BaseStateFailedPayload,\n);\nexport type BaseStateFailedEvent = typeof BaseStateFailedEvent.Type;\n\n/** Durable event union for BaseState lifecycle boundaries. */\nexport const BaseStateEvent = Schema.Union([\n BaseStateRequestedEvent,\n BaseStateCreatedEvent,\n BaseStateFailedEvent,\n]);\nexport type BaseStateEvent = typeof BaseStateEvent.Type;\n\n/** Built-in durable event union for framework-owned session facts. */\nexport const EDADurableEvent = Schema.Union([\n CommandEvent,\n MessageEvent,\n RunEvent,\n RecoveryEvent,\n TurnEvent,\n InferenceEvent,\n ToolCallEvent,\n StopControlEvent,\n ContextAndCompactionEvent,\n BaseStateEvent,\n]);\nexport type EDADurableEvent = typeof EDADurableEvent.Type;\n\n/** Current V1 framework durable event schema. Future versions route beside this alias. */\nexport const EDADurableEventV1 = EDADurableEvent;\nexport type EDADurableEventV1 = typeof EDADurableEventV1.Type;\n\n/** Decode one framework-owned durable event through the namespace/type/version router. */\nexport const decodeUnknownEDADurableEventSync = (input: unknown): EDADurableEvent => {\n const envelope = Schema.decodeUnknownSync(DurableEventEnvelope)(input);\n if (envelope.namespace !== effectDurableAgentNamespace) {\n throw new Error(\n `EDADurableEvent decoder only accepts namespace ${effectDurableAgentNamespace}; received ${envelope.namespace}`,\n );\n }\n\n switch (envelope.schemaVersion) {\n case schemaV1:\n return Schema.decodeUnknownSync(EDADurableEventV1)(envelope);\n default:\n throw new Error(\n `Unsupported EDA durable event schemaVersion ${envelope.schemaVersion} for ${envelope.type}`,\n );\n }\n};\n\n/** Effectful V1+ router for untrusted framework-owned durable event boundaries. */\nexport const decodeUnknownEDADurableEvent = (\n input: unknown,\n): Effect.Effect<EDADurableEvent, unknown> =>\n Effect.try({\n try: () => decodeUnknownEDADurableEventSync(input),\n catch: (error) => error,\n });\n"],"mappings":";;;;;;;;AAOA,MAAa,iBAAiB,OAAO;;AAIrC,MAAa,YAAY,OAAO;;AAIhC,MAAa,iBACX,UACG;;AAML,MAAa,iBAAiB,OAAO,eAAe,KAAK,OAAO,MAAM,gBAAgB,CAAC;;AAIvF,MAAa,gBAAgB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAI9E,MAAa,kBAAkB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,EAAE,KAChF,OAAO,MAAM,iBAAiB,CAChC;;AAIA,MAAa,kBAAkB,OAAO,SAAS,CAAC,WAAW,WAAW,CAAC;;AAIvE,MAAa,gBAAgB,OAAO,OAAO;CACzC,WAAW;CACX,MAAM;CACN,eAAe;CACf,YAAY;CACZ,SAAS;CACT,WAAW;CACX,eAAe,OAAO,YAAY,aAAa;CAC/C,aAAa;CACb,OAAO,cAAc,KAAK,OAAO,uBAAuB,OAAO,KAAK,qBAAqB,CAAC,CAAC;CAC3F,SAAS,OAAO;AAClB,CAAC;;AAID,MAAa,uBAAuB,OAAO,OAAO;CAChD,GAAG,cAAc;CACjB,YAAY,OAAO,QAAQ,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