@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lythos/agent-adapter",
3
- "version": "0.9.48",
3
+ "version": "0.9.49",
4
4
  "main": "./src/index.ts",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -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 shell command with prompt file', () => {
6
- const cmd = buildKimiCommand('/tmp/prompt.txt')
7
- expect(cmd[0]).toBe('sh')
8
- expect(cmd[1]).toBe('-c')
9
- expect(cmd[2]).toContain('kimi --print --afk --output-format stream-json')
10
- expect(cmd[2]).toContain('/tmp/prompt.txt')
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('includes stdin redirect from prompt file', () => {
14
- const cmd = buildKimiCommand('/tmp/my-prompt.txt')
15
- expect(cmd[2]).toContain('< /tmp/my-prompt.txt')
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
 
@@ -7,9 +7,9 @@ import { registerAgent } from '../registry'
7
7
 
8
8
  // ── Pure functions (testable without CLI) ────────────────────────────────────
9
9
 
10
- /** Build the kimi --print shell command. */
11
- export function buildKimiCommand(promptFile: string): string[] {
12
- return ['sh', '-c', `kimi --print --afk --output-format stream-json < ${promptFile}`]
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(promptFile), {
52
+ const proc = Bun.spawn(buildKimiCommand(), {
53
53
  cwd: opts.cwd,
54
- stdin: 'ignore',
54
+ stdin: Bun.file(promptFile),
55
55
  stdout: 'pipe',
56
56
  stderr: 'pipe',
57
57
  })