arki 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -80,9 +80,25 @@ Ways to enable:
80
80
  1. Add `--debug` or `-d` parameter at startup
81
81
  2. Type `/debug` during runtime to toggle
82
82
 
83
- ## Configuration File
83
+ ## Configuration
84
84
 
85
- Configuration file is located at `~/.config/arki/config.json`:
85
+ ### Global Configuration
86
+
87
+ Global configuration is stored in system-specific locations:
88
+
89
+ - **macOS/Linux**: `~/.config/arki/config.json`
90
+ - **Windows**: `%APPDATA%\arki\config.json`
91
+
92
+ On first run, Arki copies the default configuration template to this location.
93
+
94
+ ### Project Configuration
95
+
96
+ Each project can have its own configuration in `.arki/` directory:
97
+
98
+ - `.arki/config.json` - Project-specific settings (overrides global config)
99
+ - `.arki/state.json` - Project state and cache
100
+
101
+ On first run in a new project, Arki will ask if you trust the project before initializing the `.arki/` directory.
86
102
 
87
103
  ### Reset to Factory Defaults
88
104
 
@@ -90,7 +106,7 @@ Configuration file is located at `~/.config/arki/config.json`:
90
106
  arki --reset
91
107
  ```
92
108
 
93
- This will delete the current configuration file. The default configuration will be used on next startup.
109
+ This will delete the global configuration file. The default configuration will be used on next startup.
94
110
 
95
111
  ## Development
96
112
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "agents": {}
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "initialized": true,
3
+ "createdAt": ""
4
+ }
package/dist/index.d.ts CHANGED
@@ -113,6 +113,53 @@ declare class Tool {
113
113
  run(args: Record<string, unknown>): Promise<ToolResult>;
114
114
  }
115
115
 
116
+ /**
117
+ * Procedure class - step-by-step guide for specific workflows
118
+ */
119
+ declare class Procedure {
120
+ readonly name: string;
121
+ readonly description: string;
122
+ readonly manual: string;
123
+ constructor(config: {
124
+ name: string;
125
+ procedureContent: string;
126
+ });
127
+ /**
128
+ * Parse procedure.md content
129
+ * First line format: "procedure_name: description", extract description
130
+ * Remaining content is the procedure steps
131
+ */
132
+ static parseManual(content: string): {
133
+ description: string;
134
+ manual: string;
135
+ };
136
+ }
137
+
138
+ /** OS type definition */
139
+ interface OS_TYPE {
140
+ /** Operating system name: 'windows' | 'mac' | 'linux' | 'other' */
141
+ name: 'windows' | 'mac' | 'linux' | 'other';
142
+ /** Operating system version */
143
+ version: string;
144
+ }
145
+ /** Global OS information */
146
+ declare const OS: OS_TYPE;
147
+ /** Working directory */
148
+ declare let workingDir: string;
149
+ /** Set working directory (for testing) */
150
+ declare function setWorkingDir(dir: string): void;
151
+ /** Global paths configuration */
152
+ declare const PATHS: {
153
+ /** Global config directory (~/.config/arki or %APPDATA%\arki) */
154
+ globalConfig: string;
155
+ /** Project config directory (.arki/) - returns path based on current workingDir */
156
+ readonly projectConfig: string;
157
+ /** Package's global config template directory */
158
+ globalTemplate: string;
159
+ /** Package's project config template directory */
160
+ projectTemplate: string;
161
+ };
162
+
116
163
  /**
117
164
  * Fixed parameters
118
165
  */
@@ -161,6 +208,17 @@ declare abstract class Adapter {
161
208
  getModel(): string;
162
209
  }
163
210
 
211
+ /** Global tool registry */
212
+ declare const TOOLS: Record<string, Tool>;
213
+ /** Global procedure registry */
214
+ declare const PROCEDURES: Record<string, Procedure>;
215
+ /** Global Adapter instance */
216
+ declare let adapter: Adapter | null;
217
+ /** Initialize global Adapter */
218
+ declare function initAdapter(): void;
219
+ /** Initialize global state */
220
+ declare function init(cwd?: string): Promise<void>;
221
+
164
222
  /**
165
223
  * Agent type
166
224
  */
@@ -195,62 +253,54 @@ interface GlobalConfig {
195
253
  };
196
254
  }
197
255
  /**
198
- * Global configuration manager
256
+ * Get loaded configuration
199
257
  */
200
- declare class ConfigManager {
201
- private config;
202
- private loaded;
203
- /**
204
- * Load configuration (called at program startup)
205
- */
206
- load(): Promise<GlobalConfig>;
207
- /**
208
- * Save configuration
209
- */
210
- save(): Promise<void>;
211
- get(): GlobalConfig;
212
- getApiKey(provider: string): string | undefined;
213
- getAgentConfig(agentType: AgentType): AgentModelConfig;
214
- private loadEnvApiKeys;
215
- }
216
- declare const config: ConfigManager;
217
-
218
- /** Working directory */
219
- declare let workingDir: string;
220
- /** Set working directory (for testing) */
221
- declare function setWorkingDir(dir: string): void;
222
- /** Global tool registry */
223
- declare const TOOLS: Record<string, Tool>;
224
- /** Global Adapter instance */
225
- declare let adapter: Adapter | null;
226
- /** Initialize global state */
227
- declare function init(cwd?: string): Promise<void>;
258
+ declare function getConfig(): GlobalConfig;
259
+ /**
260
+ * Get API key for a provider
261
+ */
262
+ declare function getApiKey(provider: string): string | undefined;
263
+ /**
264
+ * Get agent configuration
265
+ */
266
+ declare function getAgentConfig(agentType: AgentType): AgentModelConfig;
267
+ /**
268
+ * Save configuration to global config file
269
+ */
270
+ declare function saveConfig(): Promise<void>;
228
271
 
229
272
  /**
230
273
  * Debug logging module
274
+ * All debug output is single-line for log-friendly format
231
275
  */
232
276
  /** Get debug mode status */
233
277
  declare function isDebugMode(): boolean;
234
278
  /** Set debug mode */
235
279
  declare function setDebugMode(enabled: boolean): void;
236
280
  /**
237
- * Debug log function
281
+ * Debug log function - single line output with timestamp
238
282
  * @param category Log category (e.g., 'API', 'Agent', 'Tool')
239
283
  * @param message Log message
240
- * @param data Optional additional data
284
+ * @param data Optional additional data (will be formatted to single line)
241
285
  */
242
286
  declare function debug(category: string, message: string, data?: unknown): void;
243
287
 
244
288
  /**
245
289
  * General logging module
290
+ * All log output is single-line with timestamp prefix
291
+ * Supports XML-style color tags: <red>text</red>, <bold>text</bold>, etc.
246
292
  */
247
-
248
293
  /**
249
- * Colored log output
250
- * @param color Color name
251
- * @param args Content to output
294
+ * Print output without timestamp (for prompts and simple messages)
295
+ * @param message Message string with optional XML color tags
296
+ */
297
+ declare function print(message: string): void;
298
+ /**
299
+ * Log output with timestamp and XML color tag support
300
+ * @param message Message string with optional XML color tags
301
+ * @example log('<yellow>[TOOL]</yellow> read_file <dim>{"path":"test.txt"}</dim>')
252
302
  */
253
- declare function log(color: ColorName, ...args: unknown[]): void;
303
+ declare function log(message: string): void;
254
304
  /**
255
305
  * Info log
256
306
  */
@@ -271,6 +321,7 @@ declare function error(message: string): void;
271
321
  /**
272
322
  * Logging module
273
323
  * Provides debug mode and logging functionality
324
+ * Supports XML-style color tags: <red>text</red>, <bold>text</bold>, etc.
274
325
  */
275
326
  /**
276
327
  * Terminal colors and style definitions
@@ -293,6 +344,16 @@ declare const colors: {
293
344
  };
294
345
  /** Color name type */
295
346
  type ColorName = keyof typeof colors;
347
+ /**
348
+ * Convert XML-style color tags to ANSI escape sequences
349
+ * Example: "<red>error</red>" -> "\x1b[31merror\x1b[0m"
350
+ */
351
+ declare function convertColorTags(str: string): string;
352
+ /**
353
+ * Create a buffered streaming color converter
354
+ * Used for streaming output where tags may span multiple chunks
355
+ */
356
+ declare function createColorConverter(): (chunk: string) => string;
296
357
 
297
358
  declare class OpenAIAdapter extends Adapter {
298
359
  private client;
@@ -367,4 +428,4 @@ interface Model {
367
428
  readonly capabilities: ModelCapabilities;
368
429
  }
369
430
 
370
- export { AIMsg, Adapter, type AdapterResponse, Agent, type AgentResponse, type ColorName, HAS_MANUAL, MAX_COMPLETION_TOKENS, MODELS, type Model, type ModelCapabilities, type ModelProvider, Msg, MsgType, OpenAIAdapter, type ReasoningEffort$1 as ReasoningEffort, SystemMsg, TEMPERATURE, TOOLS, Tool, type ToolCall, ToolCallMsg, type ToolResult, ToolResultMsg, UserMsg, adapter, colors, config, debug, error, info, init, isDebugMode, log, setDebugMode, setWorkingDir, success, warn, workingDir };
431
+ export { AIMsg, Adapter, type AdapterResponse, Agent, type AgentModelConfig, type AgentResponse, type AgentType, type ColorName, type GlobalConfig, HAS_MANUAL, MAX_COMPLETION_TOKENS, MODELS, type Model, type ModelCapabilities, type ModelProvider, Msg, MsgType, OS, type OS_TYPE, OpenAIAdapter, PATHS, PROCEDURES, type ReasoningEffort$1 as ReasoningEffort, SystemMsg, TEMPERATURE, TOOLS, Tool, type ToolCall, ToolCallMsg, type ToolResult, ToolResultMsg, UserMsg, adapter, colors, convertColorTags, createColorConverter, debug, error, getAgentConfig, getApiKey, getConfig, info, init, initAdapter, isDebugMode, log, print, saveConfig, setDebugMode, setWorkingDir, success, warn, workingDir };