Compare commits
13 Commits
app-v0.1.7
...
app-v0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cdfbf5151 | ||
|
|
b2b6f92943 | ||
|
|
1f2a8ec05e | ||
|
|
04b516dbc1 | ||
|
|
b386c905b2 | ||
|
|
b29150a767 | ||
|
|
6fc3ad3d57 | ||
|
|
fd7ccab55b | ||
|
|
2b832c1c3b | ||
|
|
3d8801b691 | ||
|
|
1a12755649 | ||
|
|
fbdf274b9d | ||
|
|
2a6b350079 |
2
app/Cargo.lock
generated
2
app/Cargo.lock
generated
@@ -1520,7 +1520,7 @@ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
|
||||
|
||||
[[package]]
|
||||
name = "jarvis-app"
|
||||
version = "0.1.7"
|
||||
version = "0.1.15"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "jarvis-app"
|
||||
version = "0.1.7"
|
||||
version = "0.1.15"
|
||||
edition = "2021"
|
||||
rust-version = "1.85"
|
||||
description = "Jarvis v2 Windows app core: Discord voice, voice worker supervisor, chat channels"
|
||||
|
||||
459
app/shell/Cargo.lock
generated
459
app/shell/Cargo.lock
generated
@@ -91,6 +91,126 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-broadcast"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
"event-listener-strategy",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"event-listener-strategy",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37"
|
||||
dependencies = [
|
||||
"async-task",
|
||||
"concurrent-queue",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"pin-project-lite",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"futures-io",
|
||||
"futures-lite",
|
||||
"parking",
|
||||
"polling",
|
||||
"rustix",
|
||||
"slab",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-lock"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
"event-listener-strategy",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-process"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"async-signal",
|
||||
"async-task",
|
||||
"blocking",
|
||||
"cfg-if",
|
||||
"event-listener",
|
||||
"futures-lite",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-recursion"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-signal"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"atomic-waker",
|
||||
"cfg-if",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"rustix",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "4.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.92"
|
||||
@@ -230,6 +350,19 @@ dependencies = [
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blocking"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-task",
|
||||
"futures-io",
|
||||
"futures-lite",
|
||||
"piper",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brotli"
|
||||
version = "9.1.1"
|
||||
@@ -278,6 +411,12 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder-lite"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.12.1"
|
||||
@@ -481,6 +620,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
@@ -1217,6 +1365,12 @@ dependencies = [
|
||||
"simdutf8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "endi"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
|
||||
|
||||
[[package]]
|
||||
name = "enum-map"
|
||||
version = "2.7.3"
|
||||
@@ -1237,6 +1391,27 @@ dependencies = [
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumflags2"
|
||||
version = "0.7.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"
|
||||
dependencies = [
|
||||
"enumflags2_derive",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumflags2_derive"
|
||||
version = "0.7.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.3"
|
||||
@@ -1264,6 +1439,26 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "5.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"
|
||||
dependencies = [
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener-strategy"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "extended"
|
||||
version = "0.1.0"
|
||||
@@ -1488,6 +1683,19 @@ version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.34"
|
||||
@@ -2349,6 +2557,19 @@ dependencies = [
|
||||
"icu_properties",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.25.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder-lite",
|
||||
"moxcms",
|
||||
"num-traits",
|
||||
"png",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
@@ -2416,7 +2637,7 @@ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
|
||||
|
||||
[[package]]
|
||||
name = "jarvis-app"
|
||||
version = "0.1.7"
|
||||
version = "0.1.15"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.22.1",
|
||||
@@ -2445,12 +2666,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jarvis-shell"
|
||||
version = "0.1.7"
|
||||
version = "0.1.15"
|
||||
dependencies = [
|
||||
"jarvis-app",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-single-instance",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
@@ -3075,6 +3297,16 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "moxcms"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"pxfm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "muda"
|
||||
version = "0.20.0"
|
||||
@@ -3590,6 +3822,16 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ordered-stream"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "p256"
|
||||
version = "0.13.2"
|
||||
@@ -3637,6 +3879,12 @@ dependencies = [
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
@@ -3863,6 +4111,17 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113"
|
||||
|
||||
[[package]]
|
||||
name = "piper"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"fastrand",
|
||||
"futures-io",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.10.2"
|
||||
@@ -3935,6 +4194,20 @@ dependencies = [
|
||||
"miniz_oxide 0.8.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "3.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"hermit-abi",
|
||||
"pin-project-lite",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "poly1305"
|
||||
version = "0.8.0"
|
||||
@@ -4041,6 +4314,15 @@ dependencies = [
|
||||
"toml_edit 0.20.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
|
||||
dependencies = [
|
||||
"toml_edit 0.25.19+spec-1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
@@ -4096,6 +4378,12 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pxfm"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.42.0"
|
||||
@@ -5719,6 +6007,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"heck 0.5.0",
|
||||
"http",
|
||||
"image",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
@@ -5817,6 +6106,22 @@ dependencies = [
|
||||
"tauri-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-single-instance"
|
||||
version = "2.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "726b6da0dd5bd1344f84f4108a622c07d01923baacb5c803a605189672c5352f"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"windows-sys 0.61.2",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.12.2"
|
||||
@@ -5916,6 +6221,19 @@ dependencies = [
|
||||
"toml 1.2.1+spec-1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.4.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tendril"
|
||||
version = "0.5.1"
|
||||
@@ -6251,6 +6569,18 @@ dependencies = [
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.25.19+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218"
|
||||
dependencies = [
|
||||
"indexmap 2.14.2",
|
||||
"toml_datetime 1.1.3+spec-1.1.0",
|
||||
"toml_parser",
|
||||
"winnow 1.0.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.1.5+spec-1.1.0"
|
||||
@@ -6528,6 +6858,17 @@ version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
||||
|
||||
[[package]]
|
||||
name = "uds_windows"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"tempfile",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.10.0"
|
||||
@@ -7322,6 +7663,9 @@ name = "winnow"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
@@ -7444,6 +7788,76 @@ dependencies = [
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
version = "5.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-executor",
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"async-process",
|
||||
"async-recursion",
|
||||
"async-task",
|
||||
"async-trait",
|
||||
"blocking",
|
||||
"enumflags2",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
"futures-lite",
|
||||
"hex",
|
||||
"libc",
|
||||
"ordered-stream",
|
||||
"rustix",
|
||||
"serde",
|
||||
"serde_repr",
|
||||
"tracing",
|
||||
"uds_windows",
|
||||
"uuid",
|
||||
"windows-sys 0.61.2",
|
||||
"winnow 1.0.5",
|
||||
"zbus_macros",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "5.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus_names"
|
||||
version = "4.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"winnow 1.0.5",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zcheapstr"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.63"
|
||||
@@ -7581,3 +7995,44 @@ dependencies = [
|
||||
"log",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "5.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7"
|
||||
dependencies = [
|
||||
"endi",
|
||||
"enumflags2",
|
||||
"serde",
|
||||
"winnow 1.0.5",
|
||||
"zcheapstr",
|
||||
"zvariant_derive",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "5.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_utils"
|
||||
version = "4.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"syn 3.0.10",
|
||||
"winnow 1.0.5",
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "jarvis-shell"
|
||||
version = "0.1.7"
|
||||
version = "0.1.15"
|
||||
edition = "2021"
|
||||
rust-version = "1.85"
|
||||
description = "Jarvis v2 management app window (Tauri 2 over the app core's AdminApi)"
|
||||
@@ -16,7 +16,8 @@ tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
jarvis-app = { path = ".." }
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = ["tray-icon", "image-png"] }
|
||||
tauri-plugin-single-instance = "2"
|
||||
serde_json = "1"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 53 KiB |
BIN
app/shell/icons/tray.png
Normal file
BIN
app/shell/icons/tray.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1,5 +1,5 @@
|
||||
; The Jarvis installer (admin.spec.md, "Installer"). Built on Linux by installer.sh with makensis:
|
||||
; makensis -DVERSION=0.1.0 -DSRC=<Jarvis folder> -DOUT=<setup.exe> -DICON=<icon.ico> -DWEBVIEW2=<bootstrapper>
|
||||
; makensis -DVERSION=0.1.0 -DSRC=<Jarvis folder> -DOUT=<setup.exe> -DICON=<icon.ico> -DICON_FILE=<jarvis-<hash>.ico> -DWEBVIEW2=<bootstrapper>
|
||||
; -DUNINSTALL_LIST=<the Delete/RMDir lines of the installed files> installer.nsi
|
||||
; Program Files, one administrator prompt; the data folder is chosen by the app's first-run wizard
|
||||
; and never touched here. /S installs silently (the app's updates: /S /RUN starts the app afterwards).
|
||||
@@ -19,7 +19,6 @@ SetCompressor /SOLID lzma
|
||||
Name "Jarvis"
|
||||
OutFile "${OUT}"
|
||||
InstallDir "$PROGRAMFILES64\Jarvis"
|
||||
InstallDirRegKey HKLM "Software\JarvisBot" "InstallDir"
|
||||
RequestExecutionLevel admin
|
||||
BrandingText "Jarvis ${VERSION}"
|
||||
VIProductVersion "${VERSION}.0"
|
||||
@@ -149,6 +148,13 @@ Function .onInit
|
||||
Abort
|
||||
${EndIf}
|
||||
SetRegView 64
|
||||
; An update goes where Jarvis is installed (the key is in the 64-bit view, which InstallDirRegKey
|
||||
; would not read); a folder given with /D wins.
|
||||
ReadRegStr $0 HKLM "Software\JarvisBot" "InstallDir"
|
||||
${If} $0 != ""
|
||||
${AndIf} $INSTDIR == "$PROGRAMFILES64\Jarvis"
|
||||
StrCpy $INSTDIR $0
|
||||
${EndIf}
|
||||
; Shortcuts for every user of the PC, like the Program Files install itself.
|
||||
SetShellVarContext all
|
||||
!insertmacro TakeLock
|
||||
@@ -220,6 +226,10 @@ Section "Jarvis (필수)" SecMain
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${SRC}/jarvis.exe"
|
||||
File "${SRC}/WebView2Loader.dll"
|
||||
; The shortcuts' icon, named by its content: Windows keeps an icon it has shown by the file's path,
|
||||
; so a changed icon under the old path would stay the old one on the desktop and in search.
|
||||
Delete "$INSTDIR\jarvis-*.ico"
|
||||
File "/oname=${ICON_FILE}" "${ICON}"
|
||||
File /r "${SRC}/python-src"
|
||||
File /r "${SRC}/display-driver"
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
@@ -237,11 +247,32 @@ Section "Jarvis (필수)" SecMain
|
||||
SectionEnd
|
||||
|
||||
Section "시작 메뉴 바로 가기" SecStart
|
||||
CreateShortCut "$SMPROGRAMS\Jarvis.lnk" "$INSTDIR\jarvis.exe"
|
||||
CreateShortCut "$SMPROGRAMS\Jarvis.lnk" "$INSTDIR\jarvis.exe" "" "$INSTDIR\${ICON_FILE}" 0
|
||||
SectionEnd
|
||||
|
||||
Section /o "바탕 화면 바로 가기" SecDesktop
|
||||
CreateShortCut "$DESKTOP\Jarvis.lnk" "$INSTDIR\jarvis.exe"
|
||||
CreateShortCut "$DESKTOP\Jarvis.lnk" "$INSTDIR\jarvis.exe" "" "$INSTDIR\${ICON_FILE}" 0
|
||||
SectionEnd
|
||||
|
||||
; Every shortcut to jarvis.exe on the desktops and in the start menus, their folders included (the
|
||||
; person's own too, and the installer's from an earlier version, which an update does not make
|
||||
; again) shows this version's icon file; then Explorer redraws its icons. A shortcut to another
|
||||
; Jarvis install's jarvis.exe (a folder with uninstall.exe and python-src, left behind when an
|
||||
; earlier update installed into Program Files instead) starts this one instead, so it opens the
|
||||
; Jarvis that runs, not an old copy. The paths go in through
|
||||
; the environment, so no install folder name can break the command. The 64-bit PowerShell
|
||||
; (SysNative from this 32-bit installer): a 32-bit one reads a link to Program Files as one to
|
||||
; Program Files (x86).
|
||||
Section "-Icons"
|
||||
System::Call 'kernel32::SetEnvironmentVariable(t "JARVIS_EXE", t "$INSTDIR\jarvis.exe")'
|
||||
System::Call 'kernel32::SetEnvironmentVariable(t "JARVIS_ICON", t "$INSTDIR\${ICON_FILE},0")'
|
||||
System::Call 'kernel32::SetEnvironmentVariable(t "JARVIS_DIR", t "$INSTDIR")'
|
||||
nsExec::Exec `"$WINDIR\SysNative\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NonInteractive -Command "$$w = New-Object -ComObject WScript.Shell; foreach ($$d in 'Desktop', 'CommonDesktopDirectory', 'Programs', 'CommonPrograms') { Get-ChildItem -LiteralPath ([Environment]::GetFolderPath($$d)) -Filter *.lnk -Recurse:($$d -like '*Programs') -EA 0 | ForEach-Object { $$l = $$w.CreateShortcut($$_.FullName); $$t = $$l.TargetPath; if ($$t -and (Split-Path -Leaf $$t) -ieq 'jarvis.exe' -and (Test-Path -LiteralPath (Join-Path (Split-Path $$t) 'uninstall.exe')) -and (Test-Path -LiteralPath (Join-Path (Split-Path $$t) 'python-src'))) { if ($$t -ine $$env:JARVIS_EXE) { $$l.TargetPath = $$env:JARVIS_EXE; $$l.WorkingDirectory = $$env:JARVIS_DIR }; $$l.IconLocation = $$env:JARVIS_ICON; $$l.Save() } } }"`
|
||||
Pop $0
|
||||
${If} $0 != 0
|
||||
DetailPrint "바로 가기 아이콘을 바꾸지 못했습니다 ($0)"
|
||||
${EndIf}
|
||||
System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, p 0, p 0)' ; SHCNE_ASSOCCHANGED
|
||||
SectionEnd
|
||||
|
||||
Section "가상 모니터 드라이버" SecDriver
|
||||
@@ -303,6 +334,7 @@ Section "Uninstall"
|
||||
; folder the person chose may hold other things; folders go only when empty.
|
||||
Delete "$INSTDIR\jarvis.exe"
|
||||
Delete "$INSTDIR\WebView2Loader.dll"
|
||||
Delete "$INSTDIR\jarvis-*.ico"
|
||||
!include "${UNINSTALL_LIST}"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
@@ -20,7 +20,9 @@ setup="$out/Jarvis-Setup-$version.exe"
|
||||
# The uninstall entry's size: what this setup installs, counted here. Counting the install folder on
|
||||
# the user's PC would also walk a data folder kept inside it (models, runtime: many thousand files).
|
||||
size_kb=$(cd "$out/Jarvis" && du -sk --apparent-size -c jarvis.exe WebView2Loader.dll python-src display-driver | tail -1 | cut -f1)
|
||||
makensis -V2 -DVERSION="$version" -DSRC="$out/Jarvis" -DOUT="$setup" -DICON="$here/icons/icon.ico" \
|
||||
# The shortcuts' icon file is named by its content, so a new icon gets a path Windows has not seen.
|
||||
icon_file="jarvis-$(sha256sum "$here/icons/icon.ico" | cut -c1-12).ico"
|
||||
makensis -V2 -DVERSION="$version" -DSRC="$out/Jarvis" -DOUT="$setup" -DICON="$here/icons/icon.ico" -DICON_FILE="$icon_file" \
|
||||
-DWEBVIEW2="$wv2" -DUNINSTALL_LIST="$list" -DSIZE_KB="$size_kb" ${NSIS_EXTRA:-} "$here/installer.nsi"
|
||||
(cd "$out" && sha256sum "Jarvis-Setup-$version.exe" > "Jarvis-Setup-$version.exe.sha256")
|
||||
echo "$setup"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
//! Jarvis management app: one Tauri 2 window over the app core (`app/src/admin.spec.md`, "Window
|
||||
//! and Windows build"). The screens (`app/ui`) call `invoke("admin", {command, args})`, passed to the
|
||||
//! same `AdminApi` the development server uses. Closing the window first stops what the app started;
|
||||
//! if that cannot be confirmed the window stays open and says so, and closing it again quits.
|
||||
//! same `AdminApi` the development server uses. Quitting first stops what the app started; if that
|
||||
//! cannot be confirmed the window stays open and says so, and quitting again quits. The close button
|
||||
//! quits, or hides the window to the tray when `app.closeButton` is "tray"; the tray icon opens it
|
||||
//! again or quits. Starting Jarvis again while it runs shows the running one's window.
|
||||
//!
|
||||
//! jarvis [--location FILE]
|
||||
//! jarvis --display-driver install|uninstall --result FILE (elevated, started by the app)
|
||||
@@ -14,7 +16,9 @@ use std::sync::Arc;
|
||||
|
||||
use jarvis_app::admin_api::AdminApi;
|
||||
use serde_json::Value;
|
||||
use tauri::{Emitter, Manager, RunEvent, WebviewUrl, WebviewWindowBuilder, WindowEvent};
|
||||
use tauri::menu::{Menu, MenuItem};
|
||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||
use tauri::{AppHandle, Emitter, Manager, RunEvent, WebviewUrl, WebviewWindowBuilder, WindowEvent};
|
||||
|
||||
/// Where closing stands: open, closing (stopping what runs), or the stop could not be confirmed.
|
||||
const OPEN: u8 = 0;
|
||||
@@ -37,6 +41,45 @@ async fn admin(app: tauri::AppHandle, state: tauri::State<'_, Api>, command: Str
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Bring the window back: from the tray, or when Jarvis is started again.
|
||||
fn show_window(app: &AppHandle) {
|
||||
if let Some(w) = app.get_webview_window("main") {
|
||||
let _ = w.unminimize();
|
||||
let _ = w.show();
|
||||
let _ = w.set_focus();
|
||||
}
|
||||
}
|
||||
|
||||
/// Quit (the close button set to quit, or the tray's "완전 종료"): stop what the app started, then
|
||||
/// exit; the window shows while that runs. If the stop fails the window stays with the reason, and
|
||||
/// quitting again exits anyway.
|
||||
fn quit(app: &AppHandle) {
|
||||
let state = app.state::<Api>();
|
||||
match state.phase.load(Ordering::SeqCst) {
|
||||
CLOSE_FAILED => {
|
||||
jarvis_app::warn_log!("app", "quitting again: quitting although the stop was not confirmed");
|
||||
app.exit(0);
|
||||
}
|
||||
CLOSING => {}
|
||||
_ => {
|
||||
state.phase.store(CLOSING, Ordering::SeqCst);
|
||||
show_window(app);
|
||||
let _ = app.emit("closing", ());
|
||||
let (handle, api) = (app.clone(), state.api.clone());
|
||||
tauri::async_runtime::spawn(async move {
|
||||
jarvis_app::info_log!("app", "quitting: stopping what the app started");
|
||||
match api.shutdown().await {
|
||||
Ok(()) => handle.exit(0),
|
||||
Err(e) => {
|
||||
handle.state::<Api>().phase.store(CLOSE_FAILED, Ordering::SeqCst);
|
||||
let _ = handle.emit("close-failed", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn arg(name: &str) -> Option<String> {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
args.iter().position(|a| a == name).and_then(|i| args.get(i + 1).cloned())
|
||||
@@ -66,6 +109,8 @@ fn main() {
|
||||
let (webview_data, _) = jarvis_app::datadir::webview_data_dir(&location);
|
||||
|
||||
let app = tauri::Builder::default()
|
||||
// First, so a second start only shows this one's window and exits.
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _, _| show_window(app)))
|
||||
.manage(Api { api, phase: AtomicU8::new(OPEN) })
|
||||
.invoke_handler(tauri::generate_handler![admin])
|
||||
.setup({
|
||||
@@ -76,6 +121,24 @@ fn main() {
|
||||
.min_inner_size(900.0, 600.0)
|
||||
.data_directory(webview_data)
|
||||
.build()?;
|
||||
let open = MenuItem::with_id(app, "open", "열기", true, None::<&str>)?;
|
||||
let quit_item = MenuItem::with_id(app, "quit", "완전 종료", true, None::<&str>)?;
|
||||
TrayIconBuilder::with_id("main")
|
||||
.tooltip("Jarvis")
|
||||
.menu(&Menu::with_items(app, &[&open, &quit_item])?)
|
||||
.show_menu_on_left_click(false)
|
||||
.on_menu_event(|app, e| match e.id.as_ref() {
|
||||
"open" => show_window(app),
|
||||
"quit" => quit(app),
|
||||
_ => {}
|
||||
})
|
||||
.on_tray_icon_event(|tray, e| {
|
||||
if let TrayIconEvent::Click { button: MouseButton::Left, button_state: MouseButtonState::Up, .. } = e {
|
||||
show_window(tray.app_handle());
|
||||
}
|
||||
})
|
||||
.icon(tauri::image::Image::from_bytes(include_bytes!("../icons/tray.png"))?)
|
||||
.build(app)?;
|
||||
Ok(())
|
||||
}
|
||||
})
|
||||
@@ -83,25 +146,17 @@ fn main() {
|
||||
let WindowEvent::CloseRequested { api: close, .. } = event else { return };
|
||||
let state = window.state::<Api>();
|
||||
match state.phase.load(Ordering::SeqCst) {
|
||||
CLOSE_FAILED => {
|
||||
jarvis_app::warn_log!("app", "window closed again: quitting although the stop was not confirmed");
|
||||
}
|
||||
// After a failed stop the window closes, and with it the app.
|
||||
CLOSE_FAILED => jarvis_app::warn_log!("app", "window closed again: quitting although the stop was not confirmed"),
|
||||
CLOSING => close.prevent_close(),
|
||||
_ if state.api.close_to_tray() => {
|
||||
close.prevent_close();
|
||||
let _ = window.hide();
|
||||
jarvis_app::info_log!("app", "window hidden to the tray");
|
||||
}
|
||||
_ => {
|
||||
close.prevent_close();
|
||||
state.phase.store(CLOSING, Ordering::SeqCst);
|
||||
let _ = window.emit("closing", ());
|
||||
let (handle, api) = (window.app_handle().clone(), state.api.clone());
|
||||
tauri::async_runtime::spawn(async move {
|
||||
jarvis_app::info_log!("app", "window closing: stopping what the app started");
|
||||
match api.shutdown().await {
|
||||
Ok(()) => handle.exit(0),
|
||||
Err(e) => {
|
||||
handle.state::<Api>().phase.store(CLOSE_FAILED, Ordering::SeqCst);
|
||||
let _ = handle.emit("close-failed", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
quit(window.app_handle());
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -38,7 +38,7 @@ that is not absolute, or is a file, is refused with a message.
|
||||
`config/settings.json` keeps the format of `discord_core.spec.md` and `conversation.spec.md`.
|
||||
|
||||
- `fields()` describes every key the screens edit: its dotted path (`call.mode`), screen
|
||||
(`bot`, `channels`, `chat`, `memory`, `model`, `features`, `collect`), kind (bool, integer with a range, number with a
|
||||
(`bot`, `channels`, `chat`, `memory`, `model`, `features`, `collect`, `schedule`, `pcControl`, `game`, `app`), kind (bool, integer with a range, number with a
|
||||
range, text, text list, choice with its values, Discord ID, Discord ID list, ID to number map,
|
||||
chat channel list, MCP server list, collection target list, free object), its default and a Korean label. The screens are built from this
|
||||
list, so a key is added in one place.
|
||||
@@ -229,24 +229,30 @@ records and "Traces"), so it works while the services are stopped. Nothing it re
|
||||
|
||||
- Each item is `said` (a voice transcript, or a chat message by someone other than Jarvis),
|
||||
`answered` (a spoken answer, or Jarvis's own chat message; to whom, when it answers someone) or
|
||||
`thought` (a trace: the question, the answer or none, how long it took and its steps). Jarvis's
|
||||
`thought` (a trace: the question, the answer or none, how long it took and its steps so far, at
|
||||
the time it was asked; `pending` while the answer is being made, with `ms` 0 until it ends). Jarvis's
|
||||
chat messages are known by the bot's user id (the first part of the stored token is that id in
|
||||
base64) and by the author of any chat answer to someone.
|
||||
- `history_query` `{said, answered, thought, via, person, channel, find, since, until, before, from, limit}`: the
|
||||
- `history_query` `{said, answered, thought, via, person, channel, find, since, until, session, before, from, limit}`: the
|
||||
three kinds (each on unless false), where (`voice`, `chat`, `task`; a task has traces only), a
|
||||
person (their records, answers to them and traces of their questions), a channel, text the record
|
||||
or the trace's question, answer or steps contains (records folded like the store: NFKC, lower
|
||||
case), Unix seconds from (inclusive) and to (exclusive), the cursors `before` (only items older
|
||||
case), Unix seconds from (inclusive) and to (exclusive), `session` (only items from when the
|
||||
latest service start of this app run began; none before the first start), the cursors `before` (only items older
|
||||
than it) and `from` (it and newer), each an item's `{at, key}`, and `limit` (1-2000, default 200).
|
||||
Items are ordered by time, then records before traces, then id, so paging by cursor never skips or
|
||||
repeats an item, even at equal times. Answers
|
||||
`{items, more, people, channels}`: the newest `limit` items in time order, whether older ones
|
||||
were left out, the people who spoke (their latest name) and the channels with records (with the
|
||||
name given a chat channel in the settings). Without the file: no items and `missing: true`.
|
||||
name given a chat channel in the settings), and `session`, when the latest start began (Unix
|
||||
seconds, null before the first). Without the file: no items and `missing: true`.
|
||||
- `history_stamp`: `{stamp}`, a string that changes when a record or trace is added and as a trace
|
||||
still being made gets a step or ends (the newest ids, and the number and length of the steps of
|
||||
the traces being made), cheap enough to ask twice a second; not logged.
|
||||
|
||||
## Activity (`app/src/activity.rs`)
|
||||
|
||||
`docs/v2/proactive.md` (제안 5). What Jarvis did outside its answers, for the 한 일 screen: each chat
|
||||
`docs/v2/proactive.md` (제안 5). What Jarvis did outside its answers, for the 로그 screen's 한 일 view: each chat
|
||||
channel action the brain's tool asked for (`chat.send`, `chat.edit`, `chat.react`, `chat.delete`,
|
||||
`chat.pin`, `chat.unpin`), each schedule delivery (`schedule.remind`, `schedule.task`) and each
|
||||
news notification (`collect.notify`), each screen capture (`screen.view`, "Screen viewing"), done or failed. The other PC control actions join it with M7. Ordinary answers are not recorded.
|
||||
@@ -687,7 +693,8 @@ back as Korean messages for the screen. The Tauri shell passes the screens' `inv
|
||||
| `service_start` / `service_stop` / `service_restart` / `dashboard` | the controller and its snapshot; start and restart run in the background, stop also cancels a start |
|
||||
| `discord_channel_info` `{id}` / `channel_sync_status` | a channel's Discord name and topic / each synced chat channel's last result (above) |
|
||||
| `notes_list` / `note_update` `{id, text}` / `note_delete` `{id}` | everyone's personal notes (above) / change one's text / delete one |
|
||||
| `history_query` `{said, answered, thought, via, person, channel, find, since, until, before, from, limit}` | the 대화 screen's records and answer traces (above, "Conversations") |
|
||||
| `history_query` `{said, answered, thought, via, person, channel, find, since, until, session, before, from, limit}` | the 대화 screen's records and answer traces (above, "Conversations") |
|
||||
| `history_stamp` | `{stamp}`: changes when what the 대화 screen shows may have changed (above, "Conversations") |
|
||||
| `activity_list` `{limit}` | what Jarvis did (above, "Activity"), newest first |
|
||||
| `schedules_list` / `schedule_delete` `{id}` | every person's schedules (above), soonest first, with IDs as strings / delete one |
|
||||
| `collect_results` `{target, limit}` | `{targets, items}`: every target folder with results, and the collected items newest first (`target` null: every target; `limit` 1-500, default 100) |
|
||||
@@ -706,6 +713,8 @@ its data folder, and again after each one is saved. The log hub writes to the da
|
||||
## Screens (`app/ui/`)
|
||||
|
||||
Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. All text is Korean.
|
||||
The side menu has 대화 right under 대시보드 and 앱 last; there is no separate update screen (updates
|
||||
are on the 앱 screen) and no separate 한 일 screen (it is a view of the 로그 screen).
|
||||
|
||||
- **First-run wizard** (while `firstRun`): data folder (free space, warning under 200 GB), PC check,
|
||||
the model to download, Discord bot (token check with the
|
||||
@@ -718,7 +727,7 @@ Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. A
|
||||
Strata's last line, and stop in the header; the header with start, restart and stop is rebuilt
|
||||
only when the state changes, so a click is never lost to the refresh. Every screen change starts
|
||||
a new generation: an answer that arrives after the user moved to another screen is dropped.
|
||||
- **Settings screens** (봇, 채널·호출, 채팅 채널, 대화 기억, 모델, 기능, 백그라운드 수집, 예약, PC 제어, 게임 모드): built from `settings_fields`; only
|
||||
- **Settings screens** (봇, 채널·호출, 채팅 채널, 대화 기억, 모델, 기능, 백그라운드 수집, 예약, PC 제어, 게임 모드, 앱): built from `settings_fields`; only
|
||||
changed fields are sent; the server and voice channel are pickers (choosing another server clears
|
||||
the voice channel and lists only that server's channels); the chat channels are a table
|
||||
with their switches; the bot screen also changes the token; the 기능 screen has the feature
|
||||
@@ -730,16 +739,26 @@ Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. A
|
||||
newest 100, filtered by any target that has results, each with its time, title, link and the start of its text shown
|
||||
as plain text). The 예약 screen has `schedule.chatChannel` and every person's schedules (next time
|
||||
or "다시 울리지 않음", repeat, who and how they asked, kind and text as plain text, the last
|
||||
outcome, delete).
|
||||
outcome, delete). The 앱 screen has the update card (below) first, then `app.closeButton` (완전 종료
|
||||
or 트레이로 최소화) with a note that the tray icon opens the window again and its menu quits;
|
||||
saving it needs no restart.
|
||||
- **사람별 지침**: every person's notes (name and ID, the text in a box, save and delete).
|
||||
- **대화**: what people said, Jarvis's answers and how each answer was made, in time order with a
|
||||
date line between days; people's words on the left, Jarvis's on the right with whom it answered,
|
||||
each with its time, voice or chat and channel, and a copy button. A trace is a closed card (whose
|
||||
question, how many tool calls, seconds, no answer) that opens to the question, the records and
|
||||
notes it was given, the tools offered, the plan, the model's thinking, each tool call (name,
|
||||
arguments, success, failure or skipped and why, its result) and the answer. Filters: the three
|
||||
kinds as chips, where (음성, 채팅, 정기 작업), person, channel, one day and text; "실시간" (on by
|
||||
default) re-reads the live window every 3 seconds: every item from its first one on (`from`, up to
|
||||
arguments, success, failure or skipped and why, its result) and the answer. A trace sits at the
|
||||
time it was asked and is there while the answer is made (`pending`, "답을 만드는 중"): it fills in
|
||||
step by step, and one seen being made is open and stays open with its answer unless the user
|
||||
closes it. Filters: the three
|
||||
kinds as chips, "현재 세션" (off by default: only items since the bot was last started, `session`;
|
||||
the count line starts with that start's date and time, and with no start yet in this app run the
|
||||
list says so; a new start while it is on starts the list over from that start), where (음성,
|
||||
채팅, 정기 작업), person, channel, one day and text; "실시간" (on by
|
||||
default) asks for `history_stamp` twice a second and re-reads the live window at once when it
|
||||
changed (so a trace shows from its question on, before a quick answer ends), and every 3 seconds
|
||||
anyway: every item from its first one on (`from`, up to
|
||||
2,000). Only items in that window change on screen, an edited message included; items paged back
|
||||
past it stay as they were loaded (edits and deletes there show after a reload of the screen). The
|
||||
screen redraws only when an item changed, keeping the cards the user opened open and the scroll
|
||||
@@ -750,12 +769,13 @@ Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. A
|
||||
how far back it goes; a filter change drops every answer to a request made before it, and a live
|
||||
answer older than the newest one asked is dropped; "생각 모두 펼치기/접기"; a count of each kind
|
||||
shown. The paging is `app/ui/talk.js`, pure, checked by `node --test app/tests/ui/talk.test.mjs`.
|
||||
- **한 일**: the activity (time, kind, target, who asked, outcome and why it failed), newest 200,
|
||||
with a refresh button.
|
||||
- **업데이트**: the version here, the state, "다시 확인", "받기" (with its percentage) and "설치하고
|
||||
다시 시작", and the release's notes as plain text. The app checks once when the main screens open;
|
||||
a newer release renames the button "업데이트 (새 버전)" and says so once.
|
||||
- **Logs**: tab, level and text filters, pause, live follow (lines after the last seen), "최근 오류
|
||||
- **업데이트** (a card on the 앱 screen, re-read every second while it is shown): the version here,
|
||||
the state, "다시 확인", "받기" (with its percentage) and "설치하고 다시 시작", and the release's
|
||||
notes as plain text. The app checks once when the main screens open; a newer release renames the
|
||||
앱 button "앱 (새 버전)" and says so once.
|
||||
- **Logs** (로그): two views switched at the top, 로그 and 한 일. 한 일 is the activity (time, kind,
|
||||
target, who asked, outcome and why it failed), newest 200, read when the view opens, with a
|
||||
refresh button; there is no separate 한 일 screen. 로그 has tab, level and text filters, pause, live follow (lines after the last seen), "최근 오류
|
||||
복사" (to the clipboard; over 2,000 characters it suggests the zip), and the zip export by days.
|
||||
|
||||
`jarvis-admin-dev [--port N] [--ui DIR] [--location FILE]` (development only) serves `app/ui` and
|
||||
@@ -802,6 +822,16 @@ both to a release with that tag. The repository's other releases (v1's `v1.x`) a
|
||||
left is cleared (`Controller::shutdown`: the LLM's server stopped and confirmed gone). While that
|
||||
runs the window says so; if it fails the window stays open with the reason, and closing it again
|
||||
quits anyway. Quitting another way (the system shutting down) runs the same shutdown.
|
||||
- The close button (X) quits as above, or, when `app.closeButton` is `"tray"` (`"quit"` by default,
|
||||
read each time it is pressed; no data folder or settings that do not parse: quit), only hides the
|
||||
window: the bot and services keep running. A tray icon (`icons/tray.png`, tooltip "Jarvis") is
|
||||
always there: a left click shows the window again, its menu has 열기 and 완전 종료 (the quit
|
||||
above, with the window shown while it runs).
|
||||
- One Jarvis at a time (`tauri-plugin-single-instance`): starting it again while it runs shows the
|
||||
running one's window (hidden or minimised) and the new start exits.
|
||||
- The icon (`icons/icon.ico` for the program file, window, taskbar and installer, 16-256 px;
|
||||
`icons/icon.png` 512 px): voice bars in a ring on the accent colour's gradient; at 32 px and below
|
||||
only three thicker bars, so it stays readable in the taskbar and tray.
|
||||
- `app/shell/package.sh <folder>` builds it on Linux (`x86_64-pc-windows-gnu`, mingw-w64) and lays
|
||||
out `Jarvis/`: `jarvis.exe`, `WebView2Loader.dll`, `python-src/` (the `voice_worker` and
|
||||
`jarvis` packages, no caches or specs) and `display-driver/` (the virtual monitor's driver). The worker's sources are `python-src` next to the
|
||||
@@ -817,7 +847,9 @@ both to a release with that tag. The repository's other releases (v1's `v1.x`) a
|
||||
`Jarvis-Setup-<version>.exe` with its `.sha256`. The installer is about 10 MB; models and runtimes
|
||||
come with the first-run wizard into the data folder, which the installer never touches.
|
||||
|
||||
- Program Files (`Jarvis`), one administrator prompt, 64-bit Windows 10/11 only; Korean pages:
|
||||
- Program Files (`Jarvis`), or where Jarvis is already installed (`HKLM\Software\JarvisBot`
|
||||
`InstallDir`, 64-bit view; a folder given with `/D` wins), one administrator prompt, 64-bit
|
||||
Windows 10/11 only; Korean pages:
|
||||
folder, components, progress, finish ("Jarvis 실행", started through Explorer so the app runs as
|
||||
the signed-in user, not as administrator).
|
||||
- Components: Jarvis (always), start menu shortcut (on), desktop shortcut (off), the virtual
|
||||
@@ -826,7 +858,18 @@ come with the first-run wizard into the data folder, which the installer never t
|
||||
installed later from the features screen, with the reason the app wrote (UTF-8), and the app is
|
||||
installed all the same; never in a
|
||||
silent install, so an update neither asks nor brings back a driver the person removed).
|
||||
Shortcuts are for every user of the PC.
|
||||
Shortcuts are for every user of the PC. Their icon is a file next to `jarvis.exe` named by its
|
||||
content (`jarvis-<sha256 prefix>.ico`; the old one is deleted), because Windows keeps an icon it
|
||||
has shown by its path and a changed icon under the old path stays old on the desktop and in
|
||||
search. After the shortcuts, every `.lnk` to `jarvis.exe` on the desktops and in the start menus
|
||||
and their folders (the installing user's and every user's, the person's own and an earlier
|
||||
version's included) gets this icon file (the paths reach PowerShell through the environment, so
|
||||
any folder name works; a failure is a line in the details), and Explorer is told to redraw (`SHCNE_ASSOCCHANGED`).
|
||||
A shortcut to the `jarvis.exe` of another folder that holds a Jarvis install (`uninstall.exe` and
|
||||
`python-src` next to it: a copy left behind when an update before 0.1.12 installed into Program
|
||||
Files instead of the chosen folder) is pointed at this install's `jarvis.exe` (and its working
|
||||
folder at this folder), so it starts the Jarvis that is kept up to date, and a start while it runs
|
||||
shows the running window instead of a second, old Jarvis. The old copy itself is not touched.
|
||||
- The WebView2 runtime is installed with Microsoft's bootstrapper (inside the installer) only when
|
||||
the PC has none, before any file is copied. When it is still missing afterwards the installer
|
||||
asks to retry or cancel; silently it stops with exit code 3, nothing installed and nothing
|
||||
|
||||
@@ -157,6 +157,14 @@ impl AdminApi {
|
||||
Ok(c.get_or_insert_with(|| Controller::new(ServicesHost::new(dir.path().to_path_buf()))).clone())
|
||||
}
|
||||
|
||||
/// Whether the window's close button hides it to the tray (`app.closeButton`) rather than
|
||||
/// quitting. Without a data folder or with settings that do not parse, closing quits.
|
||||
pub fn close_to_tray(&self) -> bool {
|
||||
self.dir.lock().unwrap().as_ref()
|
||||
.and_then(|d| crate::settings::load_settings(&d.settings_file()).ok())
|
||||
.is_some_and(|s| s.close_to_tray)
|
||||
}
|
||||
|
||||
/// The app is closing: cancel an install in progress and wait for it (its commands and their
|
||||
/// children end), stop the services (a start in progress is cancelled and waited for) and clear
|
||||
/// what a failed run may have left (the LLM's server). An error means something may still run;
|
||||
@@ -181,7 +189,10 @@ impl AdminApi {
|
||||
}
|
||||
|
||||
pub async fn call(&self, command: &str, args: Value) -> Result<Value, String> {
|
||||
crate::debug_log!("admin", "command {command}");
|
||||
// The 대화 screen asks for the stamp twice a second: a line each time would bury the log.
|
||||
if command != "history_stamp" {
|
||||
crate::debug_log!("admin", "command {command}");
|
||||
}
|
||||
match command {
|
||||
"app_status" => {
|
||||
let dir = self.dir.lock().unwrap().clone();
|
||||
@@ -317,7 +328,8 @@ impl AdminApi {
|
||||
let speed = crate::settings::load_settings(&file).map_err(|e| e.0)?.voice.tts_speed;
|
||||
self.controller()?.set_tts_speed(speed);
|
||||
}
|
||||
let restart = changes.keys().any(|k| k != "voice.tts.speed");
|
||||
// The close button's choice is read when it is pressed.
|
||||
let restart = changes.keys().any(|k| k != "voice.tts.speed" && k != "app.closeButton");
|
||||
Ok(json!({"saved": changes.len(),
|
||||
"restartNeeded": restart && self.controller()?.state() == crate::control::State::Running,
|
||||
"sync": sync}))
|
||||
@@ -396,15 +408,29 @@ impl AdminApi {
|
||||
crate::info_log!("admin", "note {id} deleted");
|
||||
Ok(json!({"deleted": id.to_string()}))
|
||||
}
|
||||
// The 대화 screen (admin.spec.md, "Conversations"): whether what it shows changed.
|
||||
"history_stamp" => {
|
||||
let path = self.dir()?.path().join("memory").join("history.sqlite");
|
||||
let stamp = tokio::task::spawn_blocking(move || crate::history_view::stamp(&path))
|
||||
.await.map_err(|e| e.to_string())??;
|
||||
Ok(json!({"stamp": stamp}))
|
||||
}
|
||||
// The 대화 screen (admin.spec.md, "Conversations"): records and answer traces.
|
||||
"history_query" => {
|
||||
let dir = self.dir()?;
|
||||
let text = |k: &str| args.get(k).and_then(Value::as_str).map(str::trim).filter(|s| !s.is_empty()).map(String::from);
|
||||
let flag = |k: &str| args.get(k).and_then(Value::as_bool).unwrap_or(true);
|
||||
// The current session: from when the latest start began (none yet: nothing to show).
|
||||
let session = self.controller.lock().unwrap().as_ref().and_then(|c| c.session_start());
|
||||
let only_session = args.get("session").and_then(Value::as_bool).unwrap_or(false);
|
||||
let mut since = args.get("since").and_then(Value::as_f64);
|
||||
if only_session {
|
||||
since = Some(since.unwrap_or(f64::MIN).max(session.unwrap_or(f64::INFINITY)));
|
||||
}
|
||||
let q = crate::history_view::Query {
|
||||
said: flag("said"), answered: flag("answered"), thought: flag("thought"),
|
||||
via: text("via"), person: text("person"), channel: text("channel"), find: text("find"),
|
||||
since: args.get("since").and_then(Value::as_f64), until: args.get("until").and_then(Value::as_f64),
|
||||
since, until: args.get("until").and_then(Value::as_f64),
|
||||
before: args.get("before").and_then(crate::history_view::Cursor::of),
|
||||
from: args.get("from").and_then(crate::history_view::Cursor::of),
|
||||
limit: args.get("limit").and_then(Value::as_u64).map_or(crate::history_view::DEFAULT_LIMIT, |n| n as usize),
|
||||
@@ -419,6 +445,7 @@ impl AdminApi {
|
||||
let name = named.iter().find(|c| Some(c.id.to_string().as_str()) == ch["id"].as_str()).map(|c| c.name.clone());
|
||||
ch["name"] = json!(name.unwrap_or_default());
|
||||
}
|
||||
v["session"] = json!(session);
|
||||
Ok(v)
|
||||
}
|
||||
"activity_list" => {
|
||||
@@ -550,6 +577,20 @@ mod tests {
|
||||
assert!(a.call("nope", json!({})).await.is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn the_close_button_follows_the_saved_choice() {
|
||||
let (a, base) = api("api-close");
|
||||
assert!(!a.close_to_tray(), "no data folder yet: closing quits");
|
||||
let data = base.join("d");
|
||||
a.call("folder_choose", json!({"path": data.to_string_lossy()})).await.unwrap();
|
||||
assert!(!a.close_to_tray());
|
||||
a.call("settings_apply", json!({"changes": {"app.closeButton": "tray"}})).await.unwrap();
|
||||
assert!(a.close_to_tray());
|
||||
// A settings file that does not parse never leaves the window unable to close.
|
||||
std::fs::write(data.join("config").join("settings.json"), "{").unwrap();
|
||||
assert!(!a.close_to_tray());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn the_notes_screen_lists_edits_and_deletes_anyones_notes() {
|
||||
let (a, base) = api("api-notes");
|
||||
@@ -572,6 +613,7 @@ mod tests {
|
||||
let data = base.join("d");
|
||||
a.call("folder_choose", json!({"path": data.to_string_lossy()})).await.unwrap();
|
||||
assert_eq!(a.call("history_query", json!({})).await.unwrap()["missing"], true);
|
||||
let before = a.call("history_stamp", json!({})).await.unwrap();
|
||||
std::fs::create_dir_all(data.join("memory")).unwrap();
|
||||
let c = rusqlite::Connection::open(data.join("memory").join("history.sqlite")).unwrap();
|
||||
c.execute_batch(crate::history_view::TEST_SCHEMA).unwrap();
|
||||
@@ -586,6 +628,33 @@ mod tests {
|
||||
assert_eq!(v["channels"][0]["name"], "잡담");
|
||||
let v = a.call("history_query", json!({"said": false, "find": "반가"})).await.unwrap();
|
||||
assert_eq!(v["items"][0]["type"], "thought");
|
||||
// The screen polls the stamp and reads again only when it changed.
|
||||
let now = a.call("history_stamp", json!({})).await.unwrap();
|
||||
assert_ne!(now["stamp"], before["stamp"]);
|
||||
assert_eq!(a.call("history_stamp", json!({})).await.unwrap(), now);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn the_current_session_shows_only_what_came_since_the_latest_start() {
|
||||
let (a, base) = api("api-history-session");
|
||||
let data = base.join("d");
|
||||
a.call("folder_choose", json!({"path": data.to_string_lossy()})).await.unwrap();
|
||||
std::fs::create_dir_all(data.join("memory")).unwrap();
|
||||
let c = rusqlite::Connection::open(data.join("memory").join("history.sqlite")).unwrap();
|
||||
c.execute_batch(crate::history_view::TEST_SCHEMA).unwrap();
|
||||
let rec = |ts: f64, text: &str| c.execute("INSERT INTO history(ts, kind, channel_id, author_id, author_name, text, norm) \
|
||||
VALUES (?, 'voice', 'vc', '1', 'Alice', ?, ?)", rusqlite::params![ts, text, text]).unwrap();
|
||||
rec(1.0, "지난번 말");
|
||||
let texts = |v: &Value| v["items"].as_array().unwrap().iter().map(|i| i["text"].as_str().unwrap().to_string()).collect::<Vec<_>>();
|
||||
// Not started yet in this app run: no session, so nothing in it.
|
||||
let v = a.call("history_query", json!({"session": true})).await.unwrap();
|
||||
assert_eq!((texts(&v), v["session"].clone()), (Vec::<String>::new(), Value::Null));
|
||||
a.call("service_start", json!({})).await.unwrap();
|
||||
let started = a.call("history_query", json!({})).await.unwrap()["session"].as_f64().unwrap();
|
||||
rec(started + 1.0, "이번 말");
|
||||
assert_eq!(texts(&a.call("history_query", json!({"session": true})).await.unwrap()), ["이번 말"]);
|
||||
assert_eq!(texts(&a.call("history_query", json!({})).await.unwrap()), ["지난번 말", "이번 말"]);
|
||||
a.shutdown().await.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -69,6 +69,8 @@ struct Inner {
|
||||
/// The latest speech speed saved (equal to the settings file's): a start may have read the
|
||||
/// settings before it was saved, so the services get it again once they run.
|
||||
tts_speed: Option<f64>,
|
||||
/// When the latest start began (Unix seconds): the 대화 screen's current session.
|
||||
session: Option<f64>,
|
||||
}
|
||||
|
||||
pub struct Controller {
|
||||
@@ -80,13 +82,18 @@ pub struct Controller {
|
||||
impl Controller {
|
||||
pub fn new(host: impl Host) -> Arc<Self> {
|
||||
Arc::new(Self { host: Box::new(host), inner: Mutex::new(Inner { state: State::Stopped, error: None, running: None,
|
||||
dashboard: Arc::default(), feeder: None, stop_asked: false, tts_speed: None }), usage: tokio::sync::Mutex::new(None) })
|
||||
dashboard: Arc::default(), feeder: None, stop_asked: false, tts_speed: None, session: None }), usage: tokio::sync::Mutex::new(None) })
|
||||
}
|
||||
|
||||
pub fn state(&self) -> State {
|
||||
self.inner.lock().unwrap().state
|
||||
}
|
||||
|
||||
/// When the latest start began (Unix seconds), none before the first start of this app run.
|
||||
pub fn session_start(&self) -> Option<f64> {
|
||||
self.inner.lock().unwrap().session
|
||||
}
|
||||
|
||||
/// Start from stopped or failed; a failed start leaves nothing running.
|
||||
pub async fn start(&self) -> Result<(), String> {
|
||||
self.begin_start()?;
|
||||
@@ -112,6 +119,7 @@ impl Controller {
|
||||
i.state = State::Starting;
|
||||
i.error = None;
|
||||
i.stop_asked = false;
|
||||
i.session = Some(chrono::Utc::now().timestamp_millis() as f64 / 1000.0);
|
||||
self.host.prepare_start();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -215,11 +215,13 @@ pub fn query(path: &Path, bot: Option<&str>, q: &Query) -> Result<Value, String>
|
||||
let (id, ts): (i64, f64) = (r.get(0)?, r.get(1)?);
|
||||
let user: String = r.get(4)?;
|
||||
let steps: String = r.get(8)?;
|
||||
let ms: i64 = r.get(7)?;
|
||||
Ok(((ts, 1, id), json!({
|
||||
"key": format!("t{id}"), "type": "thought", "at": ts, "via": r.get::<_, String>(2)?,
|
||||
"channel": r.get::<_, Option<String>>(3)?,
|
||||
"who": {"id": user.clone(), "name": name_of(&user)},
|
||||
"question": r.get::<_, String>(5)?, "answer": r.get::<_, String>(6)?, "ms": r.get::<_, i64>(7)?,
|
||||
"question": r.get::<_, String>(5)?, "answer": r.get::<_, String>(6)?, "ms": ms.max(0),
|
||||
"pending": ms < 0,
|
||||
"steps": serde_json::from_str::<Value>(&steps).unwrap_or(json!([])),
|
||||
})))
|
||||
}).map_err(err)?;
|
||||
@@ -252,6 +254,26 @@ pub fn query(path: &Path, bot: Option<&str>, q: &Query) -> Result<Value, String>
|
||||
"people": people, "channels": channels}))
|
||||
}
|
||||
|
||||
/// A cheap mark of what the 대화 screen shows that changes when something is said or a question
|
||||
/// arrives (the newest record and trace), and as an answer is made (its steps) and ends, so the
|
||||
/// screen can poll it often and read the items again only when it changed.
|
||||
pub fn stamp(path: &Path) -> Result<String, String> {
|
||||
if !path.is_file() {
|
||||
return Ok("missing".into());
|
||||
}
|
||||
let c = open(path)?;
|
||||
let err = |e: rusqlite::Error| format!("대화 기록을 읽지 못했습니다: {e}");
|
||||
let said: Option<i64> = c.query_row("SELECT MAX(id) FROM history", [], |r| r.get(0)).map_err(err)?;
|
||||
let thought: (Option<i64>, i64, Option<i64>) = if has_traces(&c) {
|
||||
c.query_row("SELECT MAX(id), (SELECT COUNT(*) FROM traces WHERE ms < 0), \
|
||||
(SELECT SUM(LENGTH(steps)) FROM traces WHERE ms < 0) FROM traces", [], |r| Ok((r.get(0)?, r.get(1)?, r.get(2)?)))
|
||||
.map_err(err)?
|
||||
} else {
|
||||
(None, 0, None)
|
||||
};
|
||||
Ok(format!("{said:?}/{thought:?}"))
|
||||
}
|
||||
|
||||
/// The history store's tables as `src/jarvis/memory/history.py` makes them, for tests.
|
||||
#[cfg(test)]
|
||||
pub(crate) const TEST_SCHEMA: &str = "
|
||||
@@ -384,6 +406,43 @@ mod tests {
|
||||
assert!(Cursor::of(&json!({"at": 1.0, "key": "x1"})).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_trace_still_being_made_reads_as_pending_with_its_steps_so_far() {
|
||||
let (path, c) = db("pending");
|
||||
rec(&c, 10.0, "voice", "vc", "1", "Alice", None, "서울 날씨 어때");
|
||||
c.execute("INSERT INTO traces(ts, via, channel_id, user_id, question, answer, ms, steps) VALUES (?,?,?,?,?,?,?,?)",
|
||||
rusqlite::params![10.5, "voice", "vc", "1", "서울 날씨 어때", "", -1, r#"[{"kind":"tools","names":["getWeather"]}]"#])
|
||||
.unwrap();
|
||||
let v = query(&path, None, &Query::default()).unwrap();
|
||||
let t = &v["items"][1];
|
||||
assert_eq!((t["type"].as_str(), t["pending"].as_bool()), (Some("thought"), Some(true)));
|
||||
assert_eq!(t["steps"][0]["names"], json!(["getWeather"]));
|
||||
let done = query(&sample("pending-done"), None, &Query::default()).unwrap();
|
||||
assert_eq!(done["items"][1]["pending"], false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stamp_changes_when_a_question_is_answered_step_by_step_and_only_then() {
|
||||
let (path, c) = db("stamp");
|
||||
let now = || stamp(&path).unwrap();
|
||||
let empty = now();
|
||||
assert_eq!(now(), empty, "nothing changed");
|
||||
rec(&c, 10.0, "voice", "vc", "1", "Alice", None, "서울 날씨 어때");
|
||||
let said = now();
|
||||
assert_ne!(said, empty);
|
||||
c.execute("INSERT INTO traces(ts, via, channel_id, user_id, question, answer, ms, steps) \
|
||||
VALUES (10.5, 'voice', 'vc', '1', '서울 날씨 어때', '', -1, '[]')", []).unwrap();
|
||||
let asked = now();
|
||||
assert_ne!(asked, said, "a trace still being made");
|
||||
c.execute("UPDATE traces SET steps = '[{\"kind\":\"tools\",\"names\":[\"getWeather\"]}]'", []).unwrap();
|
||||
let step = now();
|
||||
assert_ne!(step, asked, "a step added");
|
||||
c.execute("UPDATE traces SET answer = '맑습니다', ms = 900", []).unwrap();
|
||||
assert_ne!(now(), step, "the answer");
|
||||
let dir = std::env::temp_dir().join(format!("jarvis-history-view-nostamp-{}", std::process::id()));
|
||||
assert!(stamp(&dir.join("history.sqlite")).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_bot_id_comes_from_its_token() {
|
||||
assert_eq!(bot_id_of_token("MTIzNDU2Nzg5MDEyMzQ1Njc4.GxYzAb.abcdef").as_deref(), Some("123456789012345678"));
|
||||
|
||||
@@ -221,6 +221,9 @@ pub struct Settings {
|
||||
/// Jarvis's voice channel (admin.spec.md, "Schedules"); None: not delivered then.
|
||||
pub schedule_channel: Option<u64>,
|
||||
pub pc_control: PcControlSettings,
|
||||
/// The window's close button (X) hides it to the tray instead of quitting (`app.closeButton`:
|
||||
/// "tray" or "quit", default "quit"; admin.spec.md, "Window and Windows build").
|
||||
pub close_to_tray: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -272,6 +275,7 @@ impl Default for Settings {
|
||||
pc_control: PcControlSettings { allowed_users: vec![], view: Level::Auto, click: Level::Ask,
|
||||
type_text: Level::Ask, run: Level::Ask,
|
||||
screen_exclude: ["1Password", "Bitwarden", "KeePass", "KeePassXC"].map(String::from).into() },
|
||||
close_to_tray: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -618,6 +622,11 @@ pub fn parse_settings(raw: &Value) -> Result<Settings, SettingsError> {
|
||||
game: parse_game(raw, &d.game)?,
|
||||
schedule_channel,
|
||||
pc_control: parse_pc_control(raw, &d.pc_control)?,
|
||||
close_to_tray: match get_str(section(raw, "app")?, "closeButton", "app", "quit")?.as_str() {
|
||||
"tray" => true,
|
||||
"quit" => false,
|
||||
_ => return err("app.closeButton must be tray or quit"),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -984,6 +993,16 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_close_button_choice_is_read_and_checked() {
|
||||
assert!(!parse_settings(&json!({})).unwrap().close_to_tray, "closing quits by default");
|
||||
assert!(parse_settings(&json!({"app": {"closeButton": "tray"}})).unwrap().close_to_tray);
|
||||
assert!(!parse_settings(&json!({"app": {"closeButton": "quit"}})).unwrap().close_to_tray);
|
||||
for bad in [json!({"app": {"closeButton": "hide"}}), json!({"app": {"closeButton": 1}}), json!({"app": 1})] {
|
||||
assert!(parse_settings(&bad).unwrap_err().0.contains("app"), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn game_detection_settings_are_read_and_checked() {
|
||||
assert_eq!(parse_settings(&json!({})).unwrap().game, GameSettings { detect: true, games: vec![], not_games: vec![], other_room_gb: 1.0, reserve_gb: 8.0, revert_seconds: 30, pause_in_game: false });
|
||||
|
||||
@@ -24,6 +24,7 @@ pub enum Screen {
|
||||
Game,
|
||||
Schedule,
|
||||
PcControl,
|
||||
App,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize)]
|
||||
@@ -159,6 +160,8 @@ pub fn fields() -> Vec<Field> {
|
||||
f("game.revertSeconds", Game, Int { min: 0, max: 600 }, json!(30), "게임이 끝난 뒤 평소 배치로 돌아가기까지(초)"),
|
||||
f("game.pauseInGame", Game, Bool, json!(false), "게임 중 일시정지(대답하지 않음)"),
|
||||
f("game.notGames", Game, TextList { max_items: 100, nullable: false }, json!([]), "게임이 아닌 프로그램(파일 이름)"),
|
||||
// The window (admin.spec.md, "Window and Windows build"): read when the close button is pressed.
|
||||
f("app.closeButton", App, Choice { values: &["quit", "tray"] }, json!("quit"), "창 닫기(X) 버튼을 누르면"),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
109
app/ui/app.js
109
app/ui/app.js
@@ -42,6 +42,7 @@ const LEVEL = { auto: "자동", ask: "먼저 묻기", never: "안 함" };
|
||||
const CHOICE = {
|
||||
"pcControl.view": LEVEL, "pcControl.click": LEVEL, "pcControl.type": LEVEL, "pcControl.run": LEVEL,
|
||||
"call.mode": { wakeWord: "호출어로 부를 때만", addressed: "자비스에게 하는 말로 보이면", everything: "모든 말" },
|
||||
"app.closeButton": { quit: "완전 종료", tray: "트레이로 최소화" },
|
||||
"response.policy": { first: "처음 대화만", inOrder: "순서대로", latest: "가장 최근 것", important: "중요한 것 먼저" },
|
||||
};
|
||||
const REASON = { busy: "다른 답을 하는 중", queue_full: "대기열이 가득 참", replaced: "더 새 요청이 대신함",
|
||||
@@ -384,7 +385,8 @@ const ACTIVITY = { "chat.send": "채팅 보내기", "chat.edit": "채팅 고치
|
||||
"chat.delete": "채팅 지우기", "chat.pin": "고정", "chat.unpin": "고정 풀기",
|
||||
"schedule.remind": "예약 알림 전달", "schedule.task": "정기 작업 전달", "collect.notify": "수집 소식 알림" };
|
||||
/** What Jarvis did outside its answers (admin.spec.md, "Activity"): kind, target, who asked, outcome. */
|
||||
function activityScreen() {
|
||||
/** The 로그 screen's 한 일 view: what Jarvis did in chat channels and schedule deliveries. */
|
||||
function activityView() {
|
||||
const list = h("div");
|
||||
const load = async () => {
|
||||
try {
|
||||
@@ -399,9 +401,9 @@ function activityScreen() {
|
||||
} catch (err) { fail(err); }
|
||||
};
|
||||
load();
|
||||
return h("div", {}, h("h1", {}, "한 일"), h("div", { class: "card" },
|
||||
return h("div", { class: "card" },
|
||||
h("div", { class: "hint" }, "자비스가 채팅 채널에서 한 동작과 예약 전달을 종류, 대상, 시킨 사람, 결과만 남깁니다. 내용은 남기지 않고 30일 뒤 지웁니다."),
|
||||
h("div", { class: "field" }, h("button", { class: "btn", onclick: load }, "새로 고침")), list));
|
||||
h("div", { class: "field" }, h("button", { class: "btn", onclick: load }, "새로 고침")), list);
|
||||
}
|
||||
|
||||
// ---- conversations ------------------------------------------------------------------------------
|
||||
@@ -441,16 +443,19 @@ function traceStep(s) {
|
||||
function conversationScreen() {
|
||||
const chip = (label, on = true) => { const c = h("input", { type: "checkbox", checked: on }); return [c, h("label", { class: "chip" }, c, label)]; };
|
||||
const [said, saidChip] = chip("사람 말"), [answered, answeredChip] = chip("자비스 말"), [thought, thoughtChip] = chip("자비스 생각");
|
||||
const [session, sessionChip] = chip("현재 세션", false); // from when the bot was last started
|
||||
const via = h("select", {}, h("option", { value: "" }, "모든 곳"), Object.entries(VIA).map(([v, t]) => h("option", { value: v }, t)));
|
||||
const person = h("select", {}, h("option", { value: "" }, "모든 사람"));
|
||||
const channel = h("select", {}, h("option", { value: "" }, "모든 채널"));
|
||||
const day = h("input", { type: "date" });
|
||||
const find = h("input", { type: "text", placeholder: "찾기 (말, 답, 생각)", style: "max-width:220px" });
|
||||
const live = h("input", { type: "checkbox", class: "switch", checked: true });
|
||||
const open = new Set(); // traces the user opened stay open across refreshes
|
||||
// Traces the user opened stay open across refreshes, and so does one seen while being made
|
||||
// unless the user closed it.
|
||||
const open = new Set(), shut = new Set();
|
||||
// `page`: the live window and the older pages (talk.js). Each filter change starts a new epoch;
|
||||
// answers from an earlier epoch, and live answers older than the newest one asked, are dropped.
|
||||
let expandAll = false, sig = null, page = empty(), missing = false;
|
||||
let expandAll = false, sig = null, page = empty(), missing = false, sessionAt = null;
|
||||
let epoch = 0, liveSeq = 0, first = true, loadingOlder = false;
|
||||
const box = h("div", { class: "talk" });
|
||||
const summary = h("div", { class: "small muted" });
|
||||
@@ -472,15 +477,20 @@ function conversationScreen() {
|
||||
const where = h("span", { class: "small muted" }, timeOf(i.at), " · ", VIA[i.via] || i.via, i.channel ? " · " + channelName(i.channel) : "");
|
||||
if (i.type === "thought") {
|
||||
const tools = (i.steps || []).filter((s) => s.kind === "tool" && !s.skipped).length;
|
||||
const summary = h("summary", {}, h("span", { class: "who" }, "자비스 생각"), " ",
|
||||
h("span", { class: "small muted" }, `${i.who.name || i.who.id}의 말에 답하며`, tools ? ` · 도구 ${tools}번` : "",
|
||||
i.pending ? " · 답을 만드는 중" : ` · ${(i.ms / 1000).toFixed(1)}초${i.answer ? "" : " · 답 없음"}`), " ", where);
|
||||
if (i.pending && !shut.has(i.key)) open.add(i.key); // stays open with its answer once done
|
||||
const d = h("details", { class: "msg thought", open: expandAll || open.has(i.key) },
|
||||
h("summary", {}, h("span", { class: "who" }, "자비스 생각"), " ",
|
||||
h("span", { class: "small muted" }, `${i.who.name || i.who.id}의 말에 답하며`, tools ? ` · 도구 ${tools}번` : "",
|
||||
` · ${(i.ms / 1000).toFixed(1)}초`, i.answer ? "" : " · 답 없음"), " ", where),
|
||||
summary,
|
||||
h("div", { class: "steps" },
|
||||
h("div", { class: "step-row" }, h("div", { class: "k" }, "받은 말"), h("div", {}, i.question)),
|
||||
(i.steps || []).map(traceStep),
|
||||
h("div", { class: "step-row" }, h("div", { class: "k" }, "답"), i.answer ? h("div", {}, i.answer) : h("span", { class: "badge bad" }, "답하지 못함"))));
|
||||
d.addEventListener("toggle", () => (d.open ? open.add(i.key) : open.delete(i.key)));
|
||||
h("div", { class: "step-row" }, h("div", { class: "k" }, "답"), i.pending ? h("div", {}, h("span", { class: "badge warn" }, "만드는 중"))
|
||||
: i.answer ? h("div", {}, i.answer) : h("span", { class: "badge bad" }, "답하지 못함"))));
|
||||
summary.addEventListener("click", () => {
|
||||
if (d.open) { open.delete(i.key); shut.add(i.key); } else { open.add(i.key); shut.delete(i.key); }
|
||||
});
|
||||
return d;
|
||||
}
|
||||
const mine = i.type === "answered";
|
||||
@@ -495,13 +505,13 @@ function conversationScreen() {
|
||||
const since = day.value ? new Date(day.value + "T00:00:00").getTime() / 1000 : null;
|
||||
return { said: said.checked, answered: answered.checked, thought: thought.checked,
|
||||
via: via.value || null, person: person.value || null, channel: channel.value || null, find: find.value || null,
|
||||
since, until: since == null ? null : since + 86400 };
|
||||
since, until: since == null ? null : since + 86400, session: session.checked };
|
||||
}
|
||||
|
||||
function render(keepTop = false) {
|
||||
const items = page.older.concat(page.shown);
|
||||
// The whole items, so an edited message or a changed answer is redrawn too.
|
||||
const s = JSON.stringify([items, expandAll, page.hasOlder, missing]);
|
||||
const s = JSON.stringify([items, expandAll, page.hasOlder, missing, session.checked, sessionAt]);
|
||||
if (s === sig) return;
|
||||
sig = s;
|
||||
const stick = box.scrollTop + box.clientHeight >= box.scrollHeight - 30, fromBottom = box.scrollHeight - box.scrollTop;
|
||||
@@ -513,10 +523,13 @@ function conversationScreen() {
|
||||
kids.push(item(i));
|
||||
}
|
||||
box.replaceChildren(...(kids.length ? kids : [h("div", { class: "muted" },
|
||||
missing ? "아직 대화 기록이 없습니다. 서비스를 켜고 자비스와 이야기하면 여기에 나옵니다." : "조건에 맞는 기록이 없습니다.")]));
|
||||
missing ? "아직 대화 기록이 없습니다. 서비스를 켜고 자비스와 이야기하면 여기에 나옵니다."
|
||||
: session.checked && sessionAt == null ? "앱을 켠 뒤 아직 봇을 시작하지 않았습니다. 대시보드에서 시작하면 그때부터의 대화가 여기에 나옵니다."
|
||||
: "조건에 맞는 기록이 없습니다.")]));
|
||||
more.hidden = !page.hasOlder;
|
||||
const n = (t) => items.filter((i) => i.type === t).length;
|
||||
summary.textContent = `사람 말 ${n("said")} · 자비스 말 ${n("answered")} · 생각 ${n("thought")}` + (page.hasOlder ? " (이전 기록 더 있음)" : "");
|
||||
summary.textContent = (session.checked && sessionAt != null ? `${dayOf(sessionAt)} ${timeOf(sessionAt)}에 시작한 봇부터 · ` : "")
|
||||
+ `사람 말 ${n("said")} · 자비스 말 ${n("answered")} · 생각 ${n("thought")}` + (page.hasOlder ? " (이전 기록 더 있음)" : "");
|
||||
if (keepTop) box.scrollTop = box.scrollHeight - fromBottom;
|
||||
else if (stick || first) box.scrollTop = box.scrollHeight;
|
||||
first = false;
|
||||
@@ -536,6 +549,9 @@ function conversationScreen() {
|
||||
if (ep !== epoch || my !== liveSeq) return;
|
||||
lists(r);
|
||||
missing = !!r.missing;
|
||||
// A new start while the current session is shown: its window starts over at the new start.
|
||||
if (session.checked && sessionAt != null && r.session !== sessionAt) { sessionAt = r.session; reload(); return; }
|
||||
sessionAt = r.session ?? null;
|
||||
page = withLive(page, r.items, r.more);
|
||||
render();
|
||||
} catch (e) { fail(e); }
|
||||
@@ -561,19 +577,33 @@ function conversationScreen() {
|
||||
const reload = () => {
|
||||
epoch++; sig = null; page = empty(); first = true; loadingOlder = more.disabled = false; load();
|
||||
};
|
||||
for (const el of [said, answered, thought, via, person, channel, day]) el.addEventListener("change", reload);
|
||||
for (const el of [said, answered, thought, session, via, person, channel, day]) el.addEventListener("change", reload);
|
||||
find.addEventListener("input", () => { clearTimeout(find.t); find.t = setTimeout(reload, 300); });
|
||||
const view = h("div", {}, h("h1", {}, "대화"),
|
||||
h("div", { class: "card filters" },
|
||||
h("div", { class: "row" }, saidChip, answeredChip, thoughtChip),
|
||||
h("div", { class: "row" }, saidChip, answeredChip, thoughtChip, sessionChip),
|
||||
h("div", { class: "row" }, via, person, channel, day, find),
|
||||
h("div", { class: "row" }, h("label", { class: "row small muted" }, live, "실시간"),
|
||||
h("button", { class: "btn", onclick: () => { expandAll = !expandAll; if (!expandAll) open.clear(); sig = null; load(); } }, "생각 모두 펼치기/접기"),
|
||||
h("button", { class: "btn", onclick: () => { expandAll = !expandAll; open.clear(); shut.clear(); sig = null; load(); } }, "생각 모두 펼치기/접기"),
|
||||
h("button", { class: "btn", onclick: () => { sig = null; load(); } }, "새로 고침"), summary)),
|
||||
h("div", { class: "hint", style: "margin:8px 0" }, "사람이 한 말, 자비스의 답, 자비스가 답을 만든 과정(참고한 기록, 고른 도구, 계획, 도구 호출과 결과, 모델 생각)을 시간순으로 보여 줍니다. 모델 생각은 생각 모드가 켜진 답에만 있습니다. 생각 기록은 30일 동안 둡니다. 실시간으로 다시 읽는 것은 최근 2,000개까지이고, 그보다 앞서 불러온 기록의 수정과 삭제는 화면을 다시 열면 보입니다."),
|
||||
h("div", { class: "hint", style: "margin:8px 0" }, "사람이 한 말, 자비스의 답, 자비스가 답을 만든 과정(참고한 기록, 고른 도구, 계획, 도구 호출과 결과, 모델 생각)을 시간순으로 보여 줍니다. 자비스가 말을 알아들은 순간 생각이 나타나고, 답을 만드는 동안 단계가 하나씩 채워집니다. 모델 생각은 생각 모드가 켜진 답에만 있습니다. 생각 기록은 30일 동안 둡니다. 실시간으로 다시 읽는 것은 최근 2,000개까지이고, 그보다 앞서 불러온 기록의 수정과 삭제는 화면을 다시 열면 보입니다."),
|
||||
h("div", { class: "row", style: "justify-content:center" }, more), box);
|
||||
load();
|
||||
return { view, tick: () => live.checked && load() };
|
||||
// Twice a second the store's stamp (cheap): when something was said, a question arrived or an
|
||||
// answer moved on, the window is read again at once, so a trace shows from its question on and
|
||||
// fills in as it goes. Every 3 seconds it is read anyway (an edited message changes no stamp).
|
||||
let ticks = 0, stamp = null, asking = false;
|
||||
const tick = async () => {
|
||||
if (!live.checked) return;
|
||||
if (++ticks % 6 === 0) return load();
|
||||
if (asking) return;
|
||||
asking = true;
|
||||
try {
|
||||
const s = (await api("history_stamp")).stamp;
|
||||
if (s !== stamp) { stamp = s; load(); }
|
||||
} catch (e) { /* the next tick tries again */ } finally { asking = false; }
|
||||
};
|
||||
return { view, tick };
|
||||
}
|
||||
|
||||
async function settingsScreen(screen, title, extra) {
|
||||
@@ -793,7 +823,7 @@ function logsScreen() {
|
||||
find.addEventListener("input", () => { clearTimeout(find.t); find.t = setTimeout(reload, 300); });
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
const from = h("input", { type: "date", value: today }), to = h("input", { type: "date", value: today });
|
||||
const view = h("div", {}, h("h1", {}, "로그"),
|
||||
const logs = h("div", {},
|
||||
h("div", { class: "row", style: "margin-bottom:10px" }, tab, level, find, h("label", { class: "row small muted" }, pause, "일시정지"),
|
||||
h("button", { class: "btn", onclick: async () => {
|
||||
try {
|
||||
@@ -811,14 +841,25 @@ function logsScreen() {
|
||||
toast(`${r.path}에 저장했습니다${r.droppedLines ? ` (10MB를 넘어 오래된 ${r.droppedLines}줄은 뺐습니다)` : ""}`);
|
||||
} catch (e) { fail(e); }
|
||||
} }, "zip으로 저장")));
|
||||
// 로그 and 한 일 (the activity) on one screen; 한 일 is read again each time it is opened.
|
||||
const body = h("div");
|
||||
const switches = [["로그", () => logs], ["한 일", activityView]].map(([label, make]) => {
|
||||
const b = h("button", { class: "btn", onclick: () => {
|
||||
for (const x of switches) x.classList.toggle("primary", x === b);
|
||||
body.replaceChildren(make());
|
||||
} }, label);
|
||||
return b;
|
||||
});
|
||||
const view = h("div", {}, h("h1", {}, "로그"), h("div", { class: "row", style: "margin-bottom:12px" }, switches), body);
|
||||
switches[0].click();
|
||||
reload();
|
||||
return { view, tick: poll };
|
||||
return { view, tick: () => logs.isConnected && poll() };
|
||||
}
|
||||
|
||||
// ---- update -------------------------------------------------------------------------------------
|
||||
|
||||
/** The update screen: the version here, the newest release, its download and install. */
|
||||
function updateScreen() {
|
||||
/** The 앱 screen's update card: the version here, the newest release, its download and install. */
|
||||
function updateCard() {
|
||||
const body = h("div");
|
||||
let key = null;
|
||||
async function tick() {
|
||||
@@ -836,7 +877,7 @@ function updateScreen() {
|
||||
const line = { idle: "아직 확인하지 않았습니다", checking: "확인하는 중…", upToDate: "최신 버전입니다",
|
||||
available: `새 버전 ${u.latest?.version}이 있습니다`, downloading: `받는 중${pct != null ? ` ${pct}%` : ""}`,
|
||||
ready: `${u.latest?.version}을 설치할 준비가 됐습니다`, failed: u.error ?? "실패했습니다" }[u.phase] ?? u.phase;
|
||||
body.replaceChildren(h("div", { class: "card" },
|
||||
body.replaceChildren(h("div", { class: "card" }, h("h2", {}, "업데이트"),
|
||||
h("div", { class: "kv" }, h("span", { class: "k" }, "현재 버전"), h("span", {}, u.current),
|
||||
h("span", { class: "k" }, "상태"), h("span", { style: u.phase === "failed" ? "color:var(--bad)" : "" }, line)),
|
||||
h("div", { class: "row", style: "margin-top:12px" },
|
||||
@@ -848,15 +889,15 @@ function updateScreen() {
|
||||
h("pre", { class: "small", style: "white-space:pre-wrap" }, u.latest.notes)) : "");
|
||||
}
|
||||
tick();
|
||||
return { view: h("div", {}, h("h1", {}, "업데이트"), body), tick };
|
||||
return { view: body, tick };
|
||||
}
|
||||
|
||||
/** Look for a new version once when the app opens; the nav button says so when there is one. */
|
||||
async function checkUpdate() {
|
||||
try {
|
||||
const u = await api("update_check");
|
||||
if (u.latest) { $("#nav-update").textContent = "업데이트 (새 버전)"; toast(`새 버전 ${u.latest.version}이 있습니다. 업데이트 화면에서 설치할 수 있습니다.`); }
|
||||
} catch (e) { /* offline: the update screen shows why */ }
|
||||
if (u.latest) { $("#nav-app").textContent = "앱 (새 버전)"; toast(`새 버전 ${u.latest.version}이 있습니다. 앱 화면에서 설치할 수 있습니다.`); }
|
||||
} catch (e) { /* offline: the 앱 screen shows why */ }
|
||||
}
|
||||
|
||||
// ---- navigation ---------------------------------------------------------------------------------
|
||||
@@ -892,18 +933,20 @@ async function show(name) {
|
||||
try {
|
||||
if (name === "dashboard") { screen.replaceChildren(); await refresh(); ticker = setInterval(refresh, 1000); return; }
|
||||
if (name === "logs") { const l = logsScreen(); screen.replaceChildren(l.view); ticker = setInterval(l.tick, 1000); return; }
|
||||
if (name === "activity") { screen.replaceChildren(activityScreen()); return; }
|
||||
if (name === "conversations") { const c = conversationScreen(); screen.replaceChildren(c.view); ticker = setInterval(c.tick, 3000); return; }
|
||||
if (name === "conversations") { const c = conversationScreen(); screen.replaceChildren(c.view); ticker = setInterval(c.tick, 500); return; }
|
||||
if (name === "notes") { screen.replaceChildren(notesScreen()); return; }
|
||||
if (name === "update") { const u = updateScreen(); screen.replaceChildren(u.view); ticker = setInterval(u.tick, 1000); return; }
|
||||
const titles = { bot: "봇", channels: "채널·호출", chat: "채팅 채널", memory: "대화 기억", model: "모델", features: "기능",
|
||||
collect: "백그라운드 수집", game: "게임 모드", schedule: "예약", pcControl: "PC 제어" };
|
||||
const extra = name === "bot" ? await tokenCard() : name === "features" ? await displayDriverCard() : null;
|
||||
collect: "백그라운드 수집", game: "게임 모드", schedule: "예약", pcControl: "PC 제어", app: "앱" };
|
||||
const update = name === "app" ? updateCard() : null;
|
||||
const extra = name === "bot" ? await tokenCard() : name === "features" ? await displayDriverCard()
|
||||
: name === "app" ? h("div", {}, update.view, h("div", { class: "hint", style: "margin:12px 0" }, "트레이로 최소화하면 창만 숨고 봇과 서비스는 계속 돕니다. 작업 표시줄 오른쪽의 Jarvis 아이콘을 누르면 창이 다시 열리고, 아이콘의 오른쪽 클릭 메뉴에서 완전 종료할 수 있습니다. 저장하면 바로 적용됩니다.")) : null;
|
||||
const view = await settingsScreen(name, titles[name], extra);
|
||||
if (name === "collect") view.append(await collectResults());
|
||||
if (name === "schedule") view.append(await scheduleList());
|
||||
if (name === "pcControl") view.append(await permissionsCard());
|
||||
if (my === gen) screen.replaceChildren(view);
|
||||
if (my !== gen) return;
|
||||
screen.replaceChildren(view);
|
||||
if (update) ticker = setInterval(update.tick, 1000);
|
||||
} catch (e) { fail(e); }
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<nav class="side">
|
||||
<div class="brand">Jarvis</div>
|
||||
<button data-screen="dashboard" class="nav">대시보드</button>
|
||||
<button data-screen="conversations" class="nav">대화</button>
|
||||
<button data-screen="bot" class="nav">봇</button>
|
||||
<button data-screen="channels" class="nav">채널·호출</button>
|
||||
<button data-screen="chat" class="nav">채팅 채널</button>
|
||||
@@ -22,11 +23,9 @@
|
||||
<button data-screen="schedule" class="nav">예약</button>
|
||||
<button data-screen="pcControl" class="nav">PC 제어</button>
|
||||
<button data-screen="notes" class="nav">사람별 지침</button>
|
||||
<button data-screen="conversations" class="nav">대화</button>
|
||||
<button data-screen="activity" class="nav">한 일</button>
|
||||
<button data-screen="game" class="nav">게임 모드</button>
|
||||
<button data-screen="logs" class="nav">로그</button>
|
||||
<button data-screen="update" class="nav" id="nav-update">업데이트</button>
|
||||
<button data-screen="app" class="nav" id="nav-app">앱</button>
|
||||
<div class="side-foot" id="version"></div>
|
||||
</nav>
|
||||
<main id="screen" class="screen"></main>
|
||||
|
||||
@@ -44,13 +44,13 @@ CREATE TABLE IF NOT EXISTS presence (
|
||||
CREATE INDEX IF NOT EXISTS presence_user ON presence(user_id, channel_id);
|
||||
CREATE TABLE IF NOT EXISTS traces (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ts REAL NOT NULL, -- when the answer was ready
|
||||
ts REAL NOT NULL, -- when it was asked
|
||||
via TEXT NOT NULL, -- voice | chat | task
|
||||
channel_id TEXT, -- where it was asked; none for a task
|
||||
user_id TEXT NOT NULL,
|
||||
question TEXT NOT NULL,
|
||||
answer TEXT NOT NULL, -- empty when the brain gave none
|
||||
ms INTEGER NOT NULL,
|
||||
ms INTEGER NOT NULL, -- -1 while the answer is being made
|
||||
steps TEXT NOT NULL -- JSON list (history.spec.md, "Traces")
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS traces_ts ON traces(ts);
|
||||
@@ -107,6 +107,10 @@ class HistoryContext:
|
||||
matches: List[str] = field(default_factory=list)
|
||||
|
||||
|
||||
def _steps_json(steps: list) -> str:
|
||||
return json.dumps(steps, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
def _fold(text: str) -> str:
|
||||
"""One Unicode folding for stored text and query words alike (NFKC, then case folding),
|
||||
so matching does not depend on SQLite's ASCII-only lower()."""
|
||||
@@ -225,16 +229,34 @@ class HistoryStore:
|
||||
|
||||
# -- maintenance --------------------------------------------------------
|
||||
|
||||
def add_trace(self, via: str, channel_id: Optional[str], user_id: str, question: str, answer: str,
|
||||
steps: list, ms: int, ts: float) -> int:
|
||||
def start_trace(self, via: str, channel_id: Optional[str], user_id: str, question: str, ts: float) -> int:
|
||||
"""A trace from the moment it was asked: no answer yet and ``ms`` -1."""
|
||||
with self._lock:
|
||||
cur = self._conn.execute(
|
||||
"INSERT INTO traces(ts, via, channel_id, user_id, question, answer, ms, steps) VALUES (?,?,?,?,?,?,?,?)",
|
||||
(ts, via, channel_id, user_id, question, answer or "", int(ms),
|
||||
json.dumps(steps, ensure_ascii=False, default=str)))
|
||||
"INSERT INTO traces(ts, via, channel_id, user_id, question, answer, ms, steps) VALUES (?,?,?,?,?,'',-1,'[]')",
|
||||
(ts, via, channel_id, user_id, question))
|
||||
self._conn.commit()
|
||||
return int(cur.lastrowid)
|
||||
|
||||
def trace_steps(self, trace_id: int, steps: list) -> None:
|
||||
"""The steps so far of a trace still being made."""
|
||||
with self._lock:
|
||||
self._conn.execute("UPDATE traces SET steps=? WHERE id=?", (_steps_json(steps), trace_id))
|
||||
self._conn.commit()
|
||||
|
||||
def finish_trace(self, trace_id: int, answer: str, steps: list, ms: int) -> None:
|
||||
with self._lock:
|
||||
self._conn.execute("UPDATE traces SET answer=?, steps=?, ms=? WHERE id=?",
|
||||
(answer or "", _steps_json(steps), max(0, int(ms)), trace_id))
|
||||
self._conn.commit()
|
||||
|
||||
def close_unfinished_traces(self) -> int:
|
||||
"""End, with no answer, the traces a killed run left being made (the host calls it at start)."""
|
||||
with self._lock:
|
||||
n = self._conn.execute("UPDATE traces SET ms=0 WHERE ms < 0").rowcount
|
||||
self._conn.commit()
|
||||
return n
|
||||
|
||||
def traces_of(self, person: str) -> List[Trace]:
|
||||
with self._lock:
|
||||
rows = self._conn.execute(
|
||||
|
||||
@@ -73,10 +73,13 @@ Setting `since` (default none, meaning the whole history) drops records older th
|
||||
How each answer was made, for the management app's 대화 screen (`app/src/admin.spec.md`,
|
||||
"Conversations"). A trace is never a record: no read above returns it and it never reaches a prompt.
|
||||
|
||||
- `add_trace(via, channel_id, user_id, question, answer, steps, ms, ts)`: one per `reply` the brain
|
||||
ran (`via` `voice`, `chat` or `task`; `channel_id` where it was asked, none for a task; `answer`
|
||||
empty when the brain gave none; `ts` when it was ready; `ms` how long it took). `steps` is a JSON
|
||||
list in the order they happened:
|
||||
- One per `reply` the brain ran, kept from the moment it was asked so the screen can show it while
|
||||
the answer is made: `start_trace(via, channel_id, user_id, question, ts)` (`via` `voice`, `chat` or
|
||||
`task`; `channel_id` where it was asked, none for a task; `ts` when it was asked) stores it with no
|
||||
answer and `ms` -1, `trace_steps(id, steps)` stores the steps so far, and
|
||||
`finish_trace(id, answer, steps, ms)` the end (`answer` empty when the brain gave none; `ms` how
|
||||
long it took). `close_unfinished_traces()`, which the host calls at start, ends with no answer the
|
||||
traces a killed run left at -1. `steps` is a JSON list in the order they happened:
|
||||
- `{"kind": "records", "recent": [...], "matches": [...], "notes": n}`: the history lines and the
|
||||
number of personal notes the brain was given (the voice worker adds it first),
|
||||
- `{"kind": "tools", "names": [...]}`: the tools the turn was offered after routing,
|
||||
@@ -87,7 +90,7 @@ How each answer was made, for the management app's 대화 screen (`app/src/admin
|
||||
error (at most 2,000 characters), or `"skipped": "not_allowed" | "duplicate"` with `ok` false
|
||||
for a call the engine refused.
|
||||
The engine writes them through `turn_state.trace` (`reply/turn_state.py`), which does nothing when
|
||||
no trace list was set (v1, evals).
|
||||
no trace list was set (v1, evals); the voice worker's list stores the steps as each is added.
|
||||
- `traces_of(person)`: the person's traces, oldest first. `forget_person` deletes them too.
|
||||
- `purge_traces_older_than(ts)`: the voice worker keeps traces 30 days (`TRACE_KEEP_DAYS`) and
|
||||
removes older ones when it starts. `purge_older_than` removes old traces with the records.
|
||||
|
||||
@@ -55,6 +55,37 @@ MAX_NOTE_CHARS = 300
|
||||
TRACE_KEEP_DAYS = 30
|
||||
|
||||
|
||||
class _LiveTrace(list):
|
||||
"""A reply's trace (history.spec.md, "Traces"): stored as soon as the request arrives and again
|
||||
as each step is added, so the 대화 screen fills it in while the answer is made. The engine adds
|
||||
steps from the brain's thread. Storing never stops the answer."""
|
||||
|
||||
def __init__(self, store, via: str, channel: str | None, user: str, question: str):
|
||||
super().__init__()
|
||||
self.store, self.began, self.id = store, time.time(), None
|
||||
if store is not None:
|
||||
self.id = self._keep(store.start_trace, via, channel, user, question, ts=self.began)
|
||||
|
||||
@staticmethod
|
||||
def _keep(write, *args, **kw):
|
||||
try:
|
||||
return write(*args, **kw)
|
||||
except Exception as e: # noqa: BLE001 - a trace is a view, not part of the answer
|
||||
debug_log(f"trace not kept: {type(e).__name__}", "llm")
|
||||
return None
|
||||
|
||||
def append(self, step) -> None:
|
||||
super().append(step)
|
||||
if self.id is not None:
|
||||
self._keep(self.store.trace_steps, self.id, list(self))
|
||||
|
||||
def finish(self, answer: str) -> None:
|
||||
if self.id is not None:
|
||||
self._keep(self.store.finish_trace, self.id, answer, list(self),
|
||||
ms=round((time.time() - self.began) * 1000))
|
||||
self.id = None
|
||||
|
||||
|
||||
class VoiceWorker:
|
||||
def _partials_held(self) -> bool:
|
||||
return self.llm_game and self.answering > 0
|
||||
@@ -118,6 +149,9 @@ class VoiceWorker:
|
||||
n = self.history.close_open_presence(time.time())
|
||||
if n:
|
||||
debug_log(f"closed {n} presence intervals left open by a previous run", "voice_worker")
|
||||
n = self.history.close_unfinished_traces()
|
||||
if n:
|
||||
debug_log(f"closed {n} answer traces left unfinished by a previous run", "voice_worker")
|
||||
n = self.history.purge_traces_older_than(time.time() - TRACE_KEEP_DAYS * 86400)
|
||||
if n:
|
||||
debug_log(f"removed {n} answer traces older than {TRACE_KEEP_DAYS} days", "voice_worker")
|
||||
@@ -609,26 +643,22 @@ class Session:
|
||||
asyncio.get_running_loop().create_task(self._reply(rid, user, text, via, speak, early, channel, notes))
|
||||
|
||||
@staticmethod
|
||||
def _trace_start(history, notes: list | None) -> list:
|
||||
def _records_step(history, notes: list | None) -> dict:
|
||||
"""The first step of an answer's trace: the records and notes it was given."""
|
||||
return [{"kind": "records", "recent": list(history.recent), "matches": list(history.matches),
|
||||
"notes": len(notes or [])}]
|
||||
|
||||
def _trace_end(self, via: str, channel: str | None, user: str, question: str, answer: str,
|
||||
steps: list, began: float) -> None:
|
||||
"""Keep how this answer was made (history.spec.md, "Traces"); never stops the answer."""
|
||||
if self.worker.history is None:
|
||||
return
|
||||
try:
|
||||
self.worker.history.add_trace(via, channel, user, question, answer, steps,
|
||||
ms=round((time.time() - began) * 1000), ts=time.time())
|
||||
except Exception as e: # noqa: BLE001 - a trace is a view, not part of the answer
|
||||
debug_log(f"trace not kept: {type(e).__name__}", "llm")
|
||||
return {"kind": "records", "recent": list(history.recent), "matches": list(history.matches),
|
||||
"notes": len(notes or [])}
|
||||
|
||||
async def _task(self, rid: str, user: str, text: str, notes: list | None = None) -> None:
|
||||
"""A scheduled task (schedule.spec.md, "Tasks"): answered in the chat lane with the read-only
|
||||
tools, its own short-term memory and the person's history scope. It is not a turn of their
|
||||
conversation, so their turn count and delete confirmations stay as they are."""
|
||||
trace = _LiveTrace(self.worker.history, "task", None, user, text)
|
||||
try:
|
||||
await self._task_inner(rid, user, text, notes, trace)
|
||||
finally:
|
||||
trace.finish("") # only when it did not get to its answer
|
||||
|
||||
async def _task_inner(self, rid: str, user: str, text: str, notes: list | None, trace: _LiveTrace) -> None:
|
||||
w = self.worker
|
||||
answer = None
|
||||
async with w.brain_people.setdefault(user, asyncio.Lock()), w.brain_lanes["chat"]:
|
||||
@@ -644,14 +674,14 @@ class Session:
|
||||
from jarvis.memory.history import HistoryContext
|
||||
history = HistoryContext()
|
||||
try:
|
||||
steps = self._trace_start(history, notes)
|
||||
trace.append(self._records_step(history, notes))
|
||||
async with self._llm():
|
||||
answer = await asyncio.to_thread(w.brain.reply, user, text, history, task=True,
|
||||
notes=notes or [], trace=steps)
|
||||
notes=notes or [], trace=trace)
|
||||
except Exception as e: # the brain must never take the session down
|
||||
debug_log(f"brain task {rid} failed: {type(e).__name__}", "llm")
|
||||
answer = (answer or "").strip()
|
||||
self._trace_end("task", None, user, text, answer, steps, now)
|
||||
trace.finish(answer)
|
||||
self.send({"type": "reply_text", "id": rid, "text": answer, "failed": not answer})
|
||||
|
||||
def _on_llm(self, msg: dict) -> None:
|
||||
@@ -791,9 +821,11 @@ class Session:
|
||||
|
||||
async def _reply(self, rid: str, user: str, text: str, via: str, speak: bool, early: bool = False,
|
||||
channel: str | None = None, notes: list | None = None) -> None:
|
||||
trace = _LiveTrace(self.worker.history, via, self.voice_channel if via == "voice" else channel, user, text)
|
||||
try:
|
||||
await self._reply_inner(rid, user, text, via, speak, early, channel, notes or [])
|
||||
await self._reply_inner(rid, user, text, via, speak, early, channel, notes or [], trace=trace)
|
||||
finally:
|
||||
trace.finish("") # only when it did not get to its answer
|
||||
self.thinking_replies.discard(rid)
|
||||
self.cancelled_replies.discard(rid)
|
||||
if not self._handed_over.pop(rid, False): # else _delivered counts it
|
||||
@@ -830,7 +862,8 @@ class Session:
|
||||
self._delivered(rid, ok)
|
||||
|
||||
async def _reply_inner(self, rid: str, user: str, text: str, via: str, speak: bool, early: bool,
|
||||
chat_channel: str | None = None, notes: list | None = None) -> None:
|
||||
chat_channel: str | None = None, notes: list | None = None, *,
|
||||
trace: _LiveTrace) -> None:
|
||||
w = self.worker
|
||||
channel = self.voice_channel
|
||||
# Person first, then lane: a reply waiting for its asker's other answer holds no lane.
|
||||
@@ -858,7 +891,7 @@ class Session:
|
||||
schedule = AppBridge(self, asyncio.get_running_loop(), "schedule", *origin)
|
||||
notes_backend = AppBridge(self, asyncio.get_running_loop(), "note", *origin)
|
||||
screen = AppBridge(self, asyncio.get_running_loop(), "screen", *origin)
|
||||
steps = self._trace_start(history, notes)
|
||||
trace.append(self._records_step(history, notes))
|
||||
try:
|
||||
async with self._llm(rid if speak else None):
|
||||
w.answering += 1
|
||||
@@ -866,7 +899,7 @@ class Session:
|
||||
answer = await asyncio.to_thread(w.brain.reply, user, text, history, chat=chat,
|
||||
schedule=schedule, notes=notes or [],
|
||||
notes_backend=notes_backend, screen=screen,
|
||||
trace=steps)
|
||||
trace=trace)
|
||||
finally:
|
||||
w.answering -= 1
|
||||
if not w.answering and w.scheduler:
|
||||
@@ -875,7 +908,7 @@ class Session:
|
||||
debug_log(f"brain reply {rid} failed: {type(e).__name__}", "llm")
|
||||
answer = None
|
||||
answer = (answer or "").strip()
|
||||
self._trace_end(via, channel if via == "voice" else chat_channel, user, text, answer, steps, now)
|
||||
trace.finish(answer)
|
||||
if not answer and rid in self.tts_requests:
|
||||
self._on_tts({"type": "tts", "id": rid, "text": "", "more": False}) # ends the notice's speech
|
||||
self.send({"type": "reply_text", "id": rid, "text": answer, "failed": not answer})
|
||||
|
||||
@@ -248,8 +248,11 @@ which carry Discord's own time.
|
||||
still answering means the answer is not spoken: `reply_text` still comes, then `tts_done` with
|
||||
`cancelled: true` and no audio. Every reply, a task's too and one that failed, leaves a trace of
|
||||
how it was made (`history.spec.md`, "Traces"): the history lines and number of notes it was given,
|
||||
then what the engine wrote down; a trace that cannot be stored never stops the answer. Traces older
|
||||
than 30 days are removed when the worker starts. Each user keeps their own short-term dialogue
|
||||
then what the engine wrote down. It is stored as soon as the request arrives (before it waits for
|
||||
the asker's previous answer) and again as each step is added, then ends with the answer, or with
|
||||
none when the reply fails, the session closes or the reply is cancelled; a trace that cannot be
|
||||
stored never stops the answer. At start the worker ends the traces a killed run left unfinished
|
||||
and removes those older than 30 days. Each user keeps their own short-term dialogue
|
||||
memory (tool carry-over) across replies. The brain runs the reply engine with v1's single-user
|
||||
memory off (`legacy_memory=False`: no warm profile, diary or graph), because several people share
|
||||
this assistant and only the asker's scoped history may reach the prompt. It answers in Korean
|
||||
|
||||
@@ -243,10 +243,11 @@ def test_chat_tool_reads_and_searches_one_channels_messages(store):
|
||||
def test_how_an_answer_was_made_is_kept_per_person_and_never_searched(store):
|
||||
steps = [{"kind": "tools", "names": ["getWeather"]},
|
||||
{"kind": "tool", "name": "getWeather", "args": {"location": "서울"}, "ok": True, "result": "맑음"}]
|
||||
store.add_trace("voice", VC, "a", "서울 날씨 어때", "맑습니다", steps, ms=1200, ts=T0)
|
||||
store.add_trace("chat", CHAT, "b", "안녕", "", [], ms=50, ts=T0 + 1)
|
||||
store.finish_trace(store.start_trace("voice", VC, "a", "서울 날씨 어때", ts=T0), "맑습니다", steps, ms=1200)
|
||||
store.finish_trace(store.start_trace("chat", CHAT, "b", "안녕", ts=T0 + 1), "", [], ms=50)
|
||||
[t] = store.traces_of("a")
|
||||
assert (t.via, t.channel_id, t.question, t.answer, t.ms, t.steps) == ("voice", VC, "서울 날씨 어때", "맑습니다", 1200, steps)
|
||||
assert t.ts == T0 # when it was asked, not when the answer was ready
|
||||
# A trace is no record: the brain never reads it back as history.
|
||||
assert store.search("a", "날씨", scope=Scope()) == []
|
||||
assert store.recent("a", T0 + 2, scope=Scope()) == []
|
||||
@@ -255,9 +256,30 @@ def test_how_an_answer_was_made_is_kept_per_person_and_never_searched(store):
|
||||
|
||||
|
||||
def test_traces_have_their_own_retention_and_follow_the_history_retention(store):
|
||||
store.add_trace("voice", VC, "a", "옛 질문", "옛 답", [], ms=1, ts=T0)
|
||||
store.add_trace("voice", VC, "a", "새 질문", "새 답", [], ms=1, ts=T0 + 100)
|
||||
store.finish_trace(store.start_trace("voice", VC, "a", "옛 질문", ts=T0), "옛 답", [], ms=1)
|
||||
store.finish_trace(store.start_trace("voice", VC, "a", "새 질문", ts=T0 + 100), "새 답", [], ms=1)
|
||||
store.purge_traces_older_than(T0 + 50)
|
||||
assert [t.question for t in store.traces_of("a")] == ["새 질문"]
|
||||
store.purge_older_than(T0 + 200)
|
||||
assert store.traces_of("a") == []
|
||||
|
||||
|
||||
def test_a_trace_is_kept_from_the_question_on_and_filled_in_as_the_answer_is_made(store):
|
||||
tid = store.start_trace("voice", VC, "a", "서울 날씨 어때", ts=T0)
|
||||
[t] = store.traces_of("a")
|
||||
assert (t.question, t.answer, t.ms, t.steps) == ("서울 날씨 어때", "", -1, []) # -1: still being made
|
||||
store.trace_steps(tid, [{"kind": "tools", "names": ["getWeather"]}])
|
||||
assert store.traces_of("a")[0].steps == [{"kind": "tools", "names": ["getWeather"]}]
|
||||
assert store.traces_of("a")[0].ms == -1
|
||||
store.finish_trace(tid, "맑습니다", [{"kind": "tools", "names": ["getWeather"]}], ms=900)
|
||||
[t] = store.traces_of("a")
|
||||
assert (t.answer, t.ms, t.ts) == ("맑습니다", 900, T0)
|
||||
|
||||
|
||||
def test_traces_a_killed_run_left_unfinished_are_closed_without_an_answer(store):
|
||||
store.start_trace("voice", VC, "a", "끊긴 질문", ts=T0)
|
||||
store.finish_trace(store.start_trace("voice", VC, "a", "끝난 질문", ts=T0 + 1), "답", [], ms=5)
|
||||
assert store.close_unfinished_traces() == 1
|
||||
cut, done = store.traces_of("a")
|
||||
assert (cut.answer, cut.ms >= 0) == ("", True)
|
||||
assert (done.answer, done.ms) == ("답", 5)
|
||||
|
||||
@@ -244,6 +244,32 @@ def test_each_answer_keeps_how_it_was_made_with_the_records_it_was_given(store):
|
||||
assert (task.via, task.channel_id, task.answer) == ("task", None, "answer for task")
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_a_trace_is_stored_from_the_request_on_and_fills_in_while_the_answer_is_made(store):
|
||||
import time
|
||||
during = []
|
||||
|
||||
def answer(user, text):
|
||||
during.append((store.traces_of(user), time.time())) # the engine has added its steps
|
||||
return "answer"
|
||||
|
||||
async def body(url):
|
||||
async with connect(url) as ws:
|
||||
await hello(ws)
|
||||
await send(ws, type="voice_join", channel="vc1")
|
||||
await send(ws, type="reply", id="r1", user="100", text="q", via="voice", speak=False)
|
||||
await recv_until(ws, lambda m: isinstance(m, dict) and m.get("id") == "r1")
|
||||
|
||||
asyncio.run(with_worker(body, store=store, brain=FakeBrain(answer)))
|
||||
[(traces, answering_at)] = during
|
||||
[t] = traces
|
||||
assert (t.question, t.answer, t.ms) == ("q", "", -1) # -1: still being made
|
||||
assert [s["kind"] for s in t.steps] == ["records", "tools"]
|
||||
assert t.ts <= answering_at
|
||||
[t] = store.traces_of("100")
|
||||
assert (t.answer, t.ms >= 0, t.ts) == ("answer", True, traces[0].ts)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_without_a_brain_reply_is_an_error():
|
||||
async def body(url):
|
||||
@@ -337,15 +363,16 @@ def test_presence_left_open_by_a_previous_run_is_closed_at_start(store):
|
||||
def test_traces_older_than_thirty_days_are_removed_at_start(store):
|
||||
import time
|
||||
now = time.time()
|
||||
store.add_trace("voice", "vc1", "100", "old", "a", [], ms=1, ts=now - 31 * 86400)
|
||||
store.add_trace("voice", "vc1", "100", "new", "a", [], ms=1, ts=now - 29 * 86400)
|
||||
store.finish_trace(store.start_trace("voice", "vc1", "100", "old", ts=now - 31 * 86400), "a", [], ms=1)
|
||||
store.finish_trace(store.start_trace("voice", "vc1", "100", "new", ts=now - 29 * 86400), "a", [], ms=1)
|
||||
store.start_trace("voice", "vc1", "100", "cut off", ts=now - 60) # a killed run never finished it
|
||||
|
||||
async def body(url):
|
||||
async with connect(url) as ws:
|
||||
await hello(ws)
|
||||
|
||||
asyncio.run(with_worker(body, store=store))
|
||||
assert [t.question for t in store.traces_of("100")] == ["new"]
|
||||
assert [(t.question, t.ms >= 0) for t in store.traces_of("100")] == [("new", True), ("cut off", True)]
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
Reference in New Issue
Block a user