yuurei 0.0.1

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 (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +231 -0
  3. package/dist/artifact/collector.d.ts +15 -0
  4. package/dist/artifact/collector.d.ts.map +1 -0
  5. package/dist/artifact/collector.js +87 -0
  6. package/dist/artifact/collector.js.map +1 -0
  7. package/dist/artifact/types.d.ts +10 -0
  8. package/dist/artifact/types.d.ts.map +1 -0
  9. package/dist/artifact/types.js +2 -0
  10. package/dist/artifact/types.js.map +1 -0
  11. package/dist/cell/digest.d.ts +10 -0
  12. package/dist/cell/digest.d.ts.map +1 -0
  13. package/dist/cell/digest.js +13 -0
  14. package/dist/cell/digest.js.map +1 -0
  15. package/dist/cell/resolver.d.ts +18 -0
  16. package/dist/cell/resolver.d.ts.map +1 -0
  17. package/dist/cell/resolver.js +41 -0
  18. package/dist/cell/resolver.js.map +1 -0
  19. package/dist/cell/types.d.ts +48 -0
  20. package/dist/cell/types.d.ts.map +1 -0
  21. package/dist/cell/types.js +2 -0
  22. package/dist/cell/types.js.map +1 -0
  23. package/dist/cli/clean.d.ts +16 -0
  24. package/dist/cli/clean.d.ts.map +1 -0
  25. package/dist/cli/clean.js +24 -0
  26. package/dist/cli/clean.js.map +1 -0
  27. package/dist/cli/doctor.d.ts +29 -0
  28. package/dist/cli/doctor.d.ts.map +1 -0
  29. package/dist/cli/doctor.js +160 -0
  30. package/dist/cli/doctor.js.map +1 -0
  31. package/dist/cli/exit-codes.d.ts +15 -0
  32. package/dist/cli/exit-codes.d.ts.map +1 -0
  33. package/dist/cli/exit-codes.js +18 -0
  34. package/dist/cli/exit-codes.js.map +1 -0
  35. package/dist/cli/init.d.ts +32 -0
  36. package/dist/cli/init.d.ts.map +1 -0
  37. package/dist/cli/init.js +143 -0
  38. package/dist/cli/init.js.map +1 -0
  39. package/dist/cli/inspect.d.ts +4 -0
  40. package/dist/cli/inspect.d.ts.map +1 -0
  41. package/dist/cli/inspect.js +24 -0
  42. package/dist/cli/inspect.js.map +1 -0
  43. package/dist/cli/output.d.ts +5 -0
  44. package/dist/cli/output.d.ts.map +1 -0
  45. package/dist/cli/output.js +5 -0
  46. package/dist/cli/output.js.map +1 -0
  47. package/dist/cli/profile-list.d.ts +3 -0
  48. package/dist/cli/profile-list.d.ts.map +1 -0
  49. package/dist/cli/profile-list.js +14 -0
  50. package/dist/cli/profile-list.js.map +1 -0
  51. package/dist/cli/run.d.ts +22 -0
  52. package/dist/cli/run.d.ts.map +1 -0
  53. package/dist/cli/run.js +95 -0
  54. package/dist/cli/run.js.map +1 -0
  55. package/dist/cli/trace-show.d.ts +3 -0
  56. package/dist/cli/trace-show.d.ts.map +1 -0
  57. package/dist/cli/trace-show.js +22 -0
  58. package/dist/cli/trace-show.js.map +1 -0
  59. package/dist/config/discovery.d.ts +3 -0
  60. package/dist/config/discovery.d.ts.map +1 -0
  61. package/dist/config/discovery.js +18 -0
  62. package/dist/config/discovery.js.map +1 -0
  63. package/dist/config/schema.d.ts +21 -0
  64. package/dist/config/schema.d.ts.map +1 -0
  65. package/dist/config/schema.js +19 -0
  66. package/dist/config/schema.js.map +1 -0
  67. package/dist/config/yuurei-config.d.ts +4 -0
  68. package/dist/config/yuurei-config.d.ts.map +1 -0
  69. package/dist/config/yuurei-config.js +10 -0
  70. package/dist/config/yuurei-config.js.map +1 -0
  71. package/dist/cost/noop.d.ts +7 -0
  72. package/dist/cost/noop.d.ts.map +1 -0
  73. package/dist/cost/noop.js +10 -0
  74. package/dist/cost/noop.js.map +1 -0
  75. package/dist/cost/types.d.ts +21 -0
  76. package/dist/cost/types.d.ts.map +1 -0
  77. package/dist/cost/types.js +2 -0
  78. package/dist/cost/types.js.map +1 -0
  79. package/dist/index.d.ts +3 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +111 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/isolation/config-root.d.ts +9 -0
  84. package/dist/isolation/config-root.d.ts.map +1 -0
  85. package/dist/isolation/config-root.js +10 -0
  86. package/dist/isolation/config-root.js.map +1 -0
  87. package/dist/isolation/env.d.ts +2 -0
  88. package/dist/isolation/env.d.ts.map +1 -0
  89. package/dist/isolation/env.js +17 -0
  90. package/dist/isolation/env.js.map +1 -0
  91. package/dist/isolation/index.d.ts +9 -0
  92. package/dist/isolation/index.d.ts.map +1 -0
  93. package/dist/isolation/index.js +21 -0
  94. package/dist/isolation/index.js.map +1 -0
  95. package/dist/isolation/level0.d.ts +20 -0
  96. package/dist/isolation/level0.d.ts.map +1 -0
  97. package/dist/isolation/level0.js +51 -0
  98. package/dist/isolation/level0.js.map +1 -0
  99. package/dist/isolation/level1.d.ts +13 -0
  100. package/dist/isolation/level1.d.ts.map +1 -0
  101. package/dist/isolation/level1.js +58 -0
  102. package/dist/isolation/level1.js.map +1 -0
  103. package/dist/isolation/tempdir.d.ts +53 -0
  104. package/dist/isolation/tempdir.d.ts.map +1 -0
  105. package/dist/isolation/tempdir.js +87 -0
  106. package/dist/isolation/tempdir.js.map +1 -0
  107. package/dist/isolation/types.d.ts +37 -0
  108. package/dist/isolation/types.d.ts.map +1 -0
  109. package/dist/isolation/types.js +2 -0
  110. package/dist/isolation/types.js.map +1 -0
  111. package/dist/profile/loader.d.ts +9 -0
  112. package/dist/profile/loader.d.ts.map +1 -0
  113. package/dist/profile/loader.js +95 -0
  114. package/dist/profile/loader.js.map +1 -0
  115. package/dist/profile/manifest.d.ts +29 -0
  116. package/dist/profile/manifest.d.ts.map +1 -0
  117. package/dist/profile/manifest.js +28 -0
  118. package/dist/profile/manifest.js.map +1 -0
  119. package/dist/profile/types.d.ts +31 -0
  120. package/dist/profile/types.d.ts.map +1 -0
  121. package/dist/profile/types.js +2 -0
  122. package/dist/profile/types.js.map +1 -0
  123. package/dist/run/id.d.ts +7 -0
  124. package/dist/run/id.d.ts.map +1 -0
  125. package/dist/run/id.js +15 -0
  126. package/dist/run/id.js.map +1 -0
  127. package/dist/run/layout.d.ts +27 -0
  128. package/dist/run/layout.d.ts.map +1 -0
  129. package/dist/run/layout.js +45 -0
  130. package/dist/run/layout.js.map +1 -0
  131. package/dist/run/pipeline.d.ts +45 -0
  132. package/dist/run/pipeline.d.ts.map +1 -0
  133. package/dist/run/pipeline.js +246 -0
  134. package/dist/run/pipeline.js.map +1 -0
  135. package/dist/run/signals.d.ts +53 -0
  136. package/dist/run/signals.d.ts.map +1 -0
  137. package/dist/run/signals.js +74 -0
  138. package/dist/run/signals.js.map +1 -0
  139. package/dist/runtime/claude-code/args.d.ts +8 -0
  140. package/dist/runtime/claude-code/args.d.ts.map +1 -0
  141. package/dist/runtime/claude-code/args.js +13 -0
  142. package/dist/runtime/claude-code/args.js.map +1 -0
  143. package/dist/runtime/claude-code/index.d.ts +11 -0
  144. package/dist/runtime/claude-code/index.d.ts.map +1 -0
  145. package/dist/runtime/claude-code/index.js +167 -0
  146. package/dist/runtime/claude-code/index.js.map +1 -0
  147. package/dist/runtime/claude-code/paths.d.ts +3 -0
  148. package/dist/runtime/claude-code/paths.d.ts.map +1 -0
  149. package/dist/runtime/claude-code/paths.js +6 -0
  150. package/dist/runtime/claude-code/paths.js.map +1 -0
  151. package/dist/runtime/codex/args.d.ts +21 -0
  152. package/dist/runtime/codex/args.d.ts.map +1 -0
  153. package/dist/runtime/codex/args.js +35 -0
  154. package/dist/runtime/codex/args.js.map +1 -0
  155. package/dist/runtime/codex/index.d.ts +13 -0
  156. package/dist/runtime/codex/index.d.ts.map +1 -0
  157. package/dist/runtime/codex/index.js +299 -0
  158. package/dist/runtime/codex/index.js.map +1 -0
  159. package/dist/runtime/codex/paths.d.ts +3 -0
  160. package/dist/runtime/codex/paths.d.ts.map +1 -0
  161. package/dist/runtime/codex/paths.js +6 -0
  162. package/dist/runtime/codex/paths.js.map +1 -0
  163. package/dist/runtime/detect.d.ts +5 -0
  164. package/dist/runtime/detect.d.ts.map +1 -0
  165. package/dist/runtime/detect.js +42 -0
  166. package/dist/runtime/detect.js.map +1 -0
  167. package/dist/runtime/exec.d.ts +24 -0
  168. package/dist/runtime/exec.d.ts.map +1 -0
  169. package/dist/runtime/exec.js +132 -0
  170. package/dist/runtime/exec.js.map +1 -0
  171. package/dist/runtime/registry.d.ts +4 -0
  172. package/dist/runtime/registry.d.ts.map +1 -0
  173. package/dist/runtime/registry.js +23 -0
  174. package/dist/runtime/registry.js.map +1 -0
  175. package/dist/runtime/reserved-paths.d.ts +22 -0
  176. package/dist/runtime/reserved-paths.d.ts.map +1 -0
  177. package/dist/runtime/reserved-paths.js +30 -0
  178. package/dist/runtime/reserved-paths.js.map +1 -0
  179. package/dist/runtime/types.d.ts +105 -0
  180. package/dist/runtime/types.d.ts.map +1 -0
  181. package/dist/runtime/types.js +2 -0
  182. package/dist/runtime/types.js.map +1 -0
  183. package/dist/trace/reader.d.ts +4 -0
  184. package/dist/trace/reader.d.ts.map +1 -0
  185. package/dist/trace/reader.js +9 -0
  186. package/dist/trace/reader.js.map +1 -0
  187. package/dist/trace/redact.d.ts +22 -0
  188. package/dist/trace/redact.d.ts.map +1 -0
  189. package/dist/trace/redact.js +124 -0
  190. package/dist/trace/redact.js.map +1 -0
  191. package/dist/trace/schema.d.ts +49 -0
  192. package/dist/trace/schema.d.ts.map +1 -0
  193. package/dist/trace/schema.js +53 -0
  194. package/dist/trace/schema.js.map +1 -0
  195. package/dist/trace/writer.d.ts +17 -0
  196. package/dist/trace/writer.d.ts.map +1 -0
  197. package/dist/trace/writer.js +45 -0
  198. package/dist/trace/writer.js.map +1 -0
  199. package/dist/util/fs.d.ts +17 -0
  200. package/dist/util/fs.d.ts.map +1 -0
  201. package/dist/util/fs.js +61 -0
  202. package/dist/util/fs.js.map +1 -0
  203. package/dist/util/hash.d.ts +3 -0
  204. package/dist/util/hash.d.ts.map +1 -0
  205. package/dist/util/hash.js +7 -0
  206. package/dist/util/hash.js.map +1 -0
  207. package/dist/util/json.d.ts +8 -0
  208. package/dist/util/json.d.ts.map +1 -0
  209. package/dist/util/json.js +24 -0
  210. package/dist/util/json.js.map +1 -0
  211. package/dist/util/logger.d.ts +8 -0
  212. package/dist/util/logger.d.ts.map +1 -0
  213. package/dist/util/logger.js +16 -0
  214. package/dist/util/logger.js.map +1 -0
  215. package/dist/version.d.ts +24 -0
  216. package/dist/version.d.ts.map +1 -0
  217. package/dist/version.js +26 -0
  218. package/dist/version.js.map +1 -0
  219. package/docs/assets/yuurei-top.jpg +0 -0
  220. package/package.json +61 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shimpei Takamatsu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ # yuurei
2
+
3
+ > Isolated, reproducible runtime environments for coding agents
4
+
5
+ ![Yuurei ghost DJ operating a mixing console](docs/assets/yuurei-top.jpg)
6
+
7
+ `yuurei` isolates coding-agent runtime environments (Claude Code, Codex)
8
+ from your normal global configuration, so different harness profiles
9
+ (skills, instructions, settings, hooks) can be swapped and run
10
+ reproducibly without touching or breaking your everyday setup.
11
+
12
+ ## Why
13
+
14
+ Comparing harness or profile variants safely usually means backing up,
15
+ swapping, restarting, and restoring your global config by hand — a
16
+ process that gets fragile fast as the number of variants grows. `yuurei`
17
+ builds a temporary, isolated execution cell per run instead, and emits a
18
+ runtime-agnostic trace record (`trace.json`) that other tools — such as a
19
+ future ROI tracker — can consume. `yuurei` itself stays agnostic of any
20
+ such consumer; the dependency only ever points one way, from that tool
21
+ toward `yuurei`.
22
+
23
+ ## Quickstart
24
+
25
+ Install yuurei from npm, or build it from a source checkout:
26
+
27
+ ```sh
28
+ npm install -g yuurei
29
+ ```
30
+
31
+ Check that the CLI is on your PATH:
32
+
33
+ ```sh
34
+ yuurei --help
35
+ ```
36
+
37
+ ### Required authentication setup
38
+
39
+ `yuurei` forwards explicit credential variables into the isolated runtime. It
40
+ does **not** read your interactive login from the OS credential store, so you
41
+ must make a credential available explicitly before running a task. Keep
42
+ credentials out of profile and task files.
43
+
44
+ #### Claude Code
45
+
46
+ **Subscription login (default path):** Run `claude setup-token` once in this
47
+ shell to obtain a long-lived token, then export it before running any task:
48
+
49
+ ```sh
50
+ claude setup-token
51
+ # follow the prompts, then copy the token it prints
52
+ export ANTHROPIC_AUTH_TOKEN='<token from claude setup-token>'
53
+ ```
54
+
55
+ **API key:** export `ANTHROPIC_API_KEY` instead:
56
+
57
+ ```sh
58
+ export ANTHROPIC_API_KEY='<api-key>'
59
+ ```
60
+
61
+ Note: `claude auth status` may report `loggedIn: true` while `yuurei doctor`
62
+ reports `authentication: required`. These check different stores — `claude auth
63
+ status` reads the OS credential store; yuurei checks for an explicit environment
64
+ variable. A shell export applies only to that shell and its child processes; do
65
+ not persist the token in a profile, task, or committed file.
66
+
67
+ #### Codex
68
+
69
+ **API key (default path):** export `OPENAI_API_KEY`:
70
+
71
+ ```sh
72
+ export OPENAI_API_KEY='<api-key>'
73
+ ```
74
+
75
+ **Existing interactive login (experimental, opt-in):** if you already have a
76
+ `~/.codex/auth.json` from a `codex` interactive login, you can reuse it in the
77
+ isolated run with `--bridge-codex-auth-file`:
78
+
79
+ ```sh
80
+ yuurei run <run-name> --bridge-codex-auth-file
81
+ ```
82
+
83
+ This flag is experimental and off by default. When enabled, yuurei copies
84
+ exactly `~/.codex/auth.json` into the isolated run, runs with it, and scrubs
85
+ the isolated copy afterward. The real global file is never modified. It is an
86
+ explicit opt-in because that file can carry a rotating OAuth access/refresh
87
+ token pair: if the token refreshes mid-run, only the isolated copy receives the
88
+ new state while the real file stays stale, and the valid rotated copy is then
89
+ discarded on cleanup. Do not copy credentials into profiles, tasks, traces,
90
+ artifacts, or logs.
91
+
92
+ #### Verify the environment
93
+
94
+ Check that the environment is ready:
95
+
96
+ ```sh
97
+ yuurei doctor
98
+ ```
99
+
100
+ Each runtime prints as a compact status block:
101
+
102
+ ```text
103
+ claude-code
104
+ status: installed
105
+ version: <installed-version>
106
+ supported: yes
107
+ authentication: ready
108
+
109
+ codex
110
+ status: installed
111
+ version: <installed-version>
112
+ supported: yes
113
+ authentication: required
114
+ Export OPENAI_API_KEY in this shell and re-run `yuurei doctor`. ...
115
+ ```
116
+
117
+ Look for `authentication: ready` for the runtime you plan to use. If a runtime
118
+ reports `authentication: required`, `yuurei doctor` prints safe,
119
+ runtime-specific next steps. Note that the check reflects an explicit
120
+ environment credential, not whether an interactive login exists: Codex can
121
+ report `authentication: required` even when a `~/.codex/auth.json` is available
122
+ for explicit bridging, because the check detects `OPENAI_API_KEY` only. Verify a
123
+ credential variable is present without printing its value:
124
+
125
+ ```sh
126
+ [ -n "$ANTHROPIC_AUTH_TOKEN" ] && echo present || echo absent
127
+ [ -n "$OPENAI_API_KEY" ] && echo present || echo absent
128
+ ```
129
+
130
+ Orphaned temp directories are listed with a prominent count and the
131
+ `yuurei clean` recovery command. Pass `--json` for machine-readable output that
132
+ scripts can consume, one JSON object per line:
133
+
134
+ ```text
135
+ {"level":"info","message":"claude-code: installed","version":"<installed-version>","versionSupported":true,"authUsable":true}
136
+ ```
137
+
138
+ ### Create a first project
139
+
140
+ A Yuurei project keeps its configuration under `.yuurei/`. The project
141
+ configuration names profiles and runs. A profile selects a runtime and its
142
+ runtime-native config files. A task is the instruction sent to that runtime.
143
+ Each run creates a trace and logs under `.yuurei/runs/<run-id>/`.
144
+
145
+ Create the smallest Claude Code project with the scaffold command:
146
+
147
+ ```sh
148
+ mkdir yuurei-demo
149
+ cd yuurei-demo
150
+ yuurei init
151
+ ```
152
+
153
+ `init` writes a valid `.yuurei/yuurei.yaml`, one profile
154
+ (`profiles/claude-basic/profile.yaml`), and one safe task
155
+ (`tasks/hello.md`). It never overwrites existing files and creates no
156
+ credentials. Pass options to change the runtime, profile, task, run, or
157
+ target directory:
158
+
159
+ ```sh
160
+ yuurei init --runtime codex --profile codex-basic --task hello --run first-run
161
+ yuurei init ../other-project
162
+ ```
163
+
164
+ The default profile is `claude-basic` and the default task is `hello`.
165
+ The named run resolves `profile` and `task` from `.yuurei/yuurei.yaml`:
166
+
167
+ ```sh
168
+ yuurei profile list
169
+ yuurei inspect claude-basic
170
+ yuurei run hello
171
+ ```
172
+
173
+ To choose both values at the command line, run:
174
+
175
+ ```sh
176
+ yuurei run --profile claude-basic --task .yuurei/tasks/hello.md
177
+ ```
178
+
179
+ After a run, use the printed run ID to inspect the result:
180
+
181
+ ```sh
182
+ RUN_ID='<run-id>'
183
+ yuurei trace show "$RUN_ID"
184
+ cat ".yuurei/runs/$RUN_ID/trace.json"
185
+ cat ".yuurei/runs/$RUN_ID/stdout.log"
186
+ cat ".yuurei/runs/$RUN_ID/stderr.log"
187
+ cat ".yuurei/runs/$RUN_ID/artifacts.json"
188
+ ```
189
+
190
+ The trace records the runtime, exit status, timeout status, profile and task
191
+ digests, and isolation result. Yuurei does not copy your project source into
192
+ the temporary execution cell, and it does not import your global runtime
193
+ configuration automatically.
194
+
195
+ The `task` path in a named run must stay inside `.yuurei/`. A direct
196
+ `--task` path is an explicit operator choice and may point elsewhere. Keep
197
+ profile and task files trusted because the runtime executes their contents.
198
+
199
+ For runtime-specific authentication, config files, isolation levels, and
200
+ security details, read the [Getting started guide](https://github.com/shimpeiws/yuurei/blob/main/docs/getting-started.md).
201
+
202
+ `yuurei doctor` also reports isolated temp directories orphaned by an abnormal
203
+ termination (SIGKILL, power loss, hard crash); `yuurei clean` removes them.
204
+
205
+ ```sh
206
+ yuurei init [--runtime <runtime>] [--profile <name>] [--task <name>] [--run <name>] [directory]
207
+ yuurei doctor
208
+ yuurei profile list
209
+ yuurei inspect <profile-name>
210
+ yuurei run <run-name>
211
+ yuurei run --profile <profile> --task <path/to/task.md>
212
+ yuurei run <run-name> --keep
213
+ yuurei run <run-name> --bridge-codex-auth-file
214
+ yuurei trace show <run-id>
215
+ yuurei clean
216
+ ```
217
+
218
+ ## Status
219
+
220
+ v0.3 scope: single-runtime "native cell" execution (Pattern A) for Claude
221
+ Code and Codex, treated as independent runtime × model × harness × task
222
+ combinations. Not yet in scope: cross-runtime harness portability, local
223
+ LLM support, output quality auto-scoring, cost/ROI dashboards, OS-level
224
+ sandboxing, or team auth.
225
+
226
+ ## Learn more
227
+
228
+ See the
229
+ [design document](https://github.com/shimpeiws/yuurei/blob/main/docs/design/yuurei-design-v0.3.md)
230
+ for the full design, and the
231
+ [release process](https://github.com/shimpeiws/yuurei/blob/main/docs/releasing.md).
@@ -0,0 +1,15 @@
1
+ import type { ArtifactManifest } from './types.js';
2
+ export declare const DEFAULT_ARTIFACT_MAX_BYTES: number;
3
+ export interface CollectArtifactsOptions {
4
+ maxBytes?: number;
5
+ truncatedPaths?: readonly string[];
6
+ }
7
+ /**
8
+ * Collects known output files from a run directory into an artifact
9
+ * manifest. What counts as an artifact and how large a file it will
10
+ * digest is deliberately narrow in v0.3 (design doc §10: don't
11
+ * unconditionally duplicate secrets or huge files).
12
+ */
13
+ export declare function collectArtifacts(runDir: string, paths: string[], options?: CollectArtifactsOptions): Promise<ArtifactManifest>;
14
+ export declare function writeArtifactManifest(runDir: string, manifest: ArtifactManifest): Promise<void>;
15
+ //# sourceMappingURL=collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/artifact/collector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAY,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,0BAA0B,QAAc,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,gBAAgB,CAAC,CAc3B;AA+DD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1,87 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { createReadStream } from 'node:fs';
3
+ import { rename, rm, stat, writeFile } from 'node:fs/promises';
4
+ import { join } from 'node:path';
5
+ export const DEFAULT_ARTIFACT_MAX_BYTES = 1024 * 1024;
6
+ /**
7
+ * Collects known output files from a run directory into an artifact
8
+ * manifest. What counts as an artifact and how large a file it will
9
+ * digest is deliberately narrow in v0.3 (design doc §10: don't
10
+ * unconditionally duplicate secrets or huge files).
11
+ */
12
+ export async function collectArtifacts(runDir, paths, options = {}) {
13
+ const maxBytes = options.maxBytes ?? DEFAULT_ARTIFACT_MAX_BYTES;
14
+ validateMaxBytes(maxBytes);
15
+ const artifacts = [];
16
+ for (const path of paths) {
17
+ const artifact = await collectArtifact(runDir, path, maxBytes, options.truncatedPaths?.includes(path));
18
+ if (artifact)
19
+ artifacts.push(artifact);
20
+ }
21
+ return { artifacts };
22
+ }
23
+ function validateMaxBytes(maxBytes) {
24
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
25
+ throw new RangeError('maxBytes must be a non-negative safe integer');
26
+ }
27
+ }
28
+ async function collectArtifact(runDir, path, maxBytes, knownTruncated = false) {
29
+ const sourcePath = join(runDir, path);
30
+ const tempPath = `${sourcePath}.tmp-${randomUUID()}`;
31
+ const hash = createHash('sha256');
32
+ let bytes = 0;
33
+ let truncated = knownTruncated;
34
+ let needsRewrite = false;
35
+ try {
36
+ const source = createReadStream(sourcePath);
37
+ const chunks = [];
38
+ for await (const chunk of source) {
39
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
40
+ const remaining = maxBytes - bytes;
41
+ if (remaining <= 0) {
42
+ truncated = true;
43
+ needsRewrite = true;
44
+ break;
45
+ }
46
+ const kept = buffer.subarray(0, remaining);
47
+ chunks.push(kept);
48
+ hash.update(kept);
49
+ bytes += kept.length;
50
+ if (kept.length < buffer.length) {
51
+ truncated = true;
52
+ needsRewrite = true;
53
+ break;
54
+ }
55
+ }
56
+ if (needsRewrite) {
57
+ const sourceStats = await stat(sourcePath);
58
+ await writeFile(tempPath, Buffer.concat(chunks), { mode: sourceStats.mode & 0o7777 });
59
+ await rename(tempPath, sourcePath);
60
+ }
61
+ }
62
+ catch (error) {
63
+ await rm(tempPath, { force: true });
64
+ if (error.code === 'ENOENT')
65
+ return null;
66
+ throw error;
67
+ }
68
+ const artifact = {
69
+ path,
70
+ kind: kindFor(path),
71
+ digest: `sha256:${hash.digest('hex')}`,
72
+ };
73
+ if (truncated)
74
+ artifact.truncated = true;
75
+ return artifact;
76
+ }
77
+ export async function writeArtifactManifest(runDir, manifest) {
78
+ await writeFile(join(runDir, 'artifacts.json'), JSON.stringify(manifest, null, 2), 'utf8');
79
+ }
80
+ function kindFor(path) {
81
+ if (path.endsWith('.diff'))
82
+ return 'patch';
83
+ if (path.endsWith('.log'))
84
+ return 'log';
85
+ return 'file';
86
+ }
87
+ //# sourceMappingURL=collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/artifact/collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,GAAG,IAAI,CAAC;AAOtD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,KAAe,EACf,UAAmC,EAAE;IAErC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,0BAA0B,CAAC;IAChE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,MAAM,eAAe,CACpC,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,CACvC,CAAC;QACF,IAAI,QAAQ;YAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAgB;IACxC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,UAAU,CAAC,8CAA8C,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,MAAc,EACd,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@
1
+ export interface Artifact {
2
+ path: string;
3
+ kind: string;
4
+ digest: string;
5
+ truncated?: boolean;
6
+ }
7
+ export interface ArtifactManifest {
8
+ artifacts: Artifact[];
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/artifact/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/artifact/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { CellIdentityInput } from './types.js';
2
+ /**
3
+ * cell_digest = hash(runtime identity, requested model, resolved profile
4
+ * contents, task contents, yuurei version, relevant execution options) —
5
+ * design doc §7.3. Hashed over resolved content, never over profile/task
6
+ * names alone, so two profiles with the same name but different contents
7
+ * never collide.
8
+ */
9
+ export declare function computeCellDigest(input: CellIdentityInput): string;
10
+ //# sourceMappingURL=digest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../src/cell/digest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAElE"}
@@ -0,0 +1,13 @@
1
+ import { canonicalJsonStringify } from '../util/json.js';
2
+ import { sha256Digest } from '../util/hash.js';
3
+ /**
4
+ * cell_digest = hash(runtime identity, requested model, resolved profile
5
+ * contents, task contents, yuurei version, relevant execution options) —
6
+ * design doc §7.3. Hashed over resolved content, never over profile/task
7
+ * names alone, so two profiles with the same name but different contents
8
+ * never collide.
9
+ */
10
+ export function computeCellDigest(input) {
11
+ return sha256Digest(canonicalJsonStringify(input));
12
+ }
13
+ //# sourceMappingURL=digest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest.js","sourceRoot":"","sources":["../../src/cell/digest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAwB;IACxD,OAAO,YAAY,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ResolvedProfile } from '../profile/types.js';
2
+ import type { IsolationStrategy } from '../isolation/types.js';
3
+ import type { ResolvedCell } from './types.js';
4
+ export interface CellResolutionInput {
5
+ runtimeId: string;
6
+ requestedModel: string;
7
+ profile: ResolvedProfile;
8
+ taskPath: string;
9
+ yuureiVersion: string;
10
+ executionOptions?: Record<string, unknown>;
11
+ isolationStrategy: IsolationStrategy;
12
+ }
13
+ /**
14
+ * Cell Resolver: combines runtime + model + resolved profile + resolved
15
+ * task into one identified execution cell (design doc §7.3).
16
+ */
17
+ export declare function resolveCell(input: CellResolutionInput): Promise<ResolvedCell>;
18
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/cell/resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAQD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6BnF"}
@@ -0,0 +1,41 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { sha256Digest } from '../util/hash.js';
3
+ import { computeCellDigest } from './digest.js';
4
+ /** Resolves a task file into its content plus a content digest. */
5
+ async function resolveTask(taskPath) {
6
+ const content = await readFile(taskPath, 'utf8');
7
+ return { source: taskPath, content, digest: sha256Digest(content) };
8
+ }
9
+ /**
10
+ * Cell Resolver: combines runtime + model + resolved profile + resolved
11
+ * task into one identified execution cell (design doc §7.3).
12
+ */
13
+ export async function resolveCell(input) {
14
+ const resolvedTask = await resolveTask(input.taskPath);
15
+ const resolvedProfile = {
16
+ name: input.profile.name,
17
+ content: input.profile.content,
18
+ digest: input.profile.digest,
19
+ };
20
+ const executionOptions = input.executionOptions ?? {};
21
+ const cellDigest = computeCellDigest({
22
+ runtimeId: input.runtimeId,
23
+ requestedModel: input.requestedModel,
24
+ resolvedProfile,
25
+ resolvedTask,
26
+ yuureiVersion: input.yuureiVersion,
27
+ executionOptions,
28
+ isolationStrategy: input.isolationStrategy,
29
+ });
30
+ return {
31
+ runtimeId: input.runtimeId,
32
+ requestedModel: input.requestedModel,
33
+ resolvedProfile,
34
+ resolvedTask,
35
+ yuureiVersion: input.yuureiVersion,
36
+ executionOptions,
37
+ isolationStrategy: input.isolationStrategy,
38
+ cellDigest,
39
+ };
40
+ }
41
+ //# sourceMappingUR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;QACZ,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,gBAAgB;QAChB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { ProfileContent } from '../profile/types.js';
2
+ import type { IsolationStrategy } from '../isolation/types.js';
3
+ /**
4
+ * A resolved profile bundled with its content digest. `content` is the
5
+ * fully-loaded profile data (not just a name reference), because cell
6
+ * identity must be computed over resolved content — see cell_digest below.
7
+ */
8
+ export interface ResolvedProfileRef {
9
+ name: string;
10
+ content: ProfileContent;
11
+ digest: string;
12
+ }
13
+ export interface ResolvedTaskRef {
14
+ source: string;
15
+ content: string;
16
+ digest: string;
17
+ }
18
+ /**
19
+ * The fully-resolved combination of runtime, model, harness profile, and
20
+ * task that identifies one execution cell (design doc §7: runtime × model
21
+ * × native harness × task).
22
+ */
23
+ export interface ResolvedCell {
24
+ runtimeId: string;
25
+ requestedModel: string;
26
+ resolvedProfile: ResolvedProfileRef;
27
+ resolvedTask: ResolvedTaskRef;
28
+ yuureiVersion: string;
29
+ executionOptions: Record<string, unknown>;
30
+ /**
31
+ * Isolation strategy the cell runs under (design doc §7.3, §9.3). Part of
32
+ * cell identity: level0 and level1 runs have materially different
33
+ * HOME/config semantics and must never share a cellDigest.
34
+ */
35
+ isolationStrategy: IsolationStrategy;
36
+ /** sha256 digest over the canonicalized combination of the fields above. */
37
+ cellDigest: string;
38
+ }
39
+ export interface CellIdentityInput {
40
+ runtimeId: string;
41
+ requestedModel: string;
42
+ resolvedProfile: ResolvedProfileRef;
43
+ resolvedTask: ResolvedTaskRef;
44
+ yuureiVersion: string;
45
+ executionOptions: Record<string, unknown>;
46
+ isolationStrategy: IsolationStrategy;
47
+ }
48
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cell/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,kBAAkB,CAAC;IACpC,YAAY,EAAE,eAAe,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C;;;;OAIG;IACH,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,kBAAkB,CAAC;IACpC,YAAY,EAAE,eAAe,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,iBAAiB,EAAE,iBAAiB,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cell/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { type RemoveOrphanTempDirsResult } from '../isolation/tempdir.js';
2
+ import type { Logger } from '../util/logger.js';
3
+ export interface CleanOptions {
4
+ /** Scan root for orphaned temp dirs. Defaults to `os.tmpdir()`. Injectable for tests. */
5
+ tempDir?: string;
6
+ }
7
+ /**
8
+ * `yuurei clean` — removes `yuurei-*` temp directories left behind by
9
+ * abnormal termination (SIGKILL, power loss, hard crash) that are old
10
+ * enough to be safe to delete. This is the recovery half of the design
11
+ * doc §15 safety regression; `yuurei doctor` reports the orphans, this
12
+ * command deletes them. Deletion is best-effort: failures are reported
13
+ * via the logger and the result, never abort the sweep.
14
+ */
15
+ export declare function runClean(logger: Logger, options?: CleanOptions): Promise<RemoveOrphanTempDirsResult>;
16
+ //# sourceMappingURL=clean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/cli/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,0BAA0B,CAAC,CAkBrC"}
@@ -0,0 +1,24 @@
1
+ import { removeOrphanTempDirs } from '../isolation/tempdir.js';
2
+ /**
3
+ * `yuurei clean` — removes `yuurei-*` temp directories left behind by
4
+ * abnormal termination (SIGKILL, power loss, hard crash) that are old
5
+ * enough to be safe to delete. This is the recovery half of the design
6
+ * doc §15 safety regression; `yuurei doctor` reports the orphans, this
7
+ * command deletes them. Deletion is best-effort: failures are reported
8
+ * via the logger and the result, never abort the sweep.
9
+ */
10
+ export async function runClean(logger, options) {
11
+ const result = await removeOrphanTempDirs(options?.tempDir === undefined ? undefined : { root: options.tempDir });
12
+ if (result.removed.length === 0) {
13
+ logger.info('no orphaned isolation temp directories found');
14
+ }
15
+ else {
16
+ const noun = result.removed.length === 1 ? 'directory' : 'directories';
17
+ logger.info(`removed ${result.removed.length} orphaned isolation temp ${noun}`);
18
+ }
19
+ for (const failed of result.failed) {
20
+ logger.warn(`failed to remove orphaned isolation temp directory: ${failed.path} (${failed.error})`);
21
+ }
22
+ return result;
23
+ }
24
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/cli/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmC,MAAM,yBAAyB,CAAC;AAQhG;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAAc,EACd,OAAsB;IAEtB,MAAM,MAAM,GAAG,MAAM,oBAAoB,CACvC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CACvE,CAAC;IAEF,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;QACvE,MAAM,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,OAAO,CAAC,MAAM,4BAA4B,IAAI,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CACT,uDAAuD,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,KAAK,GAAG,CACvF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type OrphanTempDir } from '../isolation/tempdir.js';
2
+ import type { Logger, LogFormat } from '../util/logger.js';
3
+ interface DoctorRuntimeCheck {
4
+ runtimeId: string;
5
+ installed: boolean;
6
+ version: string | null;
7
+ versionSupported: boolean | null;
8
+ authUsable: boolean | null;
9
+ authGuidance?: string;
10
+ }
11
+ export interface DoctorReport {
12
+ runtimes: DoctorRuntimeCheck[];
13
+ canWriteOutputDir: boolean;
14
+ /** `yuurei-*` temp dirs left behind by abnormal termination (design doc §15). */
15
+ orphanTempDirs: OrphanTempDir[];
16
+ }
17
+ export interface DoctorOptions {
18
+ /** Scan root for orphaned temp dirs. Defaults to `os.tmpdir()`. Injectable for tests. */
19
+ tempDir?: string;
20
+ }
21
+ /**
22
+ * `yuurei doctor` — inspection only, never mutates the environment
23
+ * (design doc §8.1). Authentication is reported only when an installed
24
+ * runtime has credentials available through its supported default path.
25
+ */
26
+ export declare function runDoctor(options?: DoctorOptions): Promise<DoctorReport>;
27
+ export declare function printDoctorReport(report: DoctorReport, logger: Logger, format: LogFormat): void;
28
+ export {};
29
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE3D,UAAU,kBAAkB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iFAAiF;IACjF,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAqB9E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAM/F"}