praxis-agent 0.34.0 → 0.35.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/README.md +4 -0
- package/dist/application/session-service.d.ts +0 -1
- package/dist/application/session-service.js +1619 -1617
- package/dist/application/subagent-service.js +27 -16
- package/dist/application/turn-lifecycle.d.ts +38 -0
- package/dist/application/turn-lifecycle.js +36 -0
- package/dist/cli/interactive.js +17 -7
- package/dist/cli/protocol.js +5 -2
- package/dist/cli/tui/claude-style.d.ts +5 -48
- package/dist/cli/tui/claude-style.js +19 -73
- package/dist/cli/tui/transcript-presentation.d.ts +89 -0
- package/dist/cli/tui/transcript-presentation.js +169 -0
- package/dist/cli/tui/transcript-viewport.d.ts +5 -34
- package/dist/cli/tui/transcript-viewport.js +639 -158
- package/dist/cli/tui/tui-view-model.d.ts +6 -2
- package/dist/cli/tui/tui-view-model.js +23 -6
- package/dist/compatibility/claude/context.d.ts +2 -2
- package/dist/compatibility/claude/context.js +2 -14
- package/dist/compatibility/claude/data-plane-adapter.d.ts +9 -0
- package/dist/compatibility/claude/data-plane-adapter.js +44 -0
- package/dist/compatibility/claude/paths.js +2 -2
- package/dist/compatibility/claude/shared-resources.d.ts +7 -38
- package/dist/compatibility/claude/transcript-codec.d.ts +21 -0
- package/dist/compatibility/claude/transcript-codec.js +512 -0
- package/dist/core/context.d.ts +25 -7
- package/dist/core/context.js +46 -0
- package/dist/core/prompt-composer.d.ts +8 -16
- package/dist/core/prompt-composer.js +65 -25
- package/dist/core/resources.d.ts +39 -0
- package/dist/core/resources.js +2 -0
- package/dist/core/runtime.d.ts +1 -1
- package/dist/core/session.d.ts +2 -0
- package/dist/core/session.js +5 -0
- package/dist/core/transcript-codec.d.ts +70 -0
- package/dist/core/transcript-codec.js +60 -0
- package/dist/core/transcript-event.d.ts +33 -0
- package/dist/core/transcript-event.js +198 -0
- package/dist/persistence/data-plane-adapter.d.ts +32 -0
- package/dist/persistence/data-plane-adapter.js +2 -0
- package/dist/persistence/data-plane.d.ts +4 -20
- package/dist/persistence/data-plane.js +10 -47
- package/dist/persistence/native-data-plane-adapter.d.ts +9 -0
- package/dist/persistence/native-data-plane-adapter.js +39 -0
- package/dist/persistence/native-resources.d.ts +4 -4
- package/dist/persistence/native-transcript-codec.d.ts +13 -0
- package/dist/persistence/native-transcript-codec.js +102 -0
- package/dist/tools/claude-user-message.d.ts +0 -1
- package/dist/tools/claude-user-message.js +0 -1
- package/package.json +6 -2
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
function pairResults(items) {
|
|
2
|
+
const toolResults = new Map();
|
|
3
|
+
const toolResultIndexes = new Map();
|
|
4
|
+
const toolCallIndexesByResult = new Map();
|
|
5
|
+
const pairedToolResultIndexes = new Set();
|
|
6
|
+
const shellResults = new Map();
|
|
7
|
+
const shellResultIndexes = new Map();
|
|
8
|
+
const pairedShellResultIndexes = new Set();
|
|
9
|
+
const pendingTools = new Map();
|
|
10
|
+
const pendingShells = new Map();
|
|
11
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
12
|
+
const item = items[index];
|
|
13
|
+
if (!item)
|
|
14
|
+
continue;
|
|
15
|
+
if (item.kind === 'tool') {
|
|
16
|
+
const pending = pendingTools.get(item.call.id) ?? { indexes: [], next: 0 };
|
|
17
|
+
pending.indexes.push(index);
|
|
18
|
+
pendingTools.set(item.call.id, pending);
|
|
19
|
+
}
|
|
20
|
+
else if (item.kind === 'tool-result') {
|
|
21
|
+
const pending = pendingTools.get(item.callId);
|
|
22
|
+
const callIndex = pending?.indexes[pending.next];
|
|
23
|
+
if (pending && callIndex !== undefined) {
|
|
24
|
+
pending.next += 1;
|
|
25
|
+
toolResults.set(callIndex, item);
|
|
26
|
+
toolResultIndexes.set(callIndex, index);
|
|
27
|
+
toolCallIndexesByResult.set(index, callIndex);
|
|
28
|
+
pairedToolResultIndexes.add(index);
|
|
29
|
+
}
|
|
30
|
+
if (pending && pending.next === pending.indexes.length) {
|
|
31
|
+
pendingTools.delete(item.callId);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (item.kind === 'shell') {
|
|
35
|
+
const pending = pendingShells.get(item.callId) ?? { indexes: [], next: 0 };
|
|
36
|
+
pending.indexes.push(index);
|
|
37
|
+
pendingShells.set(item.callId, pending);
|
|
38
|
+
}
|
|
39
|
+
else if (item.kind === 'shell-result') {
|
|
40
|
+
const pending = pendingShells.get(item.callId);
|
|
41
|
+
const callIndex = pending?.indexes[pending.next];
|
|
42
|
+
if (pending && callIndex !== undefined) {
|
|
43
|
+
pending.next += 1;
|
|
44
|
+
shellResults.set(callIndex, item);
|
|
45
|
+
shellResultIndexes.set(callIndex, index);
|
|
46
|
+
pairedShellResultIndexes.add(index);
|
|
47
|
+
}
|
|
48
|
+
if (pending && pending.next === pending.indexes.length) {
|
|
49
|
+
pendingShells.delete(item.callId);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
toolResults,
|
|
55
|
+
toolResultIndexes,
|
|
56
|
+
toolCallIndexesByResult,
|
|
57
|
+
pairedToolResultIndexes,
|
|
58
|
+
shellResults,
|
|
59
|
+
shellResultIndexes,
|
|
60
|
+
pairedShellResultIndexes,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function readSummaryCount(items, start, pairing, cache) {
|
|
64
|
+
if (cache.has(start))
|
|
65
|
+
return cache.get(start);
|
|
66
|
+
const reads = [];
|
|
67
|
+
const readIndexes = new Set();
|
|
68
|
+
let cursor = start;
|
|
69
|
+
const failed = () => {
|
|
70
|
+
for (const readIndex of reads)
|
|
71
|
+
cache.set(readIndex, undefined);
|
|
72
|
+
return undefined;
|
|
73
|
+
};
|
|
74
|
+
while (cursor < items.length) {
|
|
75
|
+
const item = items[cursor];
|
|
76
|
+
if (item?.kind === 'tool' && item.call.name === 'Read') {
|
|
77
|
+
reads.push(cursor);
|
|
78
|
+
readIndexes.add(cursor);
|
|
79
|
+
cursor += 1;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (item?.kind === 'tool-result' &&
|
|
83
|
+
pairing.toolCallIndexesByResult.has(cursor) &&
|
|
84
|
+
readIndexes.has(pairing.toolCallIndexesByResult.get(cursor) ?? -1)) {
|
|
85
|
+
if (item.isError)
|
|
86
|
+
return failed();
|
|
87
|
+
cursor += 1;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (reads.length === 0 ||
|
|
93
|
+
reads.some((index) => {
|
|
94
|
+
const resultIndex = pairing.toolResultIndexes.get(index);
|
|
95
|
+
return resultIndex === undefined || resultIndex >= cursor;
|
|
96
|
+
})) {
|
|
97
|
+
return failed();
|
|
98
|
+
}
|
|
99
|
+
const summary = { count: reads.length, end: cursor };
|
|
100
|
+
cache.set(start, summary);
|
|
101
|
+
return summary;
|
|
102
|
+
}
|
|
103
|
+
export function projectTranscriptPresentation(items, mode) {
|
|
104
|
+
const pairing = pairResults(items);
|
|
105
|
+
const entries = [];
|
|
106
|
+
const readSummaryCache = new Map();
|
|
107
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
108
|
+
const item = items[index];
|
|
109
|
+
if (!item)
|
|
110
|
+
continue;
|
|
111
|
+
if (mode === 'normal' &&
|
|
112
|
+
item.kind === 'tool' &&
|
|
113
|
+
item.call.name === 'Read') {
|
|
114
|
+
const summary = readSummaryCount(items, index, pairing, readSummaryCache);
|
|
115
|
+
if (summary) {
|
|
116
|
+
entries.push({
|
|
117
|
+
kind: 'read-summary',
|
|
118
|
+
key: `read-summary-${index}`,
|
|
119
|
+
count: summary.count,
|
|
120
|
+
});
|
|
121
|
+
index = summary.end - 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (item.kind === 'tool') {
|
|
126
|
+
const result = pairing.toolResults.get(index);
|
|
127
|
+
entries.push({
|
|
128
|
+
kind: 'tool',
|
|
129
|
+
key: `tool-${index}-${item.call.id}`,
|
|
130
|
+
item,
|
|
131
|
+
...(result ? { result } : {}),
|
|
132
|
+
});
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (item.kind === 'tool-result') {
|
|
136
|
+
if (pairing.pairedToolResultIndexes.has(index))
|
|
137
|
+
continue;
|
|
138
|
+
entries.push({
|
|
139
|
+
kind: 'orphan-tool-result',
|
|
140
|
+
key: `tool-result-${index}`,
|
|
141
|
+
item,
|
|
142
|
+
});
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (item.kind === 'shell') {
|
|
146
|
+
const result = pairing.shellResults.get(index);
|
|
147
|
+
entries.push({
|
|
148
|
+
kind: 'shell',
|
|
149
|
+
key: `shell-${index}-${item.callId}`,
|
|
150
|
+
item,
|
|
151
|
+
...(result ? { result } : {}),
|
|
152
|
+
});
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (item.kind === 'shell-result') {
|
|
156
|
+
if (pairing.pairedShellResultIndexes.has(index))
|
|
157
|
+
continue;
|
|
158
|
+
entries.push({
|
|
159
|
+
kind: 'orphan-shell-result',
|
|
160
|
+
key: `shell-result-${index}`,
|
|
161
|
+
item,
|
|
162
|
+
});
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
entries.push({ kind: 'item', key: `item-${index}`, item });
|
|
166
|
+
}
|
|
167
|
+
return entries;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=transcript-presentation.js.map
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
* Rows reserved outside the shrinkable fullscreen transcript region: the top
|
|
4
|
-
* identity chrome, the composer separator/prompt/footer, and the status line,
|
|
5
|
-
* plus a small headroom so the active streaming tail stays visible below the
|
|
6
|
-
* projected history suffix. Fullscreen computes the transcript budget as
|
|
7
|
-
* `rows - FULLSCREEN_TRANSCRIPT_RESERVED_ROWS`.
|
|
8
|
-
*/
|
|
1
|
+
import type { TranscriptPresentationEntry, TranscriptPresentationMode } from './transcript-presentation.js';
|
|
9
2
|
export declare const FULLSCREEN_TRANSCRIPT_RESERVED_ROWS = 12;
|
|
10
|
-
/**
|
|
11
|
-
* Compact marker prepended to the projected tail of an oversized newest item so
|
|
12
|
-
* the truncation is visually explicit while the newest lines remain visible.
|
|
13
|
-
*/
|
|
14
3
|
export declare const TRANSCRIPT_TRUNCATION_MARKER = "\u2026";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* rather than dropping items that would actually render.
|
|
20
|
-
*/
|
|
21
|
-
export declare function estimateTranscriptLines(item: TranscriptItem, width: number): number;
|
|
22
|
-
export declare function transcriptLineCount(items: readonly TranscriptItem[], width: number): number;
|
|
23
|
-
/**
|
|
24
|
-
* Pure, deterministic suffix projector for the fullscreen transcript region.
|
|
25
|
-
*
|
|
26
|
-
* Given transcript items, a terminal row budget, and the usable width, it
|
|
27
|
-
* returns the longest suffix of items whose conservative line estimate fits
|
|
28
|
-
* the budget. The newest user/assistant content is always retained; if even
|
|
29
|
-
* the newest item exceeds the budget, that item is projected as a bounded tail
|
|
30
|
-
* clone rather than rendering an empty transcript (or clipping the tail below
|
|
31
|
-
* the viewport). Ordering and item object identity are preserved for items
|
|
32
|
-
* that fit and the input is never mutated.
|
|
33
|
-
*/
|
|
34
|
-
export declare function projectTranscriptTail(items: readonly TranscriptItem[], budget: number, width: number): readonly TranscriptItem[];
|
|
35
|
-
/** Projects a fixed-size transcript window, measured upward from the newest row. */
|
|
36
|
-
export declare function projectTranscriptWindow(items: readonly TranscriptItem[], budget: number, width: number, scrollOffset: number): readonly TranscriptItem[];
|
|
4
|
+
export declare function estimateTranscriptEntryLines(entry: TranscriptPresentationEntry, width: number, mode: TranscriptPresentationMode): number;
|
|
5
|
+
export declare function transcriptPresentationLineCount(entries: readonly TranscriptPresentationEntry[], width: number, mode: TranscriptPresentationMode): number;
|
|
6
|
+
export declare function projectTranscriptPresentationTail(entries: readonly TranscriptPresentationEntry[], budget: number, width: number, mode: TranscriptPresentationMode): readonly TranscriptPresentationEntry[];
|
|
7
|
+
export declare function projectTranscriptPresentationWindow(entries: readonly TranscriptPresentationEntry[], budget: number, width: number, scrollOffset: number, mode: TranscriptPresentationMode): readonly TranscriptPresentationEntry[];
|
|
37
8
|
//# sourceMappingURL=transcript-viewport.d.ts.map
|