@leitwerk-dev/protocol 0.2.0 → 0.2.1
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/api-token-contracts.d.ts +20 -0
- package/dist/api-token-contracts.d.ts.map +1 -1
- package/dist/{chunk-J4VMD5ST.js → chunk-4AKWRRFS.js} +98 -4
- package/dist/chunk-4AKWRRFS.js.map +1 -0
- package/dist/{chunk-Z4IU6KEN.js → chunk-LTIDCJFK.js} +146 -1
- package/dist/chunk-LTIDCJFK.js.map +1 -0
- package/dist/{chunk-IWVU76M5.js → chunk-RUPDB3WZ.js} +1 -1
- package/dist/chunk-RUPDB3WZ.js.map +1 -0
- package/dist/compact-turn-summary.d.ts +21 -3
- package/dist/compact-turn-summary.d.ts.map +1 -1
- package/dist/config-snapshot-public.d.ts +2 -0
- package/dist/config-snapshot-public.d.ts.map +1 -0
- package/dist/config-snapshot-public.js +1 -0
- package/dist/config-snapshot.d.ts +109 -16
- package/dist/config-snapshot.d.ts.map +1 -1
- package/dist/config-snapshot.js +0 -1
- package/dist/extension-ui-contracts.d.ts +22 -0
- package/dist/extension-ui-contracts.d.ts.map +1 -1
- package/dist/external-review.d.ts +5 -1
- package/dist/external-review.d.ts.map +1 -1
- package/dist/form-contract-public.d.ts +2 -0
- package/dist/form-contract-public.d.ts.map +1 -0
- package/dist/form-contract-public.js +1 -0
- package/dist/form-contract.d.ts +29 -5
- package/dist/form-contract.d.ts.map +1 -1
- package/dist/form-contract.js +0 -1
- package/dist/{http-contracts-ht8DDU4J.d.ts → http-contracts-public-rL4HFcxz.d.ts} +971 -45
- package/dist/http-contracts-public.d.ts +4 -0
- package/dist/http-contracts-public.d.ts.map +1 -0
- package/dist/http-contracts-public.js +10 -0
- package/dist/http-contracts.d.ts +819 -12
- package/dist/http-contracts.d.ts.map +1 -1
- package/dist/http-contracts.js +2 -2
- package/dist/index.d.ts +30 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -75
- package/dist/index.js.map +1 -1
- package/dist/initial-prompt.d.ts +6 -0
- package/dist/initial-prompt.d.ts.map +1 -1
- package/dist/launcher-contract-public.d.ts +2 -0
- package/dist/launcher-contract-public.d.ts.map +1 -0
- package/dist/launcher-contract-public.js +1 -0
- package/dist/launcher-contract-public.js.map +1 -0
- package/dist/launcher-contract.d.ts +26 -1
- package/dist/launcher-contract.d.ts.map +1 -1
- package/dist/launcher-contract.js +0 -1
- package/dist/live-turn-projection.d.ts +29 -0
- package/dist/live-turn-projection.d.ts.map +1 -1
- package/dist/pi-session-message.d.ts +16 -0
- package/dist/pi-session-message.d.ts.map +1 -1
- package/dist/primary-path-snapshot.d.ts +64 -0
- package/dist/primary-path-snapshot.d.ts.map +1 -1
- package/dist/protocol.d.ts +387 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +1 -1
- package/dist/session-entry-tree.d.ts +12 -0
- package/dist/session-entry-tree.d.ts.map +1 -1
- package/dist/streamable-events.d.ts +3 -0
- package/dist/streamable-events.d.ts.map +1 -1
- package/dist/text-preview.d.ts +5 -0
- package/dist/text-preview.d.ts.map +1 -1
- package/dist/ticket-creation-contracts.d.ts +23 -1
- package/dist/ticket-creation-contracts.d.ts.map +1 -1
- package/dist/timeline-projection.d.ts +5 -0
- package/dist/timeline-projection.d.ts.map +1 -1
- package/dist/timestamp-ordering.d.ts +2 -0
- package/dist/timestamp-ordering.d.ts.map +1 -1
- package/dist/tool-renderer-contract-public.d.ts +3 -0
- package/dist/tool-renderer-contract-public.d.ts.map +1 -0
- package/dist/tool-renderer-contract-public.js +9 -0
- package/dist/tool-renderer-contract-public.js.map +1 -0
- package/dist/tool-renderer-contract.d.ts +15 -0
- package/dist/tool-renderer-contract.d.ts.map +1 -1
- package/dist/tool-renderer-contract.js +1 -1
- package/dist/tool-result-truncation.d.ts +4 -0
- package/dist/tool-result-truncation.d.ts.map +1 -1
- package/dist/turn-continuation.d.ts +28 -0
- package/dist/turn-continuation.d.ts.map +1 -1
- package/dist/turn-trace-projection.d.ts +1 -1
- package/dist/turn-trace-projection.d.ts.map +1 -1
- package/dist/usage-by-turn-record.d.ts +2 -0
- package/dist/usage-by-turn-record.d.ts.map +1 -1
- package/dist/usage-snapshot.d.ts +20 -3
- package/dist/usage-snapshot.d.ts.map +1 -1
- package/dist/ws-event-payloads.d.ts +14 -0
- package/dist/ws-event-payloads.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/api-token-contracts.ts +20 -0
- package/src/compact-turn-summary.ts +26 -4
- package/src/config-snapshot-public.ts +12 -0
- package/src/config-snapshot.ts +109 -16
- package/src/extension-ui-contracts.ts +22 -0
- package/src/external-review.ts +5 -1
- package/src/form-contract-public.ts +6 -0
- package/src/form-contract.ts +29 -5
- package/src/http-contracts-public.ts +86 -0
- package/src/http-contracts.ts +926 -40
- package/src/index.ts +184 -25
- package/src/initial-prompt.ts +6 -0
- package/src/launcher-contract-public.ts +8 -0
- package/src/launcher-contract.ts +26 -1
- package/src/live-turn-projection.ts +29 -0
- package/src/pi-session-message.ts +21 -3
- package/src/primary-path-snapshot.ts +64 -0
- package/src/protocol.ts +412 -17
- package/src/session-entry-tree.ts +12 -0
- package/src/streamable-events.ts +3 -0
- package/src/text-preview.ts +5 -0
- package/src/ticket-creation-contracts.ts +31 -3
- package/src/timeline-projection.ts +5 -0
- package/src/timestamp-ordering.ts +2 -0
- package/src/tool-renderer-contract-public.ts +10 -0
- package/src/tool-renderer-contract.ts +15 -0
- package/src/tool-result-truncation.ts +4 -0
- package/src/turn-continuation.ts +28 -0
- package/src/turn-trace-projection.ts +1 -1
- package/src/usage-by-turn-record.ts +2 -0
- package/src/usage-snapshot.ts +20 -3
- package/src/ws-event-payloads.ts +14 -0
- package/dist/chunk-6L4W7WPV.js +0 -1
- package/dist/chunk-AAV3AAOF.js +0 -1
- package/dist/chunk-IEMT3JG4.js +0 -1
- package/dist/chunk-IWVU76M5.js.map +0 -1
- package/dist/chunk-J4VMD5ST.js.map +0 -1
- package/dist/chunk-Z4IU6KEN.js.map +0 -1
- /package/dist/{chunk-6L4W7WPV.js.map → config-snapshot-public.js.map} +0 -0
- /package/dist/{chunk-AAV3AAOF.js.map → form-contract-public.js.map} +0 -0
- /package/dist/{chunk-IEMT3JG4.js.map → http-contracts-public.js.map} +0 -0
package/src/index.ts
CHANGED
|
@@ -1,25 +1,184 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
export type { CompactActiveTurnSnapshot, CompactTurnSummary } from "./compact-turn-summary.js";
|
|
2
|
+
export {
|
|
3
|
+
applyEventToCompactTurnSummary,
|
|
4
|
+
emptyCompactTurnSummary,
|
|
5
|
+
REASONING_PREVIEW_MAX_CHARS,
|
|
6
|
+
reasoningPreviewTail,
|
|
7
|
+
} from "./compact-turn-summary.js";
|
|
8
|
+
export type {
|
|
9
|
+
ConfigSnapshot,
|
|
10
|
+
ModelProfileSnapshot,
|
|
11
|
+
} from "./config-snapshot.js";
|
|
12
|
+
export type {
|
|
13
|
+
BrowserUiExtensionDescriptor,
|
|
14
|
+
LeafOutcomeRendererDescriptor,
|
|
15
|
+
LeafOutcomeRendererFailure,
|
|
16
|
+
} from "./extension-ui-contracts.js";
|
|
17
|
+
export {
|
|
18
|
+
browserUiExtensionDescriptorSchema,
|
|
19
|
+
leafOutcomeRendererDescriptorSchema,
|
|
20
|
+
leafOutcomeRendererFailureSchema,
|
|
21
|
+
} from "./extension-ui-contracts.js";
|
|
22
|
+
export type {
|
|
23
|
+
CurrentProcessErrorSummary,
|
|
24
|
+
CurrentTurnRecoverySummary,
|
|
25
|
+
FutureActionPayload,
|
|
26
|
+
FutureExecutionOverviewItem,
|
|
27
|
+
FutureLaunchPayload,
|
|
28
|
+
InstalledSkillCatalogDetail,
|
|
29
|
+
InstalledSkillCatalogItem,
|
|
30
|
+
LauncherModelConfigDefaults,
|
|
31
|
+
LauncherModelConfigPreview,
|
|
32
|
+
LauncherModelConfigSchema,
|
|
33
|
+
LaunchersResponseBody,
|
|
34
|
+
LaunchRunResponseBody,
|
|
35
|
+
ModelProfileOptionSummary,
|
|
36
|
+
ModelProviderOptionsResponseBody,
|
|
37
|
+
ParsedActionRequestBody,
|
|
38
|
+
ParsedLauncherRequestBody,
|
|
39
|
+
ParsedScheduleRequest,
|
|
40
|
+
PiSessionContentBlock,
|
|
41
|
+
PiSessionEntry,
|
|
42
|
+
PiSessionMessageRecord,
|
|
43
|
+
PrimaryPathUiSnapshot,
|
|
44
|
+
ProcessActionModelPreview,
|
|
45
|
+
ProcessBrowseItem,
|
|
46
|
+
ProcessDetailUiSnapshotResponseBody,
|
|
47
|
+
ProcessDiagnosticsData,
|
|
48
|
+
ProcessExternalTriggerSignal,
|
|
49
|
+
ProcessExternalTriggerSummary,
|
|
50
|
+
ProcessOverviewItem,
|
|
51
|
+
ProcessSelectedTurnSummary,
|
|
52
|
+
ProcessStartupSummary,
|
|
53
|
+
ProcessTimelineInputSummary,
|
|
54
|
+
ProcessTimelineSnapshot,
|
|
55
|
+
ProcessTimelineTurnSummary,
|
|
56
|
+
ProcessUiSnapshotProcess,
|
|
57
|
+
ProcessUsageEstimateSnapshot,
|
|
58
|
+
SkillCatalogDetail,
|
|
59
|
+
SkillCatalogItem,
|
|
60
|
+
SkillRepositorySummary,
|
|
61
|
+
SkillsCatalogResponseBody,
|
|
62
|
+
SkillUsageProcessSummary,
|
|
63
|
+
SkillUsageSummary,
|
|
64
|
+
StartLaunchRunResponseBody,
|
|
65
|
+
StartupAttemptStepSummary,
|
|
66
|
+
StartupAttemptSummary,
|
|
67
|
+
StartupRecoverySummary,
|
|
68
|
+
TurnPiInputPart,
|
|
69
|
+
TurnPiInputSnapshot,
|
|
70
|
+
TurnReasoningDetailResponseBody,
|
|
71
|
+
TurnTracePreview,
|
|
72
|
+
TurnTraceSnapshot,
|
|
73
|
+
TurnTraceToolCallSnapshot,
|
|
74
|
+
WatcherPresentationField,
|
|
75
|
+
} from "./http-contracts.js";
|
|
76
|
+
export {
|
|
77
|
+
parseActionRequestBody,
|
|
78
|
+
parseFutureActionPayloadJson,
|
|
79
|
+
parseFutureLaunchPayloadJson,
|
|
80
|
+
parseLauncherInputJson,
|
|
81
|
+
parseLauncherRequestBody,
|
|
82
|
+
parseLauncherTurnConfigsJson,
|
|
83
|
+
serializeFutureActionPayload,
|
|
84
|
+
serializeFutureLaunchPayload,
|
|
85
|
+
validateScheduleRequestInput,
|
|
86
|
+
} from "./http-contracts.js";
|
|
87
|
+
export {
|
|
88
|
+
extractInitialPromptFromParamsJson,
|
|
89
|
+
extractInitialPromptFromValue,
|
|
90
|
+
extractInitialPromptPreviewFromParamsJson,
|
|
91
|
+
projectFutureExecutionOverview,
|
|
92
|
+
} from "./initial-prompt.js";
|
|
93
|
+
export type {
|
|
94
|
+
LauncherValidationError,
|
|
95
|
+
SkillOptionSummary,
|
|
96
|
+
SkillSelection,
|
|
97
|
+
} from "./launcher-contract.js";
|
|
98
|
+
export type { MutableLiveTurnProjection } from "./live-turn-projection.js";
|
|
99
|
+
export {
|
|
100
|
+
applyPiEventToLiveTurnProjection,
|
|
101
|
+
buildLiveTurnProjectionFromEvents,
|
|
102
|
+
buildPrimaryPathOperationalTraceItem,
|
|
103
|
+
createMutableLiveTurnProjection,
|
|
104
|
+
PRIMARY_PATH_OPERATIONAL_PI_EVENT_TYPES,
|
|
105
|
+
snapshotLiveTurnProjection,
|
|
106
|
+
} from "./live-turn-projection.js";
|
|
107
|
+
export {
|
|
108
|
+
extractPiSessionMessageText,
|
|
109
|
+
isPiSessionMessageEntryWithRecord,
|
|
110
|
+
} from "./pi-session-message.js";
|
|
111
|
+
export type {
|
|
112
|
+
PrimaryPathActiveTurnSnapshot,
|
|
113
|
+
PrimaryPathEntrySnapshot,
|
|
114
|
+
PrimaryPathOperationalTraceItemSnapshot,
|
|
115
|
+
PrimaryPathSnapshot,
|
|
116
|
+
PrimaryPathStreamingAssistantSnapshot,
|
|
117
|
+
PrimaryPathToolCallSnapshot,
|
|
118
|
+
PrimaryPathTraceItemSnapshot,
|
|
119
|
+
TurnUsageSnapshot,
|
|
120
|
+
} from "./primary-path-snapshot.js";
|
|
121
|
+
export type {
|
|
122
|
+
DurableWsFrameInput,
|
|
123
|
+
EphemeralWsFrameInput,
|
|
124
|
+
KnownDurableWsFrameType,
|
|
125
|
+
KnownEphemeralWsFrameType,
|
|
126
|
+
PrimaryPathWsFrame,
|
|
127
|
+
ProcessAttentionTarget,
|
|
128
|
+
WsDurability,
|
|
129
|
+
WsFrame,
|
|
130
|
+
WsPayloadByType,
|
|
131
|
+
} from "./protocol.js";
|
|
132
|
+
export {
|
|
133
|
+
createDurableWsFrame,
|
|
134
|
+
createEphemeralWsFrame,
|
|
135
|
+
mapWorkerEventToWsType,
|
|
136
|
+
parsePrimaryPathWsFrameInput,
|
|
137
|
+
parseSchema,
|
|
138
|
+
parseWsFrame,
|
|
139
|
+
WS_PRIMARY_PATH_TYPES,
|
|
140
|
+
WS_PROCESS_TYPES,
|
|
141
|
+
WS_PROTOCOL_VERSION,
|
|
142
|
+
} from "./protocol.js";
|
|
143
|
+
export type { ReadonlyEntryTree } from "./session-entry-tree.js";
|
|
144
|
+
export { createReadonlyEntryTree } from "./session-entry-tree.js";
|
|
145
|
+
export { isStreamableEvent } from "./streamable-events.js";
|
|
146
|
+
export { truncateTextPreview } from "./text-preview.js";
|
|
147
|
+
export type {
|
|
148
|
+
LaunchTicketCreationRequestBody,
|
|
149
|
+
LaunchTicketCreationResponseBody,
|
|
150
|
+
ResolveToolApprovalRequestBody,
|
|
151
|
+
TicketCreationToolSummary,
|
|
152
|
+
} from "./ticket-creation-contracts.js";
|
|
153
|
+
export {
|
|
154
|
+
buildActiveTimelineTurnSummary,
|
|
155
|
+
timelinePresentationForTurnType,
|
|
156
|
+
} from "./timeline-projection.js";
|
|
157
|
+
export { compareTimestampStrings } from "./timestamp-ordering.js";
|
|
158
|
+
export { readValueAtPath } from "./tool-renderer-contract.js";
|
|
159
|
+
export { isToolResultTruncated } from "./tool-result-truncation.js";
|
|
160
|
+
export {
|
|
161
|
+
createTurnContinuationIndex,
|
|
162
|
+
extractFirstUserPromptOnBranch,
|
|
163
|
+
hasTurnContinuationProgress,
|
|
164
|
+
resolveTurnContinuationLeafEntryId,
|
|
165
|
+
resolveTurnContinuationUserPrompt,
|
|
166
|
+
} from "./turn-continuation.js";
|
|
167
|
+
export { snapshotTurnTrace } from "./turn-trace-projection.js";
|
|
168
|
+
export { buildUsageSnapshotsByTurnRecordId } from "./usage-by-turn-record.js";
|
|
169
|
+
export type { UsageCostSnapshot, UsageTokenCounts } from "./usage-snapshot.js";
|
|
170
|
+
export {
|
|
171
|
+
cloneUsageSnapshot,
|
|
172
|
+
mergeUsageSnapshots,
|
|
173
|
+
normalizeUsageSnapshot,
|
|
174
|
+
} from "./usage-snapshot.js";
|
|
175
|
+
export {
|
|
176
|
+
asWsEventPayloadRecord,
|
|
177
|
+
readWsEventNonEmptyString,
|
|
178
|
+
readWsEventPiTurnId,
|
|
179
|
+
readWsEventStreamText,
|
|
180
|
+
readWsEventTimestamp,
|
|
181
|
+
readWsEventToolArguments,
|
|
182
|
+
readWsEventToolName,
|
|
183
|
+
readWsEventTurnRecordId,
|
|
184
|
+
} from "./ws-event-payloads.js";
|
package/src/initial-prompt.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { FutureExecutionOverviewItem, FutureExecutionSummary } from "./http
|
|
|
5
5
|
// for compact overview and detail read models. Process launchers use several
|
|
6
6
|
// established field names; keep this priority list shared so server and browser
|
|
7
7
|
// projections cannot drift.
|
|
8
|
+
/** @internal */
|
|
8
9
|
export const INITIAL_PROMPT_FIELD_PRIORITY = [
|
|
9
10
|
"initialPrompt",
|
|
10
11
|
"prompt",
|
|
@@ -26,6 +27,7 @@ function normalizePromptValue(value: string): string | null {
|
|
|
26
27
|
return normalized.length > 0 ? normalized : null;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/** @internal */
|
|
29
31
|
export function truncatePromptPreview(
|
|
30
32
|
value: string | null | undefined,
|
|
31
33
|
maxLength = 180,
|
|
@@ -53,6 +55,7 @@ function readStringField(record: Record<string, unknown>, fieldName: string): st
|
|
|
53
55
|
return null;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
/** @internal */
|
|
56
59
|
export function extractInitialPromptFromValue(value: unknown): string | null {
|
|
57
60
|
if (!isRecord(value)) {
|
|
58
61
|
return null;
|
|
@@ -68,6 +71,7 @@ export function extractInitialPromptFromValue(value: unknown): string | null {
|
|
|
68
71
|
return null;
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
/** @internal */
|
|
71
75
|
export function extractInitialPromptFromParamsJson(
|
|
72
76
|
paramsJson: string | null | undefined,
|
|
73
77
|
): string | null {
|
|
@@ -82,6 +86,7 @@ export function extractInitialPromptFromParamsJson(
|
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
/** @internal */
|
|
85
90
|
export function extractInitialPromptPreviewFromParamsJson(
|
|
86
91
|
paramsJson: string | null | undefined,
|
|
87
92
|
maxLength = 180,
|
|
@@ -89,6 +94,7 @@ export function extractInitialPromptPreviewFromParamsJson(
|
|
|
89
94
|
return truncatePromptPreview(extractInitialPromptFromParamsJson(paramsJson), maxLength);
|
|
90
95
|
}
|
|
91
96
|
|
|
97
|
+
/** @internal */
|
|
92
98
|
export function projectFutureExecutionOverview(
|
|
93
99
|
summary: FutureExecutionSummary,
|
|
94
100
|
): FutureExecutionOverviewItem {
|
package/src/launcher-contract.ts
CHANGED
|
@@ -4,40 +4,65 @@ import type {
|
|
|
4
4
|
FormFieldOptionDefinition,
|
|
5
5
|
} from "./form-contract.js";
|
|
6
6
|
|
|
7
|
+
/** @public */
|
|
7
8
|
export interface LauncherCardMetadata {
|
|
9
|
+
/** @public */
|
|
8
10
|
title?: string;
|
|
11
|
+
/** @public */
|
|
9
12
|
description?: string;
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
/** @public */
|
|
12
16
|
export type LauncherFieldOptionDefinition = FormFieldOptionDefinition;
|
|
17
|
+
/** @public */
|
|
13
18
|
export type LauncherFieldDefinition = FormFieldDefinition;
|
|
19
|
+
/** @public */
|
|
14
20
|
export type LauncherSchemaDefinition = FormDefinition<LauncherFieldDefinition>;
|
|
15
21
|
|
|
22
|
+
/** @public */
|
|
16
23
|
export interface LauncherValidationError {
|
|
24
|
+
/** @public */
|
|
17
25
|
code: string;
|
|
26
|
+
/** @public */
|
|
18
27
|
message: string;
|
|
28
|
+
/** @public */
|
|
19
29
|
fieldId?: string;
|
|
20
30
|
}
|
|
21
31
|
|
|
32
|
+
/** @internal */
|
|
22
33
|
export interface SkillOptionSummary {
|
|
34
|
+
/** @internal */
|
|
23
35
|
id: string;
|
|
36
|
+
/** @internal */
|
|
24
37
|
label: string;
|
|
38
|
+
/** @internal */
|
|
25
39
|
description: string | null;
|
|
26
40
|
}
|
|
27
41
|
|
|
42
|
+
/** @internal */
|
|
28
43
|
export interface SkillSelection {
|
|
44
|
+
/** @internal */
|
|
29
45
|
skillId: string;
|
|
46
|
+
/** @internal */
|
|
30
47
|
revisionId: string;
|
|
31
48
|
}
|
|
32
49
|
|
|
50
|
+
/** @internal */
|
|
33
51
|
export interface UiLauncherSummaryBase {
|
|
52
|
+
/** @internal */
|
|
34
53
|
id: string;
|
|
54
|
+
/** @internal */
|
|
35
55
|
processId: string;
|
|
56
|
+
/** @internal */
|
|
36
57
|
displayName: string;
|
|
58
|
+
/** @internal */
|
|
37
59
|
label: string;
|
|
60
|
+
/** @internal */
|
|
38
61
|
description: string;
|
|
62
|
+
/** @internal */
|
|
39
63
|
card: LauncherCardMetadata;
|
|
64
|
+
/** @internal */
|
|
40
65
|
launchConfigSchema: LauncherSchemaDefinition;
|
|
41
|
-
/** Safe summaries of currently available opt-in skills. */
|
|
66
|
+
/** Safe summaries of currently available opt-in skills. @internal */
|
|
42
67
|
skills?: readonly SkillOptionSummary[];
|
|
43
68
|
}
|
|
@@ -28,23 +28,37 @@ import {
|
|
|
28
28
|
type WsEventPayloadRecord,
|
|
29
29
|
} from "./ws-event-payloads.js";
|
|
30
30
|
|
|
31
|
+
/** @internal */
|
|
31
32
|
export interface MutableLiveTurnProjection {
|
|
33
|
+
/** @internal */
|
|
32
34
|
assistant: PrimaryPathStreamingAssistantSnapshot;
|
|
35
|
+
/** @internal */
|
|
33
36
|
toolCalls: PrimaryPathToolCallSnapshot[];
|
|
37
|
+
/** @internal */
|
|
34
38
|
traceItems: PrimaryPathTraceItemSnapshot[];
|
|
39
|
+
/** @internal */
|
|
35
40
|
usage: UsageSnapshot | null;
|
|
41
|
+
/** @internal */
|
|
36
42
|
toolCallsById: Map<string, PrimaryPathToolCallSnapshot>;
|
|
43
|
+
/** @internal */
|
|
37
44
|
openToolCallIdsByName: Map<string, string[]>;
|
|
45
|
+
/** @internal */
|
|
38
46
|
nextFallbackOrdinal: number;
|
|
39
47
|
}
|
|
40
48
|
|
|
49
|
+
/** @internal */
|
|
41
50
|
export interface AppliedLiveTurnProjectionEvent {
|
|
51
|
+
/** @internal */
|
|
42
52
|
canonicalData: WsEventPayloadRecord;
|
|
53
|
+
/** @internal */
|
|
43
54
|
timestamp: string;
|
|
55
|
+
/** @internal */
|
|
44
56
|
toolCallId: string | null;
|
|
57
|
+
/** @internal */
|
|
45
58
|
toolName: string | null;
|
|
46
59
|
}
|
|
47
60
|
|
|
61
|
+
/** @internal */
|
|
48
62
|
export const PRIMARY_PATH_OPERATIONAL_PI_EVENT_TYPES = [
|
|
49
63
|
"pi.error",
|
|
50
64
|
"pi.retry.start",
|
|
@@ -100,9 +114,13 @@ function retryEndFallbackMessage(data: WsEventPayloadRecord): string {
|
|
|
100
114
|
: "Retry sequence ended.";
|
|
101
115
|
}
|
|
102
116
|
|
|
117
|
+
/** @internal */
|
|
103
118
|
export function buildPrimaryPathOperationalTraceItem(input: {
|
|
119
|
+
/** @internal */
|
|
104
120
|
eventType: string;
|
|
121
|
+
/** @internal */
|
|
105
122
|
data: WsEventPayloadRecord;
|
|
123
|
+
/** @internal */
|
|
106
124
|
fallbackTimestamp: string;
|
|
107
125
|
}): PrimaryPathOperationalTraceItemSnapshot | null {
|
|
108
126
|
if (!PRIMARY_PATH_OPERATIONAL_PI_EVENT_TYPE_SET.has(input.eventType)) {
|
|
@@ -283,6 +301,7 @@ function ensureToolTraceItem(projection: MutableLiveTurnProjection, toolCallId:
|
|
|
283
301
|
});
|
|
284
302
|
}
|
|
285
303
|
|
|
304
|
+
/** @internal */
|
|
286
305
|
export function createMutableLiveTurnProjection(): MutableLiveTurnProjection {
|
|
287
306
|
return {
|
|
288
307
|
assistant: {
|
|
@@ -299,10 +318,15 @@ export function createMutableLiveTurnProjection(): MutableLiveTurnProjection {
|
|
|
299
318
|
};
|
|
300
319
|
}
|
|
301
320
|
|
|
321
|
+
/** @internal */
|
|
302
322
|
export function snapshotLiveTurnProjection(projection: MutableLiveTurnProjection): {
|
|
323
|
+
/** @internal */
|
|
303
324
|
assistant: PrimaryPathStreamingAssistantSnapshot;
|
|
325
|
+
/** @internal */
|
|
304
326
|
toolCalls: PrimaryPathToolCallSnapshot[];
|
|
327
|
+
/** @internal */
|
|
305
328
|
traceItems: PrimaryPathTraceItemSnapshot[];
|
|
329
|
+
/** @internal */
|
|
306
330
|
usage: UsageSnapshot | null;
|
|
307
331
|
} {
|
|
308
332
|
return {
|
|
@@ -313,11 +337,15 @@ export function snapshotLiveTurnProjection(projection: MutableLiveTurnProjection
|
|
|
313
337
|
};
|
|
314
338
|
}
|
|
315
339
|
|
|
340
|
+
/** @internal */
|
|
316
341
|
export function applyPiEventToLiveTurnProjection(
|
|
317
342
|
projection: MutableLiveTurnProjection,
|
|
318
343
|
input: {
|
|
344
|
+
/** @internal */
|
|
319
345
|
eventType: string;
|
|
346
|
+
/** @internal */
|
|
320
347
|
data: WsEventPayloadRecord;
|
|
348
|
+
/** @internal */
|
|
321
349
|
fallbackTimestamp: string;
|
|
322
350
|
},
|
|
323
351
|
): AppliedLiveTurnProjectionEvent {
|
|
@@ -414,6 +442,7 @@ function compareProcessEventsChronologically(left: ProcessEvent, right: ProcessE
|
|
|
414
442
|
return left.id.localeCompare(right.id);
|
|
415
443
|
}
|
|
416
444
|
|
|
445
|
+
/** @internal */
|
|
417
446
|
export function buildLiveTurnProjectionFromEvents(
|
|
418
447
|
events: readonly ProcessEvent[],
|
|
419
448
|
): MutableLiveTurnProjection {
|
|
@@ -1,34 +1,52 @@
|
|
|
1
|
+
/** @internal */
|
|
1
2
|
export interface PiSessionMessageLike {
|
|
3
|
+
/** @internal */
|
|
2
4
|
role?: unknown;
|
|
5
|
+
/** @internal */
|
|
3
6
|
content?: unknown;
|
|
7
|
+
/** @internal */
|
|
4
8
|
details?: unknown;
|
|
9
|
+
/** @internal */
|
|
5
10
|
toolCallId?: unknown;
|
|
11
|
+
/** @internal */
|
|
6
12
|
toolName?: unknown;
|
|
13
|
+
/** @internal */
|
|
7
14
|
isError?: unknown;
|
|
15
|
+
/** @internal */
|
|
8
16
|
usage?: unknown;
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
/** @internal */
|
|
11
20
|
export interface PiSessionMessageEntryLike {
|
|
21
|
+
/** @internal */
|
|
12
22
|
type?: unknown;
|
|
23
|
+
/** @internal */
|
|
13
24
|
message?: unknown;
|
|
14
25
|
}
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
/** @internal */
|
|
28
|
+
export function isPiSessionMessageEntryType<
|
|
29
|
+
TEntry extends {
|
|
30
|
+
/** @internal */
|
|
31
|
+
type?: unknown;
|
|
32
|
+
},
|
|
33
|
+
>(entry: TEntry | undefined): entry is TEntry & { type: "message" } {
|
|
19
34
|
return entry?.type === "message";
|
|
20
35
|
}
|
|
21
36
|
|
|
37
|
+
/** @internal */
|
|
22
38
|
export function isPiSessionMessageRecord(value: unknown): value is PiSessionMessageLike {
|
|
23
39
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
40
|
}
|
|
25
41
|
|
|
42
|
+
/** @internal */
|
|
26
43
|
export function isPiSessionMessageEntryWithRecord<TEntry extends PiSessionMessageEntryLike>(
|
|
27
44
|
entry: TEntry | undefined,
|
|
28
45
|
): entry is TEntry & { type: "message"; message: NonNullable<TEntry["message"]> } {
|
|
29
46
|
return isPiSessionMessageEntryType(entry) && isPiSessionMessageRecord(entry.message);
|
|
30
47
|
}
|
|
31
48
|
|
|
49
|
+
/** @internal */
|
|
32
50
|
export function extractPiSessionMessageText(content: unknown): string {
|
|
33
51
|
if (typeof content === "string") {
|
|
34
52
|
return content;
|
|
@@ -7,92 +7,156 @@ import type {
|
|
|
7
7
|
} from "@leitwerk-dev/domain";
|
|
8
8
|
import type { UsageSnapshot } from "./usage-snapshot.js";
|
|
9
9
|
|
|
10
|
+
/** @internal */
|
|
10
11
|
export interface PrimaryPathEntrySnapshot extends Record<string, unknown> {
|
|
12
|
+
/** @internal */
|
|
11
13
|
id: string;
|
|
14
|
+
/** @internal */
|
|
12
15
|
parentId: string | null;
|
|
16
|
+
/** @internal */
|
|
13
17
|
type: string;
|
|
18
|
+
/** @internal */
|
|
14
19
|
timestamp: string;
|
|
15
20
|
}
|
|
16
21
|
|
|
22
|
+
/** @internal */
|
|
17
23
|
export interface PrimaryPathDetailRailSnapshot {
|
|
24
|
+
/** @internal */
|
|
18
25
|
keyPoints: [];
|
|
26
|
+
/** @internal */
|
|
19
27
|
futureTurns: [];
|
|
28
|
+
/** @internal */
|
|
20
29
|
currentPosition: null;
|
|
21
30
|
}
|
|
22
31
|
|
|
32
|
+
/** @internal */
|
|
23
33
|
export interface PrimaryPathStreamingAssistantSnapshot {
|
|
34
|
+
/** @internal */
|
|
24
35
|
text: string;
|
|
36
|
+
/** @internal */
|
|
25
37
|
thinking: string;
|
|
38
|
+
/** @internal */
|
|
26
39
|
lastUpdatedAt: string | null;
|
|
27
40
|
}
|
|
28
41
|
|
|
42
|
+
/** @internal */
|
|
29
43
|
export interface PrimaryPathThinkingTraceItemSnapshot {
|
|
44
|
+
/** @internal */
|
|
30
45
|
kind: "thinking";
|
|
46
|
+
/** @internal */
|
|
31
47
|
text: string;
|
|
32
48
|
}
|
|
33
49
|
|
|
50
|
+
/** @internal */
|
|
34
51
|
export interface PrimaryPathToolCallTraceItemSnapshot {
|
|
52
|
+
/** @internal */
|
|
35
53
|
kind: "tool_call";
|
|
54
|
+
/** @internal */
|
|
36
55
|
toolCallId: string;
|
|
37
56
|
}
|
|
38
57
|
|
|
58
|
+
/** @internal */
|
|
39
59
|
export type PrimaryPathOperationalTraceSeverity = "info" | "success" | "warning" | "error";
|
|
40
60
|
|
|
61
|
+
/** @internal */
|
|
41
62
|
export interface PrimaryPathOperationalTraceItemSnapshot {
|
|
63
|
+
/** @internal */
|
|
42
64
|
kind: "operational_event";
|
|
65
|
+
/** @internal */
|
|
43
66
|
eventType: string;
|
|
67
|
+
/** @internal */
|
|
44
68
|
severity: PrimaryPathOperationalTraceSeverity;
|
|
69
|
+
/** @internal */
|
|
45
70
|
title: string;
|
|
71
|
+
/** @internal */
|
|
46
72
|
message: string;
|
|
73
|
+
/** @internal */
|
|
47
74
|
timestamp: string;
|
|
48
75
|
}
|
|
49
76
|
|
|
77
|
+
/** @internal */
|
|
50
78
|
export type PrimaryPathTraceItemSnapshot =
|
|
51
79
|
| PrimaryPathThinkingTraceItemSnapshot
|
|
52
80
|
| PrimaryPathToolCallTraceItemSnapshot
|
|
53
81
|
| PrimaryPathOperationalTraceItemSnapshot;
|
|
54
82
|
|
|
83
|
+
/** @internal */
|
|
55
84
|
export interface PrimaryPathToolCallSnapshot {
|
|
85
|
+
/** @internal */
|
|
56
86
|
toolCallId: string;
|
|
87
|
+
/** @internal */
|
|
57
88
|
toolName: string;
|
|
89
|
+
/** @internal */
|
|
58
90
|
status: "running" | "completed";
|
|
91
|
+
/** @internal */
|
|
59
92
|
startedAt: string;
|
|
93
|
+
/** @internal */
|
|
60
94
|
completedAt: string | null;
|
|
95
|
+
/** @internal */
|
|
61
96
|
arguments: Record<string, unknown> | null;
|
|
97
|
+
/** @internal */
|
|
62
98
|
result: unknown;
|
|
99
|
+
/** @internal */
|
|
63
100
|
isError: boolean;
|
|
64
101
|
}
|
|
65
102
|
|
|
103
|
+
/** @internal */
|
|
66
104
|
export type TurnUsageSnapshot = UsageSnapshot;
|
|
67
105
|
|
|
106
|
+
/** @internal */
|
|
68
107
|
export interface PrimaryPathActiveTurnSnapshot {
|
|
108
|
+
/** @internal */
|
|
69
109
|
turnRecordId: string;
|
|
110
|
+
/** @internal */
|
|
70
111
|
turnId: string;
|
|
112
|
+
/** @internal */
|
|
71
113
|
turnType: ProcessTurnRecord["turnType"];
|
|
114
|
+
/** @internal */
|
|
72
115
|
pathType: ProcessTurnRecord["pathType"];
|
|
116
|
+
/** @internal */
|
|
73
117
|
startedAt: string;
|
|
118
|
+
/** @internal */
|
|
74
119
|
assistant: PrimaryPathStreamingAssistantSnapshot;
|
|
120
|
+
/** @internal */
|
|
75
121
|
toolCalls: PrimaryPathToolCallSnapshot[];
|
|
122
|
+
/** @internal */
|
|
76
123
|
traceItems: PrimaryPathTraceItemSnapshot[];
|
|
124
|
+
/** @internal */
|
|
77
125
|
usage: TurnUsageSnapshot | null;
|
|
126
|
+
/** @internal */
|
|
78
127
|
eventWindowTruncated: boolean;
|
|
79
128
|
}
|
|
80
129
|
|
|
130
|
+
/** @internal */
|
|
81
131
|
export interface PrimaryPathTurnStateSnapshot {
|
|
132
|
+
/** @internal */
|
|
82
133
|
currentTurnRecordId: string | null;
|
|
134
|
+
/** @internal */
|
|
83
135
|
workerState: WorkerLease["state"] | null;
|
|
136
|
+
/** @internal */
|
|
84
137
|
isStreaming: boolean;
|
|
138
|
+
/** @internal */
|
|
85
139
|
activeTurn: PrimaryPathActiveTurnSnapshot | null;
|
|
86
140
|
}
|
|
87
141
|
|
|
142
|
+
/** @internal */
|
|
88
143
|
export interface PrimaryPathSnapshot {
|
|
144
|
+
/** @internal */
|
|
89
145
|
instanceId: string;
|
|
146
|
+
/** @internal */
|
|
90
147
|
rebuiltAt: string;
|
|
148
|
+
/** @internal */
|
|
91
149
|
primaryPathEntries: PrimaryPathEntrySnapshot[];
|
|
150
|
+
/** @internal */
|
|
92
151
|
currentLeaf: SemanticEntryRef | null;
|
|
152
|
+
/** @internal */
|
|
93
153
|
semanticEntryRefs: ProcessSemanticEntryRefs;
|
|
154
|
+
/** @internal */
|
|
94
155
|
labels: Record<string, string>;
|
|
156
|
+
/** @internal */
|
|
95
157
|
turnAnnotations: ProcessTurnAnnotation[];
|
|
158
|
+
/** @internal */
|
|
96
159
|
detailRail: PrimaryPathDetailRailSnapshot;
|
|
160
|
+
/** @internal */
|
|
97
161
|
turnState: PrimaryPathTurnStateSnapshot;
|
|
98
162
|
}
|