@effect-agent/storage-cloudflare 0.1.0-beta.45 → 0.1.0-beta.47

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 (68) hide show
  1. package/dist/DoMemoryStore.d.mts +24 -0
  2. package/dist/DoMemoryStore.mjs +50 -0
  3. package/dist/DoMemoryStore.mjs.map +1 -0
  4. package/dist/DoScheduleStore.d.mts +36 -0
  5. package/dist/DoScheduleStore.mjs +369 -0
  6. package/dist/DoScheduleStore.mjs.map +1 -0
  7. package/dist/DoStorageConfig.d.mts +45 -0
  8. package/dist/DoStorageConfig.mjs +52 -0
  9. package/dist/DoStorageConfig.mjs.map +1 -0
  10. package/dist/{do-storage-failpoint-9XB9tuif.d.mts → DoStorageError-Qwybzk0O.d.mts} +6 -15
  11. package/dist/DoStorageError.d.mts +2 -0
  12. package/dist/DoStorageError.mjs +158 -0
  13. package/dist/DoStorageError.mjs.map +1 -0
  14. package/dist/DoStorageFailpoint.d.mts +17 -0
  15. package/dist/{do-storage-failpoint-C-Qtchs7.mjs → DoStorageFailpoint.mjs} +5 -3
  16. package/dist/DoStorageFailpoint.mjs.map +1 -0
  17. package/dist/{testing.d.mts → DoStorageFailpointTesting.d.mts} +4 -3
  18. package/dist/{testing.mjs → DoStorageFailpointTesting.mjs} +3 -3
  19. package/dist/DoStorageFailpointTesting.mjs.map +1 -0
  20. package/dist/DoStorageVersion-KrYUXqeJ.d.mts +10 -0
  21. package/dist/DoStorageVersion.d.mts +2 -0
  22. package/dist/DoStorageVersion.mjs +8 -0
  23. package/dist/DoStorageVersion.mjs.map +1 -0
  24. package/dist/DoSubmissionLedger.d.mts +23 -0
  25. package/dist/DoSubmissionLedger.mjs +1716 -0
  26. package/dist/DoSubmissionLedger.mjs.map +1 -0
  27. package/dist/DoSubscriptionStore.d.mts +25 -0
  28. package/dist/DoSubscriptionStore.mjs +720 -0
  29. package/dist/DoSubscriptionStore.mjs.map +1 -0
  30. package/dist/DoThreadStore-D9ebIYPv.mjs +1083 -0
  31. package/dist/DoThreadStore-D9ebIYPv.mjs.map +1 -0
  32. package/dist/DoThreadStore.d.mts +59 -0
  33. package/dist/DoThreadStore.mjs +5 -0
  34. package/dist/MemoryProtocol.d.mts +19796 -0
  35. package/dist/MemoryProtocol.mjs +182 -0
  36. package/dist/MemoryProtocol.mjs.map +1 -0
  37. package/dist/PortProtocol.d.mts +1587 -0
  38. package/dist/PortProtocol.mjs +175 -0
  39. package/dist/PortProtocol.mjs.map +1 -0
  40. package/dist/PortRouting.d.mts +82 -0
  41. package/dist/PortRouting.mjs +404 -0
  42. package/dist/PortRouting.mjs.map +1 -0
  43. package/dist/index.d.mts +13 -21619
  44. package/dist/index.mjs +13 -4954
  45. package/dist/migrations-Bo4GU-pp.mjs +236 -0
  46. package/dist/migrations-Bo4GU-pp.mjs.map +1 -0
  47. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  48. package/package.json +1 -1
  49. package/src/{do-memory-store.ts → DoMemoryStore.ts} +5 -2
  50. package/src/{do-schedule-store.ts → DoScheduleStore.ts} +6 -4
  51. package/src/{errors.ts → DoStorageError.ts} +1 -1
  52. package/src/{do-storage-failpoint.ts → DoStorageFailpoint.ts} +1 -1
  53. package/src/{do-storage-failpoint-testing.ts → DoStorageFailpointTesting.ts} +2 -2
  54. package/src/DoStorageVersion.ts +2 -0
  55. package/src/{do-ledger.ts → DoSubmissionLedger.ts} +22 -20
  56. package/src/{do-subscription-store.ts → DoSubscriptionStore.ts} +10 -8
  57. package/src/{do-thread-store.ts → DoThreadStore.ts} +19 -21
  58. package/src/{memory-protocol.ts → MemoryProtocol.ts} +15 -10
  59. package/src/{port-protocol.ts → PortProtocol.ts} +13 -11
  60. package/src/{routing.ts → PortRouting.ts} +10 -8
  61. package/src/index.ts +12 -36
  62. package/src/{do-journal.ts → internal/do-journal.ts} +2 -2
  63. package/dist/do-storage-failpoint-C-Qtchs7.mjs.map +0 -1
  64. package/dist/index.mjs.map +0 -1
  65. package/dist/testing.mjs.map +0 -1
  66. package/src/testing.ts +0 -2
  67. /package/src/{do-storage-config.ts → DoStorageConfig.ts} +0 -0
  68. /package/src/{migrations.ts → internal/migrations.ts} +0 -0
