loki-mode 11.3.9 → 11.5.1

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.
Files changed (119) hide show
  1. package/README.md +34 -18
  2. package/SKILL.md +3 -3
  3. package/VERSION +1 -1
  4. package/agents/custom_agents.py +280 -0
  5. package/autonomy/council-v2.sh +22 -1
  6. package/autonomy/edit.sh +242 -0
  7. package/autonomy/lib/chat.sh +315 -0
  8. package/autonomy/lib/engine10-push.sh +19 -1
  9. package/autonomy/lib/help-core.sh +164 -0
  10. package/autonomy/lib/json-output.sh +38 -0
  11. package/autonomy/lib/proof-generator.py +23 -5
  12. package/autonomy/lib/proof-verify.py +607 -5
  13. package/autonomy/lib/run-summary.sh +112 -0
  14. package/autonomy/lib/setup-requirements.json +35 -0
  15. package/autonomy/loki +337 -46
  16. package/autonomy/provider-offer.sh +95 -47
  17. package/autonomy/route.sh +302 -0
  18. package/autonomy/run.sh +48 -14
  19. package/autonomy/setup-wizard.sh +170 -0
  20. package/autonomy/verify.sh +62 -3
  21. package/bin/loki +73 -18
  22. package/completions/_loki +58 -1
  23. package/completions/loki.bash +57 -5
  24. package/dashboard/__init__.py +1 -1
  25. package/docs/CLI-CORE-VERBS.md +112 -0
  26. package/docs/CLI-REFERENCE.md +9 -1
  27. package/docs/COMPARE-OPENCODE.md +94 -0
  28. package/docs/COMPONENTS.md +1 -0
  29. package/docs/EVALUATING.md +27 -0
  30. package/docs/HARNESS-INTELLIGENCE-PLAN.md +20 -0
  31. package/docs/INSTALLATION.md +56 -12
  32. package/docs/KNOWN-ISSUES.md +8 -9
  33. package/docs/PROOF-PASSPORT.md +114 -0
  34. package/docs/QUICKSTART.md +108 -0
  35. package/docs/alternative-installations.md +103 -0
  36. package/docs/cost-controls.md +139 -0
  37. package/docs/environment-variables.md +45 -2
  38. package/docs/exit-codes.md +129 -12
  39. package/docs/spec-first-intent.md +29 -0
  40. package/docs/v10/CLI-MODERN.md +11 -5
  41. package/docs/v10/ENGINE.md +32 -0
  42. package/docs/v10/GUIDE.md +270 -44
  43. package/docs/v10/OPENCODE-PARITY-PLAN.md +84 -0
  44. package/loki-ts/data/model-pricing.json +1 -0
  45. package/loki-ts/dist/loki.js +1065 -978
  46. package/mcp/__init__.py +1 -1
  47. package/package.json +2 -2
  48. package/packages/control-plane/dist/server.js +1829 -715
  49. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  50. package/plugins/loki-mode/README.md +41 -1
  51. package/plugins/loki-mode/commands/handoff.md +12 -0
  52. package/plugins/loki-mode/commands/loki-verify.md +9 -2
  53. package/plugins/loki-mode/commands/start.md +20 -0
  54. package/plugins/loki-mode/hooks/hooks.json +11 -0
  55. package/plugins/loki-mode/scripts/loki-stop-verify.sh +84 -0
  56. package/providers/claude.sh +16 -2
  57. package/providers/model_route_exec.sh +22 -0
  58. package/providers/model_routes.sh +188 -0
  59. package/skills/providers.md +13 -0
  60. package/templates/agents/planner.md +10 -0
  61. package/templates/agents/reviewer.md +10 -0
  62. package/templates/agents/tester.md +10 -0
  63. package/web-app/dist/assets/{AdminPage-QK-i_x-O.js → AdminPage-Cbu3pXL8.js} +1 -1
  64. package/web-app/dist/assets/{Avatar-DblkLNjB.js → Avatar-DGqGGcGx.js} +1 -1
  65. package/web-app/dist/assets/{Badge-DIV2ny5H.js → Badge-Bhlipt6v.js} +1 -1
  66. package/web-app/dist/assets/{Button--rePJOlQ.js → Button-CpN2sO61.js} +1 -1
  67. package/web-app/dist/assets/{CockpitPage-BZlKxpGy.js → CockpitPage-BqeDJwdL.js} +1 -1
  68. package/web-app/dist/assets/{ComparePage-3_INSVux.js → ComparePage-DUieA2ba.js} +1 -1
  69. package/web-app/dist/assets/{ErrorBoundary-DHG63CNr.js → ErrorBoundary-DTWsYrOm.js} +1 -1
  70. package/web-app/dist/assets/{EvidenceReceiptPanel-DFsBnLlO.js → EvidenceReceiptPanel-BU_B9X19.js} +1 -1
  71. package/web-app/dist/assets/{GitHubIssuesPanel-phPGah98.js → GitHubIssuesPanel-DEZoLOsP.js} +1 -1
  72. package/web-app/dist/assets/{GitHubPRsPanel-T7KQqJmx.js → GitHubPRsPanel-BEsnrq7Y.js} +1 -1
  73. package/web-app/dist/assets/{HomePage-DFjGUF5I.js → HomePage-BoUVuq7h.js} +2 -2
  74. package/web-app/dist/assets/{LoginPage-CorUid_5.js → LoginPage-CmOED7vb.js} +1 -1
  75. package/web-app/dist/assets/{MagicPage-DofbSxKD.js → MagicPage-DATZitrZ.js} +1 -1
  76. package/web-app/dist/assets/{MetricsPage-qzrhhfLC.js → MetricsPage-DGL1v0I-.js} +1 -1
  77. package/web-app/dist/assets/{NotFoundPage-BAZR0mMb.js → NotFoundPage-C2WgOjZd.js} +1 -1
  78. package/web-app/dist/assets/{ProjectPage-BOSUzG9J.js → ProjectPage-BMi1tepj.js} +3 -3
  79. package/web-app/dist/assets/{ProjectsPage-Ba0YLtzD.js → ProjectsPage-vc3y5YPh.js} +1 -1
  80. package/web-app/dist/assets/{SettingsPage-Cr10Ue2K.js → SettingsPage-kbq0Ftvi.js} +1 -1
  81. package/web-app/dist/assets/{ShowcasePage-Czn655fe.js → ShowcasePage-Bn6Q8Kbg.js} +1 -1
  82. package/web-app/dist/assets/{SystemSettingsPage-Dwjnw6Ob.js → SystemSettingsPage-Basmhs_b.js} +1 -1
  83. package/web-app/dist/assets/{TeamsPage-D8nc69Be.js → TeamsPage-BTqOc4TR.js} +1 -1
  84. package/web-app/dist/assets/{TemplatesPage-DHsaCDGv.js → TemplatesPage-2P9002VL.js} +1 -1
  85. package/web-app/dist/assets/{TerminalOutput-DBejni2a.js → TerminalOutput-CAoSPBrg.js} +1 -1
  86. package/web-app/dist/assets/{activity-B2VsBl1C.js → activity-BcWVWCqU.js} +1 -1
  87. package/web-app/dist/assets/{bell-CT77Fq2H.js → bell-CYRqqgZ6.js} +1 -1
  88. package/web-app/dist/assets/{bot-DfaWgF4H.js → bot-CU7gdn3g.js} +1 -1
  89. package/web-app/dist/assets/{check-D1yp7Ndv.js → check-DLlCpz9V.js} +1 -1
  90. package/web-app/dist/assets/{chevron-left-B6Pa8IOX.js → chevron-left-CE9Cb30C.js} +1 -1
  91. package/web-app/dist/assets/{circle-alert-D5jrL_Y7.js → circle-alert-uou4bjua.js} +1 -1
  92. package/web-app/dist/assets/{clock-DIsY_fa_.js → clock-C_dSJcDX.js} +1 -1
  93. package/web-app/dist/assets/{cloud-eGwLh1As.js → cloud-DZ22ITF6.js} +1 -1
  94. package/web-app/dist/assets/{code-xml-CGDIcZ3m.js → code-xml-BrJS0hhS.js} +1 -1
  95. package/web-app/dist/assets/{database-CWpdaykI.js → database-D2HOmxtl.js} +1 -1
  96. package/web-app/dist/assets/{dollar-sign-DZEuTCs6.js → dollar-sign-CQ1vK_6q.js} +1 -1
  97. package/web-app/dist/assets/{file-code-corner-BHBW6m9v.js → file-code-corner-w2vpGm5d.js} +1 -1
  98. package/web-app/dist/assets/{file-plus-D4h1jZSR.js → file-plus-DlF6wjkD.js} +1 -1
  99. package/web-app/dist/assets/{globe-CXdqKgwd.js → globe-Dy3lBJg1.js} +1 -1
  100. package/web-app/dist/assets/{hammer-B3YuuYI_.js → hammer-C3xIiRXN.js} +1 -1
  101. package/web-app/dist/assets/{index-BLEnboSv.js → index-4t-_IW2y.js} +3 -3
  102. package/web-app/dist/assets/{layers-Dvp5nFtw.js → layers-Y8Fs8qXI.js} +1 -1
  103. package/web-app/dist/assets/{loader-circle-DodDmIZ3.js → loader-circle-CxgN1v4m.js} +1 -1
  104. package/web-app/dist/assets/{lock-EiuaH1Ep.js → lock-DFFNbXDs.js} +1 -1
  105. package/web-app/dist/assets/{package-Cx4m2hFg.js → package-5e6qCTUg.js} +1 -1
  106. package/web-app/dist/assets/{plus-D-Sd5rpH.js → plus-C0Go_ytj.js} +1 -1
  107. package/web-app/dist/assets/{refresh-cw-C0w1cdmF.js → refresh-cw-D4i-NW3o.js} +1 -1
  108. package/web-app/dist/assets/{rotate-ccw-C_qk6MTT.js → rotate-ccw-YlKkiUW6.js} +1 -1
  109. package/web-app/dist/assets/{scroll-text-DSxiFtkc.js → scroll-text-4qXOHTap.js} +1 -1
  110. package/web-app/dist/assets/{server-NTJt7I8M.js → server-BB6zXNp9.js} +1 -1
  111. package/web-app/dist/assets/{shield-alert-HBxMQOvH.js → shield-alert-D4tzjB1H.js} +1 -1
  112. package/web-app/dist/assets/{thumbs-up-DEgsHzSD.js → thumbs-up-DZiRwdFj.js} +1 -1
  113. package/web-app/dist/assets/{trash-2-px46FnTD.js → trash-2-Dv_LkRIK.js} +1 -1
  114. package/web-app/dist/assets/{trending-down-CBosVGKa.js → trending-down-BJYp9PQe.js} +1 -1
  115. package/web-app/dist/assets/{trending-up-Dbd7zrQj.js → trending-up-BTcXLklK.js} +1 -1
  116. package/web-app/dist/assets/{upload-nhdFKAs1.js → upload-fcHqwOxr.js} +1 -1
  117. package/web-app/dist/assets/{usePolling-BgaGdinh.js → usePolling-BeJYw_4L.js} +1 -1
  118. package/web-app/dist/assets/{user-CzIihUy9.js → user-BcDwUCsO.js} +1 -1
  119. package/web-app/dist/index.html +1 -1
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env bash
2
+ # OC-OUTPUT: unified end-of-run summary for the legacy engine. Same format as
3
+ # loki-ts/src/util/run_summary.ts (Result, Files, Cost, Elapsed, Receipt, next).
4
+ # Sourced by autonomy/run.sh; defines functions only.
5
+ #
6
+ # loki_run_summary RESULT_CODE [START_SHA]
7
+ # Honors NO_COLOR and LOKI_SUMMARY_JSON=1 (machine summary). LOKI_QUIET=1 is applied by the
8
+ # caller's log threshold (banner noise off); the summary itself always prints.
9
+
10
+ loki_run_summary() {
11
+ # Print once per process even if two exit paths both call it.
12
+ [ "${_LOKI_SUMMARY_PRINTED:-0}" = "1" ] && return 0
13
+ _LOKI_SUMMARY_PRINTED=1
14
+ local code="${1:-0}" start_sha="${2:-${_LOKI_RUN_START_SHA:-}}"
15
+ local loki_dir="${LOKI_DIR:-${TARGET_DIR:-.}/.loki}"
16
+ local result="done-unverified" files="" ins="" del="" shortstat="" cost="" receipt="" next=""
17
+ local elapsed=$(( $(date +%s) - ${SESSION_START_EPOCH:-$(date +%s)} ))
18
+
19
+ # Result: verified only when a proof exists and the run exited 0.
20
+ local rid="" proof=""
21
+ if [ -s "$loki_dir/state/last-proof-id.txt" ]; then rid="$(head -n1 "$loki_dir/state/last-proof-id.txt" 2>/dev/null | tr -d '[:space:]')"; fi
22
+ case "$rid" in *[!A-Za-z0-9._-]*) rid="" ;; esac
23
+ [ -n "$rid" ] && [ -f "$loki_dir/proofs/$rid/proof.json" ] && proof="$loki_dir/proofs/$rid/proof.json"
24
+ case "$code" in
25
+ 0) if [ -n "$proof" ]; then result="verified"; else result="done-unverified"; fi ;;
26
+ 130|143) result="stopped" ;;
27
+ *) result="failed" ;;
28
+ esac
29
+ [ -f "$loki_dir/STOPPED" ] && result="stopped"
30
+ [ -n "$proof" ] && receipt="$proof"
31
+
32
+ # Files changed vs run-start SHA (excluding .loki and .git).
33
+ if [ -n "$start_sha" ]; then
34
+ local range="${start_sha}..HEAD"
35
+ # LOKI_SUMMARY_WORKTREE=1 (loki edit): compare against the working tree, edits are uncommitted.
36
+ [ "${LOKI_SUMMARY_WORKTREE:-0}" = "1" ] && range="${start_sha}"
37
+ shortstat="$( (cd "${TARGET_DIR:-.}" && git diff --shortstat "$range" -- . ':(exclude).loki/' ':(exclude).git/') 2>/dev/null || true )"
38
+ files="$(printf '%s\n' "$shortstat" | grep -oE '[0-9]+ file' | grep -oE '[0-9]+' | head -1)"
39
+ ins="$(printf '%s\n' "$shortstat" | grep -oE '[0-9]+ insertion' | grep -oE '[0-9]+' | head -1)"
40
+ del="$(printf '%s\n' "$shortstat" | grep -oE '[0-9]+ deletion' | grep -oE '[0-9]+' | head -1)"
41
+ [ -z "$files" ] && files=0
42
+ [ -z "$ins" ] && ins=0
43
+ [ -z "$del" ] && del=0
44
+ fi
45
+
46
+ # Cost: legacy cost comes from the context tracker (token estimate), so it is always marked estimated.
47
+ if [ -f "$loki_dir/context/tracking.json" ]; then
48
+ cost="$(LOKI_TRK="$loki_dir/context/tracking.json" python3 -E -c "
49
+ import json, os
50
+ try:
51
+ c = json.load(open(os.environ['LOKI_TRK'])).get('totals', {}).get('total_cost_usd')
52
+ print('' if c is None else '%.2f' % float(c))
53
+ except Exception:
54
+ print('')
55
+ " 2>/dev/null || true)"
56
+ fi
57
+
58
+ # LOKI_SUMMARY_COST: exact cost from the caller (loki edit reads it from the provider).
59
+ local cost_exact=false
60
+ if [ -n "${LOKI_SUMMARY_COST:-}" ]; then cost="$LOKI_SUMMARY_COST"; cost_exact=true; fi
61
+
62
+ case "$result" in
63
+ verified) if [ "${files:-0}" != "0" ] && [ -n "$files" ]; then next="loki diff"; else next="loki status"; fi ;;
64
+ done-unverified) next="loki verify" ;;
65
+ stopped) next="loki status" ;;
66
+ *) if [ -n "$files" ] && [ "$files" != "0" ]; then next="loki undo"; else next="loki doctor"; fi ;;
67
+ esac
68
+
69
+ # REQTRACE: requirements with no passing check, from .loki/state/requirements-map.json (written by the Bun runner and engine10).
70
+ local unc=""
71
+ if [ -s "$loki_dir/state/requirements-map.json" ]; then
72
+ unc="$(LOKI_RM="$loki_dir/state/requirements-map.json" python3 -I -c "
73
+ import json, os
74
+ try:
75
+ m = json.load(open(os.environ['LOKI_RM']))
76
+ n = sum(1 for r in m.get('requirements', []) if r.get('status') == 'uncovered')
77
+ print(n if n else '')
78
+ except Exception:
79
+ print('')
80
+ " 2>/dev/null || true)"
81
+ fi
82
+ local next_h="$next"
83
+ [ -n "$unc" ] && next_h="${next}; ${unc} requirement(s) uncovered, see: loki plan --requirements"
84
+
85
+ local mm=$((elapsed / 60)) ss=$((elapsed % 60)) elapsed_h
86
+ if [ "$elapsed" -lt 60 ]; then elapsed_h="${elapsed}s"; else elapsed_h="${mm}m$(printf '%02d' "$ss")s"; fi
87
+
88
+ if [ "${LOKI_SUMMARY_JSON:-0}" = "1" ]; then
89
+ printf '{"result":"%s","files_changed":%s,"insertions":%s,"deletions":%s,"cost_usd":%s,"cost_estimated":%s,"elapsed_s":%s,"receipt":%s,"next":"%s"}\n' \
90
+ "$result" "${files:-null}" "${ins:-null}" "${del:-null}" "${cost:-null}" "$([ "$cost_exact" = true ] && echo false || echo true)" "$elapsed" \
91
+ "$([ -n "$receipt" ] && printf '"%s"' "$receipt" || printf 'null')" "$next"
92
+ return 0
93
+ fi
94
+
95
+ local c0="" c1=""
96
+ if [ -t 1 ] && [ -z "${NO_COLOR+x}" ]; then
97
+ c1=$'\033[0m'
98
+ case "$result" in verified) c0=$'\033[32m' ;; done-unverified) c0=$'\033[33m' ;; *) c0=$'\033[31m' ;; esac
99
+ fi
100
+ local files_h="unknown" cost_h="not measured"
101
+ [ -n "$files" ] && files_h="${files} changed (+${ins} -${del})"
102
+ if [ -n "$cost" ]; then
103
+ if [ "$cost_exact" = true ]; then cost_h="\$${cost}"; else cost_h="\$${cost} (estimated)"; fi
104
+ fi
105
+ printf '\n'
106
+ printf 'Result: %s%s%s\n' "$c0" "$result" "$c1"
107
+ printf 'Files: %s\n' "$files_h"
108
+ printf 'Cost: %s\n' "$cost_h"
109
+ printf 'Elapsed: %s\n' "$elapsed_h"
110
+ [ -n "$receipt" ] && printf 'Receipt: %s\n' "$receipt"
111
+ printf 'next: %s (or: loki chat --attach)\n' "$next_h"
112
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "version": 1,
3
+ "comment": "Single source of truth for Loki setup requirements per execution path. Read by loki-ts/src/commands/doctor.ts (doctor, runtime errors), autonomy/provider-offer.sh (bash fallback), autonomy/setup-wizard.sh (loki setup) and tests (the generated block in docs/alternative-installations.md is asserted against it). Edit here, then run UPDATE_CONTRACT=1 bun test tests/commands/doctor.test.ts from loki-ts.",
4
+ "paths": [
5
+ { "id": "common", "title": "All paths", "summary": "Needed by every Loki command" },
6
+ { "id": "claude-cli", "title": "Claude Code CLI path (default, loki start)", "summary": "Loki drives the claude binary you installed and logged in" },
7
+ { "id": "api-key-sdk", "title": "Anthropic API-key path (Agent SDK, no claude CLI)", "summary": "Opt-in with LOKI_SDK_MODE=full; the bundled Agent SDK runs the loop over HTTPS" },
8
+ { "id": "other-providers", "title": "Other provider CLIs", "summary": "codex (degraded), cline, aider, opencode: any one replaces the claude CLI" }
9
+ ],
10
+ "requirements": [
11
+ { "id": "node", "path": "common", "level": "required", "kind": "command", "target": "node", "min": "20.0", "label": "Node.js 20 or newer", "fix": "install Node 20+ from https://nodejs.org" },
12
+ { "id": "python3", "path": "common", "level": "required", "kind": "command", "target": "python3", "min": "3.8", "label": "Python 3.8 or newer", "fix": "install python3 with your package manager (brew install python3)" },
13
+ { "id": "jq", "path": "common", "level": "required", "kind": "command", "target": "jq", "label": "jq", "fix": "install jq with your package manager (brew install jq)" },
14
+ { "id": "git", "path": "common", "level": "required", "kind": "command", "target": "git", "label": "git", "fix": "install git with your package manager (brew install git)" },
15
+ { "id": "curl", "path": "common", "level": "required", "kind": "command", "target": "curl", "label": "curl", "fix": "install curl with your package manager (brew install curl)" },
16
+ { "id": "bash", "path": "common", "level": "optional", "kind": "command", "target": "bash", "min": "4.0", "label": "bash 4.0 or newer", "fix": "install a newer bash (brew install bash); macOS ships 3.2" },
17
+ { "id": "bun", "path": "common", "level": "optional", "kind": "command", "target": "bun", "min": "1.3", "label": "Bun 1.3 or newer (bundled by npm install)", "fix": "reinstall without --no-optional (npm bundles @oven/bun-*) or install from https://bun.sh; without it loki falls back to the slower bash CLI" },
18
+
19
+ { "id": "claude", "path": "claude-cli", "level": "required", "kind": "command", "target": "claude", "label": "claude CLI on PATH (then log in: claude auth login)", "fix": "npm install -g @anthropic-ai/claude-code" },
20
+
21
+ { "id": "sdk-mode", "path": "api-key-sdk", "level": "required", "kind": "env_value", "target": ["LOKI_SDK_LOOP"], "values": ["1", "true"], "label": "SDK loop enabled (LOKI_SDK_MODE=full)", "fix": "export LOKI_SDK_MODE=full" },
22
+ { "id": "sdk-credentials", "path": "api-key-sdk", "level": "required", "kind": "env_any", "target": ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL"], "label": "Anthropic credentials (API key, auth token or gateway URL)", "fix": "export ANTHROPIC_API_KEY=<your key>" },
23
+ { "id": "sdk-binary", "path": "api-key-sdk", "level": "required", "kind": "sdk_binary", "target": "@anthropic-ai/claude-agent-sdk", "label": "Claude Agent SDK platform binary (optional npm dependency)", "fix": "reinstall without --no-optional: npm install -g loki-mode (the SDK is an optionalDependency)" },
24
+ { "id": "sdk-bun", "path": "api-key-sdk", "level": "required", "kind": "command", "target": "bun", "min": "1.3", "label": "Bun runtime (the SDK loop runs only on the Bun route)", "fix": "reinstall without --no-optional (npm bundles @oven/bun-*) or install from https://bun.sh" },
25
+
26
+ { "id": "codex", "path": "other-providers", "level": "optional", "kind": "command", "target": "codex", "label": "codex CLI", "fix": "npm install -g @openai/codex" },
27
+ { "id": "cline", "path": "other-providers", "level": "optional", "kind": "command", "target": "cline", "label": "cline CLI", "fix": "npm install -g cline" },
28
+ { "id": "aider", "path": "other-providers", "level": "optional", "kind": "command", "target": "aider", "label": "aider CLI", "fix": "pip install aider-chat" },
29
+ { "id": "opencode", "path": "other-providers", "level": "optional", "kind": "command", "target": "opencode", "label": "opencode CLI", "fix": "npm install -g opencode-ai" }
30
+ ],
31
+ "missing_optional": [
32
+ { "dependency": "@anthropic-ai/claude-agent-sdk (or its platform binary)", "effect": "The api-key-sdk path is unavailable and doctor reports it not ready. The claude-cli path and all other providers are unaffected." },
33
+ { "dependency": "@oven/bun-* (Bun)", "effect": "bin/loki falls back to the bash CLI (slower). The api-key-sdk path is unavailable because the SDK loop runs only on Bun." }
34
+ ]
35
+ }