opencode-quill 0.7.0 → 0.8.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/CHANGELOG.md +14 -0
- package/README.md +9 -4
- package/package.json +5 -5
- package/src/predictor.ts +20 -5
- package/src/prose.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.8.0] - 2026-11-27
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **predictor:** Reduce wrong suggestions and offer longer words after a complete word (#30)
|
|
12
|
+
|
|
13
|
+
## [0.7.1] - 2026-11-23
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **deps:** Require OpenCode 2.4.0 for OpenTUI 0.9 (#29)
|
|
18
|
+
|
|
7
19
|
## [0.7.0] - 2026-11-14
|
|
8
20
|
|
|
9
21
|
### Added
|
|
@@ -163,6 +175,8 @@ All notable changes are documented in this file using
|
|
|
163
175
|
- `/quill` command and command palette action to toggle autocomplete.
|
|
164
176
|
- Local installer script, full test suite, CI workflows, and release tooling.
|
|
165
177
|
|
|
178
|
+
[0.8.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.7.1...v0.8.0
|
|
179
|
+
[0.7.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.7.0...v0.7.1
|
|
166
180
|
[0.7.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.4...v0.7.0
|
|
167
181
|
[0.6.4]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.3...v0.6.4
|
|
168
182
|
[0.6.3]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.2...v0.6.3
|
package/README.md
CHANGED
|
@@ -90,7 +90,9 @@ A correction looks like this, with only ` → complete` dimmed:
|
|
|
90
90
|
or all-uppercase casing (`Cmplete` → `Complete`, `CMPLETE` → `COMPLETE`).
|
|
91
91
|
First-person contractions use a capital `I` in corrections and next-word
|
|
92
92
|
suggestions (`I'm`, `I'll`, `I've`, `I'd`). Lowercase contraction prefixes
|
|
93
|
-
are replaced on acceptance too (`i'v` → `I've`).
|
|
93
|
+
are replaced on acceptance too (`i'v` → `I've`). Typing the apostrophe
|
|
94
|
+
continues the word (`i'` offers `I'd`), and a word ending in an apostrophe
|
|
95
|
+
is never typo-corrected (`users'` stays as typed).
|
|
94
96
|
- **Learned casing is kept.** A word you usually capitalize mid-sentence is
|
|
95
97
|
suggested that way: `oz` shows ` → Ozan` and replaces the word, while `Oz`
|
|
96
98
|
completes with `an`.
|
|
@@ -273,7 +275,7 @@ Quill learns from your own submitted prompts, never from assistant output:
|
|
|
273
275
|
syntax are never learned as adjacent.
|
|
274
276
|
- A word missing from the base vocabulary becomes suggestible only after it
|
|
275
277
|
has been seen more than once, and not while it is a prefix of a learned word
|
|
276
|
-
you use at least as often (`addr` yields to `addressed`).
|
|
278
|
+
you use at least three times as often (`addr` yields to `addressed`).
|
|
277
279
|
- Casing is learned from words written mid-sentence; sentence-initial
|
|
278
280
|
capitals are ignored.
|
|
279
281
|
|
|
@@ -286,8 +288,11 @@ Quill learns from your own submitted prompts, never from assistant output:
|
|
|
286
288
|
- **Current draft:** words already in the draft get a small boost.
|
|
287
289
|
- **Confidence gating:** a suggestion is shown only when it clears a
|
|
288
290
|
confidence threshold, which is stricter for next-word predictions than for
|
|
289
|
-
prefix completions
|
|
290
|
-
|
|
291
|
+
prefix completions and, in prose, for single-letter prefixes. If a typed
|
|
292
|
+
prose prefix of two or more letters is already a confident word, a longer
|
|
293
|
+
word is also offered when it scores at least 40% as high in the current
|
|
294
|
+
context (typing `local` offers `locally`). Shell mode shows nothing when
|
|
295
|
+
the typed command is already the most likely word.
|
|
291
296
|
- **Typo fallback:** when prefix completion is not confident enough, nearby
|
|
292
297
|
words are ranked with an edit penalty and a stricter confidence threshold.
|
|
293
298
|
Correction confidence is the edit-penalized model score. Suggestions must
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-quill",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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",
|
|
@@ -51,18 +51,18 @@
|
|
|
51
51
|
"prepublishOnly": "bun run test && bun run typecheck"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@opentui/core": "^0.
|
|
55
|
-
"@opentui/solid": "^0.
|
|
54
|
+
"@opentui/core": "^0.9.7",
|
|
55
|
+
"@opentui/solid": "^0.9.7",
|
|
56
56
|
"subtlex-word-frequencies": "2.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@opencode/plugin": "
|
|
59
|
+
"@opencode/plugin": ">=2.4.0",
|
|
60
60
|
"solid-js": "*"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^21.2.2",
|
|
64
64
|
"@commitlint/config-conventional": "^21.2.2",
|
|
65
|
-
"@opencode/plugin": "2.2
|
|
65
|
+
"@opencode/plugin": "2.3.2",
|
|
66
66
|
"@types/bun": "^1.4.2",
|
|
67
67
|
"@types/node": "26.6.6",
|
|
68
68
|
"husky": "^9.1.7",
|
package/src/predictor.ts
CHANGED
|
@@ -14,6 +14,10 @@ export type Prompt = { id: string; text: string }
|
|
|
14
14
|
export type Prediction = { suffix: string; word: string; confidence: number; replace?: number }
|
|
15
15
|
|
|
16
16
|
const DISCOUNT = 0.5
|
|
17
|
+
const CONFIDENCE = 0.3
|
|
18
|
+
const SHORT_CONFIDENCE = 0.4
|
|
19
|
+
const EXACT_RATIO = 0.4
|
|
20
|
+
const FRAGMENT_RATIO = 3
|
|
17
21
|
const MIN_TYPO_SCORE = 0.000001
|
|
18
22
|
const PRIOR_LIMIT = 20_000
|
|
19
23
|
const WORD_LIMIT = 8000
|
|
@@ -240,7 +244,7 @@ export class WordPredictor {
|
|
|
240
244
|
const word = learned[index]
|
|
241
245
|
if (this.prior.has(word)) continue
|
|
242
246
|
for (let next = index + 1; next < learned.length && learned[next].startsWith(word); next++) {
|
|
243
|
-
if (!"/-.".includes(learned[next][word.length]) && counts.get(learned[next])! >= counts.get(word)!) {
|
|
247
|
+
if (!"/-.".includes(learned[next][word.length]) && counts.get(learned[next])! >= (this.grammar.prose ? FRAGMENT_RATIO : 1) * counts.get(word)!) {
|
|
244
248
|
fragments.add(word)
|
|
245
249
|
break
|
|
246
250
|
}
|
|
@@ -368,12 +372,23 @@ export class WordPredictor {
|
|
|
368
372
|
if (this.minSuggestedWordLength && word !== prefix && [...word].length < this.minSuggestedWordLength) continue
|
|
369
373
|
ranked.push({ word, score, weight })
|
|
370
374
|
ranked.sort((a, b) => b.score - a.score)
|
|
371
|
-
if (ranked.length > maximum) ranked.pop()
|
|
375
|
+
if (ranked.length > maximum + (this.grammar.prose && candidates.has(prefix) && !query.next ? 1 : 0)) ranked.pop()
|
|
372
376
|
}
|
|
373
377
|
const predictions: Prediction[] = []
|
|
378
|
+
const exact = query.next ? 0 : ranked.find(({ word }) => word === prefix)?.score ?? 0
|
|
379
|
+
const short = [...prefix].length < 2
|
|
380
|
+
const threshold = this.grammar.prose && short ? SHORT_CONFIDENCE : CONFIDENCE
|
|
381
|
+
const exactConfident = this.grammar.prose && !short && exact >= threshold * (sum || 1)
|
|
374
382
|
for (const { word: best, score: bestScore, weight: bestWeight } of ranked) {
|
|
383
|
+
if (best === prefix && !query.next) {
|
|
384
|
+
if (!this.grammar.prose && !predictions.length) return []
|
|
385
|
+
continue
|
|
386
|
+
}
|
|
375
387
|
const confidence = bestWeight < 1 ? typoConfidence(bestScore, sum) : query.next ? bestScore : bestScore / (sum || 1)
|
|
376
|
-
|
|
388
|
+
const gate = query.next
|
|
389
|
+
? bestScore >= CONFIDENCE
|
|
390
|
+
: confidence! >= threshold || (exactConfident && bestScore >= EXACT_RATIO * exact)
|
|
391
|
+
if (!bestScore || confidence === undefined || (bestWeight === 1 && !gate)) {
|
|
377
392
|
if (!predictions.length) return []
|
|
378
393
|
continue
|
|
379
394
|
}
|
|
@@ -389,10 +404,10 @@ export class WordPredictor {
|
|
|
389
404
|
predictions.push({ suffix: shouting ? suffix.toUpperCase() : suffix, word: best, confidence })
|
|
390
405
|
}
|
|
391
406
|
}
|
|
392
|
-
return predictions
|
|
407
|
+
return predictions.slice(0, maximum)
|
|
393
408
|
}
|
|
394
409
|
const completion = suggest()
|
|
395
|
-
if (completion.length || query.next || prefix.length < 3 || slash || candidates.has(prefix) || !this.grammar.prose) return completion
|
|
410
|
+
if (completion.length || query.next || prefix.length < 3 || slash || prefix.endsWith("'") || candidates.has(prefix) || !this.grammar.prose) return completion
|
|
396
411
|
for (const word of this.nearbyWords(prefix)) {
|
|
397
412
|
if (candidates.has(word)) continue
|
|
398
413
|
const weight = typoWeight(prefix, word)
|
package/src/prose.ts
CHANGED
|
@@ -2,7 +2,7 @@ const PART = "[\\p{L}\\p{M}]+(?:['’][\\p{L}\\p{M}]+)*"
|
|
|
2
2
|
const HYPHENATED = `${PART}(?:-${PART})*`
|
|
3
3
|
const EXTENSION = "(?:sh|md|json|jsonc|ts|tsx|js|jsx|mjs|cjs|yml|yaml|toml|lock|html|css|py|txt|rs|go|sql)"
|
|
4
4
|
const FILE = `${HYPHENATED}\\.${EXTENSION}`
|
|
5
|
-
const PREFIX = `(?:${FILE}|${HYPHENATED}
|
|
5
|
+
const PREFIX = `(?:${FILE}|${HYPHENATED}(?:['’]|-?(?:\\/(?:${HYPHENATED}-?)?)?))`
|
|
6
6
|
const WORD = new RegExp(`(?:${FILE}(?![\\p{L}\\p{M}\\p{N}])|${HYPHENATED}(?:\\/${HYPHENATED})?)`, "gu")
|
|
7
7
|
const WHOLE_WORD = new RegExp(`^(?:${FILE}|${HYPHENATED}(?:\\/${HYPHENATED})?)$`, "u")
|
|
8
8
|
const WORD_PREFIX = new RegExp(`^${PREFIX}$`, "u")
|