@@ -0,0 +1,236 @@
1
+ import { SqliteMigrator } from "@effect/sql-sqlite-do";
2
+ import { Effect } from "effect";
3
+ import * as SqlClient from "effect/unstable/sql/SqlClient";
4
+ //#region src/internal/migrations.ts
5
+ /** The current storage version recorded in `effect_agent_meta`. */
6
+ const CurrentDoStorageVersion = 2;
7
+ /**
8
+ * The Thread Durable Object schema shares its thread and ledger tables with Node/SQLite.
9
+ * Schedules and subscriptions use separate Durable Objects. Two DC-specific additions:
10
+ *
11
+ * 1. `effect_agent_meta` replaces `PRAGMA user_version` as the exact-or-fresh version gate —
12
+ * a meta table is portable regardless of which PRAGMAs Durable Object SQL storage allows.
13
+ * 2. `effect_agent_child_settlements` is the durable cross-store notification marker the
14
+ * SubmissionLedger port contract mandates for cross-store adapters (`suspend`'s covering
15
+ * check and `recordChildSettled`'s wake both consult it): parent and child Threads
16
+ * live in different Durable Objects, so a child settlement reported before the parent's
17
+ * suspend commits must be observable from the PARENT's own storage.
18
+ */
19
+ const doMigrations = SqliteMigrator.fromRecord({ "1_current_cloudflare_thread_object": Effect.gen(function* () {
20
+ const sql = yield* SqlClient.SqlClient;
21
+ yield* sql`
22
+ CREATE TABLE effect_agent_threads (
23
+ thread_id TEXT PRIMARY KEY NOT NULL,
24
+ created_at TEXT NOT NULL,
25
+ tail_sequence INTEGER NOT NULL,
26
+ tail_digest TEXT NOT NULL,
27
+ producer_epoch INTEGER NOT NULL
28
+ )
29
+ `.withoutTransform;
30
+ yield* sql`
31
+ CREATE TABLE effect_agent_canonical_batches (
32
+ thread_id TEXT NOT NULL,
33
+ batch_id TEXT NOT NULL,
34
+ first_sequence INTEGER NOT NULL,
35
+ last_sequence INTEGER NOT NULL,
36
+ batch_digest TEXT NOT NULL,
37
+ tail_digest TEXT NOT NULL,
38
+ batch_json TEXT NOT NULL,
39
+ PRIMARY KEY (thread_id, batch_id),
40
+ FOREIGN KEY (thread_id)
41
+ REFERENCES effect_agent_threads(thread_id)
42
+ ON DELETE RESTRICT
43
+ )
44
+ `.withoutTransform;
45
+ yield* sql`
46
+ CREATE TABLE effect_agent_canonical_records (
47
+ thread_id TEXT NOT NULL,
48
+ sequence INTEGER NOT NULL,
49
+ record_id TEXT NOT NULL,
50
+ batch_id TEXT NOT NULL,
51
+ record_json TEXT NOT NULL,
52
+ PRIMARY KEY (thread_id, sequence),
53
+ UNIQUE (thread_id, record_id),
54
+ FOREIGN KEY (thread_id, batch_id)
55
+ REFERENCES effect_agent_canonical_batches(thread_id, batch_id)
56
+ ON DELETE RESTRICT
57
+ )
58
+ `.withoutTransform;
59
+ yield* sql`
60
+ CREATE INDEX effect_agent_canonical_records_batch
61
+ ON effect_agent_canonical_records (thread_id, batch_id, sequence)
62
+ `.withoutTransform;
63
+ yield* sql`
64
+ CREATE TABLE effect_agent_checkpoints (
65
+ thread_id TEXT NOT NULL,
66
+ through_sequence INTEGER NOT NULL,
67
+ tail_digest TEXT NOT NULL,
68
+ checkpoint_json TEXT NOT NULL,
69
+ PRIMARY KEY (thread_id, through_sequence),
70
+ FOREIGN KEY (thread_id)
71
+ REFERENCES effect_agent_threads(thread_id)
72
+ ON DELETE RESTRICT
73
+ )
74
+ `.withoutTransform;
75
+ yield* sql`
76
+ CREATE TABLE effect_agent_submissions (
77
+ submission_id TEXT PRIMARY KEY NOT NULL,
78
+ thread_id TEXT NOT NULL,
79
+ queue_sequence INTEGER NOT NULL,
80
+ principal TEXT NOT NULL,
81
+ idempotency_key TEXT NOT NULL,
82
+ agent_id TEXT NOT NULL,
83
+ agent_digests_json TEXT NOT NULL,
84
+ deployment_id TEXT NOT NULL,
85
+ input_json TEXT NOT NULL,
86
+ input_digest TEXT NOT NULL,
87
+ receipt_id TEXT NOT NULL,
88
+ state TEXT NOT NULL,
89
+ settled_outcome TEXT,
90
+ created_at TEXT NOT NULL,
91
+ ready_at TEXT,
92
+ input_applied_record_id TEXT,
93
+ input_applied_sequence INTEGER,
94
+ joined_host_submission_id TEXT,
95
+ suspended_reason_json TEXT,
96
+ suspended_at TEXT,
97
+ unknown_reason TEXT,
98
+ unknown_tool_call_ids_json TEXT,
99
+ parent_submission_id TEXT,
100
+ parent_tool_call_id TEXT,
101
+ UNIQUE (thread_id, principal, idempotency_key),
102
+ UNIQUE (thread_id, queue_sequence)
103
+ )
104
+ `.withoutTransform;
105
+ yield* sql`
106
+ CREATE INDEX effect_agent_submissions_joined_host
107
+ ON effect_agent_submissions (joined_host_submission_id)
108
+ `.withoutTransform;
109
+ yield* sql`
110
+ CREATE INDEX effect_agent_submissions_parent
111
+ ON effect_agent_submissions (parent_submission_id)
112
+ `.withoutTransform;
113
+ yield* sql`
114
+ CREATE TABLE effect_agent_submission_ownership (
115
+ submission_id TEXT PRIMARY KEY NOT NULL,
116
+ attempt_id TEXT NOT NULL,
117
+ ownership_token TEXT NOT NULL,
118
+ producer_epoch INTEGER NOT NULL,
119
+ owner_producer_id TEXT NOT NULL,
120
+ lease_expires_at TEXT NOT NULL,
121
+ FOREIGN KEY (submission_id)
122
+ REFERENCES effect_agent_submissions(submission_id)
123
+ ON DELETE RESTRICT
124
+ )
125
+ `.withoutTransform;
126
+ yield* sql`
127
+ CREATE TABLE effect_agent_attempts (
128
+ attempt_id TEXT PRIMARY KEY NOT NULL,
129
+ submission_id TEXT NOT NULL,
130
+ thread_id TEXT NOT NULL,
131
+ owner_producer_id TEXT NOT NULL,
132
+ producer_epoch INTEGER NOT NULL,
133
+ claimed_at TEXT NOT NULL,
134
+ FOREIGN KEY (submission_id)
135
+ REFERENCES effect_agent_submissions(submission_id)
136
+ ON DELETE RESTRICT
137
+ )
138
+ `.withoutTransform;
139
+ yield* sql`
140
+ CREATE TABLE effect_agent_settlement_reservations (
141
+ submission_id TEXT PRIMARY KEY NOT NULL,
142
+ settlement_id TEXT NOT NULL,
143
+ outcome TEXT NOT NULL,
144
+ record_id TEXT NOT NULL,
145
+ record_json TEXT NOT NULL,
146
+ record_digest TEXT NOT NULL,
147
+ reserved_at TEXT NOT NULL,
148
+ finalized_at TEXT,
149
+ FOREIGN KEY (submission_id)
150
+ REFERENCES effect_agent_submissions(submission_id)
151
+ ON DELETE RESTRICT
152
+ )
153
+ `.withoutTransform;
154
+ yield* sql`
155
+ CREATE TABLE effect_agent_abort_intents (
156
+ submission_id TEXT PRIMARY KEY NOT NULL,
157
+ author TEXT NOT NULL,
158
+ reason TEXT NOT NULL,
159
+ requested_at TEXT NOT NULL,
160
+ canonical_record_id TEXT,
161
+ FOREIGN KEY (submission_id)
162
+ REFERENCES effect_agent_submissions(submission_id)
163
+ ON DELETE RESTRICT
164
+ )
165
+ `.withoutTransform;
166
+ yield* sql`
167
+ CREATE TABLE effect_agent_approval_decisions (
168
+ submission_id TEXT NOT NULL,
169
+ tool_call_id TEXT NOT NULL,
170
+ decision TEXT NOT NULL,
171
+ resolver TEXT NOT NULL,
172
+ reason TEXT NOT NULL,
173
+ decided_at TEXT NOT NULL,
174
+ PRIMARY KEY (submission_id, tool_call_id),
175
+ FOREIGN KEY (submission_id)
176
+ REFERENCES effect_agent_submissions(submission_id)
177
+ ON DELETE RESTRICT
178
+ )
179
+ `.withoutTransform;
180
+ yield* sql`
181
+ CREATE TABLE effect_agent_unknown_resolutions (
182
+ submission_id TEXT NOT NULL,
183
+ tool_call_id TEXT NOT NULL,
184
+ author TEXT NOT NULL,
185
+ reason TEXT NOT NULL,
186
+ resolution_json TEXT NOT NULL,
187
+ resolved_at TEXT NOT NULL,
188
+ PRIMARY KEY (submission_id, tool_call_id),
189
+ FOREIGN KEY (submission_id)
190
+ REFERENCES effect_agent_submissions(submission_id)
191
+ ON DELETE RESTRICT
192
+ )
193
+ `.withoutTransform;
194
+ yield* sql`
195
+ CREATE TABLE effect_agent_child_reservations (
196
+ reservation_id TEXT PRIMARY KEY NOT NULL,
197
+ parent_submission_id TEXT NOT NULL,
198
+ parent_tool_call_id TEXT NOT NULL,
199
+ child_submission_id TEXT,
200
+ status TEXT NOT NULL,
201
+ allocation_json TEXT NOT NULL,
202
+ allocation_digest TEXT NOT NULL,
203
+ accounting_json TEXT,
204
+ reserved_at TEXT NOT NULL,
205
+ release_began_at TEXT,
206
+ released_at TEXT,
207
+ UNIQUE (parent_submission_id, parent_tool_call_id),
208
+ FOREIGN KEY (parent_submission_id)
209
+ REFERENCES effect_agent_submissions(submission_id)
210
+ ON DELETE RESTRICT
211
+ )
212
+ `.withoutTransform;
213
+ yield* sql`
214
+ CREATE TABLE effect_agent_child_settlements (
215
+ parent_submission_id TEXT NOT NULL,
216
+ child_submission_id TEXT NOT NULL,
217
+ child_outcome TEXT,
218
+ recorded_at TEXT NOT NULL,
219
+ PRIMARY KEY (parent_submission_id, child_submission_id)
220
+ )
221
+ `.withoutTransform;
222
+ yield* sql`
223
+ CREATE TABLE effect_agent_meta (
224
+ key TEXT PRIMARY KEY NOT NULL,
225
+ value TEXT NOT NULL
226
+ )
227
+ `.withoutTransform;
228
+ yield* sql`
229
+ INSERT INTO effect_agent_meta (key, value)
230
+ VALUES ('storage_version', ${String(2)})
231
+ `.withoutTransform;
232
+ }) });
233
+ //#endregion
234
+ export { doMigrations as n, CurrentDoStorageVersion as t };
235
+
236
+ //# sourceMappingURL=migrations-Bo4GU-pp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations-Bo4GU-pp.mjs","names":[],"sources":["../src/internal/migrations.ts"],"sourcesContent":["import { SqliteMigrator } from \"@effect/sql-sqlite-do\";\nimport { Effect } from \"effect\";\nimport * as SqlClient from \"effect/unstable/sql/SqlClient\";\n\n/** The current storage version recorded in `effect_agent_meta`. */\nexport const CurrentDoStorageVersion = 2;\n\n/**\n * The Thread Durable Object schema shares its thread and ledger tables with Node/SQLite.\n * Schedules and subscriptions use separate Durable Objects. Two DC-specific additions:\n *\n * 1. `effect_agent_meta` replaces `PRAGMA user_version` as the exact-or-fresh version gate —\n * a meta table is portable regardless of which PRAGMAs Durable Object SQL storage allows.\n * 2. `effect_agent_child_settlements` is the durable cross-store notification marker the\n * SubmissionLedger port contract mandates for cross-store adapters (`suspend`'s covering\n * check and `recordChildSettled`'s wake both consult it): parent and child Threads\n * live in different Durable Objects, so a child settlement reported before the parent's\n * suspend commits must be observable from the PARENT's own storage.\n */\nexport const doMigrations = SqliteMigrator.fromRecord({\n \"1_current_cloudflare_thread_object\": Effect.gen(function* () {\n const sql = yield* SqlClient.SqlClient;\n\n yield* sql`\n CREATE TABLE effect_agent_threads (\n thread_id TEXT PRIMARY KEY NOT NULL,\n created_at TEXT NOT NULL,\n tail_sequence INTEGER NOT NULL,\n tail_digest TEXT NOT NULL,\n producer_epoch INTEGER NOT NULL\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_canonical_batches (\n thread_id TEXT NOT NULL,\n batch_id TEXT NOT NULL,\n first_sequence INTEGER NOT NULL,\n last_sequence INTEGER NOT NULL,\n batch_digest TEXT NOT NULL,\n tail_digest TEXT NOT NULL,\n batch_json TEXT NOT NULL,\n PRIMARY KEY (thread_id, batch_id),\n FOREIGN KEY (thread_id)\n REFERENCES effect_agent_threads(thread_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_canonical_records (\n thread_id TEXT NOT NULL,\n sequence INTEGER NOT NULL,\n record_id TEXT NOT NULL,\n batch_id TEXT NOT NULL,\n record_json TEXT NOT NULL,\n PRIMARY KEY (thread_id, sequence),\n UNIQUE (thread_id, record_id),\n FOREIGN KEY (thread_id, batch_id)\n REFERENCES effect_agent_canonical_batches(thread_id, batch_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE INDEX effect_agent_canonical_records_batch\n ON effect_agent_canonical_records (thread_id, batch_id, sequence)\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_checkpoints (\n thread_id TEXT NOT NULL,\n through_sequence INTEGER NOT NULL,\n tail_digest TEXT NOT NULL,\n checkpoint_json TEXT NOT NULL,\n PRIMARY KEY (thread_id, through_sequence),\n FOREIGN KEY (thread_id)\n REFERENCES effect_agent_threads(thread_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n // Admission rows exist before Thread materialization (durability §4), so\n // thread_id intentionally carries no foreign key into effect_agent_threads.\n yield* sql`\n CREATE TABLE effect_agent_submissions (\n submission_id TEXT PRIMARY KEY NOT NULL,\n thread_id TEXT NOT NULL,\n queue_sequence INTEGER NOT NULL,\n principal TEXT NOT NULL,\n idempotency_key TEXT NOT NULL,\n agent_id TEXT NOT NULL,\n agent_digests_json TEXT NOT NULL,\n deployment_id TEXT NOT NULL,\n input_json TEXT NOT NULL,\n input_digest TEXT NOT NULL,\n receipt_id TEXT NOT NULL,\n state TEXT NOT NULL,\n settled_outcome TEXT,\n created_at TEXT NOT NULL,\n ready_at TEXT,\n input_applied_record_id TEXT,\n input_applied_sequence INTEGER,\n joined_host_submission_id TEXT,\n suspended_reason_json TEXT,\n suspended_at TEXT,\n unknown_reason TEXT,\n unknown_tool_call_ids_json TEXT,\n parent_submission_id TEXT,\n parent_tool_call_id TEXT,\n UNIQUE (thread_id, principal, idempotency_key),\n UNIQUE (thread_id, queue_sequence)\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE INDEX effect_agent_submissions_joined_host\n ON effect_agent_submissions (joined_host_submission_id)\n `.withoutTransform;\n\n yield* sql`\n CREATE INDEX effect_agent_submissions_parent\n ON effect_agent_submissions (parent_submission_id)\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_submission_ownership (\n submission_id TEXT PRIMARY KEY NOT NULL,\n attempt_id TEXT NOT NULL,\n ownership_token TEXT NOT NULL,\n producer_epoch INTEGER NOT NULL,\n owner_producer_id TEXT NOT NULL,\n lease_expires_at TEXT NOT NULL,\n FOREIGN KEY (submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_attempts (\n attempt_id TEXT PRIMARY KEY NOT NULL,\n submission_id TEXT NOT NULL,\n thread_id TEXT NOT NULL,\n owner_producer_id TEXT NOT NULL,\n producer_epoch INTEGER NOT NULL,\n claimed_at TEXT NOT NULL,\n FOREIGN KEY (submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_settlement_reservations (\n submission_id TEXT PRIMARY KEY NOT NULL,\n settlement_id TEXT NOT NULL,\n outcome TEXT NOT NULL,\n record_id TEXT NOT NULL,\n record_json TEXT NOT NULL,\n record_digest TEXT NOT NULL,\n reserved_at TEXT NOT NULL,\n finalized_at TEXT,\n FOREIGN KEY (submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_abort_intents (\n submission_id TEXT PRIMARY KEY NOT NULL,\n author TEXT NOT NULL,\n reason TEXT NOT NULL,\n requested_at TEXT NOT NULL,\n canonical_record_id TEXT,\n FOREIGN KEY (submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_approval_decisions (\n submission_id TEXT NOT NULL,\n tool_call_id TEXT NOT NULL,\n decision TEXT NOT NULL,\n resolver TEXT NOT NULL,\n reason TEXT NOT NULL,\n decided_at TEXT NOT NULL,\n PRIMARY KEY (submission_id, tool_call_id),\n FOREIGN KEY (submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_unknown_resolutions (\n submission_id TEXT NOT NULL,\n tool_call_id TEXT NOT NULL,\n author TEXT NOT NULL,\n reason TEXT NOT NULL,\n resolution_json TEXT NOT NULL,\n resolved_at TEXT NOT NULL,\n PRIMARY KEY (submission_id, tool_call_id),\n FOREIGN KEY (submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_child_reservations (\n reservation_id TEXT PRIMARY KEY NOT NULL,\n parent_submission_id TEXT NOT NULL,\n parent_tool_call_id TEXT NOT NULL,\n child_submission_id TEXT,\n status TEXT NOT NULL,\n allocation_json TEXT NOT NULL,\n allocation_digest TEXT NOT NULL,\n accounting_json TEXT,\n reserved_at TEXT NOT NULL,\n release_began_at TEXT,\n released_at TEXT,\n UNIQUE (parent_submission_id, parent_tool_call_id),\n FOREIGN KEY (parent_submission_id)\n REFERENCES effect_agent_submissions(submission_id)\n ON DELETE RESTRICT\n )\n `.withoutTransform;\n\n // Durable cross-store child-settlement notification marker (parent-side; the child's row\n // lives in ANOTHER Durable Object). child_outcome is nullable: the notification command\n // carries identities only, and the child's canonical Settlement stays the outcome\n // authority (DUR-015). No foreign keys: the parent row is checked by the operation, and\n // the child row is intentionally foreign.\n yield* sql`\n CREATE TABLE effect_agent_child_settlements (\n parent_submission_id TEXT NOT NULL,\n child_submission_id TEXT NOT NULL,\n child_outcome TEXT,\n recorded_at TEXT NOT NULL,\n PRIMARY KEY (parent_submission_id, child_submission_id)\n )\n `.withoutTransform;\n\n yield* sql`\n CREATE TABLE effect_agent_meta (\n key TEXT PRIMARY KEY NOT NULL,\n value TEXT NOT NULL\n )\n `.withoutTransform;\n\n yield* sql`\n INSERT INTO effect_agent_meta (key, value)\n VALUES ('storage_version', ${String(CurrentDoStorageVersion)})\n `.withoutTransform;\n }),\n});\n"],"mappings":";;;;;AAKA,MAAa,0BAA0B;;;;;;;;;;;;;AAcvC,MAAa,eAAe,eAAe,WAAW,EACpD,sCAAsC,OAAO,IAAI,aAAa;CAC5D,MAAM,MAAM,OAAO,UAAU;CAE7B,OAAO,GAAG;;;;;;;;MAQR;CAEF,OAAO,GAAG;;;;;;;;;;;;;;MAcR;CAEF,OAAO,GAAG;;;;;;;;;;;;;MAaR;CAEF,OAAO,GAAG;;;MAGR;CAEF,OAAO,GAAG;;;;;;;;;;;MAWR;CAIF,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BR;CAEF,OAAO,GAAG;;;MAGR;CAEF,OAAO,GAAG;;;MAGR;CAEF,OAAO,GAAG;;;;;;;;;;;;MAYR;CAEF,OAAO,GAAG;;;;;;;;;;;;MAYR;CAEF,OAAO,GAAG;;;;;;;;;;;;;;MAcR;CAEF,OAAO,GAAG;;;;;;;;;;;MAWR;CAEF,OAAO,GAAG;;;;;;;;;;;;;MAaR;CAEF,OAAO,GAAG;;;;;;;;;;;;;MAaR;CAEF,OAAO,GAAG;;;;;;;;;;;;;;;;;;MAkBR;CAOF,OAAO,GAAG;;;;;;;;MAQR;CAEF,OAAO,GAAG;;;;;MAKR;CAEF,OAAO,GAAG;;mCAEqB,OAAA,CAA8B,EAAE;MAC7D;AACJ,CAAC,EACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@effect-agent/storage-cloudflare","version":"0.1.0-beta.45","dependencies":{"@effect-agent/core":"0.1.0-beta.45","@effect-agent/thread":"0.1.0-beta.45","@effect/platform-browser":"4.0.0-rc.112","@effect/sql-sqlite-do":"4.0.0-rc.112"},"devDependencies":{"@cloudflare/vitest-pool-workers":"0.21.3","@cloudflare/workers-types":"5.20260825.1","@effect-agent/testing":"0.1.0-beta.45","@effect/vitest":"4.0.0-rc.112","effect":"4.0.0-rc.112","typescript":"7.0.2","vite-plus":"0.3.0","vitest":"4.1.11"},"peerDependencies":{"effect":"^4.0.0-rc.112"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./testing":{"types":"./dist/testing.d.mts","default":"./dist/testing.mjs"}},"description":"Durable Object SQLite storage adapters and the routed port protocol for Effect Agent on Cloudflare.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/storage-cloudflare"},"files":["dist","src"],"type":"module","publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json"}}
1
+ {"name":"@effect-agent/storage-cloudflare","version":"0.1.0-beta.47","dependencies":{"@effect-agent/core":"0.1.0-beta.47","@effect-agent/thread":"0.1.0-beta.47","@effect/platform-browser":"4.0.0-rc.112","@effect/sql-sqlite-do":"4.0.0-rc.112"},"devDependencies":{"@cloudflare/vitest-pool-workers":"0.21.3","@cloudflare/workers-types":"5.20260825.1","@effect-agent/testing":"0.1.0-beta.47","@effect/vitest":"4.0.0-rc.112","effect":"4.0.0-rc.112","typescript":"7.0.2","vite-plus":"0.3.0","vitest":"4.1.11"},"peerDependencies":{"effect":"^4.0.0-rc.112"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./DoMemoryStore":{"types":"./dist/DoMemoryStore.d.mts","default":"./dist/DoMemoryStore.mjs"},"./DoScheduleStore":{"types":"./dist/DoScheduleStore.d.mts","default":"./dist/DoScheduleStore.mjs"},"./DoStorageConfig":{"types":"./dist/DoStorageConfig.d.mts","default":"./dist/DoStorageConfig.mjs"},"./DoStorageError":{"types":"./dist/DoStorageError.d.mts","default":"./dist/DoStorageError.mjs"},"./DoStorageFailpoint":{"types":"./dist/DoStorageFailpoint.d.mts","default":"./dist/DoStorageFailpoint.mjs"},"./DoStorageVersion":{"types":"./dist/DoStorageVersion.d.mts","default":"./dist/DoStorageVersion.mjs"},"./DoSubmissionLedger":{"types":"./dist/DoSubmissionLedger.d.mts","default":"./dist/DoSubmissionLedger.mjs"},"./DoSubscriptionStore":{"types":"./dist/DoSubscriptionStore.d.mts","default":"./dist/DoSubscriptionStore.mjs"},"./DoThreadStore":{"types":"./dist/DoThreadStore.d.mts","default":"./dist/DoThreadStore.mjs"},"./MemoryProtocol":{"types":"./dist/MemoryProtocol.d.mts","default":"./dist/MemoryProtocol.mjs"},"./PortProtocol":{"types":"./dist/PortProtocol.d.mts","default":"./dist/PortProtocol.mjs"},"./PortRouting":{"types":"./dist/PortRouting.d.mts","default":"./dist/PortRouting.mjs"},"./testing/DoStorageFailpointTesting":{"types":"./dist/DoStorageFailpointTesting.d.mts","default":"./dist/DoStorageFailpointTesting.mjs"}},"description":"Durable Object SQLite storage adapters and the routed port protocol for Effect Agent on Cloudflare.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/storage-cloudflare"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json"}}
@@ -1,5 +1,8 @@
1
- import { MemoryStorageError, MemoryMutationFailpoint } from "@effect-agent/core";
2
- import { memoryStoreLayerWithFailpoints, SqlMemoryLimits } from "@effect-agent/thread/sql-memory";
1
+ import { MemoryStorageError, MemoryMutationFailpoint } from "@effect-agent/core/MemoryStore";
2
+ import {
3
+ memoryStoreLayerWithFailpoints,
4
+ SqlMemoryLimits,
5
+ } from "@effect-agent/thread/SqlMemoryStore";
3
6
  import { SqliteClient } from "@effect/sql-sqlite-do";
