File size: 1,632 Bytes
7a1ad33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import { describe, it, expect } from 'vitest';
import { Config } from './config.js';
import { TRACKER_CREATE_TASK_TOOL_NAME } from '../tools/tool-names.js';
import * as os from 'node:os';
import type { AgentLoopContext } from './agent-loop-context.js';

describe('Config Tracker Feature Flag', () => {
  const baseParams = {
    sessionId: 'test-session',
    targetDir: os.tmpdir(),
    cwd: os.tmpdir(),
    model: 'gemini-1.5-pro',
    debugMode: false,
  };

  it('should not register tracker tools by default', async () => {
    const config = new Config(baseParams);
    await config.initialize();
    const loopContext: AgentLoopContext = config;
    const registry = loopContext.toolRegistry;
    expect(registry.getTool(TRACKER_CREATE_TASK_TOOL_NAME)).toBeUndefined();
  });

  it('should register tracker tools when tracker is enabled', async () => {
    const config = new Config({
      ...baseParams,
      tracker: true,
    });
    await config.initialize();
    const loopContext: AgentLoopContext = config;
    const registry = loopContext.toolRegistry;
    expect(registry.getTool(TRACKER_CREATE_TASK_TOOL_NAME)).toBeDefined();
  });

  it('should not register tracker tools when tracker is explicitly disabled', async () => {
    const config = new Config({
      ...baseParams,
      tracker: false,
    });
    await config.initialize();
    const loopContext: AgentLoopContext = config;
    const registry = loopContext.toolRegistry;
    expect(registry.getTool(TRACKER_CREATE_TASK_TOOL_NAME)).toBeUndefined();
  });
});