cuelo 0.10.331 → 0.10.333

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 (160) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +56 -56
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.js +1 -1
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/.next/server/app/api/agent/[id]/account/route.js +1 -1
  26. package/.next/server/app/api/agent/[id]/account/route.js.nft.json +1 -1
  27. package/.next/server/app/api/agent/[id]/computer-takeover/route.js +1 -1
  28. package/.next/server/app/api/agent/[id]/computer-takeover/route.js.nft.json +1 -1
  29. package/.next/server/app/api/agent/[id]/events/route.js +1 -1
  30. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
  31. package/.next/server/app/api/agent/[id]/route.js +1 -1
  32. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
  33. package/.next/server/app/api/agent/new/route.js +1 -1
  34. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  35. package/.next/server/app/api/agent/running/route.js +1 -1
  36. package/.next/server/app/api/agent/running/route.js.nft.json +1 -1
  37. package/.next/server/app/api/gpt6/handles/route.js +1 -1
  38. package/.next/server/app/api/gpt6/handles/route.js.nft.json +1 -1
  39. package/.next/server/app/api/gpt6/reply/route.js +1 -1
  40. package/.next/server/app/api/gpt6/reply/route.js.nft.json +1 -1
  41. package/.next/server/app/api/gpt6/token/route.js +1 -1
  42. package/.next/server/app/api/gpt6/token/route.js.nft.json +1 -1
  43. package/.next/server/app/api/gpt6/web6-session/route.js +1 -1
  44. package/.next/server/app/api/gpt6/web6-session/route.js.nft.json +1 -1
  45. package/.next/server/app/api/live/call/[callId]/route.js +1 -1
  46. package/.next/server/app/api/live/call/[callId]/route.js.nft.json +1 -1
  47. package/.next/server/app/api/live/draft-secret/route.js +1 -1
  48. package/.next/server/app/api/live/draft-secret/route.js.nft.json +1 -1
  49. package/.next/server/app/api/live/events/route.js +1 -1
  50. package/.next/server/app/api/live/events/route.js.nft.json +1 -1
  51. package/.next/server/app/api/live/interpret/assist/route.js +1 -1
  52. package/.next/server/app/api/live/interpret/assist/route.js.nft.json +1 -1
  53. package/.next/server/app/api/live/interpret/reading/route.js +1 -1
  54. package/.next/server/app/api/live/interpret/reading/route.js.nft.json +1 -1
  55. package/.next/server/app/api/live/interpret/route.js +1 -1
  56. package/.next/server/app/api/live/interpret/route.js.nft.json +1 -1
  57. package/.next/server/app/api/live/interpret/scan/route.js +1 -1
  58. package/.next/server/app/api/live/interpret/scan/route.js.nft.json +1 -1
  59. package/.next/server/app/api/live/interpret/text/route.js +1 -1
  60. package/.next/server/app/api/live/interpret/text/route.js.nft.json +1 -1
  61. package/.next/server/app/api/live/offer/route.js +1 -1
  62. package/.next/server/app/api/live/offer/route.js.nft.json +1 -1
  63. package/.next/server/app/api/live/voices/route.js +1 -1
  64. package/.next/server/app/api/live/voices/route.js.nft.json +1 -1
  65. package/.next/server/app/api/project-trust/route.js +1 -1
  66. package/.next/server/app/api/project-trust/route.js.nft.json +1 -1
  67. package/.next/server/app/api/runs/[runId]/prelude/route.js +1 -1
  68. package/.next/server/app/api/runs/[runId]/prelude/route.js.nft.json +1 -1
  69. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
  70. package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
  71. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  72. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  73. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  74. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  75. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  76. package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
  77. package/.next/server/app/api/sessions/route.js +1 -1
  78. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  79. package/.next/server/app/api/skills/check/route.js +1 -1
  80. package/.next/server/app/api/skills/check/route.js.nft.json +1 -1
  81. package/.next/server/app/api/skills/install/route.js +1 -1
  82. package/.next/server/app/api/skills/install/route.js.nft.json +1 -1
  83. package/.next/server/app/api/skills/route.js +1 -1
  84. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  85. package/.next/server/app/api/skills/update/route.js +1 -1
  86. package/.next/server/app/api/skills/update/route.js.nft.json +1 -1
  87. package/.next/server/app/api/tool-image/route.js +1 -1
  88. package/.next/server/app/api/tool-image/route.js.nft.json +1 -1
  89. package/.next/server/app/api/update-maintenance/route.js +1 -1
  90. package/.next/server/app/api/update-maintenance/route.js.nft.json +1 -1
  91. package/.next/server/app/api/updates/apply/route.js +2 -2
  92. package/.next/server/app/api/updates/route.js +1 -1
  93. package/.next/server/app/api/upkeep/check/route.js +1 -1
  94. package/.next/server/app/api/upkeep/check/route.js.nft.json +1 -1
  95. package/.next/server/app/api/upkeep/morning/route.js +2 -3
  96. package/.next/server/app/api/upkeep/morning/route.js.nft.json +1 -1
  97. package/.next/server/app/api/upkeep/nightly/export/route.js +1 -1
  98. package/.next/server/app/api/upkeep/nightly/export/route.js.nft.json +1 -1
  99. package/.next/server/app/api/upkeep/nightly/result/route.js +1 -2
  100. package/.next/server/app/api/upkeep/nightly/result/route.js.nft.json +1 -1
  101. package/.next/server/app/api/upkeep/nightly/route.js +1 -2
  102. package/.next/server/app/api/upkeep/nightly/route.js.nft.json +1 -1
  103. package/.next/server/app/api/upkeep/route.js +1 -1
  104. package/.next/server/app/api/upkeep/route.js.nft.json +1 -1
  105. package/.next/server/app/api/worktrees/route.js +1 -1
  106. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  107. package/.next/server/app/index.html +1 -1
  108. package/.next/server/app/index.rsc +4 -4
  109. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  110. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  111. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  112. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  113. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  114. package/.next/server/app/page.js +2 -2
  115. package/.next/server/app/page_client-reference-manifest.js +1 -1
  116. package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
  117. package/.next/server/app/recover.html +1 -1
  118. package/.next/server/app/recover.rsc +2 -2
  119. package/.next/server/app/recover.segments/_full.segment.rsc +2 -2
  120. package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
  121. package/.next/server/app/recover.segments/_index.segment.rsc +2 -2
  122. package/.next/server/app/recover.segments/_tree.segment.rsc +1 -1
  123. package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +1 -1
  124. package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
  125. package/.next/server/app-paths-manifest.json +56 -56
  126. package/.next/server/chunks/2235.js +2 -0
  127. package/.next/server/chunks/3173.js +3 -0
  128. package/.next/server/chunks/3392.js +2 -0
  129. package/.next/server/chunks/4831.js +1 -1
  130. package/.next/server/chunks/5228.js +1 -1
  131. package/.next/server/chunks/8041.js +1 -6
  132. package/.next/server/chunks/{6119.js → 8094.js} +1 -1
  133. package/.next/server/chunks/8685.js +2 -2
  134. package/.next/server/chunks/9467.js +2 -3
  135. package/.next/server/middleware-build-manifest.js +1 -1
  136. package/.next/server/pages/404.html +1 -1
  137. package/.next/server/pages/500.html +1 -1
  138. package/.next/server/server-reference-manifest.json +1 -1
  139. package/.next/static/chunks/app/{layout-bc3824f2c0eebb33.js → layout-b2da0140cc733ca6.js} +1 -1
  140. package/.next/static/chunks/app/{page-9e999c92e12dc19c.js → page-2affef230bc901fc.js} +2 -2
  141. package/.next/trace +113 -113
  142. package/.next/trace-build +1 -1
  143. package/README.md +1 -1
  144. package/Tools/CUELO_Setup/files/native-runtime-patch.js +1 -1
  145. package/Tools/OMP_Global_Config/agent/extensions/lib/finalize-checks.ts +353 -0
  146. package/Tools/OMP_Global_Config/agent/extensions/lib/interpreter.ts +12 -6
  147. package/Tools/OMP_Global_Config/agent/extensions/todo-nudge.ts +48 -14
  148. package/Tools/OMP_Global_Config/agent/tools/ego-browser/index.ts +19 -4
  149. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/finalizer.ps1 +11 -1
  150. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/index.ts +89 -21
  151. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/integrate.ts +66 -11
  152. package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +97 -0
  153. package/bin/ci-local.mjs +291 -0
  154. package/install.mjs +124 -10
  155. package/package.json +3 -2
  156. package/.next/server/chunks/4259.js +0 -2
  157. package/.next/server/chunks/8139.js +0 -3
  158. package/Tools/OMP_Global_Config/agent/extensions/user-input-interpreter.ts +0 -130
  159. /package/.next/static/{qYIo9_tHAFFQaFxpOUmz_ → UerdzBExCL9nskNG-lvSd}/_buildManifest.js +0 -0
  160. /package/.next/static/{qYIo9_tHAFFQaFxpOUmz_ → UerdzBExCL9nskNG-lvSd}/_ssgManifest.js +0 -0
