erosolar-cli 1.7.193 → 1.7.194
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/bin/selfTest.d.ts.map +1 -1
- package/dist/bin/selfTest.js +3 -105
- package/dist/bin/selfTest.js.map +1 -1
- package/dist/contracts/module-schema.json +1 -1
- package/dist/core/performanceMonitor.d.ts +18 -0
- package/dist/core/performanceMonitor.d.ts.map +1 -1
- package/dist/core/performanceMonitor.js.map +1 -1
- package/dist/core/schemaValidator.d.ts +38 -0
- package/dist/core/schemaValidator.d.ts.map +1 -1
- package/dist/core/schemaValidator.js +62 -0
- package/dist/core/schemaValidator.js.map +1 -1
- package/dist/core/testUtils.d.ts +121 -0
- package/dist/core/testUtils.d.ts.map +1 -0
- package/dist/core/testUtils.js +235 -0
- package/dist/core/testUtils.js.map +1 -0
- package/dist/core/toolPreconditions.d.ts.map +1 -1
- package/dist/core/toolPreconditions.js +55 -3
- package/dist/core/toolPreconditions.js.map +1 -1
- package/dist/core/toolRuntime.d.ts.map +1 -1
- package/dist/core/toolRuntime.js +7 -12
- package/dist/core/toolRuntime.js.map +1 -1
- package/dist/core/types.d.ts +233 -68
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +75 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/unified/tools.js +1 -1
- package/dist/core/unified/tools.js.map +1 -1
- package/dist/providers/anthropicProvider.js +2 -2
- package/dist/providers/anthropicProvider.js.map +1 -1
- package/dist/providers/openaiChatCompletionsProvider.js +4 -5
- package/dist/providers/openaiChatCompletionsProvider.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +15 -3
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +93 -11
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/shellApp.d.ts.map +1 -1
- package/dist/shell/shellApp.js +16 -0
- package/dist/shell/shellApp.js.map +1 -1
- package/dist/shell/terminalInput.d.ts +6 -2
- package/dist/shell/terminalInput.d.ts.map +1 -1
- package/dist/shell/terminalInput.js +28 -12
- package/dist/shell/terminalInput.js.map +1 -1
- package/dist/shell/terminalInputAdapter.d.ts +2 -3
- package/dist/shell/terminalInputAdapter.d.ts.map +1 -1
- package/dist/shell/terminalInputAdapter.js +2 -3
- package/dist/shell/terminalInputAdapter.js.map +1 -1
- package/dist/tools/editTools.js +2 -2
- package/dist/tools/editTools.js.map +1 -1
- package/dist/ui/display.d.ts +6 -21
- package/dist/ui/display.d.ts.map +1 -1
- package/dist/ui/display.js +88 -177
- package/dist/ui/display.js.map +1 -1
- package/package.json +1 -1
package/dist/core/types.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Provider identifier for multi-provider support
|
|
3
|
+
*/
|
|
1
4
|
export type ProviderId = string;
|
|
5
|
+
/**
|
|
6
|
+
* Reasoning effort levels for AI model optimization
|
|
7
|
+
*/
|
|
2
8
|
export type ReasoningEffortLevel = 'low' | 'medium' | 'high';
|
|
9
|
+
/**
|
|
10
|
+
* Text verbosity levels for output control
|
|
11
|
+
*/
|
|
3
12
|
export type TextVerbosityLevel = 'low' | 'medium' | 'high';
|
|
13
|
+
/**
|
|
14
|
+
* Conversation roles in AI message flow
|
|
15
|
+
*/
|
|
4
16
|
export type ConversationRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
5
17
|
export interface SystemMessage {
|
|
6
18
|
role: 'system';
|
|
@@ -29,99 +41,201 @@ export interface ToolMessage {
|
|
|
29
41
|
content: string;
|
|
30
42
|
toolCallId: string;
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Enhanced discriminated union for type-safe tool responses
|
|
46
|
+
* Provides comprehensive error handling and metadata tracking
|
|
47
|
+
*/
|
|
48
|
+
export interface ToolSuccessResponse {
|
|
49
|
+
readonly type: 'success';
|
|
50
|
+
readonly content: string;
|
|
51
|
+
readonly metadata?: {
|
|
52
|
+
readonly linesRead?: number;
|
|
53
|
+
readonly fileSize?: number;
|
|
54
|
+
readonly executionTime?: number;
|
|
55
|
+
readonly cacheHit?: boolean;
|
|
56
|
+
readonly toolName?: string;
|
|
57
|
+
readonly timestamp?: number;
|
|
40
58
|
};
|
|
41
59
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Structured error response with recovery guidance
|
|
62
|
+
*/
|
|
63
|
+
export interface ToolErrorResponse {
|
|
64
|
+
readonly type: 'error';
|
|
65
|
+
readonly error: {
|
|
66
|
+
readonly code: string;
|
|
67
|
+
readonly message: string;
|
|
68
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
69
|
+
readonly suggestion?: string;
|
|
70
|
+
readonly recoverable: boolean;
|
|
71
|
+
readonly toolName?: string;
|
|
50
72
|
};
|
|
51
73
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Warning response with actionable suggestions
|
|
76
|
+
*/
|
|
77
|
+
export interface ToolWarningResponse {
|
|
78
|
+
readonly type: 'warning';
|
|
79
|
+
readonly content: string;
|
|
80
|
+
readonly warnings: ReadonlyArray<{
|
|
81
|
+
readonly code: string;
|
|
82
|
+
readonly message: string;
|
|
83
|
+
readonly severity: 'critical' | 'warning' | 'info';
|
|
84
|
+
readonly suggestion: string;
|
|
60
85
|
}>;
|
|
61
86
|
}
|
|
62
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Progress update for long-running operations
|
|
89
|
+
*/
|
|
90
|
+
export interface ToolProgressResponse {
|
|
91
|
+
readonly type: 'progress';
|
|
92
|
+
readonly progress: number;
|
|
93
|
+
readonly message: string;
|
|
94
|
+
readonly metadata?: {
|
|
95
|
+
readonly estimatedRemaining?: number;
|
|
96
|
+
readonly currentStep?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Comprehensive tool response union for AI flow control
|
|
101
|
+
*/
|
|
102
|
+
export type ToolResponse = ToolSuccessResponse | ToolErrorResponse | ToolWarningResponse | ToolProgressResponse;
|
|
103
|
+
/**
|
|
104
|
+
* Type guard for successful tool responses
|
|
105
|
+
*/
|
|
106
|
+
export declare function isToolSuccess(response: ToolResponse): response is ToolSuccessResponse;
|
|
107
|
+
/**
|
|
108
|
+
* Type guard for error tool responses
|
|
109
|
+
*/
|
|
110
|
+
export declare function isToolError(response: ToolResponse): response is ToolErrorResponse;
|
|
111
|
+
/**
|
|
112
|
+
* Type guard for warning tool responses
|
|
113
|
+
*/
|
|
114
|
+
export declare function isToolWarning(response: ToolResponse): response is ToolWarningResponse;
|
|
115
|
+
/**
|
|
116
|
+
* Type guard for progress tool responses
|
|
117
|
+
*/
|
|
118
|
+
export declare function isToolProgress(response: ToolResponse): response is ToolProgressResponse;
|
|
63
119
|
export type ConversationMessage = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
|
|
120
|
+
/**
|
|
121
|
+
* Base interface for all JSON Schema property definitions
|
|
122
|
+
*/
|
|
64
123
|
export interface JSONSchemaPropertyBase {
|
|
65
|
-
description?: string;
|
|
124
|
+
readonly description?: string;
|
|
125
|
+
readonly nullable?: boolean;
|
|
126
|
+
readonly deprecated?: boolean;
|
|
127
|
+
readonly readOnly?: boolean;
|
|
128
|
+
readonly writeOnly?: boolean;
|
|
66
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* String schema with validation constraints
|
|
132
|
+
*/
|
|
67
133
|
export interface JSONSchemaString extends JSONSchemaPropertyBase {
|
|
68
|
-
type: 'string';
|
|
69
|
-
enum?: string
|
|
70
|
-
minLength?: number;
|
|
71
|
-
|
|
134
|
+
readonly type: 'string';
|
|
135
|
+
readonly enum?: ReadonlyArray<string>;
|
|
136
|
+
readonly minLength?: number;
|
|
137
|
+
readonly maxLength?: number;
|
|
138
|
+
readonly pattern?: string;
|
|
139
|
+
readonly format?: 'date-time' | 'email' | 'uri' | 'uuid' | 'hostname';
|
|
140
|
+
readonly default?: string;
|
|
72
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Number schema with validation constraints
|
|
144
|
+
*/
|
|
73
145
|
export interface JSONSchemaNumber extends JSONSchemaPropertyBase {
|
|
74
|
-
type: 'number';
|
|
146
|
+
readonly type: 'number';
|
|
147
|
+
readonly minimum?: number;
|
|
148
|
+
readonly maximum?: number;
|
|
149
|
+
readonly exclusiveMinimum?: number;
|
|
150
|
+
readonly exclusiveMaximum?: number;
|
|
151
|
+
readonly multipleOf?: number;
|
|
152
|
+
readonly default?: number;
|
|
75
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Boolean schema
|
|
156
|
+
*/
|
|
76
157
|
export interface JSONSchemaBoolean extends JSONSchemaPropertyBase {
|
|
77
|
-
type: 'boolean';
|
|
158
|
+
readonly type: 'boolean';
|
|
159
|
+
readonly default?: boolean;
|
|
78
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Array schema with item validation
|
|
163
|
+
*/
|
|
79
164
|
export interface JSONSchemaArray extends JSONSchemaPropertyBase {
|
|
80
|
-
type: 'array';
|
|
81
|
-
items: JSONSchemaProperty;
|
|
165
|
+
readonly type: 'array';
|
|
166
|
+
readonly items: JSONSchemaProperty;
|
|
167
|
+
readonly minItems?: number;
|
|
168
|
+
readonly maxItems?: number;
|
|
169
|
+
readonly uniqueItems?: boolean;
|
|
82
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Union type for all JSON Schema property types
|
|
173
|
+
*/
|
|
83
174
|
export type JSONSchemaProperty = JSONSchemaString | JSONSchemaNumber | JSONSchemaBoolean | JSONSchemaArray | JSONSchemaObject;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Object schema with property validation
|
|
177
|
+
*/
|
|
178
|
+
export interface JSONSchemaObject extends JSONSchemaPropertyBase {
|
|
179
|
+
readonly type: 'object';
|
|
180
|
+
readonly properties?: Readonly<Record<string, JSONSchemaProperty>>;
|
|
181
|
+
readonly required?: ReadonlyArray<string>;
|
|
182
|
+
readonly additionalProperties?: boolean;
|
|
183
|
+
readonly minProperties?: number;
|
|
184
|
+
readonly maxProperties?: number;
|
|
91
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Definition of a tool available to AI providers
|
|
188
|
+
*/
|
|
92
189
|
export interface ProviderToolDefinition {
|
|
93
|
-
name: string;
|
|
94
|
-
description: string;
|
|
95
|
-
parameters?: JSONSchemaObject;
|
|
190
|
+
readonly name: string;
|
|
191
|
+
readonly description: string;
|
|
192
|
+
readonly parameters?: JSONSchemaObject;
|
|
96
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Token usage statistics from AI provider
|
|
196
|
+
*/
|
|
97
197
|
export interface ProviderUsage {
|
|
98
|
-
inputTokens?: number;
|
|
99
|
-
outputTokens?: number;
|
|
100
|
-
totalTokens?: number;
|
|
198
|
+
readonly inputTokens?: number;
|
|
199
|
+
readonly outputTokens?: number;
|
|
200
|
+
readonly totalTokens?: number;
|
|
101
201
|
}
|
|
102
|
-
/**
|
|
202
|
+
/**
|
|
203
|
+
* Why the model stopped generating - critical for agentic loop control
|
|
204
|
+
*/
|
|
103
205
|
export type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'stop_sequence';
|
|
206
|
+
/**
|
|
207
|
+
* Base interface for all provider responses
|
|
208
|
+
*/
|
|
104
209
|
export interface ProviderResponseBase {
|
|
105
|
-
usage?: ProviderUsage | null;
|
|
210
|
+
readonly usage?: ProviderUsage | null;
|
|
106
211
|
/** Why the model stopped - determines if auto-continuation is needed */
|
|
107
|
-
stopReason?: StopReason;
|
|
212
|
+
readonly stopReason?: StopReason;
|
|
108
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Discriminated union for provider responses
|
|
216
|
+
*/
|
|
109
217
|
export type ProviderResponse = (ProviderResponseBase & {
|
|
110
|
-
type: 'message';
|
|
111
|
-
content: string;
|
|
218
|
+
readonly type: 'message';
|
|
219
|
+
readonly content: string;
|
|
112
220
|
}) | (ProviderResponseBase & {
|
|
113
|
-
type: 'tool_calls';
|
|
114
|
-
toolCalls: ToolCallRequest[];
|
|
115
|
-
content?: string;
|
|
221
|
+
readonly type: 'tool_calls';
|
|
222
|
+
readonly toolCalls: ToolCallRequest[];
|
|
223
|
+
readonly content?: string;
|
|
116
224
|
});
|
|
225
|
+
/**
|
|
226
|
+
* Streaming chunk for real-time AI responses
|
|
227
|
+
*/
|
|
117
228
|
export interface StreamChunk {
|
|
118
|
-
type: 'content' | 'tool_call' | 'usage' | 'done';
|
|
119
|
-
content?: string;
|
|
120
|
-
toolCall?: ToolCallRequest;
|
|
121
|
-
usage?: ProviderUsage;
|
|
229
|
+
readonly type: 'content' | 'tool_call' | 'usage' | 'done';
|
|
230
|
+
readonly content?: string;
|
|
231
|
+
readonly toolCall?: ToolCallRequest;
|
|
232
|
+
readonly usage?: ProviderUsage;
|
|
122
233
|
/** Stop reason from the final message - included with 'done' chunk */
|
|
123
|
-
stopReason?: StopReason;
|
|
234
|
+
readonly stopReason?: StopReason;
|
|
124
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* AI Provider interface for multi-provider support
|
|
238
|
+
*/
|
|
125
239
|
export interface LLMProvider {
|
|
126
240
|
readonly id: ProviderId;
|
|
127
241
|
readonly model: string;
|
|
@@ -129,13 +243,64 @@ export interface LLMProvider {
|
|
|
129
243
|
generateStream?(messages: ConversationMessage[], tools: ProviderToolDefinition[]): AsyncIterableIterator<StreamChunk>;
|
|
130
244
|
getCapabilities?(): ProviderCapabilities;
|
|
131
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Capabilities of an AI provider
|
|
248
|
+
*/
|
|
132
249
|
export interface ProviderCapabilities {
|
|
133
|
-
streaming: boolean;
|
|
134
|
-
toolCalling: boolean;
|
|
135
|
-
vision: boolean;
|
|
136
|
-
functionCalling: boolean;
|
|
137
|
-
maxTokens: number;
|
|
138
|
-
supportedModalities:
|
|
139
|
-
}
|
|
140
|
-
|
|
250
|
+
readonly streaming: boolean;
|
|
251
|
+
readonly toolCalling: boolean;
|
|
252
|
+
readonly vision: boolean;
|
|
253
|
+
readonly functionCalling: boolean;
|
|
254
|
+
readonly maxTokens: number;
|
|
255
|
+
readonly supportedModalities: ReadonlyArray<'text' | 'image' | 'audio'>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Type-safe Result pattern for error handling
|
|
259
|
+
* Eliminates the need for try-catch blocks and provides compile-time safety
|
|
260
|
+
*/
|
|
261
|
+
export type Result<T, E = Error> = {
|
|
262
|
+
readonly ok: true;
|
|
263
|
+
readonly value: T;
|
|
264
|
+
} | {
|
|
265
|
+
readonly ok: false;
|
|
266
|
+
readonly error: E;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Type guard for successful Result
|
|
270
|
+
*/
|
|
271
|
+
export declare function isOk<T, E>(result: Result<T, E>): result is {
|
|
272
|
+
readonly ok: true;
|
|
273
|
+
readonly value: T;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Type guard for failed Result
|
|
277
|
+
*/
|
|
278
|
+
export declare function isErr<T, E>(result: Result<T, E>): result is {
|
|
279
|
+
readonly ok: false;
|
|
280
|
+
readonly error: E;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Creates a successful Result
|
|
284
|
+
*/
|
|
285
|
+
export declare function ok<T>(value: T): Result<T, never>;
|
|
286
|
+
/**
|
|
287
|
+
* Creates a failed Result
|
|
288
|
+
*/
|
|
289
|
+
export declare function err<E>(error: E): Result<never, E>;
|
|
290
|
+
/**
|
|
291
|
+
* Unwraps a Result, throwing if it's an error
|
|
292
|
+
*/
|
|
293
|
+
export declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
294
|
+
/**
|
|
295
|
+
* Unwraps a Result, returning a default value if it's an error
|
|
296
|
+
*/
|
|
297
|
+
export declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
|
|
298
|
+
/**
|
|
299
|
+
* Maps a successful Result to a new value
|
|
300
|
+
*/
|
|
301
|
+
export declare function map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
302
|
+
/**
|
|
303
|
+
* Maps an error Result to a new error
|
|
304
|
+
*/
|
|
305
|
+
export declare function mapErr<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
141
306
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IA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AE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAEvF"}
|
package/dist/core/types.js
CHANGED
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type guard for successful tool responses
|
|
3
|
+
*/
|
|
4
|
+
export function isToolSuccess(response) {
|
|
5
|
+
return response.type === 'success';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Type guard for error tool responses
|
|
9
|
+
*/
|
|
10
|
+
export function isToolError(response) {
|
|
11
|
+
return response.type === 'error';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Type guard for warning tool responses
|
|
15
|
+
*/
|
|
16
|
+
export function isToolWarning(response) {
|
|
17
|
+
return response.type === 'warning';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Type guard for progress tool responses
|
|
21
|
+
*/
|
|
22
|
+
export function isToolProgress(response) {
|
|
23
|
+
return response.type === 'progress';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type guard for successful Result
|
|
27
|
+
*/
|
|
28
|
+
export function isOk(result) {
|
|
29
|
+
return result.ok;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Type guard for failed Result
|
|
33
|
+
*/
|
|
34
|
+
export function isErr(result) {
|
|
35
|
+
return !result.ok;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a successful Result
|
|
39
|
+
*/
|
|
40
|
+
export function ok(value) {
|
|
41
|
+
return { ok: true, value };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a failed Result
|
|
45
|
+
*/
|
|
46
|
+
export function err(error) {
|
|
47
|
+
return { ok: false, error };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Unwraps a Result, throwing if it's an error
|
|
51
|
+
*/
|
|
52
|
+
export function unwrap(result) {
|
|
53
|
+
if (result.ok) {
|
|
54
|
+
return result.value;
|
|
55
|
+
}
|
|
56
|
+
throw result.error;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Unwraps a Result, returning a default value if it's an error
|
|
60
|
+
*/
|
|
61
|
+
export function unwrapOr(result, defaultValue) {
|
|
62
|
+
return result.ok ? result.value : defaultValue;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Maps a successful Result to a new value
|
|
66
|
+
*/
|
|
67
|
+
export function map(result, fn) {
|
|
68
|
+
return result.ok ? { ok: true, value: fn(result.value) } : result;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Maps an error Result to a new error
|
|
72
|
+
*/
|
|
73
|
+
export function mapErr(result, fn) {
|
|
74
|
+
return result.ok ? result : { ok: false, error: fn(result.error) };
|
|
75
|
+
}
|
|
2
76
|
//# sourceMappingURL=types.js.map
|
package/dist/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAyHA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAsB;IAClD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAsB;IAChD,OAAO,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAsB;IAClD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAsB;IACnD,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAC;AACtC,CAAC;AA2KD;;GAEG;AACH,MAAM,UAAU,IAAI,CAAO,MAAo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|
@@ -127,7 +127,7 @@ export function createWriteTool(workingDir) {
|
|
|
127
127
|
export function createEditTool(workingDir) {
|
|
128
128
|
return {
|
|
129
129
|
name: 'Edit',
|
|
130
|
-
description: 'Performs exact string replacements in files. CRITICAL: ALWAYS use Read tool FIRST to get exact text
|
|
130
|
+
description: 'Performs exact string replacements in files. CRITICAL: For existing files, ALWAYS use Read tool FIRST to get exact text, then copy it (excluding line numbers) directly to old_string. Use Edit for small changes - faster than Write and shows diffs. To CREATE new file, use empty old_string (no prior read needed). To DELETE text, use empty new_string. Edit FAILS if old_string not unique unless replace_all is true.',
|
|
131
131
|
category: 'core',
|
|
132
132
|
cacheable: false,
|
|
133
133
|
parameters: {
|