Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/cli/src/acp-integration/active-work-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { createDebugLogger } from '@qwen-code/qwen-code-core';
import { createDebugLogger } from '@qwen-code/qwen-code-core/utils/debugLogger.js';
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
import {
ACTIVE_WORK_HEARTBEAT_VERSION,
ACTIVE_WORK_NOTIFICATION_METHOD,
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/acp-integration/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
* It deliberately bypasses LlmChat so neither history nor recording is
* read or mutated.
*/
import { getResponseText, type Config } from '@qwen-code/qwen-code-core';
import type { Config } from '@qwen-code/qwen-code-core/config/config.js';
import { getResponseText } from '@qwen-code/qwen-code-core/utils/partUtils.js';
import type { GenerateContentResponseUsageMetadata } from '@google/genai';

export const GENERATION_MAX_PROMPT_BYTES = 32 * 1024;
Expand Down
12 changes: 7 additions & 5 deletions packages/cli/src/acp-integration/live/capture-screen-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import { constants } from 'node:fs';
import { lstat, open, unlink } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { dirname, join, resolve } from 'node:path';
import type { PermissionDecision } from '@qwen-code/qwen-code-core/permissions/types.js';
import {
BaseDeclarativeTool,
BaseToolInvocation,
escapeJsonTagCharacters,
Kind,
type PermissionDecision,
type ToolInvocation,
type ToolResult,
} from '@qwen-code/qwen-code-core';
} from '@qwen-code/qwen-code-core/tools/tools.js';
import type {
ToolInvocation,
ToolResult,
} from '@qwen-code/qwen-code-core/tools/tools.js';
import { escapeJsonTagCharacters } from '@qwen-code/qwen-code-core/utils/formatters.js';

const MAX_SCREENSHOT_BYTES = 8 * 1024 * 1024;
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
Expand Down
10 changes: 6 additions & 4 deletions packages/cli/src/acp-integration/live/live-speak-to-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { PermissionDecision } from '@qwen-code/qwen-code-core/permissions/types.js';
import {
BaseDeclarativeTool,
BaseToolInvocation,
Kind,
type PermissionDecision,
type ToolInvocation,
type ToolResult,
} from '@qwen-code/qwen-code-core';
} from '@qwen-code/qwen-code-core/tools/tools.js';
import type {
ToolInvocation,
ToolResult,
} from '@qwen-code/qwen-code-core/tools/tools.js';

export const SPEAK_TO_USER_TOOL_NAME = 'speak_to_user' as const;
export const MAX_SPEAK_TO_USER_MESSAGE_CHARS = 32_000;
Expand Down
10 changes: 6 additions & 4 deletions packages/cli/src/acp-integration/live/live-task-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import {
LIVE_TASK_TOOL_NAMES,
type LiveTaskToolName,
} from '@qwen-code/acp-bridge/bridgeOptions';
import type { PermissionDecision } from '@qwen-code/qwen-code-core/permissions/types.js';
import {
BaseDeclarativeTool,
BaseToolInvocation,
Kind,
type PermissionDecision,
type ToolInvocation,
type ToolResult,
} from '@qwen-code/qwen-code-core';
} from '@qwen-code/qwen-code-core/tools/tools.js';
import type {
ToolInvocation,
ToolResult,
} from '@qwen-code/qwen-code-core/tools/tools.js';

export { LIVE_TASK_TOOL_NAMES, type LiveTaskToolName };
export type LiveTaskToolParams = Record<string, unknown>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Storage } from '@qwen-code/qwen-code-core';
import { Storage } from '@qwen-code/qwen-code-core/config/storage.js';
import type { LoadedSettings } from '../config/settings.js';

