dsh-composer-quill 0.31.7 → 0.31.8
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/client.js +24 -2
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -26,7 +26,7 @@ window.__ModuleLoader__.load({
|
|
|
26
26
|
const h = React.createElement
|
|
27
27
|
|
|
28
28
|
const NS = 'composer-quill'
|
|
29
|
-
const BUILD = '0.31.
|
|
29
|
+
const BUILD = '0.31.8'
|
|
30
30
|
const ROUTE = '/composer-quill/predict'
|
|
31
31
|
const BEACON = '/composer-quill/beacon'
|
|
32
32
|
/** The browser's own language, used when the Host has no style profile. */
|
|
@@ -781,6 +781,20 @@ const COVERED_DEBOUNCE_MS = 1200
|
|
|
781
781
|
return left !== '' && right !== '' && left === right
|
|
782
782
|
}
|
|
783
783
|
|
|
784
|
+
/**
|
|
785
|
+
* Does a request already in flight still cover this draft?
|
|
786
|
+
*
|
|
787
|
+
* The tail it is producing is appended to `requested`, so a draft that only
|
|
788
|
+
* grew keeps that tail valid — cancelling it and starting over is what made
|
|
789
|
+
* the ghost flicker on every keystroke. A draft that shrank or diverged is
|
|
790
|
+
* not covered: that request can no longer be pasted anywhere.
|
|
791
|
+
*/
|
|
792
|
+
function inFlightCovers(requested, draft) {
|
|
793
|
+
if (typeof requested !== 'string' || requested === '') return false
|
|
794
|
+
if (typeof draft !== 'string') return false
|
|
795
|
+
return draft.length >= requested.length && draft.startsWith(requested)
|
|
796
|
+
}
|
|
797
|
+
|
|
784
798
|
/**
|
|
785
799
|
* The Host joins on a trimmed base. A reply that echoes the untrimmed draft
|
|
786
800
|
* must not put a stray newline into the proposal.
|
|
@@ -1388,6 +1402,13 @@ const COVERED_DEBOUNCE_MS = 1200
|
|
|
1388
1402
|
if (mode === 'compose') {
|
|
1389
1403
|
if (live.running || draftNow.trim().length < MIN_DRAFT_CHARS) return
|
|
1390
1404
|
if (dismissedDraft.current === draftNow) return
|
|
1405
|
+
// The draft only grew since the in-flight request started: its tail
|
|
1406
|
+
// still applies, so keep streaming it instead of cancelling.
|
|
1407
|
+
const inFlight = ghost.getSnapshot()
|
|
1408
|
+
if (inFlight.phase === 'loading' && inFlightCovers(inFlight.requested, draftNow)) {
|
|
1409
|
+
report('reuse', { sessionId: live.sessionId, draftLength: draftNow.length, detail: 'in-flight' })
|
|
1410
|
+
return
|
|
1411
|
+
}
|
|
1391
1412
|
}
|
|
1392
1413
|
const kind = mode === 'next' ? 'next' : 'compose'
|
|
1393
1414
|
|
|
@@ -2252,7 +2273,7 @@ const COVERED_DEBOUNCE_MS = 1200
|
|
|
2252
2273
|
}
|
|
2253
2274
|
|
|
2254
2275
|
report('module', { detail: String((window.location && window.location.pathname) || '') })
|
|
2255
|
-
return { inject, apply, __test: { followRemainder, bestHistoryMatch, normalizeConfig, saveSuggestion, loadSuggestion, readSuggestions, clearSessionSuggestions, streamRoute, featuresOf, rankByLearning, recordOutcome, learningSummary, proposalIsStale, transcriptVersion, epochOf, bumpEpoch, syncEpoch } }
|
|
2276
|
+
return { inject, apply, __test: { followRemainder, bestHistoryMatch, normalizeConfig, saveSuggestion, loadSuggestion, readSuggestions, clearSessionSuggestions, streamRoute, featuresOf, rankByLearning, recordOutcome, learningSummary, proposalIsStale, inFlightCovers, transcriptVersion, epochOf, bumpEpoch, syncEpoch } }
|
|
2256
2277
|
},
|
|
2257
2278
|
})
|
|
2258
2279
|
|
|
@@ -2322,5 +2343,6 @@ const COVERED_DEBOUNCE_MS = 1200
|
|
|
2322
2343
|
|
|
2323
2344
|
|
|
2324
2345
|
|
|
2346
|
+
|
|
2325
2347
|
|
|
2326
2348
|
|
package/package.json
CHANGED