vv-agent 0.6.2

VectorVein agent runtime, SDK, CLI, tools, and workspace backends
Documentation
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
use std::path::Path;

use super::helpers::collect_rust_files;
use super::MAX_REASONABLE_SOURCE_LINES;

#[test]
fn tools_module_is_split_into_handler_files() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
    assert!(root.join("tools").join("mod.rs").is_file());
    for relative in [
        "tools/base/mod.rs",
        "tools/base/context.rs",
        "tools/base/paths.rs",
        "tools/base/spec.rs",
        "tools/common.rs",
        "tools/common/args.rs",
        "tools/common/edit.rs",
        "tools/common/file_types.rs",
        "tools/common/grep.rs",
        "tools/common/paths.rs",
        "tools/common/process.rs",
        "tools/common/result.rs",
        "tools/dispatcher.rs",
        "tools/registry/mod.rs",
        "tools/registry/defaults.rs",
        "tools/schemas/mod.rs",
        "tools/schemas/command.rs",
        "tools/schemas/control.rs",
        "tools/schemas/media.rs",
        "tools/schemas/memory.rs",
        "tools/schemas/sub_agents/mod.rs",
        "tools/schemas/sub_agents/create.rs",
        "tools/schemas/sub_agents/status.rs",
        "tools/schemas/todo.rs",
        "tools/schemas/workspace/mod.rs",
        "tools/schemas/workspace/edit.rs",
        "tools/schemas/workspace/file_io.rs",
        "tools/schemas/workspace/listing.rs",
        "tools/schemas/workspace/search.rs",
        "tools/handlers/control/mod.rs",
        "tools/handlers/control/ask_user.rs",
        "tools/handlers/control/task_finish.rs",
        "tools/handlers/todo.rs",
        "tools/handlers/workspace/mod.rs",
        "tools/handlers/workspace/edit.rs",
        "tools/handlers/workspace/file_io.rs",
        "tools/handlers/workspace/file_io/info.rs",
        "tools/handlers/workspace/file_io/read.rs",
        "tools/handlers/workspace/file_io/write.rs",
        "tools/handlers/workspace/listing.rs",
        "tools/handlers/workspace/listing/fallback.rs",
        "tools/handlers/workspace/listing/local_rg.rs",
        "tools/handlers/workspace/listing/local_rg/command.rs",
        "tools/handlers/workspace/listing/local_rg/paths.rs",
        "tools/handlers/workspace/listing/local_rg/scan.rs",
        "tools/handlers/workspace/listing/local_rg/tests.rs",
        "tools/handlers/workspace/listing/local_rg/types.rs",
        "tools/handlers/workspace/listing/request.rs",
        "tools/handlers/workspace/listing/response.rs",
        "tools/handlers/workspace/listing/types.rs",
        "tools/handlers/search/mod.rs",
        "tools/handlers/search/error.rs",
        "tools/handlers/search/execution.rs",
        "tools/handlers/search/fallback.rs",
        "tools/handlers/search/format.rs",
        "tools/handlers/search/local_rg.rs",
        "tools/handlers/search/local_rg/command.rs",
        "tools/handlers/search/local_rg/parse.rs",
        "tools/handlers/search/local_rg/parse/decode.rs",
        "tools/handlers/search/local_rg/parse/events.rs",
        "tools/handlers/search/local_rg/parse/paths.rs",
        "tools/handlers/search/local_rg/parse/state.rs",
        "tools/handlers/search/local_rg/paths.rs",
        "tools/handlers/search/response.rs",
        "tools/handlers/search/request.rs",
        "tools/handlers/search/local_rg/tests.rs",
        "tools/handlers/search/local_rg/types.rs",
        "tools/handlers/bash.rs",
        "tools/handlers/bash/env.rs",
        "tools/handlers/bash/execution.rs",
        "tools/handlers/bash/shell_defaults.rs",
        "tools/handlers/image.rs",
        "tools/handlers/memory.rs",
        "tools/handlers/skills/mod.rs",
        "tools/handlers/skills/state.rs",
        "tools/handlers/sub_agents.rs",
        "tools/handlers/sub_agents/async_mode.rs",
        "tools/handlers/sub_agents/batch.rs",
        "tools/handlers/sub_agents/request.rs",
        "tools/handlers/sub_agents/response.rs",
        "tools/handlers/sub_task_status.rs",
        "tools/handlers/background.rs",
        "runtime/mod.rs",
        "runtime/backends/mod.rs",
        "runtime/backends/inline.rs",
        "runtime/backends/recipe.rs",
        "runtime/backends/results.rs",
        "runtime/backends/thread.rs",
        "runtime/backends/distributed.rs",
        "runtime/backends/distributed/apalis.rs",
        "runtime/backends/distributed/backend.rs",
        "runtime/backends/distributed/checkpoint.rs",
        "runtime/backends/distributed/checkpointed_cycle.rs",
        "runtime/backends/distributed/dispatch.rs",
        "runtime/backends/distributed/execution.rs",
        "runtime/backends/distributed/loop.rs",
        "runtime/background_sessions.rs",
        "runtime/background_sessions/listeners.rs",
        "runtime/background_sessions/options.rs",
        "runtime/background_sessions/session.rs",
        "runtime/background_sessions/subscription.rs",
        "runtime/background_sessions/tests.rs",
        "runtime/cancellation.rs",
        "runtime/cycle_runner.rs",
        "runtime/engine/completion.rs",
        "runtime/engine/construction.rs",
        "runtime/engine/mod.rs",
        "runtime/engine/controls.rs",
        "runtime/engine/cycle_inputs.rs",
        "runtime/engine/helpers.rs",
        "runtime/engine/logging.rs",
        "runtime/engine/memory.rs",
        "runtime/engine/memory/callbacks.rs",
        "runtime/engine/memory/metadata.rs",
        "runtime/engine/planning.rs",
        "runtime/engine/memory/session.rs",
        "runtime/engine/memory/token_limits.rs",
        "runtime/engine/run_setup.rs",
        "runtime/engine/state.rs",
        "runtime/hooks.rs",
        "runtime/hooks/events.rs",
        "runtime/hooks/manager.rs",
        "runtime/hooks/patches.rs",
        "runtime/hooks/traits.rs",
        "runtime/processes.rs",
        "runtime/processes/capture.rs",
        "runtime/processes/output.rs",
        "runtime/processes/platform.rs",
        "runtime/processes/termination.rs",
        "runtime/results.rs",
        "runtime/shell/mod.rs",
        "runtime/shell/command.rs",
        "runtime/shell/metadata.rs",
        "runtime/shell/path.rs",
        "runtime/shell/platform.rs",
        "runtime/shell/windows.rs",
        "runtime/shell/windows/discovery.rs",
        "runtime/shell/windows/priority.rs",
        "runtime/shell/windows/programs.rs",
        "runtime/shell/windows/resolve.rs",
        "runtime/shell/windows/tests.rs",
        "runtime/sub_agents/mod.rs",
        "runtime/sub_agents/events.rs",
        "runtime/sub_agents/runner.rs",
        "runtime/sub_agents/runner/identity.rs",
        "runtime/sub_agents/runner/model.rs",
        "runtime/sub_agents/runner/outcome.rs",
        "runtime/sub_agents/runner/session.rs",
        "runtime/sub_agents/session.rs",
        "runtime/sub_agents/session/events.rs",
        "runtime/sub_agents/session/execution.rs",
        "runtime/sub_agents/session/state.rs",
        "runtime/sub_agents/session/subscription.rs",
        "runtime/sub_agents/task.rs",
        "runtime/sub_agents/types.rs",
        "runtime/sub_task_manager/mod.rs",
        "runtime/sub_task_manager/events.rs",
        "runtime/sub_task_manager/helpers.rs",
        "runtime/sub_task_manager/identity.rs",
        "runtime/sub_task_manager/manager.rs",
        "runtime/sub_task_manager/record.rs",
        "runtime/sub_task_manager/sessions.rs",
        "runtime/sub_task_manager/status.rs",
        "runtime/sub_task_manager/submission.rs",
        "runtime/sub_task_manager/types.rs",
        "runtime/token_usage.rs",
        "runtime/tool_call_runner.rs",
        "runtime/tool_call_runner/outcome.rs",
        "runtime/tool_call_runner/request.rs",
        "runtime/tool_call_runner/results.rs",
        "runtime/tool_call_runner/runner.rs",
        "runtime/tool_planner.rs",
        "skills/mod.rs",
        "skills/errors.rs",
        "skills/models.rs",
        "skills/normalize.rs",
        "skills/normalize/path.rs",
        "skills/normalize/value.rs",
        "skills/parser.rs",
        "skills/parser/discovery.rs",
        "skills/parser/frontmatter.rs",
        "skills/parser/io.rs",
        "skills/parser/properties.rs",
        "skills/parser/read.rs",
        "skills/parser/value.rs",
        "skills/prompt.rs",
        "skills/validator.rs",
        "skills/validator/diagnostics.rs",
        "skills/validator/mode.rs",
        "skills/validator/rules.rs",
        "memory/artifacts.rs",
        "memory/artifacts/config.rs",
        "memory/artifacts/content.rs",
        "memory/artifacts/info.rs",
        "memory/artifacts/persist.rs",
        "memory/artifacts/render.rs",
        "memory/microcompact.rs",
        "memory/mod.rs",
        "memory/manager/mod.rs",
        "memory/manager/compaction.rs",
        "memory/manager/config.rs",
        "memory/manager/emergency.rs",
        "memory/manager/helpers.rs",
        "memory/manager/limits.rs",
        "memory/manager/microcompact.rs",
        "memory/manager/normalization.rs",
        "memory/manager/prompts.rs",
        "memory/manager/session_context.rs",
        "memory/manager/warnings.rs",
        "memory/session/mod.rs",
        "memory/session/config.rs",
        "memory/session/entry.rs",
        "memory/session/parse.rs",
        "memory/session/prompt.rs",
        "memory/session/state.rs",
        "memory/session/storage.rs",
        "memory/summary.rs",
        "memory/summary/events.rs",
        "memory/summary/files.rs",
        "memory/summary/original.rs",
        "memory/summary/text.rs",
        "memory/token_utils.rs",
        "prompt/mod.rs",
        "prompt/builder.rs",
        "prompt/cache_tracker.rs",
        "prompt/templates.rs",
        "llm/mod.rs",
        "llm/base.rs",
        "llm/scripted.rs",
        "llm/anthropic_prompt_cache.rs",
        "llm/anthropic_prompt_cache/blocks.rs",
        "llm/anthropic_prompt_cache/breakpoints.rs",
        "llm/anthropic_prompt_cache/estimate.rs",
        "llm/anthropic_prompt_cache/model.rs",
        "llm/anthropic_prompt_cache/sections.rs",
        "llm/vv_llm_client/mod.rs",
        "llm/vv_llm_client/construction.rs",
        "llm/vv_llm_client/endpoints.rs",
        "llm/vv_llm_client/execution.rs",
        "llm/vv_llm_client/model_rules.rs",
        "llm/vv_llm_client/prompt_cache.rs",
        "llm/vv_llm_client/prompt_cache/apply.rs",
        "llm/vv_llm_client/prompt_cache/endpoint.rs",
        "llm/vv_llm_client/prompt_cache/from_cache.rs",
        "llm/vv_llm_client/prompt_cache/metadata.rs",
        "llm/vv_llm_client/prompt_cache/to_cache.rs",
        "llm/vv_llm_client/request.rs",
        "llm/vv_llm_client/response.rs",
        "llm/vv_llm_client/streaming.rs",
        "llm/vv_llm_client/streaming/events.rs",
        "llm/vv_llm_client/streaming/raw_content.rs",
        "llm/vv_llm_client/streaming/tool_calls.rs",
        "workspace/mod.rs",
        "workspace/base.rs",
        "workspace/local.rs",
        "workspace/memory.rs",
        "workspace/s3.rs",
        "workspace/s3/backend.rs",
        "workspace/s3/config.rs",
        "workspace/s3/paths.rs",
        "workspace/s3/runtime.rs",
        "config/settings_literal.rs",
        "config/settings_literal/assignment.rs",
        "config/settings_literal/identifiers.rs",
        "config/settings_literal/json.rs",
        "config/settings_literal/strings.rs",
        "config/model_resolution/backend.rs",
        "config/model_resolution/endpoints.rs",
        "config/model_resolution/settings.rs",
        "constants/mod.rs",
        "constants/tool_names.rs",
        "constants/workspace.rs",
        "types/mod.rs",
        "types/metadata.rs",
        "types/status.rs",
        "types/messages.rs",
        "types/tool_calls.rs",
        "types/token_usage.rs",
        "types/tasks.rs",
        "types/records.rs",
        "types/dict/mod.rs",
        "types/dict/common.rs",
        "types/dict/common/enums.rs",
        "types/dict/common/fields.rs",
        "types/dict/common/values.rs",
        "types/dict/messages.rs",
        "types/dict/records.rs",
        "types/dict/records/cycle.rs",
        "types/dict/records/result.rs",
        "types/dict/records/task.rs",
        "types/dict/token_usage.rs",
        "types/dict/tools.rs",
        "prompt/builder/hash.rs",
        "prompt/builder/options.rs",
        "prompt/builder/section.rs",
        "prompt/builder/system.rs",
        "prompt/builder/system_builder.rs",
        "cli.rs",
        "cli/args.rs",
        "cli/logging.rs",
        "cli/output.rs",
        "cli/task.rs",
    ] {
        assert!(root.join(relative).is_file(), "missing {relative}");
    }
    for (relative, message) in [
        (
            "tools.rs",
            "tools.rs should be split into src/tools/ modules",
        ),
        (
            "tools/base.rs",
            "tools base should be split into src/tools/base/ modules",
        ),
        (
            "tools/registry.rs",
            "tools registry should be split into src/tools/registry/ modules",
        ),
        (
            "runtime.rs",
            "runtime.rs should be split into src/runtime/ modules",
        ),
        (
            "background_sessions.rs",
            "background sessions should live under src/runtime/",
        ),
        (
            "processes.rs",
            "captured process helpers should live under src/runtime/",
        ),
        (
            "sub_agent_sessions.rs",
            "sub-agent session registry helpers should be exposed through runtime::engine and runtime, not flattened at crate root",
        ),
        (
            "sub_task_manager.rs",
            "sub-task manager should live under src/runtime/sub_task_manager/ modules",
        ),
        (
            "runtime/sub_agents.rs",
            "sub-agent runtime should be split into src/runtime/sub_agents/ modules",
        ),
        (
            "runtime/backends.rs",
            "runtime/backends.rs should be split into src/runtime/backends/ modules",
        ),
        (
            "runtime/engine.rs",
            "runtime/engine.rs should be split into src/runtime/engine/ modules",
        ),
        (
            "runtime/shell.rs",
            "runtime shell helpers should be split into src/runtime/shell/ modules",
        ),
        (
            "memory.rs",
            "memory.rs should be split into src/memory/ modules",
        ),
        (
            "memory/manager.rs",
            "memory manager should be split into src/memory/manager/ modules",
        ),
        (
            "memory/session.rs",
            "session memory should be split into src/memory/session/ modules",
        ),
        (
            "prompt.rs",
            "prompt.rs should be split into src/prompt/ modules",
        ),
        ("llm.rs", "llm.rs should be split into src/llm/ modules"),
        (
            "llm/vv_llm_client.rs",
            "vv-llm client should be split into src/llm/vv_llm_client/ modules",
        ),
        (
            "workspace.rs",
            "workspace.rs should be split into src/workspace/ modules",
        ),
        (
            "tools/schemas.rs",
            "schemas.rs should be split into src/tools/schemas/ domain modules",
        ),
        (
            "tools/schemas/sub_agents.rs",
            "sub-agent schemas should be split into create/status modules",
        ),
        (
            "tools/schemas/workspace.rs",
            "workspace schemas should be split into src/tools/schemas/workspace/ modules",
        ),
        (
            "tools/handlers/skills.rs",
            "skills.rs should be split into src/tools/handlers/skills/ modules",
        ),
        (
            "tools/handlers/control.rs",
            "control handlers should be split into task_finish and ask_user modules",
        ),
        (
            "tools/handlers/skills/models.rs",
            "skill models should live in the public src/skills/ module",
        ),
        (
            "tools/handlers/skills/normalize.rs",
            "skill normalization should live in the public src/skills/ module",
        ),
        (
            "tools/handlers/skills/parser.rs",
            "skill parsing should live in the public src/skills/ module",
        ),
        (
            "skills.rs",
            "skills.rs should be split into src/skills/ modules",
        ),
        (
            "constants.rs",
            "constants.rs should be split into src/constants/ modules",
        ),
        (
            "types/dict.rs",
            "dictionary conversions should be split into src/types/dict/ modules",
        ),
        (
            "types.rs",
            "core public types should be split into src/types/ modules",
        ),
    ] {
        assert!(!root.join(relative).exists(), "{message}");
    }
}

