@kingingwang/pi-linux-arm64 0.84.4 → 0.86.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/bin/CHANGELOG.md +185 -5
  2. package/bin/README.md +4 -2
  3. package/bin/docs/compaction.md +39 -13
  4. package/bin/docs/containerization.md +45 -0
  5. package/bin/docs/custom-provider.md +22 -13
  6. package/bin/docs/development.md +23 -4
  7. package/bin/docs/docs.json +4 -0
  8. package/bin/docs/environment-variables.md +3 -0
  9. package/bin/docs/extensions.md +62 -45
  10. package/bin/docs/json.md +4 -4
  11. package/bin/docs/keybindings.md +5 -2
  12. package/bin/docs/models.md +37 -3
  13. package/bin/docs/providers.md +10 -2
  14. package/bin/docs/rpc.md +1 -1
  15. package/bin/docs/sdk.md +9 -2
  16. package/bin/docs/security.md +1 -1
  17. package/bin/docs/session-format.md +82 -40
  18. package/bin/docs/sessions.md +27 -0
  19. package/bin/docs/settings.md +60 -5
  20. package/bin/docs/skills.md +1 -1
  21. package/bin/docs/terminal-setup.md +15 -0
  22. package/bin/docs/termux.md +0 -1
  23. package/bin/docs/themes.md +8 -6
  24. package/bin/docs/tui.md +21 -2
  25. package/bin/docs/usage.md +1 -0
  26. package/bin/examples/README.md +3 -0
  27. package/bin/examples/extensions/README.md +0 -1
  28. package/bin/examples/extensions/custom-provider-anthropic/index.ts +18 -12
  29. package/bin/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  30. package/bin/examples/extensions/custom-provider-anthropic/package.json +1 -1
  31. package/bin/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  32. package/bin/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  33. package/bin/examples/extensions/dynamic-resources/dynamic.json +2 -0
  34. package/bin/examples/extensions/gondolin/package-lock.json +2 -2
  35. package/bin/examples/extensions/gondolin/package.json +1 -1
  36. package/bin/examples/extensions/prompt-customizer.ts +19 -67
  37. package/bin/examples/extensions/sandbox/package-lock.json +2 -2
  38. package/bin/examples/extensions/sandbox/package.json +1 -1
  39. package/bin/examples/extensions/with-deps/package-lock.json +2 -2
  40. package/bin/examples/extensions/with-deps/package.json +1 -1
  41. package/bin/examples/plugins/pi-example-plugin/README.md +38 -0
  42. package/bin/examples/plugins/pi-example-plugin/package.json +10 -0
  43. package/bin/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  44. package/bin/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  45. package/bin/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  46. package/bin/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  47. package/bin/package.json +24 -23
  48. package/bin/pi +2 -2
  49. package/bin/theme/dark.json +2 -1
  50. package/bin/theme/light.json +2 -1
  51. package/bin/theme/theme-schema.json +6 -2
  52. package/package.json +1 -1
  53. package/bin/examples/extensions/kimi-deferred-tools.ts +0 -61
  54. package/bin/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
  55. package/bin/node_modules/@mariozechner/clipboard/Cargo.toml +0 -45
  56. package/bin/node_modules/@mariozechner/clipboard/README.md +0 -60
  57. package/bin/node_modules/@mariozechner/clipboard/build.rs +0 -5
  58. package/bin/node_modules/@mariozechner/clipboard/clipboard.linux-arm64-gnu.node +0 -0
  59. package/bin/node_modules/@mariozechner/clipboard/exp.ts +0 -12
  60. package/bin/node_modules/@mariozechner/clipboard/index.d.ts +0 -37
  61. package/bin/node_modules/@mariozechner/clipboard/index.js +0 -606
  62. package/bin/node_modules/@mariozechner/clipboard/package.json +0 -56
  63. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +0 -307
  64. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +0 -93
  65. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +0 -313
  66. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +0 -471
  67. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +0 -252
  68. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +0 -431
  69. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +0 -712
  70. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +0 -916
  71. package/bin/node_modules/@mariozechner/clipboard/src/lib.rs +0 -194
