opencode-quill 0.2.1 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes are documented in this file using
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.2.2] - 2026-10-15
8
+
9
+ ### Changed
10
+
11
+ - **learning:** Read stored snapshots without store proxies
12
+
7
13
  ## [0.2.1] - 2026-10-13
8
14
 
9
15
  ### Fixed
@@ -62,6 +68,7 @@ All notable changes are documented in this file using
62
68
  - `/quill` command and command palette action to toggle autocomplete.
63
69
  - Local installer script, full test suite, CI workflows, and release tooling.
64
70
 
71
+ [0.2.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.2.1...v0.2.2
65
72
  [0.2.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.2.0...v0.2.1
66
73
  [0.2.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.1.5...v0.2.0
67
74
  [0.1.5]: https://github.com/ozandogrultan/opencode-quill/compare/v0.1.4...v0.1.5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-quill",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "OpenCode prompt autocomplete: local n-gram word and next-word prediction shown as inline ghost text in the TUI composer, accepted with Tab.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/ghost.ts CHANGED
@@ -15,13 +15,13 @@ export function dimGhostColor(muted: RGBA): RGBA {
15
15
  return RGBA.fromValues(muted.r, muted.g, muted.b, muted.a * 0.55)
16
16
  }
17
17
 
18
- export function eligibleComposer(view: Composer): boolean {
18
+ export function eligibleComposer(view: Composer, text?: string): boolean {
19
19
  const editor = view.editor
20
20
  return view.enabled && view.normal && view.mode === "base" && !view.selected &&
21
21
  editor === view.focused && editor.focused && editor.visible && !editor.isDestroyed &&
22
22
  !!editor.parent && !editor.parent.isDestroyed && !editor.hasSelection() &&
23
23
  !editor.traits.capture?.includes("navigate") &&
24
- editor.extmarks.getAll().length === 0 && editor.plainText.trim().length > 0
24
+ (text ?? editor.plainText).trim().length > 0 && editor.extmarks.getAll().length === 0
25
25
  }
26
26
 
27
27
  export function findComposer(marker: Renderable | undefined, isEditor: (node: Renderable) => node is TextareaRenderable): TextareaRenderable | undefined {
@@ -66,11 +66,9 @@ export class ComposerGhost {
66
66
  if (!this.editor.isDestroyed) this.editor.requestRender()
67
67
  }
68
68
 
69
- private prediction(): Prediction | undefined {
70
- const text = this.editor.plainText
71
- const offset = this.offset()
69
+ private prediction(text: string, offset: number): Prediction | undefined {
72
70
  if (this.dismissed !== undefined && this.dismissed !== text) this.dismissed = undefined
73
- if (!eligibleComposer(this.view()) || this.dismissed === text) return
71
+ if (this.dismissed === text || !eligibleComposer(this.view(), text)) return
74
72
  if (this.memo?.text === text && this.memo.offset === offset) return this.memo.prediction
75
73
  const query = completionQuery(text, offset)
76
74
  let prediction = query && this.predictor.complete(query)
@@ -86,8 +84,14 @@ export class ComposerGhost {
86
84
  }
87
85
 
88
86
  private paint(buffer: OptimizedBuffer): void {
89
- const prediction = this.prediction()
90
- if (!prediction || this.editor.isDestroyed) {
87
+ if (this.editor.isDestroyed) {
88
+ this.shown = undefined
89
+ return
90
+ }
91
+ const text = this.editor.plainText
92
+ const offset = this.offset()
93
+ const prediction = this.prediction(text, offset)
94
+ if (!prediction) {
91
95
  this.shown = undefined
92
96
  return
93
97
  }
@@ -106,7 +110,7 @@ export class ComposerGhost {
106
110
  } finally {
107
111
  buffer.popScissorRect()
108
112
  }
109
- this.shown = { text: this.editor.plainText, offset: this.offset(), prediction }
113
+ this.shown = { text, offset, prediction }
110
114
  }
111
115
 
112
116
  accept(): boolean {
package/src/tui.tsx CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Plugin } from "@opencode/plugin/tui"
3
3
  import { InputRenderable, TextareaRenderable, type BoxRenderable } from "@opentui/core"
4
4
  import { createEffect, createRoot, createSignal, onCleanup, untrack } from "solid-js"
5
+ import { unwrap } from "solid-js/store"
5
6
  import frequencies from "subtlex-word-frequencies"
6
7
  import { ComposerGhost, dimGhostColor, findComposer } from "./ghost"
7
8
  import { completionLayer } from "./keymap"
@@ -83,11 +84,14 @@ export default Plugin.define({
83
84
  .filter((message) => message.type === "user")
84
85
  .slice(-200)
85
86
  .map((message) => ({ id: `${sessionID}:${message.id}`, text: message.text }))
86
- const model = new PersonalModel(learning.snapshot)
87
+ const snapshot = unwrap(learning.snapshot)
88
+ const seen = new Set(snapshot.seen)
89
+ if (!prompts.some((prompt) => !seen.has(prompt.id))) continue
90
+ const model = new PersonalModel(snapshot)
87
91
  if (model.observe(prompts)) {
88
92
  await setLearning((draft) => {
89
93
  if (disposed || !settings.enabled || version !== resetVersion) return
90
- const latest = new PersonalModel(draft.snapshot)
94
+ const latest = new PersonalModel(unwrap(draft.snapshot))
91
95
  if (latest.observe(prompts)) draft.snapshot = latest.snapshot()
92
96
  })
93
97
  }
@@ -117,7 +121,10 @@ export default Plugin.define({
117
121
 
118
122
  const disposeEffects = createRoot((dispose) => {
119
123
  createEffect(() => {
120
- predictor.setPersonal(learning.snapshot)
124
+ const snapshot = learning.snapshot
125
+ snapshot.seen.length
126
+ snapshot.seen.at(-1)
127
+ predictor.setPersonal(unwrap(snapshot))
121
128
  ghost?.invalidate()
122
129
  })
123
130
  createEffect(() => {