loki-mode 8.85.0 → 8.87.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/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Autonomous spec-driven build system with a built-in trust layer. It does not call work done until it is verified (RARV-C closure loop, 8 quality gates, completion council, verified-completion evidence gate). Triggers on "Loki Mode". Takes a spec (PRD, GitHub issue, OpenAPI doc, etc.) to deployed product with minimal human intervention. Provider-agnostic. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v8.85.0
6
+ # Loki Mode v8.87.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -469,4 +469,4 @@ See `CHANGELOG.md` entries [7.5.7], [7.5.8], [7.5.13] for the per-fix list and r
469
469
 
470
470
  ---
471
471
 
472
- **v8.85.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~410 lines core**
472
+ **v8.87.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~410 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.85.0
1
+ 8.87.0
@@ -0,0 +1,279 @@
1
+ #!/usr/bin/env python3
2
+ """Turn a `loki doctor --json` report into an ordered remediation plan.
3
+
4
+ WHY THIS EXISTS. `loki doctor` tells you WHAT is broken. It does not tell you
5
+ what to type. On a bare machine the report names two blockers and the user is
6
+ left to work out the commands and the ORDER themselves -- and the order is not
7
+ obvious: doctor's own fix for a missing provider is
8
+ `npm install -g @anthropic-ai/claude-code`, which cannot run until Node.js is
9
+ installed, and Node.js is the OTHER blocker. Handing someone two commands in
10
+ report order makes the first one fail.
11
+
12
+ WHAT IT REFUSES TO DO, and this is the actual product:
13
+
14
+ 1. It never invents a command. A blocker with no remedy we can justify is
15
+ printed as "no automated fix known", verbatim and unadorned. A wrong
16
+ command is strictly worse than no command: the user runs it, it succeeds
17
+ at doing something irrelevant, and now they trust a broken system. Every
18
+ remedy here is either lifted from the report's own text or from a table
19
+ whose provenance is cited below.
20
+ 2. It never executes. It prints. `loki doctor` is a read-only diagnosis and
21
+ so is this; the human runs the commands.
22
+ 3. It never reads an empty result as success. Zero derived blockers means
23
+ "healthy" ONLY when the input actually parsed as a doctor report -- see
24
+ the vacuity guard in plan().
25
+
26
+ PROVENANCE OF EVERY REMEDY. Nothing here is a parallel table invented to sit
27
+ alongside the repo's existing knowledge:
28
+
29
+ - Provider install commands come from the report itself. `ai_provider.detail`
30
+ carries the literal string "No AI provider CLI. Fix: npm install -g
31
+ @anthropic-ai/claude-code" (written at autonomy/loki:11519 for the text
32
+ path and in cmd_doctor_json for --json). We PARSE that "Fix:" rather than
33
+ restating it, so doctor stays the single source of truth: change the
34
+ command there and this follows automatically.
35
+ - _TOOL_FIXES is MIXED provenance, and the split is stated per entry in the
36
+ table itself rather than summarised here, because "derived from the repo"
37
+ and "conventional package-manager command" are different strengths of
38
+ claim and this file exists to keep them apart:
39
+ SOURCED `brew install python3` (autonomy/loki:500), `brew install jq`
40
+ (:552), and `https://nodejs.org` (autonomy/provider-offer.sh:321)
41
+ are the commands the CLI already prints for these same tools.
42
+ Duplicated rather than imported because they live in bash
43
+ `echo` statements inside cmd_* functions.
44
+ UNSOURCED `brew install node`, `brew install git`, `brew install curl`
45
+ and every `apt-get install ...` appear NOWHERE else in this
46
+ repo. They are the standard invocations for these packages,
47
+ not something doctor told us. They are included because they
48
+ are the ordinary, verifiable way to install these tools -- but
49
+ do not read them as repo-derived, and if one is ever wrong the
50
+ fault is here, not upstream.
51
+ - Auth remedies are deliberately ABSENT. `cmd_why`'s PROVIDER_AUTH map
52
+ (autonomy/loki:4185) keys on a LAST_ERROR error_class, which is a
53
+ different axis entirely -- `loki doctor --json` has no auth blocker to map
54
+ from. Manufacturing one so this tool could show off an ordering
55
+ dependency would be exactly the fabrication requirement 1 forbids.
56
+
57
+ INPUT CONTRACT. Blockers are DERIVED, not read: `doctor --json` emits no
58
+ blocker list (that string is built only in the text path, autonomy/loki:11367).
59
+ Anything with status "fail" is a blocker, and failable things live in three
60
+ places -- `checks[]`, plus the siblings `ai_provider` and `disk`. The advisory
61
+ siblings (`sentrux`, `receipt_signing`, `memory`, `model_catalog`) are never
62
+ "fail" by construction and are not scanned.
63
+
64
+ KNOWN LIMITATION, stated rather than papered over: the text path reports two
65
+ blockers that have NO representation in --json at all -- a broken skill symlink
66
+ (autonomy/loki:11636) and missing quality-gate detectors (:11968). This tool
67
+ cannot see them, because the JSON it consumes does not carry them. It handles
68
+ them if they ever appear as blocker text, but it cannot derive them today.
69
+ """
70
+
71
+ import argparse
72
+ import json
73
+ import re
74
+ import sys
75
+
76
+ # Prerequisite ordering. Lower rank runs first. The only edges asserted are
77
+ # ones with a real causal dependency, because a fabricated ordering is the same
78
+ # class of lie as a fabricated command.
79
+ #
80
+ # disk (0) -- every remedy below writes files; no space means they all fail.
81
+ # runtime (1) -- node/python3 are what the package managers RUN.
82
+ # tool (2) -- jq/git/curl: independent, but cheap and unblocking.
83
+ # provider (3) -- MUST follow runtime: doctor's own provider fix is
84
+ # `npm install -g ...`, and npm ships with Node.js. On the
85
+ # real capture that produced this file, Node.js and the
86
+ # provider were both blockers simultaneously.
87
+ # unknown (9) -- last: we cannot reason about what we cannot identify.
88
+ _RANK = {"disk": 0, "runtime": 1, "tool": 2, "provider": 3, "unknown": 9}
89
+
90
+ # Per-tool remedies, keyed on doctor's own `name` field. A tool ABSENT from
91
+ # this table gets an honest "no known fix" -- never a guess. Adding a row is
92
+ # therefore the one place fabrication can enter this file, so each row is
93
+ # tagged with where its command came from:
94
+ # [repo] this exact command is printed elsewhere in loki-mode (line cited)
95
+ # [conv] conventional package-manager invocation, NOT found in this repo
96
+ # If you add a row, tag it. An untagged row is an unaudited claim.
97
+ _TOOL_FIXES = {
98
+ # [repo] https://nodejs.org -- autonomy/provider-offer.sh:321. [conv] brew install node.
99
+ "Node.js": ("runtime", "Install Node.js 18+: brew install node (macOS) | https://nodejs.org"),
100
+ # [repo] autonomy/loki:500.
101
+ "Python 3": ("runtime", "Install Python 3.8+: brew install python3 (macOS)"),
102
+ # [repo] brew arm -- autonomy/loki:552. [conv] apt-get arm.
103
+ "jq": ("tool", "brew install jq (macOS) | apt-get install jq (Debian/Ubuntu)"),
104
+ # [conv] both arms.
105
+ "git": ("tool", "brew install git (macOS) | apt-get install git (Debian/Ubuntu)"),
106
+ # [conv] both arms.
107
+ "curl": ("tool", "brew install curl (macOS) | apt-get install curl (Debian/Ubuntu)"),
108
+ }
109
+
110
+ _NO_FIX = "no automated fix known for this blocker -- diagnose manually, then re-run: loki doctor"
111
+
112
+ # doctor embeds its own remedy as "Fix: <cmd>" or "Reinstall: <cmd>". Parsing it
113
+ # keeps doctor authoritative instead of duplicating the command here.
114
+ _EMBEDDED_FIX = re.compile(r"(?:Fix|Reinstall):\s*(.+?)\s*$")
115
+
116
+
117
+ def _embedded_fix(text):
118
+ """Return the command doctor embedded in its own blocker text, else None.
119
+
120
+ None is a real answer, not a failure to try: it routes the blocker to the
121
+ honest no-fix path instead of to a guess.
122
+ """
123
+ if not text:
124
+ return None
125
+ m = _EMBEDDED_FIX.search(str(text).strip())
126
+ return m.group(1) if m else None
127
+
128
+
129
+ def derive_blockers(report):
130
+ """Every status=="fail" item in a doctor report, as (id, category, title, fix).
131
+
132
+ fix is None when we have no justified remedy. Callers MUST render None as
133
+ the no-fix line rather than substituting anything.
134
+ """
135
+ out = []
136
+ if not isinstance(report, dict):
137
+ return out
138
+
139
+ for chk in report.get("checks") or []:
140
+ if not isinstance(chk, dict) or chk.get("status") != "fail":
141
+ continue
142
+ name = str(chk.get("name") or "unknown check")
143
+ # Distinguish absent from too-old: same blocker name, different user
144
+ # experience, and doctor already knows which it is.
145
+ if chk.get("found") and chk.get("min_version"):
146
+ title = "%s is older than the required %s (found %s)" % (
147
+ name, chk["min_version"], chk.get("version") or "unknown")
148
+ else:
149
+ title = "%s is not installed" % name
150
+ category, fix = _TOOL_FIXES.get(name, ("unknown", None))
151
+ out.append((name, category, title, fix))
152
+
153
+ ai = report.get("ai_provider")
154
+ if isinstance(ai, dict) and ai.get("status") == "fail":
155
+ detail = ai.get("detail")
156
+ # Reuse doctor's embedded command; do not restate it.
157
+ out.append(("ai_provider", "provider",
158
+ "No AI provider CLI installed (at least one is required)",
159
+ _embedded_fix(detail)))
160
+
161
+ disk = report.get("disk")
162
+ if isinstance(disk, dict) and disk.get("status") == "fail":
163
+ gb = disk.get("available_gb")
164
+ avail = "unknown" if gb is None else "%sGB" % gb
165
+ out.append(("disk", "disk",
166
+ "Insufficient disk space (%s available, need >= 1GB)" % avail,
167
+ "Free at least 1GB on your home volume, then re-run: loki doctor"))
168
+
169
+ return out
170
+
171
+
172
+ def plan(report):
173
+ """Ordered remediation plan for a doctor report.
174
+
175
+ Returns a dict with `status` in {healthy, action_required, not_a_report}
176
+ and `steps`. The three-way status is the vacuity guard: an empty blocker
177
+ list means HEALTHY only if the input was recognisably a doctor report.
178
+ `{}` on stdin also yields zero blockers, and calling that healthy would be
179
+ the exact fake-green this repo exists to refuse.
180
+ """
181
+ if not isinstance(report, dict) or not (
182
+ "checks" in report or "summary" in report or "ai_provider" in report):
183
+ return {
184
+ "status": "not_a_report",
185
+ "executed": False,
186
+ "steps": [],
187
+ "note": "Input is not a loki doctor report (no checks/summary/ai_provider). "
188
+ "Produce one with: loki doctor --json",
189
+ }
190
+
191
+ blockers = derive_blockers(report)
192
+ steps = []
193
+ for i, (bid, category, title, fix) in enumerate(
194
+ sorted(blockers, key=lambda b: (_RANK.get(b[1], 9), b[0]))):
195
+ steps.append({
196
+ "order": i + 1,
197
+ "id": bid,
198
+ "category": category,
199
+ "blocker": title,
200
+ "command": fix,
201
+ "fix_known": fix is not None,
202
+ })
203
+
204
+ result = {
205
+ "status": "healthy" if not steps else "action_required",
206
+ "executed": False,
207
+ "steps": steps,
208
+ }
209
+
210
+ # Cross-check derivation against doctor's own tally. If doctor counted
211
+ # failures we could not turn into blockers, the gap is OURS -- say so,
212
+ # rather than reporting a short plan as a complete one.
213
+ summary = report.get("summary")
214
+ if isinstance(summary, dict):
215
+ failed = summary.get("failed")
216
+ if isinstance(failed, int) and failed > len(blockers):
217
+ result["parse_gap"] = (
218
+ "doctor reported %d failing checks but only %d could be mapped to a "
219
+ "blocker; the remainder are not represented in this plan" % (failed, len(blockers)))
220
+ return result
221
+
222
+
223
+ def render(p):
224
+ """Human-readable plan. Mirrors plan() exactly -- no extra claims."""
225
+ lines = []
226
+ if p["status"] == "not_a_report":
227
+ lines.append("Cannot plan: %s" % p["note"])
228
+ return "\n".join(lines)
229
+
230
+ if p["status"] == "healthy":
231
+ lines.append("System is healthy -- loki doctor reported no blockers.")
232
+ lines.append("Nothing to remediate. Start a build: loki start <spec>")
233
+ return "\n".join(lines)
234
+
235
+ n = len(p["steps"])
236
+ lines.append("Remediation plan -- %d blocker%s, in order (prerequisites first)."
237
+ % (n, "" if n == 1 else "s"))
238
+ lines.append("These commands are NOT run for you. Copy, review, then run them yourself.")
239
+ lines.append("")
240
+ for s in p["steps"]:
241
+ lines.append("%d. %s" % (s["order"], s["blocker"]))
242
+ lines.append(" %s" % (s["command"] if s["fix_known"] else _NO_FIX))
243
+ lines.append("")
244
+ if p.get("parse_gap"):
245
+ lines.append("Note: %s" % p["parse_gap"])
246
+ lines.append("")
247
+ lines.append("Then re-run: loki doctor")
248
+ return "\n".join(lines)
249
+
250
+
251
+ def main(argv=None):
252
+ ap = argparse.ArgumentParser(
253
+ prog="doctor-fix.py",
254
+ description="Plan (never run) the fixes for a `loki doctor --json` report.")
255
+ ap.add_argument("--report", help="doctor JSON file; defaults to stdin")
256
+ ap.add_argument("--json", action="store_true", dest="as_json",
257
+ help="emit the plan as JSON")
258
+ args = ap.parse_args(argv)
259
+
260
+ raw = open(args.report, encoding="utf-8").read() if args.report else sys.stdin.read()
261
+ try:
262
+ report = json.loads(raw)
263
+ except (ValueError, TypeError):
264
+ # Unparseable input is not "healthy" and not a blocker list either.
265
+ report = None
266
+
267
+ p = plan(report)
268
+ if args.as_json:
269
+ print(json.dumps(p, indent=2))
270
+ else:
271
+ print(render(p))
272
+ # Exit 1 on action_required so this is CI-gateable, matching doctor's own
273
+ # convention. not_a_report is exit 2: a broken input is not a clean bill of
274
+ # health and must never be mistaken for one.
275
+ return {"healthy": 0, "action_required": 1, "not_a_report": 2}[p["status"]]
276
+
277
+
278
+ if __name__ == "__main__":
279
+ sys.exit(main())
package/autonomy/loki CHANGED
@@ -12195,7 +12195,11 @@ elif disk_status == 'warn': warn_count += 1
12195
12195
  # so an apostrophe or a double quote in a comment terminates the shell
