@valni/cli-darwin-x64 0.0.0-stage → 0.1.2
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.
- package/LICENSE +53 -0
- package/package.json +18 -5
- package/runtime/LICENSE +53 -0
- package/runtime/README.md +674 -0
- package/runtime/assets/clankolas.png +0 -0
- package/runtime/docs/extensions.md +2910 -0
- package/runtime/docs/json.md +82 -0
- package/runtime/docs/models.md +540 -0
- package/runtime/docs/packages.md +228 -0
- package/runtime/docs/rpc.md +1480 -0
- package/runtime/docs/sdk.md +1183 -0
- package/runtime/docs/session-format.md +422 -0
- package/runtime/docs/settings.md +315 -0
- package/runtime/docs/shell-aliases.md +13 -0
- package/runtime/docs/terminal-setup.md +142 -0
- package/runtime/docs/termux.md +127 -0
- package/runtime/docs/tmux.md +63 -0
- package/runtime/docs/tui.md +927 -0
- package/runtime/docs/windows.md +17 -0
- package/runtime/examples/README.md +25 -0
- package/runtime/examples/extensions/README.md +212 -0
- package/runtime/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/runtime/examples/extensions/bash-spawn-hook.ts +30 -0
- package/runtime/examples/extensions/bookmark.ts +50 -0
- package/runtime/examples/extensions/border-status-editor.ts +145 -0
- package/runtime/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/runtime/examples/extensions/claude-rules.ts +86 -0
- package/runtime/examples/extensions/commands.ts +72 -0
- package/runtime/examples/extensions/confirm-destructive.ts +59 -0
- package/runtime/examples/extensions/custom-footer.ts +64 -0
- package/runtime/examples/extensions/custom-header.ts +73 -0
- package/runtime/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/runtime/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/runtime/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/runtime/examples/extensions/dirty-repo-guard.ts +56 -0
- package/runtime/examples/extensions/doom-overlay/README.md +46 -0
- package/runtime/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/runtime/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/runtime/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/runtime/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/runtime/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/runtime/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/runtime/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/runtime/examples/extensions/doom-overlay/index.ts +74 -0
- package/runtime/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/runtime/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/runtime/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/runtime/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/runtime/examples/extensions/dynamic-resources/index.ts +15 -0
- package/runtime/examples/extensions/dynamic-tools.ts +74 -0
- package/runtime/examples/extensions/entry-renderer.ts +41 -0
- package/runtime/examples/extensions/event-bus.ts +43 -0
- package/runtime/examples/extensions/file-trigger.ts +41 -0
- package/runtime/examples/extensions/git-checkpoint.ts +53 -0
- package/runtime/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/runtime/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/runtime/examples/extensions/gondolin/index.ts +531 -0
- package/runtime/examples/extensions/gondolin/package-lock.json +185 -0
- package/runtime/examples/extensions/gondolin/package.json +19 -0
- package/runtime/examples/extensions/hello.ts +26 -0
- package/runtime/examples/extensions/hidden-thinking-label.ts +53 -0
- package/runtime/examples/extensions/inline-bash.ts +94 -0
- package/runtime/examples/extensions/input-transform-streaming.ts +39 -0
- package/runtime/examples/extensions/input-transform.ts +43 -0
- package/runtime/examples/extensions/interactive-shell.ts +196 -0
- package/runtime/examples/extensions/mac-system-theme.ts +47 -0
- package/runtime/examples/extensions/message-renderer.ts +59 -0
- package/runtime/examples/extensions/minimal-mode.ts +426 -0
- package/runtime/examples/extensions/modal-editor.ts +85 -0
- package/runtime/examples/extensions/model-status.ts +31 -0
- package/runtime/examples/extensions/notify.ts +55 -0
- package/runtime/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/runtime/examples/extensions/overlay-test.ts +153 -0
- package/runtime/examples/extensions/permission-gate.ts +34 -0
- package/runtime/examples/extensions/pirate.ts +47 -0
- package/runtime/examples/extensions/plan-mode/README.md +66 -0
- package/runtime/examples/extensions/plan-mode/index.ts +390 -0
- package/runtime/examples/extensions/plan-mode/utils.ts +168 -0
- package/runtime/examples/extensions/preset.ts +436 -0
- package/runtime/examples/extensions/project-trust.ts +64 -0
- package/runtime/examples/extensions/prompt-customizer.ts +97 -0
- package/runtime/examples/extensions/protected-paths.ts +30 -0
- package/runtime/examples/extensions/provider-payload.ts +18 -0
- package/runtime/examples/extensions/question.ts +278 -0
- package/runtime/examples/extensions/questionnaire.ts +440 -0
- package/runtime/examples/extensions/rainbow-editor.ts +88 -0
- package/runtime/examples/extensions/reload-runtime.ts +37 -0
- package/runtime/examples/extensions/rpc-demo.ts +118 -0
- package/runtime/examples/extensions/sandbox/index.ts +321 -0
- package/runtime/examples/extensions/sandbox/package-lock.json +92 -0
- package/runtime/examples/extensions/sandbox/package.json +19 -0
- package/runtime/examples/extensions/send-user-message.ts +97 -0
- package/runtime/examples/extensions/session-name.ts +27 -0
- package/runtime/examples/extensions/shutdown-command.ts +63 -0
- package/runtime/examples/extensions/snake.ts +343 -0
- package/runtime/examples/extensions/space-invaders.ts +560 -0
- package/runtime/examples/extensions/ssh.ts +220 -0
- package/runtime/examples/extensions/status-line.ts +32 -0
- package/runtime/examples/extensions/structured-output.ts +65 -0
- package/runtime/examples/extensions/subagent/README.md +175 -0
- package/runtime/examples/extensions/subagent/agents/planner.md +37 -0
- package/runtime/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/runtime/examples/extensions/subagent/agents/scout.md +50 -0
- package/runtime/examples/extensions/subagent/agents/worker.md +24 -0
- package/runtime/examples/extensions/subagent/agents.ts +126 -0
- package/runtime/examples/extensions/subagent/index.ts +1009 -0
- package/runtime/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/runtime/examples/extensions/subagent/prompts/implement.md +10 -0
- package/runtime/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/runtime/examples/extensions/system-prompt-header.ts +17 -0
- package/runtime/examples/extensions/tic-tac-toe.ts +1008 -0
- package/runtime/examples/extensions/timed-confirm.ts +70 -0
- package/runtime/examples/extensions/titlebar-spinner.ts +58 -0
- package/runtime/examples/extensions/todo.ts +297 -0
- package/runtime/examples/extensions/tool-override.ts +144 -0
- package/runtime/examples/extensions/tools.ts +146 -0
- package/runtime/examples/extensions/trigger-compact.ts +50 -0
- package/runtime/examples/extensions/truncated-tool.ts +195 -0
- package/runtime/examples/extensions/widget-placement.ts +9 -0
- package/runtime/examples/extensions/with-deps/index.ts +32 -0
- package/runtime/examples/extensions/with-deps/package-lock.json +31 -0
- package/runtime/examples/extensions/with-deps/package.json +22 -0
- package/runtime/examples/extensions/working-indicator.ts +123 -0
- package/runtime/examples/extensions/working-message-test.ts +25 -0
- package/runtime/examples/rpc-extension-ui.ts +632 -0
- package/runtime/examples/sdk/01-minimal.ts +26 -0
- package/runtime/examples/sdk/02-custom-model.ts +43 -0
- package/runtime/examples/sdk/03-custom-prompt.ts +70 -0
- package/runtime/examples/sdk/04-skills.ts +55 -0
- package/runtime/examples/sdk/05-tools.ts +48 -0
- package/runtime/examples/sdk/06-extensions.ts +94 -0
- package/runtime/examples/sdk/07-context-files.ts +42 -0
- package/runtime/examples/sdk/08-prompt-templates.ts +51 -0
- package/runtime/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/runtime/examples/sdk/10-settings.ts +53 -0
- package/runtime/examples/sdk/11-sessions.ts +52 -0
- package/runtime/examples/sdk/12-full-control.ts +71 -0
- package/runtime/examples/sdk/13-session-runtime.ts +67 -0
- package/runtime/examples/sdk/README.md +140 -0
- package/runtime/export-html/ansi-to-html.js +249 -0
- package/runtime/export-html/index.js +226 -0
- package/runtime/export-html/template.css +1066 -0
- package/runtime/export-html/template.html +55 -0
- package/runtime/export-html/template.js +1864 -0
- package/runtime/export-html/tool-renderer.js +108 -0
- package/runtime/export-html/vendor/highlight.min.js +1213 -0
- package/runtime/export-html/vendor/marked.min.js +78 -0
- package/runtime/extensions/pi-switchboard/.github/workflows/ci.yml +51 -0
- package/runtime/extensions/pi-switchboard/LICENSE +22 -0
- package/runtime/extensions/pi-switchboard/README.md +85 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/catalog.ts +183 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/config.ts +97 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/connections.ts +386 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/constants.ts +12 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/device-auth.ts +127 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/envelope.ts +199 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/errors.ts +180 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/index.ts +125 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/participant.ts +17 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/sessionStream.ts +131 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/toolProxy.ts +136 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/tools.ts +16 -0
- package/runtime/extensions/pi-switchboard/extensions/switchboard/types.ts +37 -0
- package/runtime/extensions/pi-switchboard/package.json +30 -0
- package/runtime/extensions/pi-switchboard/tsconfig.json +13 -0
- package/runtime/extensions/switchboard-local/.github/workflows/ci.yml +80 -0
- package/runtime/extensions/switchboard-local/.github/workflows/release.yml +46 -0
- package/runtime/extensions/switchboard-local/README.md +98 -0
- package/runtime/extensions/switchboard-local/extensions/local/engine.ts +28 -0
- package/runtime/extensions/switchboard-local/extensions/local/engines/gguf.ts +324 -0
- package/runtime/extensions/switchboard-local/extensions/local/engines/llamaBuild.ts +62 -0
- package/runtime/extensions/switchboard-local/extensions/local/engines/mlx.ts +245 -0
- package/runtime/extensions/switchboard-local/extensions/local/engines/select.ts +38 -0
- package/runtime/extensions/switchboard-local/extensions/local/engines/support.ts +151 -0
- package/runtime/extensions/switchboard-local/extensions/local/hf.ts +106 -0
- package/runtime/extensions/switchboard-local/extensions/local/index.ts +67 -0
- package/runtime/extensions/switchboard-local/extensions/local/nativeStream.ts +602 -0
- package/runtime/extensions/switchboard-local/extensions/local/paths.ts +44 -0
- package/runtime/extensions/switchboard-local/extensions/local/provider.ts +57 -0
- package/runtime/extensions/switchboard-local/extensions/local/store.ts +82 -0
- package/runtime/extensions/switchboard-local/extensions/local/ui.ts +60 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/apiTypes.js +74 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/client.js +292 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/deviceAuth.js +155 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/errors.js +95 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/index.js +8 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/messages.js +253 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/models.js +19 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/native.js +886 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/dist/wire.js +85 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard/package.json +39 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/package.json +29 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/anthropic.ts +127 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/google.ts +111 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/index.ts +8 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/modelRecord.test.ts +25 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/modelRecord.ts +57 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/openaiGeneric.ts +103 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/openaiPro.ts +89 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/profile.ts +120 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/routing.test.ts +82 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/routing.ts +74 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/validateConfig.google.test.ts +137 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/validateConfig.openai.test.ts +241 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/validateConfig.test.ts +174 -0
- package/runtime/extensions/switchboard-local/node_modules/@valni/switchboard-native/src/validateConfig.ts +438 -0
- package/runtime/extensions/switchboard-local/package.json +34 -0
- package/runtime/extensions/switchboard-local/tsconfig.json +13 -0
- package/runtime/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/runtime/node_modules/@mariozechner/clipboard/.yarnrc.yml +1 -0
- package/runtime/node_modules/@mariozechner/clipboard/Cargo.toml +45 -0
- package/runtime/node_modules/@mariozechner/clipboard/README.md +60 -0
- package/runtime/node_modules/@mariozechner/clipboard/build.rs +5 -0
- package/runtime/node_modules/@mariozechner/clipboard/clipboard.darwin-x64.node +0 -0
- package/runtime/node_modules/@mariozechner/clipboard/exp.ts +12 -0
- package/runtime/node_modules/@mariozechner/clipboard/index.js +606 -0
- package/runtime/node_modules/@mariozechner/clipboard/package.json +56 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +307 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +93 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +313 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +471 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +252 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +431 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +712 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +916 -0
- package/runtime/node_modules/@mariozechner/clipboard/src/lib.rs +194 -0
- package/runtime/node_modules/@mariozechner/clipboard-darwin-x64/README.md +3 -0
- package/runtime/node_modules/@mariozechner/clipboard-darwin-x64/clipboard.darwin-x64.node +0 -0
- package/runtime/node_modules/@mariozechner/clipboard-darwin-x64/package.json +22 -0
- package/runtime/package.json +104 -0
- package/runtime/photon_rs_bg.wasm +0 -0
- package/runtime/theme/dark.json +87 -0
- package/runtime/theme/light.json +86 -0
- package/runtime/theme/theme-schema.json +340 -0
- package/runtime/valni +4 -0
- package/README.md +0 -3
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mariozechner/clipboard-darwin-x64",
|
|
3
|
+
"version": "0.3.9",
|
|
4
|
+
"os": [
|
|
5
|
+
"darwin"
|
|
6
|
+
],
|
|
7
|
+
"cpu": [
|
|
8
|
+
"x64"
|
|
9
|
+
],
|
|
10
|
+
"main": "clipboard.darwin-x64.node",
|
|
11
|
+
"files": [
|
|
12
|
+
"clipboard.darwin-x64.node"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">= 10"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/badlogic/clipboard.git"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@valni/cli",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"piConfig": {
|
|
8
|
+
"name": "valni",
|
|
9
|
+
"configDir": ".valni"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"valni": "dist/cli.js"
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./rpc-entry": {
|
|
22
|
+
"import": "./dist/rpc-entry.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"docs",
|
|
28
|
+
"examples",
|
|
29
|
+
"containerization.md",
|
|
30
|
+
"CHANGELOG.md",
|
|
31
|
+
"npm-shrinkwrap.json"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "shx rm -rf dist",
|
|
35
|
+
"build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js && npm run copy-assets",
|
|
36
|
+
"build:binary": "npm --prefix ../tui run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm run build && bun build --compile ./dist/bun/cli.js ./src/utils/image-resize-worker.ts --outfile dist/valni && npm run copy-binary-assets",
|
|
37
|
+
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
|
|
38
|
+
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp ../../LICENSE dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/assets && shx cp src/modes/interactive/assets/*.png dist/assets/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
|
|
39
|
+
"test": "vitest --run",
|
|
40
|
+
"shrinkwrap": "node ../../scripts/generate-coding-agent-shrinkwrap.mjs",
|
|
41
|
+
"prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@valni/agent-core": "^0.1.2",
|
|
45
|
+
"@valni/ai": "^0.1.2",
|
|
46
|
+
"@valni/tui": "^0.1.2",
|
|
47
|
+
"pi-switchboard": "git+https://github.com/Valni-Labs/pi-switchboard.git#b35310164e79b3f99bfd697622527a8458e1719d",
|
|
48
|
+
"switchboard-local": "git+https://github.com/Valni-Labs/switchboard-local.git#bda14d2d85735da4519f4545b598b4c5e97e7d3b",
|
|
49
|
+
"@silvia-odwyer/photon-node": "0.3.4",
|
|
50
|
+
"chalk": "5.6.2",
|
|
51
|
+
"cross-spawn": "7.0.6",
|
|
52
|
+
"diff": "8.0.4",
|
|
53
|
+
"glob": "13.0.6",
|
|
54
|
+
"highlight.js": "10.7.3",
|
|
55
|
+
"hosted-git-info": "9.0.3",
|
|
56
|
+
"ignore": "7.0.5",
|
|
57
|
+
"jiti": "2.7.0",
|
|
58
|
+
"minimatch": "10.2.5",
|
|
59
|
+
"proper-lockfile": "4.1.2",
|
|
60
|
+
"semver": "7.8.0",
|
|
61
|
+
"typebox": "1.1.38",
|
|
62
|
+
"undici": "8.5.0",
|
|
63
|
+
"yaml": "2.9.0"
|
|
64
|
+
},
|
|
65
|
+
"overrides": {
|
|
66
|
+
"rimraf": "6.1.2",
|
|
67
|
+
"gaxios": {
|
|
68
|
+
"rimraf": "6.1.2"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"optionalDependencies": {
|
|
72
|
+
"@mariozechner/clipboard": "0.3.9"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@types/cross-spawn": "6.0.6",
|
|
76
|
+
"@types/diff": "7.0.2",
|
|
77
|
+
"@types/hosted-git-info": "3.0.5",
|
|
78
|
+
"@types/ms": "2.1.0",
|
|
79
|
+
"@types/node": "24.12.4",
|
|
80
|
+
"@types/proper-lockfile": "4.1.4",
|
|
81
|
+
"@types/semver": "7.7.1",
|
|
82
|
+
"shx": "0.4.0",
|
|
83
|
+
"typescript": "5.9.3",
|
|
84
|
+
"vitest": "4.1.9"
|
|
85
|
+
},
|
|
86
|
+
"keywords": [
|
|
87
|
+
"coding-agent",
|
|
88
|
+
"ai",
|
|
89
|
+
"llm",
|
|
90
|
+
"cli",
|
|
91
|
+
"tui",
|
|
92
|
+
"agent"
|
|
93
|
+
],
|
|
94
|
+
"author": "Mario Zechner",
|
|
95
|
+
"license": "MIT",
|
|
96
|
+
"repository": {
|
|
97
|
+
"type": "git",
|
|
98
|
+
"url": "git+https://github.com/earendil-works/pi.git",
|
|
99
|
+
"directory": "packages/coding-agent"
|
|
100
|
+
},
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=22.19.0"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "dark",
|
|
4
|
+
"vars": {
|
|
5
|
+
"cyan": "#00d7ff",
|
|
6
|
+
"blue": "#5f87ff",
|
|
7
|
+
"green": "#b5bd68",
|
|
8
|
+
"red": "#cc6666",
|
|
9
|
+
"yellow": "#ffff00",
|
|
10
|
+
"text": "#d4d4d4",
|
|
11
|
+
"gray": "#808080",
|
|
12
|
+
"dimGray": "#666666",
|
|
13
|
+
"darkGray": "#505050",
|
|
14
|
+
"accent": "#8abeb7",
|
|
15
|
+
"selectedBg": "#3a3a4a",
|
|
16
|
+
"userMsgBg": "#343541",
|
|
17
|
+
"toolPendingBg": "#282832",
|
|
18
|
+
"toolSuccessBg": "#283228",
|
|
19
|
+
"toolErrorBg": "#3c2828",
|
|
20
|
+
"customMsgBg": "#2d2838"
|
|
21
|
+
},
|
|
22
|
+
"colors": {
|
|
23
|
+
"accent": "accent",
|
|
24
|
+
"border": "blue",
|
|
25
|
+
"borderAccent": "cyan",
|
|
26
|
+
"borderMuted": "darkGray",
|
|
27
|
+
"success": "green",
|
|
28
|
+
"error": "red",
|
|
29
|
+
"warning": "yellow",
|
|
30
|
+
"muted": "gray",
|
|
31
|
+
"dim": "dimGray",
|
|
32
|
+
"text": "text",
|
|
33
|
+
"thinkingText": "gray",
|
|
34
|
+
|
|
35
|
+
"selectedBg": "selectedBg",
|
|
36
|
+
"userMessageBg": "userMsgBg",
|
|
37
|
+
"userMessageText": "text",
|
|
38
|
+
"customMessageBg": "customMsgBg",
|
|
39
|
+
"customMessageText": "text",
|
|
40
|
+
"customMessageLabel": "#9575cd",
|
|
41
|
+
"toolPendingBg": "toolPendingBg",
|
|
42
|
+
"toolSuccessBg": "toolSuccessBg",
|
|
43
|
+
"toolErrorBg": "toolErrorBg",
|
|
44
|
+
"toolTitle": "text",
|
|
45
|
+
"toolOutput": "gray",
|
|
46
|
+
|
|
47
|
+
"mdHeading": "#f0c674",
|
|
48
|
+
"mdLink": "#81a2be",
|
|
49
|
+
"mdLinkUrl": "dimGray",
|
|
50
|
+
"mdCode": "accent",
|
|
51
|
+
"mdCodeBlock": "green",
|
|
52
|
+
"mdCodeBlockBorder": "gray",
|
|
53
|
+
"mdQuote": "gray",
|
|
54
|
+
"mdQuoteBorder": "gray",
|
|
55
|
+
"mdHr": "gray",
|
|
56
|
+
"mdListBullet": "accent",
|
|
57
|
+
|
|
58
|
+
"toolDiffAdded": "green",
|
|
59
|
+
"toolDiffRemoved": "red",
|
|
60
|
+
"toolDiffContext": "gray",
|
|
61
|
+
|
|
62
|
+
"syntaxComment": "#6A9955",
|
|
63
|
+
"syntaxKeyword": "#569CD6",
|
|
64
|
+
"syntaxFunction": "#DCDCAA",
|
|
65
|
+
"syntaxVariable": "#9CDCFE",
|
|
66
|
+
"syntaxString": "#CE9178",
|
|
67
|
+
"syntaxNumber": "#B5CEA8",
|
|
68
|
+
"syntaxType": "#4EC9B0",
|
|
69
|
+
"syntaxOperator": "#D4D4D4",
|
|
70
|
+
"syntaxPunctuation": "#D4D4D4",
|
|
71
|
+
|
|
72
|
+
"thinkingOff": "darkGray",
|
|
73
|
+
"thinkingMinimal": "#6e6e6e",
|
|
74
|
+
"thinkingLow": "#5f87af",
|
|
75
|
+
"thinkingMedium": "#81a2be",
|
|
76
|
+
"thinkingHigh": "#b294bb",
|
|
77
|
+
"thinkingXhigh": "#d183e8",
|
|
78
|
+
"thinkingMax": "#ff5fff",
|
|
79
|
+
|
|
80
|
+
"bashMode": "green"
|
|
81
|
+
},
|
|
82
|
+
"export": {
|
|
83
|
+
"pageBg": "#18181e",
|
|
84
|
+
"cardBg": "#1e1e24",
|
|
85
|
+
"infoBg": "#3c3728"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "light",
|
|
4
|
+
"vars": {
|
|
5
|
+
"teal": "#5a8080",
|
|
6
|
+
"blue": "#547da7",
|
|
7
|
+
"green": "#588458",
|
|
8
|
+
"red": "#aa5555",
|
|
9
|
+
"yellow": "#9a7326",
|
|
10
|
+
"text": "#1f2328",
|
|
11
|
+
"mediumGray": "#6c6c6c",
|
|
12
|
+
"dimGray": "#767676",
|
|
13
|
+
"lightGray": "#b0b0b0",
|
|
14
|
+
"selectedBg": "#d0d0e0",
|
|
15
|
+
"userMsgBg": "#e8e8e8",
|
|
16
|
+
"toolPendingBg": "#e8e8f0",
|
|
17
|
+
"toolSuccessBg": "#e8f0e8",
|
|
18
|
+
"toolErrorBg": "#f0e8e8",
|
|
19
|
+
"customMsgBg": "#ede7f6"
|
|
20
|
+
},
|
|
21
|
+
"colors": {
|
|
22
|
+
"accent": "teal",
|
|
23
|
+
"border": "blue",
|
|
24
|
+
"borderAccent": "teal",
|
|
25
|
+
"borderMuted": "lightGray",
|
|
26
|
+
"success": "green",
|
|
27
|
+
"error": "red",
|
|
28
|
+
"warning": "yellow",
|
|
29
|
+
"muted": "mediumGray",
|
|
30
|
+
"dim": "dimGray",
|
|
31
|
+
"text": "text",
|
|
32
|
+
"thinkingText": "mediumGray",
|
|
33
|
+
|
|
34
|
+
"selectedBg": "selectedBg",
|
|
35
|
+
"userMessageBg": "userMsgBg",
|
|
36
|
+
"userMessageText": "text",
|
|
37
|
+
"customMessageBg": "customMsgBg",
|
|
38
|
+
"customMessageText": "text",
|
|
39
|
+
"customMessageLabel": "#7e57c2",
|
|
40
|
+
"toolPendingBg": "toolPendingBg",
|
|
41
|
+
"toolSuccessBg": "toolSuccessBg",
|
|
42
|
+
"toolErrorBg": "toolErrorBg",
|
|
43
|
+
"toolTitle": "text",
|
|
44
|
+
"toolOutput": "mediumGray",
|
|
45
|
+
|
|
46
|
+
"mdHeading": "yellow",
|
|
47
|
+
"mdLink": "blue",
|
|
48
|
+
"mdLinkUrl": "dimGray",
|
|
49
|
+
"mdCode": "teal",
|
|
50
|
+
"mdCodeBlock": "green",
|
|
51
|
+
"mdCodeBlockBorder": "mediumGray",
|
|
52
|
+
"mdQuote": "mediumGray",
|
|
53
|
+
"mdQuoteBorder": "mediumGray",
|
|
54
|
+
"mdHr": "mediumGray",
|
|
55
|
+
"mdListBullet": "green",
|
|
56
|
+
|
|
57
|
+
"toolDiffAdded": "green",
|
|
58
|
+
"toolDiffRemoved": "red",
|
|
59
|
+
"toolDiffContext": "mediumGray",
|
|
60
|
+
|
|
61
|
+
"syntaxComment": "#008000",
|
|
62
|
+
"syntaxKeyword": "#0000FF",
|
|
63
|
+
"syntaxFunction": "#795E26",
|
|
64
|
+
"syntaxVariable": "#001080",
|
|
65
|
+
"syntaxString": "#A31515",
|
|
66
|
+
"syntaxNumber": "#098658",
|
|
67
|
+
"syntaxType": "#267F99",
|
|
68
|
+
"syntaxOperator": "#000000",
|
|
69
|
+
"syntaxPunctuation": "#000000",
|
|
70
|
+
|
|
71
|
+
"thinkingOff": "lightGray",
|
|
72
|
+
"thinkingMinimal": "#767676",
|
|
73
|
+
"thinkingLow": "blue",
|
|
74
|
+
"thinkingMedium": "teal",
|
|
75
|
+
"thinkingHigh": "#875f87",
|
|
76
|
+
"thinkingXhigh": "#8b008b",
|
|
77
|
+
"thinkingMax": "#af005f",
|
|
78
|
+
|
|
79
|
+
"bashMode": "green"
|
|
80
|
+
},
|
|
81
|
+
"export": {
|
|
82
|
+
"pageBg": "#f8f8f8",
|
|
83
|
+
"cardBg": "#ffffff",
|
|
84
|
+
"infoBg": "#fffae6"
|
|
85
|
+
}
|
|
86
|
+
}
|