pi-ghost-autocomplete 0.9.1 → 0.10.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.
@@ -25,6 +25,10 @@ export declare class OpenAICompatProvider implements GhostProvider {
25
25
  readonly name: string;
26
26
  /** Why the most recent `fireOne` resolved empty; consumed by the editor. */
27
27
  private lastEmptyReason;
28
+ /** Snapshot of `PI_GHOST_FIM_CONTEXT_ALL_INTENTS`, read once at construction
29
+ * instead of per `predict` (#3 — `buildFIMPrompt` previously read
30
+ * `process.env` on every prediction). */
31
+ private readonly fimContextAllIntentsRaw;
28
32
  constructor(config: OpenAICompatProviderConfig);
29
33
  get debounceMs(): number;
30
34
  /**
@@ -66,7 +70,7 @@ export declare function fimContextIncluded(intent: PromptIntent | undefined, all
66
70
  * `question` intents, where the context is dropped to avoid the empty-rate
67
71
  * spike described on {@link FIM_CONTEXT_SUPPRESSED_INTENTS}.
68
72
  */
69
- export declare function buildFIMPrompt(req: GhostRequest, maxRecent: number): {
73
+ export declare function buildFIMPrompt(req: GhostRequest, maxRecent: number, fimContextAllIntentsRaw?: string): {
70
74
  prompt: string;
71
75
  suffix: string;
72
76
  };
@@ -41,6 +41,17 @@ export declare class RaceProvider implements GhostProvider {
41
41
  wins: number;
42
42
  skipRemaining: number;
43
43
  }>;
44
+ /**
45
+ * Skip-penalty filter (PRD §M8). Drop members still under a skip penalty,
46
+ * decrementing their counter and recording them in `skipped` so metrics can
47
+ * attribute the skip. If ALL members are skipped, fall back to running them
48
+ * anyway so the weighting policy can't permanently starve the user.
49
+ *
50
+ * In the all-skipped fallback the returned array is `this.members`, but
51
+ * `skipRemaining` has already been decremented for everyone — they execute
52
+ * regardless, which prevents starvation when every member is flagged slow.
53
+ */
54
+ private filterSkippedMembers;
44
55
  get debounceMs(): number;
45
56
  consumeLastTrace(): RaceTrace | null;
46
57
  /**
@@ -42,6 +42,11 @@ export declare class RouterProvider implements GhostProvider {
42
42
  /** Leg that served the most recent request — the one to query for the
43
43
  * empty-cause diagnostic so it reflects the register that actually ran. */
44
44
  private lastLeg;
45
+ /** Register-debounce multipliers snapshotted once at construction instead
46
+ * of re-read per `debounceMsFor` (#3 — `debounceProseMult`/
47
+ * `debounceAgentMult` previously read `process.env` on every dispatch). */
48
+ private readonly proseMult;
49
+ private readonly agentMult;
45
50
  constructor(fim: GhostProvider, chat: GhostProvider | null);
46
51
  get debounceMs(): number;
47
52
  /**
@@ -26,3 +26,34 @@ export declare function recentBoost(matchPath: string, recent: Set<string> | nul
26
26
  * assistant messages. Oldest-first.
27
27
  */
28
28
  export declare function getRoleWeightedRecent(ctx: ExtensionContext, userMax: number, assistantMax: number): RecentMessage[];
29
+ /** How long a tool-touched path keeps its ranking boost. */
30
+ export declare const TOOL_PATH_TTL_MS: number;
31
+ /** Bound on live tool paths kept for boosting. */
32
+ export declare const MAX_TOOL_PATHS = 32;
33
+ /**
34
+ * Normalize a `read`/`edit`/`write` tool-input path so it string-matches
35
+ * PathIndex entries (git ls-files output: POSIX separators, root-relative).
36
+ *
37
+ * - Backslashes → forward slashes (Windows tool inputs).
38
+ * - Absolute paths inside `root` → root-relative.
39
+ * - Leading `./` stripped.
40
+ *
41
+ * Paths outside `root` (or when `root` is null) pass through normalized —
42
+ * they simply won't exact-hit an index entry and only degrade the boost.
43
+ */
44
+ export declare function normalizeToolPath(raw: string, root: string | null): string;
45
+ /**
46
+ * Merge regex-scraped mention paths with live tool-recorded paths.
47
+ * Tool entries survive the scrape TTL (5 s) — they are exact inputs, not
48
+ * text guesses — and are pruned only by their own {@link TOOL_PATH_TTL_MS}.
49
+ */
50
+ export declare function mergeRecentPathSets(scraped: Set<string>, toolPaths: Map<string, number>, now: number, ttlMs?: number): Set<string>;
51
+ /**
52
+ * Re-key recorded tool paths against a (possibly late-arriving) index
53
+ * root. The PathIndex is built asynchronously after the editor installs;
54
+ * tool results that land before it settles were normalized with
55
+ * `root === null` and may be absolute. Renormalizing against the real
56
+ * root makes them string-match the git ls-files keys. Collisions keep
57
+ * the newest timestamp.
58
+ */
59
+ export declare function renormalizeToolPaths(toolPaths: Map<string, number>, root: string): Map<string, number>;