Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ The UI is extracted from the desktop shell (CodeNomad-style): the desktop app is
## Build, Test, and Development Commands
- Install: `bun install` + `bun run installRuntime` (first time).
- Dev: `bun run dev` (HMR). Inspect: `bun run dev:inspect`; Linux: `bun run dev:linux`.
- Preview: `pnpm start`.
- Type check: `bun run typecheck` (or `typecheck:node` / `typecheck:web`). Uses `tsgo` (native TS preview).
- Preview: `bun run start`.
- Type check: `bun run typecheck` (or `typecheck:node` / `typecheck:web`). Uses TypeScript 7 (`tsc`, the native Go-rewrite compiler).
- Lint: `bun run lint` (runs `agent-cleanup-guard`, `architecture-guard`, then `oxlint`).
- Format: `bun run format` (oxfmt). Check: `bun run format:check`.
- After completing a feature, always run `bun run format` and `bun run lint`.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align='center'>
<img src='./build/icon.png' width="150" height="150" alt="Argos AI Assistant Icon" />
<img src='./apps/desktop/resources/icon.png' width="150" height="150" alt="Argos AI Assistant Icon" />
</p>

<h1 align="center">Argos - Powerful Open-Source AI Agent Platform</h1>
Expand Down Expand Up @@ -31,11 +31,11 @@ Beyond chat, Argos supports agentic workflows: rich tool calling via MCP (Model
<table align="center">
<tr>
<td align="center" style="padding: 10px;">
<img src='https://github.com/user-attachments/assets/6e932a65-78e0-4d2e-9654-ccc010f78bf7' alt="Argos Light Mode" width="400"/>
<img src='./apps/landing/public/shot-light.png' alt="Argos Light Mode" width="400"/>
<br/>
</td>
<td align="center" style="padding: 10px;">
<img src='https://github.com/user-attachments/assets/ea6ccf60-32af-4bc1-91cc-e72703bdc1ff' alt="Argos Dark Mode" width="400"/>
<img src='./apps/landing/public/shot-dark.png' alt="Argos Dark Mode" width="400"/>
<br/>
</td>
</tr>
Expand Down
209 changes: 209 additions & 0 deletions apps/daemon/src/host/argosOrchestrationRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ type SessionActions = {
stop(sessionId: string): Promise<void>;
};

type ProvisioningActions = {
createAgent(input: Record<string, unknown>): Promise<unknown>;
updateAgent(agentId: string, updates: Record<string, unknown>): Promise<unknown>;
listMcpServers(): Promise<unknown>;
upsertMcpServer(serverName: string, config: Record<string, unknown>): Promise<unknown>;
setAgentMcpServers(agentId: string, serverNames: string[]): Promise<unknown>;
listAgentSkills(agentId: string): Promise<unknown>;
writeAgentSkill(
agentId: string,
input: { name: string; description: string; instructions: string },
): Promise<unknown>;
removeAgentSkill(agentId: string, name: string): Promise<unknown>;
provisionAgent(input: Record<string, unknown>): Promise<unknown>;
validateAgent(agentId: string): Promise<unknown>;
};

const tool = (
name: string,
description: string,
Expand All @@ -22,6 +38,7 @@ const tool = (

export class ArgosOrchestrationRuntime {
private sessionActions?: SessionActions;
private provisioningActions?: ProvisioningActions;

constructor(
private readonly db: Database,
Expand Down Expand Up @@ -85,6 +102,121 @@ export class ArgosOrchestrationRuntime {
"sessionId",
]),
tool("argos_agents_list", "List Argos agents available for delegation.", {}),
tool(
"argos_agents_create",
"Create a custom Argos agent. Pass config to set its prompt, model, permissions, tools, MCP servers, plugins, skills, memory, or subagents.",
{
name: { type: "string" },
description: { type: "string" },
enabled: { type: "boolean" },
config: { type: "object", additionalProperties: true },
},
["name"],
),
tool(
"argos_agents_update",
"Update a custom Argos agent or the orchestrator itself. The default protected Argos agent cannot be changed here.",
{
agentId: { type: "string" },
updates: { type: "object", additionalProperties: true },
},
["agentId", "updates"],
),
tool("argos_mcp_servers_list", "List globally configured MCP servers and their current configuration.", {}),
tool(
"argos_mcp_server_upsert",
"Add or update and start an MCP server. Environment values are persisted in the existing Argos MCP configuration; never place secrets in skill instructions.",
{
serverName: { type: "string" },
config: {
type: "object",
properties: {
type: { type: "string", enum: ["stdio", "sse", "http"] },
command: { type: "string" },
args: { type: "array", items: { type: "string" } },
env: { type: "object", additionalProperties: true },
baseUrl: { type: "string" },
customHeaders: { type: "object", additionalProperties: { type: "string" } },
descriptions: { type: "string" },
enabled: { type: "boolean" },
},
additionalProperties: true,
},
},
["serverName", "config"],
),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
tool(
"argos_agent_mcp_servers_set",
"Replace an agent's MCP server allowlist. An empty list gives the agent no MCP servers.",
{
agentId: { type: "string" },
serverNames: { type: "array", items: { type: "string" } },
},
["agentId", "serverNames"],
),
tool(
"argos_agent_skills_list",
"List disk-backed Argos-managed skills attached to one agent, including hash and managed version.",
{ agentId: { type: "string" } },
["agentId"],
),
tool(
"argos_agent_skill_write",
"Create or update an agent-specific skill under its managed .argos/skills directory and attach it to that agent.",
{
agentId: { type: "string" },
name: { type: "string" },
description: { type: "string" },
instructions: { type: "string" },
},
["agentId", "name", "description", "instructions"],
),
tool(
"argos_agent_skill_remove",
"Remove an Argos-managed skill from one agent and detach it from that agent's skill allowlist.",
{ agentId: { type: "string" }, name: { type: "string" } },
["agentId", "name"],
),
tool(
"argos_agent_provision",
"Atomically create and validate a specialized agent with MCP servers and durable managed skills. The incomplete agent and MCP changes are rolled back on failure.",
{
name: { type: "string" },
description: { type: "string" },
enabled: { type: "boolean" },
config: { type: "object", additionalProperties: true },
mcpServers: {
type: "array",
items: {
type: "object",
properties: {
serverName: { type: "string" },
config: { type: "object", additionalProperties: true },
},
required: ["serverName", "config"],
},
},
skills: {
type: "array",
items: {
type: "object",
properties: {
name: { type: "string" },
description: { type: "string" },
instructions: { type: "string" },
},
required: ["name", "description", "instructions"],
},
},
},
["name"],
),
tool(
"argos_agent_validate",
"Validate an Argos agent's model, MCP configuration/runtime, allowlists, managed skill files, and enabled state.",
{ agentId: { type: "string" } },
["agentId"],
),
];
}

Expand All @@ -96,6 +228,10 @@ export class ArgosOrchestrationRuntime {
this.sessionActions = actions;
}

setProvisioningActions(actions: ProvisioningActions): void {
this.provisioningActions = actions;
}

async call(request: MCPToolCall): Promise<MCPToolResponse> {
const args = JSON.parse(request.function.arguments || "{}") as Record<string, unknown>;
const now = Date.now();
Expand Down Expand Up @@ -215,9 +351,82 @@ export class ArgosOrchestrationRuntime {
case "argos_agents_list":
result = await this.listAgents();
break;
case "argos_agents_create":
result = await this.requireProvisioning().createAgent({
name: this.requireString(args, "name"),
...(typeof args.description === "string" ? { description: args.description } : {}),
...(typeof args.enabled === "boolean" ? { enabled: args.enabled } : {}),
...(this.asRecord(args.config) ? { config: this.asRecord(args.config) } : {}),
});
break;
case "argos_agents_update":
result = await this.requireProvisioning().updateAgent(
this.requireString(args, "agentId"),
this.asRecord(args.updates) ?? {},
);
break;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
case "argos_mcp_servers_list":
result = await this.requireProvisioning().listMcpServers();
break;
case "argos_mcp_server_upsert": {
const serverName = this.requireString(args, "serverName");
const serverConfig = this.asRecord(args.config) ?? {};
// stdio servers run an arbitrary local command with model-supplied args/env.
// The orchestrator may only register http/sse (URL) transports; stdio servers
// must be configured manually by the user to avoid local code execution.
if (serverConfig.type === "stdio") {
throw new Error(
"The orchestrator cannot register stdio MCP servers (that would allow arbitrary local command execution). Configure stdio servers manually via Settings, or use an http/sse transport.",
);
}
result = await this.requireProvisioning().upsertMcpServer(serverName, serverConfig);
Comment on lines +371 to +382

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Enforce a closed HTTP/SSE transport allowlist.

A missing or unrecognized config.type bypasses the exact "stdio" check. It then reaches the daemon authority that persists and starts the MCP server.

  • apps/daemon/src/host/argosOrchestrationRuntime.ts#L371-L382: reject every transport except "http" and "sse" before delegation.
  • apps/daemon/src/host/argosOrchestrationRuntime.ts#L127-L146: remove stdio and local-command fields from the published tool schema.
  • apps/daemon/test/argosOrchestrationRuntime.test.ts#L68-L101: verify that missing and unrecognized transports do not call upsertMcpServer.
Proposed fix
-              type: { type: "string", enum: ["stdio", "sse", "http"] },
-              command: { type: "string" },
-              args: { type: "array", items: { type: "string" } },
-              env: { type: "object", additionalProperties: true },
+              type: { type: "string", enum: ["sse", "http"] },
               baseUrl: { type: "string" },
               customHeaders: { type: "object", additionalProperties: { type: "string" } },
@@
-        if (serverConfig.type === "stdio") {
+        if (serverConfig.type !== "http" && serverConfig.type !== "sse") {
           throw new Error(
-            "The orchestrator cannot register stdio MCP servers (that would allow arbitrary local command execution). Configure stdio servers manually via Settings, or use an http/sse transport.",
+            "The orchestrator can register only http or sse MCP servers.",
           );
         }
📍 Affects 2 files
  • apps/daemon/src/host/argosOrchestrationRuntime.ts#L371-L382 (this comment)
  • apps/daemon/src/host/argosOrchestrationRuntime.ts#L127-L146
  • apps/daemon/test/argosOrchestrationRuntime.test.ts#L68-L101
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/daemon/src/host/argosOrchestrationRuntime.ts` around lines 371 - 382,
Enforce a closed HTTP/SSE transport allowlist in
apps/daemon/src/host/argosOrchestrationRuntime.ts lines 371-382 by rejecting any
config.type other than "http" or "sse" before
requireProvisioning().upsertMcpServer, including missing and unrecognized
values; retain the existing stdio rejection intent. In
apps/daemon/src/host/argosOrchestrationRuntime.ts lines 127-146, remove stdio
and local-command fields from the published tool schema. In
apps/daemon/test/argosOrchestrationRuntime.test.ts lines 68-101, add coverage
confirming missing and unrecognized transports reject and do not call
upsertMcpServer.

break;
}
case "argos_agent_mcp_servers_set":
result = await this.requireProvisioning().setAgentMcpServers(
String(args.agentId),
Array.isArray(args.serverNames) ? args.serverNames.map(String) : [],
);
break;
case "argos_agent_skills_list":
result = await this.requireProvisioning().listAgentSkills(String(args.agentId));
break;
case "argos_agent_skill_write":
result = await this.requireProvisioning().writeAgentSkill(String(args.agentId), {
name: String(args.name),
description: String(args.description),
instructions: String(args.instructions),
});
break;
case "argos_agent_skill_remove":
result = await this.requireProvisioning().removeAgentSkill(String(args.agentId), String(args.name));
break;
case "argos_agent_provision":
result = await this.requireProvisioning().provisionAgent(args);
break;
case "argos_agent_validate":
result = await this.requireProvisioning().validateAgent(String(args.agentId));
break;
default:
throw new Error(`Unknown Argos orchestration tool: ${request.function.name}`);
}
return { toolCallId: request.id, content: [{ type: "text", text: JSON.stringify(result) }], toolResult: result };
}

private requireProvisioning(): ProvisioningActions {
if (!this.provisioningActions) throw new Error("Argos provisioning is not ready.");
return this.provisioningActions;
}

private asRecord(value: unknown): Record<string, unknown> | null {
return value && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : null;
}

private requireString(args: Record<string, unknown>, key: string): string {
const value = args[key];
if (typeof value !== "string" || value.trim().length === 0) {
throw new Error(`Missing required argument: ${key}`);
}
return value;
}
}
5 changes: 5 additions & 0 deletions apps/daemon/src/host/daemonArgosAgentRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ export class DaemonArgosAgentRuntime {
ensureBuiltinAgent() {
return this.runtime.ensureBuiltinAgent();
}

/** Seed the disabled-by-default built-in orchestration specialist. */
ensureBuiltinOrchestratorAgent() {
return this.runtime.ensureBuiltinOrchestratorAgent();
}
}
Loading
Loading