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
@@ -0,0 +1,160 @@
1
+ import { access, constants, mkdtemp, rm } from 'node:fs/promises';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { listRuntimeIds, getRuntime } from '../runtime/registry.js';
5
+ import { findOrphanTempDirs } from '../isolation/tempdir.js';
6
+ /**
7
+ * `yuurei doctor` — inspection only, never mutates the environment
8
+ * (design doc §8.1). Authentication is reported only when an installed
9
+ * runtime has credentials available through its supported default path.
10
+ */
11
+ export async function runDoctor(options) {
12
+ const runtimes = [];
13
+ for (const runtimeId of listRuntimeIds()) {
14
+ const detection = await getRuntime(runtimeId).detect();
15
+ runtimes.push({
16
+ runtimeId,
17
+ installed: detection.installed,
18
+ version: detection.version,
19
+ versionSupported: detection.versionSupported,
20
+ authUsable: detection.authUsable,
21
+ ...(detection.authGuidance !== undefined ? { authGuidance: detection.authGuidance } : {}),
22
+ });
23
+ }
24
+ return {
25
+ runtimes,
26
+ canWriteOutputDir: await canWriteToTempDir(),
27
+ orphanTempDirs: await findOrphanTempDirs(options?.tempDir === undefined ? undefined : { root: options.tempDir }),
28
+ };
29
+ }
30
+ export function printDoctorReport(report, logger, format) {
31
+ if (format === 'json') {
32
+ printDoctorReportJson(report, logger);
33
+ return;
34
+ }
35
+ printDoctorReportHuman(report, logger);
36
+ }
37
+ /**
38
+ * Machine-readable path: one JSON object per line, `level` + `message` plus
39
+ * the runtime/guidance/orphan data as top-level keys. This is the schema
40
+ * scripts rely on and must not change (issue #103).
41
+ */
42
+ function printDoctorReportJson(report, logger) {
43
+ for (const runtime of report.runtimes) {
44
+ logger.info(`${runtime.runtimeId}: ${runtime.installed ? 'installed' : 'not found'}`, {
45
+ version: runtime.version,
46
+ versionSupported: runtime.versionSupported,
47
+ authUsable: runtime.authUsable,
48
+ });
49
+ if (runtime.installed && runtime.authUsable === false && runtime.authGuidance !== undefined) {
50
+ logger.warn(`${runtime.runtimeId}: authentication required — next steps`, {
51
+ authGuidance: runtime.authGuidance,
52
+ });
53
+ }
54
+ }
55
+ logger.info(`output directory writable: ${report.canWriteOutputDir}`);
56
+ if (report.orphanTempDirs.length === 0) {
57
+ logger.info('no orphaned isolation temp directories found');
58
+ }
59
+ else {
60
+ logger.warn(`found ${report.orphanTempDirs.length} orphaned isolation temp director${report.orphanTempDirs.length === 1 ? 'y' : 'ies'}; run "yuurei clean" to remove them`, { paths: report.orphanTempDirs.map((orphan) => orphan.path) });
61
+ }
62
+ }
63
+ /**
64
+ * Human-readable path: one compact status block per runtime, warnings marked
65
+ * with a `WARNING:` prefix so they stand out from successful checks, orphan
66
+ * paths listed one per line after the count and cleanup command. Never prints
67
+ * credential values — only the runtime-provided guidance text.
68
+ */
69
+ function printDoctorReportHuman(report, logger) {
70
+ for (const runtime of report.runtimes) {
71
+ printRuntimeBlock(runtime, logger);
72
+ logger.info('');
73
+ }
74
+ if (report.canWriteOutputDir) {
75
+ logger.info('output directory');
76
+ logger.info(`${HUMAN_INDENT}writable: yes`);
77
+ }
78
+ else {
79
+ logger.warn('WARNING: output directory is not writable');
80
+ }
81
+ if (report.orphanTempDirs.length === 0) {
82
+ logger.info('no orphaned isolation temp directories found');
83
+ }
84
+ else {
85
+ const noun = report.orphanTempDirs.length === 1 ? 'directory' : 'directories';
86
+ logger.warn(`WARNING: found ${report.orphanTempDirs.length} orphaned isolation temp ${noun}`);
87
+ logger.warn(`${HUMAN_INDENT}Run "yuurei clean" to remove them.`);
88
+ for (const orphan of report.orphanTempDirs) {
89
+ logger.warn(`${HUMAN_INDENT}${orphan.path}`);
90
+ }
91
+ }
92
+ }
93
+ function printRuntimeBlock(runtime, logger) {
94
+ logger.info(runtime.runtimeId);
95
+ if (!runtime.installed) {
96
+ logger.info(`${HUMAN_INDENT}status: not found`);
97
+ return;
98
+ }
99
+ logger.info(`${HUMAN_INDENT}status: installed`);
100
+ if (runtime.version !== null) {
101
+ logger.info(`${HUMAN_INDENT}version: ${runtime.version}`);
102
+ }
103
+ if (runtime.versionSupported !== null) {
104
+ if (runtime.versionSupported) {
105
+ logger.info(`${HUMAN_INDENT}supported: yes`);
106
+ }
107
+ else {
108
+ logger.warn(`${HUMAN_INDENT}WARNING: supported: no — upgrade this runtime to a supported version`);
109
+ }
110
+ }
111
+ if (runtime.authUsable === true) {
112
+ logger.info(`${HUMAN_INDENT}authentication: ready`);
113
+ }
114
+ else if (runtime.authUsable === false) {
115
+ logger.warn(`${HUMAN_INDENT}WARNING: authentication: required`);
116
+ if (runtime.authGuidance !== undefined) {
117
+ for (const line of wrapText(runtime.authGuidance, HUMAN_LINE_WIDTH - HUMAN_SUB_INDENT.length)) {
118
+ logger.warn(`${HUMAN_SUB_INDENT}${line}`);
119
+ }
120
+ }
121
+ }
122
+ else {
123
+ logger.info(`${HUMAN_INDENT}authentication: not checked`);
124
+ }
125
+ }
126
+ const HUMAN_LINE_WIDTH = 80;
127
+ const HUMAN_INDENT = ' ';
128
+ const HUMAN_SUB_INDENT = ' ';
129
+ /** Wraps a paragraph at word boundaries to `maxWidth` columns. */
130
+ function wrapText(text, maxWidth) {
131
+ const lines = [];
132
+ let current = '';
133
+ for (const word of text.split(/\s+/)) {
134
+ if (current.length === 0) {
135
+ current = word;
136
+ }
137
+ else if (current.length + 1 + word.length <= maxWidth) {
138
+ current += ` ${word}`;
139
+ }
140
+ else {
141
+ lines.push(current);
142
+ current = word;
143
+ }
144
+ }
145
+ if (current.length > 0)
146
+ lines.push(current);
147
+ return lines;
148
+ }
149
+ async function canWriteToTempDir() {
150
+ try {
151
+ const dir = await mkdtemp(join(tmpdir(), 'yuurei-doctor-'));
152
+ await access(dir, constants.W_OK);
153
+ await rm(dir, { recursive: true, force: true });
154
+ return true;
155
+ }
156
+ catch {
157
+ return false;
158
+ }
159
+ }
160
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAsB,MAAM,yBAAyB,CAAC;AAwBjF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAuB;IACrD,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,KAAK,MAAM,SAAS,IAAI,cAAc,EAAE,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;QACvD,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS;YACT,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,GAAG,CAAC,SAAS,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1F,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,QAAQ;QACR,iBAAiB,EAAE,MAAM,iBAAiB,EAAE;QAC5C,cAAc,EAAE,MAA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I,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAC5D,MAAM,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Exit codes from design doc §8.1. */
2
+ export declare const EXIT_CODES: {
3
+ readonly SUCCESS: 0;
4
+ readonly CONFIG_ERROR: 2;
5
+ readonly RUNTIME_UNSUPPORTED: 3;
6
+ readonly ISOLATION_VERIFICATION_FAILED: 4;
7
+ readonly RUNTIME_EXECUTION_FAILED: 5;
8
+ readonly TRACE_OR_ARTIFACT_SAVE_FAILED: 6;
9
+ };
10
+ export type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];
11
+ export declare class YuureiError extends Error {
12
+ readonly exitCode: ExitCode;
13
+ constructor(message: string, exitCode: ExitCode);
14
+ }
15
+ //# sourceMappingURL=exit-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../../src/cli/exit-codes.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE,qBAAa,WAAY,SAAQ,KAAK;aAGlB,QAAQ,EAAE,QAAQ;gBADlC,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,QAAQ;CAKrC"}
@@ -0,0 +1,18 @@
1
+ /** Exit codes from design doc §8.1. */
2
+ export const EXIT_CODES = {
3
+ SUCCESS: 0,
4
+ CONFIG_ERROR: 2,
5
+ RUNTIME_UNSUPPORTED: 3,
6
+ ISOLATION_VERIFICATION_FAILED: 4,
7
+ RUNTIME_EXECUTION_FAILED: 5,
8
+ TRACE_OR_ARTIFACT_SAVE_FAILED: 6,
9
+ };
10
+ export class YuureiError extends Error {
11
+ exitCode;
12
+ constructor(message, exitCode) {
13
+ super(message);
14
+ this.exitCode = exitCode;
15
+ this.name = 'YuureiError';
16
+ }
17
+ }
18
+ //# sourceMappingURL=exit-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../../src/cli/exit-codes.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;IACf,mBAAmB,EAAE,CAAC;IACtB,6BAA6B,EAAE,CAAC;IAChC,wBAAwB,EAAE,CAAC;IAC3B,6BAA6B,EAAE,CAAC;CACxB,CAAC;AAIX,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGlB;IAFlB,YACE,OAAe,EACC,QAAkB;QAElC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,aAAQ,GAAR,QAAQ,CAAU;QAGlC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ import type { Logger } from '../util/logger.js';
2
+ export interface InitOptions {
3
+ /** Directory to scaffold, relative to `cwd`. Use `''` for the current directory. */
4
+ directory: string;
5
+ runtime: string;
6
+ profile: string;
7
+ task: string;
8
+ /** Named run referencing the generated profile and task. Defaults to `task`. */
9
+ run?: string;
10
+ /** Emit the structured `InitReport` as the JSON output instead of the human report. */
11
+ json?: boolean;
12
+ }
13
+ /** Structured report for `yuurei init`, emitted on stdout when `--json` is set. */
14
+ export interface InitReport {
15
+ targetDir: string;
16
+ /** False when the target was already a matching scaffold, so nothing was written. */
17
+ created: boolean;
18
+ /** Paths written (or verified to already match), relative to `targetDir`. */
19
+ scaffoldPaths: string[];
20
+ profile: string;
21
+ task: string;
22
+ run: string;
23
+ }
24
+ /**
25
+ * `yuurei init` — scaffolds a minimal runnable project (issue #105). Never
26
+ * overwrites an existing file: a preflight compares every planned file
27
+ * against what is on disk and aborts before writing when any differ. Writes
28
+ * stage into a sibling temp directory and rename into place, so an
29
+ * unexpected failure cannot leave a partial scaffold (§2.3 fail-safe).
30
+ */
31
+ export declare function runInit(cwd: string, options: InitOptions, logger: Logger): Promise<void>;
32
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,OAAO,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAyGD;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0D9F"}
@@ -0,0 +1,143 @@
1
+ import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from 'node:fs/promises';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ import { listRuntimeIds } from '../runtime/registry.js';
4
+ import { isPathWithin, pathExists } from '../util/fs.js';
5
+ import { EXIT_CODES, YuureiError } from './exit-codes.js';
6
+ const NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
7
+ function validateName(value, what) {
8
+ if (!NAME_PATTERN.test(value)) {
9
+ throw new YuureiError(`invalid ${what} "${value}": use letters, digits, ".", "_" and "-", starting with a letter or digit`, EXIT_CODES.CONFIG_ERROR);
10
+ }
11
+ }
12
+ const DEFAULT_TASK_PROMPT = 'Reply with "Hello from yuurei." Do not read or write any files or run commands.';
13
+ function scaffoldFiles(options) {
14
+ const { runtime, profile, task } = options;
15
+ const run = options.run ?? task;
16
+ return [
17
+ {
18
+ relPath: '.yuurei/yuurei.yaml',
19
+ content: [
20
+ 'version: 1',
21
+ '',
22
+ 'profiles:',
23
+ ` ${profile}:`,
24
+ ` runtime: ${runtime}`,
25
+ ` source: ./profiles/${profile}`,
26
+ '',
27
+ 'runs:',
28
+ ` ${run}:`,
29
+ ` profile: ${profile}`,
30
+ ` task: ./tasks/${task}.md`,
31
+ '',
32
+ ].join('\n'),
33
+ },
34
+ {
35
+ relPath: `.yuurei/profiles/${profile}/profile.yaml`,
36
+ content: [
37
+ `runtime: ${runtime}`,
38
+ `description: ${profile} profile scaffolded by yuurei init.`,
39
+ '',
40
+ ].join('\n'),
41
+ },
42
+ {
43
+ relPath: `.yuurei/profiles/${profile}/config/.gitkeep`,
44
+ content: '',
45
+ },
46
+ {
47
+ relPath: `.yuurei/tasks/${task}.md`,
48
+ content: `${DEFAULT_TASK_PROMPT}\n`,
49
+ },
50
+ ];
51
+ }
52
+ function displayPaths(options) {
53
+ const { profile, task } = options;
54
+ return [
55
+ '.yuurei/yuurei.yaml',
56
+ `.yuurei/profiles/${profile}/profile.yaml`,
57
+ `.yuurei/profiles/${profile}/config/.gitkeep`,
58
+ `.yuurei/tasks/${task}.md`,
59
+ ];
60
+ }
61
+ function buildInitReport(targetDir, options, created) {
62
+ return {
63
+ targetDir,
64
+ created,
65
+ scaffoldPaths: displayPaths(options),
66
+ profile: options.profile,
67
+ task: options.task,
68
+ run: options.run ?? options.task,
69
+ };
70
+ }
71
+ function printInitReport(report, options, logger) {
72
+ if (options.json) {
73
+ logger.info('init', { ...report });
74
+ return;
75
+ }
76
+ logger.info(report.created
77
+ ? `scaffolded project at ${report.targetDir}`
78
+ : `project already scaffolded at ${report.targetDir}`);
79
+ for (const pathName of report.scaffoldPaths) {
80
+ logger.info(pathName);
81
+ }
82
+ logger.info(`run "${report.run}" resolves to profile "${report.profile}" and task "${report.task}"`);
83
+ logger.info('next commands:');
84
+ logger.info(' yuurei profile list');
85
+ logger.info(` yuurei inspect ${report.profile}`);
86
+ logger.info(` yuurei run ${report.run}`);
87
+ }
88
+ /**
89
+ * `yuurei init` — scaffolds a minimal runnable project (issue #105). Never
90
+ * overwrites an existing file: a preflight compares every planned file
91
+ * against what is on disk and aborts before writing when any differ. Writes
92
+ * stage into a sibling temp directory and rename into place, so an
93
+ * unexpected failure cannot leave a partial scaffold (§2.3 fail-safe).
94
+ */
95
+ export async function runInit(cwd, options, logger) {
96
+ // resolve() not join(): the operand may be absolute, and join() would then
97
+ // nest it under cwd (join('/work', '/tmp/proj') === '/work/tmp/proj').
98
+ const targetDir = resolve(cwd, options.directory);
99
+ const runtimeIds = listRuntimeIds();
100
+ if (!runtimeIds.includes(options.runtime)) {
101
+ throw new YuureiError(`unknown runtime "${options.runtime}": must be one of ${runtimeIds.join(', ')}`, EXIT_CODES.RUNTIME_UNSUPPORTED);
102
+ }
103
+ validateName(options.profile, 'profile name');
104
+ validateName(options.task, 'task name');
105
+ if (options.run !== undefined)
106
+ validateName(options.run, 'run name');
107
+ const planned = scaffoldFiles(options);
108
+ const yuureiDir = join(targetDir, '.yuurei');
109
+ for (const file of planned) {
110
+ const absPath = join(targetDir, file.relPath);
111
+ if (!(await isPathWithin(targetDir, absPath))) {
112
+ throw new YuureiError(`refusing to scaffold ${file.relPath}: escapes target directory ${targetDir}`, EXIT_CODES.CONFIG_ERROR);
113
+ }
114
+ }
115
+ await mkdir(targetDir, { recursive: true });
116
+ if (await pathExists(yuureiDir)) {
117
+ const conflicts = [];
118
+ for (const file of planned) {
119
+ const existing = await readFile(join(targetDir, file.relPath), 'utf8').catch(() => null);
120
+ if (existing !== file.content)
121
+ conflicts.push(file.relPath);
122
+ }
123
+ if (conflicts.length > 0) {
124
+ throw new YuureiError(`refusing to overwrite existing files: ${conflicts.join(', ')}`, EXIT_CODES.CONFIG_ERROR);
125
+ }
126
+ printInitReport(buildInitReport(targetDir, options, false), options, logger);
127
+ return;
128
+ }
129
+ const stagingDir = await mkdtemp(join(targetDir, '.yuurei-init-'));
130
+ try {
131
+ for (const file of planned) {
132
+ const realPath = join(stagingDir, file.relPath);
133
+ await mkdir(dirname(realPath), { recursive: true });
134
+ await writeFile(realPath, file.content, 'utf8');
135
+ }
136
+ await rename(join(stagingDir, '.yuurei'), yuureiDir);
137
+ }
138
+ finally {
139
+ await rm(stagingDir, { recursive: true, force: true });
140
+ }
141
+ printInitReport(buildInitReport(targetDir, options, true), options, logger);
142
+ }
143
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAiC1D,MAAM,YAAY,GAAG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AC;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,eAAe,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Logger } from '../util/logger.js';
2
+ /** `yuurei inspect <profile-name>` — resolves a profile's config but never runs anything. */
3
+ export declare function runInspect(cwd: string, profileName: string, logger: Logger): Promise<void>;
4
+ //# sourceMappingURL=inspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/cli/inspect.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,6FAA6F;AAC7F,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhG"}
@@ -0,0 +1,24 @@
1
+ import { join } from 'node:path';
2
+ import { findYuureiDir } from '../config/discovery.js';
3
+ import { loadYuureiConfig } from '../config/yuurei-config.js';
4
+ import { loadProfile } from '../profile/loader.js';
5
+ import { YuureiError, EXIT_CODES } from './exit-codes.js';
6
+ /** `yuurei inspect <profile-name>` — resolves a profile's config but never runs anything. */
7
+ export async function runInspect(cwd, profileName, logger) {
8
+ const yuureiDir = await findYuureiDir(cwd);
9
+ if (!yuureiDir) {
10
+ throw new YuureiError('no .yuurei/ directory found', EXIT_CODES.CONFIG_ERROR);
11
+ }
12
+ const config = await loadYuureiConfig(yuureiDir);
13
+ const profileEntry = config.profiles[profileName];
14
+ if (!profileEntry) {
15
+ throw new YuureiError(`unknown profile: ${profileName}`, EXIT_CODES.CONFIG_ERROR);
16
+ }
17
+ const resolved = await loadProfile({
18
+ name: profileName,
19
+ runtime: profileEntry.runtime,
20
+ sourceDir: join(yuureiDir, profileEntry.source),
21
+ });
22
+ logger.info(profileName, { runtime: resolved.runtime, digest: resolved.digest });
23
+ }
24
+ //# sourceMappingURL=inspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/cli/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG1D,6FAA6F;AAC7F,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,WAAmB,EAAE,MAAc;IAC/E,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CAAC,6BAA6B,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAClD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,WAAW,CAAC,oBAAoB,WAAW,EAAE,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC;QACjC,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC;KAChD,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type Logger } from '../util/logger.js';
2
+ export declare function loggerForFlags(flags: {
3
+ json?: boolean;
4
+ }): Logger;
5
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE9D,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAEhE"}
@@ -0,0 +1,5 @@
1
+ import { createLogger } from '../util/logger.js';
2
+ export function loggerForFlags(flags) {
3
+ return createLogger(flags.json ? 'json' : 'human');
4
+ }
5
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAE9D,MAAM,UAAU,cAAc,CAAC,KAAyB;IACtD,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Logger } from '../util/logger.js';
2
+ export declare function runProfileList(cwd: string, logger: Logger): Promise<void>;
3
+ //# sourceMappingURL=profile-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-list.d.ts","sourceRoot":"","sources":["../../src/cli/profile-list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E"}
@@ -0,0 +1,14 @@
1
+ import { findYuureiDir } from '../config/discovery.js';
2
+ import { loadYuureiConfig } from '../config/yuurei-config.js';
3
+ import { YuureiError, EXIT_CODES } from './exit-codes.js';
4
+ export async function runProfileList(cwd, logger) {
5
+ const yuureiDir = await findYuureiDir(cwd);
6
+ if (!yuureiDir) {
7
+ throw new YuureiError('no .yuurei/ directory found', EXIT_CODES.CONFIG_ERROR);
8
+ }
9
+ const config = await loadYuureiConfig(yuureiDir);
10
+ for (const [name, profile] of Object.entries(config.profiles)) {
11
+ logger.info(name, { runtime: profile.runtime, source: profile.source });
12
+ }
13
+ }
14
+ //# sourceMappingURL=profile-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-list.js","sourceRoot":"","sources":["../../src/cli/profile-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG1D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW,EAAE,MAAc;IAC9D,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CAAC,6BAA6B,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { Logger } from '../util/logger.js';
2
+ export interface RunOptions {
3
+ runName: string | undefined;
4
+ profile: string | undefined;
5
+ task: string | undefined;
6
+ keep: boolean | undefined;
7
+ model: string | undefined;
8
+ /** Milliseconds before the runtime process is sent SIGTERM. undefined = no timeout. */
9
+ timeoutMs: number | undefined;
10
+ /** Isolation strategy (design doc §9.3): 'level0' or 'level1'. Defaults to 'level1'. */
11
+ isolation: string | undefined;
12
+ /**
13
+ * Opt-in, experimental: bridge the real ~/.codex/auth.json into the
14
+ * isolated CODEX_HOME (ignored for other runtimes). Off by default because
15
+ * that file can carry a rotating OAuth token pair — see the Codex
16
+ * adapter's bridgeCodexAuthFile doc comment. The supported v0.3 auth path
17
+ * is an explicitly-set OPENAI_API_KEY, forwarded unconditionally.
18
+ */
19
+ bridgeCodexAuthFile: boolean | undefined;
20
+ }
21
+ export declare function runRun(cwd: string, options: RunOptions, logger: Logger): Promise<void>;
22
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAUhD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,uFAAuF;IACvF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,wFAAwF;IACxF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC1C;AAID,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4G5F"}
@@ -0,0 +1,95 @@
1
+ import { join } from 'node:path';
2
+ import { findYuureiDir } from '../config/discovery.js';
3
+ import { loadYuureiConfig } from '../config/yuurei-config.js';
4
+ import { loadProfile } from '../profile/loader.js';
5
+ import { runPipeline } from '../run/pipeline.js';
6
+ import { MAX_TIMEOUT_MS } from '../runtime/exec.js';
7
+ import { getRuntime } from '../runtime/registry.js';
8
+ import { isPathWithin } from '../util/fs.js';
9
+ import { YuureiError, EXIT_CODES } from './exit-codes.js';
10
+ import { exitCodeForSignal } from '../run/signals.js';
11
+ import { packageVersion } from '../version.js';
12
+ const ISOLATION_STRATEGIES = ['level0', 'level1'];
13
+ const DEFAULT_ISOLATION_STRATEGY = 'level1';
14
+ function isIsolationStrategy(value) {
15
+ return ISOLATION_STRATEGIES.includes(value);
16
+ }
17
+ const YUUREI_VERSION = packageVersion;
18
+ export async function runRun(cwd, options, logger) {
19
+ const yuureiDir = await findYuureiDir(cwd);
20
+ if (!yuureiDir) {
21
+ throw new YuureiError('no .yuurei/ directory found', EXIT_CODES.CONFIG_ERROR);
22
+ }
23
+ const config = await loadYuureiConfig(yuureiDir);
24
+ let profileName = options.profile;
25
+ let taskPath = options.task;
26
+ if (options.runName) {
27
+ const runEntry = config.runs[options.runName];
28
+ if (!runEntry) {
29
+ throw new YuureiError(`unknown run: ${options.runName}`, EXIT_CODES.CONFIG_ERROR);
30
+ }
31
+ profileName = runEntry.profile;
32
+ taskPath = join(yuureiDir, runEntry.task);
33
+ if (!(await isPathWithin(yuureiDir, taskPath))) {
34
+ throw new YuureiError(`task path escapes the .yuurei directory: ${runEntry.task}`, EXIT_CODES.CONFIG_ERROR);
35
+ }
36
+ }
37
+ if (!profileName || !taskPath) {
38
+ throw new YuureiError('either a run name or both --profile and --task are required', EXIT_CODES.CONFIG_ERROR);
39
+ }
40
+ if (options.timeoutMs !== undefined &&
41
+ !(Number.isFinite(options.timeoutMs) &&
42
+ options.timeoutMs > 0 &&
43
+ options.timeoutMs <= MAX_TIMEOUT_MS)) {
44
+ throw new YuureiError(`--timeout must be a finite number of milliseconds between 1 and ${MAX_TIMEOUT_MS}`, EXIT_CODES.CONFIG_ERROR);
45
+ }
46
+ if (options.isolation !== undefined && !isIsolationStrategy(options.isolation)) {
47
+ throw new YuureiError(`--isolation must be one of: ${ISOLATION_STRATEGIES.join(', ')}`, EXIT_CODES.CONFIG_ERROR);
48
+ }
49
+ const isolationStrategy = options.isolation ?? DEFAULT_ISOLATION_STRATEGY;
50
+ const profileEntry = config.profiles[profileName];
51
+ if (!profileEntry) {
52
+ throw new YuureiError(`unknown profile: ${profileName}`, EXIT_CODES.CONFIG_ERROR);
53
+ }
54
+ const profile = await loadProfile({
55
+ name: profileName,
56
+ runtime: profileEntry.runtime,
57
+ sourceDir: join(yuureiDir, profileEntry.source),
58
+ });
59
+ const result = await runPipeline({
60
+ runtimeId: profile.runtime,
61
+ requestedModel: options.model ?? '',
62
+ profile,
63
+ taskPath,
64
+ yuureiVersion: YUUREI_VERSION,
65
+ yuureiDir,
66
+ isolationStrategy,
67
+ keep: options.keep ?? false,
68
+ timeoutMs: options.timeoutMs ?? null,
69
+ executionOptions: { bridgeCodexAuthFile: options.bridgeCodexAuthFile ?? false },
70
+ onWarning: (message) => logger.warn(message),
71
+ });
72
+ logger.info(`run ${result.runId} finished`, {
73
+ exitCode: result.trace.execution.exit_code,
74
+ signal: result.trace.execution.signal,
75
+ runDir: result.runDir,
76
+ });
77
+ if (result.trace.execution.signal !== null) {
78
+ process.exitCode = exitCodeForSignal(result.trace.execution.signal);
79
+ }
80
+ // Surface auth guidance on failure without exposing runtime stdout/stderr
81
+ // (§10.2). Only for a numeric non-zero exit code — a signal-terminated run
82
+ // (exit_code null) is covered by the signal exit-code propagation above.
83
+ if (typeof result.trace.execution.exit_code === 'number' &&
84
+ result.trace.execution.exit_code !== 0) {
85
+ const detection = await getRuntime(profile.runtime).detect();
86
+ if (detection.installed &&
87
+ detection.authUsable === false &&
88
+ detection.authGuidance !== undefined) {
89
+ logger.warn(`${profile.runtime}: authentication required — next steps`, {
90
+ authGuidance: detection.authGuidance,
91
+ });
92
+ }
93
+ }
94
+ }
95
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,oBAAoB,GAAiC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAChF,MAAM,0BAA0B,GAAsB,QAAQ,CAAC;AAE/D,SAAS,mBAAmB,CAAC,KAAa;IACxC,OA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CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Logger } from '../util/logger.js';
2
+ export declare function runTraceShow(cwd: string, runId: string, logger: Logger): Promise<void>;
3
+ //# sourceMappingURL=trace-show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-show.d.ts","sourceRoot":"","sources":["../../src/cli/trace-show.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5F"}