4
7
  import { Effect, Layer, Schema } from "effect";
5
8
 
@@ -1,12 +1,9 @@
1
1
  import {
2
- applyScheduleChange,
3
2
  ScheduleCapacityError,
4
3
  ScheduleDueCursor,
5
4
  defaultSchedulingLimits,
6
- scheduleUsesCapacity,
7
5
  ScheduleChange,
8
6
  ScheduleConflict,
9
- scheduleDeadline,
10
7
  ScheduleFailpoint,
11
8
  type ScheduleFailpointError,
12
9
  ScheduleKey,
@@ -19,7 +16,12 @@ import {
19
16
  ScheduleRecord,
20
17
  ScheduleStorageError,
21
18
  ScheduleStore,
22
- } from "@effect-agent/thread";
19
+ } from "@effect-agent/thread/Schedule";
20
+ import {
21
+ applyScheduleChange,
22
+ scheduleUsesCapacity,
23
+ scheduleDeadline,
24
+ } from "@effect-agent/thread/ScheduleTransition";
23
25
  import { Context, Effect, Layer, Result, Schema } from "effect";
24
26
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
25
27
 
@@ -1,4 +1,4 @@
1
- import { CanonicalSequence, ProducerEpoch } from "@effect-agent/thread";
1
+ import { CanonicalSequence, ProducerEpoch } from "@effect-agent/thread/Records";
2
2
  import { Schema } from "effect";