@@ -0,0 +1,291 @@
1
+ #!/usr/bin/env node
2
+ import { execFileSync, spawn } from "node:child_process";
3
+ import { setMaxListeners } from "node:events";
4
+ import { constants, closeSync, cpSync, globSync, mkdirSync, mkdtempSync, openSync, readFileSync, realpathSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
5
+ import { constants as osConstants, homedir, tmpdir } from "node:os";
6
+ import { basename, join, resolve } from "node:path";
7
+ import { pathToFileURL, fileURLToPath } from "node:url";
8
+
9
+ const root = fileURLToPath(new URL("../", import.meta.url));
10
+ const harness = join(root, "Tools/OMP_Global_Config");
11
+ const corePackage = "@oh-my-pi/pi-coding-agent";
12
+ const patchCommand = [process.execPath, "patches/apply-core-patch.mjs"];
13
+ const coreVersionPattern = "\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?";
14
+ const coreVersion = new RegExp(`^${coreVersionPattern}$`);
15
+ const suites = ["harness-extensions", "harness-core", "app"];
16
+ const usage = `Usage: node bin/ci-local.mjs <${suites.join(" | ")}> [...]`;
17
+
18
+ export function parseSuites(args) {
19
+ if (args.length === 1 && ["--help", "-h"].includes(args[0])) return [];
20
+ if (args.length === 0) throw new Error(usage);
21
+ const unknown = args.find((arg) => !suites.includes(arg));
22
+ if (unknown !== undefined) throw new Error(`Unknown suite: ${unknown}\n${usage}`);
23
+ return [...new Set(args)];
24
+ }
25
+
26
+ export function coreCacheKey(version, platform = process.platform, arch = process.arch) {
27
+ if (!coreVersion.test(version)) {
28
+ throw new Error(`Expected an exact ${corePackage} version, got ${version}`);
29
+ }
30
+ return `${platform}-${arch}-${version}`;
31
+ }
32
+
33
+ function runChild(program, args, options, signal) {
34
+ signal.throwIfAborted();
35
+ return new Promise((done) => {
36
+ const group = process.platform !== "win32";
37
+ const child = spawn(program, args, { ...options, detached: group });
38
+ let startError;
39
+ const stop = () => {
40
+ if (!child.pid) return;
41
+ try {
42
+ if (group) process.kill(-child.pid, signal.reason.signal);
43
+ else child.kill(signal.reason.signal);
44
+ } catch (error) {
45
+ if (error.code !== "ESRCH") console.error(error.message);
46
+ }
47
+ };
48
+ signal.addEventListener("abort", stop, { once: true });
49
+ child.on("error", (error) => { startError = error.message; });
50
+ child.on("close", (code, bySignal) => {
51
+ signal.removeEventListener("abort", stop);
52
+ done(startError ?? (code === 0 ? undefined : bySignal ?? `exit ${code}`));
53
+ });
54
+ });
55
+ }
56
+
57
+ async function run([program, ...args], cwd, env, signal) {
58
+ console.log(`$ ${[program, ...args].join(" ")}`);
59
+ const failure = await runChild(program, args, { cwd, env, stdio: ["ignore", "inherit", "inherit"] }, signal);
60
+ signal.throwIfAborted();
61
+ if (failure) throw new Error(`${[program, ...args].join(" ")}: ${failure}`);
62
+ }
63
+
64
+ function coreTarget(directory) {
65
+ return join(directory, "node_modules", corePackage);
66
+ }
67
+
68
+ export function reusableCore(directory, version) {
69
+ const target = coreTarget(directory);
70
+ const manifest = join(target, "package.json");
71
+ if (!statSync(manifest, { throwIfNoEntry: false })?.isFile()) return false;
72
+ try {
73
+ return JSON.parse(readFileSync(manifest, "utf8"))?.version === version &&
74
+ statSync(join(target, "src/registry/agent-registry.ts"), { throwIfNoEntry: false })?.isFile() === true &&
75
+ statSync(join(target, "..", "pi-natives-linux-x64"), { throwIfNoEntry: false })?.isDirectory() === true;
76
+ } catch (error) {
77
+ if (error instanceof SyntaxError) return false;
78
+ throw error;
79
+ }
80
+ }
81
+
82
+ export function makeCoreRunDir(parent) {
83
+ mkdirSync(parent, { recursive: true });
84
+ for (const entry of readdirSync(parent, { withFileTypes: true })) {
85
+ const owner = /^run-([1-9]\d*)-[A-Za-z0-9]{6}$/.exec(entry.name);
86
+ if (!owner || !entry.isDirectory()) continue;
87
+ try {
88
+ process.kill(Number(owner[1]), 0);
89
+ } catch (error) {
90
+ if (error.code === "ESRCH") rmSync(join(parent, entry.name), { recursive: true, force: true });
91
+ else if (error.code !== "EPERM" && error.code !== "ERR_OUT_OF_RANGE") throw error;
92
+ }
93
+ }
94
+ return mkdtempSync(join(parent, `run-${process.pid}-`));
95
+ }
96
+
97
+ async function installCore(directory, version, env, signal) {
98
+ mkdirSync(directory, { recursive: true });
99
+ writeFileSync(join(directory, "package.json"), JSON.stringify({ name: "ci-core", private: true }), { flag: "wx" });
100
+ console.log(`Installing pristine core ${version}: ${directory}`);
101
+ // The shared Bun cache may already contain in-place SDK patches from older tools.
102
+ const downloadEnv = { ...env, BUN_INSTALL_CACHE_DIR: join(directory, "..", "bun-download") };
103
+ await run(["bun", "add", "--backend=copyfile", `${corePackage}@${version}`], directory, downloadEnv, signal);
104
+ if (!reusableCore(directory, version)) throw new Error(`Core ${version} or pi-natives-linux-x64 is missing: ${directory}`);
105
+ }
106
+
107
+ export function obsoleteCorePins(entries, installedPin) {
108
+ const prefix = `${process.platform}-${process.arch}-`;
109
+ return entries.filter(({ name }) => name !== installedPin && name.startsWith(prefix) && coreVersion.test(name.slice(prefix.length)))
110
+ .sort((a, b) => b.installedAt - a.installedAt || a.name.localeCompare(b.name))
111
+ .slice(1)
112
+ .map(({ name }) => name);
113
+ }
114
+
115
+ async function copyPristineCore(cache, scratch, checkout, version, env, signal) {
116
+ const parent = join(cache, "pristine");
117
+ mkdirSync(parent, { recursive: true });
118
+ const lock = openSync(join(parent, ".lock"), "a");
119
+ try {
120
+ // flock locks the inherited open file description; Node still owns it after flock exits.
121
+ // Keep it through copy and eviction, then tests use only their private copies.
122
+ const lockFailure = await runChild("flock", ["-x", "3"], { env, stdio: ["ignore", "inherit", "inherit", lock] }, signal);
123
+ signal.throwIfAborted();
124
+ if (lockFailure) throw new Error(`Cannot lock pristine core cache: ${lockFailure}`);
125
+ const installedPin = coreCacheKey(version);
126
+ const pristine = join(parent, installedPin);
127
+ if (reusableCore(pristine, version)) {
128
+ console.log(`Reusing pristine core ${version}: ${pristine}`);
129
+ } else {
130
+ const staging = join(scratch, "install");
131
+ await installCore(staging, version, env, signal);
132
+ if (statSync(pristine, { throwIfNoEntry: false })) renameSync(pristine, join(scratch, "invalid-install"));
133
+ renameSync(staging, pristine);
134
+ const entries = readdirSync(parent, { withFileTypes: true }).filter((entry) => entry.isDirectory());
135
+ for (const name of obsoleteCorePins(entries.map(({ name }) => ({
136
+ name, installedAt: statSync(join(parent, name)).mtimeMs,
137
+ })), installedPin)) {
138
+ rmSync(join(parent, name), { recursive: true, force: true });
139
+ }
140
+ }
141
+ const start = performance.now();
142
+ cpSync(pristine, checkout, { recursive: true, verbatimSymlinks: true, mode: constants.COPYFILE_FICLONE });
143
+ console.log(`Copied pristine core (${((performance.now() - start) / 1000).toFixed(1)}s)`);
144
+ } finally {
145
+ closeSync(lock);
146
+ }
147
+ }
148
+
149
+ async function prepareHarness(env, signal) {
150
+ await run(["bash", "-ec", "command -v bash; command -v pwsh"], harness, env, signal);
151
+ const { dependencies } = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
152
+ const version = dependencies[corePackage];
153
+ const explicitDir = env.CUELO_CI_CORE_DIR && resolve(root, env.CUELO_CI_CORE_DIR);
154
+ const cache = join(env.XDG_CACHE_HOME || join(homedir(), ".cache"), "cuelo-ci-local");
155
+ const scratch = makeCoreRunDir(explicitDir || join(cache, "runs"));
156
+ let prepared = false;
157
+ try {
158
+ const checkout = join(scratch, "core");
159
+ if (explicitDir) await installCore(checkout, version, env, signal);
160
+ else await copyPristineCore(cache, scratch, checkout, version, env, signal);
161
+ const target = coreTarget(checkout);
162
+ const testEnv = { ...env, OMP_CORE_PATCH_TARGET: target };
163
+ const patchEnv = { ...testEnv, HOME: scratch, USERPROFILE: scratch };
164
+ const start = performance.now();
165
+ await run(patchCommand, harness, patchEnv, signal);
166
+ await run([...patchCommand, "--check"], harness, patchEnv, signal);
167
+ console.log(`Patched and verified scratch core (${((performance.now() - start) / 1000).toFixed(1)}s)`);
168
+ prepared = true;
169
+ return { env: testEnv, scratch };
170
+ } finally {
171
+ if (!prepared) rmSync(scratch, { recursive: true, force: true });
172
+ }
173
+ }
174
+
175
+ async function runExtensions(env, signal) {
176
+ await run([process.execPath, "patches/check-extension-duplicates.mjs"], harness, env, signal);
177
+ await run(["bun", "test", "./agent/extensions/tests", "./agent/extensions/command-guard",
178
+ "./agent/tools/git-finalizer", "./agent/tools/windows-control", "./agent/tools/artifact-search",
179
+ "./agent/tools/vm-build", "./skill-cost"], harness, env, signal);
180
+ }
181
+
182
+ async function coreTest(file, log, env, signal) {
183
+ const fd = openSync(log, "w");
184
+ try {
185
+ return await runChild("bun", ["run", file], { cwd: harness, env, stdio: ["ignore", fd, fd] }, signal);
186
+ } finally {
187
+ closeSync(fd);
188
+ }
189
+ }
190
+
191
+ async function runCore(env, signal) {
192
+ const files = globSync("patches/core-*-test.ts", { cwd: harness }).sort();
193
+ files.push("patches/apply-core-patch-cli-test.ts");
194
+ const parallel = Number(execFileSync("nproc", { encoding: "utf8" }));
195
+ const logs = mkdtempSync(join(env.RUNNER_TEMP || tmpdir(), "cuelo-core-tests-"));
196
+ const runs = files.map((file) => ({ file, name: basename(file), log: join(logs, `${basename(file)}.log`) }));
197
+ let next = 0;
198
+ try {
199
+ console.log(`Running ${runs.length} core test files (bun run, up to ${parallel} at once)`);
200
+ await Promise.all(Array.from({ length: Math.min(parallel, runs.length) }, async () => {
201
+ while (!signal.aborted && next < runs.length) {
202
+ const test = runs[next++];
203
+ test.failure = await coreTest(test.file, test.log, env, signal);
204
+ }
205
+ }));
206
+ signal.throwIfAborted();
207
+ const failed = [];
208
+ let ptyPassed = false;
209
+ for (const test of runs) {
210
+ if (env.GITHUB_ACTIONS === "true") console.log(`::group::${test.name}`);
211
+ else console.log(`--- ${test.name} ---`);
212
+ const log = readFileSync(test.log, "utf8");
213
+ process.stdout.write(log.endsWith("\n") ? log : `${log}\n`);
214
+ if (env.GITHUB_ACTIONS === "true") console.log("::endgroup::");
215
+ if (test.failure) failed.push(`${test.name} (${test.failure})`);
216
+ if (test.name === "core-patch-test.ts") ptyPassed = log.includes("PASS 사용자 셸 PTY");
217
+ }
218
+ if (!ptyPassed) failed.push("core-patch-test.ts (user-shell PTY check did not run)");
219
+ if (failed.length) throw new Error(`Failed: ${failed.join(", ")}`);
220
+ } finally {
221
+ rmSync(logs, { recursive: true, force: true });
222
+ }
223
+ }
224
+
225
+ async function runApp(env, signal) {
226
+ for (const script of ["typecheck", "lint", "test"]) await run(["bun", "run", script], root, env, signal);
227
+ await run(["bun", "test", "./Tools/CUELO_Setup/files/btw-server.test.mjs",
228
+ "./Tools/CUELO_Setup/files/subagent-server.test.mjs", "./Tools/CUELO_Setup/files/usage-server.test.js"], root, env, signal);
229
+ }
230
+
231
+ async function main(args) {
232
+ const selected = parseSuites(args);
233
+ if (!selected.length) {
234
+ console.log(usage);
235
+ return;
236
+ }
237
+ const env = { NEXT_TELEMETRY_DISABLED: "1", ...process.env };
238
+ const controller = new AbortController();
239
+ const { signal } = controller;
240
+ setMaxListeners(Infinity, signal);
241
+ const stop = (name) => controller.abort(Object.assign(new Error(`Interrupted by ${name}`), { signal: name }));
242
+ const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM"] : ["SIGHUP", "SIGINT", "SIGQUIT", "SIGTERM"];
243
+ const handlers = signals.map((name) => [name, () => stop(name)]);
244
+ for (const [name, handler] of handlers) process.on(name, handler);
245
+ let sourcePrepared = false;
246
+ let preparedHarness;
247
+ let harnessPreparationError;
248
+ try {
249
+ for (const suite of selected) {
250
+ const start = performance.now();
251
+ console.log(`\n=== CI local: ${suite} ===`);
252
+ try {
253
+ if (!sourcePrepared) {
254
+ await run(["bun", "install", "--frozen-lockfile"], root, env, signal);
255
+ await run(["bun", "run", "prepare:source"], root, env, signal);
256
+ sourcePrepared = true;
257
+ }
258
+ if (suite === "app") await runApp(env, signal);
259
+ else {
260
+ if (harnessPreparationError) throw harnessPreparationError;
261
+ if (!preparedHarness) {
262
+ try {
263
+ preparedHarness = await prepareHarness(env, signal);
264
+ } catch (error) {
265
+ harnessPreparationError = error;
266
+ throw error;
267
+ }
268
+ }
269
+ if (suite === "harness-extensions") await runExtensions(preparedHarness.env, signal);
270
+ else await runCore(preparedHarness.env, signal);
271
+ }
272
+ console.log(`=== ${suite}: passed (${((performance.now() - start) / 1000).toFixed(1)}s) ===`);
273
+ } catch (error) {
274
+ process.exitCode = signal.aborted ? 128 + osConstants.signals[signal.reason.signal] : 1;
275
+ console.error(`=== ${suite}: failed (${((performance.now() - start) / 1000).toFixed(1)}s): ${error.message} ===`);
276
+ if (!sourcePrepared || signal.aborted) break;
277
+ }
278
+ }
279
+ } finally {
280
+ for (const [name, handler] of handlers) process.removeListener(name, handler);
281
+ if (preparedHarness) rmSync(preparedHarness.scratch, { recursive: true, force: true });
282
+ console.log("\nCI-only checks not run here: next build, web runtime compatibility, upkeep reader matrix, private-file job.");
283
+ }
284
+ }
285
+
286
+ if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) {
287
+ main(process.argv.slice(2)).catch((error) => {
288
+ console.error(error.message);
289
+ process.exitCode = 2;
290
+ });
291
+ }
package/install.mjs CHANGED
@@ -209,14 +209,14 @@ function fileHash(file) {
209
209
  */
210
210
  export function readHarnessManifest(agentDir) {
211
211
  const file = path.join(agentDir, HARNESS_MANIFEST);
212
- if (!fs.existsSync(file)) return { cuelo: null, files: {} };
212
+ if (!fs.existsSync(file)) return { cuelo: null, files: Object.create(null) };
213
213
  let parsed;
214
214
  try {
215
215
  parsed = JSON.parse(fs.readFileSync(file, "utf8"));
216
216
  } catch (error) {
217
217
  throw new Error(`${file} is not readable (${error.message}). Delete it to treat every harness file as untracked.`);
218
218
  }
219
- const files = {};
219
+ const files = Object.create(null);
220
220
  for (const [rel, hash] of Object.entries(parsed?.files ?? {})) files[rel] = typeof hash === "string" && SHA256.test(hash) ? hash : null;
221
221
  return { cuelo: typeof parsed?.cuelo === "string" ? parsed.cuelo : null, files };
222
222
  }
@@ -242,9 +242,11 @@ export function recordHarnessInstall(agentDir, report, version) {
242
242
  } catch (error) {
243
243
  return { skipped: error.message };
244
244
  }
245
- const files = {};
245
+ const files = Object.create(null);
246
246
  for (const rel of report.kept) files[rel] = previous[rel] ?? null;
247
247
  for (const rel of report.created) files[rel] = fileHash(path.join(agentDir, ...rel.split("/")));
248
+ // A file the distribution dropped keeps its record, so a setup re-run does not forget it before harness-update retires it.
249
+ for (const [rel, hash] of Object.entries(previous)) if (hash !== null && !Object.hasOwn(files, rel) && isPlainProfilePath(rel)) files[rel] = hash;
248
250
  writeHarnessManifest(agentDir, files, version);
249
251
  return { skipped: null };
250
252
  }
