lastlight-core 0.40.5 → 0.42.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/config/default.yaml +47 -0
- package/dist/admin/board-cache.d.ts +5 -0
- package/dist/admin/board-cache.js +14 -0
- package/dist/admin/board-cache.js.map +1 -1
- package/dist/admin/board-stream.d.ts +5 -7
- package/dist/admin/board-stream.js +2 -5
- package/dist/admin/board-stream.js.map +1 -1
- package/dist/admin/board.d.ts +12 -0
- package/dist/admin/board.js +19 -2
- package/dist/admin/board.js.map +1 -1
- package/dist/admin/change-stream.d.ts +33 -0
- package/dist/admin/change-stream.js +75 -0
- package/dist/admin/change-stream.js.map +1 -0
- package/dist/admin/chat-session-reader.d.ts +2 -2
- package/dist/admin/chat-session-reader.js +28 -28
- package/dist/admin/chat-session-reader.js.map +1 -1
- package/dist/admin/index.js +3 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/routes.js +89 -74
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/sessions.d.ts +52 -37
- package/dist/admin/sessions.js +101 -182
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/transcript-index.d.ts +25 -0
- package/dist/admin/transcript-index.js +26 -0
- package/dist/admin/transcript-index.js.map +1 -0
- package/dist/config/config.d.ts +53 -0
- package/dist/config/config.js +154 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/provider-registry.d.ts +2 -1
- package/dist/config/provider-registry.js +1 -0
- package/dist/config/provider-registry.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +2 -2
- package/dist/engine/agent-executor.js +8 -1
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/chat/chat-runner.js +9 -2
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/executors/orchestrator.d.ts +4 -3
- package/dist/engine/executors/orchestrator.js +8 -6
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/executors/shared.d.ts +15 -1
- package/dist/engine/executors/shared.js +32 -5
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/jira/adf.d.ts +27 -0
- package/dist/engine/jira/adf.js +225 -0
- package/dist/engine/jira/adf.js.map +1 -0
- package/dist/engine/jira/client.d.ts +99 -0
- package/dist/engine/jira/client.js +245 -0
- package/dist/engine/jira/client.js.map +1 -0
- package/dist/engine/llm.js +1 -0
- package/dist/engine/llm.js.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/sandbox/docker.js +5 -0
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/egress-allowlist.d.ts +40 -3
- package/dist/sandbox/egress-allowlist.js +68 -3
- package/dist/sandbox/egress-allowlist.js.map +1 -1
- package/dist/sandbox/egress-firewall-config.d.ts +6 -0
- package/dist/sandbox/egress-firewall-config.js +9 -3
- package/dist/sandbox/egress-firewall-config.js.map +1 -1
- package/dist/sandbox/model-gateway.d.ts +40 -0
- package/dist/sandbox/model-gateway.js +235 -0
- package/dist/sandbox/model-gateway.js.map +1 -0
- package/dist/sandbox/sandbox.js +9 -2
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/sandbox/smol.d.ts +1 -1
- package/dist/sandbox/smol.js +1 -1
- package/dist/session-log.d.ts +30 -0
- package/dist/session-log.js +67 -5
- package/dist/session-log.js.map +1 -1
- package/dist/state/change-signal.d.ts +17 -0
- package/dist/state/change-signal.js +62 -0
- package/dist/state/change-signal.js.map +1 -0
- package/dist/state/db.d.ts +6 -0
- package/dist/state/db.js +8 -2
- package/dist/state/db.js.map +1 -1
- package/dist/state/execution-store.d.ts +53 -13
- package/dist/state/execution-store.js +130 -22
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/schema/pg.d.ts +34 -0
- package/dist/state/schema/pg.js +9 -0
- package/dist/state/schema/pg.js.map +1 -1
- package/dist/state/schema/sqlite.d.ts +38 -0
- package/dist/state/schema/sqlite.js +9 -0
- package/dist/state/schema/sqlite.js.map +1 -1
- package/dist/state/workflow-run-store.d.ts +3 -0
- package/dist/state/workflow-run-store.js +26 -0
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/handlers/survey-units.js +6 -3
- package/dist/workflows/handlers/survey-units.js.map +1 -1
- package/docker-compose.yml +36 -2
- package/drizzle/pg/0004_colorful_speed.sql +4 -0
- package/drizzle/pg/meta/0004_snapshot.json +1942 -0
- package/drizzle/pg/meta/_journal.json +7 -0
- package/drizzle/sqlite/0005_cynical_whistler.sql +4 -0
- package/drizzle/sqlite/meta/0005_snapshot.json +1767 -0
- package/drizzle/sqlite/meta/_journal.json +7 -0
- package/package.json +26 -26
package/dist/admin/sessions.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SessionLog, type JsonlMessage, type SessionLogScope } from "../session-log.js";
|
|
2
|
+
import type { ExecutionStore, SessionSummary } from "../state/execution-store.js";
|
|
2
3
|
export type { JsonlMessage } from "../session-log.js";
|
|
3
4
|
export interface SessionMeta {
|
|
4
5
|
id: string;
|
|
@@ -26,7 +27,22 @@ export interface SessionMeta {
|
|
|
26
27
|
* and null sessions are never filtered out.
|
|
27
28
|
*/
|
|
28
29
|
repo?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the session's phase is still running, when the source knows —
|
|
32
|
+
* the ledger does (`finished_at` is null). Liveness uses it ahead of the
|
|
33
|
+
* recent-activity heuristic.
|
|
34
|
+
*/
|
|
35
|
+
running?: boolean;
|
|
29
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The dashboard's session-type key (see `dashboard/src/sessionTypes.ts`) for a
|
|
39
|
+
* ledger `skill` — `<workflow>:<phase>`, or a bare name for non-workflow rows.
|
|
40
|
+
*
|
|
41
|
+
* Read off the ledger rather than sniffed from the transcript's first prompt,
|
|
42
|
+
* which is what this used to do: the skill is the authoritative name of what
|
|
43
|
+
* ran, and reading it costs nothing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sessionTypeForSkill(skill: string): string;
|
|
30
46
|
/**
|
|
31
47
|
* Which on-disk slice of `<sessionsDir>/projects` a SessionReader exposes.
|
|
32
48
|
*
|
|
@@ -47,7 +63,11 @@ export type SessionReaderScope = SessionLogScope;
|
|
|
47
63
|
* caring where the data lives.
|
|
48
64
|
*/
|
|
49
65
|
export interface SessionSource {
|
|
50
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The newest `limit` sessions, newest first, with their meta. One query —
|
|
68
|
+
* the list must never cost a directory walk or a transcript parse per row.
|
|
69
|
+
*/
|
|
70
|
+
listSessions(limit: number): Promise<SessionMeta[]>;
|
|
51
71
|
exists(sessionId: string): Promise<boolean>;
|
|
52
72
|
getSessionMeta(sessionId: string): Promise<SessionMeta | null>;
|
|
53
73
|
read(sessionId: string): Promise<Array<{
|
|
@@ -58,53 +78,48 @@ export interface SessionSource {
|
|
|
58
78
|
normalizeRawLine(raw: Record<string, unknown>): JsonlMessage[];
|
|
59
79
|
}
|
|
60
80
|
/**
|
|
61
|
-
*
|
|
81
|
+
* The slice of the `executions` ledger a {@link SessionReader} reads. A narrow
|
|
82
|
+
* port rather than the whole `StateDb`, so the reader is testable with a
|
|
83
|
+
* migrated test DB or a stub alike.
|
|
84
|
+
*/
|
|
85
|
+
export type SessionLedger = Pick<ExecutionStore, "listSessions" | "sessionById" | "setTranscriptPath">;
|
|
86
|
+
/** Map a ledger {@link SessionSummary} to the dashboard's {@link SessionMeta}. */
|
|
87
|
+
export declare function metaFromSummary(s: SessionSummary): SessionMeta;
|
|
88
|
+
/**
|
|
89
|
+
* The workflow "Sessions" tab: sandbox-run transcripts, LISTED from the
|
|
90
|
+
* `executions` ledger and READ from disk.
|
|
62
91
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
92
|
+
* Every session the dashboard can show has a ledger row (each phase records its
|
|
93
|
+
* session id there), so the list, its ordering and every field it renders come
|
|
94
|
+
* from one indexed query. Only opening a session touches the filesystem — and
|
|
95
|
+
* then through the row's `transcript_path`, an O(1) lookup. This replaced a
|
|
96
|
+
* reader that walked the whole transcript tree and parsed hundreds of files on
|
|
97
|
+
* every 3 s stream tick, which pinned the agent's event loop on a host with
|
|
98
|
+
* tens of thousands of transcripts.
|
|
68
99
|
*/
|
|
69
|
-
export type RepoForSession = (sessionId: string) => Promise<string | null>;
|
|
70
100
|
export declare class SessionReader implements SessionSource {
|
|
71
|
-
private sessionLog;
|
|
72
|
-
private
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
private static CACHE_TTL_MS;
|
|
76
|
-
constructor(sessionsHomeDir: string, scope?: SessionReaderScope, repoForSession?: RepoForSession);
|
|
77
|
-
constructor(sessionLog: SessionLog, scope?: SessionReaderScope, repoForSession?: RepoForSession);
|
|
101
|
+
private readonly sessionLog;
|
|
102
|
+
private readonly ledger;
|
|
103
|
+
constructor(sessionLog: SessionLog, ledger: SessionLedger);
|
|
104
|
+
listSessions(limit: number): Promise<SessionMeta[]>;
|
|
78
105
|
exists(sessionId: string): Promise<boolean>;
|
|
79
|
-
/** Return all session IDs across all project directories, sorted
|
|
80
|
-
* newest-first by file mtime.
|
|
81
|
-
*
|
|
82
|
-
* Filters out agent sub-sessions (agent-xxx) — those are included
|
|
83
|
-
* in their parent session's view.
|
|
84
|
-
*
|
|
85
|
-
* The newest-first ordering matters: callers (the `/sessions` list +
|
|
86
|
-
* SSE handlers) slice this to a `limit * 2` window BEFORE loading and
|
|
87
|
-
* date-sorting each session's meta. With raw `readdir` order that window
|
|
88
|
-
* could omit the most recent sessions entirely — e.g. today's runs living
|
|
89
|
-
* in repo-suffixed project dirs read after a large generic dir — so the
|
|
90
|
-
* list silently showed only older sessions. mtime is a cheap, reliable
|
|
91
|
-
* recency proxy (it tracks the last appended message) that keeps the
|
|
92
|
-
* freshest sessions inside the window; the handler then refines ordering
|
|
93
|
-
* by parsed `started_at`. Mirrors the DB-backed chat reader, which
|
|
94
|
-
* already returns threads newest-first. */
|
|
95
|
-
listSessionIds(): Promise<string[]>;
|
|
96
106
|
getSessionMeta(sessionId: string): Promise<SessionMeta | null>;
|
|
97
|
-
private _readSessionMeta;
|
|
98
107
|
/**
|
|
99
|
-
* Read all messages from a session,
|
|
100
|
-
*
|
|
101
|
-
* belong to this session, interleaved by timestamp.
|
|
108
|
+
* Read all messages from a session, including legacy `agent-*` sidechains,
|
|
109
|
+
* interleaved by timestamp.
|
|
102
110
|
*/
|
|
103
111
|
read(sessionId: string): Promise<Array<{
|
|
104
112
|
index: number;
|
|
105
113
|
msg: JsonlMessage;
|
|
106
114
|
}>>;
|
|
107
|
-
/** Get the file path for a session (needed by the tailer) */
|
|
115
|
+
/** Get the file path for a session (needed by the tailer). */
|
|
108
116
|
getFilePath(sessionId: string): Promise<string | null>;
|
|
109
117
|
normalizeRawLine(raw: Record<string, unknown>): JsonlMessage[];
|
|
118
|
+
/**
|
|
119
|
+
* Session id → its transcript. The ledger's `transcript_path` makes this one
|
|
120
|
+
* point lookup. A row written before that column existed (and not yet
|
|
121
|
+
* backfilled) falls back to ONE scan for this id, then records what it found
|
|
122
|
+
* so the next open is direct.
|
|
123
|
+
*/
|
|
124
|
+
private resolve;
|
|
110
125
|
}
|
package/dist/admin/sessions.js
CHANGED
|
@@ -1,210 +1,129 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { transcriptRelativePath, } from "../session-log.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The dashboard's session-type key (see `dashboard/src/sessionTypes.ts`) for a
|
|
4
|
+
* ledger `skill` — `<workflow>:<phase>`, or a bare name for non-workflow rows.
|
|
5
|
+
*
|
|
6
|
+
* Read off the ledger rather than sniffed from the transcript's first prompt,
|
|
7
|
+
* which is what this used to do: the skill is the authoritative name of what
|
|
8
|
+
* ran, and reading it costs nothing.
|
|
5
9
|
*/
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export function sessionTypeForSkill(skill) {
|
|
11
|
+
const [workflow = "", phase = ""] = skill.split(":");
|
|
12
|
+
if (workflow === "pr-review")
|
|
13
|
+
return "review";
|
|
14
|
+
if (workflow === "pr-fix")
|
|
15
|
+
return "pr-fix";
|
|
16
|
+
if (workflow.includes("triage"))
|
|
17
|
+
return "triage";
|
|
18
|
+
if (workflow.includes("health"))
|
|
19
|
+
return "health";
|
|
20
|
+
if (workflow === "chat")
|
|
21
|
+
return "chat";
|
|
22
|
+
const p = phase || workflow;
|
|
23
|
+
if (p.startsWith("guardrails"))
|
|
12
24
|
return "guardrails";
|
|
13
|
-
if (
|
|
25
|
+
if (p.startsWith("architect"))
|
|
14
26
|
return "architect";
|
|
15
|
-
if (
|
|
16
|
-
return "fix";
|
|
17
|
-
if (msg.includes("You are the EXECUTOR"))
|
|
27
|
+
if (p.startsWith("executor"))
|
|
18
28
|
return "executor";
|
|
19
|
-
if (
|
|
29
|
+
if (p.startsWith("reviewer"))
|
|
20
30
|
return "reviewer";
|
|
21
|
-
if (
|
|
31
|
+
if (p.startsWith("fix"))
|
|
32
|
+
return "fix";
|
|
33
|
+
if (p === "pr" || p.startsWith("pr_") || p.startsWith("pr-"))
|
|
22
34
|
return "pr";
|
|
23
|
-
if (
|
|
24
|
-
return "pr-fix";
|
|
25
|
-
if (msg.includes("Check if a build cycle already exists"))
|
|
35
|
+
if (p.startsWith("resume"))
|
|
26
36
|
return "resume";
|
|
27
|
-
// Skills
|
|
28
|
-
if (msg.includes("issue-triage"))
|
|
29
|
-
return "triage";
|
|
30
|
-
if (msg.includes("pr-review"))
|
|
31
|
-
return "review";
|
|
32
|
-
if (msg.includes("repo-health"))
|
|
33
|
-
return "health";
|
|
34
|
-
// Chat (handled by chat.ts, not executor)
|
|
35
|
-
if (msg.includes("You are Last Light") && msg.includes("chat"))
|
|
36
|
-
return "chat";
|
|
37
37
|
return "agent";
|
|
38
38
|
}
|
|
39
|
+
/** Map a ledger {@link SessionSummary} to the dashboard's {@link SessionMeta}. */
|
|
40
|
+
export function metaFromSummary(s) {
|
|
41
|
+
const started = Date.parse(s.startedAt) / 1000;
|
|
42
|
+
const finished = s.finishedAt ? Date.parse(s.finishedAt) / 1000 : NaN;
|
|
43
|
+
return {
|
|
44
|
+
id: s.sessionId,
|
|
45
|
+
source: "agent",
|
|
46
|
+
sessionType: sessionTypeForSkill(s.skill),
|
|
47
|
+
model: s.model,
|
|
48
|
+
started_at: Number.isNaN(started) ? 0 : started,
|
|
49
|
+
last_message_at: Number.isNaN(finished) ? null : finished,
|
|
50
|
+
// The ledger counts turns, not messages. The list shows it as a size hint;
|
|
51
|
+
// nothing filters on it for this source (see `hasContent` in routes.ts).
|
|
52
|
+
message_count: s.turns ?? 0,
|
|
53
|
+
tool_call_count: 0,
|
|
54
|
+
conversation_message_count: s.turns ?? 0,
|
|
55
|
+
last_assistant_content: s.outputSnippet,
|
|
56
|
+
agentIds: [],
|
|
57
|
+
repo: s.repo,
|
|
58
|
+
running: s.finishedAt === null,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The workflow "Sessions" tab: sandbox-run transcripts, LISTED from the
|
|
63
|
+
* `executions` ledger and READ from disk.
|
|
64
|
+
*
|
|
65
|
+
* Every session the dashboard can show has a ledger row (each phase records its
|
|
66
|
+
* session id there), so the list, its ordering and every field it renders come
|
|
67
|
+
* from one indexed query. Only opening a session touches the filesystem — and
|
|
68
|
+
* then through the row's `transcript_path`, an O(1) lookup. This replaced a
|
|
69
|
+
* reader that walked the whole transcript tree and parsed hundreds of files on
|
|
70
|
+
* every 3 s stream tick, which pinned the agent's event loop on a host with
|
|
71
|
+
* tens of thousands of transcripts.
|
|
72
|
+
*/
|
|
39
73
|
export class SessionReader {
|
|
40
74
|
sessionLog;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
constructor(sessionsHomeDirOrLog, scope = "sandbox", repoForSession) {
|
|
46
|
-
this.sessionLog = typeof sessionsHomeDirOrLog === "string"
|
|
47
|
-
? new SessionLog(sessionsHomeDirOrLog)
|
|
48
|
-
: sessionsHomeDirOrLog;
|
|
49
|
-
this.scope = scope;
|
|
50
|
-
this.repoForSession = repoForSession;
|
|
75
|
+
ledger;
|
|
76
|
+
constructor(sessionLog, ledger) {
|
|
77
|
+
this.sessionLog = sessionLog;
|
|
78
|
+
this.ledger = ledger;
|
|
51
79
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
async exists(sessionId) {
|
|
55
|
-
return this.sessionLog.findSession(this.scope, sessionId) !== null;
|
|
80
|
+
async listSessions(limit) {
|
|
81
|
+
return (await this.ledger.listSessions(limit)).map(metaFromSummary);
|
|
56
82
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
* Filters out agent sub-sessions (agent-xxx) — those are included
|
|
61
|
-
* in their parent session's view.
|
|
62
|
-
*
|
|
63
|
-
* The newest-first ordering matters: callers (the `/sessions` list +
|
|
64
|
-
* SSE handlers) slice this to a `limit * 2` window BEFORE loading and
|
|
65
|
-
* date-sorting each session's meta. With raw `readdir` order that window
|
|
66
|
-
* could omit the most recent sessions entirely — e.g. today's runs living
|
|
67
|
-
* in repo-suffixed project dirs read after a large generic dir — so the
|
|
68
|
-
* list silently showed only older sessions. mtime is a cheap, reliable
|
|
69
|
-
* recency proxy (it tracks the last appended message) that keeps the
|
|
70
|
-
* freshest sessions inside the window; the handler then refines ordering
|
|
71
|
-
* by parsed `started_at`. Mirrors the DB-backed chat reader, which
|
|
72
|
-
* already returns threads newest-first. */
|
|
73
|
-
async listSessionIds() {
|
|
74
|
-
return this.sessionLog.listSessions(this.scope).map((e) => e.id);
|
|
83
|
+
async exists(sessionId) {
|
|
84
|
+
return (await this.resolve(sessionId)) !== null;
|
|
75
85
|
}
|
|
76
86
|
async getSessionMeta(sessionId) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
return cached.meta;
|
|
80
|
-
}
|
|
81
|
-
const meta = await this._readSessionMeta(sessionId);
|
|
82
|
-
if (meta) {
|
|
83
|
-
this.metaCache.set(sessionId, { meta, cachedAt: Date.now() });
|
|
84
|
-
}
|
|
85
|
-
return meta;
|
|
86
|
-
}
|
|
87
|
-
async _readSessionMeta(sessionId) {
|
|
88
|
-
const entry = this.sessionLog.findSession(this.scope, sessionId);
|
|
89
|
-
if (!entry)
|
|
90
|
-
return null;
|
|
91
|
-
const filesToScan = this.sessionLog.relatedFilesForSession(this.scope, sessionId, { includeAgents: true });
|
|
92
|
-
let source = "agent";
|
|
93
|
-
let model = null;
|
|
94
|
-
let startedAt = null;
|
|
95
|
-
let lastMessageAt = null;
|
|
96
|
-
let messageCount = 0;
|
|
97
|
-
let toolCallCount = 0;
|
|
98
|
-
let conversationMessageCount = 0;
|
|
99
|
-
let lastAssistantContent = null;
|
|
100
|
-
let firstUserMessage = null;
|
|
101
|
-
const agentIds = [];
|
|
102
|
-
for (const scanFile of filesToScan) {
|
|
103
|
-
const records = await this.sessionLog.readNormalizedFile(scanFile);
|
|
104
|
-
for (const { raw, msg } of records) {
|
|
105
|
-
// Track agent sub-sessions
|
|
106
|
-
const agentId = raw.agentId;
|
|
107
|
-
if (agentId && !agentIds.includes(agentId)) {
|
|
108
|
-
agentIds.push(agentId);
|
|
109
|
-
}
|
|
110
|
-
// Extract source from userType field
|
|
111
|
-
if (raw.userType === "external")
|
|
112
|
-
source = "agent";
|
|
113
|
-
// Extract model from first assistant message
|
|
114
|
-
if (msg.role === "assistant" && msg.model && !model) {
|
|
115
|
-
model = msg.model;
|
|
116
|
-
}
|
|
117
|
-
// Handle session_meta (Hermes format)
|
|
118
|
-
if (msg.role === "session_meta") {
|
|
119
|
-
source = msg.platform ?? msg.source ?? source;
|
|
120
|
-
model = msg.model ?? model;
|
|
121
|
-
if (msg.timestamp) {
|
|
122
|
-
startedAt = new Date(msg.timestamp).getTime() / 1000;
|
|
123
|
-
}
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
if (msg.timestamp) {
|
|
127
|
-
const ts = new Date(msg.timestamp).getTime() / 1000;
|
|
128
|
-
if (!Number.isNaN(ts)) {
|
|
129
|
-
// True min/max across the main session AND every agent sub-
|
|
130
|
-
// session file. The previous "first / last seen" logic broke
|
|
131
|
-
// when multiple files were scanned in non-chronological
|
|
132
|
-
// readdir order — `lastMessageAt` ended up being the final
|
|
133
|
-
// timestamp of whichever file was scanned last, which could
|
|
134
|
-
// easily be older than the real most recent message.
|
|
135
|
-
if (startedAt === null || ts < startedAt)
|
|
136
|
-
startedAt = ts;
|
|
137
|
-
if (lastMessageAt === null || ts > lastMessageAt)
|
|
138
|
-
lastMessageAt = ts;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (msg.role === "user" || msg.role === "assistant" || msg.role === "tool") {
|
|
142
|
-
messageCount++;
|
|
143
|
-
conversationMessageCount++;
|
|
144
|
-
}
|
|
145
|
-
// Capture first user message for type detection
|
|
146
|
-
if (msg.role === "user" && firstUserMessage === null && msg.content) {
|
|
147
|
-
firstUserMessage = typeof msg.content === "string"
|
|
148
|
-
? msg.content
|
|
149
|
-
: Array.isArray(msg.content)
|
|
150
|
-
? msg.content
|
|
151
|
-
.filter((b) => b.type === "text")
|
|
152
|
-
.map((b) => b.text)
|
|
153
|
-
.join(" ")
|
|
154
|
-
: JSON.stringify(msg.content);
|
|
155
|
-
}
|
|
156
|
-
if (msg.role === "assistant") {
|
|
157
|
-
if (msg.tool_calls && Array.isArray(msg.tool_calls)) {
|
|
158
|
-
toolCallCount += msg.tool_calls.length;
|
|
159
|
-
}
|
|
160
|
-
if (typeof msg.content === "string" && msg.content) {
|
|
161
|
-
lastAssistantContent = msg.content;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (startedAt === null) {
|
|
167
|
-
// No parseable timestamps (empty or malformed file). Fall back to the
|
|
168
|
-
// file's mtime — its real last-write time — NOT Date.now(). Using "now"
|
|
169
|
-
// made a zero-byte/timestamp-less session masquerade as freshly active:
|
|
170
|
-
// it sorted to the top of the list and tripped the 5-minute liveness
|
|
171
|
-
// check, surfacing dead runs as live sessions.
|
|
172
|
-
startedAt = entry.mtimeMs > 0 ? entry.mtimeMs / 1000 : Date.now() / 1000;
|
|
173
|
-
}
|
|
174
|
-
const sessionType = detectSessionType(firstUserMessage ?? "");
|
|
175
|
-
return {
|
|
176
|
-
id: sessionId,
|
|
177
|
-
source,
|
|
178
|
-
sessionType,
|
|
179
|
-
model,
|
|
180
|
-
started_at: startedAt,
|
|
181
|
-
last_message_at: lastMessageAt,
|
|
182
|
-
message_count: messageCount,
|
|
183
|
-
tool_call_count: toolCallCount,
|
|
184
|
-
conversation_message_count: conversationMessageCount,
|
|
185
|
-
last_assistant_content: lastAssistantContent,
|
|
186
|
-
agentIds,
|
|
187
|
-
// Best-effort: a session whose repo we can't resolve stays visible.
|
|
188
|
-
repo: (await this.repoForSession?.(sessionId)) ?? null,
|
|
189
|
-
};
|
|
87
|
+
const summary = await this.ledger.sessionById(sessionId);
|
|
88
|
+
return summary ? metaFromSummary(summary) : null;
|
|
190
89
|
}
|
|
191
90
|
/**
|
|
192
|
-
* Read all messages from a session,
|
|
193
|
-
*
|
|
194
|
-
* belong to this session, interleaved by timestamp.
|
|
91
|
+
* Read all messages from a session, including legacy `agent-*` sidechains,
|
|
92
|
+
* interleaved by timestamp.
|
|
195
93
|
*/
|
|
196
94
|
async read(sessionId) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
skipEmptySystem: true
|
|
200
|
-
|
|
95
|
+
const entry = await this.resolve(sessionId);
|
|
96
|
+
return entry
|
|
97
|
+
? this.sessionLog.readNormalizedEntry(entry, { includeAgents: true, skipEmptySystem: true })
|
|
98
|
+
: [];
|
|
201
99
|
}
|
|
202
|
-
/** Get the file path for a session (needed by the tailer) */
|
|
100
|
+
/** Get the file path for a session (needed by the tailer). */
|
|
203
101
|
async getFilePath(sessionId) {
|
|
204
|
-
return this.
|
|
102
|
+
return (await this.resolve(sessionId))?.filePath ?? null;
|
|
205
103
|
}
|
|
206
104
|
normalizeRawLine(raw) {
|
|
207
105
|
return this.sessionLog.normalizeLine(raw);
|
|
208
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Session id → its transcript. The ledger's `transcript_path` makes this one
|
|
109
|
+
* point lookup. A row written before that column existed (and not yet
|
|
110
|
+
* backfilled) falls back to ONE scan for this id, then records what it found
|
|
111
|
+
* so the next open is direct.
|
|
112
|
+
*/
|
|
113
|
+
async resolve(sessionId) {
|
|
114
|
+
const summary = await this.ledger.sessionById(sessionId);
|
|
115
|
+
if (!summary)
|
|
116
|
+
return null;
|
|
117
|
+
if (summary.transcriptPath) {
|
|
118
|
+
const entry = this.sessionLog.entryForRelativePath(summary.transcriptPath);
|
|
119
|
+
if (entry)
|
|
120
|
+
return entry;
|
|
121
|
+
}
|
|
122
|
+
const found = this.sessionLog.findSession("sandbox", sessionId);
|
|
123
|
+
if (found) {
|
|
124
|
+
await this.ledger.setTranscriptPath(sessionId, transcriptRelativePath(found.projectSlug, found.id));
|
|
125
|
+
}
|
|
126
|
+
return found;
|
|
127
|
+
}
|
|
209
128
|
}
|
|
210
129
|
//# sourceMappingURL=sessions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/admin/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/admin/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,GAIvB,MAAM,mBAAmB,CAAC;AAuC3B;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,MAAM,CAAC,QAAQ,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,QAAQ,KAAK,WAAW;QAAE,OAAO,QAAQ,CAAC;IAC9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BAAiB,CAAC,SAAS,EAAE,sBAAsB,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boot backfill for `executions.transcript_path`.
|
|
3
|
+
*
|
|
4
|
+
* The dashboard opens a workflow session's transcript through the path recorded
|
|
5
|
+
* on its ledger row, so no request ever walks the transcript tree. Rows written
|
|
6
|
+
* before that column existed (and any transcript moved back from an archive)
|
|
7
|
+
* have no path yet. This pass records one for every such session whose file is
|
|
8
|
+
* on disk, once, in the background after the server is listening.
|
|
9
|
+
*
|
|
10
|
+
* Cost: one async directory listing (names only, no stat) of `projects/*` —
|
|
11
|
+
* about 0.2 s for 39k transcripts — and one UPDATE per matched session, in
|
|
12
|
+
* batches that yield to the event loop. A boot with nothing missing costs one
|
|
13
|
+
* indexed query and returns. Rows with no file stay null, so a later boot
|
|
14
|
+
* re-checks them cheaply; that is how un-archiving works: move the files back
|
|
15
|
+
* and restart.
|
|
16
|
+
*/
|
|
17
|
+
import type { LoggerPort } from "lastlight-workflow-engine";
|
|
18
|
+
import type { ExecutionStore } from "../state/execution-store.js";
|
|
19
|
+
import type { SessionLog } from "../session-log.js";
|
|
20
|
+
export declare const TRANSCRIPT_INDEX_BATCH = 500;
|
|
21
|
+
export interface TranscriptIndexResult {
|
|
22
|
+
indexed: number;
|
|
23
|
+
unmatched: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function indexTranscripts(executions: Pick<ExecutionStore, "sessionIdsMissingTranscriptPath" | "setTranscriptPath">, sessionLog: Pick<SessionLog, "indexSandboxTranscripts">, log?: LoggerPort): Promise<TranscriptIndexResult>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const TRANSCRIPT_INDEX_BATCH = 500;
|
|
2
|
+
export async function indexTranscripts(executions, sessionLog, log) {
|
|
3
|
+
const missing = await executions.sessionIdsMissingTranscriptPath();
|
|
4
|
+
if (missing.length === 0)
|
|
5
|
+
return { indexed: 0, unmatched: 0 };
|
|
6
|
+
const onDisk = await sessionLog.indexSandboxTranscripts();
|
|
7
|
+
let indexed = 0;
|
|
8
|
+
let unmatched = 0;
|
|
9
|
+
for (let i = 0; i < missing.length; i++) {
|
|
10
|
+
const sessionId = missing[i];
|
|
11
|
+
const rel = onDisk.get(sessionId);
|
|
12
|
+
if (rel) {
|
|
13
|
+
await executions.setTranscriptPath(sessionId, rel);
|
|
14
|
+
indexed++;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
unmatched++;
|
|
18
|
+
}
|
|
19
|
+
// Yield between batches so the dashboard and webhooks stay responsive.
|
|
20
|
+
if ((i + 1) % TRANSCRIPT_INDEX_BATCH === 0)
|
|
21
|
+
await new Promise((r) => setImmediate(r));
|
|
22
|
+
}
|
|
23
|
+
log?.info("Indexed transcript paths", { indexed, unmatched });
|
|
24
|
+
return { indexed, unmatched };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=transcript-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript-index.js","sourceRoot":"","sources":["../../src/admin/transcript-index.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAO1C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,UAAyF,EACzF,UAAuD,EACvD,GAAgB;IAEhB,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,+BAA+B,EAAE,CAAC;IACnE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAE9D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,uBAAuB,EAAE,CAAC;IAC1D,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YACnD,OAAO,EAAE,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,SAAS,EAAE,CAAC;QACd,CAAC;QACD,uEAAuE;QACvE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,sBAAsB,KAAK,CAAC;YAAE,MAAM,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9F,CAAC;IACD,GAAG,EAAE,IAAI,CAAC,0BAA0B,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC9D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC"}
|
package/dist/config/config.d.ts
CHANGED
|
@@ -31,6 +31,47 @@ export interface SlackConfig {
|
|
|
31
31
|
*/
|
|
32
32
|
repoChannels: Record<string, string>;
|
|
33
33
|
}
|
|
34
|
+
/** A Jira project's mapping to a GitHub repo, with optional per-component overrides. */
|
|
35
|
+
export interface JiraProjectMapping {
|
|
36
|
+
/** Project default repo, `owner/repo`. */
|
|
37
|
+
repo: string;
|
|
38
|
+
/** Optional component-name → `owner/repo` overrides, resolved before the default. */
|
|
39
|
+
components?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The live Jira connector config (issue #501). Credentials + the site come from
|
|
43
|
+
* env (secret); behaviour comes from the YAML `jira:` block. Present only when
|
|
44
|
+
* enabled with the secrets set — otherwise the feature is inert.
|
|
45
|
+
*/
|
|
46
|
+
export interface JiraConfig {
|
|
47
|
+
/** `JIRA_SITE_URL`, e.g. `https://acme.atlassian.net` (no trailing slash). */
|
|
48
|
+
siteUrl: string;
|
|
49
|
+
/**
|
|
50
|
+
* `JIRA_CLOUD_ID` — only a SCOPED token needs it (gateway base); a classic
|
|
51
|
+
* token leaves it unset and uses `siteUrl`. Supplied from config, not resolved
|
|
52
|
+
* at boot (`tenantInfo` 404s on some sites; `accessible-resources` is OAuth-only).
|
|
53
|
+
*/
|
|
54
|
+
cloudId?: string;
|
|
55
|
+
/** `JIRA_EMAIL` / `JIRA_API_TOKEN` — basic auth for the bot account. */
|
|
56
|
+
email: string;
|
|
57
|
+
apiToken: string;
|
|
58
|
+
/** `JIRA_WEBHOOK_SECRET` — HMAC secret the inbound webhook is signed with. */
|
|
59
|
+
webhookSecret: string;
|
|
60
|
+
/** Jira label that opts a ticket in. */
|
|
61
|
+
triggerLabel: string;
|
|
62
|
+
/** Jira accountIds allowed to trigger / comment / approve. EMPTY = nobody. */
|
|
63
|
+
allowedAccountIds: string[];
|
|
64
|
+
projects: Record<string, JiraProjectMapping>;
|
|
65
|
+
transitions: {
|
|
66
|
+
started?: string;
|
|
67
|
+
prOpened?: string;
|
|
68
|
+
merged?: string;
|
|
69
|
+
};
|
|
70
|
+
webhook: {
|
|
71
|
+
url: string | null;
|
|
72
|
+
autoSync: boolean;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
34
75
|
/** The weekly Slack repo digest. Operator-only — see {@link RuntimeConfig.digest}. */
|
|
35
76
|
export interface DigestConfig {
|
|
36
77
|
/** How far back a digest looks, in days. */
|
|
@@ -177,6 +218,8 @@ export interface LastLightConfig {
|
|
|
177
218
|
*/
|
|
178
219
|
githubToken?: string;
|
|
179
220
|
slack?: SlackConfig;
|
|
221
|
+
/** Jira connector (issue #501) — present only when enabled with `JIRA_*` set. */
|
|
222
|
+
jira?: JiraConfig;
|
|
180
223
|
approval?: Record<string, boolean>;
|
|
181
224
|
bootstrapLabel: string;
|
|
182
225
|
/**
|
|
@@ -584,6 +627,16 @@ export declare function getHoldLabel(): string;
|
|
|
584
627
|
* rather than mirrored by hand.
|
|
585
628
|
*/
|
|
586
629
|
export declare const SENSITIVE_KEY_RE: RegExp;
|
|
630
|
+
/**
|
|
631
|
+
* A WHOLE key that names a count of tokens (`maxTokens`, `max_tokens`,
|
|
632
|
+
* `maxOutputTokens`, `contextTokens`). `SENSITIVE_KEY_RE` matches it for the
|
|
633
|
+
* `token` in it, but its value is a number the operator tunes and needs to read
|
|
634
|
+
* back, so `redactPublic` shows it — when, and only when, the value IS a finite
|
|
635
|
+
* number. Anchored at both ends, so `adminToken` or `maxTokensSecret` never
|
|
636
|
+
* qualifies, and the value check keeps a credential pasted under a count key
|
|
637
|
+
* (repo YAML is redacted before validation) masked.
|
|
638
|
+
*/
|
|
639
|
+
export declare const TOKEN_COUNT_KEY_RE: RegExp;
|
|
587
640
|
/**
|
|
588
641
|
* Recursively redact secret-looking keys from a public (non-secret) config tree.
|
|
589
642
|
* Exported alongside {@link SENSITIVE_KEY_RE} for the admin routes — same rule,
|