export function runWithAcpRuntimeOutputDir<T>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {
createTranscriptMessageUpdate,
createTranscriptUsageUpdate,
} from '@qwen-code/acp-bridge/transcriptReplay';
import {
apiActivityTracker,
getActiveGoal,
projectGoalStateToLegacy,
type GoalRecord,
type GoalSnapshotV2,
type GoalStateCause,
type VisionBridgeResult,
} from '@qwen-code/qwen-code-core';
import { getActiveGoal } from '@qwen-code/qwen-code-core/goals/activeGoalStore.js';
import { projectGoalStateToLegacy } from '@qwen-code/qwen-code-core/goals/goal-legacy-projection.js';
import type {
GoalRecord,
GoalSnapshotV2,
GoalStateCause,
} from '@qwen-code/qwen-code-core/goals/goal-protocol.js';
import type { VisionBridgeResult } from '@qwen-code/qwen-code-core/services/visionBridge/vision-bridge-service.js';
import { apiActivityTracker } from '@qwen-code/qwen-code-core/telemetry/api-activity-tracker.js';
import { BaseEmitter } from './base-emitter.js';
import type { SessionUpdate } from '@agentclientprotocol/sdk';
import type { HistoryItemGoalStatus } from '../../../ui/types.js';
Expand Down
26 changes: 16 additions & 10 deletions packages/cli/src/acp-integration/session/history-replay-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { Config } from '@qwen-code/qwen-code-core/config/config.js';
import {
parseGoalSnapshotV2,
parseGoalStateCause,
lastHistoryContentFromRecords,
restorableAskUserQuestionCallIds,
type ChatRecord,
type Config,
type GoalSnapshotV2,
type GoalStateCause,
type HistoryGap,
type SessionTranscriptCursorState,
type SessionTranscriptRecordPage,
} from '@qwen-code/qwen-code-core';
} from '@qwen-code/qwen-code-core/core/ask-user-question-restore.js';
import type {
GoalSnapshotV2,
GoalStateCause,
} from '@qwen-code/qwen-code-core/goals/goal-protocol.js';
import {
parseGoalSnapshotV2,
parseGoalStateCause,
} from '@qwen-code/qwen-code-core/goals/goal-reducer.js';
import type { ChatRecord } from '@qwen-code/qwen-code-core/services/chatRecordingService.js';
import type {
SessionTranscriptCursorState,
SessionTranscriptRecordPage,
} from '@qwen-code/qwen-code-core/services/session-transcript-reader.js';
import type { HistoryGap } from '@qwen-code/qwen-code-core/utils/conversation-chain.js';
import type { SessionUpdate } from '@agentclientprotocol/sdk';
import type { TranscriptReplayStateV1 } from '@qwen-code/acp-bridge/transcriptReplay';
import { Buffer } from 'node:buffer';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/acp-integration/session/permissionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { ToolCallConfirmationDetails } from '@qwen-code/qwen-code-core';
import { ToolConfirmationOutcome } from '@qwen-code/qwen-code-core';
import type { ToolCallConfirmationDetails } from '@qwen-code/qwen-code-core/tools/tools.js';
import { ToolConfirmationOutcome } from '@qwen-code/qwen-code-core/tools/tools.js';
import type {
AgentSideConnection,
PermissionOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/

import type { SessionUpdate } from '@agentclientprotocol/sdk';
import {
GoalPersistenceUnavailableError,
type ChatRecord,
type GoalRecord,
type GoalRuntime,
type GoalSnapshotV2,
type GoalStateCause,
} from '@qwen-code/qwen-code-core';
import type {
GoalRecord,
GoalSnapshotV2,
GoalStateCause,
} from '@qwen-code/qwen-code-core/goals/goal-protocol.js';
import { GoalPersistenceUnavailableError } from '@qwen-code/qwen-code-core/goals/goal-runtime.js';
import type { GoalRuntime } from '@qwen-code/qwen-code-core/goals/goal-runtime.js';
import type { ChatRecord } from '@qwen-code/qwen-code-core/services/chatRecordingService.js';
import type { HistoryItemGoalStatus } from '../../ui/types.js';
import {
collectGoalStatusItemsFromRecords,
Expand Down
16 changes: 7 additions & 9 deletions packages/cli/src/acp-integration/session/tasksSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {
buildBackgroundEntryLabel,
type AgentTask,
type Config,
type MonitorTask,
type ShellTask,
type WorkflowSnapshot,
type WorkflowTask,
} from '@qwen-code/qwen-code-core';
import { buildBackgroundEntryLabel } from '@qwen-code/qwen-code-core/agents/background-tasks.js';
import type { AgentTask } from '@qwen-code/qwen-code-core/agents/background-tasks.js';
import type { WorkflowTask } from '@qwen-code/qwen-code-core/agents/workflow-run-registry.js';
import type { WorkflowSnapshot } from '@qwen-code/qwen-code-core/agents/workflow-snapshot.js';
import type { Config } from '@qwen-code/qwen-code-core/config/config.js';
import type { ShellTask } from '@qwen-code/qwen-code-core/services/backgroundShellRegistry.js';
import type { MonitorTask } from '@qwen-code/qwen-code-core/services/monitorRegistry.js';
import {
STATUS_SCHEMA_VERSION,
type ServeSessionAgentTaskStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import type { FunctionCall, GenerateContentResponse } from '@google/genai';
import { getToolCallPreparations } from '@qwen-code/qwen-code-core';
import { getToolCallPreparations } from '@qwen-code/qwen-code-core/core/tool-call-preparation.js';
import type { ToolCallEmitter } from './emitters/tool-call-emitter.js';

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/acp-integration/skill-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { Storage, type Config } from '@qwen-code/qwen-code-core';
import type { Config } from '@qwen-code/qwen-code-core/config/config.js';
import { Storage } from '@qwen-code/qwen-code-core/config/storage.js';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verified real at head 2e7b7eb: ran the seven suites together (acpAgent, curator-command, workspace-git-diff, workspace-git-log, workspace-github-prs, local-control/service, McpPromptLoader) — 7 files failed, 70 tests failed, matching the reported signatures (spies record 0 calls, real implementations reach fs/git, 200 vs expected 502). This PR changes no test files, so the source import rewrites are the cause.

Not auto-fixing because both remedies exceed three files: (a) revert these seven source files to barrel imports and let the mock-migration change convert them (the series' own selection rule), or (b) move vi.mock in all seven test files to the exact subpath modules, reusing the same Storage fake in acpAgent.test.ts. @yiliang114 which direction? Leaving open until decided.

import { RequestError } from '@agentclientprotocol/sdk';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/acp-integration/skill-source-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { createDebugLogger } from '@qwen-code/qwen-code-core';
import { createDebugLogger } from '@qwen-code/qwen-code-core/utils/debugLogger.js';
import { RequestError } from '@agentclientprotocol/sdk';
import { Readable, Writable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/channel/status.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync, readFileSync } from 'node:fs';
import * as path from 'node:path';
import { Storage } from '@qwen-code/qwen-code-core';
import { Storage } from '@qwen-code/qwen-code-core/config/storage.js';
import type { CommandModule } from 'yargs';
import { writeStderrLine, writeStdoutLine } from '../../utils/stdioHelpers.js';
import { readServiceInfo } from './pidfile.js';
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/commands/extensions/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
*/

import type { CommandModule } from 'yargs';
import {
isExtensionCommittedWithWarningsError,
type ExtensionInstallMetadata,
} from '@qwen-code/qwen-code-core';
import type { ExtensionInstallMetadata } from '@qwen-code/qwen-code-core/config/config.js';
import { isExtensionCommittedWithWarningsError } from '@qwen-code/qwen-code-core/extension/extensionManager.js';
import { getErrorMessage } from '../../utils/errors.js';
import { writeStdoutLine, writeStderrLine } from '../../utils/stdioHelpers.js';
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/extensions/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import { access, cp, mkdir, readdir, writeFile } from 'node:fs/promises';
import { join, basename } from 'node:path';
import type { CommandModule } from 'yargs';
import { isNodeError, resolveBundleDir } from '@qwen-code/qwen-code-core';
import { resolveBundleDir } from '@qwen-code/qwen-code-core/utils/bundlePaths.js';
import { isNodeError } from '@qwen-code/qwen-code-core/utils/errors.js';
import { getErrorMessage } from '../../utils/errors.js';
import { writeStdoutLine, writeStderrLine } from '../../utils/stdioHelpers.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/extensions/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import type { CommandModule } from 'yargs';
import { redactUrlCredentials } from '@qwen-code/qwen-code-core';
import { redactUrlCredentials } from '@qwen-code/qwen-code-core/extension/redaction.js';
import { getErrorMessage } from '../../utils/errors.js';
import { writeStdoutLine, writeStderrLine } from '../../utils/stdioHelpers.js';
import { getExtensionManager } from './utils.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/mcp/approve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// Files for 'qwen mcp approve' / 'qwen mcp reject' commands (issue #4615).
import type { CommandModule } from 'yargs';
import type { MCPServerConfig } from '@qwen-code/qwen-code-core';
import { isGatedMcpScope } from '@qwen-code/qwen-code-core';
import type { MCPServerConfig } from '@qwen-code/qwen-code-core/config/mcp-server-config.js';
import { isGatedMcpScope } from '@qwen-code/qwen-code-core/config/mcp-server-config.js';
import { writeStdoutLine } from '../../utils/stdioHelpers.js';
import { loadSettings } from '../../config/settings.js';
import { assembleMcpServers } from '../../config/mcpServers.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/agent-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import type { CommandModule } from 'yargs';
import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { REVIEW_BUILTIN_SUBAGENT_TYPE } from '@qwen-code/qwen-code-core';
import { REVIEW_BUILTIN_SUBAGENT_TYPE } from '@qwen-code/qwen-code-core/subagents/builtin-agents.js';
import {
writeStdoutLine,
writeStderrLine,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/comment-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import type { CommandModule } from 'yargs';
import { mkdirSync, writeFileSync } from 'node:fs';
import { dirname } from 'node:path';
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD } from '@qwen-code/qwen-code-core';
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD } from '@qwen-code/qwen-code-core/config/config.js';
import { writeStdoutLine } from '../../utils/stdioHelpers.js';
import {
currentUser,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/cost-ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import type { CommandModule } from 'yargs';
import { mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { parseLineTolerant } from '@qwen-code/qwen-code-core';
import { parseLineTolerant } from '@qwen-code/qwen-code-core/utils/jsonl-utils.js';
import {
writeStdoutLineSafe,
writeStderrLineSafe,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/findings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
FINDING_DIRECTIONS,
FINDING_BASELINES,
compressFindingSummary,
} from '@qwen-code/qwen-code-core';
} from '@qwen-code/qwen-code-core/tools/report-findings.js';
import { writeStdoutLine, writeStderrLine } from '../../utils/stdioHelpers.js';
import type { AnchorRequest } from './lib/anchors.js';
import { isSameFile } from './lib/same-file.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/lib/deadline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
writeFileSync,
} from 'node:fs';
import { join } from 'node:path';
import { parsePositiveIntegerEnv } from '@qwen-code/qwen-code-core';
import { parsePositiveIntegerEnv } from '@qwen-code/qwen-code-core/utils/env.js';
import { promptRecordDir, runEpochMs } from './prompt-record.js';

/** Unix seconds at which the review process will be killed. Set by CI. */
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/lib/diff-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// for it. The chunks tile the diff exactly, so the orchestrator can assert
// that every line was assigned to some agent.

import { unquoteCStylePath } from '@qwen-code/qwen-code-core';
import { unquoteCStylePath } from '@qwen-code/qwen-code-core/utils/gitDiff.js';

/** A single `@@` hunk. All line numbers are 1-based and inclusive. */
export interface DiffHunk {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/lib/inline-counts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import {
FINDING_BASELINES,
FINDING_DIRECTIONS,
} from '@qwen-code/qwen-code-core';
} from '@qwen-code/qwen-code-core/tools/report-findings.js';
import { LEDGER_ID_READBACK } from './ledger.js';

/** The severity prefixes the skill mandates on every posted inline comment. */
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/review/lib/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
statSync,
} from 'node:fs';
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
import { sanitizeFilenameComponent, Storage } from '@qwen-code/qwen-code-core';
import { sanitizeFilenameComponent } from '@qwen-code/qwen-code-core/agents/agent-transcript.js';
import { Storage } from '@qwen-code/qwen-code-core/config/storage.js';
import { safeTarget } from '../../../utils/paths.js';

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/commands/review/lib/transcripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
// come from the environment the CLI itself exported.

import { lstatSync, readFileSync, readdirSync, statSync } from 'node:fs';
import {
ToolNames,
sanitizeFilenameComponent,
} from '@qwen-code/qwen-code-core';
import { sanitizeFilenameComponent } from '@qwen-code/qwen-code-core/agents/agent-transcript.js';
import { ToolNames } from '@qwen-code/qwen-code-core/tools/tool-names.js';
import { join } from 'node:path';
import { priorSessionEntries } from './run-ledger.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/review/pr-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
writeFileSync,
} from 'node:fs';
import { dirname, join } from 'node:path';
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD } from '@qwen-code/qwen-code-core';
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD } from '@qwen-code/qwen-code-core/config/config.js';
import { writeStdoutLine } from '../../utils/stdioHelpers.js';
import { HOSTNAME_RE, resolveGhHost, setGhHost } from './lib/gh.js';
import { getPlatformReader } from './lib/platform/registry.js';
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/commands/review/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
// reached a verdict" from "blocking verdict" (opt-in via --fail-on).

import type { CommandModule } from 'yargs';
import {
APPROVAL_MODES,
isUnusableScriptEntry,
} from '@qwen-code/qwen-code-core';
import { APPROVAL_MODES } from '@qwen-code/qwen-code-core/config/approval-mode.js';
import { isUnusableScriptEntry } from '@qwen-code/qwen-code-core/services/shellContextEnv.js';
import { spawn, execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
Expand Down
Loading
Loading