opencode-quill 0.5.1 → 0.5.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 +7 -0
- package/package.json +1 -1
- package/src/predictor.ts +12 -7
- package/src/prose.ts +1 -1
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.5.2] - 2026-10-22
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **prediction:** Restore personal completion weight, next-word predictions, and slash-command prose
|
|
12
|
+
|
|
7
13
|
## [0.5.1] - 2026-10-22
|
|
8
14
|
|
|
9
15
|
### Fixed
|
|
@@ -121,6 +127,7 @@ All notable changes are documented in this file using
|
|
|
121
127
|
- `/quill` command and command palette action to toggle autocomplete.
|
|
122
128
|
- Local installer script, full test suite, CI workflows, and release tooling.
|
|
123
129
|
|
|
130
|
+
[0.5.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.5.1...v0.5.2
|
|
124
131
|
[0.5.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.5.0...v0.5.1
|
|
125
132
|
[0.5.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.4.0...v0.5.0
|
|
126
133
|
[0.4.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.3.4...v0.4.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-quill",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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/predictor.ts
CHANGED
|
@@ -262,10 +262,11 @@ export class WordPredictor {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
private score(word: string, context: readonly string[]): number {
|
|
265
|
+
private score(word: string, context: readonly string[], typo = false): number {
|
|
266
266
|
const prior = (this.prior.get(word) ?? 0) / (this.priorTotal || 1)
|
|
267
267
|
const personal = (this.personal.words.get(word) ?? 0) / (this.personalTotal || 1)
|
|
268
|
-
const
|
|
268
|
+
const ratio = this.personalTotal / (this.personalTotal + 100)
|
|
269
|
+
const weight = this.priorTotal ? (typo ? Math.min(0.7, ratio) : ratio) : 1
|
|
269
270
|
let score = weight * personal + (1 - weight) * prior
|
|
270
271
|
const previous = context.at(-1)
|
|
271
272
|
const bigram = previous && this.bigramTotals.get(previous)
|
|
@@ -275,7 +276,7 @@ export class WordPredictor {
|
|
|
275
276
|
}
|
|
276
277
|
const pair = context.length === 2 ? context.join("\0") : undefined
|
|
277
278
|
const trigram = pair && this.trigramTotals.get(pair)
|
|
278
|
-
if (trigram) {
|
|
279
|
+
if (trigram && trigram.total >= 2) {
|
|
279
280
|
const count = this.personal.trigrams.get(`${pair}\0${word}`) ?? 0
|
|
280
281
|
score = Math.max(count - DISCOUNT, 0) / trigram.total + DISCOUNT * trigram.types / trigram.total * score
|
|
281
282
|
}
|
|
@@ -296,7 +297,7 @@ export class WordPredictor {
|
|
|
296
297
|
if ((this.bigramTotals.get(candidate)?.total ?? 0) < 2) continue
|
|
297
298
|
const weight = typoWeight(word, candidate, true)
|
|
298
299
|
if (!weight) continue
|
|
299
|
-
const score = this.score(candidate, resolved) * weight
|
|
300
|
+
const score = this.score(candidate, resolved, true) * weight
|
|
300
301
|
sum += score
|
|
301
302
|
if (score > bestScore) {
|
|
302
303
|
best = candidate
|
|
@@ -320,7 +321,9 @@ export class WordPredictor {
|
|
|
320
321
|
const local = new Map<string, number>()
|
|
321
322
|
for (const word of words) increment(local, word.text)
|
|
322
323
|
const context = this.resolveContext(leftContext(query.before, words), local)
|
|
323
|
-
const
|
|
324
|
+
const previous = context.at(-1)
|
|
325
|
+
const pair = context.length === 2 ? context.join("\0") : undefined
|
|
326
|
+
const evidence = this.bigramTotals.get(previous ?? "")?.total ?? 0
|
|
324
327
|
if (query.next && evidence < 2) return []
|
|
325
328
|
if (!query.next && [...prefix].length < 2 && evidence < 2) return []
|
|
326
329
|
const slash = prefix.includes("/")
|
|
@@ -331,11 +334,13 @@ export class WordPredictor {
|
|
|
331
334
|
if (query.next || slash === word.includes("/")) candidates.set(word, 1)
|
|
332
335
|
}
|
|
333
336
|
for (const word of local.keys()) if (!word.includes("/") && word.startsWith(prefix) && (query.next || !slash)) candidates.set(word, 1)
|
|
337
|
+
const followed = (word: string) => (previous ? this.personal.bigrams.get(`${previous}\0${word}`) ?? 0 : 0) >= 2 ||
|
|
338
|
+
(pair ? this.personal.trigrams.get(`${pair}\0${word}`) ?? 0 : 0) >= 2
|
|
334
339
|
const suggest = (): Prediction[] => {
|
|
335
340
|
const ranked: { word: string; score: number; weight: number }[] = []
|
|
336
341
|
let sum = 0
|
|
337
342
|
for (const [word, weight] of candidates) {
|
|
338
|
-
const base = this.score(word, context) + (query.next ? 0 : 0.003 * Math.min(local.get(word) ?? 0, 3))
|
|
343
|
+
const base = this.score(word, context, weight < 1) + (query.next ? 0 : 0.003 * Math.min(local.get(word) ?? 0, 3))
|
|
339
344
|
const score = base * weight
|
|
340
345
|
sum += score
|
|
341
346
|
ranked.push({ word, score, weight })
|
|
@@ -345,7 +350,7 @@ export class WordPredictor {
|
|
|
345
350
|
const predictions: Prediction[] = []
|
|
346
351
|
for (const { word: best, score: bestScore, weight: bestWeight } of ranked) {
|
|
347
352
|
const confidence = bestWeight < 1 ? typoConfidence(bestScore, sum) : query.next ? bestScore : bestScore / (sum || 1)
|
|
348
|
-
if (!bestScore || best === prefix || confidence === undefined || (bestWeight === 1 && confidence <
|
|
353
|
+
if (!bestScore || best === prefix || confidence === undefined || (query.next && !followed(best)) || (bestWeight === 1 && confidence < 0.3)) {
|
|
349
354
|
if (!predictions.length) return []
|
|
350
355
|
continue
|
|
351
356
|
}
|
package/src/prose.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function maskProse(text: string): string {
|
|
|
40
40
|
})
|
|
41
41
|
masked = masked.replace(/(`+)[\s\S]*?(?:\1|$)/g, blank)
|
|
42
42
|
masked = masked.replace(/(?:https?:\/\/|www\.)\S+|\[[^\]\n]*\]\([^\)\n]*\)|<[^>\n]+>/g, blank)
|
|
43
|
-
masked = masked.replace(/^[ \t]*(?:[
|
|
43
|
+
masked = masked.replace(/^[ \t]*(?:[!$]|(?:const|let|var|function|class|import|export)\s|(?:Traceback|Error:)\b).*$/gm, blank)
|
|
44
44
|
masked = masked.replace(/^(?: {4}| {0,3}\t).*$/gm, blank)
|
|
45
45
|
masked = masked.replace(/\S+/g, (token) => {
|
|
46
46
|
const core = token.replace(/^["“‘([{]+|["”’),;:!?}\]]+$/g, "")
|