@aria-cli/types 1.0.18 → 1.0.31

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.
Files changed (46) hide show
  1. package/{dist-cjs/errors.d.ts → dist/errors.js} +20 -5
  2. package/dist/index.js +11 -1
  3. package/dist/logger.js +163 -0
  4. package/dist/memoria.js +10 -0
  5. package/dist/models.js +17 -0
  6. package/dist/native-tools.js +29 -0
  7. package/dist/relaunch.js +59 -0
  8. package/dist/stall-phase.js +14 -0
  9. package/dist/tool-outputs.js +4 -0
  10. package/dist-cjs/errors.js +49 -0
  11. package/dist-cjs/index.js +29 -1
  12. package/dist-cjs/logger.js +166 -0
  13. package/dist-cjs/memoria.js +11 -0
  14. package/dist-cjs/models.js +21 -0
  15. package/dist-cjs/native-tools.js +33 -0
  16. package/dist-cjs/relaunch.js +67 -0
  17. package/dist-cjs/stall-phase.js +18 -0
  18. package/dist-cjs/tool-outputs.js +5 -0
  19. package/package.json +4 -2
  20. package/dist/errors.d.ts +0 -29
  21. package/dist/index.d.ts +0 -11
  22. package/dist/logger.d.ts +0 -54
  23. package/dist/memoria.d.ts +0 -428
  24. package/dist/models.d.ts +0 -322
  25. package/dist/native-tools.d.ts +0 -57
  26. package/dist/relaunch.d.ts +0 -22
  27. package/dist/stall-phase.d.ts +0 -2
  28. package/dist/tool-outputs.d.ts +0 -37
  29. package/dist-cjs/index.d.ts +0 -11
  30. package/dist-cjs/logger.d.ts +0 -54
  31. package/dist-cjs/memoria.d.ts +0 -428
  32. package/dist-cjs/models.d.ts +0 -322
  33. package/dist-cjs/native-tools.d.ts +0 -57
  34. package/dist-cjs/relaunch.d.ts +0 -22
  35. package/dist-cjs/src/errors.d.ts +0 -29
  36. package/dist-cjs/src/index.d.ts +0 -10
  37. package/dist-cjs/src/logger.d.ts +0 -22
  38. package/dist-cjs/src/memoria.d.ts +0 -418
  39. package/dist-cjs/src/models.d.ts +0 -322
  40. package/dist-cjs/src/native-tools.d.ts +0 -57
  41. package/dist-cjs/src/relaunch.d.ts +0 -22
  42. package/dist-cjs/src/tool-outputs.d.ts +0 -37
  43. package/dist-cjs/stall-phase.d.ts +0 -2
  44. package/dist-cjs/tests/logger.test.d.ts +0 -1
  45. package/dist-cjs/tool-outputs.d.ts +0 -37
  46. package/dist-cjs/vitest.config.d.ts +0 -2
