@stage5/lumine 0.2.66 → 0.2.67

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.
@@ -18,7 +18,8 @@ canonical structured data.
18
18
  one allowlisted run scope and one public actor. `--scope full` is the full
19
19
  daily-management review. `--scope featured` is only an authorization
20
20
  envelope for a specifically requested Featured slice; it does not authorize
21
- or imply the newspaper, queues, conduct review, logs, costs, sponsors,
21
+ or imply the newspaper, queues, conduct review, logs, costs, AI Energy
22
+ budget health, sponsors,
22
23
  carry-over work, or final full-run report. Every run-scoped CLI command loads
23
24
  the canonical active run and sends its ID; the API rejects a missing,
24
25
  expired, scope-mismatched, or actor-mismatched run.
@@ -729,6 +730,7 @@ lumine admin daily-run escalation add --target subject:123 \
729
730
  lumine admin daily-run escalation add --target chatMessage:3768159 \
730
731
  --note "Concrete safety issue in a bot-authored chat message" --json
731
732
  lumine admin daily-run report --json
733
+ lumine admin daily-run report --run 123 --json
732
734
  lumine admin daily-run complete --json
733
735
  lumine admin daily-run fail --reason "operator stopped" --json
734
736
  lumine admin escalation list --status all --json
@@ -798,7 +800,17 @@ During a full review, record only qualifying escalations as they are confirmed.
798
800
  then composes the active run's canonical audit events, successful mutations,
799
801
  completed queue scans, recorded escalations, and the most useful brief deltas
800
802
  into one result. Generate it before `complete`, because run-scoped reads require
801
- the current active run. Queue coverage is written automatically only after an
803
+ the current active run. After completion,
804
+ `daily-run report --run <completed-run-id>` is the run-independent recovery
805
+ path. It reconstructs immutable run/audit/coverage/escalation evidence and the
806
+ closed-day calendar cost view at the run's completion boundary. It labels that
807
+ basis `historical_reconstruction`: later canonical ledger corrections to those
808
+ closed days are reflected, while the boundary day's then-open cost bucket is
809
+ omitted. The former live brief, carry-over-todo snapshot, and pending sponsor-
810
+ application count are returned as unavailable rather than being synthesized
811
+ from today's state; sponsor scan/case status is explicitly labeled as current
812
+ canonical state for that run's scan. Queue coverage is
813
+ written automatically only after an
802
814
  `--all` traversal reaches canonical exhaustion; an interrupted scan remains in
803
815
  its local checkpoint and cannot be misreported as complete.
804
816
 
@@ -876,7 +888,8 @@ Every successful full `daily-run start` response automatically includes all
876
888
  unfinished items under `data.carryoverTodos`. The same run ID increments an
877
889
  item's surfacing telemetry at most once, even when start is retried. This is the
878
890
  canonical handoff: read it before discretionary new work, resume what can safely
879
- progress after the run's mandatory newspaper/brief/conduct duties, and record a
891
+ progress after the run's mandatory newspaper/brief/conduct/log-review/cost/
892
+ energy-budget duties, and record a
880
893
  concrete progress note before the run closes. The daily-run report includes the
881
894
  still-unfinished set again. Completing a daily run never silently completes its
882
895
  todos. A CLI carrying this contract rejects a start response that does not echo
@@ -942,6 +955,8 @@ lumine admin recommendations list --include-legacy --all --json
942
955
  lumine admin recommendations list --unviewed --json
943
956
  lumine admin subjects candidates --after 2026-08-01T00:00:00Z \
944
957
  --all --checkpoint subjects.json --json
958
+ lumine admin subjects candidates --since-run --all --json
959
+ lumine admin subjects candidates --include-legacy --all --json
945
960
  lumine admin subjects candidates --effort unassigned --json
946
961
  lumine admin subjects candidates --unviewed --json
947
962
  lumine admin builds candidates --all --limit 50 --json
@@ -1052,6 +1067,13 @@ only page/scanned/candidate counts and the private checkpoint path. A long
1052
1067
  traversal therefore no longer looks stalled, while piping stdout to `jq` or a
1053
1068
  file remains safe.
1054
1069
 
