@pi-unipi/subagents 0.2.8 → 2.0.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.
- package/package.json +1 -1
- package/src/index.ts +5 -5
- package/src/widget.ts +4 -3
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { Type } from "@sinclair/typebox";
|
|
|
12
12
|
import { existsSync, readdirSync } from "node:fs";
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { homedir } from "node:os";
|
|
15
|
-
import { emitEvent, MODULES, UNIPI_EVENTS } from "@pi-unipi/core";
|
|
15
|
+
import { emitEvent, MODULES, UNIPI_EVENTS, type UnipiBadgeGenerateRequestEvent } from "@pi-unipi/core";
|
|
16
16
|
import { AgentManager } from "./agent-manager.js";
|
|
17
17
|
import { initConfig } from "./config.js";
|
|
18
18
|
import { type AgentActivity, type NotificationDetails, BUILTIN_TYPES } from "./types.js";
|
|
@@ -21,8 +21,7 @@ import { AgentWidget } from "./widget.js";
|
|
|
21
21
|
|
|
22
22
|
/** Get info registry from global */
|
|
23
23
|
function getInfoRegistry() {
|
|
24
|
-
|
|
25
|
-
return g.__unipi_info_registry;
|
|
24
|
+
return globalThis.__unipi_info_registry;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
// ---- Formatting helpers (shared between renderers and inline text) ----
|
|
@@ -338,7 +337,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
338
337
|
}
|
|
339
338
|
|
|
340
339
|
// Store session context for badge generation
|
|
341
|
-
let sessionCtx:
|
|
340
|
+
let sessionCtx: import("@mariozechner/pi-coding-agent").ExtensionContext | null = null;
|
|
342
341
|
|
|
343
342
|
// Session start: emit MODULE_READY + capture context
|
|
344
343
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -352,7 +351,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
352
351
|
});
|
|
353
352
|
|
|
354
353
|
// Listen for badge generation requests — spawn background agent
|
|
355
|
-
pi.events.on(UNIPI_EVENTS.BADGE_GENERATE_REQUEST, async (
|
|
354
|
+
pi.events.on(UNIPI_EVENTS.BADGE_GENERATE_REQUEST, async (data) => {
|
|
355
|
+
const event = data as UnipiBadgeGenerateRequestEvent;
|
|
356
356
|
if (!sessionCtx) return;
|
|
357
357
|
|
|
358
358
|
const summary = event?.conversationSummary ?? "";
|
package/src/widget.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { truncateToWidth } from "@mariozechner/pi-tui";
|
|
14
|
+
import type { ExtensionUIContext } from "@mariozechner/pi-coding-agent";
|
|
14
15
|
import type { AgentManager } from "./agent-manager.js";
|
|
15
16
|
import type { AgentActivity } from "./types.js";
|
|
16
17
|
|
|
@@ -94,8 +95,8 @@ function describeActivity(activeTools: Map<string, string>, responseText?: strin
|
|
|
94
95
|
export class AgentWidget {
|
|
95
96
|
private spinnerFrame = 0;
|
|
96
97
|
private timer?: ReturnType<typeof setInterval>;
|
|
97
|
-
private uiCtx?:
|
|
98
|
-
private tui?:
|
|
98
|
+
private uiCtx?: ExtensionUIContext;
|
|
99
|
+
private tui?: import("@mariozechner/pi-tui").TUI;
|
|
99
100
|
private widgetRegistered = false;
|
|
100
101
|
/** Last content key — skips requestRender when only spinner changed. */
|
|
101
102
|
private lastContentKey = "";
|
|
@@ -112,7 +113,7 @@ export class AgentWidget {
|
|
|
112
113
|
private activity: Map<string, AgentActivity>,
|
|
113
114
|
) {}
|
|
114
115
|
|
|
115
|
-
setUICtx(ctx:
|
|
116
|
+
setUICtx(ctx: ExtensionUIContext) {
|
|
116
117
|
if (ctx !== this.uiCtx) {
|
|
117
118
|
this.uiCtx = ctx;
|
|
118
119
|
this.widgetRegistered = false;
|