stk-codegen 1.0.7 → 1.0.9

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.
@@ -1,17 +1,24 @@
1
1
  import { BackendMessage, ClientMessage } from '../types/index.js';
2
2
  type MessageHandler = (data: BackendMessage) => void;
3
- declare class WebSocketClient {
3
+ type StatusChangeHandler = (status: 'connecting' | 'connected' | 'disconnected') => void;
4
+ export declare class WebSocketClient {
4
5
  private ws;
5
6
  private messageHandler;
7
+ private onStatusChange;
6
8
  private sessionId;
7
9
  private handshakeSent;
8
10
  private isConnecting;
9
11
  private connectionPromise;
12
+ private messageQueue;
13
+ private isReadyForUserInput;
14
+ private status;
15
+ private setStatus;
10
16
  private createSession;
11
17
  private setupWebSocketConnection;
18
+ private flushMessageQueue;
12
19
  ensureConnected(): Promise<void>;
13
- connect(messageHandler: MessageHandler): Promise<void>;
14
- send(data: ClientMessage): void;
20
+ connect(messageHandler: MessageHandler, onStatusChange: StatusChangeHandler): Promise<void>;
21
+ send(data: ClientMessage): Promise<void>;
15
22
  }
16
23
  export declare const websocketClient: WebSocketClient;
17
24
  export {};
@@ -1,18 +1,8 @@
1
- export declare const SearchText: (parameters: {
2
- pattern: string;
3
- dir_path?: string;
4
- include?: string;
5
- case_sensitive?: boolean;
6
- fixed_strings?: boolean;
7
- context?: number;
8
- }) => Promise<{
1
+ import { type SearchTextParams } from './searchTextFallback.js';
2
+ export declare const SearchText: (parameters: SearchTextParams) => Promise<{
9
3
  matches: ({
10
4
  file: string;
11
5
  line: any;
12
6
  content: any;
13
7
  } | null)[];
14
- error?: undefined;
15
- } | {
16
- error: any;
17
- matches?: undefined;
18
8
  }>;
@@ -0,0 +1,20 @@
1
+ export type SearchTextParams = {
2
+ pattern: string;
3
+ dir_path?: string;
4
+ include?: string;
5
+ case_sensitive?: boolean;
6
+ fixed_strings?: boolean;
7
+ context?: number;
8
+ };
9
+ export type SearchTextMatch = {
10
+ file: string;
11
+ line: number;
12
+ content: string;
13
+ };
14
+ /**
15
+ * Node-based SearchText fallback that avoids external binaries.
16
+ * Behavior is best-effort compatible with rg: returns line matches and line text.
17
+ */
18
+ export declare const searchTextFallback: (params: SearchTextParams) => Promise<{
19
+ matches: SearchTextMatch[];
20
+ }>;
@@ -9,6 +9,10 @@ export interface ConversationMessage {
9
9
  status: 'streaming' | 'finished';
10
10
  content?: string;
11
11
  };
12
+ highlightedBlock?: {
13
+ language?: string;
14
+ content: string;
15
+ };
12
16
  }
13
17
  export interface PendingShellCommand {
14
18
  tool_name: string;
@@ -33,21 +37,24 @@ export interface ToolResult {
33
37
  payload: {
34
38
  tool_name: string;
35
39
  tool_id: string;
36
- generation_id: string;
40
+ generation_id: string | null;
37
41
  status: 'success' | 'error';
38
- result: any;
42
+ result: any | null;
43
+ error?: string | null;
39
44
  };
40
45
  }
41
46
  export interface ClientCancelGeneration {
42
47
  type: 'client_cancel_generation';
43
48
  payload: {
44
49
  generation_id: string;
50
+ reason?: string;
45
51
  };
46
52
  }
47
53
  export interface AgentGenerationCancelled {
48
54
  type: 'agent_generation_cancelled';
49
55
  payload: {
50
56
  generation_id: string;
57
+ reason?: string | null;
51
58
  };
52
59
  }
53
60
  export interface UserMessage {
@@ -85,6 +92,7 @@ export interface HandshakeMessage {
85
92
  content: string;
86
93
  filePaths: string[];
87
94
  } | null;
95
+ initial_prompt?: string;
88
96
  };
89
97
  }
90
98
  export interface ClientCancelLast {
@@ -95,20 +103,38 @@ export type ClientMessage = UserMessage | MagicCommand | ClientCancelGeneration
95
103
  export type BackendMessage = RunTool | AgentGenerationCancelled | {
96
104
  type: 'agent_error';
97
105
  payload: {
106
+ generation_id?: string;
98
107
  message: string;
99
108
  details?: string;
100
109
  };
101
110
  } | {
102
111
  type: 'agent_message_delta';
103
112
  payload: {
113
+ generation_id?: string;
114
+ content: string;
115
+ };
116
+ } | {
117
+ type: 'agent_message';
118
+ payload: {
119
+ generation_id?: string;
104
120
  content: string;
105
121
  };
106
122
  } | {
107
123
  type: 'agent_thought';
108
124
  payload: {
125
+ generation_id?: string;
109
126
  content: string;
110
127
  };
111
128
  } | {
112
129
  type: 'agent_finished';
130
+ payload: {
131
+ generation_id?: string;
132
+ content?: string;
133
+ };
134
+ } | {
135
+ type: 'handshake_ack';
136
+ payload: Record<string, never>;
137
+ } | {
138
+ type: 'bootstrap_finished';
113
139
  payload: Record<string, never>;
114
140
  };
@@ -7,6 +7,10 @@ export interface StaticMessageView {
7
7
  toolParams?: Record<string, any>;
8
8
  status?: 'running' | 'finished' | 'error';
9
9
  isBootstrap?: boolean;
10
+ highlightedBlock?: {
11
+ language?: string;
12
+ content: string;
13
+ };
10
14
  }
11
15
  export interface ShellRunView {
12
16
  id: string;
@@ -0,0 +1,8 @@
1
+ export type InlineSegment = {
2
+ type: 'text';
3
+ content: string;
4
+ } | {
5
+ type: 'code';
6
+ content: string;
7
+ };
8
+ export declare function parseInlineCodeSegments(text: string): InlineSegment[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stk-codegen",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A CLI executor for the autonomous agent.",
5
5
  "main": "index.js",
6
6
  "bin": {