@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 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" aria-labelledby="perspectives-title" color="#237763" role="img" viewBox="0 0 64 64"><title id="perspectives-title">OFFSCRIPT — Perspectives</title><path fill="currentColor" d="M5 17 34 7v16l-8-3v-2l-13 5v15l7 2v9L5 44Zm34 5 20 5v23l-11 4v-9l3-1V33l-12-3Z"/><path fill="currentColor" fill-rule="evenodd" d="m24 27 21 6v22l-21 7Zm8 11v13l5-2V40Z" clip-rule="evenodd"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" aria-labelledby="perspectives-title" color="#237763" role="img" viewBox="0 0 64 64"><style>@media (prefers-color-scheme:dark){svg{color:#78c8ad}}</style><title id="perspectives-title">OFFSCRIPT — Perspectives</title><path fill="currentColor" d="M5 17 34 7v16l-8-3v-2l-13 5v15l7 2v9L5 44Zm34 5 20 5v23l-11 4v-9l3-1V33l-12-3Z"/><path fill="currentColor" fill-rule="evenodd" d="m24 27 21 6v22l-21 7Zm8 11v13l5-2V40Z" clip-rule="evenodd"/></svg>
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" sizes="any" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>offscript</title>
8
+ <script type="module" crossorigin src="/assets/index-uXpu7a13.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-Dh5KHl3J.css">
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) JetBrainsMono-Italic[wght].ttf: Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
Binary file
package/offscript.mjs ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync, statSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { parseArgs } from "node:util";
5
+
6
+ function resolveCliScript() {
7
+ const dist = new URL("./dist/scripts/server/cli-results.js", import.meta.url);
8
+ try {
9
+ if (statSync(dist).isFile()) return dist.href;
10
+ } catch {}
11
+ const dev = new URL("./scripts/server/cli-results.ts", import.meta.url);
12
+ try {
13
+ if (statSync(dev).isFile()) return dev.href;
14
+ } catch {}
15
+ throw new Error("Distribution is missing. Run npm run build:local in the OFFSCRIPT checkout, or reinstall the archive.");
16
+ }
17
+
18
+ try {
19
+ const { values, positionals } = parseArgs({ allowPositionals: true, options: {
20
+ project: { type: "string" }, port: { type: "string" }, "data-directory": { type: "string" },
21
+ "no-studio": { type: "boolean" }, "no-open": { type: "boolean" }, cancel: { type: "boolean" },
22
+ help: { type: "boolean", short: "h" }, version: { type: "boolean", short: "v" },
23
+ } });
24
+ const command = positionals[0];
25
+ const isResults = command === "results";
26
+ const isRecover = command === "recover";
27
+ const isTargeted = isResults || isRecover;
28
+ const validCommands = ["studio", "serve", "list", "results", "recover"];
29
+ if (
30
+ (command !== undefined && !validCommands.includes(command)) ||
31
+ (isTargeted && positionals.length !== 2) ||
32
+ (!isTargeted && positionals.length > 1)
33
+ ) {
34
+ throw new Error("Expected studio, serve, list, results <simulation-id>, or recover <simulation-id>. Use --help for usage.");
35
+ }
36
+ if ((command === "studio" && values["no-studio"]) ||
37
+ ((command === "serve" || values["no-studio"]) && values["no-open"]) ||
38
+ ((command === "list" || isTargeted) && (values["no-studio"] || values["no-open"] || values.port))) {
39
+ throw new Error("Conflicting options for command. Use --help for usage.");
40
+ }
41
+ if (values.help) {
42
+ console.log(`Usage: offscript [command] [options]
43
+
44
+ Commands:
45
+ studio Serve Studio/API and open the secure local entry (default).
46
+ serve Serve the API only.
47
+ list List saved simulations for the project.
48
+ results <id> Inspect exploration results (findings, observations, investigations).
49
+ recover <id> Explicitly settle an interrupted simulation to failed (or cancelled with --cancel).
50
+
51
+ Options:
52
+ --project <directory> Target project (default: current directory).
53
+ --port <number> Loopback port, 0 selects an available port (default: 0).
54
+ --data-directory <dir> Storage directory, relative to the target project.
55
+ --cancel When recovering, mark as cancelled instead of failed.
56
+ --no-open Print the Studio entry without opening a browser.
57
+ --no-studio Legacy alias for serve.
58
+ -h, --help Show help without starting the host.
59
+ -v, --version Show the package version without starting the host.
60
+
61
+ Flags override OFFSCRIPT_PROJECT_ROOT, OFFSCRIPT_PORT, OFFSCRIPT_DATA_DIRECTORY.
62
+ No agents or target services start automatically.`);
63
+ } else if (values.version) {
64
+ console.log(JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version);
65
+ } else {
66
+ const project = values.project ?? process.env.OFFSCRIPT_PROJECT_ROOT ?? process.cwd();
67
+ try {
68
+ if (!project.trim() || !statSync(project).isDirectory()) throw new Error();
69
+ } catch { throw new Error("Project must reference an existing, accessible directory."); }
70
+ const dataDirectory = values["data-directory"] ?? process.env.OFFSCRIPT_DATA_DIRECTORY;
71
+ if (dataDirectory !== undefined && !dataDirectory.trim()) throw new Error("Storage directory must not be blank.");
72
+
73
+ if (command === "list") {
74
+ const { executeListCommand } = await import(resolveCliScript());
75
+ await executeListCommand({ projectRoot: project, ...(dataDirectory !== undefined ? { dataDirectory } : {}) });
76
+ } else if (isResults) {
77
+ const { executeResultsCommand } = await import(resolveCliScript());
78
+ await executeResultsCommand({ projectRoot: project, simulationId: positionals[1] ?? "", ...(dataDirectory !== undefined ? { dataDirectory } : {}) });
79
+ } else if (isRecover) {
80
+ const { executeRecoverCommand } = await import(resolveCliScript());
81
+ await executeRecoverCommand({ projectRoot: project, simulationId: positionals[1] ?? "", cancel: Boolean(values.cancel), ...(dataDirectory !== undefined ? { dataDirectory } : {}) });
82
+ } else {
83
+ const port = values.port ?? process.env.OFFSCRIPT_PORT ?? "0";
84
+ if (!/^\d+$/.test(port) || !Number.isSafeInteger(Number(port)) || Number(port) > 65535) {
85
+ throw new Error("Port must be an integer between 0 and 65535.");
86
+ }
87
+ const studio = command !== "serve" && !values["no-studio"];
88
+ try {
89
+ if (!statSync(new URL("./dist/scripts/server/run.js", import.meta.url)).isFile()) throw new Error();
90
+ if (studio && !statSync(new URL("./dist/studio/index.html", import.meta.url)).isFile()) throw new Error();
91
+ } catch { throw new Error("Distribution is missing. Run npm run build:local in the OFFSCRIPT checkout, or reinstall the archive."); }
92
+ process.env.OFFSCRIPT_PROJECT_ROOT = project;
93
+ process.env.OFFSCRIPT_PORT = port;
94
+ if (dataDirectory !== undefined) process.env.OFFSCRIPT_DATA_DIRECTORY = dataDirectory;
95
+ if (studio) process.env.OFFSCRIPT_STUDIO_DIRECTORY = fileURLToPath(new URL("./dist/studio/", import.meta.url));
96
+ else delete process.env.OFFSCRIPT_STUDIO_DIRECTORY;
97
+ process.env.OFFSCRIPT_OPEN_BROWSER = studio && !values["no-open"] ? "1" : "0";
98
+ await import("./dist/scripts/server/run.js");
99
+ }
100
+ }
101
+ } catch (error) {
102
+ console.error(`OFFSCRIPT: ${error instanceof Error ? error.message : "Could not launch. Use --help for usage."}`);
103
+ process.exitCode = 1;
104
+ }
package/package.json CHANGED
@@ -1,6 +1,102 @@
1
1
  {
2
2
  "name": "@nikelyh/offscript",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "type": "module",
4
+ "scripts": {
5
+ "prepare": "node -e \"if (process.env.HUSKY !== '0') import('husky').then(m => m.default()).catch(() => {})\"",
6
+ "lint": "npm run lint:packages && npm --prefix apps/studio run lint",
7
+ "build": "npm --prefix apps/studio run build",
8
+ "check": "npm run typecheck:domain && npm run typecheck:contracts && npm run typecheck:application && npm run typecheck:browser && npm run typecheck:orchestration && npm run typecheck:persistence && npm run typecheck:runtime && npm run typecheck:server && npm run typecheck:projects && npm run db:check && npm --prefix apps/studio run typecheck:tests && npm test && npm run lint && npm run build",
9
+ "commitlint": "commitlint",
10
+ "typecheck:domain": "tsc -p packages/domain/tsconfig.json && tsc -p packages/domain/tests/tsconfig.json",
11
+ "test:domain": "node --test packages/domain/tests/*.test.ts",
12
+ "test": "npm run test:domain && npm run test:contracts && npm run test:application && npm run test:browser && npm run test:orchestration && npm run test:persistence && npm run test:runtime && npm run test:server && npm run test:projects && npm --prefix apps/studio test",
13
+ "typecheck:browser": "tsc -p packages/browser/tsconfig.json && tsc -p packages/browser/tests/tsconfig.json",
14
+ "test:browser": "node --test packages/browser/tests/*.test.ts",
15
+ "typecheck:application": "tsc -p packages/application/tsconfig.json && tsc -p packages/application/tests/tsconfig.json",
16
+ "test:application": "node --test packages/application/tests/*.test.ts",
17
+ "typecheck:contracts": "tsc -p packages/contracts/tsconfig.json && tsc -p packages/contracts/tests/tsconfig.json",
18
+ "test:contracts": "node --test packages/contracts/tests/*.test.ts",
19
+ "typecheck:orchestration": "tsc -p packages/orchestration/tsconfig.json && tsc -p packages/orchestration/tests/tsconfig.json",
20
+ "test:orchestration": "node --import ./packages/orchestration/tests/setup.ts --test packages/orchestration/tests/*.test.ts",
21
+ "demo:mozaik": "node scripts/mozaik/run.ts",
22
+ "typecheck:persistence": "tsc -p packages/persistence/tsconfig.json && tsc -p packages/persistence/tests/tsconfig.json",
23
+ "test:persistence": "node --test packages/persistence/tests/*.test.ts",
24
+ "db:generate": "drizzle-kit generate",
25
+ "db:check": "drizzle-kit check",
26
+ "lint:packages": "npm exec --prefix apps/studio --offline -- oxlint packages scripts drizzle.config.ts offscript.mjs",
27
+ "typecheck:runtime": "tsc -p packages/runtime/tsconfig.json && tsc -p packages/runtime/tests/tsconfig.json",
28
+ "test:runtime": "node --test packages/runtime/tests/*.test.ts",
29
+ "typecheck:server": "tsc -p packages/server/tsconfig.json && tsc -p packages/server/tests/tsconfig.json",
30
+ "test:server": "node --test packages/server/tests/*.test.ts",
31
+ "dev:server": "node scripts/server/run.ts",
32
+ "typecheck:projects": "tsc -p packages/projects/tsconfig.json && tsc -p packages/projects/tests/tsconfig.json",
33
+ "test:projects": "node --test packages/projects/tests/*.test.ts",
34
+ "build:local": "node scripts/server/distribution-clean.ts && npm run build && tsc -p tsconfig.distribution.json && node scripts/server/distribution-assets.ts",
35
+ "start": "node offscript.mjs",
36
+ "prepack": "npm run build:local"
37
+ },
38
+ "devDependencies": {
39
+ "@commitlint/cli": "^21.2.4",
40
+ "@commitlint/config-conventional": "^21.2.4",
41
+ "@types/better-sqlite3": "9.6.0",
42
+ "@types/node": "^26.6.5",
43
+ "drizzle-kit": "0.31.11",
44
+ "husky": "^9.1.7",
45
+ "typescript": "~7.0.2"
46
+ },
47
+ "dependencies": {
48
+ "@fastify/send": "4.2.0",
49
+ "@mozaik-ai/core": "4.2.0",
50
+ "better-sqlite3": "13.0.3",
51
+ "drizzle-orm": "0.45.4",
52
+ "fastify": "5.12.7",
53
+ "playwright": "1.64.1"
54
+ },
55
+ "overrides": {
56
+ "@esbuild-kit/core-utils": {
57
+ "esbuild": "0.25.12"
58
+ }
59
+ },
60
+ "allowScripts": {
61
+ "better-sqlite3": false,
62
+ "@google/genai@2.32.0": false,
63
+ "protobufjs@7.6.6": false,
64
+ "esbuild@0.25.12": true,
65
+ "esbuild@0.28.2": true
66
+ },
67
+ "version": "1.0.0",
68
+ "bin": {
69
+ "offscript": "offscript.mjs"
70
+ },
71
+ "engines": {
72
+ "node": ">=24.0.0",
73
+ "npm": ">=11.19.0"
74
+ },
75
+ "files": [
76
+ "offscript.mjs",
77
+ "dist",
78
+ "THIRD_PARTY_NOTICES.md"
79
+ ],
80
+ "description": "Local-first software exploration with Mozaik multi-agent coordination and a local Studio.",
81
+ "license": "Apache-2.0",
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "git+https://github.com/yohanvillarp/offscript.git"
85
+ },
86
+ "bugs": {
87
+ "url": "https://github.com/yohanvillarp/offscript/issues"
88
+ },
89
+ "homepage": "https://github.com/yohanvillarp/offscript#readme",
90
+ "keywords": [
91
+ "mozaik",
92
+ "multi-agent",
93
+ "software-exploration",
94
+ "playwright",
95
+ "developer-tools",
96
+ "local-first"
97
+ ],
98
+ "publishConfig": {
99
+ "access": "public",
100
+ "registry": "https://registry.npmjs.org/"
101
+ }
102
+ }