12196
12196
  # string and mangles the program. First attempt did exactly that: doctor
12197
12197
  # --json printed nothing and exited 0. Keep this comment quote-free.
12198
- _provider_cmds = ('claude', 'codex', 'cline', 'aider')
12198
+ # Must match auto_detect_provider() in providers/loader.sh, in ITS order.
12199
+ # Omitting opencode made doctor report 'No AI provider CLI' on a machine
12200
+ # where the runner would happily select opencode -- the fifth list in this
12201
+ # repo to drift from that authority (see v8.76.0, v8.82.0).
12202
+ _provider_cmds = ('claude', 'cline', 'codex', 'aider', 'opencode')
12199
12203
  _any_provider = any(shutil.which(_p) is not None for _p in _provider_cmds)
12200
12204
  ai_provider = {
12201
12205
  'found': _any_provider,
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "8.85.0"
10
+ __version__ = "8.87.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var m_=Object.create;var{getPrototypeOf:u_,defineProperty:eK,getOwnPropertyNames:p_}=Object;var d_=Object.prototype.hasOwnProperty;function c_(Z){return this[Z]}var l_,i_,a_=(Z,X,Q)=>{var Y=Z!=null&&typeof Z==="object";if(Y){var J=X?l_??=new WeakMap:i_??=new WeakMap,z=J.get(Z);if(z)return z}Q=Z!=null?m_(u_(Z)):{};let K=X||!Z||!Z.__esModule?eK(Q,"default",{value:Z,enumerable:!0}):Q;for(let $ of p_(Z))if(!d_.call(K,$))eK(K,$,{get:c_.bind(Z,$),enumerable:!0});if(Y)J.set(Z,K);return K};var HQ=(Z,X)=>()=>(X||Z((X={exports:{}}).exports,X),X.exports);var s_=(Z)=>Z;function n_(Z,X){this[Z]=s_.bind(null,X)}var l0=(Z,X)=>{for(var Q in X)eK(Z,Q,{get:X[Q],enumerable:!0,configurable:!0,set:n_.bind(X,Q)})};var p=(Z,X)=>()=>(Z&&(X=Z(Z=0)),X);var e0=import.meta.require;var kO={};l0(kO,{lokiDir:()=>j0,homeLokiDir:()=>R4,findRepoRootForVersion:()=>X$,REPO_ROOT:()=>i0});import{resolve as n7,dirname as Z$}from"path";import{fileURLToPath as o_}from"url";import{existsSync as UQ}from"fs";import{homedir as r_}from"os";function t_(){let Z=RO;for(let X=0;X<6;X++){if(UQ(n7(Z,"VERSION"))&&UQ(n7(Z,"autonomy/run.sh")))return Z;let Q=Z$(Z);if(Q===Z)break;Z=Q}return n7(RO,"..","..","..")}function X$(Z){let X=Z;for(let Q=0;Q<6;Q++){if(UQ(n7(X,"VERSION"))&&UQ(n7(X,"autonomy/run.sh")))return X;let Y=Z$(X);if(Y===X)break;X=Y}return n7(Z,"..","..","..")}function j0(){return process.env.LOKI_DIR??n7(process.cwd(),".loki")}function R4(){return n7(r_(),".loki")}var RO,i0;var H8=p(()=>{RO=Z$(o_(import.meta.url));i0=t_()});import{readFileSync as e_}from"fs";import{resolve as Zf,dirname as Xf}from"path";import{fileURLToPath as Qf}from"url";function h3(){if(h5!==null)return h5;let Z="8.85.0";if(typeof Z==="string"&&Z.length>0)return h5=Z,h5;try{let X=Xf(Qf(import.meta.url)),Q=X$(X);h5=e_(Zf(Q,"VERSION"),"utf-8").trim()}catch{h5="unknown"}return h5}var h5=null;var BQ=p(()=>{H8()});var bO={};l0(bO,{runOrThrow:()=>jf,run:()=>E0,readStreamCapped:()=>NQ,commandVersion:()=>Tf,commandExists:()=>X9,ShellError:()=>Q$,MAX_STDOUT_BYTES:()=>yO});async function NQ(Z,X=yO){let Q=Z.getReader(),Y=new TextDecoder,J="",z=0;try{while(z<X){let{done:K,value:$}=await Q.read();if(K)break;if(!$)continue;if(z+=$.byteLength,z>X){let W=$.byteLength-(z-X);J+=Y.decode($.subarray(0,W),{stream:!0});break}J+=Y.decode($,{stream:!0})}J+=Y.decode()}finally{try{await Q.cancel()}catch{}Q.releaseLock()}return J}async function E0(Z,X={}){let Q=Bun.spawn({cmd:[...Z],stdout:"pipe",stderr:"pipe",env:X.env?{...process.env,...X.env}:process.env,cwd:X.cwd}),Y,J;if(X.timeoutMs&&X.timeoutMs>0)Y=setTimeout(()=>{try{Q.kill("SIGTERM")}catch{}J=setTimeout(()=>{try{Q.kill("SIGKILL")}catch{}},2000)},X.timeoutMs);try{let[z,K,$]=await Promise.all([NQ(Q.stdout),new Response(Q.stderr).text(),Q.exited]);return{stdout:z,stderr:K,exitCode:$}}finally{if(Y)clearTimeout(Y);if(J)clearTimeout(J)}}async function jf(Z,X={}){let Q=await E0(Z,X);if(Q.exitCode!==0)throw new Q$(`command failed (${Q.exitCode}): ${Z.join(" ")}`,Q.exitCode,Q.stdout,Q.stderr);return Q}async function X9(Z){let X=Mf(Z),Q=await E0(["sh","-c",`command -v ${X}`],{timeoutMs:5000});if(Q.exitCode===0)return Q.stdout.trim()||null;return null}function Mf(Z){if(!/^[A-Za-z0-9._/-]+$/.test(Z))throw Error(`refused to shell-escape suspect token: ${Z}`);return Z}async function Tf(Z,X="--version"){if(!await X9(Z))return null;let Y=await E0([Z,X],{timeoutMs:5000});if(Y.exitCode!==0)return null;return((Y.stdout||Y.stderr).split(/\r?\n/)[0]?.trim()??"")||null}var yO=16777216,Q$;var x9=p(()=>{Q$=class Q$ extends Error{message;exitCode;stdout;stderr;constructor(Z,X,Q,Y){super(Z);this.message=Z;this.exitCode=X;this.stdout=Q;this.stderr=Y;this.name="ShellError"}}});function o7(Z){return wf?"":Z}var wf,L0,F8,p0,zV0,a0,W8,Q9,v;var S6=p(()=>{wf=(process.env.NO_COLOR??"").length>0;L0=o7("\x1B[0;31m"),F8=o7("\x1B[0;32m"),p0=o7("\x1B[1;33m"),zV0=o7("\x1B[0;34m"),a0=o7("\x1B[0;36m"),W8=o7("\x1B[1m"),Q9=o7("\x1B[2m"),v=o7("\x1B[0m")});import{existsSync as bf}from"fs";async function E7(){if(x4!==void 0)return x4;let Z="/opt/homebrew/bin/python3.12";if(bf(Z))return x4=Z,Z;let X=await X9("python3.12");if(X)return x4=X,X;let Q=await X9("python3");return x4=Q,Q}async function Y7(Z,X={}){let Q=await E7();if(!Q)return{stdout:"",stderr:"python3 not found",exitCode:127};return E0([Q,"-c",Z],X)}var x4;var r7=p(()=>{x9()});var ZL={};l0(ZL,{runStatus:()=>Kh});import{existsSync as Y9,readFileSync as g3,readdirSync as iO,statSync as aO}from"fs";import{resolve as h8,basename as rf}from"path";import{homedir as tf}from"os";function sO(Z){let X=Math.trunc(Z);if(X>=1e6)return`${(Math.trunc(X/1e6*10)/10).toFixed(1)}M`;if(X>=1000)return`${(Math.trunc(X/1000*10)/10).toFixed(1)}K`;return String(X)}function nO(Z,X,Q){if(X===0)return null;let Y=Math.trunc(Z*100/X),J=Math.trunc(Z*LQ/X);if(J>LQ)J=LQ;let z=LQ-J,K=F8;if(Y>=80)K=L0;else if(Y>=50)K=p0;let $="=".repeat(Math.max(0,J))+" ".repeat(Math.max(0,z)),W=sO(Z),V=sO(X);return` ${W8}${Q}${v} ${K}[${$}]${v} ${Y}% (${W} / ${V})`}async function Zh(){if(await X9("jq"))return!0;return process.stdout.write(`${L0}Error: jq is required but not installed.${v}
2
+ var m_=Object.create;var{getPrototypeOf:u_,defineProperty:eK,getOwnPropertyNames:p_}=Object;var d_=Object.prototype.hasOwnProperty;function c_(Z){return this[Z]}var l_,i_,a_=(Z,X,Q)=>{var Y=Z!=null&&typeof Z==="object";if(Y){var J=X?l_??=new WeakMap:i_??=new WeakMap,z=J.get(Z);if(z)return z}Q=Z!=null?m_(u_(Z)):{};let K=X||!Z||!Z.__esModule?eK(Q,"default",{value:Z,enumerable:!0}):Q;for(let $ of p_(Z))if(!d_.call(K,$))eK(K,$,{get:c_.bind(Z,$),enumerable:!0});if(Y)J.set(Z,K);return K};var HQ=(Z,X)=>()=>(X||Z((X={exports:{}}).exports,X),X.exports);var s_=(Z)=>Z;function n_(Z,X){this[Z]=s_.bind(null,X)}var l0=(Z,X)=>{for(var Q in X)eK(Z,Q,{get:X[Q],enumerable:!0,configurable:!0,set:n_.bind(X,Q)})};var p=(Z,X)=>()=>(Z&&(X=Z(Z=0)),X);var e0=import.meta.require;var kO={};l0(kO,{lokiDir:()=>j0,homeLokiDir:()=>R4,findRepoRootForVersion:()=>X$,REPO_ROOT:()=>i0});import{resolve as n7,dirname as Z$}from"path";import{fileURLToPath as o_}from"url";import{existsSync as UQ}from"fs";import{homedir as r_}from"os";function t_(){let Z=RO;for(let X=0;X<6;X++){if(UQ(n7(Z,"VERSION"))&&UQ(n7(Z,"autonomy/run.sh")))return Z;let Q=Z$(Z);if(Q===Z)break;Z=Q}return n7(RO,"..","..","..")}function X$(Z){let X=Z;for(let Q=0;Q<6;Q++){if(UQ(n7(X,"VERSION"))&&UQ(n7(X,"autonomy/run.sh")))return X;let Y=Z$(X);if(Y===X)break;X=Y}return n7(Z,"..","..","..")}function j0(){return process.env.LOKI_DIR??n7(process.cwd(),".loki")}function R4(){return n7(r_(),".loki")}var RO,i0;var H8=p(()=>{RO=Z$(o_(import.meta.url));i0=t_()});import{readFileSync as e_}from"fs";import{resolve as Zf,dirname as Xf}from"path";import{fileURLToPath as Qf}from"url";function h3(){if(h5!==null)return h5;let Z="8.87.0";if(typeof Z==="string"&&Z.length>0)return h5=Z,h5;try{let X=Xf(Qf(import.meta.url)),Q=X$(X);h5=e_(Zf(Q,"VERSION"),"utf-8").trim()}catch{h5="unknown"}return h5}var h5=null;var BQ=p(()=>{H8()});var bO={};l0(bO,{runOrThrow:()=>jf,run:()=>E0,readStreamCapped:()=>NQ,commandVersion:()=>Tf,commandExists:()=>X9,ShellError:()=>Q$,MAX_STDOUT_BYTES:()=>yO});async function NQ(Z,X=yO){let Q=Z.getReader(),Y=new TextDecoder,J="",z=0;try{while(z<X){let{done:K,value:$}=await Q.read();if(K)break;if(!$)continue;if(z+=$.byteLength,z>X){let W=$.byteLength-(z-X);J+=Y.decode($.subarray(0,W),{stream:!0});break}J+=Y.decode($,{stream:!0})}J+=Y.decode()}finally{try{await Q.cancel()}catch{}Q.releaseLock()}return J}async function E0(Z,X={}){let Q=Bun.spawn({cmd:[...Z],stdout:"pipe",stderr:"pipe",env:X.env?{...process.env,...X.env}:process.env,cwd:X.cwd}),Y,J;if(X.timeoutMs&&X.timeoutMs>0)Y=setTimeout(()=>{try{Q.kill("SIGTERM")}catch{}J=setTimeout(()=>{try{Q.kill("SIGKILL")}catch{}},2000)},X.timeoutMs);try{let[z,K,$]=await Promise.all([NQ(Q.stdout),new Response(Q.stderr).text(),Q.exited]);return{stdout:z,stderr:K,exitCode:$}}finally{if(Y)clearTimeout(Y);if(J)clearTimeout(J)}}async function jf(Z,X={}){let Q=await E0(Z,X);if(Q.exitCode!==0)throw new Q$(`command failed (${Q.exitCode}): ${Z.join(" ")}`,Q.exitCode,Q.stdout,Q.stderr);return Q}async function X9(Z){let X=Mf(Z),Q=await E0(["sh","-c",`command -v ${X}`],{timeoutMs:5000});if(Q.exitCode===0)return Q.stdout.trim()||null;return null}function Mf(Z){if(!/^[A-Za-z0-9._/-]+$/.test(Z))throw Error(`refused to shell-escape suspect token: ${Z}`);return Z}async function Tf(Z,X="--version"){if(!await X9(Z))return null;let Y=await E0([Z,X],{timeoutMs:5000});if(Y.exitCode!==0)return null;return((Y.stdout||Y.stderr).split(/\r?\n/)[0]?.trim()??"")||null}var yO=16777216,Q$;var x9=p(()=>{Q$=class Q$ extends Error{message;exitCode;stdout;stderr;constructor(Z,X,Q,Y){super(Z);this.message=Z;this.exitCode=X;this.stdout=Q;this.stderr=Y;this.name="ShellError"}}});function o7(Z){return wf?"":Z}var wf,L0,F8,p0,zV0,a0,W8,Q9,v;var S6=p(()=>{wf=(process.env.NO_COLOR??"").length>0;L0=o7("\x1B[0;31m"),F8=o7("\x1B[0;32m"),p0=o7("\x1B[1;33m"),zV0=o7("\x1B[0;34m"),a0=o7("\x1B[0;36m"),W8=o7("\x1B[1m"),Q9=o7("\x1B[2m"),v=o7("\x1B[0m")});import{existsSync as bf}from"fs";async function E7(){if(x4!==void 0)return x4;let Z="/opt/homebrew/bin/python3.12";if(bf(Z))return x4=Z,Z;let X=await X9("python3.12");if(X)return x4=X,X;let Q=await X9("python3");return x4=Q,Q}async function Y7(Z,X={}){let Q=await E7();if(!Q)return{stdout:"",stderr:"python3 not found",exitCode:127};return E0([Q,"-c",Z],X)}var x4;var r7=p(()=>{x9()});var ZL={};l0(ZL,{runStatus:()=>Kh});import{existsSync as Y9,readFileSync as g3,readdirSync as iO,statSync as aO}from"fs";import{resolve as h8,basename as rf}from"path";import{homedir as tf}from"os";function sO(Z){let X=Math.trunc(Z);if(X>=1e6)return`${(Math.trunc(X/1e6*10)/10).toFixed(1)}M`;if(X>=1000)return`${(Math.trunc(X/1000*10)/10).toFixed(1)}K`;return String(X)}function nO(Z,X,Q){if(X===0)return null;let Y=Math.trunc(Z*100/X),J=Math.trunc(Z*LQ/X);if(J>LQ)J=LQ;let z=LQ-J,K=F8;if(Y>=80)K=L0;else if(Y>=50)K=p0;let $="=".repeat(Math.max(0,J))+" ".repeat(Math.max(0,z)),W=sO(Z),V=sO(X);return` ${W8}${Q}${v} ${K}[${$}]${v} ${Y}% (${W} / ${V})`}async function Zh(){if(await X9("jq"))return!0;return process.stdout.write(`${L0}Error: jq is required but not installed.${v}
3
3
  `),process.stdout.write(`Install with:
4
4
  `),process.stdout.write(` brew install jq (macOS)
5
5
  `),process.stdout.write(` apt install jq (Debian/Ubuntu)
@@ -1232,4 +1232,4 @@ Set LOKI_LEGACY_BASH=1 to force the bash CLI for every command.
1232
1232
  `),2}case"start":{let{runStart:Y}=await Promise.resolve().then(() => (h_(),f_));return Y(Q)}default:return process.stderr.write(`Unknown command: ${X}
1233
1233
  `),process.stderr.write(v_),2}}cO();process.on("SIGINT",()=>process.exit(130));process.on("SIGTERM",()=>process.exit(143));var uW0=await mW0(Bun.argv.slice(2));process.exit(uW0);
1234
1234
 
1235
- //# debugId=4F01D2A6D41F31AE64756E2164756E21
1235
+ //# debugId=963043D4CCDC5F7D64756E2164756E21
package/mcp/__init__.py CHANGED
@@ -75,4 +75,4 @@ try:
75
75
  except ImportError:
76
76
  __all__ = ['mcp']
77
77
 
78
- __version__ = '8.85.0'
78
+ __version__ = '8.87.0'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loki-mode",
3
3
  "mcpName": "io.github.asklokesh/loki-mode",
4
- "version": "8.85.0",
4
+ "version": "8.87.0",
5
5
  "description": "Loki Mode by Autonomi. Autonomous spec-to-product system: takes a PRD, GitHub issue, OpenAPI/JSON/YAML, or one-line brief to a deployed app via the RARV-C closure loop with 8 quality gates. Provider-agnostic (Claude Code, OpenAI Codex, Cline, Aider).",
6
6
  "keywords": [
7
7
  "agent",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "loki-mode",
4
4
  "displayName": "Loki Mode",
5
- "version": "8.85.0",
5
+ "version": "8.87.0",
6
6
  "description": "Autonomous spec-to-product build system with a built-in trust layer (RARV-C closure loop, 8 quality gates, completion council). Ships Loki's spec-hardening, drift-detection, and deterministic PR verification commands plus the Loki MCP server.",
7
7
  "author": {
8
8
  "name": "Autonomi",