1070
+ `Ctrl+C` and `SIGTERM` abort the in-flight page request, leave the last
1071
+ server-confirmed page fsynced in the private checkpoint/spool, and release the
1072
+ adjacent process lock. The cancellation error names the checkpoint. Continue
1073
+ only by rerunning the exact same command with `--resume`; the next invocation
1074
+ verifies the request fingerprint and confirmed spool digest before requesting
1075
+ another page. An interrupted request is never counted as queue coverage.
1076
+
1055
1077
  Recommendations default to `--since-run`: the server uses the previous
1056
1078
  completed run's start time (or the same bounded seven-day fallback used by the
1057
1079
  brief on a first run). That deliberate start-to-start overlap gives the queue
@@ -1062,6 +1084,13 @@ All-history traversal is deliberately available only through
1062
1084
  boundary for bounded modes, so deploying a new CLI against an older API cannot
1063
1085
  silently fall back to a million-row historical scan.
1064
1086
 
1087
+ Subject candidates follow the same window contract. They default to the
1088
+ previous completed full run's start (with the seven-day first-run fallback),
1089
+ accept an explicit inclusive `--after`, and require `--include-legacy` for a
1090
+ lifetime traversal. `--since-run`, `--after`, and `--include-legacy` are
1091
+ mutually exclusive. The CLI also requires the API to echo the bounded Subject
1092
+ window before accepting a page.
1093
+
1065
1094
  `builds candidates` is a management-agent discovery view over the canonical
1066
1095
  public Build browser, ordered by the current published release. It is
1067
1096
  available through the `admin` namespace only while a delegated run is active;
@@ -1843,27 +1872,97 @@ The current API-side files are:
1843
1872
  - `/home/ec2-user/server/logs/twinkle-image-optimizer.out.log`
1844
1873
 
1845
1874
  Treat every current `/home/ec2-user/server/logs/*.err.log` and `*.out.log` as
