loki-mode 11.119.0 → 11.120.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 +2 -2
- package/VERSION +1 -1
- package/autonomy/lib/backlog.py +107 -37
- package/autonomy/loki +5 -2
- package/dashboard/__init__.py +1 -1
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/trackers.md +12 -0
- package/docs/v10/GUIDE.md +3 -3
- package/loki-ts/data/child-env.json +2 -0
- package/loki-ts/dist/loki.js +1529 -1519
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +4947 -4750
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-BI9sK7Ww.js → AdminPage-D1_vz1LQ.js} +1 -1
- package/web-app/dist/assets/{Avatar-CqStW3hh.js → Avatar-BefQj_9m.js} +1 -1
- package/web-app/dist/assets/{Badge-Sqo523qW.js → Badge-BcAowN-N.js} +1 -1
- package/web-app/dist/assets/{Button-65BGFYzo.js → Button-BeVwFkYh.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-DLppS7i4.js → CockpitPage-Q-sO8Psm.js} +1 -1
- package/web-app/dist/assets/{ComparePage-y-To7RDW.js → ComparePage-CiJ3FrSl.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-BRfjLxKD.js → ErrorBoundary-DdIh2DlF.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-BZYXpZlj.js → EvidenceReceiptPanel-cf2Jhgl3.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-D5VQeqef.js → GitHubIssuesPanel-SfgkosoM.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-B-ZTugBP.js → GitHubPRsPanel-DsUqn99r.js} +1 -1
- package/web-app/dist/assets/{HomePage-3O1Ixdaj.js → HomePage-C6PCzqqg.js} +2 -2
- package/web-app/dist/assets/{LoginPage-D_c2Q5Yd.js → LoginPage-Bqci5QVa.js} +1 -1
- package/web-app/dist/assets/{MagicPage-CWoBDJIL.js → MagicPage-NO5PIrOb.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-D_8_KsDG.js → MetricsPage-B0oveHbr.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-Ck7EB21i.js → NotFoundPage-CDh2DiQC.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-DjzxAUpk.js → ProjectPage-CrJ_t9m_.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-IiL9eZZl.js → ProjectsPage-UPhA-lpV.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-B21XsJXj.js → SettingsPage-DKO1LhLq.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-Dw-qMqRX.js → ShowcasePage-sZmG4qo4.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-DRKM2q7Y.js → SystemSettingsPage-Drvx9eXK.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-cE3eF_mQ.js → TeamsPage-DFuLa1I9.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-2m8EFD1w.js → TemplatesPage-C_U8lRMD.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-BVj57oRn.js → TerminalOutput-DdU-3V0-.js} +1 -1
- package/web-app/dist/assets/{activity--3RdDrr_.js → activity-BwXV9-sA.js} +1 -1
- package/web-app/dist/assets/{bell-Cf1aNwyn.js → bell-DF148FeB.js} +1 -1
- package/web-app/dist/assets/{bot-C9eepiBo.js → bot-BM1t71_O.js} +1 -1
- package/web-app/dist/assets/{check-C0eAyl30.js → check-DHJPb450.js} +1 -1
- package/web-app/dist/assets/{chevron-left-CQzEDgKz.js → chevron-left-DZIgwXb6.js} +1 -1
- package/web-app/dist/assets/{circle-alert-C45LOFIn.js → circle-alert-31lHNmy0.js} +1 -1
- package/web-app/dist/assets/{clock-DRQ4_6O5.js → clock-D4QAxoCy.js} +1 -1
- package/web-app/dist/assets/{cloud-D2YwYtSX.js → cloud-Dd2iypzJ.js} +1 -1
- package/web-app/dist/assets/{code-xml-C0kAguzE.js → code-xml-CnUOPwx8.js} +1 -1
- package/web-app/dist/assets/{database-Dc-69TwF.js → database-Dhpbplpo.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-D80FbCfO.js → dollar-sign-DCt7L7Pk.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-D0vcShuD.js → file-code-corner-D2SPiEH7.js} +1 -1
- package/web-app/dist/assets/{file-plus-D7P7v4hD.js → file-plus-cCrpp-pe.js} +1 -1
- package/web-app/dist/assets/{globe-DGnqby6a.js → globe-Cn6TYK_z.js} +1 -1
- package/web-app/dist/assets/{hammer-BvafjTXC.js → hammer-sMLkpUw2.js} +1 -1
- package/web-app/dist/assets/{index-1Kvtppgn.js → index-Dgb8Kves.js} +3 -3
- package/web-app/dist/assets/{layers-7f3JxJPK.js → layers-DuPguIVU.js} +1 -1
- package/web-app/dist/assets/{loader-circle-Dsmov_Fj.js → loader-circle-BBhsXs18.js} +1 -1
- package/web-app/dist/assets/{lock-CYPcR4L9.js → lock-n-qJvU_o.js} +1 -1
- package/web-app/dist/assets/{package-CDRe5Fid.js → package-cDxKfjAD.js} +1 -1
- package/web-app/dist/assets/{plus-BwmTPRgM.js → plus-COk5sQxp.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-DxlbreLM.js → refresh-cw--VKVhvpo.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-CpTwximO.js → rotate-ccw-DvZ6KExW.js} +1 -1
- package/web-app/dist/assets/{scroll-text-CgcWfO8K.js → scroll-text-HRyHuQUy.js} +1 -1
- package/web-app/dist/assets/{server-CBVNgMbf.js → server-CoZSZtid.js} +1 -1
- package/web-app/dist/assets/{shield-alert-CL8lOpTJ.js → shield-alert--WkXdHlN.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-B245iaZM.js → thumbs-up-YeW2Lb8g.js} +1 -1
- package/web-app/dist/assets/{trash-2-D_LCAVug.js → trash-2-DuhNrOPo.js} +1 -1
- package/web-app/dist/assets/{trending-down-DQn3R8k7.js → trending-down-55EMrZu6.js} +1 -1
- package/web-app/dist/assets/{trending-up-BuXPO-tN.js → trending-up-BaUDEQ-n.js} +1 -1
- package/web-app/dist/assets/{upload-DNc_smXL.js → upload-BrHq6BXI.js} +1 -1
- package/web-app/dist/assets/{usePolling-CwMs9ya4.js → usePolling-BEtK-_qo.js} +1 -1
- package/web-app/dist/assets/{user-DupXJP9t.js → user-DL5XlCBR.js} +1 -1
- package/web-app/dist/index.html +1 -1
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: loki-mode
|
|
|
3
3
|
description: Runs an autonomous software factory that knows what it is supposed to deliver and proves it did, with a signed receipt. Use when the user says Loki Mode or asks to build, fix or verify software autonomously.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Loki Mode v11.
|
|
6
|
+
# Loki Mode v11.120.0
|
|
7
7
|
|
|
8
8
|
**Current entry points (Loki 10 engine):** `loki "<task>"`, `loki owner/repo#N` and `loki quick "<task>"` run the Loki 10 engine and end with a signed receipt (`loki verify`). `loki backlog owner/repo --all` runs many issues in parallel. Guide: `docs/v10/GUIDE.md`. The skill instructions below, and `loki start`, describe the previous bash loop. PRD-file starts (`loki start ./prd.md`) and the opencode provider still run on it until FC38-SWEEP ports them; the legacy-engine command and the LOKI_ENGINE switch remain removed. Prefer `loki owner/repo#N` for issues.
|
|
9
9
|
|
|
@@ -473,4 +473,4 @@ Implemented, planned and deprecated items, with the version each landed in: `CHA
|
|
|
473
473
|
|
|
474
474
|
---
|
|
475
475
|
|
|
476
|
-
**v11.
|
|
476
|
+
**v11.120.0 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
11.
|
|
1
|
+
11.120.0
|
package/autonomy/lib/backlog.py
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
loki backlog owner/repo --all | --label X | --issues 1,2,3
|
|
5
5
|
[--concurrency N] [--slots N] [--dry-run]
|
|
6
|
+
loki backlog jira:PROJ | linear:TEAM (same options; Jira and Linear items)
|
|
6
7
|
|
|
7
8
|
Each issue gets its own git worktree and branch (loki/backlog-N) beside the
|
|
8
9
|
checkout; the launcher runs inside it. Success = the child exited 0 (the engine's
|
|
9
|
-
ladder: 0 VERIFIED, 1 FAILED, 3 BUDGET_STOP, 4 BLOCKED, 5 STALLED). A
|
|
10
|
-
from a failed run is still FAILED
|
|
10
|
+
ladder: 0 VERIFIED, 1 FAILED, 3 BUDGET_STOP, 4 BLOCKED, 5 STALLED, 6 PARTIAL). A
|
|
11
|
+
draft PR from a failed run is still FAILED; a PARTIAL run counts only with its PR.
|
|
12
|
+
A split issue prints one Outcome and one Cost line for all its slices, so its
|
|
13
|
+
spend reaches the day ledger like any run. Exit: 0 all ok, 3 only budget stops, 1 other
|
|
11
14
|
failures, 2 usage/config error.
|
|
12
15
|
|
|
13
16
|
Unit mode (D61 slice 10): --dag FILE [--group G] also runs the units of a
|
|
@@ -21,14 +24,22 @@ Passing unit branches are kept for the integrator; issue mode is unchanged.
|
|
|
21
24
|
|
|
22
25
|
Triage: before anything runs, every issue is classified by the triage router
|
|
23
26
|
(loki-ts/src/features/triage.ts, via `loki internal triage`) as implement (run
|
|
24
|
-
it
|
|
25
|
-
|
|
26
|
-
with
|
|
27
|
+
it; a large issue, by the one rule in features/decompose.ts deliverables, runs
|
|
28
|
+
and the engine splits it into slices), spec (vague or ambiguous: draft
|
|
29
|
+
.loki/specs/<slug>.md with `loki plan --spec`, run nothing, print the command to
|
|
30
|
+
run it after review) or human (never run headless; listed with the reason). --dry-run prints the class and reason per issue. A label
|
|
27
31
|
loki:implement, loki:spec or loki:human forces the class; LOKI_TRIAGE=0 turns
|
|
28
32
|
the router off (every issue runs, as before). The class and reason reach each
|
|
29
33
|
child run as LOKI_TRIAGE_CLASS / LOKI_TRIAGE_REASON, which the engine records in
|
|
30
34
|
the run events, the receipt and the PR body.
|
|
31
35
|
|
|
36
|
+
Jira and Linear: `jira:PROJ` or `linear:TEAM` in place of owner/repo lists that
|
|
37
|
+
project's open items with `loki internal tracker-list` (features/tracker_intake.ts,
|
|
38
|
+
the same credentials as `loki jira:PROJ-1`), triages them the same way and runs
|
|
39
|
+
each as `loki jira:PROJ-N` / `loki linear:TEAM-N` from the current checkout.
|
|
40
|
+
--issues takes item numbers (12 means PROJ-12). A large Jira or Linear item runs
|
|
41
|
+
as one run: the engine splits only GitHub issues today.
|
|
42
|
+
|
|
32
43
|
Test seam: LOKI_BACKLOG_LAUNCHER replaces the real launcher (called with the
|
|
33
44
|
issue ref, cwd = the issue worktree).
|
|
34
45
|
"""
|
|
@@ -51,6 +62,10 @@ import worktree_prep # noqa: E402
|
|
|
51
62
|
|
|
52
63
|
REPO_ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
|
|
53
64
|
REPO_RE = re.compile(r"^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$")
|
|
65
|
+
TRACKER_RE = re.compile(r"^(jira|linear):([A-Za-z][A-Za-z0-9_]*)$")
|
|
66
|
+
# A tracker item key names worktree, branch and log paths: only PROJECT-<number> of the listed project is accepted.
|
|
67
|
+
ITEM_KEY_RE = r"^%s-\d+$" # %s: the validated, uppercased project key
|
|
68
|
+
TRACKER_SECRETS = {"jira": ("JIRA_API_TOKEN", "JIRA_TOKEN", "LOKI_JIRA_TOKEN"), "linear": ("LINEAR_API_KEY", "LOKI_LINEAR_TOKEN")} # each tracker's token and its aliases
|
|
54
69
|
|
|
55
70
|
|
|
56
71
|
def say(msg):
|
|
@@ -76,9 +91,41 @@ def origin_slug(cwd):
|
|
|
76
91
|
return m.group(1) if m else ""
|
|
77
92
|
|
|
78
93
|
|
|
79
|
-
def _issue(i):
|
|
94
|
+
def _issue(i, repo):
|
|
95
|
+
"""One work item. key: the job-table key; label: how it prints; ref: what the launcher runs; slug: branch suffix."""
|
|
80
96
|
labels = [l.get("name", "") if isinstance(l, dict) else str(l) for l in i.get("labels") or []]
|
|
81
|
-
|
|
97
|
+
n = i["number"]
|
|
98
|
+
return {"number": n, "key": n, "label": "#%d" % n, "ref": "%s#%d" % (repo, n), "slug": str(n), "split": True,
|
|
99
|
+
"title": i.get("title") or "", "body": i.get("body") or "", "labels": labels}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def list_tracker(spec, label, numbers, env):
|
|
103
|
+
"""Jira/Linear items via `loki internal tracker-list` (features/tracker_intake.ts). Raises RuntimeError."""
|
|
104
|
+
source, project = spec.split(":", 1)
|
|
105
|
+
cmd = [os.path.join(REPO_ROOT, "bin", "loki"), "internal", "tracker-list", spec]
|
|
106
|
+
if label:
|
|
107
|
+
cmd += ["--label", label]
|
|
108
|
+
if numbers:
|
|
109
|
+
cmd += ["--issues", ",".join(str(n) for n in numbers)]
|
|
110
|
+
r = subprocess.run(cmd, capture_output=True, text=True, env=env, stdin=subprocess.DEVNULL)
|
|
111
|
+
try:
|
|
112
|
+
rows = json.loads(r.stdout) if r.returncode == 0 else None
|
|
113
|
+
if not isinstance(rows, list):
|
|
114
|
+
raise ValueError("not a list")
|
|
115
|
+
out = [{"number": int(x["number"]), "key": str(x["key"]), "label": str(x["key"]), "ref": "%s:%s" % (source, x["key"]),
|
|
116
|
+
"slug": str(x["key"]), "split": False, "title": str(x.get("title") or ""), "body": str(x.get("body") or ""),
|
|
117
|
+
"labels": [str(l) for l in x.get("labels") or []], "source": source} for x in rows]
|
|
118
|
+
except (ValueError, TypeError, KeyError):
|
|
119
|
+
why = (r.stderr.strip().splitlines() or ["no usable output"])[-1]
|
|
120
|
+
raise RuntimeError("listing %s failed (%s)" % (spec, why))
|
|
121
|
+
key_re = re.compile(ITEM_KEY_RE % re.escape(project))
|
|
122
|
+
for i in out:
|
|
123
|
+
if not key_re.fullmatch(i["key"]) or not str(i["number"]) == i["key"].rsplit("-", 1)[1]:
|
|
124
|
+
raise RuntimeError("listing %s returned an invalid item key %r; refusing to use it in a path" % (spec, i["key"][:40]))
|
|
125
|
+
missing = sorted(set(numbers or []) - {i["number"] for i in out})
|
|
126
|
+
if missing:
|
|
127
|
+
raise RuntimeError("%s has no item %s" % (spec, ", ".join("%s-%d" % (project.upper(), n) for n in missing)))
|
|
128
|
+
return out
|
|
82
129
|
|
|
83
130
|
|
|
84
131
|
def list_issues(repo, label, env):
|
|
@@ -89,7 +136,7 @@ def list_issues(repo, label, env):
|
|
|
89
136
|
r = subprocess.run(cmd, capture_output=True, text=True, env=env)
|
|
90
137
|
if r.returncode != 0:
|
|
91
138
|
raise RuntimeError("gh issue list failed: " + (r.stderr.strip().splitlines() or ["unknown error"])[0])
|
|
92
|
-
return sorted((_issue(i) for i in json.loads(r.stdout or "[]")), key=lambda i: i["number"])
|
|
139
|
+
return sorted((_issue(i, repo) for i in json.loads(r.stdout or "[]")), key=lambda i: i["number"])
|
|
93
140
|
|
|
94
141
|
|
|
95
142
|
def view_issues(repo, numbers, env):
|
|
@@ -99,7 +146,7 @@ def view_issues(repo, numbers, env):
|
|
|
99
146
|
capture_output=True, text=True, env=env)
|
|
100
147
|
if r.returncode != 0:
|
|
101
148
|
raise RuntimeError("gh issue view %d failed: %s" % (n, (r.stderr.strip().splitlines() or ["unknown error"])[0]))
|
|
102
|
-
out.append(_issue(json.loads(r.stdout or "{}")))
|
|
149
|
+
out.append(_issue(json.loads(r.stdout or "{}"), repo))
|
|
103
150
|
return out
|
|
104
151
|
|
|
105
152
|
|
|
@@ -107,12 +154,12 @@ TRIAGE_CLASSES = ("implement", "spec", "human")
|
|
|
107
154
|
|
|
108
155
|
|
|
109
156
|
def triage(issues, top, env):
|
|
110
|
-
"""-> {
|
|
157
|
+
"""-> {key: (class, reason)} from `loki internal triage`; raises RuntimeError (fail closed: nothing untriaged runs)."""
|
|
111
158
|
if os.environ.get("LOKI_TRIAGE") == "0":
|
|
112
|
-
return {i["
|
|
159
|
+
return {i["key"]: ("implement", "LOKI_TRIAGE=0: router off") for i in issues}
|
|
113
160
|
if not issues:
|
|
114
161
|
return {}
|
|
115
|
-
items = [{"id": i["
|
|
162
|
+
items = [{"id": i["key"], "title": i["title"], "body": i["body"], "labels": i["labels"], "split": i["split"]} for i in issues]
|
|
116
163
|
r = subprocess.run([os.path.join(REPO_ROOT, "bin", "loki"), "internal", "triage", "--repo-dir", top],
|
|
117
164
|
input=json.dumps(items), capture_output=True, text=True, env=env)
|
|
118
165
|
try:
|
|
@@ -120,12 +167,17 @@ def triage(issues, top, env):
|
|
|
120
167
|
got = {row["id"]: (row["class"], row["reason"]) for row in rows if row.get("class") in TRIAGE_CLASSES}
|
|
121
168
|
except (ValueError, TypeError, KeyError, AttributeError):
|
|
122
169
|
got = None
|
|
123
|
-
if not got or set(got) != {i["
|
|
170
|
+
if not got or set(got) != {i["key"] for i in issues}:
|
|
124
171
|
why = (r.stderr.strip().splitlines() or ["no usable output"])[-1]
|
|
125
172
|
raise RuntimeError("triage failed (%s); fix it, or set LOKI_TRIAGE=0 to run every issue untriaged" % why)
|
|
126
173
|
return got
|
|
127
174
|
|
|
128
175
|
|
|
176
|
+
def without(env, keys):
|
|
177
|
+
"""A copy of env with keys removed."""
|
|
178
|
+
return {k: v for k, v in env.items() if k not in keys}
|
|
179
|
+
|
|
180
|
+
|
|
129
181
|
def draft_spec(issue, top, env):
|
|
130
182
|
"""Draft .loki/specs/<slug>.md with `loki plan --spec` (one plan session). -> (ok, status line)."""
|
|
131
183
|
task = issue["title"] + ("\n\n" + issue["body"] if issue["body"].strip() else "")
|
|
@@ -180,10 +232,13 @@ def add_spend(usd):
|
|
|
180
232
|
|
|
181
233
|
def parse_result(rc, text):
|
|
182
234
|
"""-> (ok, status line text, cost_usd or None)."""
|
|
183
|
-
pr = re.search(r"^PR:\s+(https
|
|
235
|
+
pr = re.search(r"^PR:\s+((?:https?|local)://\S+)", text, re.M) # local://: published to a local bare origin (engine10-push.sh)
|
|
184
236
|
why = re.search(r"^Reason:\s+(.+)$", text, re.M)
|
|
185
237
|
cost = re.search(r"^Cost:\s+(?:partial:\s+)?\$([0-9]+(?:\.[0-9]+)?)", text, re.M)
|
|
186
238
|
usd = float(cost.group(1)) if cost else None
|
|
239
|
+
plan = re.search(r"^Split planning:\s+(?:partial:\s+)?\$([0-9]+(?:\.[0-9]+)?)", text, re.M) # a refused split's planning sessions
|
|
240
|
+
if plan:
|
|
241
|
+
usd = (usd or 0.0) + float(plan.group(1))
|
|
187
242
|
reason = why.group(1).strip() if why else ""
|
|
188
243
|
if rc == 0:
|
|
189
244
|
return True, ("PR " + pr.group(1)) if pr else "VERIFIED", usd
|
|
@@ -191,6 +246,8 @@ def parse_result(rc, text):
|
|
|
191
246
|
return False, "BLOCKED: " + (reason or "see the run log"), usd
|
|
192
247
|
if rc == 3:
|
|
193
248
|
return False, "BUDGET_STOP: " + (reason or "run cost cap reached"), usd
|
|
249
|
+
if rc == 6: # PARTIAL: some proof missing; counts as done only with its (draft) PR
|
|
250
|
+
return bool(pr), ("PARTIAL, PR " + pr.group(1)) if pr else "PARTIAL: " + (reason or "not every check proven"), usd
|
|
194
251
|
return False, "FAILED: " + (reason or "exit %d" % rc), usd
|
|
195
252
|
|
|
196
253
|
|
|
@@ -283,8 +340,14 @@ def main(argv):
|
|
|
283
340
|
ap.add_argument("--group", help="unit group id (default: the DAG's group, else g1)")
|
|
284
341
|
a = ap.parse_args(argv)
|
|
285
342
|
|
|
286
|
-
|
|
287
|
-
|
|
343
|
+
tracker = TRACKER_RE.match(a.repo)
|
|
344
|
+
if tracker: # jira:proj is jira:PROJ: tracker project keys are uppercase
|
|
345
|
+
a.repo = "%s:%s" % (tracker.group(1), tracker.group(2).upper())
|
|
346
|
+
tracker = TRACKER_RE.match(a.repo)
|
|
347
|
+
if tracker and os.environ.get("LOKI_TRACKER_INTAKE") == "0":
|
|
348
|
+
return die("LOKI_TRACKER_INTAKE=0 disables Jira and Linear; unset it to run %s" % a.repo)
|
|
349
|
+
if not (REPO_RE.match(a.repo) or tracker):
|
|
350
|
+
return die("repo must be owner/repo, jira:PROJ or linear:TEAM, got %r" % a.repo)
|
|
288
351
|
if not (a.all or a.label or a.issues or a.dag):
|
|
289
352
|
return die("choose one of --all, --label X, --issues 1,2,3, --dag FILE")
|
|
290
353
|
group, dag_units = None, []
|
|
@@ -329,7 +392,7 @@ def main(argv):
|
|
|
329
392
|
top = git("rev-parse", "--show-toplevel").stdout.strip()
|
|
330
393
|
if not top:
|
|
331
394
|
return die("run this from a checkout of %s" % a.repo)
|
|
332
|
-
if origin_slug(top).lower() != a.repo.lower():
|
|
395
|
+
if not tracker and origin_slug(top).lower() != a.repo.lower():
|
|
333
396
|
return die("this checkout's origin is %r, not %s; cd into a checkout of %s"
|
|
334
397
|
% (origin_slug(top) or "unknown", a.repo, a.repo))
|
|
335
398
|
|
|
@@ -345,8 +408,11 @@ def main(argv):
|
|
|
345
408
|
u["base"] = sha
|
|
346
409
|
|
|
347
410
|
try:
|
|
348
|
-
|
|
349
|
-
|
|
411
|
+
if tracker:
|
|
412
|
+
issues = list_tracker(a.repo, a.label, numbers, env) if (numbers or a.all or a.label) else []
|
|
413
|
+
else:
|
|
414
|
+
issues = (view_issues(a.repo, numbers, env) if numbers
|
|
415
|
+
else list_issues(a.repo, a.label, env) if (a.all or a.label) else [])
|
|
350
416
|
klass = triage(issues, top, env)
|
|
351
417
|
except RuntimeError as e:
|
|
352
418
|
return die(redact(str(e), token), 1)
|
|
@@ -354,13 +420,14 @@ def main(argv):
|
|
|
354
420
|
say("backlog: %s concurrency %d, %d issue(s)" % (a.repo, conc, len(issues))
|
|
355
421
|
+ (", %d unit(s) in group %s" % (len(dag_units), group) if dag_units else ""))
|
|
356
422
|
for i in issues:
|
|
357
|
-
c, why = klass[i["
|
|
358
|
-
say("backlog:
|
|
423
|
+
c, why = klass[i["key"]]
|
|
424
|
+
say("backlog: %s %-9s %s | %s" % (i["label"], c, i["title"], why))
|
|
359
425
|
if a.dry_run:
|
|
360
|
-
n_of = lambda c: sum(1 for i in issues if klass[i["
|
|
426
|
+
n_of = lambda c: sum(1 for i in issues if klass[i["key"]][0] == c) # noqa: E731
|
|
427
|
+
n_large = sum(1 for i in issues if i["split"] and klass[i["key"]][0] == "implement" and klass[i["key"]][1].startswith("large ("))
|
|
361
428
|
if issues:
|
|
362
|
-
say("backlog: dry run: %d would run, %d would get a drafted spec, %d need a human; nothing launched"
|
|
363
|
-
% (n_of("implement"), n_of("spec"), n_of("human")))
|
|
429
|
+
say("backlog: dry run: %d would run%s, %d would get a drafted spec, %d need a human; nothing launched"
|
|
430
|
+
% (n_of("implement"), " (%d split into slices)" % n_large if n_large else "", n_of("spec"), n_of("human")))
|
|
364
431
|
for u in dag_units:
|
|
365
432
|
say("backlog: would run unit %s-%d (%s) after: %s" % (group, u["n"], u["id"], ", ".join(u["deps"]) or "nothing"))
|
|
366
433
|
return 0
|
|
@@ -395,26 +462,29 @@ def main(argv):
|
|
|
395
462
|
day_cap = cfg.get("budgets", {}).get("per_day_usd")
|
|
396
463
|
|
|
397
464
|
# Triage: only implement issues run; spec issues get a drafted spec, human issues are listed.
|
|
398
|
-
routed = {} #
|
|
465
|
+
routed = {} # key -> (ok, status) for issues that do not run
|
|
466
|
+
labels = {i["key"]: i["label"] for i in issues}
|
|
399
467
|
for i in issues:
|
|
400
|
-
c, why = klass[i["
|
|
468
|
+
c, why = klass[i["key"]]
|
|
401
469
|
if c == "human":
|
|
402
|
-
routed[i["
|
|
470
|
+
routed[i["key"]] = (True, "HUMAN: " + why)
|
|
403
471
|
elif c == "spec":
|
|
404
|
-
ok, status = draft_spec(i, top, child_env)
|
|
405
|
-
routed[i["
|
|
472
|
+
ok, status = draft_spec(i, top, without(child_env, sum(TRACKER_SECRETS.values(), ())))
|
|
473
|
+
routed[i["key"]] = (ok, "%s (%s)" % (status, why))
|
|
406
474
|
if c != "implement":
|
|
407
|
-
say("backlog:
|
|
475
|
+
say("backlog: %s %s" % (i["label"], routed[i["key"]][1]))
|
|
408
476
|
|
|
409
477
|
# One job table for issues and units: they share one slot pool.
|
|
410
478
|
spec = {}
|
|
411
479
|
for i in issues:
|
|
412
|
-
n = i["
|
|
480
|
+
n = i["key"]
|
|
413
481
|
if n in routed:
|
|
414
482
|
continue
|
|
415
|
-
spec[n] = {"label": "
|
|
416
|
-
"cmd": [launcher, "
|
|
417
|
-
"env": {"LOKI_TRIAGE_CLASS": klass[n][0], "LOKI_TRIAGE_REASON": klass[n][1]}
|
|
483
|
+
spec[n] = {"label": i["label"], "branch": "loki/backlog-%s" % i["slug"], "wt": "issue-%s" % i["slug"],
|
|
484
|
+
"cmd": [launcher, i["ref"]], "deps": [], "unit": False,
|
|
485
|
+
"env": {"LOKI_TRIAGE_CLASS": klass[n][0], "LOKI_TRIAGE_REASON": klass[n][1]},
|
|
486
|
+
# a child keeps only its own tracker's token (intake and writeback need it); the other tracker's never reaches it
|
|
487
|
+
"drop": [k for src, keys in TRACKER_SECRETS.items() if src != i.get("source") for k in keys]}
|
|
418
488
|
key_of = {u["id"]: "unit-%s-%d" % (group, u["n"]) for u in dag_units}
|
|
419
489
|
for u in dag_units:
|
|
420
490
|
k = key_of[u["id"]]
|
|
@@ -423,7 +493,7 @@ def main(argv):
|
|
|
423
493
|
"deps": [key_of[d] for d in u["deps"]],
|
|
424
494
|
"env": {"LOKI_GROUP_ID": group, "LOKI_UNIT_ID": u["id"], "LOKI_UNIT_N": str(u["n"]),
|
|
425
495
|
"LOKI_UNIT_DEPS": ",".join(u["deps"]), "LOKI_UNIT_WRITE_SET": "\n".join(u["write_set"])},
|
|
426
|
-
"done": u["done"], "base": u["base"]}
|
|
496
|
+
"done": u["done"], "base": u["base"], "drop": sum(TRACKER_SECRETS.values(), ())} # a unit is a text task: no tracker token
|
|
427
497
|
if u["spec"]: # frozen group acceptance for unit_mode (wall.ts)
|
|
428
498
|
spec[k]["env"].update(LOKI_UNIT_SPEC=u["spec"], LOKI_SPEED="1")
|
|
429
499
|
state = {k: {"status": "queued", "ok": None, "cost": None, "ran": False} for k in spec}
|
|
@@ -531,7 +601,7 @@ def main(argv):
|
|
|
531
601
|
return
|
|
532
602
|
log = os.path.join(wt_root, "logs", s["wt"] + ".log")
|
|
533
603
|
with open(log, "w") as lf:
|
|
534
|
-
p = subprocess.Popen(s["cmd"], cwd=wt, env=dict(child_env, **s["env"]), stdout=lf,
|
|
604
|
+
p = subprocess.Popen(s["cmd"], cwd=wt, env=without(dict(child_env, **s["env"]), s.get("drop", ())), stdout=lf,
|
|
535
605
|
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL, start_new_session=True)
|
|
536
606
|
running[k] = (p, log, wt)
|
|
537
607
|
state[k].update(status="running", ran=True)
|
|
@@ -589,7 +659,7 @@ def main(argv):
|
|
|
589
659
|
say("Summary: %s" % a.repo)
|
|
590
660
|
say("%-14s %-10s %s" % ("ITEM", "COST", "RESULT"))
|
|
591
661
|
for n, s in state.items():
|
|
592
|
-
say("%-14s %-10s %s" % (spec[n]["label"] if n in spec else
|
|
662
|
+
say("%-14s %-10s %s" % (spec[n]["label"] if n in spec else labels[n], ("$%.2f" % s["cost"] if s["cost"] is not None else "unmeasured" if s["ran"] else "-"), s["status"]))
|
|
593
663
|
measured = sum(s["cost"] or 0 for s in state.values())
|
|
594
664
|
say("Total measured cost: $%.2f%s" % (measured, " (%d run(s) unmeasured, not counted as $0)" % unmeasured if unmeasured else ""))
|
|
595
665
|
bad = [s for s in state.values() if not s["ok"]]
|
package/autonomy/loki
CHANGED
|
@@ -14873,6 +14873,7 @@ cmd_backlog() {
|
|
|
14873
14873
|
echo -e "${BOLD}loki backlog${NC} - run a v10 issue-mode run for every matching open issue"
|
|
14874
14874
|
echo ""
|
|
14875
14875
|
echo "Usage: loki backlog owner/repo (--all | --label X | --issues 1,2,3) [--concurrency N] [--dry-run]"
|
|
14876
|
+
echo " loki backlog jira:PROJ | linear:TEAM (same options; --issues 12 means PROJ-12)"
|
|
14876
14877
|
echo ""
|
|
14877
14878
|
echo " --all Every open issue"
|
|
14878
14879
|
echo " --label X Open issues with label X"
|
|
@@ -14880,8 +14881,10 @@ cmd_backlog() {
|
|
|
14880
14881
|
echo " --concurrency N Max runs in parallel (default: loki.yaml concurrency, else 2)"
|
|
14881
14882
|
echo " --dry-run Print each issue's triage class (implement, spec, human) and reason; launch nothing"
|
|
14882
14883
|
echo ""
|
|
14883
|
-
echo "Run from a checkout of owner/repo
|
|
14884
|
-
echo "
|
|
14884
|
+
echo "Run from a checkout of owner/repo (for Jira or Linear, the checkout the work lands in)."
|
|
14885
|
+
echo "Each issue runs in its own worktree on loki/backlog-N. Jira and Linear use the credentials in docs/trackers.md."
|
|
14886
|
+
echo "Triage: implement issues run, and a large one is split into slices that each run on their own;"
|
|
14887
|
+
echo "vague or ambiguous (spec) issues get .loki/specs/<slug>.md and the command to run it;"
|
|
14885
14888
|
echo "human issues are listed with the reason. Label loki:implement|loki:spec|loki:human forces a class;"
|
|
14886
14889
|
echo "LOKI_TRIAGE=0 runs every issue untriaged."
|
|
14887
14890
|
echo "Config: loki.yaml (repo root, then ~/.loki/loki.yaml); see docs/loki.yaml.example."
|
package/dashboard/__init__.py
CHANGED
package/docs/CLI-REFERENCE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CLI reference
|
|
2
2
|
|
|
3
|
-
Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.
|
|
3
|
+
Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.120.0. Do not edit by hand.
|
|
4
4
|
Hidden and legacy-only commands are omitted; see `docs/CLI-INVENTORY.md` for the full inventory.
|
|
5
5
|
|
|
6
6
|
| Command | Description |
|
package/docs/INSTALLATION.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Loki Mode, by [Autonomi](https://www.autonomi.dev/), turns a spec or an issue into a verified pull request with a receipt you can check. This page covers installing it, a first run, and the options around it.
|
|
4
4
|
|
|
5
|
-
**Version:** v11.
|
|
5
|
+
**Version:** v11.120.0
|
|
6
6
|
|
|
7
7
|
**Engine note:** `loki start` is the primary command. `loki start`, `loki "<task>"`, `loki owner/repo#N` and `loki quick` all run the Loki 10 engine, whatever the flag order or input form (PRD file, issue ref, task or one-word brief). The previous loop runs only on `--engine legacy`, `LOKI_ENGINE=legacy`, or for one call when a flag Loki 10 cannot honor is present. See the [user guide](v10/GUIDE.md) and the [5-minute quickstart](QUICKSTART.md).
|
|
8
8
|
|
package/docs/trackers.md
CHANGED
|
@@ -7,6 +7,18 @@ loki jira:PROJ-123
|
|
|
7
7
|
loki linear:ENG-42
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
## Backlog
|
|
11
|
+
|
|
12
|
+
`loki backlog` works a whole Jira project or Linear team the way it works GitHub issues: it lists the open items, triages each one (implement, spec or human), runs the implement items as `loki jira:PROJ-N` or `loki linear:TEAM-N` in their own worktrees of the current checkout, drafts a spec for the vague ones and lists the human ones.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
loki backlog jira:PROJ --all --dry-run
|
|
16
|
+
loki backlog linear:ENG --label loki
|
|
17
|
+
loki backlog jira:PROJ --issues 12,14 # PROJ-12 and PROJ-14
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The project key is case-insensitive (`jira:proj` is `jira:PROJ`). An item whose key is not `PROJ-<number>` stops the listing before anything runs. Each run gets only its own tracker's token: a Jira run never sees `LINEAR_API_KEY` or `LOKI_LINEAR_TOKEN`, a Linear run never sees `JIRA_API_TOKEN`, `JIRA_TOKEN` or `LOKI_JIRA_TOKEN`, and a GitHub run or a `--dag` unit sees none of them. Open means a Jira status category other than Done, or a Linear state other than completed or canceled. At most 200 items are listed. A large Jira or Linear item runs as one run: only GitHub issues are split into slices today, and the triage reason says so.
|
|
21
|
+
|
|
10
22
|
## Credentials (environment only)
|
|
11
23
|
|
|
12
24
|
- Jira: `JIRA_EMAIL`, `JIRA_API_TOKEN` and `JIRA_BASE_URL` (for example `https://acme.atlassian.net`). `JIRA_BASE_URL` may be omitted when you pass an `atlassian.net` browse URL.
|
package/docs/v10/GUIDE.md
CHANGED
|
@@ -356,12 +356,12 @@ on:
|
|
|
356
356
|
- run: loki backlog "${GITHUB_REPOSITORY}" --label loki --concurrency 2
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
`loki backlog` also takes `--all`, `--issues 1,2,3` and `--dry-run
|
|
359
|
+
`loki backlog` also takes `--all`, `--issues 1,2,3` and `--dry-run`, and `jira:PROJ` or `linear:TEAM` in place of `owner/repo` to work a Jira project or Linear team the same way (see [Jira and Linear intake](../trackers.md)). The nightly job runs the agent and a write token together, so label only issues you trust.
|
|
360
360
|
|
|
361
361
|
Before anything runs, `loki backlog` triages every issue into one of three classes, each printed with a one-line reason (`--dry-run` prints only this and launches nothing):
|
|
362
362
|
|
|
363
|
-
- `implement`: a concrete target (a file, function, value or expected result)
|
|
364
|
-
- `spec`: vague or
|
|
363
|
+
- `implement`: a concrete target (a file, function, value or expected result), or a large issue. Only these run. Large has one definition, the same one `loki start owner/repo#N` uses: an epic label (`epic`, `umbrella`, `tracking` or `meta`), or at least two of 4 or more solution parts, 4 or more acceptance criteria, and both a backend and a frontend named. A large issue is split into slices that each run on their own (the reason says `runs split into slices`).
|
|
364
|
+
- `spec`: vague or ambiguous (no concrete target named, or an ambiguity score at the threshold). Loki drafts `.loki/specs/<slug>.md` with `loki plan --spec`, runs nothing, and prints `loki start --spec .loki/specs/<slug>.md` to run after you edit or approve it.
|
|
365
365
|
- `human`: the issue touches secrets, production or a destructive operation. Never run headless; listed with the reason. Repos without tests, UI work and infra work still run: Loki writes its own tests and verifies once at the end.
|
|
366
366
|
|
|
367
367
|
The rules are deterministic (issue text, labels, the repo test map and the ambiguity score); no model call decides a class. A run records its class and reason in the run events, the receipt (`triage`) and a `Triage:` line in the PR body. Overrides: the label `loki:implement`, `loki:spec` or `loki:human` forces that class for one issue; `LOKI_TRIAGE=0` turns the router off and runs every issue. Routing happens only in `loki backlog`. A direct `loki "<goal>"` or `loki start owner/repo#N` never stops or refuses because of triage: when the ambiguity gate fires it records the class and reason in the run events and the receipt, then runs exactly as before.
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
"LOKI_E10_PREFIX",
|
|
120
120
|
"LOKI_E10_PROJECT_MODEL",
|
|
121
121
|
"LOKI_E10_PROVIDER",
|
|
122
|
+
"LOKI_E10_QUICK_VERIFY",
|
|
122
123
|
"LOKI_E10_READINESS_FOLD",
|
|
123
124
|
"LOKI_E10_REPOMAP_MAX_FILES",
|
|
124
125
|
"LOKI_E10_REPO_DIR",
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
"LOKI_E10_STAGE",
|
|
139
140
|
"LOKI_E10_STALL_KILL_S",
|
|
140
141
|
"LOKI_E10_STALL_S",
|
|
142
|
+
"LOKI_E10_SUITE_CMDS",
|
|
141
143
|
"LOKI_E10_TASK_TEXT",
|
|
142
144
|
"LOKI_E10_TIER",
|
|
143
145
|
"LOKI_E10_TRIM",
|