@valni/cli-darwin-x64 0.1.2 → 0.1.3
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 +1 -2
- package/package.json +1 -1
- package/runtime/LICENSE +1 -2
- package/runtime/examples/extensions/auto-commit-on-exit.ts +6 -6
- package/runtime/examples/extensions/bash-spawn-hook.ts +3 -3
- package/runtime/examples/extensions/bookmark.ts +5 -5
- package/runtime/examples/extensions/border-status-editor.ts +7 -7
- package/runtime/examples/extensions/built-in-tool-renderer.ts +6 -6
- package/runtime/examples/extensions/claude-rules.ts +4 -4
- package/runtime/examples/extensions/commands.ts +5 -5
- package/runtime/examples/extensions/confirm-destructive.ts +3 -3
- package/runtime/examples/extensions/custom-footer.ts +2 -2
- package/runtime/examples/extensions/custom-header.ts +5 -5
- package/runtime/examples/extensions/custom-provider-anthropic/index.ts +4 -4
- package/runtime/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/runtime/examples/extensions/custom-provider-anthropic/package.json +3 -3
- package/runtime/examples/extensions/dirty-repo-guard.ts +7 -7
- package/runtime/examples/extensions/doom-overlay/doom/build.sh +4 -4
- package/runtime/examples/extensions/doom-overlay/doom/{doomgeneric_pi.c → doomgeneric_valni.c} +1 -1
- package/runtime/examples/extensions/doom-overlay/index.ts +3 -3
- package/runtime/examples/extensions/dynamic-resources/dynamic.json +0 -1
- package/runtime/examples/extensions/dynamic-resources/index.ts +2 -4
- package/runtime/examples/extensions/dynamic-tools.ts +4 -4
- package/runtime/examples/extensions/entry-renderer.ts +6 -6
- package/runtime/examples/extensions/event-bus.ts +8 -8
- package/runtime/examples/extensions/file-trigger.ts +3 -3
- package/runtime/examples/extensions/git-checkpoint.ts +7 -7
- package/runtime/examples/extensions/git-merge-and-resolve.ts +14 -14
- package/runtime/examples/extensions/github-issue-autocomplete.ts +6 -6
- package/runtime/examples/extensions/hello.ts +2 -2
- package/runtime/examples/extensions/hidden-thinking-label.ts +4 -4
- package/runtime/examples/extensions/inline-bash.ts +5 -5
- package/runtime/examples/extensions/input-transform-streaming.ts +5 -5
- package/runtime/examples/extensions/input-transform.ts +5 -5
- package/runtime/examples/extensions/interactive-shell.ts +3 -3
- package/runtime/examples/extensions/mac-system-theme.ts +5 -5
- package/runtime/examples/extensions/message-renderer.ts +4 -4
- package/runtime/examples/extensions/minimal-mode.ts +9 -9
- package/runtime/examples/extensions/modal-editor.ts +3 -3
- package/runtime/examples/extensions/model-status.ts +3 -3
- package/runtime/examples/extensions/notify.ts +5 -5
- package/runtime/examples/extensions/overlay-qa-tests.ts +20 -20
- package/runtime/examples/extensions/overlay-test.ts +3 -3
- package/runtime/examples/extensions/permission-gate.ts +2 -2
- package/runtime/examples/extensions/pirate.ts +4 -4
- package/runtime/examples/extensions/plan-mode/index.ts +21 -21
- package/runtime/examples/extensions/preset.ts +26 -26
- package/runtime/examples/extensions/project-trust.ts +7 -7
- package/runtime/examples/extensions/prompt-customizer.ts +3 -3
- package/runtime/examples/extensions/protected-paths.ts +2 -2
- package/runtime/examples/extensions/provider-payload.ts +3 -3
- package/runtime/examples/extensions/question.ts +2 -2
- package/runtime/examples/extensions/questionnaire.ts +2 -2
- package/runtime/examples/extensions/rainbow-editor.ts +3 -3
- package/runtime/examples/extensions/reload-runtime.ts +4 -4
- package/runtime/examples/extensions/rpc-demo.ts +10 -10
- package/runtime/examples/extensions/sandbox/index.ts +15 -15
- package/runtime/examples/extensions/sandbox/package-lock.json +4 -4
- package/runtime/examples/extensions/sandbox/package.json +3 -3
- package/runtime/examples/extensions/send-user-message.ts +13 -13
- package/runtime/examples/extensions/session-name.ts +4 -4
- package/runtime/examples/extensions/shutdown-command.ts +10 -10
- package/runtime/examples/extensions/snake.ts +3 -3
- package/runtime/examples/extensions/space-invaders.ts +3 -3
- package/runtime/examples/extensions/ssh.ts +12 -12
- package/runtime/examples/extensions/status-line.ts +4 -4
- package/runtime/examples/extensions/structured-output.ts +2 -2
- package/runtime/examples/extensions/subagent/index.ts +5 -5
- package/runtime/examples/extensions/system-prompt-header.ts +3 -3
- package/runtime/examples/extensions/tic-tac-toe.ts +15 -15
- package/runtime/examples/extensions/timed-confirm.ts +4 -4
- package/runtime/examples/extensions/titlebar-spinner.ts +11 -11
- package/runtime/examples/extensions/todo.ts +5 -5
- package/runtime/examples/extensions/tool-override.ts +5 -5
- package/runtime/examples/extensions/tools.ts +10 -10
- package/runtime/examples/extensions/trigger-compact.ts +3 -3
- package/runtime/examples/extensions/truncated-tool.ts +3 -3
- package/runtime/examples/extensions/widget-placement.ts +2 -2
- package/runtime/examples/extensions/with-deps/index.ts +2 -2
- package/runtime/examples/extensions/with-deps/package-lock.json +4 -4
- package/runtime/examples/extensions/with-deps/package.json +3 -3
- package/runtime/examples/extensions/working-indicator.ts +7 -7
- package/runtime/examples/extensions/working-message-test.ts +3 -3
- package/runtime/examples/sdk/01-minimal.ts +1 -1
- package/runtime/examples/sdk/03-custom-prompt.ts +1 -1
- package/runtime/examples/sdk/04-skills.ts +1 -1
- package/runtime/examples/sdk/05-tools.ts +1 -1
- package/runtime/examples/sdk/06-extensions.ts +11 -11
- package/runtime/examples/sdk/08-prompt-templates.ts +1 -1
- package/runtime/export-html/template.js +3 -3
- package/runtime/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/runtime/package.json +8 -14
- package/runtime/theme/dark.json +0 -1
- package/runtime/theme/light.json +0 -1
- package/runtime/theme/theme-schema.json +2 -2
- package/runtime/valni +2 -2
- package/runtime/README.md +0 -674
- package/runtime/docs/extensions.md +0 -2910
- package/runtime/docs/json.md +0 -82
- package/runtime/docs/models.md +0 -540
- package/runtime/docs/packages.md +0 -228
- package/runtime/docs/rpc.md +0 -1480
- package/runtime/docs/sdk.md +0 -1183
- package/runtime/docs/session-format.md +0 -422
- package/runtime/docs/settings.md +0 -315
- package/runtime/docs/shell-aliases.md +0 -13
- package/runtime/docs/terminal-setup.md +0 -142
- package/runtime/docs/termux.md +0 -127
- package/runtime/docs/tmux.md +0 -63
- package/runtime/docs/tui.md +0 -927
- package/runtime/docs/windows.md +0 -17
- package/runtime/examples/README.md +0 -25
- package/runtime/examples/extensions/README.md +0 -212
- package/runtime/examples/extensions/doom-overlay/README.md +0 -46
- package/runtime/examples/extensions/dynamic-resources/SKILL.md +0 -8
- package/runtime/examples/extensions/dynamic-resources/dynamic.md +0 -5
- package/runtime/examples/extensions/gondolin/index.ts +0 -531
- package/runtime/examples/extensions/gondolin/package-lock.json +0 -185
- package/runtime/examples/extensions/gondolin/package.json +0 -19
- package/runtime/examples/extensions/plan-mode/README.md +0 -66
- package/runtime/examples/extensions/subagent/README.md +0 -175
- package/runtime/examples/extensions/subagent/agents/planner.md +0 -37
- package/runtime/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/runtime/examples/extensions/subagent/agents/scout.md +0 -50
- package/runtime/examples/extensions/subagent/agents/worker.md +0 -24
- package/runtime/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/runtime/examples/extensions/subagent/prompts/implement.md +0 -10
- package/runtime/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- package/runtime/examples/sdk/README.md +0 -140
- package/runtime/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
- package/runtime/node_modules/@mariozechner/clipboard/Cargo.toml +0 -45
- package/runtime/node_modules/@mariozechner/clipboard/README.md +0 -60
- package/runtime/node_modules/@mariozechner/clipboard/build.rs +0 -5
- package/runtime/node_modules/@mariozechner/clipboard/clipboard.darwin-x64.node +0 -0
- package/runtime/node_modules/@mariozechner/clipboard/exp.ts +0 -12
- package/runtime/node_modules/@mariozechner/clipboard/index.js +0 -606
- package/runtime/node_modules/@mariozechner/clipboard/package.json +0 -56
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +0 -307
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +0 -93
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +0 -313
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +0 -471
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +0 -252
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +0 -431
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +0 -712
- package/runtime/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +0 -916
- package/runtime/node_modules/@mariozechner/clipboard/src/lib.rs +0 -194
- package/runtime/node_modules/@mariozechner/clipboard-darwin-x64/README.md +0 -3
- package/runtime/node_modules/@mariozechner/clipboard-darwin-x64/clipboard.darwin-x64.node +0 -0
- package/runtime/node_modules/@mariozechner/clipboard-darwin-x64/package.json +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay QA Tests - comprehensive overlay positioning and edge case tests
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: valni --extension ./examples/extensions/overlay-qa-tests.ts
|
|
5
5
|
*
|
|
6
6
|
* Commands:
|
|
7
7
|
* /overlay-animation - Real-time animation demo (~30 FPS, proves DOOM-like rendering works)
|
|
@@ -27,9 +27,9 @@ import { spawn } from "child_process";
|
|
|
27
27
|
// Global handle for toggle demo (in real code, use a more elegant pattern)
|
|
28
28
|
let globalToggleHandle: OverlayHandle | null = null;
|
|
29
29
|
|
|
30
|
-
export default function (
|
|
31
|
-
// Animation demo - proves overlays can handle real-time updates (like
|
|
32
|
-
|
|
30
|
+
export default function (valni: ExtensionAPI) {
|
|
31
|
+
// Animation demo - proves overlays can handle real-time updates (like valni-doom would need)
|
|
32
|
+
valni.registerCommand("overlay-animation", {
|
|
33
33
|
description: "Test real-time animation in overlay (~30 FPS)",
|
|
34
34
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
35
35
|
await ctx.ui.custom<void>((tui, theme, _kb, done) => new AnimationDemoComponent(tui, theme, done), {
|
|
@@ -40,7 +40,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
// Test all 9 anchor positions
|
|
43
|
-
|
|
43
|
+
valni.registerCommand("overlay-anchors", {
|
|
44
44
|
description: "Cycle through all anchor positions",
|
|
45
45
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
46
46
|
const anchors: OverlayAnchor[] = [
|
|
@@ -78,7 +78,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
// Test margins and offsets
|
|
81
|
-
|
|
81
|
+
valni.registerCommand("overlay-margins", {
|
|
82
82
|
description: "Test margin and offset options",
|
|
83
83
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
84
84
|
const configs: { name: string; options: OverlayOptions }[] = [
|
|
@@ -112,7 +112,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
// Test stacked overlays
|
|
115
|
-
|
|
115
|
+
valni.registerCommand("overlay-stack", {
|
|
116
116
|
description: "Test stacked overlays",
|
|
117
117
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
118
118
|
// Three large overlays that overlap in the center area
|
|
@@ -156,7 +156,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
// Test width overflow scenarios (original crash case) - streams real process output
|
|
159
|
-
|
|
159
|
+
valni.registerCommand("overlay-overflow", {
|
|
160
160
|
description: "Test width overflow with streaming process output",
|
|
161
161
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
162
162
|
await ctx.ui.custom<void>((tui, theme, _kb, done) => new StreamingOverflowComponent(tui, theme, done), {
|
|
@@ -167,7 +167,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
// Test overlay at terminal edge
|
|
170
|
-
|
|
170
|
+
valni.registerCommand("overlay-edge", {
|
|
171
171
|
description: "Test overlay positioned at terminal edge",
|
|
172
172
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
173
173
|
await ctx.ui.custom<void>((_tui, theme, _kb, done) => new EdgeTestComponent(theme, done), {
|
|
@@ -178,7 +178,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
// Test percentage-based positioning
|
|
181
|
-
|
|
181
|
+
valni.registerCommand("overlay-percent", {
|
|
182
182
|
description: "Test percentage-based positioning",
|
|
183
183
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
184
184
|
const configs = [
|
|
@@ -214,7 +214,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
// Test maxHeight
|
|
217
|
-
|
|
217
|
+
valni.registerCommand("overlay-maxheight", {
|
|
218
218
|
description: "Test maxHeight truncation",
|
|
219
219
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
220
220
|
await ctx.ui.custom<void>((_tui, theme, _kb, done) => new MaxHeightTestComponent(theme, done), {
|
|
@@ -225,7 +225,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
225
225
|
});
|
|
226
226
|
|
|
227
227
|
// Test responsive sidepanel - only shows when terminal is wide enough
|
|
228
|
-
|
|
228
|
+
valni.registerCommand("overlay-sidepanel", {
|
|
229
229
|
description: "Test responsive sidepanel (hides when terminal < 100 cols)",
|
|
230
230
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
231
231
|
await ctx.ui.custom<void>((tui, theme, _kb, done) => new SidepanelComponent(tui, theme, done), {
|
|
@@ -243,7 +243,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
// Test toggle overlay - demonstrates OverlayHandle.setHidden() via onHandle callback
|
|
246
|
-
|
|
246
|
+
valni.registerCommand("overlay-toggle", {
|
|
247
247
|
description: "Test overlay toggle (press 't' to toggle visibility)",
|
|
248
248
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
249
249
|
await ctx.ui.custom<void>((tui, theme, _kb, done) => new ToggleDemoComponent(tui, theme, done), {
|
|
@@ -261,7 +261,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
// Non-capturing overlay demo - passive info panel that doesn't steal focus
|
|
264
|
-
|
|
264
|
+
valni.registerCommand("overlay-passive", {
|
|
265
265
|
description: "Test non-capturing overlay (passive info panel alongside active overlay)",
|
|
266
266
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
267
267
|
ctx.ui.setEditorText("");
|
|
@@ -273,7 +273,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
// Focus cycling demo - demonstrates focus(), input routing, per-panel dismissal, and rendering order
|
|
276
|
-
|
|
276
|
+
valni.registerCommand("overlay-focus", {
|
|
277
277
|
description: "Test focus cycling, input routing, dismissal, and rendering order with overlays",
|
|
278
278
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
279
279
|
ctx.ui.setEditorText("");
|
|
@@ -285,7 +285,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
285
285
|
});
|
|
286
286
|
|
|
287
287
|
// Test multiple input panels with simulated streaming
|
|
288
|
-
|
|
288
|
+
valni.registerCommand("overlay-streaming", {
|
|
289
289
|
description: "Multiple input panels with simulated streaming (Tab to cycle focus)",
|
|
290
290
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
291
291
|
ctx.ui.setEditorText("");
|
|
@@ -485,13 +485,13 @@ class StreamingOverflowComponent extends BaseOverlay {
|
|
|
485
485
|
echo ""
|
|
486
486
|
for i in $(seq 1 100); do
|
|
487
487
|
# Simulate long file paths with OSC 8 hyperlinks (clickable) - tests width overflow
|
|
488
|
-
DIR="/Users/nicobailon/Documents/development/
|
|
488
|
+
DIR="/Users/nicobailon/Documents/development/valni-cli/packages/coding-agent/src/modes/interactive"
|
|
489
489
|
FILE="\${DIR}/components/very-long-component-name-that-exceeds-width-\${i}.ts"
|
|
490
490
|
echo -e "\\033]8;;file://\${FILE}\\007▶ read: \${FILE}\\033]8;;\\007"
|
|
491
491
|
|
|
492
492
|
# Add some colored status messages with long text
|
|
493
493
|
if [ $((i % 5)) -eq 0 ]; then
|
|
494
|
-
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/
|
|
494
|
+
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/valni-cli\\033[0m"
|
|
495
495
|
fi
|
|
496
496
|
if [ $((i % 7)) -eq 0 ]; then
|
|
497
497
|
echo -e " \\033[33m⚠ Warning: potential issue detected at line \${i} in very-long-component-name-that-exceeds-width.ts\\033[0m"
|
|
@@ -760,7 +760,7 @@ class SidepanelComponent extends BaseOverlay {
|
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
-
// Animation demo - proves overlays can handle real-time updates like
|
|
763
|
+
// Animation demo - proves overlays can handle real-time updates like valni-doom
|
|
764
764
|
class AnimationDemoComponent extends BaseOverlay {
|
|
765
765
|
private tui: TUI;
|
|
766
766
|
private frame = 0;
|
|
@@ -836,7 +836,7 @@ class AnimationDemoComponent extends BaseOverlay {
|
|
|
836
836
|
lines.push(border("│") + padLine(``) + border("│"));
|
|
837
837
|
lines.push(border("│") + padLine(th.fg("dim", " This proves overlays can handle")) + border("│"));
|
|
838
838
|
lines.push(border("│") + padLine(th.fg("dim", " real-time game-like rendering.")) + border("│"));
|
|
839
|
-
lines.push(border("│") + padLine(th.fg("dim", " (
|
|
839
|
+
lines.push(border("│") + padLine(th.fg("dim", " (valni-doom uses same approach)")) + border("│"));
|
|
840
840
|
lines.push(border("│") + padLine(``) + border("│"));
|
|
841
841
|
lines.push(border("│") + padLine(th.fg("dim", " Press Esc to close")) + border("│"));
|
|
842
842
|
lines.push(border(`╰${"─".repeat(innerW)}╯`));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay Test - validates overlay compositing with inline text inputs
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: valni --extension ./examples/extensions/overlay-test.ts
|
|
5
5
|
*
|
|
6
6
|
* Run /overlay-test to show a floating overlay with:
|
|
7
7
|
* - Inline text inputs within menu items
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@valni/cli";
|
|
12
12
|
import { CURSOR_MARKER, type Focusable, matchesKey, visibleWidth } from "@valni/tui";
|
|
13
13
|
|
|
14
|
-
export default function (
|
|
15
|
-
|
|
14
|
+
export default function (valni: ExtensionAPI) {
|
|
15
|
+
valni.registerCommand("overlay-test", {
|
|
16
16
|
description: "Test overlay rendering with edge cases",
|
|
17
17
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
18
18
|
const result = await ctx.ui.custom<{ action: string; query?: string } | undefined>(
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI } from "@valni/cli";
|
|
9
9
|
|
|
10
|
-
export default function (
|
|
10
|
+
export default function (valni: ExtensionAPI) {
|
|
11
11
|
const dangerousPatterns = [/\brm\s+(-rf?|--recursive)/i, /\bsudo\b/i, /\b(chmod|chown)\b.*777/i];
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
valni.on("tool_call", async (event, ctx) => {
|
|
14
14
|
if (event.toolName !== "bash") return undefined;
|
|
15
15
|
|
|
16
16
|
const command = event.input.command as string;
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* change agent behavior based on extension state.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
* 1. Copy this file to ~/.
|
|
8
|
+
* 1. Copy this file to ~/.valni/agent/extensions/ or your project's .valni/extensions/
|
|
9
9
|
* 2. Use /pirate to toggle pirate mode
|
|
10
10
|
* 3. When enabled, the agent will respond like a pirate
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { ExtensionAPI } from "@valni/cli";
|
|
14
14
|
|
|
15
|
-
export default function pirateExtension(
|
|
15
|
+
export default function pirateExtension(valni: ExtensionAPI) {
|
|
16
16
|
let pirateMode = false;
|
|
17
17
|
|
|
18
18
|
// Register /pirate command to toggle pirate mode
|
|
19
|
-
|
|
19
|
+
valni.registerCommand("pirate", {
|
|
20
20
|
description: "Toggle pirate mode (agent speaks like a pirate)",
|
|
21
21
|
handler: async (_args, ctx) => {
|
|
22
22
|
pirateMode = !pirateMode;
|
|
@@ -25,7 +25,7 @@ export default function pirateExtension(pi: ExtensionAPI) {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// Append to system prompt when pirate mode is enabled
|
|
28
|
-
|
|
28
|
+
valni.on("before_agent_start", async (event) => {
|
|
29
29
|
if (pirateMode) {
|
|
30
30
|
return {
|
|
31
31
|
systemPrompt:
|
|
@@ -44,13 +44,13 @@ function getTextContent(message: AssistantMessage): string {
|
|
|
44
44
|
.join("\n");
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export default function planModeExtension(
|
|
47
|
+
export default function planModeExtension(valni: ExtensionAPI): void {
|
|
48
48
|
let planModeEnabled = false;
|
|
49
49
|
let executionMode = false;
|
|
50
50
|
let todoItems: TodoItem[] = [];
|
|
51
51
|
let toolsBeforePlanMode: string[] | undefined;
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
valni.registerFlag("plan", {
|
|
54
54
|
description: "Start in plan mode (read-only exploration)",
|
|
55
55
|
type: "boolean",
|
|
56
56
|
default: false,
|
|
@@ -103,18 +103,18 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
|
|
103
103
|
|
|
104
104
|
function enablePlanModeTools(): void {
|
|
105
105
|
if (toolsBeforePlanMode === undefined) {
|
|
106
|
-
toolsBeforePlanMode =
|
|
106
|
+
toolsBeforePlanMode = valni.getActiveTools();
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
valni.setActiveTools(getPlanModeTools(toolsBeforePlanMode));
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
function restoreNormalModeTools(): void {
|
|
112
|
-
|
|
112
|
+
valni.setActiveTools(toolsBeforePlanMode ?? getNormalModeTools(valni.getActiveTools()));
|
|
113
113
|
toolsBeforePlanMode = undefined;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
function persistState(): void {
|
|
117
|
-
|
|
117
|
+
valni.appendEntry("plan-mode", {
|
|
118
118
|
enabled: planModeEnabled,
|
|
119
119
|
todos: todoItems,
|
|
120
120
|
executing: executionMode,
|
|
@@ -138,12 +138,12 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
|
|
138
138
|
persistState();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
valni.registerCommand("plan", {
|
|
142
142
|
description: "Toggle plan mode (read-only exploration)",
|
|
143
143
|
handler: async (_args, ctx) => togglePlanMode(ctx),
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
valni.registerCommand("todos", {
|
|
147
147
|
description: "Show current plan todo list",
|
|
148
148
|
handler: async (_args, ctx) => {
|
|
149
149
|
if (todoItems.length === 0) {
|
|
@@ -155,13 +155,13 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
|
|
155
155
|
},
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
valni.registerShortcut(Key.ctrlAlt("p"), {
|
|
159
159
|
description: "Toggle plan mode",
|
|
160
160
|
handler: async (ctx) => togglePlanMode(ctx),
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
// Block destructive bash commands in plan mode
|
|
164
|
-
|
|
164
|
+
valni.on("tool_call", async (event) => {
|
|
165
165
|
if (!planModeEnabled || event.toolName !== "bash") return;
|
|
166
166
|
|
|
167
167
|
const command = event.input.command as string;
|
|
@@ -174,7 +174,7 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
// Filter out stale plan mode context when not in plan mode
|
|
177
|
-
|
|
177
|
+
valni.on("context", async (event) => {
|
|
178
178
|
if (planModeEnabled) return;
|
|
179
179
|
|
|
180
180
|
return {
|
|
@@ -198,7 +198,7 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
// Inject plan/execution context before agent starts
|
|
201
|
-
|
|
201
|
+
valni.on("before_agent_start", async () => {
|
|
202
202
|
if (planModeEnabled) {
|
|
203
203
|
return {
|
|
204
204
|
message: {
|
|
@@ -247,7 +247,7 @@ After completing a step, include a [DONE:n] tag in your response.`,
|
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
// Track progress after each turn
|
|
250
|
-
|
|
250
|
+
valni.on("turn_end", async (event, ctx) => {
|
|
251
251
|
if (!executionMode || todoItems.length === 0) return;
|
|
252
252
|
if (!isAssistantMessage(event.message)) return;
|
|
253
253
|
|
|
@@ -259,12 +259,12 @@ After completing a step, include a [DONE:n] tag in your response.`,
|
|
|
259
259
|
});
|
|
260
260
|
|
|
261
261
|
// Handle plan completion and plan mode UI
|
|
262
|
-
|
|
262
|
+
valni.on("agent_end", async (event, ctx) => {
|
|
263
263
|
// Check if execution is complete
|
|
264
264
|
if (executionMode && todoItems.length > 0) {
|
|
265
265
|
if (todoItems.every((t) => t.completed)) {
|
|
266
266
|
const completedList = todoItems.map((t) => `~~${t.text}~~`).join("\n");
|
|
267
|
-
|
|
267
|
+
valni.sendMessage(
|
|
268
268
|
{ customType: "plan-complete", content: `**Plan Complete!** ✓\n\n${completedList}`, display: true },
|
|
269
269
|
{ triggerTurn: false },
|
|
270
270
|
);
|
|
@@ -322,23 +322,23 @@ ${remainingList}
|
|
|
322
322
|
|
|
323
323
|
Start with: ${firstTodoItem.text}
|
|
324
324
|
After completing a step, include a [DONE:n] tag in your response.`;
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
valni.sendMessage(planTodoListMessage, { deliverAs: "followUp" });
|
|
326
|
+
valni.sendMessage(
|
|
327
327
|
{ customType: "plan-mode-execute", content: execMessage, display: true },
|
|
328
328
|
{ triggerTurn: true, deliverAs: "followUp" },
|
|
329
329
|
);
|
|
330
330
|
} else if (choice === "Refine the plan") {
|
|
331
331
|
const refinement = await ctx.ui.editor("Refine the plan:", "");
|
|
332
332
|
if (refinement?.trim()) {
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
valni.sendMessage(planTodoListMessage, { deliverAs: "followUp" });
|
|
334
|
+
valni.sendUserMessage(refinement.trim(), { deliverAs: "followUp" });
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
// Restore state on session start/resume
|
|
340
|
-
|
|
341
|
-
if (
|
|
340
|
+
valni.on("session_start", async (_event, ctx) => {
|
|
341
|
+
if (valni.getFlag("plan") === true) {
|
|
342
342
|
planModeEnabled = true;
|
|
343
343
|
}
|
|
344
344
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* and can be activated via CLI flag, /preset command, or Ctrl+Shift+U to cycle.
|
|
7
7
|
*
|
|
8
8
|
* Config files (merged, project takes precedence):
|
|
9
|
-
* - ~/.
|
|
10
|
-
* - <cwd>/.
|
|
9
|
+
* - ~/.valni/agent/presets.json (global)
|
|
10
|
+
* - <cwd>/.valni/presets.json (project-local)
|
|
11
11
|
*
|
|
12
12
|
* Example presets.json:
|
|
13
13
|
* ```json
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* Usage:
|
|
33
|
-
* - `
|
|
33
|
+
* - `valni --preset plan` - start with plan preset
|
|
34
34
|
* - `/preset` - show selector to switch presets mid-session
|
|
35
35
|
* - `/preset implement` - switch to implement preset directly
|
|
36
36
|
* - `Ctrl+Shift+U` - cycle through presets
|
|
@@ -104,14 +104,14 @@ interface OriginalState {
|
|
|
104
104
|
tools: string[];
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
export default function presetExtension(
|
|
107
|
+
export default function presetExtension(valni: ExtensionAPI) {
|
|
108
108
|
let presets: PresetsConfig = {};
|
|
109
109
|
let activePresetName: string | undefined;
|
|
110
110
|
let activePreset: Preset | undefined;
|
|
111
111
|
let originalState: OriginalState | undefined;
|
|
112
112
|
|
|
113
113
|
// Register --preset CLI flag
|
|
114
|
-
|
|
114
|
+
valni.registerFlag("preset", {
|
|
115
115
|
description: "Preset configuration to use",
|
|
116
116
|
type: "string",
|
|
117
117
|
});
|
|
@@ -124,8 +124,8 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
124
124
|
if (activePresetName === undefined) {
|
|
125
125
|
originalState = {
|
|
126
126
|
model: ctx.model,
|
|
127
|
-
thinkingLevel:
|
|
128
|
-
tools:
|
|
127
|
+
thinkingLevel: valni.getThinkingLevel(),
|
|
128
|
+
tools: valni.getActiveTools(),
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -133,7 +133,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
133
133
|
if (preset.provider && preset.model) {
|
|
134
134
|
const model = ctx.modelRegistry.find(preset.provider, preset.model);
|
|
135
135
|
if (model) {
|
|
136
|
-
const success = await
|
|
136
|
+
const success = await valni.setModel(model);
|
|
137
137
|
if (!success) {
|
|
138
138
|
ctx.ui.notify(`Preset "${name}": No API key for ${preset.provider}/${preset.model}`, "warning");
|
|
139
139
|
}
|
|
@@ -144,12 +144,12 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
144
144
|
|
|
145
145
|
// Apply thinking level if specified
|
|
146
146
|
if (preset.thinkingLevel) {
|
|
147
|
-
|
|
147
|
+
valni.setThinkingLevel(preset.thinkingLevel);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// Apply tools if specified
|
|
151
151
|
if (preset.tools && preset.tools.length > 0) {
|
|
152
|
-
const allToolNames =
|
|
152
|
+
const allToolNames = valni.getAllTools().map((t) => t.name);
|
|
153
153
|
const validTools = preset.tools.filter((t) => allToolNames.includes(t));
|
|
154
154
|
const invalidTools = preset.tools.filter((t) => !allToolNames.includes(t));
|
|
155
155
|
|
|
@@ -158,7 +158,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
if (validTools.length > 0) {
|
|
161
|
-
|
|
161
|
+
valni.setActiveTools(validTools);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -273,12 +273,12 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
273
273
|
activePreset = undefined;
|
|
274
274
|
if (originalState) {
|
|
275
275
|
if (originalState.model) {
|
|
276
|
-
await
|
|
276
|
+
await valni.setModel(originalState.model);
|
|
277
277
|
}
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
valni.setThinkingLevel(originalState.thinkingLevel);
|
|
279
|
+
valni.setActiveTools(originalState.tools);
|
|
280
280
|
} else {
|
|
281
|
-
|
|
281
|
+
valni.setActiveTools(["read", "bash", "edit", "write"]);
|
|
282
282
|
}
|
|
283
283
|
ctx.ui.notify("Preset cleared, defaults restored", "info");
|
|
284
284
|
updateStatus(ctx);
|
|
@@ -329,12 +329,12 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
329
329
|
activePreset = undefined;
|
|
330
330
|
if (originalState) {
|
|
331
331
|
if (originalState.model) {
|
|
332
|
-
await
|
|
332
|
+
await valni.setModel(originalState.model);
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
valni.setThinkingLevel(originalState.thinkingLevel);
|
|
335
|
+
valni.setActiveTools(originalState.tools);
|
|
336
336
|
} else {
|
|
337
|
-
|
|
337
|
+
valni.setActiveTools(["read", "bash", "edit", "write"]);
|
|
338
338
|
}
|
|
339
339
|
ctx.ui.notify("Preset cleared, defaults restored", "info");
|
|
340
340
|
updateStatus(ctx);
|
|
@@ -349,7 +349,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
349
349
|
updateStatus(ctx);
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
valni.registerShortcut(Key.ctrlShift("u"), {
|
|
353
353
|
description: "Cycle presets",
|
|
354
354
|
handler: async (ctx) => {
|
|
355
355
|
await cyclePreset(ctx);
|
|
@@ -357,7 +357,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
357
357
|
});
|
|
358
358
|
|
|
359
359
|
// Register /preset command
|
|
360
|
-
|
|
360
|
+
valni.registerCommand("preset", {
|
|
361
361
|
description: "Switch preset configuration",
|
|
362
362
|
handler: async (args, ctx) => {
|
|
363
363
|
// If preset name provided, apply directly
|
|
@@ -383,7 +383,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
383
383
|
});
|
|
384
384
|
|
|
385
385
|
// Inject preset instructions into system prompt
|
|
386
|
-
|
|
386
|
+
valni.on("before_agent_start", async (event) => {
|
|
387
387
|
if (activePreset?.instructions) {
|
|
388
388
|
return {
|
|
389
389
|
systemPrompt: `${event.systemPrompt}\n\n${activePreset.instructions}`,
|
|
@@ -392,12 +392,12 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
392
392
|
});
|
|
393
393
|
|
|
394
394
|
// Initialize on session start
|
|
395
|
-
|
|
395
|
+
valni.on("session_start", async (_event, ctx) => {
|
|
396
396
|
// Load presets from config files
|
|
397
397
|
presets = loadPresets(ctx.cwd);
|
|
398
398
|
|
|
399
399
|
// Check for --preset flag
|
|
400
|
-
const presetFlag =
|
|
400
|
+
const presetFlag = valni.getFlag("preset");
|
|
401
401
|
if (typeof presetFlag === "string" && presetFlag) {
|
|
402
402
|
const preset = presets[presetFlag];
|
|
403
403
|
if (preset) {
|
|
@@ -428,9 +428,9 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
428
428
|
});
|
|
429
429
|
|
|
430
430
|
// Persist preset state
|
|
431
|
-
|
|
431
|
+
valni.on("turn_start", async () => {
|
|
432
432
|
if (activePresetName) {
|
|
433
|
-
|
|
433
|
+
valni.appendEntry("preset-state", { name: activePresetName });
|
|
434
434
|
}
|
|
435
435
|
});
|
|
436
436
|
}
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates the project_trust event. Install globally or pass via -e:
|
|
5
5
|
*
|
|
6
|
-
* mkdir -p ~/.
|
|
7
|
-
* cp packages/coding-agent/examples/extensions/project-trust.ts ~/.
|
|
6
|
+
* mkdir -p ~/.valni/agent/extensions
|
|
7
|
+
* cp packages/coding-agent/examples/extensions/project-trust.ts ~/.valni/agent/extensions/
|
|
8
8
|
*
|
|
9
9
|
* Or:
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* valni -e packages/coding-agent/examples/extensions/project-trust.ts
|
|
12
12
|
*
|
|
13
|
-
* Try it in a project containing .
|
|
13
|
+
* Try it in a project containing .valni, AGENTS.md/CLAUDE.md, or .agents/skills.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type { ExtensionAPI, ProjectTrustEventResult } from "@valni/cli";
|
|
17
17
|
|
|
18
|
-
export default function (
|
|
18
|
+
export default function (valni: ExtensionAPI) {
|
|
19
19
|
let loadCount = 0;
|
|
20
20
|
loadCount++;
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
23
23
|
// { trusted: "yes" } or { trusted: "no" } wins and suppresses the built-in
|
|
24
24
|
// trust prompt. Return { trusted: "undecided" } to let another handler or the
|
|
25
25
|
// built-in flow decide.
|
|
26
|
-
|
|
26
|
+
valni.on("project_trust", async (event, ctx): Promise<ProjectTrustEventResult> => {
|
|
27
27
|
ctx.ui.notify(`project_trust fired for ${event.cwd} (mode: ${ctx.mode}, load: ${loadCount})`, "info");
|
|
28
28
|
|
|
29
29
|
if (!ctx.hasUI) {
|
|
@@ -58,7 +58,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
58
58
|
return { trusted: "undecided" };
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
valni.on("session_start", (_event, ctx) => {
|
|
62
62
|
ctx.ui.notify(`project-trust example loaded after trust resolution in ${ctx.cwd}`, "info");
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* are currently active, respecting whatever the user has configured.
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
* 1. Copy this file to ~/.
|
|
11
|
+
* 1. Copy this file to ~/.valni/agent/extensions/ or your project's .valni/extensions/
|
|
12
12
|
* 2. Use the extension — it automatically adapts to your active tools and skills
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -83,8 +83,8 @@ If you have additional requirements, configure them via --append-system-prompt o
|
|
|
83
83
|
return extensionSpecific;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export default function promptCustomizer(
|
|
87
|
-
|
|
86
|
+
export default function promptCustomizer(valni: ExtensionAPI) {
|
|
87
|
+
valni.on("before_agent_start", async (event) => {
|
|
88
88
|
const { systemPrompt, systemPromptOptions } = event;
|
|
89
89
|
|
|
90
90
|
const customPrompt = addToolGuidance(systemPromptOptions, systemPrompt);
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI } from "@valni/cli";
|
|
9
9
|
|
|
10
|
-
export default function (
|
|
10
|
+
export default function (valni: ExtensionAPI) {
|
|
11
11
|
const protectedPaths = [".env", ".git/", "node_modules/"];
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
valni.on("tool_call", async (event, ctx) => {
|
|
14
14
|
if (event.toolName !== "write" && event.toolName !== "edit") {
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
@@ -2,8 +2,8 @@ import { appendFileSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@valni/cli";
|
|
4
4
|
|
|
5
|
-
export default function (
|
|
6
|
-
|
|
5
|
+
export default function (valni: ExtensionAPI) {
|
|
6
|
+
valni.on("before_provider_request", (event, ctx) => {
|
|
7
7
|
const logFile = join(ctx.cwd, CONFIG_DIR_NAME, "provider-payload.log");
|
|
8
8
|
appendFileSync(logFile, `${JSON.stringify(event.payload, null, 2)}\n\n`, "utf8");
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
11
11
|
// return { ...event.payload, temperature: 0 };
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
valni.on("after_provider_response", (event, ctx) => {
|
|
15
15
|
const logFile = join(ctx.cwd, CONFIG_DIR_NAME, "provider-payload.log");
|
|
16
16
|
appendFileSync(logFile, `[${event.status}] ${JSON.stringify(event.headers)}\n\n`, "utf8");
|
|
17
17
|
});
|
|
@@ -33,8 +33,8 @@ const QuestionParams = Type.Object({
|
|
|
33
33
|
options: Type.Array(OptionSchema, { description: "Options for the user to choose from" }),
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
export default function question(
|
|
37
|
-
|
|
36
|
+
export default function question(valni: ExtensionAPI) {
|
|
37
|
+
valni.registerTool({
|
|
38
38
|
name: "question",
|
|
39
39
|
label: "Question",
|
|
40
40
|
description: "Ask the user a question and let them pick from options. Use when you need user input to proceed.",
|
|
@@ -73,8 +73,8 @@ function errorResult(
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export default function questionnaire(
|
|
77
|
-
|
|
76
|
+
export default function questionnaire(valni: ExtensionAPI) {
|
|
77
|
+
valni.registerTool({
|
|
78
78
|
name: "questionnaire",
|
|
79
79
|
label: "Questionnaire",
|
|
80
80
|
description:
|