cuelo 0.10.53 → 0.10.55
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 +33 -33
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +2 -2
- package/.next/required-server-files.json +2 -2
- 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 +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- 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 +2 -2
- 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]/bash-output/route.js +1 -1
- package/.next/server/app/api/agent/[id]/bash-output/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- 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/cwd/validate/route.js +1 -1
- package/.next/server/app/api/cwd/validate/route.js.nft.json +1 -1
- package/.next/server/app/api/default-cwd/route.js +1 -1
- package/.next/server/app/api/default-cwd/route.js.nft.json +1 -1
- package/.next/server/app/api/display-settings/route.js +1 -1
- package/.next/server/app/api/display-settings/route.js.nft.json +1 -1
- package/.next/server/app/api/file-index/route.js +1 -1
- package/.next/server/app/api/file-index/route.js.nft.json +1 -1
- package/.next/server/app/api/files/[...path]/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/git/diff/route.js +1 -1
- package/.next/server/app/api/git/diff/route.js.nft.json +1 -1
- package/.next/server/app/api/git/status/route.js +1 -1
- package/.next/server/app/api/git/status/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 +2 -2
- package/.next/server/app/api/live/call/[callId]/route.js.nft.json +1 -1
- package/.next/server/app/api/live/events/route.js +2 -2
- package/.next/server/app/api/live/events/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/route.js +2 -2
- package/.next/server/app/api/live/interpret/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/mcp/route.js +1 -1
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/model-roles/route.js +1 -1
- package/.next/server/app/api/model-roles/route.js.nft.json +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/plugins/route.js.nft.json +1 -1
- package/.next/server/app/api/project-docs/route.js +1 -1
- package/.next/server/app/api/project-docs/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/projects/route.js +1 -1
- package/.next/server/app/api/projects/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/runs/[runId]/route.js +1 -1
- package/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
- package/.next/server/app/api/runs/[runId]/turns/route.js +1 -1
- package/.next/server/app/api/runs/[runId]/turns/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]/entries/[entryId]/thinking/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/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/sessions/search/route.js +1 -1
- package/.next/server/app/api/sessions/search/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js +1 -1
- package/.next/server/app/api/settings/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/search/route.js +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/subagents/eta/route.js +1 -1
- package/.next/server/app/api/subagents/eta/route.js.nft.json +1 -1
- package/.next/server/app/api/theme/route.js +1 -1
- package/.next/server/app/api/theme/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 +50 -15
- package/.next/server/app/api/update-maintenance/route.js.nft.json +1 -1
- package/.next/server/app/api/updates/route.js +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 +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js +18 -18
- 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 +3 -3
- package/.next/server/app/recover.segments/_full.segment.rsc +3 -3
- package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
- package/.next/server/app/recover.segments/_index.segment.rsc +3 -3
- package/.next/server/app/recover.segments/_tree.segment.rsc +2 -2
- 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 +33 -33
- package/.next/server/chunks/1008.js +7 -7
- package/.next/server/chunks/402.js +14 -0
- package/.next/server/chunks/5948.js +1 -0
- package/.next/server/chunks/6429.js +3 -3
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- 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-3b1f8b74c7fc5e77.js → layout-59ae71dee674bd98.js} +1 -1
- package/.next/static/chunks/app/page-5bff390ed0c94ee0.js +26 -0
- package/.next/static/css/1526dbff4bf3d372.css +1 -0
- package/.next/trace +108 -107
- package/.next/trace-build +1 -1
- package/README.md +11 -3
- package/Tools/CUELO_Setup/files/native-runtime-patch.js +3 -3
- package/Tools/CUELO_Setup/files/usage-server.js +277 -42
- package/Tools/OMP_Global_Config/agent/agents/maker.md +2 -2
- package/Tools/OMP_Global_Config/agent/rules/harness-policy.json +2 -2
- package/Tools/OMP_Global_Config/agent/rules/meta-harness.md +1 -1
- package/Tools/OMP_Global_Config/agent/sop/maker.md +1 -1
- package/Tools/OMP_Global_Config/agent/tools/artifact-search/index.ts +646 -0
- package/Tools/OMP_Global_Config/agent/tools/ego-browser/index.ts +232 -0
- package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +35 -0
- package/package.json +7 -7
- package/.next/server/chunks/5582.js +0 -14
- package/.next/static/chunks/app/page-efae4fdcf84b7a14.js +0 -26
- package/.next/static/css/7467faea1ab68673.css +0 -1
- /package/.next/static/{-mDQEyWQ8VQsAfLpiACIP → 0j_1y9tyocdXWP2cqYOR9}/_buildManifest.js +0 -0
- /package/.next/static/{-mDQEyWQ8VQsAfLpiACIP → 0j_1y9tyocdXWP2cqYOR9}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { CustomToolFactory } from "@oh-my-pi/pi-coding-agent";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
export type EgoProfile = "user" | "verify";
|
|
5
|
+
|
|
6
|
+
export interface EgoBrowserParams {
|
|
7
|
+
script: string;
|
|
8
|
+
profile?: EgoProfile;
|
|
9
|
+
finish?: boolean;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ExecResult {
|
|
14
|
+
code: number;
|
|
15
|
+
stdout: string;
|
|
16
|
+
stderr: string;
|
|
17
|
+
killed: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** `ego-browser <args>`를 실행하고 `input`을 stdin으로 넘긴다. 실행 파일이 없으면 code ENOENT로 throw한다. */
|
|
21
|
+
export type Exec = (args: string[], input: string, options: { timeoutMs: number; signal?: AbortSignal }) => Promise<ExecResult>;
|
|
22
|
+
|
|
23
|
+
export interface EgoDeps {
|
|
24
|
+
exec: Exec;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 프로필 정본: "user"는 ego 기본 프로필(사용자 로그인), "verify"는 사용자가 CUELO 화면 검증 전용으로 지정한 `Profile 2`. */
|
|
29
|
+
export const VERIFY_PROFILE_ID = "Profile 2";
|
|
30
|
+
export const DEFAULT_TIMEOUT_MS = 120_000;
|
|
31
|
+
export const MAX_TIMEOUT_MS = 600_000;
|
|
32
|
+
const MAX_HEAD = 20_000;
|
|
33
|
+
const MAX_TAIL = 8_000;
|
|
34
|
+
|
|
35
|
+
const UNAVAILABLE =
|
|
36
|
+
"ego_browser: 이 PC에는 ego lite가 없다(ego-browser 래퍼가 127로 끝났다). 이 PC에서는 ego_browser를 쓸 수 없으니 기존 `browser` 도구(OMP Relay)를 쓴다.";
|
|
37
|
+
|
|
38
|
+
/** 세션·프로필마다 고정된 TaskSpace 이름. 같은 이름은 ego가 새로 만들지 않고 이어 쓴다. 세션 id를 자르지 않아 다른 세션이 공간을 공유하지 않는다. */
|
|
39
|
+
export function spaceName(sessionId: string, profile: EgoProfile): string {
|
|
40
|
+
return `cuelo-${sessionId}-${profile}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** 이미 있는 공간에 profileId를 주면 ego가 거절한다. 그 거절만 profileId 없이 이어 쓰기로 바꾼다(그 밖의 오류는 그대로 던진다). */
|
|
44
|
+
export const RESUME_ERROR_MARKER = "only applies when creating";
|
|
45
|
+
|
|
46
|
+
/** 모델 스크립트 앞에 붙이는 머리말. `task`와 `page`(p1)를 묶는다. profileId는 공간을 처음 만들 때만 적용된다. */
|
|
47
|
+
export function buildPrelude(name: string, profile: EgoProfile): string {
|
|
48
|
+
const quoted = JSON.stringify(name);
|
|
49
|
+
const create = profile === "verify"
|
|
50
|
+
? `taskSpace(${quoted}, { profileId: ${JSON.stringify(VERIFY_PROFILE_ID)} }).catch((error) => {\n if (String(error?.message).includes(${JSON.stringify(RESUME_ERROR_MARKER)})) return taskSpace(${quoted});\n throw error;\n})`
|
|
51
|
+
: `taskSpace(${quoted})`;
|
|
52
|
+
return `const task = await ${create};\nconst page = task.page("p1");\n`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** finish가 true면 스크립트가 던져도 공간을 정리한다. 본문은 블록 안에서 돈다. */
|
|
56
|
+
export function buildScript(name: string, profile: EgoProfile, body: string, finish: boolean): string {
|
|
57
|
+
const prelude = buildPrelude(name, profile);
|
|
58
|
+
if (!finish) return `${prelude}${body}\n`;
|
|
59
|
+
return `${prelude}try {\n${body}\n} finally {\n await task.finish({ keep: [] });\n}\n`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 세션 종료 때 쓰는 정리 스크립트. 공간을 새로 만들지 않고 ego의 목록(listTaskSpaces)에서 이름으로 찾는다.
|
|
64
|
+
* `task.handOff()` 뒤에는 ownership이 "agentDelegatedToUser"로 바뀌고(0.6.0.16 실측), 사용자 소유 공간도 "agent"가 아니다.
|
|
65
|
+
* 에이전트가 만들고 아직 에이전트가 쥔 공간만 닫고, 나머지는 사용자 몫이라 그대로 둔다.
|
|
66
|
+
*/
|
|
67
|
+
export function buildCleanup(name: string): string {
|
|
68
|
+
return `const found = (await listTaskSpaces()).find((space) => space.name === ${JSON.stringify(name)});
|
|
69
|
+
if (found && found.createdBy === "agent" && found.ownership === "agent") {
|
|
70
|
+
await (await taskSpace(found.id)).finish({ keep: [] });
|
|
71
|
+
console.log("closed", found.id);
|
|
72
|
+
} else {
|
|
73
|
+
console.log("skipped", found ? found.ownership : "not found");
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function clip(text: string): string {
|
|
79
|
+
if (text.length <= MAX_HEAD + MAX_TAIL) return text;
|
|
80
|
+
return `${text.slice(0, MAX_HEAD)}\n… ${text.length - MAX_HEAD - MAX_TAIL}자 생략 …\n${text.slice(-MAX_TAIL)}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function isUnavailable(error: unknown): boolean {
|
|
84
|
+
return (error as NodeJS.ErrnoException | undefined)?.code === "ENOENT";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface EgoRun {
|
|
88
|
+
text: string;
|
|
89
|
+
spaceName: string;
|
|
90
|
+
profile: EgoProfile;
|
|
91
|
+
finished: boolean;
|
|
92
|
+
result: ExecResult;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function clampTimeout(value: number | undefined): number {
|
|
96
|
+
if (value === undefined || !Number.isFinite(value) || value <= 0) return DEFAULT_TIMEOUT_MS;
|
|
97
|
+
return Math.min(Math.floor(value), MAX_TIMEOUT_MS);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function runEgoBrowser(params: EgoBrowserParams, deps: EgoDeps, signal?: AbortSignal): Promise<EgoRun> {
|
|
101
|
+
if (!params.script || !params.script.trim()) throw new Error("ego_browser: script가 비어 있다.");
|
|
102
|
+
const profile: EgoProfile = params.profile ?? "user";
|
|
103
|
+
if (profile !== "user" && profile !== "verify") throw new Error(`ego_browser: profile은 "user" 또는 "verify"다: ${String(profile)}`);
|
|
104
|
+
const finish = params.finish === true;
|
|
105
|
+
const name = spaceName(deps.sessionId, profile);
|
|
106
|
+
const input = buildScript(name, profile, params.script, finish);
|
|
107
|
+
const timeoutMs = clampTimeout(params.timeoutMs);
|
|
108
|
+
let result: ExecResult;
|
|
109
|
+
try {
|
|
110
|
+
result = await deps.exec(["nodejs"], input, { timeoutMs, signal });
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (isUnavailable(error)) throw new Error(UNAVAILABLE);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
if (result.code === 127) {
|
|
116
|
+
const detail = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join("\n");
|
|
117
|
+
throw new Error(`${UNAVAILABLE}${detail ? `\n${detail}` : ""}`);
|
|
118
|
+
}
|
|
119
|
+
const label = `TaskSpace ${name} (${profile === "verify" ? `${VERIFY_PROFILE_ID}, 검증 전용` : "사용자 기본 프로필"})`;
|
|
120
|
+
// ego-browser nodejs는 console.log를 stderr로 보낸다. 성공 때는 두 스트림이 모두 스크립트 출력이다.
|
|
121
|
+
const clean = (text: string) => clip(text.trim());
|
|
122
|
+
const failed = result.killed || result.code !== 0;
|
|
123
|
+
const body = failed
|
|
124
|
+
? [result.stdout.trim() && clean(result.stdout), result.stderr.trim() && `[stderr]\n${clean(result.stderr)}`].filter(Boolean).join("\n")
|
|
125
|
+
: [result.stdout.trim() && clean(result.stdout), result.stderr.trim() && clean(result.stderr)].filter(Boolean).join("\n");
|
|
126
|
+
if (result.killed) {
|
|
127
|
+
throw new Error(`ego_browser: ${Math.round(timeoutMs / 1000)}초 안에 끝나지 않아 중단했다(또는 취소됨). ${label}은 남아 있을 수 있다. 같은 공간에서 다시 시도하거나 finish: true로 정리한다.${body ? `\n${body}` : ""}`);
|
|
128
|
+
}
|
|
129
|
+
if (result.code !== 0) {
|
|
130
|
+
throw new Error(`ego_browser: exit ${result.code}. ${label}${body ? `\n${body}` : ""}`);
|
|
131
|
+
}
|
|
132
|
+
const text = `${label}${finish ? " — 정리됨" : ""}\n${body || "(출력 없음)"}`;
|
|
133
|
+
return { text, spaceName: name, profile, finished: finish, result };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 기본 실행기: `ego-browser nodejs`를 띄우고 스크립트를 stdin으로 보낸다(pi.exec는 stdin이 없다).
|
|
138
|
+
* 시간 초과·취소 때는 자식 프로세스 그룹 전체를 죽이고 close를 기다리지 않고 바로 끝낸다. 래퍼가 만든 하위 프로세스가
|
|
139
|
+
* 파이프를 쥐고 있으면 close가 한참 늦게 오기 때문이다.
|
|
140
|
+
*/
|
|
141
|
+
export const defaultExec: Exec = (args, input, options) => {
|
|
142
|
+
const { promise, resolve, reject } = Promise.withResolvers<ExecResult>();
|
|
143
|
+
let stdout = "";
|
|
144
|
+
let stderr = "";
|
|
145
|
+
let settled = false;
|
|
146
|
+
const finish = (code: number, killed: boolean) => {
|
|
147
|
+
if (settled) return;
|
|
148
|
+
settled = true;
|
|
149
|
+
clearTimeout(timer);
|
|
150
|
+
options.signal?.removeEventListener("abort", abort);
|
|
151
|
+
resolve({ code, stdout, stderr, killed });
|
|
152
|
+
};
|
|
153
|
+
const child = spawn("ego-browser", args, { stdio: ["pipe", "pipe", "pipe"], detached: true });
|
|
154
|
+
const kill = () => {
|
|
155
|
+
try {
|
|
156
|
+
if (child.pid) process.kill(-child.pid, "SIGKILL");
|
|
157
|
+
} catch {
|
|
158
|
+
child.kill("SIGKILL");
|
|
159
|
+
}
|
|
160
|
+
finish(-1, true);
|
|
161
|
+
};
|
|
162
|
+
const abort = () => kill();
|
|
163
|
+
const timer = setTimeout(kill, options.timeoutMs);
|
|
164
|
+
if (options.signal?.aborted) abort();
|
|
165
|
+
else options.signal?.addEventListener("abort", abort, { once: true });
|
|
166
|
+
child.stdout.setEncoding("utf8").on("data", (chunk: string) => { stdout += chunk; });
|
|
167
|
+
child.stderr.setEncoding("utf8").on("data", (chunk: string) => { stderr += chunk; });
|
|
168
|
+
child.on("error", (error: NodeJS.ErrnoException) => {
|
|
169
|
+
if (settled) return;
|
|
170
|
+
settled = true;
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
options.signal?.removeEventListener("abort", abort);
|
|
173
|
+
reject(error);
|
|
174
|
+
});
|
|
175
|
+
child.on("close", (code) => finish(code ?? -1, code === null));
|
|
176
|
+
child.stdin.on("error", () => {});
|
|
177
|
+
child.stdin.end(input);
|
|
178
|
+
return promise;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/** 세션마다 한 번 불리는 팩토리. 상태는 클로저에 두고, ego 실행기는 주입할 수 있다(기본은 defaultExec). */
|
|
182
|
+
export function createFactory(exec: Exec): CustomToolFactory {
|
|
183
|
+
return (pi) => {
|
|
184
|
+
// 이 세션이 시작했을 수 있는 공간의 프로필. 호출이 중간에 실패해도 공간은 이미 생겼을 수 있어 실행 전에 넣는다.
|
|
185
|
+
const open = new Set<EgoProfile>();
|
|
186
|
+
let sessionId = "";
|
|
187
|
+
return {
|
|
188
|
+
name: "ego_browser",
|
|
189
|
+
label: "ego Browser",
|
|
190
|
+
loadMode: "essential",
|
|
191
|
+
description:
|
|
192
|
+
"Drive ego lite TaskSpaces (the `ego-browser` runtime) without a bash heredoc. Only on PCs where ego lite is installed (the tool says so and exits when it is not; then use the normal `browser` tool). "
|
|
193
|
+
+ "`script` is the body of an `ego-browser nodejs` script (ESM, top-level await, Node.js, not the page): the tool has already run `const task = await taskSpace(<name>)` and `const page = task.page(\"p1\")`, so use `task`/`page` directly. Browser-side JS goes inside `page.evaluate()`. "
|
|
194
|
+
+ "Run `ego-browser skill` once in bash to read the API guide. "
|
|
195
|
+
+ "One TaskSpace is kept per session and profile and resumed on every call (variables do not persist between calls, tabs and pages do). "
|
|
196
|
+
+ "`profile: \"user\"` (default) is the user's own ego profile with their logins; `profile: \"verify\"` is the dedicated verification profile (Profile 2, logged out everywhere) and MUST be used for CUELO screen/UI verification. "
|
|
197
|
+
+ "Never clear cookies, cache or storage (it hits the whole profile). For login, permission or CAPTCHA steps call `task.handOff()` and tell the user (it stops the script; do not retry or take control back until the user says continue). "
|
|
198
|
+
+ "Set `finish: true` on the last call to close the space (`task.finish({ keep: [] })`, also on error); spaces still open when the session ends are closed automatically unless they were handed off to the user. "
|
|
199
|
+
+ "Do not use relay (`browser.open`) for this unless the user names a tab that is already open.",
|
|
200
|
+
parameters: pi.zod.object({
|
|
201
|
+
script: pi.zod.string().describe("Script body; `task` and `page` (p1) are already defined"),
|
|
202
|
+
profile: pi.zod.enum(["user", "verify"]).optional().describe("user = the user's default ego profile (default); verify = Profile 2, verification only"),
|
|
203
|
+
finish: pi.zod.boolean().optional().describe("Close the TaskSpace after this script, even if it throws"),
|
|
204
|
+
timeoutMs: pi.zod.number().optional().describe(`Kill the script after this many ms (default ${DEFAULT_TIMEOUT_MS}, max ${MAX_TIMEOUT_MS})`),
|
|
205
|
+
}),
|
|
206
|
+
|
|
207
|
+
async execute(_toolCallId, params, _onUpdate, ctx, signal) {
|
|
208
|
+
const p = params as EgoBrowserParams;
|
|
209
|
+
sessionId = ctx.sessionManager.getSessionId();
|
|
210
|
+
const profile: EgoProfile = p.profile ?? "user";
|
|
211
|
+
open.add(profile);
|
|
212
|
+
const run = await runEgoBrowser(p, { exec, sessionId }, signal);
|
|
213
|
+
if (run.finished) open.delete(profile);
|
|
214
|
+
return { content: [{ type: "text", text: run.text }], details: { spaceName: run.spaceName, profile: run.profile, finished: run.finished } };
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
async onSession(event) {
|
|
218
|
+
if (event.reason !== "shutdown" || open.size === 0) return;
|
|
219
|
+
for (const profile of [...open]) {
|
|
220
|
+
open.delete(profile);
|
|
221
|
+
try {
|
|
222
|
+
await exec(["nodejs"], buildCleanup(spaceName(sessionId, profile)), { timeoutMs: 30_000 });
|
|
223
|
+
} catch {
|
|
224
|
+
// 종료 중 정리는 최선 노력이다. ego가 없거나 이미 닫혔으면 할 일이 없다.
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export default createFactory(defaultExec);
|
|
@@ -3539,6 +3539,35 @@ function resolveSubagentRetryFallbackCandidates(
|
|
|
3539
3539
|
(typeof options.modelPattern === "string" ? options.modelPattern : options.modelPattern?.[0]),
|
|
3540
3540
|
);
|
|
3541
3541
|
}`,
|
|
3542
|
+
// 18.12.6 에서만 성립하는 후보가 있어 옛 후보는 그 문자열이 있는 sdk.ts 를 후보에서 뺀다(excludes). 18.12.5 이하의 라이브 적용본은
|
|
3543
|
+
// 한 바이트도 바뀌지 않고, 옛 후보의 anchor·patched 도 그대로다.
|
|
3544
|
+
excludes: "const initialModel = `${model.provider}/${model.id}`;",
|
|
3545
|
+
alternates: [
|
|
3546
|
+
{
|
|
3547
|
+
// 2026-10-22 18.12.6 (ADAPT): upstream #16548 이 새 세션의 첫 model_change 를 `initialModel` 로 한 번 쓰고, 지연 패턴의 retry role 이
|
|
3548
|
+
// 있으면 같은 모델을 그 role 로 한 번 더 남기게 했다(체인 조회가 패턴 자신의 체인을 먼저 보게 하려는 것이다). 우리 몫은 첫 항목의
|
|
3549
|
+
// `resolvedModelIsFallback`·`requestedModel` 증거뿐이다. 둘째 항목(role)은 upstream 그대로 두고 첫 호출만 같은 증거를 싣는다.
|
|
3550
|
+
// 첫 항목이 기본 role 항목이라는 사실(재개 시 그 모델을 기본으로 복원)과 증거 계약은 18.12.5 와 같다.
|
|
3551
|
+
file: "src/sdk.ts",
|
|
3552
|
+
requires: "const initialModel = `${model.provider}/${model.id}`;",
|
|
3553
|
+
marker: "options.modelPatternAuthFallbackUsed === true",
|
|
3554
|
+
anchor: ` const initialModel = \`\${model.provider}/\${model.id}\`;
|
|
3555
|
+
sessionManager.appendModelChange(initialModel);`,
|
|
3556
|
+
patched: ` const initialModel = \`\${model.provider}/\${model.id}\`;
|
|
3557
|
+
// Both facts come from the caller's own report (\`modelPatternAuthFallbackUsed\`
|
|
3558
|
+
// / \`modelPatternRequested\`), because the resolution that produced them
|
|
3559
|
+
// runs inside a closure below. \`resolvedModelIsFallback\` is passed as
|
|
3560
|
+
// \`undefined\` unless a substitution is known, and \`requestedModel\` only when
|
|
3561
|
+
// a caller named a model: an unobserved value is never persisted as \`false\`.
|
|
3562
|
+
sessionManager.appendModelChange(
|
|
3563
|
+
initialModel,
|
|
3564
|
+
undefined,
|
|
3565
|
+
options.modelPatternAuthFallbackUsed === true ? true : undefined,
|
|
3566
|
+
options.modelPatternRequested ??
|
|
3567
|
+
(typeof options.modelPattern === "string" ? options.modelPattern : options.modelPattern?.[0]),
|
|
3568
|
+
);`,
|
|
3569
|
+
},
|
|
3570
|
+
],
|
|
3542
3571
|
},
|
|
3543
3572
|
{
|
|
3544
3573
|
// 실행부가 계산해 넘긴 대체 사실과 요청 selector 를 sdk 가 받는 옵션 필드.
|
|
@@ -13169,6 +13198,12 @@ function parentSubagentServiceTiers(
|
|
|
13169
13198
|
marker: 'if(!a.endsWith(".jsonl")||a.includes(".bak")||qPe(a))continue;let l=a.slice(0,-6),',
|
|
13170
13199
|
anchor: 'if(!a.endsWith(".jsonl")||a.includes(".bak")||qPe(a))continue;let l=a.slice(0,-6),',
|
|
13171
13200
|
patched: 'if(!a.endsWith(".jsonl")||a.includes(".bak")||qPe(a))continue;let l=a.slice(0,-6),',
|
|
13201
|
+
}, {
|
|
13202
|
+
// 2026-10-22 18.12.6: nMe는 같은 isAdvisorTranscriptName 함수다(`e===tMe||e.startsWith(\`${eMe}.\`)&&e.endsWith(kpe)`). minified 이름만 바뀌었다(RETIRE 유지).
|
|
13203
|
+
file: "dist/cli.js",
|
|
13204
|
+
marker: 'if(!a.endsWith(".jsonl")||a.includes(".bak")||nMe(a))continue;let l=a.slice(0,-6),',
|
|
13205
|
+
anchor: 'if(!a.endsWith(".jsonl")||a.includes(".bak")||nMe(a))continue;let l=a.slice(0,-6),',
|
|
13206
|
+
patched: 'if(!a.endsWith(".jsonl")||a.includes(".bak")||nMe(a))continue;let l=a.slice(0,-6),',
|
|
13172
13207
|
}],
|
|
13173
13208
|
},
|
|
13174
13209
|
// 18.4.5 는 /ratchet 을 새로 넣으면서 `src/ratchet/prelude.ts`(코드)와 `prelude.js`(eval 텍스트 자산)를 같은 stem 으로
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cuelo",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.55",
|
|
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": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"cueloBuild": {
|
|
32
32
|
"distribution": "cuelo",
|
|
33
|
-
"coreVersion": "18.12.
|
|
33
|
+
"coreVersion": "18.12.6"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=22.19.0",
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"test:coverage": "bun test --coverage ./app ./components ./hooks ./lib ./public ./bin ./install.test.mjs"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@oh-my-pi/pi-agent-core": "18.12.
|
|
93
|
-
"@oh-my-pi/pi-ai": "18.12.
|
|
94
|
-
"@oh-my-pi/pi-coding-agent": "18.12.
|
|
95
|
-
"@oh-my-pi/pi-tui": "18.12.
|
|
96
|
-
"@oh-my-pi/pi-utils": "18.12.
|
|
92
|
+
"@oh-my-pi/pi-agent-core": "18.12.6",
|
|
93
|
+
"@oh-my-pi/pi-ai": "18.12.6",
|
|
94
|
+
"@oh-my-pi/pi-coding-agent": "18.12.6",
|
|
95
|
+
"@oh-my-pi/pi-tui": "18.12.6",
|
|
96
|
+
"@oh-my-pi/pi-utils": "18.12.6",
|
|
97
97
|
"@seed-design/css": "2.8.0",
|
|
98
98
|
"@seed-design/react": "2.4.1",
|
|
99
99
|
"@seed-design/tailwind4-theme": "2.4.0",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
exports.id=5582,exports.ids=[5582,8741],exports.modules={1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>n,GO:()=>j,X:()=>l,_4:()=>d,cV:()=>k,jL:()=>f,kv:()=>e,oC:()=>m});let d=262144,e=0xa00000,f=0xa00000,g={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},h={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm",webm:"audio/webm"},i={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function j(a){return(a.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function k(a){return g[j(a)]??null}function l(a){return h[j(a)]??null}function m(a){return i[j(a)]??null}function n(a){let b=j(a);return"pdf"===b||"docx"===b?b:null}},5908:(a,b,c)=>{"use strict";function d(a,b={}){let c=b.intervalMs??6e4,e=b.now??Date.now,f=new Map,g=new Map;return{recover:(b,d={})=>{let h=g.get(b);if(h)return h.then(a=>({...a,shared:!0}));let i=e(),j=f.get(b);if(!d.force&&void 0!==j&&i-j<c)return Promise.resolve({outcome:"throttled",shared:!1});f.set(b,i);let k=a.refreshProvider(b,"online").then(()=>({outcome:"refreshed",shared:!1})).catch(a=>({outcome:"failed",shared:!1,error:function(a){let b=[],c=a;for(let a=0;a<3&&void 0!==c;a+=1){if(c instanceof Error){b.push(c.message),c=c.cause;continue}if("object"==typeof c&&null!==c){let a=c;"string"==typeof a.message&&b.push(a.message),"string"==typeof a.code&&b.push(a.code),"number"==typeof a.status&&b.push(`HTTP ${a.status}`),c=a.cause;continue}b.push(String(c));break}let d=b.join(" "),e=d.match(/\b(?:HTTP\s*)?([45]\d{2})\b/i)?.[1];if("401"===e||"403"===e||/\b(?:api[- ]?key|credential|authentication|unauthorized|forbidden)\b/i.test(d))return e?`provider authentication failed (HTTP ${e})`:"provider authentication failed";let f=d.match(/\b(EAI_AGAIN|ECONNREFUSED|ECONNRESET|ENETUNREACH|ENOTFOUND|ETIMEDOUT|UND_ERR_CONNECT_TIMEOUT|UND_ERR_HEADERS_TIMEOUT|UND_ERR_BODY_TIMEOUT)\b/i)?.[1];return f?f.toUpperCase():/\b(?:timed?\s*out|timeout)\b/i.test(d)?"request timed out":e?`HTTP ${e}`:"discovery request failed"}(a)})).finally(()=>{g.get(b)===k&&g.delete(b)});return g.set(b,k),k}}}function e(a){return a.providerKnown?"failed"===a.recovery.outcome?`Model ${a.selector} is not in the model list and the discovery refresh for provider "${a.provider}" failed: ${a.recovery.error??"unknown error"}.`:"throttled"===a.recovery.outcome?`Model ${a.selector} is not in the model list. Discovery for provider "${a.provider}" was refreshed recently, so this lookup did not fetch again.`:`Model ${a.selector} is not in the model list after refreshing discovery for provider "${a.provider}".`:`Unknown model provider "${a.provider}" for ${a.selector}: the provider is not registered.`}c.d(b,{fw:()=>d,zX:()=>e})},12039:(a,b,c)=>{"use strict";function d(a){if("assistant"!==a.role)return a;let b=a.content;if(!Array.isArray(b))return a;let c=b.map(a=>("object"!=typeof a||null===a||Array.isArray(a)||"toolCall"!==a.type?null:{type:"toolCall",toolCallId:"string"==typeof a.toolCallId?a.toolCallId:"string"==typeof a.id?a.id:"",toolName:"string"==typeof a.toolName?a.toolName:"string"==typeof a.name?a.name:"",input:"object"!=typeof a.input||null===a.input||Array.isArray(a.input)?"object"!=typeof a.arguments||null===a.arguments||Array.isArray(a.arguments)?{}:a.arguments:a.input})??a);return{...a,content:c}}c.d(b,{B:()=>d})},24923:(a,b,c)=>{"use strict";c.d(b,{IL:()=>u,KI:()=>q,P9:()=>s,RL:()=>n,l:()=>t,lP:()=>o});var d=c(79646),e=c(29021),f=c(33873),g=c(28354),h=c(25252),i=c(90811);let j=(0,g.promisify)(d.execFile);function k(){return globalThis.__ompProjectCache||(globalThis.__ompProjectCache=new Map),globalThis.__ompProjectCache}function l(a){let b=k().get(a);return b&&b.expiresAt>Date.now()?b:void 0}function m(){globalThis.__ompProjectCache?.clear()}function n(a){let b=l(a);if(b)return"info"in b?b.info:b.grouping}function o(a){let b=n(a);if(b)return b;let c={projectRoot:a,branch:null,isWorktree:!1};return k().set(a,{grouping:c,expiresAt:Date.now()+6e4}),c}async function p(a,b,c){let{stdout:d}=await j(c?.command??"git",b,{cwd:a,timeout:1e4,maxBuffer:1048576,env:{...process.env,LC_ALL:"C"}});return d.trim()}async function q(a){let b,c=l(a);if(c&&"info"in c)return c.info;let d=k();try{if(!(0,e.existsSync)(a))return b=function(a){let b=(0,f.dirname)(a);if(!b.endsWith("-worktrees"))return null;let c=b.slice(0,-10);return c&&(0,e.existsSync)((0,f.join)(c,".git"))?{projectRoot:c,branch:(0,f.basename)(a),isWorktree:!0,isTopLevel:!0}:null}(a)??{projectRoot:a,branch:null,isWorktree:!1,isTopLevel:!1},d.set(a,{info:b,expiresAt:Date.now()+6e4}),b;let c=await (0,i.cu)(a),[g,h,j,k]=(await p(a,["rev-parse","--path-format=absolute","--git-common-dir","--git-dir","--show-toplevel","--abbrev-ref","HEAD"],c)).split("\n").map(a=>a.trim()),l=c.toPosix(g),m=c.toPosix(h),n=c.toPosix(j),o=a;try{o=(0,e.realpathSync)(a)}catch{}let q=n===o,r=m!==l&&q;b={projectRoot:r?(0,f.dirname)(l):a,branch:k&&"HEAD"!==k?k:null,isWorktree:r,isTopLevel:q}}catch{b={projectRoot:a,branch:null,isWorktree:!1,isTopLevel:!1}}return d.set(a,{info:b,expiresAt:Date.now()+6e4}),b}async function r(a){let b=await (0,i.cu)(a),c=b.toPosix(await p(a,["rev-parse","--path-format=absolute","--git-common-dir"],b));return(0,f.dirname)(c)}async function s(a){let b=await (0,i.cu)(a),c=await p(a,["worktree","list","--porcelain"],b),d=[],f=null,g=()=>{f?.path&&!f.prunable&&(0,e.existsSync)(f.path)&&d.push({path:f.path,branch:f.branch??null,isMain:0===d.length}),f=null};for(let a of c.split("\n"))if(a.startsWith("worktree ")){g();let c=a.slice(9).trim();f={path:b.toPosix(c),linuxRegistered:b.windows&&c.startsWith("/")}}else a.startsWith("branch ")&&f?f.branch=a.slice(7).trim().replace(/^refs\/heads\//,""):a.startsWith("prunable")&&f?f.linuxRegistered||(f.prunable=!0):""===a.trim()&&g();return g(),d}async function t(a,b){let c=b.trim();if(!c)throw Error("Branch name is required");let d=c.replace(/[\/\\:*?"<>|\s]+/g,"-").replace(/^-+|-+$/g,"");if(!d)throw Error(`Invalid branch name: ${b}`);let g=await r(a),i=`${(0,f.resolve)(g)}-worktrees`,j=(0,f.join)(i,d);if((0,e.existsSync)(j))throw Error(`Directory already exists: ${j}`);(0,e.mkdirSync)(i,{recursive:!0});let k=!1;try{await p(g,["rev-parse","--verify","--quiet",`refs/heads/${c}`]),k=!0}catch{k=!1}try{k?await p(g,["worktree","add","--",j,c]):await p(g,["worktree","add","-b",c,"--",j])}catch(a){throw Error(v(a))}return(0,h.wz)(j),m(),{path:j,branch:c}}async function u(a,b,c=!1){let d=(await s(a)).find(a=>a.path===b);if(!d)throw Error(`Not a worktree of this repository: ${b}`);if(d.isMain)throw Error("Cannot remove the main worktree");try{await p(a,["worktree","remove",...c?["--force"]:[],b])}catch(a){throw Error(v(a))}m()}function v(a){let b=a.stderr;return"string"==typeof b&&b.trim()?b.trim():a instanceof Error?a.message:String(a)}},25252:(a,b,c)=>{"use strict";function d(a){return a.replace(/\\/g,"/")}function e(){return globalThis.__ompAdditionalAllowedRoots||(globalThis.__ompAdditionalAllowedRoots=new Set),globalThis.__ompAdditionalAllowedRoots}function f(a){if(!a)return;let b=d(a);e().add(b),globalThis.__ompAllowedRootsCache?.roots.add(b)}c.d(b,{HM:()=>e,Nw:()=>d,wz:()=>f})},36208:(a,b,c)=>{"use strict";c.d(b,{Lg:()=>l,Ly:()=>j,Qw:()=>d,YC:()=>i,e6:()=>f,iH:()=>e,we:()=>m});let d=8388608,e=12e4,f=250,g=/^att_[0-9a-f]{32}$/,h=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function i(a){return"string"==typeof a&&g.test(a)}function j(a){return"string"==typeof a&&h.test(a)}let k={".mp3":"audio/mpeg",".wav":"audio/wav",".wave":"audio/wav",".m4a":"audio/mp4",".ogg":"audio/ogg",".oga":"audio/ogg",".opus":"audio/ogg",".flac":"audio/flac",".webm":"audio/webm",".aac":"audio/aac",".aif":"audio/aiff",".aiff":"audio/aiff"};function l(a){let b=a.name.toLocaleLowerCase(),c=b.lastIndexOf("."),d=c>0?k[b.slice(c)]:void 0;if(d)return d;let e=a.type.toLocaleLowerCase().split(";",1)[0]?.trim();return e?.startsWith("audio/")?e:null}function m(a){return function(a){let b;if(!a.startsWith(n))return null;let c=a.indexOf("\n");if(c<0)return null;let f=a.slice(0,c);if(!f.endsWith(o))return null;try{b=JSON.parse(f.slice(n.length,-o.length))}catch{return null}if(!function(a){if(!a||"object"!=typeof a||!Number.isSafeInteger(a.userMessageLength)||(a.userMessageLength??-1)<0||!Array.isArray(a.documents)||0===a.documents.length||a.documents.length>3)return!1;let b=0,c=0;for(let f of a.documents){if(!f||"object"!=typeof f||"string"!=typeof f.name||0===f.name.length||"text/markdown"!==f.mimeType&&"text/plain"!==f.mimeType&&"application/pdf"!==f.mimeType||!Number.isSafeInteger(f.size)||(f.size??-1)<0||(f.size??0)>d||!Number.isSafeInteger(f.textLength)||(f.textLength??-1)<0||(f.textLength??0)>e)return!1;b+=f.size??0,c+=f.textLength??0}return b<=0x1000000&&c<=24e4}(b))return null;let g=c+1;if(!a.startsWith(p,g))return null;let h=(g+=p.length)+b.userMessageLength;if(h>a.length)return null;let i=a.slice(g,h);if(g=h,!a.startsWith(q,g))return null;g+=q.length;let j=[];for(let c=0;c<b.documents.length;c+=1){var k,l,m;let d=b.documents[c],e=(k=c,l=d,`
|
|
2
|
-
--- Begin attached document ${k+1}: ${JSON.stringify(l.name)} (${l.mimeType}, ${l.size} bytes) ---
|
|
3
|
-
`);if(!a.startsWith(e,g))return null;let f=(g+=e.length)+d.textLength;if(f>a.length)return null;let h=a.slice(g,f);g=f;let i=(m=c,`
|
|
4
|
-
--- End attached document ${m+1} ---`);if(!a.startsWith(i,g))return null;g+=i.length,j.push({name:d.name,mimeType:d.mimeType,size:d.size,text:h})}return g===a.length?{message:i,documents:j}:null}(a)?.message??a}let n="\x3c!-- omp-web-document-context-v1:",o=" --\x3e",p="User message:\n",q="\n\nAttached documents (locally extracted text supplied by the user):\n"},38741:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{findModelWithRecovery:()=>m,getOmpRuntime:()=>i,getSettingsForCwd:()=>j,invalidateOmpRuntime:()=>k,missingModelRecoveryFor:()=>l,recoverMissingModelRefs:()=>n});var e=c(92582),f=c(5908),g=a([e]);async function h(){let a=(0,e.getAgentDir)(),b=await e.Settings.init({agentDir:a}),c=await (0,e.discoverAuthStorage)(a),d=new e.ModelRegistry(c);return await d.refresh("online-if-uncached"),{agentDir:a,settings:b,authStorage:c,modelRegistry:d}}function i(){return globalThis.__ompRuntimePromise??=h().catch(a=>{throw globalThis.__ompRuntimePromise=void 0,a}),globalThis.__ompRuntimePromise}async function j(a){let{settings:b}=await i();return a&&b.getCwd()!==a?b.cloneForCwd(a):b}function k(){globalThis.__ompRuntimePromise=void 0}function l(a){let b=globalThis.__ompMissingModelRecovery??=new WeakMap,c=b.get(a);return c||(c=(0,f.fw)(a),b.set(a,c)),c}async function m(a,b,c,d={}){let e=a.find(b,c);if(e)return{model:e};let f=await l(a).recover(b,{force:d.forceDiscovery}),g=a.find(b,c);return g?{model:g}:{miss:{selector:`${b}/${c}`,provider:b,providerKnown:a.hasProvider(b),recovery:f}}}async function n(a,b){let c=new Set;for(let d of b)d.provider&&d.modelId&&(a.find(d.provider,d.modelId)||c.add(d.provider));0!==c.size&&await Promise.all([...c].map(b=>l(a).recover(b)))}e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},40402:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$M:()=>e.getAgentDir,BR:()=>L,DK:()=>N,O5:()=>C,O8:()=>K,R7:()=>P,Uv:()=>R,dQ:()=>T,eP:()=>M,kc:()=>O,mD:()=>F,os:()=>I,u1:()=>J,wb:()=>E,zH:()=>B});var e=c(92582),f=c(48331),g=c(5969),h=c(29021),i=c(79748),j=c(33873),k=c(69610),l=c(53739),m=c(40575),n=c(38741),o=c(12039),p=c(50880),q=c(45902),r=c(24923),s=c(36208),t=c(87576),u=c(85821),v=c(77356),w=a([e,f,g,l,m,n]);[e,f,g,l,m,n]=w.then?(await w)():w;let Y=["GIT_DIR","GIT_COMMON_DIR","GIT_WORK_TREE","GIT_CEILING_DIRECTORIES","GIT_DISCOVERY_ACROSS_FILESYSTEM","GIT_OBJECT_DIRECTORY"];async function x(a){try{return{isDirectory:(await (0,i.stat)(a)).isDirectory()}}catch(b){let a=b.code;return"ENOENT"!==a&&"ENOTDIR"!==a&&null}}async function y(a){let[b,c]=await Promise.all([x((0,j.join)(a,".git")),x((0,j.join)(a,"HEAD"))]);return!1!==c||null===b?"git":!1===b||b.isDirectory&&await x((0,j.join)(a,".git","commondir"))===!1?"clear":"git"}async function z(a,b){let c;if(Y.some(a=>void 0!==process.env[a]))return!1;try{if(!(0,h.existsSync)(a))return!1;c=(0,h.realpathSync)(a)}catch{return!1}for(;;){let a=b.get(c);if(a||(a=y(c),b.set(c,a)),await a==="git")return!1;let d=(0,j.dirname)(c);if(d===c)return!0;c=d}}async function A(a,b){let c=(0,r.RL)(a);return c||(await z(a,b)?(0,r.lP)(a):(0,r.KI)(a))}async function B(a){let b=[...new Set(a.map(a=>a.cwd).filter(Boolean))],c=new Map,d=new Map;return await Promise.all(b.map(async a=>{c.set(a,await A(a,d))})),a.map(a=>{let b=a.cwd?c.get(a.cwd):void 0;return{...a,projectRoot:b?.projectRoot??a.cwd,...b?.isWorktree&&b.branch?{worktreeBranch:b.branch}:{}}})}function C(a,b){let c=new Map(b.map(a=>[a.id,a]));for(let b of a)c.set(b.id,b);return[...c.values()].sort((a,b)=>b.modified.localeCompare(a.modified))}let Z="(no messages)";async function D(){let a=await e.SessionManager.listAll(),b=new Map;for(let c of a)b.set((0,q.$)(c.path),c.id);let c=a.map(a=>{K(a.id,a.path);let c=function(a){if(a.firstMessage&&a.firstMessage!==Z)return a.firstMessage;if(!(a.size>4096))return null;let b=a.modified instanceof Date?a.modified:new Date(String(a.modified)),c=globalThis.__ompSessionFirstMessageCache??=new Map,d=(0,q.$)(a.path),e=c.get(d);if(e&&e.mtimeMs===b.getTime()&&e.size===a.size)return e.text;let f=function(a){let b;try{b=(0,h.openSync)(a,"r");let d=new TextDecoder,e=Buffer.alloc(65536),f="",g=0;for(;g<1048576;){let a=(0,h.readSync)(b,e,0,e.length,g);if(a<=0)break;g+=a;let i=(f+=d.decode(e.subarray(0,a),{stream:!0})).split("\n");for(let a of(f=i.pop()??"",i)){var c;let b;if(!a.includes('"role":"user"'))continue;try{b=JSON.parse(a)}catch{continue}if(!b||"object"!=typeof b||!("type"in b)||"message"!==b.type||!("message"in b))continue;let d=b.message;if(!d||"object"!=typeof d||!("role"in d)||"user"!==d.role)continue;let e=(c="content"in d?d.content:void 0,"string"==typeof c?c.trim():Array.isArray(c)?c.map(a=>a&&"object"==typeof a&&"type"in a&&"text"===a.type&&"text"in a&&"string"==typeof a.text?a.text:"").filter(Boolean).join(" ").trim():"");if(e)return e}}return null}catch{return null}finally{void 0!==b&&(0,h.closeSync)(b)}}(a.path);return c.set(d,{mtimeMs:b.getTime(),size:a.size,text:f}),f}(a);return{path:a.path,id:a.id,cwd:a.cwd,name:a.title,created:a.created instanceof Date?a.created.toISOString():String(a.created),modified:function(a){let b=a.modified instanceof Date?a.modified:new Date(String(a.modified)),c=Number.isFinite(b.getTime())?b.toISOString():String(a.modified),d=globalThis.__ompSessionActivityCache??=new Map,e=(0,q.$)(a.path),f=d.get(e);if(f&&f.mtimeMs===b.getTime()&&f.size===a.size)return f.at??c;let g=function(a){let b;try{b=(0,h.openSync)(a,"r");let c=(0,h.fstatSync)(b).size,d=Buffer.alloc(0),e=0,f=!1;for(;;){let a=e>0?d.lastIndexOf(10,e-1):-1;if(a<0&&c>0){if(!f&&d.length>=65536||d.length>=8388608)return null;let a=Math.min(65536,c),g=Buffer.alloc(a);c-=a,(0,h.readSync)(b,g,0,a,c),d=Buffer.concat([g,d]),e+=a;continue}let g=d.toString("utf8",a+1,e).trim();if(e=Math.max(a,0),g){if(!f&&!g.includes(l.SESSION_EXIT_CUSTOM_TYPE))return null;let a=JSON.parse(g);if(!a||"object"!=typeof a)return null;if("type"in a&&"custom"===a.type&&"customType"in a&&a.customType===l.SESSION_EXIT_CUSTOM_TYPE)f=!0;else{if(!f)return null;let b="timestamp"in a?a.timestamp:void 0;return"string"==typeof b&&Number.isFinite(Date.parse(b))?new Date(b).toISOString():null}}if(a<0)return null}}catch{return null}finally{void 0!==b&&(0,h.closeSync)(b)}}(a.path);return d.set(e,{mtimeMs:b.getTime(),size:a.size,at:g}),g??c}(a),messageCount:c?Math.max(a.messageCount,1):a.messageCount,firstMessage:(0,s.we)(c??"")||Z,parentSessionId:a.parentSessionPath?b.get((0,q.$)(a.parentSessionPath)):void 0,transient:!1}});return B(c)}async function E(a={}){a.force&&F();let b=globalThis.__ompSessionListGeneration??0;if(globalThis.__ompSessionListCache&&Date.now()-globalThis.__ompSessionListCache.ts<$)return globalThis.__ompSessionListCache.data;if(globalThis.__ompSessionListPromise&&globalThis.__ompSessionListPromiseGeneration===b)return globalThis.__ompSessionListPromise;let c=D().then(a=>(globalThis.__ompSessionListGeneration??0)!==b?E():(globalThis.__ompSessionListCache={data:a,ts:Date.now()},a)).finally(()=>{globalThis.__ompSessionListPromise===c&&(globalThis.__ompSessionListPromise=void 0,globalThis.__ompSessionListPromiseGeneration=void 0)});return globalThis.__ompSessionListPromise=c,globalThis.__ompSessionListPromiseGeneration=b,c}let $=3e4;function F(){globalThis.__ompSessionListGeneration=(globalThis.__ompSessionListGeneration??0)+1,globalThis.__ompSessionListCache=void 0}function G(){return globalThis.__ompSessionPathCache||(globalThis.__ompSessionPathCache=new Map),globalThis.__ompSessionPathCache}function H(){return globalThis.__ompPathToSessionIdCache||(globalThis.__ompPathToSessionIdCache=new Map),globalThis.__ompPathToSessionIdCache}async function I(a){let b=G().get(a);return b&&(0,h.existsSync)(b)?b:(b&&L(a),await E(),G().get(a)??null)}async function J(a){let b=(0,q.$)(a),c=H().get(b);return c||(await E(),H().get(b))}function K(a,b){let c=(0,j.normalize)(b),d=(0,q.$)(c),e=G(),f=H(),g=e.get(a),h=g?(0,q.$)(g):void 0,i=f.get(d),k=i?e.get(i):void 0;h&&h!==d&&f.get(h)===a&&f.delete(h),i&&i!==a&&k&&(0,q.$)(k)===d&&e.delete(i),e.set(a,c),f.set(d,a)}function L(a){let b=G(),c=H(),d=b.get(a);b.delete(a);let e=d?(0,q.$)(d):void 0;e&&c.get(e)===a&&c.delete(e)}function M(a){let b=(0,h.openSync)(a,"r");try{let a=[],c=0,d=!1;for(;c<65536&&!d;){let e=Buffer.allocUnsafe(Math.min(4096,65536-c)),f=(0,h.readSync)(b,e,0,e.length,c);if(0===f)break;let g=e.subarray(0,f),i=g.indexOf(10);a.push(-1===i?g:g.subarray(0,i)),c+=f,d=-1!==i}if(!d&&c>=65536)return null;let e=Buffer.concat(a).toString("utf8").trimEnd();if(!e)return null;try{let a=JSON.parse(e);return"session"===a.type?a:null}catch{return null}}finally{(0,h.closeSync)(b)}}async function N(a){return(await e.SessionManager.open(a)).getEntries()}function O(a,b,c){if(null===c)return[];let d=(c?b.get(c):void 0)??a[a.length-1];if(!d)return[];let e=[],f=new Set,g=d;for(;g&&!f.has(g.id);)f.add(g.id),e.push(g),g=g.parentId?b.get(g.parentId):void 0;return e.reverse()}function P(a){let b=-1;for(let c=a.length-1;c>=0;c--)if("compaction"===a[c].type){b=c;break}if(-1===b)return{displayed:a,hidden:[]};let c=a[b],d=[],e=[],f=!1;for(let g=0;g<b;g++)a[g].id===c.firstKeptEntryId&&(f=!0),(f?d:e).push(a[g]);return{displayed:[...d,c,...a.slice(b+1)],hidden:e}}function Q(a){let b=a.fallback??a.default;if(!b)return null;let c=b.indexOf("/");return c<=0?null:{provider:b.slice(0,c),modelId:b.slice(c+1)}}function R(a,b,c={}){let d=new Map;for(let b of a)d.set(b.id,b);let f=(0,e.buildSessionContext)(a,b,d,{transcript:!0,collapseCompactedHistory:!0}),g=O(a,d,b),{displayed:h,hidden:i}=P(g),j=[],l=[];for(let a of h){let b=X(a,c);b&&(j.push(function a(b){let c;if("string"==typeof b){if(b.length<=5e5||b.startsWith("data:image/"))return b;let a=b.slice(0,5e5-_.length),c=a.charCodeAt(a.length-1);return c>=55296&&c<=56319&&(a=a.slice(0,-1)),a+_}if(Array.isArray(b)){let c;for(let d=0;d<b.length;d++){let e=a(b[d]);e!==b[d]&&((c??=b.slice())[d]=e)}return c??b}if(!V(b)||W(b))return b;for(let d in b){if(!Object.hasOwn(b,d))continue;let e=a(b[d]);e!==b[d]&&((c??={...b})[d]=e)}return c??b}(b)),l.push(a.id))}return{messages:j,entryIds:l,thinkingLevel:f.thinkingLevel??"off",configuredThinkingLevel:f.configuredThinkingLevel??f.thinkingLevel??"off",thinkingCeiling:(0,v.hi)(g),model:Q(f.models),compactedWork:function(a){let b=[],c=!1;for(let d of a){let a=X(d,{}),e=a?(0,k.sh)(a):null;e&&("user"!==e.role||b.at(-1)?.role!=="user")&&("user"!==e.role&&(c=!0),b.push(e))}let d=(0,m.getLatestTodoSnapshotIdentity)(a)?(0,m.getLatestTodoPhasesFromEntries)(a):null;return c||d?{messages:c?b:[],todoPhases:d}:null}(i)}}function S(a){if(V(a)&&"contextSnapshot"in a)return V(a.contextSnapshot)?a.contextSnapshot:void 0}async function T(a,b){let c,d,h,i=new Map;for(let b of a)i.set(b.id,b);let j=(0,e.buildSessionContext)(a,b,i),k=Q(j.models);if(!k)return;try{let{modelRegistry:a}=await (0,n.getOmpRuntime)(),b=a.find(k.provider,k.modelId),e=b?.contextWindow;if("number"!=typeof e||!Number.isFinite(e)||e<=0)return;c=e,d=new f.Tokenizer(b)}catch{return}let l=O(a,i,b),m=-1;for(let a=l.length-1;a>=0;a-=1)if("compaction"===l[a].type){m=a;break}for(let a=l.length-1;a>m;a-=1){let b=l[a];if("message"!==b.type||"assistant"!==b.message.role)continue;let c=b.message,d=S(c);if("aborted"!==c.stopReason&&"error"!==c.stopReason&&c.usage&&(d||(0,g.hasContextTokenUsage)(c.usage))){h=c;break}}if(!h)return;let o=S(h),p=o?.promptTokens,q="number"==typeof p&&Number.isFinite(p)?p:(0,g.calculatePromptTokens)(h.usage);if(!Number.isFinite(q)||q<0)return;let r=j.messages,s=-1;for(let a=r.length-1;a>=0;a-=1){let b=r[a];if(b===h||"assistant"===b.role&&b.timestamp===h.timestamp){s=a;break}}let t=0;if(s>=0)for(let a=s+1;a<r.length;a+=1)t+=d.countMessage(r[a]);let u=Math.max(0,q+t);return{tokens:u,contextWindow:c,percent:u/c*100}}function U(a){let b=Date.parse(a);return Number.isNaN(b)?void 0:b}function V(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function W(a){let b,c;if(!V(a)||"image"!==a.type||("string"==typeof a.data?(b=a.data,c="string"==typeof a.mimeType?a.mimeType:void 0):V(a.source)&&"base64"===a.source.type&&"string"==typeof a.source.data&&(b=a.source.data,c="string"==typeof a.source.media_type?a.source.media_type:void 0),!b))return null;let d=b.endsWith("==")?2:+!!b.endsWith("=");return{bytes:Math.max(0,Math.floor(3*b.length/4)-d),mime:c}}let _="\n\n[Session persistence truncated large content]";function X(a,b){switch(a.type){case"message":{let c=function(a){if("assistant"!==a.role)return a;let{providerPayload:b,...c}=a,d=a.content.map(a=>{if(!("thinkingSignature"in a)&&!("textSignature"in a))return a;let{thinkingSignature:b,textSignature:c,...d}=a;return d});return{...c,content:d}}((0,o.B)(a.message)),d=b.deferToolResultImages?function(a){if("toolResult"!==a.role)return a;let b=0,c=0,d=new Set,e=a.content.filter(a=>{let e=W(a);return!e||(b+=1,c+=e.bytes,e.mime&&d.add(e.mime),!1)});return 0===b?a:(e.push({type:"text",text:(0,p.if)(b,[...d],c)}),{...a,content:e})}(c):c;if(!b.deferThinking||"assistant"!==d.role)return d;return{...d,content:d.content.map(a=>"thinking"===a.type&&""!==a.thinking.trim()?{...a,thinking:"",deferred:!0}:a)}}case"compaction":return{role:"custom",customType:"compaction",content:a.summary,display:!0,details:{tokensBefore:a.tokensBefore,firstKeptEntryId:a.firstKeptEntryId},timestamp:U(a.timestamp)};case"branch_summary":if(!a.summary)return null;return{role:"user",content:`*The conversation briefly explored another branch and returned with this summary:*
|
|
5
|
-
|
|
6
|
-
${a.summary}`,timestamp:U(a.timestamp)};case"custom_message":if(a.customType===t.BD){let b=(0,t.hw)(a.content,a.details);if(b?.role==="user")return{role:"user",content:b.text,timestamp:U(a.timestamp)};if(b?.role==="assistant"){let c=(0,t.p8)(a.details);return{role:"assistant",content:[{type:"text",text:b.text}],model:"Codex Live",provider:"openai-codex",...c?{liveSpeaker:c}:{},stopReason:"stop",timestamp:U(a.timestamp)}}}if(a.customType===u.gt){let b="string"==typeof a.content?a.content:a.content.map(a=>"text"===a.type?a.text:"").join("\n");if(b.trim())return{role:"assistant",content:[{type:"text",text:b}],model:u.$f,provider:"web6",stopReason:"stop",timestamp:U(a.timestamp)}}return{role:"custom",customType:a.customType,content:a.content,display:a.display,details:a.details,timestamp:U(a.timestamp)};default:return null}}d()}catch(a){d(a)}})},45902:(a,b,c)=>{"use strict";c.d(b,{$:()=>f});var d=c(76760),e=c.n(d);function f(a,b=process.platform){let c="win32"===b?e().win32.normalize(a):e().posix.normalize(a);return"win32"===b?c.toLowerCase():c}},50880:(a,b,c)=>{"use strict";function d(a,b,c){let d=b.length>0?`: ${b.join(", ")}`:"";return`[${a} tool result image${1===a?"":"s"} omitted from initial history payload${d}, ~${c} bytes]`}c.d(b,{if:()=>d}),c(1060)},69610:(a,b,c)=>{"use strict";c.d(b,{sh:()=>m});let d=/^[\t ]*(?:WORK_CLASS|PURPOSE|BLOCKS_PRIMARY|PRIMARY_DELIVERABLE|OWNED_PATHS|FINDING_ID)[\t ]*:[^\r\n]*$/i;c(50880);let e=["feature","maintenance","diagnostic"],f=/^[\t ]*([A-Z_]+)[\t ]*:[\t ]*(.*?)[\t ]*$/;function g(a){return Array.isArray(a)?a.filter(a=>"object"==typeof a&&null!==a):[]}function h(a){return"string"==typeof a&&a.trim()?a:null}function i(a){return"string"==typeof a?a:a.map(a=>"text"===a.type?a.text:"").join("\n")}function j(a){if(a.isError)return null;let b=a.details?.record;if("object"!=typeof b||null===b)try{let c=JSON.parse(i(a.content));b=c?.ok===!0?c.record:void 0}catch{return null}return"object"==typeof b&&null!==b?b:null}let k=/<task-result\b([^>]*)>/g;function l(a){let b="string"==typeof a?function(a){if(!a)return null;let b=/^\s*TASK_GUARD\s*:\s*$/im.exec(a),c=a;if(b){let e=b.index+b[0].length;"\r"===a[e]&&(e+=1),"\n"===a[e]&&(e+=1);let f=e;for(;e<a.length;){let b=a.indexOf("\n",e),c=-1===b?a.length:b,g=c>e&&"\r"===a[c-1]?c-1:c;if(!d.test(a.slice(e,g)))break;f=g,e=-1===b?a.length:b+1}let g=b[0].length-b[0].trimStart().length;c=`${a.slice(0,b.index+g)}${a.slice(f)}`}let e=[...c.matchAll(/^\s*TASK_TITLE\s*:\s*(.*?)\s*$/gim)].map(a=>a[1]??"");return 1===e.length&&e[0]&&e[0]===e[0].trim()&&/[가-힣]/u.test(e[0])?e[0]:null}(a):null,c=function(a){if("string"!=typeof a)return null;let b=a.split(/\r?\n/),c=b.findIndex(a=>/^\s*TASK_GUARD\s*:\s*$/.test(a));if(c<0)return null;for(let a=c+1;a<b.length;a+=1){let c=f.exec(b[a]);if(!c)break;if("WORK_CLASS"!==c[1])continue;let d=c[2].toLowerCase();return e.includes(d)?d:null}return null}(a),g=c?["TASK_GUARD:",`WORK_CLASS: ${c}`]:[];return b&&g.push(`TASK_TITLE: ${b}`),g.join("\n")}function m(a){switch(a.role){case"user":return{role:"user",content:"",timestamp:a.timestamp};case"assistant":{let b=(a.content??[]).filter(a=>"toolCall"===a.type&&"task"===a.toolName).map(a=>({type:"toolCall",toolCallId:a.toolCallId,toolName:"task",input:{tasks:g(a.input?.tasks).map(a=>({name:a.name,agent:a.agent,task:l(a.task)}))}}));if(0===b.length)return null;return{role:"assistant",content:b,model:a.model,provider:a.provider,timestamp:a.timestamp}}case"toolResult":{let b={role:"toolResult",toolCallId:a.toolCallId,toolName:a.toolName,content:[],timestamp:a.timestamp};if("task"===a.toolName){if(a.isError)return{...b,isError:!0};let c=g(a.details?.progress).map(a=>({index:a.index,id:a.id,agent:a.agent,task:l(a.task)}));return{...b,details:{progress:c}}}if("routing_verdict"===a.toolName){if(!function(a){let b=j(a);if(!b)return null;let c=b.verdict;if("accepted"!==c&&"rework"!==c&&"held"!==c)return null;let d=h(b.assignmentId),e=d?.split("#")??[];if(e.length<3)return null;let f=e[e.length-1],g=e.slice(1,-1).join("#");return/^\d+$/.test(f)&&g?{key:`${g}#${f}`,record:{verdict:c,attempt:"number"==typeof b.attempt?b.attempt:null,reason:h(b.reason)}}:null}(a))return null;let c=j(a);return{...b,details:{record:{verdict:c.verdict,assignmentId:c.assignmentId,attempt:c.attempt,reason:c.reason}}}}if("wait"===a.toolName){let c=g(a.details?.jobs).filter(a=>"task"===a.type).map(a=>({type:a.type,id:a.id,status:a.status,...void 0===a.durationMs?{}:{durationMs:a.durationMs}}));return c.length>0?{...b,details:{jobs:c}}:null}return null}case"custom":{if("async-result"!==a.customType)return null;let b=[...i(a.content).matchAll(k)].map(a=>a[0]);return b.length>0?{role:"custom",customType:"async-result",display:!1,content:b.join("\n"),timestamp:a.timestamp}:null}default:return null}}},77356:(a,b,c)=>{"use strict";c.d(b,{FR:()=>d,KE:()=>f,hi:()=>g});let d="cuelo-thinking-ceiling",e=["minimal","low","medium","high","xhigh","max"];function f(a){return"string"==typeof a&&e.includes(a)}function g(a){for(let b=a.length-1;b>=0;b--){let c=a[b];if(c?.type!=="custom"||c.customType!==d)continue;let e=c.data?.ceiling;return f(e)?e:null}return null}},78335:()=>{},85821:(a,b,c)=>{"use strict";c.d(b,{$f:()=>f,Ro:()=>g,YA:()=>i,YO:()=>j,gt:()=>e,lN:()=>h,xI:()=>o});var d=c(77598);let e="gpt6-reply",f="ChatGPT 6PRO",g="gpt6-binding";function h(a,b){return`[6PRO 경유] 이 세션은 6PRO 연결번호 ${a}에 묶였다(만료 ${b}).
|
|
7
|
-
|
|
8
|
-
하네스 정책 \`mainLane.web6Consult\`에 따라 이 세션에서는 ChatGPT 6 Pro 상담 네 자리 중
|
|
9
|
-
**발주 전 설계**와 **최종 판정 직전 상담** 둘이 자동으로 발동한다. 나머지 둘(경합 가설 판정,
|
|
10
|
-
되돌리기 비싼 설계 선택)은 조건이 맞을 때 Main 재량이다.
|
|
11
|
-
|
|
12
|
-
경로는 loopback shim이고 상담은 조언이다 — 분할\xb7진단\xb7판정은 그대로 Main이 소유한다.
|
|
13
|
-
shim이 응답하지 않으면 막지 말고 기존 경로로 진행한 뒤 상담 없이 판정했음을 남긴다.`}class i extends Error{constructor(a,b){super(b),this.name="Gpt6Error",this.code=a}}function j(a){switch(a){case"unknown_handle":case"session_not_found":return 404;case"invalid_token":return 401;case"store_conflict":return 409;case"invalid_argument":return 400;default:return 500}}function k(a,b){if("string"!=typeof a||""===a.trim())throw new i("invalid_argument",`${b}는 비어 있지 않은 문자열이어야 합니다.`);return a.trim()}let l=/^[0-9a-f]{64}$/;function m(a){return(0,d.createHash)("sha256").update(a,"utf8").digest("hex")}function n(a,b){if(""===a||!l.test(b))return!1;let c=(0,d.createHash)("sha256").update(a,"utf8").digest(),e=Buffer.from(b,"hex");return e.length===c.length&&(0,d.timingSafeEqual)(c,e)}function o(a){let b,c=null;function d(){return{schemaVersion:2,revision:0,tokenHash:"",handles:{}}}function g(){let e=a.readStore();if(null!==c&&e===b)return c;let f=function(a){let b;if(null===a||""===a.trim())return d();try{b=JSON.parse(a)}catch{throw new i("store_unreadable","핸들 저장소(gpt6-handles.json)를 JSON으로 읽을 수 없습니다.")}if(!b||"object"!=typeof b||Array.isArray(b))throw new i("store_unreadable","핸들 저장소(gpt6-handles.json)의 형식이 올바르지 않습니다.");let c=b;if(2!==c.schemaVersion)return d();let e={};if(c.handles&&"object"==typeof c.handles)for(let[a,b]of Object.entries(c.handles)){if(b&&"object"==typeof b)"string"==typeof b.sessionId&&"string"==typeof b.cwd&&"string"==typeof b.handleKeyHash&&l.test(b.handleKeyHash)&&(e[a]={handle:"string"==typeof b.handle?b.handle:a,cwd:b.cwd,sessionId:b.sessionId,instruction:"string"==typeof b.instruction?b.instruction:"",createdAt:"string"==typeof b.createdAt?b.createdAt:new Date(0).toISOString(),expiresAt:"string"==typeof b.expiresAt?b.expiresAt:new Date(0).toISOString(),revokedAt:"string"==typeof b.revokedAt?b.revokedAt:null,..."string"==typeof b.web6RequestId&&""!==b.web6RequestId.trim()?{web6RequestId:b.web6RequestId.trim()}:{},handleKeyHash:b.handleKeyHash})}return{schemaVersion:2,revision:"number"==typeof c.revision?c.revision:0,tokenHash:"string"==typeof c.tokenHash&&l.test(c.tokenHash)?c.tokenHash:"",handles:e}}(e);return b=e,c=f,f}function h(a){return Date.parse(a.revokedAt??a.expiresAt)}function j(a,b){return h(a)>b-864e5}function o(b){for(let c=0;c<2;c+=1){let c=g(),d=b(c);if(!function(a,b){for(let c of Object.keys(a.handles)){let d=a.handles[c];d&&!j(d,b)&&delete a.handles[c]}let c=Object.keys(a.handles).length-50;if(!(c<=0))for(let[d]of Object.entries(a.handles).filter(([,a])=>h(a)<=b).sort((a,b)=>h(a[1])-h(b[1]))){if(c<=0)break;delete a.handles[d],c-=1}}(c,a.now().getTime()),g().revision===c.revision)return c.revision+=1,a.writeStore(`${JSON.stringify(c,null,2)}
|
|
14
|
-
`),d}throw new i("store_conflict","핸들 저장소가 다른 호출과 충돌했습니다. 잠시 뒤 다시 시도하세요.")}function p(a,b){let c=a.revokedAt?"revoked":Date.parse(a.expiresAt)<=b?"expired":"active";return{handle:a.handle,cwd:a.cwd,sessionId:a.sessionId,instruction:a.instruction,createdAt:a.createdAt,expiresAt:a.expiresAt,revokedAt:a.revokedAt,status:c}}async function q(b){let c=a.getSession(b),d=c?.isAlive()?c:await a.resumeSession(b);return d&&d.isAlive()?d:void 0}return{issueHandle:function(b){let c=k(b.cwd,"cwd"),d=k(b.sessionId,"sessionId"),e="string"==typeof b.instruction?b.instruction:"",f=void 0===b.web6RequestId?void 0:k(b.web6RequestId,"web6RequestId"),g=function(a){if(null==a)return 720;if("number"!=typeof a||!Number.isInteger(a))throw new i("invalid_argument","ttlMinutes는 정수여야 합니다.");if(a<1||a>10080)throw new i("invalid_argument","ttlMinutes는 1~10080 범위여야 합니다.");return a}(b.ttlMinutes),h=a.now().getTime();return o(b=>{let j=null;""===b.tokenHash&&(b.tokenHash=m(j=a.randomToken()));let k="";for(let c=0;c<20;c+=1){let c=`H-${a.randomHandleDigits()}`;if(!b.handles[c]){k=c;break}}if(""===k)throw new i("handle_exhausted","연결번호를 발급하지 못했습니다. 4자리 번호가 소진되었습니다.");let l=a.randomHandleKey(),n={handle:k,cwd:c,sessionId:d,instruction:e,createdAt:new Date(h).toISOString(),expiresAt:new Date(h+6e4*g).toISOString(),revokedAt:null,...void 0===f?{}:{web6RequestId:f},handleKeyHash:m(l)};return b.handles[k]=n,{...p(n,h),token:j,handleKey:l,startSentence:`OMP 연결번호 ${k}에 묶인 세션의 상담이다. 작업폴더는 ${c}다.`}})},listHandles:function(){let b=g(),c=a.now().getTime();return{handles:Object.values(b.handles).filter(a=>j(a,c)).map(a=>p(a,c)).sort((a,b)=>b.createdAt.localeCompare(a.createdAt)||a.handle.localeCompare(b.handle)),tokenPresent:""!==b.tokenHash}},revokeHandle:function(b){let c=k(b,"handle");return o(b=>{let d=b.handles[c];if(!d)throw new i("unknown_handle",`연결번호 ${c}를 찾을 수 없습니다.`);return d.revokedAt||(d.revokedAt=a.now().toISOString()),{handle:c,revoked:!0}})},rotateToken:function(b){return o(c=>{if(!n(b,c.tokenHash))throw new i("invalid_token","현재 토큰이 올바르지 않습니다. 회전에는 지금 쓰는 토큰이 필요합니다.");let d=a.randomToken();return c.tokenHash=m(d),{token:d,rotatedAt:a.now().toISOString()}})},acceptsToken:a=>n(a,g().tokenHash),publishReply:async function(a){let b=k(a.sessionId,"sessionId"),c=k(a.text,"text"),d="string"==typeof a.model&&""!==a.model.trim()?a.model.trim():f,g=await q(b);if(!g)throw new i("session_not_found",`세션 ${b}의 기록을 찾을 수 없습니다.`);return{published:!0,entryId:g.appendCustomMessage(e,c,!0,{source:f,model:d}),busy:g.isRunning()}}}}},87576:(a,b,c)=>{"use strict";c.d(b,{BD:()=>d,NR:()=>g,PW:()=>k,Yh:()=>i,c$:()=>l,hw:()=>h,p8:()=>e});let d="live-transcript";function e(a){if(!a||"object"!=typeof a||!("speaker"in a))return;let b=a.speaker;if(!b||"object"!=typeof b)return;let{alias:c,mode:d}=b;if("string"==typeof c&&""!==c.trim()&&("character"===d||"native"===d))return{alias:c,mode:d}}let f={user:"User (live voice):\n",assistant:"Voice assistant (live voice):\n"};function g(a,b){return`${f[a]}${b}`}function h(a,b){if(!b||"object"!=typeof b||!("role"in b))return null;let c=b.role;if("user"!==c&&"assistant"!==c||"string"!=typeof a)return null;let d=f[c];if(!a.startsWith(d))return null;let e=a.slice(d.length).trim();return e?{role:c,text:e}:null}function i(a,b,c,d){let e;if(b){if(a?.text)if(a.final)if(c){if(void 0!==d&&a.finalizedTurnIds?.has(d)||void 0===d&&b===a.text)return;e=b}else{if(void 0!==d&&void 0!==a.itemId&&d===a.itemId||void 0===d&&(b===a.text||a.text.endsWith(b)))return;e=b}else if(c){if(void 0!==d&&a.finalizedTurnIds?.has(d))return;e=a.text.startsWith(b)&&a.text.length>b.length?a.text:b}else e=b.startsWith(a.text)?b:a.text.endsWith(b)?a.text:a.text+b;else e=b;if(e=e.trim())return{text:e,final:c,itemId:c?a?.itemId:d??a?.itemId,finalizedTurnIds:c&&void 0!==d?(a?.finalizedTurnIds??new Set).add(d):a?.finalizedTurnIds}}}function j(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function k(a){let b=a;if("string"==typeof b)try{b=JSON.parse(b)}catch{return null}return j(b)?b:null}function l(a){let b="turn.done"===a.type?a.turn:"input_transcript.added"===a.type||"output_transcript.added"===a.type?a.item:void 0;if(!j(b))return;let c=b.id;return"string"==typeof c&&c?c:void 0}RegExp("^(?:아|어|음|응|네|자|그럼|이제|일단|그만|좀|알았어|알겠어|아니|그래)*(?:(?:통화|전화)(?:를|좀|그만)*)?(?:좀|그만)*(?:끊어|끊어봐|끊을게|끊자|끊겠습니다|끊으라고)(?:줘|주세요|요)?$|^(?:아|어|음|응|네|자|그럼|이제|일단|그만|좀|알았어|알겠어|아니|그래)*(?:통화|전화)(?:를|좀|그만)*(?:종료|종료해|종료해봐|종료할게|종료하자|종료하라고)(?:줘|주세요|요)?$","u")},90811:(a,b,c)=>{"use strict";let d;c.d(b,{cu:()=>m});var e=c(73024),f=c(51455),g=c(76760);async function h(a){let b=(0,g.resolve)(a);for(;;){let a=(0,g.join)(b,".git"),c=await (0,f.stat)(a).catch(()=>void 0);if(c)return c.isFile()&&/^gitdir:\s*\//m.test(await (0,f.readFile)(a,"utf8"));let d=(0,g.dirname)(b);if(d===b)return!1;b=d}}async function i(a,b){for(let c of b)if(await h((0,g.dirname)((0,g.resolve)(a,c))))return!0;return!1}async function j(a,b){return!!("linux"===process.platform&&process.env.WSL_DISTRO_NAME&&/^\/mnt\/[a-z](?:\/|$)/i.test(a))&&!await (b?i(a,b):h(a))}let k={command:"git",windows:!1,toPosix:a=>a},l={command:"git.exe",windows:!0,toPosix:function(a){let b=/^([A-Za-z]):[\\/]*(.*)$/.exec(a);if(!b)return a;let c=b[2].replace(/\\/g,"/").replace(/\/+$/,"");return c?`/mnt/${b[1].toLowerCase()}/${c}`:`/mnt/${b[1].toLowerCase()}`}};async function m(a){let b;return(b=process.env.PATH??"",d?.path!==b&&(d={path:b,found:b.split(g.delimiter).some(a=>a&&(0,e.existsSync)((0,g.join)(a,"git.exe")))}),d.found&&await j(a).catch(()=>!1))?l:k}},96487:()=>{}};
|