loki-mode 6.74.4 → 6.74.6

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: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v6.74.4
6
+ # Loki Mode v6.74.6
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -272,4 +272,4 @@ The following features are documented in skill modules but not yet fully automat
272
272
  | Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
273
273
  | Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
274
274
 
275
- **v6.74.4 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
275
+ **v6.74.6 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.74.4
1
+ 6.74.6
package/autonomy/loki CHANGED
@@ -125,7 +125,7 @@ RUN_SH="$SKILL_DIR/autonomy/run.sh"
125
125
  SANDBOX_SH="$SKILL_DIR/autonomy/sandbox.sh"
126
126
  EMIT_SH="$SKILL_DIR/events/emit.sh"
127
127
  LEARNING_EMIT_SH="$SKILL_DIR/learning/emit.sh"
128
- LOKI_DIR=".loki"
128
+ LOKI_DIR="${LOKI_DIR:-.loki}"
129
129
  export LOKI_DIR
130
130
 
131
131
  # Anonymous usage telemetry
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.74.4"
10
+ __version__ = "6.74.6"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2164,21 +2164,26 @@ def _get_loki_dir() -> _Path:
2164
2164
  """Get LOKI_DIR, refreshing from env on each call for consistency.
2165
2165
 
2166
2166
  Resolution order:
2167
- 1. LOKI_DIR env var (set by run.sh during active sessions)
2168
- 2. _active_project_dir (set via /api/focus API for cross-directory projects)
2167
+ 1. _active_project_dir (set via /api/focus API for cross-directory projects)
2168
+ -- takes priority because it is a runtime signal pointing to the actual
2169
+ active project, whereas LOKI_DIR is a stale startup-time value (typically
2170
+ the relative string ".loki" inherited from the CLI).
2171
+ 2. LOKI_DIR env var (only when it is an absolute path, to avoid resolving
2172
+ a relative path against the dashboard's CWD which is usually wrong)
2169
2173
  3. .loki/ in current working directory
2170
2174
  4. ~/.loki/ as global fallback
2171
2175
  """
2172
- env_dir = os.environ.get("LOKI_DIR")
2173
- if env_dir:
2174
- return _Path(env_dir)
2175
-
2176
- # Check API-set project directory (for AI Chat running in different CWD)
2176
+ # Check API-set project directory first (runtime override from /api/focus
2177
+ # or from Purple Lab / AI Chat starting a session in a different directory)
2177
2178
  if _active_project_dir:
2178
2179
  project_loki = _Path(_active_project_dir) / ".loki"
2179
2180
  if project_loki.is_dir():
2180
2181
  return project_loki
2181
2182
 
2183
+ env_dir = os.environ.get("LOKI_DIR")
2184
+ if env_dir and _Path(env_dir).is_absolute():
2185
+ return _Path(env_dir)
2186
+
2182
2187
  # Check CWD first
2183
2188
  cwd_loki = _Path.cwd() / ".loki"
2184
2189
  if cwd_loki.is_dir():
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v6.74.4
5
+ **Version:** v6.74.6
6
6
 
7
7
  ---
8
8
 
package/mcp/__init__.py CHANGED
@@ -57,4 +57,4 @@ try:
57
57
  except ImportError:
58
58
  __all__ = ['mcp']
59
59
 
60
- __version__ = '6.74.4'
60
+ __version__ = '6.74.6'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "6.74.4",
3
+ "version": "6.74.6",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "agent",
package/web-app/server.py CHANGED
@@ -2605,6 +2605,8 @@ def _cleanup_chat_tasks() -> None:
2605
2605
  @app.post("/api/session/start")
2606
2606
  async def start_session(req: StartRequest) -> JSONResponse:
2607
2607
  """Start a new loki session with the given PRD."""
2608
+ logger.info("START_SESSION called: provider=%s, projectDir=%s, mode=%s, prd_len=%d",
2609
+ req.provider, req.projectDir, req.mode, len(req.prd))
2608
2610
  if len(req.prd.encode()) > _MAX_PRD_BYTES:
2609
2611
  return JSONResponse(status_code=400, content={"error": "PRD exceeds 1 MB limit"})
2610
2612
 
@@ -2688,6 +2690,8 @@ async def start_session(req: StartRequest) -> JSONResponse:
2688
2690
  content={"error": f"Failed to start session: {e}"},
2689
2691
  )
2690
2692
 
2693
+ logger.info("START_SESSION: process spawned pid=%d, cmd=%s", proc.pid, cmd)
2694
+
2691
2695
  # Update session state
2692
2696
  session.reset()
2693
2697
  session.process = proc
@@ -2725,6 +2729,23 @@ async def start_session(req: StartRequest) -> JSONResponse:
2725
2729
  "pid": proc.pid,
2726
2730
  }})
2727
2731
 
2732
+ # Notify the Loki Dashboard (port 57374) about the active project so it
2733
+ # reads state files from the correct .loki/ directory (BUG-FOCUS-001).
2734
+ try:
2735
+ os.makedirs(os.path.join(project_dir, ".loki"), exist_ok=True)
2736
+ import urllib.request
2737
+ focus_data = json.dumps({"project_dir": project_dir}).encode()
2738
+ focus_req = urllib.request.Request(
2739
+ "http://127.0.0.1:57374/api/focus",
2740
+ data=focus_data,
2741
+ headers={"Content-Type": "application/json"},
2742
+ method="POST",
2743
+ )
2744
+ urllib.request.urlopen(focus_req, timeout=2)
2745
+ logger.info("Notified dashboard of project focus: %s", project_dir)
2746
+ except Exception:
2747
+ logger.debug("Could not notify dashboard (may not be running)")
2748
+
2728
2749
  return JSONResponse(content={
2729
2750
  "started": True,
2730
2751
  "pid": proc.pid,
@@ -2878,8 +2899,11 @@ async def get_status() -> JSONResponse:
2878
2899
  # Check if process is still alive (read-only -- do not mutate session.running
2879
2900
  # here; that is handled by _read_process_output under the lock)
2880
2901
  is_running = session.running
2902
+ poll_result = session.process.poll() if session.process else None
2881
2903
  if session.process and is_running:
2882
- if session.process.poll() is not None:
2904
+ if poll_result is not None:
2905
+ logger.info("STATUS: process pid=%d exited with code=%s, session.running=%s, elapsed=%.1fs",
2906
+ session.process.pid, poll_result, session.running, time.time() - session.start_time)
2883
2907
  # BUG-RACE-001: The process has exited, but if the session was
2884
2908
  # started very recently (within 5 seconds), report "running" with
2885
2909
  # a "starting" phase so the UI does not flash "stopped" before the