@underactive/pi-topping 0.11.1 → 0.13.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.
@@ -1,49 +0,0 @@
1
- import { isPlainObject, sanitizedText } from "./util.ts";
2
-
3
- /**
4
- * Event-bus channel on which pi-topping-routesense announces the physical model it routed
5
- * a request to, before Pi sends that request (so before `message_start`). Payload:
6
- *
7
- * ```json
8
- * {
9
- * "version": 1,
10
- * "provider": "openai-codex",
11
- * "modelId": "gpt-5.6-sol",
12
- * "model": "openai-codex/gpt-5.6-sol",
13
- * "name": "GPT-5.6 Sol",
14
- * "thinkingLevel": "high",
15
- * "reason": "user",
16
- * "cause": "jev_classifier",
17
- * "tier": "COMPLEX",
18
- * "ts": 1790000000000
19
- * }
20
- * ```
21
- *
22
- * `reason` is Pi's route reason: `user`, `continuation`, `retry`, or `direct`. `direct` routes
23
- * serve compaction summaries and other extensions' side requests, not the chat response.
24
- * `tier` may be absent. Shared with pi-topping-routesense.
25
- */
26
- export const ROUTED_MODEL_CHANNEL = "pi-topping-routesense:routed-model";
27
-
28
- const ROUTE_REASONS = ["user", "continuation", "retry", "direct"] as const;
29
- export type RouteReason = (typeof ROUTE_REASONS)[number];
30
-
31
- export interface RoutedModelAnnouncement {
32
- provider: string;
33
- modelId: string;
34
- reason: RouteReason;
35
- }
36
-
37
- function isRouteReason(value: string): value is RouteReason {
38
- return ROUTE_REASONS.some((reason) => reason === value);
39
- }
40
-
41
- /** The sanitized provider, model id, and route reason of a ROUTED_MODEL_CHANNEL announcement, or undefined if malformed. */
42
- export function routedModelAnnouncement(data: unknown): RoutedModelAnnouncement | undefined {
43
- if (!isPlainObject(data) || data.version !== 1) return undefined;
44
- const provider = sanitizedText(data.provider);
45
- const modelId = sanitizedText(data.modelId);
46
- const reason = sanitizedText(data.reason);
47
- if (!provider || !modelId || !isRouteReason(reason)) return undefined;
48
- return { provider, modelId, reason };
49
- }
@@ -1,12 +0,0 @@
1
- import { isPlainObject } from "./util.ts";
2
-
3
- /**
4
- * Event-bus channel on which pi-topping-statusline announces, as `{ embedded: boolean }`,
5
- * whether its status bar hosts Pi's working loader. Shared with pi-topping-statusline.
6
- */
7
- export const STATUSLINE_EMBED_CHANNEL = "pi-topping-statusline:working-status-embedded";
8
-
9
- /** Whether an announcement on STATUSLINE_EMBED_CHANNEL says the status bar hosts the loader. */
10
- export function announcesEmbedded(data: unknown): boolean {
11
- return isPlainObject(data) && data.embedded === true;
12
- }