pi-ghost-autocomplete 0.7.0 → 0.8.1
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 +16 -2
- package/dist/bench-cli.js +1 -1
- package/dist/bench.js +1 -1
- package/dist/cold-start.d.ts +26 -0
- package/dist/command-registry.d.ts +3 -3
- package/dist/config.d.ts +21 -0
- package/dist/cycle-manager.d.ts +21 -0
- package/dist/ghost-editor.d.ts +76 -5
- package/dist/index.d.ts +17 -4
- package/dist/index.js +1 -1
- package/dist/intent.d.ts +14 -0
- package/dist/metrics.d.ts +9 -0
- package/dist/replay-cli.js +1 -1
- package/dist/session-trie.d.ts +53 -0
- package/dist/snooze.d.ts +35 -0
- package/package.json +5 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-License-Identifier: SSPL-1.0
|
|
3
|
+
* SPDX-FileCopyrightText: 2025 Alessandro Pungitore <alessandro.pungitore.ch>
|
|
4
|
+
*/
|
|
5
|
+
export declare const MIN_PREFIX_LEN = 3;
|
|
6
|
+
export declare const MIN_WEIGHT = 1.5;
|
|
7
|
+
export declare const MIN_MARGIN = 1;
|
|
8
|
+
export declare const DEFAULT_CAPACITY = 5000;
|
|
9
|
+
export declare const DEFAULT_DECAY_EVERY = 200;
|
|
10
|
+
export declare const DEFAULT_DECAY_FACTOR = 0.5;
|
|
11
|
+
export declare const MAX_COMMITTED_PREFIX_LEN = 12;
|
|
12
|
+
export declare const MAX_COMMITTED_SUFFIX_WORDS = 4;
|
|
13
|
+
export interface TrieMatch {
|
|
14
|
+
ghost: string;
|
|
15
|
+
weight: number;
|
|
16
|
+
margin: number;
|
|
17
|
+
}
|
|
18
|
+
export interface TrieStats {
|
|
19
|
+
prefixes: number;
|
|
20
|
+
candidates: number;
|
|
21
|
+
insertsSinceDecay: number;
|
|
22
|
+
}
|
|
23
|
+
export interface LookupOptions {
|
|
24
|
+
contextVolatileValues?: ReadonlySet<string>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Wrapper around the native `SessionTrie`. Owns no logic — every method is a
|
|
28
|
+
* 1:1 delegate. `lookup` adapts the `ReadonlySet` option to the native
|
|
29
|
+
* string-array shape.
|
|
30
|
+
*/
|
|
31
|
+
export declare class SessionTrie {
|
|
32
|
+
private readonly inner;
|
|
33
|
+
constructor(capacity?: number, decayEvery?: number, decayFactor?: number);
|
|
34
|
+
get size(): number;
|
|
35
|
+
get stats(): TrieStats;
|
|
36
|
+
insert(prefix: string, suffix: string, weight: number): void;
|
|
37
|
+
insertFromAccept(prefix: string, suffix: string, weight: number): void;
|
|
38
|
+
insertFromCommittedMessage(text: string, weightPerShingle?: number): void;
|
|
39
|
+
penalize(prefix: string, suffix: string, magnitude?: number): void;
|
|
40
|
+
lookup(prefix: string, opts?: LookupOptions): TrieMatch | null;
|
|
41
|
+
clear(): void;
|
|
42
|
+
decayNow(): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Pure helper used by `GhostEditor.onPromptCommitted`. Seeds `trie` from the
|
|
46
|
+
* committed text. If `accepted` is non-null AND the committed text contains
|
|
47
|
+
* the accepted ghost, the per-shingle weight drops from +1 to +0.25 to avoid
|
|
48
|
+
* double-counting (PRD §M2 "Insertion signals").
|
|
49
|
+
*/
|
|
50
|
+
export declare function seedTrieFromCommit(trie: SessionTrie, text: string, accepted: {
|
|
51
|
+
prefix: string;
|
|
52
|
+
ghost: string;
|
|
53
|
+
} | null): void;
|
package/dist/snooze.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-License-Identifier: SSPL-1.0
|
|
3
|
+
* SPDX-FileCopyrightText: 2025 Alessandro Pungitore <alessandro@pungitore.ch>
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Gap-fix P2.1 — temporary mute for ghost suggestions (Copilot-style snooze).
|
|
7
|
+
*
|
|
8
|
+
* Independent of `config.enabled`: `/ghost off` is permanent until `/ghost on`;
|
|
9
|
+
* snooze auto-clears when the timer fires. `/ghost on` also cancels an active
|
|
10
|
+
* snooze so the user has one obvious "wake up" command.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_SNOOZE_MS: number;
|
|
13
|
+
export declare const MAX_SNOOZE_MS: number;
|
|
14
|
+
/**
|
|
15
|
+
* Parse a snooze duration from `/ghost snooze` args.
|
|
16
|
+
* Accepts: "" (default 5m), "5", "5m", "30s", "1h", "10 min".
|
|
17
|
+
* Returns null on invalid input.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseSnoozeDuration(args: string): number | null;
|
|
20
|
+
export declare function formatSnoozeRemaining(ms: number): string;
|
|
21
|
+
export declare class SnoozeController {
|
|
22
|
+
private until;
|
|
23
|
+
private timer;
|
|
24
|
+
private onExpire;
|
|
25
|
+
/** Optional callback when the timer elapses (e.g. UI notify). */
|
|
26
|
+
setOnExpire(cb: (() => void) | null): void;
|
|
27
|
+
isActive(now?: number): boolean;
|
|
28
|
+
remainingMs(now?: number): number;
|
|
29
|
+
/** Arm snooze for `ms` from now. Replaces any previous snooze. */
|
|
30
|
+
snooze(ms: number, now?: number): void;
|
|
31
|
+
/** Cancel snooze without firing onExpire. */
|
|
32
|
+
cancel(): void;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private clearTimer;
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-ghost-autocomplete",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Inline ghost-text autocomplete extension for the Pi coding agent (pi.dev). Cloud and local LLM providers, zero-flicker rendering, no popup interference.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"strip-ansi": "^7.2.0"
|
|
84
84
|
},
|
|
85
85
|
"optionalDependencies": {
|
|
86
|
-
"pi-ghost-autocomplete-darwin-arm64": "0.
|
|
87
|
-
"pi-ghost-autocomplete-linux-arm64-gnu": "0.
|
|
88
|
-
"pi-ghost-autocomplete-linux-x64-gnu": "0.
|
|
89
|
-
"pi-ghost-autocomplete-win32-x64-msvc": "0.
|
|
86
|
+
"pi-ghost-autocomplete-darwin-arm64": "0.8.1",
|
|
87
|
+
"pi-ghost-autocomplete-linux-arm64-gnu": "0.8.1",
|
|
88
|
+
"pi-ghost-autocomplete-linux-x64-gnu": "0.8.1",
|
|
89
|
+
"pi-ghost-autocomplete-win32-x64-msvc": "0.8.1"
|
|
90
90
|
}
|
|
91
91
|
}
|