billion-context-pi 0.1.26 → 0.1.28

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.
@@ -0,0 +1,69 @@
1
+ export interface ToolStartEvent {
2
+ kind: "tool-start";
3
+ toolName: string;
4
+ argsText: string;
5
+ }
6
+ export interface ToolUpdateEvent {
7
+ kind: "tool-update";
8
+ toolCallId: string;
9
+ text: string;
10
+ }
11
+ export interface ToolEndEvent {
12
+ kind: "tool-end";
13
+ toolName: string;
14
+ isError: boolean;
15
+ }
16
+ export interface ReplyDeltaEvent {
17
+ kind: "reply-delta";
18
+ delta: string;
19
+ }
20
+ export interface ReplyCompleteEvent {
21
+ kind: "reply-complete";
22
+ content: string;
23
+ }
24
+ export interface ThinkingDeltaEvent {
25
+ kind: "thinking-delta";
26
+ delta: string;
27
+ }
28
+ export type ParsedEvent = ToolStartEvent | ToolUpdateEvent | ToolEndEvent | ReplyDeltaEvent | ReplyCompleteEvent | ThinkingDeltaEvent | ThinkingEndEvent | RetryStartEvent | RetryEndEvent;
29
+ export interface ThinkingEndEvent {
30
+ kind: "thinking-end";
31
+ }
32
+ /**
33
+ * Accumulates thinking_delta tokens and emits one human-readable line per
34
+ * thinking segment (a segment ends at thinking_end / text_start). Nothing is
35
+ * emitted when showThinking is off.
36
+ */
37
+ export declare class ThinkingCollector {
38
+ private readonly showThinking;
39
+ private buf;
40
+ constructor(showThinking: boolean);
41
+ push(delta: string): void;
42
+ /** Return the segment line to write ("" when empty or disabled), resetting. */
43
+ flush(): string;
44
+ }
45
+ export interface RetryStartEvent {
46
+ kind: "retry-start";
47
+ attempt: number;
48
+ maxAttempts: number;
49
+ delayMs: number;
50
+ errorMessage: string;
51
+ }
52
+ export interface RetryEndEvent {
53
+ kind: "retry-end";
54
+ success: boolean;
55
+ attempt: number;
56
+ }
57
+ export declare function parseEventLine(line: string): ParsedEvent | null;
58
+ /** Join `content[].text` blocks from a tool result / partialResult payload. */
59
+ export declare function extractContentText(payload: unknown): string;
60
+ /** Format a parsed event as human-readable activity file lines (each with a
61
+ * trailing newline; empty when none). */
62
+ export declare function activityLines(ev: ParsedEvent, opts: {
63
+ showThinking: boolean;
64
+ }): string[];
65
+ /**
66
+ * partialResult is an accumulated snapshot (not a delta), so each update
67
+ * carries everything so far. Return only the newly-appended portion.
68
+ */
69
+ export declare function newPortion(text: string, prev: string): string;
@@ -13,6 +13,7 @@ declare const DelegateParams: Type.TObject<{
13
13
  cwd: Type.TOptional<Type.TString>;
14
14
  model: Type.TOptional<Type.TString>;
15
15
  async: Type.TOptional<Type.TBoolean>;
16
+ showThinking: Type.TOptional<Type.TBoolean>;
16
17
  }>;
17
18
  type DelegateArgs = Static<typeof DelegateParams>;
18
19
  declare const CancelParams: Type.TObject<{
@@ -40,5 +41,7 @@ export declare function makeDelegateCancelTool(_pi: ExtensionAPI): ToolDefinitio
40
41
  export declare function buildChildArgs(args: DelegateArgs, rolePrompt: string, ctx: ExtensionContext): Promise<{
41
42
  cliArgs: string[];
42
43
  tmpDir: string;
44
+ isAsync: boolean;
45
+ useJsonStream: boolean;
43
46
  }>;
44
47
  export {};
@@ -0,0 +1,31 @@
1
+ import type { Readable } from "node:stream";
2
+ export interface WatchdogOptions {
3
+ eofGraceMs: number;
4
+ idleMs: number;
5
+ timeoutMs: number;
6
+ killGraceMs: number;
7
+ }
8
+ export interface WatchdogHooks {
9
+ /** True once the run is finalized; watchdogs stop firing. */
10
+ isSettled(): boolean;
11
+ /** The child is about to be killed (SIGTERM). reason explains why. */
12
+ onKill(reason: string): void;
13
+ /** stdout EOF passed without the process exiting; force-finalize now. */
14
+ onEofGrace(): void;
15
+ }
16
+ export interface WatchdogHandle {
17
+ /** Re-arm the idle timer (call on every stdout data). */
18
+ poke(): void;
19
+ /** Stop all timers (call on finalize). */
20
+ dispose(): void;
21
+ }
22
+ /**
23
+ * Guarantees a hung child process gets killed. A stuck child holds its stdout
24
+ * fd open, so stdout EOF never fires — hence the idle timer (no output for
25
+ * idleMs) is the main defense; the hard time limit and the EOF grace period
26
+ * cover the rest. Kill is SIGTERM, escalated to SIGKILL after killGraceMs.
27
+ */
28
+ export declare function attachWatchdogs(child: {
29
+ kill(signal: NodeJS.Signals): boolean;
30
+ stdout: Readable | null;
31
+ }, hooks: WatchdogHooks, opts: WatchdogOptions): WatchdogHandle;