chore: drop non-code junk (pi-mono-reference, runtime state, root duplicates)
Remove files that should never have been tracked: - pi-mono-reference/: 688-file copy of an upstream monorepo, zero imports, used only as offline human reference - build/electron-builder.runtime.json: environment-specific build artifact with hardcoded local paths - state/cancel-signal-state.json: runtime state written by the app - prompt.txt, logo.svg (root): exact duplicates of the canonical copies under .planning/archive/ and assets/ Add state/ to .gitignore so future runtime state stays out.
This commit is contained in:
1 parent
34ca5b77f1
commit
1f7230fe87
691 files changed
+3
-190434
No files matched your search
@@ -1,99 +0,0 @@
|
||||
import { Alert } from "@mariozechner/mini-lit/dist/Alert.js";
|
||||
import type { Message } from "@mariozechner/pi-ai";
|
||||
import type { AgentMessage, MessageRenderer } from "@mariozechner/pi-web-ui";
|
||||
import { defaultConvertToLlm, registerMessageRenderer } from "@mariozechner/pi-web-ui";
|
||||
import { html } from "lit";
|
||||
|
||||
// ============================================================================
|
||||
// 1. EXTEND AppMessage TYPE VIA DECLARATION MERGING
|
||||
// ============================================================================
|
||||
|
||||
// Define custom message types
|
||||
export interface SystemNotificationMessage {
|
||||
role: "system-notification";
|
||||
message: string;
|
||||
variant: "default" | "destructive";
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
// Extend CustomAgentMessages interface via declaration merging
|
||||
// This must target pi-agent-core where CustomAgentMessages is defined
|
||||
declare module "@mariozechner/pi-agent-core" {
|
||||
interface CustomAgentMessages {
|
||||
"system-notification": SystemNotificationMessage;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 2. CREATE CUSTOM RENDERER (TYPED TO SystemNotificationMessage)
|
||||
// ============================================================================
|
||||
|
||||
const systemNotificationRenderer: MessageRenderer<SystemNotificationMessage> = {
|
||||
render: (notification) => {
|
||||
// notification is fully typed as SystemNotificationMessage!
|
||||
return html`
|
||||
<div class="px-4">
|
||||
${Alert({
|
||||
variant: notification.variant,
|
||||
children: html`
|
||||
<div class="flex flex-col gap-1">
|
||||
<div>${notification.message}</div>
|
||||
<div class="text-xs opacity-70">${new Date(notification.timestamp).toLocaleTimeString()}</div>
|
||||
</div>
|
||||
`,
|
||||
})}
|
||||
</div>
|
||||
`;
|
||||
},
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// 3. REGISTER RENDERER
|
||||
// ============================================================================
|
||||
|
||||
export function registerCustomMessageRenderers() {
|
||||
registerMessageRenderer("system-notification", systemNotificationRenderer);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 4. HELPER TO CREATE CUSTOM MESSAGES
|
||||
// ============================================================================
|
||||
|
||||
export function createSystemNotification(
|
||||
message: string,
|
||||
variant: "default" | "destructive" = "default",
|
||||
): SystemNotificationMessage {
|
||||
return {
|
||||
role: "system-notification",
|
||||
message,
|
||||
variant,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 5. CUSTOM MESSAGE TRANSFORMER
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Custom message transformer that extends defaultConvertToLlm.
|
||||
* Handles system-notification messages by converting them to user messages.
|
||||
*/
|
||||
export function customConvertToLlm(messages: AgentMessage[]): Message[] {
|
||||
// First, handle our custom system-notification type
|
||||
const processed = messages.map((m): AgentMessage => {
|
||||
if (m.role === "system-notification") {
|
||||
const notification = m as SystemNotificationMessage;
|
||||
// Convert to user message with <system> tags
|
||||
return {
|
||||
role: "user",
|
||||
content: `<system>${notification.message}</system>`,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
}
|
||||
return m;
|
||||
});
|
||||
|
||||
// Then use defaultConvertToLlm for standard handling
|
||||
return defaultConvertToLlm(processed);
|
||||
}
|
||||
Reference in new issue
Block a user