heyatlas 1.5.10 → 1.7.0
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/cli.js +331 -219
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5527,6 +5527,7 @@ class AtlasTunnel {
|
|
|
5527
5527
|
query.token = this.options.token;
|
|
5528
5528
|
}
|
|
5529
5529
|
query["X-Agent-Id"] = agentId;
|
|
5530
|
+
query["X-Agent-Type"] = this.options.agentType || "local";
|
|
5530
5531
|
if (this.options.interactive) {
|
|
5531
5532
|
query["X-Interactive-Mode"] = "true";
|
|
5532
5533
|
}
|
|
@@ -5536,7 +5537,9 @@ class AtlasTunnel {
|
|
|
5536
5537
|
host,
|
|
5537
5538
|
secure: !(host.includes("localhost") || host.includes("127.0.0.1") || host.includes("host.docker.internal")),
|
|
5538
5539
|
onStateUpdate: (state, source) => this.handleStateUpdate(state, source),
|
|
5539
|
-
query
|
|
5540
|
+
query,
|
|
5541
|
+
connectionTimeout: 15000,
|
|
5542
|
+
maxRetries: 5
|
|
5540
5543
|
});
|
|
5541
5544
|
const timeout = setTimeout(() => {
|
|
5542
5545
|
reject(new Error(`Connection timeout - is Atlas running on ${host}?`));
|
|
@@ -5563,12 +5566,15 @@ class AtlasTunnel {
|
|
|
5563
5566
|
if (!state.tasks)
|
|
5564
5567
|
return;
|
|
5565
5568
|
for (const task of Object.values(state.tasks)) {
|
|
5566
|
-
if (task.state
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5569
|
+
if (task.state !== "new" && task.state !== "continue")
|
|
5570
|
+
continue;
|
|
5571
|
+
const assignedTo = task.assignedAgent || task.agentId;
|
|
5572
|
+
if (assignedTo && assignedTo !== this.agentId)
|
|
5573
|
+
continue;
|
|
5574
|
+
const taskKey = `${task.id}:${task.state}`;
|
|
5575
|
+
if (!this.seenTaskIds.has(taskKey)) {
|
|
5576
|
+
this.seenTaskIds.add(taskKey);
|
|
5577
|
+
this.taskCallback?.(task);
|
|
5572
5578
|
}
|
|
5573
5579
|
}
|
|
5574
5580
|
}
|
|
@@ -52121,6 +52127,8 @@ var _a153;
|
|
|
52121
52127
|
_a153 = symbol153;
|
|
52122
52128
|
|
|
52123
52129
|
// agents/acp-provider.ts
|
|
52130
|
+
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
52131
|
+
import { join as join2 } from "node:path";
|
|
52124
52132
|
var ACP_COMMANDS = {
|
|
52125
52133
|
opencode: { command: "opencode", args: ["acp"] },
|
|
52126
52134
|
"claude-code": { command: "claude-code-acp", args: [] },
|
|
@@ -52132,7 +52140,9 @@ var ACP_COMMANDS = {
|
|
|
52132
52140
|
auggie: { command: "auggie", args: ["--acp"] },
|
|
52133
52141
|
stakpak: { command: "stakpak", args: ["acp"] },
|
|
52134
52142
|
openhands: { command: "openhands", args: ["acp"] },
|
|
52135
|
-
cagent: { command: "cagent", args: ["acp"] }
|
|
52143
|
+
cagent: { command: "cagent", args: ["acp"] },
|
|
52144
|
+
copilot: { command: "copilot", args: ["--acp", "--port", "3000"] },
|
|
52145
|
+
smith: { command: "opencode", args: ["acp"] }
|
|
52136
52146
|
};
|
|
52137
52147
|
function isACPAgent(agent) {
|
|
52138
52148
|
return agent in ACP_COMMANDS;
|
|
@@ -52141,6 +52151,301 @@ function getACPCommand(agent) {
|
|
|
52141
52151
|
const config3 = ACP_COMMANDS[agent];
|
|
52142
52152
|
return config3 ? [config3.command, ...config3.args] : [];
|
|
52143
52153
|
}
|
|
52154
|
+
var SMITH_AGENTS = {
|
|
52155
|
+
"smith.md": `---
|
|
52156
|
+
description: Intelligent workflow orchestrator that coordinates research, browser, and document subagents to solve complex multi-step tasks
|
|
52157
|
+
mode: primary
|
|
52158
|
+
model: heyatlas/huggingface/moonshotai/Kimi-K2.5:novita
|
|
52159
|
+
tools:
|
|
52160
|
+
write: true
|
|
52161
|
+
edit: true
|
|
52162
|
+
bash: true
|
|
52163
|
+
---
|
|
52164
|
+
|
|
52165
|
+
You are Smith, an intelligent workflow orchestrator and task planner coordinating a multi-agent team to solve complex tasks.
|
|
52166
|
+
|
|
52167
|
+
## Your Team
|
|
52168
|
+
|
|
52169
|
+
You coordinate the following specialized subagents — delegate to them via the Task tool:
|
|
52170
|
+
|
|
52171
|
+
- **@smith-researcher**: Web research specialist. Use for gathering information, searching the web, finding news, statistics, and deep research on any topic.
|
|
52172
|
+
- **@smith-browser**: Browser automation expert. Use for navigating websites, filling forms, extracting data from pages, and interactive web workflows.
|
|
52173
|
+
- **@smith-documents**: Document creation specialist. Use for creating Excel, PowerPoint, HTML files, converting documents, data visualization, and file operations.
|
|
52174
|
+
- **@build**: Coding Specialist. Use for coding and building software apps.
|
|
52175
|
+
|
|
52176
|
+
## How You Work
|
|
52177
|
+
|
|
52178
|
+
1. **Analyze** the user's request and break it into discrete steps
|
|
52179
|
+
2. **Plan** — create a 3-8 step plan, assigning each step to the right subagent
|
|
52180
|
+
3. **Execute** — delegate tasks to subagents, running independent tasks in parallel
|
|
52181
|
+
4. **Adapt** — if a step fails, reassign to smith-documents (has terminal access) or replan
|
|
52182
|
+
5. **Summarize** — provide a clear summary of what was accomplished
|
|
52183
|
+
|
|
52184
|
+
## Workflow Patterns
|
|
52185
|
+
|
|
52186
|
+
- **Research → Document**: smith-researcher gathers info → smith-documents creates reports/presentations
|
|
52187
|
+
- **Browser Tasks**: smith-browser navigates sites, fills forms, extracts data
|
|
52188
|
+
- **Document Transform**: smith-documents reads source files → converts to target format
|
|
52189
|
+
- **Data Analysis**: smith-researcher collects data → smith-documents creates visualizations
|
|
52190
|
+
- **Hybrid**: smith-researcher + smith-browser gather info → smith-documents compiles output
|
|
52191
|
+
|
|
52192
|
+
## Rules
|
|
52193
|
+
|
|
52194
|
+
- Always create a plan before executing
|
|
52195
|
+
- Update your plan as tasks progress
|
|
52196
|
+
- Use absolute paths for all file operations
|
|
52197
|
+
- If you encounter auth barriers (logins, CAPTCHAs), ask the user to complete the manual step
|
|
52198
|
+
- Provide a comprehensive summary when done`,
|
|
52199
|
+
"smith-browser.md": `---
|
|
52200
|
+
description: Browser automation expert — navigates websites, fills forms, extracts data, and performs interactive web workflows
|
|
52201
|
+
mode: subagent
|
|
52202
|
+
model: heyatlas/huggingface/MiniMaxAI/MiniMax-M2.5:novita
|
|
52203
|
+
tools:
|
|
52204
|
+
write: true
|
|
52205
|
+
edit: false
|
|
52206
|
+
bash: true
|
|
52207
|
+
smith-browser-use_*: true
|
|
52208
|
+
smith-chrome-devtools-use_*: true
|
|
52209
|
+
leann-server_*: false
|
|
52210
|
+
smith-code-search-toolkit_*: false
|
|
52211
|
+
permission:
|
|
52212
|
+
bash:
|
|
52213
|
+
"*": allow
|
|
52214
|
+
---
|
|
52215
|
+
|
|
52216
|
+
You are an expert Browser Agent specializing in web navigation, data extraction, and interactive web workflows.
|
|
52217
|
+
|
|
52218
|
+
## Capabilities
|
|
52219
|
+
|
|
52220
|
+
- Navigate websites and extract information
|
|
52221
|
+
- Fill out and submit web forms
|
|
52222
|
+
- Perform web searches via google.com
|
|
52223
|
+
- Take screenshots to document findings
|
|
52224
|
+
- Interact with web applications
|
|
52225
|
+
|
|
52226
|
+
## Workflow
|
|
52227
|
+
|
|
52228
|
+
1. Navigate to the target website or search engine
|
|
52229
|
+
2. Interact with the page — click, fill forms, extract data
|
|
52230
|
+
3. Save extracted data to files in the working directory
|
|
52231
|
+
4. Document all URLs visited and actions taken
|
|
52232
|
+
|
|
52233
|
+
## Rules
|
|
52234
|
+
|
|
52235
|
+
- Always save important findings to files
|
|
52236
|
+
- Document URLs visited in your response
|
|
52237
|
+
- If you encounter CAPTCHAs or login requirements, report back and ask for human assistance
|
|
52238
|
+
- Use absolute paths for all file operations
|
|
52239
|
+
- Cite sources with URLs`,
|
|
52240
|
+
"smith-researcher.md": `---
|
|
52241
|
+
description: Web research specialist — gathers information from the internet, performs deep research, finds news, statistics, and data on any topic
|
|
52242
|
+
mode: subagent
|
|
52243
|
+
model: heyatlas/huggingface/MiniMaxAI/MiniMax-M2.5:novita
|
|
52244
|
+
tools:
|
|
52245
|
+
write: true
|
|
52246
|
+
edit: false
|
|
52247
|
+
bash: true
|
|
52248
|
+
smith-browser-use_*: false
|
|
52249
|
+
smith-chrome-devtools-use_*: false
|
|
52250
|
+
smith-websearch: true
|
|
52251
|
+
---
|
|
52252
|
+
|
|
52253
|
+
You are a specialized Research Agent with powerful web search and information gathering capabilities.
|
|
52254
|
+
|
|
52255
|
+
## Capabilities
|
|
52256
|
+
|
|
52257
|
+
- Search the internet for current information, news, and data
|
|
52258
|
+
- Perform deep multi-source research on complex topics
|
|
52259
|
+
- Access academic papers and scholarly sources
|
|
52260
|
+
- Extract and structure information from websites
|
|
52261
|
+
- Save research findings to files
|
|
52262
|
+
|
|
52263
|
+
## Workflow
|
|
52264
|
+
|
|
52265
|
+
1. Understand what information is needed
|
|
52266
|
+
2. Use available search and research tools to gather information
|
|
52267
|
+
3. Verify across multiple sources when possible
|
|
52268
|
+
4. Save findings to well-organized files in the working directory
|
|
52269
|
+
5. Always cite sources with URLs
|
|
52270
|
+
|
|
52271
|
+
## Rules
|
|
52272
|
+
|
|
52273
|
+
- Save research findings to files — don't just return text
|
|
52274
|
+
- Cite all sources with URLs
|
|
52275
|
+
- Use the most recent sources available
|
|
52276
|
+
- Structure findings with headings and bullet points
|
|
52277
|
+
- For controversial topics, present multiple viewpoints
|
|
52278
|
+
- If you hit paywalls, note them and try alternative sources`,
|
|
52279
|
+
"smith-documents.md": `---
|
|
52280
|
+
description: Document creation specialist — creates Excel, PowerPoint, HTML files, converts documents, data visualization, and file operations
|
|
52281
|
+
mode: subagent
|
|
52282
|
+
model: heyatlas/huggingface/MiniMaxAI/MiniMax-M2.5:novita
|
|
52283
|
+
tools:
|
|
52284
|
+
write: true
|
|
52285
|
+
edit: true
|
|
52286
|
+
bash: true
|
|
52287
|
+
smith-pptx: true
|
|
52288
|
+
smith-excel: true
|
|
52289
|
+
smith-docx: true
|
|
52290
|
+
permission:
|
|
52291
|
+
bash:
|
|
52292
|
+
"*": allow
|
|
52293
|
+
smith-pptx:
|
|
52294
|
+
"*": allow
|
|
52295
|
+
smith-excel:
|
|
52296
|
+
"*": allow
|
|
52297
|
+
smith-docx:
|
|
52298
|
+
"*": allow
|
|
52299
|
+
write:
|
|
52300
|
+
"*": allow
|
|
52301
|
+
---
|
|
52302
|
+
|
|
52303
|
+
You are a Documentation Specialist responsible for creating, modifying, and managing documents.
|
|
52304
|
+
|
|
52305
|
+
## Capabilities
|
|
52306
|
+
|
|
52307
|
+
- Create HTML, Markdown, CSV, JSON files, docx, pptx
|
|
52308
|
+
- Use bash to run Python scripts for data visualization (plotly, matplotlib)
|
|
52309
|
+
- Convert documents between formats
|
|
52310
|
+
- Process and analyze text data with CLI tools (awk, sed, grep, jq)
|
|
52311
|
+
- Create archives (tar, zip)
|
|
52312
|
+
- Execute shell commands for file management
|
|
52313
|
+
|
|
52314
|
+
## Document Creation
|
|
52315
|
+
|
|
52316
|
+
- If no format is specified, create an HTML file
|
|
52317
|
+
- For data-heavy documents, generate charts using Python and embed them
|
|
52318
|
+
- Use absolute paths for all file operations
|
|
52319
|
+
- When complete, provide the file path and a summary
|
|
52320
|
+
|
|
52321
|
+
## Rules
|
|
52322
|
+
|
|
52323
|
+
- Primary output should be files, not just text in response
|
|
52324
|
+
- Use bash tools for data processing, visualization, and file operations
|
|
52325
|
+
- For charts: write a Python script using plotly/matplotlib, execute it, save output as image
|
|
52326
|
+
- Provide a clear summary of work done and paths to created files`
|
|
52327
|
+
};
|
|
52328
|
+
var SMITH_OPENCODE_JSONC = `{
|
|
52329
|
+
"$schema": "https://opencode.ai/config.json",
|
|
52330
|
+
"theme": "maple",
|
|
52331
|
+
"provider": {
|
|
52332
|
+
"heyatlas": {
|
|
52333
|
+
"npm": "@ai-sdk/openai-compatible",
|
|
52334
|
+
"name": "HeyAtlas Provider",
|
|
52335
|
+
"options": {
|
|
52336
|
+
"baseURL": "\${HEYATLAS_PROVIDER_API_URL}",
|
|
52337
|
+
"apiKey": "\${HEYATLAS_PROVIDER_API_KEY}",
|
|
52338
|
+
},
|
|
52339
|
+
"models": {
|
|
52340
|
+
"huggingface/MiniMaxAI/MiniMax-M2.5:novita": {
|
|
52341
|
+
"name": "MiniMax-M2.5",
|
|
52342
|
+
},
|
|
52343
|
+
"huggingface/moonshotai/Kimi-K2.5:novita": {
|
|
52344
|
+
"name": "Kimi-K2.5",
|
|
52345
|
+
},
|
|
52346
|
+
},
|
|
52347
|
+
},
|
|
52348
|
+
},
|
|
52349
|
+
"mcp": {
|
|
52350
|
+
"smith-browser-use": {
|
|
52351
|
+
"type": "remote",
|
|
52352
|
+
"url": "http://127.0.0.1:12306/mcp",
|
|
52353
|
+
"enabled": true,
|
|
52354
|
+
},
|
|
52355
|
+
"smith-code-search-toolkit": {
|
|
52356
|
+
"type": "local",
|
|
52357
|
+
"command": ["uvx", "--from", "cased-kit", "kit-dev-mcp"],
|
|
52358
|
+
"enabled": true,
|
|
52359
|
+
},
|
|
52360
|
+
"smith-chrome-devtools-use": {
|
|
52361
|
+
"type": "local",
|
|
52362
|
+
"command": ["npx", "-y", "chrome-devtools-mcp@latest"],
|
|
52363
|
+
},
|
|
52364
|
+
"smith-websearch": {
|
|
52365
|
+
"type": "remote",
|
|
52366
|
+
"url": "https://nirmanus-bifrost-gateway.fly.dev/mcp",
|
|
52367
|
+
"headers": {
|
|
52368
|
+
"Authorization": "Bearer e7381674-6495-4112-ab87-7b943eff2390",
|
|
52369
|
+
},
|
|
52370
|
+
},
|
|
52371
|
+
"smith-arxiv": {
|
|
52372
|
+
"type": "local",
|
|
52373
|
+
"command": [
|
|
52374
|
+
"uv",
|
|
52375
|
+
"run",
|
|
52376
|
+
"--python",
|
|
52377
|
+
"3.12",
|
|
52378
|
+
"--with",
|
|
52379
|
+
"camel-ai",
|
|
52380
|
+
"--with",
|
|
52381
|
+
"arxiv",
|
|
52382
|
+
"python",
|
|
52383
|
+
"-c",
|
|
52384
|
+
"from camel.toolkits import ArxivToolkit; ArxivToolkit().run_mcp_server(mode=\\"stdio\\")",
|
|
52385
|
+
],
|
|
52386
|
+
},
|
|
52387
|
+
"smith-pptx": {
|
|
52388
|
+
"type": "local",
|
|
52389
|
+
"enabled": true,
|
|
52390
|
+
"command": [
|
|
52391
|
+
"uv",
|
|
52392
|
+
"run",
|
|
52393
|
+
"--python",
|
|
52394
|
+
"3.12",
|
|
52395
|
+
"--with",
|
|
52396
|
+
"camel-ai",
|
|
52397
|
+
"--with",
|
|
52398
|
+
"python-pptx",
|
|
52399
|
+
"python",
|
|
52400
|
+
"-c",
|
|
52401
|
+
"from camel.toolkits import PPTXToolkit; PPTXToolkit(working_directory=\\"\${WORKING_DIRECTORY}\\").run_mcp_server(mode=\\"stdio\\")",
|
|
52402
|
+
],
|
|
52403
|
+
},
|
|
52404
|
+
"smith-docx": {
|
|
52405
|
+
"type": "local",
|
|
52406
|
+
"enabled": true,
|
|
52407
|
+
"command": [
|
|
52408
|
+
"uv",
|
|
52409
|
+
"run",
|
|
52410
|
+
"--python",
|
|
52411
|
+
"3.12",
|
|
52412
|
+
"--with",
|
|
52413
|
+
"camel-ai",
|
|
52414
|
+
"--with",
|
|
52415
|
+
"python-docx",
|
|
52416
|
+
"python",
|
|
52417
|
+
"-c",
|
|
52418
|
+
"from camel.toolkits import FileToolkit; FileToolkit(working_directory=\\"\${WORKING_DIRECTORY}\\").run_mcp_server(mode=\\"stdio\\")",
|
|
52419
|
+
],
|
|
52420
|
+
},
|
|
52421
|
+
"smith-excel": {
|
|
52422
|
+
"type": "local",
|
|
52423
|
+
"enabled": true,
|
|
52424
|
+
"command": [
|
|
52425
|
+
"uv",
|
|
52426
|
+
"run",
|
|
52427
|
+
"--python",
|
|
52428
|
+
"3.12",
|
|
52429
|
+
"--with",
|
|
52430
|
+
"camel-ai",
|
|
52431
|
+
"--with",
|
|
52432
|
+
"openpyxl",
|
|
52433
|
+
"python",
|
|
52434
|
+
"-c",
|
|
52435
|
+
"from camel.toolkits import ExcelToolkit; ExcelToolkit(working_directory=\\"\${WORKING_DIRECTORY}\\").run_mcp_server(mode=\\"stdio\\")",
|
|
52436
|
+
],
|
|
52437
|
+
},
|
|
52438
|
+
},
|
|
52439
|
+
}`;
|
|
52440
|
+
async function setupSmithWorkspace(cwd) {
|
|
52441
|
+
const targetAgentsDir = join2(cwd, ".opencode", "agents");
|
|
52442
|
+
mkdirSync2(targetAgentsDir, { recursive: true });
|
|
52443
|
+
for (const [filename, content] of Object.entries(SMITH_AGENTS)) {
|
|
52444
|
+
writeFileSync2(join2(targetAgentsDir, filename), content);
|
|
52445
|
+
}
|
|
52446
|
+
writeFileSync2(join2(cwd, "opencode.jsonc"), SMITH_OPENCODE_JSONC);
|
|
52447
|
+
console.log("[smith] Workspace configured with agents and opencode.jsonc");
|
|
52448
|
+
}
|
|
52144
52449
|
|
|
52145
52450
|
class ACPProviderAgent {
|
|
52146
52451
|
agentType;
|
|
@@ -52178,6 +52483,9 @@ class ACPProviderAgent {
|
|
|
52178
52483
|
if (!config3) {
|
|
52179
52484
|
throw new Error(`Unknown ACP agent: ${this.agentType}`);
|
|
52180
52485
|
}
|
|
52486
|
+
if (this.agentType === "smith") {
|
|
52487
|
+
await setupSmithWorkspace(this.options.cwd || process.cwd());
|
|
52488
|
+
}
|
|
52181
52489
|
this.provider = createACPProvider({
|
|
52182
52490
|
command: config3.command,
|
|
52183
52491
|
args: config3.args,
|
|
@@ -52208,177 +52516,6 @@ class ACPProviderAgent {
|
|
|
52208
52516
|
}
|
|
52209
52517
|
}
|
|
52210
52518
|
|
|
52211
|
-
// agents/config.ts
|
|
52212
|
-
function isSmith(agent) {
|
|
52213
|
-
return agent === "smith";
|
|
52214
|
-
}
|
|
52215
|
-
|
|
52216
|
-
// agents/smith.ts
|
|
52217
|
-
import { spawn as spawn2 } from "child_process";
|
|
52218
|
-
var SANDBOX_BUNDLE_PATH = "@bishk029/agent-smith";
|
|
52219
|
-
var SMITH_CONFIG = {
|
|
52220
|
-
port: 3141,
|
|
52221
|
-
agentId: "workflow-orchestrator",
|
|
52222
|
-
healthPath: "/agents",
|
|
52223
|
-
chatPath: "/agents/workflow-orchestrator/chat",
|
|
52224
|
-
command: "npx",
|
|
52225
|
-
args: [SANDBOX_BUNDLE_PATH]
|
|
52226
|
-
};
|
|
52227
|
-
|
|
52228
|
-
class Smith {
|
|
52229
|
-
options;
|
|
52230
|
-
baseUrl;
|
|
52231
|
-
process = null;
|
|
52232
|
-
constructor(options = {}) {
|
|
52233
|
-
this.options = options;
|
|
52234
|
-
this.baseUrl = `http://localhost:${SMITH_CONFIG.port}`;
|
|
52235
|
-
}
|
|
52236
|
-
get name() {
|
|
52237
|
-
return "smith";
|
|
52238
|
-
}
|
|
52239
|
-
get agentId() {
|
|
52240
|
-
return SMITH_CONFIG.agentId;
|
|
52241
|
-
}
|
|
52242
|
-
get port() {
|
|
52243
|
-
return SMITH_CONFIG.port;
|
|
52244
|
-
}
|
|
52245
|
-
async isRunning() {
|
|
52246
|
-
try {
|
|
52247
|
-
const response = await fetch(`${this.baseUrl}${SMITH_CONFIG.healthPath}`, {
|
|
52248
|
-
method: "GET",
|
|
52249
|
-
signal: AbortSignal.timeout(2000)
|
|
52250
|
-
});
|
|
52251
|
-
return response.ok;
|
|
52252
|
-
} catch {
|
|
52253
|
-
return false;
|
|
52254
|
-
}
|
|
52255
|
-
}
|
|
52256
|
-
async isAvailable() {
|
|
52257
|
-
try {
|
|
52258
|
-
const { promisify } = await import("node:util");
|
|
52259
|
-
const exec = promisify((await import("node:child_process")).exec);
|
|
52260
|
-
await exec("which npx || where npx");
|
|
52261
|
-
return true;
|
|
52262
|
-
} catch {
|
|
52263
|
-
return false;
|
|
52264
|
-
}
|
|
52265
|
-
}
|
|
52266
|
-
async start() {
|
|
52267
|
-
if (await this.isRunning()) {
|
|
52268
|
-
console.log(`[smith] Server already running on port ${SMITH_CONFIG.port}`);
|
|
52269
|
-
return;
|
|
52270
|
-
}
|
|
52271
|
-
const env = {
|
|
52272
|
-
...process.env,
|
|
52273
|
-
PORT: String(SMITH_CONFIG.port)
|
|
52274
|
-
};
|
|
52275
|
-
console.log(`[smith] Starting ${SMITH_CONFIG.command} ${SMITH_CONFIG.args.join(" ")}`);
|
|
52276
|
-
this.process = spawn2(SMITH_CONFIG.command, SMITH_CONFIG.args, {
|
|
52277
|
-
env,
|
|
52278
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
52279
|
-
});
|
|
52280
|
-
this.process.stdout?.on("data", (data) => {
|
|
52281
|
-
console.log(`[smith] ${data.toString().trim()}`);
|
|
52282
|
-
});
|
|
52283
|
-
this.process.stderr?.on("data", (data) => {
|
|
52284
|
-
console.error(`[smith] ${data.toString().trim()}`);
|
|
52285
|
-
});
|
|
52286
|
-
this.process.on("error", (err) => {
|
|
52287
|
-
console.error(`[smith] Process error:`, err.message);
|
|
52288
|
-
});
|
|
52289
|
-
await this.waitForReady();
|
|
52290
|
-
}
|
|
52291
|
-
async waitForReady(maxAttempts = 60) {
|
|
52292
|
-
const delay2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
52293
|
-
for (let i = 0;i < maxAttempts; i++) {
|
|
52294
|
-
if (await this.isRunning()) {
|
|
52295
|
-
return;
|
|
52296
|
-
}
|
|
52297
|
-
await delay2(1000);
|
|
52298
|
-
}
|
|
52299
|
-
throw new Error(`Smith failed to start after ${maxAttempts}s`);
|
|
52300
|
-
}
|
|
52301
|
-
stop() {
|
|
52302
|
-
if (this.process) {
|
|
52303
|
-
this.process.kill("SIGTERM");
|
|
52304
|
-
this.process = null;
|
|
52305
|
-
}
|
|
52306
|
-
}
|
|
52307
|
-
getChatUrl() {
|
|
52308
|
-
return `${this.baseUrl}${SMITH_CONFIG.chatPath}`;
|
|
52309
|
-
}
|
|
52310
|
-
async* streamChat(prompt, userId, conversationId) {
|
|
52311
|
-
const response = await fetch(this.getChatUrl(), {
|
|
52312
|
-
method: "POST",
|
|
52313
|
-
headers: { "Content-Type": "application/json" },
|
|
52314
|
-
body: JSON.stringify({
|
|
52315
|
-
input: prompt,
|
|
52316
|
-
options: {
|
|
52317
|
-
userId: userId || "default-user",
|
|
52318
|
-
conversationId: conversationId || `conv-${Date.now()}`,
|
|
52319
|
-
temperature: 0.2,
|
|
52320
|
-
maxSteps: 35
|
|
52321
|
-
}
|
|
52322
|
-
})
|
|
52323
|
-
});
|
|
52324
|
-
if (!response.ok) {
|
|
52325
|
-
throw new Error(`Chat request failed: ${response.statusText}`);
|
|
52326
|
-
}
|
|
52327
|
-
const reader = response.body?.getReader();
|
|
52328
|
-
if (!reader) {
|
|
52329
|
-
throw new Error("No response body");
|
|
52330
|
-
}
|
|
52331
|
-
const decoder = new TextDecoder;
|
|
52332
|
-
let buffer = "";
|
|
52333
|
-
while (true) {
|
|
52334
|
-
const { done, value } = await reader.read();
|
|
52335
|
-
if (done)
|
|
52336
|
-
break;
|
|
52337
|
-
buffer += decoder.decode(value, { stream: true });
|
|
52338
|
-
const lines = buffer.split(`
|
|
52339
|
-
`);
|
|
52340
|
-
buffer = lines.pop() || "";
|
|
52341
|
-
for (const line of lines) {
|
|
52342
|
-
const trimmed = line.trim();
|
|
52343
|
-
if (!trimmed)
|
|
52344
|
-
continue;
|
|
52345
|
-
let jsonStr = null;
|
|
52346
|
-
if (trimmed.startsWith("data: ")) {
|
|
52347
|
-
jsonStr = trimmed.slice(6);
|
|
52348
|
-
} else if (/^\d+:/.test(trimmed)) {
|
|
52349
|
-
const colonIndex = trimmed.indexOf(":");
|
|
52350
|
-
jsonStr = trimmed.slice(colonIndex + 1);
|
|
52351
|
-
}
|
|
52352
|
-
if (jsonStr && jsonStr !== "[DONE]") {
|
|
52353
|
-
try {
|
|
52354
|
-
const event = JSON.parse(jsonStr);
|
|
52355
|
-
yield event;
|
|
52356
|
-
} catch {}
|
|
52357
|
-
}
|
|
52358
|
-
}
|
|
52359
|
-
}
|
|
52360
|
-
}
|
|
52361
|
-
async streamRaw(prompt, userId, conversationId) {
|
|
52362
|
-
const response = await fetch(this.getChatUrl(), {
|
|
52363
|
-
method: "POST",
|
|
52364
|
-
headers: { "Content-Type": "application/json" },
|
|
52365
|
-
body: JSON.stringify({
|
|
52366
|
-
input: prompt,
|
|
52367
|
-
options: {
|
|
52368
|
-
userId: userId || "default-user",
|
|
52369
|
-
conversationId: conversationId || `conv-${Date.now()}`,
|
|
52370
|
-
temperature: 0.2,
|
|
52371
|
-
maxSteps: 35
|
|
52372
|
-
}
|
|
52373
|
-
})
|
|
52374
|
-
});
|
|
52375
|
-
if (!response.ok) {
|
|
52376
|
-
throw new Error(`Chat request failed: ${response.statusText}`);
|
|
52377
|
-
}
|
|
52378
|
-
return response;
|
|
52379
|
-
}
|
|
52380
|
-
}
|
|
52381
|
-
|
|
52382
52519
|
// commands/connect.ts
|
|
52383
52520
|
async function connect(agentType, options = {}) {
|
|
52384
52521
|
const credentials = await login();
|
|
@@ -52388,13 +52525,9 @@ async function connect(agentType, options = {}) {
|
|
|
52388
52525
|
process.exit(1);
|
|
52389
52526
|
}
|
|
52390
52527
|
if (!await agent.isAvailable()) {
|
|
52391
|
-
|
|
52392
|
-
|
|
52393
|
-
|
|
52394
|
-
console.error(`Command: ${cmd.join(" ")}`);
|
|
52395
|
-
} else {
|
|
52396
|
-
console.error(`Error: Agent '${agentType}' is not available`);
|
|
52397
|
-
}
|
|
52528
|
+
const cmd = getACPCommand(agentType);
|
|
52529
|
+
console.error(`Error: Agent '${agentType}' is not installed or not in PATH`);
|
|
52530
|
+
console.error(`Command: ${cmd.join(" ")}`);
|
|
52398
52531
|
process.exit(1);
|
|
52399
52532
|
}
|
|
52400
52533
|
console.log(`Agent: ${agent.name}`);
|
|
@@ -52408,7 +52541,8 @@ async function connect(agentType, options = {}) {
|
|
|
52408
52541
|
const tunnel = new AtlasTunnel({
|
|
52409
52542
|
host: process.env.ATLAS_AGENT_HOST || "agent.heyatlas.app",
|
|
52410
52543
|
token: credentials.accessToken,
|
|
52411
|
-
interactive: true
|
|
52544
|
+
interactive: true,
|
|
52545
|
+
agentType: options.agentType || "local"
|
|
52412
52546
|
});
|
|
52413
52547
|
tunnel.onNewTask(async (task) => {
|
|
52414
52548
|
await handleTask(task, agent, tunnel);
|
|
@@ -52436,35 +52570,14 @@ Disconnecting...
|
|
|
52436
52570
|
await new Promise(() => {});
|
|
52437
52571
|
}
|
|
52438
52572
|
function createAgent(agentType) {
|
|
52439
|
-
if (
|
|
52440
|
-
return
|
|
52441
|
-
}
|
|
52442
|
-
if (isACPAgent(agentType)) {
|
|
52443
|
-
return createACPAgent(agentType);
|
|
52444
|
-
}
|
|
52445
|
-
return null;
|
|
52446
|
-
}
|
|
52447
|
-
function createSmithAgent() {
|
|
52448
|
-
const smith = new Smith({ cwd: process.cwd() });
|
|
52449
|
-
return {
|
|
52450
|
-
name: "smith",
|
|
52451
|
-
isAvailable: () => smith.isAvailable(),
|
|
52452
|
-
async init() {
|
|
52453
|
-
console.log("Starting smith server...");
|
|
52454
|
-
await smith.start();
|
|
52455
|
-
console.log(`Smith server running on port ${smith.port}`);
|
|
52456
|
-
},
|
|
52457
|
-
stream: (prompt) => smith.streamChat(prompt),
|
|
52458
|
-
cleanup: () => smith.stop()
|
|
52459
|
-
};
|
|
52460
|
-
}
|
|
52461
|
-
function createACPAgent(agentType) {
|
|
52573
|
+
if (!isACPAgent(agentType))
|
|
52574
|
+
return null;
|
|
52462
52575
|
const acp = new ACPProviderAgent(agentType, { cwd: process.cwd() });
|
|
52463
52576
|
return {
|
|
52464
52577
|
name: agentType,
|
|
52465
52578
|
isAvailable: () => acp.isAvailable(),
|
|
52466
52579
|
init: () => acp.init(),
|
|
52467
|
-
async* stream(prompt) {
|
|
52580
|
+
async* stream(prompt, _taskId) {
|
|
52468
52581
|
const result = acp.stream(prompt);
|
|
52469
52582
|
for await (const chunk of result.toUIMessageStream()) {
|
|
52470
52583
|
yield chunk;
|
|
@@ -52482,7 +52595,7 @@ async function handleTask(task, agent, tunnel) {
|
|
|
52482
52595
|
{ type: "message", timestamp: Date.now(), data: { role: "user", content: latestUserMessage } }
|
|
52483
52596
|
]);
|
|
52484
52597
|
try {
|
|
52485
|
-
const parts = await processStream(task.id, agent.stream(prompt), tunnel);
|
|
52598
|
+
const parts = await processStream(task.id, agent.stream(prompt, task.id), tunnel);
|
|
52486
52599
|
if (parts.length > 0) {
|
|
52487
52600
|
await tunnel.appendContext(task.id, [
|
|
52488
52601
|
{ type: "ui_message", timestamp: Date.now(), data: { id: crypto.randomUUID(), role: "assistant", parts } }
|
|
@@ -52624,7 +52737,7 @@ function openBrowser(url3) {
|
|
|
52624
52737
|
}
|
|
52625
52738
|
|
|
52626
52739
|
// index.ts
|
|
52627
|
-
var
|
|
52740
|
+
var SUPPORTED_AGENTS = [
|
|
52628
52741
|
"opencode",
|
|
52629
52742
|
"claude-code",
|
|
52630
52743
|
"goose",
|
|
@@ -52635,10 +52748,10 @@ var ACP_AGENTS = [
|
|
|
52635
52748
|
"auggie",
|
|
52636
52749
|
"stakpak",
|
|
52637
52750
|
"openhands",
|
|
52638
|
-
"cagent"
|
|
52751
|
+
"cagent",
|
|
52752
|
+
"copilot",
|
|
52753
|
+
"smith"
|
|
52639
52754
|
];
|
|
52640
|
-
var SMITH_AGENTS = ["smith"];
|
|
52641
|
-
var SUPPORTED_AGENTS = [...ACP_AGENTS, ...SMITH_AGENTS];
|
|
52642
52755
|
var { positionals, values } = parseArgs({
|
|
52643
52756
|
args: process.argv.slice(2),
|
|
52644
52757
|
options: {
|
|
@@ -52656,8 +52769,7 @@ Usage:
|
|
|
52656
52769
|
heyatlas connect <agent> Connect agent to Atlas
|
|
52657
52770
|
|
|
52658
52771
|
Supported Agents:
|
|
52659
|
-
|
|
52660
|
-
Smith: ${SMITH_AGENTS.join(", ")}
|
|
52772
|
+
${SUPPORTED_AGENTS.join(", ")}
|
|
52661
52773
|
|
|
52662
52774
|
Options:
|
|
52663
52775
|
-h, --help Show this help message
|
|
@@ -52666,7 +52778,7 @@ Options:
|
|
|
52666
52778
|
|
|
52667
52779
|
Examples:
|
|
52668
52780
|
heyatlas connect opencode Connect OpenCode via ACP
|
|
52669
|
-
heyatlas connect smith Connect Smith
|
|
52781
|
+
heyatlas connect smith Connect Smith via OpenCode
|
|
52670
52782
|
`);
|
|
52671
52783
|
}
|
|
52672
52784
|
async function main() {
|