1846
- in scope so a later API-side worker is not silently omitted. Use the production
1847
- SSH endpoint and key from the repository agent guide; all inspection commands
1848
- are read-only.
1849
-
1850
- 1. Immediately after `daily-run start`, record each matching file's inode and
1851
- byte size, inspect its current tail to establish service health, and read
1852
- every non-empty error log before accepting that position as the run
1853
- baseline. The prior run is supposed to leave the live API error log empty,
1854
- so unexplained pre-existing stderr is evidence, not a reason to skip ahead.
1855
- 2. Run and fully paginate `bot-output`, reading every row as required above.
1856
- In this same phase, read every byte appended to both error and normal-output
1857
- files since the recorded baseline. Refresh the offsets after inspection.
1858
- Do not rely on a fixed-line `tail`: a busy or multiline failure can begin
1859
- before that arbitrary window.
1860
- 3. Immediately before `daily-run report` and `daily-run complete`, inspect the
1861
- delta again. This catches failures caused by the curation actions performed
1862
- after the first conduct/log review. If a file's inode changed or its size
1863
- shrank, do not assume the missing range was clean: inspect the replacement
1864
- from byte zero, check the relevant `twinkle-api.service` or
1865
- `twinkle-image-optimizer.service` journal interval, and report the lost
1866
- boundary.
1875
+ in scope so a later API-side worker is not silently omitted. Use the delegated,
1876
+ run-independent workflow; it holds one server lease across the review and
1877
+ writes private, digest-verified local artifacts:
1878
+
1879
+ ```bash
1880
+ lumine admin runtime-logs start --output-dir ./runtime-log-review --json
1881
+ # Read every file under data.artifacts.latestSnapshot.snapshotPath.
1882
+
1883
+ # After bot-output and again after later management actions:
1884
+ lumine admin runtime-logs read \
1885
+ --review-session <data.artifacts.reviewSessionPath> --json
1886
+ # Read every newly returned snapshot artifact.
1887
+
1888
+ # Immediately before the daily report/completion:
1889
+ lumine admin runtime-logs finish \
1890
+ --review-session <data.artifacts.reviewSessionPath> --reviewed --json
1891
+ ```
1892
+
1893
+ `start` captures every byte of each non-empty error log and a bounded 64 KiB
1894
+ health tail of each normal-output log. `read` captures every error byte
1895
+ appended after the last immutable server boundary and at most an 8 MiB tail
1896
+ of each normal-output log's growth; a segment whose start was moved forward by
1897
+ that cap carries `tailOnly: true` and `omittedBytes` in the manifest, so treat
1898
+ the omitted stdout range as unreviewed operational chatter, never as missing
1899
+ error evidence (error streams are never tail-capped). Each snapshot fixes file
1900
+ inode, offset, byte length, and SHA-256 before the CLI downloads it in bounded chunks;
1901
+ the CLI acknowledges only matching local bytes. If an inode changes, a file
1902
+ shrinks, or a new/missing file crosses the boundary, the manifest says so and
1903
+ captures the replacement from byte zero. Review that evidence and the relevant
1904
+ service journal interval; never assume the missing range was clean.
1905
+
1906
+ Only one operator can own the production-log boundary. The API's database
1907
+ lease and filesystem guard serialize starts, captures, and the eventual clear;
1908
+ every legacy service clear (API stdout/stderr and image-optimizer stderr)
1909
+ refuses to cross an active or starting Lumine review. A dropped CLI response
1910
+ is recoverable from the private `--review-session`: the next command
1911
+ materializes and acknowledges the pending
1912
+ snapshot, returns it as `needs_review`, and stops before taking another action.
1913
+
1914
+ A dropped `start` response is the one case with no session file yet. The CLI
1915
+ persists its start request key (`runtime-log-review-start-intent.json` under
1916
+ `--output-dir`, next to `--review-session`, or — with neither flag — a
1917
+ per-account file in the OS temp directory) before sending, so simply rerunning
1918
+ the same `start` command replays that key and the API answers with the same
1919
+ review. The key survives only transport failures, timeouts, and 5xx answers; a
1920
+ definitive 4xx clears it, and a key that belongs to a finished review is
1921
+ replaced once automatically. Every replayed `start` rotates the lease token the
1922
+ same way `resume` does, so if two shells of the same account raced, only the
1923
+ last responder holds a valid token and the other gets 403 until it runs
1924
+ `resume`. Two further owner-only recovery commands exist:
1925
+
1926
+ ```bash
1927
+ # Your own active review, with a freshly rotated lease token (the old token
1928
+ # stops working) and its latest snapshot materialized into a new session.
1929
+ lumine admin runtime-logs resume --output-dir ./runtime-log-review --json
1930
+
1931
+ # Release your own active review: database state, filesystem lease, a start
1932
+ # guard left by a dead start, and preserved artifacts. Never clears a log.
1933
+ lumine admin runtime-logs abandon [--review-session <file>] --json
1934
+ ```
1935
+
1936
+ Prefer `resume` (it keeps the reviewed boundary); use `abandon` only when the
1937
+ review cannot continue. A review lives at most 24 hours regardless of how
1938
+ often it captures; after that the API reports `CLI_ADMIN_RUNTIME_LOG_REVIEW_EXPIRED`
1939
+ and the next `start` supersedes it without clearing anything.
1940
+
1941
+ `finish --reviewed` confirms that every artifact returned by prior invocations
1942
+ was actually read. If any error log changed since the last artifact, it returns
1943
+ a new `needs_review` snapshot and does not clear. At a stable error boundary it
1944
+ clears only `twinkle-api.err.log`; lease verification, exact device/inode/size
1945
+ checking, and in-place truncation occur on the same open descriptor. It then
1946
+ returns `post_clear_review_required` with another immutable snapshot. That
1947
+ snapshot also captures normal-output bytes that arrived after the prior
1948
+ acknowledged cutoff, so routine stdout traffic cannot make the review infinite.
1949
+ Read it and run the same `finish --reviewed` command again. A review clears
1950
+ `twinkle-api.err.log` at most once. The lease closes when the reviewed error
1951
+ boundary is still stable, i.e. every byte now in the API error log arrived
1952
+ after that clear and was captured and acknowledged; errors that arrive before
1953
+ the boundary settles produce another `needs_review` snapshot first. Bytes still
1954
+ in the file at completion were reviewed but not cleared — the response reports
1955
+ them as `retainedErrorBytes` and the next review's baseline captures them
1956
+ again — which is what keeps a steadily erroring service from turning the
1957
+ review into an endless clear/capture/acknowledge loop. Normal output after the
1958
+ acknowledged post-clear snapshot is outside that finite review cutoff and
1959
+ belongs to the next review. The `needs_review` loop itself is bounded only by
1960
+ the review's 24-hour lifetime: if errors arrive faster than a finish
1961
+ round-trip, every `finish` returns another snapshot and the boundary never
1962
+ settles. `abandon` is the escape in that case — it releases the review without
1963
+ clearing anything, and the next review's baseline picks the bytes up again.
1964
+ Never delete, recreate, editor-save, or manually truncate a live log, and never
1965
+ clear stdout or optimizer logs through this workflow.
1867
1966
 
