@nikelyh/offscript 0.0.0-stage → 1.1.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.
- package/LICENSE +201 -0
- package/README.md +183 -2
- package/THIRD_PARTY_NOTICES.md +16 -0
- package/dist/packages/application/assign-investigation/execute.js +34 -0
- package/dist/packages/application/assign-investigation/ports.js +1 -0
- package/dist/packages/application/assign-investigation/resolve-context.js +41 -0
- package/dist/packages/application/check-target.js +4 -0
- package/dist/packages/application/complete-investigation/execute.js +54 -0
- package/dist/packages/application/complete-investigation/ports.js +1 -0
- package/dist/packages/application/complete-investigation/resolve-context.js +48 -0
- package/dist/packages/application/configure-simulation/execute.js +29 -0
- package/dist/packages/application/configure-simulation/ports.js +1 -0
- package/dist/packages/application/configure-simulation/profiles.js +16 -0
- package/dist/packages/application/delete-configured-simulation.js +11 -0
- package/dist/packages/application/errors.js +8 -0
- package/dist/packages/application/index.js +11 -0
- package/dist/packages/application/outbox/dispatch.js +48 -0
- package/dist/packages/application/outbox/ports.js +16 -0
- package/dist/packages/application/recover-simulation/execute.js +31 -0
- package/dist/packages/application/recover-simulation/ports.js +1 -0
- package/dist/packages/application/request-investigation/execute.js +38 -0
- package/dist/packages/application/request-investigation/ports.js +1 -0
- package/dist/packages/application/request-investigation/resolve-context.js +41 -0
- package/dist/packages/browser/browser-manager.js +91 -0
- package/dist/packages/browser/dom-snapshot.js +186 -0
- package/dist/packages/browser/index.js +5 -0
- package/dist/packages/browser/scope-guard.js +73 -0
- package/dist/packages/browser/session.js +209 -0
- package/dist/packages/browser/tools/browser-tools.js +192 -0
- package/dist/packages/browser/types.js +1 -0
- package/dist/packages/contracts/errors.js +8 -0
- package/dist/packages/contracts/event-envelope.js +28 -0
- package/dist/packages/contracts/event-validation.js +44 -0
- package/dist/packages/contracts/events.js +1 -0
- package/dist/packages/contracts/finding-assessment.js +128 -0
- package/dist/packages/contracts/index.js +15 -0
- package/dist/packages/contracts/investigation-events.js +43 -0
- package/dist/packages/contracts/investigation-summary.js +60 -0
- package/dist/packages/contracts/mappers.js +17 -0
- package/dist/packages/contracts/observation-summary.js +25 -0
- package/dist/packages/contracts/semantic-events.js +41 -0
- package/dist/packages/contracts/serialization.js +18 -0
- package/dist/packages/contracts/simulation-configuration.js +17 -0
- package/dist/packages/contracts/simulation-execution.js +62 -0
- package/dist/packages/contracts/simulation-results.js +52 -0
- package/dist/packages/contracts/simulation-setup.js +60 -0
- package/dist/packages/contracts/summaries.js +42 -0
- package/dist/packages/contracts/target-connection.js +36 -0
- package/dist/packages/contracts/validation.js +42 -0
- package/dist/packages/domain/agent.js +23 -0
- package/dist/packages/domain/environment.js +1 -0
- package/dist/packages/domain/errors.js +14 -0
- package/dist/packages/domain/identity.js +16 -0
- package/dist/packages/domain/index.js +10 -0
- package/dist/packages/domain/investigation-result.js +19 -0
- package/dist/packages/domain/investigation.js +70 -0
- package/dist/packages/domain/observation.js +19 -0
- package/dist/packages/domain/profile.js +19 -0
- package/dist/packages/domain/simulation.js +61 -0
- package/dist/packages/domain/timestamp.js +9 -0
- package/dist/packages/orchestration/browser-exploration-factory.js +135 -0
- package/dist/packages/orchestration/controlled-demo-factory.js +26 -0
- package/dist/packages/orchestration/deterministic-browser-runner.js +92 -0
- package/dist/packages/orchestration/deterministic-runner.js +69 -0
- package/dist/packages/orchestration/event-bridge.js +27 -0
- package/dist/packages/orchestration/guard-inference.js +44 -0
- package/dist/packages/orchestration/index.js +7 -0
- package/dist/packages/orchestration/investigation-reaction.js +53 -0
- package/dist/packages/orchestration/investigation-store.js +96 -0
- package/dist/packages/orchestration/memory-outbox.js +63 -0
- package/dist/packages/orchestration/multi-mode-factory.js +12 -0
- package/dist/packages/orchestration/outbox-publisher.js +13 -0
- package/dist/packages/orchestration/session-storage.js +52 -0
- package/dist/packages/orchestration/session.js +176 -0
- package/dist/packages/orchestration/situations.js +26 -0
- package/dist/packages/orchestration/state.js +32 -0
- package/dist/packages/orchestration/tools/arguments.js +13 -0
- package/dist/packages/orchestration/tools/browser-exploration-tools.js +154 -0
- package/dist/packages/orchestration/tools/browser-interaction-tools.js +74 -0
- package/dist/packages/orchestration/tools/exploration-tools.js +119 -0
- package/dist/packages/persistence/codecs/investigation.js +30 -0
- package/dist/packages/persistence/codecs/simulation.js +69 -0
- package/dist/packages/persistence/codecs/values.js +24 -0
- package/dist/packages/persistence/connection.js +29 -0
- package/dist/packages/persistence/errors.js +8 -0
- package/dist/packages/persistence/index.js +22 -0
- package/dist/packages/persistence/migrate.js +40 -0
- package/dist/packages/persistence/migrations/0000_initial_domain_storage.sql +92 -0
- package/dist/packages/persistence/migrations/0001_transactional_outbox.sql +26 -0
- package/dist/packages/persistence/migrations/0002_simulation_configuration.sql +7 -0
- package/dist/packages/persistence/migrations/meta/0000_snapshot.json +637 -0
- package/dist/packages/persistence/migrations/meta/0001_snapshot.json +812 -0
- package/dist/packages/persistence/migrations/meta/0002_snapshot.json +859 -0
- package/dist/packages/persistence/migrations/meta/_journal.json +27 -0
- package/dist/packages/persistence/outbox/committer.js +54 -0
- package/dist/packages/persistence/outbox/store.js +66 -0
- package/dist/packages/persistence/repositories/configurations.js +41 -0
- package/dist/packages/persistence/repositories/delete-configuration.js +20 -0
- package/dist/packages/persistence/repositories/investigation-writes.js +72 -0
- package/dist/packages/persistence/repositories/investigations.js +27 -0
- package/dist/packages/persistence/repositories/observations.js +36 -0
- package/dist/packages/persistence/repositories/simulation-writes.js +39 -0
- package/dist/packages/persistence/repositories/simulations.js +23 -0
- package/dist/packages/persistence/schema/configurations.js +10 -0
- package/dist/packages/persistence/schema/index.js +5 -0
- package/dist/packages/persistence/schema/investigations.js +53 -0
- package/dist/packages/persistence/schema/observations.js +17 -0
- package/dist/packages/persistence/schema/outbox.js +26 -0
- package/dist/packages/persistence/schema/simulations.js +29 -0
- package/dist/packages/projects/index.js +2 -0
- package/dist/packages/projects/inspect.js +45 -0
- package/dist/packages/projects/suggest-target.js +34 -0
- package/dist/packages/projects/target-probe.js +61 -0
- package/dist/packages/runtime/deadline.js +11 -0
- package/dist/packages/runtime/evidence-store.js +76 -0
- package/dist/packages/runtime/execution-coordinator.js +223 -0
- package/dist/packages/runtime/execution-settlement.js +50 -0
- package/dist/packages/runtime/execution-types.js +1 -0
- package/dist/packages/runtime/host-config.js +26 -0
- package/dist/packages/runtime/host-storage.js +46 -0
- package/dist/packages/runtime/host.js +2 -0
- package/dist/packages/runtime/index.js +1 -0
- package/dist/packages/runtime/local-host.js +280 -0
- package/dist/packages/runtime/outbox-dispatcher.js +61 -0
- package/dist/packages/runtime/session-registry.js +42 -0
- package/dist/packages/server/configuration-routes.js +85 -0
- package/dist/packages/server/contracts.js +13 -0
- package/dist/packages/server/index.js +2 -0
- package/dist/packages/server/security.js +38 -0
- package/dist/packages/server/server.js +44 -0
- package/dist/packages/server/studio-assets.js +44 -0
- package/dist/packages/server/studio-session.js +28 -0
- package/dist/scripts/server/access-file.js +21 -0
- package/dist/scripts/server/cli-results.js +126 -0
- package/dist/scripts/server/open-browser.js +13 -0
- package/dist/scripts/server/run.js +76 -0
- package/dist/scripts/server/startup-error.js +17 -0
- package/dist/scripts/server/studio-entry-file.js +22 -0
- package/dist/studio/assets/index-DMnHlGCr.js +9 -0
- package/dist/studio/assets/index-Dh5KHl3J.css +1 -0
- package/dist/studio/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/studio/assets/space-grotesk-latin-ext-wght-normal-D9tNdqV9.woff2 +0 -0
- package/dist/studio/assets/space-grotesk-latin-wght-normal-BhU9QXUp.woff2 +0 -0
- package/dist/studio/assets/space-grotesk-vietnamese-wght-normal-D0rl6rjA.woff2 +0 -0
- package/dist/studio/brand/logo-perspectives.svg +1 -0
- package/dist/studio/favicon.svg +1 -0
- package/dist/studio/index.html +14 -0
- package/dist/studio/licenses/jetbrains-mono.txt +93 -0
- package/dist/studio/licenses/space-grotesk.txt +93 -0
- package/dist/studio/participants/badger.png +0 -0
- package/dist/studio/participants/compass.png +0 -0
- package/dist/studio/participants/fox.png +0 -0
- package/dist/studio/participants/owl.png +0 -0
- package/dist/studio/participants/raven.png +0 -0
- package/dist/studio/participants/sparrow.png +0 -0
- package/offscript.mjs +178 -0
- package/package.json +100 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,184 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OFFSCRIPT
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@nikelyh/offscript)
|
|
4
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
|
+
[](https://offscript.nikelyh.tech)
|
|
6
|
+
|
|
7
|
+
**Your users don't follow a script. Neither do ours.**
|
|
8
|
+
|
|
9
|
+
Current stable release: **v1.0.1** on [npm](https://www.npmjs.com/package/@nikelyh/offscript).
|
|
10
|
+
Online documentation: [offscript.nikelyh.tech](https://offscript.nikelyh.tech).
|
|
11
|
+
|
|
12
|
+
OFFSCRIPT brings multi-agent software exploration into a local developer workflow: configure a target and goal, choose artificial users, run a bounded session, and inspect observations, investigations and visual evidence in Studio or the terminal.
|
|
13
|
+
|
|
14
|
+
**Execution mode:** The default browser execution uses deterministic decisions, not live autonomous reasoning. Live inference is currently available only through the separate, opt-in controlled-cart demo.
|
|
15
|
+
|
|
16
|
+
## What you can do today
|
|
17
|
+
|
|
18
|
+
- Save a simulation with an application URL, concrete goal, selected users and execution limits.
|
|
19
|
+
- Run the controlled cart demo or the deterministic browser integration on an explicitly authorized target.
|
|
20
|
+
- Inspect attributed observations, collaborative investigations, available screenshots and uncertainty-aware results.
|
|
21
|
+
- Stop execution, recover interrupted records explicitly, and delete eligible configurations that have not started.
|
|
22
|
+
- Keep configuration, results and evidence in the selected project's local `.offscript` directory.
|
|
23
|
+
|
|
24
|
+
Six behavioral profiles are available: Explorer/Raven, Impatient/Fox, Beginner/Compass, Regular/Sparrow, Meticulous/Owl and Distrustful/Badger. Their instructions express different tendencies; the default scripted runner does not demonstrate those differences. An observation or an assigned collaborator is not a confirmed defect.
|
|
25
|
+
|
|
26
|
+
## Installation & Quick start
|
|
27
|
+
|
|
28
|
+
### Install via npm (Recommended)
|
|
29
|
+
|
|
30
|
+
Requires Node.js 24 or later and npm 11.19 or later.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npm install -g @nikelyh/offscript
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or run directly with `npx`:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npx --yes @nikelyh/offscript@1.0.1 studio
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For browser exploration, install the required Chromium binary:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npx playwright install chromium
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Launch Studio
|
|
49
|
+
|
|
50
|
+
In your target project's root directory:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
offscript studio
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Studio starts locally on a loopback port and opens the secure entry file in your browser. (Use `offscript studio --no-open` to print the entry link without launching the browser automatically).
|
|
57
|
+
|
|
58
|
+
1. Start your web application separately (e.g. at `http://localhost:5173`).
|
|
59
|
+
2. In Studio, select **New simulation**.
|
|
60
|
+
3. Enter your target URL and exploration goal, pick your user profiles, and save.
|
|
61
|
+
4. Run the simulation and inspect observations, investigations, and visual evidence.
|
|
62
|
+
|
|
63
|
+
## Quick start from source
|
|
64
|
+
|
|
65
|
+
Requirements: Node.js 24 or later, npm, Git, and enough disk space for dependencies and Chromium if using browser mode. Native SQLite may require a supported prebuilt binary or platform build tools. Linux browser execution also needs Playwright's system dependencies.
|
|
66
|
+
|
|
67
|
+
Isolated clean installations passed on Windows with Node 24.21.0/npm 11.19.0. This does not establish cross-platform release readiness; see the [release checkpoint](docs/RELEASE.md#preparation-checkpoint-2026-10-31) for the actual checks and remaining gates.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
git clone https://github.com/yohanvillarp/offscript.git
|
|
71
|
+
cd offscript
|
|
72
|
+
npm ci
|
|
73
|
+
npm --prefix apps/studio ci
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
First, exercise Mozaik without a browser or model account:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
npm run demo:mozaik
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This starts two users concurrently on the real Mozaik runtime, using deterministic inference and a simulated cart. It prints semantic events followed by observations/investigations, per-agent turn counts and failure stages. A successful fixture run reports no failures. This checks coordination; it is not an autonomous exploration of your application. See [the integration guide](https://github.com/yohanvillarp/offscript/blob/main/docs/MOZAIK-INTEGRATION.md) for the separate `--live` demo and its model/credential requirements; live requests can incur provider costs.
|
|
83
|
+
|
|
84
|
+
Build Studio and the local executable distribution:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npm run build:local
|
|
88
|
+
npm start -- studio --project "/absolute/path/to/your-app"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use the actual target path, such as `C:/Projects/my-app` on Windows. The host prints a loopback address and opens a local HTML entry file that establishes Studio's authenticated session. Use `studio --no-open` to open that printed file yourself. Do not place access tokens in URLs.
|
|
92
|
+
|
|
93
|
+
For **browser exploration**, install the browser matching the repository's locked Playwright version before starting a run:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
npm exec -- playwright install chromium
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
On supported Linux environments, the corresponding setup command is `npm exec -- playwright install --with-deps chromium`. Installing browsers/system dependencies is explicit; OFFSCRIPT does not do it silently.
|
|
100
|
+
|
|
101
|
+
Start your target application separately using that project's instructions. In Studio, choose **New simulation**, review the detected project, enter the target URL and goal, select users, and save. Open the saved simulation to choose its execution mode and inspect results. A successful connection check is not authorization for destructive actions. Use a disposable test environment; browser clicks can change real backend data.
|
|
102
|
+
|
|
103
|
+
Stop OFFSCRIPT with Ctrl+C. Saved data remains under `<target>/.offscript`; entry/access files are removed on normal shutdown. Add `.offscript/` to the target project's ignore rules yourself. No target scripts are started automatically.
|
|
104
|
+
|
|
105
|
+
## Try the npm archive in another project
|
|
106
|
+
|
|
107
|
+
From the OFFSCRIPT checkout:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
npm pack
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This builds `nikelyh-offscript-1.0.1.tgz`. From your target project's directory:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
npm exec --yes --package="/absolute/path/nikelyh-offscript-1.0.1.tgz" -- offscript studio
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The current directory becomes the project root. Use a real absolute archive path; Windows paths are supported. npm installs dependencies in its execution cache without adding OFFSCRIPT to the target's package manifest. The first run can need network access and native dependency setup.
|
|
120
|
+
|
|
121
|
+
For a one-shot archive installation, the browser prerequisite must match OFFSCRIPT's Playwright version; for this source release that is `1.64.1`:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
npm exec --yes --package=playwright@1.64.1 -- playwright install chromium
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The archive flow above can be used to test a local build independently of the npm registry.
|
|
128
|
+
|
|
129
|
+
## CLI reference
|
|
130
|
+
|
|
131
|
+
Arguments follow the executable in an installed package, or `npm start --` in the checkout.
|
|
132
|
+
|
|
133
|
+
| Command | Behavior |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| `offscript studio` | Start local Studio/API and open the secure entry. Default command. |
|
|
136
|
+
| `offscript studio --no-open` | Print the entry path without launching a browser. |
|
|
137
|
+
| `offscript serve` | Start the API only. |
|
|
138
|
+
| `offscript list` | List saved project configurations. |
|
|
139
|
+
| `offscript results <id>` | Show observations, investigations and finding assessments. |
|
|
140
|
+
| `offscript recover <id> [--cancel]` | Explicitly resolve an interrupted run; does not resume agents. |
|
|
141
|
+
| `offscript help [command]` | Print detailed help and option descriptions for any command. |
|
|
142
|
+
| `offscript --help` / `--version` | Print general information without starting the host or creating storage. |
|
|
143
|
+
|
|
144
|
+
Common options: `--project <directory>`, `--port <number>` (0 selects an available port), and `--data-directory <directory>` (relative to the target). Flags override the documented `OFFSCRIPT_*` environment values. The installation directory never determines the target project.
|
|
145
|
+
|
|
146
|
+
## How Mozaik is used
|
|
147
|
+
|
|
148
|
+
Each simulation gets a Mozaik runtime. Artificial users have separate identities, memories and tool contexts, while OFFSCRIPT's exploration state holds observations, investigations, permissions and bounded turn admission. Mozaik runs inference/tool turns and reactive situation handlers; OFFSCRIPT does not implement a competing inference loop.
|
|
149
|
+
|
|
150
|
+
Users can run in parallel. A recorded observation can lead to an investigation request; a peer's reactive handler records assignment before contributing. SQLite's transactional outbox delivers committed investigation events to prepared sessions. Dispatch acceptance does not prove asynchronous work finished or a hypothesis is true.
|
|
151
|
+
|
|
152
|
+

|
|
153
|
+
|
|
154
|
+

|
|
155
|
+
|
|
156
|
+
These are explanatory diagrams, not captured evidence of live model behavior. Editable Mermaid sources live beside the SVGs in `docs/assets`.
|
|
157
|
+
|
|
158
|
+
## Current boundaries
|
|
159
|
+
|
|
160
|
+
- Default Studio browser execution is deterministic. Provider setup for autonomous browser exploration is not exposed as a finished operator workflow.
|
|
161
|
+
- Tool/origin restrictions and isolated contexts are implemented, but a general destructive-action policy, broader target authentication and complete secret redaction are not.
|
|
162
|
+
- Browser storage isolation does not isolate backend accounts or records. Use authorized test accounts/data.
|
|
163
|
+
- Goal achievement, independent corroboration and artifact availability are distinct. Provisional results must not be treated as verified defects.
|
|
164
|
+
- Session closure is not a guarantee that a provider has aborted an in-flight request. There is no automatic agent resumption after restart.
|
|
165
|
+
- The native SQLite driver and matching browser binaries are platform requirements; install/run qualification is needed on each supported platform.
|
|
166
|
+
|
|
167
|
+
## Troubleshooting
|
|
168
|
+
|
|
169
|
+
| Symptom | Check |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| `Distribution is missing` | Run `npm install -g @nikelyh/offscript` or `npm run build:local` in the checkout. |
|
|
172
|
+
| Chromium executable missing | Install Chromium using `npx playwright install chromium`. |
|
|
173
|
+
| `401` when entering Studio | Open the current host's printed HTML entry; an old entry/session does not authenticate a restarted host. |
|
|
174
|
+
| Connection check fails | Start the target separately; verify its actual URL/port. Checks currently support loopback targets. |
|
|
175
|
+
| `ENOSPC` during install/pack | Free space on the project, npm-cache and browser-cache volumes, then retry. Do not delete project `.offscript` data to repair packaging. |
|
|
176
|
+
| Interrupted simulation | Inspect its results and use explicit recovery. Recovery records an outcome rather than resuming browser/provider work. |
|
|
177
|
+
|
|
178
|
+
## Documentation and contributing
|
|
179
|
+
|
|
180
|
+
[Official Documentation](https://offscript.nikelyh.tech) · [Architecture](https://github.com/yohanvillarp/offscript/blob/main/docs/ARCHITECTURE.md) · [Browser adapter](https://github.com/yohanvillarp/offscript/blob/main/docs/BROWSER-INTERACTION.md) · [Mozaik integration](https://github.com/yohanvillarp/offscript/blob/main/docs/MOZAIK-INTEGRATION.md) · [Known limits](https://github.com/yohanvillarp/offscript/blob/main/docs/CONSOLIDATION.md) · [Roadmap](https://github.com/yohanvillarp/offscript/blob/main/docs/ROADMAP.md) · [Contributing](https://github.com/yohanvillarp/offscript/blob/main/CONTRIBUTING.md)
|
|
181
|
+
|
|
182
|
+
Visit the documentation portal at **[offscript.nikelyh.tech](https://offscript.nikelyh.tech)**. Development commands, checks and release notes are documented in the repository. No browser or live model call is required for reading the guides.
|
|
183
|
+
|
|
184
|
+
Apache-2.0. See [LICENSE](https://github.com/yohanvillarp/offscript/blob/main/LICENSE) and [third-party notices](https://github.com/yohanvillarp/offscript/blob/main/THIRD_PARTY_NOTICES.md). Studio's bundled fonts retain their SIL Open Font License texts in the archive.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
OFFSCRIPT source is provided under Apache-2.0; see LICENSE. Third-party assets and dependencies retain their own licenses.
|
|
4
|
+
|
|
5
|
+
## Bundled typography
|
|
6
|
+
|
|
7
|
+
Studio bundles font files from the Fontsource Variable distributions of:
|
|
8
|
+
|
|
9
|
+
- **Space Grotesk** — Copyright 2020 The Space Grotesk Project Authors. Source: https://github.com/floriankarsten/space-grotesk. SIL Open Font License 1.1.
|
|
10
|
+
- **JetBrains Mono** — Copyright 2020 The JetBrains Mono Project Authors. Source: https://github.com/JetBrains/JetBrainsMono. SIL Open Font License 1.1.
|
|
11
|
+
|
|
12
|
+
The distribution copies each installed font package's full LICENSE to `dist/studio/licenses/space-grotesk.txt` and `dist/studio/licenses/jetbrains-mono.txt`. These notices do not replace those license texts.
|
|
13
|
+
|
|
14
|
+
## Runtime dependencies
|
|
15
|
+
|
|
16
|
+
Mozaik, Playwright, SQLite/Drizzle, Fastify and other npm dependencies are installed as dependencies, not relicensed as OFFSCRIPT source. Their package licenses/notices remain applicable. The Playwright browser download is a separate installation; its distribution includes the relevant browser licenses.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { agentId, assignInvestigation, investigationId, simulationId } from "../../domain/index.js";
|
|
2
|
+
import { parseInvestigationEvent } from "../../contracts/index.js";
|
|
3
|
+
import { ApplicationError } from "../errors.js";
|
|
4
|
+
import { resolveAssignmentContext } from "./resolve-context.js";
|
|
5
|
+
export async function executeAssignInvestigation(input, dependencies) {
|
|
6
|
+
const command = Object.freeze({
|
|
7
|
+
...input, investigationId: investigationId(input.investigationId), simulationId: simulationId(input.simulationId),
|
|
8
|
+
agentIds: Object.freeze(input.agentIds.map(agentId)), origin: Object.freeze({ ...input.origin }),
|
|
9
|
+
});
|
|
10
|
+
const record = await resolveAssignmentContext(command, dependencies);
|
|
11
|
+
const investigation = assignInvestigation(record.investigation, command.agentIds, command.assignedAt);
|
|
12
|
+
const event = parseInvestigationEvent({
|
|
13
|
+
eventId: command.eventId, type: "investigation.assigned", schemaVersion: 1,
|
|
14
|
+
occurredAt: command.assignedAt, simulationId: command.simulationId, origin: command.origin,
|
|
15
|
+
correlationId: command.correlationId, payload: { investigation },
|
|
16
|
+
});
|
|
17
|
+
if (event.type !== "investigation.assigned")
|
|
18
|
+
throw new ApplicationError("INVALID_REFERENCE", "Unexpected assignment event type.");
|
|
19
|
+
let saved;
|
|
20
|
+
try {
|
|
21
|
+
saved = await dependencies.investigations.commitAssignment(event, record.revision);
|
|
22
|
+
}
|
|
23
|
+
catch (cause) {
|
|
24
|
+
throw new ApplicationError("SAVE_FAILED", "Assignment save failed; its commit outcome may be unknown.", { cause });
|
|
25
|
+
}
|
|
26
|
+
if (saved === "not-found")
|
|
27
|
+
throw new ApplicationError("INVESTIGATION_NOT_FOUND", "Investigation disappeared before saving.");
|
|
28
|
+
if (saved === "conflict")
|
|
29
|
+
throw new ApplicationError("INVESTIGATION_CONFLICT", "Investigation changed before saving; reload before deciding to retry.");
|
|
30
|
+
const revision = record.revision + 1;
|
|
31
|
+
if (saved === "event-conflict")
|
|
32
|
+
throw new ApplicationError("EVENT_ID_CONFLICT", "Event identity already has different content.");
|
|
33
|
+
return Object.freeze({ investigation, event, revision, publication: Object.freeze({ status: saved === "duplicate" ? "already-recorded" : "queued" }) });
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ApplicationError } from "../errors.js";
|
|
2
|
+
async function read(operation) {
|
|
3
|
+
try {
|
|
4
|
+
return await operation();
|
|
5
|
+
}
|
|
6
|
+
catch (cause) {
|
|
7
|
+
throw new ApplicationError("READ_FAILED", "Could not read assignment context.", { cause });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function activeAgent(simulation, id, actor) {
|
|
11
|
+
const agent = simulation.agents.find((entry) => entry.id === id);
|
|
12
|
+
if (!agent)
|
|
13
|
+
throw new ApplicationError(actor ? "ASSIGNER_NOT_FOUND" : "ASSIGNEE_NOT_FOUND", "Assignment agent is not a simulation member.");
|
|
14
|
+
if (agent.lifecycle.status !== "running") {
|
|
15
|
+
throw new ApplicationError(actor ? "ASSIGNER_NOT_RUNNING" : "ASSIGNEE_NOT_RUNNING", "Assignment agent must have active participation.");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export async function resolveAssignmentContext(command, dependencies) {
|
|
19
|
+
const record = await read(() => dependencies.investigations.findInvestigation(command.investigationId));
|
|
20
|
+
if (!record)
|
|
21
|
+
throw new ApplicationError("INVESTIGATION_NOT_FOUND", "Investigation does not exist.");
|
|
22
|
+
if (record.investigation.id !== command.investigationId || record.investigation.simulationId !== command.simulationId) {
|
|
23
|
+
throw new ApplicationError("INVALID_REFERENCE", "Investigation identity or simulation does not match the command.");
|
|
24
|
+
}
|
|
25
|
+
if (!Number.isSafeInteger(record.revision) || record.revision < 0 || record.revision === Number.MAX_SAFE_INTEGER) {
|
|
26
|
+
throw new ApplicationError("INVALID_REFERENCE", "Investigation storage revision is invalid or exhausted.");
|
|
27
|
+
}
|
|
28
|
+
const simulation = await read(() => dependencies.simulations.findSimulation(command.simulationId));
|
|
29
|
+
if (!simulation)
|
|
30
|
+
throw new ApplicationError("SIMULATION_NOT_FOUND", "Simulation does not exist.");
|
|
31
|
+
if (simulation.id !== command.simulationId)
|
|
32
|
+
throw new ApplicationError("INVALID_REFERENCE", "Simulation identity does not match the command.");
|
|
33
|
+
if (simulation.lifecycle.status !== "running") {
|
|
34
|
+
throw new ApplicationError("SIMULATION_NOT_RUNNING", "Assignment requires a running simulation.");
|
|
35
|
+
}
|
|
36
|
+
if (command.origin.kind === "agent")
|
|
37
|
+
activeAgent(simulation, command.origin.agentId, true);
|
|
38
|
+
for (const id of command.agentIds)
|
|
39
|
+
activeAgent(simulation, id, false);
|
|
40
|
+
return record;
|
|
41
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { agentId, completeInvestigation, createInvestigationResult, investigationId, simulationId, } from "../../domain/index.js";
|
|
2
|
+
import { parseInvestigationEvent } from "../../contracts/index.js";
|
|
3
|
+
import { ApplicationError } from "../errors.js";
|
|
4
|
+
import { resolveCompletionContext } from "./resolve-context.js";
|
|
5
|
+
export async function executeCompleteInvestigation(input, dependencies) {
|
|
6
|
+
const command = Object.freeze({
|
|
7
|
+
...input,
|
|
8
|
+
investigationId: investigationId(input.investigationId),
|
|
9
|
+
simulationId: simulationId(input.simulationId),
|
|
10
|
+
completedBy: agentId(input.completedBy),
|
|
11
|
+
result: createInvestigationResult(input.result),
|
|
12
|
+
origin: Object.freeze({ ...input.origin }),
|
|
13
|
+
});
|
|
14
|
+
const record = await resolveCompletionContext(command, dependencies);
|
|
15
|
+
const investigation = completeInvestigation(record.investigation, command.result, command.completedBy, command.completedAt);
|
|
16
|
+
const event = parseInvestigationEvent({
|
|
17
|
+
eventId: command.eventId,
|
|
18
|
+
type: "investigation.completed",
|
|
19
|
+
schemaVersion: 1,
|
|
20
|
+
occurredAt: command.completedAt,
|
|
21
|
+
simulationId: command.simulationId,
|
|
22
|
+
origin: command.origin,
|
|
23
|
+
correlationId: command.correlationId,
|
|
24
|
+
payload: { investigation },
|
|
25
|
+
});
|
|
26
|
+
if (event.type !== "investigation.completed") {
|
|
27
|
+
throw new ApplicationError("INVALID_REFERENCE", "Unexpected completion event type.");
|
|
28
|
+
}
|
|
29
|
+
let saved;
|
|
30
|
+
try {
|
|
31
|
+
saved = await dependencies.investigations.commitCompletion(event, record.revision);
|
|
32
|
+
}
|
|
33
|
+
catch (cause) {
|
|
34
|
+
throw new ApplicationError("SAVE_FAILED", "Completion save failed; its commit outcome may be unknown.", { cause });
|
|
35
|
+
}
|
|
36
|
+
if (saved === "not-found") {
|
|
37
|
+
throw new ApplicationError("INVESTIGATION_NOT_FOUND", "Investigation disappeared before saving.");
|
|
38
|
+
}
|
|
39
|
+
if (saved === "conflict") {
|
|
40
|
+
throw new ApplicationError("INVESTIGATION_CONFLICT", "Investigation changed before saving; reload before deciding to retry.");
|
|
41
|
+
}
|
|
42
|
+
if (saved === "event-conflict") {
|
|
43
|
+
throw new ApplicationError("EVENT_ID_CONFLICT", "Event identity already has different content.");
|
|
44
|
+
}
|
|
45
|
+
const revision = record.revision + 1;
|
|
46
|
+
return Object.freeze({
|
|
47
|
+
investigation,
|
|
48
|
+
event,
|
|
49
|
+
revision,
|
|
50
|
+
publication: Object.freeze({
|
|
51
|
+
status: saved === "duplicate" ? "already-recorded" : "queued",
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ApplicationError } from "../errors.js";
|
|
2
|
+
async function read(operation) {
|
|
3
|
+
try {
|
|
4
|
+
return await operation();
|
|
5
|
+
}
|
|
6
|
+
catch (cause) {
|
|
7
|
+
throw new ApplicationError("READ_FAILED", "Could not read completion context.", { cause });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function activeAgent(simulation, id) {
|
|
11
|
+
const agent = simulation.agents.find((entry) => entry.id === id);
|
|
12
|
+
if (!agent) {
|
|
13
|
+
throw new ApplicationError("COMPLETER_NOT_FOUND", "Completion agent is not a simulation member.");
|
|
14
|
+
}
|
|
15
|
+
if (agent.lifecycle.status !== "running") {
|
|
16
|
+
throw new ApplicationError("COMPLETER_NOT_RUNNING", "Completion agent must have active participation.");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function resolveCompletionContext(command, dependencies) {
|
|
20
|
+
const record = await read(() => dependencies.investigations.findInvestigation(command.investigationId));
|
|
21
|
+
if (!record) {
|
|
22
|
+
throw new ApplicationError("INVESTIGATION_NOT_FOUND", "Investigation does not exist.");
|
|
23
|
+
}
|
|
24
|
+
if (record.investigation.id !== command.investigationId ||
|
|
25
|
+
record.investigation.simulationId !== command.simulationId) {
|
|
26
|
+
throw new ApplicationError("INVALID_REFERENCE", "Investigation identity or simulation does not match the command.");
|
|
27
|
+
}
|
|
28
|
+
if (!Number.isSafeInteger(record.revision) ||
|
|
29
|
+
record.revision < 0 ||
|
|
30
|
+
record.revision === Number.MAX_SAFE_INTEGER) {
|
|
31
|
+
throw new ApplicationError("INVALID_REFERENCE", "Investigation storage revision is invalid or exhausted.");
|
|
32
|
+
}
|
|
33
|
+
const simulation = await read(() => dependencies.simulations.findSimulation(command.simulationId));
|
|
34
|
+
if (!simulation) {
|
|
35
|
+
throw new ApplicationError("SIMULATION_NOT_FOUND", "Simulation does not exist.");
|
|
36
|
+
}
|
|
37
|
+
if (simulation.id !== command.simulationId) {
|
|
38
|
+
throw new ApplicationError("INVALID_REFERENCE", "Simulation identity does not match the command.");
|
|
39
|
+
}
|
|
40
|
+
if (simulation.lifecycle.status !== "running") {
|
|
41
|
+
throw new ApplicationError("SIMULATION_NOT_RUNNING", "Completion requires a running simulation.");
|
|
42
|
+
}
|
|
43
|
+
activeAgent(simulation, command.completedBy);
|
|
44
|
+
if (command.origin.kind === "agent") {
|
|
45
|
+
activeAgent(simulation, command.origin.agentId);
|
|
46
|
+
}
|
|
47
|
+
return record;
|
|
48
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { simulationId } from "../../domain/index.js";
|
|
2
|
+
import { parseSimulationConfiguration, parseSimulationSetup } from "../../contracts/index.js";
|
|
3
|
+
import { ApplicationError } from "../errors.js";
|
|
4
|
+
import { configuredSimulation } from "./profiles.js";
|
|
5
|
+
export async function executeConfigureSimulation(input, dependencies) {
|
|
6
|
+
const id = simulationId(input.simulationId);
|
|
7
|
+
const setup = parseSimulationSetup(input.setup);
|
|
8
|
+
const root = input.projectRoot;
|
|
9
|
+
let project;
|
|
10
|
+
try {
|
|
11
|
+
project = await dependencies.projects.inspectProject(root);
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
throw new ApplicationError("PROJECT_INSPECTION_FAILED", "Could not inspect the selected project.", { cause });
|
|
15
|
+
}
|
|
16
|
+
const configuration = parseSimulationConfiguration({ ...setup, simulationId: id, projectRoot: project.rootPath,
|
|
17
|
+
name: setup.name ?? project.suggestedName });
|
|
18
|
+
const simulation = configuredSimulation(configuration);
|
|
19
|
+
let saved;
|
|
20
|
+
try {
|
|
21
|
+
saved = await dependencies.configurations.createConfiguredSimulation(configuration, simulation);
|
|
22
|
+
}
|
|
23
|
+
catch (cause) {
|
|
24
|
+
throw new ApplicationError("SAVE_FAILED", "Simulation configuration commit failed; its outcome may be unknown.", { cause });
|
|
25
|
+
}
|
|
26
|
+
if (saved === "already-exists")
|
|
27
|
+
throw new ApplicationError("SIMULATION_ALREADY_EXISTS", "A simulation with this identity already exists.");
|
|
28
|
+
return Object.freeze({ configuration, simulation });
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { agentId, createAgent, createAgentProfile, createSimulation } from "../../domain/index.js";
|
|
2
|
+
const behaviors = Object.freeze({
|
|
3
|
+
explorer: Object.freeze({ name: "Explorer", personality: "Observant, curious, and experimental; tries alternative paths and questions unexpected results." }),
|
|
4
|
+
impatient: Object.freeze({ name: "Impatient", personality: "Quick, resourceful, and focused on results; retries or finds alternatives when progress feels slow." }),
|
|
5
|
+
beginner: Object.freeze({ name: "Beginner", personality: "Needs guidance and interprets instructions without prior product knowledge; may make unexpected choices." }),
|
|
6
|
+
regular: Object.freeze({ name: "Regular", personality: "Conventional, practical, and habitual; follows familiar application patterns and expects common user flows." }),
|
|
7
|
+
meticulous: Object.freeze({ name: "Meticulous", personality: "Thorough, attentive, and precise; examines fine print, validates input states, and double-checks confirmations." }),
|
|
8
|
+
distrustful: Object.freeze({ name: "Distrustful", personality: "Skeptical, cautious, and vigilant; looks out for deceptive designs, unintended data disclosures, and unprompted charges." }),
|
|
9
|
+
});
|
|
10
|
+
export function configuredSimulation(configuration) {
|
|
11
|
+
return createSimulation(configuration.simulationId, configuration.environment, configuration.userProfileIds.map(id => {
|
|
12
|
+
const behavior = behaviors[id];
|
|
13
|
+
return createAgent(agentId(id), createAgentProfile({ ...behavior,
|
|
14
|
+
goals: [{ description: configuration.goal }], capabilities: [] }));
|
|
15
|
+
}));
|
|
16
|
+
}
|