@valni/cli-darwin-x64 0.1.2 → 0.1.4
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
package/LICENSE
CHANGED
|
@@ -25,8 +25,7 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
25
25
|
|
|
26
26
|
THIRD-PARTY NOTICES
|
|
27
27
|
|
|
28
|
-
This software includes code from pi
|
|
29
|
-
used under the MIT License. That code remains under its own terms, reproduced
|
|
28
|
+
This software includes code from pi, used under the MIT License. That code remains under its own terms, reproduced
|
|
30
29
|
below. Nothing in this notice grants rights to Benovi Limited Company's own
|
|
31
30
|
code, which is governed by the terms above.
|
|
32
31
|
|
package/package.json
CHANGED
package/runtime/LICENSE
CHANGED
|
@@ -25,8 +25,7 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
25
25
|
|
|
26
26
|
THIRD-PARTY NOTICES
|
|
27
27
|
|
|
28
|
-
This software includes code from pi
|
|
29
|
-
used under the MIT License. That code remains under its own terms, reproduced
|
|
28
|
+
This software includes code from pi, used under the MIT License. That code remains under its own terms, reproduced
|
|
30
29
|
below. Nothing in this notice grants rights to Benovi Limited Company's own
|
|
31
30
|
code, which is governed by the terms above.
|
|
32
31
|
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI } from "@valni/cli";
|
|
9
9
|
|
|
10
|
-
export default function (
|
|
11
|
-
|
|
10
|
+
export default function (valni: ExtensionAPI) {
|
|
11
|
+
valni.on("session_shutdown", async (_event, ctx) => {
|
|
12
12
|
// Check for uncommitted changes
|
|
13
|
-
const { stdout: status, code } = await
|
|
13
|
+
const { stdout: status, code } = await valni.exec("git", ["status", "--porcelain"]);
|
|
14
14
|
|
|
15
15
|
if (code !== 0 || status.trim().length === 0) {
|
|
16
16
|
// Not a git repo or no changes
|
|
@@ -36,11 +36,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
36
36
|
|
|
37
37
|
// Generate a simple commit message
|
|
38
38
|
const firstLine = lastAssistantText.split("\n")[0] || "Work in progress";
|
|
39
|
-
const commitMessage = `[
|
|
39
|
+
const commitMessage = `[valni] ${firstLine.slice(0, 50)}${firstLine.length > 50 ? "..." : ""}`;
|
|
40
40
|
|
|
41
41
|
// Stage and commit
|
|
42
|
-
await
|
|
43
|
-
const { code: commitCode } = await
|
|
42
|
+
await valni.exec("git", ["add", "-A"]);
|
|
43
|
+
const { code: commitCode } = await valni.exec("git", ["commit", "-m", commitMessage]);
|
|
44
44
|
|
|
45
45
|
if (commitCode === 0 && ctx.hasUI) {
|
|
46
46
|
ctx.ui.notify(`Auto-committed: ${commitMessage}`, "info");
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Adjusts command, cwd, and env before execution.
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
*
|
|
7
|
+
* valni -e ./bash-spawn-hook.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ExtensionAPI } from "@valni/cli";
|
|
11
11
|
import { createBashTool } from "@valni/cli";
|
|
12
12
|
|
|
13
|
-
export default function (
|
|
13
|
+
export default function (valni: ExtensionAPI) {
|
|
14
14
|
const cwd = process.cwd();
|
|
15
15
|
|
|
16
16
|
const bashTool = createBashTool(cwd, {
|
|
@@ -21,7 +21,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
21
21
|
}),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
valni.registerTool({
|
|
25
25
|
...bashTool,
|
|
26
26
|
execute: async (id, params, signal, onUpdate, _ctx) => {
|
|
27
27
|
return bashTool.execute(id, params, signal, onUpdate);
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import type { ExtensionAPI } from "@valni/cli";
|
|
11
11
|
|
|
12
|
-
export default function (
|
|
13
|
-
|
|
12
|
+
export default function (valni: ExtensionAPI) {
|
|
13
|
+
valni.registerCommand("bookmark", {
|
|
14
14
|
description: "Bookmark last message (usage: /bookmark [label])",
|
|
15
15
|
handler: async (args, ctx) => {
|
|
16
16
|
const label = args.trim() || `bookmark-${Date.now()}`;
|
|
@@ -20,7 +20,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
20
20
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
21
21
|
const entry = entries[i];
|
|
22
22
|
if (entry.type === "message" && entry.message.role === "assistant") {
|
|
23
|
-
|
|
23
|
+
valni.setLabel(entry.id, label);
|
|
24
24
|
ctx.ui.notify(`Bookmarked as: ${label}`, "info");
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
// Remove bookmark
|
|
34
|
-
|
|
34
|
+
valni.registerCommand("unbookmark", {
|
|
35
35
|
description: "Remove bookmark from last labeled entry",
|
|
36
36
|
handler: async (_args, ctx) => {
|
|
37
37
|
const entries = ctx.sessionManager.getEntries();
|
|
@@ -39,7 +39,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
39
39
|
const entry = entries[i];
|
|
40
40
|
const label = ctx.sessionManager.getLabel(entry.id);
|
|
41
41
|
if (label) {
|
|
42
|
-
|
|
42
|
+
valni.setLabel(entry.id, undefined);
|
|
43
43
|
ctx.ui.notify(`Removed bookmark: ${label}`, "info");
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
@@ -63,7 +63,7 @@ class EmptyFooter implements Component {
|
|
|
63
63
|
invalidate(): void {}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export default function (
|
|
66
|
+
export default function (valni: ExtensionAPI) {
|
|
67
67
|
let isWorking = false;
|
|
68
68
|
let spinnerIndex = 0;
|
|
69
69
|
let spinnerTimer: ReturnType<typeof setInterval> | undefined;
|
|
@@ -77,7 +77,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
valni.on("agent_start", () => {
|
|
81
81
|
isWorking = true;
|
|
82
82
|
stopSpinner();
|
|
83
83
|
spinnerTimer = setInterval(() => {
|
|
@@ -87,25 +87,25 @@ export default function (pi: ExtensionAPI) {
|
|
|
87
87
|
activeTui?.requestRender();
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
valni.on("agent_end", () => {
|
|
91
91
|
isWorking = false;
|
|
92
92
|
stopSpinner();
|
|
93
93
|
activeTui?.requestRender();
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
valni.on("session_shutdown", () => {
|
|
97
97
|
stopSpinner();
|
|
98
98
|
activeTui = undefined;
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
valni.on("session_start", (_event, ctx) => {
|
|
102
102
|
ctx.ui.setWorkingVisible(false);
|
|
103
103
|
ctx.ui.setFooter(() => new EmptyFooter());
|
|
104
104
|
|
|
105
105
|
let branch: string | undefined;
|
|
106
106
|
|
|
107
107
|
const refreshBranch = async () => {
|
|
108
|
-
const result = await
|
|
108
|
+
const result = await valni.exec("git", ["branch", "--show-current"], { cwd: ctx.cwd }).catch(() => undefined);
|
|
109
109
|
const stdout = result?.stdout.trim();
|
|
110
110
|
branch = stdout && stdout.length > 0 ? stdout : undefined;
|
|
111
111
|
activeTui?.requestRender();
|
|
@@ -124,7 +124,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
124
124
|
|
|
125
125
|
const thm = ctx.ui.theme;
|
|
126
126
|
const model = ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : "no model";
|
|
127
|
-
const thinking =
|
|
127
|
+
const thinking = valni.getThinkingLevel();
|
|
128
128
|
const topLeft = isWorking ? thm.fg("accent", ` ${spinnerFrames[spinnerIndex]} `) : "";
|
|
129
129
|
const topRight = "";
|
|
130
130
|
const bottomLeft = thm.fg("muted", ` ${model} · ${formatThinking(thinking)} `);
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
* toggled the tool output open (via ctrl+e or clicking)
|
|
23
23
|
*
|
|
24
24
|
* Usage:
|
|
25
|
-
*
|
|
25
|
+
* valni -e ./built-in-tool-renderer.ts
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import type { BashToolDetails, EditToolDetails, ExtensionAPI, ReadToolDetails } from "@valni/cli";
|
|
29
29
|
import { createBashTool, createEditTool, createReadTool, createWriteTool } from "@valni/cli";
|
|
30
30
|
import { Text } from "@valni/tui";
|
|
31
31
|
|
|
32
|
-
export default function (
|
|
32
|
+
export default function (valni: ExtensionAPI) {
|
|
33
33
|
const cwd = process.cwd();
|
|
34
34
|
|
|
35
35
|
// --- Read tool: show path and line count ---
|
|
36
36
|
const originalRead = createReadTool(cwd);
|
|
37
|
-
|
|
37
|
+
valni.registerTool({
|
|
38
38
|
name: "read",
|
|
39
39
|
label: "read",
|
|
40
40
|
description: originalRead.description,
|
|
@@ -93,7 +93,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
93
93
|
|
|
94
94
|
// --- Bash tool: show command and exit code ---
|
|
95
95
|
const originalBash = createBashTool(cwd);
|
|
96
|
-
|
|
96
|
+
valni.registerTool({
|
|
97
97
|
name: "bash",
|
|
98
98
|
label: "bash",
|
|
99
99
|
description: originalBash.description,
|
|
@@ -152,7 +152,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
152
152
|
|
|
153
153
|
// --- Edit tool: show path and diff stats ---
|
|
154
154
|
const originalEdit = createEditTool(cwd);
|
|
155
|
-
|
|
155
|
+
valni.registerTool({
|
|
156
156
|
name: "edit",
|
|
157
157
|
label: "edit",
|
|
158
158
|
description: originalEdit.description,
|
|
@@ -217,7 +217,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
217
217
|
|
|
218
218
|
// --- Write tool: show path and size ---
|
|
219
219
|
const originalWrite = createWriteTool(cwd);
|
|
220
|
-
|
|
220
|
+
valni.registerTool({
|
|
221
221
|
name: "write",
|
|
222
222
|
label: "write",
|
|
223
223
|
description: originalWrite.description,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - Organize with subdirectories: Group related rules (e.g., frontend/, backend/)
|
|
13
13
|
*
|
|
14
14
|
* Usage:
|
|
15
|
-
* 1. Copy this file to ~/.
|
|
15
|
+
* 1. Copy this file to ~/.valni/agent/extensions/ or your project's .valni/extensions/
|
|
16
16
|
* 2. Create .claude/rules/ folder in your project root
|
|
17
17
|
* 3. Add .md files with your rules
|
|
18
18
|
*/
|
|
@@ -46,12 +46,12 @@ function findMarkdownFiles(dir: string, basePath: string = ""): string[] {
|
|
|
46
46
|
return results;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export default function claudeRulesExtension(
|
|
49
|
+
export default function claudeRulesExtension(valni: ExtensionAPI) {
|
|
50
50
|
let ruleFiles: string[] = [];
|
|
51
51
|
let rulesDir: string = "";
|
|
52
52
|
|
|
53
53
|
// Scan for rules on session start
|
|
54
|
-
|
|
54
|
+
valni.on("session_start", async (_event, ctx) => {
|
|
55
55
|
rulesDir = path.join(ctx.cwd, ".claude", "rules");
|
|
56
56
|
ruleFiles = findMarkdownFiles(rulesDir);
|
|
57
57
|
|
|
@@ -61,7 +61,7 @@ export default function claudeRulesExtension(pi: ExtensionAPI) {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// Append available rules to system prompt
|
|
64
|
-
|
|
64
|
+
valni.on("before_agent_start", async (event) => {
|
|
65
65
|
if (ruleFiles.length === 0) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Commands Extension
|
|
3
3
|
*
|
|
4
|
-
* Demonstrates the
|
|
4
|
+
* Demonstrates the valni.getCommands() API by providing a /commands command
|
|
5
5
|
* that lists all available slash commands in the current session.
|
|
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 /commands to see available commands
|
|
10
10
|
* 3. Use /commands extensions to filter by source
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { ExtensionAPI, SlashCommandInfo } from "@valni/cli";
|
|
14
14
|
|
|
15
|
-
export default function commandsExtension(
|
|
16
|
-
|
|
15
|
+
export default function commandsExtension(valni: ExtensionAPI) {
|
|
16
|
+
valni.registerCommand("commands", {
|
|
17
17
|
description: "List available slash commands",
|
|
18
18
|
getArgumentCompletions: (prefix) => {
|
|
19
19
|
const sources = ["extension", "prompt", "skill"];
|
|
@@ -21,7 +21,7 @@ export default function commandsExtension(pi: ExtensionAPI) {
|
|
|
21
21
|
return filtered.length > 0 ? filtered.map((s) => ({ value: s, label: s })) : null;
|
|
22
22
|
},
|
|
23
23
|
handler: async (args, ctx) => {
|
|
24
|
-
const commands =
|
|
24
|
+
const commands = valni.getCommands();
|
|
25
25
|
const sourceFilter = args.trim() as "extension" | "prompt" | "skill" | "";
|
|
26
26
|
|
|
27
27
|
// Filter by source if specified
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI, SessionBeforeSwitchEvent, SessionMessageEntry } from "@valni/cli";
|
|
9
9
|
|
|
10
|
-
export default function (
|
|
11
|
-
|
|
10
|
+
export default function (valni: ExtensionAPI) {
|
|
11
|
+
valni.on("session_before_switch", async (event: SessionBeforeSwitchEvent, ctx) => {
|
|
12
12
|
if (!ctx.hasUI) return;
|
|
13
13
|
|
|
14
14
|
if (event.reason === "new") {
|
|
@@ -43,7 +43,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
valni.on("session_before_fork", async (event, ctx) => {
|
|
47
47
|
if (!ctx.hasUI) return;
|
|
48
48
|
|
|
49
49
|
const choice = await ctx.ui.select(`Fork from entry ${event.entryId.slice(0, 8)}?`, [
|
|
@@ -12,10 +12,10 @@ import type { AssistantMessage } from "@valni/ai";
|
|
|
12
12
|
import type { ExtensionAPI } from "@valni/cli";
|
|
13
13
|
import { truncateToWidth, visibleWidth } from "@valni/tui";
|
|
14
14
|
|
|
15
|
-
export default function (
|
|
15
|
+
export default function (valni: ExtensionAPI) {
|
|
16
16
|
let enabled = false;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
valni.registerCommand("footer", {
|
|
19
19
|
description: "Toggle custom footer",
|
|
20
20
|
handler: async (_args, ctx) => {
|
|
21
21
|
enabled = !enabled;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Custom Header Extension
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates ctx.ui.setHeader() for replacing the built-in header
|
|
5
|
-
* (logo + keybinding hints) with a custom component showing the
|
|
5
|
+
* (logo + keybinding hints) with a custom component showing the valni mascot.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI, Theme } from "@valni/cli";
|
|
9
9
|
import { VERSION } from "@valni/cli";
|
|
10
10
|
|
|
11
11
|
// --- PI MASCOT ---
|
|
12
|
-
// Based on
|
|
12
|
+
// Based on the valni agent character
|
|
13
13
|
function getPiMascot(theme: Theme): string[] {
|
|
14
14
|
// --- COLORS ---
|
|
15
15
|
// 3b1b Blue: R=80, G=180, B=230
|
|
@@ -44,9 +44,9 @@ function getPiMascot(theme: Theme): string[] {
|
|
|
44
44
|
return ["", lineEyes, lineBar, lineLeg, lineLeg, lineLeg, lineLeg, ""];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export default function (
|
|
47
|
+
export default function (valni: ExtensionAPI) {
|
|
48
48
|
// Set custom header immediately on load (if UI is available)
|
|
49
|
-
|
|
49
|
+
valni.on("session_start", async (_event, ctx) => {
|
|
50
50
|
if (ctx.mode === "tui") {
|
|
51
51
|
ctx.ui.setHeader((_tui, theme) => {
|
|
52
52
|
return {
|
|
@@ -63,7 +63,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
// Command to restore built-in header
|
|
66
|
-
|
|
66
|
+
valni.registerCommand("builtin-header", {
|
|
67
67
|
description: "Restore built-in header with keybinding hints",
|
|
68
68
|
handler: async (_args, ctx) => {
|
|
69
69
|
ctx.ui.setHeader(undefined);
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
* cd packages/coding-agent/examples/extensions/custom-provider && npm install
|
|
14
14
|
*
|
|
15
15
|
* # With OAuth (run /login custom-anthropic first)
|
|
16
|
-
*
|
|
16
|
+
* valni -e ./packages/coding-agent/examples/extensions/custom-provider
|
|
17
17
|
*
|
|
18
18
|
* # With API key
|
|
19
|
-
* CUSTOM_ANTHROPIC_API_KEY=sk-ant-...
|
|
19
|
+
* CUSTOM_ANTHROPIC_API_KEY=sk-ant-... valni -e ./packages/coding-agent/examples/extensions/custom-provider
|
|
20
20
|
*
|
|
21
21
|
* Then use /model to select custom-anthropic/claude-sonnet-4-5
|
|
22
22
|
*/
|
|
@@ -565,8 +565,8 @@ function streamCustomAnthropic(
|
|
|
565
565
|
// Extension Entry Point
|
|
566
566
|
// =============================================================================
|
|
567
567
|
|
|
568
|
-
export default function (
|
|
569
|
-
|
|
568
|
+
export default function (valni: ExtensionAPI) {
|
|
569
|
+
valni.registerProvider("custom-anthropic", {
|
|
570
570
|
baseUrl: "https://api.anthropic.com",
|
|
571
571
|
apiKey: "$CUSTOM_ANTHROPIC_API_KEY",
|
|
572
572
|
api: "custom-anthropic-api",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"version": "0.80.
|
|
2
|
+
"name": "valni-extension-custom-provider",
|
|
3
|
+
"version": "0.80.11",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "
|
|
9
|
-
"version": "0.80.
|
|
8
|
+
"name": "valni-extension-custom-provider",
|
|
9
|
+
"version": "0.80.11",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "valni-extension-custom-provider-anthropic",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.80.
|
|
4
|
+
"version": "0.80.11",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "echo 'nothing to clean'",
|
|
8
8
|
"build": "echo 'nothing to build'",
|
|
9
9
|
"check": "echo 'nothing to check'"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
11
|
+
"valni": {
|
|
12
12
|
"extensions": [
|
|
13
13
|
"./index.ts"
|
|
14
14
|
]
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
import type { ExtensionAPI, ExtensionContext } from "@valni/cli";
|
|
9
9
|
|
|
10
10
|
async function checkDirtyRepo(
|
|
11
|
-
|
|
11
|
+
valni: ExtensionAPI,
|
|
12
12
|
ctx: ExtensionContext,
|
|
13
13
|
action: string,
|
|
14
14
|
): Promise<{ cancel: boolean } | undefined> {
|
|
15
15
|
// Check for uncommitted changes
|
|
16
|
-
const { stdout, code } = await
|
|
16
|
+
const { stdout, code } = await valni.exec("git", ["status", "--porcelain"]);
|
|
17
17
|
|
|
18
18
|
if (code !== 0) {
|
|
19
19
|
// Not a git repo, allow the action
|
|
@@ -44,13 +44,13 @@ async function checkDirtyRepo(
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export default function (
|
|
48
|
-
|
|
47
|
+
export default function (valni: ExtensionAPI) {
|
|
48
|
+
valni.on("session_before_switch", async (event, ctx) => {
|
|
49
49
|
const action = event.reason === "new" ? "new session" : "switch session";
|
|
50
|
-
return checkDirtyRepo(
|
|
50
|
+
return checkDirtyRepo(valni, ctx, action);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
return checkDirtyRepo(
|
|
53
|
+
valni.on("session_before_fork", async (_event, ctx) => {
|
|
54
|
+
return checkDirtyRepo(valni, ctx, "fork");
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Build DOOM for
|
|
2
|
+
# Build DOOM for valni-doom using doomgeneric and Emscripten
|
|
3
3
|
|
|
4
4
|
set -e
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
|
8
8
|
DOOM_DIR="$PROJECT_ROOT/doom"
|
|
9
9
|
BUILD_DIR="$PROJECT_ROOT/doom/build"
|
|
10
10
|
|
|
11
|
-
echo "===
|
|
11
|
+
echo "=== valni-doom Build Script ==="
|
|
12
12
|
|
|
13
13
|
# Check for emcc
|
|
14
14
|
if ! command -v emcc &> /dev/null; then
|
|
@@ -35,7 +35,7 @@ fi
|
|
|
35
35
|
mkdir -p "$BUILD_DIR"
|
|
36
36
|
|
|
37
37
|
# Copy our platform file
|
|
38
|
-
cp "$DOOM_DIR/
|
|
38
|
+
cp "$DOOM_DIR/doomgeneric_valni.c" "$DOOM_DIR/doomgeneric/doomgeneric/"
|
|
39
39
|
|
|
40
40
|
echo "Compiling DOOM to WebAssembly..."
|
|
41
41
|
cd "$DOOM_DIR/doomgeneric/doomgeneric"
|
|
@@ -73,7 +73,7 @@ emcc -O2 \
|
|
|
73
73
|
d_net.c \
|
|
74
74
|
doomdef.c \
|
|
75
75
|
doomgeneric.c \
|
|
76
|
-
|
|
76
|
+
doomgeneric_valni.c \
|
|
77
77
|
doomstat.c \
|
|
78
78
|
dstrings.c \
|
|
79
79
|
f_finale.c \
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DOOM Overlay Demo - Play DOOM as an overlay
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: valni --extension ./examples/extensions/doom-overlay
|
|
5
5
|
*
|
|
6
6
|
* Commands:
|
|
7
7
|
* /doom-overlay - Play DOOM in an overlay (Q to pause/exit)
|
|
@@ -18,8 +18,8 @@ import { ensureWadFile } from "./wad-finder.ts";
|
|
|
18
18
|
let activeEngine: DoomEngine | null = null;
|
|
19
19
|
let activeWadPath: string | null = null;
|
|
20
20
|
|
|
21
|
-
export default function (
|
|
22
|
-
|
|
21
|
+
export default function (valni: ExtensionAPI) {
|
|
22
|
+
valni.registerCommand("doom-overlay", {
|
|
23
23
|
description: "Play DOOM as an overlay. Q to pause and exit.",
|
|
24
24
|
|
|
25
25
|
handler: async (args, ctx) => {
|
|
@@ -4,11 +4,9 @@ import type { ExtensionAPI } from "@valni/cli";
|
|
|
4
4
|
|
|
5
5
|
const baseDir = dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
|
|
7
|
-
export default function (
|
|
8
|
-
|
|
7
|
+
export default function (valni: ExtensionAPI) {
|
|
8
|
+
valni.on("resources_discover", () => {
|
|
9
9
|
return {
|
|
10
|
-
skillPaths: [join(baseDir, "SKILL.md")],
|
|
11
|
-
promptPaths: [join(baseDir, "dynamic.md")],
|
|
12
10
|
themePaths: [join(baseDir, "dynamic.json")],
|
|
13
11
|
};
|
|
14
12
|
});
|
|
@@ -21,7 +21,7 @@ function normalizeToolName(input: string): string | undefined {
|
|
|
21
21
|
return trimmed;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export default function dynamicToolsExtension(
|
|
24
|
+
export default function dynamicToolsExtension(valni: ExtensionAPI) {
|
|
25
25
|
const registeredToolNames = new Set<string>();
|
|
26
26
|
|
|
27
27
|
const registerEchoTool = (name: string, label: string, prefix: string): boolean => {
|
|
@@ -30,7 +30,7 @@ export default function dynamicToolsExtension(pi: ExtensionAPI) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
registeredToolNames.add(name);
|
|
33
|
-
|
|
33
|
+
valni.registerTool({
|
|
34
34
|
name,
|
|
35
35
|
label,
|
|
36
36
|
description: `Echo a message with prefix: ${prefix}`,
|
|
@@ -48,12 +48,12 @@ export default function dynamicToolsExtension(pi: ExtensionAPI) {
|
|
|
48
48
|
return true;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
valni.on("session_start", (_event, ctx) => {
|
|
52
52
|
registerEchoTool("echo_session", "Echo Session", "[session] ");
|
|
53
53
|
ctx.ui.notify("Registered dynamic tool: echo_session", "info");
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
valni.registerCommand("add-echo-tool", {
|
|
57
57
|
description: "Register a new echo tool dynamically: /add-echo-tool <tool_name>",
|
|
58
58
|
handler: async (args, ctx) => {
|
|
59
59
|
const toolName = normalizeToolName(args);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Custom entry rendering example.
|
|
3
3
|
*
|
|
4
4
|
* Shows how to render durable extension data inside the chat without sending it
|
|
5
|
-
* to the LLM. Custom entries are stored in the session via
|
|
6
|
-
* rendered in interactive mode via
|
|
5
|
+
* to the LLM. Custom entries are stored in the session via valni.appendEntry() and
|
|
6
|
+
* rendered in interactive mode via valni.registerEntryRenderer().
|
|
7
7
|
*
|
|
8
8
|
* Usage: /status-card [message]
|
|
9
9
|
*/
|
|
@@ -16,8 +16,8 @@ interface StatusCardData {
|
|
|
16
16
|
timestamp: number;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default function (
|
|
20
|
-
|
|
19
|
+
export default function (valni: ExtensionAPI) {
|
|
20
|
+
valni.registerEntryRenderer<StatusCardData>("status-card", (entry, { expanded }, theme) => {
|
|
21
21
|
const data = entry.data ?? { message: "No data", timestamp: Date.now() };
|
|
22
22
|
const box = new Box(1, 1, (text) => theme.bg("customMessageBg", text));
|
|
23
23
|
box.addChild(new Text(`${theme.fg("accent", "[status]")} ${data.message}`, 0, 0));
|
|
@@ -29,10 +29,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
29
29
|
return box;
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
valni.registerCommand("status-card", {
|
|
33
33
|
description: "Render a durable status card that is not sent to the LLM",
|
|
34
34
|
handler: async (args) => {
|
|
35
|
-
|
|
35
|
+
valni.appendEntry<StatusCardData>("status-card", {
|
|
36
36
|
message: args.trim() || "Status card",
|
|
37
37
|
timestamp: Date.now(),
|
|
38
38
|
});
|