Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
Merge remote-tracking branch 'origin/main' into exec-approvals
Naiyuan Qing9bcb0993b193
diff --cc src/agent/runner.tsindex 310dabfb7d,9f5ae76fc4..65fd528b9b--- a/src/agent/runner.ts+++ b/src/agent/runner.ts@@@ -323,8 -331,56 +331,29 @@@ export class Agentreturn this.agent.subscribe(fn);}+ /** Subscribe to both AgentEvent and MulticaEvent streams */+ subscribeAll(fn: (event: AgentEvent | MulticaEvent) => void): () => void {+ const unsubCore = this.agent.subscribe(fn);+ this.multicaListeners.push(fn);+ return () => {+ unsubCore();+ const idx = this.multicaListeners.indexOf(fn);+ if (idx >= 0) this.multicaListeners.splice(idx, 1);+ };+ }++ private emitMulticaEvent(event: MulticaEvent): void {+ for (const fn of this.multicaListeners) {+ try {+ fn(event);+ } catch {+ // Don't let listener errors break the agent loop+ }+ }+ }+async run(prompt: string): Promise<AgentRunResult> {- if (!this.initialized) {- await this.session.repairIfNeeded((msg) => console.error(msg));- const restoredMessages = this.session.loadMessages();- if (restoredMessages.length > 0) {- if (this.debug) {- console.error(`[debug] Restoring ${restoredMessages.length} messages from session`);- for (const msg of restoredMessages) {- const msgAny = msg as any;- const content = Array.isArray(msgAny.content)- ? msgAny.content.map((c: any) => c.type || "text").join(", ")- : typeof msgAny.content;- console.error(`[debug] ${msg.role}: ${content}`);- if (Array.isArray(msgAny.content)) {- for (const block of msgAny.content) {- if (block.type === "tool_use") {- console.error(`[debug] tool_use id: ${block.id}, name: ${block.name}`);- }- if (block.type === "tool_result") {- console.error(`[debug] tool_result tool_use_id: ${block.tool_use_id}`);- }- }- }- }- }- this.agent.replaceMessages(restoredMessages);- }- this.initialized = true;- }+ await this.ensureInitialized();this.output.state.lastAssistantText = "";const canRotate = !this.pinnedProfile && this.profileCandidates.length > 1;diff --cc src/agent/tools.tsindex 4019a34d4f,f542e65fd5..0a33e03936--- a/src/agent/tools.ts+++ b/src/agent/tools.ts@@@ -6,11 -6,10 +6,11 @@@ import { createExecTool } from "./toolsimport { createProcessTool } from "./tools/process.js";import { createGlobTool } from "./tools/glob.js";import { createWebFetchTool, createWebSearchTool } from "./tools/web/index.js";- import { createMemoryTools } from "./tools/memory/index.js";import { createSessionsSpawnTool } from "./tools/sessions-spawn.js";+ import { createMemorySearchTool } from "./tools/memory-search.js";import { filterTools } from "./tools/policy.js";import { isMulticaError, isRetryableError } from "../shared/errors.js";+import type { ExecApprovalCallback } from "./tools/exec-approval-types.js";// Re-export resolveModel from providers for backwards compatibilityexport { resolveModel } from "./providers/index.js";@@@ -146,17 -144,15 +147,16 @@@ export interface ResolveToolsOptions ex* 3. Provider-specific rules* 4. Subagent restrictions*/- export function resolveTools(options: AgentOptions): AgentTool<any>[] {+ export function resolveTools(options: ResolveToolsOptions): AgentTool<any>[] {const cwd = options.cwd ?? process.cwd();- // Create all tools (including memory tools if profileId is provided)+ // Create all toolsconst allTools = createAllTools({cwd,- profileId: options.profileId,- profileBaseDir: options.profileBaseDir,+ profileDir: options.profileDir,isSubagent: options.isSubagent,sessionId: options.sessionId,+ onExecApprovalNeeded: options.onExecApprovalNeeded,});// Apply policy filtering