@principal-ai/subsystems-core 0.43.0 → 0.44.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/package.json +1 -1
- package/schemas/subsystem-model.schema.json +15 -15
- package/src/storage/topicStore.test.ts +0 -19
- package/src/storage/topicStore.ts +11 -63
- package/src/types/subsystem-model.ts +23 -23
- package/src/validation.test.ts +10 -10
- package/src/validation.ts +15 -15
- package/dist/agent-sessions/fixture.d.ts +0 -80
- package/dist/agent-sessions/fixture.d.ts.map +0 -1
- package/dist/agent-sessions/fixture.js +0 -130
- package/dist/agent-sessions/fixture.js.map +0 -1
- package/dist/agent-sessions/index.d.ts +0 -3
- package/dist/agent-sessions/index.d.ts.map +0 -1
- package/dist/agent-sessions/index.js +0 -6
- package/dist/agent-sessions/index.js.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -36
- package/dist/index.js.map +0 -1
- package/dist/node.d.ts +0 -22
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -55
- package/dist/node.js.map +0 -1
- package/dist/opencode/OpenCodeEventStore.d.ts +0 -25
- package/dist/opencode/OpenCodeEventStore.d.ts.map +0 -1
- package/dist/opencode/OpenCodeEventStore.js +0 -182
- package/dist/opencode/OpenCodeEventStore.js.map +0 -1
- package/dist/opencode/agent-sessions.d.ts +0 -46
- package/dist/opencode/agent-sessions.d.ts.map +0 -1
- package/dist/opencode/agent-sessions.js +0 -302
- package/dist/opencode/agent-sessions.js.map +0 -1
- package/dist/opencode/index.d.ts +0 -6
- package/dist/opencode/index.d.ts.map +0 -1
- package/dist/opencode/index.js +0 -15
- package/dist/opencode/index.js.map +0 -1
- package/dist/opencode/node-path-adapter.d.ts +0 -25
- package/dist/opencode/node-path-adapter.d.ts.map +0 -1
- package/dist/opencode/node-path-adapter.js +0 -188
- package/dist/opencode/node-path-adapter.js.map +0 -1
- package/dist/opencode/pipeline.d.ts +0 -42
- package/dist/opencode/pipeline.d.ts.map +0 -1
- package/dist/opencode/pipeline.js +0 -90
- package/dist/opencode/pipeline.js.map +0 -1
- package/dist/opencode/types.d.ts +0 -39
- package/dist/opencode/types.d.ts.map +0 -1
- package/dist/opencode/types.js +0 -3
- package/dist/opencode/types.js.map +0 -1
- package/dist/storage/topic-types.d.ts +0 -203
- package/dist/storage/topic-types.d.ts.map +0 -1
- package/dist/storage/topic-types.js +0 -60
- package/dist/storage/topic-types.js.map +0 -1
- package/dist/storage/topicStore.d.ts +0 -135
- package/dist/storage/topicStore.d.ts.map +0 -1
- package/dist/storage/topicStore.js +0 -389
- package/dist/storage/topicStore.js.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -23
- package/dist/types/index.js.map +0 -1
- package/dist/types/subsystem-model.d.ts +0 -388
- package/dist/types/subsystem-model.d.ts.map +0 -1
- package/dist/types/subsystem-model.js +0 -87
- package/dist/types/subsystem-model.js.map +0 -1
- package/dist/validation.d.ts +0 -24
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -112
- package/dist/validation.js.map +0 -1
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchRawEvents = exports.detectAgent = exports.listAgentSessions = exports.collectRepositories = exports.accumulateEvents = exports.normalizeEventsWithAdapter = exports.normalizeEvents = exports.NodePathNormalizationAdapter = void 0;
|
|
4
|
-
const agent_monitoring_1 = require("@principal-ai/agent-monitoring");
|
|
5
|
-
const OpenCodeEventStore_1 = require("./OpenCodeEventStore");
|
|
6
|
-
const pipeline_1 = require("./pipeline");
|
|
7
|
-
Object.defineProperty(exports, "NodePathNormalizationAdapter", { enumerable: true, get: function () { return pipeline_1.NodePathNormalizationAdapter; } });
|
|
8
|
-
Object.defineProperty(exports, "accumulateEvents", { enumerable: true, get: function () { return pipeline_1.accumulateEvents; } });
|
|
9
|
-
Object.defineProperty(exports, "collectRepositories", { enumerable: true, get: function () { return pipeline_1.collectRepositories; } });
|
|
10
|
-
Object.defineProperty(exports, "normalizeEvents", { enumerable: true, get: function () { return pipeline_1.normalizeEvents; } });
|
|
11
|
-
Object.defineProperty(exports, "normalizeEventsWithAdapter", { enumerable: true, get: function () { return pipeline_1.normalizeEventsWithAdapter; } });
|
|
12
|
-
const clineReader = new agent_monitoring_1.ClineSessionReader();
|
|
13
|
-
const piReader = new agent_monitoring_1.PiSessionReader();
|
|
14
|
-
const grokReader = new agent_monitoring_1.GrokSessionReader();
|
|
15
|
-
const codexReader = new agent_monitoring_1.CodexSessionReader();
|
|
16
|
-
const cursorReader = new agent_monitoring_1.CursorSessionReader();
|
|
17
|
-
function isClineSession(sessionId) {
|
|
18
|
-
return clineReader.readSession(sessionId) !== null;
|
|
19
|
-
}
|
|
20
|
-
function isPiSession(sessionId) {
|
|
21
|
-
return piReader.readSession(sessionId) !== null;
|
|
22
|
-
}
|
|
23
|
-
function isGrokSession(sessionId) {
|
|
24
|
-
return grokReader.readSession(sessionId) !== null;
|
|
25
|
-
}
|
|
26
|
-
function isCodexSession(sessionId) {
|
|
27
|
-
return codexReader.readSession(sessionId) !== null;
|
|
28
|
-
}
|
|
29
|
-
function isCursorSession(sessionId) {
|
|
30
|
-
return cursorReader.readSession(sessionId) !== null;
|
|
31
|
-
}
|
|
32
|
-
/** List Cline CLI sessions from the durable on-disk transcript. */
|
|
33
|
-
function listClineSessions() {
|
|
34
|
-
return clineReader.listSessions().map((record) => {
|
|
35
|
-
const meta = record.metadata;
|
|
36
|
-
const promptText = (meta.prompt ?? "").trim();
|
|
37
|
-
const title = promptText.length > 0
|
|
38
|
-
? promptText.length > 80
|
|
39
|
-
? `${promptText.slice(0, 80)}…`
|
|
40
|
-
: promptText
|
|
41
|
-
: "Cline session";
|
|
42
|
-
return {
|
|
43
|
-
agent: "cline",
|
|
44
|
-
sessionId: record.sessionId,
|
|
45
|
-
title,
|
|
46
|
-
createdAt: meta.started_at ?? "",
|
|
47
|
-
eventCount: clineReader.readMessages(record.sessionId)?.messages.length ?? 0,
|
|
48
|
-
isFinished: meta.status === "completed" || meta.status === "failed",
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/** List pi CLI sessions from the durable on-disk JSONL transcripts. */
|
|
53
|
-
function listPiSessions() {
|
|
54
|
-
return piReader.listSessions().map((record) => {
|
|
55
|
-
const promptText = (record.firstPrompt ?? "").trim();
|
|
56
|
-
const title = promptText.length > 0
|
|
57
|
-
? promptText.length > 80
|
|
58
|
-
? `${promptText.slice(0, 80)}…`
|
|
59
|
-
: promptText
|
|
60
|
-
: "pi session";
|
|
61
|
-
return {
|
|
62
|
-
agent: "pi",
|
|
63
|
-
sessionId: record.sessionId,
|
|
64
|
-
title,
|
|
65
|
-
createdAt: record.header.timestamp ?? "",
|
|
66
|
-
eventCount: record.messageCount,
|
|
67
|
-
// pi transcripts carry no finished marker; the principal-studio appends a
|
|
68
|
-
// synthesized session-end event at read time.
|
|
69
|
-
isFinished: false,
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/** List Grok Build sessions from ~/.grok/sessions durable JSONL. */
|
|
74
|
-
function listGrokSessions() {
|
|
75
|
-
return grokReader.listSessions().map((record) => {
|
|
76
|
-
return {
|
|
77
|
-
agent: "grok",
|
|
78
|
-
sessionId: record.sessionId,
|
|
79
|
-
title: record.title || "Grok session",
|
|
80
|
-
createdAt: record.createdAt,
|
|
81
|
-
eventCount: record.messageCount,
|
|
82
|
-
isFinished: false,
|
|
83
|
-
parentID: record.parentSessionId,
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/** List Codex sessions from durable rollout JSONL. */
|
|
88
|
-
function listCodexSessions() {
|
|
89
|
-
return codexReader.listSessions().map((record) => ({
|
|
90
|
-
agent: "codex",
|
|
91
|
-
sessionId: record.sessionId,
|
|
92
|
-
title: record.firstPrompt || "Codex session",
|
|
93
|
-
createdAt: typeof record.meta.timestamp === "string"
|
|
94
|
-
? record.meta.timestamp
|
|
95
|
-
: new Date(record.lastActivity).toISOString(),
|
|
96
|
-
eventCount: record.messageCount,
|
|
97
|
-
isFinished: false,
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
100
|
-
/** List Cursor IDE agent chats from ~/.cursor/chats. */
|
|
101
|
-
function listCursorSessions() {
|
|
102
|
-
return cursorReader.listSessions().map((record) => ({
|
|
103
|
-
agent: "cursor",
|
|
104
|
-
sessionId: record.sessionId,
|
|
105
|
-
title: record.title || "Cursor session",
|
|
106
|
-
createdAt: record.createdAt || new Date(record.lastActivity).toISOString(),
|
|
107
|
-
eventCount: record.messageCount,
|
|
108
|
-
isFinished: false,
|
|
109
|
-
}));
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* List opencode sessions, top-level only by default. Delegates to the store's
|
|
113
|
-
* grouped `listSessionsWithSummaries()` which excludes subagent (child) sessions.
|
|
114
|
-
*/
|
|
115
|
-
function listOpencodeSessions(dbPath) {
|
|
116
|
-
const store = new OpenCodeEventStore_1.OpenCodeEventStore({ dbPath });
|
|
117
|
-
try {
|
|
118
|
-
const result = store.listSessionsWithSummaries(50);
|
|
119
|
-
const toSummary = (s) => ({
|
|
120
|
-
agent: "opencode",
|
|
121
|
-
sessionId: s.id,
|
|
122
|
-
title: s.title,
|
|
123
|
-
createdAt: s.createdAt,
|
|
124
|
-
eventCount: s.eventCount,
|
|
125
|
-
isFinished: s.isFinished,
|
|
126
|
-
});
|
|
127
|
-
const standalone = [
|
|
128
|
-
...result.standalone.map(toSummary),
|
|
129
|
-
...result.groups.map((g) => toSummary(g.parent)),
|
|
130
|
-
];
|
|
131
|
-
// Sort newest-first by createdAt
|
|
132
|
-
return standalone.sort((a, b) => b.createdAt < a.createdAt ? -1 : b.createdAt > a.createdAt ? 1 : 0);
|
|
133
|
-
}
|
|
134
|
-
finally {
|
|
135
|
-
store.close();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/** List sessions from all supported agents. Top-level only by default. */
|
|
139
|
-
function listAgentSessions(options = {}) {
|
|
140
|
-
const all = [];
|
|
141
|
-
let firstError = null;
|
|
142
|
-
try {
|
|
143
|
-
all.push(...listOpencodeSessions(options.dbPath));
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
firstError = err;
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
all.push(...listClineSessions());
|
|
150
|
-
}
|
|
151
|
-
catch (err) {
|
|
152
|
-
if (!firstError)
|
|
153
|
-
firstError = err;
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
all.push(...listPiSessions());
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
if (!firstError)
|
|
160
|
-
firstError = err;
|
|
161
|
-
}
|
|
162
|
-
try {
|
|
163
|
-
all.push(...listGrokSessions());
|
|
164
|
-
}
|
|
165
|
-
catch (err) {
|
|
166
|
-
if (!firstError)
|
|
167
|
-
firstError = err;
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
all.push(...listCodexSessions());
|
|
171
|
-
}
|
|
172
|
-
catch (err) {
|
|
173
|
-
if (!firstError)
|
|
174
|
-
firstError = err;
|
|
175
|
-
}
|
|
176
|
-
try {
|
|
177
|
-
all.push(...listCursorSessions());
|
|
178
|
-
}
|
|
179
|
-
catch (err) {
|
|
180
|
-
if (!firstError)
|
|
181
|
-
firstError = err;
|
|
182
|
-
}
|
|
183
|
-
if (all.length === 0 && firstError) {
|
|
184
|
-
throw firstError;
|
|
185
|
-
}
|
|
186
|
-
return all;
|
|
187
|
-
}
|
|
188
|
-
exports.listAgentSessions = listAgentSessions;
|
|
189
|
-
/** Detect which agent a session id belongs to. */
|
|
190
|
-
function detectAgent(sessionId) {
|
|
191
|
-
if (isClineSession(sessionId))
|
|
192
|
-
return "cline";
|
|
193
|
-
if (isPiSession(sessionId))
|
|
194
|
-
return "pi";
|
|
195
|
-
if (isGrokSession(sessionId))
|
|
196
|
-
return "grok";
|
|
197
|
-
if (isCodexSession(sessionId))
|
|
198
|
-
return "codex";
|
|
199
|
-
if (isCursorSession(sessionId))
|
|
200
|
-
return "cursor";
|
|
201
|
-
return "opencode";
|
|
202
|
-
}
|
|
203
|
-
exports.detectAgent = detectAgent;
|
|
204
|
-
/**
|
|
205
|
-
* Fetch a session's raw universal events from the appropriate source.
|
|
206
|
-
*/
|
|
207
|
-
function fetchRawEvents(sessionId, options = {}) {
|
|
208
|
-
const agent = options.agent ?? detectAgent(sessionId);
|
|
209
|
-
if (agent === "cline") {
|
|
210
|
-
const record = clineReader.readSession(sessionId);
|
|
211
|
-
const promptText = (record?.metadata.prompt ?? "").trim();
|
|
212
|
-
return {
|
|
213
|
-
agent,
|
|
214
|
-
events: clineReader.toUniversalEvents(sessionId),
|
|
215
|
-
sessionMeta: {
|
|
216
|
-
sessionName: "cline",
|
|
217
|
-
sessionTask: (promptText.length > 80 ? `${promptText.slice(0, 80)}…` : promptText) ||
|
|
218
|
-
"Cline session",
|
|
219
|
-
workingDirectory: record?.metadata.workspace_root ?? record?.metadata.cwd ?? "",
|
|
220
|
-
},
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
if (agent === "pi") {
|
|
224
|
-
const record = piReader.readSession(sessionId);
|
|
225
|
-
const promptText = (record?.firstPrompt ?? "").trim();
|
|
226
|
-
return {
|
|
227
|
-
agent,
|
|
228
|
-
events: piReader.toUniversalEvents(sessionId),
|
|
229
|
-
sessionMeta: {
|
|
230
|
-
sessionName: "pi",
|
|
231
|
-
sessionTask: (promptText.length > 80 ? `${promptText.slice(0, 80)}…` : promptText) || "pi session",
|
|
232
|
-
workingDirectory: "",
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
if (agent === "grok") {
|
|
237
|
-
const record = grokReader.readSession(sessionId);
|
|
238
|
-
return {
|
|
239
|
-
agent,
|
|
240
|
-
events: grokReader.toUniversalEvents(sessionId),
|
|
241
|
-
sessionMeta: {
|
|
242
|
-
sessionName: "grok",
|
|
243
|
-
sessionTask: record?.title || "Grok session",
|
|
244
|
-
workingDirectory: record?.cwd ?? "",
|
|
245
|
-
createdAt: record?.createdAt,
|
|
246
|
-
},
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
if (agent === "codex") {
|
|
250
|
-
const record = codexReader.readSession(sessionId);
|
|
251
|
-
const promptText = (record?.firstPrompt ?? "").trim();
|
|
252
|
-
return {
|
|
253
|
-
agent,
|
|
254
|
-
events: codexReader.toUniversalEvents(sessionId),
|
|
255
|
-
sessionMeta: {
|
|
256
|
-
sessionName: "codex",
|
|
257
|
-
sessionTask: (promptText.length > 80 ? `${promptText.slice(0, 80)}…` : promptText) ||
|
|
258
|
-
"Codex session",
|
|
259
|
-
workingDirectory: record?.cwd ?? "",
|
|
260
|
-
createdAt: typeof record?.meta.timestamp === "string"
|
|
261
|
-
? record.meta.timestamp
|
|
262
|
-
: undefined,
|
|
263
|
-
},
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
if (agent === "cursor") {
|
|
267
|
-
const record = cursorReader.readSession(sessionId);
|
|
268
|
-
const promptText = (record?.firstPrompt ?? "").trim();
|
|
269
|
-
return {
|
|
270
|
-
agent,
|
|
271
|
-
events: cursorReader.toUniversalEvents(sessionId),
|
|
272
|
-
sessionMeta: {
|
|
273
|
-
sessionName: "cursor",
|
|
274
|
-
sessionTask: record?.title ||
|
|
275
|
-
(promptText.length > 80 ? `${promptText.slice(0, 80)}…` : promptText) ||
|
|
276
|
-
"Cursor session",
|
|
277
|
-
workingDirectory: record?.cwd ?? "",
|
|
278
|
-
createdAt: record?.createdAt,
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const store = new OpenCodeEventStore_1.OpenCodeEventStore({ dbPath: options.dbPath });
|
|
283
|
-
try {
|
|
284
|
-
const { events } = store.readAggregate(sessionId, { limit: 10000 });
|
|
285
|
-
const meta = store.getSessionMeta(sessionId);
|
|
286
|
-
const title = meta.title && !meta.title.startsWith("New session") ? meta.title : meta.slug;
|
|
287
|
-
return {
|
|
288
|
-
agent,
|
|
289
|
-
events: (0, pipeline_1.opencodeRowsToUniversalEvents)(events),
|
|
290
|
-
sessionMeta: {
|
|
291
|
-
sessionName: meta.slug || "opencode",
|
|
292
|
-
sessionTask: title || meta.slug || "opencode",
|
|
293
|
-
workingDirectory: meta.directory,
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
finally {
|
|
298
|
-
store.close();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
exports.fetchRawEvents = fetchRawEvents;
|
|
302
|
-
//# sourceMappingURL=agent-sessions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-sessions.js","sourceRoot":"","sources":["../../src/opencode/agent-sessions.ts"],"names":[],"mappings":";;;AAAA,qEAOwC;AACxC,6DAA0D;AAC1D,yCAOoB;AAGlB,6GATA,uCAA4B,OASA;AAG5B,iGAXA,2BAAgB,OAWA;AAChB,oGAXA,8BAAmB,OAWA;AAHnB,gGAPA,0BAAe,OAOA;AACf,2GAPA,qCAA0B,OAOA;AAyC5B,MAAM,WAAW,GAAG,IAAI,qCAAkB,EAAE,CAAC;AAC7C,MAAM,QAAQ,GAAG,IAAI,kCAAe,EAAE,CAAC;AACvC,MAAM,UAAU,GAAG,IAAI,oCAAiB,EAAE,CAAC;AAC3C,MAAM,WAAW,GAAG,IAAI,qCAAkB,EAAE,CAAC;AAC7C,MAAM,YAAY,GAAG,IAAI,sCAAmB,EAAE,CAAC;AAE/C,SAAS,cAAc,CAAC,SAAiB;IACvC,OAAO,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB;IACpC,OAAO,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,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ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type { OpenCodeRawEvent, OpenCodeSessionEvents, OpenCodeEventRetriever, OpenCodeStoreOptions, } from "./types";
|
|
2
|
-
export { listAgentSessions, detectAgent, fetchRawEvents } from "./agent-sessions";
|
|
3
|
-
export type { AgentSessionSummary, AgentSessionMeta, SupportedSessionAgent, } from "./agent-sessions";
|
|
4
|
-
export { NodePathNormalizationAdapter, normalizeEvents, normalizeEventsWithAdapter, accumulateEvents, collectRepositories, opencodeRowsToUniversalEvents, } from "./pipeline";
|
|
5
|
-
export type { OpenCodeEventRow } from "./pipeline";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/opencode/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClF,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,4BAA4B,EAC5B,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/opencode/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.opencodeRowsToUniversalEvents = exports.collectRepositories = exports.accumulateEvents = exports.normalizeEventsWithAdapter = exports.normalizeEvents = exports.NodePathNormalizationAdapter = exports.fetchRawEvents = exports.detectAgent = exports.listAgentSessions = void 0;
|
|
4
|
-
var agent_sessions_1 = require("./agent-sessions");
|
|
5
|
-
Object.defineProperty(exports, "listAgentSessions", { enumerable: true, get: function () { return agent_sessions_1.listAgentSessions; } });
|
|
6
|
-
Object.defineProperty(exports, "detectAgent", { enumerable: true, get: function () { return agent_sessions_1.detectAgent; } });
|
|
7
|
-
Object.defineProperty(exports, "fetchRawEvents", { enumerable: true, get: function () { return agent_sessions_1.fetchRawEvents; } });
|
|
8
|
-
var pipeline_1 = require("./pipeline");
|
|
9
|
-
Object.defineProperty(exports, "NodePathNormalizationAdapter", { enumerable: true, get: function () { return pipeline_1.NodePathNormalizationAdapter; } });
|
|
10
|
-
Object.defineProperty(exports, "normalizeEvents", { enumerable: true, get: function () { return pipeline_1.normalizeEvents; } });
|
|
11
|
-
Object.defineProperty(exports, "normalizeEventsWithAdapter", { enumerable: true, get: function () { return pipeline_1.normalizeEventsWithAdapter; } });
|
|
12
|
-
Object.defineProperty(exports, "accumulateEvents", { enumerable: true, get: function () { return pipeline_1.accumulateEvents; } });
|
|
13
|
-
Object.defineProperty(exports, "collectRepositories", { enumerable: true, get: function () { return pipeline_1.collectRepositories; } });
|
|
14
|
-
Object.defineProperty(exports, "opencodeRowsToUniversalEvents", { enumerable: true, get: function () { return pipeline_1.opencodeRowsToUniversalEvents; } });
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opencode/index.ts"],"names":[],"mappings":";;;AAOA,mDAAkF;AAAzE,mHAAA,iBAAiB,OAAA;AAAE,6GAAA,WAAW,OAAA;AAAE,gHAAA,cAAc,OAAA;AAOvD,uCAOoB;AANlB,wHAAA,4BAA4B,OAAA;AAC5B,2GAAA,eAAe,OAAA;AACf,sHAAA,0BAA0B,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,yHAAA,6BAA6B,OAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { PathNormalizationAdapter, RepositoryInfo, SystemInfo } from "@principal-ai/agent-monitoring";
|
|
2
|
-
export declare class NodePathNormalizationAdapter implements PathNormalizationAdapter {
|
|
3
|
-
private homeDir;
|
|
4
|
-
private gitRootCache;
|
|
5
|
-
private canonicalCaseCache;
|
|
6
|
-
private knownRoots;
|
|
7
|
-
/** Roots discovered via .git walk-up that weren't in the initial knownRoots */
|
|
8
|
-
readonly newlyDiscovered: RepositoryInfo[];
|
|
9
|
-
constructor(knownRoots?: Map<string, RepositoryInfo>);
|
|
10
|
-
/**
|
|
11
|
-
* Resolve the on-disk spelling of a directory path segment by segment. On
|
|
12
|
-
* case-insensitive filesystems (macOS APFS) the same directory is reachable
|
|
13
|
-
* under any casing, so git-root discovery can surface `/repo` and `/Repo` as
|
|
14
|
-
* two distinct roots unless we pin them to the actual on-disk spelling.
|
|
15
|
-
*/
|
|
16
|
-
private canonicalizeCase;
|
|
17
|
-
getRawRepositoryInfo(absolutePath: string): Promise<RepositoryInfo | null>;
|
|
18
|
-
private findGitRoot;
|
|
19
|
-
getSystemInfo(): SystemInfo;
|
|
20
|
-
resolvePath(relativePath: string, workingDirectory: string): string;
|
|
21
|
-
isAbsolutePath(path: string): boolean;
|
|
22
|
-
getRelativePath(fromPath: string, toPath: string): string;
|
|
23
|
-
isAvailable(): boolean;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=node-path-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-path-adapter.d.ts","sourceRoot":"","sources":["../../src/opencode/node-path-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,UAAU,EACX,MAAM,gCAAgC,CAAC;AAuCxC,qBAAa,4BAA6B,YAAW,wBAAwB;IAC3E,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAoC;IACxD,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,UAAU,CAA8B;IAChD,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,EAAE,cAAc,EAAE,CAAM;gBAEpC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC;IAKpD;;;;;OAKG;YACW,gBAAgB;IAsBxB,oBAAoB,CACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;YAoEnB,WAAW;IAsBzB,aAAa,IAAI,UAAU;IAS3B,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM;IAInE,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIrC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAIzD,WAAW,IAAI,OAAO;CAGvB"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NodePathNormalizationAdapter = void 0;
|
|
7
|
-
const node_child_process_1 = require("node:child_process");
|
|
8
|
-
const node_fs_1 = require("node:fs");
|
|
9
|
-
const node_path_1 = require("node:path");
|
|
10
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
11
|
-
/**
|
|
12
|
-
* NodePathNormalizationAdapter — a Node.js implementation of the
|
|
13
|
-
* `PathNormalizationAdapter` interface from `@principal-ai/agent-monitoring`.
|
|
14
|
-
*
|
|
15
|
-
* This is the shared, agent-agnostic adapter used by the CLI's `agent-session`
|
|
16
|
-
* command. It discovers git roots by walking up directories and enriches them
|
|
17
|
-
* with git metadata via the `git` CLI (spawnSync). It keeps the same interface
|
|
18
|
-
* so `PathNormalizationService` can be shared verbatim. It is the Node.js
|
|
19
|
-
* analogue of the principal-studio's `BunNormalizationAdapter` and the desktop
|
|
20
|
-
* app's `ServerPathNormalizationAdapter`.
|
|
21
|
-
*/
|
|
22
|
-
function gitCommand(cwd, subcommand) {
|
|
23
|
-
const result = (0, node_child_process_1.spawnSync)("git", ["-C", cwd, ...subcommand.split(" ")], {
|
|
24
|
-
encoding: "utf8",
|
|
25
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
26
|
-
timeout: 5000,
|
|
27
|
-
});
|
|
28
|
-
if (result.status !== 0 || !result.stdout)
|
|
29
|
-
return undefined;
|
|
30
|
-
return result.stdout.trim() || undefined;
|
|
31
|
-
}
|
|
32
|
-
/** Basic GitHub owner/repo extraction from a remote URL. */
|
|
33
|
-
function githubIdentityFromRemoteUrl(remoteUrl) {
|
|
34
|
-
const cleaned = remoteUrl
|
|
35
|
-
.replace(/^git@github\.com:/, "")
|
|
36
|
-
.replace(/^https?:\/\/github\.com\//, "")
|
|
37
|
-
.replace(/\.git$/, "");
|
|
38
|
-
const parts = cleaned.split("/").filter(Boolean);
|
|
39
|
-
if (parts.length >= 2) {
|
|
40
|
-
return { owner: parts[0], name: parts[1] };
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
class NodePathNormalizationAdapter {
|
|
45
|
-
constructor(knownRoots) {
|
|
46
|
-
this.gitRootCache = new Map();
|
|
47
|
-
this.canonicalCaseCache = new Map();
|
|
48
|
-
/** Roots discovered via .git walk-up that weren't in the initial knownRoots */
|
|
49
|
-
this.newlyDiscovered = [];
|
|
50
|
-
this.homeDir = node_os_1.default.homedir();
|
|
51
|
-
this.knownRoots = knownRoots ?? new Map();
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Resolve the on-disk spelling of a directory path segment by segment. On
|
|
55
|
-
* case-insensitive filesystems (macOS APFS) the same directory is reachable
|
|
56
|
-
* under any casing, so git-root discovery can surface `/repo` and `/Repo` as
|
|
57
|
-
* two distinct roots unless we pin them to the actual on-disk spelling.
|
|
58
|
-
*/
|
|
59
|
-
async canonicalizeCase(input) {
|
|
60
|
-
const cached = this.canonicalCaseCache.get(input);
|
|
61
|
-
if (cached !== undefined)
|
|
62
|
-
return cached;
|
|
63
|
-
const segments = input.split("/").filter(Boolean);
|
|
64
|
-
let current = "/";
|
|
65
|
-
for (const seg of segments) {
|
|
66
|
-
let real = seg;
|
|
67
|
-
try {
|
|
68
|
-
const entries = await node_fs_1.promises.readdir(current);
|
|
69
|
-
const match = entries.find((name) => name.toLowerCase() === seg.toLowerCase());
|
|
70
|
-
if (match)
|
|
71
|
-
real = match;
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// segment vanished; keep the given spelling
|
|
75
|
-
}
|
|
76
|
-
current = current === "/" ? `/${real}` : `${current}/${real}`;
|
|
77
|
-
}
|
|
78
|
-
this.canonicalCaseCache.set(input, current);
|
|
79
|
-
return current;
|
|
80
|
-
}
|
|
81
|
-
async getRawRepositoryInfo(absolutePath) {
|
|
82
|
-
// Canonicalize the input: strip trailing slashes and collapse redundant
|
|
83
|
-
// separators (e.g. a tool that reads a directory as "/repo/" vs "/repo").
|
|
84
|
-
// findGitRoot returns its input verbatim when it IS the git root, so an
|
|
85
|
-
// uncanonical input would surface the same repo under two distinct root
|
|
86
|
-
// strings and duplicate it in the session's repo list. NOTE: use resolve,
|
|
87
|
-
// not normalize — path.normalize preserves trailing slashes.
|
|
88
|
-
const target = (0, node_path_1.resolve)(absolutePath);
|
|
89
|
-
// Fast path: prefix-match against known roots (zero I/O).
|
|
90
|
-
// Match on a path boundary so sibling dirs (/repo vs /repo2) don't collide.
|
|
91
|
-
let bestMatch = null;
|
|
92
|
-
let bestLen = 0;
|
|
93
|
-
for (const [root, info] of this.knownRoots) {
|
|
94
|
-
const rootCanon = (0, node_path_1.resolve)(root);
|
|
95
|
-
if ((target === rootCanon || target.startsWith(`${rootCanon}/`)) && rootCanon.length > bestLen) {
|
|
96
|
-
bestMatch = info;
|
|
97
|
-
bestLen = rootCanon.length;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (bestMatch) {
|
|
101
|
-
// A registry entry can carry a case-variant spelling of the same dir
|
|
102
|
-
// (e.g. `developer/...` on a case-insensitive fs). Pin it to the on-disk
|
|
103
|
-
// casing too, so a polluted registry can't surface the same repo twice.
|
|
104
|
-
const canonicalRoot = await this.canonicalizeCase(bestMatch.root);
|
|
105
|
-
return { ...bestMatch, root: canonicalRoot };
|
|
106
|
-
}
|
|
107
|
-
const gitRoot = await this.findGitRoot(target);
|
|
108
|
-
if (!gitRoot)
|
|
109
|
-
return null;
|
|
110
|
-
// Pin the root to its on-disk casing so a case-variant spelling of the same
|
|
111
|
-
// directory never surfaces as a second repo (see canonicalizeCase).
|
|
112
|
-
const canonicalRoot = await this.canonicalizeCase(gitRoot);
|
|
113
|
-
const remoteUrl = gitCommand(canonicalRoot, "remote get-url origin");
|
|
114
|
-
const branch = gitCommand(canonicalRoot, "rev-parse --abbrev-ref HEAD");
|
|
115
|
-
const headCommit = gitCommand(canonicalRoot, "rev-parse HEAD");
|
|
116
|
-
let owner;
|
|
117
|
-
let repo;
|
|
118
|
-
if (remoteUrl) {
|
|
119
|
-
const identity = githubIdentityFromRemoteUrl(remoteUrl);
|
|
120
|
-
if (identity) {
|
|
121
|
-
owner = identity.owner;
|
|
122
|
-
repo = identity.name;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (!repo) {
|
|
126
|
-
const parts = canonicalRoot.replace(/\/+$/, "").split("/");
|
|
127
|
-
repo = parts[parts.length - 1] ?? undefined;
|
|
128
|
-
}
|
|
129
|
-
const info = {
|
|
130
|
-
root: canonicalRoot,
|
|
131
|
-
remoteUrl,
|
|
132
|
-
owner,
|
|
133
|
-
repo,
|
|
134
|
-
branch,
|
|
135
|
-
headCommit,
|
|
136
|
-
};
|
|
137
|
-
if (!this.knownRoots.has(canonicalRoot)) {
|
|
138
|
-
this.knownRoots.set(canonicalRoot, info);
|
|
139
|
-
this.newlyDiscovered.push(info);
|
|
140
|
-
}
|
|
141
|
-
return info;
|
|
142
|
-
}
|
|
143
|
-
async findGitRoot(dir) {
|
|
144
|
-
const cached = this.gitRootCache.get(dir);
|
|
145
|
-
if (cached !== undefined)
|
|
146
|
-
return cached;
|
|
147
|
-
try {
|
|
148
|
-
const s = await node_fs_1.promises.stat((0, node_path_1.resolve)(dir, ".git"));
|
|
149
|
-
if (s.isDirectory() || s.isFile()) {
|
|
150
|
-
this.gitRootCache.set(dir, dir);
|
|
151
|
-
return dir;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
// not a git root; walk up
|
|
156
|
-
}
|
|
157
|
-
const parent = (0, node_path_1.dirname)(dir);
|
|
158
|
-
if (parent === dir || parent.length >= dir.length) {
|
|
159
|
-
this.gitRootCache.set(dir, null);
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
const result = await this.findGitRoot(parent);
|
|
163
|
-
this.gitRootCache.set(dir, result);
|
|
164
|
-
return result;
|
|
165
|
-
}
|
|
166
|
-
getSystemInfo() {
|
|
167
|
-
return {
|
|
168
|
-
homeDir: this.homeDir,
|
|
169
|
-
pathSeparator: "/",
|
|
170
|
-
platform: process.platform,
|
|
171
|
-
machineId: "",
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
resolvePath(relativePath, workingDirectory) {
|
|
175
|
-
return (0, node_path_1.resolve)(workingDirectory, relativePath);
|
|
176
|
-
}
|
|
177
|
-
isAbsolutePath(path) {
|
|
178
|
-
return (0, node_path_1.isAbsolute)(path);
|
|
179
|
-
}
|
|
180
|
-
getRelativePath(fromPath, toPath) {
|
|
181
|
-
return (0, node_path_1.relative)(fromPath, toPath);
|
|
182
|
-
}
|
|
183
|
-
isAvailable() {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
exports.NodePathNormalizationAdapter = NodePathNormalizationAdapter;
|
|
188
|
-
//# sourceMappingURL=node-path-adapter.js.map
|
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
|
|
|
1
|
-
import { type RepoNormalizedUniversalAgentSessionEvent, type RepositoryInfo, type UniversalAgentSessionEvent } from "@principal-ai/agent-monitoring";
|
|
2
|
-
import { NodePathNormalizationAdapter } from "./node-path-adapter";
|
|
3
|
-
export { NodePathNormalizationAdapter };
|
|
4
|
-
/**
|
|
5
|
-
* Pure, agent-agnostic session pipeline shared by CLI and principal-studio.
|
|
6
|
-
*
|
|
7
|
-
* This module intentionally imports NO better-sqlite3 / OpenCodeEventStore so
|
|
8
|
-
* it can be loaded in any runtime (the principal-studio runs under Bun, where
|
|
9
|
-
* better-sqlite3's native NAPI binding crashes). Runtime-specific DB access
|
|
10
|
-
* feeds this pipeline; everything after the raw rows are in is shared.
|
|
11
|
-
*/
|
|
12
|
-
/** A raw opencode event DB row, before JSON decoding of its `data` payload. */
|
|
13
|
-
export interface OpenCodeEventRow {
|
|
14
|
-
id: string;
|
|
15
|
-
aggregateId: string;
|
|
16
|
-
seq: number;
|
|
17
|
-
type: string;
|
|
18
|
-
data: string | Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Convert raw opencode event rows into universal events. Handles both string
|
|
22
|
-
* (SQLite TEXT, unparsed) and already-parsed object `data` payloads.
|
|
23
|
-
*/
|
|
24
|
-
export declare function opencodeRowsToUniversalEvents(rows: OpenCodeEventRow[]): UniversalAgentSessionEvent[];
|
|
25
|
-
/** Normalize raw universal events into repo-normalized universal events. */
|
|
26
|
-
export declare function normalizeEvents(events: UniversalAgentSessionEvent[], workingDirectory?: string, knownRoots?: Map<string, RepositoryInfo>): Promise<RepoNormalizedUniversalAgentSessionEvent[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Like `normalizeEvents`, but also returns the adapter so callers can inspect
|
|
29
|
-
* `adapter.newlyDiscovered` for auto-registration of newly found git roots.
|
|
30
|
-
*/
|
|
31
|
-
export declare function normalizeEventsWithAdapter(events: UniversalAgentSessionEvent[], workingDirectory?: string, knownRoots?: Map<string, RepositoryInfo>): Promise<{
|
|
32
|
-
normalized: RepoNormalizedUniversalAgentSessionEvent[];
|
|
33
|
-
adapter: NodePathNormalizationAdapter;
|
|
34
|
-
}>;
|
|
35
|
-
/** Compute the accumulated agent-session event rows for a normalized session. */
|
|
36
|
-
export declare function accumulateEvents(normalizedEvents: RepoNormalizedUniversalAgentSessionEvent[], sessionTitle?: string): Array<{
|
|
37
|
-
normalized: RepoNormalizedUniversalAgentSessionEvent;
|
|
38
|
-
accumulated: unknown;
|
|
39
|
-
}>;
|
|
40
|
-
/** Collect the distinct repositories referenced across a normalized session. */
|
|
41
|
-
export declare function collectRepositories(normalizedEvents: RepoNormalizedUniversalAgentSessionEvent[]): RepositoryInfo[];
|
|
42
|
-
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/opencode/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wCAAwC,EAC7C,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC;;;;;;;GAOG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,gBAAgB,EAAE,GACvB,0BAA0B,EAAE,CAmB9B;AAED,4EAA4E;AAC5E,wBAAsB,eAAe,CACnC,MAAM,EAAE,0BAA0B,EAAE,EACpC,gBAAgB,SAAK,EACrB,UAAU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