|
28 | 28 | "Expected state machine to contain [:preparing :tool-prepare] transition") |
29 | 29 | (is (contains? state-machine [:preparing :tool-run]) |
30 | 30 | "Expected state machine to contain [:preparing :tool-run] transition") |
31 | | - (is (contains? state-machine [:check-approval :manual-approve]) |
32 | | - "Expected state machine to contain [:check-approval :manual-approve] transition") |
33 | | - (is (contains? state-machine [:check-approval :auto-approve]) |
34 | | - "Expected state machine to contain [:check-approval :auto-approve] transition") |
| 31 | + (is (contains? state-machine [:check-approval :config-ask]) |
| 32 | + "Expected state machine to contain [:check-approval :config-ask] transition") |
| 33 | + (is (contains? state-machine [:check-approval :config-allow]) |
| 34 | + "Expected state machine to contain [:check-approval :config-allow] transition") |
| 35 | + (is (contains? state-machine [:check-approval :config-deny]) |
| 36 | + "Expected state machine to contain [:check-approval :config-deny] transition") |
35 | 37 | (is (contains? state-machine [:waiting-approval :user-approve]) |
36 | 38 | "Expected state machine to contain [:waiting-approval :user-approve] transition") |
37 | 39 | (is (contains? state-machine [:waiting-approval :user-reject]) |
|
286 | 288 | "Expected the exact promise passed in to be stored"))) |
287 | 289 |
|
288 | 290 | ;; Step 3: :check-approval -> :waiting-approval (manual approval needed) |
289 | | - (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :manual-approve manual-approve-event-data)] |
| 291 | + (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-ask manual-approve-event-data)] |
290 | 292 | (is (match? {:status :waiting-approval |
291 | 293 | :actions [:send-progress]} |
292 | 294 | result) |
|
337 | 339 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :tool-run run-event-data) |
338 | 340 |
|
339 | 341 | ;; Step 3: :check-approval -> :execution-approved (auto approval) |
340 | | - (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :auto-approve |
341 | | - {:default-approval true})] |
| 342 | + (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow)] |
342 | 343 | (is (match? {:status :execution-approved |
343 | | - :actions [:deliver-default-approval]} |
| 344 | + :actions [:deliver-approval-true]} |
344 | 345 | result) |
345 | 346 | "Expected transition to :execution-approved with deliver approval true action") |
346 | 347 |
|
|
363 | 364 | {:name "test" :origin "test" :arguments-text "{}"}) |
364 | 365 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :tool-run |
365 | 366 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval true}) |
366 | | - (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :manual-approve |
| 367 | + (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-ask |
367 | 368 | {:state :running :text "Waiting"}) |
368 | 369 |
|
369 | 370 | (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :user-reject)] |
|
398 | 399 | {:name "list_files" :origin "filesystem" :arguments-text "{\"path\": \"/tmp\"}"}) |
399 | 400 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :tool-run |
400 | 401 | {:approved?* approved?* :name "list_files" :origin "filesystem" :arguments {:path "/tmp"} :manual-approval false}) |
401 | | - (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :auto-approve |
402 | | - {:default-approval true}) |
| 402 | + (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow) |
403 | 403 |
|
404 | 404 | (let [tool-state (#'f.chat/get-tool-call-state @db* chat-id tool-call-id)] |
405 | 405 | (is (= :execution-approved (:status tool-state)) |
|
491 | 491 | {:name "test" :origin "test" :arguments-text "{}"}) |
492 | 492 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-completed" :tool-run |
493 | 493 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval false}) |
494 | | - (#'f.chat/transition-tool-call! db* chat-ctx "tool-completed" :auto-approve |
495 | | - {:default-approval true}) |
| 494 | + (#'f.chat/transition-tool-call! db* chat-ctx "tool-completed" :config-allow) |
496 | 495 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-completed" :execution-start |
497 | 496 | {:name "test" :origin "test" :arguments {}}) |
498 | 497 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-completed" :execution-end |
|
512 | 511 | {:name "test" :origin "test" :arguments-text "{}"}) |
513 | 512 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-rejected" :tool-run |
514 | 513 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval true}) |
515 | | - (#'f.chat/transition-tool-call! db* chat-ctx "tool-rejected" :manual-approve |
| 514 | + (#'f.chat/transition-tool-call! db* chat-ctx "tool-rejected" :config-ask |
516 | 515 | {:state :running :text "Waiting"}) |
517 | 516 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-rejected" :user-reject) |
518 | 517 |
|
|
548 | 547 | {:name "test" :origin "test" :arguments-text "{}"}) |
549 | 548 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-2" :tool-run |
550 | 549 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval true}) |
551 | | - (#'f.chat/transition-tool-call! db* chat-ctx "tool-2" :manual-approve |
| 550 | + (#'f.chat/transition-tool-call! db* chat-ctx "tool-2" :config-ask |
552 | 551 | {:state :running :text "Waiting"}) |
553 | 552 |
|
554 | 553 | (let [result (#'f.chat/transition-tool-call! db* chat-ctx "tool-2" :stop-requested)] |
|
567 | 566 | {:name "test" :origin "test" :arguments-text "{}"}) |
568 | 567 | (#'f.chat/transition-tool-call! db* chat-ctx "tool-3" :tool-run |
569 | 568 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval false}) |
570 | | - (#'f.chat/transition-tool-call! db* chat-ctx "tool-3" :auto-approve |
571 | | - {:default-approval true}) |
| 569 | + (#'f.chat/transition-tool-call! db* chat-ctx "tool-3" :config-allow) |
572 | 570 |
|
573 | 571 | (let [result (#'f.chat/transition-tool-call! db* chat-ctx "tool-3" :stop-requested)] |
574 | 572 | (is (match? {:status :stopped |
|
731 | 729 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :tool-run |
732 | 730 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval false}) |
733 | 731 |
|
734 | | - (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :auto-approve |
735 | | - {:default-approval true})] |
| 732 | + (let [result (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow)] |
736 | 733 | (is (match? {:status :execution-approved |
737 | | - :actions [:deliver-default-approval]} |
| 734 | + :actions [:deliver-approval-true]} |
738 | 735 | result) |
739 | 736 | "Expected transition to :execution-approved with deliver approval true action") |
740 | 737 |
|
|
758 | 755 | {:name "test" :origin "test" :arguments-text "{}"}) |
759 | 756 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :tool-run |
760 | 757 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval false}) |
761 | | - (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :auto-approve |
762 | | - {:default-approval true}) |
| 758 | + (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow) |
763 | 759 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :execution-start |
764 | 760 | {:name "test" :origin "test" :arguments {}}) |
765 | 761 |
|
|
806 | 802 | {:name "test" :origin "test" :arguments-text "{}"}) |
807 | 803 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :tool-run |
808 | 804 | {:approved?* approved?* :name "test" :origin "test" :arguments {} :manual-approval false}) |
809 | | - (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :auto-approve |
810 | | - {:default-approval true}) |
| 805 | + (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow) |
811 | 806 | (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :execution-start |
812 | 807 | {:name "test" :origin "test" :arguments {}}) |
813 | 808 |
|
|
862 | 857 | (is (identical? approved?* (:approved?* state-after-run)) |
863 | 858 | "Expected same promise to be stored in state")) |
864 | 859 |
|
865 | | - (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :auto-approve |
866 | | - {:default-approval true}) |
| 860 | + (#'f.chat/transition-tool-call! db* chat-ctx tool-call-id :config-allow) |
867 | 861 |
|
868 | 862 | (let [state-after-approve (#'f.chat/get-tool-call-state @db* chat-id tool-call-id)] |
869 | 863 | (is (= :execution-approved (:status state-after-approve)) |
|
889 | 883 | {:name "test1" :origin "test" :arguments-text "{}"}) |
890 | 884 | (#'f.chat/transition-tool-call! db* chat-ctx-1 tool-call-id :tool-run |
891 | 885 | {:approved?* approved-1* :name "test1" :origin "test" :arguments {} :manual-approval false}) |
892 | | - (#'f.chat/transition-tool-call! db* chat-ctx-1 tool-call-id :auto-approve |
893 | | - {:default-approval true}) |
| 886 | + (#'f.chat/transition-tool-call! db* chat-ctx-1 tool-call-id :config-allow) |
894 | 887 |
|
895 | 888 | ;; Tool 2 |
896 | 889 | (#'f.chat/transition-tool-call! db* chat-ctx-2 tool-call-id :tool-prepare |
|
0 commit comments