@arcteninc/core 0.0.175 → 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 +856 -8408
  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,51 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Wrapper script for cli-prompt.ts
4
- * Handles TypeScript execution via tsx or ts-node
5
- */
6
-
7
- const { spawn } = require('child_process');
8
- const path = require('path');
9
- const fs = require('fs');
10
-
11
- const scriptPath = path.join(__dirname, 'cli-prompt.ts');
12
-
13
- // Check if script exists
14
- if (!fs.existsSync(scriptPath)) {
15
- console.error(`❌ Script not found: ${scriptPath}`);
16
- process.exit(1);
17
- }
18
-
19
- // Try tsx first (faster), then ts-node, then bun
20
- const runners = [
21
- { cmd: 'tsx', args: [scriptPath, ...process.argv.slice(2)] },
22
- { cmd: 'npx', args: ['tsx', scriptPath, ...process.argv.slice(2)] },
23
- { cmd: 'bun', args: ['run', scriptPath, ...process.argv.slice(2)] },
24
- ];
25
-
26
- function tryRunner(index) {
27
- if (index >= runners.length) {
28
- console.error('❌ Could not find a TypeScript runner (tsx, ts-node, or bun)');
29
- console.error(' Install tsx: npm install -g tsx');
30
- process.exit(1);
31
- }
32
-
33
- const { cmd, args } = runners[index];
34
-
35
- const child = spawn(cmd, args, {
36
- stdio: 'inherit',
37
- cwd: process.cwd(),
38
- shell: process.platform === 'win32',
39
- });
40
-
41
- child.on('error', () => {
42
- // Try next runner
43
- tryRunner(index + 1);
44
- });
45
-
46
- child.on('exit', (code) => {
47
- process.exit(code || 0);
48
- });
49
- }
50
-
51
- tryRunner(0);
@@ -1,306 +0,0 @@
1
- #!/usr/bin/env tsx
2
- /**
3
- * arcten prompt - System prompt management
4
- *
5
- * Usage:
6
- * arcten prompt Edit project-level prompt.md
7
- * arcten prompt --agent=<name> Edit agent-specific prompt
8
- * arcten prompt --view View current prompt
9
- * arcten prompt --sync Sync prompt to dashboard
10
- */
11
-
12
- import * as fs from "fs";
13
- import * as path from "path";
14
- import { execSync, spawn } from "child_process";
15
-
16
- const DEFAULT_PROJECT_PROMPT = `# AI Assistant
17
-
18
- You are a helpful AI assistant for this application.
19
-
20
- ## Your Role
21
- - Help users accomplish their tasks efficiently
22
- - Use the available tools when appropriate
23
- - Ask for clarification when needed
24
-
25
- ## Guidelines
26
- - Be concise and helpful
27
- - Explain what you're doing when using tools
28
- - Handle errors gracefully and suggest alternatives
29
-
30
- ## Available Tools
31
- The tools available to you are defined in the codebase and synced via \`arcten sync\`.
32
- Safe tools execute automatically. Sensitive tools require user approval.
33
- `;
34
-
35
- const DEFAULT_AGENT_TEMPLATE = (name: string) => `name: ${name}
36
- description:
37
- isDefault: false
38
- toolMode: inherit
39
-
40
- # System prompt for this agent
41
- # This overrides the project-level prompt when this agent is active
42
- systemPrompt: |
43
- You are a helpful AI assistant.
44
-
45
- ## Your Role
46
- - Help users with their requests
47
- - Use available tools appropriately
48
-
49
- ## Guidelines
50
- - Be concise and professional
51
-
52
- # Tools this agent can access (only used if toolMode is 'custom')
53
- # enabledTools:
54
- # - getOrders
55
- # - getOrderDetails
56
- `;
57
-
58
- function findProjectRoot(): string {
59
- let dir = process.cwd();
60
- while (dir !== path.dirname(dir)) {
61
- if (fs.existsSync(path.join(dir, "package.json"))) {
62
- return dir;
63
- }
64
- dir = path.dirname(dir);
65
- }
66
- return process.cwd();
67
- }
68
-
69
- function getPromptPath(projectRoot: string, agentName: string | null): string {
70
- if (agentName) {
71
- return path.join(projectRoot, ".arcten", "agents", `${agentName}.yaml`);
72
- }
73
- return path.join(projectRoot, ".arcten", "prompt.md");
74
- }
75
-
76
- function ensurePromptExists(promptPath: string, agentName: string | null): void {
77
- const dir = path.dirname(promptPath);
78
- if (!fs.existsSync(dir)) {
79
- fs.mkdirSync(dir, { recursive: true });
80
- }
81
-
82
- if (!fs.existsSync(promptPath)) {
83
- const content = agentName ? DEFAULT_AGENT_TEMPLATE(agentName) : DEFAULT_PROJECT_PROMPT;
84
- fs.writeFileSync(promptPath, content);
85
- console.log(`✨ Created ${agentName ? "agent config" : "prompt"}: ${path.relative(process.cwd(), promptPath)}`);
86
- }
87
- }
88
-
89
- function viewPrompt(promptPath: string, agentName: string | null): void {
90
- if (!fs.existsSync(promptPath)) {
91
- console.log(`❌ ${agentName ? `Agent "${agentName}"` : "Project prompt"} not found.`);
92
- console.log(` Run 'arcten prompt${agentName ? ` --agent=${agentName}` : ""}' to create it.`);
93
- return;
94
- }
95
-
96
- const content = fs.readFileSync(promptPath, "utf-8");
97
- const relativePath = path.relative(process.cwd(), promptPath);
98
-
99
- console.log(`\n📄 ${agentName ? `Agent: ${agentName}` : "Project Prompt"}`);
100
- console.log(` File: ${relativePath}\n`);
101
- console.log("─".repeat(60));
102
- console.log(content);
103
- console.log("─".repeat(60));
104
- console.log(`\nTo edit: arcten prompt${agentName ? ` --agent=${agentName}` : ""}`);
105
- console.log("To sync: arcten sync --prompt");
106
- }
107
-
108
- function openInEditor(filePath: string): void {
109
- // Try to find an editor
110
- const editors = [
111
- process.env.EDITOR,
112
- process.env.VISUAL,
113
- "code", // VS Code
114
- "cursor", // Cursor
115
- "vim",
116
- "nano",
117
- "notepad", // Windows fallback
118
- ].filter(Boolean);
119
-
120
- for (const editor of editors) {
121
- try {
122
- // Check if editor exists
123
- if (process.platform === "win32") {
124
- // On Windows, just try to spawn it
125
- const child = spawn(editor!, ["--wait", filePath], {
126
- stdio: "inherit",
127
- shell: true,
128
- });
129
-
130
- child.on("error", () => {
131
- // Try next editor
132
- });
133
-
134
- child.on("exit", (code) => {
135
- if (code === 0) {
136
- console.log(`\n✅ Prompt saved.`);
137
- console.log(" Run 'arcten sync --prompt' to sync to dashboard.");
138
- }
139
- process.exit(code || 0);
140
- });
141
-
142
- return;
143
- } else {
144
- // On Unix, check if command exists first
145
- try {
146
- execSync(`which ${editor}`, { stdio: "ignore" });
147
- } catch {
148
- continue;
149
- }
150
-
151
- const child = spawn(editor!, [filePath], {
152
- stdio: "inherit",
153
- });
154
-
155
- child.on("exit", (code) => {
156
- if (code === 0) {
157
- console.log(`\n✅ Prompt saved.`);
158
- console.log(" Run 'arcten sync --prompt' to sync to dashboard.");
159
- }
160
- process.exit(code || 0);
161
- });
162
-
163
- return;
164
- }
165
- } catch {
166
- continue;
167
- }
168
- }
169
-
170
- console.error("❌ Could not find an editor. Set $EDITOR environment variable.");
171
- console.log(` File location: ${filePath}`);
172
- process.exit(1);
173
- }
174
-
175
- async function syncPrompt(projectRoot: string, agentName: string | null): Promise<void> {
176
- const promptPath = getPromptPath(projectRoot, agentName);
177
-
178
- if (!fs.existsSync(promptPath)) {
179
- console.error(`❌ ${agentName ? `Agent "${agentName}"` : "Project prompt"} not found.`);
180
- console.error(` Run 'arcten prompt${agentName ? ` --agent=${agentName}` : ""}' to create it.`);
181
- process.exit(1);
182
- }
183
-
184
- // Read config for API key
185
- const configPath = path.join(projectRoot, ".arcten", "config.ts");
186
- if (!fs.existsSync(configPath)) {
187
- console.error("❌ .arcten/config.ts not found. Run 'arcten init' first.");
188
- process.exit(1);
189
- }
190
-
191
- // Read API key from environment variable first (for CI/Vercel), then .env files
192
- let apiKey: string | undefined = process.env.ARCTEN_API_KEY;
193
-
194
- if (!apiKey) {
195
- const envPath = path.join(projectRoot, ".env");
196
- if (fs.existsSync(envPath)) {
197
- const envContent = fs.readFileSync(envPath, "utf-8");
198
- const match = envContent.match(/ARCTEN_API_KEY=["']?([^"'\n]+)["']?/);
199
- if (match) {
200
- apiKey = match[1];
201
- }
202
- }
203
- }
204
-
205
- if (!apiKey) {
206
- console.error("❌ ARCTEN_API_KEY not found in environment or .env");
207
- process.exit(1);
208
- }
209
-
210
- const promptContent = fs.readFileSync(promptPath, "utf-8");
211
-
212
- // For agents, extract systemPrompt from YAML
213
- let systemPrompt = promptContent;
214
- if (agentName) {
215
- const match = promptContent.match(/systemPrompt:\s*\|\s*([\s\S]*?)(?=\n[a-zA-Z]|\n#|\n$|$)/);
216
- if (match) {
217
- systemPrompt = match[1].trim();
218
- }
219
- }
220
-
221
- console.log(`\n📤 Syncing ${agentName ? `agent "${agentName}"` : "project"} prompt to dashboard...`);
222
-
223
- try {
224
- // Get token first
225
- const apiBaseUrl = process.env.ARCTEN_API_URL || "https://api.arcten.com";
226
- const tokenResponse = await fetch(`${apiBaseUrl}/token`, {
227
- method: "POST",
228
- headers: { "Content-Type": "application/json" },
229
- body: JSON.stringify({ apiKey }),
230
- });
231
-
232
- if (!tokenResponse.ok) {
233
- throw new Error(`Token request failed: ${tokenResponse.status}`);
234
- }
235
-
236
- const { clientToken } = (await tokenResponse.json()) as { clientToken: string };
237
-
238
- // Sync prompt
239
- const syncResponse = await fetch(`${apiBaseUrl}/prompt/sync`, {
240
- method: "POST",
241
- headers: {
242
- "Content-Type": "application/json",
243
- Authorization: `Bearer ${clientToken}`,
244
- },
245
- body: JSON.stringify({
246
- systemPrompt,
247
- agentName: agentName || undefined,
248
- }),
249
- });
250
-
251
- if (!syncResponse.ok) {
252
- const error = await syncResponse.text();
253
- throw new Error(`Sync failed: ${error}`);
254
- }
255
-
256
- console.log(`✅ Prompt synced successfully!`);
257
- } catch (error: any) {
258
- console.error(`❌ Sync failed: ${error.message}`);
259
- console.log("\n💡 The /prompt/sync endpoint may not be implemented yet.");
260
- console.log(" The prompt is saved locally. Dashboard sync will be available soon.");
261
- }
262
- }
263
-
264
- async function main(): Promise<void> {
265
- const args = process.argv.slice(2);
266
-
267
- // Parse --agent=name
268
- let agentName: string | null = null;
269
- const agentArg = args.find((a) => a.startsWith("--agent="));
270
- if (agentArg) {
271
- agentName = agentArg.split("=")[1];
272
- if (!agentName) {
273
- console.error("❌ Invalid --agent flag. Usage: --agent=<name>");
274
- process.exit(1);
275
- }
276
- }
277
-
278
- const doView = args.includes("--view") || args.includes("-v");
279
- const doSync = args.includes("--sync") || args.includes("-s");
280
-
281
- const projectRoot = findProjectRoot();
282
- const promptPath = getPromptPath(projectRoot, agentName);
283
-
284
- if (doView) {
285
- viewPrompt(promptPath, agentName);
286
- return;
287
- }
288
-
289
- if (doSync) {
290
- await syncPrompt(projectRoot, agentName);
291
- return;
292
- }
293
-
294
- // Default: edit prompt
295
- ensurePromptExists(promptPath, agentName);
296
-
297
- console.log(`\n📝 Opening ${agentName ? `agent "${agentName}"` : "project prompt"} in editor...`);
298
- console.log(` File: ${path.relative(process.cwd(), promptPath)}`);
299
-
300
- openInEditor(promptPath);
301
- }
302
-
303
- main().catch((error) => {
304
- console.error("❌ Error:", error.message);
305
- process.exit(1);
306
- });
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Wrapper for cli-sync.ts
4
- * Handles TypeScript execution via tsx
5
- */
6
-
7
- const { spawn, execSync } = require('child_process');
8
- const path = require('path');
9
- const fs = require('fs');
10
-
11
- const scriptPath = path.join(__dirname, 'cli-sync.ts');
12
-
13
- // Check if script exists
14
- if (!fs.existsSync(scriptPath)) {
15
- console.error('❌ cli-sync.ts not found');
16
- process.exit(1);
17
- }
18
-
19
- // Try tsx first (most reliable for TypeScript)
20
- function tryTsx() {
21
- try {
22
- execSync('npx tsx --version', { stdio: 'ignore' });
23
- return true;
24
- } catch {
25
- return false;
26
- }
27
- }
28
-
29
- // Try bun
30
- function tryBun() {
31
- try {
32
- execSync('bun --version', { stdio: 'ignore' });
33
- return true;
34
- } catch {
35
- return false;
36
- }
37
- }
38
-
39
- let runner, args;
40
-
41
- if (tryTsx()) {
42
- runner = 'npx';
43
- args = ['tsx', scriptPath, ...process.argv.slice(2)];
44
- } else if (tryBun()) {
45
- runner = 'bun';
46
- args = [scriptPath, ...process.argv.slice(2)];
47
- } else {
48
- console.error('❌ No TypeScript runner found.');
49
- console.error('');
50
- console.error('Install one of:');
51
- console.error(' npm install -g tsx');
52
- console.error(' OR install Bun: https://bun.sh');
53
- process.exit(1);
54
- }
55
-
56
- const child = spawn(runner, args, {
57
- stdio: 'inherit',
58
- cwd: process.cwd(),
59
- shell: true
60
- });
61
-
62
- child.on('error', (error) => {
63
- console.error('❌ Failed to run sync:', error.message);
64
- process.exit(1);
65
- });
66
-
67
- child.on('exit', (code) => {
68
- process.exit(code || 0);
69
- });