@iowarp/clio-coder 0.3.0
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/CHANGELOG.md +407 -0
- package/CODE_OF_CONDUCT.md +21 -0
- package/CONTRIBUTING.md +224 -0
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +798 -0
- package/SECURITY.md +72 -0
- package/assets/clio-coder-logo-128.webp +0 -0
- package/damage-control-rules.yaml +419 -0
- package/dist/acp-UMLFVA3F.js +92 -0
- package/dist/agents-Q4MYPMUW.js +91 -0
- package/dist/auth-O6HYIJ6J.js +521 -0
- package/dist/chunk-262G75JS.js +35 -0
- package/dist/chunk-26BZQOAD.js +1281 -0
- package/dist/chunk-2J63S4SF.js +508 -0
- package/dist/chunk-3DANZDGR.js +717 -0
- package/dist/chunk-4UQA7NCT.js +29 -0
- package/dist/chunk-527KG6XR.js +497 -0
- package/dist/chunk-5LDRNKX2.js +1063 -0
- package/dist/chunk-5N2FG33Q.js +25 -0
- package/dist/chunk-67MTHP2E.js +135 -0
- package/dist/chunk-6CWDTGUC.js +20 -0
- package/dist/chunk-7BHLZB3A.js +2115 -0
- package/dist/chunk-7RBKDI66.js +348 -0
- package/dist/chunk-AMFR5YA3.js +541 -0
- package/dist/chunk-BBUH4VAA.js +1224 -0
- package/dist/chunk-BYEU76JP.js +899 -0
- package/dist/chunk-CLJ5HLUD.js +458 -0
- package/dist/chunk-D5YD55AR.js +116 -0
- package/dist/chunk-DXQNI4PC.js +61 -0
- package/dist/chunk-E3NYWENM.js +1004 -0
- package/dist/chunk-GNGDQYDU.js +34688 -0
- package/dist/chunk-GOTUR54M.js +9 -0
- package/dist/chunk-HBU5MTAM.js +41 -0
- package/dist/chunk-HMYNFFY4.js +28 -0
- package/dist/chunk-JPOWPFCU.js +1010 -0
- package/dist/chunk-JWHCJDCI.js +1215 -0
- package/dist/chunk-KBR4MZZR.js +41 -0
- package/dist/chunk-KKKPTZLM.js +93 -0
- package/dist/chunk-ME6DNWIU.js +66 -0
- package/dist/chunk-NI4DEJMC.js +88 -0
- package/dist/chunk-O4EJEDHO.js +659 -0
- package/dist/chunk-PIDUD6M2.js +31 -0
- package/dist/chunk-PS4PFJQP.js +29459 -0
- package/dist/chunk-QV47YRF4.js +48 -0
- package/dist/chunk-RQDWMVRB.js +279 -0
- package/dist/chunk-TFSSEXL6.js +136 -0
- package/dist/chunk-TKHQ4DGZ.js +8290 -0
- package/dist/chunk-TPOCL34A.js +2876 -0
- package/dist/chunk-UGYAX5YI.js +565 -0
- package/dist/chunk-UHTSULZS.js +461 -0
- package/dist/chunk-UU3R62TT.js +128 -0
- package/dist/chunk-UWIJNAOB.js +3906 -0
- package/dist/chunk-VOO7NYPP.js +914 -0
- package/dist/chunk-VPAWTYLY.js +117 -0
- package/dist/chunk-WD6AJM35.js +1216 -0
- package/dist/chunk-X3BR7HWV.js +115 -0
- package/dist/chunk-X3NE4WVW.js +120 -0
- package/dist/chunk-XNISANGE.js +1395 -0
- package/dist/chunk-XV4ZJ6ZM.js +3177 -0
- package/dist/cli/index.js +236 -0
- package/dist/clio-KIQ5SNDS.js +53 -0
- package/dist/components-JVHMUBEB.js +653 -0
- package/dist/config-ZFCDBMDC.js +372 -0
- package/dist/configure-G4E3A2PG.js +27 -0
- package/dist/context-CDXTP2MP.js +293 -0
- package/dist/context-E3KIFVXI.js +185 -0
- package/dist/context-clear-3F4PLXOS.js +102 -0
- package/dist/context-index-Q7YSYTR3.js +106 -0
- package/dist/docs-YIETIWZI.js +280 -0
- package/dist/doctor-M5HJJZOL.js +61 -0
- package/dist/domains/agents/builtins/architect.md +33 -0
- package/dist/domains/agents/builtins/coder.md +31 -0
- package/dist/domains/agents/builtins/context-bootstrap.md +38 -0
- package/dist/domains/agents/builtins/debugger.md +30 -0
- package/dist/domains/agents/builtins/documenter.md +31 -0
- package/dist/domains/agents/builtins/git-master.md +30 -0
- package/dist/domains/agents/builtins/provenance.md +30 -0
- package/dist/domains/agents/builtins/researcher.md +71 -0
- package/dist/domains/agents/builtins/scout.md +42 -0
- package/dist/domains/agents/builtins/tester.md +31 -0
- package/dist/domains/agents/builtins/verifier.md +30 -0
- package/dist/domains/agents/builtins/wiki-writer.md +41 -0
- package/dist/eval-B3KZZESM.js +2674 -0
- package/dist/evidence-V67CHM35.js +233 -0
- package/dist/evolve-YDZSUQYA.js +518 -0
- package/dist/extensions-SRG7XCAH.js +207 -0
- package/dist/fleet-CA2CRTVG.js +760 -0
- package/dist/fleet-preflight-CLIAX7YR.js +21 -0
- package/dist/init-2OZDJE2D.js +227 -0
- package/dist/memory-3PIQQAKX.js +207 -0
- package/dist/models-DY35XI7Y.js +237 -0
- package/dist/paths-5OMXW7Z4.js +57 -0
- package/dist/preload-KZVHET2B.js +11 -0
- package/dist/reset-PIFYNOS3.js +216 -0
- package/dist/run-3VSPP24F.js +735 -0
- package/dist/share-D36RQCXM.js +241 -0
- package/dist/skills-F2MRLELY.js +445 -0
- package/dist/skills-eval-E2ZTW4PL.js +932 -0
- package/dist/targets-DZMEZAH4.js +977 -0
- package/dist/trace-7NYCUI2J.js +250 -0
- package/dist/uninstall-AD3JWHBB.js +322 -0
- package/dist/upgrade-WYYBKGDY.js +301 -0
- package/dist/usage-ULIDAGFF.js +755 -0
- package/dist/version-ROZ6CZKH.js +16 -0
- package/dist/wiki-generate-PKFIX6OB.js +377 -0
- package/dist/worker/entry.js +1739 -0
- package/docs/README.md +93 -0
- package/docs/acp.md +120 -0
- package/docs/alcf-provider.md +72 -0
- package/docs/architecture.md +172 -0
- package/docs/artifact-versions.md +54 -0
- package/docs/built-in-agents.md +265 -0
- package/docs/capacity-and-scheduling.md +97 -0
- package/docs/commands-and-modes.md +554 -0
- package/docs/config-knobs-audit.md +115 -0
- package/docs/configuration-and-targets.md +812 -0
- package/docs/context-engine.md +236 -0
- package/docs/dispatch-architecture-rationale.md +126 -0
- package/docs/documentation-coverage.md +46 -0
- package/docs/documentation-guide.md +166 -0
- package/docs/environment-variables.md +105 -0
- package/docs/eval-runner.md +205 -0
- package/docs/evals-internal.md +298 -0
- package/docs/evidence-and-memory.md +243 -0
- package/docs/evolution.md +143 -0
- package/docs/exit-codes-and-output.md +74 -0
- package/docs/extensions-and-sharing.md +306 -0
- package/docs/fleet-demo-runbook.md +179 -0
- package/docs/fleet-dispatch.md +591 -0
- package/docs/glossary.md +75 -0
- package/docs/html/agents_blueprint.html +936 -0
- package/docs/html/alcf_blueprint.html +324 -0
- package/docs/html/architecture_blueprint.html +850 -0
- package/docs/html/commands_blueprint.html +794 -0
- package/docs/html/config_knobs_audit_blueprint.html +178 -0
- package/docs/html/configuration_blueprint.html +1080 -0
- package/docs/html/context_blueprint.html +603 -0
- package/docs/html/documentation_blueprint.html +832 -0
- package/docs/html/environment_blueprint.html +404 -0
- package/docs/html/eval_blueprint.html +743 -0
- package/docs/html/evals_internal_blueprint.html +190 -0
- package/docs/html/evolution_blueprint.html +674 -0
- package/docs/html/extensions_blueprint.html +2065 -0
- package/docs/html/fleet_dispatch_blueprint.html +286 -0
- package/docs/html/index.html +919 -0
- package/docs/html/lifecycle_blueprint.html +723 -0
- package/docs/html/memory_blueprint.html +699 -0
- package/docs/html/middleware_blueprint.html +664 -0
- package/docs/html/models_blueprint.html +2366 -0
- package/docs/html/observability_blueprint.html +683 -0
- package/docs/html/provider_adapter_blueprint.html +245 -0
- package/docs/html/safety_blueprint.html +1386 -0
- package/docs/html/shared.css +571 -0
- package/docs/html/shared.js +143 -0
- package/docs/html/skills_blueprint.html +671 -0
- package/docs/html/soak_blueprint.html +182 -0
- package/docs/html/tool_usage_blueprint.html +350 -0
- package/docs/html/tools_blueprint.html +2249 -0
- package/docs/html/trace_blueprint.html +235 -0
- package/docs/html/tui_design_blueprint.html +314 -0
- package/docs/html/validation_blueprint.html +961 -0
- package/docs/html/worker_dispatch_blueprint.html +231 -0
- package/docs/installation-and-lifecycle.md +308 -0
- package/docs/middleware-and-components.md +148 -0
- package/docs/model-catalog.md +189 -0
- package/docs/observability.md +233 -0
- package/docs/proactive-memory.md +452 -0
- package/docs/prompt-envelope-and-tools.md +142 -0
- package/docs/provider-adapter-cookbook.md +148 -0
- package/docs/release-cut-checklist.md +138 -0
- package/docs/safety-model.md +357 -0
- package/docs/scientific-validation.md +105 -0
- package/docs/session-lifecycle.md +156 -0
- package/docs/skills-marketplace.md +46 -0
- package/docs/tool-usage.md +527 -0
- package/docs/trace-store.md +132 -0
- package/docs/troubleshooting.md +33 -0
- package/docs/tui-design.md +239 -0
- package/docs/worker-dispatch-mechanics.md +242 -0
- package/package.json +132 -0
- package/skills/README.md +408 -0
- package/skills/git/commit-crafting/SKILL.md +79 -0
- package/skills/git/commit-crafting/evals.md +92 -0
- package/skills/git/create-pr/SKILL.md +116 -0
- package/skills/git/create-pr/evals.md +114 -0
- package/skills/git/investigate-issue/SKILL.md +139 -0
- package/skills/git/investigate-issue/evals.md +94 -0
- package/skills/git/resolve-merge-conflicts/SKILL.md +96 -0
- package/skills/git/resolve-merge-conflicts/evals.md +58 -0
- package/skills/git/review-changes/SKILL.md +103 -0
- package/skills/git/review-changes/evals.md +85 -0
- package/skills/git/worktree-create/SKILL.md +92 -0
- package/skills/git/worktree-create/evals.md +97 -0
- package/skills/git/worktree-create/references/worktree-setup.md +66 -0
- package/skills/git/worktree-merge/SKILL.md +95 -0
- package/skills/git/worktree-merge/evals.md +114 -0
- package/skills/skill-marketplace.json +261 -0
- package/skills/workflow/cut-it/SKILL.md +86 -0
- package/skills/workflow/cut-it/evals.md +42 -0
- package/src/domains/agents/builtins/architect.md +33 -0
- package/src/domains/agents/builtins/coder.md +31 -0
- package/src/domains/agents/builtins/context-bootstrap.md +38 -0
- package/src/domains/agents/builtins/debugger.md +30 -0
- package/src/domains/agents/builtins/documenter.md +31 -0
- package/src/domains/agents/builtins/git-master.md +30 -0
- package/src/domains/agents/builtins/provenance.md +30 -0
- package/src/domains/agents/builtins/researcher.md +71 -0
- package/src/domains/agents/builtins/scout.md +42 -0
- package/src/domains/agents/builtins/tester.md +31 -0
- package/src/domains/agents/builtins/verifier.md +30 -0
- package/src/domains/agents/builtins/wiki-writer.md +41 -0
- package/src/domains/agents/fleets/build-review.md +34 -0
- package/src/domains/agents/fleets/build-test.md +35 -0
- package/src/domains/agents/fleets/sdlc.md +86 -0
- package/src/domains/prompts/fragments/identity/clio-worker.md +11 -0
- package/src/domains/prompts/fragments/identity/clio.md +26 -0
- package/src/domains/prompts/fragments/operating/contract.md +64 -0
- package/src/domains/prompts/fragments/safety/auto-edit.md +14 -0
- package/src/domains/prompts/fragments/safety/full-auto.md +14 -0
- package/src/domains/prompts/fragments/safety/read-only.md +13 -0
- package/src/domains/prompts/fragments/safety/suggest.md +13 -0
- package/src/domains/prompts/fragments/wiki/page.md +75 -0
- package/src/domains/prompts/fragments/wiki/plan.md +48 -0
- package/src/domains/providers/models/cloud-models/alcf.yaml +40 -0
- package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +993 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getVersionInfo
|
|
3
|
+
} from "./chunk-HMYNFFY4.js";
|
|
4
|
+
import {
|
|
5
|
+
fingerprintNativeRuntime
|
|
6
|
+
} from "./chunk-262G75JS.js";
|
|
7
|
+
import {
|
|
8
|
+
initializeClioHome
|
|
9
|
+
} from "./chunk-TFSSEXL6.js";
|
|
10
|
+
import {
|
|
11
|
+
formatSettingsIssues,
|
|
12
|
+
readSettings,
|
|
13
|
+
validateSettingsFile
|
|
14
|
+
} from "./chunk-JWHCJDCI.js";
|
|
15
|
+
import {
|
|
16
|
+
openAuthStorage
|
|
17
|
+
} from "./chunk-5LDRNKX2.js";
|
|
18
|
+
import {
|
|
19
|
+
readSessionFileEntries
|
|
20
|
+
} from "./chunk-UGYAX5YI.js";
|
|
21
|
+
import {
|
|
22
|
+
clioStatePath,
|
|
23
|
+
resolveClioDirs
|
|
24
|
+
} from "./chunk-X3NE4WVW.js";
|
|
25
|
+
|
|
26
|
+
// src/domains/lifecycle/state.ts
|
|
27
|
+
import { readFileSync } from "node:fs";
|
|
28
|
+
import { join } from "node:path";
|
|
29
|
+
function readStateInfoResult() {
|
|
30
|
+
const path = join(clioStatePath(), "install.json");
|
|
31
|
+
try {
|
|
32
|
+
return { info: JSON.parse(readFileSync(path, "utf8")), problem: null };
|
|
33
|
+
} catch (error) {
|
|
34
|
+
const code = typeof error === "object" && error !== null && "code" in error ? String(error.code) : "";
|
|
35
|
+
if (code === "ENOENT") return { info: null, problem: null };
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
return { info: null, problem: `${path} could not be read: ${message}` };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function readStateInfo() {
|
|
41
|
+
return readStateInfoResult().info;
|
|
42
|
+
}
|
|
43
|
+
function ensureClioState() {
|
|
44
|
+
initializeClioHome();
|
|
45
|
+
const info = readStateInfo();
|
|
46
|
+
if (!info) throw new Error("state metadata was not written by initializeClioHome()");
|
|
47
|
+
return info;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/domains/lifecycle/doctor.ts
|
|
51
|
+
import { accessSync, chmodSync, constants, existsSync, readdirSync, statSync } from "node:fs";
|
|
52
|
+
import { join as join2 } from "node:path";
|
|
53
|
+
function describeNodeType(stats) {
|
|
54
|
+
if (stats.isFile()) return "a regular file";
|
|
55
|
+
if (stats.isSymbolicLink()) return "a symlink";
|
|
56
|
+
if (stats.isFIFO()) return "a FIFO";
|
|
57
|
+
if (stats.isSocket()) return "a socket";
|
|
58
|
+
if (stats.isBlockDevice() || stats.isCharacterDevice()) return "a device node";
|
|
59
|
+
return "not a directory";
|
|
60
|
+
}
|
|
61
|
+
function directoryFinding(name, path) {
|
|
62
|
+
let stats;
|
|
63
|
+
try {
|
|
64
|
+
stats = statSync(path);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
const code = typeof error === "object" && error !== null && "code" in error ? String(error.code) : "";
|
|
67
|
+
if (code === "ENOENT") return { ok: false, name, detail: `${path} missing (run \`clio-coder doctor --fix\`)` };
|
|
68
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
69
|
+
return { ok: false, name, detail: `${path} cannot be inspected: ${message}` };
|
|
70
|
+
}
|
|
71
|
+
if (!stats.isDirectory()) {
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
name,
|
|
75
|
+
detail: `${path} is ${describeNodeType(stats)}, not a directory (move it aside, then run \`clio-coder doctor --fix\`)`
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const missing = [
|
|
79
|
+
["readable", constants.R_OK],
|
|
80
|
+
["writable", constants.W_OK],
|
|
81
|
+
["traversable", constants.X_OK]
|
|
82
|
+
].filter(([, bit]) => {
|
|
83
|
+
try {
|
|
84
|
+
accessSync(path, bit);
|
|
85
|
+
return false;
|
|
86
|
+
} catch {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}).map(([label]) => label);
|
|
90
|
+
if (missing.length > 0) {
|
|
91
|
+
return { ok: false, name, detail: `${path} is not ${missing.join(" or ")} (run \`chmod u+rwx\` on it)` };
|
|
92
|
+
}
|
|
93
|
+
return { ok: true, name, detail: path };
|
|
94
|
+
}
|
|
95
|
+
var SESSION_STORE_DAMAGE_DETAIL_LIMIT = 3;
|
|
96
|
+
var SESSION_STORE_DAMAGE_LOCATION_LIMIT = 2;
|
|
97
|
+
function summarizeSessionDamage(warnings) {
|
|
98
|
+
const byMessage = /* @__PURE__ */ new Map();
|
|
99
|
+
for (const warning of warnings) {
|
|
100
|
+
const locations = byMessage.get(warning.message) ?? [];
|
|
101
|
+
locations.push(`${warning.path}:${warning.line}`);
|
|
102
|
+
byMessage.set(warning.message, locations);
|
|
103
|
+
}
|
|
104
|
+
return Array.from(byMessage, ([message, locations]) => {
|
|
105
|
+
const shown = locations.slice(0, SESSION_STORE_DAMAGE_LOCATION_LIMIT);
|
|
106
|
+
const rest = locations.length - shown.length;
|
|
107
|
+
return `${shown.join(", ")}${rest > 0 ? `, +${rest} more` : ""}: ${message}`;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function collectSessionLedgers(dir, ledgers, unlistable) {
|
|
111
|
+
let entries;
|
|
112
|
+
try {
|
|
113
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
114
|
+
} catch (error) {
|
|
115
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
116
|
+
unlistable.push(`${dir} could not be listed: ${message}`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
for (const entry of entries) {
|
|
120
|
+
const full = join2(dir, entry.name);
|
|
121
|
+
if (entry.isDirectory()) {
|
|
122
|
+
collectSessionLedgers(full, ledgers, unlistable);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (entry.isFile() && entry.name.endsWith(".jsonl")) ledgers.push(full);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function sessionStoreFinding(stateDir, stateMetadataPresent) {
|
|
129
|
+
const store = join2(stateDir, "sessions");
|
|
130
|
+
const usable = directoryFinding("session store", store);
|
|
131
|
+
if (!usable.ok) {
|
|
132
|
+
if (!stateMetadataPresent && !existsSync(store)) return null;
|
|
133
|
+
return usable;
|
|
134
|
+
}
|
|
135
|
+
const ledgers = [];
|
|
136
|
+
const unlistable = [];
|
|
137
|
+
collectSessionLedgers(store, ledgers, unlistable);
|
|
138
|
+
const damaged = [];
|
|
139
|
+
for (const ledger of ledgers) {
|
|
140
|
+
const first = [];
|
|
141
|
+
readSessionFileEntries(ledger, {
|
|
142
|
+
onWarning: (warning2) => {
|
|
143
|
+
if (first.length === 0) first.push(warning2);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const warning = first[0];
|
|
147
|
+
if (warning) damaged.push(warning);
|
|
148
|
+
}
|
|
149
|
+
if (damaged.length === 0 && unlistable.length === 0) {
|
|
150
|
+
return {
|
|
151
|
+
ok: true,
|
|
152
|
+
name: "session store",
|
|
153
|
+
detail: ledgers.length === 0 ? `${store} (no sessions recorded)` : `${store} (${ledgers.length} readable)`
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const clauses = summarizeSessionDamage(damaged);
|
|
157
|
+
const shown = clauses.slice(0, SESSION_STORE_DAMAGE_DETAIL_LIMIT);
|
|
158
|
+
const remainder = clauses.length - shown.length;
|
|
159
|
+
const parts = [];
|
|
160
|
+
if (damaged.length > 0) {
|
|
161
|
+
parts.push(
|
|
162
|
+
`${damaged.length} of ${ledgers.length} ledgers hold lines that cannot be read: ${shown.join("; ")}${remainder > 0 ? `; +${remainder} more` : ""}`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
parts.push(...unlistable);
|
|
166
|
+
return { ok: false, name: "session store", detail: parts.join("; ") };
|
|
167
|
+
}
|
|
168
|
+
function credentialsDamage() {
|
|
169
|
+
try {
|
|
170
|
+
return openAuthStorage().damageReason();
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return error instanceof Error ? error.message : String(error);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function runDoctor(options = {}) {
|
|
176
|
+
let repairFailure = null;
|
|
177
|
+
if (options.fix) {
|
|
178
|
+
try {
|
|
179
|
+
initializeClioHome();
|
|
180
|
+
const credentialsPath = join2(resolveClioDirs().config, "credentials.yaml");
|
|
181
|
+
if (existsSync(credentialsPath)) {
|
|
182
|
+
chmodSync(credentialsPath, 384);
|
|
183
|
+
}
|
|
184
|
+
} catch (error) {
|
|
185
|
+
repairFailure = error instanceof Error ? error.message : String(error);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const findings = [];
|
|
189
|
+
if (repairFailure !== null) {
|
|
190
|
+
findings.push({ ok: false, name: "repair", detail: `--fix could not finish: ${repairFailure}` });
|
|
191
|
+
}
|
|
192
|
+
const version = getVersionInfo();
|
|
193
|
+
findings.push({ ok: true, name: "Clio Coder version", detail: version.clio });
|
|
194
|
+
findings.push({ ok: true, name: "node version", detail: version.node });
|
|
195
|
+
findings.push({ ok: true, name: "platform", detail: version.platform });
|
|
196
|
+
const engineReady = Boolean(version.piAgentCore && version.piAi && version.piTui);
|
|
197
|
+
findings.push({
|
|
198
|
+
ok: engineReady,
|
|
199
|
+
name: "engine runtime",
|
|
200
|
+
detail: engineReady ? "ready" : "missing required packages"
|
|
201
|
+
});
|
|
202
|
+
const dirs = resolveClioDirs();
|
|
203
|
+
const config = dirs.config;
|
|
204
|
+
findings.push(directoryFinding("config dir", config));
|
|
205
|
+
findings.push(directoryFinding("data dir", dirs.data));
|
|
206
|
+
findings.push(directoryFinding("state dir", dirs.state));
|
|
207
|
+
findings.push(directoryFinding("cache dir", dirs.cache));
|
|
208
|
+
const settings = join2(config, "settings.yaml");
|
|
209
|
+
if (!existsSync(settings)) {
|
|
210
|
+
findings.push({
|
|
211
|
+
ok: false,
|
|
212
|
+
name: "settings.yaml",
|
|
213
|
+
detail: "missing (run `clio-coder doctor --fix` or `clio-coder configure`)"
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
const validation = validateSettingsFile();
|
|
217
|
+
if (validation.issues.length === 0) {
|
|
218
|
+
findings.push({ ok: true, name: "settings.yaml", detail: settings });
|
|
219
|
+
} else {
|
|
220
|
+
findings.push({ ok: false, name: "settings.yaml", detail: formatSettingsIssues(validation.issues) });
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const creds = join2(config, "credentials.yaml");
|
|
224
|
+
if (!existsSync(creds)) {
|
|
225
|
+
findings.push({ ok: false, name: "credentials", detail: "missing (run `clio-coder doctor --fix`)" });
|
|
226
|
+
} else {
|
|
227
|
+
try {
|
|
228
|
+
accessSync(creds, constants.R_OK);
|
|
229
|
+
const st = statSync(creds);
|
|
230
|
+
const mode = st.mode & 511;
|
|
231
|
+
const damage = credentialsDamage();
|
|
232
|
+
findings.push({
|
|
233
|
+
ok: mode === 384 && damage === null,
|
|
234
|
+
name: "credentials",
|
|
235
|
+
detail: damage === null ? mode.toString(8) : `${mode.toString(8)}; ${damage}`
|
|
236
|
+
});
|
|
237
|
+
} catch (err) {
|
|
238
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
239
|
+
findings.push({
|
|
240
|
+
ok: false,
|
|
241
|
+
name: "credentials",
|
|
242
|
+
detail: foldDetail(`${creds} cannot be read: ${message} (run \`clio-coder doctor --fix\`)`)
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const stateRead = readStateInfoResult();
|
|
247
|
+
const state = stateRead.info;
|
|
248
|
+
const stateCurrent = Boolean(state && state.version === version.clio);
|
|
249
|
+
const stateStamps = state ? [
|
|
250
|
+
state.installedAt ? `installed ${state.installedAt}` : null,
|
|
251
|
+
state.repairedAt ? `repaired ${state.repairedAt}` : null,
|
|
252
|
+
state.upgradedAt ? `upgraded ${state.upgradedAt}` : null
|
|
253
|
+
].filter((stamp) => stamp !== null) : [];
|
|
254
|
+
const stateStamp = stateStamps.join(", ");
|
|
255
|
+
findings.push({
|
|
256
|
+
ok: stateCurrent,
|
|
257
|
+
name: "state metadata",
|
|
258
|
+
detail: state ? stateCurrent ? `${state.version} (${stateStamp})` : `stale ${state.version} (${stateStamp}); current ${version.clio} (run \`clio-coder doctor --fix\`)` : stateRead.problem !== null ? (
|
|
259
|
+
// Present but unreadable. `--fix` cannot repair this one: it fails on
|
|
260
|
+
// the same permissions, so pointing there would send the user in a
|
|
261
|
+
// circle.
|
|
262
|
+
stateRead.problem
|
|
263
|
+
) : (
|
|
264
|
+
// Every other failing row names the command that repairs it. This one
|
|
265
|
+
// said only "missing", and `clio-coder doctor --fix` does write it.
|
|
266
|
+
"missing (run `clio-coder doctor --fix`)"
|
|
267
|
+
)
|
|
268
|
+
});
|
|
269
|
+
const sessionStore = sessionStoreFinding(dirs.state, state !== null);
|
|
270
|
+
if (sessionStore !== null) findings.push(sessionStore);
|
|
271
|
+
return findings;
|
|
272
|
+
}
|
|
273
|
+
function foldDetail(detail) {
|
|
274
|
+
return detail.replace(/\s*\n\s*/g, " ").trim();
|
|
275
|
+
}
|
|
276
|
+
function formatDoctorReport(findings) {
|
|
277
|
+
const lines = findings.map((f) => {
|
|
278
|
+
const level = f.level ?? (f.ok ? "ok" : "error");
|
|
279
|
+
const badge = level === "ok" ? "OK" : level === "warn" ? "WARN" : "!! ";
|
|
280
|
+
return `${badge.padEnd(4)} ${f.name.padEnd(22)} ${foldDetail(f.detail)}`;
|
|
281
|
+
});
|
|
282
|
+
return lines.join("\n");
|
|
283
|
+
}
|
|
284
|
+
async function runDoctorFleetChecks(projectRoot = process.cwd()) {
|
|
285
|
+
let settings;
|
|
286
|
+
try {
|
|
287
|
+
settings = readSettings();
|
|
288
|
+
} catch {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
291
|
+
const nodes = settings.fleet?.nodes ?? [];
|
|
292
|
+
if (nodes.length === 0) return [];
|
|
293
|
+
const { recordFleetPreflight, runFleetNodePreflight } = await import("./fleet-preflight-CLIAX7YR.js");
|
|
294
|
+
const targets = (settings.targets ?? []).map((target) => ({
|
|
295
|
+
id: target.id,
|
|
296
|
+
runtimeId: target.runtime,
|
|
297
|
+
...target.url !== void 0 ? { url: target.url } : {},
|
|
298
|
+
...target.defaultModel !== void 0 ? { wireModelId: target.defaultModel } : {}
|
|
299
|
+
}));
|
|
300
|
+
const records = await Promise.all(nodes.map((node) => runFleetNodePreflight(node, projectRoot, { targets })));
|
|
301
|
+
try {
|
|
302
|
+
recordFleetPreflight(records);
|
|
303
|
+
} catch {
|
|
304
|
+
}
|
|
305
|
+
return records.map((record) => ({
|
|
306
|
+
ok: true,
|
|
307
|
+
level: record.ok ? "ok" : "warn",
|
|
308
|
+
name: `fleet node ${record.nodeId}`,
|
|
309
|
+
detail: record.ok ? `eligible: ${record.host} clio ${record.remoteVersion ?? "(custom entry)"}, path parity for ${record.projectRoot}, ${record.targets.filter((fact) => fact.reachable === "true").length}/${record.targets.length} targets reachable from the node` : `ineligible: ${record.detail ?? "preflight failed"}`
|
|
310
|
+
}));
|
|
311
|
+
}
|
|
312
|
+
async function runDoctorRuntimeChecks() {
|
|
313
|
+
let settings;
|
|
314
|
+
try {
|
|
315
|
+
settings = readSettings();
|
|
316
|
+
} catch {
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
const candidates = settings.targets.filter(
|
|
320
|
+
(entry) => (entry.runtime === "openai-compat" || entry.runtime === "anthropic-compat") && Boolean(entry.url)
|
|
321
|
+
);
|
|
322
|
+
if (candidates.length === 0) return [];
|
|
323
|
+
const results = await Promise.all(
|
|
324
|
+
candidates.map(async (target) => {
|
|
325
|
+
const url = target.url;
|
|
326
|
+
if (!url) return null;
|
|
327
|
+
const fingerprint = await fingerprintNativeRuntime(url);
|
|
328
|
+
if (!fingerprint) return null;
|
|
329
|
+
return {
|
|
330
|
+
ok: true,
|
|
331
|
+
level: "warn",
|
|
332
|
+
name: `target ${target.id}`,
|
|
333
|
+
detail: `${fingerprint.displayName} detected at ${url}; run \`clio-coder targets convert ${target.id} --runtime ${fingerprint.runtimeId}\` for proper resident-model lifecycle`
|
|
334
|
+
};
|
|
335
|
+
})
|
|
336
|
+
);
|
|
337
|
+
return results.filter((finding) => finding !== null);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export {
|
|
341
|
+
readStateInfo,
|
|
342
|
+
ensureClioState,
|
|
343
|
+
runDoctor,
|
|
344
|
+
formatDoctorReport,
|
|
345
|
+
runDoctorFleetChecks,
|
|
346
|
+
runDoctorRuntimeChecks
|
|
347
|
+
};
|
|
348
|
+
//# sourceMappingURL=chunk-7RBKDI66.js.map
|