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
//! **The tool host's own document** (REMOTE §5.2, bl-024b): what this machine
//! can run, and — by dropping half of it — what it says it can run.
//!
//! ```json
//! [{"name": "Bash",
//! "description": "run a command in a shell",
//! "input_schema": {"type": "object",
//! "properties": {"command": {"type": "string"}},
//! "required": ["command"]},
//! "command": ["/usr/local/libexec/yog-tools/bash-tool"],
//! "cwd": "/srv/work"}]
//! ```
//!
//! **The advertisement is a projection of this file, not a second list.** The
//! first three keys *are* REMOTE §5.1's advertised element, verbatim, and
//! [`advertisement`] is the whole of the derivation: drop `command` and `cwd`.
//! One document, two readings — so what a host offers and what it can actually
//! run cannot drift, which is the entire reason the config is not a pair of
//! lists an operator has to keep in step.
//!
//! **`command` is an argv, spawned directly.** There is no shell and no
//! interpolation of the invocation's input into it: a shell would make the
//! declared schema advisory and turn an operator's config into a
//! command-injection surface for anything a model can type. The input reaches
//! the command exactly as lernie's own tool contract delivers one (its ARCH
//! §3.3) — the JSON on stdin, bytes on stdout, the exit code the verdict.
//!
//! **It sits beside the wire material, not inside the world**
//! (`<yog-data-root>/tools.json`, the sibling of `wire/` and `world/`), for
//! `wire/`'s reason exactly: it describes *this machine*, it is written by the
//! operator, and nothing yog generates may sit where a reseed would take it.
//!
//! JSON rather than TOML for one reason (REMOTE §5.2): `input_schema` is JSON
//! Schema carried verbatim, and any other syntax would make the operator
//! transcribe it.
use ;
use Value;
use crate;
use crate;
use crateEnv;
/// The document's leaf under the yog data root.
pub const TOOLS: &str = "tools.json";
/// One tool this machine offers: the advertised half, and the local half that
/// is never presented to anyone.
/// This machine's document.
/// Read it, or say why it is not one. An absent document is a **refusal**
/// rather than the empty set: a tool host with nothing to offer has nothing to
/// do, and starting one is an explicit act that deserves an explicit answer —
/// the same posture `yog seat` takes to absent wire material.
/// One element: the advertised three read by the **same** decoder the wire and
/// the stored document spend, then the local two.
/// **The advertisement, derived** (REMOTE §5.2): the same document with the
/// local half dropped. The one derivation, so a host cannot offer what it
/// cannot run.
/// Which element an invocation names, by position — an index rather than a
/// borrow, so the caller resolves it against the very list it passed in.