@@ -1,194 +0,0 @@
1
- #![deny(clippy::all)]
2
- use base64::{engine::general_purpose, Engine as _};
3
- #[allow(dead_code, unused_imports)]
4
- mod clipboard_rs;
5
-
6
- use clipboard_rs::{
7
- common::RustImage, Clipboard, ClipboardContext, ClipboardHandler, ClipboardWatcher,
8
- ClipboardWatcherContext, ContentFormat, RustImageData,
9
- };
10
- use napi::{
11
- bindgen_prelude::*,
12
- threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
13
- };
14
- use std::{sync::Arc, thread, time::Duration};
15
-
16
- #[macro_use]
17
- extern crate napi_derive;
18
-
19
- fn napi_error(error: impl ToString) -> Error {
20
- Error::from_reason(error.to_string())
21
- }
22
-
23
- #[napi]
24
- pub fn available_formats() -> Result<Vec<String>> {
25
- let ctx = ClipboardContext::new().map_err(napi_error)?;
26
- ctx.available_formats().map_err(napi_error)
27
- }
28
-
29
- #[napi]
30
- pub async fn get_text() -> Result<String> {
31
- let ctx = ClipboardContext::new().map_err(napi_error)?;
32
- ctx.get_text().map_err(napi_error)
33
- }
34
-
35
- #[napi]
36
- pub async fn set_text(text: String) -> Result<()> {
37
- let ctx = ClipboardContext::new().map_err(napi_error)?;
38
- ctx.set_text(text).map_err(napi_error)
39
- }
40
-
41
- #[napi]
42
- pub fn has_text() -> Result<bool> {
43
- let ctx = ClipboardContext::new().map_err(napi_error)?;
44
- Ok(ctx.has(ContentFormat::Text))
45
- }
46
-
47
- #[napi]
48
- pub async fn get_image_binary() -> Result<Vec<u8>> {
49
- let ctx = ClipboardContext::new().map_err(napi_error)?;
50
- let image = ctx.get_image().map_err(napi_error)?;
51
- let image_bytes = image.to_png().map_err(napi_error)?.get_bytes().to_vec();
52
- Ok(image_bytes)
53
- }
54
-
55
- #[napi]
56
- pub async fn get_image_base64() -> Result<String> {
57
- let image_bytes = get_image_binary().await?;
58
- let base64_str = general_purpose::STANDARD_NO_PAD.encode(&image_bytes);
59
- Ok(base64_str)
60
- }
61
-
62
- #[napi]
63
- pub async fn set_image_binary(image_bytes: Vec<u8>) -> Result<()> {
64
- let ctx = ClipboardContext::new().map_err(napi_error)?;
65
- let img = RustImageData::from_bytes(&image_bytes).map_err(napi_error)?;
66
- ctx.set_image(img).map_err(napi_error)
67
- }
68
-
69
- #[napi]
70
- pub async fn set_image_base64(base64_str: String) -> Result<()> {
71
- let decoded: Vec<u8> = general_purpose::STANDARD_NO_PAD
72
- .decode(base64_str)
73
- .map_err(napi_error)?;
74
- set_image_binary(decoded).await
75
- }
76
-
77
- #[napi]
78
- pub fn has_image() -> Result<bool> {
79
- let ctx = ClipboardContext::new().map_err(napi_error)?;
80
- Ok(ctx.has(ContentFormat::Image))
81
- }
82
-
83
- #[napi]
84
- pub async fn get_html() -> Result<String> {
85
- let ctx = ClipboardContext::new().map_err(napi_error)?;
86
- ctx.get_html().map_err(napi_error)
87
- }
88
-
89
- #[napi]
90
- pub async fn set_html(html: String) -> Result<()> {
91
- let ctx = ClipboardContext::new().map_err(napi_error)?;
92
- ctx.set_html(html).map_err(napi_error)
93
- }
94
-
95
- #[napi]
96
- fn has_html() -> Result<bool> {
97
- let ctx = ClipboardContext::new().map_err(napi_error)?;
98
- Ok(ctx.has(ContentFormat::Html))
99
- }
100
-
101
- #[napi]
102
- pub async fn get_rtf() -> Result<String> {
103
- let ctx = ClipboardContext::new().map_err(napi_error)?;
104
- ctx.get_rich_text().map_err(napi_error)
105
- }
106
-
107
- #[napi]
108
- pub async fn set_rtf(rtf: String) -> Result<()> {
109
- let ctx = ClipboardContext::new().map_err(napi_error)?;
110
- ctx.set_rich_text(rtf).map_err(napi_error)
111
- }
112
-
113
- #[napi]
114
- pub fn has_rtf() -> Result<bool> {
115
- let ctx = ClipboardContext::new().map_err(napi_error)?;
116
- Ok(ctx.has(ContentFormat::Rtf))
117
- }
118
-
119
- #[napi]
120
- pub async fn clear() -> Result<()> {
121
- let ctx = ClipboardContext::new().map_err(napi_error)?;
122
- ctx.clear().map_err(napi_error)
123
- }
124
-
125
- struct Manager {
126
- ctx: ClipboardContext,
127
- }
128
-
129
- impl Manager {
130
- pub fn new() -> Self {
131
- let ctx = ClipboardContext::new().unwrap();
132
- Manager { ctx }
133
- }
134
- }
135
-
136
- impl ClipboardHandler for Manager {
137
- fn on_clipboard_change(&mut self) {
138
- println!(
139
- "on_clipboard_change, txt = {}",
140
- self.ctx.get_text().unwrap()
141
- );
142
- }
143
- }
144
-
145
- #[napi]
146
- pub fn watch() {
147
- let manager = Manager::new();
148
-
149
- let mut watcher = ClipboardWatcherContext::new().unwrap();
150
-
151
- let watcher_shutdown = watcher.add_handler(manager).get_shutdown_channel();
152
-
153
- thread::spawn(move || {
154
- thread::sleep(Duration::from_secs(5));
155
- println!("stop watch!");
156
- watcher_shutdown.stop();
157
- });
158
-
159
- println!("start watch!");
160
- watcher.start_watch();
161
- }
162
-
163
- #[napi]
164
- pub fn call_threadsafe_function(callback: Arc<ThreadsafeFunction<u32, ()>>) -> Result<()> {
165
- for n in 0..10 {
166
- let tsfn = Arc::clone(&callback);
167
- thread::spawn(move || {
168
- tsfn.call(Ok(n), ThreadsafeFunctionCallMode::Blocking);
169
- });
170
- }
171
- Ok(())
172
- }
173
-
174
- // #[js_function(1)]
175
- // fn hello(ctx: CallContext) -> Result<JsString, String> {
176
- // let argument_one = ctx
177
- // .get::<JsString>(0)
178
- // .map_err(|err| err.to_string())?
179
- // .into_utf8()
180
- // .map_err(|err| err.to_string())?;
181
- // ctx
182
- // .env
183
- // .create_string_from_std(format!("{} world!", argument_one.as_str()?))
184
- // }
185
-
186
- #[cfg(test)]
187
- mod tests {
188
- use super::*;
189
-
190
- #[test]
191
- fn it_works() {
192
- watch();
193
- }
194
- }