@ellipsis-dev/sdk 0.19.0 → 0.21.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/dist/index.d.ts +6 -63
- package/dist/index.js +4 -62
- package/dist/store/index.d.ts +30 -9
- package/dist/store/index.js +163 -1
- package/dist/stream/index.d.ts +1 -1
- package/dist/{types-D2YZTvgg.d.ts → types-DXHI6EPF.d.ts} +14 -541
- package/package.json +1 -1
- package/schema/frames.schema.json +3 -11
- package/schema/openapi.v1.json +10 -892
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as components } from './types-
|
|
2
|
-
export { A as AgentConfigSource, a as AttributionType, B as BudgetSource, C as ClaudeSessionRecord, b as CodexEvent, d as CodexItem, e as CodexSessionRecord, f as CreateReviewRequest, D as DeltaFrame, g as DoneFrame, E as ErrorFrame, F as Finding, G as GithubAccountSnippet, h as GithubAccountType, H as Harness, i as HeartbeatFrame, L as LifecycleSessionRecord, P as ParentKind, j as PromptBlockedReason, R as RecordsAppendFrame, k as ResolvedReviewScope, l as Review, m as ReviewConfiguration, n as ReviewCounters, o as ReviewFinding, p as ReviewRequester, q as ReviewScope, r as ReviewScopeKind, s as ReviewStage, t as ReviewedCommit, u as ReviewsListResponse, S as SdkAssistantRecord, v as SdkContentBlock, w as SdkRateLimitRecord, x as SdkRecord, y as SdkResultRecord, z as SdkSystemRecord, I as SdkUserRecord, J as SendSessionMessageRequest, K as Session, M as
|
|
1
|
+
import { c as components } from './types-DXHI6EPF.js';
|
|
2
|
+
export { A as AgentConfigSource, a as AttributionType, B as BudgetSource, C as ClaudeSessionRecord, b as CodexEvent, d as CodexItem, e as CodexSessionRecord, f as CreateReviewRequest, D as DeltaFrame, g as DoneFrame, E as ErrorFrame, F as Finding, G as GithubAccountSnippet, h as GithubAccountType, H as Harness, i as HeartbeatFrame, L as LifecycleSessionRecord, P as ParentKind, j as PromptBlockedReason, R as RecordsAppendFrame, k as ResolvedReviewScope, l as Review, m as ReviewConfiguration, n as ReviewCounters, o as ReviewFinding, p as ReviewRequester, q as ReviewScope, r as ReviewScopeKind, s as ReviewStage, t as ReviewedCommit, u as ReviewsListResponse, S as SdkAssistantRecord, v as SdkContentBlock, w as SdkRateLimitRecord, x as SdkRecord, y as SdkResultRecord, z as SdkSystemRecord, I as SdkUserRecord, J as SendSessionMessageRequest, K as Session, M as SessionExitStatus, N as SessionFrame, O as SessionGit, Q as SessionLiveness, T as SessionMessage, U as SessionMessageResponse, V as SessionMessageStatus, W as SessionPrompting, X as SessionRecord, Y as SessionRecordsListResponse, Z as SessionResponse, _ as SessionSource, $ as SessionState, a0 as SessionStatus, a1 as SessionStreamFrame, a2 as SessionSurface, a3 as SessionsListResponse, a4 as SnapshotFrame, a5 as StreamFrame, a6 as TokensInfo, a7 as paths } from './types-DXHI6EPF.js';
|
|
3
3
|
|
|
4
4
|
interface CursorResponse {
|
|
5
5
|
has_more: boolean;
|
|
@@ -409,7 +409,7 @@ declare class EllipsisIntegrationsGithub {
|
|
|
409
409
|
* List the GitHub organization roster.
|
|
410
410
|
*
|
|
411
411
|
* (Or the account itself for a personal workspace) — the universe of author_id values for
|
|
412
|
-
* /sessions
|
|
412
|
+
* /sessions.
|
|
413
413
|
*
|
|
414
414
|
* Members carry their linked Slack identity when a Slack-GitHub
|
|
415
415
|
* link exists, and /slack/members carries the reverse link.
|
|
@@ -553,23 +553,6 @@ declare class EllipsisMemories {
|
|
|
553
553
|
prefix?: string | null;
|
|
554
554
|
}): Promise<S['MemoriesListResponse']>;
|
|
555
555
|
}
|
|
556
|
-
declare class EllipsisModels {
|
|
557
|
-
private readonly transport;
|
|
558
|
-
constructor(transport: Transport);
|
|
559
|
-
/**
|
|
560
|
-
* List Supported Models
|
|
561
|
-
*
|
|
562
|
-
* List selectable agent models.
|
|
563
|
-
*
|
|
564
|
-
* Most expensive first, with the platform default flagged.
|
|
565
|
-
*
|
|
566
|
-
* Reads the same registry as the dashboard's rate table, so a
|
|
567
|
-
* client's model picker can never drift from what's offered.
|
|
568
|
-
* Behind auth but not account-scoped — the selectable set is
|
|
569
|
-
* global.
|
|
570
|
-
*/
|
|
571
|
-
list(): Promise<S['ModelsListResponse']>;
|
|
572
|
-
}
|
|
573
556
|
declare class EllipsisReviews {
|
|
574
557
|
private readonly transport;
|
|
575
558
|
constructor(transport: Transport);
|
|
@@ -665,19 +648,6 @@ declare class EllipsisSecrets {
|
|
|
665
648
|
declare class EllipsisSessions {
|
|
666
649
|
private readonly transport;
|
|
667
650
|
constructor(transport: Transport);
|
|
668
|
-
/**
|
|
669
|
-
* Get Agent Session Executions
|
|
670
|
-
*
|
|
671
|
-
* Return the session's executions and launch context.
|
|
672
|
-
*
|
|
673
|
-
* Most notably system_prompt_append, the text Ellipsis appends to
|
|
674
|
-
* Claude Code's default system prompt (platform section + response
|
|
675
|
-
* instructions + the config's own instructions).
|
|
676
|
-
*
|
|
677
|
-
* Per execution because each cold wake persists its own launch
|
|
678
|
-
* config (a config edit between wakes changes it).
|
|
679
|
-
*/
|
|
680
|
-
executions(session_id: string): Promise<S['SessionExecutionsListResponse']>;
|
|
681
651
|
/**
|
|
682
652
|
* Export Agent Session
|
|
683
653
|
*
|
|
@@ -760,40 +730,14 @@ declare class EllipsisSessions {
|
|
|
760
730
|
*
|
|
761
731
|
* Pagination is opt-in (cursor/limit); a bare call returns the
|
|
762
732
|
* full retained transcript. Available to sandbox tokens too: an
|
|
763
|
-
* agent answering "did X look into Y?" needs to read the
|
|
764
|
-
* it
|
|
765
|
-
*
|
|
733
|
+
* agent answering "did X look into Y?" needs to read the sessions
|
|
734
|
+
* it finds, and any org member sees the same transcript in the
|
|
735
|
+
* dashboard.
|
|
766
736
|
*/
|
|
767
737
|
records(session_id: string, options?: {
|
|
768
738
|
cursor?: string | null;
|
|
769
739
|
limit?: number | null;
|
|
770
740
|
}): Promise<Page<S['ClaudeSessionRecord'] | S['CodexSessionRecord'] | S['LifecycleSessionRecord'], S['SessionRecordsListResponse']>>;
|
|
771
|
-
/**
|
|
772
|
-
* Search Agent Sessions
|
|
773
|
-
*
|
|
774
|
-
* Search sessions over steps, recaps, and pull requests.
|
|
775
|
-
*
|
|
776
|
-
* Grouped by session, over everything a session left behind: step text, recap text, created
|
|
777
|
-
* PRs, and recap-embedding similarity.
|
|
778
|
-
*
|
|
779
|
-
* This is how an agent answers "did Tony look into X?": resolve
|
|
780
|
-
* the author via /github/members, search, then read the winning
|
|
781
|
-
* session via /sessions/{id} (recap) and /sessions/{id}/records
|
|
782
|
-
* (transcript).
|
|
783
|
-
*/
|
|
784
|
-
search(options?: {
|
|
785
|
-
q?: string;
|
|
786
|
-
scope?: S['SessionSearchScope'];
|
|
787
|
-
source?: (S['SessionSource'])[] | null;
|
|
788
|
-
author_id?: (number)[] | null;
|
|
789
|
-
config_id?: (string)[] | null;
|
|
790
|
-
session_ids?: (string)[] | null;
|
|
791
|
-
repo?: string | null;
|
|
792
|
-
status?: (S['SessionStatus'])[] | null;
|
|
793
|
-
start?: string | null;
|
|
794
|
-
end?: string | null;
|
|
795
|
-
limit?: number;
|
|
796
|
-
}): Promise<S['SessionSearchResponse']>;
|
|
797
741
|
/**
|
|
798
742
|
* Send Agent Session Message
|
|
799
743
|
*
|
|
@@ -915,7 +859,6 @@ declare class Ellipsis {
|
|
|
915
859
|
readonly files: EllipsisFiles;
|
|
916
860
|
readonly integrations: EllipsisIntegrations;
|
|
917
861
|
readonly memories: EllipsisMemories;
|
|
918
|
-
readonly models: EllipsisModels;
|
|
919
862
|
readonly reviews: EllipsisReviews;
|
|
920
863
|
readonly secrets: EllipsisSecrets;
|
|
921
864
|
readonly sessions: EllipsisSessions;
|
package/dist/index.js
CHANGED
|
@@ -642,7 +642,7 @@ var EllipsisIntegrationsGithub = class {
|
|
|
642
642
|
* List the GitHub organization roster.
|
|
643
643
|
*
|
|
644
644
|
* (Or the account itself for a personal workspace) — the universe of author_id values for
|
|
645
|
-
* /sessions
|
|
645
|
+
* /sessions.
|
|
646
646
|
*
|
|
647
647
|
* Members carry their linked Slack identity when a Slack-GitHub
|
|
648
648
|
* link exists, and /slack/members carries the reverse link.
|
|
@@ -828,28 +828,6 @@ var EllipsisMemories = class {
|
|
|
828
828
|
return await this.transport.request("GET", path, { query });
|
|
829
829
|
}
|
|
830
830
|
};
|
|
831
|
-
var EllipsisModels = class {
|
|
832
|
-
constructor(transport) {
|
|
833
|
-
this.transport = transport;
|
|
834
|
-
}
|
|
835
|
-
transport;
|
|
836
|
-
/**
|
|
837
|
-
* List Supported Models
|
|
838
|
-
*
|
|
839
|
-
* List selectable agent models.
|
|
840
|
-
*
|
|
841
|
-
* Most expensive first, with the platform default flagged.
|
|
842
|
-
*
|
|
843
|
-
* Reads the same registry as the dashboard's rate table, so a
|
|
844
|
-
* client's model picker can never drift from what's offered.
|
|
845
|
-
* Behind auth but not account-scoped — the selectable set is
|
|
846
|
-
* global.
|
|
847
|
-
*/
|
|
848
|
-
async list() {
|
|
849
|
-
const path = "/v1/models";
|
|
850
|
-
return await this.transport.request("GET", path);
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
831
|
var EllipsisReviews = class {
|
|
854
832
|
constructor(transport) {
|
|
855
833
|
this.transport = transport;
|
|
@@ -962,22 +940,6 @@ var EllipsisSessions = class {
|
|
|
962
940
|
this.transport = transport;
|
|
963
941
|
}
|
|
964
942
|
transport;
|
|
965
|
-
/**
|
|
966
|
-
* Get Agent Session Executions
|
|
967
|
-
*
|
|
968
|
-
* Return the session's executions and launch context.
|
|
969
|
-
*
|
|
970
|
-
* Most notably system_prompt_append, the text Ellipsis appends to
|
|
971
|
-
* Claude Code's default system prompt (platform section + response
|
|
972
|
-
* instructions + the config's own instructions).
|
|
973
|
-
*
|
|
974
|
-
* Per execution because each cold wake persists its own launch
|
|
975
|
-
* config (a config edit between wakes changes it).
|
|
976
|
-
*/
|
|
977
|
-
async executions(session_id) {
|
|
978
|
-
const path = `/v1/sessions/${enc(session_id)}/executions`;
|
|
979
|
-
return await this.transport.request("GET", path);
|
|
980
|
-
}
|
|
981
943
|
/**
|
|
982
944
|
* Export Agent Session
|
|
983
945
|
*
|
|
@@ -1068,9 +1030,9 @@ var EllipsisSessions = class {
|
|
|
1068
1030
|
*
|
|
1069
1031
|
* Pagination is opt-in (cursor/limit); a bare call returns the
|
|
1070
1032
|
* full retained transcript. Available to sandbox tokens too: an
|
|
1071
|
-
* agent answering "did X look into Y?" needs to read the
|
|
1072
|
-
* it
|
|
1073
|
-
*
|
|
1033
|
+
* agent answering "did X look into Y?" needs to read the sessions
|
|
1034
|
+
* it finds, and any org member sees the same transcript in the
|
|
1035
|
+
* dashboard.
|
|
1074
1036
|
*/
|
|
1075
1037
|
async records(session_id, options = {}) {
|
|
1076
1038
|
const path = `/v1/sessions/${enc(session_id)}/records`;
|
|
@@ -1082,24 +1044,6 @@ var EllipsisSessions = class {
|
|
|
1082
1044
|
(cursor) => this.records(session_id, { ...options, cursor })
|
|
1083
1045
|
);
|
|
1084
1046
|
}
|
|
1085
|
-
/**
|
|
1086
|
-
* Search Agent Sessions
|
|
1087
|
-
*
|
|
1088
|
-
* Search sessions over steps, recaps, and pull requests.
|
|
1089
|
-
*
|
|
1090
|
-
* Grouped by session, over everything a session left behind: step text, recap text, created
|
|
1091
|
-
* PRs, and recap-embedding similarity.
|
|
1092
|
-
*
|
|
1093
|
-
* This is how an agent answers "did Tony look into X?": resolve
|
|
1094
|
-
* the author via /github/members, search, then read the winning
|
|
1095
|
-
* session via /sessions/{id} (recap) and /sessions/{id}/records
|
|
1096
|
-
* (transcript).
|
|
1097
|
-
*/
|
|
1098
|
-
async search(options = {}) {
|
|
1099
|
-
const path = "/v1/sessions/search";
|
|
1100
|
-
const query = buildQuery({ q: options.q, scope: options.scope, source: options.source, author_id: options.author_id, config_id: options.config_id, session_ids: options.session_ids, repo: options.repo, status: options.status, start: options.start, end: options.end, limit: options.limit });
|
|
1101
|
-
return await this.transport.request("GET", path, { query });
|
|
1102
|
-
}
|
|
1103
1047
|
/**
|
|
1104
1048
|
* Send Agent Session Message
|
|
1105
1049
|
*
|
|
@@ -1240,7 +1184,6 @@ var Ellipsis = class {
|
|
|
1240
1184
|
files;
|
|
1241
1185
|
integrations;
|
|
1242
1186
|
memories;
|
|
1243
|
-
models;
|
|
1244
1187
|
reviews;
|
|
1245
1188
|
secrets;
|
|
1246
1189
|
sessions;
|
|
@@ -1256,7 +1199,6 @@ var Ellipsis = class {
|
|
|
1256
1199
|
this.files = new EllipsisFiles(this.transport);
|
|
1257
1200
|
this.integrations = new EllipsisIntegrations(this.transport);
|
|
1258
1201
|
this.memories = new EllipsisMemories(this.transport);
|
|
1259
|
-
this.models = new EllipsisModels(this.transport);
|
|
1260
1202
|
this.reviews = new EllipsisReviews(this.transport);
|
|
1261
1203
|
this.secrets = new EllipsisSecrets(this.transport);
|
|
1262
1204
|
this.sessions = new EllipsisSessions(this.transport);
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X as SessionRecord, a8 as CodexFileChangeItem, b as CodexEvent, a9 as CodexMcpToolCallItem, x as SdkRecord, K as Session, T as SessionMessage, a5 as StreamFrame } from '../types-DXHI6EPF.js';
|
|
2
2
|
|
|
3
3
|
interface ChatToolNode {
|
|
4
4
|
key: string;
|
|
@@ -82,13 +82,6 @@ declare function deriveSandboxState(records: readonly RecordSlice[], minFeedSeq:
|
|
|
82
82
|
declare function sandboxSummary(sandbox: SandboxState | null): string;
|
|
83
83
|
declare function lastLines(log: readonly SandboxLogLine[], max: number): SandboxLogLine[];
|
|
84
84
|
|
|
85
|
-
declare function sandboxOutputStep(payload: Record<string, unknown>): string;
|
|
86
|
-
declare function sandboxOutputLines(payload: Record<string, unknown>): string[];
|
|
87
|
-
declare function sandboxOutputLine(payload: Record<string, unknown>): string | null;
|
|
88
|
-
declare function cacheTierLabel(tier: unknown): string | null;
|
|
89
|
-
declare function sandboxPhaseLabel(phase: unknown): string;
|
|
90
|
-
declare function lifecycleText(recordType: string, payload: Record<string, unknown>): string | null;
|
|
91
|
-
|
|
92
85
|
type ItemKind = 'assistant' | 'thinking' | 'tool' | 'tool_result' | 'summary' | 'system' | 'user' | 'notice' | 'error';
|
|
93
86
|
interface TranscriptItem {
|
|
94
87
|
key: string;
|
|
@@ -129,6 +122,34 @@ declare function foldCosts(events: SdkRecord[]): {
|
|
|
129
122
|
};
|
|
130
123
|
declare function statusActivityText(status: string): string | null;
|
|
131
124
|
|
|
125
|
+
declare const LIVE_GLYPH = "\u23FA";
|
|
126
|
+
declare const USER_BAR = "\u2503";
|
|
127
|
+
declare const BRANCH_GLYPH = "\u23BF";
|
|
128
|
+
declare function gutterFor(item: TranscriptItem): string;
|
|
129
|
+
declare function chatTurnsToItems(turns: readonly ChatTurn[]): TranscriptItem[];
|
|
130
|
+
declare function isToolFold(item: TranscriptItem): boolean;
|
|
131
|
+
declare function isToolActivity(item: TranscriptItem): boolean;
|
|
132
|
+
declare function isAgentSpeech(item: TranscriptItem): boolean;
|
|
133
|
+
type PlacedItem = {
|
|
134
|
+
item: TranscriptItem;
|
|
135
|
+
nested: boolean;
|
|
136
|
+
attach: boolean;
|
|
137
|
+
};
|
|
138
|
+
declare function layOutItems(items: readonly TranscriptItem[]): PlacedItem[];
|
|
139
|
+
declare function foldGutter(nested: boolean): string;
|
|
140
|
+
declare function tailLines(text: string, maxLines: number): {
|
|
141
|
+
body: string;
|
|
142
|
+
hidden: number;
|
|
143
|
+
};
|
|
144
|
+
declare function toolRunMembers(items: readonly TranscriptItem[]): Map<string, TranscriptItem[]>;
|
|
145
|
+
|
|
146
|
+
declare function sandboxOutputStep(payload: Record<string, unknown>): string;
|
|
147
|
+
declare function sandboxOutputLines(payload: Record<string, unknown>): string[];
|
|
148
|
+
declare function sandboxOutputLine(payload: Record<string, unknown>): string | null;
|
|
149
|
+
declare function cacheTierLabel(tier: unknown): string | null;
|
|
150
|
+
declare function sandboxPhaseLabel(phase: unknown): string;
|
|
151
|
+
declare function lifecycleText(recordType: string, payload: Record<string, unknown>): string | null;
|
|
152
|
+
|
|
132
153
|
declare function isConversationOver(session: Session): boolean;
|
|
133
154
|
interface SessionTranscriptSnapshot {
|
|
134
155
|
session: Session | null;
|
|
@@ -165,4 +186,4 @@ declare class SessionTranscriptStore {
|
|
|
165
186
|
ingest: (rawFrame: StreamFrame) => void;
|
|
166
187
|
}
|
|
167
188
|
|
|
168
|
-
export { type ChatNode, type ChatToolNode, type ChatTurn, type EventToItemsOptions, type ItemKind, type RecordSlice, type SandboxLogKind, type SandboxLogLine, type SandboxState, type SessionTranscriptSnapshot, SessionTranscriptStore, StreamFrame, type TranscriptItem, awaitingAgentPhase, cacheTierLabel, clampLines, codexChangedPaths, codexEventToItems, codexMcpToolName, collapseToolRuns, deliveredUnechoedSends, deriveSandboxState, emptySessionTranscriptSnapshot, eventToItems, foldCosts, formatDuration, groupRecordsToChatTurns, hookPhrase, humanDuration, isConnectVisibleRecord, isConversationOver, lastLines, lifecycleText, oneLine, pendingToolCalls, recordSlice, recordToItems, resultCostUsd, sandboxOutputLine, sandboxOutputLines, sandboxOutputStep, sandboxPhaseLabel, sandboxSummary, seedTranscriptStore, sessionLogText, statusActivityText, summarizeToolInput, toolResultText };
|
|
189
|
+
export { BRANCH_GLYPH, type ChatNode, type ChatToolNode, type ChatTurn, type EventToItemsOptions, type ItemKind, LIVE_GLYPH, type PlacedItem, type RecordSlice, type SandboxLogKind, type SandboxLogLine, type SandboxState, type SessionTranscriptSnapshot, SessionTranscriptStore, StreamFrame, type TranscriptItem, USER_BAR, awaitingAgentPhase, cacheTierLabel, chatTurnsToItems, clampLines, codexChangedPaths, codexEventToItems, codexMcpToolName, collapseToolRuns, deliveredUnechoedSends, deriveSandboxState, emptySessionTranscriptSnapshot, eventToItems, foldCosts, foldGutter, formatDuration, groupRecordsToChatTurns, gutterFor, hookPhrase, humanDuration, isAgentSpeech, isConnectVisibleRecord, isConversationOver, isToolActivity, isToolFold, lastLines, layOutItems, lifecycleText, oneLine, pendingToolCalls, recordSlice, recordToItems, resultCostUsd, sandboxOutputLine, sandboxOutputLines, sandboxOutputStep, sandboxPhaseLabel, sandboxSummary, seedTranscriptStore, sessionLogText, statusActivityText, summarizeToolInput, tailLines, toolResultText, toolRunMembers };
|
package/dist/store/index.js
CHANGED
|
@@ -1062,6 +1062,156 @@ function lastLines(log, max) {
|
|
|
1062
1062
|
return log.length <= max ? [...log] : log.slice(log.length - max);
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
|
+
// src/store/layout.ts
|
|
1066
|
+
var LIVE_GLYPH = "\u23FA";
|
|
1067
|
+
var USER_BAR = "\u2503";
|
|
1068
|
+
var BRANCH_GLYPH = "\u23BF";
|
|
1069
|
+
function gutterFor(item) {
|
|
1070
|
+
if (item.kind === "user") return USER_BAR;
|
|
1071
|
+
if (item.kind === "assistant") return "\u25CF";
|
|
1072
|
+
if (item.kind === "system" || item.kind === "notice") return "\u2726";
|
|
1073
|
+
return item.gutter ?? "";
|
|
1074
|
+
}
|
|
1075
|
+
var SANDBOX_RECORD_TYPES2 = /* @__PURE__ */ new Set([
|
|
1076
|
+
"sandbox_starting",
|
|
1077
|
+
"sandbox_phase",
|
|
1078
|
+
"sandbox_output",
|
|
1079
|
+
"sandbox_ready"
|
|
1080
|
+
]);
|
|
1081
|
+
function chatTurnsToItems(turns) {
|
|
1082
|
+
const items = [];
|
|
1083
|
+
let wakeAt = -1;
|
|
1084
|
+
for (const turn of turns) {
|
|
1085
|
+
if (turn.role === "lifecycle") {
|
|
1086
|
+
for (const node of turn.nodes) {
|
|
1087
|
+
if (node.kind !== "lifecycle") continue;
|
|
1088
|
+
if (SANDBOX_RECORD_TYPES2.has(node.recordType)) continue;
|
|
1089
|
+
if (node.recordType === "session_resumed" && wakeAt >= 0) {
|
|
1090
|
+
items[wakeAt] = { ...items[wakeAt], text: "Session awake" };
|
|
1091
|
+
wakeAt = -1;
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
const text = sessionLogText(node.recordType, node.payload ?? {});
|
|
1095
|
+
if (!text) continue;
|
|
1096
|
+
items.push({ key: node.key, kind: "notice", text, spaceBefore: true });
|
|
1097
|
+
wakeAt = text === "Waking the session\u2026" ? items.length - 1 : -1;
|
|
1098
|
+
}
|
|
1099
|
+
continue;
|
|
1100
|
+
}
|
|
1101
|
+
if (turn.role === "user") {
|
|
1102
|
+
for (const node of turn.nodes) {
|
|
1103
|
+
if (node.kind === "user") {
|
|
1104
|
+
items.push({
|
|
1105
|
+
key: node.key,
|
|
1106
|
+
kind: "user",
|
|
1107
|
+
text: node.text,
|
|
1108
|
+
spaceBefore: true
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
continue;
|
|
1113
|
+
}
|
|
1114
|
+
for (const node of turn.nodes) {
|
|
1115
|
+
if (node.kind === "assistant") {
|
|
1116
|
+
items.push({
|
|
1117
|
+
key: node.key,
|
|
1118
|
+
kind: "assistant",
|
|
1119
|
+
text: node.text,
|
|
1120
|
+
spaceBefore: true
|
|
1121
|
+
});
|
|
1122
|
+
} else if (node.kind === "thinking") {
|
|
1123
|
+
items.push({
|
|
1124
|
+
key: node.key,
|
|
1125
|
+
kind: "thinking",
|
|
1126
|
+
gutter: "\u273B",
|
|
1127
|
+
text: node.text,
|
|
1128
|
+
spaceBefore: true
|
|
1129
|
+
});
|
|
1130
|
+
} else if (node.kind === "tool") {
|
|
1131
|
+
const orphan = node.name === "tool" && node.input === null && node.startedAt === null;
|
|
1132
|
+
if (!orphan) {
|
|
1133
|
+
items.push({
|
|
1134
|
+
key: node.key,
|
|
1135
|
+
kind: "tool",
|
|
1136
|
+
gutter: "\u25CF",
|
|
1137
|
+
text: node.name,
|
|
1138
|
+
detail: node.summary ? `(${node.summary})` : void 0,
|
|
1139
|
+
spaceBefore: true,
|
|
1140
|
+
tool: { name: node.name, input: node.input ?? void 0 }
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
if (node.result !== null) {
|
|
1144
|
+
items.push({
|
|
1145
|
+
key: `${node.key}:r`,
|
|
1146
|
+
kind: "tool_result",
|
|
1147
|
+
gutter: BRANCH_GLYPH,
|
|
1148
|
+
text: node.result || "(no output)",
|
|
1149
|
+
spaceBefore: false,
|
|
1150
|
+
isError: node.isError || void 0
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
if (turn.isError) {
|
|
1156
|
+
items.push({
|
|
1157
|
+
key: `${turn.key}:err`,
|
|
1158
|
+
kind: "summary",
|
|
1159
|
+
text: "turn ended with an error",
|
|
1160
|
+
spaceBefore: true,
|
|
1161
|
+
isError: true
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
return items;
|
|
1166
|
+
}
|
|
1167
|
+
function isToolFold(item) {
|
|
1168
|
+
return item.key.startsWith("grp:");
|
|
1169
|
+
}
|
|
1170
|
+
function isToolActivity(item) {
|
|
1171
|
+
return item.kind === "tool" || item.kind === "tool_result" || isToolFold(item);
|
|
1172
|
+
}
|
|
1173
|
+
function isAgentSpeech(item) {
|
|
1174
|
+
return item.kind === "assistant" || item.kind === "thinking";
|
|
1175
|
+
}
|
|
1176
|
+
function layOutItems(items) {
|
|
1177
|
+
const out = [];
|
|
1178
|
+
let nestUnder = false;
|
|
1179
|
+
for (const item of items) {
|
|
1180
|
+
if (!isToolActivity(item)) {
|
|
1181
|
+
out.push({ item, nested: false, attach: false });
|
|
1182
|
+
nestUnder = isAgentSpeech(item);
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
out.push({ item, nested: nestUnder, attach: nestUnder });
|
|
1186
|
+
}
|
|
1187
|
+
return out;
|
|
1188
|
+
}
|
|
1189
|
+
function foldGutter(nested) {
|
|
1190
|
+
return nested ? BRANCH_GLYPH : "\u25CF";
|
|
1191
|
+
}
|
|
1192
|
+
function tailLines(text, maxLines) {
|
|
1193
|
+
const lines = text.split("\n");
|
|
1194
|
+
if (lines.length <= maxLines) return { body: text, hidden: 0 };
|
|
1195
|
+
return {
|
|
1196
|
+
body: lines.slice(lines.length - maxLines).join("\n"),
|
|
1197
|
+
hidden: lines.length - maxLines
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function toolRunMembers(items) {
|
|
1201
|
+
const out = /* @__PURE__ */ new Map();
|
|
1202
|
+
let group = [];
|
|
1203
|
+
const flush = () => {
|
|
1204
|
+
if (group.length > 0) out.set(`grp:${group[0].key}`, group);
|
|
1205
|
+
group = [];
|
|
1206
|
+
};
|
|
1207
|
+
for (const item of items) {
|
|
1208
|
+
if (item.kind === "tool" || item.kind === "tool_result") group.push(item);
|
|
1209
|
+
else flush();
|
|
1210
|
+
}
|
|
1211
|
+
flush();
|
|
1212
|
+
return out;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1065
1215
|
// src/store/index.ts
|
|
1066
1216
|
var TERMINAL_SESSION_STATUSES = /* @__PURE__ */ new Set([
|
|
1067
1217
|
"completed",
|
|
@@ -1266,9 +1416,13 @@ var SessionTranscriptStore = class {
|
|
|
1266
1416
|
};
|
|
1267
1417
|
};
|
|
1268
1418
|
export {
|
|
1419
|
+
BRANCH_GLYPH,
|
|
1420
|
+
LIVE_GLYPH,
|
|
1269
1421
|
SessionTranscriptStore,
|
|
1422
|
+
USER_BAR,
|
|
1270
1423
|
awaitingAgentPhase,
|
|
1271
1424
|
cacheTierLabel,
|
|
1425
|
+
chatTurnsToItems,
|
|
1272
1426
|
clampLines,
|
|
1273
1427
|
codexChangedPaths,
|
|
1274
1428
|
codexEventToItems,
|
|
@@ -1279,13 +1433,19 @@ export {
|
|
|
1279
1433
|
emptySessionTranscriptSnapshot,
|
|
1280
1434
|
eventToItems,
|
|
1281
1435
|
foldCosts,
|
|
1436
|
+
foldGutter,
|
|
1282
1437
|
formatDuration,
|
|
1283
1438
|
groupRecordsToChatTurns,
|
|
1439
|
+
gutterFor,
|
|
1284
1440
|
hookPhrase,
|
|
1285
1441
|
humanDuration,
|
|
1442
|
+
isAgentSpeech,
|
|
1286
1443
|
isConnectVisibleRecord,
|
|
1287
1444
|
isConversationOver,
|
|
1445
|
+
isToolActivity,
|
|
1446
|
+
isToolFold,
|
|
1288
1447
|
lastLines,
|
|
1448
|
+
layOutItems,
|
|
1289
1449
|
lifecycleText,
|
|
1290
1450
|
oneLine,
|
|
1291
1451
|
pendingToolCalls,
|
|
@@ -1301,5 +1461,7 @@ export {
|
|
|
1301
1461
|
sessionLogText,
|
|
1302
1462
|
statusActivityText,
|
|
1303
1463
|
summarizeToolInput,
|
|
1304
|
-
|
|
1464
|
+
tailLines,
|
|
1465
|
+
toolResultText,
|
|
1466
|
+
toolRunMembers
|
|
1305
1467
|
};
|
package/dist/stream/index.d.ts
CHANGED