@cleocode/adapters 2026.6.14 → 2026.6.17
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/index.js +285 -26
- package/dist/index.js.map +3 -3
- package/dist/providers/claude-code/spawn.d.ts +20 -4
- package/dist/providers/claude-code/spawn.d.ts.map +1 -1
- package/dist/providers/claude-code/suite-reaper.d.ts +41 -0
- package/dist/providers/claude-code/suite-reaper.d.ts.map +1 -0
- package/dist/providers/shared/agent-spawn-wrapper.d.ts +79 -0
- package/dist/providers/shared/agent-spawn-wrapper.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/__tests__/suite-containment.test.ts +347 -0
- package/src/providers/claude-code/spawn.ts +78 -11
- package/src/providers/claude-code/suite-reaper.ts +210 -0
- package/src/providers/shared/agent-spawn-wrapper.ts +222 -0
package/dist/index.js
CHANGED
|
@@ -11274,6 +11274,22 @@ var init_operations_registry = __esm({
|
|
|
11274
11274
|
}
|
|
11275
11275
|
]
|
|
11276
11276
|
},
|
|
11277
|
+
// ── selfimprove query: probe (T11988 — seeded-code-regression scenario) ────────
|
|
11278
|
+
// Pure read-only op that returns `{ probe: 'ok', version: probeVersion() }`.
|
|
11279
|
+
// The `probe-helper.ts` intentionally ships with `probeVersion()` returning `2`
|
|
11280
|
+
// (should be `1`) so the seeded-code-regression scenario replay diverges from its
|
|
11281
|
+
// golden (`version: 1`) and gives the fix-gen LLM stage a real, patchable bug.
|
|
11282
|
+
{
|
|
11283
|
+
gateway: "query",
|
|
11284
|
+
domain: "selfimprove",
|
|
11285
|
+
operation: "probe",
|
|
11286
|
+
description: 'selfimprove.probe (query) \u2014 returns { probe: "ok", version: 1 } (health/version probe). Used by the seeded-code-regression scenario to validate the fix-gen pipeline (T11988).',
|
|
11287
|
+
tier: 2,
|
|
11288
|
+
idempotent: true,
|
|
11289
|
+
sessionRequired: false,
|
|
11290
|
+
requiredParams: [],
|
|
11291
|
+
params: []
|
|
11292
|
+
},
|
|
11277
11293
|
// ── selfimprove mutate: run (T11889 / T11889-D — the self-dogfooding loop) ──
|
|
11278
11294
|
// Boots ONE sandbox → replays the named canned scenario → diffs result
|
|
11279
11295
|
// envelopes vs the golden → on a regression emits ONE leased `selfimprove_dhq`
|
|
@@ -11887,6 +11903,31 @@ var init_operations_registry = __esm({
|
|
|
11887
11903
|
cli: { positional: true }
|
|
11888
11904
|
}
|
|
11889
11905
|
]
|
|
11906
|
+
},
|
|
11907
|
+
// T11995 — Janitor MVP: orphan process reaper + stale scope/lock/debris sweep
|
|
11908
|
+
{
|
|
11909
|
+
gateway: "mutate",
|
|
11910
|
+
domain: "admin",
|
|
11911
|
+
operation: "janitor.run",
|
|
11912
|
+
description: "admin.janitor.run (mutate) \u2014 run the janitor sweep: reap orphan processes, stop dead cleo-owned scopes, reclaim stale locks, prune tmp debris",
|
|
11913
|
+
tier: 1,
|
|
11914
|
+
idempotent: true,
|
|
11915
|
+
sessionRequired: false,
|
|
11916
|
+
requiredParams: [],
|
|
11917
|
+
params: [
|
|
11918
|
+
{
|
|
11919
|
+
name: "dryRun",
|
|
11920
|
+
type: "boolean",
|
|
11921
|
+
required: false,
|
|
11922
|
+
description: "Report planned actions without mutating anything."
|
|
11923
|
+
},
|
|
11924
|
+
{
|
|
11925
|
+
name: "gracePeriodMs",
|
|
11926
|
+
type: "number",
|
|
11927
|
+
required: false,
|
|
11928
|
+
description: "Minimum age (ms) of an unregistered process before reap eligibility (default: 600000)."
|
|
11929
|
+
}
|
|
11930
|
+
]
|
|
11890
11931
|
}
|
|
11891
11932
|
];
|
|
11892
11933
|
}
|
|
@@ -42786,6 +42827,188 @@ var init_install = __esm({
|
|
|
42786
42827
|
}
|
|
42787
42828
|
});
|
|
42788
42829
|
|
|
42830
|
+
// packages/adapters/src/providers/shared/agent-spawn-wrapper.ts
|
|
42831
|
+
import { spawnSync } from "node:child_process";
|
|
42832
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
42833
|
+
function hasSystemdRun() {
|
|
42834
|
+
if (_systemdRunAvailable !== void 0) return _systemdRunAvailable;
|
|
42835
|
+
if (process.platform !== "linux") {
|
|
42836
|
+
_systemdRunAvailable = false;
|
|
42837
|
+
return false;
|
|
42838
|
+
}
|
|
42839
|
+
const probe = spawnSync("systemd-run", ["--version"], { stdio: "ignore" });
|
|
42840
|
+
_systemdRunAvailable = probe.status === 0;
|
|
42841
|
+
return _systemdRunAvailable;
|
|
42842
|
+
}
|
|
42843
|
+
function readMemTotalBytes() {
|
|
42844
|
+
if (process.platform !== "linux") return 32 * 1024 * 1024 * 1024;
|
|
42845
|
+
try {
|
|
42846
|
+
const raw = readFileSync6("/proc/meminfo", "utf8");
|
|
42847
|
+
const m = raw.match(/^MemTotal:\s+(\d+)\s+kB/m);
|
|
42848
|
+
if (m?.[1]) return parseInt(m[1], 10) * 1024;
|
|
42849
|
+
} catch {
|
|
42850
|
+
}
|
|
42851
|
+
return 32 * 1024 * 1024 * 1024;
|
|
42852
|
+
}
|
|
42853
|
+
function buildAgentSpawnArgs(command, args, scopeId) {
|
|
42854
|
+
if (!hasSystemdRun()) {
|
|
42855
|
+
if (!_demotionLogged) {
|
|
42856
|
+
_demotionLogged = true;
|
|
42857
|
+
process.stderr.write(
|
|
42858
|
+
"[cleo:agent-spawn-wrapper] systemd-run unavailable \u2014 falling back to plain pgid (detached) spawn; no cgroup containment\n"
|
|
42859
|
+
);
|
|
42860
|
+
}
|
|
42861
|
+
return {
|
|
42862
|
+
command: "sh",
|
|
42863
|
+
args: ["-c", 'ulimit -c 0; exec "$@"', "sh", command, ...args],
|
|
42864
|
+
ownership: {
|
|
42865
|
+
mode: "pgid"
|
|
42866
|
+
// pgid is populated after spawn; the caller patches it via the
|
|
42867
|
+
// returned child.pid (which is the pgid leader when detached: true).
|
|
42868
|
+
}
|
|
42869
|
+
};
|
|
42870
|
+
}
|
|
42871
|
+
const totalBytes = readMemTotalBytes();
|
|
42872
|
+
const maxStr = DEFAULT_MEMORY_MAX;
|
|
42873
|
+
const counter = ++_scopeCounter;
|
|
42874
|
+
const discriminator = scopeId ? scopeId.replace(/[^a-zA-Z0-9-]/g, "-").slice(0, 40) : String(counter);
|
|
42875
|
+
const unitName = `cleo-agent-session-${discriminator}.scope`;
|
|
42876
|
+
void totalBytes;
|
|
42877
|
+
const wrapArgs = [
|
|
42878
|
+
"--user",
|
|
42879
|
+
"--scope",
|
|
42880
|
+
`--slice=${CLEO_SLICE}`,
|
|
42881
|
+
`--unit=${unitName}`,
|
|
42882
|
+
"-p",
|
|
42883
|
+
`MemoryMax=${maxStr}`,
|
|
42884
|
+
"-p",
|
|
42885
|
+
"MemorySwapMax=0",
|
|
42886
|
+
// NOTE: ManagedOOMPreference=avoid is NOT set for agent sessions —
|
|
42887
|
+
// only daemon/db scope classes (write-txn holders) get 'avoid'.
|
|
42888
|
+
// See spawn-wrapper.ts OOM_AVOID_CLASSES and the module TSDoc for rationale.
|
|
42889
|
+
"--",
|
|
42890
|
+
"sh",
|
|
42891
|
+
"-c",
|
|
42892
|
+
'ulimit -c 0; exec "$@"',
|
|
42893
|
+
"sh",
|
|
42894
|
+
command,
|
|
42895
|
+
...args
|
|
42896
|
+
];
|
|
42897
|
+
return {
|
|
42898
|
+
command: "systemd-run",
|
|
42899
|
+
args: wrapArgs,
|
|
42900
|
+
ownership: {
|
|
42901
|
+
mode: "systemd",
|
|
42902
|
+
unitName
|
|
42903
|
+
// pgid is populated after spawn; caller patches via child.pid.
|
|
42904
|
+
}
|
|
42905
|
+
};
|
|
42906
|
+
}
|
|
42907
|
+
var CLEO_SLICE, DEFAULT_MEMORY_MAX, _systemdRunAvailable, _demotionLogged, _scopeCounter;
|
|
42908
|
+
var init_agent_spawn_wrapper = __esm({
|
|
42909
|
+
"packages/adapters/src/providers/shared/agent-spawn-wrapper.ts"() {
|
|
42910
|
+
"use strict";
|
|
42911
|
+
CLEO_SLICE = "cleo.slice";
|
|
42912
|
+
DEFAULT_MEMORY_MAX = "32G";
|
|
42913
|
+
_demotionLogged = false;
|
|
42914
|
+
_scopeCounter = 0;
|
|
42915
|
+
}
|
|
42916
|
+
});
|
|
42917
|
+
|
|
42918
|
+
// packages/adapters/src/providers/claude-code/suite-reaper.ts
|
|
42919
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
42920
|
+
async function reapAgentSuite(ownership) {
|
|
42921
|
+
switch (ownership.mode) {
|
|
42922
|
+
case "systemd":
|
|
42923
|
+
await reapSystemdScope(ownership);
|
|
42924
|
+
break;
|
|
42925
|
+
case "pgid":
|
|
42926
|
+
await reapPgidGroup(ownership);
|
|
42927
|
+
break;
|
|
42928
|
+
case "none":
|
|
42929
|
+
process.stderr.write(
|
|
42930
|
+
"[cleo:suite-reaper] containment mode=none \u2014 no reap performed; janitor (T11995) is the backstop\n"
|
|
42931
|
+
);
|
|
42932
|
+
break;
|
|
42933
|
+
default: {
|
|
42934
|
+
const _exhaustive = ownership.mode;
|
|
42935
|
+
void _exhaustive;
|
|
42936
|
+
}
|
|
42937
|
+
}
|
|
42938
|
+
}
|
|
42939
|
+
async function reapSystemdScope(ownership) {
|
|
42940
|
+
const { unitName, pgid } = ownership;
|
|
42941
|
+
if (unitName) {
|
|
42942
|
+
const stopResult = spawnSync2("systemctl", ["--user", "stop", unitName], {
|
|
42943
|
+
stdio: "ignore",
|
|
42944
|
+
timeout: 1e4
|
|
42945
|
+
});
|
|
42946
|
+
if (stopResult.error) {
|
|
42947
|
+
process.stderr.write(
|
|
42948
|
+
`[cleo:suite-reaper] systemctl stop failed (${stopResult.error.message}); falling back to pgid kill
|
|
42949
|
+
`
|
|
42950
|
+
);
|
|
42951
|
+
} else if (stopResult.status !== 0) {
|
|
42952
|
+
spawnSync2("systemctl", ["--user", "reset-failed", unitName], {
|
|
42953
|
+
stdio: "ignore",
|
|
42954
|
+
timeout: 5e3
|
|
42955
|
+
});
|
|
42956
|
+
if (pgid !== void 0) {
|
|
42957
|
+
await killPgidGracefully(pgid);
|
|
42958
|
+
}
|
|
42959
|
+
return;
|
|
42960
|
+
} else {
|
|
42961
|
+
spawnSync2("systemctl", ["--user", "reset-failed", unitName], {
|
|
42962
|
+
stdio: "ignore",
|
|
42963
|
+
timeout: 5e3
|
|
42964
|
+
});
|
|
42965
|
+
return;
|
|
42966
|
+
}
|
|
42967
|
+
}
|
|
42968
|
+
if (pgid !== void 0) {
|
|
42969
|
+
await killPgidGracefully(pgid);
|
|
42970
|
+
}
|
|
42971
|
+
}
|
|
42972
|
+
async function reapPgidGroup(ownership) {
|
|
42973
|
+
const { pgid } = ownership;
|
|
42974
|
+
if (pgid === void 0) return;
|
|
42975
|
+
await killPgidGracefully(pgid);
|
|
42976
|
+
}
|
|
42977
|
+
async function killPgidGracefully(pgid) {
|
|
42978
|
+
try {
|
|
42979
|
+
process.kill(-pgid, "SIGTERM");
|
|
42980
|
+
} catch (err) {
|
|
42981
|
+
if (isEsrch(err)) return;
|
|
42982
|
+
process.stderr.write(`[cleo:suite-reaper] SIGTERM to pgid=${pgid} failed: ${String(err)}
|
|
42983
|
+
`);
|
|
42984
|
+
}
|
|
42985
|
+
await sleep(SIGTERM_GRACE_MS);
|
|
42986
|
+
try {
|
|
42987
|
+
process.kill(-pgid, "SIGKILL");
|
|
42988
|
+
} catch (err) {
|
|
42989
|
+
if (isEsrch(err)) return;
|
|
42990
|
+
process.stderr.write(`[cleo:suite-reaper] SIGKILL to pgid=${pgid} failed: ${String(err)}
|
|
42991
|
+
`);
|
|
42992
|
+
}
|
|
42993
|
+
}
|
|
42994
|
+
function isEsrch(err) {
|
|
42995
|
+
if (typeof err === "object" && err !== null) {
|
|
42996
|
+
const code = err["code"];
|
|
42997
|
+
return code === "ESRCH";
|
|
42998
|
+
}
|
|
42999
|
+
return false;
|
|
43000
|
+
}
|
|
43001
|
+
function sleep(ms) {
|
|
43002
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
43003
|
+
}
|
|
43004
|
+
var SIGTERM_GRACE_MS;
|
|
43005
|
+
var init_suite_reaper = __esm({
|
|
43006
|
+
"packages/adapters/src/providers/claude-code/suite-reaper.ts"() {
|
|
43007
|
+
"use strict";
|
|
43008
|
+
SIGTERM_GRACE_MS = 3e3;
|
|
43009
|
+
}
|
|
43010
|
+
});
|
|
43011
|
+
|
|
42789
43012
|
// packages/adapters/src/providers/claude-code/spawn.ts
|
|
42790
43013
|
import { exec, spawn as nodeSpawn } from "node:child_process";
|
|
42791
43014
|
import { unlink, writeFile } from "node:fs/promises";
|
|
@@ -42795,6 +43018,8 @@ var init_spawn2 = __esm({
|
|
|
42795
43018
|
"packages/adapters/src/providers/claude-code/spawn.ts"() {
|
|
42796
43019
|
"use strict";
|
|
42797
43020
|
init_src();
|
|
43021
|
+
init_agent_spawn_wrapper();
|
|
43022
|
+
init_suite_reaper();
|
|
42798
43023
|
execAsync = promisify2(exec);
|
|
42799
43024
|
ClaudeCodeSpawnProvider = class {
|
|
42800
43025
|
/** Map of instance IDs to tracked process info. */
|
|
@@ -42842,15 +43067,17 @@ var init_spawn2 = __esm({
|
|
|
42842
43067
|
}
|
|
42843
43068
|
tmpFile = `/tmp/claude-spawn-${instanceId}.txt`;
|
|
42844
43069
|
await writeFile(tmpFile, enrichedPrompt, "utf-8");
|
|
42845
|
-
const
|
|
43070
|
+
const claudeArgs = [
|
|
42846
43071
|
"--print",
|
|
42847
43072
|
"--dangerously-skip-permissions",
|
|
42848
43073
|
"--output-format",
|
|
42849
43074
|
"json",
|
|
42850
43075
|
tmpFile
|
|
42851
43076
|
];
|
|
43077
|
+
const spawnBuild = buildAgentSpawnArgs("claude", claudeArgs, instanceId);
|
|
43078
|
+
const isSystemd = spawnBuild.ownership.mode === "systemd";
|
|
42852
43079
|
const spawnOpts = {
|
|
42853
|
-
detached:
|
|
43080
|
+
detached: !isSystemd,
|
|
42854
43081
|
stdio: ["ignore", "pipe", "pipe"]
|
|
42855
43082
|
};
|
|
42856
43083
|
if (context.workingDirectory) {
|
|
@@ -42860,13 +43087,19 @@ var init_spawn2 = __esm({
|
|
|
42860
43087
|
if (optionsEnv !== void 0 && Object.keys(optionsEnv).length > 0) {
|
|
42861
43088
|
spawnOpts.env = { ...process.env, ...optionsEnv };
|
|
42862
43089
|
}
|
|
42863
|
-
const child = nodeSpawn(
|
|
43090
|
+
const child = nodeSpawn(spawnBuild.command, spawnBuild.args, spawnOpts);
|
|
42864
43091
|
child.unref();
|
|
43092
|
+
const ownership = {
|
|
43093
|
+
...spawnBuild.ownership,
|
|
43094
|
+
pid: child.pid,
|
|
43095
|
+
pgid: spawnBuild.ownership.mode === "pgid" && child.pid !== void 0 ? child.pid : spawnBuild.ownership.pgid
|
|
43096
|
+
};
|
|
42865
43097
|
if (child.pid) {
|
|
42866
43098
|
this.processMap.set(instanceId, {
|
|
42867
43099
|
pid: child.pid,
|
|
42868
43100
|
taskId: context.taskId,
|
|
42869
|
-
startTime
|
|
43101
|
+
startTime,
|
|
43102
|
+
ownership
|
|
42870
43103
|
});
|
|
42871
43104
|
}
|
|
42872
43105
|
const capturedTmpFile = tmpFile;
|
|
@@ -42882,7 +43115,10 @@ var init_spawn2 = __esm({
|
|
|
42882
43115
|
taskId: context.taskId,
|
|
42883
43116
|
providerId: "claude-code",
|
|
42884
43117
|
status: "running",
|
|
42885
|
-
startTime
|
|
43118
|
+
startTime,
|
|
43119
|
+
// T11998: surface the ownership handle in the result so callers can
|
|
43120
|
+
// persist it or pass it to reapAgentSuite on session end.
|
|
43121
|
+
ownership
|
|
42886
43122
|
};
|
|
42887
43123
|
} catch (error48) {
|
|
42888
43124
|
console.error(`[ClaudeCodeSpawnProvider] Failed to spawn: ${getErrorMessage(error48)}`);
|
|
@@ -42921,7 +43157,9 @@ var init_spawn2 = __esm({
|
|
|
42921
43157
|
taskId: tracked.taskId,
|
|
42922
43158
|
providerId: "claude-code",
|
|
42923
43159
|
status: "running",
|
|
42924
|
-
startTime: tracked.startTime
|
|
43160
|
+
startTime: tracked.startTime,
|
|
43161
|
+
// T11998: propagate ownership handle so callers can reap the suite.
|
|
43162
|
+
ownership: tracked.ownership
|
|
42925
43163
|
});
|
|
42926
43164
|
} catch {
|
|
42927
43165
|
this.processMap.delete(instanceId);
|
|
@@ -42932,19 +43170,40 @@ var init_spawn2 = __esm({
|
|
|
42932
43170
|
/**
|
|
42933
43171
|
* Terminate a running spawn by instance ID.
|
|
42934
43172
|
*
|
|
42935
|
-
*
|
|
42936
|
-
*
|
|
43173
|
+
* Uses the suite-reaper to kill the entire process tree (root claude CLI +
|
|
43174
|
+
* all MCP grandchildren) via the containment handle recorded at spawn time.
|
|
43175
|
+
* Falls back to a direct SIGTERM on the tracked PID for legacy entries
|
|
43176
|
+
* that pre-date T11998 and lack an ownership handle.
|
|
43177
|
+
*
|
|
43178
|
+
* Idempotent: no-op if the instance is not found or has already exited.
|
|
42937
43179
|
*
|
|
42938
43180
|
* @param instanceId - ID of the spawn instance to terminate
|
|
43181
|
+
* @task T11998
|
|
42939
43182
|
*/
|
|
42940
43183
|
async terminate(instanceId) {
|
|
42941
43184
|
const tracked = this.processMap.get(instanceId);
|
|
42942
43185
|
if (!tracked) return;
|
|
43186
|
+
this.processMap.delete(instanceId);
|
|
42943
43187
|
try {
|
|
42944
|
-
|
|
43188
|
+
await reapAgentSuite(tracked.ownership);
|
|
42945
43189
|
} catch {
|
|
43190
|
+
try {
|
|
43191
|
+
process.kill(tracked.pid, "SIGTERM");
|
|
43192
|
+
} catch {
|
|
43193
|
+
}
|
|
42946
43194
|
}
|
|
42947
|
-
|
|
43195
|
+
}
|
|
43196
|
+
/**
|
|
43197
|
+
* Terminate all tracked spawn instances on session end.
|
|
43198
|
+
*
|
|
43199
|
+
* Called by the session lifecycle when a CLEO session ends, ensuring
|
|
43200
|
+
* no orphaned agent suites (root process + MCP children) remain.
|
|
43201
|
+
*
|
|
43202
|
+
* @task T11998
|
|
43203
|
+
*/
|
|
43204
|
+
async terminateAll() {
|
|
43205
|
+
const instanceIds = [...this.processMap.keys()];
|
|
43206
|
+
await Promise.allSettled(instanceIds.map((id) => this.terminate(id)));
|
|
42948
43207
|
}
|
|
42949
43208
|
};
|
|
42950
43209
|
}
|
|
@@ -43234,7 +43493,7 @@ var init_adapter = __esm({
|
|
|
43234
43493
|
});
|
|
43235
43494
|
|
|
43236
43495
|
// packages/adapters/src/providers/claude-code/statusline.ts
|
|
43237
|
-
import { existsSync as existsSync8, readFileSync as
|
|
43496
|
+
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
43238
43497
|
import { homedir as homedir8 } from "node:os";
|
|
43239
43498
|
import { join as join10 } from "node:path";
|
|
43240
43499
|
function getClaudeSettingsPath() {
|
|
@@ -43244,7 +43503,7 @@ function checkStatuslineIntegration() {
|
|
|
43244
43503
|
const settingsPath = getClaudeSettingsPath();
|
|
43245
43504
|
if (!existsSync8(settingsPath)) return "no_settings";
|
|
43246
43505
|
try {
|
|
43247
|
-
const settings = JSON.parse(
|
|
43506
|
+
const settings = JSON.parse(readFileSync7(settingsPath, "utf-8"));
|
|
43248
43507
|
const statusLine = settings.statusLine;
|
|
43249
43508
|
if (!statusLine?.type) return "not_configured";
|
|
43250
43509
|
if (statusLine.type !== "command") return "custom_no_cleo";
|
|
@@ -43255,7 +43514,7 @@ function checkStatuslineIntegration() {
|
|
|
43255
43514
|
const scriptPath = cmd.startsWith("~") ? cmd.replace("~", homedir8()) : cmd;
|
|
43256
43515
|
if (existsSync8(scriptPath)) {
|
|
43257
43516
|
try {
|
|
43258
|
-
const content =
|
|
43517
|
+
const content = readFileSync7(scriptPath, "utf-8");
|
|
43259
43518
|
if (content.includes("context-state.json")) return "configured";
|
|
43260
43519
|
} catch {
|
|
43261
43520
|
}
|
|
@@ -43488,7 +43747,7 @@ var init_hooks2 = __esm({
|
|
|
43488
43747
|
});
|
|
43489
43748
|
|
|
43490
43749
|
// packages/adapters/src/providers/cursor/install.ts
|
|
43491
|
-
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as
|
|
43750
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "node:fs";
|
|
43492
43751
|
import { join as join16 } from "node:path";
|
|
43493
43752
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile3 } from "@cleocode/caamp";
|
|
43494
43753
|
var CursorInstallProvider;
|
|
@@ -43546,7 +43805,7 @@ var init_install2 = __esm({
|
|
|
43546
43805
|
const rulesPath = join16(process.cwd(), ".cursorrules");
|
|
43547
43806
|
if (existsSync11(rulesPath)) {
|
|
43548
43807
|
try {
|
|
43549
|
-
const content =
|
|
43808
|
+
const content = readFileSync8(rulesPath, "utf-8");
|
|
43550
43809
|
const injectionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
43551
43810
|
if (content.includes(injectionRef) || content.includes("@.cleo/memory-bridge.md")) {
|
|
43552
43811
|
return true;
|
|
@@ -43599,7 +43858,7 @@ var init_install2 = __esm({
|
|
|
43599
43858
|
if (!existsSync11(rulesPath)) {
|
|
43600
43859
|
return false;
|
|
43601
43860
|
}
|
|
43602
|
-
let content =
|
|
43861
|
+
let content = readFileSync8(rulesPath, "utf-8");
|
|
43603
43862
|
const cursorRefs = [
|
|
43604
43863
|
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
43605
43864
|
"@.cleo/memory-bridge.md"
|
|
@@ -43640,7 +43899,7 @@ var init_install2 = __esm({
|
|
|
43640
43899
|
""
|
|
43641
43900
|
].join("\n");
|
|
43642
43901
|
if (existsSync11(mdcPath)) {
|
|
43643
|
-
const existing =
|
|
43902
|
+
const existing = readFileSync8(mdcPath, "utf-8");
|
|
43644
43903
|
if (existing === expectedContent) {
|
|
43645
43904
|
return false;
|
|
43646
43905
|
}
|
|
@@ -43716,7 +43975,7 @@ var init_install2 = __esm({
|
|
|
43716
43975
|
let config2 = {};
|
|
43717
43976
|
if (existsSync11(hooksJsonPath)) {
|
|
43718
43977
|
try {
|
|
43719
|
-
config2 = JSON.parse(
|
|
43978
|
+
config2 = JSON.parse(readFileSync8(hooksJsonPath, "utf-8"));
|
|
43720
43979
|
} catch {
|
|
43721
43980
|
}
|
|
43722
43981
|
}
|
|
@@ -44050,7 +44309,7 @@ var init_hooks3 = __esm({
|
|
|
44050
44309
|
});
|
|
44051
44310
|
|
|
44052
44311
|
// packages/adapters/src/providers/opencode/install.ts
|
|
44053
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync5, readFileSync as
|
|
44312
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync5 } from "node:fs";
|
|
44054
44313
|
import { join as join23 } from "node:path";
|
|
44055
44314
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile6 } from "@cleocode/caamp";
|
|
44056
44315
|
var OpenCodeInstallProvider;
|
|
@@ -44214,7 +44473,7 @@ var init_install3 = __esm({
|
|
|
44214
44473
|
].join("\n");
|
|
44215
44474
|
if (existsSync17(pluginPath)) {
|
|
44216
44475
|
try {
|
|
44217
|
-
if (
|
|
44476
|
+
if (readFileSync11(pluginPath, "utf-8") === generated) {
|
|
44218
44477
|
return false;
|
|
44219
44478
|
}
|
|
44220
44479
|
} catch {
|
|
@@ -45769,7 +46028,7 @@ var GeminiCliHookProvider = class {
|
|
|
45769
46028
|
|
|
45770
46029
|
// packages/adapters/src/providers/gemini-cli/install.ts
|
|
45771
46030
|
init_paths2();
|
|
45772
|
-
import { existsSync as existsSync13, readFileSync as
|
|
46031
|
+
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "node:fs";
|
|
45773
46032
|
import { join as join19 } from "node:path";
|
|
45774
46033
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile4 } from "@cleocode/caamp";
|
|
45775
46034
|
var GeminiCliInstallProvider = class {
|
|
@@ -45818,7 +46077,7 @@ var GeminiCliInstallProvider = class {
|
|
|
45818
46077
|
const geminiMdPath = join19(process.cwd(), "GEMINI.md");
|
|
45819
46078
|
if (existsSync13(geminiMdPath)) {
|
|
45820
46079
|
try {
|
|
45821
|
-
const content =
|
|
46080
|
+
const content = readFileSync9(geminiMdPath, "utf-8");
|
|
45822
46081
|
if (content.includes(instructionRef)) {
|
|
45823
46082
|
return true;
|
|
45824
46083
|
}
|
|
@@ -46041,7 +46300,7 @@ var KimiHookProvider = class {
|
|
|
46041
46300
|
|
|
46042
46301
|
// packages/adapters/src/providers/kimi/install.ts
|
|
46043
46302
|
init_paths2();
|
|
46044
|
-
import { existsSync as existsSync15, readFileSync as
|
|
46303
|
+
import { existsSync as existsSync15, readFileSync as readFileSync10 } from "node:fs";
|
|
46045
46304
|
import { join as join21 } from "node:path";
|
|
46046
46305
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile5 } from "@cleocode/caamp";
|
|
46047
46306
|
var KimiInstallProvider = class {
|
|
@@ -46090,7 +46349,7 @@ var KimiInstallProvider = class {
|
|
|
46090
46349
|
const agentsMdPath = join21(process.cwd(), "AGENTS.md");
|
|
46091
46350
|
if (existsSync15(agentsMdPath)) {
|
|
46092
46351
|
try {
|
|
46093
|
-
const content =
|
|
46352
|
+
const content = readFileSync10(agentsMdPath, "utf-8");
|
|
46094
46353
|
if (content.includes(instructionRef)) {
|
|
46095
46354
|
return true;
|
|
46096
46355
|
}
|
|
@@ -46241,7 +46500,7 @@ init_opencode();
|
|
|
46241
46500
|
init_hook_template_installer();
|
|
46242
46501
|
|
|
46243
46502
|
// packages/adapters/src/registry.ts
|
|
46244
|
-
import { readFileSync as
|
|
46503
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
46245
46504
|
import { dirname as dirname4, join as join28, resolve as resolve2 } from "node:path";
|
|
46246
46505
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
46247
46506
|
var PROVIDER_IDS = ["claude-code", "opencode", "cursor", "pi"];
|
|
@@ -46251,7 +46510,7 @@ function getProviderManifests() {
|
|
|
46251
46510
|
for (const providerId of PROVIDER_IDS) {
|
|
46252
46511
|
try {
|
|
46253
46512
|
const manifestPath = join28(baseDir, providerId, "manifest.json");
|
|
46254
|
-
const raw =
|
|
46513
|
+
const raw = readFileSync12(manifestPath, "utf-8");
|
|
46255
46514
|
manifests.push(JSON.parse(raw));
|
|
46256
46515
|
} catch {
|
|
46257
46516
|
}
|