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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +56 -56
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/agent/[id]/account/route.js +1 -1
- package/.next/server/app/api/agent/[id]/account/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/computer-takeover/route.js +1 -1
- package/.next/server/app/api/agent/[id]/computer-takeover/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/running/route.js +1 -1
- package/.next/server/app/api/agent/running/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/handles/route.js +1 -1
- package/.next/server/app/api/gpt6/handles/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/reply/route.js +1 -1
- package/.next/server/app/api/gpt6/reply/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/token/route.js +1 -1
- package/.next/server/app/api/gpt6/token/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/web6-session/route.js +1 -1
- package/.next/server/app/api/gpt6/web6-session/route.js.nft.json +1 -1
- package/.next/server/app/api/live/call/[callId]/route.js +1 -1
- package/.next/server/app/api/live/call/[callId]/route.js.nft.json +1 -1
- package/.next/server/app/api/live/draft-secret/route.js +1 -1
- package/.next/server/app/api/live/draft-secret/route.js.nft.json +1 -1
- package/.next/server/app/api/live/events/route.js +1 -1
- package/.next/server/app/api/live/events/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/assist/route.js +1 -1
- package/.next/server/app/api/live/interpret/assist/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/reading/route.js +1 -1
- package/.next/server/app/api/live/interpret/reading/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/route.js +1 -1
- package/.next/server/app/api/live/interpret/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/scan/route.js +1 -1
- package/.next/server/app/api/live/interpret/scan/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/text/route.js +1 -1
- package/.next/server/app/api/live/interpret/text/route.js.nft.json +1 -1
- package/.next/server/app/api/live/offer/route.js +1 -1
- package/.next/server/app/api/live/offer/route.js.nft.json +1 -1
- package/.next/server/app/api/live/voices/route.js +1 -1
- package/.next/server/app/api/live/voices/route.js.nft.json +1 -1
- package/.next/server/app/api/project-trust/route.js +1 -1
- package/.next/server/app/api/project-trust/route.js.nft.json +1 -1
- package/.next/server/app/api/runs/[runId]/prelude/route.js +1 -1
- package/.next/server/app/api/runs/[runId]/prelude/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/check/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/install/route.js +1 -1
- package/.next/server/app/api/skills/install/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +1 -1
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/update/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js.nft.json +1 -1
- package/.next/server/app/api/tool-image/route.js +1 -1
- package/.next/server/app/api/tool-image/route.js.nft.json +1 -1
- package/.next/server/app/api/update-maintenance/route.js +1 -1
- package/.next/server/app/api/update-maintenance/route.js.nft.json +1 -1
- package/.next/server/app/api/updates/apply/route.js +2 -2
- package/.next/server/app/api/updates/route.js +1 -1
- package/.next/server/app/api/upkeep/check/route.js +1 -1
- package/.next/server/app/api/upkeep/check/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/morning/route.js +2 -3
- package/.next/server/app/api/upkeep/morning/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/nightly/export/route.js +1 -1
- package/.next/server/app/api/upkeep/nightly/export/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/nightly/result/route.js +1 -2
- package/.next/server/app/api/upkeep/nightly/result/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/nightly/route.js +1 -2
- package/.next/server/app/api/upkeep/nightly/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/route.js +1 -1
- package/.next/server/app/api/upkeep/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
- package/.next/server/app/recover.html +1 -1
- package/.next/server/app/recover.rsc +2 -2
- package/.next/server/app/recover.segments/_full.segment.rsc +2 -2
- package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
- package/.next/server/app/recover.segments/_index.segment.rsc +2 -2
- package/.next/server/app/recover.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +56 -56
- package/.next/server/chunks/2235.js +2 -0
- package/.next/server/chunks/3173.js +3 -0
- package/.next/server/chunks/3392.js +2 -0
- package/.next/server/chunks/4831.js +1 -1
- package/.next/server/chunks/5228.js +1 -1
- package/.next/server/chunks/8041.js +1 -6
- package/.next/server/chunks/{6119.js → 8094.js} +1 -1
- package/.next/server/chunks/8685.js +2 -2
- package/.next/server/chunks/9467.js +2 -3
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/app/{layout-bc3824f2c0eebb33.js → layout-b2da0140cc733ca6.js} +1 -1
- package/.next/static/chunks/app/{page-9e999c92e12dc19c.js → page-2affef230bc901fc.js} +2 -2
- package/.next/trace +113 -113
- package/.next/trace-build +1 -1
- package/README.md +1 -1
- package/Tools/CUELO_Setup/files/native-runtime-patch.js +1 -1
- package/Tools/OMP_Global_Config/agent/extensions/lib/finalize-checks.ts +353 -0
- package/Tools/OMP_Global_Config/agent/extensions/lib/interpreter.ts +12 -6
- package/Tools/OMP_Global_Config/agent/extensions/todo-nudge.ts +48 -14
- package/Tools/OMP_Global_Config/agent/tools/ego-browser/index.ts +19 -4
- package/Tools/OMP_Global_Config/agent/tools/git-finalizer/finalizer.ps1 +11 -1
- package/Tools/OMP_Global_Config/agent/tools/git-finalizer/index.ts +89 -21
- package/Tools/OMP_Global_Config/agent/tools/git-finalizer/integrate.ts +66 -11
- package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +97 -0
- package/bin/ci-local.mjs +291 -0
- package/install.mjs +124 -10
- package/package.json +3 -2
- package/.next/server/chunks/4259.js +0 -2
- package/.next/server/chunks/8139.js +0 -3
- package/Tools/OMP_Global_Config/agent/extensions/user-input-interpreter.ts +0 -130
- /package/.next/static/{qYIo9_tHAFFQaFxpOUmz_ → UerdzBExCL9nskNG-lvSd}/_buildManifest.js +0 -0
- /package/.next/static/{qYIo9_tHAFFQaFxpOUmz_ → UerdzBExCL9nskNG-lvSd}/_ssgManifest.js +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { CustomTool, CustomToolFactory } from "@oh-my-pi/pi-coding-agent";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
+
import { readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { access, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
5
6
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
7
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { currentBlobs,
|
|
8
|
+
import { currentBlobs, ledgerPath, resolveRepoTargets, runGate, spawnExec } from "../../extensions/lib/cross-review";
|
|
9
|
+
import { finalizeChecksNote, runFinalizeChecks, type FinalizeChecksResult } from "../../extensions/lib/finalize-checks";
|
|
8
10
|
import { mergeGateBlobs, runSlopGate, slopLedgerPath } from "../../extensions/lib/slop-gate";
|
|
9
11
|
import { integrateTool, reattachRetiredBranch } from "./integrate";
|
|
10
12
|
import { syncBehindUpstream } from "./sync-upstream";
|
|
11
|
-
import { hasPosixGitdirWorktree, isWindowsDrivePath, selectGitExecutor, usesWindowsDriveRepo } from "./wsl-git";
|
|
13
|
+
import { hasPosixGitdirWorktree, isWindowsDrivePath, selectGitExecutor, usesWindowsDriveRepo, windowsPathToPosix } from "./wsl-git";
|
|
12
14
|
|
|
13
15
|
export { hasPosixGitdirWorktree };
|
|
14
16
|
/** 도구 로더가 넘기는 API. 한 factory가 git_finalize와 git_integrate를 함께 등록한다. */
|
|
@@ -26,6 +28,8 @@ interface FinalizerResult {
|
|
|
26
28
|
leftoverScope?: string;
|
|
27
29
|
leftoverTotal?: number;
|
|
28
30
|
leftoverFiles?: string[];
|
|
31
|
+
repositoryRoot?: string;
|
|
32
|
+
repositoryFiles?: string[];
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
const scriptPath = fileURLToPath(new URL("./finalizer.ps1", import.meta.url));
|
|
@@ -212,7 +216,7 @@ type ManifestExec = (command: string, args: string[], options: { cwd: string })
|
|
|
212
216
|
* 낡음이 아닌 오류(목록 누락 등)는 그대로 던진다. 요청 파일 일부가 cwd 밖인데 outsideCwdReason이 없으면 finalizer가 거절할 요청이므로
|
|
213
217
|
* 저장소를 건드리지 않고 기존 오류를 그대로 던진다.
|
|
214
218
|
*/
|
|
215
|
-
async function checkSourceManifest(cwd: string, files: string[], exec: ManifestExec, outsideAuthorized: boolean): Promise<string | undefined> {
|
|
219
|
+
async function checkSourceManifest(cwd: string, files: string[], exec: ManifestExec, outsideAuthorized: boolean): Promise<{ file: string; restoreIfUnchanged: () => string } | undefined> {
|
|
216
220
|
try {
|
|
217
221
|
await verifySourceManifest(cwd, files, exec);
|
|
218
222
|
return undefined;
|
|
@@ -273,7 +277,20 @@ async function checkSourceManifest(cwd: string, files: string[], exec: ManifestE
|
|
|
273
277
|
const restored = await restore();
|
|
274
278
|
throw new Error(`${error.message}\nThe manifest was regenerated but still does not match (${restored}): ${recheckError instanceof Error ? recheckError.message : String(recheckError)}${earlierOutputs.length ? `\nHelper output: ${earlierOutputs.join(" | ")}` : ""}`);
|
|
275
279
|
}
|
|
276
|
-
|
|
280
|
+
const generated = await readFile(manifestFile);
|
|
281
|
+
return {
|
|
282
|
+
file: relative(cwd, manifestFile).split(sep).join("/"),
|
|
283
|
+
restoreIfUnchanged: () => {
|
|
284
|
+
try {
|
|
285
|
+
if (!readFileSync(manifestFile).equals(generated)) return `The generated ${manifestPath} changed again and was left alone; include it in the retry.`;
|
|
286
|
+
if (previous) writeFileSync(manifestFile, previous);
|
|
287
|
+
else rmSync(manifestFile);
|
|
288
|
+
return "The previous source manifest was restored.";
|
|
289
|
+
} catch (error) {
|
|
290
|
+
return `Could not restore ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`;
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
};
|
|
277
294
|
}
|
|
278
295
|
}
|
|
279
296
|
|
|
@@ -380,18 +397,20 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
380
397
|
label: "Git Finalize",
|
|
381
398
|
loadMode: "essential",
|
|
382
399
|
description:
|
|
383
|
-
"Main-only commit/push exact cwd-relative files in one repo, no globs/directories. message required; crossReviewHighRisk uses paths from files. Review/slop passes bind current content. crossReviewWaiver: explicit user instruction OR 2026-11-19 provider-limit exception after required Hydrogen also failed or could not be called (decision, reviewId, raw errors). slopGateWaiver: explicit user instruction only. outsideCwdReason: the user's explicit instruction authorizing files outside the session cwd (another repo, another worktree, or the shared main checkout outside cwd); not needed inside the session's own linked worktree or for direct repo-root children of the cwd repo; without it such paths are rejected. A stale source manifest is regenerated and committed automatically. After a commit the result lists untracked/modified files left under the committed folder (not committed, advisory). Behind-only copies fast-forward/merge before gates; divergence/conflict stops. Never bypass locks/ancestry."
|
|
400
|
+
"Main-only commit/push exact cwd-relative files in one repo, no globs/directories. message required; crossReviewHighRisk uses paths from files. Review/slop passes bind current content. crossReviewWaiver: explicit user instruction OR 2026-11-19 provider-limit exception after required Hydrogen also failed or could not be called (decision, reviewId, raw errors). slopGateWaiver: explicit user instruction only. outsideCwdReason: the user's explicit instruction authorizing files outside the session cwd (another repo, another worktree, or the shared main checkout outside cwd); not needed inside the session's own linked worktree or for direct repo-root children of the cwd repo; without it such paths are rejected. A stale source manifest is regenerated and committed automatically. After a commit the result lists untracked/modified files left under the committed folder (not committed, advisory). Behind-only copies fast-forward/merge before gates; divergence/conflict stops. Never bypass locks/ancestry."
|
|
401
|
+
+ " Matching .finalize-checks.json checks run after review/slop and before commit/push. finalizeChecksWaiver: explicit user instruction only.",
|
|
384
402
|
parameters: pi.zod.object({
|
|
385
403
|
files: pi.zod.array(pi.zod.string()),
|
|
386
404
|
message: pi.zod.string(),
|
|
387
405
|
crossReviewHighRisk: pi.zod.array(pi.zod.string()).optional(),
|
|
388
406
|
crossReviewWaiver: pi.zod.string().optional(),
|
|
389
407
|
slopGateWaiver: pi.zod.string().optional(),
|
|
408
|
+
finalizeChecksWaiver: pi.zod.string().optional(),
|
|
390
409
|
outsideCwdReason: pi.zod.string().optional(),
|
|
391
410
|
}),
|
|
392
411
|
|
|
393
|
-
async execute(_toolCallId, params, onUpdate,
|
|
394
|
-
let requested = params.files.map((value) => value.trim()).filter(Boolean);
|
|
412
|
+
async execute(_toolCallId, params, onUpdate, ctx, signal) {
|
|
413
|
+
let requested: string[] = params.files.map((value: string) => value.trim()).filter(Boolean);
|
|
395
414
|
const message = params.message.trim();
|
|
396
415
|
if (requested.length === 0) throw new Error("git_finalize requires at least one exact file path.");
|
|
397
416
|
if (!message) throw new Error("git_finalize requires a non-empty commit message.");
|
|
@@ -415,7 +434,9 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
415
434
|
}
|
|
416
435
|
// 낡은 매니페스트는 여기서 다시 만들어 요청 파일에 더한다. 게이트 blob 수집(runGate)보다 앞이라 finalizer의 blob 대조와 어긋나지 않는다.
|
|
417
436
|
const regeneratedManifest = await checkSourceManifest(pi.cwd, requested, exec, Boolean(params.outsideCwdReason?.trim()));
|
|
418
|
-
if (regeneratedManifest && !requested.some((file) => resolve(pi.cwd, file) === resolve(pi.cwd, regeneratedManifest)))
|
|
437
|
+
if (regeneratedManifest && !requested.some((file) => resolve(pi.cwd, file) === resolve(pi.cwd, regeneratedManifest.file))) {
|
|
438
|
+
requested = [...requested, regeneratedManifest.file];
|
|
439
|
+
}
|
|
419
440
|
// 계열 교차검증 게이트: 새로 커밋할 코드가 trigger·표본에 걸리면 통과한 검토 기록이 있어야 한다.
|
|
420
441
|
// 기억 transport(memory.file)는 생성물이라 요청 파일에만 적용한다.
|
|
421
442
|
let gateBlobs: Record<string, string> | undefined;
|
|
@@ -455,23 +476,69 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
455
476
|
}
|
|
456
477
|
}
|
|
457
478
|
|
|
458
|
-
onUpdate?.({
|
|
459
|
-
content: [{ type: "text", text: "Repository finalizer lock을 획득하고 변경 경계를 확인하는 중입니다." }],
|
|
460
|
-
details: { phase: "preflight", files },
|
|
461
|
-
});
|
|
462
|
-
|
|
463
479
|
const tempDir = await mkdtemp(join(tmpdir(), "omp-git-finalize-"));
|
|
464
480
|
const requestPath = join(tempDir, "request.json");
|
|
465
481
|
try {
|
|
466
482
|
const windows = await windowsDrivePaths(pi.cwd, files, [pi.cwd, scriptPath, requestPath], exec);
|
|
467
|
-
|
|
483
|
+
const shell = process.platform === "win32" || windows ? "powershell.exe" : "pwsh";
|
|
484
|
+
const args = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", windows?.[1] ?? scriptPath, "-Request", windows?.[2] ?? requestPath];
|
|
485
|
+
const options = { cwd: pi.cwd, signal, timeout: 180_000 };
|
|
468
486
|
const outsideCwdReason = params.outsideCwdReason?.trim();
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
)
|
|
487
|
+
const request = { cwd: windows?.[0] ?? pi.cwd, files, message, outsideCwdReason, generatedFiles: regeneratedManifest ? [manifestPath] : undefined };
|
|
488
|
+
let finalizeChecks: FinalizeChecksResult | undefined;
|
|
489
|
+
let finalizeChecksHead: string | undefined;
|
|
490
|
+
const run = spawnExec(signal);
|
|
491
|
+
let pathPreflight: { root: string; paths: string[] } | undefined;
|
|
492
|
+
const verifyPaths = async () => {
|
|
493
|
+
if (pathPreflight) return pathPreflight;
|
|
494
|
+
await writeFile(requestPath, JSON.stringify(request), "utf8");
|
|
495
|
+
const result = await pi.exec(shell, [...args, "-PreflightOnly"], options);
|
|
496
|
+
const parsed = parseResult(result.stdout);
|
|
497
|
+
if (result.code !== 0 || !parsed?.ok || !parsed.repositoryRoot || !parsed.repositoryFiles?.length) {
|
|
498
|
+
throw new Error(`git_finalize failed at ${parsed?.stage ?? "preflight"}: ${parsed?.error || result.stderr.trim() || result.stdout.trim() || `exit ${result.code}`}`);
|
|
499
|
+
}
|
|
500
|
+
const root = windows ? windowsPathToPosix(parsed.repositoryRoot) : parsed.repositoryRoot;
|
|
501
|
+
return pathPreflight = { root, paths: parsed.repositoryFiles };
|
|
502
|
+
};
|
|
503
|
+
const portableFiles = files.map((file) => file.replaceAll("\\", "/"));
|
|
504
|
+
const targets = repo && !("failure" in repo) && files.length === repo.targets.length && portableFiles.every((file, index) => file === repo.targets[index].input)
|
|
505
|
+
? repo : await resolveRepoTargets(pi.cwd, portableFiles, run);
|
|
506
|
+
const { root, paths } = "failure" in targets
|
|
507
|
+
? await verifyPaths()
|
|
508
|
+
: { root: targets.root, paths: targets.targets.map((target) => target.path) };
|
|
509
|
+
const git = (await selectGitExecutor(root)).command;
|
|
510
|
+
try {
|
|
511
|
+
finalizeChecks = await runFinalizeChecks({
|
|
512
|
+
root, files: paths, git, exec: run, signal, waiver: params.finalizeChecksWaiver,
|
|
513
|
+
sessionManager: ctx?.sessionManager, showDirtyTracked: true,
|
|
514
|
+
authorize: async () => {
|
|
515
|
+
// Project commands may only run after the finalizer approves the same target/paths.
|
|
516
|
+
const authoritative = await verifyPaths();
|
|
517
|
+
if (pathKey(resolve(authoritative.root)) !== pathKey(resolve(root)) ||
|
|
518
|
+
authoritative.paths.length !== paths.length ||
|
|
519
|
+
authoritative.paths.some((path, index) => pathKey(path) !== pathKey(paths[index]))) {
|
|
520
|
+
throw new Error("The publication paths changed during path preflight.");
|
|
521
|
+
}
|
|
522
|
+
const head = await run(git, ["rev-parse", "--verify", "HEAD"], { cwd: root });
|
|
523
|
+
if (head.code !== 0) throw new Error(`Could not read HEAD: ${(head.stderr || head.stdout).trim()}`);
|
|
524
|
+
finalizeChecksHead = head.stdout.trim();
|
|
525
|
+
const missing = paths.filter((path) => !gateBlobs || !Object.hasOwn(gateBlobs, path));
|
|
526
|
+
const blobs = await currentBlobs(run, git, root, missing);
|
|
527
|
+
gateBlobs = { ...Object.fromEntries(blobs), ...gateBlobs };
|
|
528
|
+
onUpdate?.({ content: [{ type: "text", text: "Running the repository's finalize checks on the working tree." }], details: { phase: "finalize-checks" } });
|
|
529
|
+
},
|
|
530
|
+
});
|
|
531
|
+
} catch (error) {
|
|
532
|
+
const manifestNote = regeneratedManifest?.restoreIfUnchanged();
|
|
533
|
+
throw new Error(`git_finalize failed at finalize-checks: ${error instanceof Error ? error.message : String(error)}${manifestNote ? `\n${manifestNote}` : ""}`);
|
|
534
|
+
}
|
|
535
|
+
onUpdate?.({
|
|
536
|
+
content: [{ type: "text", text: "Repository finalizer lock을 획득하고 변경 경계를 확인하는 중입니다." }],
|
|
537
|
+
details: { phase: "preflight", files },
|
|
538
|
+
});
|
|
539
|
+
// Gate blobs and HEAD bind the checked publication to the commit transaction under the lock.
|
|
540
|
+
await writeFile(requestPath, JSON.stringify({ ...request, finalizeChecksHead, gateBlobs: gateBlobs && Object.keys(gateBlobs).length ? gateBlobs : undefined }), "utf8");
|
|
541
|
+
const result = await pi.exec(shell, args, options);
|
|
475
542
|
const parsed = parseResult(result.stdout);
|
|
476
543
|
if (result.code !== 0 || !parsed?.ok) {
|
|
477
544
|
const detail = parsed?.error || result.stderr.trim() || result.stdout.trim() || `exit ${result.code}`;
|
|
@@ -505,6 +572,7 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
505
572
|
+ (memory.file ? ` 기억 transport(${memory.file})를 함께 커밋했다.` : "")
|
|
506
573
|
+ (memory.note ? ` ${memory.note}` : "")
|
|
507
574
|
+ (handoffNote ? ` ${handoffNote}` : "")
|
|
575
|
+
+ (finalizeChecks ? `\n${finalizeChecksNote(finalizeChecks)}` : "")
|
|
508
576
|
+ (parsed.outsideCwdReason ? `\n세션 cwd 밖 경로를 사용자 지시(outsideCwdReason)로 커밋했다: ${parsed.outsideCwdReason}` : "")
|
|
509
577
|
+ (parsed.leftoverTotal && parsed.leftoverFiles?.length
|
|
510
578
|
? `\n커밋하지 않고 남은 파일(${parsed.leftoverScope}/ 아래 ${parsed.leftoverTotal}개, 이번 커밋에 포함되지 않음):\n${parsed.leftoverFiles.join("\n")}`
|
|
@@ -514,7 +582,7 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
514
582
|
+ syncHint
|
|
515
583
|
},
|
|
516
584
|
],
|
|
517
|
-
details: parsed,
|
|
585
|
+
details: finalizeChecks ? { ...parsed, finalizeChecks } : parsed,
|
|
518
586
|
};
|
|
519
587
|
} finally {
|
|
520
588
|
await rm(tempDir, { recursive: true, force: true });
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - source manifest(Tools/CUELO_Setup/files/source-integrity.json) 충돌은 합친 추적 내용으로 다시 만들어 자동으로 넘긴다.
|
|
9
9
|
* - 잠금은 fetch와 게시 구간에만 잡는다. rebase·checks 동안 다른 세션의 git_finalize·git_integrate를 막지 않는다.
|
|
10
10
|
*/
|
|
11
|
-
import type { CustomTool } from "@oh-my-pi/pi-coding-agent";
|
|
11
|
+
import type { CustomTool, CustomToolContext } from "@oh-my-pi/pi-coding-agent";
|
|
12
12
|
import { spawn } from "node:child_process";
|
|
13
13
|
import { copyFile, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
14
14
|
import { tmpdir } from "node:os";
|
|
@@ -16,6 +16,7 @@ import { join, resolve } from "node:path";
|
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
17
|
import { matchBlockedCommand } from "../../extensions/command-guard/matcher";
|
|
18
18
|
import { DELETED_BLOB, ledgerPath, runGate, spawnExec } from "../../extensions/lib/cross-review";
|
|
19
|
+
import { finalizeChecksNote, runFinalizeChecks, type FinalizeChecksResult } from "../../extensions/lib/finalize-checks";
|
|
19
20
|
import { mergeGateBlobs, runSlopGate, slopLedgerPath } from "../../extensions/lib/slop-gate";
|
|
20
21
|
import type { ToolApi } from "./index";
|
|
21
22
|
import { isWindowsDrivePath } from "./wsl-git";
|
|
@@ -602,10 +603,59 @@ async function ensureCleanTracked(repo: Repo, stage: string): Promise<void> {
|
|
|
602
603
|
if (dirty) throw new IntegrateFailure(stage, `tracked changes are present:\n${dirty}`);
|
|
603
604
|
}
|
|
604
605
|
|
|
606
|
+
type ConfiguredChecksOptions = { sessionManager?: CustomToolContext["sessionManager"]; waiver?: string };
|
|
607
|
+
|
|
608
|
+
async function restoreAfterConfiguredFailure(repo: Repo, state: State, tested: string, untrackedBefore?: string): Promise<string> {
|
|
609
|
+
if (tested === state.origHead) return `No rebase rollback was needed; the starting commit was ${tested}.`;
|
|
610
|
+
// This is rollback of our own completed rebase, not a new rebase or remote update.
|
|
611
|
+
// Finish the rollback even when it was cancellation that stopped the checks.
|
|
612
|
+
const rollback = { ...repo, signal: undefined };
|
|
613
|
+
const ref = `refs/cuelo/integrate-failed/${state.branch}/${tested}`;
|
|
614
|
+
const stage = "finalize-checks rollback";
|
|
615
|
+
let saved = `Rebased commit: ${tested}.`;
|
|
616
|
+
try {
|
|
617
|
+
await gitOk(rollback, stage, ["update-ref", ref, tested]);
|
|
618
|
+
saved = `Rebased commit ${tested} is saved at ${ref}.`;
|
|
619
|
+
const branch = (await git(rollback, ["symbolic-ref", "-q", "HEAD"])).stdout.trim();
|
|
620
|
+
const head = await gitOk(rollback, stage, ["rev-parse", "HEAD"]);
|
|
621
|
+
if (branch !== `refs/heads/${state.branch}` || head !== tested || await rebaseInProgress(rollback)) {
|
|
622
|
+
return `${saved} Branch or HEAD changed during the checks; left the worktree unchanged.`;
|
|
623
|
+
}
|
|
624
|
+
await ensureCleanTracked(rollback, stage);
|
|
625
|
+
if (untrackedBefore !== undefined && untrackedBefore !== await gitOk(rollback, stage, ["ls-files", "--others", "--exclude-standard", "-z"])) {
|
|
626
|
+
return `${saved} The untracked file list changed during the checks; left the worktree unchanged.`;
|
|
627
|
+
}
|
|
628
|
+
await gitOk(rollback, stage, ["reset", "--keep", state.origHead]);
|
|
629
|
+
return `${saved} Restored ${state.branch} to ${state.origHead}; fix the check and start git_integrate again.`;
|
|
630
|
+
} catch (error) {
|
|
631
|
+
return `${saved} Could not restore ${state.branch} to ${state.origHead}; no remote refs changed. ${error instanceof Error ? error.message : String(error)}`;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
605
635
|
/** rebase가 끝난 브랜치를 검사하고 잠금 안에서 게시한다. 대상이 그새 움직였으면 다시 rebase한다. */
|
|
606
|
-
async function checkAndPublish(repo: Repo, state: State) {
|
|
636
|
+
async function checkAndPublish(repo: Repo, state: State, configured: ConfiguredChecksOptions) {
|
|
607
637
|
for (;;) {
|
|
608
638
|
const tested = await gitOk(repo, "checks", ["rev-parse", "HEAD"]);
|
|
639
|
+
let finalizeChecks: FinalizeChecksResult | undefined;
|
|
640
|
+
let untrackedBefore: string | undefined;
|
|
641
|
+
try {
|
|
642
|
+
finalizeChecks = await runFinalizeChecks({
|
|
643
|
+
root: repo.root, signal: repo.signal, ...configured,
|
|
644
|
+
files: async () => (await gitOk(repo, "finalize-checks", ["diff", "--name-only", "-z", "--no-renames", state.onto, tested])).split("\0").filter(Boolean),
|
|
645
|
+
authorize: async () => {
|
|
646
|
+
await ensureCleanTracked(repo, "finalize-checks");
|
|
647
|
+
if (tested !== state.origHead) untrackedBefore = await gitOk(repo, "finalize-checks", ["ls-files", "--others", "--exclude-standard", "-z"]);
|
|
648
|
+
},
|
|
649
|
+
});
|
|
650
|
+
if (finalizeChecks && !finalizeChecks.waiver) {
|
|
651
|
+
if ((await gitOk(repo, "finalize-checks", ["rev-parse", "HEAD"])) !== tested) throw new Error(`the checks moved HEAD from ${tested}`);
|
|
652
|
+
await ensureCleanTracked(repo, "finalize-checks");
|
|
653
|
+
}
|
|
654
|
+
} catch (error) {
|
|
655
|
+
const recovery = await restoreAfterConfiguredFailure(repo, state, tested, untrackedBefore);
|
|
656
|
+
await clearState(repo);
|
|
657
|
+
throw new IntegrateFailure("finalize-checks", `${error instanceof Error ? error.message : String(error)}\nNothing was pushed. ${recovery}`);
|
|
658
|
+
}
|
|
609
659
|
let ran: { command: string; seconds: number }[];
|
|
610
660
|
try {
|
|
611
661
|
ran = await runChecks(repo, state.checks);
|
|
@@ -662,18 +712,20 @@ async function checkAndPublish(repo: Repo, state: State) {
|
|
|
662
712
|
type: "text" as const,
|
|
663
713
|
text: `Integrated ${state.branch} and pushed ${outcome.pushed} to ${state.remote} ${upstreamRef}.`
|
|
664
714
|
+ (state.moves > 0 ? ` The target moved ${state.moves} time(s) before the push; the branch was rebased and checked again.` : "")
|
|
665
|
-
+ ` Session branch: ${branchNote}.` + ` Local branch: ${localNote}.` + ` Main checkout: ${mainNote}.`
|
|
715
|
+
+ ` Session branch: ${branchNote}.` + ` Local branch: ${localNote}.` + ` Main checkout: ${mainNote}.`
|
|
716
|
+
+ (finalizeChecks ? `\n${finalizeChecksNote(finalizeChecks)}` : "") + syncHint,
|
|
666
717
|
}],
|
|
667
718
|
details: {
|
|
668
719
|
ok: true, stage: "complete", commitSha: outcome.pushed, remote: state.remote, upstreamRef, branch: state.branch,
|
|
669
720
|
previousTarget: state.previousTarget, moves: state.moves, checks: ran, branchSync: branchNote, localBranch: localNote, mainCheckout: mainNote,
|
|
721
|
+
...(finalizeChecks ? { finalizeChecks } : {}),
|
|
670
722
|
...(files.length <= 1000 ? { files } : { filesTruncated: true }),
|
|
671
723
|
},
|
|
672
724
|
};
|
|
673
725
|
}
|
|
674
726
|
}
|
|
675
727
|
|
|
676
|
-
async function start(repo: Repo, params: { target?: string; checks?: string[] }) {
|
|
728
|
+
async function start(repo: Repo, params: { target?: string; checks?: string[] }, configured: ConfiguredChecksOptions) {
|
|
677
729
|
if (await rebaseInProgress(repo)) throw new IntegrateFailure("preflight", "a rebase is already in progress in this worktree; call git_integrate with action continue or abort.");
|
|
678
730
|
let branch = (await git(repo, ["symbolic-ref", "--short", "-q", "HEAD"])).stdout.trim();
|
|
679
731
|
if (!branch) {
|
|
@@ -714,10 +766,10 @@ async function start(repo: Repo, params: { target?: string; checks?: string[] })
|
|
|
714
766
|
} else {
|
|
715
767
|
await saveState(repo, state);
|
|
716
768
|
}
|
|
717
|
-
return checkAndPublish(repo, state);
|
|
769
|
+
return checkAndPublish(repo, state, configured);
|
|
718
770
|
}
|
|
719
771
|
|
|
720
|
-
async function resume(repo: Repo, params: { crossReviewHighRisk?: string[]; crossReviewWaiver?: string; slopGateWaiver?: string }) {
|
|
772
|
+
async function resume(repo: Repo, params: { crossReviewHighRisk?: string[]; crossReviewWaiver?: string; slopGateWaiver?: string }, configured: ConfiguredChecksOptions) {
|
|
721
773
|
const state = await readState(repo);
|
|
722
774
|
if (!state) throw new IntegrateFailure("preflight", "no git_integrate run is paused in this worktree; call git_integrate with action start.");
|
|
723
775
|
if (!(await rebaseInProgress(repo))) {
|
|
@@ -771,7 +823,7 @@ async function resume(repo: Repo, params: { crossReviewHighRisk?: string[]; cros
|
|
|
771
823
|
if (state.pendingManifest) await regenerateManifest(repo);
|
|
772
824
|
const replay = await driveRebase(repo, state, "continue");
|
|
773
825
|
if (!replay.done) return conflictResult(repo, state, replay.conflicts);
|
|
774
|
-
return checkAndPublish(repo, state);
|
|
826
|
+
return checkAndPublish(repo, state, configured);
|
|
775
827
|
}
|
|
776
828
|
|
|
777
829
|
async function abort(repo: Repo) {
|
|
@@ -806,7 +858,8 @@ export const integrateTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
806
858
|
name: "git_integrate",
|
|
807
859
|
label: "Git Integrate",
|
|
808
860
|
description:
|
|
809
|
-
"Publish this session's linked-worktree branch (wt/<topic>) to a target branch (default main) by rebasing it onto the fetched target inside this worktree only and fast-forward pushing it. Commit the work on the branch with git_finalize first. action start (default): refuses the main checkout, the target branch, a detached HEAD it cannot re-attach and tracked uncommitted changes; fetches the target under the repository finalizer lock (shared with git_finalize), rebases, runs `checks` (required: shell commands such as typecheck and tests, [] only when none apply), then re-fetches under the lock and pushes without force; if the target moved it rebases and checks again. After a successful push it deletes the session branch's own remote copy (wt/<topic>; wt/nightly-* is only updated) when that copy holds nothing beyond this worktree's work; once that copy is gone and the local branch tip is in the pushed commit, it also removes the local branch so finished wt branches leave branch lists (GitHub Desktop), detaching HEAD at the pushed commit and keeping the worktree folder and files (wt/nightly-* and non-wt branches stay). Continuing in that worktree needs no git command: git_finalize and git_integrate re-create the same branch at HEAD first (start returns up-to-date without re-creating it when HEAD has no new commit). On a conflict the rebase stays paused and the result lists the conflicted paths, the session commit being replayed and the target commits that touched them: edit the files to keep both intents (rewrite HANDOFF.md, doc/README.md and CHANGELOG.md for the combined state), then call action continue, which refuses leftover conflict markers and applies the git_finalize review gates (crossReviewHighRisk, crossReviewWaiver, slopGateWaiver) to the resolved files. crossReviewWaiver: explicit user instruction OR 2026-11-19 provider-limit exception after required Hydrogen also failed or could not be called (decision, reviewId, raw errors). Other tracked files you edit or stage while the rebase is paused become part of that step and are gated too. Tools/CUELO_Setup/files/source-integrity.json conflicts are regenerated from the merged tracked content automatically. action abort restores the branch. Failing checks stop before the push. Never run git rebase, merge or pull yourself."
|
|
861
|
+
"Publish this session's linked-worktree branch (wt/<topic>) to a target branch (default main) by rebasing it onto the fetched target inside this worktree only and fast-forward pushing it. Commit the work on the branch with git_finalize first. action start (default): refuses the main checkout, the target branch, a detached HEAD it cannot re-attach and tracked uncommitted changes; fetches the target under the repository finalizer lock (shared with git_finalize), rebases, runs `checks` (required: shell commands such as typecheck and tests, [] only when none apply), then re-fetches under the lock and pushes without force; if the target moved it rebases and checks again. After a successful push it deletes the session branch's own remote copy (wt/<topic>; wt/nightly-* is only updated) when that copy holds nothing beyond this worktree's work; once that copy is gone and the local branch tip is in the pushed commit, it also removes the local branch so finished wt branches leave branch lists (GitHub Desktop), detaching HEAD at the pushed commit and keeping the worktree folder and files (wt/nightly-* and non-wt branches stay). Continuing in that worktree needs no git command: git_finalize and git_integrate re-create the same branch at HEAD first (start returns up-to-date without re-creating it when HEAD has no new commit). On a conflict the rebase stays paused and the result lists the conflicted paths, the session commit being replayed and the target commits that touched them: edit the files to keep both intents (rewrite HANDOFF.md, doc/README.md and CHANGELOG.md for the combined state), then call action continue, which refuses leftover conflict markers and applies the git_finalize review gates (crossReviewHighRisk, crossReviewWaiver, slopGateWaiver) to the resolved files. crossReviewWaiver: explicit user instruction OR 2026-11-19 provider-limit exception after required Hydrogen also failed or could not be called (decision, reviewId, raw errors). Other tracked files you edit or stage while the rebase is paused become part of that step and are gated too. Tools/CUELO_Setup/files/source-integrity.json conflicts are regenerated from the merged tracked content automatically. action abort restores the branch. Failing checks stop before the push. Never run git rebase, merge or pull yourself."
|
|
862
|
+
+ " Matching .finalize-checks.json checks run before pushing the rebased tree. finalizeChecksWaiver: explicit user instruction only, for this call.",
|
|
810
863
|
parameters: pi.zod.object({
|
|
811
864
|
action: pi.zod.enum(["start", "continue", "abort"]).optional(),
|
|
812
865
|
target: pi.zod.string().optional(),
|
|
@@ -814,14 +867,16 @@ export const integrateTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
814
867
|
crossReviewHighRisk: pi.zod.array(pi.zod.string()).optional(),
|
|
815
868
|
crossReviewWaiver: pi.zod.string().optional(),
|
|
816
869
|
slopGateWaiver: pi.zod.string().optional(),
|
|
870
|
+
finalizeChecksWaiver: pi.zod.string().optional(),
|
|
817
871
|
}),
|
|
818
872
|
|
|
819
|
-
async execute(_toolCallId, params, onUpdate,
|
|
873
|
+
async execute(_toolCallId, params, onUpdate, ctx, signal) {
|
|
820
874
|
const action = params.action ?? "start";
|
|
821
875
|
const repo = await openRepo(pi.cwd, signal);
|
|
822
876
|
onUpdate?.({ content: [{ type: "text", text: `git_integrate ${action}: ${repo.root}` }], details: { phase: action } });
|
|
823
877
|
if (action === "abort") return abort(repo);
|
|
824
|
-
|
|
825
|
-
return
|
|
878
|
+
const configured = { sessionManager: ctx?.sessionManager, waiver: params.finalizeChecksWaiver };
|
|
879
|
+
if (action === "continue") return resume(repo, params, configured);
|
|
880
|
+
return start(repo, params, configured);
|
|
826
881
|
},
|
|
827
882
|
});
|
|
@@ -9009,6 +9009,103 @@ function operationFromNative(op: string): Operation | undefined {
|
|
|
9009
9009
|
patched: "\tlet phase = findPhaseByName(phases, targetPhase);\n\tif (!phase) {\n\t\tphase = { name: targetPhase, tasks: [] };\n",
|
|
9010
9010
|
},
|
|
9011
9011
|
...TODO_DEPENDENCY_EDITS,
|
|
9012
|
+
{
|
|
9013
|
+
file: "src/session/session-manager.ts",
|
|
9014
|
+
marker: "beginCueloTodoNudgeRequest(): void",
|
|
9015
|
+
anchor: "\tgetSessionId(): string {\n\t\treturn this.#sessionId;\n\t}",
|
|
9016
|
+
patched: ` getSessionId(): string {
|
|
9017
|
+
return this.#sessionId;
|
|
9018
|
+
}
|
|
9019
|
+
|
|
9020
|
+
// CUELO: this budget belongs to direct user input, not a prompt cycle or todo mutation.
|
|
9021
|
+
#cueloTodoNudgeRequest?: {
|
|
9022
|
+
sessionId: string;
|
|
9023
|
+
claimed: boolean;
|
|
9024
|
+
fifthReminder?: { content: string; atStop: boolean };
|
|
9025
|
+
};
|
|
9026
|
+
|
|
9027
|
+
beginCueloTodoNudgeRequest(): void {
|
|
9028
|
+
this.#cueloTodoNudgeRequest = { sessionId: this.#sessionId, claimed: false };
|
|
9029
|
+
}
|
|
9030
|
+
|
|
9031
|
+
getCueloTodoNudgeRequest() {
|
|
9032
|
+
const request = this.#cueloTodoNudgeRequest;
|
|
9033
|
+
return request?.sessionId === this.#sessionId ? request : undefined;
|
|
9034
|
+
}`,
|
|
9035
|
+
},
|
|
9036
|
+
{
|
|
9037
|
+
file: "src/extensibility/extensions/runner.ts",
|
|
9038
|
+
marker: '// CUELO: core also consumes direct input for the todo reminder budget.',
|
|
9039
|
+
anchor: "\thasHandlers(eventType: string): boolean {\n\t\tfor (const ext of this.extensions) {",
|
|
9040
|
+
patched: ` hasHandlers(eventType: string): boolean {
|
|
9041
|
+
// CUELO: core also consumes direct input for the todo reminder budget.
|
|
9042
|
+
if (eventType === "input") return true;
|
|
9043
|
+
for (const ext of this.extensions) {`,
|
|
9044
|
+
},
|
|
9045
|
+
{
|
|
9046
|
+
file: "src/extensibility/extensions/runner.ts",
|
|
9047
|
+
marker: "this.sessionManager.beginCueloTodoNudgeRequest();",
|
|
9048
|
+
anchor: ` ): Promise<InputEventResult> {
|
|
9049
|
+
if (!this.hasHandlers("input")) return {};
|
|
9050
|
+
const ctx = this.createContext();
|
|
9051
|
+
let currentText = text;
|
|
9052
|
+
let currentImages = images;
|
|
9053
|
+
|
|
9054
|
+
for (const ext of this.extensions) {
|
|
9055
|
+
for (const handler of ext.handlers.get("input") ?? []) {
|
|
9056
|
+
const event: InputEvent = { type: "input", text: currentText, images: currentImages, source };
|
|
9057
|
+
const result = (await this.#runHandlerWithTimeout(handler, event, ctx, ext, extensionHandlerTimeoutMs)) as`,
|
|
9058
|
+
patched: ` ): Promise<InputEventResult> {
|
|
9059
|
+
if (source === "interactive" || source === "rpc") this.sessionManager.beginCueloTodoNudgeRequest();
|
|
9060
|
+
let ctx: ExtensionContext | undefined;
|
|
9061
|
+
let currentText = text;
|
|
9062
|
+
let currentImages = images;
|
|
9063
|
+
|
|
9064
|
+
for (const ext of this.extensions) {
|
|
9065
|
+
for (const handler of ext.handlers.get("input") ?? []) {
|
|
9066
|
+
const event: InputEvent = { type: "input", text: currentText, images: currentImages, source };
|
|
9067
|
+
ctx ??= this.createContext();
|
|
9068
|
+
const result = (await this.#runHandlerWithTimeout(handler, event, ctx, ext, extensionHandlerTimeoutMs)) as`,
|
|
9069
|
+
},
|
|
9070
|
+
{
|
|
9071
|
+
file: "src/session/todo-tracker.ts",
|
|
9072
|
+
marker: "if (request?.claimed) return null;",
|
|
9073
|
+
anchor: "\ttakeMidRunNudge(): AgentMessage | null {\n\t\tconst mode = cfgTodoMidRunNudges.get(this.#host.settings);",
|
|
9074
|
+
patched: ` takeMidRunNudge(): AgentMessage | null {
|
|
9075
|
+
const request = this.#host.sessionManager.getCueloTodoNudgeRequest();
|
|
9076
|
+
if (request?.claimed) return null;
|
|
9077
|
+
const mode = cfgTodoMidRunNudges.get(this.#host.settings);`,
|
|
9078
|
+
},
|
|
9079
|
+
{
|
|
9080
|
+
file: "src/session/todo-tracker.ts",
|
|
9081
|
+
marker: "if (request) request.claimed = true;",
|
|
9082
|
+
// Claim only after the existing eligibility checks and prompt rendering succeed.
|
|
9083
|
+
anchor: '\t\treturn {\n\t\t\trole: "custom",\n\t\t\tcustomType: MID_RUN_NUDGE_MESSAGE_TYPE,',
|
|
9084
|
+
patched: ` if (request) request.claimed = true;
|
|
9085
|
+
return {
|
|
9086
|
+
role: "custom",
|
|
9087
|
+
customType: MID_RUN_NUDGE_MESSAGE_TYPE,`,
|
|
9088
|
+
},
|
|
9089
|
+
{
|
|
9090
|
+
file: "src/session/agent-session.ts",
|
|
9091
|
+
marker: "request.fifthReminder = undefined;",
|
|
9092
|
+
anchor: "\t\t\tthunks.push(() => this.#todo.takeMidRunNudge());",
|
|
9093
|
+
patched: ` thunks.push(() => this.#todo.takeMidRunNudge());
|
|
9094
|
+
thunks.push(() => {
|
|
9095
|
+
const request = this.sessionManager.getCueloTodoNudgeRequest();
|
|
9096
|
+
const reminder = request?.fifthReminder;
|
|
9097
|
+
if (!request || !reminder || (boundary === "stop" && !reminder.atStop && !hasDelivery)) return null;
|
|
9098
|
+
request.fifthReminder = undefined;
|
|
9099
|
+
return {
|
|
9100
|
+
role: "custom",
|
|
9101
|
+
customType: "todo-nudge",
|
|
9102
|
+
content: reminder.content,
|
|
9103
|
+
display: false,
|
|
9104
|
+
attribution: "agent",
|
|
9105
|
+
timestamp: Date.now(),
|
|
9106
|
+
};
|
|
9107
|
+
});`,
|
|
9108
|
+
},
|
|
9012
9109
|
{
|
|
9013
9110
|
// 2026-09-27 edit 거절 조사: 7일 거절 174건 중 68건이 직전 edit 응답의 새 태그를 기준으로 했다. edit 가
|
|
9014
9111
|
// 성공하면 새 스냅샷은 응답에 보인 몇 줄만 '본 줄' 로 갖고, 전에 읽은 바뀌지 않은 줄은 잃었다(1~43줄 read →
|