pi-ghost-autocomplete 0.16.1 → 0.16.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/README.md +3 -3
- package/dist/bench-cli.js +1 -1
- package/dist/bench.js +1 -1
- package/dist/ghost-editor.d.ts +7 -1
- package/dist/ghost-utils.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/profile.d.ts +6 -0
- package/dist/providers/pi-model-provider.d.ts +26 -2
- package/dist/providers/types.d.ts +11 -0
- package/dist/replay-cli.js +1 -1
- package/package.json +5 -5
package/dist/profile.d.ts
CHANGED
|
@@ -147,6 +147,12 @@ export declare function profilePathBoost(idx: ProfileIndex, path: string): numbe
|
|
|
147
147
|
* Slash-command frequency score. Used by the editor's slash fast-path:
|
|
148
148
|
* given a `/cmd-prefix`, return the best-matching full command by weight.
|
|
149
149
|
* Returns null when nothing in the index extends `prefix`.
|
|
150
|
+
*
|
|
151
|
+
* Like the command-registry matcher (`bestCommandMatch`): `prefix` must
|
|
152
|
+
* carry at least one character after the slash — a bare `/` matches
|
|
153
|
+
* everything and the built-in popup already owns that presentation; a
|
|
154
|
+
* ghost completing the top-weighted command from a lone slash (incl.
|
|
155
|
+
* after leading whitespace, pi 1.0 #10218) is too speculative.
|
|
150
156
|
*/
|
|
151
157
|
export declare function bestSlashMatch(idx: ProfileIndex, prefix: string): {
|
|
152
158
|
cmd: string;
|
|
@@ -27,10 +27,10 @@ import { type GhostProvider, type GhostRequest, type StreamDelta } from "./types
|
|
|
27
27
|
* non-streaming `predict()` path on 0.84).
|
|
28
28
|
*/
|
|
29
29
|
export declare class PiModelProvider implements GhostProvider {
|
|
30
|
-
readonly name: string;
|
|
31
30
|
private readonly registry;
|
|
32
31
|
private readonly config;
|
|
33
32
|
private readonly streamFn;
|
|
33
|
+
private readonly autoPick;
|
|
34
34
|
private resolved;
|
|
35
35
|
private resolvedSpec;
|
|
36
36
|
private lastEmpty;
|
|
@@ -42,9 +42,33 @@ export declare class PiModelProvider implements GhostProvider {
|
|
|
42
42
|
* pi 0.84–0.98 of ghosts instead of falling back to `predict()`.
|
|
43
43
|
*/
|
|
44
44
|
predictStream?: (req: GhostRequest) => AsyncIterable<StreamDelta>;
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Live so a lazy auto-pick (see {@link resolveModel}) is reflected.
|
|
47
|
+
*/
|
|
48
|
+
get name(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Settle the zero-config pick *before* the editor snapshots `name` and
|
|
51
|
+
* the provider fingerprint into the request context (see
|
|
52
|
+
* GhostProvider.ensureReady): without this, the first post-/login
|
|
53
|
+
* completion would be attributed to `ghost-pi:unset` and cached under
|
|
54
|
+
* the empty-spec key that later lookups never compute.
|
|
55
|
+
*/
|
|
56
|
+
ensureReady(): void;
|
|
57
|
+
constructor(config: PiModelProviderConfig, registry: ModelRegistry, opts?: {
|
|
58
|
+
autoPick?: boolean;
|
|
59
|
+
});
|
|
46
60
|
get debounceMs(): number;
|
|
47
61
|
consumeLastEmptyReason(): EmptyReason | null;
|
|
62
|
+
/**
|
|
63
|
+
* Zero-config path (`PI_GHOST_PROVIDER=pi`, no `PI_GHOST_MODEL`): pick a
|
|
64
|
+
* fast model from the registry's auth-available models. Cheap and
|
|
65
|
+
* side-effect-free on failure, so callers retry it on every use — the
|
|
66
|
+
* registry can gain models at any point after session start (e.g. a
|
|
67
|
+
* `/login` Radius sign-in), and the startup pick may have found nothing
|
|
68
|
+
* simply because it ran too early. Mutates the shared config so /ghost
|
|
69
|
+
* status and the editor's provider fingerprint stay honest.
|
|
70
|
+
*/
|
|
71
|
+
private tryAutoPick;
|
|
48
72
|
/**
|
|
49
73
|
* Resolve `modelSpec` (`"provider/model-id"` or bare `"model-id"`) to a
|
|
50
74
|
* registry model. Successful lookups are cached per spec; failures retry
|
|
@@ -70,6 +70,17 @@ export interface StreamDelta {
|
|
|
70
70
|
export interface GhostProvider {
|
|
71
71
|
readonly name: string;
|
|
72
72
|
readonly debounceMs: number;
|
|
73
|
+
/**
|
|
74
|
+
* Optional pre-request readiness hook. The editor calls it at the top of
|
|
75
|
+
* every prediction — before `name`/fingerprints are snapshotted into the
|
|
76
|
+
* request context — so late-binding providers (e.g. PiModelProvider's
|
|
77
|
+
* lazy auto-pick, which can resolve a model after /login mid-session)
|
|
78
|
+
* settle their identity first. Otherwise the first post-pick completion
|
|
79
|
+
* would be attributed to the pre-pick name and cached under a key no
|
|
80
|
+
* later lookup ever computes. Must be cheap and synchronous; no-op for
|
|
81
|
+
* providers without late-bound state.
|
|
82
|
+
*/
|
|
83
|
+
ensureReady?(): void;
|
|
73
84
|
/**
|
|
74
85
|
* Optional register-aware debounce (session 52). When present, the editor
|
|
75
86
|
* uses this instead of {@link debounceMs} so natural-language registers
|