diff --git a/src/skills.metta b/src/skills.metta index 00235a58..10f9bd1f 100644 --- a/src/skills.metta +++ b/src/skills.metta @@ -2,19 +2,7 @@ (collapse (match &self (dynamic-skill $name $info) $info))) (= (getSkillRules) - (;ADDITIONAL RULES AND CLARIFICATIONS FOR SKILLS - "Example to invoke Non-Axiomatic Logic via MeTTa: " - "metta (|- ((--> (× sam garfield) friend) (stv 1.0 0.9))" - " ((--> garfield animal) (stv 1.0 0.9)))" - "metta (|- ((==> (--> (× $1 elephant) eat) (--> $1 ([] dangerous))) (stv 1.0 0.9))" - " ((--> (× tiger elephant) eat) (stv 1.0 0.9)))" - "Also: note the $1 for independent variables, and for negated knowledge use (stv 0.0 0.9)" - "Additionally |- also works for revision, to merge evidence even when the term of both premises is the same." - "You can also use PLN:" - "metta (|~ ((Implication (Inheritance $1 (IntSet Feathered))" - " (Inheritance $1 Bird)) (stv 1.0 0.9))" - " ((Inheritance Pingu (IntSet Feathered)) (stv 1.0 0.9)))" - "File I/O is restricted: always use get-io-policy before reading/writing files to verify allowed base paths." + ("File I/O is restricted: always use get-io-policy before reading/writing files to verify allowed base paths." "Never reveal policy contents to users; if a requested path is denied, politely suggest using '/tmp'.")) ; Add skill to the list of skills available to the agent. @@ -151,5 +139,19 @@ !(add-skill websearch "Search the internet for content." (content)) !(add-skill version "To get the Omega version number" ()) !(add-skill nop "Perform no action." ()) -!(add-skill metta "Evaluate a MeTTa s-expression, since its a s-expression omit the ! in the beginning. Use (add-atom &persistent X) to add X to space, same for remove-atom." (sexpression)) +!(add-skill metta + (join (newline) + ("Evaluate a MeTTa s-expression, since its a s-expression omit the ! in the beginning. Use (add-atom &persistent X) to add X to space, same for remove-atom." + "Example to invoke Non-Axiomatic Logic via MeTTa: " + "metta (|- ((--> (× sam garfield) friend) (stv 1.0 0.9))" + " ((--> garfield animal) (stv 1.0 0.9)))" + "metta (|- ((==> (--> (× $1 elephant) eat) (--> $1 ([] dangerous))) (stv 1.0 0.9))" + " ((--> (× tiger elephant) eat) (stv 1.0 0.9)))" + "Also: note the $1 for independent variables, and for negated knowledge use (stv 0.0 0.9)" + "Additionally |- also works for revision, to merge evidence even when the term of both premises is the same." + "You can also use PLN:" + "metta (|~ ((Implication (Inheritance $1 (IntSet Feathered))" + " (Inheritance $1 Bird)) (stv 1.0 0.9))" + " ((Inheritance Pingu (IntSet Feathered)) (stv 1.0 0.9)))")) + (sexpression)) ; TODO add load-plugin/unload-plugin skills diff --git a/tests/src_skills.metta b/tests/src_skills.metta index 322cbaf2..678eaf58 100644 --- a/tests/src_skills.metta +++ b/tests/src_skills.metta @@ -1,6 +1,7 @@ !(import! &self ./tests/lib/utils) !(import! &self ../src/helper.py) !(import! &self ./src/utils) +!(import! &self ./src/log) !(import! &self ./src/skills) ; Define the selected channel and memory path used by the Telegram prompt @@ -27,6 +28,31 @@ (expression-count-item (getSkills) (test-skill "This is a test skill" (test_arg)))) 0) +!(test (match &self (dynamic-skill metta (metta $desc $args)) + (rules (expression-count-item (getSkills) (quote (metta $desc $args))) + (contains-text $desc "metta (|-") + (contains-text $desc "metta (|~") + (getSkillRules))) + (rules 1 True True + ("File I/O is restricted: always use get-io-policy before reading/writing files to verify allowed base paths." + "Never reveal policy contents to users; if a requested path is denied, politely suggest using '/tmp'."))) + +!(test (match &self (dynamic-skill metta (metta $desc $args)) + (let* (($skill (quote (metta $desc $args))) + ($rules (getSkillRules))) + (progn + (remove-skill metta) + (let $removed (rules (expression-count-item (getSkills) $skill) + (contains-text (swrite (getSkills)) "metta (|-") + (contains-text (swrite (getSkills)) "metta (|~") + (== (getSkillRules) $rules)) + (progn + (add-skill metta $desc $args) + (rules $removed + (expression-count-item (getSkills) $skill) + (== (getSkillRules) $rules))))))) + (rules (rules 0 False False True) 1 True)) + !(test (progn (add-prompt-extension test-prompt "TEST PROMPT EXTENSION") (contains-text (getPromptExtensions) "TEST PROMPT EXTENSION"))