@nikelyh/offscript 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +148 -2
  3. package/THIRD_PARTY_NOTICES.md +16 -0
  4. package/dist/packages/application/assign-investigation/execute.js +34 -0
  5. package/dist/packages/application/assign-investigation/ports.js +1 -0
  6. package/dist/packages/application/assign-investigation/resolve-context.js +41 -0
  7. package/dist/packages/application/check-target.js +4 -0
  8. package/dist/packages/application/complete-investigation/execute.js +54 -0
  9. package/dist/packages/application/complete-investigation/ports.js +1 -0
  10. package/dist/packages/application/complete-investigation/resolve-context.js +48 -0
  11. package/dist/packages/application/configure-simulation/execute.js +29 -0
  12. package/dist/packages/application/configure-simulation/ports.js +1 -0
  13. package/dist/packages/application/configure-simulation/profiles.js +16 -0
  14. package/dist/packages/application/delete-configured-simulation.js +11 -0
  15. package/dist/packages/application/errors.js +8 -0
  16. package/dist/packages/application/index.js +11 -0
  17. package/dist/packages/application/outbox/dispatch.js +48 -0
  18. package/dist/packages/application/outbox/ports.js +16 -0
  19. package/dist/packages/application/recover-simulation/execute.js +31 -0
  20. package/dist/packages/application/recover-simulation/ports.js +1 -0
  21. package/dist/packages/application/request-investigation/execute.js +38 -0
  22. package/dist/packages/application/request-investigation/ports.js +1 -0
  23. package/dist/packages/application/request-investigation/resolve-context.js +41 -0
  24. package/dist/packages/browser/browser-manager.js +91 -0
  25. package/dist/packages/browser/dom-snapshot.js +186 -0
  26. package/dist/packages/browser/index.js +5 -0
  27. package/dist/packages/browser/scope-guard.js +73 -0
  28. package/dist/packages/browser/session.js +209 -0
  29. package/dist/packages/browser/tools/browser-tools.js +192 -0
  30. package/dist/packages/browser/types.js +1 -0
  31. package/dist/packages/contracts/errors.js +8 -0
  32. package/dist/packages/contracts/event-envelope.js +28 -0
  33. package/dist/packages/contracts/event-validation.js +44 -0
  34. package/dist/packages/contracts/events.js +1 -0
  35. package/dist/packages/contracts/finding-assessment.js +128 -0
  36. package/dist/packages/contracts/index.js +15 -0
  37. package/dist/packages/contracts/investigation-events.js +43 -0
  38. package/dist/packages/contracts/investigation-summary.js +60 -0
  39. package/dist/packages/contracts/mappers.js +17 -0
  40. package/dist/packages/contracts/observation-summary.js +25 -0
  41. package/dist/packages/contracts/semantic-events.js +41 -0
  42. package/dist/packages/contracts/serialization.js +18 -0
  43. package/dist/packages/contracts/simulation-configuration.js +17 -0
  44. package/dist/packages/contracts/simulation-execution.js +62 -0
  45. package/dist/packages/contracts/simulation-results.js +52 -0
  46. package/dist/packages/contracts/simulation-setup.js +60 -0
  47. package/dist/packages/contracts/summaries.js +42 -0
  48. package/dist/packages/contracts/target-connection.js +36 -0
  49. package/dist/packages/contracts/validation.js +42 -0
  50. package/dist/packages/domain/agent.js +23 -0
  51. package/dist/packages/domain/environment.js +1 -0
  52. package/dist/packages/domain/errors.js +14 -0
  53. package/dist/packages/domain/identity.js +16 -0
  54. package/dist/packages/domain/index.js +10 -0
  55. package/dist/packages/domain/investigation-result.js +19 -0
  56. package/dist/packages/domain/investigation.js +70 -0
  57. package/dist/packages/domain/observation.js +19 -0
  58. package/dist/packages/domain/profile.js +19 -0
  59. package/dist/packages/domain/simulation.js +61 -0
  60. package/dist/packages/domain/timestamp.js +9 -0
  61. package/dist/packages/orchestration/browser-exploration-factory.js +135 -0
  62. package/dist/packages/orchestration/controlled-demo-factory.js +26 -0
  63. package/dist/packages/orchestration/deterministic-browser-runner.js +92 -0
  64. package/dist/packages/orchestration/deterministic-runner.js +69 -0
  65. package/dist/packages/orchestration/event-bridge.js +27 -0
  66. package/dist/packages/orchestration/guard-inference.js +44 -0
  67. package/dist/packages/orchestration/index.js +7 -0
  68. package/dist/packages/orchestration/investigation-reaction.js +53 -0
  69. package/dist/packages/orchestration/investigation-store.js +96 -0
  70. package/dist/packages/orchestration/memory-outbox.js +63 -0
  71. package/dist/packages/orchestration/multi-mode-factory.js +12 -0
  72. package/dist/packages/orchestration/outbox-publisher.js +13 -0
  73. package/dist/packages/orchestration/session-storage.js +52 -0
  74. package/dist/packages/orchestration/session.js +176 -0
  75. package/dist/packages/orchestration/situations.js +26 -0
  76. package/dist/packages/orchestration/state.js +32 -0
  77. package/dist/packages/orchestration/tools/arguments.js +13 -0
  78. package/dist/packages/orchestration/tools/browser-exploration-tools.js +154 -0
  79. package/dist/packages/orchestration/tools/browser-interaction-tools.js +74 -0
  80. package/dist/packages/orchestration/tools/exploration-tools.js +119 -0
  81. package/dist/packages/persistence/codecs/investigation.js +30 -0
  82. package/dist/packages/persistence/codecs/simulation.js +69 -0
  83. package/dist/packages/persistence/codecs/values.js +24 -0
  84. package/dist/packages/persistence/connection.js +29 -0
  85. package/dist/packages/persistence/errors.js +8 -0
  86. package/dist/packages/persistence/index.js +22 -0
  87. package/dist/packages/persistence/migrate.js +40 -0
  88. package/dist/packages/persistence/migrations/0000_initial_domain_storage.sql +92 -0
  89. package/dist/packages/persistence/migrations/0001_transactional_outbox.sql +26 -0
  90. package/dist/packages/persistence/migrations/0002_simulation_configuration.sql +7 -0
  91. package/dist/packages/persistence/migrations/meta/0000_snapshot.json +637 -0
  92. package/dist/packages/persistence/migrations/meta/0001_snapshot.json +812 -0
  93. package/dist/packages/persistence/migrations/meta/0002_snapshot.json +859 -0
  94. package/dist/packages/persistence/migrations/meta/_journal.json +27 -0
  95. package/dist/packages/persistence/outbox/committer.js +54 -0
  96. package/dist/packages/persistence/outbox/store.js +66 -0
  97. package/dist/packages/persistence/repositories/configurations.js +41 -0
  98. package/dist/packages/persistence/repositories/delete-configuration.js +20 -0
  99. package/dist/packages/persistence/repositories/investigation-writes.js +72 -0
  100. package/dist/packages/persistence/repositories/investigations.js +27 -0
  101. package/dist/packages/persistence/repositories/observations.js +36 -0
  102. package/dist/packages/persistence/repositories/simulation-writes.js +39 -0
  103. package/dist/packages/persistence/repositories/simulations.js +23 -0
  104. package/dist/packages/persistence/schema/configurations.js +10 -0
  105. package/dist/packages/persistence/schema/index.js +5 -0
  106. package/dist/packages/persistence/schema/investigations.js +53 -0
  107. package/dist/packages/persistence/schema/observations.js +17 -0
  108. package/dist/packages/persistence/schema/outbox.js +26 -0
  109. package/dist/packages/persistence/schema/simulations.js +29 -0
  110. package/dist/packages/projects/index.js +2 -0
  111. package/dist/packages/projects/inspect.js +45 -0
  112. package/dist/packages/projects/suggest-target.js +34 -0
  113. package/dist/packages/projects/target-probe.js +61 -0
  114. package/dist/packages/runtime/deadline.js +11 -0
  115. package/dist/packages/runtime/evidence-store.js +76 -0
  116. package/dist/packages/runtime/execution-coordinator.js +223 -0
  117. package/dist/packages/runtime/execution-settlement.js +50 -0
  118. package/dist/packages/runtime/execution-types.js +1 -0
  119. package/dist/packages/runtime/host-config.js +26 -0
  120. package/dist/packages/runtime/host-storage.js +46 -0
  121. package/dist/packages/runtime/host.js +2 -0
  122. package/dist/packages/runtime/index.js +1 -0
  123. package/dist/packages/runtime/local-host.js +280 -0
  124. package/dist/packages/runtime/outbox-dispatcher.js +61 -0
  125. package/dist/packages/runtime/session-registry.js +42 -0
  126. package/dist/packages/server/configuration-routes.js +85 -0
  127. package/dist/packages/server/contracts.js +13 -0
  128. package/dist/packages/server/index.js +2 -0
  129. package/dist/packages/server/security.js +38 -0
  130. package/dist/packages/server/server.js +44 -0
  131. package/dist/packages/server/studio-assets.js +44 -0
  132. package/dist/packages/server/studio-session.js +28 -0
  133. package/dist/scripts/server/access-file.js +21 -0
  134. package/dist/scripts/server/cli-results.js +126 -0
  135. package/dist/scripts/server/open-browser.js +13 -0
  136. package/dist/scripts/server/run.js +76 -0
  137. package/dist/scripts/server/startup-error.js +17 -0
  138. package/dist/scripts/server/studio-entry-file.js +22 -0
  139. package/dist/studio/assets/index-Dh5KHl3J.css +1 -0
  140. package/dist/studio/assets/index-uXpu7a13.js +9 -0
  141. package/dist/studio/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  142. package/dist/studio/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  143. package/dist/studio/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  144. package/dist/studio/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  145. package/dist/studio/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  146. package/dist/studio/assets/space-grotesk-latin-ext-wght-normal-D9tNdqV9.woff2 +0 -0
  147. package/dist/studio/assets/space-grotesk-latin-wght-normal-BhU9QXUp.woff2 +0 -0
  148. package/dist/studio/assets/space-grotesk-vietnamese-wght-normal-D0rl6rjA.woff2 +0 -0
  149. package/dist/studio/brand/logo-perspectives.svg +1 -0
  150. package/dist/studio/favicon.svg +1 -0
  151. package/dist/studio/index.html +14 -0
  152. package/dist/studio/licenses/jetbrains-mono.txt +93 -0
  153. package/dist/studio/licenses/space-grotesk.txt +93 -0
  154. package/dist/studio/participants/badger.png +0 -0
  155. package/dist/studio/participants/compass.png +0 -0
  156. package/dist/studio/participants/fox.png +0 -0
  157. package/dist/studio/participants/owl.png +0 -0
  158. package/dist/studio/participants/raven.png +0 -0
  159. package/dist/studio/participants/sparrow.png +0 -0
  160. package/offscript.mjs +104 -0
  161. package/package.json +100 -4
