@leitwerk-dev/protocol 0.1.2 → 0.1.3
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/config-snapshot.d.ts +33 -34
- package/dist/config-snapshot.d.ts.map +1 -0
- package/dist/config-snapshot.js +1 -1
- package/dist/config-snapshot.js.map +1 -1
- package/dist/external-review.d.ts +8 -0
- package/dist/external-review.d.ts.map +1 -0
- package/dist/external-review.js +2 -0
- package/dist/external-review.js.map +1 -0
- package/dist/form-contract.d.ts +10 -11
- package/dist/form-contract.d.ts.map +1 -0
- package/dist/form-contract.js +1 -1
- package/dist/form-contract.js.map +1 -1
- package/dist/http-contracts.d.ts +959 -7
- package/dist/http-contracts.d.ts.map +1 -0
- package/dist/http-contracts.js +432 -31
- package/dist/http-contracts.js.map +1 -1
- package/dist/index.d.ts +21 -177
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -1087
- package/dist/index.js.map +1 -1
- package/dist/initial-prompt.d.ts +8 -0
- package/dist/initial-prompt.d.ts.map +1 -0
- package/dist/initial-prompt.js +103 -0
- package/dist/initial-prompt.js.map +1 -0
- package/dist/launcher-contract.d.ts +10 -12
- package/dist/launcher-contract.d.ts.map +1 -0
- package/dist/launcher-contract.js +1 -1
- package/dist/launcher-contract.js.map +1 -1
- package/dist/live-turn-projection.d.ts +39 -0
- package/dist/live-turn-projection.d.ts.map +1 -0
- package/dist/live-turn-projection.js +395 -0
- package/dist/live-turn-projection.js.map +1 -0
- package/dist/pi-session-message.d.ts +25 -0
- package/dist/pi-session-message.d.ts.map +1 -0
- package/dist/pi-session-message.js +27 -0
- package/dist/pi-session-message.js.map +1 -0
- package/dist/primary-path-snapshot.d.ts +77 -0
- package/dist/primary-path-snapshot.d.ts.map +1 -0
- package/dist/primary-path-snapshot.js +2 -0
- package/dist/primary-path-snapshot.js.map +1 -0
- package/dist/protocol.d.ts +428 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +261 -0
- package/dist/protocol.js.map +1 -0
- package/dist/session-entry-tree.d.ts +15 -0
- package/dist/session-entry-tree.d.ts.map +1 -0
- package/dist/session-entry-tree.js +42 -0
- package/dist/session-entry-tree.js.map +1 -0
- package/dist/streamable-events.d.ts +4 -0
- package/dist/streamable-events.d.ts.map +1 -0
- package/dist/streamable-events.js +17 -0
- package/dist/streamable-events.js.map +1 -0
- package/dist/text-preview.d.ts +7 -0
- package/dist/text-preview.d.ts.map +1 -0
- package/dist/text-preview.js +23 -0
- package/dist/text-preview.js.map +1 -0
- package/dist/timeline-projection.d.ts +9 -0
- package/dist/timeline-projection.d.ts.map +1 -0
- package/dist/timeline-projection.js +30 -0
- package/dist/timeline-projection.js.map +1 -0
- package/dist/timestamp-ordering.d.ts +3 -0
- package/dist/timestamp-ordering.d.ts.map +1 -0
- package/dist/timestamp-ordering.js +15 -0
- package/dist/timestamp-ordering.js.map +1 -0
- package/dist/tool-renderer-contract.d.ts +8 -9
- package/dist/tool-renderer-contract.d.ts.map +1 -0
- package/dist/tool-renderer-contract.js +21 -10
- package/dist/tool-renderer-contract.js.map +1 -1
- package/dist/turn-continuation.d.ts +36 -0
- package/dist/turn-continuation.d.ts.map +1 -0
- package/dist/turn-continuation.js +179 -0
- package/dist/turn-continuation.js.map +1 -0
- package/dist/usage-by-turn-record.d.ts +5 -0
- package/dist/usage-by-turn-record.d.ts.map +1 -0
- package/dist/usage-by-turn-record.js +25 -0
- package/dist/usage-by-turn-record.js.map +1 -0
- package/dist/usage-snapshot.d.ts +25 -0
- package/dist/usage-snapshot.d.ts.map +1 -0
- package/dist/usage-snapshot.js +120 -0
- package/dist/usage-snapshot.js.map +1 -0
- package/dist/ws-event-payloads.d.ts +18 -0
- package/dist/ws-event-payloads.d.ts.map +1 -0
- package/dist/ws-event-payloads.js +47 -0
- package/dist/ws-event-payloads.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,177 +1,21 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare function extractInitialPromptPreviewFromParamsJson(paramsJson: string | null | undefined, maxLength?: number): string | null;
|
|
23
|
-
declare function projectFutureExecutionOverview(summary: FutureExecutionSummary): FutureExecutionOverviewItem;
|
|
24
|
-
|
|
25
|
-
interface WsEventPayloadRecord extends Record<string, unknown> {
|
|
26
|
-
}
|
|
27
|
-
interface ResolveWsEventToolCallIdOptions {
|
|
28
|
-
timestamp: string;
|
|
29
|
-
toolName?: string;
|
|
30
|
-
ordinal?: number;
|
|
31
|
-
}
|
|
32
|
-
declare function asWsEventPayloadRecord(value: unknown): WsEventPayloadRecord;
|
|
33
|
-
declare function readWsEventNonEmptyString(value: unknown): string | null;
|
|
34
|
-
declare function readWsEventTimestamp(data: WsEventPayloadRecord, fallbackTimestamp: string): string;
|
|
35
|
-
declare function readWsEventTurnRecordId(data: WsEventPayloadRecord): string | null;
|
|
36
|
-
declare function readWsEventPiTurnId(data: WsEventPayloadRecord): string | null;
|
|
37
|
-
declare function readWsEventStreamText(data: WsEventPayloadRecord): string | null;
|
|
38
|
-
declare function readWsEventToolName(data: WsEventPayloadRecord): string;
|
|
39
|
-
declare function readWsEventToolArguments(data: WsEventPayloadRecord): Record<string, unknown> | null;
|
|
40
|
-
declare function readWsEventToolCallId(data: WsEventPayloadRecord): string | null;
|
|
41
|
-
declare function resolveWsEventToolCallId(data: WsEventPayloadRecord, options: ResolveWsEventToolCallIdOptions): string;
|
|
42
|
-
|
|
43
|
-
interface MutableLiveTurnProjection {
|
|
44
|
-
assistant: PrimaryPathStreamingAssistantSnapshot;
|
|
45
|
-
toolCalls: PrimaryPathToolCallSnapshot[];
|
|
46
|
-
traceItems: PrimaryPathTraceItemSnapshot[];
|
|
47
|
-
usage: UsageSnapshot | null;
|
|
48
|
-
toolCallsById: Map<string, PrimaryPathToolCallSnapshot>;
|
|
49
|
-
openToolCallIdsByName: Map<string, string[]>;
|
|
50
|
-
nextFallbackOrdinal: number;
|
|
51
|
-
}
|
|
52
|
-
interface AppliedLiveTurnProjectionEvent {
|
|
53
|
-
canonicalData: WsEventPayloadRecord;
|
|
54
|
-
timestamp: string;
|
|
55
|
-
toolCallId: string | null;
|
|
56
|
-
toolName: string | null;
|
|
57
|
-
}
|
|
58
|
-
declare const PRIMARY_PATH_OPERATIONAL_PI_EVENT_TYPES: readonly ["pi.error", "pi.retry.start", "pi.retry.end", "pi.compaction.start", "pi.compaction.end"];
|
|
59
|
-
declare function buildPrimaryPathOperationalTraceItem(input: {
|
|
60
|
-
eventType: string;
|
|
61
|
-
data: WsEventPayloadRecord;
|
|
62
|
-
fallbackTimestamp: string;
|
|
63
|
-
}): PrimaryPathOperationalTraceItemSnapshot | null;
|
|
64
|
-
declare function createMutableLiveTurnProjection(): MutableLiveTurnProjection;
|
|
65
|
-
declare function snapshotLiveTurnProjection(projection: MutableLiveTurnProjection): {
|
|
66
|
-
assistant: PrimaryPathStreamingAssistantSnapshot;
|
|
67
|
-
toolCalls: PrimaryPathToolCallSnapshot[];
|
|
68
|
-
traceItems: PrimaryPathTraceItemSnapshot[];
|
|
69
|
-
usage: UsageSnapshot | null;
|
|
70
|
-
};
|
|
71
|
-
declare function applyPiEventToLiveTurnProjection(projection: MutableLiveTurnProjection, input: {
|
|
72
|
-
eventType: string;
|
|
73
|
-
data: WsEventPayloadRecord;
|
|
74
|
-
fallbackTimestamp: string;
|
|
75
|
-
}): AppliedLiveTurnProjectionEvent;
|
|
76
|
-
declare function buildLiveTurnProjectionFromEvents(events: readonly ProcessEvent[]): MutableLiveTurnProjection;
|
|
77
|
-
|
|
78
|
-
interface PiSessionMessageLike {
|
|
79
|
-
role?: unknown;
|
|
80
|
-
content?: unknown;
|
|
81
|
-
details?: unknown;
|
|
82
|
-
toolCallId?: unknown;
|
|
83
|
-
toolName?: unknown;
|
|
84
|
-
isError?: unknown;
|
|
85
|
-
usage?: unknown;
|
|
86
|
-
}
|
|
87
|
-
interface PiSessionMessageEntryLike {
|
|
88
|
-
type?: unknown;
|
|
89
|
-
message?: unknown;
|
|
90
|
-
}
|
|
91
|
-
declare function isPiSessionMessageEntryType<TEntry extends {
|
|
92
|
-
type?: unknown;
|
|
93
|
-
}>(entry: TEntry | undefined): entry is TEntry & {
|
|
94
|
-
type: "message";
|
|
95
|
-
};
|
|
96
|
-
declare function isPiSessionMessageRecord(value: unknown): value is PiSessionMessageLike;
|
|
97
|
-
declare function isPiSessionMessageEntryWithRecord<TEntry extends PiSessionMessageEntryLike>(entry: TEntry | undefined): entry is TEntry & {
|
|
98
|
-
type: "message";
|
|
99
|
-
message: NonNullable<TEntry["message"]>;
|
|
100
|
-
};
|
|
101
|
-
declare function extractPiSessionMessageText(content: unknown): string;
|
|
102
|
-
|
|
103
|
-
interface SessionTreeEntryLike {
|
|
104
|
-
id: string;
|
|
105
|
-
parentId: string | null;
|
|
106
|
-
timestamp: string;
|
|
107
|
-
type: string;
|
|
108
|
-
}
|
|
109
|
-
interface ReadonlyEntryTree<TEntry extends SessionTreeEntryLike> {
|
|
110
|
-
entries: TEntry[];
|
|
111
|
-
leafId: string | null;
|
|
112
|
-
getEntry(id: string): TEntry | undefined;
|
|
113
|
-
getChildren(parentId: string): TEntry[];
|
|
114
|
-
getBranch(fromId?: string | null): TEntry[];
|
|
115
|
-
}
|
|
116
|
-
declare function createReadonlyEntryTree<TEntry extends SessionTreeEntryLike>(entries: readonly TEntry[]): ReadonlyEntryTree<TEntry>;
|
|
117
|
-
|
|
118
|
-
declare const STREAMABLE_WORKER_EVENT_TYPES: readonly ["pi.stream.delta", "pi.turn.start", "pi.turn.end", "pi.tool.call", "pi.tool.result", "pi.label.changed", "pi.error", "pi.retry.start", "pi.retry.end", "pi.usage"];
|
|
119
|
-
type StreamableWorkerEventType = (typeof STREAMABLE_WORKER_EVENT_TYPES)[number];
|
|
120
|
-
declare function isStreamableEvent(eventType: string): eventType is StreamableWorkerEventType;
|
|
121
|
-
|
|
122
|
-
interface TextPreview {
|
|
123
|
-
text: string;
|
|
124
|
-
truncated: boolean;
|
|
125
|
-
}
|
|
126
|
-
declare function truncateTextPreview(value: string, maxLength: number): TextPreview;
|
|
127
|
-
declare function buildTrailingLinePreview(value: string, lineCount: number, maxLength: number): TextPreview;
|
|
128
|
-
|
|
129
|
-
declare function timelinePresentationForTurnType(turnType: ProcessTimelineTurnSummary["turnType"]): ProcessTimelineTurnPresentation;
|
|
130
|
-
declare function buildActiveTimelineTurnSummary(activeTurn: PrimaryPathActiveTurnSnapshot, input?: {
|
|
131
|
-
summary: string;
|
|
132
|
-
output: string;
|
|
133
|
-
actionSource?: ProcessTimelineTurnSummary["actionSource"];
|
|
134
|
-
}): ProcessTimelineTurnSummary;
|
|
135
|
-
|
|
136
|
-
declare function compareTimestampStrings(left: string, right: string): number;
|
|
137
|
-
declare function happenedOnOrAfterStart(entryTimestamp: string, startedAt: string | null): boolean;
|
|
138
|
-
|
|
139
|
-
interface ContinuationTreeEntry {
|
|
140
|
-
id: string;
|
|
141
|
-
parentId: string | null;
|
|
142
|
-
timestamp: string;
|
|
143
|
-
type: string;
|
|
144
|
-
message?: {
|
|
145
|
-
role?: string;
|
|
146
|
-
content?: unknown;
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
interface ContinuationTurnRecordLike {
|
|
150
|
-
forkPiEntryId?: string | null;
|
|
151
|
-
resultPiEntryId?: string | null;
|
|
152
|
-
startedAt?: string | null;
|
|
153
|
-
status?: string | null;
|
|
154
|
-
}
|
|
155
|
-
interface ContinuationSliceBounds {
|
|
156
|
-
endedAt?: string | null;
|
|
157
|
-
}
|
|
158
|
-
interface TurnContinuationIndex<TEntry extends ContinuationTreeEntry> {
|
|
159
|
-
resolveLeafEntryId(turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): string | null;
|
|
160
|
-
buildSlice(turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): TEntry[];
|
|
161
|
-
}
|
|
162
|
-
declare function createTurnContinuationIndex<TEntry extends ContinuationTreeEntry>(entries: readonly TEntry[]): TurnContinuationIndex<TEntry>;
|
|
163
|
-
declare function resolveTurnContinuationLeafEntryId(entries: readonly ContinuationTreeEntry[], turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): string | null;
|
|
164
|
-
declare function buildTurnContinuationSliceFromTree<TEntry extends ContinuationTreeEntry>(tree: ReadonlyEntryTree<TEntry>, turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): TEntry[];
|
|
165
|
-
declare function buildTurnContinuationSlice<TEntry extends ContinuationTreeEntry>(entries: readonly TEntry[], turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): TEntry[];
|
|
166
|
-
interface BranchUserPromptSnapshot {
|
|
167
|
-
text: string | null;
|
|
168
|
-
createdAt: string | null;
|
|
169
|
-
}
|
|
170
|
-
declare function extractFirstUserPromptOnBranch<TEntry extends ContinuationTreeEntry>(tree: ReadonlyEntryTree<TEntry>, leafId: string | null | undefined): BranchUserPromptSnapshot;
|
|
171
|
-
declare function resolveTurnContinuationUserPrompt(entries: readonly ContinuationTreeEntry[], turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): string | null;
|
|
172
|
-
declare function hasTurnContinuationProgress(entries: readonly ContinuationTreeEntry[], turnRecord: ContinuationTurnRecordLike, bounds?: ContinuationSliceBounds): boolean;
|
|
173
|
-
|
|
174
|
-
type UsageSnapshotByTurnRecordId = Record<string, UsageSnapshot>;
|
|
175
|
-
declare function buildUsageSnapshotsByTurnRecordId(events: readonly ProcessEvent[]): UsageSnapshotByTurnRecordId;
|
|
176
|
-
|
|
177
|
-
export { type AppliedLiveTurnProjectionEvent, type BranchUserPromptSnapshot, type ContinuationSliceBounds, type ContinuationTreeEntry, type ContinuationTurnRecordLike, type CreatedExternalReview, FutureExecutionOverviewItem, FutureExecutionSummary, INITIAL_PROMPT_FIELD_PRIORITY, type MutableLiveTurnProjection, PRIMARY_PATH_OPERATIONAL_PI_EVENT_TYPES, type PiSessionMessageEntryLike, type PiSessionMessageLike, PrimaryPathActiveTurnSnapshot, PrimaryPathOperationalTraceItemSnapshot, PrimaryPathStreamingAssistantSnapshot, PrimaryPathToolCallSnapshot, PrimaryPathTraceItemSnapshot, ProcessTimelineTurnPresentation, ProcessTimelineTurnSummary, type ReadonlyEntryTree, type ResolveWsEventToolCallIdOptions, STREAMABLE_WORKER_EVENT_TYPES, type SessionTreeEntryLike, type StreamableWorkerEventType, type TextPreview, type TurnContinuationIndex, UsageSnapshot, type UsageSnapshotByTurnRecordId, type WsEventPayloadRecord, applyPiEventToLiveTurnProjection, asWsEventPayloadRecord, buildActiveTimelineTurnSummary, buildLiveTurnProjectionFromEvents, buildPrimaryPathOperationalTraceItem, buildTrailingLinePreview, buildTurnContinuationSlice, buildTurnContinuationSliceFromTree, buildUsageSnapshotsByTurnRecordId, compareTimestampStrings, createMutableLiveTurnProjection, createReadonlyEntryTree, createTurnContinuationIndex, extractFirstUserPromptOnBranch, extractInitialPromptFromParamsJson, extractInitialPromptFromValue, extractInitialPromptPreviewFromParamsJson, extractPiSessionMessageText, happenedOnOrAfterStart, hasTurnContinuationProgress, isPiSessionMessageEntryType, isPiSessionMessageEntryWithRecord, isPiSessionMessageRecord, isStreamableEvent, projectFutureExecutionOverview, readWsEventNonEmptyString, readWsEventPiTurnId, readWsEventStreamText, readWsEventTimestamp, readWsEventToolArguments, readWsEventToolCallId, readWsEventToolName, readWsEventTurnRecordId, resolveTurnContinuationLeafEntryId, resolveTurnContinuationUserPrompt, resolveWsEventToolCallId, snapshotLiveTurnProjection, timelinePresentationForTurnType, truncatePromptPreview, truncateTextPreview };
|
|
1
|
+
export * from "./config-snapshot.js";
|
|
2
|
+
export * from "./external-review.js";
|
|
3
|
+
export * from "./form-contract.js";
|
|
4
|
+
export * from "./http-contracts.js";
|
|
5
|
+
export * from "./initial-prompt.js";
|
|
6
|
+
export * from "./launcher-contract.js";
|
|
7
|
+
export * from "./live-turn-projection.js";
|
|
8
|
+
export * from "./pi-session-message.js";
|
|
9
|
+
export * from "./primary-path-snapshot.js";
|
|
10
|
+
export * from "./protocol.js";
|
|
11
|
+
export * from "./session-entry-tree.js";
|
|
12
|
+
export * from "./streamable-events.js";
|
|
13
|
+
export * from "./text-preview.js";
|
|
14
|
+
export * from "./timeline-projection.js";
|
|
15
|
+
export * from "./timestamp-ordering.js";
|
|
16
|
+
export * from "./tool-renderer-contract.js";
|
|
17
|
+
export * from "./turn-continuation.js";
|
|
18
|
+
export * from "./usage-by-turn-record.js";
|
|
19
|
+
export * from "./usage-snapshot.js";
|
|
20
|
+
export * from "./ws-event-payloads.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|