1868
1967
  For each warning, fallback, retry loop, or failure, correlate timestamps and
1869
1968
  request/target IDs with the canonical CLI response and private audit event.
@@ -1883,25 +1982,10 @@ carry-over todo with the exact finding and acceptance criteria, and tell Mikey
1883
1982
  in the run report. Do not mark that todo complete until the fix is verified
1884
1983
  live.
1885
1984
 
1886
- Preserve all log evidence while any finding remains. Once every issue found in
1887
- `/home/ec2-user/server/logs/twinkle-api.err.log` has been fixed and verified
1888
- live, or conclusively classified as expected/non-defective, clear that exact
1889
- live API stderr log through the only safe path:
1890
-
1891
- ```bash
1892
- ssh -i /Users/mikey/twinkle-api.pem -o IdentitiesOnly=yes \
1893
- ec2-user@api.twinkle.network \
1894
- 'cd /home/ec2-user/server && npm run logs:clear-errors'
1895
- ```
1896
-
1897
- That command truncates the file through the service's inode-safe lifecycle; it
1898
- does not restart the API. Never delete, recreate, editor-save, or manually
1899
- truncate any log. Do not clear normal stdout or the optimizer logs. After the
1900
- safe clear, inspect the error file and all bytes appended to the normal logs
1901
- once more, and include the reviewed file set, boundaries, findings/fixes,
1902
- live-verification result, clear result, and any remaining todo in the final run
1903
- report. If any error-log issue remains unresolved or unverified, do not clear
1904
- the error log.
1985
+ Preserve all downloaded evidence while any finding remains. Include the
1986
+ reviewed file set, boundary-loss notices, findings/fixes, live-verification
1987
+ result, clear result, and any remaining todo in the final run report. If any
1988
+ error-log issue remains unresolved or unverified, do not invoke `finish`.
1905
1989
 
1906
1990
  **Purpose and privacy boundary:** this audits how Twinkle's bots treated
1907
1991
  members; it is not thought-policing or a moderation queue for members' private
@@ -2006,6 +2090,7 @@ lumine admin brief --json
2006
2090
  lumine admin brief --days 3 --json
2007
2091
  lumine admin ai-costs monthly --json
2008
2092
  lumine admin media-costs monthly --json
2093
+ lumine admin notable status Stealth --json
2009
2094
  lumine admin notable add 12647 --note "Top authored-activity kid of the window: 11 subjects, 61 comments." --json
2010
2095
  lumine admin notable add Minecrarft_guy --note "Helped three new builders debug their projects and gave detailed feedback on five posts." --json
2011
2096
  ```
@@ -2049,6 +2134,20 @@ from a billing provider. All ledger values are pricing-based estimates rather
2049
2134
  than invoices and can change if canonical usage attribution or pricing is
2050
2135
  corrected.
2051
2136
 
2137
+ For an exact provider/model/operation breakdown after the run has already
2138
+ closed, use the run-independent closed-day drilldown:
2139
+
2140
+ ```bash
2141
+ lumine admin ai-costs day 2026-09-03 --json
2142
+ ```
2143
+
2144
+ The date is a UTC `YYYY-MM-DD` key and must be earlier than the current UTC
2145
+ day. `data.dailyAiCosts` uses the same canonical deduplicated ledger as the
2146
+ monthly report and returns the exact closed-day summary plus `byDay`,
2147
+ `bySurface`, `byProviderModel`, `byBillingPolicy`, `byOperation`, and Lumine
2148
+ provider status/model telemetry. It never includes a still-filling day or
2149
+ reconstructs totals client-side.
2150
+
2052
2151
  The stable JSON payload is `data.monthlyAiCosts`:
2053
2152
 
2054
2153
  ```ts