@@ -267,6 +269,54 @@ function isProfilePathSafe(agentDir, rel) {
267
269
  return true;
268
270
  }
269
271
 
272
+ /** Creates a file that must not exist yet with the final permission bits set before any byte is written; a partial file this call made is removed again. */
273
+ function writeNewFile(file, bytes, mode) {
274
+ const fd = fs.openSync(file, "wx", mode);
275
+ try {
276
+ fs.fchmodSync(fd, mode);
277
+ fs.writeFileSync(fd, bytes);
278
+ } catch (error) {
279
+ fs.closeSync(fd);
280
+ fs.rmSync(file, { force: true });
281
+ throw error;
282
+ }
283
+ fs.closeSync(fd);
284
+ }
285
+
286
+ /** A record path is only acted on when it is a plain relative path inside the profile that is not CUELO's own bookkeeping. */
287
+ function isPlainProfilePath(rel) {
288
+ const parts = rel.split("/");
289
+ if (parts.some((part) => part === "" || part === "." || part === ".." || /[\\\0]/.test(part)) || /^[A-Za-z]:/.test(parts[0])) return false;
290
+ return rel !== HARNESS_MANIFEST && parts[0] !== HARNESS_BACKUP_DIR;
291
+ }
292
+
293
+ /**
294
+ * Files CUELO installed (a recorded hash) that the distribution no longer ships, with what to do about each:
295
+ * retired still the bytes we installed: backed up and removed
296
+ * user-modified differs from the bytes we installed: left in place
297
+ * untracked not a plain file, or behind a link: left in place
298
+ * gone already absent: only the record goes
299
+ * guarded the distribution looks empty, so nothing is judged retired and the record stays
300
+ * A file with no record, or a null one (it was there before CUELO), is never listed.
301
+ */
302
+ function findRetired(agentDir, manifest, distributed) {
303
+ // Compared without case: on a case-insensitive profile a differently spelled distributed name is the same file.
304
+ const shipped = new Set([...distributed].map((rel) => rel.toLowerCase()));
305
+ const candidates = Object.entries(manifest.files)
306
+ .filter(([rel, hash]) => hash !== null && !shipped.has(rel.toLowerCase()) && isPlainProfilePath(rel))
307
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
308
+ const empty = distributed.size === 0;
309
+ const retired = candidates.map(([rel, recorded]) => {
310
+ if (empty) return { path: rel, status: "guarded", recorded };
311
+ if (!isProfilePathSafe(agentDir, rel)) return { path: rel, status: "untracked", recorded };
312
+ const stat = fs.lstatSync(path.join(agentDir, ...rel.split("/")), { throwIfNoEntry: false });
313
+ if (!stat) return { path: rel, status: "gone", recorded };
314
+ if (!stat.isFile()) return { path: rel, status: "untracked", recorded };
315
+ return { path: rel, status: fileHash(path.join(agentDir, ...rel.split("/"))) === recorded ? "retired" : "user-modified", recorded };
316
+ });
317
+ return { retired, retiredSkipped: empty && candidates.length > 0 ? "the distribution lists no harness files, so nothing was judged retired" : null };
318
+ }
319
+
270
320
  const HARNESS_STATES = ["identical", "missing", "update-available", "user-modified", "untracked"];