3
3
 
4
4
  /** The Durable Object's SQLite storage uses a private-development format this adapter cannot read. */
@@ -1,6 +1,6 @@
1
1
  import { Context, Effect, Layer } from "effect";
2
2
 
3
- import type { DoStorageFailpointError, DoStorageFailpointLocation } from "./errors.ts";
3
+ import type { DoStorageFailpointError, DoStorageFailpointLocation } from "./DoStorageError.ts";
4
4
 
5
5
  export type DoStorageFailpointHandler = (
6
6
  location: DoStorageFailpointLocation,
@@ -1,7 +1,7 @@
1
1
  import { Context, Effect, Layer, Ref } from "effect";
2
2
 
3
- import { DoStorageFailpoint, type DoStorageFailpointHandler } from "./do-storage-failpoint.ts";
4
- import type { DoStorageFailpointLocation } from "./errors.ts";
3
+ import type { DoStorageFailpointLocation } from "./DoStorageError.ts";
4
+ import { DoStorageFailpoint, type DoStorageFailpointHandler } from "./DoStorageFailpoint.ts";
5
5
 
6
6
  const noFailpoint: DoStorageFailpointHandler = () => Effect.void;
7
7
 
@@ -0,0 +1,2 @@
1
+ /** Public DoStorageVersion API. Implementation helpers remain private. */
2
+ export { CurrentDoStorageVersion } from "./internal/migrations.ts";
@@ -1,3 +1,14 @@
1
+ import { EMPTY_TAIL_DIGEST } from "@effect-agent/thread/Digest";
2
+ import {
3
+ ApprovalDecision,
4
+ CanonicalSequence,
5
+ DefinitionDigests,
6
+ Digest,
7
+ PersistedJson,
8
+ ProducerEpoch,
9
+ RecordEnvelope,
10
+ SettlementOutcome,
11
+ } from "@effect-agent/thread/Records";
1
12
  import {
2
13
  AbortCommand,
3
14
  AbortIntent,
@@ -7,12 +18,10 @@ import {
7
18
  AdmissionRequest,
8
19
  AdmissionResult,
9
20
  ApprovalConflict,
10
- ApprovalDecision,
11
21
  ApprovalDecisionCommand,
12
22
  ApprovalDecisionIntent,
13
23
  AttachChildToReservationRequest,
14
24
  BeginChildBudgetReleaseRequest,
15
- CanonicalSequence,
16
25
  ChildAttachmentSnapshot,
17
26
  ChildBudgetReservationRequest,
18
27
  ChildBudgetReservationSnapshot,
@@ -22,9 +31,6 @@ import {
22
31
  Claim,
23
32
  ClaimJoiningRequest,
24
33
  ClaimRequest,
25
- DefinitionDigests,
26
- Digest,
27
- EMPTY_TAIL_DIGEST,
28
34
  InputAppliedMarker,
29
35
  JoinSnapshot,
30
36
  JoinedToHost,
@@ -39,10 +45,7 @@ import {
39
45
  OwnershipRenewal,
40
46
  OwnershipSnapshot,
41
47
  ParentLinkage,
42
- PersistedJson,
43
- ProducerEpoch,
44
48
  QueueSequence,
45
- RecordEnvelope,
46
49
  RecoverySnapshot,
47
50
  RecoverySnapshotRequest,
48
51
  ReleaseChildBudgetRequest,
@@ -54,7 +57,6 @@ import {
54
57
  Settlement,
55
58
  SettlementConflict,
56
59
  SettlementFinalization,
57
- SettlementOutcome,
58
60
  SettlementReservation,
59
61
  SubmissionLedger,
60
62
  SubmissionLookup,
@@ -73,28 +75,28 @@ import {
73
75
  submissionAbortRecordId,
74
76
  type ChildSettledOutcome,
75
77
  type SuspensionOutcome,
76
- } from "@effect-agent/thread";
78
+ } from "@effect-agent/thread/SubmissionLedger";
77
79
  import { BrowserCrypto } from "@effect/platform-browser";
78
80
  import { SqliteClient } from "@effect/sql-sqlite-do";
79
81
  import { Clock, Context, Crypto, DateTime, Effect, Layer, Option, Schema, Stream } from "effect";
80
82
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
81
83
  import type { SqlError } from "effect/unstable/sql/SqlError";
82
84
 
83
- import { decodeRows, initializeDoJournal } from "./do-journal.ts";
84
- import { DoStorageConfig } from "./do-storage-config.ts";
85
- import { DoStorageFailpoint } from "./do-storage-failpoint.ts";
86
- import {
87
- storageConfigLayer,
88
- storageFailpointLayer,
89
- type DoStorageInitializationError,
90
- type DoStorageOptions,
91
- } from "./do-thread-store.ts";
85
+ import { DoStorageConfig } from "./DoStorageConfig.ts";
92
86
  import {
93
87
  DoLedgerError,
94
88
  DoStorageCorruptionError,
95
89
  DoStorageError,
96
90
  type DoStorageFailpointLocation,
97
- } from "./errors.ts";
91
+ } from "./DoStorageError.ts";
92
+ import { DoStorageFailpoint } from "./DoStorageFailpoint.ts";
93
+ import {
94
+ storageConfigLayer,
95
+ storageFailpointLayer,
96
+ type DoStorageInitializationError,
97
+ type DoStorageOptions,
98
+ } from "./DoThreadStore.ts";
99
+ import { decodeRows, initializeDoJournal } from "./internal/do-journal.ts";
98
100
 
99
101
  type SubmissionId = SubmissionSnapshot["submissionId"];
100
102
 
@@ -1,14 +1,9 @@
1
- import type { SubscriptionFailpointError } from "@effect-agent/thread";
1
+ import { Digest } from "@effect-agent/thread/Records";
2
+ import { type SubscriptionFailpointError } from "@effect-agent/thread/Subscription";
2
3
  import {
3
4
  AcceptedEvent,
4
- applySubscriptionDeliveryChange,
5
5
  DeliveryChange,
6
- Digest,
7
- sameAcceptedEventIdentity,
8
- sameSourcePartition,
9
6
  SourcePartition,
10
- subscriptionCanSelect,
11
- subscriptionDeliveryCanSelect,
12
7
  SubscriptionDelivery,
13
8
  SubscriptionDeliveryKey,
14
9
  SubscriptionError,
@@ -20,7 +15,14 @@ import {
20
15
  SubscriptionScanCursors,
21
16
  SubscriptionStore,
22
17
  subscriptionDeliveryKeyString,
23
- } from "@effect-agent/thread";
18
+ } from "@effect-agent/thread/Subscription";
19
+ import {
20
+ applySubscriptionDeliveryChange,
21
+ sameAcceptedEventIdentity,
22
+ sameSourcePartition,
23
+ subscriptionCanSelect,
24
+ subscriptionDeliveryCanSelect,
25
+ } from "@effect-agent/thread/SubscriptionTransition";
24
26
  import { Clock, Context, Effect, Layer, Result, Schema } from "effect";
25
27
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
26
28
  import type { SqlError } from "effect/unstable/sql/SqlError";
@@ -1,10 +1,16 @@
1
+ import { digestCanonicalBatch, EMPTY_TAIL_DIGEST } from "@effect-agent/thread/Digest";
1
2
  import {
2
- AppendConflict,
3
- AppendResult,
4
3
  CanonicalBatch,
5
4
  CanonicalRecord,
6
5
  CanonicalRecordEnvelope,
7
6
  CanonicalSequence,
7
+ Digest,
8
+ ObservationOffset,
9
+ } from "@effect-agent/thread/Records";
10
+ import { DEFAULT_OWNERSHIP_LEASE_DURATION } from "@effect-agent/thread/SubmissionLedger";
11
+ import {
12
+ AppendConflict,
13
+ AppendResult,
8
14
  CheckpointRejected,
9
15
  ThreadCheckpoint,
10
16
  ThreadExport,
@@ -18,16 +24,11 @@ import {
18
24
  ThreadStoreError,
19
25
  ThreadTail,
20
26
  ThreadTailRequest,
21
- DEFAULT_OWNERSHIP_LEASE_DURATION,
22
- digestCanonicalBatch,
23
- Digest,
24
- EMPTY_TAIL_DIGEST,
25
27
  FenceRejected,
26
28
  FencedAppendRequest,
27
29
  LoadCheckpointRequest,
28
- ObservationOffset,
29
30
  SaveCheckpointRequest,
30
- } from "@effect-agent/thread";
31
+ } from "@effect-agent/thread/ThreadStore";
31
32
  import { BrowserCrypto } from "@effect/platform-browser";
32
33
  import { SqliteClient } from "@effect/sql-sqlite-do";
33
34
  import {
@@ -44,19 +45,11 @@ import {
44
45
  } from "effect";
45
46
  import * as SqlClientService from "effect/unstable/sql/SqlClient";
46
47
 
47
- import {
48
- initializeDoJournal,
49
- RawAppendRequest,
50
- RawCheckpoint,
51
- RawReadRequest,
52
- type DoJournal,
53
- } from "./do-journal.ts";
54
48
  import {
55
49
  DEFAULT_MAX_STORED_VALUE_BYTES,
56
50
  DoStorageConfig,
57
51
  DoStorageConfigValue,
58
- } from "./do-storage-config.ts";
59
- import { DoStorageFailpoint, type DoStorageFailpointHandler } from "./do-storage-failpoint.ts";
52
+ } from "./DoStorageConfig.ts";
60
53
  import {
61
54
  type DoStorageCompatibilityError,
62
55
  DoAppendConflict,
@@ -65,7 +58,15 @@ import {
65
58
  type DoStorageFailpointLocation,
66
59
  DoStorageCorruptionError,
67
60
  DoStorageError,
68
- } from "./errors.ts";
61
+ } from "./DoStorageError.ts";
62
+ import { DoStorageFailpoint, type DoStorageFailpointHandler } from "./DoStorageFailpoint.ts";
63
+ import {
64
+ initializeDoJournal,
65
+ RawAppendRequest,
66
+ RawCheckpoint,
67
+ RawReadRequest,
68
+ type DoJournal,
69
+ } from "./internal/do-journal.ts";
69
70
 
70
71
  /**
71
72
  * Convenience-layer construction options. `storage` is the Durable Object's own
@@ -903,6 +904,3 @@ export const layer = (
903
904
  ),
904
905
  ),
905
906
  ).pipe(Layer.provide(storageConfigLayer(options)));
906
-
907
- /** Create an adapter-owned resumable observation offset for a known canonical sequence. */
908
- export const observationOffsetAt = makeOffset;
@@ -1,28 +1,33 @@
1
- import type { MemoryReader } from "@effect-agent/core";
1
+ import * as MemoryNamespace from "@effect-agent/core/MemoryNamespace";
2
+ import {
3
+ MemoryLookup,
4
+ MemoryRecallError,
5
+ MemoryRecallLimits,
6
+ } from "@effect-agent/core/MemoryReference";
7
+ import { MemoryAccess, revalidateMemoryLookup } from "@effect-agent/core/MemoryRevalidation";
8
+ import { type MemoryReader } from "@effect-agent/core/MemoryStore";
2
9
  import {
3
- MemoryAccess,
4
10
  MemoryConflict,
5
11
  MemoryDocument,
6
- MemoryLookup,
7
12
  MemoryMutationFailure,
8
- MemoryNamespace,
9
13
  MemoryOperationConflict,
10
- MemoryRecallError,
11
- MemoryRecallLimits,
12
14
  MemoryStorageError,
13
15
  MemoryWithdrawn,
14
16
  MemoryWrite,
15
17
  MemoryWriter,
16
- revalidateMemoryLookup,
18
+ } from "@effect-agent/core/MemoryStore";
19
+ import {
17
20
  MemoryIndexSearch,
18
21
  MemoryIndexError,
19
- SemanticMemoryError,
20
22
  SemanticMemoryProfile,
23
+ } from "@effect-agent/core/SemanticMemoryIndex";
24
+ import {
25
+ SemanticMemoryError,
21
26
  SemanticCandidateLimits,
22
27
  SemanticCandidateResult,
23
28
  revalidateSemanticMemoryCandidates,
24
- } from "@effect-agent/core";
25
- import { Principal } from "@effect-agent/thread";
29
+ } from "@effect-agent/core/SemanticMemoryRevalidation";
30
+ import { Principal } from "@effect-agent/thread/SubmissionLedger";
26
31
  import { Clock, Context, Effect, Encoding, Schema } from "effect";
27
32
 
28
33
  export class MemoryRpcError extends Schema.TaggedError<MemoryRpcError>()("MemoryRpcError", {
@@ -1,3 +1,4 @@
1
+ import { CanonicalRecordEnvelope } from "@effect-agent/thread/Records";
1
2
  import {
2
3
  AbortCommand,
3
4
  AbortIntent,
@@ -5,11 +6,19 @@ import {
5
6
  AdmissionRequest,
6
7
  AdmissionResolution,
7
8
  AdmissionResult,
8
- AppendConflict,
9
- AppendResult,
10
- CanonicalRecordEnvelope,
11
9
  ChildSettledNotification,
12
10
  ChildSettledOutcome,
11
+ JoinedToHost,
12
+ LedgerError,
13
+ MarkReadyRequest,
14
+ SettlementConflict,
15
+ SubmissionLookup,
16
+ SubmissionLookupByKey,
17
+ SubmissionSnapshot,
18
+ } from "@effect-agent/thread/SubmissionLedger";
19
+ import {
20
+ AppendConflict,
21
+ AppendResult,
13
22
  ThreadExport,
14
23
  ThreadExportRequest,
15
24
  ThreadMaterialization,
@@ -20,14 +29,7 @@ import {
20
29
  ThreadTailRequest,
21
30
  FenceRejected,
22
31
  FencedAppendRequest,
23
- JoinedToHost,
24
- LedgerError,
25
- MarkReadyRequest,
26
- SettlementConflict,
27
- SubmissionLookup,
28
- SubmissionLookupByKey,
29
- SubmissionSnapshot,
30
- } from "@effect-agent/thread";
32
+ } from "@effect-agent/thread/ThreadStore";
31
33
  import { Schema } from "effect";
32
34
 
33
35
  /**