@@ -2115,10 +2214,47 @@ type MonthlyAiCostProjection = {
2115
2214
  };
2116
2215
  ```
2117
2216
 
2118
- Release boundary: `/cli/admin/ai-costs/monthly` and all calendar math are API-
2119
- owned. Deploy and verify the compatible `twinkle-api` route before publishing
2120
- or installing the Lumine CLI release that invokes it; an older API will reject
2121
- the new command instead of synthesizing figures locally.
2217
+ Release boundary: `/cli/admin/ai-costs/monthly`, `/cli/admin/ai-costs/day/:day`,
2218
+ `/cli/admin/energy-budget/report`, the historical daily-run report, exact
2219
+ notable-user status, Subject-window resolution, and the runtime-log
2220
+ lease/snapshot workflow are API-owned. Apply the runtime-log review and energy
2221
+ telemetry migrations, then deploy and verify the compatible `twinkle-api`
2222
+ routes before publishing or installing the Lumine CLI release that invokes
2223
+ them. An older API will reject the new commands instead of synthesizing
2224
+ figures locally.
2225
+
2226
+ ### AI Energy budget health (standing duty, every full daily review)
2227
+
2228
+ Read the report at run start, before any other duty, so the day confirms the
2229
+ AI Energy budget system (one live Lumine run per user, per-run energy ceiling
2230
+ with an exact round cap, settled stops) is still behaving:
2231
+
2232
+ ```bash
2233
+ lumine admin energy-budget --json # last 7 UTC days (max --days 31)
2234
+ ```
2235
+
2236
+ It is owner-only and run-independent. Every UTC day carries the canonical
2237
+ energy ledger (`chargedUsd`, `overflowUsd`, `users`, `recharges`; 1,000,000
2238
+ units = $1), every telemetry counter (`busy_refusal`, `autofix_yielded`,
2239
+ `autofix_superseded`, `reservation_admitted` with `avgRunBudgetUsd`,
2240
+ `budget_stop_changed` / `budget_stop_unchanged` / `run_completed` with a
2241
+ per-model breakdown, `stop_settled`, `tool_limit_settled`) and per-model
2242
+ per-run usage stats (`runs`, `callsPerRun`, `usdPerRun`, each avg and
2243
+ nearest-rank p90). The current UTC day is returned with `inProgress: true`.
2244
+ **Headline `lastCompletedDay` (its exact `dayKey`) — never the in-progress
2245
+ day**, exactly as the closed-day AI-cost duty does.
2246
+
2247
+ `flags` lists every tripped check with its exact numbers: `overflow_usd`
2248
+ (overflow above $1 on a completed day), `budget_stop_unchanged_ratio` (more
2249
+ than 30% of at least 5 budget stops ended with nothing saved),
2250
+ `busy_refusals` (more than 20 in a day), and `telemetry_missing` (runs
2251
+ recorded usage while the telemetry table has no rows for that day — the
2252
+ writer is broken). Record every tripped flag, and any anomaly you judge from
2253
+ the numbers (a per-run p90 far above the average run budget, a sudden drop in
2254
+ `run_completed` while runs still record usage, recharges climbing), as a
2255
+ carry-over todo with the exact figures and day. **Never auto-enforce** —
2256
+ escalate to Mikey; this duty observes, it does not change budgets, caps, or
2257
+ user state.
2122
2258
 
2123
2259
  ### Lumine media feature cost and cleanup watch (standing duty, every full daily review)
2124
2260
 
@@ -2362,6 +2498,11 @@ farm-signal sections added that day; AI Card summon watch added 2026-08-24):
2362
2498
  service). It can therefore record Mikey's approval after the daily run has
2363
2499
  closed without opening another delegated run. Without his approval the run
2364
2500
  only proposes.
2501
+ Check an exact current username or user ID without opening a run using
2502
+ `lumine admin notable status <userId|username> --json`. This reads the
2503
+ canonical writer and returns only the resolved public account identity,
2504
+ current membership, and the roster rationale/timestamps when present; it
2505
+ does not expose the private roster fields.
2365
2506
  **Always pass `--note`** with a concrete one-or-two-sentence record of what
2366
2507
  made them notable — real numbers and specifics from the brief window, not
2367
2508
  "active user". It lands in the management page's reason column, which is