#[test]
fn rust_source_files_stay_under_reasonable_size_limit() {
    let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
    let source_files = collect_rust_files(&manifest_dir.join("src"));
    let oversized = source_files
        .into_iter()
        .filter_map(|path| {
            let content = std::fs::read_to_string(&path).expect("read source file");
            let line_count = content.lines().count();
            (line_count > MAX_REASONABLE_SOURCE_LINES).then(|| {
                let relative = path
                    .strip_prefix(manifest_dir)
                    .unwrap_or(path.as_path())
                    .display()
                    .to_string();
                format!("{relative}: {line_count} lines")
            })
        })
        .collect::<Vec<_>>();

    assert!(
        oversized.is_empty(),
        "Rust source files over {MAX_REASONABLE_SOURCE_LINES} lines should be split:\n{}",
        oversized.join("\n")
    );
}

#[test]
fn rust_test_files_stay_under_reasonable_size_limit() {
    let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
    let test_files = collect_rust_files(&manifest_dir.join("tests"));
    let oversized = test_files
        .into_iter()
        .filter_map(|path| {
            let content = std::fs::read_to_string(&path).expect("read test file");
            let line_count = content.lines().count();
            (line_count > MAX_REASONABLE_SOURCE_LINES).then(|| {
                let relative = path
                    .strip_prefix(manifest_dir)
                    .unwrap_or(path.as_path())
                    .display()
                    .to_string();
                format!("{relative}: {line_count} lines")
            })
        })
        .collect::<Vec<_>>();

    assert!(
        oversized.is_empty(),
        "Rust test files over {MAX_REASONABLE_SOURCE_LINES} lines should be split:\n{}",
        oversized.join("\n")
    );
}

