@ai-matrx/coding-sessions 0.1.165 → 0.2.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 +26 -0
- package/dist/engine/index.cjs +224 -54
- 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 +220 -53
- package/dist/engine/index.js.map +1 -1
- package/dist/{index-CDeDKQHe.d.cts → index-29t7n472.d.cts} +81 -3
- package/dist/{index-CDeDKQHe.d.ts → index-29t7n472.d.ts} +81 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +15 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +23 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +15 -3
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +201 -52
- 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 +201 -52
- package/dist/server/index.js.map +1 -1
- package/dist/sessions/index.cjs +335 -0
- package/dist/sessions/index.cjs.map +1 -0
- package/dist/sessions/index.d.cts +63 -0
- package/dist/sessions/index.d.ts +63 -0
- package/dist/sessions/index.js +312 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/titles-eCnA5sY7.d.cts +41 -0
- package/dist/titles-eCnA5sY7.d.ts +41 -0
- package/dist/ui/assets/{index-5Iix3spw.js → index-SuRr0-D2.js} +2 -2
- package/dist/ui/index.html +1 -1
- package/package.json +13 -3
|
@@ -2,6 +2,10 @@ import { JsonValue } from '@ai-matrx/agents/portable';
|
|
|
2
2
|
import { CredentialsPort } from '@ai-matrx/data';
|
|
3
3
|
import { McpHttpReply } from '@ai-matrx/agents/portable/mcp';
|
|
4
4
|
|
|
5
|
+
/** Where a title came from, strongest first. */
|
|
6
|
+
declare const TITLE_PRECEDENCE: readonly ["override", "app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt"];
|
|
7
|
+
type TitleSource = (typeof TITLE_PRECEDENCE)[number];
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* The public contract of `@ai-matrx/coding-sessions`, shared by the engine
|
|
7
11
|
* (Node), the local host (Node) and the UI (browser). Pure types — nothing here
|
|
@@ -129,7 +133,22 @@ interface DiscoveredSession {
|
|
|
129
133
|
provider: CodingProvider;
|
|
130
134
|
providerSessionId: string;
|
|
131
135
|
cwd: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* The chat's own title by the one rule (`./sessions`): the coding app's title when the owner of
|
|
138
|
+
* the apps' index supplied it (title hints), else the transcript's. Never the person's rename —
|
|
139
|
+
* that is applied once, by the screen, from the preferences.
|
|
140
|
+
*/
|
|
132
141
|
title: string;
|
|
142
|
+
/** Where `title` came from (`TITLE_PRECEDENCE`). */
|
|
143
|
+
titleSource?: TitleSource | undefined;
|
|
144
|
+
/** The app's title is still on its way (hints not loaded yet); `title` is the transcript's for now. */
|
|
145
|
+
titlePending?: boolean | undefined;
|
|
146
|
+
/** Archived in the app (hidden by default, like Code › Chats). */
|
|
147
|
+
archived?: boolean | undefined;
|
|
148
|
+
/** A scheduled or automated run (hidden by default). */
|
|
149
|
+
scheduled?: boolean | undefined;
|
|
150
|
+
/** The app lists it but its conversation file is gone: why. Shown, cannot be taken over. */
|
|
151
|
+
unavailable?: string | null | undefined;
|
|
133
152
|
updatedAt: string;
|
|
134
153
|
/** Where it was started, when the provider records it ("cli", "vscode", "exec", …). */
|
|
135
154
|
source: string | null;
|
|
@@ -254,6 +273,10 @@ type CodingEvent = {
|
|
|
254
273
|
} | {
|
|
255
274
|
type: "preferences";
|
|
256
275
|
preferences: Record<string, ChatPreference>;
|
|
276
|
+
}
|
|
277
|
+
/** The apps' titles changed (or finished loading): re-read the discovered chats. */
|
|
278
|
+
| {
|
|
279
|
+
type: "titles";
|
|
257
280
|
} | {
|
|
258
281
|
type: "item";
|
|
259
282
|
sessionId: string;
|
|
@@ -573,11 +596,20 @@ declare const DEFAULT_SUPABASE_URL = "https://db.matrxserver.com";
|
|
|
573
596
|
* few newest, and a transcript read is capped with the cap announced.
|
|
574
597
|
*/
|
|
575
598
|
|
|
599
|
+
interface CodexHome {
|
|
600
|
+
/** `<CODEX_HOME>/sessions` (dated folders of rollouts). */
|
|
601
|
+
sessions: string;
|
|
602
|
+
/** `<CODEX_HOME>/archived_sessions` (rollouts Codex archived; flat). */
|
|
603
|
+
archived: string;
|
|
604
|
+
/** `<CODEX_HOME>/session_index.jsonl` (the app's thread names). */
|
|
605
|
+
index: string;
|
|
606
|
+
}
|
|
576
607
|
interface ProviderHomes {
|
|
577
608
|
claudeProjects: string;
|
|
578
|
-
|
|
579
|
-
|
|
609
|
+
/** Every Codex home to read (main first). The owner of the apps' index names them (Matrx 2: the Codex source's homes). */
|
|
610
|
+
codex: CodexHome[];
|
|
580
611
|
}
|
|
612
|
+
declare function codexHome(dir: string): CodexHome;
|
|
581
613
|
declare function defaultProviderHomes(home?: string): ProviderHomes;
|
|
582
614
|
interface DiscoverOptions {
|
|
583
615
|
limit?: number | undefined;
|
|
@@ -601,6 +633,40 @@ declare function findSessionFile(provider: CodingProvider, providerSessionId: st
|
|
|
601
633
|
*/
|
|
602
634
|
declare function readSessionFile(provider: CodingProvider, file: string, endOffset?: number | undefined, maxBytes?: number): Promise<SessionHistory>;
|
|
603
635
|
|
|
636
|
+
/**
|
|
637
|
+
* TITLE HINTS — the port through which the owner of the coding apps' index (Matrx 2's core, which
|
|
638
|
+
* reads Claude's records, Codex's database and the rest through its own `fs`/`exec` owners) tells
|
|
639
|
+
* this package what each chat is called and whether the app hides it. The package never walks the
|
|
640
|
+
* apps' records itself: it reads transcripts (titles by the transcript rules, content search,
|
|
641
|
+
* activity) and overlays these hints as they arrive. Pure: browser-safe types and helpers.
|
|
642
|
+
*/
|
|
643
|
+
|
|
644
|
+
type HintProvider = "claude" | "codex";
|
|
645
|
+
interface TitleHint {
|
|
646
|
+
/** The app's title (pre-override: the person's rename is applied by whoever draws the row). */
|
|
647
|
+
title: string;
|
|
648
|
+
source: TitleSource;
|
|
649
|
+
/** The app hides it: archived in the app (shown behind a toggle). */
|
|
650
|
+
archived?: boolean | undefined;
|
|
651
|
+
/** A scheduled or automated run (shown behind a toggle). */
|
|
652
|
+
scheduled?: boolean | undefined;
|
|
653
|
+
/** Listed by the app but its conversation file is gone: why (it is shown, never dropped). */
|
|
654
|
+
unavailable?: string | null | undefined;
|
|
655
|
+
/** Last activity the app records (ms), for chats only the app knows. */
|
|
656
|
+
lastActiveMs?: number | null | undefined;
|
|
657
|
+
}
|
|
658
|
+
interface TitleHints {
|
|
659
|
+
/** The hints now, keyed `titleHintKey()`; null while the owner's index is still loading. Never waits. */
|
|
660
|
+
current(): ReadonlyMap<string, TitleHint> | null;
|
|
661
|
+
/** Called after the hints change (a rename in the app, a new chat, the first load). */
|
|
662
|
+
subscribe(listener: () => void): () => void;
|
|
663
|
+
}
|
|
664
|
+
declare function titleHintKey(provider: HintProvider, sessionId: string): string;
|
|
665
|
+
/** A hints port the host fills by hand (tests, or an owner that pushes whole snapshots). */
|
|
666
|
+
declare function createTitleHintsStore(): TitleHints & {
|
|
667
|
+
set(hints: ReadonlyMap<string, TitleHint> | null): void;
|
|
668
|
+
};
|
|
669
|
+
|
|
604
670
|
/**
|
|
605
671
|
* THE CLEAN ENVIRONMENT — built from an ALLOWLIST, never a denylist.
|
|
606
672
|
*
|
|
@@ -724,6 +790,12 @@ declare class PreferenceStore {
|
|
|
724
790
|
get(key: string): ChatPreference | null;
|
|
725
791
|
/** Merge `patch`; a null/false/empty field is removed, an empty preference deleted. */
|
|
726
792
|
set(key: string, patch: ChatPreference): Record<string, ChatPreference>;
|
|
793
|
+
/**
|
|
794
|
+
* Move a preference to the chat's lasting key (`session:<id>` → `<provider>:<id>` once the
|
|
795
|
+
* provider's id is known), so a rename made early is the one rename everywhere. A preference
|
|
796
|
+
* already under the lasting key wins field by field.
|
|
797
|
+
*/
|
|
798
|
+
rekey(from: string, to: string): boolean;
|
|
727
799
|
private persist;
|
|
728
800
|
flush(): Promise<void>;
|
|
729
801
|
}
|
|
@@ -780,6 +852,12 @@ interface CodingSessionsEngineOptions {
|
|
|
780
852
|
* are unaffected.
|
|
781
853
|
*/
|
|
782
854
|
agents?: CodingSessionsAgentsOptions | undefined;
|
|
855
|
+
/**
|
|
856
|
+
* What the coding apps' own records say each chat is called (and archived / scheduled / file
|
|
857
|
+
* gone), from the owner of the apps' index — Matrx 2's core. Never waited for; absent → titles
|
|
858
|
+
* come from the transcripts alone (the standalone host).
|
|
859
|
+
*/
|
|
860
|
+
titleHints?: TitleHints | undefined;
|
|
783
861
|
}
|
|
784
862
|
interface CodingSessionsEngine extends CodingSessionsApi {
|
|
785
863
|
subscribe(listener: (event: CodingEvent) => void): () => void;
|
|
@@ -799,4 +877,4 @@ interface CodingSessionsEngine extends CodingSessionsApi {
|
|
|
799
877
|
declare function describeProviderStatus(provider: CodingProvider, probe: Record<string, unknown> | undefined, lastProblem?: ProviderProblem | null, quota?: QuotaWindow[]): ProviderStatus;
|
|
800
878
|
declare function createCodingSessionsEngine(options?: CodingSessionsEngineOptions): Promise<CodingSessionsEngine>;
|
|
801
879
|
|
|
802
|
-
export {
|
|
880
|
+
export { findSessionFile as A, isAllowedEnvName as B, type CodingSessionsMethod as C, DEFAULT_SERVER_URL as D, EFFORT_LEVELS as E, listProcesses as F, readSessionFile as G, searchLocalChats as H, sessionActivity as I, snippetAround as J, titleHintKey as K, PreferenceStore as P, RAW_TRANSCRIPT_MAX_BYTES as R, type TitleHint as T, type CodingSessionsApi as a, type CodingEvent as b, type CodingSessionsEngine as c, type CodingSessionsEngineOptions as d, type CodingSessionsAgentsOptions as e, type CodexHome as f, DEFAULT_SUPABASE_URL as g, type ProviderHomes as h, type RawBackupPolicy as i, type RawBackupSink as j, type RunStatus as k, type TitleHints as l, buildCleanEnv as m, claudeDefaults as n, codexDefaults as o, codexHome as p, createAiMatrxRawBackupSink as q, createCodingSessionsEngine as r, createRawBackupScheduler as s, createTitleHintsStore as t, defaultProviderHomes as u, describeActivity as v, describeProviderStatus as w, discoverLocalSessions as x, endsWithOpenToolCall as y, findDrivingProcess as z };
|
|
@@ -2,6 +2,10 @@ import { JsonValue } from '@ai-matrx/agents/portable';
|
|
|
2
2
|
import { CredentialsPort } from '@ai-matrx/data';
|
|
3
3
|
import { McpHttpReply } from '@ai-matrx/agents/portable/mcp';
|
|
4
4
|
|
|
5
|
+
/** Where a title came from, strongest first. */
|
|
6
|
+
declare const TITLE_PRECEDENCE: readonly ["override", "app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt"];
|
|
7
|
+
type TitleSource = (typeof TITLE_PRECEDENCE)[number];
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* The public contract of `@ai-matrx/coding-sessions`, shared by the engine
|
|
7
11
|
* (Node), the local host (Node) and the UI (browser). Pure types — nothing here
|
|
@@ -129,7 +133,22 @@ interface DiscoveredSession {
|
|
|
129
133
|
provider: CodingProvider;
|
|
130
134
|
providerSessionId: string;
|
|
131
135
|
cwd: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* The chat's own title by the one rule (`./sessions`): the coding app's title when the owner of
|
|
138
|
+
* the apps' index supplied it (title hints), else the transcript's. Never the person's rename —
|
|
139
|
+
* that is applied once, by the screen, from the preferences.
|
|
140
|
+
*/
|
|
132
141
|
title: string;
|
|
142
|
+
/** Where `title` came from (`TITLE_PRECEDENCE`). */
|
|
143
|
+
titleSource?: TitleSource | undefined;
|
|
144
|
+
/** The app's title is still on its way (hints not loaded yet); `title` is the transcript's for now. */
|
|
145
|
+
titlePending?: boolean | undefined;
|
|
146
|
+
/** Archived in the app (hidden by default, like Code › Chats). */
|
|
147
|
+
archived?: boolean | undefined;
|
|
148
|
+
/** A scheduled or automated run (hidden by default). */
|
|
149
|
+
scheduled?: boolean | undefined;
|
|
150
|
+
/** The app lists it but its conversation file is gone: why. Shown, cannot be taken over. */
|
|
151
|
+
unavailable?: string | null | undefined;
|
|
133
152
|
updatedAt: string;
|
|
134
153
|
/** Where it was started, when the provider records it ("cli", "vscode", "exec", …). */
|
|
135
154
|
source: string | null;
|
|
@@ -254,6 +273,10 @@ type CodingEvent = {
|
|
|
254
273
|
} | {
|
|
255
274
|
type: "preferences";
|
|
256
275
|
preferences: Record<string, ChatPreference>;
|
|
276
|
+
}
|
|
277
|
+
/** The apps' titles changed (or finished loading): re-read the discovered chats. */
|
|
278
|
+
| {
|
|
279
|
+
type: "titles";
|
|
257
280
|
} | {
|
|
258
281
|
type: "item";
|
|
259
282
|
sessionId: string;
|
|
@@ -573,11 +596,20 @@ declare const DEFAULT_SUPABASE_URL = "https://db.matrxserver.com";
|
|
|
573
596
|
* few newest, and a transcript read is capped with the cap announced.
|
|
574
597
|
*/
|
|
575
598
|
|
|
599
|
+
interface CodexHome {
|
|
600
|
+
/** `<CODEX_HOME>/sessions` (dated folders of rollouts). */
|
|
601
|
+
sessions: string;
|
|
602
|
+
/** `<CODEX_HOME>/archived_sessions` (rollouts Codex archived; flat). */
|
|
603
|
+
archived: string;
|
|
604
|
+
/** `<CODEX_HOME>/session_index.jsonl` (the app's thread names). */
|
|
605
|
+
index: string;
|
|
606
|
+
}
|
|
576
607
|
interface ProviderHomes {
|
|
577
608
|
claudeProjects: string;
|
|
578
|
-
|
|
579
|
-
|
|
609
|
+
/** Every Codex home to read (main first). The owner of the apps' index names them (Matrx 2: the Codex source's homes). */
|
|
610
|
+
codex: CodexHome[];
|
|
580
611
|
}
|
|
612
|
+
declare function codexHome(dir: string): CodexHome;
|
|
581
613
|
declare function defaultProviderHomes(home?: string): ProviderHomes;
|
|
582
614
|
interface DiscoverOptions {
|
|
583
615
|
limit?: number | undefined;
|
|
@@ -601,6 +633,40 @@ declare function findSessionFile(provider: CodingProvider, providerSessionId: st
|
|
|
601
633
|
*/
|
|
602
634
|
declare function readSessionFile(provider: CodingProvider, file: string, endOffset?: number | undefined, maxBytes?: number): Promise<SessionHistory>;
|
|
603
635
|
|
|
636
|
+
/**
|
|
637
|
+
* TITLE HINTS — the port through which the owner of the coding apps' index (Matrx 2's core, which
|
|
638
|
+
* reads Claude's records, Codex's database and the rest through its own `fs`/`exec` owners) tells
|
|
639
|
+
* this package what each chat is called and whether the app hides it. The package never walks the
|
|
640
|
+
* apps' records itself: it reads transcripts (titles by the transcript rules, content search,
|
|
641
|
+
* activity) and overlays these hints as they arrive. Pure: browser-safe types and helpers.
|
|
642
|
+
*/
|
|
643
|
+
|
|
644
|
+
type HintProvider = "claude" | "codex";
|
|
645
|
+
interface TitleHint {
|
|
646
|
+
/** The app's title (pre-override: the person's rename is applied by whoever draws the row). */
|
|
647
|
+
title: string;
|
|
648
|
+
source: TitleSource;
|
|
649
|
+
/** The app hides it: archived in the app (shown behind a toggle). */
|
|
650
|
+
archived?: boolean | undefined;
|
|
651
|
+
/** A scheduled or automated run (shown behind a toggle). */
|
|
652
|
+
scheduled?: boolean | undefined;
|
|
653
|
+
/** Listed by the app but its conversation file is gone: why (it is shown, never dropped). */
|
|
654
|
+
unavailable?: string | null | undefined;
|
|
655
|
+
/** Last activity the app records (ms), for chats only the app knows. */
|
|
656
|
+
lastActiveMs?: number | null | undefined;
|
|
657
|
+
}
|
|
658
|
+
interface TitleHints {
|
|
659
|
+
/** The hints now, keyed `titleHintKey()`; null while the owner's index is still loading. Never waits. */
|
|
660
|
+
current(): ReadonlyMap<string, TitleHint> | null;
|
|
661
|
+
/** Called after the hints change (a rename in the app, a new chat, the first load). */
|
|
662
|
+
subscribe(listener: () => void): () => void;
|
|
663
|
+
}
|
|
664
|
+
declare function titleHintKey(provider: HintProvider, sessionId: string): string;
|
|
665
|
+
/** A hints port the host fills by hand (tests, or an owner that pushes whole snapshots). */
|
|
666
|
+
declare function createTitleHintsStore(): TitleHints & {
|
|
667
|
+
set(hints: ReadonlyMap<string, TitleHint> | null): void;
|
|
668
|
+
};
|
|
669
|
+
|
|
604
670
|
/**
|
|
605
671
|
* THE CLEAN ENVIRONMENT — built from an ALLOWLIST, never a denylist.
|
|
606
672
|
*
|
|
@@ -724,6 +790,12 @@ declare class PreferenceStore {
|
|
|
724
790
|
get(key: string): ChatPreference | null;
|
|
725
791
|
/** Merge `patch`; a null/false/empty field is removed, an empty preference deleted. */
|
|
726
792
|
set(key: string, patch: ChatPreference): Record<string, ChatPreference>;
|
|
793
|
+
/**
|
|
794
|
+
* Move a preference to the chat's lasting key (`session:<id>` → `<provider>:<id>` once the
|
|
795
|
+
* provider's id is known), so a rename made early is the one rename everywhere. A preference
|
|
796
|
+
* already under the lasting key wins field by field.
|
|
797
|
+
*/
|
|
798
|
+
rekey(from: string, to: string): boolean;
|
|
727
799
|
private persist;
|
|
728
800
|
flush(): Promise<void>;
|
|
729
801
|
}
|
|
@@ -780,6 +852,12 @@ interface CodingSessionsEngineOptions {
|
|
|
780
852
|
* are unaffected.
|
|
781
853
|
*/
|
|
782
854
|
agents?: CodingSessionsAgentsOptions | undefined;
|
|
855
|
+
/**
|
|
856
|
+
* What the coding apps' own records say each chat is called (and archived / scheduled / file
|
|
857
|
+
* gone), from the owner of the apps' index — Matrx 2's core. Never waited for; absent → titles
|
|
858
|
+
* come from the transcripts alone (the standalone host).
|
|
859
|
+
*/
|
|
860
|
+
titleHints?: TitleHints | undefined;
|
|
783
861
|
}
|
|
784
862
|
interface CodingSessionsEngine extends CodingSessionsApi {
|
|
785
863
|
subscribe(listener: (event: CodingEvent) => void): () => void;
|
|
@@ -799,4 +877,4 @@ interface CodingSessionsEngine extends CodingSessionsApi {
|
|
|
799
877
|
declare function describeProviderStatus(provider: CodingProvider, probe: Record<string, unknown> | undefined, lastProblem?: ProviderProblem | null, quota?: QuotaWindow[]): ProviderStatus;
|
|
800
878
|
declare function createCodingSessionsEngine(options?: CodingSessionsEngineOptions): Promise<CodingSessionsEngine>;
|
|
801
879
|
|
|
802
|
-
export {
|
|
880
|
+
export { findSessionFile as A, isAllowedEnvName as B, type CodingSessionsMethod as C, DEFAULT_SERVER_URL as D, EFFORT_LEVELS as E, listProcesses as F, readSessionFile as G, searchLocalChats as H, sessionActivity as I, snippetAround as J, titleHintKey as K, PreferenceStore as P, RAW_TRANSCRIPT_MAX_BYTES as R, type TitleHint as T, type CodingSessionsApi as a, type CodingEvent as b, type CodingSessionsEngine as c, type CodingSessionsEngineOptions as d, type CodingSessionsAgentsOptions as e, type CodexHome as f, DEFAULT_SUPABASE_URL as g, type ProviderHomes as h, type RawBackupPolicy as i, type RawBackupSink as j, type RunStatus as k, type TitleHints as l, buildCleanEnv as m, claudeDefaults as n, codexDefaults as o, codexHome as p, createAiMatrxRawBackupSink as q, createCodingSessionsEngine as r, createRawBackupScheduler as s, createTitleHintsStore as t, defaultProviderHomes as u, describeActivity as v, describeProviderStatus as w, discoverLocalSessions as x, endsWithOpenToolCall as y, findDrivingProcess as z };
|