Skip to content

Commit 6529cc3

Browse files
committed
making more stable by fixing a few existing bypass on the tests
1 parent ab02bfe commit 6529cc3

4 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/import/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* interactive (TTY) and non-interactive (CI/pipe) modes.
88
*/
99
import chalk from 'chalk';
10-
import type { ImportOptions, ImportSource, ImportCategory, ImportResult } from './types.js';
11-
import { IMPORT_SOURCES, ALL_CATEGORIES } from './types.js';
10+
import type { ImportOptions, ImportCategory, ImportResult } from './types.js';
11+
import { IMPORT_SOURCES } from './types.js';
1212

1313
/**
1414
* Run the import command.

src/modes/acp/adapter.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ export class AutohandAcpAdapter implements Agent {
111111
}
112112

113113
private cloneConfigOptions(options: SessionConfigOption[]): SessionConfigOption[] {
114-
return options.map((opt) => ({
115-
...opt,
116-
options: opt.options.map((valueOption) => ({ ...valueOption })),
117-
}));
114+
return structuredClone(options);
118115
}
119116

120117
private getSessionConfigOptions(sessionId: string): SessionConfigOption[] {
@@ -141,13 +138,13 @@ export class AutohandAcpAdapter implements Agent {
141138
}
142139

143140
return mcpServers.map((server): McpServerConfig => {
144-
if (server.type === 'stdio') {
141+
if ('command' in server) {
145142
return {
146143
name: server.name,
147144
transport: 'stdio',
148145
command: server.command,
149146
args: [...server.args],
150-
env: Object.fromEntries(server.env.map((variable) => [variable.name, variable.value])),
147+
env: Object.fromEntries(server.env.map((variable: { name: string; value: string }) => [variable.name, variable.value])),
151148
autoConnect: true,
152149
};
153150
}
@@ -156,7 +153,7 @@ export class AutohandAcpAdapter implements Agent {
156153
name: server.name,
157154
transport: server.type,
158155
url: server.url,
159-
headers: Object.fromEntries(server.headers.map((header) => [header.name, header.value])),
156+
headers: Object.fromEntries(server.headers.map((header: { name: string; value: string }) => [header.name, header.value])),
160157
autoConnect: true,
161158
};
162159
});
@@ -646,7 +643,16 @@ export class AutohandAcpAdapter implements Agent {
646643
throw RequestError.invalidParams({ message: `Unknown config option: ${params.configId}` });
647644
}
648645

649-
const validValues = option.options.map((entry) => entry.value);
646+
const validValues: string[] = [];
647+
for (const entry of option.options) {
648+
if ('value' in entry) {
649+
validValues.push(entry.value);
650+
} else if ('options' in entry) {
651+
for (const subEntry of entry.options) {
652+
validValues.push(subEntry.value);
653+
}
654+
}
655+
}
650656
if (!validValues.includes(params.value)) {
651657
throw RequestError.invalidParams({
652658
message: `Invalid value "${params.value}" for config option "${params.configId}"`,

tests/import/BaseImporter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright 2025 Autohand AI LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
6+
import { describe, it, expect, vi, beforeEach } from 'vitest';
77
import os from 'node:os';
88
import path from 'node:path';
99
import type { ImportSource, ImportCategory, ImportScanResult, ImportResult, ProgressCallback } from '../../src/import/types.js';
@@ -367,7 +367,7 @@ describe('BaseImporter', () => {
367367
vi.mocked(fse.readJson).mockRejectedValue(new Error('not found') as never);
368368
vi.mocked(fse.pathExists).mockResolvedValue(false as never);
369369

370-
const { status, ...optsWithoutStatus } = baseOpts;
370+
const { status: _status, ...optsWithoutStatus } = baseOpts;
371371
await importer.testWriteAutohandSession(optsWithoutStatus);
372372

373373
const writeJsonCalls = vi.mocked(fse.writeJson).mock.calls;

tests/import/types.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ describe('Import types', () => {
325325
return { source: 'claude' as ImportSource, imported: new Map(), errors: [], duration: 0 };
326326
},
327327
};
328-
await importer.import(['sessions'], (p) => { progressCalled = true; });
328+
await importer.import(['sessions'], (_p) => { progressCalled = true; });
329329
expect(progressCalled).toBe(true);
330330
});
331331
});

0 commit comments

Comments
 (0)