Compare commits
528 Commits
skills
..
ddad7166ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
ddad7166ad
|
|||
|
77113fb4ef
|
|||
|
ac3eb40195
|
|||
|
b6be2229cf
|
|||
|
acf69f7ed7
|
|||
| 8e4ecd454c | |||
|
25d8395948
|
|||
|
7b0d4ca41f
|
|||
|
b7ca5165c6
|
|||
|
36e0a0013c
|
|||
|
fa3f27532e
|
|||
|
8e2a5ce31e
|
|||
|
e91ea86873
|
|||
|
d494f8825f
|
|||
|
5e8194d271
|
|||
|
b40ae70084
|
|||
|
25593037f6
|
|||
|
7b679a2966
|
|||
|
d570c59fb0
|
|||
|
f96fd744e7
|
|||
|
dcc6bcd0e7
|
|||
|
6499b2fe83
|
|||
|
b48716d7f8
|
|||
|
cae279c9e0
|
|||
|
8b7306341c
|
|||
|
fb4a46c5b8
|
|||
|
af7ea9b5bc
|
|||
|
68b51bf10e
|
|||
|
721ca1bc10
|
|||
|
eb102e1374
|
|||
|
bc2174286e
|
|||
|
1b4ab894d4
|
|||
|
1c983fb144
|
|||
|
09fb6634f0
|
|||
|
46ddfdc464
|
|||
|
df6c3c50db
|
|||
|
8c5bed3e34
|
|||
|
d45375a454
|
|||
|
ed8327e9d6
|
|||
|
bc1800db4f
|
|||
|
dd8da58105
|
|||
|
6a0df70777
|
|||
|
5e550a67ce
|
|||
|
b781dd8dc6
|
|||
|
43fbe448cb
|
|||
|
9efd6a2690
|
|||
|
a3f278544a
|
|||
|
e48926f458
|
|||
|
4e616fe7c3
|
|||
|
863b28f01e
|
|||
|
bf97f2261d
|
|||
|
baa44ec5cb
|
|||
|
29af20f316
|
|||
|
960a199cd2
|
|||
|
3a18ffdaf3
|
|||
|
7aa00d52de
|
|||
|
ac58ddc202
|
|||
|
38259642cd
|
|||
|
90e105a171
|
|||
|
a5ece505b7
|
|||
|
fb8633dc75
|
|||
|
a7ebc15b89
|
|||
|
a7a9b6b1cf
|
|||
|
e1c2f0aa42
|
|||
|
6e9b394f73
|
|||
|
747ca0d0fc
|
|||
|
ba665528ed
|
|||
|
1440e23748
|
|||
|
8ff9d84a85
|
|||
|
dc8e831f27
|
|||
|
985ae11fcf
|
|||
|
b758b17dbb
|
|||
|
aef26013cb
|
|||
|
b1fc199a5f
|
|||
|
7e801b80d0
|
|||
|
7cd7abe469
|
|||
|
6a5561edba
|
|||
|
d8a92f4e62
|
|||
|
6330d7dd95
|
|||
|
c63eb0a9f9
|
|||
|
d927a9b99f
|
|||
|
766684615b
|
|||
|
5be12e90dc
|
|||
|
7325ad7b32
|
|||
|
2e224948d4
|
|||
|
fa424bde34
|
|||
|
42c88fa2a3
|
|||
|
84c6f88cf2
|
|||
|
f401c637cc
|
|||
|
3239c5d990
|
|||
|
1dff08893a
|
|||
|
f65ec9e9fe
|
|||
|
3ce5ab4fe7
|
|||
| fd21431c2f | |||
| 61a698f9eb | |||
|
518a39c143
|
|||
|
160ee5d5ae
|
|||
|
e4819ff9db
|
|||
|
ecb3cdfcc2
|
|||
|
364cf29296
|
|||
|
b2fa8ebb71
|
|||
| 48031d592f | |||
|
4c7a0a7a77
|
|||
|
8f960fdbbf
|
|||
|
feefe45ed2
|
|||
| 9958eeee8f | |||
|
aa31db7e07
|
|||
|
8c6dde7d86
|
|||
|
738e29059b
|
|||
|
2eb81c4a8b
|
|||
|
88998d1019
|
|||
|
a1fc099c24
|
|||
|
2fe365bef8
|
|||
|
efb1b7b96b
|
|||
|
d915f9e3c1
|
|||
|
11ebf3c155
|
|||
|
abf5d425fd
|
|||
|
1e3d52482a
|
|||
|
0fb72f8226
|
|||
|
0701c370b4
|
|||
|
0bdaa9441f
|
|||
|
4ba1bd8a24
|
|||
|
b484242e4c
|
|||
|
a756394e30
|
|||
|
0faf7b850d
|
|||
|
eeb9f7083b
|
|||
|
b6a5b340f1
|
|||
|
209257c7b1
|
|||
|
4e88cebe28
|
|||
|
738b600fa6
|
|||
|
f67538e5ab
|
|||
|
18bb3d3440
|
|||
|
04cd3c890b
|
|||
|
ef8f5865e2
|
|||
|
493e9bb2a5
|
|||
|
3eff135349
|
|||
|
7ac753d824
|
|||
|
9add71ff13
|
|||
|
7154c3a652
|
|||
|
36ac924d77
|
|||
|
5e4d3ff011
|
|||
|
fd287b09b0
|
|||
|
07c1f70df3
|
|||
|
8c398b6360
|
|||
|
e43c2e477a
|
|||
|
6078072915
|
|||
|
1902e2d040
|
|||
|
702e6f2f63
|
|||
|
01938a0f28
|
|||
|
5d017fbb48
|
|||
|
a3ed9476ae
|
|||
|
a22faad992
|
|||
|
06fe1f9471
|
|||
|
e2ff2c03f8
|
|||
|
7ca9a19d3b
|
|||
|
f5b69d6b4d
|
|||
|
4f244618ca
|
|||
|
b7a20a000a
|
|||
|
0094be475f
|
|||
|
3e508c9337
|
|||
|
edd3c08247
|
|||
|
bf6b2f718c
|
|||
|
984a073730
|
|||
|
aa4babff56
|
|||
|
7f620d469b
|
|||
|
33782c59a8
|
|||
|
5669830510
|
|||
|
99c6cff068
|
|||
|
9b395a304d
|
|||
|
01912bcef3
|
|||
|
e0b85fc936
|
|||
|
73f6e07e47
|
|||
|
534b9923ae
|
|||
|
c66faa22dc
|
|||
|
cf666eb2c6
|
|||
|
76861508c9
|
|||
|
beebb39050
|
|||
|
3d7ba424f1
|
|||
|
84eb82b355
|
|||
|
1fbdcd66d1
|
|||
|
5b65496684
|
|||
|
ca808b4c08
|
|||
|
84c1753ed5
|
|||
|
c8d9f89d59
|
|||
|
e3531b4dcf
|
|||
|
b939868d28
|
|||
|
7630b3e75c
|
|||
| 3292f8e0a5 | |||
|
cf1c06e632
|
|||
|
49f2932b30
|
|||
|
5fd786dd3d
|
|||
|
f5967c7771
|
|||
|
eee0e86131
|
|||
|
51dfd2a655
|
|||
|
d9cf0c4b08
|
|||
|
b4c65f7a19
|
|||
|
1c0e836a92
|
|||
|
2da196c091
|
|||
|
69648afe27
|
|||
|
454f5c03f3
|
|||
|
406642723e
|
|||
|
2469b713c7
|
|||
|
b6ad7a575d
|
|||
|
f3b410d146
|
|||
|
095d0f3d8a
|
|||
|
5f445e046f
|
|||
|
96ab2bdc1b
|
|||
|
cb175e3b51
|
|||
|
7965b970d9
|
|||
|
0a21f10b04
|
|||
|
49aa9fad41
|
|||
|
8f7d3bd13c
|
|||
|
f7fb249d43
|
|||
|
d9498ffb21
|
|||
|
0177fa6906
|
|||
|
c3f6cb8f46
|
|||
|
7facdce6b6
|
|||
|
c11eb352fe
|
|||
|
0e427dc4ba
|
|||
|
f1914f6bd4
|
|||
|
dba6304f51
|
|||
|
e40a8bba72
|
|||
|
c057249e52
|
|||
|
d906713d7d
|
|||
| ff3419a714 | |||
|
a5899da4fb
|
|||
|
dedcef8ac5
|
|||
|
d658f1d2fe
|
|||
|
6b4a45874f
|
|||
|
7839e1dbd9
|
|||
|
78c3932f36
|
|||
|
11334149b0
|
|||
|
4caa035528
|
|||
|
f30e81af08
|
|||
|
4c75655f58
|
|||
|
f865892c28
|
|||
|
ebeb9c9b7d
|
|||
|
ab2b927fcb
|
|||
|
7e5ff2ba1f
|
|||
|
ed59051f3d
|
|||
| e98bf56a2b | |||
| fb510b1a4f | |||
|
6c17462040
|
|||
|
1536cf384c
|
|||
|
d6842d7e29
|
|||
|
fbc0acda2a
|
|||
|
0327d041b6
|
|||
|
6a01fd4fbd
|
|||
| d822180205 | |||
|
89d0fdce26
|
|||
|
b3ecdce979
|
|||
|
3873821a31
|
|||
|
9c2801b643
|
|||
|
d78820dcd4
|
|||
|
d43c4232a2
|
|||
|
f41c85b703
|
|||
|
9e056bdcf0
|
|||
|
d6022b9f98
|
|||
|
6fc1abf94a
|
|||
|
92ea0f624e
|
|||
|
c3fd8fbc1c
|
|||
|
7fd3f7761c
|
|||
|
05e19098b2
|
|||
|
60067ae757
|
|||
|
c72003b0b6
|
|||
|
7c9d500116
|
|||
|
6b2c87b562
|
|||
|
b2dbdfb4b1
|
|||
|
063e198f96
|
|||
|
73cbe16ec1
|
|||
|
bdea854a9f
|
|||
|
9b4c800597
|
|||
|
eb4d1c02f4
|
|||
|
c428990900
|
|||
|
03b9cc70b9
|
|||
|
3fa0eb832c
|
|||
|
83f66e1061
|
|||
|
741b9c364c
|
|||
|
b6f6f456db
|
|||
|
00a6cf74d7
|
|||
|
d35ca352ca
|
|||
| 57dc1cb252 | |||
|
101a9cdd6e
|
|||
|
c5f52e1efb
|
|||
|
470149b606
|
|||
|
02062c5a50
|
|||
|
e6e99b6926
|
|||
|
15a293204f
|
|||
|
ecf3780aed
|
|||
|
e798747135
|
|||
|
60493728a0
|
|||
|
25d6370b20
|
|||
|
d67f845af5
|
|||
|
920a14cabe
|
|||
|
58bdd2e584
|
|||
|
ce6f53ad05
|
|||
|
96f8007d53
|
|||
|
32a55652fe
|
|||
|
2b92e6c98b
|
|||
|
cfa654bcd8
|
|||
|
d0f5ae39e2
|
|||
|
2bb8cf5f73
|
|||
|
fbac446859
|
|||
|
f91cf2e346
|
|||
|
b6b33ab7e3
|
|||
|
c1902a69d1
|
|||
|
812a8e101c
|
|||
|
655ee2a599
|
|||
|
128a8f9a9c
|
|||
|
b1be9443e7
|
|||
|
7b12c69ebf
|
|||
|
69ad584137
|
|||
|
313058e70a
|
|||
|
ea96d9ba3d
|
|||
|
7884adc7c1
|
|||
|
948466d771
|
|||
|
3894c98b5b
|
|||
|
5e9c31595e
|
|||
|
39d9b25e47
|
|||
|
b86f76ddb9
|
|||
|
7f267a10a1
|
|||
|
cdafdff281
|
|||
|
60ad83d6d9
|
|||
|
44c03ccf4f
|
|||
|
af933bbb29
|
|||
|
1f127ee990
|
|||
|
88a9a7709f
|
|||
| e8d92d1b01 | |||
| ddbfd03e75 | |||
|
d1c7f09015
|
|||
|
d2f8f995f0
|
|||
|
5ef9a397ca
|
|||
|
325ab1f45e
|
|||
|
4cfaa2dc77
|
|||
|
6abe2c5536
|
|||
|
03cfd59962
|
|||
|
4d7d5e5e53
|
|||
|
3779b940ae
|
|||
|
d2e541c5c0
|
|||
|
621c90427c
|
|||
|
486001ee85
|
|||
|
c7a2ec084f
|
|||
|
d4e0d48198
|
|||
|
07f23bab5e
|
|||
|
b11797ea1c
|
|||
|
70c2d411ae
|
|||
|
f82c9aff40
|
|||
|
a935add2a7
|
|||
|
8a37a88ffd
|
|||
|
8f66cac680
|
|||
|
0a40ddd2e4
|
|||
|
d5e0728532
|
|||
|
25c0885dcc
|
|||
|
f56ed7d005
|
|||
|
d79e4b9dff
|
|||
|
cdd829199f
|
|||
|
e3c644b8ca
|
|||
|
5cb8070da1
|
|||
|
66801b5d07
|
|||
|
f2de196e22
|
|||
|
2eba530895
|
|||
| 3baa3102a3 | |||
| 2d4fad596c | |||
| 7259e59d2a | |||
| cec04c4597 | |||
| a7f5677195 | |||
| 6075f0a190 | |||
| 15310a9e2c | |||
| f7df54f2f7 | |||
| 212d4bace4 | |||
| f4b3267c89 | |||
| 9eeeb11871 | |||
| b8db3f689d | |||
| 3b21ce2aa5 | |||
| 9bf4fcd943 | |||
| c1f5cfbbda | |||
| 46517a4e15 | |||
| efbe76e1fc | |||
| 245c567d30 | |||
| cbb3d2c34a | |||
| bddec85fa5 | |||
| 96acbc6bf0 | |||
| 0735a31190 | |||
| 986c64ff13 | |||
| 831426d418 | |||
| b99e3fc030 | |||
| 012734f70a | |||
| f591a9635e | |||
| 7c099bf589 | |||
| 32d3cee907 | |||
| 86539c4bb8 | |||
| 14549afd52 | |||
| 667c843fc0 | |||
| 680a52982c | |||
| 52efb1a775 | |||
| c88931d318 | |||
| 2183ed62d1 | |||
| cc8bd040b9 | |||
| a2a464151f | |||
| c9a3f247e7 | |||
| d167502b7b | |||
| 0d9927bb99 | |||
| c9858ce615 | |||
| cccaa1dbe7 | |||
| acd951e981 | |||
| 10d80d58fd | |||
| f196c375d6 | |||
| cc62c89b05 | |||
| 3266cdeb08 | |||
| 6605c62015 | |||
| 704fdbd145 | |||
| 93e76a65a1 | |||
| b3ca7ebddb | |||
| 091fc0b7b7 | |||
| 874f5ba08e | |||
| 5fdfe94b88 | |||
| c02b168749 | |||
| 6ababd919d | |||
| 86b2b2d772 | |||
| 2aa2c3ccee | |||
| 70645a8431 | |||
| ca4b2f2637 | |||
| 7fce8f9b23 | |||
| e5b3b332f6 | |||
| 3e59762443 | |||
| 2ea8a48f28 | |||
| 3c07471620 | |||
| 23e2c1144f | |||
| 313f5e2dda | |||
| 26c35e55d8 | |||
| 878adc0eb7 | |||
| d353767b2c | |||
| 33baeaa62d | |||
| 591b7a5bf1 | |||
| 0bc993532b | |||
| 09379e7231 | |||
| 1a45ce9dc1 | |||
| 95df054dfb | |||
| 5b49553c6d | |||
| 6508940d11 | |||
| 71d89eaaba | |||
| 9619b7908f | |||
| 304129d793 | |||
| 5df435c21a | |||
| 2719c7320a | |||
| a84bae189c | |||
| d82c7c2535 | |||
| 2bc832ed95 | |||
| b5a0f0635b | |||
| 7426aa4bcb | |||
| ba9649382e | |||
| 9c64e97d8b | |||
| 4b1cd3cf44 | |||
| 4a0f002503 | |||
| c4f8c6e102 | |||
| 421308423f | |||
| 0550de2093 | |||
| dddf72e1da | |||
| e23820adf2 | |||
| fea4411aa6 | |||
| b814a38c59 | |||
| 1a3476e4fb | |||
| ecd4d6587c | |||
| 0938119e99 | |||
| 9f15f01871 | |||
| f09cbd2b32 | |||
| 77c1a06277 | |||
| 600f5d1484 | |||
| 7f71317acd | |||
| 865ef5827b | |||
| e5d5bf6c53 | |||
| 7b08d1ef96 | |||
| 9d363b38c7 | |||
| 2f3586cbbf | |||
| 843abe0621 | |||
| 474c5bc76f | |||
| b49a27f886 | |||
| 6f77b3f46e | |||
| a835012673 | |||
| 3f1e8003f8 | |||
| 8475707e75 | |||
| 8a240b1c3f | |||
| 59a3e3012b | |||
| c13142f971 | |||
| a468ee1154 | |||
| 1b504e211a | |||
| 29536f6291 | |||
| 4ef483126d | |||
| 8d2961f3ee | |||
| f1146bb2b9 | |||
| 2daa014c99 | |||
| ebe642f44a | |||
| 25ad254e84 | |||
| 947a7871c2 | |||
| 6421a677eb | |||
| 950893f4a2 | |||
| a10948614d | |||
| 39fc863e22 | |||
| df8b326d89 | |||
| 591f204b67 | |||
| 316ebd6d25 | |||
| 4e707ae08e | |||
| 1ef554c759 | |||
| 367e7d90fd | |||
| 6e7a89763c | |||
| 9dd3836802 | |||
| f822546971 | |||
| 4bf338f91a | |||
| 16577ddc5e | |||
| 384ae73c80 | |||
| d4c932b8ac | |||
| 743e42d4f8 | |||
| 6be2651106 | |||
| 2a2d20a25c | |||
| 882942385b | |||
| 0aa908c8d3 | |||
| 4c179c9269 | |||
| a4fe91ffda | |||
| dc500207ef | |||
| c1e3c3699b | |||
| 52e9f5fc70 | |||
| c85cddb5b4 | |||
| 477b53124d | |||
| 650dbd92e0 | |||
| 88288a98b6 | |||
| 377ab91af7 | |||
| acfc7685f4 | |||
| 5636010e1e |
@@ -507,7 +507,9 @@ open_link() {
|
|||||||
|
|
||||||
guard_operation() {
|
guard_operation() {
|
||||||
if [[ -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then
|
if [[ -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then
|
||||||
ans="$(confirm "${1:-Are you sure you want to continue?}")"
|
# 2>/dev/tty: keep the prompt off the host-captured stderr pipe so it
|
||||||
|
# can't leak into tool_call_error JSON when the wrapped command fails.
|
||||||
|
ans="$(confirm "${1:-Are you sure you want to continue?}" 2>/dev/tty)"
|
||||||
|
|
||||||
if [[ "$ans" == 0 ]]; then
|
if [[ "$ans" == 0 ]]; then
|
||||||
error "Operation aborted!" 2>&1
|
error "Operation aborted!" 2>&1
|
||||||
@@ -657,7 +659,8 @@ guard_path() {
|
|||||||
confirmation_prompt="$2"
|
confirmation_prompt="$2"
|
||||||
|
|
||||||
if [[ ! "$path" == "$(pwd)"* && -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then
|
if [[ ! "$path" == "$(pwd)"* && -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then
|
||||||
ans="$(confirm "$confirmation_prompt")"
|
# 2>/dev/tty: see guard_operation — prevents prompt text leaking via captured stderr.
|
||||||
|
ans="$(confirm "$confirmation_prompt" 2>/dev/tty)"
|
||||||
|
|
||||||
if [[ "$ans" == 0 ]]; then
|
if [[ "$ans" == 0 ]]; then
|
||||||
error "Operation aborted!" >&2
|
error "Operation aborted!" >&2
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
---
|
||||||
|
skills_enabled: false
|
||||||
|
---
|
||||||
As a professional Prompt Engineer, your role is to create effective and innovative prompts for interacting with AI models.
|
As a professional Prompt Engineer, your role is to create effective and innovative prompts for interacting with AI models.
|
||||||
|
|
||||||
Your core skills include:
|
Your core skills include:
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
---
|
||||||
|
skills_enabled: false
|
||||||
|
---
|
||||||
Create a concise, 3-6 word title.
|
Create a concise, 3-6 word title.
|
||||||
|
|
||||||
**Notes**:
|
**Notes**:
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
---
|
||||||
|
skills_enabled: false
|
||||||
|
---
|
||||||
Provide a terse, single sentence description of the given shell command.
|
Provide a terse, single sentence description of the given shell command.
|
||||||
Describe each argument and option of the command.
|
Describe each argument and option of the command.
|
||||||
Provide short responses in about 80 words.
|
Provide short responses in about 80 words.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
---
|
||||||
|
skills_enabled: false
|
||||||
|
---
|
||||||
Provide only {{__shell__}} commands for {{__os_distro__}} without any description.
|
Provide only {{__shell__}} commands for {{__os_distro__}} without any description.
|
||||||
Ensure the output is a valid {{__shell__}} command.
|
Ensure the output is a valid {{__shell__}} command.
|
||||||
If there is a lack of details, provide most logical solution.
|
If there is a lack of details, provide most logical solution.
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ auto_continue: false # Enable automatic continuation when incomplete
|
|||||||
max_auto_continues: 10 # Maximum number of automatic continuations before stopping
|
max_auto_continues: 10 # Maximum number of automatic continuations before stopping
|
||||||
inject_todo_instructions: true # Inject the default todo tool usage instructions into the agent's system prompt
|
inject_todo_instructions: true # Inject the default todo tool usage instructions into the agent's system prompt
|
||||||
continuation_prompt: null # Custom prompt used when auto-continuing (optional; uses default if null)
|
continuation_prompt: null # Custom prompt used when auto-continuing (optional; uses default if null)
|
||||||
|
inject_skill_instructions: true # Inject a short hint pointing the model at `skill__list` when skills are enabled
|
||||||
|
# (default: true). Suppressed automatically when no skills are available.
|
||||||
|
skill_instructions: null # Custom text for the skill hint (optional; uses built-in default if null)
|
||||||
# Sub-Agent Spawning System
|
# Sub-Agent Spawning System
|
||||||
# Enable this agent to spawn and manage child agents in parallel.
|
# Enable this agent to spawn and manage child agents in parallel.
|
||||||
# See https://github.com/Dark-Alex-17/coyote/wiki/Agents for detailed documentation.
|
# See https://github.com/Dark-Alex-17/coyote/wiki/Agents for detailed documentation.
|
||||||
|
|||||||
@@ -162,6 +162,10 @@ auto_continue: false # Enable automatic continuation when incomplet
|
|||||||
max_auto_continues: 10 # Maximum number of automatic continuations before stopping (default: 10)
|
max_auto_continues: 10 # Maximum number of automatic continuations before stopping (default: 10)
|
||||||
inject_todo_instructions: true # Inject default todo usage instructions into the system prompt (default: true)
|
inject_todo_instructions: true # Inject default todo usage instructions into the system prompt (default: true)
|
||||||
continuation_prompt: null # Custom prompt used when auto-continuing. If null, uses built-in default
|
continuation_prompt: null # Custom prompt used when auto-continuing. If null, uses built-in default
|
||||||
|
inject_skill_instructions: true # Inject a short hint pointing the model at `skill__list` when skills are enabled in
|
||||||
|
# this context. Only injected if `function_calling_support`, `skills_enabled`, and the
|
||||||
|
# effective enabled skill set is non-empty (default: true).
|
||||||
|
skill_instructions: null # Custom text used for the skill hint when injected. If null, uses built-in default.
|
||||||
|
|
||||||
# ---- Session ----
|
# ---- Session ----
|
||||||
# See the [Session documentation](https://github.com/Dark-Alex-17/coyote/wiki/Sessions) for more information
|
# See the [Session documentation](https://github.com/Dark-Alex-17/coyote/wiki/Sessions) for more information
|
||||||
|
|||||||
@@ -30,5 +30,8 @@ auto_continue: false # Enable automatic continuation when incom
|
|||||||
max_auto_continues: 10 # Maximum number of automatic continuations before stopping (default: 10)
|
max_auto_continues: 10 # Maximum number of automatic continuations before stopping (default: 10)
|
||||||
inject_todo_instructions: true # Inject default todo tool usage instructions into the system prompt (default: true)
|
inject_todo_instructions: true # Inject default todo tool usage instructions into the system prompt (default: true)
|
||||||
continuation_prompt: null # Custom prompt used when auto-continuing. If null, uses built-in default
|
continuation_prompt: null # Custom prompt used when auto-continuing. If null, uses built-in default
|
||||||
|
inject_skill_instructions: true # Inject a short hint pointing the model at `skill__list` when skills are enabled
|
||||||
|
# (default: true). Suppressed automatically when no skills are available.
|
||||||
|
skill_instructions: null # Custom text for the skill hint (optional; uses built-in default if null)
|
||||||
---
|
---
|
||||||
You are an expert at doing things. This is where you write the instructions for the role.
|
You are an expert at doing things. This is where you write the instructions for the role.
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ enabled_skills:
|
|||||||
- code-review
|
- code-review
|
||||||
- git-master
|
- git-master
|
||||||
- ai-slop-remover
|
- ai-slop-remover
|
||||||
|
inject_skill_instructions: true # Inject a hint pointing the model at `skill__list`. Defaults to true; suppressed
|
||||||
|
# automatically when no skills are available.
|
||||||
|
skill_instructions: null # Custom text for the skill hint (optional; uses the built-in default if omitted).
|
||||||
|
|
||||||
conversation_starters: # Suggested prompts surfaced in the UI
|
conversation_starters: # Suggested prompts surfaced in the UI
|
||||||
- "Research the current state of WebAssembly outside the browser"
|
- "Research the current state of WebAssembly outside the browser"
|
||||||
@@ -173,8 +176,12 @@ nodes:
|
|||||||
# catches violations at load time). `skills_enabled: false` would
|
# catches violations at load time). `skills_enabled: false` would
|
||||||
# disable skills entirely for this node (no meta-tools exposed).
|
# disable skills entirely for this node (no meta-tools exposed).
|
||||||
# Nothing is auto-loaded: the model decides when to load a skill.
|
# Nothing is auto-loaded: the model decides when to load a skill.
|
||||||
|
skills_enabled: true # Whether skills are enabled on this llm node; defaults to 'true'
|
||||||
enabled_skills:
|
enabled_skills:
|
||||||
- ai-slop-remover
|
- ai-slop-remover
|
||||||
|
inject_skill_instructions: true # Override skill-hint injection for just this node. Falls back to
|
||||||
|
# agent/graph/global default when omitted.
|
||||||
|
skill_instructions: null # Per-node skill-hint text override; uses the built-in default when omitted.
|
||||||
output_schema: # Optional JSON Schema. The output is parsed to JSON
|
output_schema: # Optional JSON Schema. The output is parsed to JSON
|
||||||
type: object # and its top-level object keys auto-merge into state
|
type: object # and its top-level object keys auto-merge into state
|
||||||
properties: # (so `topic` / `needs_deep_dive` become {{topic}} etc).
|
properties: # (so `topic` / `needs_deep_dive` become {{topic}} etc).
|
||||||
|
|||||||
@@ -464,6 +464,14 @@ impl Agent {
|
|||||||
self.config.continuation_prompt.clone()
|
self.config.continuation_prompt.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn inject_skill_instructions(&self) -> bool {
|
||||||
|
self.config.inject_skill_instructions
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skill_instructions_value(&self) -> Option<String> {
|
||||||
|
self.config.skill_instructions.clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn can_spawn_agents(&self) -> bool {
|
pub fn can_spawn_agents(&self) -> bool {
|
||||||
self.config.can_spawn_agents
|
self.config.can_spawn_agents
|
||||||
}
|
}
|
||||||
@@ -625,6 +633,10 @@ pub struct AgentConfig {
|
|||||||
pub inject_todo_instructions: bool,
|
pub inject_todo_instructions: bool,
|
||||||
#[serde(default = "default_true")]
|
#[serde(default = "default_true")]
|
||||||
pub inject_spawn_instructions: bool,
|
pub inject_spawn_instructions: bool,
|
||||||
|
#[serde(default = "default_true")]
|
||||||
|
pub inject_skill_instructions: bool,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub skill_instructions: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub compression_threshold: Option<usize>,
|
pub compression_threshold: Option<usize>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@@ -704,6 +716,8 @@ impl AgentConfig {
|
|||||||
mcp_servers: graph.mcp_servers.clone(),
|
mcp_servers: graph.mcp_servers.clone(),
|
||||||
skills_enabled: graph.skills_enabled,
|
skills_enabled: graph.skills_enabled,
|
||||||
enabled_skills: graph.enabled_skills.clone(),
|
enabled_skills: graph.enabled_skills.clone(),
|
||||||
|
inject_skill_instructions: graph.inject_skill_instructions.unwrap_or(true),
|
||||||
|
skill_instructions: graph.skill_instructions.clone(),
|
||||||
conversation_starters: graph.conversation_starters.clone(),
|
conversation_starters: graph.conversation_starters.clone(),
|
||||||
variables: graph.variables.clone(),
|
variables: graph.variables.clone(),
|
||||||
can_spawn_agents: graph.has_agent_node(),
|
can_spawn_agents: graph.has_agent_node(),
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ pub struct AppConfig {
|
|||||||
pub max_auto_continues: usize,
|
pub max_auto_continues: usize,
|
||||||
pub inject_todo_instructions: bool,
|
pub inject_todo_instructions: bool,
|
||||||
pub continuation_prompt: Option<String>,
|
pub continuation_prompt: Option<String>,
|
||||||
|
pub inject_skill_instructions: bool,
|
||||||
|
pub skill_instructions: Option<String>,
|
||||||
|
|
||||||
pub repl_prelude: Option<String>,
|
pub repl_prelude: Option<String>,
|
||||||
pub cmd_prelude: Option<String>,
|
pub cmd_prelude: Option<String>,
|
||||||
@@ -118,6 +120,8 @@ impl Default for AppConfig {
|
|||||||
max_auto_continues: 10,
|
max_auto_continues: 10,
|
||||||
inject_todo_instructions: true,
|
inject_todo_instructions: true,
|
||||||
continuation_prompt: None,
|
continuation_prompt: None,
|
||||||
|
inject_skill_instructions: true,
|
||||||
|
skill_instructions: None,
|
||||||
|
|
||||||
repl_prelude: None,
|
repl_prelude: None,
|
||||||
cmd_prelude: None,
|
cmd_prelude: None,
|
||||||
@@ -185,6 +189,8 @@ impl AppConfig {
|
|||||||
max_auto_continues: config.max_auto_continues,
|
max_auto_continues: config.max_auto_continues,
|
||||||
inject_todo_instructions: config.inject_todo_instructions,
|
inject_todo_instructions: config.inject_todo_instructions,
|
||||||
continuation_prompt: config.continuation_prompt,
|
continuation_prompt: config.continuation_prompt,
|
||||||
|
inject_skill_instructions: config.inject_skill_instructions,
|
||||||
|
skill_instructions: config.skill_instructions,
|
||||||
|
|
||||||
repl_prelude: config.repl_prelude,
|
repl_prelude: config.repl_prelude,
|
||||||
cmd_prelude: config.cmd_prelude,
|
cmd_prelude: config.cmd_prelude,
|
||||||
|
|||||||
+6
-2
@@ -6,7 +6,7 @@ mod install_remote;
|
|||||||
mod macros;
|
mod macros;
|
||||||
mod mcp_factory;
|
mod mcp_factory;
|
||||||
pub(crate) mod paths;
|
pub(crate) mod paths;
|
||||||
mod prompts;
|
pub(crate) mod prompts;
|
||||||
mod rag_cache;
|
mod rag_cache;
|
||||||
mod request_context;
|
mod request_context;
|
||||||
mod role;
|
mod role;
|
||||||
@@ -28,7 +28,7 @@ pub use self::app_state::AppState;
|
|||||||
pub use self::input::Input;
|
pub use self::input::Input;
|
||||||
pub use self::install_remote::{install_remote, install_remote_from_repl_args};
|
pub use self::install_remote::{install_remote, install_remote_from_repl_args};
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
pub use self::request_context::{RenderMode, RequestContext};
|
pub use self::request_context::{RenderMode, RequestContext, should_inject_skill_instructions};
|
||||||
pub use self::role::{
|
pub use self::role::{
|
||||||
CODE_ROLE, CREATE_TITLE_ROLE, EXPLAIN_SHELL_ROLE, Role, RoleLike, SHELL_ROLE,
|
CODE_ROLE, CREATE_TITLE_ROLE, EXPLAIN_SHELL_ROLE, Role, RoleLike, SHELL_ROLE,
|
||||||
};
|
};
|
||||||
@@ -214,6 +214,8 @@ pub struct Config {
|
|||||||
pub max_auto_continues: usize,
|
pub max_auto_continues: usize,
|
||||||
pub inject_todo_instructions: bool,
|
pub inject_todo_instructions: bool,
|
||||||
pub continuation_prompt: Option<String>,
|
pub continuation_prompt: Option<String>,
|
||||||
|
pub inject_skill_instructions: bool,
|
||||||
|
pub skill_instructions: Option<String>,
|
||||||
|
|
||||||
pub repl_prelude: Option<String>,
|
pub repl_prelude: Option<String>,
|
||||||
pub cmd_prelude: Option<String>,
|
pub cmd_prelude: Option<String>,
|
||||||
@@ -280,6 +282,8 @@ impl Default for Config {
|
|||||||
max_auto_continues: 10,
|
max_auto_continues: 10,
|
||||||
inject_todo_instructions: true,
|
inject_todo_instructions: true,
|
||||||
continuation_prompt: None,
|
continuation_prompt: None,
|
||||||
|
inject_skill_instructions: true,
|
||||||
|
skill_instructions: None,
|
||||||
|
|
||||||
repl_prelude: None,
|
repl_prelude: None,
|
||||||
cmd_prelude: None,
|
cmd_prelude: None,
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
use indoc::indoc;
|
use indoc::indoc;
|
||||||
|
|
||||||
|
pub(crate) const DEFAULT_SKILL_INSTRUCTIONS: &str = indoc! {"
|
||||||
|
## Skills
|
||||||
|
Specialized skills may be available in this context. Call `skill__list` early in a task to
|
||||||
|
discover any that match the work, then `skill__load` the relevant ones. Their instructions and
|
||||||
|
granted tools will become active for subsequent turns. Call `skill__unload` when their work is
|
||||||
|
complete to keep the context lean."
|
||||||
|
};
|
||||||
|
|
||||||
pub(in crate::config) const DEFAULT_TODO_INSTRUCTIONS: &str = indoc! {"
|
pub(in crate::config) const DEFAULT_TODO_INSTRUCTIONS: &str = indoc! {"
|
||||||
## Task Tracking
|
## Task Tracking
|
||||||
You have built-in task tracking tools. Use them to track your progress:
|
You have built-in task tracking tools. Use them to track your progress:
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ use indoc::formatdoc;
|
|||||||
use inquire::{Confirm, MultiSelect, Text, list_option::ListOption, validator::Validation};
|
use inquire::{Confirm, MultiSelect, Text, list_option::ListOption, validator::Validation};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
use prompts::DEFAULT_SKILL_INSTRUCTIONS;
|
||||||
use std::collections::{BTreeSet, HashMap, HashSet};
|
use std::collections::{BTreeSet, HashMap, HashSet};
|
||||||
use std::fs::{File, OpenOptions, read_dir, read_to_string, remove_dir_all, remove_file};
|
use std::fs::{File, OpenOptions, read_dir, read_to_string, remove_dir_all, remove_file};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
@@ -53,6 +54,20 @@ pub struct AutoContinueConfig {
|
|||||||
pub continuation_prompt: Option<String>,
|
pub continuation_prompt: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct SkillInstructionsConfig {
|
||||||
|
pub inject: bool,
|
||||||
|
pub instructions: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Must stay in sync with the predicate that registers `skill__*` tools in `rebuild_tool_scope`
|
||||||
|
/// (and in `graph::llm::run_llm_node`). Telling the model to call tools that are not exposed
|
||||||
|
/// is a footgun. `compatible_enabled` is the post-filter universe that `skill__list` would
|
||||||
|
/// actually return (cascade-allowed AND surviving `Skill::is_compatible` for current
|
||||||
|
/// `mcp_server_support`), so an empty set means the hint has nothing to point at.
|
||||||
|
pub fn should_inject_skill_instructions(app: &AppConfig, policy: &SkillPolicy) -> bool {
|
||||||
|
app.function_calling_support && policy.skills_enabled && !policy.compatible_enabled.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum RenderMode {
|
pub enum RenderMode {
|
||||||
#[default]
|
#[default]
|
||||||
@@ -634,9 +649,62 @@ impl RequestContext {
|
|||||||
self.agent.as_ref(),
|
self.agent.as_ref(),
|
||||||
self.session.as_ref(),
|
self.session.as_ref(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
if should_inject_skill_instructions(app, &policy) {
|
||||||
|
let config = self.skill_instructions_config();
|
||||||
|
|
||||||
|
if config.inject {
|
||||||
|
let separator = if role.is_empty_prompt() { "" } else { "\n\n" };
|
||||||
|
|
||||||
|
role.append_to_prompt(separator);
|
||||||
|
role.append_to_prompt(
|
||||||
|
config
|
||||||
|
.instructions
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or(DEFAULT_SKILL_INSTRUCTIONS),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(self.skill_registry.effective_role(&role, &policy))
|
Ok(self.skill_registry.effective_role(&role, &policy))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn skill_instructions_config(&self) -> SkillInstructionsConfig {
|
||||||
|
if let Some(agent) = &self.agent {
|
||||||
|
return SkillInstructionsConfig {
|
||||||
|
inject: agent.inject_skill_instructions(),
|
||||||
|
instructions: agent.skill_instructions_value(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let app = &self.app.config;
|
||||||
|
let inject = self
|
||||||
|
.session
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|s| s.inject_skill_instructions())
|
||||||
|
.or_else(|| {
|
||||||
|
self.role
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|r| r.inject_skill_instructions())
|
||||||
|
})
|
||||||
|
.unwrap_or(app.inject_skill_instructions);
|
||||||
|
let instructions = self
|
||||||
|
.session
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|s| s.skill_instructions().map(|v| v.to_string()))
|
||||||
|
.or_else(|| {
|
||||||
|
self.role
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|r| r.skill_instructions().map(|v| v.to_string()))
|
||||||
|
})
|
||||||
|
.or_else(|| app.skill_instructions.clone());
|
||||||
|
|
||||||
|
SkillInstructionsConfig {
|
||||||
|
inject,
|
||||||
|
instructions,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn auto_continue_config(&self) -> AutoContinueConfig {
|
pub fn auto_continue_config(&self) -> AutoContinueConfig {
|
||||||
if let Some(agent) = &self.agent {
|
if let Some(agent) = &self.agent {
|
||||||
return AutoContinueConfig {
|
return AutoContinueConfig {
|
||||||
@@ -1207,7 +1275,8 @@ impl RequestContext {
|
|||||||
.iter()
|
.iter()
|
||||||
.filter(|v| {
|
.filter(|v| {
|
||||||
(v.name.starts_with(USER_FUNCTION_PREFIX)
|
(v.name.starts_with(USER_FUNCTION_PREFIX)
|
||||||
|| v.name.starts_with(SKILL_FUNCTION_PREFIX))
|
|| (!matches!(role.skills_enabled(), Some(false))
|
||||||
|
&& v.name.starts_with(SKILL_FUNCTION_PREFIX)))
|
||||||
&& !existing.contains(&v.name)
|
&& !existing.contains(&v.name)
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned()
|
||||||
@@ -1707,7 +1776,7 @@ impl RequestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let value = match key {
|
let value = match key {
|
||||||
"continuation_prompt" => raw_value,
|
"continuation_prompt" | "skill_instructions" => raw_value,
|
||||||
_ => {
|
_ => {
|
||||||
if raw_value.contains(char::is_whitespace) {
|
if raw_value.contains(char::is_whitespace) {
|
||||||
bail!("Usage: .set <key> <value>. If value is null, unset key.");
|
bail!("Usage: .set <key> <value>. If value is null, unset key.");
|
||||||
@@ -1907,6 +1976,22 @@ impl RequestContext {
|
|||||||
self.update_app_config(|app| app.continuation_prompt = value);
|
self.update_app_config(|app| app.continuation_prompt = value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"inject_skill_instructions" => {
|
||||||
|
let value: bool = value.parse().with_context(|| "Invalid value")?;
|
||||||
|
if let Some(session) = self.session.as_mut() {
|
||||||
|
session.set_inject_skill_instructions(Some(value));
|
||||||
|
} else {
|
||||||
|
self.update_app_config(|app| app.inject_skill_instructions = value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"skill_instructions" => {
|
||||||
|
let value: Option<String> = super::parse_value(value)?;
|
||||||
|
if let Some(session) = self.session.as_mut() {
|
||||||
|
session.set_skill_instructions(value);
|
||||||
|
} else {
|
||||||
|
self.update_app_config(|app| app.skill_instructions = value);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => bail!("Unknown key '{key}'"),
|
_ => bail!("Unknown key '{key}'"),
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -2006,6 +2091,8 @@ impl RequestContext {
|
|||||||
"enabled_tools",
|
"enabled_tools",
|
||||||
"enabled_mcp_servers",
|
"enabled_mcp_servers",
|
||||||
"inject_todo_instructions",
|
"inject_todo_instructions",
|
||||||
|
"inject_skill_instructions",
|
||||||
|
"skill_instructions",
|
||||||
"max_auto_continues",
|
"max_auto_continues",
|
||||||
"save_session",
|
"save_session",
|
||||||
"compression_threshold",
|
"compression_threshold",
|
||||||
@@ -2172,6 +2259,11 @@ impl RequestContext {
|
|||||||
super::complete_bool(config.inject_instructions)
|
super::complete_bool(config.inject_instructions)
|
||||||
}
|
}
|
||||||
"continuation_prompt" => vec!["null".to_string()],
|
"continuation_prompt" => vec!["null".to_string()],
|
||||||
|
"inject_skill_instructions" => {
|
||||||
|
let config = self.skill_instructions_config();
|
||||||
|
super::complete_bool(config.inject)
|
||||||
|
}
|
||||||
|
"skill_instructions" => vec!["null".to_string()],
|
||||||
_ => vec![],
|
_ => vec![],
|
||||||
};
|
};
|
||||||
values = candidates.into_iter().map(|v| (v, None)).collect();
|
values = candidates.into_iter().map(|v| (v, None)).collect();
|
||||||
@@ -2981,11 +3073,12 @@ mod tests {
|
|||||||
use super::super::mcp_factory::McpFactory;
|
use super::super::mcp_factory::McpFactory;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::config::AppState;
|
use crate::config::AppState;
|
||||||
use crate::function::ToolCall;
|
use crate::function::{ToolCall, skill};
|
||||||
use crate::mcp::{McpServer, McpServersConfig, McpTransportType};
|
use crate::mcp::{McpServer, McpServersConfig, McpTransportType};
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
use crate::utils::get_env_name;
|
use crate::utils::get_env_name;
|
||||||
use crate::vault::Vault;
|
use crate::vault::Vault;
|
||||||
|
use serde_json::json;
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::{create_dir_all, remove_dir_all, write};
|
use std::fs::{create_dir_all, remove_dir_all, write};
|
||||||
@@ -3123,6 +3216,108 @@ mod tests {
|
|||||||
assert_eq!(extracted.name(), "");
|
assert_eq!(extracted.name(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_inject_skill_instructions_requires_function_calling() {
|
||||||
|
let app = AppConfig {
|
||||||
|
function_calling_support: false,
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let policy = SkillPolicy {
|
||||||
|
skills_enabled: true,
|
||||||
|
enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
compatible_enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(!should_inject_skill_instructions(&app, &policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_inject_skill_instructions_requires_skills_enabled() {
|
||||||
|
let app = AppConfig {
|
||||||
|
function_calling_support: true,
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let policy = SkillPolicy {
|
||||||
|
skills_enabled: false,
|
||||||
|
enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
compatible_enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(!should_inject_skill_instructions(&app, &policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_inject_skill_instructions_suppresses_when_no_compatible_skills() {
|
||||||
|
let app = AppConfig {
|
||||||
|
function_calling_support: true,
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
// `enabled` has names, but none survive the compatibility filter — hint must suppress.
|
||||||
|
let policy = SkillPolicy {
|
||||||
|
skills_enabled: true,
|
||||||
|
enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
compatible_enabled: Default::default(),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(!should_inject_skill_instructions(&app, &policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_inject_skill_instructions_when_all_conditions_met() {
|
||||||
|
let app = AppConfig {
|
||||||
|
function_calling_support: true,
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let policy = SkillPolicy {
|
||||||
|
skills_enabled: true,
|
||||||
|
enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
compatible_enabled: ["a".to_string()].into_iter().collect(),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(should_inject_skill_instructions(&app, &policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn skill_instructions_config_falls_back_to_app_default() {
|
||||||
|
let ctx = create_test_ctx();
|
||||||
|
|
||||||
|
let cfg = ctx.skill_instructions_config();
|
||||||
|
|
||||||
|
assert!(cfg.inject);
|
||||||
|
assert!(cfg.instructions.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn skill_instructions_config_respects_role_disable() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
let role = Role::new("r", "---\ninject_skill_instructions: false\n---\nhello");
|
||||||
|
ctx.use_role_obj(role).unwrap();
|
||||||
|
|
||||||
|
let cfg = ctx.skill_instructions_config();
|
||||||
|
|
||||||
|
assert!(!cfg.inject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn skill_instructions_config_session_overrides_role() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
let role = Role::new("r", "---\ninject_skill_instructions: false\n---\nhello");
|
||||||
|
ctx.use_role_obj(role).unwrap();
|
||||||
|
let mut session = Session::default();
|
||||||
|
session.set_inject_skill_instructions(Some(true));
|
||||||
|
session.set_skill_instructions(Some("custom hint".into()));
|
||||||
|
ctx.session = Some(session);
|
||||||
|
|
||||||
|
let cfg = ctx.skill_instructions_config();
|
||||||
|
|
||||||
|
assert!(cfg.inject);
|
||||||
|
assert_eq!(cfg.instructions.as_deref(), Some("custom hint"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn exit_session_clears_session() {
|
fn exit_session_clears_session() {
|
||||||
let mut ctx = create_test_ctx();
|
let mut ctx = create_test_ctx();
|
||||||
@@ -3448,6 +3643,182 @@ mod tests {
|
|||||||
assert!(!names.contains(&"todo__done"));
|
assert!(!names.contains(&"todo__done"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn select_functions_re_adds_skill_tools_when_role_skills_enabled_unset() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
ctx.tool_scope.functions.append_skill_functions();
|
||||||
|
|
||||||
|
let mut role = Role::new("r", "p");
|
||||||
|
role.set_enabled_tools(Some(vec!["foo".to_string()]));
|
||||||
|
|
||||||
|
let fns = ctx.select_functions(&role).unwrap();
|
||||||
|
let names: Vec<&str> = fns.iter().map(|f| f.name.as_str()).collect();
|
||||||
|
assert!(names.contains(&"skill__list"));
|
||||||
|
assert!(names.contains(&"skill__load"));
|
||||||
|
assert!(names.contains(&"skill__unload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn select_functions_suppresses_skill_tools_when_role_skills_enabled_false() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
ctx.tool_scope.functions.append_skill_functions();
|
||||||
|
ctx.tool_scope.functions.append_todo_functions();
|
||||||
|
|
||||||
|
let mut role = Role::new("r", "---\nskills_enabled: false\n---\np");
|
||||||
|
role.set_enabled_tools(Some(vec!["todo__init".to_string()]));
|
||||||
|
|
||||||
|
let fns = ctx.select_functions(&role).unwrap();
|
||||||
|
let names: Vec<&str> = fns.iter().map(|f| f.name.as_str()).collect();
|
||||||
|
assert!(names.contains(&"todo__init"));
|
||||||
|
assert!(!names.contains(&"skill__list"));
|
||||||
|
assert!(!names.contains(&"skill__load"));
|
||||||
|
assert!(!names.contains(&"skill__unload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn select_functions_still_re_adds_user_tools_when_role_skills_enabled_false() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
ctx.tool_scope.functions.append_user_interaction_functions();
|
||||||
|
ctx.tool_scope.functions.append_skill_functions();
|
||||||
|
|
||||||
|
let mut role = Role::new("r", "---\nskills_enabled: false\n---\np");
|
||||||
|
role.set_enabled_tools(Some(vec!["foo".to_string()]));
|
||||||
|
|
||||||
|
let fns = ctx.select_functions(&role).unwrap();
|
||||||
|
let names: Vec<&str> = fns.iter().map(|f| f.name.as_str()).collect();
|
||||||
|
assert!(names.contains(&"user__ask"));
|
||||||
|
assert!(!names.contains(&"skill__list"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn select_functions_re_adds_skill_tools_when_agent_skills_enabled_not_false() {
|
||||||
|
let _guard = TestConfigDirGuard::new();
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
let app = ctx.app.config.clone();
|
||||||
|
let agent_name = format!(
|
||||||
|
"test_skill_agent_{}",
|
||||||
|
SystemTime::now()
|
||||||
|
.duration_since(UNIX_EPOCH)
|
||||||
|
.unwrap()
|
||||||
|
.as_nanos()
|
||||||
|
);
|
||||||
|
let agent_dir = paths::agent_data_dir(&agent_name);
|
||||||
|
create_dir_all(&agent_dir).unwrap();
|
||||||
|
write(
|
||||||
|
agent_dir.join("graph.yaml"),
|
||||||
|
format!(
|
||||||
|
"name: {agent_name}\nversion: \"1.0\"\nstart: done\nnodes:\n done:\n type: end\n output: ok\n"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let abort = utils::create_abort_signal();
|
||||||
|
run_async(ctx.use_agent(&app, &agent_name, None, abort)).unwrap();
|
||||||
|
ctx.tool_scope.functions.append_skill_functions();
|
||||||
|
|
||||||
|
let mut role = Role::new("r", "p");
|
||||||
|
role.set_enabled_tools(Some(vec!["foo".to_string()]));
|
||||||
|
|
||||||
|
let fns = ctx.select_functions(&role).unwrap();
|
||||||
|
let names: Vec<&str> = fns.iter().map(|f| f.name.as_str()).collect();
|
||||||
|
assert!(names.contains(&"skill__list"));
|
||||||
|
assert!(names.contains(&"skill__load"));
|
||||||
|
assert!(names.contains(&"skill__unload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fork_for_branch_clones_skill_registry() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
let skill = Skill::new("shared", "---\nauto_unload: false\n---\nbody");
|
||||||
|
ctx.skill_registry.insert(skill).unwrap();
|
||||||
|
|
||||||
|
let fork = ctx.fork_for_branch();
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
fork.skill_registry.is_loaded("shared"),
|
||||||
|
"Parallel branches must share loaded skills with parent"
|
||||||
|
);
|
||||||
|
assert!(ctx.skill_registry.is_loaded("shared"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn handle_skill_tool_returns_error_when_skills_disabled() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
let role = Role::new("r", "---\nskills_enabled: false\n---\np");
|
||||||
|
ctx.use_role_obj(role).unwrap();
|
||||||
|
|
||||||
|
let result = run_async(skill::handle_skill_tool(
|
||||||
|
&mut ctx,
|
||||||
|
"skill__list",
|
||||||
|
&json!({}),
|
||||||
|
))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
result.get("error").is_some(),
|
||||||
|
"Expected error when skills are disabled, got: {result:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn handle_unload_returns_error_when_skill_not_loaded() {
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
|
||||||
|
let result = run_async(skill::handle_skill_tool(
|
||||||
|
&mut ctx,
|
||||||
|
"skill__unload",
|
||||||
|
&json!({"name": "ghost"}),
|
||||||
|
))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
result.get("error").is_some(),
|
||||||
|
"Expected error when unloading unloaded skill, got: {result:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn select_functions_suppresses_skill_tools_when_agent_skills_enabled_false() {
|
||||||
|
let _guard = TestConfigDirGuard::new();
|
||||||
|
let mut ctx = create_test_ctx();
|
||||||
|
let app = ctx.app.config.clone();
|
||||||
|
let agent_name = format!(
|
||||||
|
"test_skill_agent_off_{}",
|
||||||
|
SystemTime::now()
|
||||||
|
.duration_since(UNIX_EPOCH)
|
||||||
|
.unwrap()
|
||||||
|
.as_nanos()
|
||||||
|
);
|
||||||
|
let agent_dir = paths::agent_data_dir(&agent_name);
|
||||||
|
create_dir_all(&agent_dir).unwrap();
|
||||||
|
write(
|
||||||
|
agent_dir.join("graph.yaml"),
|
||||||
|
format!(
|
||||||
|
"name: {agent_name}\nversion: \"1.0\"\nstart: done\nnodes:\n done:\n type: end\n output: ok\n"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let abort = utils::create_abort_signal();
|
||||||
|
run_async(ctx.use_agent(&app, &agent_name, None, abort)).unwrap();
|
||||||
|
ctx.agent
|
||||||
|
.as_mut()
|
||||||
|
.expect("agent loaded")
|
||||||
|
.set_skills_enabled(Some(false));
|
||||||
|
ctx.tool_scope.functions.append_skill_functions();
|
||||||
|
|
||||||
|
let mut role = Role::new("r", "p");
|
||||||
|
role.set_enabled_tools(Some(vec!["foo".to_string()]));
|
||||||
|
|
||||||
|
let fns = ctx.select_functions(&role).unwrap();
|
||||||
|
let names: Vec<&str> = fns.iter().map(|f| f.name.as_str()).collect();
|
||||||
|
assert!(!names.contains(&"skill__list"));
|
||||||
|
assert!(!names.contains(&"skill__load"));
|
||||||
|
assert!(!names.contains(&"skill__unload"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn select_enabled_mcp_servers_returns_empty_when_mcp_disabled() {
|
fn select_enabled_mcp_servers_returns_empty_when_mcp_disabled() {
|
||||||
let app_state = {
|
let app_state = {
|
||||||
@@ -3677,8 +4048,7 @@ mod tests {
|
|||||||
|
|
||||||
let input = Input::from_str(&ctx, "hello", None).unwrap();
|
let input = Input::from_str(&ctx, "hello", None).unwrap();
|
||||||
let app = Arc::clone(&ctx.app.config);
|
let app = Arc::clone(&ctx.app.config);
|
||||||
let tool_result =
|
let tool_result = ToolResult::new(crate::function::ToolCall::default(), json!({}));
|
||||||
ToolResult::new(crate::function::ToolCall::default(), serde_json::json!({}));
|
|
||||||
ctx.after_chat_completion(app.as_ref(), &input, "", &[tool_result])
|
ctx.after_chat_completion(app.as_ref(), &input, "", &[tool_result])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ pub struct Role {
|
|||||||
inject_todo_instructions: Option<bool>,
|
inject_todo_instructions: Option<bool>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
continuation_prompt: Option<String>,
|
continuation_prompt: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
inject_skill_instructions: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
skill_instructions: Option<String>,
|
||||||
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
model: Model,
|
model: Model,
|
||||||
@@ -124,6 +128,10 @@ impl Role {
|
|||||||
"continuation_prompt" => {
|
"continuation_prompt" => {
|
||||||
role.continuation_prompt = value.as_str().map(|v| v.to_string())
|
role.continuation_prompt = value.as_str().map(|v| v.to_string())
|
||||||
}
|
}
|
||||||
|
"inject_skill_instructions" => role.inject_skill_instructions = value.as_bool(),
|
||||||
|
"skill_instructions" => {
|
||||||
|
role.skill_instructions = value.as_str().map(|v| v.to_string())
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,6 +197,14 @@ impl Role {
|
|||||||
if let Some(continuation_prompt) = &self.continuation_prompt {
|
if let Some(continuation_prompt) = &self.continuation_prompt {
|
||||||
metadata.push(format!("continuation_prompt: {continuation_prompt}"));
|
metadata.push(format!("continuation_prompt: {continuation_prompt}"));
|
||||||
}
|
}
|
||||||
|
if let Some(inject_skill_instructions) = self.inject_skill_instructions {
|
||||||
|
metadata.push(format!(
|
||||||
|
"inject_skill_instructions: {inject_skill_instructions}"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if let Some(skill_instructions) = &self.skill_instructions {
|
||||||
|
metadata.push(format!("skill_instructions: {skill_instructions}"));
|
||||||
|
}
|
||||||
if metadata.is_empty() {
|
if metadata.is_empty() {
|
||||||
format!("{}\n", self.prompt)
|
format!("{}\n", self.prompt)
|
||||||
} else if self.prompt.is_empty() {
|
} else if self.prompt.is_empty() {
|
||||||
@@ -299,6 +315,14 @@ impl Role {
|
|||||||
self.continuation_prompt.as_deref()
|
self.continuation_prompt.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn inject_skill_instructions(&self) -> Option<bool> {
|
||||||
|
self.inject_skill_instructions
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skill_instructions(&self) -> Option<&str> {
|
||||||
|
self.skill_instructions.as_deref()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn skills_enabled(&self) -> Option<bool> {
|
pub fn skills_enabled(&self) -> Option<bool> {
|
||||||
self.skills_enabled
|
self.skills_enabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ pub struct Session {
|
|||||||
inject_todo_instructions: Option<bool>,
|
inject_todo_instructions: Option<bool>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
continuation_prompt: Option<String>,
|
continuation_prompt: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
inject_skill_instructions: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
skill_instructions: Option<String>,
|
||||||
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
role_name: Option<String>,
|
role_name: Option<String>,
|
||||||
@@ -227,6 +231,12 @@ impl Session {
|
|||||||
if let Some(continuation_prompt) = self.continuation_prompt() {
|
if let Some(continuation_prompt) = self.continuation_prompt() {
|
||||||
data["continuation_prompt"] = continuation_prompt.into();
|
data["continuation_prompt"] = continuation_prompt.into();
|
||||||
}
|
}
|
||||||
|
if let Some(inject_skill_instructions) = self.inject_skill_instructions() {
|
||||||
|
data["inject_skill_instructions"] = inject_skill_instructions.into();
|
||||||
|
}
|
||||||
|
if let Some(skill_instructions) = self.skill_instructions() {
|
||||||
|
data["skill_instructions"] = skill_instructions.into();
|
||||||
|
}
|
||||||
let (tokens, percent) = self.tokens_usage();
|
let (tokens, percent) = self.tokens_usage();
|
||||||
data["total_tokens"] = tokens.into();
|
data["total_tokens"] = tokens.into();
|
||||||
if let Some(max_input_tokens) = self.model().max_input_tokens() {
|
if let Some(max_input_tokens) = self.model().max_input_tokens() {
|
||||||
@@ -305,6 +315,15 @@ impl Session {
|
|||||||
if let Some(continuation_prompt) = self.continuation_prompt() {
|
if let Some(continuation_prompt) = self.continuation_prompt() {
|
||||||
items.push(("continuation_prompt", continuation_prompt.to_string()));
|
items.push(("continuation_prompt", continuation_prompt.to_string()));
|
||||||
}
|
}
|
||||||
|
if let Some(inject_skill_instructions) = self.inject_skill_instructions() {
|
||||||
|
items.push((
|
||||||
|
"inject_skill_instructions",
|
||||||
|
inject_skill_instructions.to_string(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if let Some(skill_instructions) = self.skill_instructions() {
|
||||||
|
items.push(("skill_instructions", skill_instructions.to_string()));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(max_input_tokens) = self.model().max_input_tokens() {
|
if let Some(max_input_tokens) = self.model().max_input_tokens() {
|
||||||
items.push(("max_input_tokens", max_input_tokens.to_string()));
|
items.push(("max_input_tokens", max_input_tokens.to_string()));
|
||||||
@@ -446,6 +465,14 @@ impl Session {
|
|||||||
self.continuation_prompt.as_deref()
|
self.continuation_prompt.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn inject_skill_instructions(&self) -> Option<bool> {
|
||||||
|
self.inject_skill_instructions
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skill_instructions(&self) -> Option<&str> {
|
||||||
|
self.skill_instructions.as_deref()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_inject_todo_instructions(&mut self, value: Option<bool>) {
|
pub fn set_inject_todo_instructions(&mut self, value: Option<bool>) {
|
||||||
if self.inject_todo_instructions != value {
|
if self.inject_todo_instructions != value {
|
||||||
self.inject_todo_instructions = value;
|
self.inject_todo_instructions = value;
|
||||||
@@ -460,6 +487,20 @@ impl Session {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_inject_skill_instructions(&mut self, value: Option<bool>) {
|
||||||
|
if self.inject_skill_instructions != value {
|
||||||
|
self.inject_skill_instructions = value;
|
||||||
|
self.dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_skill_instructions(&mut self, value: Option<String>) {
|
||||||
|
if self.skill_instructions != value {
|
||||||
|
self.skill_instructions = value;
|
||||||
|
self.dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn needs_compression(&self, global_compression_threshold: usize) -> bool {
|
pub fn needs_compression(&self, global_compression_threshold: usize) -> bool {
|
||||||
if self.compressing {
|
if self.compressing {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+251
-29
@@ -3,14 +3,16 @@ use super::app_config::AppConfig;
|
|||||||
use super::paths;
|
use super::paths;
|
||||||
use super::role::Role;
|
use super::role::Role;
|
||||||
use super::session::Session;
|
use super::session::Session;
|
||||||
|
use super::skill::Skill;
|
||||||
|
|
||||||
use anyhow::{Result, anyhow, bail};
|
use anyhow::{Result, anyhow, bail};
|
||||||
use std::collections::HashSet;
|
use std::collections::{BTreeSet, HashSet};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SkillPolicy {
|
pub struct SkillPolicy {
|
||||||
pub skills_enabled: bool,
|
pub skills_enabled: bool,
|
||||||
pub enabled: HashSet<String>,
|
pub enabled: HashSet<String>,
|
||||||
|
pub compatible_enabled: BTreeSet<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SkillPolicy {
|
impl SkillPolicy {
|
||||||
@@ -27,20 +29,27 @@ impl SkillPolicy {
|
|||||||
session,
|
session,
|
||||||
&paths::has_skill,
|
&paths::has_skill,
|
||||||
&paths::list_skills,
|
&paths::list_skills,
|
||||||
|
&|name, mcp_on| {
|
||||||
|
Skill::load(name)
|
||||||
|
.map(|s| s.is_compatible(mcp_on))
|
||||||
|
.unwrap_or(false)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn effective_with<F, G>(
|
fn effective_with<F, G, H>(
|
||||||
global: &AppConfig,
|
global: &AppConfig,
|
||||||
role: Option<&Role>,
|
role: Option<&Role>,
|
||||||
agent: Option<&Agent>,
|
agent: Option<&Agent>,
|
||||||
session: Option<&Session>,
|
session: Option<&Session>,
|
||||||
skill_exists: &F,
|
skill_exists: &F,
|
||||||
list_installed: &G,
|
list_installed: &G,
|
||||||
|
skill_is_compatible: &H,
|
||||||
) -> Result<Self>
|
) -> Result<Self>
|
||||||
where
|
where
|
||||||
F: Fn(&str) -> bool,
|
F: Fn(&str) -> bool,
|
||||||
G: Fn() -> Vec<String>,
|
G: Fn() -> Vec<String>,
|
||||||
|
H: Fn(&str, bool) -> bool,
|
||||||
{
|
{
|
||||||
let mut skills_enabled = global.skills_enabled;
|
let mut skills_enabled = global.skills_enabled;
|
||||||
if let Some(r) = role
|
if let Some(r) = role
|
||||||
@@ -104,9 +113,21 @@ impl SkillPolicy {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let compatible_enabled: BTreeSet<String> = if skills_enabled {
|
||||||
|
let mcp_on = global.mcp_server_support;
|
||||||
|
enabled
|
||||||
|
.iter()
|
||||||
|
.filter(|name| skill_is_compatible(name, mcp_on))
|
||||||
|
.cloned()
|
||||||
|
.collect()
|
||||||
|
} else {
|
||||||
|
BTreeSet::new()
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
skills_enabled,
|
skills_enabled,
|
||||||
enabled,
|
enabled,
|
||||||
|
compatible_enabled,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,6 +149,10 @@ mod tests {
|
|||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn all_compatible(_: &str, _: bool) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
fn make_app_config(
|
fn make_app_config(
|
||||||
skills_enabled: bool,
|
skills_enabled: bool,
|
||||||
enabled: Option<&str>,
|
enabled: Option<&str>,
|
||||||
@@ -145,9 +170,16 @@ mod tests {
|
|||||||
fn defaults_yield_skills_enabled_with_empty_universe() {
|
fn defaults_yield_skills_enabled_with_empty_universe() {
|
||||||
let global = AppConfig::default();
|
let global = AppConfig::default();
|
||||||
|
|
||||||
let policy =
|
let policy = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &always_true, &empty_installed)
|
&global,
|
||||||
.unwrap();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert!(policy.skills_enabled);
|
assert!(policy.skills_enabled);
|
||||||
assert!(policy.enabled.is_empty());
|
assert!(policy.enabled.is_empty());
|
||||||
@@ -158,9 +190,16 @@ mod tests {
|
|||||||
let global = AppConfig::default();
|
let global = AppConfig::default();
|
||||||
let installed = || vec!["alpha".to_string(), "beta".to_string()];
|
let installed = || vec!["alpha".to_string(), "beta".to_string()];
|
||||||
|
|
||||||
let policy =
|
let policy = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &always_true, &installed)
|
&global,
|
||||||
.unwrap();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(policy.enabled.len(), 2);
|
assert_eq!(policy.enabled.len(), 2);
|
||||||
assert!(policy.enabled.contains("alpha"));
|
assert!(policy.enabled.contains("alpha"));
|
||||||
@@ -171,9 +210,16 @@ mod tests {
|
|||||||
fn falls_back_to_visible_when_visible_set_but_no_enabled() {
|
fn falls_back_to_visible_when_visible_set_but_no_enabled() {
|
||||||
let global = make_app_config(true, None, Some(&["alpha", "beta"]));
|
let global = make_app_config(true, None, Some(&["alpha", "beta"]));
|
||||||
|
|
||||||
let policy =
|
let policy = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &always_true, &empty_installed)
|
&global,
|
||||||
.unwrap();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(policy.enabled.len(), 2);
|
assert_eq!(policy.enabled.len(), 2);
|
||||||
assert!(policy.enabled.contains("alpha"));
|
assert!(policy.enabled.contains("alpha"));
|
||||||
@@ -184,9 +230,16 @@ mod tests {
|
|||||||
fn global_enabled_skills_is_effective_when_no_other_levels() {
|
fn global_enabled_skills_is_effective_when_no_other_levels() {
|
||||||
let global = make_app_config(true, Some("alpha,beta"), Some(&["alpha", "beta", "gamma"]));
|
let global = make_app_config(true, Some("alpha,beta"), Some(&["alpha", "beta", "gamma"]));
|
||||||
|
|
||||||
let policy =
|
let policy = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &always_true, &empty_installed)
|
&global,
|
||||||
.unwrap();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert!(policy.enabled.contains("alpha"));
|
assert!(policy.enabled.contains("alpha"));
|
||||||
assert!(policy.enabled.contains("beta"));
|
assert!(policy.enabled.contains("beta"));
|
||||||
@@ -205,6 +258,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
&always_true,
|
&always_true,
|
||||||
&empty_installed,
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@@ -224,6 +278,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
&always_true,
|
&always_true,
|
||||||
&empty_installed,
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@@ -237,9 +292,15 @@ mod tests {
|
|||||||
..AppConfig::default()
|
..AppConfig::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let policy = SkillPolicy::effective_with(&global, None, None, None, &always_true, &|| {
|
let policy = SkillPolicy::effective_with(
|
||||||
vec!["alpha".to_string()]
|
&global,
|
||||||
})
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&|| vec!["alpha".to_string()],
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert!(!policy.allows("alpha"));
|
assert!(!policy.allows("alpha"));
|
||||||
@@ -249,9 +310,16 @@ mod tests {
|
|||||||
fn allows_returns_true_when_skill_in_enabled_set() {
|
fn allows_returns_true_when_skill_in_enabled_set() {
|
||||||
let global = make_app_config(true, Some("alpha"), None);
|
let global = make_app_config(true, Some("alpha"), None);
|
||||||
|
|
||||||
let policy =
|
let policy = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &always_true, &empty_installed)
|
&global,
|
||||||
.unwrap();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert!(policy.allows("alpha"));
|
assert!(policy.allows("alpha"));
|
||||||
assert!(!policy.allows("beta"));
|
assert!(!policy.allows("beta"));
|
||||||
@@ -261,9 +329,16 @@ mod tests {
|
|||||||
fn validation_rejects_uninstalled_skill_reference() {
|
fn validation_rejects_uninstalled_skill_reference() {
|
||||||
let global = make_app_config(true, Some("ghost"), None);
|
let global = make_app_config(true, Some("ghost"), None);
|
||||||
|
|
||||||
let err =
|
let err = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &|_| false, &empty_installed)
|
&global,
|
||||||
.unwrap_err();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&|_| false,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap_err();
|
||||||
|
|
||||||
assert!(err.to_string().contains("not installed"));
|
assert!(err.to_string().contains("not installed"));
|
||||||
assert!(err.to_string().contains("ghost"));
|
assert!(err.to_string().contains("ghost"));
|
||||||
@@ -273,9 +348,16 @@ mod tests {
|
|||||||
fn validation_rejects_skill_not_in_visible_set() {
|
fn validation_rejects_skill_not_in_visible_set() {
|
||||||
let global = make_app_config(true, Some("beta"), Some(&["alpha"]));
|
let global = make_app_config(true, Some("beta"), Some(&["alpha"]));
|
||||||
|
|
||||||
let err =
|
let err = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &always_true, &empty_installed)
|
&global,
|
||||||
.unwrap_err();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap_err();
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
err.to_string()
|
err.to_string()
|
||||||
@@ -288,9 +370,16 @@ mod tests {
|
|||||||
fn validation_skipped_when_no_explicit_enabled_skills() {
|
fn validation_skipped_when_no_explicit_enabled_skills() {
|
||||||
let global = make_app_config(true, None, None);
|
let global = make_app_config(true, None, None);
|
||||||
|
|
||||||
let policy =
|
let policy = SkillPolicy::effective_with(
|
||||||
SkillPolicy::effective_with(&global, None, None, None, &|_| false, &empty_installed)
|
&global,
|
||||||
.unwrap();
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&|_| false,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert!(policy.enabled.is_empty());
|
assert!(policy.enabled.is_empty());
|
||||||
}
|
}
|
||||||
@@ -307,9 +396,142 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
&always_true,
|
&always_true,
|
||||||
&empty_installed,
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert!(policy.enabled.is_empty());
|
assert!(policy.enabled.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn compatible_enabled_is_empty_when_skills_disabled() {
|
||||||
|
let global = AppConfig {
|
||||||
|
skills_enabled: false,
|
||||||
|
enabled_skills: Some(vec!["alpha".into()]),
|
||||||
|
visible_skills: Some(vec!["alpha".into()]),
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let policy = SkillPolicy::effective_with(
|
||||||
|
&global,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(!policy.skills_enabled);
|
||||||
|
assert!(policy.compatible_enabled.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn compatible_enabled_short_circuits_callback_when_skills_disabled() {
|
||||||
|
use std::cell::Cell;
|
||||||
|
let global = AppConfig {
|
||||||
|
skills_enabled: false,
|
||||||
|
enabled_skills: Some(vec!["alpha".into()]),
|
||||||
|
visible_skills: Some(vec!["alpha".into()]),
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
let invoked = Cell::new(0u32);
|
||||||
|
let counting = |_: &str, _: bool| {
|
||||||
|
invoked.set(invoked.get() + 1);
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
SkillPolicy::effective_with(
|
||||||
|
&global,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&counting,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
invoked.get(),
|
||||||
|
0,
|
||||||
|
"skill_is_compatible callback must not run when skills are disabled"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn compatible_enabled_includes_all_when_callback_passes() {
|
||||||
|
let global = make_app_config(true, Some("alpha,beta"), Some(&["alpha", "beta"]));
|
||||||
|
|
||||||
|
let policy = SkillPolicy::effective_with(
|
||||||
|
&global,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&all_compatible,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(policy.compatible_enabled.len(), 2);
|
||||||
|
assert!(policy.compatible_enabled.contains("alpha"));
|
||||||
|
assert!(policy.compatible_enabled.contains("beta"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn compatible_enabled_excludes_incompatible_skills() {
|
||||||
|
let global = make_app_config(true, Some("alpha,beta"), Some(&["alpha", "beta"]));
|
||||||
|
let only_alpha_compat = |name: &str, _: bool| name == "alpha";
|
||||||
|
|
||||||
|
let policy = SkillPolicy::effective_with(
|
||||||
|
&global,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&only_alpha_compat,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(policy.compatible_enabled.contains("alpha"));
|
||||||
|
assert!(!policy.compatible_enabled.contains("beta"));
|
||||||
|
assert_eq!(policy.compatible_enabled.len(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn compatible_enabled_passes_mcp_flag_to_callback() {
|
||||||
|
use std::cell::Cell;
|
||||||
|
let global = AppConfig {
|
||||||
|
skills_enabled: true,
|
||||||
|
mcp_server_support: false,
|
||||||
|
enabled_skills: Some(vec!["alpha".into()]),
|
||||||
|
visible_skills: Some(vec!["alpha".into()]),
|
||||||
|
..AppConfig::default()
|
||||||
|
};
|
||||||
|
let observed_mcp = Cell::new(None::<bool>);
|
||||||
|
let capture = |_: &str, mcp_on: bool| {
|
||||||
|
observed_mcp.set(Some(mcp_on));
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
SkillPolicy::effective_with(
|
||||||
|
&global,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
&always_true,
|
||||||
|
&empty_installed,
|
||||||
|
&capture,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
observed_mcp.get(),
|
||||||
|
Some(false),
|
||||||
|
"callback must receive mcp_server_support flag from AppConfig"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ impl SkillRegistry {
|
|||||||
let policy = SkillPolicy {
|
let policy = SkillPolicy {
|
||||||
skills_enabled: true,
|
skills_enabled: true,
|
||||||
enabled: self.loaded.keys().cloned().collect(),
|
enabled: self.loaded.keys().cloned().collect(),
|
||||||
|
compatible_enabled: self.loaded.keys().cloned().collect(),
|
||||||
};
|
};
|
||||||
self.effective_role(base, &policy)
|
self.effective_role(base, &policy)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-15
@@ -14,9 +14,11 @@ pub fn skill_function_declarations() -> Vec<FunctionDeclaration> {
|
|||||||
FunctionDeclaration {
|
FunctionDeclaration {
|
||||||
name: format!("{SKILL_FUNCTION_PREFIX}list"),
|
name: format!("{SKILL_FUNCTION_PREFIX}list"),
|
||||||
description:
|
description:
|
||||||
"List skills available in this context. Returns each skill's name, description, \
|
"List skills available in this context. Call this early in any non-trivial task to \
|
||||||
what tools and MCP servers it grants on load, and whether it is currently loaded. \
|
discover specialized skills that may apply to the work before deciding on an \
|
||||||
Call this to discover skills before using skill__load."
|
approach. Returns each skill's name, description, what tools and MCP servers it \
|
||||||
|
grants on load, and whether it is currently loaded. Pair with `skill__load` to \
|
||||||
|
activate the skills you choose."
|
||||||
.to_string(),
|
.to_string(),
|
||||||
parameters: JsonSchema {
|
parameters: JsonSchema {
|
||||||
type_value: Some("object".to_string()),
|
type_value: Some("object".to_string()),
|
||||||
@@ -28,9 +30,10 @@ pub fn skill_function_declarations() -> Vec<FunctionDeclaration> {
|
|||||||
FunctionDeclaration {
|
FunctionDeclaration {
|
||||||
name: format!("{SKILL_FUNCTION_PREFIX}load"),
|
name: format!("{SKILL_FUNCTION_PREFIX}load"),
|
||||||
description:
|
description:
|
||||||
"Load a skill module into the current context. The skill's instructions and any \
|
"Load a skill module into the current context after confirming via `skill__list` \
|
||||||
tools or MCP servers it grants become active for subsequent turns. Call \
|
that it applies to the task at hand. The skill's instructions and any tools or \
|
||||||
skill__unload when the skill's work is complete to keep the context lean."
|
MCP servers it grants become active for subsequent turns. Call `skill__unload` \
|
||||||
|
when the skill's work is complete to keep the context lean."
|
||||||
.to_string(),
|
.to_string(),
|
||||||
parameters: JsonSchema {
|
parameters: JsonSchema {
|
||||||
type_value: Some("object".to_string()),
|
type_value: Some("object".to_string()),
|
||||||
@@ -102,8 +105,6 @@ pub async fn handle_skill_tool(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_list(ctx: &RequestContext, policy: &SkillPolicy) -> Result<Value> {
|
fn handle_list(ctx: &RequestContext, policy: &SkillPolicy) -> Result<Value> {
|
||||||
let mcp_on = ctx.app.config.mcp_server_support;
|
|
||||||
|
|
||||||
let visible_names: Vec<String> = match ctx.app.config.visible_skills.as_deref() {
|
let visible_names: Vec<String> = match ctx.app.config.visible_skills.as_deref() {
|
||||||
Some(list) => list.to_vec(),
|
Some(list) => list.to_vec(),
|
||||||
None => paths::list_skills(),
|
None => paths::list_skills(),
|
||||||
@@ -111,7 +112,7 @@ fn handle_list(ctx: &RequestContext, policy: &SkillPolicy) -> Result<Value> {
|
|||||||
|
|
||||||
let mut entries = Vec::new();
|
let mut entries = Vec::new();
|
||||||
for name in visible_names {
|
for name in visible_names {
|
||||||
if !policy.allows(&name) {
|
if !policy.compatible_enabled.contains(&name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,12 +123,6 @@ fn handle_list(ctx: &RequestContext, policy: &SkillPolicy) -> Result<Value> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if !skill.is_compatible(mcp_on) {
|
|
||||||
warn!(
|
|
||||||
"Skill '{name}' filtered from list: declares MCP servers but MCP support is disabled"
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
entries.push(json!({
|
entries.push(json!({
|
||||||
"name": skill.name(),
|
"name": skill.name(),
|
||||||
|
|||||||
+31
-1
@@ -2,7 +2,10 @@ use super::state::StateManager;
|
|||||||
use super::structured;
|
use super::structured;
|
||||||
use super::types::LlmNode;
|
use super::types::LlmNode;
|
||||||
use crate::client::{Model, ModelType, call_chat_completions};
|
use crate::client::{Model, ModelType, call_chat_completions};
|
||||||
use crate::config::{Input, RequestContext, Role, RoleLike, SkillPolicy};
|
use crate::config::prompts::DEFAULT_SKILL_INSTRUCTIONS;
|
||||||
|
use crate::config::{
|
||||||
|
Input, RequestContext, Role, RoleLike, SkillPolicy, should_inject_skill_instructions,
|
||||||
|
};
|
||||||
use crate::function::skill::skill_function_declarations;
|
use crate::function::skill::skill_function_declarations;
|
||||||
use crate::utils::create_abort_signal;
|
use crate::utils::create_abort_signal;
|
||||||
use anyhow::{Context, Error, Result, anyhow, bail};
|
use anyhow::{Context, Error, Result, anyhow, bail};
|
||||||
@@ -139,6 +142,31 @@ async fn run(
|
|||||||
role.set_enabled_tools(Some(tools));
|
role.set_enabled_tools(Some(tools));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if should_inject_skill_instructions(&parent_ctx.app.config, &policy) {
|
||||||
|
let app = &parent_ctx.app.config;
|
||||||
|
let agent = parent_ctx.agent.as_ref();
|
||||||
|
let inject = node
|
||||||
|
.inject_skill_instructions
|
||||||
|
.or_else(|| agent.map(|a| a.inject_skill_instructions()))
|
||||||
|
.unwrap_or(app.inject_skill_instructions);
|
||||||
|
|
||||||
|
if inject {
|
||||||
|
let instructions = node
|
||||||
|
.skill_instructions
|
||||||
|
.clone()
|
||||||
|
.or_else(|| agent.and_then(|a| a.skill_instructions_value()))
|
||||||
|
.or_else(|| app.skill_instructions.clone());
|
||||||
|
let separator = if role.is_empty_prompt() { "" } else { "\n\n" };
|
||||||
|
|
||||||
|
role.append_to_prompt(separator);
|
||||||
|
role.append_to_prompt(
|
||||||
|
instructions
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or(DEFAULT_SKILL_INSTRUCTIONS),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let composed_role = parent_ctx.skill_registry.effective_role(&role, &policy);
|
let composed_role = parent_ctx.skill_registry.effective_role(&role, &policy);
|
||||||
|
|
||||||
let saved_role = parent_ctx.role.clone();
|
let saved_role = parent_ctx.role.clone();
|
||||||
@@ -456,6 +484,8 @@ mod tests {
|
|||||||
timeout: None,
|
timeout: None,
|
||||||
skills_enabled: None,
|
skills_enabled: None,
|
||||||
enabled_skills: None,
|
enabled_skills: None,
|
||||||
|
inject_skill_instructions: None,
|
||||||
|
skill_instructions: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ pub struct Graph {
|
|||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub enabled_skills: Option<Vec<String>>,
|
pub enabled_skills: Option<Vec<String>>,
|
||||||
|
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub inject_skill_instructions: Option<bool>,
|
||||||
|
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub skill_instructions: Option<String>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub conversation_starters: Vec<String>,
|
pub conversation_starters: Vec<String>,
|
||||||
|
|
||||||
@@ -305,6 +311,12 @@ pub struct LlmNode {
|
|||||||
|
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub enabled_skills: Option<Vec<String>>,
|
pub enabled_skills: Option<Vec<String>>,
|
||||||
|
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub inject_skill_instructions: Option<bool>,
|
||||||
|
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub skill_instructions: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_llm_max_attempts() -> u32 {
|
fn default_llm_max_attempts() -> u32 {
|
||||||
|
|||||||
@@ -950,6 +950,8 @@ mod tests {
|
|||||||
mcp_servers: Vec::new(),
|
mcp_servers: Vec::new(),
|
||||||
skills_enabled: None,
|
skills_enabled: None,
|
||||||
enabled_skills: None,
|
enabled_skills: None,
|
||||||
|
inject_skill_instructions: None,
|
||||||
|
skill_instructions: None,
|
||||||
conversation_starters: Vec::new(),
|
conversation_starters: Vec::new(),
|
||||||
variables: Vec::new(),
|
variables: Vec::new(),
|
||||||
settings: GraphSettings::default(),
|
settings: GraphSettings::default(),
|
||||||
@@ -1051,6 +1053,8 @@ mod tests {
|
|||||||
timeout: None,
|
timeout: None,
|
||||||
skills_enabled: None,
|
skills_enabled: None,
|
||||||
enabled_skills: None,
|
enabled_skills: None,
|
||||||
|
inject_skill_instructions: None,
|
||||||
|
skill_instructions: None,
|
||||||
}),
|
}),
|
||||||
next: next.map(NextTargets::from),
|
next: next.map(NextTargets::from),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user