opencode-quill 0.3.2 → 0.3.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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ 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.3] - 2026-10-21
8
+
9
+ ### Fixed
10
+
11
+ - Keep learning when full, honor clear, and skip subagent sessions
12
+ - Hide suggestions that do not fit the cursor row
13
+
7
14
  ## [0.3.2] - 2026-10-21
8
15
 
9
16
  ### Added
@@ -90,6 +97,7 @@ All notable changes are documented in this file using
90
97
  - `/quill` command and command palette action to toggle autocomplete.
91
98
  - Local installer script, full test suite, CI workflows, and release tooling.
92
99
 
100
+ [0.3.3]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.2...v0.3.3
93
101
  [0.3.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.1...v0.3.2
94
102
  [0.3.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.0...v0.3.1
95
103
  [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.3",
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) {
@@ -80,19 +81,23 @@ export default Plugin.define({
80
81
  await context.data.session.message.sync(sessionID)
81
82
  if (disposed || !settings.enabled) return
82
83
  if (version !== resetVersion) continue
83
- const prompts = context.data.session.message.list(sessionID)
84
+ const candidates = context.data.session.message.list(sessionID)
84
85
  .filter((message) => message.type === "user")
85
86
  .slice(-200)
86
- .map((message) => ({ id: `${sessionID}:${message.id}`, text: message.text }))
87
+ .map((message) => ({ id: `${sessionID}:${message.id}`, text: message.text, created: message.time?.created }))
88
+ const promptsFor = (clearedAt: number | undefined) => candidates
89
+ .filter((prompt) => clearedAt === undefined || prompt.created === undefined || prompt.created >= clearedAt)
90
+ .map(({ id, text }) => ({ id, text }))
87
91
  const snapshot = unwrap(learning.snapshot)
88
92
  const seen = new Set(snapshot.seen)
93
+ const prompts = promptsFor(snapshot.clearedAt)
89
94
  if (!prompts.some((prompt) => !seen.has(prompt.id))) continue
90
95
  const model = new PersonalModel(snapshot)
91
96
  if (model.observe(prompts)) {
92
97
  await setLearning((draft) => {
93
98
  if (disposed || !settings.enabled || version !== resetVersion) return
94
99
  const latest = new PersonalModel(unwrap(draft.snapshot))
95
- if (latest.observe(prompts)) draft.snapshot = latest.snapshot()
100
+ if (latest.observe(promptsFor(latest.clearedAt))) draft.snapshot = latest.snapshot()
96
101
  })
97
102
  }
98
103
  } catch (error) {
@@ -113,8 +118,9 @@ export default Plugin.define({
113
118
  state.pending = false
114
119
  state.announce = false
115
120
  }
116
- predictor.setPersonal(emptySnapshot())
117
- await setLearning((draft) => { draft.snapshot = emptySnapshot() })
121
+ const cleared = { ...emptySnapshot(), clearedAt: Date.now() }
122
+ predictor.setPersonal(cleared)
123
+ await setLearning((draft) => { draft.snapshot = cleared })
118
124
  ghost?.invalidate()
119
125
  context.ui.toast.show({ title: "Quill", message: "Word autocomplete history cleared" })
120
126
  }