@@ -1,322 +0,0 @@
1
- /**
2
- * Types for ARIA's multi-model system
3
- * @module @aria-cli/types/models
4
- */
5
- import type { NativeToolMetadata } from "./native-tools.js";
6
- /**
7
- * Supported model providers
8
- */
9
- export type ModelProvider = "anthropic" | "openai" | "github-copilot" | "openai-codex" | "google" | "local" | "bedrock" | "bedrock-converse";
10
- /**
11
- * Model tier for task routing
12
- * - 'fast': Quick responses, simple tasks (e.g., Haiku, GPT-4o-mini)
13
- * - 'balanced': Good balance of speed and capability (e.g., Sonnet, GPT-5.2)
14
- * - 'powerful': Maximum capability for complex tasks (e.g., Opus, o1)
15
- * - 'ensemble': Multiple models working together
16
- */
17
- export type ModelTier = "fast" | "balanced" | "powerful" | "ensemble";
18
- /**
19
- * Configuration for a specific model
20
- */
21
- export interface ModelConfig {
22
- /** Model provider */
23
- provider: ModelProvider;
24
- /** Model identifier (e.g., 'claude-opus-4-6') */
25
- modelId: string;
26
- /** Human-readable name */
27
- name: string;
28
- /** Model tier classification */
29
- tier: ModelTier;
30
- /** Maximum context window size in tokens */
31
- maxContextTokens: number;
32
- /** Maximum output tokens */
33
- maxOutputTokens: number;
34
- /** Cost per million input tokens (USD) */
35
- inputCostPerMillion: number;
36
- /** Cost per million output tokens (USD) */
37
- outputCostPerMillion: number;
38
- /** Capabilities this model supports */
39
- capabilities: {
40
- /** Supports tool/function calling */
41
- tools: boolean;
42
- /** Supports vision/image input */
43
- vision: boolean;
44
- /** Supports structured output (JSON mode) */
45
- structuredOutput: boolean;
46
- /** Supports streaming responses */
47
- streaming: boolean;
48
- };
49
- /** API endpoint (for local/custom providers) */
50
- endpoint?: string;
51
- /** Additional provider-specific options */
52
- options?: Record<string, unknown>;
53
- }
54
- /**
55
- * Configuration for the model router
56
- */
57
- export interface ModelRouterConfig {
58
- /** Default model tier to use */
59
- defaultTier: ModelTier;
60
- /** Available models by tier */
61
- models: {
62
- fast: ModelConfig[];
63
- balanced: ModelConfig[];
64
- powerful: ModelConfig[];
65
- ensemble?: ModelConfig[];
66
- };
67
- /** Rules for automatic tier selection */
68
- routingRules: {
69
- /** Use powerful tier for tasks with risk above this level */
70
- riskThreshold: number;
71
- /** Use powerful tier for tasks with complexity above this score */
72
- complexityThreshold: number;
73
- /** Maximum cost per request before requiring approval (USD) */
74
- costThreshold: number;
75
- };
76
- /** Fallback model if primary fails */
77
- fallbackModel?: ModelConfig;
78
- }
79
- /**
80
- * Role of a message in a conversation
81
- */
82
- export type MessageRole = "system" | "user" | "assistant" | "tool";
83
- /**
84
- * A message in a conversation
85
- */
86
- export interface Message {
87
- /** Role of the message sender */
88
- role: MessageRole;
89
- /** Text content of the message */
90
- content: string;
91
- /** Name of the sender (optional) */
92
- name?: string;
93
- /** Tool call ID this message is responding to (for tool role) */
94
- toolCallId?: string;
95
- /** Tool calls requested by the assistant for execution (present on assistant messages with tool_use blocks) */
96
- toolCalls?: ToolCall[];
97
- /** Image attachments (for vision models) */
98
- images?: {
99
- /** Base64 encoded image data or URL */
100
- data: string;
101
- /** MIME type of the image */
102
- mimeType: string;
103
- }[];
104
- }
105
- /**
106
- * JSON Schema for function tool parameters
107
- */
108
- export interface FunctionToolParameters {
109
- type: "object";
110
- properties: Record<string, unknown>;
111
- required?: string[];
112
- [key: string]: unknown;
113
- }
114
- /**
115
- * Function tool schema (standard ARIA tool)
116
- */
117
- export interface FunctionToolSchema {
118
- kind: "function";
119
- name: string;
120
- description: string;
121
- parameters: FunctionToolParameters;
122
- /** When true, the provider defers loading this tool until needed */
123
- defer_loading?: boolean;
124
- /** Native-only fields are forbidden on function tools */
125
- provider?: never;
126
- capability?: never;
127
- config?: never;
128
- suppresses?: never;
129
- }
130
- /**
131
- * Provider-native passthrough tool schema
132
- */
133
- export interface NativeToolSchema {
134
- kind: "native";
135
- /** Provider that supplies this native tool */
136
- provider: "anthropic" | "openai" | "google";
137
- /** Native capability identifier */
138
- capability: string;
139
- /** Provider-specific native tool payload */
140
- config: Record<string, unknown>;
141
- /** ARIA function tools suppressed by this native tool */
142
- suppresses?: string[];
143
- /** Function-only fields are forbidden on native tools */
144
- name?: never;
145
- description?: never;
146
- parameters?: never;
147
- defer_loading?: never;
148
- }
149
- /**
150
- * Tool schema for model requests (discriminated by `kind`)
151
- */
152
- export type ToolSchema = FunctionToolSchema | NativeToolSchema;
153
- /**
154
- * Type guard for function tools
155
- */
156
- export declare function isFunctionToolSchema(tool: ToolSchema): tool is FunctionToolSchema;
157
- /**
158
- * Type guard for native tools
159
- */
160
- export declare function isNativeToolSchema(tool: ToolSchema): tool is NativeToolSchema;
161
- /**
162
- * A tool call requested by the model
163
- */
164
- export interface ToolCall {
165
- /** Unique identifier for this tool call */
166
- id: string;
167
- /** Name of the tool to call */
168
- name: string;
169
- /** Arguments to pass to the tool */
170
- arguments: Record<string, unknown>;
171
- /** Gemini thought signature — must be replayed verbatim in conversation history */
172
- thoughtSignature?: string;
173
- }
174
- /**
175
- * Thinking mode for models that support extended reasoning.
176
- * - 'adaptive': Model decides when and how much to think (Opus 4.6+, recommended)
177
- * - 'enabled': Explicit thinking with a token budget (Sonnet 4.5, Opus 4.5)
178
- */
179
- export type ThinkingMode = "adaptive" | "enabled";
180
- /**
181
- * Configuration for extended thinking/reasoning
182
- */
183
- export interface ThinkingConfig {
184
- /** Thinking mode */
185
- mode: ThinkingMode;
186
- /** Token budget for thinking (required for 'enabled' mode, ignored for 'adaptive') */
187
- budgetTokens?: number;
188
- }
189
- /**
190
- * Effort level controlling reasoning depth vs speed/cost.
191
- * - 'low': Fastest, cheapest. Skips thinking for simple tasks.
192
- * - 'medium': Balanced. May skip thinking for very simple queries.
193
- * - 'high': Default. Deep reasoning on complex tasks.
194
- * - 'max': Maximum capability, no constraints. Opus 4.6 only.
195
- */
196
- export type EffortLevel = "low" | "medium" | "high" | "max";
197
- /**
198
- * A thinking block from a model's internal reasoning process
199
- */
200
- export interface ThinkingBlock {
201
- /** The thinking text content (empty string if redacted) */
202
- thinking: string;
203
- /** Cryptographic signature for verification (required for tool-use continuations) */
204
- signature?: string;
205
- /** Whether this block was redacted by safety systems */
206
- redacted?: boolean;
207
- }
208
- /**
209
- * Request to a model
210
- */
211
- export interface ModelRequest {
212
- /** Messages in the conversation */
213
- messages: Message[];
214
- /** System prompt (if not in messages) */
215
- systemPrompt?: string;
216
- /** Available tools */
217
- tools?: ToolSchema[];
218
- /** Temperature for sampling (0-2) */
219
- temperature?: number;
220
- /** Maximum tokens to generate */
221
- maxTokens?: number;
222
- /** Stop sequences */
223
- stopSequences?: string[];
224
- /** Whether to stream the response */
225
- stream?: boolean;
226
- /** Force structured JSON output */
227
- jsonMode?: boolean;
228
- /** Extended thinking configuration */
229
- thinking?: ThinkingConfig;
230
- /** Effort level for response quality vs speed/cost tradeoff */
231
- effort?: EffortLevel;
232
- /** Tool choice strategy (e.g. "auto", "none", or a specific tool name) */
233
- tool_choice?: string;
234
- /** Request metadata */
235
- metadata?: {
236
- /** Task ID for tracking */
237
- taskId?: string;
238
- /** User ID for billing */
239
- userId?: string;
240
- /** Request priority */
241
- priority?: "low" | "normal" | "high";
242
- };
243
- /** Callback for streaming thinking blocks as they arrive (Gemini 2.5+/3.x).
244
- * Allows the runner to yield thinking events during model streaming
245
- * instead of waiting for the full response. */
246
- onThinking?: (text: string) => void;
247
- /** AbortSignal for cancelling in-flight HTTP requests.
248
- * Passed through to provider fetch() calls so Ctrl+C cancels immediately
249
- * instead of waiting for the next network chunk. */
250
- abortSignal?: AbortSignal;
251
- }
252
- /** Capabilities that a model provider supports */
253
- export interface ProviderCapabilities {
254
- /** Whether the provider supports structured JSON output */
255
- jsonMode: boolean;
256
- /** Whether the provider supports extended thinking */
257
- thinking: boolean;
258
- /** Whether the provider supports tool/function calling */
259
- toolUse: boolean;
260
- /** Whether the provider supports streaming responses */
261
- streaming: boolean;
262
- /** Whether the provider supports native defer_loading on tool schemas */
263
- nativeDeferredLoading: boolean;
264
- /** Whether the provider supports native web search */
265
- nativeSearch: boolean;
266
- /** Whether the provider supports native web fetch */
267
- nativeFetch: boolean;
268
- /** Whether the provider supports native code execution */
269
- nativeCodeExec: boolean;
270
- /** Whether the provider supports native computer use */
271
- nativeComputerUse: boolean;
272
- /** Whether the provider supports native image generation */
273
- nativeImageGen: boolean;
274
- /** Whether the provider supports native file search */
275
- nativeFileSearch: boolean;
276
- }
277
- /**
278
- * Usage statistics from a model response
279
- */
280
- export interface ModelUsage {
281
- /** Input tokens consumed (TOTAL context window — includes cached tokens) */
282
- inputTokens: number;
283
- /** Output tokens generated */
284
- outputTokens: number;
285
- /** Total tokens (input + output) */
286
- totalTokens: number;
287
- /** Estimated cost in USD */
288
- estimatedCost: number;
289
- /** Thinking tokens consumed (subset of outputTokens, if available) */
290
- thinkingTokens?: number;
291
- /** Tokens read from prompt cache (subset of inputTokens) */
292
- cacheReadTokens?: number;
293
- /** Tokens written to prompt cache (subset of inputTokens) */
294
- cacheCreationTokens?: number;
295
- }
296
- /**
297
- * Response from a model
298
- */
299
- export interface ModelResponse {
300
- /** The model's text response */
301
- content: string;
302
- /** Tool calls requested by the model */
303
- toolCalls?: ToolCall[];
304
- /** Why the model stopped generating */
305
- stopReason: "end" | "max_tokens" | "tool_call" | "stop_sequence" | "aborted";
306
- /** Token usage statistics */
307
- usage: ModelUsage;
308
- /** Model that generated the response */
309
- model: string;
310
- /** Response generation time in milliseconds */
311
- latency: number;
312
- /** Unique ID for this response */
313
- responseId: string;
314
- /** Thinking blocks from the model's reasoning process */
315
- thinking?: ThinkingBlock[];
316
- /** Raw content blocks from the API (for tool-use continuations with thinking) */
317
- rawContentBlocks?: unknown[];
318
- /** Provider that generated the response */
319
- provider?: ModelProvider;
320
- /** Native tool metadata (e.g., search results, code exec output) */
321
- nativeToolMetadata?: NativeToolMetadata;
322
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * Native tool types and type guards for provider-native capabilities
3
- * @module @aria-cli/types/native-tools
4
- */
5
- import type { ToolCall } from "./models.js";
6
- /**
7
- * Type guard to check if a tool call is a function/custom tool
8
- * (as opposed to a native provider tool like search or code execution)
9
- */
10
- export declare function isFunctionTool(toolCall: ToolCall): boolean;
11
- /**
12
- * Type guard to check if a tool call is a native provider tool
13
- * Native tools have special name prefixes like "brave_search", "computer", etc.
14
- */
15
- export declare function isNativeTool(toolCall: ToolCall): boolean;
16
- /**
17
- * A single source from a search result
18
- */
19
- export interface NormalizedSource {
20
- /** URL of the source */
21
- url: string;
22
- /** Title of the source */
23
- title: string;
24
- /** Optional snippet/excerpt from the source */
25
- snippet?: string;
26
- /** Confidence score (0-1) if provided by the search API */
27
- confidence?: number;
28
- /** Which segments of the response cited this source */
29
- citedSegments?: Array<{
30
- text: string;
31
- startIndex: number;
32
- endIndex: number;
33
- }>;
34
- }
35
- /**
36
- * Normalized metadata for native search tool calls
37
- * Abstracts over provider-specific search APIs (Anthropic Brave, Google Search, etc.)
38
- */
39
- export interface NormalizedSearchMetadata {
40
- /** Provider that executed the search */
41
- provider: "anthropic" | "openai" | "google";
42
- /** Search queries executed (may be multiple if refined) */
43
- queries: string[];
44
- /** Sources returned by the search */
45
- sources: NormalizedSource[];
46
- /** The grounded response generated from search results (if available) */
47
- groundedResponse?: string;
48
- }
49
- /**
50
- * Metadata attached to ModelResponse when native tools are used
51
- */
52
- export interface NativeToolMetadata {
53
- /** Search metadata (if native search was used) */
54
- search?: NormalizedSearchMetadata;
55
- /** Raw provider-specific metadata for other native tools */
56
- raw?: unknown;
57
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Magic exit code that tells the parent supervisor to respawn the child.
3
- */
4
- export declare const RELAUNCH_EXIT_CODE = 199;
5
- /**
6
- * Environment variables used by relaunch/supervisor flows.
7
- */
8
- export declare const NO_RELAUNCH_ENV = "ARIA_NO_RELAUNCH";
9
- export declare const RESUME_SESSION_ENV = "ARIA_RESUME_SESSION_ID";
10
- export declare const RESUME_ARION_ENV = "ARIA_RESUME_ARION";
11
- export declare const RESTART_KIND_ENV = "ARIA_RESTART_KIND";
12
- export interface RelaunchMarker {
13
- sessionId: string | null;
14
- arionName: string;
15
- pid: number;
16
- timestamp: string;
17
- }
18
- export declare function getRelaunchMarkerDir(): string;
19
- export declare function getRelaunchMarkerPath(pid?: number): string;
20
- export declare function writeRelaunchMarker(marker: RelaunchMarker): void;
21
- export declare function readRelaunchMarker(pid?: number): RelaunchMarker | null;
22
- export declare function clearRelaunchMarker(pid?: number): void;
@@ -1,37 +0,0 @@
1
- /** Canonical output shapes for tools with dedicated renderers.
2
- * Executors MUST return these shapes. Renderers consume them directly. */
3
- export interface EditFileOutput {
4
- filePath: string;
5
- structuredPatch: Array<{
6
- oldStart: number;
7
- oldLines: number;
8
- newStart: number;
9
- newLines: number;
10
- lines: string[];
11
- }>;
12
- replacements: number;
13
- strategy: string;
14
- }
15
- export interface WriteFileOutput {
16
- filePath: string;
17
- action: "created" | "overwritten" | "appended";
18
- bytesWritten: number;
19
- structuredPatch?: Array<{
20
- oldStart: number;
21
- oldLines: number;
22
- newStart: number;
23
- newLines: number;
24
- lines: string[];
25
- }>;
26
- }
27
- export interface BashToolOutput {
28
- stdout: string;
29
- stderr: string;
30
- exitCode: number;
31
- }
32
- export interface NotebookEditOutput {
33
- cellNumber: number;
34
- newSource: string;
35
- language: string;
36
- error?: string;
37
- }
@@ -1,2 +0,0 @@
1
- export declare function setGlobalStallPhase(label: string): void;
2
- export declare function clearGlobalStallPhase(): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,37 +0,0 @@
1
- /** Canonical output shapes for tools with dedicated renderers.
2
- * Executors MUST return these shapes. Renderers consume them directly. */
3
- export interface EditFileOutput {
4
- filePath: string;
5
- structuredPatch: Array<{
6
- oldStart: number;
7
- oldLines: number;
8
- newStart: number;
9
- newLines: number;
10
- lines: string[];
11
- }>;
12
- replacements: number;
13
- strategy: string;
14
- }
15
- export interface WriteFileOutput {
16
- filePath: string;
17
- action: "created" | "overwritten" | "appended";
18
- bytesWritten: number;
19
- structuredPatch?: Array<{
20
- oldStart: number;
21
- oldLines: number;
22
- newStart: number;
23
- newLines: number;
24
- lines: string[];
25
- }>;
26
- }
27
- export interface BashToolOutput {
28
- stdout: string;
29
- stderr: string;
30
- exitCode: number;
31
- }
32
- export interface NotebookEditOutput {
33
- cellNumber: number;
34
- newSource: string;
35
- language: string;
36
- error?: string;
37
- }
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfig;
2
- export default _default;