@mtayfur/opencode-chat-tree 1.0.1 → 1.0.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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # OpenCode Chat Tree
2
2
 
3
- `@mtayfur/opencode-chat-tree` adds persistent conversation branching to the OpenCode TUI. It presents related sessions as a navigable tree, creates branches from any visible message, and can carry a generated handoff into the new branch.
3
+ `@mtayfur/opencode-chat-tree` adds persistent conversation branching to the OpenCode TUI. It presents related
4
+ sessions as a navigable tree, creates branches from any visible message, and can carry a generated handoff into the
5
+ new branch.
4
6
 
5
7
  ## Capabilities
6
8
 
@@ -16,32 +18,29 @@
16
18
  ## Requirements
17
19
 
18
20
  - OpenCode `1.18.16` or newer compatible 1.x release
19
- - Bun `1.3.14` or newer for local development
20
21
 
21
22
  ## Installation
22
23
 
23
- Add the package to `~/.config/opencode/tui.json`:
24
+ Install the plugin globally with OpenCode:
24
25
 
25
- ```json
26
- {
27
- "plugin": ["@mtayfur/opencode-chat-tree"]
28
- }
26
+ ```sh
27
+ opencode plugin @mtayfur/opencode-chat-tree --global
29
28
  ```
30
29
 
31
- OpenCode installs package plugins automatically. Restart the TUI after changing the configuration.
32
-
33
- ### Local checkout
30
+ Restart OpenCode after installation.
34
31
 
35
- ```sh
36
- bash ./install.sh
37
- ```
32
+ ### Manual configuration
38
33
 
39
- The installer resolves dependencies, builds `dist/index.js`, and replaces the package entry with a local file URL. Restore the published package entry with:
34
+ Alternatively, add the package to `~/.config/opencode/tui.json`:
40
35
 
41
- ```sh
42
- bash ./install.sh --uninstall
36
+ ```json
37
+ {
38
+ "plugin": ["@mtayfur/opencode-chat-tree"]
39
+ }
43
40
  ```
44
41
 
42
+ Restart OpenCode after changing the configuration.
43
+
45
44
  ## Configuration
46
45
 
47
46
  The plugin intentionally keeps its configuration small:
@@ -64,9 +63,11 @@ The plugin intentionally keeps its configuration small:
64
63
  | Option | Default | Description |
65
64
  | -------------- | ---------------------- | --------------------------------------- |
66
65
  | `storageScope` | `global` | Use `global` or `local` tree metadata. |
67
- | `model` | Current OpenCode model | Model used to generate branch handoffs. |
66
+ | `model` | OpenCode `small_model` | Model used to generate branch handoffs. |
68
67
  | `variant` | Model default | Model variant used for branch handoffs. |
69
68
 
69
+ When `model` is not set, branch handoffs use OpenCode's `small_model`.
70
+
70
71
  Unknown options are ignored so removing an obsolete option does not prevent the plugin from loading.
71
72
 
72
73
  ## Controls
@@ -95,29 +96,6 @@ Controls are fixed by design. OpenCode activates them only while the tree has fo
95
96
  - Global: `<OpenCode state>/plugins/opencode-chat-tree/projects/<project-slug-hash>/`
96
97
  - Local: `<project>/.opencode/opencode-chat-tree/`
97
98
 
98
- Each project has a `registry.json` and immutable-style tree snapshots under `trees/<tree-id>/snapshot.json`. Writes use temporary files and atomic renames. The plugin validates ownership, parent-child symmetry, graph reachability, and path-safe tree IDs before using persisted data.
99
-
100
- ## Architecture
101
-
102
- ```text
103
- src/
104
- ├── adapters/ OpenCode and filesystem boundaries
105
- ├── core/ Tree, transcript, projection, and branch rules
106
- ├── ui/ TUI controls, workflow, route, and rendering
107
- ├── configuration.ts
108
- └── index.ts Plugin entrypoint
109
- ```
110
-
111
- Core modules are side-effect free. `TreeRepository` owns persistence, while `OpenCodeTreeGateway` owns SDK calls and fork cleanup. The UI only coordinates reactive state and user interaction.
112
-
113
- ## Development
114
-
115
- From the repository root:
116
-
117
- ```sh
118
- bun install --frozen-lockfile
119
- bun run --filter @mtayfur/opencode-chat-tree fmt:check
120
- bun run --filter @mtayfur/opencode-chat-tree typecheck
121
- bun run --filter @mtayfur/opencode-chat-tree build
122
- npm pack ./packages/chat-tree --dry-run
123
- ```
99
+ Each project has a `registry.json` and immutable-style tree snapshots under `trees/<tree-id>/snapshot.json`. Writes use
100
+ temporary files and atomic renames. The plugin validates ownership, parent-child symmetry, graph reachability, and
101
+ path-safe tree IDs before using persisted data.
@@ -11,7 +11,7 @@ export type SummaryRequest = {
11
11
  readonly messages: readonly ConversationEntry[];
12
12
  readonly customInstructions?: string;
13
13
  readonly signal?: AbortSignal;
14
- readonly model?: SummaryModel;
14
+ readonly model: SummaryModel;
15
15
  readonly variant?: string;
16
16
  };
17
17
  export type CreatedBranch = {
package/dist/index.js CHANGED
@@ -862,7 +862,7 @@ class OpenCodeTreeGateway {
862
862
  directory: this.projectRoot,
863
863
  agent: "summary",
864
864
  system: SUMMARY_SYSTEM_PROMPT,
865
- ...request.model ? { model: request.model } : {},
865
+ model: request.model,
866
866
  ...request.variant ? { variant: request.variant } : {},
867
867
  parts: [
868
868
  {
@@ -1448,6 +1448,10 @@ function createBranchWorkflow(input) {
1448
1448
  failSummary("Tree transcripts are unavailable.");
1449
1449
  return;
1450
1450
  }
1451
+ if (!input.summaryModel) {
1452
+ failSummary("OpenCode small_model is not configured.");
1453
+ return;
1454
+ }
1451
1455
  let messages;
1452
1456
  try {
1453
1457
  messages = collectSummaryMessages(input.selectedRow(), transcripts);
@@ -1460,9 +1464,7 @@ function createBranchWorkflow(input) {
1460
1464
  const summaryRequest = {
1461
1465
  messages,
1462
1466
  signal: controller.signal,
1463
- ...input.summaryModel ? {
1464
- model: input.summaryModel
1465
- } : {},
1467
+ model: input.summaryModel,
1466
1468
  ...input.summaryVariant ? {
1467
1469
  variant: input.summaryVariant
1468
1470
  } : {}
@@ -2365,7 +2367,7 @@ var tui = async (api, rawOptions) => {
2365
2367
  projectRoot,
2366
2368
  storageRoot,
2367
2369
  sessionId,
2368
- summaryModel: configuration.model ?? readSummaryModel(api.state.config.model),
2370
+ summaryModel: configuration.model ?? readSummaryModel(api.state.config.small_model),
2369
2371
  summaryVariant: configuration.variant,
2370
2372
  navigateToSession: (targetSessionId) => {
2371
2373
  api.route.navigate("session", { sessionID: targetSessionId });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@mtayfur/opencode-chat-tree",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "description": "Conversation branching and navigation for the OpenCode TUI.",
6
6
  "homepage": "https://github.com/mtayfur/opencode-plugins/tree/main/packages/chat-tree#readme",
7
7
  "bugs": {