@ai-matrx/coding-sessions 0.1.81 → 0.1.85
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 +24 -0
- package/dist/engine/index.cjs +724 -139
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +4 -1
- package/dist/engine/index.d.ts +4 -1
- package/dist/engine/index.js +717 -132
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/worker.js +14 -2
- package/dist/engine/worker.js.map +1 -1
- package/dist/{index-RYOb-YZT.d.cts → index-DEPwyr2j.d.cts} +148 -0
- package/dist/{index-RYOb-YZT.d.ts → index-DEPwyr2j.d.ts} +148 -0
- package/dist/index.cjs +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -1
- package/dist/index.d.ts +105 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +722 -410
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +105 -7
- package/dist/react/index.d.ts +105 -7
- package/dist/react/index.js +730 -405
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +792 -155
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +4 -1
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +783 -146
- package/dist/server/index.js.map +1 -1
- package/dist/ui/assets/index-DSWoryQZ.js +72 -0
- package/dist/ui/assets/index-Gp2bMDtx.css +2 -0
- package/dist/ui/index.html +2 -2
- package/package.json +4 -2
- package/dist/ui/assets/index-B3Ic2ziA.js +0 -69
- package/dist/ui/assets/index-BAkpc01s.css +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JsonValue } from '@ai-matrx/agents/portable';
|
|
1
2
|
import { ChatMessage } from '@ai-matrx/chat';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -6,12 +7,29 @@ import { ChatMessage } from '@ai-matrx/chat';
|
|
|
6
7
|
* touches Node or the DOM, and every value is JSON-serializable because it
|
|
7
8
|
* crosses a transport (WebSocket today, desktop IPC later).
|
|
8
9
|
*/
|
|
10
|
+
|
|
9
11
|
/** The coding agents this package drives. "coding session" is the canonical
|
|
10
12
|
* platform term (chat.coding_session, the Coding Session Bridge). */
|
|
11
13
|
type CodingProvider = "claude" | "codex";
|
|
12
14
|
declare const CODING_PROVIDERS: readonly CodingProvider[];
|
|
13
15
|
declare const PROVIDER_LABEL: Record<CodingProvider, string>;
|
|
14
16
|
type Billing = "subscription" | "api" | "unknown";
|
|
17
|
+
/** Where the CLI a provider runs came from. */
|
|
18
|
+
type BinarySource = "desktop-app" | "path" | "npm-global" | "configured";
|
|
19
|
+
/** The exact CLI runs use: the newest copy on this computer (or the host's pick). */
|
|
20
|
+
interface ProviderBinary {
|
|
21
|
+
path: string;
|
|
22
|
+
version: string | null;
|
|
23
|
+
source: BinarySource;
|
|
24
|
+
/** "from ChatGPT app", "from PATH", … */
|
|
25
|
+
sourceLabel: string;
|
|
26
|
+
/** A newer copy than the one in use, when one exists. */
|
|
27
|
+
newer: {
|
|
28
|
+
path: string;
|
|
29
|
+
version: string;
|
|
30
|
+
sourceLabel: string;
|
|
31
|
+
} | null;
|
|
32
|
+
}
|
|
15
33
|
/** What `providers()` answers for one provider, in plain terms. */
|
|
16
34
|
interface ProviderStatus {
|
|
17
35
|
provider: CodingProvider;
|
|
@@ -49,6 +67,8 @@ interface ProviderStatus {
|
|
|
49
67
|
} | null | undefined;
|
|
50
68
|
/** The effort a run uses when none is picked (the person's own settings). */
|
|
51
69
|
defaultEffort?: string | null | undefined;
|
|
70
|
+
/** Which CLI runs use, and its version. */
|
|
71
|
+
binary?: ProviderBinary | null | undefined;
|
|
52
72
|
}
|
|
53
73
|
interface ModelOption {
|
|
54
74
|
id: string;
|
|
@@ -179,6 +199,8 @@ interface CodingSession {
|
|
|
179
199
|
lastRunStatus: RunStatus | null;
|
|
180
200
|
/** Prompts waiting for the active run to finish, oldest first. */
|
|
181
201
|
queued: string[];
|
|
202
|
+
/** The AI Matrx agent loaded into every run of this session, when one was picked. */
|
|
203
|
+
agent?: SessionAgent | null | undefined;
|
|
182
204
|
}
|
|
183
205
|
/**
|
|
184
206
|
* One normalized transcript item — the same shape from Claude and Codex, from
|
|
@@ -259,6 +281,82 @@ interface StartInput {
|
|
|
259
281
|
prompt: string;
|
|
260
282
|
model?: string | null | undefined;
|
|
261
283
|
effort?: string | null | undefined;
|
|
284
|
+
/** An AI Matrx agent to load into the CLI. Needs the host's `agents` credentials. */
|
|
285
|
+
agent?: AgentSelection | null | undefined;
|
|
286
|
+
}
|
|
287
|
+
/** Which AI Matrx agent a new session loads, and the person's variable values. */
|
|
288
|
+
interface AgentSelection {
|
|
289
|
+
agentId: string;
|
|
290
|
+
/** Pin one saved version; omitted = the latest, pinned at start. */
|
|
291
|
+
versionId?: string | null | undefined;
|
|
292
|
+
variables?: Record<string, JsonValue> | undefined;
|
|
293
|
+
}
|
|
294
|
+
/** One part of an agent and whether this session's CLI carries it. */
|
|
295
|
+
interface SessionAgentPart {
|
|
296
|
+
part: "instructions" | "skills" | "tools";
|
|
297
|
+
loaded: number;
|
|
298
|
+
total: number;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The agent a session runs with. Recorded at start and never drifts: every
|
|
302
|
+
* later turn reloads the SAME bundle (same version, same hash).
|
|
303
|
+
*/
|
|
304
|
+
interface SessionAgent {
|
|
305
|
+
agentId: string;
|
|
306
|
+
versionId: string | null;
|
|
307
|
+
versionNumber: number | null;
|
|
308
|
+
name: string;
|
|
309
|
+
definitionHash: string;
|
|
310
|
+
loaded: SessionAgentPart[];
|
|
311
|
+
/** What could not be carried, with the reason. */
|
|
312
|
+
unavailable: {
|
|
313
|
+
kind: string;
|
|
314
|
+
name: string;
|
|
315
|
+
reason: string;
|
|
316
|
+
}[];
|
|
317
|
+
}
|
|
318
|
+
/** Whether this host can reach AI Matrx as a signed-in person. */
|
|
319
|
+
interface AgentAccess {
|
|
320
|
+
signedIn: boolean;
|
|
321
|
+
userId: string | null;
|
|
322
|
+
organizationId: string | null;
|
|
323
|
+
/** True when the host was started with no AI Matrx connection at all. */
|
|
324
|
+
configured: boolean;
|
|
325
|
+
}
|
|
326
|
+
/** A catalogue read the picker asks the host to make (PostgREST RPC shape). */
|
|
327
|
+
interface AgentCatalogRpcRequest {
|
|
328
|
+
fn: string;
|
|
329
|
+
args?: Record<string, unknown> | undefined;
|
|
330
|
+
count?: "exact" | "planned" | "estimated" | undefined;
|
|
331
|
+
range?: [number, number] | undefined;
|
|
332
|
+
order?: {
|
|
333
|
+
column: string;
|
|
334
|
+
ascending?: boolean | undefined;
|
|
335
|
+
} | undefined;
|
|
336
|
+
}
|
|
337
|
+
interface AgentCatalogRpcResult {
|
|
338
|
+
data: unknown;
|
|
339
|
+
error: {
|
|
340
|
+
message: string;
|
|
341
|
+
code?: string | undefined;
|
|
342
|
+
details?: string | null | undefined;
|
|
343
|
+
hint?: string | null | undefined;
|
|
344
|
+
} | null;
|
|
345
|
+
count?: number | null;
|
|
346
|
+
}
|
|
347
|
+
/** What the New session form needs about one agent. */
|
|
348
|
+
interface AgentDetails {
|
|
349
|
+
agentId: string;
|
|
350
|
+
name: string;
|
|
351
|
+
/** Variable declarations as authored (camelCase). */
|
|
352
|
+
variables: Record<string, JsonValue>[];
|
|
353
|
+
versions: {
|
|
354
|
+
id: string;
|
|
355
|
+
versionNumber: number;
|
|
356
|
+
changedAt: string | null;
|
|
357
|
+
}[];
|
|
358
|
+
/** The version "Latest" resolves to right now. */
|
|
359
|
+
latestVersionNumber: number | null;
|
|
262
360
|
}
|
|
263
361
|
interface TakeoverInput {
|
|
264
362
|
provider: CodingProvider;
|
|
@@ -335,6 +433,12 @@ interface CodingSessionsApi {
|
|
|
335
433
|
model?: string | null;
|
|
336
434
|
effort?: string | null;
|
|
337
435
|
}): Promise<CodingSession>;
|
|
436
|
+
/** Is this host signed in to AI Matrx (so agents can load)? */
|
|
437
|
+
agentAccess(): Promise<AgentAccess>;
|
|
438
|
+
/** One allowlisted agent-catalogue read, made by the host as the signed-in person. */
|
|
439
|
+
agentCatalogRpc(request: AgentCatalogRpcRequest): Promise<AgentCatalogRpcResult>;
|
|
440
|
+
/** An agent's variables and saved versions, for the New session form. */
|
|
441
|
+
agentDetails(agentId: string): Promise<AgentDetails>;
|
|
338
442
|
}
|
|
339
443
|
type RawTranscript = {
|
|
340
444
|
available: true;
|
|
@@ -509,4 +613,4 @@ declare function friendlyToolName(name: string): string;
|
|
|
509
613
|
/** The key argument, for the card's subtitle. null when there is none worth showing. */
|
|
510
614
|
declare function toolSubtitle(name: string, input: unknown): string | null;
|
|
511
615
|
|
|
512
|
-
export { type ActiveElsewhere, type Billing, CODING_PROVIDERS, type ChatPreference, type ChatSearchHit, type ChatSearchResult, type ClaudeNormalizer, type CodexRolloutNormalizer, type CodexStreamNormalizer, type CodingEvent, type CodingProvider, type CodingSession, type CodingSessionsApi, type CodingSessionsMethod, type CodingSessionsTransport, type DiscoveredSession, type FolderCheck, type HistoryOptions, type LineSplitter, type ModelOption, type OpenTarget, PROVIDER_LABEL, type ProviderProblem, type ProviderStatus, type QuotaWindow, type RawTranscript, type RecentFolder, type RunRecord, type RunStatus, type RunUsage, type SendResult, type SessionHistory, type SessionOrigin, type StartInput, TERMINAL_RUN_STATUSES, type TakeoverInput, type TranscriptBuilder, type TranscriptItem, type TransportStatus, type WebSocketTransportOptions, chatKey, createClaudeNormalizer, createCodexRolloutNormalizer, createCodexStreamNormalizer, createLineSplitter, createTranscriptBuilder, createWebSocketTransport, friendlyToolName, isSyntheticClaudeUserText, isTerminalRunStatus, parseJsonl, parseMcpToolName, stripCodexInjectedContext, toolSubtitle };
|
|
616
|
+
export { type ActiveElsewhere, type AgentAccess, type AgentCatalogRpcRequest, type AgentCatalogRpcResult, type AgentDetails, type AgentSelection, type Billing, type BinarySource, CODING_PROVIDERS, type ChatPreference, type ChatSearchHit, type ChatSearchResult, type ClaudeNormalizer, type CodexRolloutNormalizer, type CodexStreamNormalizer, type CodingEvent, type CodingProvider, type CodingSession, type CodingSessionsApi, type CodingSessionsMethod, type CodingSessionsTransport, type DiscoveredSession, type FolderCheck, type HistoryOptions, type LineSplitter, type ModelOption, type OpenTarget, PROVIDER_LABEL, type ProviderBinary, type ProviderProblem, type ProviderStatus, type QuotaWindow, type RawTranscript, type RecentFolder, type RunRecord, type RunStatus, type RunUsage, type SendResult, type SessionAgent, type SessionAgentPart, type SessionHistory, type SessionOrigin, type StartInput, TERMINAL_RUN_STATUSES, type TakeoverInput, type TranscriptBuilder, type TranscriptItem, type TransportStatus, type WebSocketTransportOptions, chatKey, createClaudeNormalizer, createCodexRolloutNormalizer, createCodexStreamNormalizer, createLineSplitter, createTranscriptBuilder, createWebSocketTransport, friendlyToolName, isSyntheticClaudeUserText, isTerminalRunStatus, parseJsonl, parseMcpToolName, stripCodexInjectedContext, toolSubtitle };
|
package/dist/index.js
CHANGED
|
@@ -593,6 +593,23 @@ import {
|
|
|
593
593
|
createChatMessage
|
|
594
594
|
} from "@ai-matrx/chat";
|
|
595
595
|
|
|
596
|
+
// src/provider-health.ts
|
|
597
|
+
var MODEL_UNAVAILABLE = [
|
|
598
|
+
/model is not supported when using codex/i,
|
|
599
|
+
/\bmodel[\s:'"`][^.\n]{0,80}\b(?:not supported|does not exist|not available|not found)\b/i,
|
|
600
|
+
/\bmodel_not_found\b/i,
|
|
601
|
+
/issue with the selected model/i,
|
|
602
|
+
/may not exist or you may not have access to it/i
|
|
603
|
+
];
|
|
604
|
+
var MODEL_UNAVAILABLE_LABEL = "Model not available on this account";
|
|
605
|
+
function isModelUnavailable(text) {
|
|
606
|
+
const trimmed = (text ?? "").trim();
|
|
607
|
+
return trimmed !== "" && MODEL_UNAVAILABLE.some((re) => re.test(trimmed));
|
|
608
|
+
}
|
|
609
|
+
function runErrorLabel(text) {
|
|
610
|
+
return isModelUnavailable(text) ? MODEL_UNAVAILABLE_LABEL : text;
|
|
611
|
+
}
|
|
612
|
+
|
|
596
613
|
// src/tool-labels.ts
|
|
597
614
|
var BUILTIN = {
|
|
598
615
|
Bash: "Run command",
|
|
@@ -847,14 +864,15 @@ function createTranscriptBuilder() {
|
|
|
847
864
|
}));
|
|
848
865
|
return;
|
|
849
866
|
case "error": {
|
|
850
|
-
const
|
|
867
|
+
const text = runErrorLabel(item.text);
|
|
868
|
+
const said = current?.message.parts.some((p) => p.type === "error" && p.message.trim() === text.trim());
|
|
851
869
|
if (said) return;
|
|
852
870
|
upsertPart(item.id, () => ({
|
|
853
871
|
type: "error",
|
|
854
872
|
errorType: "provider",
|
|
855
873
|
code: null,
|
|
856
|
-
message:
|
|
857
|
-
userMessage:
|
|
874
|
+
message: text,
|
|
875
|
+
userMessage: text,
|
|
858
876
|
recoverable: true,
|
|
859
877
|
remedy: null
|
|
860
878
|
}));
|