codeloop-mcp-server 0.1.82 → 0.1.83
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.
|
@@ -8,6 +8,8 @@ export type AgentMode = "fix" | "audit";
|
|
|
8
8
|
export declare const AUDIT_TTL_MS: number;
|
|
9
9
|
/** Normalize a free-text mode value to the canonical enum. */
|
|
10
10
|
export declare function normalizeAgentMode(value?: string | null): AgentMode | undefined;
|
|
11
|
+
/** Delete the persisted mode file. Best-effort — used to clear stale audit. */
|
|
12
|
+
export declare function clearPersistedAgentMode(cwd: string): void;
|
|
11
13
|
export declare function readPersistedAgentMode(cwd: string, now?: number): AgentMode | undefined;
|
|
12
14
|
export declare function persistAgentMode(cwd: string, mode: AgentMode): void;
|
|
13
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_mode.d.ts","sourceRoot":"","sources":["../../src/evidence/agent_mode.ts"],"names":[],"mappings":"AAwCA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;AAIxC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAiB,CAAC;AAE3C,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAc/E;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"agent_mode.d.ts","sourceRoot":"","sources":["../../src/evidence/agent_mode.ts"],"names":[],"mappings":"AAwCA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;AAIxC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAiB,CAAC;AAE3C,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAc/E;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOzD;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,SAAS,GAAG,SAAS,CAwBnG;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAQnE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,SAAS,CAWZ;AAED,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,QAmBgB,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CA0BtF"}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* explicit config.agent_mode:"audit" is a deliberate user opt-in and is honored
|
|
36
36
|
* with no TTL.
|
|
37
37
|
*/
|
|
38
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
38
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from "fs";
|
|
39
39
|
import { join, dirname } from "path";
|
|
40
40
|
const MODE_FILE_REL = join(".codeloop", "agent_mode.json");
|
|
41
41
|
/**
|
|
@@ -60,6 +60,17 @@ export function normalizeAgentMode(value) {
|
|
|
60
60
|
}
|
|
61
61
|
return undefined;
|
|
62
62
|
}
|
|
63
|
+
/** Delete the persisted mode file. Best-effort — used to clear stale audit. */
|
|
64
|
+
export function clearPersistedAgentMode(cwd) {
|
|
65
|
+
try {
|
|
66
|
+
const p = join(cwd, MODE_FILE_REL);
|
|
67
|
+
if (existsSync(p))
|
|
68
|
+
unlinkSync(p);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
/* best-effort */
|
|
72
|
+
}
|
|
73
|
+
}
|
|
63
74
|
export function readPersistedAgentMode(cwd, now = Date.now()) {
|
|
64
75
|
try {
|
|
65
76
|
const p = join(cwd, MODE_FILE_REL);
|
|
@@ -69,10 +80,17 @@ export function readPersistedAgentMode(cwd, now = Date.now()) {
|
|
|
69
80
|
const mode = normalizeAgentMode(data.mode);
|
|
70
81
|
// Persisted audit is OPT-IN and time-boxed: ignore it once stale so CodeLoop
|
|
71
82
|
// reverts to the active fix default unless the user keeps requesting audit.
|
|
83
|
+
// Crucially we also DELETE the stale file: a leftover agent_mode.json that
|
|
84
|
+
// still says "audit" is exactly what leaked across sessions — the agent saw
|
|
85
|
+
// it in git status, inferred "the project is in audit mode", and re-asserted
|
|
86
|
+
// mode:"audit" on the next call (bypassing this TTL entirely). Removing the
|
|
87
|
+
// artifact means a new, neutral request can't be silently turned read-only.
|
|
72
88
|
if (mode === "audit") {
|
|
73
89
|
const setAt = data.set_at ? Date.parse(data.set_at) : NaN;
|
|
74
|
-
if (!Number.isFinite(setAt) || now - setAt > AUDIT_TTL_MS)
|
|
90
|
+
if (!Number.isFinite(setAt) || now - setAt > AUDIT_TTL_MS) {
|
|
91
|
+
clearPersistedAgentMode(cwd);
|
|
75
92
|
return undefined;
|
|
93
|
+
}
|
|
76
94
|
}
|
|
77
95
|
return mode;
|
|
78
96
|
}
|
|
@@ -108,16 +126,22 @@ export function resolveAgentMode(opts) {
|
|
|
108
126
|
export const MODE_PARAM_DESCRIPTION = "Response TONE only — it does NOT change what CodeLoop verifies. LEAVE UNSET " +
|
|
109
127
|
"for the normal behavior: 'fix' (default) = the standard auto-fix loop where, " +
|
|
110
128
|
"after verify/gate, you actively diagnose and modify code, re-verify, and drive " +
|
|
111
|
-
"the gate/confidence up until it passes. ONLY set 'audit' when the user " +
|
|
112
|
-
"EXPLICITLY asked you to run the checks and LIST the
|
|
113
|
-
"their code (e.g. 'don't change anything, just tell
|
|
114
|
-
"infer audit on your own.
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
129
|
+
"the gate/confidence up until it passes. ONLY set 'audit' when the user, IN " +
|
|
130
|
+
"THEIR CURRENT MESSAGE, EXPLICITLY asked you to run the checks and LIST the " +
|
|
131
|
+
"problems WITHOUT modifying their code (e.g. 'don't change anything, just tell " +
|
|
132
|
+
"me what's wrong'). Do NOT infer audit on your own. CRITICAL: NEVER pass " +
|
|
133
|
+
"mode:'audit' merely because a .codeloop/agent_mode.json file exists, shows up " +
|
|
134
|
+
"in git status, or contains \"audit\" — that file is a STALE per-session " +
|
|
135
|
+
"artifact from an earlier run, NOT a project setting and NOT the user's current " +
|
|
136
|
+
"intent. Decide the mode SOLELY from what the user asked THIS time; if they just " +
|
|
137
|
+
"said 'verify'/'run CodeLoop' with no read-only request, that is 'fix' (omit " +
|
|
138
|
+
"mode). In EITHER mode CodeLoop runs the FULL suite — build, tests, launching + " +
|
|
139
|
+
"DRIVING the app (codeloop_run_journey), screenshots, gate, confidence — and " +
|
|
140
|
+
"returns every issue; driving the app is verification, not a code edit. 'audit' " +
|
|
141
|
+
"only stops CodeLoop's prose from commanding you to edit files or loop, so you " +
|
|
142
|
+
"present the report and let the user decide. Audit is OPT-IN and time-boxed: it " +
|
|
143
|
+
"auto-expires back to the fix default; pass mode:'fix' (or omit it) the moment " +
|
|
144
|
+
"the user is ready for you to apply fixes again.";
|
|
121
145
|
/**
|
|
122
146
|
* The report-only directive appended to verify / diagnose / gate_check responses
|
|
123
147
|
* when audit tone is active. It softens ONLY the auto-fix prose — it never tells
|
|
@@ -141,7 +165,8 @@ export function buildAuditDirective(tool) {
|
|
|
141
165
|
diagnose: [
|
|
142
166
|
"The repair_tasks above are a DIAGNOSIS for the REPORT, not a TODO list to execute. " +
|
|
143
167
|
"Summarise each issue (severity, root cause, affected files, suggested fix) for the user. " +
|
|
144
|
-
"Do NOT apply the fixes and do NOT
|
|
168
|
+
"Do NOT apply the fixes and do NOT loop on code edits — the user asked you not to modify their code. " +
|
|
169
|
+
"This does NOT exempt you from the read-only VISUAL evidence: if you have not yet driven the app this run, you MUST still call codeloop_run_journey once (it launches + drives the app + screenshots — verification, not a code edit) and then codeloop_gate_check, so the report includes whether the app actually launches and behaves. Only the SOURCE-CODE fixes are paused; the launch/interaction pass is not.",
|
|
145
170
|
],
|
|
146
171
|
gate_check: [
|
|
147
172
|
"Report the gate results and confidence as an AUDIT SUMMARY. " +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_mode.js","sourceRoot":"","sources":["../../src/evidence/agent_mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"agent_mode.js","sourceRoot":"","sources":["../../src/evidence/agent_mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIrC,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAEzD,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,KAAqB;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,E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;QAChC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;QACnC,KAAK,CACN,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,sBAAsB,GACjC,8EAA8E;IAC9E,+EAA+E;IAC/E,iFAAiF;IACjF,6EAA6E;IAC7E,6EAA6E;IAC7E,gFAAgF;IAChF,0EAA0E;IAC1E,gFAAgF;IAChF,0EAA0E;IAC1E,iFAAiF;IACjF,kFAAkF;IAClF,8EAA8E;IAC9E,iFAAiF;IACjF,8EAA8E;IAC9E,iFAAiF;IACjF,gFAAgF;IAChF,iFAAiF;IACjF,gFAAgF;IAChF,iDAAiD,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA0C;IAC5E,MAAM,IAAI,GAAG;QACX,EAAE;QACF,EAAE;QACF,sFAAsF;QACtF,gTAAgT;KACjT,CAAC;IACF,MAAM,IAAI,GAAkC;QAC1C,MAAM,EAAE;YACN,4FAA4F;gBAC1F,gLAAgL;gBAChL,wFAAwF;SAC3F;QACD,QAAQ,EAAE;YACR,qFAAqF;gBACnF,2FAA2F;gBAC3F,sGAAsG;gBACtG,qZAAqZ;SACxZ;QACD,UAAU,EAAE;YACV,8DAA8D;gBAC5D,sFAAsF;gBACtF,+FAA+F;SAClG;KACF,CAAC;IACF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeloop-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.83",
|
|
4
4
|
"description": "CodeLoop MCP server - verification, self-repair, and recommendation layer for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"prepublishOnly": "npm run build && npm run check:publishable"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@codelooptech/shared": "^0.1.
|
|
53
|
+
"@codelooptech/shared": "^0.1.35",
|
|
54
54
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
55
55
|
"pixelmatch": "^7.1.0",
|
|
56
56
|
"pngjs": "^7.0.0",
|