@@ -0,0 +1,812 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "e31bb657-4223-4cf1-b0cc-4f36c0862aac",
5
+ "prevId": "82cfa942-ab13-41e4-85e6-9a98dbf84c0e",
6
+ "tables": {
7
+ "agents": {
8
+ "name": "agents",
9
+ "columns": {
10
+ "simulation_id": {
11
+ "name": "simulation_id",
12
+ "type": "text",
13
+ "primaryKey": false,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "id": {
18
+ "name": "id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "position": {
25
+ "name": "position",
26
+ "type": "integer",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "profile": {
32
+ "name": "profile",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "status": {
39
+ "name": "status",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false
44
+ },
45
+ "reason": {
46
+ "name": "reason",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
+ "autoincrement": false
51
+ }
52
+ },
53
+ "indexes": {
54
+ "agent_position": {
55
+ "name": "agent_position",
56
+ "columns": [
57
+ "simulation_id",
58
+ "position"
59
+ ],
60
+ "isUnique": true
61
+ }
62
+ },
63
+ "foreignKeys": {
64
+ "agents_simulation_id_simulations_id_fk": {
65
+ "name": "agents_simulation_id_simulations_id_fk",
66
+ "tableFrom": "agents",
67
+ "tableTo": "simulations",
68
+ "columnsFrom": [
69
+ "simulation_id"
70
+ ],
71
+ "columnsTo": [
72
+ "id"
73
+ ],
74
+ "onDelete": "no action",
75
+ "onUpdate": "no action"
76
+ }
77
+ },
78
+ "compositePrimaryKeys": {
79
+ "agents_simulation_id_id_pk": {
80
+ "columns": [
81
+ "simulation_id",
82
+ "id"
83
+ ],
84
+ "name": "agents_simulation_id_id_pk"
85
+ }
86
+ },
87
+ "uniqueConstraints": {},
88
+ "checkConstraints": {
89
+ "agent_nonnegative_position": {
90
+ "name": "agent_nonnegative_position",
91
+ "value": "\"agents\".\"position\" >= 0"
92
+ },
93
+ "agent_profile_json": {
94
+ "name": "agent_profile_json",
95
+ "value": "json_valid(\"agents\".\"profile\")"
96
+ },
97
+ "agent_status": {
98
+ "name": "agent_status",
99
+ "value": "\"agents\".\"status\" in ('ready','running','completed','failed','cancelled')"
100
+ },
101
+ "agent_reason": {
102
+ "name": "agent_reason",
103
+ "value": "(\"agents\".\"status\" = 'failed' and \"agents\".\"reason\" is not null and length(trim(\"agents\".\"reason\")) > 0) or (\"agents\".\"status\" != 'failed' and \"agents\".\"reason\" is null)"
104
+ }
105
+ }
106
+ },
107
+ "investigation_agents": {
108
+ "name": "investigation_agents",
109
+ "columns": {
110
+ "investigation_id": {
111
+ "name": "investigation_id",
112
+ "type": "text",
113
+ "primaryKey": false,
114
+ "notNull": true,
115
+ "autoincrement": false
116
+ },
117
+ "simulation_id": {
118
+ "name": "simulation_id",
119
+ "type": "text",
120
+ "primaryKey": false,
121
+ "notNull": true,
122
+ "autoincrement": false
123
+ },
124
+ "agent_id": {
125
+ "name": "agent_id",
126
+ "type": "text",
127
+ "primaryKey": false,
128
+ "notNull": true,
129
+ "autoincrement": false
130
+ },
131
+ "position": {
132
+ "name": "position",
133
+ "type": "integer",
134
+ "primaryKey": false,
135
+ "notNull": true,
136
+ "autoincrement": false
137
+ }
138
+ },
139
+ "indexes": {
140
+ "investigation_agent_position": {
141
+ "name": "investigation_agent_position",
142
+ "columns": [
143
+ "investigation_id",
144
+ "position"
145
+ ],
146
+ "isUnique": true
147
+ }
148
+ },
149
+ "foreignKeys": {
150
+ "investigation_agents_investigation_id_simulation_id_investigations_id_simulation_id_fk": {
151
+ "name": "investigation_agents_investigation_id_simulation_id_investigations_id_simulation_id_fk",
152
+ "tableFrom": "investigation_agents",
153
+ "tableTo": "investigations",
154
+ "columnsFrom": [
155
+ "investigation_id",
156
+ "simulation_id"
157
+ ],
158
+ "columnsTo": [
159
+ "id",
160
+ "simulation_id"
161
+ ],
162
+ "onDelete": "no action",
163
+ "onUpdate": "no action"
164
+ },
165
+ "investigation_agents_simulation_id_agent_id_agents_simulation_id_id_fk": {
166
+ "name": "investigation_agents_simulation_id_agent_id_agents_simulation_id_id_fk",
167
+ "tableFrom": "investigation_agents",
168
+ "tableTo": "agents",
169
+ "columnsFrom": [
170
+ "simulation_id",
171
+ "agent_id"
172
+ ],
173
+ "columnsTo": [
174
+ "simulation_id",
175
+ "id"
176
+ ],
177
+ "onDelete": "no action",
178
+ "onUpdate": "no action"
179
+ }
180
+ },
181
+ "compositePrimaryKeys": {
182
+ "investigation_agents_investigation_id_agent_id_pk": {
183
+ "columns": [
184
+ "investigation_id",
185
+ "agent_id"
186
+ ],
187
+ "name": "investigation_agents_investigation_id_agent_id_pk"
188
+ }
189
+ },
190
+ "uniqueConstraints": {},
191
+ "checkConstraints": {
192
+ "investigation_agent_nonnegative_position": {
193
+ "name": "investigation_agent_nonnegative_position",
194
+ "value": "\"investigation_agents\".\"position\" >= 0"
195
+ }
196
+ }
197
+ },
198
+ "investigation_observations": {
199
+ "name": "investigation_observations",
200
+ "columns": {
201
+ "investigation_id": {
202
+ "name": "investigation_id",
203
+ "type": "text",
204
+ "primaryKey": false,
205
+ "notNull": true,
206
+ "autoincrement": false
207
+ },
208
+ "simulation_id": {
209
+ "name": "simulation_id",
210
+ "type": "text",
211
+ "primaryKey": false,
212
+ "notNull": true,
213
+ "autoincrement": false
214
+ },
215
+ "observation_id": {
216
+ "name": "observation_id",
217
+ "type": "text",
218
+ "primaryKey": false,
219
+ "notNull": true,
220
+ "autoincrement": false
221
+ },
222
+ "position": {
223
+ "name": "position",
224
+ "type": "integer",
225
+ "primaryKey": false,
226
+ "notNull": true,
227
+ "autoincrement": false
228
+ }
229
+ },
230
+ "indexes": {
231
+ "investigation_observation_position": {
232
+ "name": "investigation_observation_position",
233
+ "columns": [
234
+ "investigation_id",
235
+ "position"
236
+ ],
237
+ "isUnique": true
238
+ }
239
+ },
240
+ "foreignKeys": {
241
+ "investigation_observations_investigation_id_simulation_id_investigations_id_simulation_id_fk": {
242
+ "name": "investigation_observations_investigation_id_simulation_id_investigations_id_simulation_id_fk",
243
+ "tableFrom": "investigation_observations",
244
+ "tableTo": "investigations",
245
+ "columnsFrom": [
246
+ "investigation_id",
247
+ "simulation_id"
248
+ ],
249
+ "columnsTo": [
250
+ "id",
251
+ "simulation_id"
252
+ ],
253
+ "onDelete": "no action",
254
+ "onUpdate": "no action"
255
+ },
256
+ "investigation_observations_observation_id_simulation_id_observations_id_simulation_id_fk": {
257
+ "name": "investigation_observations_observation_id_simulation_id_observations_id_simulation_id_fk",
258
+ "tableFrom": "investigation_observations",
259
+ "tableTo": "observations",
260
+ "columnsFrom": [
261
+ "observation_id",
262
+ "simulation_id"
263
+ ],
264
+ "columnsTo": [
265
+ "id",
266
+ "simulation_id"
267
+ ],
268
+ "onDelete": "no action",
269
+ "onUpdate": "no action"
270
+ }
271
+ },
272
+ "compositePrimaryKeys": {
273
+ "investigation_observations_investigation_id_observation_id_pk": {
274
+ "columns": [
275
+ "investigation_id",
276
+ "observation_id"
277
+ ],
278
+ "name": "investigation_observations_investigation_id_observation_id_pk"
279
+ }
280
+ },
281
+ "uniqueConstraints": {},
282
+ "checkConstraints": {
283
+ "investigation_observation_nonnegative_position": {
284
+ "name": "investigation_observation_nonnegative_position",
285
+ "value": "\"investigation_observations\".\"position\" >= 0"
286
+ }
287
+ }
288
+ },
289
+ "investigations": {
290
+ "name": "investigations",
291
+ "columns": {
292
+ "id": {
293
+ "name": "id",
294
+ "type": "text",
295
+ "primaryKey": true,
296
+ "notNull": true,
297
+ "autoincrement": false
298
+ },
299
+ "simulation_id": {
300
+ "name": "simulation_id",
301
+ "type": "text",
302
+ "primaryKey": false,
303
+ "notNull": true,
304
+ "autoincrement": false
305
+ },
306
+ "requested_by": {
307
+ "name": "requested_by",
308
+ "type": "text",
309
+ "primaryKey": false,
310
+ "notNull": true,
311
+ "autoincrement": false
312
+ },
313
+ "hypothesis": {
314
+ "name": "hypothesis",
315
+ "type": "text",
316
+ "primaryKey": false,
317
+ "notNull": true,
318
+ "autoincrement": false
319
+ },
320
+ "requested_at": {
321
+ "name": "requested_at",
322
+ "type": "text",
323
+ "primaryKey": false,
324
+ "notNull": true,
325
+ "autoincrement": false
326
+ },
327
+ "status": {
328
+ "name": "status",
329
+ "type": "text",
330
+ "primaryKey": false,
331
+ "notNull": true,
332
+ "autoincrement": false
333
+ },
334
+ "assigned_at": {
335
+ "name": "assigned_at",
336
+ "type": "text",
337
+ "primaryKey": false,
338
+ "notNull": false,
339
+ "autoincrement": false
340
+ },
341
+ "completed_at": {
342
+ "name": "completed_at",
343
+ "type": "text",
344
+ "primaryKey": false,
345
+ "notNull": false,
346
+ "autoincrement": false
347
+ },
348
+ "completed_by": {
349
+ "name": "completed_by",
350
+ "type": "text",
351
+ "primaryKey": false,
352
+ "notNull": false,
353
+ "autoincrement": false
354
+ },
355
+ "result": {
356
+ "name": "result",
357
+ "type": "text",
358
+ "primaryKey": false,
359
+ "notNull": false,
360
+ "autoincrement": false
361
+ },
362
+ "revision": {
363
+ "name": "revision",
364
+ "type": "integer",
365
+ "primaryKey": false,
366
+ "notNull": true,
367
+ "autoincrement": false,
368
+ "default": 0
369
+ }
370
+ },
371
+ "indexes": {
372
+ "investigation_simulation_status": {
373
+ "name": "investigation_simulation_status",
374
+ "columns": [
375
+ "simulation_id",
376
+ "status",
377
+ "requested_at",
378
+ "id"
379
+ ],
380
+ "isUnique": false
381
+ },
382
+ "investigation_scope": {
383
+ "name": "investigation_scope",
384
+ "columns": [
385
+ "id",
386
+ "simulation_id"
387
+ ],
388
+ "isUnique": true
389
+ }
390
+ },
391
+ "foreignKeys": {
392
+ "investigations_simulation_id_simulations_id_fk": {
393
+ "name": "investigations_simulation_id_simulations_id_fk",
394
+ "tableFrom": "investigations",
395
+ "tableTo": "simulations",
396
+ "columnsFrom": [
397
+ "simulation_id"
398
+ ],
399
+ "columnsTo": [
400
+ "id"
401
+ ],
402
+ "onDelete": "no action",
403
+ "onUpdate": "no action"
404
+ },
405
+ "investigations_simulation_id_requested_by_agents_simulation_id_id_fk": {
406
+ "name": "investigations_simulation_id_requested_by_agents_simulation_id_id_fk",
407
+ "tableFrom": "investigations",
408
+ "tableTo": "agents",
409
+ "columnsFrom": [
410
+ "simulation_id",
411
+ "requested_by"
412
+ ],
413
+ "columnsTo": [
414
+ "simulation_id",
415
+ "id"
416
+ ],
417
+ "onDelete": "no action",
418
+ "onUpdate": "no action"
419
+ },
420
+ "investigations_simulation_id_completed_by_agents_simulation_id_id_fk": {
421
+ "name": "investigations_simulation_id_completed_by_agents_simulation_id_id_fk",
422
+ "tableFrom": "investigations",
423
+ "tableTo": "agents",
424
+ "columnsFrom": [
425
+ "simulation_id",
426
+ "completed_by"
427
+ ],
428
+ "columnsTo": [
429
+ "simulation_id",
430
+ "id"
431
+ ],
432
+ "onDelete": "no action",
433
+ "onUpdate": "no action"
434
+ }
435
+ },
436
+ "compositePrimaryKeys": {},
437
+ "uniqueConstraints": {},
438
+ "checkConstraints": {
439
+ "investigation_revision": {
440
+ "name": "investigation_revision",
441
+ "value": "\"investigations\".\"revision\" >= 0 and \"investigations\".\"revision\" <= 9007199254740991"
442
+ },
443
+ "investigation_state": {
444
+ "name": "investigation_state",
445
+ "value": "(\n (\"investigations\".\"status\" = 'requested' and \"investigations\".\"assigned_at\" is null and \"investigations\".\"completed_at\" is null and \"investigations\".\"completed_by\" is null and \"investigations\".\"result\" is null)\n or (\"investigations\".\"status\" = 'assigned' and \"investigations\".\"assigned_at\" is not null and \"investigations\".\"completed_at\" is null and \"investigations\".\"completed_by\" is null and \"investigations\".\"result\" is null)\n or (\"investigations\".\"status\" = 'completed' and \"investigations\".\"assigned_at\" is not null and \"investigations\".\"completed_at\" is not null and \"investigations\".\"completed_by\" is not null and \"investigations\".\"result\" is not null)\n )"
446
+ },
447
+ "investigation_result_json": {
448
+ "name": "investigation_result_json",
449
+ "value": "\"investigations\".\"result\" is null or json_valid(\"investigations\".\"result\")"
450
+ }
451
+ }
452
+ },
453
+ "observations": {
454
+ "name": "observations",
455
+ "columns": {
456
+ "id": {
457
+ "name": "id",
458
+ "type": "text",
459
+ "primaryKey": true,
460
+ "notNull": true,
461
+ "autoincrement": false
462
+ },
463
+ "simulation_id": {
464
+ "name": "simulation_id",
465
+ "type": "text",
466
+ "primaryKey": false,
467
+ "notNull": true,
468
+ "autoincrement": false
469
+ },
470
+ "agent_id": {
471
+ "name": "agent_id",
472
+ "type": "text",
473
+ "primaryKey": false,
474
+ "notNull": true,
475
+ "autoincrement": false
476
+ },
477
+ "observed_at": {
478
+ "name": "observed_at",
479
+ "type": "text",
480
+ "primaryKey": false,
481
+ "notNull": true,
482
+ "autoincrement": false
483
+ },
484
+ "description": {
485
+ "name": "description",
486
+ "type": "text",
487
+ "primaryKey": false,
488
+ "notNull": true,
489
+ "autoincrement": false
490
+ },
491
+ "location": {
492
+ "name": "location",
493
+ "type": "text",
494
+ "primaryKey": false,
495
+ "notNull": true,
496
+ "autoincrement": false
497
+ },
498
+ "evidence_ids": {
499
+ "name": "evidence_ids",
500
+ "type": "text",
501
+ "primaryKey": false,
502
+ "notNull": true,
503
+ "autoincrement": false
504
+ }
505
+ },
506
+ "indexes": {
507
+ "observation_simulation_time": {
508
+ "name": "observation_simulation_time",
509
+ "columns": [
510
+ "simulation_id",
511
+ "observed_at",
512
+ "id"
513
+ ],
514
+ "isUnique": false
515
+ },
516
+ "observation_scope": {
517
+ "name": "observation_scope",
518
+ "columns": [
519
+ "id",
520
+ "simulation_id"
521
+ ],
522
+ "isUnique": true
523
+ }
524
+ },
525
+ "foreignKeys": {
526
+ "observations_simulation_id_simulations_id_fk": {
527
+ "name": "observations_simulation_id_simulations_id_fk",
528
+ "tableFrom": "observations",
529
+ "tableTo": "simulations",
530
+ "columnsFrom": [
531
+ "simulation_id"
532
+ ],
533
+ "columnsTo": [
534
+ "id"
535
+ ],
536
+ "onDelete": "no action",
537
+ "onUpdate": "no action"
538
+ },
539
+ "observations_simulation_id_agent_id_agents_simulation_id_id_fk": {
540
+ "name": "observations_simulation_id_agent_id_agents_simulation_id_id_fk",
541
+ "tableFrom": "observations",
542
+ "tableTo": "agents",
543
+ "columnsFrom": [
544
+ "simulation_id",
545
+ "agent_id"
546
+ ],
547
+ "columnsTo": [
548
+ "simulation_id",
549
+ "id"
550
+ ],
551
+ "onDelete": "no action",
552
+ "onUpdate": "no action"
553
+ }
554
+ },
555
+ "compositePrimaryKeys": {},
556
+ "uniqueConstraints": {},
557
+ "checkConstraints": {
558
+ "observation_evidence_json": {
559
+ "name": "observation_evidence_json",
560
+ "value": "json_valid(\"observations\".\"evidence_ids\")"
561
+ }
562
+ }
563
+ },
564
+ "event_outbox": {
565
+ "name": "event_outbox",
566
+ "columns": {
567
+ "sequence": {
568
+ "name": "sequence",
569
+ "type": "integer",
570
+ "primaryKey": true,
571
+ "notNull": true,
572
+ "autoincrement": true
573
+ },
574
+ "event_id": {
575
+ "name": "event_id",
576
+ "type": "text",
577
+ "primaryKey": false,
578
+ "notNull": true,
579
+ "autoincrement": false
580
+ },
581
+ "simulation_id": {
582
+ "name": "simulation_id",
583
+ "type": "text",
584
+ "primaryKey": false,
585
+ "notNull": true,
586
+ "autoincrement": false
587
+ },
588
+ "investigation_id": {
589
+ "name": "investigation_id",
590
+ "type": "text",
591
+ "primaryKey": false,
592
+ "notNull": true,
593
+ "autoincrement": false
594
+ },
595
+ "revision": {
596
+ "name": "revision",
597
+ "type": "integer",
598
+ "primaryKey": false,
599
+ "notNull": true,
600
+ "autoincrement": false
601
+ },
602
+ "event_json": {
603
+ "name": "event_json",
604
+ "type": "text",
605
+ "primaryKey": false,
606
+ "notNull": true,
607
+ "autoincrement": false
608
+ },
609
+ "status": {
610
+ "name": "status",
611
+ "type": "text",
612
+ "primaryKey": false,
613
+ "notNull": true,
614
+ "autoincrement": false,
615
+ "default": "'pending'"
616
+ },
617
+ "attempts": {
618
+ "name": "attempts",
619
+ "type": "integer",
620
+ "primaryKey": false,
621
+ "notNull": true,
622
+ "autoincrement": false,
623
+ "default": 0
624
+ },
625
+ "available_at": {
626
+ "name": "available_at",
627
+ "type": "integer",
628
+ "primaryKey": false,
629
+ "notNull": true,
630
+ "autoincrement": false,
631
+ "default": 0
632
+ },
633
+ "lease_token": {
634
+ "name": "lease_token",
635
+ "type": "text",
636
+ "primaryKey": false,
637
+ "notNull": false,
638
+ "autoincrement": false
639
+ },
640
+ "lease_until": {
641
+ "name": "lease_until",
642
+ "type": "integer",
643
+ "primaryKey": false,
644
+ "notNull": false,
645
+ "autoincrement": false
646
+ },
647
+ "accepted_at": {
648
+ "name": "accepted_at",
649
+ "type": "integer",
650
+ "primaryKey": false,
651
+ "notNull": false,
652
+ "autoincrement": false
653
+ },
654
+ "last_error": {
655
+ "name": "last_error",
656
+ "type": "text",
657
+ "primaryKey": false,
658
+ "notNull": false,
659
+ "autoincrement": false
660
+ }
661
+ },
662
+ "indexes": {
663
+ "event_outbox_event_id_unique": {
664
+ "name": "event_outbox_event_id_unique",
665
+ "columns": [
666
+ "event_id"
667
+ ],
668
+ "isUnique": true
669
+ },
670
+ "outbox_ready": {
671
+ "name": "outbox_ready",
672
+ "columns": [
673
+ "status",
674
+ "available_at",
675
+ "sequence"
676
+ ],
677
+ "isUnique": false
678
+ },
679
+ "outbox_aggregate_order": {
680
+ "name": "outbox_aggregate_order",
681
+ "columns": [
682
+ "investigation_id",
683
+ "sequence",
684
+ "status"
685
+ ],
686
+ "isUnique": false
687
+ },
688
+ "outbox_investigation_revision": {
689
+ "name": "outbox_investigation_revision",
690
+ "columns": [
691
+ "investigation_id",
692
+ "revision"
693
+ ],
694
+ "isUnique": true
695
+ }
696
+ },
697
+ "foreignKeys": {
698
+ "event_outbox_investigation_id_simulation_id_investigations_id_simulation_id_fk": {
699
+ "name": "event_outbox_investigation_id_simulation_id_investigations_id_simulation_id_fk",
700
+ "tableFrom": "event_outbox",
701
+ "tableTo": "investigations",
702
+ "columnsFrom": [
703
+ "investigation_id",
704
+ "simulation_id"
705
+ ],
706
+ "columnsTo": [
707
+ "id",
708
+ "simulation_id"
709
+ ],
710
+ "onDelete": "no action",
711
+ "onUpdate": "no action"
712
+ }
713
+ },
714
+ "compositePrimaryKeys": {},
715
+ "uniqueConstraints": {},
716
+ "checkConstraints": {
717
+ "outbox_json": {
718
+ "name": "outbox_json",
719
+ "value": "json_valid(\"event_outbox\".\"event_json\")"
720
+ },
721
+ "outbox_numbers": {
722
+ "name": "outbox_numbers",
723
+ "value": "\"event_outbox\".\"revision\" >= 0 and \"event_outbox\".\"attempts\" >= 0 and \"event_outbox\".\"available_at\" >= 0"
724
+ },
725
+ "outbox_status": {
726
+ "name": "outbox_status",
727
+ "value": "\"event_outbox\".\"status\" in ('pending','leased','accepted','failed')"
728
+ },
729
+ "outbox_lease": {
730
+ "name": "outbox_lease",
731
+ "value": "(\"event_outbox\".\"status\" = 'leased' and \"event_outbox\".\"lease_token\" is not null and \"event_outbox\".\"lease_until\" is not null) or (\"event_outbox\".\"status\" != 'leased' and \"event_outbox\".\"lease_token\" is null and \"event_outbox\".\"lease_until\" is null)"
732
+ },
733
+ "outbox_acceptance": {
734
+ "name": "outbox_acceptance",
735
+ "value": "(\"event_outbox\".\"status\" = 'accepted' and \"event_outbox\".\"accepted_at\" is not null) or (\"event_outbox\".\"status\" != 'accepted' and \"event_outbox\".\"accepted_at\" is null)"
736
+ }
737
+ }
738
+ },
739
+ "simulations": {
740
+ "name": "simulations",
741
+ "columns": {
742
+ "id": {
743
+ "name": "id",
744
+ "type": "text",
745
+ "primaryKey": true,
746
+ "notNull": true,
747
+ "autoincrement": false
748
+ },
749
+ "environment": {
750
+ "name": "environment",
751
+ "type": "text",
752
+ "primaryKey": false,
753
+ "notNull": true,
754
+ "autoincrement": false
755
+ },
756
+ "deployment": {
757
+ "name": "deployment",
758
+ "type": "text",
759
+ "primaryKey": false,
760
+ "notNull": true,
761
+ "autoincrement": false
762
+ },
763
+ "status": {
764
+ "name": "status",
765
+ "type": "text",
766
+ "primaryKey": false,
767
+ "notNull": true,
768
+ "autoincrement": false
769
+ },
770
+ "reason": {
771
+ "name": "reason",
772
+ "type": "text",
773
+ "primaryKey": false,
774
+ "notNull": false,
775
+ "autoincrement": false
776
+ }
777
+ },
778
+ "indexes": {},
779
+ "foreignKeys": {},
780
+ "compositePrimaryKeys": {},
781
+ "uniqueConstraints": {},
782
+ "checkConstraints": {
783
+ "simulation_environment": {
784
+ "name": "simulation_environment",
785
+ "value": "\"simulations\".\"environment\" = 'web'"
786
+ },
787
+ "simulation_deployment": {
788
+ "name": "simulation_deployment",
789
+ "value": "\"simulations\".\"deployment\" in ('local','development','test','staging','production')"
790
+ },
791
+ "simulation_status": {
792
+ "name": "simulation_status",
793
+ "value": "\"simulations\".\"status\" in ('created','running','completed','failed','cancelled')"
794
+ },
795
+ "simulation_reason": {
796
+ "name": "simulation_reason",
797
+ "value": "(\"simulations\".\"status\" = 'failed' and \"simulations\".\"reason\" is not null and length(trim(\"simulations\".\"reason\")) > 0) or (\"simulations\".\"status\" != 'failed' and \"simulations\".\"reason\" is null)"
798
+ }
799
+ }
800
+ }
801
+ },
802
+ "views": {},
803
+ "enums": {},
804
+ "_meta": {
805
+ "schemas": {},
806
+ "tables": {},
807
+ "columns": {}
808
+ },
809
+ "internal": {
810
+ "indexes": {}
811
+ }
812
+ }