@arcteninc/core 0.0.176 → 0.0.177

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 (103) hide show
  1. package/README.md +73 -78
  2. package/dist/index.cjs +3 -16
  3. package/dist/index.d.ts +1 -6
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.mjs +851 -8410
  6. package/dist/lib/useAgent.d.ts +1 -2
  7. package/dist/lib/useAgent.d.ts.map +1 -1
  8. package/dist/types/use-agent.d.ts +3 -44
  9. package/dist/types/use-agent.d.ts.map +1 -1
  10. package/dist/utils/extract-tool-metadata.d.ts.map +1 -1
  11. package/package.json +7 -46
  12. package/scripts/arcten-cli.cjs +14 -108
  13. package/scripts/cli-extract-types-auto.ts +22 -4
  14. package/scripts/update-core.cjs +124 -0
  15. package/dist/components/ArctenAgent.d.ts +0 -52
  16. package/dist/components/ArctenAgent.d.ts.map +0 -1
  17. package/dist/components/ai-elements/prompt-input.d.ts +0 -187
  18. package/dist/components/ai-elements/prompt-input.d.ts.map +0 -1
  19. package/dist/components/ai-elements/reasoning.d.ts +0 -17
  20. package/dist/components/ai-elements/reasoning.d.ts.map +0 -1
  21. package/dist/components/ai-elements/response.d.ts +0 -8
  22. package/dist/components/ai-elements/response.d.ts.map +0 -1
  23. package/dist/components/ai-elements/shimmer.d.ts +0 -10
  24. package/dist/components/ai-elements/shimmer.d.ts.map +0 -1
  25. package/dist/components/citation-button.d.ts +0 -14
  26. package/dist/components/citation-button.d.ts.map +0 -1
  27. package/dist/components/citation-text-renderer.d.ts +0 -31
  28. package/dist/components/citation-text-renderer.d.ts.map +0 -1
  29. package/dist/components/secure-modals/EmailModal.d.ts +0 -10
  30. package/dist/components/secure-modals/EmailModal.d.ts.map +0 -1
  31. package/dist/components/secure-modals/FormModal.d.ts +0 -20
  32. package/dist/components/secure-modals/FormModal.d.ts.map +0 -1
  33. package/dist/components/secure-modals/PasswordModal.d.ts +0 -10
  34. package/dist/components/secure-modals/PasswordModal.d.ts.map +0 -1
  35. package/dist/components/secure-modals/PhoneModal.d.ts +0 -10
  36. package/dist/components/secure-modals/PhoneModal.d.ts.map +0 -1
  37. package/dist/components/secure-modals/PinModal.d.ts +0 -11
  38. package/dist/components/secure-modals/PinModal.d.ts.map +0 -1
  39. package/dist/components/secure-modals/SecureModalProvider.d.ts +0 -13
  40. package/dist/components/secure-modals/SecureModalProvider.d.ts.map +0 -1
  41. package/dist/components/secure-modals/TextModal.d.ts +0 -11
  42. package/dist/components/secure-modals/TextModal.d.ts.map +0 -1
  43. package/dist/components/secure-modals/index.d.ts +0 -10
  44. package/dist/components/secure-modals/index.d.ts.map +0 -1
  45. package/dist/components/secure-modals/types.d.ts +0 -34
  46. package/dist/components/secure-modals/types.d.ts.map +0 -1
  47. package/dist/components/tool-call-approval.d.ts +0 -9
  48. package/dist/components/tool-call-approval.d.ts.map +0 -1
  49. package/dist/components/tool-call-result.d.ts +0 -8
  50. package/dist/components/tool-call-result.d.ts.map +0 -1
  51. package/dist/components/ui/autotextarea.d.ts +0 -19
  52. package/dist/components/ui/autotextarea.d.ts.map +0 -1
  53. package/dist/components/ui/badge.d.ts +0 -10
  54. package/dist/components/ui/badge.d.ts.map +0 -1
  55. package/dist/components/ui/button.d.ts +0 -14
  56. package/dist/components/ui/button.d.ts.map +0 -1
  57. package/dist/components/ui/collapsible.d.ts +0 -6
  58. package/dist/components/ui/collapsible.d.ts.map +0 -1
  59. package/dist/components/ui/command.d.ts +0 -19
  60. package/dist/components/ui/command.d.ts.map +0 -1
  61. package/dist/components/ui/dialog.d.ts +0 -16
  62. package/dist/components/ui/dialog.d.ts.map +0 -1
  63. package/dist/components/ui/dropdown-menu.d.ts +0 -26
  64. package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
  65. package/dist/components/ui/hover-card.d.ts +0 -7
  66. package/dist/components/ui/hover-card.d.ts.map +0 -1
  67. package/dist/components/ui/input-group.d.ts +0 -17
  68. package/dist/components/ui/input-group.d.ts.map +0 -1
  69. package/dist/components/ui/input.d.ts +0 -4
  70. package/dist/components/ui/input.d.ts.map +0 -1
  71. package/dist/components/ui/kbd.d.ts +0 -4
  72. package/dist/components/ui/kbd.d.ts.map +0 -1
  73. package/dist/components/ui/select.d.ts +0 -16
  74. package/dist/components/ui/select.d.ts.map +0 -1
  75. package/dist/components/ui/textarea.d.ts +0 -4
  76. package/dist/components/ui/textarea.d.ts.map +0 -1
  77. package/dist/components/ui/tooltip.d.ts +0 -8
  78. package/dist/components/ui/tooltip.d.ts.map +0 -1
  79. package/dist/core.css +0 -1
  80. package/dist/utils/form-generator.d.ts +0 -29
  81. package/dist/utils/form-generator.d.ts.map +0 -1
  82. package/dist/utils/secure-param-detector.d.ts +0 -26
  83. package/dist/utils/secure-param-detector.d.ts.map +0 -1
  84. package/scripts/cli-agent-inject.ts +0 -205
  85. package/scripts/cli-agent-wrapper.cjs +0 -51
  86. package/scripts/cli-agent.ts +0 -483
  87. package/scripts/cli-create-project.ts +0 -608
  88. package/scripts/cli-create-wrapper.cjs +0 -60
  89. package/scripts/cli-init-wizard-wrapper.cjs +0 -58
  90. package/scripts/cli-init-wizard.ts +0 -646
  91. package/scripts/cli-prompt-wrapper.cjs +0 -51
  92. package/scripts/cli-prompt.ts +0 -306
  93. package/scripts/cli-sync-wrapper.cjs +0 -69
  94. package/scripts/cli-sync.ts +0 -915
  95. package/scripts/cli-tools-wrapper.cjs +0 -51
  96. package/scripts/cli-tools.ts +0 -320
  97. package/scripts/cli-uninstall-wrapper.cjs +0 -66
  98. package/scripts/cli-uninstall.ts +0 -173
  99. package/scripts/config-parser.ts +0 -432
  100. package/scripts/dashboard-sync.ts +0 -454
  101. package/scripts/tree-sitter-discover.ts +0 -526
  102. package/scripts/wasm/tree-sitter-tsx.wasm +0 -0
  103. package/scripts/wasm/tree-sitter-typescript.wasm +0 -0