271
321
 
272
322
  /**
@@ -296,7 +346,8 @@ export function diffHarness(sourceDir, agentDir, entries) {
296
346
  return { path: rel, status, distHash, profileHash, recorded };
297
347
  });
298
348
  const counts = Object.fromEntries(HARNESS_STATES.map((state) => [state, files.filter((file) => file.status === state).length]));
299
- return { installedVersion: manifest.cuelo, manifest, files, counts };
349
+ const { retired, retiredSkipped } = findRetired(agentDir, manifest, new Set(files.map((file) => file.path)));
350
+ return { installedVersion: manifest.cuelo, manifest, files, counts, retired, retiredSkipped };
300
351
  }
301
352
 
302
353
  /**
@@ -308,6 +359,8 @@ export function diffHarness(sourceDir, agentDir, entries) {
308
359
  * appeared meanwhile. A file that fails its re-check is reported as user-modified / untracked instead.
309
360
  * A throw part-way (disk full, a permission) puts back every file this run wrote before it rethrows, and the
310
361
  * record is left as it was, so the profile never ends up half old and half new with a record matching neither.
362
+ * Files CUELO installed that the distribution no longer ships (`retired`) are removed the same way: only while their
363
+ * bytes still hash to the recorded installed hash, after a backup, and never when the distribution lists nothing.
311
364
  */