#[test]
fn live_deepseek_tests_use_facade_entrypoints() {
    let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
    let root_path = manifest_dir.join("tests/live_deepseek.rs");
    let root = std::fs::read_to_string(&root_path).expect("read live_deepseek root test");
    let root_line_count = root.lines().count();

    assert!(
        root_line_count <= 250,
        "tests/live_deepseek.rs should be a small module entrypoint; found {root_line_count} lines"
    );
    assert!(
        root.contains("Runner") && root.contains("Agent") && root.contains("VvLlmModelProvider"),
        "live DeepSeek tests should exercise the current Agent/Runner API"
    );
    assert!(
        !manifest_dir.join("tests/live_deepseek").exists(),
        "old live DeepSeek capability modules should not be kept after Agent/Runner consolidation"
    );
}

#[test]
fn runtime_engine_root_stays_focused_on_loop_orchestration() {
    let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
    let runtime_engine = manifest_dir.join("src/runtime/engine/mod.rs");
    let content = std::fs::read_to_string(&runtime_engine).expect("read runtime engine module");
    let line_count = content.lines().count();

    assert!(
        line_count <= MAX_REASONABLE_SOURCE_LINES,
        "runtime/engine/mod.rs is over {MAX_REASONABLE_SOURCE_LINES} lines and should be split before growing further; found {line_count} lines"
    );

    for module in [
        "completion",
        "construction",
        "controls",
        "cycle_inputs",
        "helpers",
        "logging",
        "memory",
        "planning",
        "run_setup",
        "state",
    ] {
        assert!(
            content.contains(&format!("mod {module};")),
            "runtime/engine/mod.rs should delegate {module} responsibilities to a focused submodule"
        );
    }
}