@plures/runebook 0.4.0
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/ANALYSIS_LADDER.md +231 -0
- package/CHANGELOG.md +124 -0
- package/INTEGRATIONS.md +242 -0
- package/LICENSE +21 -0
- package/MEMORY.md +253 -0
- package/NIXOS.md +357 -0
- package/QUICKSTART.md +157 -0
- package/README.md +295 -0
- package/RELEASE.md +190 -0
- package/ValidationChecklist.md +598 -0
- package/docs/demo.md +338 -0
- package/docs/llm-integration.md +300 -0
- package/docs/parallel-execution-plan.md +160 -0
- package/flake.nix +228 -0
- package/integrations/README.md +242 -0
- package/integrations/demo-steps.sh +64 -0
- package/integrations/nvim-runebook.lua +140 -0
- package/integrations/tmux-status.sh +51 -0
- package/integrations/vim-runebook.vim +77 -0
- package/integrations/wezterm-status-simple.lua +48 -0
- package/integrations/wezterm-status.lua +76 -0
- package/nixos-module.nix +156 -0
- package/package.json +76 -0
- package/packages/design-dojo/index.js +4 -0
- package/packages/design-dojo/package.json +20 -0
- package/packages/design-dojo/tokens.css +69 -0
- package/playwright.config.ts +16 -0
- package/scripts/check-versions.cjs +62 -0
- package/scripts/demo.sh +220 -0
- package/shell.nix +31 -0
- package/src/app.html +13 -0
- package/src/cli/index.ts +1050 -0
- package/src/lib/agent/analysis-pipeline.ts +347 -0
- package/src/lib/agent/analysis-service.ts +171 -0
- package/src/lib/agent/analysis.ts +159 -0
- package/src/lib/agent/analyzers/heuristic.ts +289 -0
- package/src/lib/agent/analyzers/index.ts +7 -0
- package/src/lib/agent/analyzers/llm.ts +204 -0
- package/src/lib/agent/analyzers/local-search.ts +215 -0
- package/src/lib/agent/capture.ts +123 -0
- package/src/lib/agent/index.ts +244 -0
- package/src/lib/agent/integration.ts +81 -0
- package/src/lib/agent/llm/providers/base.ts +99 -0
- package/src/lib/agent/llm/providers/index.ts +60 -0
- package/src/lib/agent/llm/providers/mock.ts +67 -0
- package/src/lib/agent/llm/providers/ollama.ts +151 -0
- package/src/lib/agent/llm/providers/openai.ts +153 -0
- package/src/lib/agent/llm/sanitizer.ts +170 -0
- package/src/lib/agent/llm/types.ts +118 -0
- package/src/lib/agent/memory.ts +363 -0
- package/src/lib/agent/node-status.ts +56 -0
- package/src/lib/agent/node-suggestions.ts +64 -0
- package/src/lib/agent/status.ts +80 -0
- package/src/lib/agent/suggestions.ts +169 -0
- package/src/lib/components/Canvas.svelte +124 -0
- package/src/lib/components/ConnectionLine.svelte +46 -0
- package/src/lib/components/DisplayNode.svelte +167 -0
- package/src/lib/components/InputNode.svelte +158 -0
- package/src/lib/components/TerminalNode.svelte +237 -0
- package/src/lib/components/Toolbar.svelte +359 -0
- package/src/lib/components/TransformNode.svelte +327 -0
- package/src/lib/core/index.ts +31 -0
- package/src/lib/core/observer.ts +278 -0
- package/src/lib/core/redaction.ts +158 -0
- package/src/lib/core/shell-adapters/base.ts +325 -0
- package/src/lib/core/shell-adapters/bash.ts +110 -0
- package/src/lib/core/shell-adapters/index.ts +62 -0
- package/src/lib/core/shell-adapters/zsh.ts +105 -0
- package/src/lib/core/storage.ts +360 -0
- package/src/lib/core/types.ts +176 -0
- package/src/lib/design-dojo/Box.svelte +47 -0
- package/src/lib/design-dojo/Button.svelte +75 -0
- package/src/lib/design-dojo/Input.svelte +65 -0
- package/src/lib/design-dojo/List.svelte +38 -0
- package/src/lib/design-dojo/Select.svelte +48 -0
- package/src/lib/design-dojo/SplitPane.svelte +43 -0
- package/src/lib/design-dojo/StatusBar.svelte +61 -0
- package/src/lib/design-dojo/Table.svelte +47 -0
- package/src/lib/design-dojo/Text.svelte +36 -0
- package/src/lib/design-dojo/Toggle.svelte +48 -0
- package/src/lib/design-dojo/index.ts +10 -0
- package/src/lib/stores/canvas-praxis.ts +268 -0
- package/src/lib/stores/canvas.ts +58 -0
- package/src/lib/types/agent.ts +78 -0
- package/src/lib/types/canvas.ts +71 -0
- package/src/lib/utils/storage.ts +326 -0
- package/src/lib/utils/yaml-loader.ts +52 -0
- package/src/routes/+layout.svelte +5 -0
- package/src/routes/+layout.ts +5 -0
- package/src/routes/+page.svelte +32 -0
- package/src-tauri/Cargo.lock +5735 -0
- package/src-tauri/Cargo.toml +38 -0
- package/src-tauri/build.rs +3 -0
- package/src-tauri/capabilities/default.json +10 -0
- package/src-tauri/icons/128x128.png +0 -0
- package/src-tauri/icons/128x128@2x.png +0 -0
- package/src-tauri/icons/32x32.png +0 -0
- package/src-tauri/icons/Square107x107Logo.png +0 -0
- package/src-tauri/icons/Square142x142Logo.png +0 -0
- package/src-tauri/icons/Square150x150Logo.png +0 -0
- package/src-tauri/icons/Square284x284Logo.png +0 -0
- package/src-tauri/icons/Square30x30Logo.png +0 -0
- package/src-tauri/icons/Square310x310Logo.png +0 -0
- package/src-tauri/icons/Square44x44Logo.png +0 -0
- package/src-tauri/icons/Square71x71Logo.png +0 -0
- package/src-tauri/icons/Square89x89Logo.png +0 -0
- package/src-tauri/icons/StoreLogo.png +0 -0
- package/src-tauri/icons/icon.icns +0 -0
- package/src-tauri/icons/icon.ico +0 -0
- package/src-tauri/icons/icon.png +0 -0
- package/src-tauri/src/agents/agent1.rs +66 -0
- package/src-tauri/src/agents/agent2.rs +80 -0
- package/src-tauri/src/agents/agent3.rs +73 -0
- package/src-tauri/src/agents/agent4.rs +66 -0
- package/src-tauri/src/agents/agent5.rs +68 -0
- package/src-tauri/src/agents/agent6.rs +75 -0
- package/src-tauri/src/agents/base.rs +52 -0
- package/src-tauri/src/agents/mod.rs +17 -0
- package/src-tauri/src/core/coordination.rs +117 -0
- package/src-tauri/src/core/mod.rs +12 -0
- package/src-tauri/src/core/ownership.rs +61 -0
- package/src-tauri/src/core/types.rs +132 -0
- package/src-tauri/src/execution/mod.rs +5 -0
- package/src-tauri/src/execution/runner.rs +143 -0
- package/src-tauri/src/lib.rs +161 -0
- package/src-tauri/src/main.rs +6 -0
- package/src-tauri/src/memory/api.rs +422 -0
- package/src-tauri/src/memory/client.rs +156 -0
- package/src-tauri/src/memory/encryption.rs +79 -0
- package/src-tauri/src/memory/migration.rs +110 -0
- package/src-tauri/src/memory/mod.rs +28 -0
- package/src-tauri/src/memory/schema.rs +275 -0
- package/src-tauri/src/memory/tests.rs +192 -0
- package/src-tauri/src/orchestrator/coordinator.rs +232 -0
- package/src-tauri/src/orchestrator/mod.rs +13 -0
- package/src-tauri/src/orchestrator/planner.rs +304 -0
- package/src-tauri/tauri.conf.json +35 -0
- package/static/examples/date-time-example.yaml +147 -0
- package/static/examples/hello-world.yaml +74 -0
- package/static/examples/transform-example.yaml +157 -0
- package/static/favicon.png +0 -0
- package/static/svelte.svg +1 -0
- package/static/tauri.svg +6 -0
- package/static/vite.svg +1 -0
- package/svelte.config.js +18 -0
- package/tsconfig.json +19 -0
- package/vite.config.js +45 -0
- package/vitest.config.ts +21 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Parallel Execution Plan
|
|
2
|
+
|
|
3
|
+
This document describes the parallel execution system for RuneBook agents.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The parallel execution plan coordinates multiple agents working on different parts of the RuneBook system simultaneously, with clear ownership boundaries and dependency management.
|
|
8
|
+
|
|
9
|
+
## Execution Order
|
|
10
|
+
|
|
11
|
+
### Phase 1: Orchestrator
|
|
12
|
+
**Agent**: Orchestrator
|
|
13
|
+
**Tasks**:
|
|
14
|
+
- Create roadmap and task breakdown
|
|
15
|
+
- Stub all interfaces
|
|
16
|
+
- Assign file ownership boundaries
|
|
17
|
+
- Initialize coordination system
|
|
18
|
+
|
|
19
|
+
**Output**: Execution plan with roadmap, tasks, interfaces, and ownership boundaries
|
|
20
|
+
|
|
21
|
+
### Phase 2: Parallel Agents (Agent 1 + Agent 2)
|
|
22
|
+
**Agents**: Agent 1 (Event Capture) + Agent 2 (Storage APIs)
|
|
23
|
+
**Execution**: Run in parallel
|
|
24
|
+
**Dependencies**: Phase 1 (Orchestrator)
|
|
25
|
+
|
|
26
|
+
**Agent 1 Tasks**:
|
|
27
|
+
- Implement event capture system
|
|
28
|
+
- Owns: `src/lib/agent/capture.ts`, `src/lib/core/observer.ts`
|
|
29
|
+
|
|
30
|
+
**Agent 2 Tasks**:
|
|
31
|
+
- Implement storage APIs
|
|
32
|
+
- Publish storage API interface (triggers Phase 3)
|
|
33
|
+
- Owns: `src-tauri/src/memory/`
|
|
34
|
+
|
|
35
|
+
### Phase 3: Analysis Pipeline
|
|
36
|
+
**Agent**: Agent 3 (Analysis Pipeline)
|
|
37
|
+
**Execution**: Starts after Agent 2 publishes APIs
|
|
38
|
+
**Dependencies**: Phase 2 (Agent 2 APIs published)
|
|
39
|
+
|
|
40
|
+
**Tasks**:
|
|
41
|
+
- Implement analysis pipeline
|
|
42
|
+
- Write suggestions to store (triggers Phase 4)
|
|
43
|
+
- Owns: `src/lib/agent/analysis-pipeline.ts`, `analysis-service.ts`, `analyzers/`
|
|
44
|
+
|
|
45
|
+
### Phase 4: Surfaces
|
|
46
|
+
**Agent**: Agent 4 (Surfaces)
|
|
47
|
+
**Execution**: Starts after Agent 3 writes suggestions to store
|
|
48
|
+
**Dependencies**: Phase 3 (Agent 3 suggestions written)
|
|
49
|
+
|
|
50
|
+
**Tasks**:
|
|
51
|
+
- Implement suggestion surfaces
|
|
52
|
+
- Integrate with tmux, wezterm, vim, neovim
|
|
53
|
+
- Owns: `src/lib/agent/surfaces.ts`, `integrations/`
|
|
54
|
+
|
|
55
|
+
### Phase 5: Continuous Agents
|
|
56
|
+
**Agents**: Agent 5 (Nix + CI) + Agent 6 (Finalization)
|
|
57
|
+
**Execution**: Run continuously (start early, Agent 6 finalizes at end)
|
|
58
|
+
**Dependencies**: Phase 1 (Orchestrator)
|
|
59
|
+
|
|
60
|
+
**Agent 5 Tasks**:
|
|
61
|
+
- Set up Nix scaffolding (`flake.nix`, `shell.nix`)
|
|
62
|
+
- Set up CI scaffolding (`.github/workflows/`)
|
|
63
|
+
- Runs continuously (can be updated throughout)
|
|
64
|
+
|
|
65
|
+
**Agent 6 Tasks**:
|
|
66
|
+
- Finalize integration and testing
|
|
67
|
+
- Update `ValidationChecklist.md`
|
|
68
|
+
- Runs continuously but finalizes at the end
|
|
69
|
+
|
|
70
|
+
## Architecture
|
|
71
|
+
|
|
72
|
+
### Core Module (`src-tauri/src/core/`)
|
|
73
|
+
|
|
74
|
+
Shared types and coordination mechanisms:
|
|
75
|
+
|
|
76
|
+
- **`types.rs`**: Agent IDs, status, tasks, roadmap, interfaces, ownership, coordination messages
|
|
77
|
+
- **`ownership.rs`**: File ownership management and boundary checking
|
|
78
|
+
- **`coordination.rs`**: Coordination channels, API registry, message handling
|
|
79
|
+
|
|
80
|
+
### Orchestrator (`src-tauri/src/orchestrator/`)
|
|
81
|
+
|
|
82
|
+
- **`planner.rs`**: Creates execution plan (roadmap, tasks, interfaces, ownership)
|
|
83
|
+
- **`coordinator.rs`**: Coordinates parallel execution, tracks dependencies, manages agent status
|
|
84
|
+
|
|
85
|
+
### Agents (`src-tauri/src/agents/`)
|
|
86
|
+
|
|
87
|
+
Each agent implements the `Agent` trait:
|
|
88
|
+
|
|
89
|
+
- **`base.rs`**: Base agent trait and common functionality
|
|
90
|
+
- **`agent1.rs`**: Event capture agent
|
|
91
|
+
- **`agent2.rs`**: Storage APIs agent
|
|
92
|
+
- **`agent3.rs`**: Analysis pipeline agent
|
|
93
|
+
- **`agent4.rs`**: Surfaces agent
|
|
94
|
+
- **`agent5.rs`**: Nix + CI agent
|
|
95
|
+
- **`agent6.rs`**: Finalization agent
|
|
96
|
+
|
|
97
|
+
### Execution Runner (`src-tauri/src/execution/`)
|
|
98
|
+
|
|
99
|
+
- **`runner.rs`**: Parallel execution runner that orchestrates agent execution according to the plan
|
|
100
|
+
|
|
101
|
+
## Coordination Rules
|
|
102
|
+
|
|
103
|
+
### Ownership Boundaries
|
|
104
|
+
|
|
105
|
+
1. **No agent changes another agent's owned module without coordinating via orchestrator**
|
|
106
|
+
- Agents must request coordination to modify files owned by other agents
|
|
107
|
+
- Orchestrator approves/rejects coordination requests
|
|
108
|
+
- Shared types go in `runebook-core` module
|
|
109
|
+
|
|
110
|
+
2. **File Ownership**:
|
|
111
|
+
- Each agent has clear ownership of specific files/directories
|
|
112
|
+
- Ownership is enforced by the `OwnershipManager`
|
|
113
|
+
- Shared files are marked with `shared: true`
|
|
114
|
+
|
|
115
|
+
### API Publishing
|
|
116
|
+
|
|
117
|
+
- Agent 2 publishes storage APIs via `CoordinationMessage::ApiPublished`
|
|
118
|
+
- Agent 3 waits for Agent 2 APIs before starting
|
|
119
|
+
- API registry tracks all published APIs
|
|
120
|
+
|
|
121
|
+
### Task Completion
|
|
122
|
+
|
|
123
|
+
- Agents signal task completion via `CoordinationMessage::TaskCompleted`
|
|
124
|
+
- Agent 3 signals when suggestions are written (triggers Agent 4)
|
|
125
|
+
- Coordinator tracks task status and unblocks dependent agents
|
|
126
|
+
|
|
127
|
+
## Usage
|
|
128
|
+
|
|
129
|
+
```rust
|
|
130
|
+
use runebook::execution::ParallelExecutionRunner;
|
|
131
|
+
|
|
132
|
+
// Create runner
|
|
133
|
+
let (mut runner, _handle) = ParallelExecutionRunner::new();
|
|
134
|
+
|
|
135
|
+
// Execute all agents according to the plan
|
|
136
|
+
runner.execute().await?;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Integration with Existing Code
|
|
140
|
+
|
|
141
|
+
The parallel execution plan integrates with existing RuneBook components:
|
|
142
|
+
|
|
143
|
+
- **Event Capture**: Agent 1 extends `src/lib/agent/capture.ts`
|
|
144
|
+
- **Storage APIs**: Agent 2 extends `src-tauri/src/memory/api.rs`
|
|
145
|
+
- **Analysis Pipeline**: Agent 3 extends `src/lib/agent/analysis-pipeline.ts`
|
|
146
|
+
- **Surfaces**: Agent 4 extends `src/lib/agent/surfaces.ts` and `integrations/`
|
|
147
|
+
- **Nix/CI**: Agent 5 manages `flake.nix`, `shell.nix`, `.github/workflows/`
|
|
148
|
+
- **Finalization**: Agent 6 updates `ValidationChecklist.md`
|
|
149
|
+
|
|
150
|
+
## Next Steps
|
|
151
|
+
|
|
152
|
+
1. Implement Agent 1: Complete event capture system
|
|
153
|
+
2. Implement Agent 2: Complete storage APIs and publish interfaces
|
|
154
|
+
3. Implement Agent 3: Complete analysis pipeline and write suggestions
|
|
155
|
+
4. Implement Agent 4: Complete suggestion surfaces
|
|
156
|
+
5. Implement Agent 5: Complete Nix and CI scaffolding
|
|
157
|
+
6. Implement Agent 6: Complete finalization tasks
|
|
158
|
+
|
|
159
|
+
Each agent should follow the ownership boundaries and coordinate via the orchestrator when needed.
|
|
160
|
+
|
package/flake.nix
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
description = "RuneBook - A reactive, canvas-native computing environment";
|
|
3
|
+
|
|
4
|
+
inputs = {
|
|
5
|
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
6
|
+
flake-utils.url = "github:numtide/flake-utils";
|
|
7
|
+
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
|
11
|
+
flake-utils.lib.eachDefaultSystem (system:
|
|
12
|
+
let
|
|
13
|
+
overlays = [ (import rust-overlay) ];
|
|
14
|
+
pkgs = import nixpkgs {
|
|
15
|
+
inherit system overlays;
|
|
16
|
+
config = {
|
|
17
|
+
# TODO: Migrate to libsoup 3 or newer webkitgtk version
|
|
18
|
+
# libsoup 2.74.3 is EOL with known CVEs but required by webkitgtk_4_1
|
|
19
|
+
permittedInsecurePackages = [
|
|
20
|
+
"libsoup-2.74.3"
|
|
21
|
+
];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
# Rust toolchain (stable)
|
|
26
|
+
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
27
|
+
extensions = [ "rust-src" "rustfmt" "clippy" ];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
# Node.js
|
|
31
|
+
nodejs = pkgs.nodejs_20;
|
|
32
|
+
|
|
33
|
+
# Build the frontend (SvelteKit)
|
|
34
|
+
frontend = pkgs.buildNpmPackage {
|
|
35
|
+
pname = "runebook-frontend";
|
|
36
|
+
version = "0.2.0";
|
|
37
|
+
src = ./.;
|
|
38
|
+
|
|
39
|
+
npmDepsHash = "sha256-0HEvw24urS7Kbu/Qj8wkx0L/wZye4oZdI6z2EL+K2PE=";
|
|
40
|
+
|
|
41
|
+
nativeBuildInputs = [
|
|
42
|
+
nodejs
|
|
43
|
+
pkgs.python3
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
buildPhase = ''
|
|
47
|
+
export HOME=$(mktemp -d)
|
|
48
|
+
npm run build
|
|
49
|
+
'';
|
|
50
|
+
|
|
51
|
+
installPhase = ''
|
|
52
|
+
mkdir -p $out
|
|
53
|
+
cp -r build $out/
|
|
54
|
+
'';
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
# Build the Rust backend (Tauri)
|
|
58
|
+
runebook = pkgs.rustPlatform.buildRustPackage {
|
|
59
|
+
pname = "runebook";
|
|
60
|
+
version = "0.2.0";
|
|
61
|
+
|
|
62
|
+
# Point src directly to src-tauri directory
|
|
63
|
+
src = ./src-tauri;
|
|
64
|
+
|
|
65
|
+
# Use Cargo.lock from the source
|
|
66
|
+
cargoLock = {
|
|
67
|
+
lockFile = ./src-tauri/Cargo.lock;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
nativeBuildInputs = [
|
|
71
|
+
nodejs
|
|
72
|
+
pkgs.pkg-config
|
|
73
|
+
pkgs.wrapGAppsHook3
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
buildInputs = [
|
|
77
|
+
pkgs.openssl
|
|
78
|
+
pkgs.webkitgtk_4_1
|
|
79
|
+
pkgs.librsvg
|
|
80
|
+
pkgs.glib
|
|
81
|
+
pkgs.gtk3
|
|
82
|
+
pkgs.libayatana-appindicator
|
|
83
|
+
pkgs.libsoup_2_4
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
preBuild = ''
|
|
87
|
+
# Copy frontend build to expected location (Tauri expects it at ../build)
|
|
88
|
+
mkdir -p ../build
|
|
89
|
+
cp -r ${frontend}/build/* ../build/ || true
|
|
90
|
+
|
|
91
|
+
# Set up Rust environment
|
|
92
|
+
export RUST_BACKTRACE=1
|
|
93
|
+
export TAURI_DIST_DIR="../build"
|
|
94
|
+
export TAURI_PRIVATE_KEY=""
|
|
95
|
+
export TAURI_KEY_PASSWORD=""
|
|
96
|
+
'';
|
|
97
|
+
|
|
98
|
+
# Don't run tests during build
|
|
99
|
+
doCheck = false;
|
|
100
|
+
|
|
101
|
+
postInstall = ''
|
|
102
|
+
# wrapGAppsHook3 will handle wrapping for GTK/WebKit
|
|
103
|
+
mkdir -p $out/share/applications
|
|
104
|
+
mkdir -p $out/share/icons/hicolor
|
|
105
|
+
'';
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
# Headless CLI agent wrapper
|
|
109
|
+
runebook-agent = pkgs.writeShellApplication {
|
|
110
|
+
name = "runebook-agent";
|
|
111
|
+
runtimeInputs = [ nodejs ];
|
|
112
|
+
text = ''
|
|
113
|
+
exec ${nodejs}/bin/node ${./src/cli/index.ts} "$@"
|
|
114
|
+
'';
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
# Build the CLI as a standalone Node.js package
|
|
118
|
+
runebook-agent-pkg = pkgs.buildNpmPackage {
|
|
119
|
+
pname = "runebook-agent";
|
|
120
|
+
version = "0.2.0";
|
|
121
|
+
src = ./.;
|
|
122
|
+
|
|
123
|
+
npmDepsHash = "sha256-0HEvw24urS7Kbu/Qj8wkx0L/wZye4oZdI6z2EL+K2PE=";
|
|
124
|
+
|
|
125
|
+
nativeBuildInputs = [
|
|
126
|
+
nodejs
|
|
127
|
+
pkgs.nodePackages.typescript
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
# Don't build the frontend, just install deps
|
|
131
|
+
buildPhase = ''
|
|
132
|
+
export HOME=$(mktemp -d)
|
|
133
|
+
# Install dependencies only (no build)
|
|
134
|
+
npm install --offline --no-audit --no-fund
|
|
135
|
+
'';
|
|
136
|
+
|
|
137
|
+
installPhase = ''
|
|
138
|
+
mkdir -p $out/bin
|
|
139
|
+
mkdir -p $out/lib/node_modules/runebook-agent
|
|
140
|
+
|
|
141
|
+
# Copy package files and source
|
|
142
|
+
cp -r package.json package-lock.json $out/lib/node_modules/runebook-agent/
|
|
143
|
+
cp -r src $out/lib/node_modules/runebook-agent/
|
|
144
|
+
# Copy workspace packages so that symlinks in node_modules resolve correctly
|
|
145
|
+
cp -r packages $out/lib/node_modules/runebook-agent/
|
|
146
|
+
cp -r node_modules $out/lib/node_modules/runebook-agent/
|
|
147
|
+
|
|
148
|
+
# Create wrapper script that uses tsx to run TypeScript directly
|
|
149
|
+
# Note: tsx is included in node_modules, so we can use it directly
|
|
150
|
+
cat > $out/bin/runebook-agent <<EOF
|
|
151
|
+
#!${pkgs.runtimeShell}
|
|
152
|
+
export NODE_PATH=$out/lib/node_modules/runebook-agent/node_modules
|
|
153
|
+
exec ${nodejs}/bin/node $out/lib/node_modules/runebook-agent/node_modules/.bin/tsx $out/lib/node_modules/runebook-agent/src/cli/index.ts "\$@"
|
|
154
|
+
EOF
|
|
155
|
+
chmod +x $out/bin/runebook-agent
|
|
156
|
+
'';
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
in
|
|
160
|
+
{
|
|
161
|
+
devShells.default = pkgs.mkShell {
|
|
162
|
+
buildInputs = [
|
|
163
|
+
nodejs
|
|
164
|
+
rustToolchain
|
|
165
|
+
pkgs.pkg-config
|
|
166
|
+
pkgs.openssl
|
|
167
|
+
pkgs.webkitgtk_4_1
|
|
168
|
+
pkgs.librsvg
|
|
169
|
+
pkgs.glib
|
|
170
|
+
pkgs.gtk3
|
|
171
|
+
pkgs.libayatana-appindicator
|
|
172
|
+
pkgs.libsoup_2_4
|
|
173
|
+
pkgs.nodePackages.typescript
|
|
174
|
+
# Optional: pre-commit hooks
|
|
175
|
+
pkgs.pre-commit
|
|
176
|
+
pkgs.nixpkgs-fmt
|
|
177
|
+
pkgs.rustfmt
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
shellHook = ''
|
|
181
|
+
echo "RuneBook Development Environment"
|
|
182
|
+
echo "Node.js: $(node --version)"
|
|
183
|
+
echo "Rust: $(rustc --version)"
|
|
184
|
+
echo "Cargo: $(cargo --version)"
|
|
185
|
+
echo ""
|
|
186
|
+
echo "Available commands:"
|
|
187
|
+
echo " npm install - Install dependencies"
|
|
188
|
+
echo " npm run dev - Start development server"
|
|
189
|
+
echo " npm run build - Build the application"
|
|
190
|
+
echo " npm test - Run tests"
|
|
191
|
+
echo " npm run agent - Run agent CLI"
|
|
192
|
+
echo ""
|
|
193
|
+
echo "Nix commands:"
|
|
194
|
+
echo " nix build .#runebook - Build the Tauri app"
|
|
195
|
+
echo " nix build .#runebook-agent - Build the headless agent"
|
|
196
|
+
echo " nix run .#runebook-agent -- <command> - Run agent CLI"
|
|
197
|
+
echo ""
|
|
198
|
+
echo "⚠️ Note: OpenAI keys and other secrets must be provided"
|
|
199
|
+
echo " via environment variables at runtime, never in Nix store."
|
|
200
|
+
'';
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
packages = {
|
|
204
|
+
default = runebook;
|
|
205
|
+
runebook = runebook;
|
|
206
|
+
runebook-agent = runebook-agent-pkg;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
apps = {
|
|
210
|
+
default = {
|
|
211
|
+
type = "app";
|
|
212
|
+
program = "${runebook}/bin/runebook";
|
|
213
|
+
};
|
|
214
|
+
runebook = {
|
|
215
|
+
type = "app";
|
|
216
|
+
program = "${runebook}/bin/runebook";
|
|
217
|
+
};
|
|
218
|
+
"runebook-agent" = {
|
|
219
|
+
type = "app";
|
|
220
|
+
program = "${runebook-agent-pkg}/bin/runebook-agent";
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
# NixOS module (separate file)
|
|
225
|
+
nixosModules.default = ./nixos-module.nix;
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# RuneBook Integration Guide
|
|
2
|
+
|
|
3
|
+
This directory contains integration snippets for displaying RuneBook suggestions in various terminal environments.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
All integrations read from the same shared suggestion store located at `~/.runebook/suggestions.json` and status file at `~/.runebook/agent-status.json`. This ensures consistency across all surfaces.
|
|
8
|
+
|
|
9
|
+
## CLI Commands
|
|
10
|
+
|
|
11
|
+
### Basic Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Show current agent status
|
|
15
|
+
runebook suggest status
|
|
16
|
+
|
|
17
|
+
# Show top suggestion
|
|
18
|
+
runebook suggest top
|
|
19
|
+
|
|
20
|
+
# Show suggestions for last command
|
|
21
|
+
runebook suggest last
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Tmux Integration
|
|
25
|
+
|
|
26
|
+
### Setup
|
|
27
|
+
|
|
28
|
+
1. Copy `tmux-status.sh` to your home directory:
|
|
29
|
+
```bash
|
|
30
|
+
mkdir -p ~/.runebook/integrations
|
|
31
|
+
cp integrations/tmux-status.sh ~/.runebook/integrations/
|
|
32
|
+
chmod +x ~/.runebook/integrations/tmux-status.sh
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. Add to your `~/.tmux.conf`:
|
|
36
|
+
```tmux
|
|
37
|
+
set -g status-right '#(bash ~/.runebook/integrations/tmux-status.sh)'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. Reload tmux config:
|
|
41
|
+
```bash
|
|
42
|
+
tmux source-file ~/.tmux.conf
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Status Indicators
|
|
46
|
+
|
|
47
|
+
- `●` (green) - Agent idle
|
|
48
|
+
- `⟳` (yellow) - Agent analyzing
|
|
49
|
+
- `⚠` (red) - Issues found (shows count)
|
|
50
|
+
|
|
51
|
+
## WezTerm Integration
|
|
52
|
+
|
|
53
|
+
### Setup
|
|
54
|
+
|
|
55
|
+
1. Copy the integration file to your WezTerm config directory:
|
|
56
|
+
```bash
|
|
57
|
+
mkdir -p ~/.config/wezterm
|
|
58
|
+
cp integrations/wezterm-status-simple.lua ~/.config/wezterm/
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. Add to your `~/.config/wezterm/wezterm.lua`:
|
|
62
|
+
```lua
|
|
63
|
+
wezterm.on('update-right-status', function(window, pane)
|
|
64
|
+
local status_file = wezterm.home_dir .. '/.runebook/agent-status.json'
|
|
65
|
+
local file = io.open(status_file, 'r')
|
|
66
|
+
if not file then
|
|
67
|
+
window:set_right_status('')
|
|
68
|
+
return
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
local content = file:read('*all')
|
|
72
|
+
file:close()
|
|
73
|
+
|
|
74
|
+
-- Simple JSON parsing (for status field only)
|
|
75
|
+
local status = content:match('"status"%s*:%s*"([^"]*)"')
|
|
76
|
+
local high_priority = content:match('"highPriorityCount"%s*:%s*([0-9]+)')
|
|
77
|
+
|
|
78
|
+
local symbol = ''
|
|
79
|
+
local color = ''
|
|
80
|
+
local text = ''
|
|
81
|
+
|
|
82
|
+
if status == 'idle' then
|
|
83
|
+
symbol = '●'
|
|
84
|
+
color = '#00ff00'
|
|
85
|
+
elseif status == 'analyzing' then
|
|
86
|
+
symbol = '⟳'
|
|
87
|
+
color = '#ffff00'
|
|
88
|
+
elseif status == 'issues_found' then
|
|
89
|
+
symbol = '⚠'
|
|
90
|
+
color = '#ff0000'
|
|
91
|
+
if high_priority then
|
|
92
|
+
text = high_priority
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if symbol ~= '' then
|
|
97
|
+
window:set_right_status(wezterm.format({
|
|
98
|
+
{ Foreground = { Color = color } },
|
|
99
|
+
{ Text = symbol .. text },
|
|
100
|
+
{ Foreground = { Color = '#ffffff' } },
|
|
101
|
+
{ Text = ' ' },
|
|
102
|
+
}))
|
|
103
|
+
else
|
|
104
|
+
window:set_right_status('')
|
|
105
|
+
end
|
|
106
|
+
end)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
3. Restart WezTerm
|
|
110
|
+
|
|
111
|
+
## Vim/Neovim Integration
|
|
112
|
+
|
|
113
|
+
### Vim Setup
|
|
114
|
+
|
|
115
|
+
1. Copy the plugin file:
|
|
116
|
+
```bash
|
|
117
|
+
mkdir -p ~/.vim/plugin
|
|
118
|
+
cp integrations/vim-runebook.vim ~/.vim/plugin/
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
2. Use the command:
|
|
122
|
+
```
|
|
123
|
+
:RunebookSuggestion
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Neovim Setup (Lua)
|
|
127
|
+
|
|
128
|
+
1. Copy the plugin file:
|
|
129
|
+
```bash
|
|
130
|
+
mkdir -p ~/.config/nvim/lua
|
|
131
|
+
cp integrations/nvim-runebook.lua ~/.config/nvim/lua/runebook.lua
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
2. Or place in plugin directory:
|
|
135
|
+
```bash
|
|
136
|
+
mkdir -p ~/.config/nvim/plugin
|
|
137
|
+
cp integrations/nvim-runebook.lua ~/.config/nvim/plugin/runebook.lua
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
3. Use the command:
|
|
141
|
+
```
|
|
142
|
+
:RunebookSuggestion
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Optional: Auto-display in Virtual Text (Neovim)
|
|
146
|
+
|
|
147
|
+
Uncomment the autocmd in `nvim-runebook.lua` to automatically display suggestions in virtual text.
|
|
148
|
+
|
|
149
|
+
## Status File Format
|
|
150
|
+
|
|
151
|
+
The status file (`~/.runebook/agent-status.json`) contains:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"status": "idle" | "analyzing" | "issues_found",
|
|
156
|
+
"lastCommand": "command-name",
|
|
157
|
+
"lastCommandTimestamp": 1234567890,
|
|
158
|
+
"suggestionCount": 5,
|
|
159
|
+
"highPriorityCount": 2,
|
|
160
|
+
"lastUpdated": 1234567890
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Suggestions File Format
|
|
165
|
+
|
|
166
|
+
The suggestions file (`~/.runebook/suggestions.json`) contains:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"suggestions": [
|
|
171
|
+
{
|
|
172
|
+
"id": "suggestion-id",
|
|
173
|
+
"type": "warning" | "command" | "optimization" | "shortcut" | "tip",
|
|
174
|
+
"priority": "low" | "medium" | "high",
|
|
175
|
+
"title": "Suggestion Title",
|
|
176
|
+
"description": "Detailed description",
|
|
177
|
+
"command": "optional-command",
|
|
178
|
+
"args": ["arg1", "arg2"],
|
|
179
|
+
"timestamp": 1234567890
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"lastUpdated": 1234567890
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Testing
|
|
187
|
+
|
|
188
|
+
Run the demo script to see all features:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
./integrations/demo-steps.sh
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Requirements
|
|
195
|
+
|
|
196
|
+
- All integrations work over SSH (no GUI dependencies)
|
|
197
|
+
- No system notifications (passive display only)
|
|
198
|
+
- All surfaces read from the same shared store
|
|
199
|
+
- Works in headless environments
|
|
200
|
+
|
|
201
|
+
## Troubleshooting
|
|
202
|
+
|
|
203
|
+
### Status not updating
|
|
204
|
+
|
|
205
|
+
1. Check that the agent is enabled:
|
|
206
|
+
```bash
|
|
207
|
+
runebook agent status
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
2. Verify the status file exists:
|
|
211
|
+
```bash
|
|
212
|
+
cat ~/.runebook/agent-status.json
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
3. Check file permissions:
|
|
216
|
+
```bash
|
|
217
|
+
ls -la ~/.runebook/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Tmux status not showing
|
|
221
|
+
|
|
222
|
+
1. Verify the script is executable:
|
|
223
|
+
```bash
|
|
224
|
+
chmod +x ~/.runebook/integrations/tmux-status.sh
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
2. Test the script directly:
|
|
228
|
+
```bash
|
|
229
|
+
~/.runebook/integrations/tmux-status.sh
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
3. Check tmux config syntax:
|
|
233
|
+
```bash
|
|
234
|
+
tmux show-options -g status-right
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### WezTerm status not showing
|
|
238
|
+
|
|
239
|
+
1. Check WezTerm logs for errors
|
|
240
|
+
2. Verify the status file exists and is readable
|
|
241
|
+
3. Test JSON parsing manually
|
|
242
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Manual demo steps for RuneBook suggestion rendering
|
|
3
|
+
# This script demonstrates the UX surfaces for suggestions
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "=== RuneBook Suggestion Rendering Demo ==="
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Colors for output
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
echo -e "${BLUE}Step 1: Enable the agent${NC}"
|
|
17
|
+
echo "Command: runebook agent enable"
|
|
18
|
+
runebook agent enable
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
echo -e "${BLUE}Step 2: Check initial status${NC}"
|
|
22
|
+
echo "Command: runebook suggest status"
|
|
23
|
+
runebook suggest status
|
|
24
|
+
echo ""
|
|
25
|
+
|
|
26
|
+
echo -e "${BLUE}Step 3: Simulate some commands (these would normally be captured)${NC}"
|
|
27
|
+
echo "Note: In a real scenario, commands would be executed and captured automatically"
|
|
28
|
+
echo "For demo purposes, we'll manually trigger some analysis"
|
|
29
|
+
echo ""
|
|
30
|
+
|
|
31
|
+
echo -e "${BLUE}Step 4: Show top suggestion${NC}"
|
|
32
|
+
echo "Command: runebook suggest top"
|
|
33
|
+
runebook suggest top
|
|
34
|
+
echo ""
|
|
35
|
+
|
|
36
|
+
echo -e "${BLUE}Step 5: Show suggestions for last command${NC}"
|
|
37
|
+
echo "Command: runebook suggest last"
|
|
38
|
+
runebook suggest last
|
|
39
|
+
echo ""
|
|
40
|
+
|
|
41
|
+
echo -e "${BLUE}Step 6: Check status again${NC}"
|
|
42
|
+
echo "Command: runebook suggest status"
|
|
43
|
+
runebook suggest status
|
|
44
|
+
echo ""
|
|
45
|
+
|
|
46
|
+
echo -e "${GREEN}=== Integration Examples ===${NC}"
|
|
47
|
+
echo ""
|
|
48
|
+
echo -e "${YELLOW}Tmux Integration:${NC}"
|
|
49
|
+
echo "Add to ~/.tmux.conf:"
|
|
50
|
+
echo " set -g status-right '#(bash ~/.runebook/integrations/tmux-status.sh)'"
|
|
51
|
+
echo ""
|
|
52
|
+
|
|
53
|
+
echo -e "${YELLOW}WezTerm Integration:${NC}"
|
|
54
|
+
echo "Add to ~/.config/wezterm/wezterm.lua:"
|
|
55
|
+
echo " See integrations/wezterm-status-simple.lua for example code"
|
|
56
|
+
echo ""
|
|
57
|
+
|
|
58
|
+
echo -e "${YELLOW}Vim/Neovim Integration:${NC}"
|
|
59
|
+
echo "Place integrations/vim-runebook.vim in ~/.vim/plugin/ or ~/.config/nvim/plugin/"
|
|
60
|
+
echo "Use :RunebookSuggestion command to show suggestions"
|
|
61
|
+
echo ""
|
|
62
|
+
|
|
63
|
+
echo -e "${GREEN}Demo complete!${NC}"
|
|
64
|
+
|