312
365
  export function updateHarness(sourceDir, agentDir, entries, version, { dryRun = false, now = new Date() } = {}) {
313
366
  const diff = diffHarness(sourceDir, agentDir, entries);
@@ -317,6 +370,12 @@ export function updateHarness(sourceDir, agentDir, entries, version, { dryRun =
317
370
  untracked: planned("untracked").map((file) => file.path),
318
371
  "backup-unsafe": [],
319
372
  };
373
+ const retiredBy = (...statuses) => diff.retired.filter((file) => statuses.includes(file.status));
374
+ skipped["user-modified"].push(...retiredBy("user-modified").map((file) => file.path));
375
+ skipped.untracked.push(...retiredBy("untracked").map((file) => file.path));
376
+ // Records of retired files that stay in the profile are kept; a removed or already absent file's record goes.
377
+ const keepRecord = new Set(retiredBy("user-modified", "untracked", "guarded").map((file) => file.path));
378
+ const removed = [];
320
379
  const backupStamp = now.toISOString().replace(/[:.]/g, "-");
321
380
  let backupDir = null;
322
381
  const updated = [];
@@ -324,9 +383,48 @@ export function updateHarness(sourceDir, agentDir, entries, version, { dryRun =
324
383
  if (dryRun) {
325
384
  updated.push(...planned("update-available").map((file) => file.path));
326
385
  added.push(...planned("missing").map((file) => file.path));
386
+ for (const file of retiredBy("retired")) {
387
+ const backup = path.join(agentDir, HARNESS_BACKUP_DIR, backupStamp, ...file.path.split("/"));
388
+ if (isProfilePathSafe(agentDir, `${HARNESS_BACKUP_DIR}/${backupStamp}/${file.path}`) && !fs.lstatSync(backup, { throwIfNoEntry: false })) removed.push(file.path);
389
+ else skipped["backup-unsafe"].push(file.path);
390
+ }
327
391
  } else {
328
392
  const undo = [];
329
393
  try {
394
+ for (const file of retiredBy("retired")) {
395
+ const target = path.join(agentDir, ...file.path.split("/"));
396
+ const safe = isProfilePathSafe(agentDir, file.path);
397
+ const stat = safe ? fs.lstatSync(target, { throwIfNoEntry: false }) : null;
398
+ if (safe && !stat) continue;
399
+ const current = stat?.isFile() ? fs.readFileSync(target) : null;
400
+ if (current === null) {
401
+ skipped.untracked.push(file.path);
402
+ keepRecord.add(file.path);
403
+ } else if (hashBytes(current) !== file.recorded) {
404
+ skipped["user-modified"].push(file.path);
405
+ keepRecord.add(file.path);
406
+ } else if (!isProfilePathSafe(agentDir, `${HARNESS_BACKUP_DIR}/${backupStamp}/${file.path}`)) {
407
+ skipped["backup-unsafe"].push(file.path);
408
+ keepRecord.add(file.path);
409
+ } else {
410
+ backupDir ??= path.join(agentDir, HARNESS_BACKUP_DIR, backupStamp);
411
+ const backup = path.join(backupDir, ...file.path.split("/"));
412
+ fs.mkdirSync(path.dirname(backup), { recursive: true });
413
+ writeNewFile(backup, current, stat.mode & 0o7777);
414
+ // Same re-check as an overwrite: the file is deleted only if, right now, it is still a plain file in a safe
415
+ // folder holding exactly the bytes that were backed up. Only a finished removal can be rolled back.
416
+ const now = isProfilePathSafe(agentDir, file.path) ? fs.lstatSync(target, { throwIfNoEntry: false }) : undefined;
417
+ const latest = now?.isFile() ? fs.readFileSync(target) : null;
418
+ if (latest === null || !latest.equals(current)) {
419
+ skipped["user-modified"].push(file.path);
420
+ keepRecord.add(file.path);
421
+ } else {
422
+ fs.rmSync(target);
423
+ undo.push({ rel: file.path, target, backup, done: false, removed: true, bytes: current, mode: now.mode & 0o7777 });
424
+ removed.push(file.path);
425
+ }
426
+ }
427
+ }
330
428
  for (const file of planned("update-available")) {
331
429
  const target = path.join(agentDir, ...file.path.split("/"));
332
430
  let current = null;
@@ -369,19 +467,28 @@ export function updateHarness(sourceDir, agentDir, entries, version, { dryRun =
369
467
  // Records follow what is on disk now: written files and identical tracked files carry the distributed
370
468
  // hash, every other file keeps the record it had.
371
469
  const written = new Set([...updated, ...added]);
372
- const files = {};
470
+ const files = Object.create(null);
373
471
  for (const file of diff.files) {
374
472
  const tracked = file.status === "identical" && file.recorded !== null;
375
473
  files[file.path] = written.has(file.path) || tracked ? file.distHash : file.recorded;
376
474
  }
475
+ for (const file of diff.retired) if (keepRecord.has(file.path)) files[file.path] = file.recorded;
377
476
  writeHarnessManifest(agentDir, files, version);
378
477
  } catch (error) {
379
478
  // Only bytes this run wrote are undone, in a regular unlinked profile file: exactly the distributed bytes for a
380
479
  // finished copy, or a cut-short start of them for the copy that failed. A file the user changed or replaced
381
480
  // meanwhile is left and named in the error.
382
481
  const left = [];
383
- for (const { rel, target, backup, done } of undo.reverse()) {
482
+ for (const { rel, target, backup, done, removed: wasRemoved, bytes: removedBytes, mode } of undo.reverse()) {
384
483
  try {
484
+ // A removed file comes back, from the bytes that were removed, only if nothing took its place meanwhile.
485
+ if (wasRemoved) {
486
+ const safeNow = isProfilePathSafe(agentDir, rel);
487
+ const present = safeNow ? fs.lstatSync(target, { throwIfNoEntry: false }) : undefined;
488
+ if (safeNow && !present) writeNewFile(target, removedBytes, mode);
489
+ else left.push(rel);
490
+ continue;
491
+ }
385
492
  const safe = isProfilePathSafe(agentDir, rel);
386
493
  const stat = safe ? fs.lstatSync(target, { throwIfNoEntry: false }) : undefined;
387
494
  // Gone meanwhile: an addition needs nothing; an overwritten file the user removed stays removed.
@@ -404,7 +511,7 @@ export function updateHarness(sourceDir, agentDir, entries, version, { dryRun =
404
511
  throw error;
405
512
  }
406
513
  }
407
- return { dryRun, updated, added, skipped, backupDir, identical: diff.counts.identical };
514
+ return { dryRun, updated, added, removed, skipped, backupDir, retiredSkipped: diff.retiredSkipped, identical: diff.counts.identical };
408
515
  }
409
516
 
410
517
  function packageInfo() {
@@ -430,7 +537,9 @@ function harnessDiff(options) {
430
537
  const diff = diffHarness(sourceDir, agentDir, entries);
431
538
  if (options.json) {
432
539
  const files = diff.files.map(({ path: file, status }) => ({ path: file, status }));
433
- console.log(JSON.stringify({ agentDir, cuelo: packageInfo().version, installedVersion: diff.installedVersion, counts: diff.counts, files }, null, 2));
540
+ const retired = diff.retired.map(({ path: file, status }) => ({ path: file, status }));
541
+ const counts = { ...diff.counts, retired: retired.filter((file) => file.status === "retired").length };
542
+ console.log(JSON.stringify({ agentDir, cuelo: packageInfo().version, installedVersion: diff.installedVersion, counts, files, retired, retiredSkipped: diff.retiredSkipped }, null, 2));
434
543
  return;
435
544
  }
436
545
  const by = (state) => diff.files.filter((file) => file.status === state).map((file) => file.path);
@@ -439,6 +548,9 @@ function harnessDiff(options) {
439
548
  printList("missing: not in the profile; `harness-update` adds it", by("missing"));
440
549
  printList("user-modified: differs from what was installed; never changed automatically", by("user-modified"));
441
550
  printList("untracked: exists with no install record; never changed automatically", by("untracked"));
551
+ printList("retired: installed by CUELO, no longer distributed, unmodified; `harness-update` backs it up and removes it", diff.retired.filter((file) => file.status === "retired").map((file) => file.path));
552
+ printList("retired and user-modified: no longer distributed, but differs from what was installed; never removed automatically", diff.retired.filter((file) => file.status === "user-modified").map((file) => file.path));
553
+ if (diff.retiredSkipped) console.log(`Retired files not checked: ${diff.retiredSkipped}.`);
442
554
  console.log(`${diff.counts.identical} files identical to the distribution.`);
443
555
  }
444
556
 
@@ -453,11 +565,13 @@ function harnessUpdate(options) {
453
565
  const prefix = result.dryRun ? "Would be " : "";
454
566
  printList(`${prefix}updated`, result.updated);
455
567
  printList(`${prefix}added`, result.added);
568
+ printList(`${prefix}removed (installed by CUELO, no longer distributed)`, result.removed);
569
+ if (result.retiredSkipped) console.log(`Retired files not removed: ${result.retiredSkipped}.`);
456
570
  printList("Left as it is, user-modified", result.skipped["user-modified"]);
457
571
  printList("Left as it is, untracked", result.skipped.untracked);
458
572
  printList("Left as it is, the backup folder inside the profile is a link or not a folder", result.skipped["backup-unsafe"]);
459
- if (result.updated.length + result.added.length === 0) console.log("Nothing to update.");
460
- if (result.backupDir) console.log(`Previous versions of the updated files were saved under ${result.backupDir}.`);
573
+ if (result.updated.length + result.added.length + result.removed.length === 0) console.log("Nothing to update.");
574
+ if (result.backupDir) console.log(`Previous versions of the updated and removed files were saved under ${result.backupDir}.`);
461
575
  if (result.dryRun) console.log("Dry run: no file was changed.");
462
576
  }
463
577
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuelo",
3
- "version": "0.10.331",
3
+ "version": "0.10.333",
4
4
  "description": "CUELO — open-source AI coding agent workspace and harness for omp (oh-my-pi)",
5
5
  "homepage": "https://github.com/gim47656-ship-it/CUELO#readme",
6
6
  "repository": {
@@ -88,6 +88,7 @@
88
88
  "prepare:runtime": "node bin/prepare-runtime.js",
89
89
  "prepare:source": "node bin/prepare-runtime.js --source",
90
90
  "prepare:worktree": "node bin/prepare-worktree.js",
91
+ "ci:local": "node bin/ci-local.mjs",
91
92
  "dev": "bun --bun next dev --webpack -H 127.0.0.1 -p 30141",
92
93
  "dev:lan": "bun --bun next dev --webpack -H 0.0.0.0 -p 30141",
93
94
  "dev:verify": "CUELO_DIST_DIR=.next-verify NODE_ENV=development bun --bun next dev --webpack -H 127.0.0.1 -p 30163",
@@ -95,7 +96,7 @@
95
96
  "start": "bun bin/cuelo.js --no-open -H 127.0.0.1 -p 30141",
96
97
  "start:lan": "bun bin/cuelo.js --no-open -H 0.0.0.0 -p 30141",
97
98
  "lint": "eslint .",
98
- "typecheck": "next typegen && tsc --noEmit",
99
+ "typecheck": "next typegen && tsc --noEmit -p tsconfig.typecheck.json",
99
100
  "test": "bun test ./app ./components ./hooks ./lib ./public ./bin ./install.test.mjs",
100
101
  "test:coverage": "bun test --coverage ./app ./components ./hooks ./lib ./public ./bin ./install.test.mjs"
101
102
  },
@@ -1,2 +0,0 @@
1
- "use strict";exports.id=4259,exports.ids=[4259],exports.modules={8102:(a,b,c)=>{c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j,e9:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.CUELO_HOSTNAME,...process.env.CUELO_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}function j(a,b=g()){return!!i(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{LV:()=>v,On:()=>B,TK:()=>E,Y1:()=>A,Zc:()=>I,er:()=>C,ix:()=>F,qm:()=>K,wK:()=>D});var e=c(29021),f=c(21820),g=c(33873),h=c(92582),i=c(63833),j=c(94374),k=c(65209),l=c(82640),m=c(1740),n=c(9015),o=c(78772),p=c(28518),q=c(13229),r=c(8102),s=c(38741),t=a([h,i,j,k,l,m,n,o,p,s]);[h,i,j,k,l,m,n,o,p,s]=t.then?(await t)():t;let L=[".omp/extensions",".omp/hooks",".omp/tools",".pi/extensions",".pi/hooks",".pi/tools",".claude/extensions",".claude/hooks",".claude/tools",".agents/extensions",".agents/hooks",".agents/tools"],M=[".mcp.json",".omp/.mcp.json",".omp/mcp.json",".claude/.mcp.json",".claude/mcp.json",".cursor/mcp.json"];function u(a){return(0,g.join)(a,"cuelo-trusted-projects.json")}function v(a){let b=(0,g.resolve)(a);try{return(0,e.realpathSync)(b)}catch{return b}}function w(a){try{(0,q.adoptLegacyStateFile)(u(a),"omp-web-trusted-projects.json");let b=JSON.parse((0,e.readFileSync)(u(a),"utf8"));if("object"!=typeof b||null===b||Array.isArray(b))return{};return Object.fromEntries(Object.entries(b).filter(a=>"boolean"==typeof a[1]))}catch{return{}}}function x(a,b){let c=[];for(let d of a){let a;if("string"==typeof d&&0!==d.length){try{a=(0,p.resolvePath)(d,b)}catch{continue}(0,e.existsSync)(a)&&c.push(a)}}return c}function y(a){if("project"!==a.getProvenance(o.cfgDisabledExtensions))return[...o.cfgDisabledExtensions.get(a)];let b=a.getGlobalSettings().disabledExtensions;return Array.isArray(b)?b.filter(a=>"string"==typeof a):[]}function z(a){if("project"!==a.getProvenance(o.cfgDisabledExtensions))return!1;let b=new Set(o.cfgDisabledExtensions.get(a)),c=new Set(y(a));return b.size!==c.size||[...b].some(a=>!c.has(a))}function A(a,b,c){return a&&function(a,b){if(!a)return!1;for(let b of L)if((0,e.existsSync)((0,g.join)(a,b)))return!0;for(let b of M)if((0,e.existsSync)((0,g.join)(a,b)))return!0;return("project"!==b.extensionsSourceLevel()?[]:x(o.cfgExtensions.get(b),a)).length>0||function(a){let b;if((0,g.resolve)(a)===(0,g.resolve)((0,f.homedir)()))return[];try{b=JSON.parse((0,e.readFileSync)((0,g.join)(a,".omp","settings.json"),"utf8"))}catch{return[]}let c=b?.extensions;return Array.isArray(c)?x(c,a):[]}(a).length>0||z(b)}(a,c)?{requiresTrust:!0,trusted:!0===w(b)[v(a)]}:{requiresTrust:!1,trusted:!0}}async function B(a,b){return A(a,b,await (0,s.getSettingsForCwd)(a))}function C(a,b,c){let d=A(a,b,c);return d.requiresTrust?(D(a,b,!0),{requiresTrust:!0,trusted:!0}):d}function D(a,b,c){let d=w(b);d[v(a)]=c,(0,e.mkdirSync)(b,{recursive:!0}),(0,r.$)(u(b),`${JSON.stringify(d,null,2)}
2
- `)}function E(a){return w(a)}function F(a,b){let c=(0,g.relative)((0,g.resolve)(b),(0,g.resolve)(a));return""===c||!(0,g.isAbsolute)(c)&&".."!==c&&!c.startsWith(`..${g.sep}`)&&!c.startsWith("../")}async function G(a){return(await (0,n.getEnabledPlugins)(a)).flatMap(a=>(0,n.resolvePluginExtensionPaths)(a))}async function H(a,b,c){let d={explicit:c,mode:"explicit-only",configured:[],configuredLevel:"user"},[e,f,g,l]=await Promise.all([(0,i.loadCapability)(j.extensionModuleCapability.id,{cwd:b,providers:["native"]}),(0,i.loadCapability)(k.hookCapability.id,{cwd:b}),(0,h.discoverSessionExtensionPaths)({extensionRoots:()=>d},b,a),G(b)]),m=new Set([...e.items.filter(a=>"project"!==a.level).map(a=>a.path),...f.items.filter(a=>"project"!==a.level).map(a=>a.path),...g,...l].map(v));return new Set(e.items.filter(a=>"project"===a.level).map(a=>v(a.path)).filter(a=>!m.has(a)))}async function I(a,b){let c=function(a){if("project"!==a.extensionsSourceLevel())return[...o.cfgExtensions.get(a)];let b=a.getGlobalSettings().extensions;return Array.isArray(b)?b.filter(a=>"string"==typeof a&&a.length>0):[]}(a),d={explicit:[],mode:"merge",configured:c,configuredLevel:"user"};return(0,l.withOmpExtensionRootScope)([],"merge",async()=>{(0,l.setInvocationConfiguredExtensions)(c,"user");let[e,f,g]=await Promise.all([(0,h.discoverSessionExtensionPaths)({extensionRoots:()=>d},b,a),(0,m.discoverCustomToolPaths)([],b),H(a,b,c)]);return{extensionPaths:e.filter(a=>!g.has(v(a))),customToolPaths:f}})}async function J(a,b){let c=await a.cloneForCwd(b);return o.cfgDisabledExtensions.override(c,y(a)),c}async function K(a,b,c,d){let e=A(a,b,c);if(!e.requiresTrust||e.trusted)return;let f=z(c)?await J(c,a):c,g=await d(f);return{preloadedExtensionPaths:g.extensionPaths.filter(b=>!F(b,a)),preloadedCustomToolPaths:g.customToolPaths.filter(b=>b.source?.level!=="project"&&!F(b.path,a)),enableMCP:!1,...f!==c?{settings:f}:{}}}d()}catch(a){d(a)}})},75805:(a,b,c)=>{c.d(b,{_:()=>k,i:()=>g});var d=c(29021),e=c(21820),f=c(33873);function g({homeDir:a=(0,e.homedir)(),xdgStateHome:b=process.env.XDG_STATE_HOME}={}){return b?(0,f.join)(b,"skills",".skill-lock.json"):(0,f.join)(a,".agents",".skill-lock.json")}function h(a){try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return b.skills&&"object"==typeof b.skills?b.skills:{}}catch{return{}}}function i(a,b){let c=(0,f.relative)((0,f.resolve)(b),(0,f.resolve)(a));return""!==c&&".."!==c&&!c.startsWith(`..${f.sep}`)&&!(0,f.isAbsolute)(c)}function j(a,b,c){var d;let e=function(a,b){if(a[b])return a[b];let c=b.toLowerCase(),d=Object.keys(a).find(a=>a.toLowerCase()===c);return d?a[d]:void 0}(a,b);if(!e||"string"!=typeof e.source||!e.source.trim())return;let f="string"==typeof e.sourceType?e.sourceType:void 0,g=(d=e.source.trim(),"github"!==f?d.replace(/\/$/,""):d.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,""));if(!g)return;let h="string"==typeof e.skillPath?e.skillPath:void 0,i="string"==typeof e.ref?e.ref:void 0,j="global"===c?e.skillFolderHash:e.computedHash,k="string"==typeof j&&j?j:void 0,l="github"===f&&/^[\w.-]+\/[\w.-]+$/.test(g);return{package:`${g}@${b}`,scope:c,source:g,sourceType:f,skillsShUrl:"local"===f?void 0:function(a,b){if(!a||a.includes("://")||a.startsWith("git@"))return;let c=a.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(c)return`https://skills.sh/${c}/${encodeURIComponent(b)}`}(g,b),...h&&{skillPath:h},...i&&{ref:i},...k&&{versionHash:k},canCheckForUpdates:!!(l&&h&&k&&("global"===c||!i))}}function k(a,{cwd:b,agentDir:c,globalLockPath:l=g(),projectLockPath:m=(0,f.join)(b,"skills-lock.json")}){let n=h(l),o=h(m),p=[(0,f.join)(c,"skills"),(0,f.join)((0,e.homedir)(),".claude","skills")],q=[(0,f.join)(b,".omp","skills"),(0,f.join)(b,".claude","skills")];return a.map(a=>{if(!(0,d.existsSync)(a.filePath))return a;let b=p.some(b=>i(a.filePath,b))?j(n,a.name,"global"):q.some(b=>i(a.filePath,b))?j(o,a.name,"project"):void 0;return b?{...a,install:b}:a})}},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,Ph:()=>r,mU:()=>s,mc:()=>n,uK:()=>m,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=a([k]);k=(l.then?(await l)():l)[0];let t=/^[a-zA-Z]:[\\/]/;function m(a){return t.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function n(){let a=Date.now(),b=globalThis.__ompAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.wb)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^omp-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__ompAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){for(let c of b){let b=m(a)||m(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}function p(a,b){return(0,j.x)(a,b)}function q(a){return"string"==typeof a?.windows&&t.test(a.windows)&&"string"==typeof a.local&&h().posix.isAbsolute(a.local)}function r(a=(0,k.$M)()){let b=globalThis.__cueloLegacyPathMaps??=new Map,c=b.get(a);if(c)return c;let d=[];try{let b=JSON.parse((0,e.readFileSync)(h().join(a,"cuelo-legacy-paths.json"),"utf8"));Array.isArray(b?.prefixes)&&(d=b.prefixes.filter(q))}catch{}return b.set(a,d),d}function s(a,b){if(!b.length||!t.test(a))return a;let c=a=>h().win32.normalize(a).split("\\").filter(Boolean),d=c(a),e=d.map(a=>a.toLowerCase()),f=null;for(let a of b){let b=c(a.windows).map(a=>a.toLowerCase());b.length>e.length||f&&b.length<=f.length||b.every((a,b)=>a===e[b])&&(f={length:b.length,local:a.local})}return f?h().posix.join(f.local,...d.slice(f.length)):a}d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>j,x:()=>k});var d=c(29021),e=c(33873),f=c.n(e);let g=/^[a-zA-Z]:[\\/]/;function h(a){return g.test(a)||a.startsWith("\\\\")||a.startsWith("//")}function i(a,b){let c=h(a)||h(b),d=c?f().win32:f(),e=c?"\\":f().sep,g=d.resolve(a),i=d.resolve(b),j=c?g.toLowerCase():g,k=c?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;return j===k||j.startsWith(l)}function j(a,b){for(let c of b)if(i(a,c))return!0;return!1}function k(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}for(let e=0;e<2;e++)for(let f of b)if(i(a,f)===(0===e))try{if(i(c,(0,d.realpathSync)(f)))return!0}catch{}return!1}}};
@@ -1,3 +0,0 @@
1
- "use strict";exports.id=8139,exports.ids=[8139],exports.modules={13440:(a,b,c)=>{c.d(b,{AR:()=>i,Nm:()=>t,Ny:()=>h,TB:()=>r,VZ:()=>s,Yv:()=>m,Zz:()=>o,_6:()=>q,je:()=>j,my:()=>n,xF:()=>l,yn:()=>k});var d=c(73024),e=c(76760),f=c(8102),g=c(88740);let h="cuelo-upkeep-checks.json",i=300,j=`note must be a string of at most ${i} characters`;function k(a){let b="object"==typeof a&&null!==a&&"metricId"in a?a.metricId:void 0;return"string"==typeof b&&b.trim()===b&&b.length>0&&b.length<=200?b:null}function l(a){let b="object"==typeof a&&null!==a&&"note"in a?a.note:void 0;if(null==b)return null;if("string"!=typeof b)return;let c=b.replace(/\s+/g," ").trim();if(!(c.length>i))return c||null}function m(a){let b="object"==typeof a&&null!==a&&"verdict"in a?a.verdict:void 0;return null==b?null:"real"===b||"false-positive"===b?b:void 0}function n(a){let b=Object.create(null);for(let c of Object.values(a)){if(!c.criterionId||!c.verdict)continue;let a=b[c.criterionId]??={real:0,falsePositive:0,precision:null};"real"===c.verdict?a.real++:a.falsePositive++,a.precision=a.real/(a.real+a.falsePositive)}return b}function o(a){let b;try{b=(0,d.readFileSync)((0,e.join)(a,h),"utf8")}catch(a){if("ENOENT"===a.code)return{};throw a}let c=JSON.parse(b);if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`${h} is not a JSON object`);let f={};for(let[a,b]of Object.entries(c)){if(!b||"object"!=typeof b)continue;let{at:c,note:d,verdict:e,criterionId:g}=b;if("string"!=typeof c||!Number.isFinite(Date.parse(c)))continue;let h=("real"===e||"false-positive"===e)&&"string"==typeof g&&g.length>0;f[a]={at:c,note:"string"==typeof d&&d?d:null,...h?{verdict:e,criterionId:g}:{}}}return f}function p(a,b){(0,d.mkdirSync)(a,{recursive:!0}),(0,f.$)((0,e.join)(a,h),`${JSON.stringify(b,null,2)}
2
- `)}function q(a,b,c,d,e){let f=e?{verdict:e,criterionId:(0,g.U5)(b)}:{};p(a,{...o(a),[b]:{at:c.toISOString(),note:d,...f}})}function r(a,b,c,d,e){let f=o(a),h=Object.hasOwn(f,b)?f[b]:void 0,i={...(h&&Date.parse(h.at)>=c.getTime()-6048e5&&Date.parse(h.at)<=c.getTime()?h:void 0)??{at:c.toISOString(),note:null},...void 0===d?{}:{note:d}};void 0!==e&&(delete i.verdict,delete i.criterionId,e&&(i.verdict=e,i.criterionId=(0,g.U5)(b))),p(a,{...f,[b]:i})}function s(a,b){let c=o(a);b in c&&(delete c[b],p(a,c))}function t(a,b){let c;try{c=o(a)}catch{return{}}let d={};for(let[a,e]of Object.entries(c))Date.parse(e.at)>=b-6048e5&&(d[a]=e);if(Object.keys(d).length!==Object.keys(c).length)try{p(a,d)}catch{}return d}},19294:(a,b,c)=>{c.d(b,{EY:()=>m,F6:()=>j,H3:()=>k,Wq:()=>q,YT:()=>p,Yn:()=>l,e0:()=>g,pL:()=>o});var d=c(73024),e=c(76760),f=c(8102);let g="cuelo-upkeep-fixes.json",h={"tool-error-rate":!0,"dispatch-rejects":!0,"slow-gaps":!0,compactions:!0,"todo-nudges":!0,"maker-early-exits":!0,"maker-verdicts":!0,"recall-per-turn":!0,"gated-ratio":!0,"memory-export-failures":!0,"cost-per-turn":!0,"session-cache-rewrite":!0,"billed-api-key":!0,"repeat-complaints":!0},i=["purpose:","model:"];function j(a){return Object.hasOwn(h,a)||i.some(b=>a.startsWith(b)&&a.length>b.length)}function k(a){let b="object"==typeof a&&null!==a&&"metricId"in a?a.metricId:void 0;return"string"==typeof b&&b.length<=200&&j(b)?b:null}function l(a,b){let c="object"==typeof a&&null!==a&&"at"in a?a.at:void 0;if(void 0===c)return b;let d="string"==typeof c?Date.parse(c):NaN;return!Number.isFinite(d)||d>b.getTime()||d<b.getTime()-6048e5?null:new Date(d)}function m(a){let b;try{b=(0,d.readFileSync)((0,e.join)(a,g),"utf8")}catch(a){if("ENOENT"===a.code)return{};throw a}let c=JSON.parse(b);if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`${g} is not a JSON object`);let f={};for(let[a,b]of Object.entries(c))"string"==typeof b&&Number.isFinite(Date.parse(b))&&j(a)&&(f[a]=b);return f}function n(a,b){(0,d.mkdirSync)(a,{recursive:!0}),(0,f.$)((0,e.join)(a,g),`${JSON.stringify(b,null,2)}
3
- `)}function o(a,b,c){n(a,{...m(a),[b]:c.toISOString()})}function p(a,b){let c=m(a);b in c&&(delete c[b],n(a,c))}function q(a,b){let c;try{c=m(a)}catch{return{}}let d={},e={};for(let[a,f]of Object.entries(c)){let c=Date.parse(f);c<b||(d[a]=c,e[a]=f)}if(Object.keys(e).length!==Object.keys(c).length)try{n(a,e)}catch{}return d}},43803:(a,b,c)=>{c.d(b,{Hc:()=>k,iq:()=>g,on:()=>r,rJ:()=>f});let d={ok:"정상",watch:"주의",problem:"문제",unknown:"미확인"};function e(a){let b=Date.parse(a);return Number.isNaN(b)?null:new Date(b+324e5).toISOString()}function f(a){return e(a)?.slice(0,10)??a}function g(a){let b=e(a);return b?`${b.slice(0,10)} ${b.slice(11,16)}`:a}function h(a){let b=Date.parse(a);return Number.isNaN(b)?a:f(new Date(b-1).toISOString())}function i(a){let[b,c]=String(a).split("."),d=b.startsWith("-")?"-":"",e=(d?b.slice(1):b).replace(/\B(?=(\d{3})+(?!\d))/g,",");return`${d}${e}${c?`.${c}`:""}`}function j(a,b){let c=10**b;return Math.round(a*c)/c}function k(a,b){if(null===b)return"측정 불가";switch(a){case"count":return`${i(j(b,2))}건`;case"ratio":return`${(100*b).toFixed(1)}%`;case"usd":return`$${i(j(b,2))}`;case"ms":return b>=1e3?`${i(j(b/1e3,1))}초`:`${i(j(b,0))}ms`;case"tokens":return`${i(Math.round(b))} 토큰`}}function l(a,b=""){let{unit:c,current:d,previous:e}=a;if(null===d||null===e)return null;let f=d-e;if(0===f)return"없음";let g=f>0?"+":"-";if("ratio"===c)return`${g}${(100*Math.abs(f)).toFixed(1)}%p`;let h=k(c,Math.abs(f)),i=0===e?"":` (${g}${j(Math.abs(f)/Math.abs(e)*100,0)}%)`;return`${g}${h}${b}${i}`}function m(a){return a<36e5?`${Math.max(0,Math.floor(a/6e4))}분`:a<864e5?`${Math.floor(a/36e5)}시간`:`${j(a/864e5,1)}일`}let n="관찰 중",o={date:0,"after-deploy":0,condition:1,none:2};function p(a,b){return[`${b} (${a.path}, 「${a.title}」):`,"```text",a.text,"```"]}let q=["요청:","1. 위 근거 사례의 세션 파일과 경로를 직접 열어, 이 판정이 나온 원인을 찾아 주세요. 근거가 부족하면 그 사실부터 알려 주세요.","2. 원인이 CUELO-private 저장소 범위 안이면 고치고, 고친 동작을 실제로 검증해 주세요.","3. HANDOFF.md와 작업 기록(doc/history)에 원인\xb7조치\xb7검증 결과를 남겨 주세요.","4. 사용자 결정이 필요한 일(기준 변경, 비용, 삭제, 상시 승인 범위 밖의 배포 등)이면 고치지 말고 멈춰서 저에게 물어봐 주세요. 이미 확인된 상시 승인 범위의 배포는 재승인을 요청하지 말고 해당 프로젝트의 검증, 커밋과 푸시, 배포 절차를 따라 주세요.",'5. 고쳐서 live 배포와 검증까지 끝난 지표만 고침 표시를 남겨 주세요. 이 CUELO 서버의 `POST /api/upkeep`에 JSON `{"metricId": "<지표 id>", "at": "<고친 동작이 live에 들어간 시각, ISO>"}`을 보내면 됩니다(최근 7일 안, 미래 불가). 원인은 확인했지만 사용자 결정에 따른 사용량처럼 고친 게 아닌 지표는 고침 표시 대신 점검 표시를 남겨 주세요: `POST /api/upkeep/check`에 JSON `{"metricId": "<지표 id>", "note": "<확인한 원인 한 줄>"}`(행 판정은 그대로 두고, 7일 동안 「점검 완료」로 붙어 섹션 판정과 전체\xb7섹션 프롬프트에서 빠집니다). 비밀번호 잠금 등으로 API를 부를 수 없으면 표시 대신 지표 id와 시각\xb7사유를 결과에 적어 주세요.'];function r(a){let b,c,e=["CUELO 보수 전체 점검","","점검 기간:",...(b=function(a){let{currentStart:b,currentEnd:c,previousStart:d}=a.window;return{current:`${f(b)} ~ ${h(c)}`,previous:`${f(d)} ~ ${h(b)}`}}(a),[`- 최근 7일: ${b.current}`,`- 비교 기간(직전 7일): ${b.previous}`,`- 보고서 생성: ${g(a.generatedAt)} (세션 파일 ${i(a.scannedFiles)}개를 읽음)`]),"","보수 대시보드에서 정상이 아닌 지표, 점검일이 지난 HANDOFF 항목, 읽지 못한 자료만 모았습니다. 섹션 순서대로 처리하고, 항목마다 원인과 조치를 따로 적어 주세요.",...(c=a.sections.flatMap(a=>a.metrics).filter(a=>a.check)).length?["",`점검 완료 표시한 지표 ${c.length}개는 뺐습니다: ${c.map(a=>a.label).join(", ")}`]:[]],j=0;for(let b of a.sections){let a=b.metrics.filter(a=>"ok"!==a.status&&!a.check),c=[...b.items??[]].sort((a,b)=>a.overdue!==b.overdue?a.overdue?-1:1:a.dueDate&&b.dueDate&&a.dueDate!==b.dueDate?a.dueDate<b.dueDate?-1:1:!!a.dueDate!=!!b.dueDate?a.dueDate?-1:1:o[a.dueKind]-o[b.dueKind]).filter(a=>a.overdue);if(a.length||c.length||b.warnings.length){for(let f of(j+=a.length+c.length,e.push("",`# ${b.title} (${d[b.status]})`),a))e.push("",`## ${f.label}`,...function(a){let b,c,e,f,h,{fix:j}=a,o=j?null:l(a),q=j?(b=j.perDay?"/일":"",e=(c=(a,b)=>null!==a&&j.perDay?b>0?a/(b/864e5):null:a)(a.current,j.afterMs),f=c(j.before,j.beforeMs),h=c=>`${k(a.unit,c)}${null===c?"":b}`,{after:j.observing?n:h(e),before:h(f),afterWindow:m(j.afterMs),beforeWindow:m(j.beforeMs),change:j.observing?n:l({unit:a.unit,current:e,previous:f},b)}):null,r=j&&q?[`- 고침 표시: ${g(j.markedAt)}. 판정은 이 시각 이후 기록만으로 냈습니다.`,`- 고침 뒤 값(표시 뒤 ${q.afterWindow}): ${q.after}`,`- 고침 전 값(최근 7일 중 표시 전 ${q.beforeWindow}): ${q.before}${!j.observing&&q.change?` (고침 전 대비 변화 ${q.change})`:""}`]:[`- 최근 7일 값: ${k(a.unit,a.current)}`];return r.push(`- 직전 7일 값: ${k(a.unit,a.previous)}${o?` (변화 ${o})`:""}`,`- 판정: ${d[a.status]}`,`- 판정 기준: ${a.criterion}`),a.note&&r.push(`- 해석 주의: ${a.note}`),a.check&&r.push(`- 점검 완료: ${g(a.check.checkedAt)}${a.check.note?` \xb7 ${a.check.note}`:""}. 원인을 확인했지만 고친 게 아니라 행 판정은 그대로이고, 섹션 판정과 전체\xb7섹션 프롬프트에서는 빠집니다.`),r.push(`- 지표 id(${a.fixable?"고침\xb7점검 표시용":"점검 표시용"}): \`${a.id}\``),a.handoff&&r.push("",...p(a.handoff,"이 기준을 적은 HANDOFF 항목")),r.push("","근거 사례:"),a.evidence.length?r.push(...a.evidence.map(a=>{let b,c;return b=[a.label],void 0!==a.count&&b.push(`${i(a.count)}회`),a.sessionId&&b.push(`세션 ${a.sessionId}`),a.sessionPath&&b.push(a.sessionPath),a.timestamp&&b.push(g(a.timestamp)),(c=function(a,b){if(!b||!a.timestamp)return null;let c=Date.parse(b.markedAt);return Date.parse(a.timestamp)<c?"고침 전":a.since&&Date.parse(a.since)<c?"고침 전 사용 포함":null}(a,j))&&b.push(c),a.detail&&b.push(a.detail),`- ${b.join(" \xb7 ")}`})):r.push("- 보고서에 사례가 없습니다. 아래 요청 1번에서 직접 찾아야 합니다."),r}(f));for(let a of c)e.push("",`## 점검일 지남: ${a.ref.title}`,`- 기한: ${function(a){if("condition"===a.dueKind)return"조건이 생기면 점검";if(!a.dueDate)return"점검일 미기재";let b="after-deploy"===a.dueKind?"배포일 기준 계산":"점검일";return`${b} ${a.dueDate}${a.overdue?" \xb7 기한 지남":""}`}(a)}`,`- 출처: ${a.ref.path}의 「${a.section}」 절`,"",...p(a.ref,"HANDOFF 원문"));e.push(...b.warnings.length?["","이 섹션을 만들 때 읽지 못한 자료:",...b.warnings.map(a=>`- ${a}`)]:[])}}j||e.push("","이번 보고서에는 정상이 아닌 지표와 기한 지난 항목이 없습니다."),e.push("",...q,"6. 점검일이 지난 HANDOFF 항목은 원문에 적힌 조건과 기준으로 판정하고, 결과에 맞게 그 항목을 고쳐 주세요.");let r=e.filter((a,b)=>""!==a||b>0&&""!==e[b-1]);for(;""===r[0];)r.shift();for(;""===r.at(-1);)r.pop();return r.join("\n")}},88740:(a,b,c)=>{c.d(b,{A$:()=>q,Br:()=>M,G4:()=>C,Im:()=>g,Iv:()=>n,L9:()=>f,Nf:()=>G,QD:()=>i,QZ:()=>P,Sy:()=>l,U5:()=>R,UD:()=>O,UJ:()=>H,UV:()=>m,Uj:()=>A,WG:()=>F,Y7:()=>B,_H:()=>y,cD:()=>h,cN:()=>r,dj:()=>k,eO:()=>K,e_:()=>Q,h5:()=>L,hD:()=>j,kF:()=>o,kJ:()=>D,mM:()=>z,nB:()=>v,oe:()=>e,pu:()=>w,qv:()=>d,s0:()=>E,tJ:()=>p,uj:()=>J,w0:()=>u,yb:()=>I,yg:()=>N,z1:()=>x});let d=20,e="직전 7일 대비 50% 넘게 나빠지면 주의, 2배 이상이면 문제 (두 기간 모두 표본 20 이상일 때)",f=5,g=5,h=1728e5,i=10,j=.25,k=.5,l=10,m=25,n=25,o=50,p=3,q=2e4,r=2,s=/또(?![는한])/u,t=["왜 안","아까 말","말했잖","다시 말하","몇 번","그게 아니라","안 되잖","왜 이래","아직도"];function u(a){return!(a.length>v)&&(s.test(a)||t.some(b=>a.includes(b)))}let v=300,w=.515,x=.008,y=1,z="OAuth(구독) 사용분을 뺀 청구분의 요청 100건당 금액이 직전 7일보다 50% 넘게 늘면 주의, 2배 이상이면 문제 (두 기간 모두 호출 20건 이상이고 큰 쪽 청구분이 $1 이상일 때)",A=.1,B=12,C=2e4,D=.5,E=36e5,F=3e5,G=2592e5,H=7;function I(a){let b=/^(?:origin\/|refs\/heads\/)?wt\/nightly-(\d{4})(\d{2})(\d{2})(?:-inbox)?$/.exec(a);if(!b)return null;let c=`${b[1]}-${b[2]}-${b[3]}`,d=Date.parse(`${c}T00:00:00+09:00`);return Number.isNaN(d)||new Date(d+324e5).toISOString().slice(0,10)!==c?null:d}function J(a,b){let c=I(a);return null!==c&&b-c<864e5*H}let K=864e5,L=1,M=3,N=36e5;function O(a,b,c,e,f="higher",h){if(null===a||null===b||c<d||e<d)return"unknown";if(h&&Math.max(...h)<g||!("higher"===f?a>b:a<b))return"ok";let i="higher"===f?0===b?1/0:a/b:0===a?1/0:b/a;return i>=2?"problem":i>1.5?"watch":"ok"}function P(a){return a.includes("problem")?"problem":a.includes("watch")?"watch":a.includes("unknown")?"unknown":"ok"}function Q(a,b){return b?a/b*100:null}function R(a){return a.startsWith("skill:")?"skill-correlation-info-v2":a.startsWith("model:")?"model-cost-v2":a.startsWith("purpose:")?"purpose-cost-v1":a.startsWith("task-cost:")?"task-cost-v1":`${a}-v2`}}};