@ai-matrx/coding-sessions 0.2.0 → 0.3.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/CHANGELOG.md +15 -0
- package/dist/engine/index.cjs +54 -10
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +1 -1
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +54 -10
- package/dist/engine/index.js.map +1 -1
- package/dist/{index-29t7n472.d.cts → index-Bbe11HoB.d.cts} +30 -3
- package/dist/{index-29t7n472.d.ts → index-Bbe11HoB.d.ts} +30 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +34 -5
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +15 -1
- package/dist/react/index.d.ts +15 -1
- package/dist/react/index.js +34 -5
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +44 -9
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +44 -9
- package/dist/server/index.js.map +1 -1
- package/dist/sessions/index.cjs +26 -1
- package/dist/sessions/index.cjs.map +1 -1
- package/dist/sessions/index.d.cts +13 -5
- package/dist/sessions/index.d.ts +13 -5
- package/dist/sessions/index.js +26 -1
- package/dist/sessions/index.js.map +1 -1
- package/dist/{titles-eCnA5sY7.d.cts → titles-DjxUb0ji.d.cts} +8 -1
- package/dist/{titles-eCnA5sY7.d.ts → titles-DjxUb0ji.d.ts} +8 -1
- package/dist/ui/assets/index-BqzTnRFe.css +2 -0
- package/dist/ui/assets/{index-SuRr0-D2.js → index-U98AY8r-.js} +17 -17
- package/dist/ui/index.html +2 -2
- package/package.json +3 -3
- package/dist/ui/assets/index-BqpVx_My.css +0 -2
package/dist/server/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CodingSessionsMethod, a as CodingSessionsApi, b as CodingEvent, c as CodingSessionsEngine, d as CodingSessionsEngineOptions } from '../index-
|
|
2
|
-
export { e as CodingSessionsAgentsOptions } from '../index-
|
|
1
|
+
import { C as CodingSessionsMethod, a as CodingSessionsApi, b as CodingEvent, c as CodingSessionsEngine, d as CodingSessionsEngineOptions } from '../index-Bbe11HoB.cjs';
|
|
2
|
+
export { e as CodingSessionsAgentsOptions } from '../index-Bbe11HoB.cjs';
|
|
3
3
|
import '@ai-matrx/agents/portable';
|
|
4
4
|
import '@ai-matrx/data';
|
|
5
5
|
import '@ai-matrx/agents/portable/mcp';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CodingSessionsMethod, a as CodingSessionsApi, b as CodingEvent, c as CodingSessionsEngine, d as CodingSessionsEngineOptions } from '../index-
|
|
2
|
-
export { e as CodingSessionsAgentsOptions } from '../index-
|
|
1
|
+
import { C as CodingSessionsMethod, a as CodingSessionsApi, b as CodingEvent, c as CodingSessionsEngine, d as CodingSessionsEngineOptions } from '../index-Bbe11HoB.js';
|
|
2
|
+
export { e as CodingSessionsAgentsOptions } from '../index-Bbe11HoB.js';
|
|
3
3
|
import '@ai-matrx/agents/portable';
|
|
4
4
|
import '@ai-matrx/data';
|
|
5
5
|
import '@ai-matrx/agents/portable/mcp';
|
package/dist/server/index.js
CHANGED
|
@@ -1569,6 +1569,7 @@ function codexHome(dir) {
|
|
|
1569
1569
|
function defaultProviderHomes(home = os3.homedir()) {
|
|
1570
1570
|
return {
|
|
1571
1571
|
claudeProjects: path5.join(home, ".claude", "projects"),
|
|
1572
|
+
claudeVault: path5.join(home, ".claude", "claude-app-vault"),
|
|
1572
1573
|
codex: [codexHome(path5.join(home, ".codex"))]
|
|
1573
1574
|
};
|
|
1574
1575
|
}
|
|
@@ -1740,6 +1741,12 @@ async function describeCodex(candidate, names) {
|
|
|
1740
1741
|
activeElsewhere: null
|
|
1741
1742
|
};
|
|
1742
1743
|
}
|
|
1744
|
+
async function codexNames(homes, appTitles) {
|
|
1745
|
+
if (!appTitles) return readCodexIndex(homes.codex.map((h) => h.index));
|
|
1746
|
+
const out = /* @__PURE__ */ new Map();
|
|
1747
|
+
for (const [key, title] of appTitles) if (key.startsWith("codex:")) out.set(key.slice(6), title);
|
|
1748
|
+
return out;
|
|
1749
|
+
}
|
|
1743
1750
|
async function readTail(file, size) {
|
|
1744
1751
|
const start = Math.max(0, size - TAIL_BYTES);
|
|
1745
1752
|
return parseJsonl(completeLines(await readSlice(file, start, Math.min(size, TAIL_BYTES)), start > 0));
|
|
@@ -1780,7 +1787,7 @@ async function discoverLocalSessions(options = {}) {
|
|
|
1780
1787
|
const [claude, codex, names] = await Promise.all([
|
|
1781
1788
|
claudeCandidates(homes.claudeProjects),
|
|
1782
1789
|
codexCandidates(homes.codex),
|
|
1783
|
-
|
|
1790
|
+
codexNames(homes, options.appTitles)
|
|
1784
1791
|
]);
|
|
1785
1792
|
const candidates = [...claude, ...codex].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
1786
1793
|
const processes = await listProcesses();
|
|
@@ -1802,7 +1809,12 @@ async function findSessionFile(provider, providerSessionId, homes = defaultProvi
|
|
|
1802
1809
|
if (!/^[0-9a-f-]{36}$/i.test(providerSessionId)) return null;
|
|
1803
1810
|
const candidates = provider === "claude" ? await claudeCandidates(homes.claudeProjects) : await codexCandidates(homes.codex);
|
|
1804
1811
|
const hits = candidates.filter((c) => c.id === providerSessionId).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
1805
|
-
return hits[0]
|
|
1812
|
+
if (hits[0]) return hits[0].file;
|
|
1813
|
+
if (provider === "claude" && homes.claudeVault) {
|
|
1814
|
+
const copy = path5.join(homes.claudeVault, providerSessionId, "transcript.jsonl");
|
|
1815
|
+
if ((await fs4.stat(copy).catch(() => null))?.isFile()) return copy;
|
|
1816
|
+
}
|
|
1817
|
+
return null;
|
|
1806
1818
|
}
|
|
1807
1819
|
var HISTORY_BUDGET = 24 * 1024 * 1024;
|
|
1808
1820
|
var MAX_HISTORY_BUDGET = 256 * 1024 * 1024;
|
|
@@ -1856,8 +1868,8 @@ async function listSessionFiles(homes = defaultProviderHomes()) {
|
|
|
1856
1868
|
]);
|
|
1857
1869
|
return [...claude, ...codex].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
1858
1870
|
}
|
|
1859
|
-
async function describeSessionFile(candidate,
|
|
1860
|
-
return (candidate.provider === "claude" ? describeClaude(candidate) : describeCodex(candidate,
|
|
1871
|
+
async function describeSessionFile(candidate, codexNames2) {
|
|
1872
|
+
return (candidate.provider === "claude" ? describeClaude(candidate) : describeCodex(candidate, codexNames2)).catch(
|
|
1861
1873
|
() => null
|
|
1862
1874
|
);
|
|
1863
1875
|
}
|
|
@@ -2052,12 +2064,12 @@ async function searchLocalChats(query, options = {}) {
|
|
|
2052
2064
|
const raw = JSON.stringify(needle).slice(1, -1);
|
|
2053
2065
|
const limit = Math.max(1, Math.min(options.limit ?? 30, 100));
|
|
2054
2066
|
const deadline = Date.now() + (options.budgetMs ?? 3500);
|
|
2055
|
-
const names = await
|
|
2067
|
+
const names = await codexNames(homes, options.appTitles);
|
|
2056
2068
|
const hits = [];
|
|
2057
2069
|
let i = cursor;
|
|
2058
2070
|
for (; i < files.length && hits.length < limit && Date.now() < deadline; i += 1) {
|
|
2059
2071
|
const candidate = files[i];
|
|
2060
|
-
const named = candidate.provider === "codex" ? names.get(candidate.id) : void 0;
|
|
2072
|
+
const named = options.appTitles?.get(`${candidate.provider}:${candidate.id}`) ?? (candidate.provider === "codex" ? names.get(candidate.id) : void 0);
|
|
2061
2073
|
const nameHit = named !== void 0 && named.toLowerCase().includes(needle);
|
|
2062
2074
|
const scanned = nameHit ? null : await scanFile(candidate.provider, candidate.file, needle, raw, deadline);
|
|
2063
2075
|
if (scanned === TIMED_OUT) {
|
|
@@ -2091,6 +2103,11 @@ async function searchLocalChats(query, options = {}) {
|
|
|
2091
2103
|
function titleHintKey(provider, sessionId) {
|
|
2092
2104
|
return `${provider}:${sessionId}`;
|
|
2093
2105
|
}
|
|
2106
|
+
function appTitlesOf(hints) {
|
|
2107
|
+
const out = /* @__PURE__ */ new Map();
|
|
2108
|
+
for (const [key, hint] of hints) out.set(key, hint.title);
|
|
2109
|
+
return out;
|
|
2110
|
+
}
|
|
2094
2111
|
|
|
2095
2112
|
// src/engine/title-hints.ts
|
|
2096
2113
|
function overlayHint(chat, hints, expected) {
|
|
@@ -2401,7 +2418,7 @@ function describeAuthStatus(provider, probe) {
|
|
|
2401
2418
|
async function createCodingSessionsEngine(options = {}) {
|
|
2402
2419
|
const dataDir = options.dataDir ?? path9.join(os5.homedir(), ".matrx", "coding-sessions");
|
|
2403
2420
|
const stateDir = path9.join(dataDir, "paperclip-state");
|
|
2404
|
-
|
|
2421
|
+
let homes = options.homes ?? defaultProviderHomes();
|
|
2405
2422
|
const index = new RunIndex(dataDir);
|
|
2406
2423
|
await index.load();
|
|
2407
2424
|
const preferences = new PreferenceStore(dataDir);
|
|
@@ -2483,6 +2500,11 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
2483
2500
|
}
|
|
2484
2501
|
const titleHints = options.titleHints;
|
|
2485
2502
|
const hintsNow = () => titleHints?.current() ?? null;
|
|
2503
|
+
const appTitles = () => {
|
|
2504
|
+
if (!titleHints) return void 0;
|
|
2505
|
+
const hints = hintsNow();
|
|
2506
|
+
return hints ? appTitlesOf(hints) : /* @__PURE__ */ new Map();
|
|
2507
|
+
};
|
|
2486
2508
|
const unsubscribeHints = titleHints?.subscribe(() => emit({ type: "titles" })) ?? null;
|
|
2487
2509
|
const withHintTitle = (session) => {
|
|
2488
2510
|
const hint = session.providerSessionId ? hintsNow()?.get(titleHintKey(session.provider, session.providerSessionId)) : void 0;
|
|
@@ -2957,7 +2979,7 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
2957
2979
|
);
|
|
2958
2980
|
},
|
|
2959
2981
|
async discoverSessions(opts) {
|
|
2960
|
-
const read = await discoverLocalSessions({ limit: opts?.limit, homes, excludePids: ourPids() });
|
|
2982
|
+
const read = await discoverLocalSessions({ limit: opts?.limit, homes, excludePids: ourPids(), appTitles: appTitles() });
|
|
2961
2983
|
const hints = hintsNow();
|
|
2962
2984
|
const found = read.map((chat) => overlayHint(chat, hints, titleHints !== void 0));
|
|
2963
2985
|
if (backups) {
|
|
@@ -2995,6 +3017,17 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
2995
3017
|
}))
|
|
2996
3018
|
);
|
|
2997
3019
|
},
|
|
3020
|
+
async titleStatus() {
|
|
3021
|
+
if (!titleHints) return { owner: false, pending: false, problem: null };
|
|
3022
|
+
const problem = titleHints.problem?.() ?? null;
|
|
3023
|
+
return { owner: true, pending: hintsNow() === null && problem === null, problem };
|
|
3024
|
+
},
|
|
3025
|
+
async retryTitles() {
|
|
3026
|
+
titleHints?.retry?.();
|
|
3027
|
+
},
|
|
3028
|
+
setHomes(next) {
|
|
3029
|
+
homes = next;
|
|
3030
|
+
},
|
|
2998
3031
|
async listSessions() {
|
|
2999
3032
|
return index.sessions().map(withHintTitle);
|
|
3000
3033
|
},
|
|
@@ -3171,7 +3204,7 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
3171
3204
|
return all;
|
|
3172
3205
|
},
|
|
3173
3206
|
async searchChats(query, opts) {
|
|
3174
|
-
const result = await searchLocalChats(String(query ?? ""), { homes, cursor: opts?.cursor, limit: opts?.limit });
|
|
3207
|
+
const result = await searchLocalChats(String(query ?? ""), { homes, cursor: opts?.cursor, limit: opts?.limit, appTitles: appTitles() });
|
|
3175
3208
|
const hints = hintsNow();
|
|
3176
3209
|
return { ...result, hits: result.hits.map((hit) => ({ ...hit, title: hints?.get(titleHintKey(hit.provider, hit.providerSessionId))?.title ?? hit.title })) };
|
|
3177
3210
|
},
|
|
@@ -3255,6 +3288,8 @@ function openFolderIn(folder, target) {
|
|
|
3255
3288
|
var BRIDGE_METHODS = [
|
|
3256
3289
|
"providers",
|
|
3257
3290
|
"discoverSessions",
|
|
3291
|
+
"titleStatus",
|
|
3292
|
+
"retryTitles",
|
|
3258
3293
|
"recentFolders",
|
|
3259
3294
|
"listSessions",
|
|
3260
3295
|
"listRuns",
|