praxis-agent 0.55.1 → 0.55.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/application/session-service.d.ts +0 -7
- package/dist/application/session-service.js +270 -639
- package/dist/application/turn-accounting.d.ts +74 -0
- package/dist/application/turn-accounting.js +444 -0
- package/dist/application/turn-persistence.d.ts +62 -0
- package/dist/application/turn-persistence.js +114 -0
- package/dist/cli/protocol.d.ts +45 -10
- package/dist/cli/protocol.js +283 -139
- package/dist/cli-runtime.js +56 -11
- package/package.json +1 -1
package/dist/cli/protocol.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelDocument, ModelDocumentMediaType, ModelImage, ModelImageMediaType, ModelUsage, RuntimeEventSink } from '../core/runtime.js';
|
|
1
|
+
import type { ModelDocument, ModelDocumentMediaType, ModelImage, ModelImageMediaType, ModelTerminalReason, ModelUsage, RuntimeEventSink } from '../core/runtime.js';
|
|
2
2
|
export type CliInputFormat = 'text' | 'stream-json';
|
|
3
3
|
export type CliOutputFormat = 'text' | 'json' | 'stream-json';
|
|
4
4
|
export type CliPermissionMode = 'acceptEdits' | 'auto' | 'bypassPermissions' | 'manual' | 'dontAsk' | 'plan' | 'default';
|
|
@@ -225,8 +225,25 @@ export interface ProtocolResult {
|
|
|
225
225
|
*/
|
|
226
226
|
modelCostUsd?: Readonly<Record<string, number>>;
|
|
227
227
|
}
|
|
228
|
-
export
|
|
229
|
-
|
|
228
|
+
export interface ProtocolSuccessProjectionContext {
|
|
229
|
+
localCommand?: boolean;
|
|
230
|
+
stopReason?: ModelTerminalReason;
|
|
231
|
+
ttftMs?: number;
|
|
232
|
+
ttftStreamMs?: number;
|
|
233
|
+
timeToRequestMs?: number;
|
|
234
|
+
}
|
|
235
|
+
export interface ProtocolErrorProjectionContext {
|
|
236
|
+
providerApiError?: boolean;
|
|
237
|
+
apiErrorStatus?: number | null;
|
|
238
|
+
}
|
|
239
|
+
export interface ProtocolTimingProjection {
|
|
240
|
+
ttftMs?: number;
|
|
241
|
+
ttftStreamMs?: number;
|
|
242
|
+
timeToRequestMs?: number;
|
|
243
|
+
}
|
|
244
|
+
export declare function projectProtocolTimings(startedAt: number, requestAt?: number, outputAt?: number): ProtocolTimingProjection;
|
|
245
|
+
export declare function createSuccessResult(result: ProtocolResult, info: CliRuntimeInfo, startedAt: number, modelTurns: number, context?: ProtocolSuccessProjectionContext): Record<string, unknown>;
|
|
246
|
+
export declare function createErrorResult(message: string, sessionId: string, startedAt: number, modelTurns: number, context?: ProtocolErrorProjectionContext): Record<string, unknown>;
|
|
230
247
|
/**
|
|
231
248
|
* Returns the argument text of a headless `/color` prompt, or undefined when
|
|
232
249
|
* the prompt is not a bare `/color` command. A trailing space matches with an
|
|
@@ -243,11 +260,9 @@ export declare function parseCliInvocation(argv: readonly string[]): CliInvocati
|
|
|
243
260
|
export declare function readStreamJsonMessages(input: AsyncIterable<string | Uint8Array>): AsyncGenerator<StreamJsonMessage>;
|
|
244
261
|
export declare function readStreamUserMessages(input: AsyncIterable<string | Uint8Array>): AsyncGenerator<StreamUserMessage>;
|
|
245
262
|
export declare class StreamJsonOutput {
|
|
246
|
-
private readonly
|
|
263
|
+
private readonly emitRaw;
|
|
247
264
|
private readonly info;
|
|
248
265
|
private readonly sessionId;
|
|
249
|
-
private readonly includePartialMessages;
|
|
250
|
-
private readonly includeHookEvents;
|
|
251
266
|
private turnId;
|
|
252
267
|
private turnText;
|
|
253
268
|
private turnThinking;
|
|
@@ -261,10 +276,25 @@ export declare class StreamJsonOutput {
|
|
|
261
276
|
private activeThinkingIndex;
|
|
262
277
|
private nextContentIndex;
|
|
263
278
|
private modelTurns;
|
|
279
|
+
private projectionStartedAt;
|
|
280
|
+
private firstRequestAt;
|
|
281
|
+
private firstOutputAt;
|
|
282
|
+
private turnHasRealContent;
|
|
283
|
+
private pendingFailureMessage;
|
|
264
284
|
private compacting;
|
|
265
285
|
private sessionState;
|
|
266
|
-
|
|
267
|
-
|
|
286
|
+
private readonly emitSessionStateEvents;
|
|
287
|
+
private partialEvents;
|
|
288
|
+
private pendingPartialStop;
|
|
289
|
+
constructor(emitRaw: (value: unknown) => void, info: CliRuntimeInfo, sessionId: string, options: {
|
|
290
|
+
includePartialMessages: boolean;
|
|
291
|
+
includeHookEvents?: boolean;
|
|
292
|
+
emitSessionStateEvents?: boolean;
|
|
293
|
+
});
|
|
294
|
+
private readonly includePartialMessages;
|
|
295
|
+
private readonly includeHookEvents;
|
|
296
|
+
private write;
|
|
297
|
+
init(startedAt?: number): void;
|
|
268
298
|
replayUser(message: StreamUserMessage['message']): void;
|
|
269
299
|
/**
|
|
270
300
|
* Emits the synthetic assistant message for a provider-free local command
|
|
@@ -277,16 +307,21 @@ export declare class StreamJsonOutput {
|
|
|
277
307
|
request: Record<string, unknown>;
|
|
278
308
|
}): void;
|
|
279
309
|
readonly sink: RuntimeEventSink;
|
|
280
|
-
result(result: ProtocolResult, startedAt: number): void;
|
|
310
|
+
result(result: ProtocolResult, startedAt: number, context?: ProtocolSuccessProjectionContext): void;
|
|
281
311
|
promptSuggestion(suggestion: string): void;
|
|
282
|
-
error(message: string, startedAt: number): void;
|
|
312
|
+
error(message: string, startedAt: number, context?: ProtocolErrorProjectionContext): void;
|
|
283
313
|
private onEvent;
|
|
284
314
|
private writeSessionState;
|
|
315
|
+
private writeTerminalIdle;
|
|
285
316
|
private ensureTurn;
|
|
317
|
+
private observeOutput;
|
|
286
318
|
private discardTurn;
|
|
287
319
|
private startTurn;
|
|
320
|
+
private writePartialMessageStart;
|
|
288
321
|
private partialText;
|
|
322
|
+
private beginPartialBlock;
|
|
289
323
|
private finishPartial;
|
|
324
|
+
private finishPartialTail;
|
|
290
325
|
private flushAssistant;
|
|
291
326
|
private finishTurn;
|
|
292
327
|
}
|