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
//! Bridge a [`DigitalWorkerManifest`]'s `extension_tools` snapshot into the
//! AW runtime's [`ToolRef`] catalog.
//!
//! Sub-project #2 snapshots the tools a Digital Worker invokes in
//! `DigitalWorkerManifest.extension_tools: Vec<ExtensionTool>`. A
//! [`crate::ConfigProvider`] can call [`manifest_to_tool_refs`] to derive the
//! `(extension_id, tool_name)` set to wire as `AgentConfig.tools`.
//!
//! ## Snapshot-wins-at-runtime is out of scope
//!
//! This converter only supplies the *set* of `ToolRef`s. The runtime keeps its
//! existing **live** schema resolution: `tools::list_tools_for_llm` resolves
//! each `ToolRef` against `ExtensionRuntime::list_tools()` at call time. The
//! snapshot's `description` / `input_schema_json` are intentionally ignored
//! here.
use crateToolRef;
use DigitalWorkerManifest;
/// Convert a manifest's `extension_tools` into AW runtime [`ToolRef`]s.
///
/// Only tools whose `capabilities` declare [`AGENTIC_WORKER_CAPABILITY`] are
/// included; flow-only tools are skipped. Declaration order is preserved, and
/// exact `(extension_id, tool_name)` pairs are de-duplicated keeping the first
/// occurrence.
///
/// # Arguments
/// * `manifest` - the Digital Worker manifest carrying the tool snapshot
///
/// # Returns
/// The ordered, de-duplicated list of agentic-worker [`ToolRef`]s. Empty when
/// the manifest declares no agentic-worker-capable tools.
///
/// # Example
/// ```no_run
/// # use greentic_dw_manifest::DigitalWorkerManifest;
/// # use greentic_aw_runtime::manifest_tools::manifest_to_tool_refs;
/// # fn demo(manifest: &DigitalWorkerManifest) {
/// let tool_refs = manifest_to_tool_refs(manifest);
/// // feed `tool_refs` into `AgentConfig.tools`
/// # let _ = tool_refs;
/// # }
/// ```