opencode-quill 0.3.2 → 0.3.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/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ 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.3.4] - 2026-10-21
8
+
9
+ ### Fixed
10
+
11
+ - Preserve learning exclusions across sync and restart
12
+
13
+ ## [0.3.3] - 2026-10-21
14
+
15
+ ### Fixed
16
+
17
+ - Keep learning when full, honor clear, and skip subagent sessions
18
+ - Hide suggestions that do not fit the cursor row
19
+
7
20
  ## [0.3.2] - 2026-10-21
8
21
 
9
22
  ### Added
@@ -90,6 +103,8 @@ All notable changes are documented in this file using
90
103
  - `/quill` command and command palette action to toggle autocomplete.
91
104
  - Local installer script, full test suite, CI workflows, and release tooling.
92
105
 
106
+ [0.3.4]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.3...v0.3.4
107
+ [0.3.3]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.2...v0.3.3
93
108
  [0.3.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.1...v0.3.2
94
109
  [0.3.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.0...v0.3.1
95
110
  [0.3.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.2.2...v0.3.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-quill",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
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
@@ -107,13 +107,13 @@ export class ComposerGhost {
107
107
  }
108
108
  const cursor = this.editor.visualCursor
109
109
  const room = this.editor.width - cursor.visualCol
110
- if (room <= 0 || cursor.visualRow < 0 || cursor.visualRow >= this.editor.height) {
110
+ const ghost = prediction.replace ? ` → ${prediction.suffix}` : prediction.suffix
111
+ if (room <= 0 || cursor.visualRow < 0 || cursor.visualRow >= this.editor.height || this.editor.editBuffer.measureText(ghost) > room) {
111
112
  this.shown = undefined
112
113
  return
113
114
  }
114
115
  const x = this.editor.screenX + cursor.visualCol
115
116
  const y = this.editor.screenY + cursor.visualRow
116
- const ghost = prediction.replace ? ` → ${prediction.suffix}` : prediction.suffix
117
117
  buffer.pushScissorRect(x, y, room, 1)
118
118
  try {
119
119
  buffer.drawText(ghost, x, y, this.color(), this.editor.backgroundColor)
package/src/predictor.ts CHANGED
@@ -8,6 +8,7 @@ export type Snapshot = {
8
8
  trigrams: [string, number][]
9
9
  forms?: [string, number][]
10
10
  seen: string[]
11
+ clearedAt?: number
11
12
  }
12
13
  export type Prompt = { id: string; text: string }
13
14
  export type Prediction = { suffix: string; word: string; confidence: number; replace?: number }
@@ -34,12 +35,16 @@ function restore(rows: [string, number][], limit: number): Map<string, number> {
34
35
  return new Map(rows.slice(0, limit).filter(([word, count]) => typeof word === "string" && word.length <= 100 && Number.isFinite(count) && count > 0))
35
36
  }
36
37
 
37
- function trim(map: Map<string, number>, limit: number): [string, number][] {
38
- return [...map].sort((a, b) => b[1] - a[1]).slice(0, limit)
38
+ const byCount = (a: [string, number], b: [string, number]) => b[1] - a[1]
39
+
40
+ export function trim(map: Map<string, number>, limit: number): [string, number][] {
41
+ return [...map].reverse().sort(byCount).slice(0, limit).reverse().sort(byCount)
39
42
  }
40
43
 
41
44
  function increment(map: Map<string, number>, word: string): void {
42
- map.set(word, (map.get(word) ?? 0) + 1)
45
+ const count = map.get(word) ?? 0
46
+ map.delete(word)
47
+ map.set(word, count + 1)
43
48
  }
44
49
 
45
50
  export class PersonalModel {
@@ -48,8 +53,10 @@ export class PersonalModel {
48
53
  readonly trigrams: Map<string, number>
49
54
  readonly forms: Map<string, number>
50
55
  readonly seen: Set<string>
56
+ readonly clearedAt: number | undefined
51
57
 
52
58
  constructor(snapshot: Snapshot = emptySnapshot()) {
59
+ this.clearedAt = Number.isFinite(snapshot.clearedAt) ? snapshot.clearedAt : undefined
53
60
  this.words = restore(snapshot.words, WORD_LIMIT)
54
61
  this.bigrams = restore(snapshot.bigrams, CONTEXT_LIMIT)
55
62
  this.trigrams = restore(snapshot.trigrams, CONTEXT_LIMIT)
@@ -97,6 +104,7 @@ export class PersonalModel {
97
104
  trigrams: trim(this.trigrams, CONTEXT_LIMIT),
98
105
  forms: trim(this.forms, WORD_LIMIT),
99
106
  seen: [...this.seen].slice(-SEEN_LIMIT),
107
+ ...(this.clearedAt === undefined ? {} : { clearedAt: this.clearedAt }),
100
108
  }
101
109
  }
102
110
  }
package/src/tui.tsx CHANGED
@@ -60,6 +60,7 @@ export default Plugin.define({
60
60
 
61
61
  const learn = async (sessionID: string, announce = true) => {
62
62
  if (disposed || !settings.enabled) return
63
+ if (context.data.session.list().find((session) => session.id === sessionID)?.parentID) return
63
64
  const active = inFlight.get(sessionID)
64
65
  if (active) {
65
66
  if (announce) {
@@ -79,20 +80,26 @@ export default Plugin.define({
79
80
  try {
80
81
  await context.data.session.message.sync(sessionID)
81
82
  if (disposed || !settings.enabled) return
83
+ if (context.data.session.list().find((session) => session.id === sessionID)?.parentID) return
82
84
  if (version !== resetVersion) continue
83
- const prompts = context.data.session.message.list(sessionID)
85
+ const candidates = context.data.session.message.list(sessionID)
84
86
  .filter((message) => message.type === "user")
85
87
  .slice(-200)
86
- .map((message) => ({ id: `${sessionID}:${message.id}`, text: message.text }))
88
+ .map((message) => ({ id: `${sessionID}:${message.id}`, text: message.text, created: message.time?.created }))
89
+ const promptsFor = (clearedAt: number | undefined) => candidates
90
+ .filter((prompt) => clearedAt === undefined || (prompt.created !== undefined && prompt.created >= clearedAt))
91
+ .map(({ id, text }) => ({ id, text }))
87
92
  const snapshot = unwrap(learning.snapshot)
88
93
  const seen = new Set(snapshot.seen)
94
+ const prompts = promptsFor(snapshot.clearedAt)
89
95
  if (!prompts.some((prompt) => !seen.has(prompt.id))) continue
90
96
  const model = new PersonalModel(snapshot)
91
97
  if (model.observe(prompts)) {
92
98
  await setLearning((draft) => {
93
99
  if (disposed || !settings.enabled || version !== resetVersion) return
100
+ if (context.data.session.list().find((session) => session.id === sessionID)?.parentID) return
94
101
  const latest = new PersonalModel(unwrap(draft.snapshot))
95
- if (latest.observe(prompts)) draft.snapshot = latest.snapshot()
102
+ if (latest.observe(promptsFor(latest.clearedAt))) draft.snapshot = latest.snapshot()
96
103
  })
97
104
  }
98
105
  } catch (error) {
@@ -113,8 +120,9 @@ export default Plugin.define({
113
120
  state.pending = false
114
121
  state.announce = false
115
122
  }
116
- predictor.setPersonal(emptySnapshot())
117
- await setLearning((draft) => { draft.snapshot = emptySnapshot() })
123
+ const cleared = { ...emptySnapshot(), clearedAt: Date.now() }
124
+ predictor.setPersonal(cleared)
125
+ await setLearning((draft) => { draft.snapshot = cleared })
118
126
  ghost?.invalidate()
119
127
  context.ui.toast.show({ title: "Quill", message: "Word autocomplete history cleared" })
120
128
  }