heyatlas 1.5.11 → 1.8.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 +327 -216
- 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
|
}
|
|
@@ -5565,12 +5566,15 @@ class AtlasTunnel {
|
|
|
5565
5566
|
if (!state.tasks)
|
|
5566
5567
|
return;
|
|
5567
5568
|
for (const task of Object.values(state.tasks)) {
|
|
5568
|
-
if (task.state
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
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);
|
|
5574
5578
|
}
|
|
5575
5579
|
}
|
|
5576
5580
|
}
|
|
@@ -52123,6 +52127,8 @@ var _a153;
|
|
|
52123
52127
|
_a153 = symbol153;
|
|
52124
52128
|
|
|
52125
52129
|
// agents/acp-provider.ts
|
|
52130
|
+
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
52131
|
+
import { join as join2 } from "node:path";
|
|
52126
52132
|
var ACP_COMMANDS = {
|
|
52127
52133
|
opencode: { command: "opencode", args: ["acp"] },
|
|
52128
52134
|
"claude-code": { command: "claude-code-acp", args: [] },
|
|
@@ -52134,7 +52140,9 @@ var ACP_COMMANDS = {
|
|
|
52134
52140
|
auggie: { command: "auggie", args: ["--acp"] },
|
|
52135
52141
|
stakpak: { command: "stakpak", args: ["acp"] },
|
|
52136
52142
|
openhands: { command: "openhands", args: ["acp"] },
|
|
52137
|
-
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"] }
|
|
52138
52146
|
};
|
|
52139
52147
|
function isACPAgent(agent) {
|
|
52140
52148
|
return agent in ACP_COMMANDS;
|
|
@@ -52143,6 +52151,302 @@ function getACPCommand(agent) {
|
|
|
52143
52151
|
const config3 = ACP_COMMANDS[agent];
|
|
52144
52152
|
return config3 ? [config3.command, ...config3.args] : [];
|
|
52145
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
|
+
const config3 = SMITH_OPENCODE_JSONC.replace(/\$\{WORKING_DIRECTORY\}/g, cwd);
|
|
52447
|
+
writeFileSync2(join2(cwd, "opencode.jsonc"), config3);
|
|
52448
|
+
console.log("[smith] Workspace configured with agents and opencode.jsonc");
|
|
52449
|
+
}
|
|
52146
52450
|
|
|
52147
52451
|
class ACPProviderAgent {
|
|
52148
52452
|
agentType;
|
|
@@ -52180,6 +52484,9 @@ class ACPProviderAgent {
|
|
|
52180
52484
|
if (!config3) {
|
|
52181
52485
|
throw new Error(`Unknown ACP agent: ${this.agentType}`);
|
|
52182
52486
|
}
|
|
52487
|
+
if (this.agentType === "smith") {
|
|
52488
|
+
await setupSmithWorkspace(this.options.cwd || process.cwd());
|
|
52489
|
+
}
|
|
52183
52490
|
this.provider = createACPProvider({
|
|
52184
52491
|
command: config3.command,
|
|
52185
52492
|
args: config3.args,
|
|
@@ -52210,177 +52517,6 @@ class ACPProviderAgent {
|
|
|
52210
52517
|
}
|
|
52211
52518
|
}
|
|
52212
52519
|
|
|
52213
|
-
// agents/config.ts
|
|
52214
|
-
function isSmith(agent) {
|
|
52215
|
-
return agent === "smith";
|
|
52216
|
-
}
|
|
52217
|
-
|
|
52218
|
-
// agents/smith.ts
|
|
52219
|
-
import { spawn as spawn2 } from "child_process";
|
|
52220
|
-
var SANDBOX_BUNDLE_PATH = "@bishk029/agent-smith";
|
|
52221
|
-
var SMITH_CONFIG = {
|
|
52222
|
-
port: 3141,
|
|
52223
|
-
agentId: "workflow-orchestrator",
|
|
52224
|
-
healthPath: "/agents",
|
|
52225
|
-
chatPath: "/agents/workflow-orchestrator/chat",
|
|
52226
|
-
command: "npx",
|
|
52227
|
-
args: [SANDBOX_BUNDLE_PATH]
|
|
52228
|
-
};
|
|
52229
|
-
|
|
52230
|
-
class Smith {
|
|
52231
|
-
options;
|
|
52232
|
-
baseUrl;
|
|
52233
|
-
process = null;
|
|
52234
|
-
constructor(options = {}) {
|
|
52235
|
-
this.options = options;
|
|
52236
|
-
this.baseUrl = `http://localhost:${SMITH_CONFIG.port}`;
|
|
52237
|
-
}
|
|
52238
|
-
get name() {
|
|
52239
|
-
return "smith";
|
|
52240
|
-
}
|
|
52241
|
-
get agentId() {
|
|
52242
|
-
return SMITH_CONFIG.agentId;
|
|
52243
|
-
}
|
|
52244
|
-
get port() {
|
|
52245
|
-
return SMITH_CONFIG.port;
|
|
52246
|
-
}
|
|
52247
|
-
async isRunning() {
|
|
52248
|
-
try {
|
|
52249
|
-
const response = await fetch(`${this.baseUrl}${SMITH_CONFIG.healthPath}`, {
|
|
52250
|
-
method: "GET",
|
|
52251
|
-
signal: AbortSignal.timeout(2000)
|
|
52252
|
-
});
|
|
52253
|
-
return response.ok;
|
|
52254
|
-
} catch {
|
|
52255
|
-
return false;
|
|
52256
|
-
}
|
|
52257
|
-
}
|
|
52258
|
-
async isAvailable() {
|
|
52259
|
-
try {
|
|
52260
|
-
const { promisify } = await import("node:util");
|
|
52261
|
-
const exec = promisify((await import("node:child_process")).exec);
|
|
52262
|
-
await exec("which npx || where npx");
|
|
52263
|
-
return true;
|
|
52264
|
-
} catch {
|
|
52265
|
-
return false;
|
|
52266
|
-
}
|
|
52267
|
-
}
|
|
52268
|
-
async start() {
|
|
52269
|
-
if (await this.isRunning()) {
|
|
52270
|
-
console.log(`[smith] Server already running on port ${SMITH_CONFIG.port}`);
|
|
52271
|
-
return;
|
|
52272
|
-
}
|
|
52273
|
-
const env = {
|
|
52274
|
-
...process.env,
|
|
52275
|
-
PORT: String(SMITH_CONFIG.port)
|
|
52276
|
-
};
|
|
52277
|
-
console.log(`[smith] Starting ${SMITH_CONFIG.command} ${SMITH_CONFIG.args.join(" ")}`);
|
|
52278
|
-
this.process = spawn2(SMITH_CONFIG.command, SMITH_CONFIG.args, {
|
|
52279
|
-
env,
|
|
52280
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
52281
|
-
});
|
|
52282
|
-
this.process.stdout?.on("data", (data) => {
|
|
52283
|
-
console.log(`[smith] ${data.toString().trim()}`);
|
|
52284
|
-
});
|
|
52285
|
-
this.process.stderr?.on("data", (data) => {
|
|
52286
|
-
console.error(`[smith] ${data.toString().trim()}`);
|
|
52287
|
-
});
|
|
52288
|
-
this.process.on("error", (err) => {
|
|
52289
|
-
console.error(`[smith] Process error:`, err.message);
|
|
52290
|
-
});
|
|
52291
|
-
await this.waitForReady();
|
|
52292
|
-
}
|
|
52293
|
-
async waitForReady(maxAttempts = 60) {
|
|
52294
|
-
const delay2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
52295
|
-
for (let i = 0;i < maxAttempts; i++) {
|
|
52296
|
-
if (await this.isRunning()) {
|
|
52297
|
-
return;
|
|
52298
|
-
}
|
|
52299
|
-
await delay2(1000);
|
|
52300
|
-
}
|
|
52301
|
-
throw new Error(`Smith failed to start after ${maxAttempts}s`);
|
|
52302
|
-
}
|
|
52303
|
-
stop() {
|
|
52304
|
-
if (this.process) {
|
|
52305
|
-
this.process.kill("SIGTERM");
|
|
52306
|
-
this.process = null;
|
|
52307
|
-
}
|
|
52308
|
-
}
|
|
52309
|
-
getChatUrl() {
|
|
52310
|
-
return `${this.baseUrl}${SMITH_CONFIG.chatPath}`;
|
|
52311
|
-
}
|
|
52312
|
-
async* streamChat(prompt, userId, conversationId) {
|
|
52313
|
-
const response = await fetch(this.getChatUrl(), {
|
|
52314
|
-
method: "POST",
|
|
52315
|
-
headers: { "Content-Type": "application/json" },
|
|
52316
|
-
body: JSON.stringify({
|
|
52317
|
-
input: prompt,
|
|
52318
|
-
options: {
|
|
52319
|
-
userId: userId || "default-user",
|
|
52320
|
-
conversationId: conversationId || `conv-${Date.now()}`,
|
|
52321
|
-
temperature: 0.2,
|
|
52322
|
-
maxSteps: 35
|
|
52323
|
-
}
|
|
52324
|
-
})
|
|
52325
|
-
});
|
|
52326
|
-
if (!response.ok) {
|
|
52327
|
-
throw new Error(`Chat request failed: ${response.statusText}`);
|
|
52328
|
-
}
|
|
52329
|
-
const reader = response.body?.getReader();
|
|
52330
|
-
if (!reader) {
|
|
52331
|
-
throw new Error("No response body");
|
|
52332
|
-
}
|
|
52333
|
-
const decoder = new TextDecoder;
|
|
52334
|
-
let buffer = "";
|
|
52335
|
-
while (true) {
|
|
52336
|
-
const { done, value } = await reader.read();
|
|
52337
|
-
if (done)
|
|
52338
|
-
break;
|
|
52339
|
-
buffer += decoder.decode(value, { stream: true });
|
|
52340
|
-
const lines = buffer.split(`
|
|
52341
|
-
`);
|
|
52342
|
-
buffer = lines.pop() || "";
|
|
52343
|
-
for (const line of lines) {
|
|
52344
|
-
const trimmed = line.trim();
|
|
52345
|
-
if (!trimmed)
|
|
52346
|
-
continue;
|
|
52347
|
-
let jsonStr = null;
|
|
52348
|
-
if (trimmed.startsWith("data: ")) {
|
|
52349
|
-
jsonStr = trimmed.slice(6);
|
|
52350
|
-
} else if (/^\d+:/.test(trimmed)) {
|
|
52351
|
-
const colonIndex = trimmed.indexOf(":");
|
|
52352
|
-
jsonStr = trimmed.slice(colonIndex + 1);
|
|
52353
|
-
}
|
|
52354
|
-
if (jsonStr && jsonStr !== "[DONE]") {
|
|
52355
|
-
try {
|
|
52356
|
-
const event = JSON.parse(jsonStr);
|
|
52357
|
-
yield event;
|
|
52358
|
-
} catch {}
|
|
52359
|
-
}
|
|
52360
|
-
}
|
|
52361
|
-
}
|
|
52362
|
-
}
|
|
52363
|
-
async streamRaw(prompt, userId, conversationId) {
|
|
52364
|
-
const response = await fetch(this.getChatUrl(), {
|
|
52365
|
-
method: "POST",
|
|
52366
|
-
headers: { "Content-Type": "application/json" },
|
|
52367
|
-
body: JSON.stringify({
|
|
52368
|
-
input: prompt,
|
|
52369
|
-
options: {
|
|
52370
|
-
userId: userId || "default-user",
|
|
52371
|
-
conversationId: conversationId || `conv-${Date.now()}`,
|
|
52372
|
-
temperature: 0.2,
|
|
52373
|
-
maxSteps: 35
|
|
52374
|
-
}
|
|
52375
|
-
})
|
|
52376
|
-
});
|
|
52377
|
-
if (!response.ok) {
|
|
52378
|
-
throw new Error(`Chat request failed: ${response.statusText}`);
|
|
52379
|
-
}
|
|
52380
|
-
return response;
|
|
52381
|
-
}
|
|
52382
|
-
}
|
|
52383
|
-
|
|
52384
52520
|
// commands/connect.ts
|
|
52385
52521
|
async function connect(agentType, options = {}) {
|
|
52386
52522
|
const credentials = await login();
|
|
@@ -52390,13 +52526,9 @@ async function connect(agentType, options = {}) {
|
|
|
52390
52526
|
process.exit(1);
|
|
52391
52527
|
}
|
|
52392
52528
|
if (!await agent.isAvailable()) {
|
|
52393
|
-
|
|
52394
|
-
|
|
52395
|
-
|
|
52396
|
-
console.error(`Command: ${cmd.join(" ")}`);
|
|
52397
|
-
} else {
|
|
52398
|
-
console.error(`Error: Agent '${agentType}' is not available`);
|
|
52399
|
-
}
|
|
52529
|
+
const cmd = getACPCommand(agentType);
|
|
52530
|
+
console.error(`Error: Agent '${agentType}' is not installed or not in PATH`);
|
|
52531
|
+
console.error(`Command: ${cmd.join(" ")}`);
|
|
52400
52532
|
process.exit(1);
|
|
52401
52533
|
}
|
|
52402
52534
|
console.log(`Agent: ${agent.name}`);
|
|
@@ -52410,7 +52542,8 @@ async function connect(agentType, options = {}) {
|
|
|
52410
52542
|
const tunnel = new AtlasTunnel({
|
|
52411
52543
|
host: process.env.ATLAS_AGENT_HOST || "agent.heyatlas.app",
|
|
52412
52544
|
token: credentials.accessToken,
|
|
52413
|
-
interactive: true
|
|
52545
|
+
interactive: true,
|
|
52546
|
+
agentType: options.agentType || "local"
|
|
52414
52547
|
});
|
|
52415
52548
|
tunnel.onNewTask(async (task) => {
|
|
52416
52549
|
await handleTask(task, agent, tunnel);
|
|
@@ -52438,29 +52571,8 @@ Disconnecting...
|
|
|
52438
52571
|
await new Promise(() => {});
|
|
52439
52572
|
}
|
|
52440
52573
|
function createAgent(agentType) {
|
|
52441
|
-
if (
|
|
52442
|
-
return
|
|
52443
|
-
}
|
|
52444
|
-
if (isACPAgent(agentType)) {
|
|
52445
|
-
return createACPAgent(agentType);
|
|
52446
|
-
}
|
|
52447
|
-
return null;
|
|
52448
|
-
}
|
|
52449
|
-
function createSmithAgent() {
|
|
52450
|
-
const smith = new Smith({ cwd: process.cwd() });
|
|
52451
|
-
return {
|
|
52452
|
-
name: "smith",
|
|
52453
|
-
isAvailable: () => smith.isAvailable(),
|
|
52454
|
-
async init() {
|
|
52455
|
-
console.log("Starting smith server...");
|
|
52456
|
-
await smith.start();
|
|
52457
|
-
console.log(`Smith server running on port ${smith.port}`);
|
|
52458
|
-
},
|
|
52459
|
-
stream: (prompt, taskId) => smith.streamChat(prompt, undefined, taskId),
|
|
52460
|
-
cleanup: () => smith.stop()
|
|
52461
|
-
};
|
|
52462
|
-
}
|
|
52463
|
-
function createACPAgent(agentType) {
|
|
52574
|
+
if (!isACPAgent(agentType))
|
|
52575
|
+
return null;
|
|
52464
52576
|
const acp = new ACPProviderAgent(agentType, { cwd: process.cwd() });
|
|
52465
52577
|
return {
|
|
52466
52578
|
name: agentType,
|
|
@@ -52626,7 +52738,7 @@ function openBrowser(url3) {
|
|
|
52626
52738
|
}
|
|
52627
52739
|
|
|
52628
52740
|
// index.ts
|
|
52629
|
-
var
|
|
52741
|
+
var SUPPORTED_AGENTS = [
|
|
52630
52742
|
"opencode",
|
|
52631
52743
|
"claude-code",
|
|
52632
52744
|
"goose",
|
|
@@ -52637,10 +52749,10 @@ var ACP_AGENTS = [
|
|
|
52637
52749
|
"auggie",
|
|
52638
52750
|
"stakpak",
|
|
52639
52751
|
"openhands",
|
|
52640
|
-
"cagent"
|
|
52752
|
+
"cagent",
|
|
52753
|
+
"copilot",
|
|
52754
|
+
"smith"
|
|
52641
52755
|
];
|
|
52642
|
-
var SMITH_AGENTS = ["smith"];
|
|
52643
|
-
var SUPPORTED_AGENTS = [...ACP_AGENTS, ...SMITH_AGENTS];
|
|
52644
52756
|
var { positionals, values } = parseArgs({
|
|
52645
52757
|
args: process.argv.slice(2),
|
|
52646
52758
|
options: {
|
|
@@ -52658,8 +52770,7 @@ Usage:
|
|
|
52658
52770
|
heyatlas connect <agent> Connect agent to Atlas
|
|
52659
52771
|
|
|
52660
52772
|
Supported Agents:
|
|
52661
|
-
|
|
52662
|
-
Smith: ${SMITH_AGENTS.join(", ")}
|
|
52773
|
+
${SUPPORTED_AGENTS.join(", ")}
|
|
52663
52774
|
|
|
52664
52775
|
Options:
|
|
52665
52776
|
-h, --help Show this help message
|
|
@@ -52668,7 +52779,7 @@ Options:
|
|
|
52668
52779
|
|
|
52669
52780
|
Examples:
|
|
52670
52781
|
heyatlas connect opencode Connect OpenCode via ACP
|
|
52671
|
-
heyatlas connect smith Connect Smith
|
|
52782
|
+
heyatlas connect smith Connect Smith via OpenCode
|
|
52672
52783
|
`);
|
|
52673
52784
|
}
|
|
52674
52785
|
async function main() {
|