@@ -1,432 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Config Parser - Parse existing arcten.config.ts to extract agents and tools
4
- *
5
- * Reads the local configuration file and extracts:
6
- * - Project ID
7
- * - Agent definitions (name, placement, tools, systemPrompt)
8
- * - Tool file references
9
- *
10
- * This enables the AI-guided agent to understand existing setup
11
- * and offer contextual modifications.
12
- */
13
-
14
- import * as fs from 'fs';
15
- import * as path from 'path';
16
-
17
- // Types for parsed configuration
18
- export interface ParsedAgent {
19
- name: string;
20
- placement?: string; // File path where component is placed
21
- tools: string[];
22
- systemPrompt?: string;
23
- description?: string;
24
- }
25
-
26
- export interface ParsedConfig {
27
- projectId: string;
28
- toolFile?: string;
29
- agents: ParsedAgent[];
30
- routes?: Array<{
31
- pattern: string;
32
- agentName: string;
33
- }>;
34
- }
35
-
36
- export interface ConfigParseResult {
37
- exists: boolean;
38
- config?: ParsedConfig;
39
- error?: string;
40
- configPath?: string;
41
- }
42
-
43
- /**
44
- * Find the arcten config file in a project
45
- */
46
- export function findConfigFile(projectRoot: string): string | null {
47
- const possiblePaths = [
48
- path.join(projectRoot, 'arcten.config.ts'),
49
- path.join(projectRoot, 'arcten.config.js'),
50
- path.join(projectRoot, '.arcten', 'config.ts'),
51
- path.join(projectRoot, '.arcten', 'config.js'),
52
- ];
53
-
54
- for (const configPath of possiblePaths) {
55
- if (fs.existsSync(configPath)) {
56
- return configPath;
57
- }
58
- }
59
-
60
- return null;
61
- }
62
-
63
- /**
64
- * Parse arcten.config.ts content to extract configuration
65
- *
66
- * This uses regex-based parsing to avoid needing to execute the TypeScript.
67
- * It handles both single-agent (legacy) and multi-agent (new) formats.
68
- */
69
- export function parseConfigContent(content: string): ParsedConfig | null {
70
- try {
71
- // Extract projectId
72
- const projectIdMatch = content.match(/projectId:\s*["'`]([^"'`]+)["'`]/);
73
- if (!projectIdMatch) {
74
- return null;
75
- }
76
-
77
- const projectId = projectIdMatch[1];
78
-
79
- // Extract toolFile if present
80
- const toolFileMatch = content.match(/toolFile:\s*["'`]([^"'`]+)["'`]/);
81
- const toolFile = toolFileMatch?.[1];
82
-
83
- // Try to extract agents array (new multi-agent format)
84
- const agents: ParsedAgent[] = [];
85
-
86
- // Check for agents array
87
- const agentsArrayMatch = content.match(/agents:\s*\[([\s\S]*?)\]/);
88
-
89
- if (agentsArrayMatch) {
90
- // Multi-agent format
91
- const agentsContent = agentsArrayMatch[1];
92
-
93
- // Parse each agent object
94
- const agentMatches = agentsContent.matchAll(
95
- /\{\s*name:\s*["'`]([^"'`]+)["'`][\s\S]*?\}/g
96
- );
97
-
98
- for (const match of agentMatches) {
99
- const agentBlock = match[0];
100
- const name = match[1];
101
-
102
- // Extract placement
103
- const placementMatch = agentBlock.match(/placement:\s*["'`]([^"'`]+)["'`]/);
104
- const placement = placementMatch?.[1];
105
-
106
- // Extract tools array
107
- const toolsMatch = agentBlock.match(/tools:\s*\[([\s\S]*?)\]/);
108
- const tools: string[] = [];
109
- if (toolsMatch) {
110
- const toolNames = toolsMatch[1].matchAll(/["'`]([^"'`]+)["'`]/g);
111
- for (const toolName of toolNames) {
112
- tools.push(toolName[1]);
113
- }
114
- }
115
-
116
- // Extract systemPrompt
117
- const promptMatch = agentBlock.match(/systemPrompt:\s*["'`]([\s\S]*?)["'`]/);
118
- const systemPrompt = promptMatch?.[1];
119
-
120
- // Extract description
121
- const descMatch = agentBlock.match(/description:\s*["'`]([^"'`]+)["'`]/);
122
- const description = descMatch?.[1];
123
-
124
- agents.push({
125
- name,
126
- placement,
127
- tools,
128
- systemPrompt,
129
- description,
130
- });
131
- }
132
- } else {
133
- // Legacy single-agent format with routes
134
- const routesMatch = content.match(/routes:\s*\[([\s\S]*?)\]/);
135
-
136
- if (routesMatch) {
137
- const routesContent = routesMatch[1];
138
- const routeMatches = routesContent.matchAll(
139
- /\{\s*pattern:\s*["'`]([^"'`]+)["'`]\s*,\s*agentName:\s*["'`]([^"'`]+)["'`]\s*\}/g
140
- );
141
-
142
- const agentNames = new Set<string>();
143
- for (const match of routeMatches) {
144
- agentNames.add(match[2]);
145
- }
146
-
147
- // Create agent entries from unique agent names
148
- for (const name of agentNames) {
149
- agents.push({
150
- name,
151
- tools: [], // Tools not specified in legacy format
152
- });
153
- }
154
- }
155
-
156
- // If no routes found, assume single default agent
157
- if (agents.length === 0) {
158
- agents.push({
159
- name: 'default',
160
- tools: [],
161
- });
162
- }
163
- }
164
-
165
- // Extract routes if present
166
- const routes: Array<{ pattern: string; agentName: string }> = [];
167
- const routesMatch = content.match(/routes:\s*\[([\s\S]*?)\]/);
168
- if (routesMatch) {
169
- const routeMatches = routesMatch[1].matchAll(
170
- /\{\s*pattern:\s*["'`]([^"'`]+)["'`]\s*,\s*agentName:\s*["'`]([^"'`]+)["'`]\s*\}/g
171
- );
172
- for (const match of routeMatches) {
173
- routes.push({
174
- pattern: match[1],
175
- agentName: match[2],
176
- });
177
- }
178
- }
179
-
180
- return {
181
- projectId,
182
- toolFile,
183
- agents,
184
- routes: routes.length > 0 ? routes : undefined,
185
- };
186
- } catch (error) {
187
- console.error('Failed to parse config content:', error);
188
- return null;
189
- }
190
- }
191
-
192
- /**
193
- * Parse an arcten.config.ts file from a project
194
- */
195
- export function parseConfigFile(projectRoot: string): ConfigParseResult {
196
- const configPath = findConfigFile(projectRoot);
197
-
198
- if (!configPath) {
199
- return {
200
- exists: false,
201
- };
202
- }
203
-
204
- try {
205
- const content = fs.readFileSync(configPath, 'utf-8');
206
- const config = parseConfigContent(content);
207
-
208
- if (!config) {
209
- return {
210
- exists: true,
211
- error: 'Failed to parse configuration file',
212
- configPath,
213
- };
214
- }
215
-
216
- return {
217
- exists: true,
218
- config,
219
- configPath,
220
- };
221
- } catch (error) {
222
- return {
223
- exists: true,
224
- error: `Failed to read config file: ${error}`,
225
- configPath,
226
- };
227
- }
228
- }
229
-
230
- /**
231
- * Find component placements by scanning for ArctenAgent usage
232
- */
233
- export async function findAgentPlacements(
234
- projectRoot: string
235
- ): Promise<Map<string, string>> {
236
- const placements = new Map<string, string>();
237
-
238
- // Common patterns for agent component usage
239
- const patterns = [
240
- 'app/**/*.tsx',
241
- 'src/**/*.tsx',
242
- 'pages/**/*.tsx',
243
- 'components/**/*.tsx',
244
- ];
245
-
246
- const { glob } = await import('glob');
247
-
248
- for (const pattern of patterns) {
249
- const files = await glob(path.join(projectRoot, pattern).replace(/\\/g, '/'), {
250
- ignore: ['**/node_modules/**', '**/dist/**', '**/.next/**'],
251
- });
252
-
253
- for (const file of files) {
254
- try {
255
- const content = fs.readFileSync(file, 'utf-8');
256
-
257
- // Look for ArctenAgent component usage
258
- const agentMatch = content.match(/<ArctenAgent[\s\S]*?agentName=["'`]([^"'`]+)["'`]/);
259
- if (agentMatch) {
260
- const agentName = agentMatch[1];
261
- const relativePath = path.relative(projectRoot, file);
262
- placements.set(agentName, relativePath);
263
- }
264
-
265
- // Also check for useAgent hook usage
266
- const hookMatch = content.match(/useAgent\(\s*\{[\s\S]*?agentName:\s*["'`]([^"'`]+)["'`]/);
267
- if (hookMatch) {
268
- const agentName = hookMatch[1];
269
- const relativePath = path.relative(projectRoot, file);
270
- if (!placements.has(agentName)) {
271
- placements.set(agentName, relativePath);
272
- }
273
- }
274
- } catch {
275
- // Skip files that can't be read
276
- }
277
- }
278
- }
279
-
280
- return placements;
281
- }
282
-
283
- /**
284
- * Get a complete picture of the current setup
285
- */
286
- export async function analyzeExistingSetup(projectRoot: string): Promise<{
287
- hasConfig: boolean;
288
- config?: ParsedConfig;
289
- placements: Map<string, string>;
290
- summary: string;
291
- }> {
292
- const parseResult = parseConfigFile(projectRoot);
293
- const placements = await findAgentPlacements(projectRoot);
294
-
295
- // Merge placement info into config
296
- if (parseResult.config) {
297
- for (const agent of parseResult.config.agents) {
298
- const placement = placements.get(agent.name);
299
- if (placement && !agent.placement) {
300
- agent.placement = placement;
301
- }
302
- }
303
- }
304
-
305
- // Generate summary
306
- let summary = '';
307
- if (!parseResult.exists) {
308
- summary = 'No existing Arcten setup found.';
309
- } else if (parseResult.error) {
310
- summary = `Found config file but failed to parse: ${parseResult.error}`;
311
- } else if (parseResult.config) {
312
- const { config } = parseResult;
313
- const agentCount = config.agents.length;
314
- const toolCount = config.agents.reduce((sum, a) => sum + a.tools.length, 0);
315
-
316
- summary = `Found ${agentCount} agent${agentCount !== 1 ? 's' : ''} with ${toolCount} total tool${toolCount !== 1 ? 's' : ''}`;
317
-
318
- if (config.agents.length > 0) {
319
- summary += ':\n';
320
- for (const agent of config.agents) {
321
- const placement = agent.placement ? ` (${agent.placement})` : '';
322
- summary += ` • ${agent.name}${placement} - ${agent.tools.length} tools\n`;
323
- }
324
- }
325
- }
326
-
327
- return {
328
- hasConfig: parseResult.exists && !!parseResult.config,
329
- config: parseResult.config,
330
- placements,
331
- summary,
332
- };
333
- }
334
-
335
- /**
336
- * Generate arcten.config.ts content from a config object
337
- */
338
- export function generateConfigContent(config: ParsedConfig): string {
339
- const toolFileLine = config.toolFile ? ` toolFile: "${config.toolFile}",\n` : '';
340
-
341
- const agentsContent = config.agents
342
- .map((agent) => {
343
- const lines = [` name: "${agent.name}"`];
344
-
345
- if (agent.placement) {
346
- lines.push(` placement: "${agent.placement}"`);
347
- }
348
-
349
- if (agent.tools.length > 0) {
350
- lines.push(` tools: [${agent.tools.map((t) => `"${t}"`).join(', ')}]`);
351
- } else {
352
- lines.push(` tools: []`);
353
- }
354
-
355
- if (agent.systemPrompt) {
356
- // Escape backticks and template literals in system prompt
357
- const escapedPrompt = agent.systemPrompt
358
- .replace(/\\/g, '\\\\')
359
- .replace(/`/g, '\\`')
360
- .replace(/\$\{/g, '\\${');
361
- lines.push(` systemPrompt: \`${escapedPrompt}\``);
362
- }
363
-
364
- if (agent.description) {
365
- lines.push(` description: "${agent.description}"`);
366
- }
367
-
368
- return ` {\n${lines.map((l) => ` ${l}`).join(',\n')}\n }`;
369
- })
370
- .join(',\n');
371
-
372
- let routesContent = '';
373
- if (config.routes && config.routes.length > 0) {
374
- const routeLines = config.routes
375
- .map((r) => ` { pattern: "${r.pattern}", agentName: "${r.agentName}" }`)
376
- .join(',\n');
377
- routesContent = ` routes: [\n${routeLines}\n ],\n`;
378
- }
379
-
380
- return `/**
381
- * Arcten Configuration
382
- * Generated by: arcten init
383
- *
384
- * This file contains your project configuration and agent definitions.
385
- */
386
-
387
- export const arctenConfig = {
388
- projectId: "${config.projectId}",
389
- ${toolFileLine} agents: [
390
- ${agentsContent}
391
- ],
392
- ${routesContent}} as const;
393
- `;
394
- }
395
-
396
- /**
397
- * Write config to file
398
- */
399
- export function writeConfig(projectRoot: string, config: ParsedConfig): void {
400
- const content = generateConfigContent(config);
401
- const configPath = path.join(projectRoot, 'arcten.config.ts');
402
-
403
- // Ensure directory exists
404
- const dir = path.dirname(configPath);
405
- if (!fs.existsSync(dir)) {
406
- fs.mkdirSync(dir, { recursive: true });
407
- }
408
-
409
- fs.writeFileSync(configPath, content, 'utf-8');
410
- }
411
-
412
- // CLI entry point for testing
413
- if (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith('config-parser.ts')) {
414
- const projectRoot = process.argv[2] || process.cwd();
415
-
416
- analyzeExistingSetup(projectRoot).then((result) => {
417
- console.log('\nšŸ“‹ Existing Setup Analysis\n');
418
- console.log(result.summary);
419
-
420
- if (result.config) {
421
- console.log('\nParsed Configuration:');
422
- console.log(JSON.stringify(result.config, null, 2));
423
- }
424
-
425
- if (result.placements.size > 0) {
426
- console.log('\nComponent Placements:');
427
- for (const [agent, file] of result.placements) {
428
- console.log(` ${agent} → ${file}`);
429
- }
430
- }
431
- });
432
- }