@lythos/agent-adapter 0.9.48 → 0.9.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/adapters/kimi.test.ts +11 -9
- package/src/adapters/kimi.ts +5 -5
package/package.json
CHANGED
|
@@ -2,17 +2,19 @@ import { describe, expect, it } from 'bun:test'
|
|
|
2
2
|
import { buildKimiCommand, parseKimiStreamJson } from './kimi'
|
|
3
3
|
|
|
4
4
|
describe('buildKimiCommand', () => {
|
|
5
|
-
it('builds
|
|
6
|
-
const cmd = buildKimiCommand(
|
|
7
|
-
expect(cmd[0]).toBe('
|
|
8
|
-
expect(cmd
|
|
9
|
-
expect(cmd
|
|
10
|
-
expect(cmd
|
|
5
|
+
it('builds kimi CLI args without shell wrapper', () => {
|
|
6
|
+
const cmd = buildKimiCommand()
|
|
7
|
+
expect(cmd[0]).toBe('kimi')
|
|
8
|
+
expect(cmd).toContain('--print')
|
|
9
|
+
expect(cmd).toContain('--afk')
|
|
10
|
+
expect(cmd).toContain('--output-format')
|
|
11
|
+
expect(cmd).toContain('stream-json')
|
|
11
12
|
})
|
|
12
13
|
|
|
13
|
-
it('
|
|
14
|
-
const cmd = buildKimiCommand(
|
|
15
|
-
expect(cmd
|
|
14
|
+
it('does not use shell or redirect (injection-safe)', () => {
|
|
15
|
+
const cmd = buildKimiCommand()
|
|
16
|
+
expect(cmd).not.toContain('sh')
|
|
17
|
+
expect(cmd).not.toContain('-c')
|
|
16
18
|
})
|
|
17
19
|
})
|
|
18
20
|
|
package/src/adapters/kimi.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { registerAgent } from '../registry'
|
|
|
7
7
|
|
|
8
8
|
// ── Pure functions (testable without CLI) ────────────────────────────────────
|
|
9
9
|
|
|
10
|
-
/** Build
|
|
11
|
-
export function buildKimiCommand(
|
|
12
|
-
return ['
|
|
10
|
+
/** Build kimi --print command args (no shell wrapper — safe from injection). */
|
|
11
|
+
export function buildKimiCommand(): string[] {
|
|
12
|
+
return ['kimi', '--print', '--afk', '--output-format', 'stream-json']
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -49,9 +49,9 @@ async function spawnKimi(opts: {
|
|
|
49
49
|
|
|
50
50
|
const start = Date.now()
|
|
51
51
|
|
|
52
|
-
const proc = Bun.spawn(buildKimiCommand(
|
|
52
|
+
const proc = Bun.spawn(buildKimiCommand(), {
|
|
53
53
|
cwd: opts.cwd,
|
|
54
|
-
stdin:
|
|
54
|
+
stdin: Bun.file(promptFile),
|
|
55
55
|
stdout: 'pipe',
|
|
56
56
|
stderr: 'pipe',
|
|
57
57
|
})
|