@cleocode/adapters 2026.4.39 → 2026.4.40
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/dist/cant-context.d.ts +130 -0
- package/dist/cant-context.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +386 -199
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code/hooks.d.ts.map +1 -1
- package/dist/providers/claude-code/spawn.d.ts.map +1 -1
- package/dist/providers/opencode/spawn.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/cant-context.test.ts +248 -0
- package/src/cant-context.ts +379 -0
- package/src/index.ts +3 -0
- package/src/providers/claude-code/hooks.ts +12 -11
- package/src/providers/claude-code/spawn.ts +15 -1
- package/src/providers/opencode/spawn.ts +30 -11
package/dist/index.js
CHANGED
|
@@ -8,9 +8,174 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// packages/adapters/src/
|
|
11
|
+
// packages/adapters/src/cant-context.ts
|
|
12
|
+
var cant_context_exports = {};
|
|
13
|
+
__export(cant_context_exports, {
|
|
14
|
+
buildCantEnrichedPrompt: () => buildCantEnrichedPrompt,
|
|
15
|
+
buildMemoryBridgeBlock: () => buildMemoryBridgeBlock,
|
|
16
|
+
buildMentalModelInjection: () => buildMentalModelInjection,
|
|
17
|
+
discoverCantFiles: () => discoverCantFiles,
|
|
18
|
+
discoverCantFilesMultiTier: () => discoverCantFilesMultiTier,
|
|
19
|
+
readMemoryBridge: () => readMemoryBridge,
|
|
20
|
+
resolveThreeTierPaths: () => resolveThreeTierPaths
|
|
21
|
+
});
|
|
22
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
12
23
|
import { homedir } from "node:os";
|
|
13
|
-
import { join } from "node:path";
|
|
24
|
+
import { basename, join } from "node:path";
|
|
25
|
+
function discoverCantFiles(dir) {
|
|
26
|
+
try {
|
|
27
|
+
const entries = readdirSync(dir, { recursive: true, withFileTypes: true });
|
|
28
|
+
const files = [];
|
|
29
|
+
for (const entry of entries) {
|
|
30
|
+
if (entry.isFile() && entry.name.endsWith(".cant")) {
|
|
31
|
+
const parent = entry.parentPath ?? dir;
|
|
32
|
+
files.push(join(parent, entry.name));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return files;
|
|
36
|
+
} catch {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function resolveThreeTierPaths(projectDir) {
|
|
41
|
+
const home = homedir();
|
|
42
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join(home, ".local", "share");
|
|
43
|
+
const xdgConfig = process.env["XDG_CONFIG_HOME"] ?? join(home, ".config");
|
|
44
|
+
return {
|
|
45
|
+
global: join(xdgData, "cleo", "cant"),
|
|
46
|
+
user: join(xdgConfig, "cleo", "cant"),
|
|
47
|
+
project: join(projectDir, ".cleo", "cant")
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function discoverCantFilesMultiTier(projectDir) {
|
|
51
|
+
const paths = resolveThreeTierPaths(projectDir);
|
|
52
|
+
const globalFiles = discoverCantFiles(paths.global);
|
|
53
|
+
const userFiles = discoverCantFiles(paths.user);
|
|
54
|
+
const projectFiles = discoverCantFiles(paths.project);
|
|
55
|
+
const fileMap = /* @__PURE__ */ new Map();
|
|
56
|
+
for (const file of globalFiles) {
|
|
57
|
+
fileMap.set(basename(file), file);
|
|
58
|
+
}
|
|
59
|
+
for (const file of userFiles) {
|
|
60
|
+
fileMap.set(basename(file), file);
|
|
61
|
+
}
|
|
62
|
+
for (const file of projectFiles) {
|
|
63
|
+
fileMap.set(basename(file), file);
|
|
64
|
+
}
|
|
65
|
+
const totalUniqueInputs = globalFiles.length + userFiles.length + projectFiles.length;
|
|
66
|
+
const overrides = totalUniqueInputs - fileMap.size;
|
|
67
|
+
return {
|
|
68
|
+
files: Array.from(fileMap.values()),
|
|
69
|
+
stats: {
|
|
70
|
+
global: globalFiles.length,
|
|
71
|
+
user: userFiles.length,
|
|
72
|
+
project: projectFiles.length,
|
|
73
|
+
overrides,
|
|
74
|
+
merged: fileMap.size
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function readMemoryBridge(projectDir) {
|
|
79
|
+
try {
|
|
80
|
+
const bridgePath = join(projectDir, ".cleo", "memory-bridge.md");
|
|
81
|
+
if (!existsSync(bridgePath)) return null;
|
|
82
|
+
const content = readFileSync(bridgePath, "utf-8");
|
|
83
|
+
return content.length > 0 ? content : null;
|
|
84
|
+
} catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function buildMemoryBridgeBlock(content) {
|
|
89
|
+
return "\n\n===== CLEO MEMORY BRIDGE =====\nThis is your project memory context from .cleo/memory-bridge.md.\nUse it to understand recent decisions, handoff notes, and key patterns.\n\n" + content.trim() + "\n===== END MEMORY BRIDGE =====";
|
|
90
|
+
}
|
|
91
|
+
function buildMentalModelInjection(agentName, observations) {
|
|
92
|
+
if (observations.length === 0) return "";
|
|
93
|
+
const lines = ["", `// Agent: ${agentName}`, VALIDATE_ON_LOAD_PREAMBLE, ""];
|
|
94
|
+
for (let i = 0; i < observations.length; i++) {
|
|
95
|
+
const obs = observations[i];
|
|
96
|
+
const datePart = obs.date ? ` [${obs.date}]` : "";
|
|
97
|
+
lines.push(`${i + 1}. [${obs.id}] (${obs.type})${datePart}: ${obs.title}`);
|
|
98
|
+
}
|
|
99
|
+
lines.push("===== END MENTAL MODEL =====");
|
|
100
|
+
return lines.join("\n");
|
|
101
|
+
}
|
|
102
|
+
async function fetchMentalModelInjection(agentName, projectRoot) {
|
|
103
|
+
try {
|
|
104
|
+
const coreModule = await import(
|
|
105
|
+
/* webpackIgnore: true */
|
|
106
|
+
"@cleocode/core"
|
|
107
|
+
);
|
|
108
|
+
if (typeof coreModule.memoryFind !== "function") return "";
|
|
109
|
+
const result = await coreModule.memoryFind(
|
|
110
|
+
{
|
|
111
|
+
query: agentName,
|
|
112
|
+
agent: agentName,
|
|
113
|
+
limit: 10,
|
|
114
|
+
tables: ["observations"]
|
|
115
|
+
},
|
|
116
|
+
projectRoot
|
|
117
|
+
);
|
|
118
|
+
if (!result.success || !result.data?.results?.length) return "";
|
|
119
|
+
return buildMentalModelInjection(agentName, result.data.results);
|
|
120
|
+
} catch {
|
|
121
|
+
return "";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function buildCantEnrichedPrompt(options) {
|
|
125
|
+
const { projectDir, basePrompt, agentName } = options;
|
|
126
|
+
let appendix = "";
|
|
127
|
+
try {
|
|
128
|
+
const { files } = discoverCantFilesMultiTier(projectDir);
|
|
129
|
+
if (files.length > 0) {
|
|
130
|
+
const cantModule = await import(
|
|
131
|
+
/* webpackIgnore: true */
|
|
132
|
+
"@cleocode/cant"
|
|
133
|
+
);
|
|
134
|
+
if (typeof cantModule.compileBundle === "function") {
|
|
135
|
+
const bundle = cantModule.compileBundle(files);
|
|
136
|
+
if (bundle.valid) {
|
|
137
|
+
const rendered = bundle.renderSystemPrompt();
|
|
138
|
+
if (rendered) {
|
|
139
|
+
appendix += `
|
|
140
|
+
|
|
141
|
+
${rendered}`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} catch {
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
const bridge = readMemoryBridge(projectDir);
|
|
150
|
+
if (bridge) {
|
|
151
|
+
appendix += buildMemoryBridgeBlock(bridge);
|
|
152
|
+
}
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
if (agentName) {
|
|
156
|
+
try {
|
|
157
|
+
const mentalModel = await fetchMentalModelInjection(agentName, projectDir);
|
|
158
|
+
if (mentalModel) {
|
|
159
|
+
appendix += `
|
|
160
|
+
|
|
161
|
+
${mentalModel}`;
|
|
162
|
+
}
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return appendix ? basePrompt + appendix : basePrompt;
|
|
167
|
+
}
|
|
168
|
+
var VALIDATE_ON_LOAD_PREAMBLE;
|
|
169
|
+
var init_cant_context = __esm({
|
|
170
|
+
"packages/adapters/src/cant-context.ts"() {
|
|
171
|
+
"use strict";
|
|
172
|
+
VALIDATE_ON_LOAD_PREAMBLE = "===== MENTAL MODEL (validate-on-load) =====\nThese are your prior observations, patterns, and learnings for this project.\nBefore acting, you MUST re-evaluate each entry against current project state.\nIf an entry is stale, note it and proceed with fresh understanding.";
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// packages/adapters/src/providers/claude-code/paths.ts
|
|
177
|
+
import { homedir as homedir2 } from "node:os";
|
|
178
|
+
import { join as join2 } from "node:path";
|
|
14
179
|
var ClaudeCodePathProvider;
|
|
15
180
|
var init_paths = __esm({
|
|
16
181
|
"packages/adapters/src/providers/claude-code/paths.ts"() {
|
|
@@ -18,29 +183,29 @@ var init_paths = __esm({
|
|
|
18
183
|
ClaudeCodePathProvider = class {
|
|
19
184
|
/** Get the provider's root configuration directory. */
|
|
20
185
|
getProviderDir() {
|
|
21
|
-
return process.env["CLAUDE_HOME"] ??
|
|
186
|
+
return process.env["CLAUDE_HOME"] ?? join2(homedir2(), ".claude");
|
|
22
187
|
}
|
|
23
188
|
/** Get the path to the provider's settings file, or null if unavailable. */
|
|
24
189
|
getSettingsPath() {
|
|
25
|
-
return process.env["CLAUDE_SETTINGS"] ??
|
|
190
|
+
return process.env["CLAUDE_SETTINGS"] ?? join2(this.getProviderDir(), "settings.json");
|
|
26
191
|
}
|
|
27
192
|
/** Get the directory where agents are installed, or null if unsupported. */
|
|
28
193
|
getAgentInstallDir() {
|
|
29
|
-
return
|
|
194
|
+
return join2(this.getProviderDir(), "agents");
|
|
30
195
|
}
|
|
31
196
|
/** Get the path to the provider's memory database, or null if unsupported. */
|
|
32
197
|
getMemoryDbPath() {
|
|
33
|
-
return process.env["CLAUDE_MEM_DB"] ??
|
|
198
|
+
return process.env["CLAUDE_MEM_DB"] ?? join2(homedir2(), ".claude-mem", "claude-mem.db");
|
|
34
199
|
}
|
|
35
200
|
};
|
|
36
201
|
}
|
|
37
202
|
});
|
|
38
203
|
|
|
39
204
|
// packages/adapters/src/providers/claude-code/context-monitor.ts
|
|
40
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
205
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
41
206
|
import { mkdir } from "node:fs/promises";
|
|
42
|
-
import { homedir as
|
|
43
|
-
import { dirname, join as
|
|
207
|
+
import { homedir as homedir3 } from "node:os";
|
|
208
|
+
import { dirname, join as join3 } from "node:path";
|
|
44
209
|
function getContextStatusFromPercentage(percentage) {
|
|
45
210
|
if (percentage >= THRESHOLDS.EMERGENCY) return "emergency";
|
|
46
211
|
if (percentage >= THRESHOLDS.CRITICAL) return "critical";
|
|
@@ -74,10 +239,10 @@ var init_context_monitor = __esm({
|
|
|
74
239
|
const totalTokens = inputTokens + outputTokens + cacheCreate;
|
|
75
240
|
const percentage = Math.floor(totalTokens * 100 / contextSize);
|
|
76
241
|
const status = getContextStatusFromPercentage(percentage);
|
|
77
|
-
const cleoDir = cwd ?
|
|
78
|
-
if (
|
|
79
|
-
const stateDir =
|
|
80
|
-
const statePath =
|
|
242
|
+
const cleoDir = cwd ? join3(cwd, ".cleo") : ".cleo";
|
|
243
|
+
if (existsSync2(cleoDir)) {
|
|
244
|
+
const stateDir = join3(cleoDir, "context-states");
|
|
245
|
+
const statePath = join3(stateDir, ".context-state.json");
|
|
81
246
|
const state = {
|
|
82
247
|
$schema: "https://cleo-dev.com/schemas/v1/context-state.schema.json",
|
|
83
248
|
version: "1.0.0",
|
|
@@ -114,9 +279,9 @@ var init_context_monitor = __esm({
|
|
|
114
279
|
/** Check the current statusline integration status in Claude Code settings. */
|
|
115
280
|
checkStatuslineIntegration() {
|
|
116
281
|
const settingsPath = this.pathProvider.getSettingsPath();
|
|
117
|
-
if (!settingsPath || !
|
|
282
|
+
if (!settingsPath || !existsSync2(settingsPath)) return "no_settings";
|
|
118
283
|
try {
|
|
119
|
-
const settings = JSON.parse(
|
|
284
|
+
const settings = JSON.parse(readFileSync2(settingsPath, "utf-8"));
|
|
120
285
|
const statusLine = settings.statusLine;
|
|
121
286
|
if (!statusLine?.type) return "not_configured";
|
|
122
287
|
if (statusLine.type !== "command") return "custom_no_cleo";
|
|
@@ -124,10 +289,10 @@ var init_context_monitor = __esm({
|
|
|
124
289
|
if (cmd.includes("context-monitor.sh") || cmd.includes("cleo-statusline") || cmd.includes(".context-state.json") || cmd.includes("context-states")) {
|
|
125
290
|
return "configured";
|
|
126
291
|
}
|
|
127
|
-
const scriptPath = cmd.startsWith("~") ? cmd.replace("~",
|
|
128
|
-
if (
|
|
292
|
+
const scriptPath = cmd.startsWith("~") ? cmd.replace("~", homedir3()) : cmd;
|
|
293
|
+
if (existsSync2(scriptPath)) {
|
|
129
294
|
try {
|
|
130
|
-
const content =
|
|
295
|
+
const content = readFileSync2(scriptPath, "utf-8");
|
|
131
296
|
if (content.includes("context-state.json")) return "configured";
|
|
132
297
|
} catch {
|
|
133
298
|
}
|
|
@@ -142,7 +307,7 @@ var init_context_monitor = __esm({
|
|
|
142
307
|
return {
|
|
143
308
|
statusLine: {
|
|
144
309
|
type: "command",
|
|
145
|
-
command:
|
|
310
|
+
command: join3(homedir3(), ".cleo", "lib", "session", "context-monitor.sh")
|
|
146
311
|
}
|
|
147
312
|
};
|
|
148
313
|
}
|
|
@@ -163,10 +328,10 @@ var init_context_monitor = __esm({
|
|
|
163
328
|
});
|
|
164
329
|
|
|
165
330
|
// packages/adapters/src/providers/claude-code/hooks.ts
|
|
166
|
-
import { existsSync as
|
|
331
|
+
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
167
332
|
import { readdir, readFile } from "node:fs/promises";
|
|
168
|
-
import { homedir as
|
|
169
|
-
import { join as
|
|
333
|
+
import { homedir as homedir4 } from "node:os";
|
|
334
|
+
import { join as join4 } from "node:path";
|
|
170
335
|
var PROVIDER_ID, CLAUDE_CODE_EVENT_MAP, ClaudeCodeHookProvider;
|
|
171
336
|
var init_hooks = __esm({
|
|
172
337
|
"packages/adapters/src/providers/claude-code/hooks.ts"() {
|
|
@@ -243,12 +408,12 @@ var init_hooks = __esm({
|
|
|
243
408
|
this.projectDir = projectDir;
|
|
244
409
|
this.registered = true;
|
|
245
410
|
try {
|
|
246
|
-
const home =
|
|
247
|
-
const settingsPath =
|
|
411
|
+
const home = homedir4();
|
|
412
|
+
const settingsPath = join4(home, ".claude", "settings.json");
|
|
248
413
|
let settings = {};
|
|
249
|
-
if (
|
|
414
|
+
if (existsSync3(settingsPath)) {
|
|
250
415
|
try {
|
|
251
|
-
settings = JSON.parse(
|
|
416
|
+
settings = JSON.parse(readFileSync3(settingsPath, "utf-8"));
|
|
252
417
|
} catch {
|
|
253
418
|
}
|
|
254
419
|
}
|
|
@@ -284,7 +449,7 @@ var init_hooks = __esm({
|
|
|
284
449
|
]
|
|
285
450
|
});
|
|
286
451
|
settings.hooks = hooks;
|
|
287
|
-
mkdirSync(
|
|
452
|
+
mkdirSync(join4(home, ".claude"), { recursive: true });
|
|
288
453
|
writeFileSync2(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
289
454
|
} catch {
|
|
290
455
|
}
|
|
@@ -301,10 +466,10 @@ var init_hooks = __esm({
|
|
|
301
466
|
this.registered = false;
|
|
302
467
|
this.projectDir = null;
|
|
303
468
|
try {
|
|
304
|
-
const home =
|
|
305
|
-
const settingsPath =
|
|
306
|
-
if (!
|
|
307
|
-
const settings = JSON.parse(
|
|
469
|
+
const home = homedir4();
|
|
470
|
+
const settingsPath = join4(home, ".claude", "settings.json");
|
|
471
|
+
if (!existsSync3(settingsPath)) return;
|
|
472
|
+
const settings = JSON.parse(readFileSync3(settingsPath, "utf-8"));
|
|
308
473
|
const hooks = settings.hooks;
|
|
309
474
|
if (!hooks) return;
|
|
310
475
|
let changed = false;
|
|
@@ -427,18 +592,18 @@ var init_hooks = __esm({
|
|
|
427
592
|
async getTranscript(_sessionId, _projectDir) {
|
|
428
593
|
try {
|
|
429
594
|
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "/root";
|
|
430
|
-
const projectsDir =
|
|
595
|
+
const projectsDir = join4(homeDir, ".claude", "projects");
|
|
431
596
|
let allFiles = [];
|
|
432
597
|
try {
|
|
433
598
|
const projectDirs = await readdir(projectsDir, { withFileTypes: true });
|
|
434
599
|
for (const entry of projectDirs) {
|
|
435
600
|
if (!entry.isDirectory()) continue;
|
|
436
|
-
const subDir =
|
|
601
|
+
const subDir = join4(projectsDir, entry.name);
|
|
437
602
|
try {
|
|
438
603
|
const files = await readdir(subDir);
|
|
439
604
|
for (const file of files) {
|
|
440
605
|
if (!file.endsWith(".jsonl")) continue;
|
|
441
|
-
const filePath =
|
|
606
|
+
const filePath = join4(subDir, file);
|
|
442
607
|
allFiles.push({ path: filePath, mtime: 0 });
|
|
443
608
|
}
|
|
444
609
|
} catch {
|
|
@@ -479,18 +644,18 @@ var init_hooks = __esm({
|
|
|
479
644
|
// packages/adapters/src/providers/claude-code/install.ts
|
|
480
645
|
import {
|
|
481
646
|
copyFileSync,
|
|
482
|
-
existsSync as
|
|
647
|
+
existsSync as existsSync4,
|
|
483
648
|
mkdirSync as mkdirSync2,
|
|
484
|
-
readdirSync,
|
|
485
|
-
readFileSync as
|
|
649
|
+
readdirSync as readdirSync2,
|
|
650
|
+
readFileSync as readFileSync4,
|
|
486
651
|
writeFileSync as writeFileSync3
|
|
487
652
|
} from "node:fs";
|
|
488
|
-
import { homedir as
|
|
489
|
-
import { dirname as dirname2, join as
|
|
653
|
+
import { homedir as homedir5 } from "node:os";
|
|
654
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
490
655
|
import { fileURLToPath } from "node:url";
|
|
491
656
|
function getAdapterCommandsDir() {
|
|
492
657
|
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
493
|
-
return
|
|
658
|
+
return join5(thisDir, "commands");
|
|
494
659
|
}
|
|
495
660
|
var INSTRUCTION_REFERENCES, ClaudeCodeInstallProvider;
|
|
496
661
|
var init_install = __esm({
|
|
@@ -511,7 +676,7 @@ var init_install = __esm({
|
|
|
511
676
|
const details = {};
|
|
512
677
|
instructionFileUpdated = this.updateInstructionFile(projectDir);
|
|
513
678
|
if (instructionFileUpdated) {
|
|
514
|
-
details.instructionFile =
|
|
679
|
+
details.instructionFile = join5(projectDir, "CLAUDE.md");
|
|
515
680
|
}
|
|
516
681
|
const commandsInstalled = this.installCommands(projectDir);
|
|
517
682
|
if (commandsInstalled.length > 0) {
|
|
@@ -541,10 +706,10 @@ var init_install = __esm({
|
|
|
541
706
|
* Checks for plugin enabled in ~/.claude/settings.json.
|
|
542
707
|
*/
|
|
543
708
|
async isInstalled() {
|
|
544
|
-
const settingsPath =
|
|
545
|
-
if (
|
|
709
|
+
const settingsPath = join5(homedir5(), ".claude", "settings.json");
|
|
710
|
+
if (existsSync4(settingsPath)) {
|
|
546
711
|
try {
|
|
547
|
-
const settings = JSON.parse(
|
|
712
|
+
const settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
|
|
548
713
|
const plugins = settings.enabledPlugins;
|
|
549
714
|
if (plugins && plugins["cleo@cleocode"] === true) {
|
|
550
715
|
return true;
|
|
@@ -570,11 +735,11 @@ var init_install = __esm({
|
|
|
570
735
|
* @returns true if the file was created or modified
|
|
571
736
|
*/
|
|
572
737
|
updateInstructionFile(projectDir) {
|
|
573
|
-
const claudeMdPath =
|
|
738
|
+
const claudeMdPath = join5(projectDir, "CLAUDE.md");
|
|
574
739
|
let content = "";
|
|
575
740
|
let existed = false;
|
|
576
|
-
if (
|
|
577
|
-
content =
|
|
741
|
+
if (existsSync4(claudeMdPath)) {
|
|
742
|
+
content = readFileSync4(claudeMdPath, "utf-8");
|
|
578
743
|
existed = true;
|
|
579
744
|
}
|
|
580
745
|
const missingRefs = INSTRUCTION_REFERENCES.filter((ref) => !content.includes(ref));
|
|
@@ -602,16 +767,16 @@ var init_install = __esm({
|
|
|
602
767
|
*/
|
|
603
768
|
installCommands(projectDir) {
|
|
604
769
|
const adapterCommandsDir = getAdapterCommandsDir();
|
|
605
|
-
if (!
|
|
770
|
+
if (!existsSync4(adapterCommandsDir)) {
|
|
606
771
|
return [];
|
|
607
772
|
}
|
|
608
|
-
const targetDir =
|
|
773
|
+
const targetDir = join5(projectDir, ".claude", "commands");
|
|
609
774
|
mkdirSync2(targetDir, { recursive: true });
|
|
610
775
|
const installed = [];
|
|
611
|
-
const files =
|
|
776
|
+
const files = readdirSync2(adapterCommandsDir).filter((f) => f.endsWith(".md"));
|
|
612
777
|
for (const file of files) {
|
|
613
|
-
const src =
|
|
614
|
-
const dest =
|
|
778
|
+
const src = join5(adapterCommandsDir, file);
|
|
779
|
+
const dest = join5(targetDir, file);
|
|
615
780
|
copyFileSync(src, dest);
|
|
616
781
|
installed.push(file);
|
|
617
782
|
}
|
|
@@ -623,12 +788,12 @@ var init_install = __esm({
|
|
|
623
788
|
* @returns Description of what was registered, or null if no change needed
|
|
624
789
|
*/
|
|
625
790
|
registerPlugin() {
|
|
626
|
-
const home =
|
|
627
|
-
const settingsPath =
|
|
791
|
+
const home = homedir5();
|
|
792
|
+
const settingsPath = join5(home, ".claude", "settings.json");
|
|
628
793
|
let settings = {};
|
|
629
|
-
if (
|
|
794
|
+
if (existsSync4(settingsPath)) {
|
|
630
795
|
try {
|
|
631
|
-
settings = JSON.parse(
|
|
796
|
+
settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
|
|
632
797
|
} catch {
|
|
633
798
|
}
|
|
634
799
|
}
|
|
@@ -642,7 +807,7 @@ var init_install = __esm({
|
|
|
642
807
|
}
|
|
643
808
|
enabledPlugins[pluginKey] = true;
|
|
644
809
|
settings.enabledPlugins = enabledPlugins;
|
|
645
|
-
mkdirSync2(
|
|
810
|
+
mkdirSync2(join5(home, ".claude"), { recursive: true });
|
|
646
811
|
writeFileSync3(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
647
812
|
return `Enabled ${pluginKey} in ~/.claude/settings.json`;
|
|
648
813
|
}
|
|
@@ -852,8 +1017,18 @@ var init_spawn = __esm({
|
|
|
852
1017
|
const startTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
853
1018
|
let tmpFile;
|
|
854
1019
|
try {
|
|
1020
|
+
let enrichedPrompt = context.prompt;
|
|
1021
|
+
try {
|
|
1022
|
+
const { buildCantEnrichedPrompt: buildCantEnrichedPrompt2 } = await Promise.resolve().then(() => (init_cant_context(), cant_context_exports));
|
|
1023
|
+
enrichedPrompt = await buildCantEnrichedPrompt2({
|
|
1024
|
+
projectDir: context.workingDirectory ?? process.cwd(),
|
|
1025
|
+
basePrompt: context.prompt,
|
|
1026
|
+
agentName: context.options?.agentName ?? void 0
|
|
1027
|
+
});
|
|
1028
|
+
} catch {
|
|
1029
|
+
}
|
|
855
1030
|
tmpFile = `/tmp/claude-spawn-${instanceId}.txt`;
|
|
856
|
-
await writeFile(tmpFile,
|
|
1031
|
+
await writeFile(tmpFile, enrichedPrompt, "utf-8");
|
|
857
1032
|
const args = ["--allow-insecure", "--no-upgrade-check", tmpFile];
|
|
858
1033
|
const spawnOpts = {
|
|
859
1034
|
detached: true,
|
|
@@ -954,7 +1129,7 @@ var init_spawn = __esm({
|
|
|
954
1129
|
|
|
955
1130
|
// packages/adapters/src/providers/claude-code/task-sync.ts
|
|
956
1131
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
957
|
-
import { join as
|
|
1132
|
+
import { join as join6 } from "node:path";
|
|
958
1133
|
function parseTaskId(content) {
|
|
959
1134
|
const match = content.match(/^\[T(\d+)\]/);
|
|
960
1135
|
return match ? `T${match[1]}` : null;
|
|
@@ -975,7 +1150,7 @@ function mapStatus(twStatus) {
|
|
|
975
1150
|
}
|
|
976
1151
|
}
|
|
977
1152
|
function getTodoWriteFilePath(projectDir) {
|
|
978
|
-
return
|
|
1153
|
+
return join6(projectDir, ".cleo", "sync", "todowrite-state.json");
|
|
979
1154
|
}
|
|
980
1155
|
var ClaudeCodeTaskSyncProvider;
|
|
981
1156
|
var init_task_sync = __esm({
|
|
@@ -1047,9 +1222,9 @@ var init_transport = __esm({
|
|
|
1047
1222
|
|
|
1048
1223
|
// packages/adapters/src/providers/claude-code/adapter.ts
|
|
1049
1224
|
import { exec as exec2 } from "node:child_process";
|
|
1050
|
-
import { existsSync as
|
|
1051
|
-
import { homedir as
|
|
1052
|
-
import { join as
|
|
1225
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1226
|
+
import { homedir as homedir6 } from "node:os";
|
|
1227
|
+
import { join as join7 } from "node:path";
|
|
1053
1228
|
import { promisify as promisify2 } from "node:util";
|
|
1054
1229
|
var execAsync2, ClaudeCodeAdapter;
|
|
1055
1230
|
var init_adapter = __esm({
|
|
@@ -1180,8 +1355,8 @@ var init_adapter = __esm({
|
|
|
1180
1355
|
} catch {
|
|
1181
1356
|
details.cliAvailable = false;
|
|
1182
1357
|
}
|
|
1183
|
-
const claudeConfigDir =
|
|
1184
|
-
const configExists =
|
|
1358
|
+
const claudeConfigDir = join7(homedir6(), ".claude");
|
|
1359
|
+
const configExists = existsSync5(claudeConfigDir);
|
|
1185
1360
|
details.configDirExists = configExists;
|
|
1186
1361
|
const entrypointSet = process.env.CLAUDE_CODE_ENTRYPOINT !== void 0;
|
|
1187
1362
|
details.entrypointEnvSet = entrypointSet;
|
|
@@ -1210,17 +1385,17 @@ var init_adapter = __esm({
|
|
|
1210
1385
|
});
|
|
1211
1386
|
|
|
1212
1387
|
// packages/adapters/src/providers/claude-code/statusline.ts
|
|
1213
|
-
import { existsSync as
|
|
1214
|
-
import { homedir as
|
|
1215
|
-
import { join as
|
|
1388
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
|
|
1389
|
+
import { homedir as homedir7 } from "node:os";
|
|
1390
|
+
import { join as join8 } from "node:path";
|
|
1216
1391
|
function getClaudeSettingsPath() {
|
|
1217
|
-
return process.env["CLAUDE_SETTINGS"] ??
|
|
1392
|
+
return process.env["CLAUDE_SETTINGS"] ?? join8(process.env["CLAUDE_HOME"] ?? join8(homedir7(), ".claude"), "settings.json");
|
|
1218
1393
|
}
|
|
1219
1394
|
function checkStatuslineIntegration() {
|
|
1220
1395
|
const settingsPath = getClaudeSettingsPath();
|
|
1221
|
-
if (!
|
|
1396
|
+
if (!existsSync6(settingsPath)) return "no_settings";
|
|
1222
1397
|
try {
|
|
1223
|
-
const settings = JSON.parse(
|
|
1398
|
+
const settings = JSON.parse(readFileSync5(settingsPath, "utf-8"));
|
|
1224
1399
|
const statusLine = settings.statusLine;
|
|
1225
1400
|
if (!statusLine?.type) return "not_configured";
|
|
1226
1401
|
if (statusLine.type !== "command") return "custom_no_cleo";
|
|
@@ -1228,10 +1403,10 @@ function checkStatuslineIntegration() {
|
|
|
1228
1403
|
if (cmd.includes("context-monitor.sh") || cmd.includes("cleo-statusline") || cmd.includes(".context-state.json") || cmd.includes("context-states")) {
|
|
1229
1404
|
return "configured";
|
|
1230
1405
|
}
|
|
1231
|
-
const scriptPath = cmd.startsWith("~") ? cmd.replace("~",
|
|
1232
|
-
if (
|
|
1406
|
+
const scriptPath = cmd.startsWith("~") ? cmd.replace("~", homedir7()) : cmd;
|
|
1407
|
+
if (existsSync6(scriptPath)) {
|
|
1233
1408
|
try {
|
|
1234
|
-
const content =
|
|
1409
|
+
const content = readFileSync5(scriptPath, "utf-8");
|
|
1235
1410
|
if (content.includes("context-state.json")) return "configured";
|
|
1236
1411
|
} catch {
|
|
1237
1412
|
}
|
|
@@ -1245,7 +1420,7 @@ function getStatuslineConfig(cleoHome) {
|
|
|
1245
1420
|
return {
|
|
1246
1421
|
statusLine: {
|
|
1247
1422
|
type: "command",
|
|
1248
|
-
command:
|
|
1423
|
+
command: join8(cleoHome, "lib", "session", "context-monitor.sh")
|
|
1249
1424
|
}
|
|
1250
1425
|
};
|
|
1251
1426
|
}
|
|
@@ -1456,8 +1631,8 @@ var init_hooks2 = __esm({
|
|
|
1456
1631
|
});
|
|
1457
1632
|
|
|
1458
1633
|
// packages/adapters/src/providers/cursor/install.ts
|
|
1459
|
-
import { existsSync as
|
|
1460
|
-
import { join as
|
|
1634
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "node:fs";
|
|
1635
|
+
import { join as join13 } from "node:path";
|
|
1461
1636
|
var INSTRUCTION_REFERENCES3, CursorInstallProvider;
|
|
1462
1637
|
var init_install2 = __esm({
|
|
1463
1638
|
"packages/adapters/src/providers/cursor/install.ts"() {
|
|
@@ -1499,14 +1674,14 @@ var init_install2 = __esm({
|
|
|
1499
1674
|
* Checks for .cursor/rules/cleo.mdc or .cursorrules with CLEO references.
|
|
1500
1675
|
*/
|
|
1501
1676
|
async isInstalled() {
|
|
1502
|
-
const mdcPath =
|
|
1503
|
-
if (
|
|
1677
|
+
const mdcPath = join13(process.cwd(), ".cursor", "rules", "cleo.mdc");
|
|
1678
|
+
if (existsSync9(mdcPath)) {
|
|
1504
1679
|
return true;
|
|
1505
1680
|
}
|
|
1506
|
-
const rulesPath =
|
|
1507
|
-
if (
|
|
1681
|
+
const rulesPath = join13(process.cwd(), ".cursorrules");
|
|
1682
|
+
if (existsSync9(rulesPath)) {
|
|
1508
1683
|
try {
|
|
1509
|
-
const content =
|
|
1684
|
+
const content = readFileSync7(rulesPath, "utf-8");
|
|
1510
1685
|
if (INSTRUCTION_REFERENCES3.some((ref) => content.includes(ref))) {
|
|
1511
1686
|
return true;
|
|
1512
1687
|
}
|
|
@@ -1549,11 +1724,11 @@ var init_install2 = __esm({
|
|
|
1549
1724
|
* @returns true if the file was modified
|
|
1550
1725
|
*/
|
|
1551
1726
|
updateLegacyRules(projectDir) {
|
|
1552
|
-
const rulesPath =
|
|
1553
|
-
if (!
|
|
1727
|
+
const rulesPath = join13(projectDir, ".cursorrules");
|
|
1728
|
+
if (!existsSync9(rulesPath)) {
|
|
1554
1729
|
return false;
|
|
1555
1730
|
}
|
|
1556
|
-
let content =
|
|
1731
|
+
let content = readFileSync7(rulesPath, "utf-8");
|
|
1557
1732
|
const missingRefs = INSTRUCTION_REFERENCES3.filter((ref) => !content.includes(ref));
|
|
1558
1733
|
if (missingRefs.length === 0) {
|
|
1559
1734
|
return false;
|
|
@@ -1572,8 +1747,8 @@ var init_install2 = __esm({
|
|
|
1572
1747
|
* @returns true if the file was created or modified
|
|
1573
1748
|
*/
|
|
1574
1749
|
updateModernRules(projectDir) {
|
|
1575
|
-
const rulesDir =
|
|
1576
|
-
const mdcPath =
|
|
1750
|
+
const rulesDir = join13(projectDir, ".cursor", "rules");
|
|
1751
|
+
const mdcPath = join13(rulesDir, "cleo.mdc");
|
|
1577
1752
|
const expectedContent = [
|
|
1578
1753
|
"---",
|
|
1579
1754
|
"description: CLEO task management protocol references",
|
|
@@ -1584,8 +1759,8 @@ var init_install2 = __esm({
|
|
|
1584
1759
|
...INSTRUCTION_REFERENCES3,
|
|
1585
1760
|
""
|
|
1586
1761
|
].join("\n");
|
|
1587
|
-
if (
|
|
1588
|
-
const existing =
|
|
1762
|
+
if (existsSync9(mdcPath)) {
|
|
1763
|
+
const existing = readFileSync7(mdcPath, "utf-8");
|
|
1589
1764
|
if (existing === expectedContent) {
|
|
1590
1765
|
return false;
|
|
1591
1766
|
}
|
|
@@ -1599,10 +1774,10 @@ var init_install2 = __esm({
|
|
|
1599
1774
|
*/
|
|
1600
1775
|
getUpdatedFileList(projectDir) {
|
|
1601
1776
|
const files = [];
|
|
1602
|
-
if (
|
|
1603
|
-
files.push(
|
|
1777
|
+
if (existsSync9(join13(projectDir, ".cursorrules"))) {
|
|
1778
|
+
files.push(join13(projectDir, ".cursorrules"));
|
|
1604
1779
|
}
|
|
1605
|
-
files.push(
|
|
1780
|
+
files.push(join13(projectDir, ".cursor", "rules", "cleo.mdc"));
|
|
1606
1781
|
return files;
|
|
1607
1782
|
}
|
|
1608
1783
|
};
|
|
@@ -1610,8 +1785,8 @@ var init_install2 = __esm({
|
|
|
1610
1785
|
});
|
|
1611
1786
|
|
|
1612
1787
|
// packages/adapters/src/providers/cursor/adapter.ts
|
|
1613
|
-
import { existsSync as
|
|
1614
|
-
import { join as
|
|
1788
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
1789
|
+
import { join as join14 } from "node:path";
|
|
1615
1790
|
var CursorAdapter;
|
|
1616
1791
|
var init_adapter2 = __esm({
|
|
1617
1792
|
"packages/adapters/src/providers/cursor/adapter.ts"() {
|
|
@@ -1705,14 +1880,14 @@ var init_adapter2 = __esm({
|
|
|
1705
1880
|
}
|
|
1706
1881
|
let configExists = false;
|
|
1707
1882
|
if (this.projectDir) {
|
|
1708
|
-
const cursorConfigDir =
|
|
1709
|
-
configExists =
|
|
1883
|
+
const cursorConfigDir = join14(this.projectDir, ".cursor");
|
|
1884
|
+
configExists = existsSync10(cursorConfigDir);
|
|
1710
1885
|
details.configDirExists = configExists;
|
|
1711
1886
|
}
|
|
1712
1887
|
const editorEnvSet = process.env.CURSOR_EDITOR !== void 0;
|
|
1713
1888
|
details.editorEnvSet = editorEnvSet;
|
|
1714
1889
|
if (this.projectDir) {
|
|
1715
|
-
const legacyRulesExist =
|
|
1890
|
+
const legacyRulesExist = existsSync10(join14(this.projectDir, ".cursorrules"));
|
|
1716
1891
|
details.legacyRulesExist = legacyRulesExist;
|
|
1717
1892
|
}
|
|
1718
1893
|
const healthy = configExists || editorEnvSet;
|
|
@@ -1916,8 +2091,8 @@ var init_hooks3 = __esm({
|
|
|
1916
2091
|
});
|
|
1917
2092
|
|
|
1918
2093
|
// packages/adapters/src/providers/opencode/install.ts
|
|
1919
|
-
import { existsSync as
|
|
1920
|
-
import { join as
|
|
2094
|
+
import { existsSync as existsSync15, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "node:fs";
|
|
2095
|
+
import { join as join20 } from "node:path";
|
|
1921
2096
|
var INSTRUCTION_REFERENCES6, OpenCodeInstallProvider;
|
|
1922
2097
|
var init_install3 = __esm({
|
|
1923
2098
|
"packages/adapters/src/providers/opencode/install.ts"() {
|
|
@@ -1937,7 +2112,7 @@ var init_install3 = __esm({
|
|
|
1937
2112
|
const details = {};
|
|
1938
2113
|
instructionFileUpdated = this.updateInstructionFile(projectDir);
|
|
1939
2114
|
if (instructionFileUpdated) {
|
|
1940
|
-
details.instructionFile =
|
|
2115
|
+
details.instructionFile = join20(projectDir, "AGENTS.md");
|
|
1941
2116
|
}
|
|
1942
2117
|
return {
|
|
1943
2118
|
success: true,
|
|
@@ -1959,10 +2134,10 @@ var init_install3 = __esm({
|
|
|
1959
2134
|
* Checks for CLEO references in AGENTS.md.
|
|
1960
2135
|
*/
|
|
1961
2136
|
async isInstalled() {
|
|
1962
|
-
const agentsMdPath =
|
|
1963
|
-
if (
|
|
2137
|
+
const agentsMdPath = join20(process.cwd(), "AGENTS.md");
|
|
2138
|
+
if (existsSync15(agentsMdPath)) {
|
|
1964
2139
|
try {
|
|
1965
|
-
const content =
|
|
2140
|
+
const content = readFileSync10(agentsMdPath, "utf-8");
|
|
1966
2141
|
if (INSTRUCTION_REFERENCES6.some((ref) => content.includes(ref))) {
|
|
1967
2142
|
return true;
|
|
1968
2143
|
}
|
|
@@ -1987,11 +2162,11 @@ var init_install3 = __esm({
|
|
|
1987
2162
|
* @returns true if the file was created or modified
|
|
1988
2163
|
*/
|
|
1989
2164
|
updateInstructionFile(projectDir) {
|
|
1990
|
-
const agentsMdPath =
|
|
2165
|
+
const agentsMdPath = join20(projectDir, "AGENTS.md");
|
|
1991
2166
|
let content = "";
|
|
1992
2167
|
let existed = false;
|
|
1993
|
-
if (
|
|
1994
|
-
content =
|
|
2168
|
+
if (existsSync15(agentsMdPath)) {
|
|
2169
|
+
content = readFileSync10(agentsMdPath, "utf-8");
|
|
1995
2170
|
existed = true;
|
|
1996
2171
|
}
|
|
1997
2172
|
const missingRefs = INSTRUCTION_REFERENCES6.filter((ref) => !content.includes(ref));
|
|
@@ -2015,7 +2190,7 @@ var init_install3 = __esm({
|
|
|
2015
2190
|
// packages/adapters/src/providers/opencode/spawn.ts
|
|
2016
2191
|
import { exec as exec6, spawn as nodeSpawn2 } from "node:child_process";
|
|
2017
2192
|
import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
2018
|
-
import { join as
|
|
2193
|
+
import { join as join21 } from "node:path";
|
|
2019
2194
|
import { promisify as promisify6 } from "node:util";
|
|
2020
2195
|
function buildOpenCodeAgentMarkdown(description, instructions) {
|
|
2021
2196
|
const normalizedDesc = description.replace(/\s+/g, " ").trim();
|
|
@@ -2030,11 +2205,11 @@ function buildOpenCodeAgentMarkdown(description, instructions) {
|
|
|
2030
2205
|
""
|
|
2031
2206
|
].join("\n");
|
|
2032
2207
|
}
|
|
2033
|
-
async function ensureSubagentDefinition(workingDirectory) {
|
|
2034
|
-
const agentDir =
|
|
2035
|
-
const agentPath =
|
|
2036
|
-
const description = "CLEO task executor with protocol compliance.";
|
|
2037
|
-
const instructions = [
|
|
2208
|
+
async function ensureSubagentDefinition(workingDirectory, enrichedInstructions) {
|
|
2209
|
+
const agentDir = join21(workingDirectory, ".opencode", "agent");
|
|
2210
|
+
const agentPath = join21(agentDir, `${OPENCODE_SUBAGENT_NAME}.md`);
|
|
2211
|
+
const description = "CLEO task executor with protocol compliance and CANT context.";
|
|
2212
|
+
const instructions = enrichedInstructions ?? [
|
|
2038
2213
|
"# CLEO Subagent",
|
|
2039
2214
|
"",
|
|
2040
2215
|
"You are a CLEO subagent executing a delegated task.",
|
|
@@ -2093,9 +2268,19 @@ var init_spawn2 = __esm({
|
|
|
2093
2268
|
const startTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
2094
2269
|
const workingDirectory = context.workingDirectory ?? process.cwd();
|
|
2095
2270
|
try {
|
|
2271
|
+
let enrichedInstructions;
|
|
2272
|
+
try {
|
|
2273
|
+
const { buildCantEnrichedPrompt: buildCantEnrichedPrompt2 } = await Promise.resolve().then(() => (init_cant_context(), cant_context_exports));
|
|
2274
|
+
enrichedInstructions = await buildCantEnrichedPrompt2({
|
|
2275
|
+
projectDir: workingDirectory,
|
|
2276
|
+
basePrompt: context.prompt,
|
|
2277
|
+
agentName: context.options?.agentName ?? void 0
|
|
2278
|
+
});
|
|
2279
|
+
} catch {
|
|
2280
|
+
}
|
|
2096
2281
|
let agentName;
|
|
2097
2282
|
try {
|
|
2098
|
-
agentName = await ensureSubagentDefinition(workingDirectory);
|
|
2283
|
+
agentName = await ensureSubagentDefinition(workingDirectory, enrichedInstructions);
|
|
2099
2284
|
} catch {
|
|
2100
2285
|
agentName = OPENCODE_FALLBACK_AGENT;
|
|
2101
2286
|
}
|
|
@@ -2195,8 +2380,8 @@ var init_spawn2 = __esm({
|
|
|
2195
2380
|
|
|
2196
2381
|
// packages/adapters/src/providers/opencode/adapter.ts
|
|
2197
2382
|
import { exec as exec7 } from "node:child_process";
|
|
2198
|
-
import { existsSync as
|
|
2199
|
-
import { join as
|
|
2383
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
2384
|
+
import { join as join22 } from "node:path";
|
|
2200
2385
|
import { promisify as promisify7 } from "node:util";
|
|
2201
2386
|
var execAsync7, OpenCodeAdapter;
|
|
2202
2387
|
var init_adapter3 = __esm({
|
|
@@ -2308,8 +2493,8 @@ var init_adapter3 = __esm({
|
|
|
2308
2493
|
details.cliAvailable = false;
|
|
2309
2494
|
}
|
|
2310
2495
|
if (this.projectDir) {
|
|
2311
|
-
const openCodeConfigDir =
|
|
2312
|
-
const configExists =
|
|
2496
|
+
const openCodeConfigDir = join22(this.projectDir, ".opencode");
|
|
2497
|
+
const configExists = existsSync16(openCodeConfigDir);
|
|
2313
2498
|
details.configDirExists = configExists;
|
|
2314
2499
|
}
|
|
2315
2500
|
const versionEnvSet = process.env.OPENCODE_VERSION !== void 0;
|
|
@@ -2518,21 +2703,21 @@ var init_hooks4 = __esm({
|
|
|
2518
2703
|
});
|
|
2519
2704
|
|
|
2520
2705
|
// packages/adapters/src/providers/pi/install.ts
|
|
2521
|
-
import { existsSync as
|
|
2522
|
-
import { homedir as
|
|
2523
|
-
import { join as
|
|
2706
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync9 } from "node:fs";
|
|
2707
|
+
import { homedir as homedir13 } from "node:os";
|
|
2708
|
+
import { join as join23 } from "node:path";
|
|
2524
2709
|
function getPiAgentDir() {
|
|
2525
2710
|
const env = process.env["PI_CODING_AGENT_DIR"];
|
|
2526
2711
|
if (env !== void 0 && env.length > 0) {
|
|
2527
|
-
if (env === "~") return
|
|
2528
|
-
if (env.startsWith("~/")) return
|
|
2712
|
+
if (env === "~") return homedir13();
|
|
2713
|
+
if (env.startsWith("~/")) return join23(homedir13(), env.slice(2));
|
|
2529
2714
|
return env;
|
|
2530
2715
|
}
|
|
2531
2716
|
const piHome = process.env["PI_HOME"];
|
|
2532
2717
|
if (piHome !== void 0 && piHome.length > 0) {
|
|
2533
|
-
return
|
|
2718
|
+
return join23(piHome, "agent");
|
|
2534
2719
|
}
|
|
2535
|
-
return
|
|
2720
|
+
return join23(homedir13(), ".pi", "agent");
|
|
2536
2721
|
}
|
|
2537
2722
|
var INSTRUCTION_REFERENCES7, PiInstallProvider;
|
|
2538
2723
|
var init_install4 = __esm({
|
|
@@ -2552,14 +2737,14 @@ var init_install4 = __esm({
|
|
|
2552
2737
|
const details = {};
|
|
2553
2738
|
const projectUpdated = this.updateInstructionFile(projectDir, "AGENTS.md");
|
|
2554
2739
|
if (projectUpdated) {
|
|
2555
|
-
details.instructionFile =
|
|
2740
|
+
details.instructionFile = join23(projectDir, "AGENTS.md");
|
|
2556
2741
|
}
|
|
2557
2742
|
let globalUpdated = false;
|
|
2558
2743
|
try {
|
|
2559
2744
|
const globalDir = getPiAgentDir();
|
|
2560
2745
|
globalUpdated = this.updateInstructionFile(globalDir, "AGENTS.md");
|
|
2561
2746
|
if (globalUpdated) {
|
|
2562
|
-
details.globalInstructionFile =
|
|
2747
|
+
details.globalInstructionFile = join23(globalDir, "AGENTS.md");
|
|
2563
2748
|
}
|
|
2564
2749
|
} catch {
|
|
2565
2750
|
}
|
|
@@ -2584,10 +2769,10 @@ var init_install4 = __esm({
|
|
|
2584
2769
|
* Checks for CLEO references in the project AGENTS.md.
|
|
2585
2770
|
*/
|
|
2586
2771
|
async isInstalled() {
|
|
2587
|
-
const agentsMdPath =
|
|
2588
|
-
if (
|
|
2772
|
+
const agentsMdPath = join23(process.cwd(), "AGENTS.md");
|
|
2773
|
+
if (existsSync17(agentsMdPath)) {
|
|
2589
2774
|
try {
|
|
2590
|
-
const content =
|
|
2775
|
+
const content = readFileSync11(agentsMdPath, "utf-8");
|
|
2591
2776
|
if (INSTRUCTION_REFERENCES7.some((ref) => content.includes(ref))) {
|
|
2592
2777
|
return true;
|
|
2593
2778
|
}
|
|
@@ -2595,9 +2780,9 @@ var init_install4 = __esm({
|
|
|
2595
2780
|
}
|
|
2596
2781
|
}
|
|
2597
2782
|
try {
|
|
2598
|
-
const globalPath =
|
|
2599
|
-
if (
|
|
2600
|
-
const content =
|
|
2783
|
+
const globalPath = join23(getPiAgentDir(), "AGENTS.md");
|
|
2784
|
+
if (existsSync17(globalPath)) {
|
|
2785
|
+
const content = readFileSync11(globalPath, "utf-8");
|
|
2601
2786
|
if (INSTRUCTION_REFERENCES7.some((ref) => content.includes(ref))) {
|
|
2602
2787
|
return true;
|
|
2603
2788
|
}
|
|
@@ -2624,11 +2809,11 @@ var init_install4 = __esm({
|
|
|
2624
2809
|
* @returns true if the file was created or modified
|
|
2625
2810
|
*/
|
|
2626
2811
|
updateInstructionFile(dir, filename) {
|
|
2627
|
-
const filePath =
|
|
2812
|
+
const filePath = join23(dir, filename);
|
|
2628
2813
|
let content = "";
|
|
2629
2814
|
let existed = false;
|
|
2630
|
-
if (
|
|
2631
|
-
content =
|
|
2815
|
+
if (existsSync17(filePath)) {
|
|
2816
|
+
content = readFileSync11(filePath, "utf-8");
|
|
2632
2817
|
existed = true;
|
|
2633
2818
|
}
|
|
2634
2819
|
const missingRefs = INSTRUCTION_REFERENCES7.filter((ref) => !content.includes(ref));
|
|
@@ -2803,22 +2988,22 @@ var init_spawn3 = __esm({
|
|
|
2803
2988
|
|
|
2804
2989
|
// packages/adapters/src/providers/pi/adapter.ts
|
|
2805
2990
|
import { exec as exec9 } from "node:child_process";
|
|
2806
|
-
import { existsSync as
|
|
2807
|
-
import { homedir as
|
|
2808
|
-
import { join as
|
|
2991
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
2992
|
+
import { homedir as homedir14 } from "node:os";
|
|
2993
|
+
import { join as join24 } from "node:path";
|
|
2809
2994
|
import { promisify as promisify9 } from "node:util";
|
|
2810
2995
|
function getPiAgentDir2() {
|
|
2811
2996
|
const env = process.env["PI_CODING_AGENT_DIR"];
|
|
2812
2997
|
if (env !== void 0 && env.length > 0) {
|
|
2813
|
-
if (env === "~") return
|
|
2814
|
-
if (env.startsWith("~/")) return
|
|
2998
|
+
if (env === "~") return homedir14();
|
|
2999
|
+
if (env.startsWith("~/")) return join24(homedir14(), env.slice(2));
|
|
2815
3000
|
return env;
|
|
2816
3001
|
}
|
|
2817
3002
|
const piHome = process.env["PI_HOME"];
|
|
2818
3003
|
if (piHome !== void 0 && piHome.length > 0) {
|
|
2819
|
-
return
|
|
3004
|
+
return join24(piHome, "agent");
|
|
2820
3005
|
}
|
|
2821
|
-
return
|
|
3006
|
+
return join24(homedir14(), ".pi", "agent");
|
|
2822
3007
|
}
|
|
2823
3008
|
var execAsync9, PiAdapter;
|
|
2824
3009
|
var init_adapter4 = __esm({
|
|
@@ -2936,12 +3121,12 @@ var init_adapter4 = __esm({
|
|
|
2936
3121
|
details.cliAvailable = false;
|
|
2937
3122
|
}
|
|
2938
3123
|
const agentDir = getPiAgentDir2();
|
|
2939
|
-
const agentDirExists =
|
|
3124
|
+
const agentDirExists = existsSync18(agentDir);
|
|
2940
3125
|
details.agentDirExists = agentDirExists;
|
|
2941
3126
|
details.agentDir = agentDir;
|
|
2942
3127
|
if (this.projectDir) {
|
|
2943
|
-
const projectPiDir =
|
|
2944
|
-
details.projectPiDirExists =
|
|
3128
|
+
const projectPiDir = join24(this.projectDir, ".pi");
|
|
3129
|
+
details.projectPiDirExists = existsSync18(projectPiDir);
|
|
2945
3130
|
}
|
|
2946
3131
|
details.piCodingAgentDirSet = process.env["PI_CODING_AGENT_DIR"] !== void 0;
|
|
2947
3132
|
details.piHomeSet = process.env["PI_HOME"] !== void 0;
|
|
@@ -2997,22 +3182,23 @@ var init_pi = __esm({
|
|
|
2997
3182
|
});
|
|
2998
3183
|
|
|
2999
3184
|
// packages/adapters/src/index.ts
|
|
3185
|
+
init_cant_context();
|
|
3000
3186
|
init_claude_code();
|
|
3001
3187
|
|
|
3002
3188
|
// packages/adapters/src/providers/codex/adapter.ts
|
|
3003
3189
|
import { exec as exec3 } from "node:child_process";
|
|
3004
|
-
import { existsSync as
|
|
3005
|
-
import { homedir as
|
|
3006
|
-
import { join as
|
|
3190
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
3191
|
+
import { homedir as homedir9 } from "node:os";
|
|
3192
|
+
import { join as join12 } from "node:path";
|
|
3007
3193
|
import { promisify as promisify3 } from "node:util";
|
|
3008
3194
|
|
|
3009
3195
|
// packages/adapters/src/providers/codex/hooks.ts
|
|
3010
|
-
import { homedir as
|
|
3011
|
-
import { join as
|
|
3196
|
+
import { homedir as homedir8 } from "node:os";
|
|
3197
|
+
import { join as join10 } from "node:path";
|
|
3012
3198
|
|
|
3013
3199
|
// packages/adapters/src/providers/shared/transcript-reader.ts
|
|
3014
3200
|
import { readdir as readdir2, readFile as readFile3 } from "node:fs/promises";
|
|
3015
|
-
import { join as
|
|
3201
|
+
import { join as join9 } from "node:path";
|
|
3016
3202
|
function parseTranscriptLines(raw) {
|
|
3017
3203
|
const turns = [];
|
|
3018
3204
|
const lines = raw.split("\n").filter((l) => l.trim());
|
|
@@ -3037,7 +3223,7 @@ async function readLatestTranscript(providerDir) {
|
|
|
3037
3223
|
if (!entry.isFile()) continue;
|
|
3038
3224
|
const name = entry.name;
|
|
3039
3225
|
if (name.endsWith(".json") || name.endsWith(".jsonl")) {
|
|
3040
|
-
allFiles.push(
|
|
3226
|
+
allFiles.push(join9(providerDir, name));
|
|
3041
3227
|
}
|
|
3042
3228
|
}
|
|
3043
3229
|
} catch {
|
|
@@ -3127,13 +3313,13 @@ var CodexHookProvider = class {
|
|
|
3127
3313
|
* @task T162 @epic T134
|
|
3128
3314
|
*/
|
|
3129
3315
|
async getTranscript(_sessionId, _projectDir) {
|
|
3130
|
-
return readLatestTranscript(
|
|
3316
|
+
return readLatestTranscript(join10(homedir8(), ".codex"));
|
|
3131
3317
|
}
|
|
3132
3318
|
};
|
|
3133
3319
|
|
|
3134
3320
|
// packages/adapters/src/providers/codex/install.ts
|
|
3135
|
-
import { existsSync as
|
|
3136
|
-
import { join as
|
|
3321
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
3322
|
+
import { join as join11 } from "node:path";
|
|
3137
3323
|
var INSTRUCTION_REFERENCES2 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
|
|
3138
3324
|
var CodexInstallProvider = class {
|
|
3139
3325
|
/**
|
|
@@ -3150,7 +3336,7 @@ var CodexInstallProvider = class {
|
|
|
3150
3336
|
const details = {};
|
|
3151
3337
|
instructionFileUpdated = this.updateInstructionFile(projectDir);
|
|
3152
3338
|
if (instructionFileUpdated) {
|
|
3153
|
-
details.instructionFile =
|
|
3339
|
+
details.instructionFile = join11(projectDir, "AGENTS.md");
|
|
3154
3340
|
}
|
|
3155
3341
|
return {
|
|
3156
3342
|
success: true,
|
|
@@ -3174,10 +3360,10 @@ var CodexInstallProvider = class {
|
|
|
3174
3360
|
* @task T162
|
|
3175
3361
|
*/
|
|
3176
3362
|
async isInstalled() {
|
|
3177
|
-
const agentsMdPath =
|
|
3178
|
-
if (
|
|
3363
|
+
const agentsMdPath = join11(process.cwd(), "AGENTS.md");
|
|
3364
|
+
if (existsSync7(agentsMdPath)) {
|
|
3179
3365
|
try {
|
|
3180
|
-
const content =
|
|
3366
|
+
const content = readFileSync6(agentsMdPath, "utf-8");
|
|
3181
3367
|
if (INSTRUCTION_REFERENCES2.some((ref) => content.includes(ref))) {
|
|
3182
3368
|
return true;
|
|
3183
3369
|
}
|
|
@@ -3204,11 +3390,11 @@ var CodexInstallProvider = class {
|
|
|
3204
3390
|
* @returns true if the file was created or modified
|
|
3205
3391
|
*/
|
|
3206
3392
|
updateInstructionFile(projectDir) {
|
|
3207
|
-
const agentsMdPath =
|
|
3393
|
+
const agentsMdPath = join11(projectDir, "AGENTS.md");
|
|
3208
3394
|
let content = "";
|
|
3209
3395
|
let existed = false;
|
|
3210
|
-
if (
|
|
3211
|
-
content =
|
|
3396
|
+
if (existsSync7(agentsMdPath)) {
|
|
3397
|
+
content = readFileSync6(agentsMdPath, "utf-8");
|
|
3212
3398
|
existed = true;
|
|
3213
3399
|
}
|
|
3214
3400
|
const missingRefs = INSTRUCTION_REFERENCES2.filter((ref) => !content.includes(ref));
|
|
@@ -3312,8 +3498,8 @@ var CodexAdapter = class {
|
|
|
3312
3498
|
} catch {
|
|
3313
3499
|
details.cliAvailable = false;
|
|
3314
3500
|
}
|
|
3315
|
-
const codexConfigDir =
|
|
3316
|
-
const configExists =
|
|
3501
|
+
const codexConfigDir = join12(homedir9(), ".codex");
|
|
3502
|
+
const configExists = existsSync8(codexConfigDir);
|
|
3317
3503
|
details.configDirExists = configExists;
|
|
3318
3504
|
const healthy = cliAvailable;
|
|
3319
3505
|
details.cliAvailable = cliAvailable;
|
|
@@ -3349,14 +3535,14 @@ init_cursor();
|
|
|
3349
3535
|
|
|
3350
3536
|
// packages/adapters/src/providers/gemini-cli/adapter.ts
|
|
3351
3537
|
import { exec as exec4 } from "node:child_process";
|
|
3352
|
-
import { existsSync as
|
|
3353
|
-
import { homedir as
|
|
3354
|
-
import { join as
|
|
3538
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
3539
|
+
import { homedir as homedir11 } from "node:os";
|
|
3540
|
+
import { join as join17 } from "node:path";
|
|
3355
3541
|
import { promisify as promisify4 } from "node:util";
|
|
3356
3542
|
|
|
3357
3543
|
// packages/adapters/src/providers/gemini-cli/hooks.ts
|
|
3358
|
-
import { homedir as
|
|
3359
|
-
import { join as
|
|
3544
|
+
import { homedir as homedir10 } from "node:os";
|
|
3545
|
+
import { join as join15 } from "node:path";
|
|
3360
3546
|
var GEMINI_CLI_EVENT_MAP = {
|
|
3361
3547
|
SessionStart: "SessionStart",
|
|
3362
3548
|
SessionEnd: "SessionEnd",
|
|
@@ -3434,13 +3620,13 @@ var GeminiCliHookProvider = class {
|
|
|
3434
3620
|
* @task T161 @epic T134
|
|
3435
3621
|
*/
|
|
3436
3622
|
async getTranscript(_sessionId, _projectDir) {
|
|
3437
|
-
return readLatestTranscript(
|
|
3623
|
+
return readLatestTranscript(join15(homedir10(), ".gemini"));
|
|
3438
3624
|
}
|
|
3439
3625
|
};
|
|
3440
3626
|
|
|
3441
3627
|
// packages/adapters/src/providers/gemini-cli/install.ts
|
|
3442
|
-
import { existsSync as
|
|
3443
|
-
import { join as
|
|
3628
|
+
import { existsSync as existsSync11, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "node:fs";
|
|
3629
|
+
import { join as join16 } from "node:path";
|
|
3444
3630
|
var INSTRUCTION_REFERENCES4 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
|
|
3445
3631
|
var GeminiCliInstallProvider = class {
|
|
3446
3632
|
/**
|
|
@@ -3457,7 +3643,7 @@ var GeminiCliInstallProvider = class {
|
|
|
3457
3643
|
const details = {};
|
|
3458
3644
|
instructionFileUpdated = this.updateInstructionFile(projectDir);
|
|
3459
3645
|
if (instructionFileUpdated) {
|
|
3460
|
-
details.instructionFile =
|
|
3646
|
+
details.instructionFile = join16(projectDir, "AGENTS.md");
|
|
3461
3647
|
}
|
|
3462
3648
|
return {
|
|
3463
3649
|
success: true,
|
|
@@ -3481,10 +3667,10 @@ var GeminiCliInstallProvider = class {
|
|
|
3481
3667
|
* @task T161
|
|
3482
3668
|
*/
|
|
3483
3669
|
async isInstalled() {
|
|
3484
|
-
const agentsMdPath =
|
|
3485
|
-
if (
|
|
3670
|
+
const agentsMdPath = join16(process.cwd(), "AGENTS.md");
|
|
3671
|
+
if (existsSync11(agentsMdPath)) {
|
|
3486
3672
|
try {
|
|
3487
|
-
const content =
|
|
3673
|
+
const content = readFileSync8(agentsMdPath, "utf-8");
|
|
3488
3674
|
if (INSTRUCTION_REFERENCES4.some((ref) => content.includes(ref))) {
|
|
3489
3675
|
return true;
|
|
3490
3676
|
}
|
|
@@ -3511,11 +3697,11 @@ var GeminiCliInstallProvider = class {
|
|
|
3511
3697
|
* @returns true if the file was created or modified
|
|
3512
3698
|
*/
|
|
3513
3699
|
updateInstructionFile(projectDir) {
|
|
3514
|
-
const agentsMdPath =
|
|
3700
|
+
const agentsMdPath = join16(projectDir, "AGENTS.md");
|
|
3515
3701
|
let content = "";
|
|
3516
3702
|
let existed = false;
|
|
3517
|
-
if (
|
|
3518
|
-
content =
|
|
3703
|
+
if (existsSync11(agentsMdPath)) {
|
|
3704
|
+
content = readFileSync8(agentsMdPath, "utf-8");
|
|
3519
3705
|
existed = true;
|
|
3520
3706
|
}
|
|
3521
3707
|
const missingRefs = INSTRUCTION_REFERENCES4.filter((ref) => !content.includes(ref));
|
|
@@ -3630,8 +3816,8 @@ var GeminiCliAdapter = class {
|
|
|
3630
3816
|
} catch {
|
|
3631
3817
|
details.cliAvailable = false;
|
|
3632
3818
|
}
|
|
3633
|
-
const geminiConfigDir =
|
|
3634
|
-
const configExists =
|
|
3819
|
+
const geminiConfigDir = join17(homedir11(), ".gemini");
|
|
3820
|
+
const configExists = existsSync12(geminiConfigDir);
|
|
3635
3821
|
details.configDirExists = configExists;
|
|
3636
3822
|
const healthy = cliAvailable;
|
|
3637
3823
|
details.cliAvailable = cliAvailable;
|
|
@@ -3664,9 +3850,9 @@ function createAdapter4() {
|
|
|
3664
3850
|
|
|
3665
3851
|
// packages/adapters/src/providers/kimi/adapter.ts
|
|
3666
3852
|
import { exec as exec5 } from "node:child_process";
|
|
3667
|
-
import { existsSync as
|
|
3668
|
-
import { homedir as
|
|
3669
|
-
import { join as
|
|
3853
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
3854
|
+
import { homedir as homedir12 } from "node:os";
|
|
3855
|
+
import { join as join19 } from "node:path";
|
|
3670
3856
|
import { promisify as promisify5 } from "node:util";
|
|
3671
3857
|
|
|
3672
3858
|
// packages/adapters/src/providers/kimi/hooks.ts
|
|
@@ -3725,8 +3911,8 @@ var KimiHookProvider = class {
|
|
|
3725
3911
|
};
|
|
3726
3912
|
|
|
3727
3913
|
// packages/adapters/src/providers/kimi/install.ts
|
|
3728
|
-
import { existsSync as
|
|
3729
|
-
import { join as
|
|
3914
|
+
import { existsSync as existsSync13, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "node:fs";
|
|
3915
|
+
import { join as join18 } from "node:path";
|
|
3730
3916
|
var INSTRUCTION_REFERENCES5 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
|
|
3731
3917
|
var KimiInstallProvider = class {
|
|
3732
3918
|
/**
|
|
@@ -3743,7 +3929,7 @@ var KimiInstallProvider = class {
|
|
|
3743
3929
|
const details = {};
|
|
3744
3930
|
instructionFileUpdated = this.updateInstructionFile(projectDir);
|
|
3745
3931
|
if (instructionFileUpdated) {
|
|
3746
|
-
details.instructionFile =
|
|
3932
|
+
details.instructionFile = join18(projectDir, "AGENTS.md");
|
|
3747
3933
|
}
|
|
3748
3934
|
return {
|
|
3749
3935
|
success: true,
|
|
@@ -3767,10 +3953,10 @@ var KimiInstallProvider = class {
|
|
|
3767
3953
|
* @task T163
|
|
3768
3954
|
*/
|
|
3769
3955
|
async isInstalled() {
|
|
3770
|
-
const agentsMdPath =
|
|
3771
|
-
if (
|
|
3956
|
+
const agentsMdPath = join18(process.cwd(), "AGENTS.md");
|
|
3957
|
+
if (existsSync13(agentsMdPath)) {
|
|
3772
3958
|
try {
|
|
3773
|
-
const content =
|
|
3959
|
+
const content = readFileSync9(agentsMdPath, "utf-8");
|
|
3774
3960
|
if (INSTRUCTION_REFERENCES5.some((ref) => content.includes(ref))) {
|
|
3775
3961
|
return true;
|
|
3776
3962
|
}
|
|
@@ -3797,11 +3983,11 @@ var KimiInstallProvider = class {
|
|
|
3797
3983
|
* @returns true if the file was created or modified
|
|
3798
3984
|
*/
|
|
3799
3985
|
updateInstructionFile(projectDir) {
|
|
3800
|
-
const agentsMdPath =
|
|
3986
|
+
const agentsMdPath = join18(projectDir, "AGENTS.md");
|
|
3801
3987
|
let content = "";
|
|
3802
3988
|
let existed = false;
|
|
3803
|
-
if (
|
|
3804
|
-
content =
|
|
3989
|
+
if (existsSync13(agentsMdPath)) {
|
|
3990
|
+
content = readFileSync9(agentsMdPath, "utf-8");
|
|
3805
3991
|
existed = true;
|
|
3806
3992
|
}
|
|
3807
3993
|
const missingRefs = INSTRUCTION_REFERENCES5.filter((ref) => !content.includes(ref));
|
|
@@ -3903,8 +4089,8 @@ var KimiAdapter = class {
|
|
|
3903
4089
|
} catch {
|
|
3904
4090
|
details.cliAvailable = false;
|
|
3905
4091
|
}
|
|
3906
|
-
const kimiConfigDir =
|
|
3907
|
-
const configExists =
|
|
4092
|
+
const kimiConfigDir = join19(homedir12(), ".kimi");
|
|
4093
|
+
const configExists = existsSync14(kimiConfigDir);
|
|
3908
4094
|
details.configDirExists = configExists;
|
|
3909
4095
|
const healthy = cliAvailable;
|
|
3910
4096
|
details.cliAvailable = cliAvailable;
|
|
@@ -3939,8 +4125,8 @@ function createAdapter5() {
|
|
|
3939
4125
|
init_opencode();
|
|
3940
4126
|
|
|
3941
4127
|
// packages/adapters/src/registry.ts
|
|
3942
|
-
import { readFileSync as
|
|
3943
|
-
import { dirname as dirname3, join as
|
|
4128
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
4129
|
+
import { dirname as dirname3, join as join25, resolve } from "node:path";
|
|
3944
4130
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
3945
4131
|
var PROVIDER_IDS = ["claude-code", "opencode", "cursor", "pi"];
|
|
3946
4132
|
function getProviderManifests() {
|
|
@@ -3948,8 +4134,8 @@ function getProviderManifests() {
|
|
|
3948
4134
|
const baseDir = resolve(dirname3(fileURLToPath2(import.meta.url)), "providers");
|
|
3949
4135
|
for (const providerId of PROVIDER_IDS) {
|
|
3950
4136
|
try {
|
|
3951
|
-
const manifestPath =
|
|
3952
|
-
const raw =
|
|
4137
|
+
const manifestPath = join25(baseDir, providerId, "manifest.json");
|
|
4138
|
+
const raw = readFileSync12(manifestPath, "utf-8");
|
|
3953
4139
|
manifests.push(JSON.parse(raw));
|
|
3954
4140
|
} catch {
|
|
3955
4141
|
}
|
|
@@ -4000,6 +4186,7 @@ export {
|
|
|
4000
4186
|
OpenCodeHookProvider,
|
|
4001
4187
|
OpenCodeInstallProvider,
|
|
4002
4188
|
OpenCodeSpawnProvider,
|
|
4189
|
+
buildCantEnrichedPrompt,
|
|
4003
4190
|
checkStatuslineIntegration,
|
|
4004
4191
|
createAdapter as createClaudeCodeAdapter,
|
|
4005
4192
|
createAdapter2 as createCodexAdapter,
|