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
7 changes: 4 additions & 3 deletions apps/ade-cli/src/adeRpcServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1906,13 +1906,14 @@ describe("adeRpcServer", () => {
// it ends with the user prompt and carries the inline guidance preamble.
const createCall = (fixture.runtime.ptyService.create as ReturnType<typeof vi.fn>).mock.calls[0]?.[0] as { args: string[] };
const finalArg = createCall.args[createCall.args.length - 1];
expect(finalArg).toContain("Before reporting an ADE lane");
expect(finalArg).toContain("only normal reason to skip ADE CLI");
expect(finalArg).toContain("ADE proof drawer");
expect(finalArg).toContain("clean up old, stale, or finished processes");
expect(finalArg.endsWith("Implement API wiring")).toBe(true);
expect(response.structuredContent.startupCommand).toContain("claude");
expect(response.structuredContent.startupCommand).toContain("--model");
expect(response.structuredContent.startupCommand).toContain("--permission-mode");
expect(response.structuredContent.startupCommand).toContain("Before reporting an ADE lane");
expect(response.structuredContent.startupCommand).toContain("only normal reason to skip ADE CLI");
expect(response.structuredContent.permissionMode).toBe("default");
expect(response.structuredContent.contextRef?.path).toBeNull();
});
Expand Down Expand Up @@ -2874,7 +2875,7 @@ describe("adeRpcServer", () => {
expect(response.structuredContent.permissionMode).toBe("plan");
expect(response.structuredContent.startupCommand).toContain("--sandbox");
expect(response.structuredContent.startupCommand).toContain("read-only");
expect(response.structuredContent.startupCommand).toContain("Before reporting an ADE lane");
expect(response.structuredContent.startupCommand).toContain("only normal reason to skip ADE CLI");
const contextPath = response.structuredContent.contextRef?.path as string | null;
expect(contextPath).toBeTruthy();
expect(contextPath?.includes("/.ade/cache/orchestrator/agent-context/run-123/")).toBe(true);
Expand Down
2 changes: 0 additions & 2 deletions apps/ade-cli/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import { createMissionBudgetService } from "../../desktop/src/main/services/orch
import type { createSyncService } from "../../desktop/src/main/services/sync/syncService";
import type { createSyncHostService } from "../../desktop/src/main/services/sync/syncHostService";
import type { createAutomationIngressService } from "../../desktop/src/main/services/automations/automationIngressService";
import type { createContextDocService } from "../../desktop/src/main/services/context/contextDocService";
import type { createGithubService } from "../../desktop/src/main/services/github/githubService";
import type { createFeedbackReporterService } from "../../desktop/src/main/services/feedback/feedbackReporterService";
import type { createUsageTrackingService } from "../../desktop/src/main/services/usage/usageTrackingService";
Expand Down Expand Up @@ -170,7 +169,6 @@ export type AdeRuntime = {
syncHostService?: ReturnType<typeof createSyncHostService> | null;
syncService?: ReturnType<typeof createSyncService> | null;
automationIngressService?: ReturnType<typeof createAutomationIngressService> | null;
contextDocService?: ReturnType<typeof createContextDocService> | null;
feedbackReporterService?: ReturnType<typeof createFeedbackReporterService> | null;
usageTrackingService?: ReturnType<typeof createUsageTrackingService> | null;
budgetCapService?: ReturnType<typeof createBudgetCapService> | null;
Expand Down
18 changes: 0 additions & 18 deletions apps/desktop/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { createPortAllocationService } from "./services/lanes/portAllocationServ
import { createLaneProxyService } from "./services/lanes/laneProxyService";
import { createOAuthRedirectService } from "./services/lanes/oauthRedirectService";
import { createRuntimeDiagnosticsService } from "./services/lanes/runtimeDiagnosticsService";
import { createContextDocService } from "./services/context/contextDocService";
import { createSessionService } from "./services/sessions/sessionService";
import { createSessionDeltaService } from "./services/sessions/sessionDeltaService";
import { createPtyService } from "./services/pty/ptyService";
Expand Down Expand Up @@ -2115,19 +2114,6 @@ app.whenReady().then(async () => {
proceduralLearningService,
});
skillRegistryServiceRef = skillRegistryService;
const contextDocService = createContextDocService({
db,
logger,
projectRoot,
projectId,
packsDir: adePaths.packsDir,
laneService,
projectConfigService,
aiIntegrationService,
onStatusChanged: (status) =>
emitProjectEvent(projectRoot, IPC.contextStatusChanged, status),
});

const ctoStateService = createCtoStateService({
db,
projectId,
Expand Down Expand Up @@ -2279,7 +2265,6 @@ app.whenReady().then(async () => {
getAutomationService: () => automationService,
getGitService: () => gitServiceRef,
conflictService,
contextDocService,
getWorkerBudgetService: () => workerBudgetService,
getMissionBudgetService: () => missionBudgetServiceRef,
episodicSummaryService,
Expand Down Expand Up @@ -3346,7 +3331,6 @@ app.whenReady().then(async () => {
syncHostService: syncService.getHostService(),
syncService,
automationIngressService,
contextDocService,
feedbackReporterService,
usageTrackingService,
budgetCapService,
Expand Down Expand Up @@ -3574,7 +3558,6 @@ app.whenReady().then(async () => {
missionBudgetService,
aiOrchestratorService,
agentChatService,
contextDocService,
projectConfigService,
processService,
sessionDeltaService,
Expand Down Expand Up @@ -3682,7 +3665,6 @@ app.whenReady().then(async () => {
orchestratorService: null,
missionBudgetService: null,
aiOrchestratorService: null,
contextDocService: null,
projectConfigService: null,
processService: null,
sessionDeltaService: null,
Expand Down
39 changes: 1 addition & 38 deletions apps/desktop/src/main/services/ai/tools/ctoOperatorTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import type { createIssueInventoryService } from "../../prs/issueInventoryServic
import { computeConvergenceStatus, detectSource, extractSeverity } from "../../prs/issueInventoryService";
import { launchPrIssueResolutionChat } from "../../prs/prIssueResolver";
import type { createPrService } from "../../prs/prService";
import { isNoisyIssueComment, mapPermissionMode } from "../../prs/resolverUtils";
import { isNoisyIssueComment } from "../../prs/resolverUtils";
import type { createProcessService } from "../../processes/processService";
import type { createSessionService } from "../../sessions/sessionService";
import type { createCtoStateService } from "../../cto/ctoStateService";
Expand Down Expand Up @@ -115,10 +115,6 @@ export interface CtoOperatorToolDeps {
applyProposal: (args: any) => Promise<any>;
undoProposal: (args: any) => Promise<any>;
} | null;
contextDocService?: {
getStatus: () => any;
generateDocs: (args: any) => Promise<any>;
} | null;
steerChat?: (args: { sessionId: string; instruction: string }) => Promise<{ steerId: string; queued: boolean }>;
cancelSteer?: (args: { sessionId: string }) => Promise<void>;
handoffChat?: (args: { sessionId: string; targetIdentityKey?: string; reason?: string }) => Promise<any>;
Expand Down Expand Up @@ -2779,39 +2775,6 @@ export function createCtoOperatorTools(deps: CtoOperatorToolDeps): Record<string
execute: ({ laneId, proposalId }) => conflictGuard(() => deps.conflictService!.undoProposal({ laneId, proposalId })),
});

// ---------------------------------------------------------------------------
// Context Pack Export
// ---------------------------------------------------------------------------

tools.getContextStatus = tool({
description: "Check what ADE context docs exist and whether they are stale.",
inputSchema: z.object({}),
execute: async () => {
if (!deps.contextDocService) return { success: false, error: "Context doc service is not available." };
try {
return { success: true, ...deps.contextDocService.getStatus() };
} catch (error) {
return { success: false, error: getErrorMessage(error) };
}
},
});

tools.generateContextDocs = tool({
description: "Generate bounded context packs for bootstrapping workers or exporting project state.",
inputSchema: z.object({
scope: z.string().optional(),
categories: z.array(z.string()).optional(),
}),
execute: async ({ scope, categories }) => {
if (!deps.contextDocService) return { success: false, error: "Context doc service is not available." };
try {
return { success: true, ...(await deps.contextDocService.generateDocs({ scope, categories })) };
} catch (error) {
return { success: false, error: getErrorMessage(error) };
}
},
});

// ---------------------------------------------------------------------------
// Agent Chat Steering
// ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe("buildCodingAgentSystemPrompt", () => {
const result = buildCodingAgentSystemPrompt({ cwd: "/x" });
expect(result).toContain("## Operating Loop");
expect(result).toContain("## ADE CLI");
expect(result).toContain("Before saying an ADE task is blocked");
expect(result).toContain("only normal reason to skip ADE CLI");
expect(result).toContain("## Editing Rules");
expect(result).toContain("## Verification Rules");
expect(result).toContain("## User-Facing Progress");
Expand Down
12 changes: 7 additions & 5 deletions apps/desktop/src/main/services/chat/agentChatService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ describe("buildComputerUseDirective", () => {
const status = makeBackendStatus({ ghostOs: true });
const result = buildComputerUseDirective(status);
expect(result).toContain("Proof Capture");
expect(result).toContain("ade proof");
expect(result).toContain("ingest_computer_use_artifacts");
expect(result).toContain("capture visual proof first");
expect(result).toContain("Console logs and text files are supporting diagnostics only");
Expand Down Expand Up @@ -1052,9 +1053,10 @@ describe("createAgentChatService", () => {
});

const opts = vi.mocked(unstable_v2_createSession).mock.calls[0]?.[0] as { systemPrompt?: { append?: string } } | undefined;
expect(opts?.systemPrompt?.append).toContain("internal ADE work");
expect(opts?.systemPrompt?.append).toContain("Before saying an ADE task is blocked");
expect(opts?.systemPrompt?.append).toContain("default control plane");
expect(opts?.systemPrompt?.append).toContain("only normal reason to skip ADE CLI");
expect(opts?.systemPrompt?.append).toContain("ade lanes list");
expect(opts?.systemPrompt?.append).toContain("ADE proof drawer");
expect(opts?.systemPrompt?.append).toContain("clean up old, stale, or finished processes");
});

Expand Down Expand Up @@ -1665,10 +1667,10 @@ describe("createAgentChatService", () => {
expect(firstUserContent).toContain("[ADE launch directive]");
expect(firstUserContent).toContain(tmpRoot);
expect(firstUserContent).toContain("only inside that worktree");
expect(firstUserContent).toContain("Before saying an ADE task is blocked");
expect(firstUserContent).toContain("only normal reason to skip ADE CLI");
expect(firstUserContent).toContain("ade actions list --text");
expect(secondUserContent).not.toContain("[ADE launch directive]");
expect(secondUserContent).toContain("Before saying an ADE task is blocked");
expect(secondUserContent).toContain("only normal reason to skip ADE CLI");
});

it("starts Codex sessions without ADE-owned tool server injection", async () => {
Expand Down Expand Up @@ -1697,7 +1699,7 @@ describe("createAgentChatService", () => {
const turnStartRequest = mockState.codexRequestPayloads.find((payload) => payload.method === "turn/start");
const turnParams = turnStartRequest?.params as { input?: Array<{ text?: unknown }> } | undefined;
const textInput = turnParams?.input?.map((entry) => String(entry.text ?? "")).join("\n") ?? "";
expect(textInput).toContain("Before saying an ADE task is blocked");
expect(textInput).toContain("only normal reason to skip ADE CLI");
expect(textInput).toContain("ade actions list --text");
});

Expand Down
4 changes: 1 addition & 3 deletions apps/desktop/src/main/services/chat/agentChatService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,7 @@ export function buildComputerUseDirective(
"ADE will automatically capture screenshots and other visual artifacts from your computer-use tool calls into the proof drawer — you do not need to manually call ingest_computer_use_artifacts for normal captures.",
"",
"Call `get_computer_use_backend_status` to check available backends before attempting computer use.",
"When the user asks you to send proof, register the resulting artifact with ADE via `ade proof ...` or `ingest_computer_use_artifacts` so it appears in the active proof drawer.",
].join("\n"),
);

Expand Down Expand Up @@ -2679,7 +2680,6 @@ export function createAgentChatService(args: {
getAutomationService?: () => { list: () => any[]; triggerManually: (args: any) => Promise<any>; listRuns: (args?: any) => any[] } | null;
getGitService?: () => CtoOperatorToolDeps["gitService"];
conflictService?: CtoOperatorToolDeps["conflictService"];
contextDocService?: CtoOperatorToolDeps["contextDocService"];
getWorkerBudgetService?: () => CtoOperatorToolDeps["workerBudgetService"];
getMissionBudgetService?: () => CtoOperatorToolDeps["missionBudgetService"];
computerUseArtifactBrokerService?: ComputerUseArtifactBrokerService | null;
Expand Down Expand Up @@ -2719,7 +2719,6 @@ export function createAgentChatService(args: {
getAutomationService,
getGitService,
conflictService,
contextDocService,
getWorkerBudgetService,
getMissionBudgetService,
computerUseArtifactBrokerService,
Expand Down Expand Up @@ -3691,7 +3690,6 @@ export function createAgentChatService(args: {
automationService: getAutomationService?.() ?? null,
gitService: getGitService?.() ?? null,
conflictService: conflictService ?? null,
contextDocService: contextDocService ?? null,
computerUseArtifactBrokerService: computerUseArtifactBrokerRef ?? null,
workerBudgetService: getWorkerBudgetService?.() ?? null,
missionBudgetService: getMissionBudgetService?.() ?? null,
Expand Down
Loading
Loading