openzellij 1.0.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/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # openzellij
2
+
3
+ OpenCode plugin for Zellij integration - automatically manages background agent
4
+ panes in Zellij terminal sessions.
5
+
6
+ ## Features
7
+
8
+ - **Auto-spawning panes**: Background OpenCode agents automatically open in
9
+ Zellij floating panes
10
+ - **Auto-close on completion**: Panes automatically close when agents finish
11
+ (configurable)
12
+ - **Agent visibility**: Track all active agent panes with logging
13
+ - **Configurable behavior**: Fine-tune polling intervals, grace periods, and
14
+ pane layout
15
+ - **Cross-platform**: Works on Linux, macOS, Windows via npm
16
+
17
+ ## Installation
18
+
19
+ ### For LLMs
20
+
21
+ Paste this into opencode:
22
+
23
+ `follow the steps written in this markdown file and execute them in order : https://raw.githubusercontent.com/cernoh/openzellij/refs/heads/main/docs/LLM_SETUP_SCRIPT.md`
24
+
25
+ ### npm (Recommended)
26
+
27
+ ```bash
28
+ # Global installation (recommended)
29
+ npm install -g openzellij
30
+
31
+ # Project-local
32
+ npm install openzellij
33
+ ```
34
+
35
+ ### Adding to OpenCode Config
36
+
37
+ After installing via npm, add `openzellij` to your OpenCode configuration:
38
+
39
+ **Global configuration** (`~/.config/opencode/opencode.json`):
40
+ ```json
41
+ {
42
+ "$schema": "https://opencode.ai/config.json",
43
+ "plugin": ["openzellij"]
44
+ }
45
+ ```
46
+
47
+ **Project configuration** (`opencode.json` in your project root):
48
+ ```json
49
+ {
50
+ "$schema": "https://opencode.ai/config.json",
51
+ "plugin": ["openzellij"]
52
+ }
53
+ ```
54
+
55
+ OpenCode will automatically install and load the plugin at startup. The plugin will
56
+ activate when you launch background agents in a Zellij session.
57
+
58
+ ## Quick Start
59
+
60
+ 1. Install the plugin (see Installation above)
61
+ 2. Ensure Zellij is installed and in your PATH
62
+ 3. Start a Zellij session: `zellij`
63
+ 4. Launch OpenCode with background agents
64
+ 5. Agent panes will automatically appear in Zellij
65
+ 6. Panes auto-close when agents complete (default behavior)
66
+
67
+ ## Configuration
68
+
69
+ Create `~/.config/opencode/openzellij.json`:
70
+
71
+ ```json
72
+ {
73
+ "autoClosePanes": true,
74
+ "panePollIntervalMs": 2000,
75
+ "paneMissingGraceMs": 6000,
76
+ "paneLayout": "tiled",
77
+ "enableLogging": true
78
+ }
79
+ ```
80
+
81
+ See [docs/CONFIG.md](docs/CONFIG.md) for full configuration reference.
82
+
83
+ ## Documentation
84
+
85
+ - [Installation Guide](docs/INSTALL.md) - Detailed installation steps
86
+ - [Configuration Reference](docs/CONFIG.md) - All config options
87
+
88
+ ## Requirements
89
+
90
+ - Zellij >= 0.30.0
91
+ - OpenCode >= 1.0.0
92
+ - Node.js >= 18 or Bun >= 1.0
93
+
94
+ ## License
95
+
96
+ MIT
File without changes
@@ -0,0 +1,99 @@
1
+ export type SessionLifecycleEvent =
2
+ | 'session.created'
3
+ | 'session.updated'
4
+ | 'session.idle'
5
+ | 'session.deleted'
6
+ | 'session.logs'
7
+ | 'session.progress'
8
+
9
+ export interface PluginContext {
10
+ client: OpencodeClient
11
+ directory: string
12
+ serverUrl?: string
13
+ }
14
+
15
+ export interface OpencodeClient {
16
+ session: {
17
+ status(options?: { includeLogs?: boolean }): Promise<SessionStatusResponse>
18
+ subscribe(listener: SessionSubscriptionHandler): () => void
19
+ }
20
+ logger?: {
21
+ info(message: string, meta?: Record<string, unknown>): void
22
+ warn(message: string, meta?: Record<string, unknown>): void
23
+ error(message: string | Error, meta?: Record<string, unknown>): void
24
+ debug?(message: string, meta?: Record<string, unknown>): void
25
+ }
26
+ }
27
+
28
+ export interface SessionStatusResponse {
29
+ sessions: SessionDescriptor[]
30
+ }
31
+
32
+ export type SessionSubscriptionHandler = (event: PluginEventInput) => void | Promise<void>
33
+
34
+ export interface SessionDescriptor {
35
+ id: string
36
+ title?: string
37
+ parentId?: string | null
38
+ status: SessionState
39
+ metadata?: Record<string, unknown>
40
+ }
41
+
42
+ export type SessionState = 'running' | 'idle' | 'completed' | 'failed' | 'unknown'
43
+
44
+ export interface PluginEventInput {
45
+ type: SessionLifecycleEvent
46
+ session: SessionDescriptor
47
+ }
48
+
49
+ export interface PluginInstance {
50
+ name: string
51
+ event: (input: PluginEventInput) => Promise<void>
52
+ dispose?: () => Promise<void>
53
+ }
54
+
55
+ export interface TrackedPane {
56
+ sessionId: string
57
+ paneId: string
58
+ processId?: number
59
+ createdAt: number
60
+ lastUpdatedAt: number
61
+ title?: string
62
+ exitStatus?: number | null
63
+ missingSince?: number
64
+ }
65
+
66
+ export interface PaneRegistry {
67
+ sessions: Map<string, TrackedPane>
68
+ add(pane: TrackedPane): void
69
+ remove(sessionId: string): void
70
+ get(sessionId: string): TrackedPane | undefined
71
+ getAll(): TrackedPane[]
72
+ updateLastSeen(sessionId: string): void
73
+ }
74
+
75
+ export interface PluginConfig {
76
+ enableLogging: boolean
77
+ spawnDelayMs: number
78
+ maxConcurrentSpawns: number
79
+ paneLayout: 'tiled' | 'vertical' | 'horizontal'
80
+ zellijBinary: string
81
+ listIntervalMs: number
82
+ autoClosePanes: boolean
83
+ panePollIntervalMs: number
84
+ paneMissingGraceMs: number
85
+ }
86
+
87
+ export interface PluginInput {
88
+ context: PluginContext
89
+ }
90
+
91
+ export interface PluginOutput {
92
+ name: string
93
+ event: SessionEvent
94
+ }
95
+
96
+ export type SessionEvent =
97
+ | { type: 'custom'; payload: Record<string, unknown> }
98
+ | { type: 'pane.spawned'; sessionId: string; paneId: string }
99
+ | { type: 'pane.closed'; sessionId: string; paneId: string }