chore(ts): use source import extensions
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { Badge } from "@mariozechner/mini-lit/dist/Badge.js";
|
||||
import { html, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import "./components/AgentInterface.js";
|
||||
import "./components/AgentInterface.ts";
|
||||
import type { Agent, AgentTool } from "@earendil-works/pi-agent-core";
|
||||
import type { AgentInterface } from "./components/AgentInterface.js";
|
||||
import { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js";
|
||||
import { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js";
|
||||
import type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.js";
|
||||
import { ArtifactsPanel, ArtifactsToolRenderer } from "./tools/artifacts/index.js";
|
||||
import { registerToolRenderer } from "./tools/renderer-registry.js";
|
||||
import type { Attachment } from "./utils/attachment-utils.js";
|
||||
import { i18n } from "./utils/i18n.js";
|
||||
import type { AgentInterface } from "./components/AgentInterface.ts";
|
||||
import { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.ts";
|
||||
import { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.ts";
|
||||
import type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.ts";
|
||||
import { ArtifactsPanel, ArtifactsToolRenderer } from "./tools/artifacts/index.ts";
|
||||
import { registerToolRenderer } from "./tools/renderer-registry.ts";
|
||||
import type { Attachment } from "./utils/attachment-utils.ts";
|
||||
import { i18n } from "./utils/i18n.ts";
|
||||
|
||||
const BREAKPOINT = 800; // px - switch between overlay and side-by-side
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { streamSimple, type ToolResultMessage, type Usage } from "@earendil-works/pi-ai";
|
||||
import { html, LitElement } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators.js";
|
||||
import { ModelSelector } from "../dialogs/ModelSelector.js";
|
||||
import type { MessageEditor } from "./MessageEditor.js";
|
||||
import "./MessageEditor.js";
|
||||
import "./MessageList.js";
|
||||
import "./Messages.js"; // Import for side effects to register the custom elements
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import "./StreamingMessageContainer.js";
|
||||
import { ModelSelector } from "../dialogs/ModelSelector.ts";
|
||||
import type { MessageEditor } from "./MessageEditor.ts";
|
||||
import "./MessageEditor.ts";
|
||||
import "./MessageList.ts";
|
||||
import "./Messages.ts"; // Import for side effects to register the custom elements
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import "./StreamingMessageContainer.ts";
|
||||
import type { Agent, AgentEvent } from "@earendil-works/pi-agent-core";
|
||||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { formatUsage } from "../utils/format.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { createStreamFn } from "../utils/proxy-utils.js";
|
||||
import type { UserMessageWithAttachments } from "./Messages.js";
|
||||
import type { StreamingMessageContainer } from "./StreamingMessageContainer.js";
|
||||
import type { Attachment } from "../utils/attachment-utils.ts";
|
||||
import { formatUsage } from "../utils/format.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
import { createStreamFn } from "../utils/proxy-utils.ts";
|
||||
import type { UserMessageWithAttachments } from "./Messages.ts";
|
||||
import type { StreamingMessageContainer } from "./StreamingMessageContainer.ts";
|
||||
|
||||
@customElement("agent-interface")
|
||||
export class AgentInterface extends LitElement {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { html } from "lit/html.js";
|
||||
import { FileSpreadsheet, FileText, X } from "lucide";
|
||||
import { AttachmentOverlay } from "../dialogs/AttachmentOverlay.js";
|
||||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { AttachmentOverlay } from "../dialogs/AttachmentOverlay.ts";
|
||||
import type { Attachment } from "../utils/attachment-utils.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
@customElement("attachment-tile")
|
||||
export class AttachmentTile extends LitElement {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { LitElement } from "lit";
|
||||
import { property, state } from "lit/decorators.js";
|
||||
import { html } from "lit/html.js";
|
||||
import { Check, Copy } from "lucide";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
export class ConsoleBlock extends LitElement {
|
||||
@property() content: string = "";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { i18n } from "@mariozechner/mini-lit";
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { html, LitElement, type TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import type { CustomProvider } from "../storage/stores/custom-providers-store.js";
|
||||
import type { CustomProvider } from "../storage/stores/custom-providers-store.ts";
|
||||
|
||||
@customElement("custom-provider-card")
|
||||
export class CustomProviderCard extends LitElement {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type BaseComponentProps, fc } from "@mariozechner/mini-lit/dist/mini.js";
|
||||
import { html } from "lit";
|
||||
import { type Ref, ref } from "lit/directives/ref.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
export type InputType = "text" | "email" | "password" | "number" | "url" | "tel" | "search";
|
||||
export type InputSize = "sm" | "md" | "lg";
|
||||
|
||||
@@ -6,9 +6,9 @@ import { html, LitElement } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { createRef, ref } from "lit/directives/ref.js";
|
||||
import { Brain, Loader2, Paperclip, Send, Sparkles, Square } from "lucide";
|
||||
import { type Attachment, loadAttachment } from "../utils/attachment-utils.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import "./AttachmentTile.js";
|
||||
import { type Attachment, loadAttachment } from "../utils/attachment-utils.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
import "./AttachmentTile.ts";
|
||||
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
||||
|
||||
@customElement("message-editor")
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
import { html, LitElement, type TemplateResult } from "lit";
|
||||
import { property } from "lit/decorators.js";
|
||||
import { repeat } from "lit/directives/repeat.js";
|
||||
import { renderMessage } from "./message-renderer-registry.js";
|
||||
import { renderMessage } from "./message-renderer-registry.ts";
|
||||
|
||||
export class MessageList extends LitElement {
|
||||
@property({ type: Array }) messages: AgentMessage[] = [];
|
||||
|
||||
@@ -8,11 +8,11 @@ import type {
|
||||
} from "@earendil-works/pi-ai";
|
||||
import { html, LitElement, type TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { renderTool } from "../tools/index.js";
|
||||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { formatUsage } from "../utils/format.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import "./ThinkingBlock.js";
|
||||
import { renderTool } from "../tools/index.ts";
|
||||
import type { Attachment } from "../utils/attachment-utils.ts";
|
||||
import { formatUsage } from "../utils/format.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
import "./ThinkingBlock.ts";
|
||||
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
||||
|
||||
export type UserMessageWithAttachments = {
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Badge } from "@mariozechner/mini-lit/dist/Badge.js";
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { html, LitElement } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import { applyProxyIfNeeded } from "../utils/proxy-utils.js";
|
||||
import { Input } from "./Input.js";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import { applyProxyIfNeeded } from "../utils/proxy-utils.ts";
|
||||
import { Input } from "./Input.ts";
|
||||
|
||||
// Test models for each provider
|
||||
const TEST_MODELS: Record<string, string> = {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { ConsoleRuntimeProvider } from "./sandbox/ConsoleRuntimeProvider.js";
|
||||
import { RuntimeMessageBridge } from "./sandbox/RuntimeMessageBridge.js";
|
||||
import { type MessageConsumer, RUNTIME_MESSAGE_ROUTER } from "./sandbox/RuntimeMessageRouter.js";
|
||||
import type { SandboxRuntimeProvider } from "./sandbox/SandboxRuntimeProvider.js";
|
||||
import { ConsoleRuntimeProvider } from "./sandbox/ConsoleRuntimeProvider.ts";
|
||||
import { RuntimeMessageBridge } from "./sandbox/RuntimeMessageBridge.ts";
|
||||
import { type MessageConsumer, RUNTIME_MESSAGE_ROUTER } from "./sandbox/RuntimeMessageRouter.ts";
|
||||
import type { SandboxRuntimeProvider } from "./sandbox/SandboxRuntimeProvider.ts";
|
||||
|
||||
export interface SandboxFile {
|
||||
fileName: string;
|
||||
|
||||
@@ -2,8 +2,8 @@ import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
||||
import {
|
||||
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO,
|
||||
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW,
|
||||
} from "../../prompts/prompts.js";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js";
|
||||
} from "../../prompts/prompts.ts";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.ts";
|
||||
|
||||
// Define minimal interface for ArtifactsPanel to avoid circular dependencies
|
||||
interface ArtifactsPanelLike {
|
||||
@@ -25,11 +25,15 @@ interface AgentLike {
|
||||
* Supports both online (extension) and offline (downloaded HTML) modes.
|
||||
*/
|
||||
export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
||||
constructor(
|
||||
private artifactsPanel: ArtifactsPanelLike,
|
||||
private agent?: AgentLike,
|
||||
private readWrite: boolean = true,
|
||||
) {}
|
||||
private artifactsPanel: ArtifactsPanelLike;
|
||||
private agent?: AgentLike;
|
||||
private readWrite: boolean;
|
||||
|
||||
constructor(artifactsPanel: ArtifactsPanelLike, agent?: AgentLike, readWrite: boolean = true) {
|
||||
this.artifactsPanel = artifactsPanel;
|
||||
this.agent = agent;
|
||||
this.readWrite = readWrite;
|
||||
}
|
||||
|
||||
getData(): Record<string, any> {
|
||||
// Inject artifact snapshot for offline mode
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ATTACHMENTS_RUNTIME_DESCRIPTION } from "../../prompts/prompts.js";
|
||||
import type { Attachment } from "../../utils/attachment-utils.js";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js";
|
||||
import { ATTACHMENTS_RUNTIME_DESCRIPTION } from "../../prompts/prompts.ts";
|
||||
import type { Attachment } from "../../utils/attachment-utils.ts";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.ts";
|
||||
|
||||
/**
|
||||
* Attachments Runtime Provider
|
||||
@@ -10,7 +10,11 @@ import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js";
|
||||
* Attachments are read-only snapshot data - no messaging needed.
|
||||
*/
|
||||
export class AttachmentsRuntimeProvider implements SandboxRuntimeProvider {
|
||||
constructor(private attachments: Attachment[]) {}
|
||||
private attachments: Attachment[];
|
||||
|
||||
constructor(attachments: Attachment[]) {
|
||||
this.attachments = attachments;
|
||||
}
|
||||
|
||||
getData(): Record<string, any> {
|
||||
const attachmentsData = this.attachments.map((a) => ({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.ts";
|
||||
|
||||
export interface ConsoleLog {
|
||||
type: "log" | "warn" | "error" | "info";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.ts";
|
||||
|
||||
export interface DownloadableFile {
|
||||
fileName: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.js";
|
||||
import type { SandboxRuntimeProvider } from "./SandboxRuntimeProvider.ts";
|
||||
|
||||
// Type declaration for chrome extension API (when available)
|
||||
declare const chrome: any;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import "../components/ProviderKeyInput.js";
|
||||
import "../components/ProviderKeyInput.ts";
|
||||
import { DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.js";
|
||||
import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js";
|
||||
import { html } from "lit";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
@customElement("api-key-prompt-dialog")
|
||||
export class ApiKeyPromptDialog extends DialogBase {
|
||||
|
||||
@@ -7,8 +7,8 @@ import { state } from "lit/decorators.js";
|
||||
import { Download, X } from "lucide";
|
||||
import * as pdfjsLib from "pdfjs-dist";
|
||||
import * as XLSX from "xlsx";
|
||||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import type { Attachment } from "../utils/attachment-utils.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
type FileType = "image" | "pdf" | "docx" | "pptx" | "excel" | "text";
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import { Label } from "@mariozechner/mini-lit/dist/Label.js";
|
||||
import { Select } from "@mariozechner/mini-lit/dist/Select.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { state } from "lit/decorators.js";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import type { CustomProvider, CustomProviderType } from "../storage/stores/custom-providers-store.js";
|
||||
import { discoverModels } from "../utils/model-discovery.js";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import type { CustomProvider, CustomProviderType } from "../storage/stores/custom-providers-store.ts";
|
||||
import { discoverModels } from "../utils/model-discovery.ts";
|
||||
|
||||
export class CustomProviderDialog extends DialogBase {
|
||||
private provider?: CustomProvider;
|
||||
|
||||
@@ -8,12 +8,12 @@ import { html, type PropertyValues, type TemplateResult } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { createRef, ref } from "lit/directives/ref.js";
|
||||
import { Brain, Image as ImageIcon } from "lucide";
|
||||
import { Input } from "../components/Input.js";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import type { AutoDiscoveryProviderType } from "../storage/stores/custom-providers-store.js";
|
||||
import { formatModelCost } from "../utils/format.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { discoverModels } from "../utils/model-discovery.js";
|
||||
import { Input } from "../components/Input.ts";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import type { AutoDiscoveryProviderType } from "../storage/stores/custom-providers-store.ts";
|
||||
import { formatModelCost } from "../utils/format.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
import { discoverModels } from "../utils/model-discovery.ts";
|
||||
|
||||
/**
|
||||
* Score a query against a text using subsequence matching.
|
||||
|
||||
@@ -3,7 +3,7 @@ import { DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.
|
||||
import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js";
|
||||
import { html } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
@customElement("persistent-storage-dialog")
|
||||
export class PersistentStorageDialog extends DialogBase {
|
||||
|
||||
@@ -3,17 +3,17 @@ import { i18n } from "@mariozechner/mini-lit";
|
||||
import { Select } from "@mariozechner/mini-lit/dist/Select.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import "../components/CustomProviderCard.js";
|
||||
import "../components/ProviderKeyInput.js";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import "../components/CustomProviderCard.ts";
|
||||
import "../components/ProviderKeyInput.ts";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import type {
|
||||
AutoDiscoveryProviderType,
|
||||
CustomProvider,
|
||||
CustomProviderType,
|
||||
} from "../storage/stores/custom-providers-store.js";
|
||||
import { discoverModels } from "../utils/model-discovery.js";
|
||||
import { CustomProviderDialog } from "./CustomProviderDialog.js";
|
||||
import { SettingsTab } from "./SettingsDialog.js";
|
||||
} from "../storage/stores/custom-providers-store.ts";
|
||||
import { discoverModels } from "../utils/model-discovery.ts";
|
||||
import { CustomProviderDialog } from "./CustomProviderDialog.ts";
|
||||
import { SettingsTab } from "./SettingsDialog.ts";
|
||||
|
||||
@customElement("providers-models-tab")
|
||||
export class ProvidersModelsTab extends SettingsTab {
|
||||
|
||||
@@ -2,10 +2,10 @@ import { DialogContent, DialogHeader } from "@mariozechner/mini-lit/dist/Dialog.
|
||||
import { DialogBase } from "@mariozechner/mini-lit/dist/DialogBase.js";
|
||||
import { html } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import type { SessionMetadata } from "../storage/types.js";
|
||||
import { formatUsage } from "../utils/format.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
import type { SessionMetadata } from "../storage/types.ts";
|
||||
import { formatUsage } from "../utils/format.ts";
|
||||
import { i18n } from "../utils/i18n.ts";
|
||||
|
||||
@customElement("session-list-dialog")
|
||||
export class SessionListDialog extends DialogBase {
|
||||
|
||||
@@ -6,8 +6,8 @@ import { Label } from "@mariozechner/mini-lit/dist/Label.js";
|
||||
import { Switch } from "@mariozechner/mini-lit/dist/Switch.js";
|
||||
import { html, LitElement, type TemplateResult } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import "../components/ProviderKeyInput.js";
|
||||
import { getAppStorage } from "../storage/app-storage.js";
|
||||
import "../components/ProviderKeyInput.ts";
|
||||
import { getAppStorage } from "../storage/app-storage.ts";
|
||||
|
||||
// Base class for settings tabs
|
||||
export abstract class SettingsTab extends LitElement {
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
export type { Agent, AgentMessage, AgentState, ThinkingLevel } from "@earendil-works/pi-agent-core";
|
||||
export type { Model } from "@earendil-works/pi-ai";
|
||||
export { ChatPanel } from "./ChatPanel.js";
|
||||
export { ChatPanel } from "./ChatPanel.ts";
|
||||
// Components
|
||||
export { AgentInterface } from "./components/AgentInterface.js";
|
||||
export { AttachmentTile } from "./components/AttachmentTile.js";
|
||||
export { ConsoleBlock } from "./components/ConsoleBlock.js";
|
||||
export { CustomProviderCard } from "./components/CustomProviderCard.js";
|
||||
export { ExpandableSection } from "./components/ExpandableSection.js";
|
||||
export { Input } from "./components/Input.js";
|
||||
export { MessageEditor } from "./components/MessageEditor.js";
|
||||
export { MessageList } from "./components/MessageList.js";
|
||||
export { AgentInterface } from "./components/AgentInterface.ts";
|
||||
export { AttachmentTile } from "./components/AttachmentTile.ts";
|
||||
export { ConsoleBlock } from "./components/ConsoleBlock.ts";
|
||||
export { CustomProviderCard } from "./components/CustomProviderCard.ts";
|
||||
export { ExpandableSection } from "./components/ExpandableSection.ts";
|
||||
export { Input } from "./components/Input.ts";
|
||||
export { MessageEditor } from "./components/MessageEditor.ts";
|
||||
export { MessageList } from "./components/MessageList.ts";
|
||||
// Message components
|
||||
export type { ArtifactMessage, UserMessageWithAttachments } from "./components/Messages.js";
|
||||
export type { ArtifactMessage, UserMessageWithAttachments } from "./components/Messages.ts";
|
||||
export {
|
||||
AbortedMessage,
|
||||
AssistantMessage,
|
||||
@@ -24,7 +24,7 @@ export {
|
||||
ToolMessage,
|
||||
ToolMessageDebugView,
|
||||
UserMessage,
|
||||
} from "./components/Messages.js";
|
||||
} from "./components/Messages.ts";
|
||||
// Message renderer registry
|
||||
export {
|
||||
getMessageRenderer,
|
||||
@@ -32,55 +32,55 @@ export {
|
||||
type MessageRole,
|
||||
registerMessageRenderer,
|
||||
renderMessage,
|
||||
} from "./components/message-renderer-registry.js";
|
||||
export { ProviderKeyInput } from "./components/ProviderKeyInput.js";
|
||||
} from "./components/message-renderer-registry.ts";
|
||||
export { ProviderKeyInput } from "./components/ProviderKeyInput.ts";
|
||||
export {
|
||||
type SandboxFile,
|
||||
SandboxIframe,
|
||||
type SandboxResult,
|
||||
type SandboxUrlProvider,
|
||||
} from "./components/SandboxedIframe.js";
|
||||
export { StreamingMessageContainer } from "./components/StreamingMessageContainer.js";
|
||||
} from "./components/SandboxedIframe.ts";
|
||||
export { StreamingMessageContainer } from "./components/StreamingMessageContainer.ts";
|
||||
// Sandbox Runtime Providers
|
||||
export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.js";
|
||||
export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.js";
|
||||
export { type ConsoleLog, ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider.js";
|
||||
export { ArtifactsRuntimeProvider } from "./components/sandbox/ArtifactsRuntimeProvider.ts";
|
||||
export { AttachmentsRuntimeProvider } from "./components/sandbox/AttachmentsRuntimeProvider.ts";
|
||||
export { type ConsoleLog, ConsoleRuntimeProvider } from "./components/sandbox/ConsoleRuntimeProvider.ts";
|
||||
export {
|
||||
type DownloadableFile,
|
||||
FileDownloadRuntimeProvider,
|
||||
} from "./components/sandbox/FileDownloadRuntimeProvider.js";
|
||||
export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge.js";
|
||||
export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter.js";
|
||||
export type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.js";
|
||||
export { ThinkingBlock } from "./components/ThinkingBlock.js";
|
||||
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.js";
|
||||
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.js";
|
||||
export { CustomProviderDialog } from "./dialogs/CustomProviderDialog.js";
|
||||
} from "./components/sandbox/FileDownloadRuntimeProvider.ts";
|
||||
export { RuntimeMessageBridge } from "./components/sandbox/RuntimeMessageBridge.ts";
|
||||
export { RUNTIME_MESSAGE_ROUTER } from "./components/sandbox/RuntimeMessageRouter.ts";
|
||||
export type { SandboxRuntimeProvider } from "./components/sandbox/SandboxRuntimeProvider.ts";
|
||||
export { ThinkingBlock } from "./components/ThinkingBlock.ts";
|
||||
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.ts";
|
||||
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.ts";
|
||||
export { CustomProviderDialog } from "./dialogs/CustomProviderDialog.ts";
|
||||
// Dialogs
|
||||
export { ModelSelector } from "./dialogs/ModelSelector.js";
|
||||
export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog.js";
|
||||
export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab.js";
|
||||
export { SessionListDialog } from "./dialogs/SessionListDialog.js";
|
||||
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.js";
|
||||
export { ModelSelector } from "./dialogs/ModelSelector.ts";
|
||||
export { PersistentStorageDialog } from "./dialogs/PersistentStorageDialog.ts";
|
||||
export { ProvidersModelsTab } from "./dialogs/ProvidersModelsTab.ts";
|
||||
export { SessionListDialog } from "./dialogs/SessionListDialog.ts";
|
||||
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.ts";
|
||||
// Prompts
|
||||
export {
|
||||
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO,
|
||||
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW,
|
||||
ATTACHMENTS_RUNTIME_DESCRIPTION,
|
||||
} from "./prompts/prompts.js";
|
||||
} from "./prompts/prompts.ts";
|
||||
// Storage
|
||||
export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage.js";
|
||||
export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend.js";
|
||||
export { Store } from "./storage/store.js";
|
||||
export { AppStorage, getAppStorage, setAppStorage } from "./storage/app-storage.ts";
|
||||
export { IndexedDBStorageBackend } from "./storage/backends/indexeddb-storage-backend.ts";
|
||||
export { Store } from "./storage/store.ts";
|
||||
export type {
|
||||
AutoDiscoveryProviderType,
|
||||
CustomProvider,
|
||||
CustomProviderType,
|
||||
} from "./storage/stores/custom-providers-store.js";
|
||||
export { CustomProvidersStore } from "./storage/stores/custom-providers-store.js";
|
||||
export { ProviderKeysStore } from "./storage/stores/provider-keys-store.js";
|
||||
export { SessionsStore } from "./storage/stores/sessions-store.js";
|
||||
export { SettingsStore } from "./storage/stores/settings-store.js";
|
||||
} from "./storage/stores/custom-providers-store.ts";
|
||||
export { CustomProvidersStore } from "./storage/stores/custom-providers-store.ts";
|
||||
export { ProviderKeysStore } from "./storage/stores/provider-keys-store.ts";
|
||||
export { SessionsStore } from "./storage/stores/sessions-store.ts";
|
||||
export { SettingsStore } from "./storage/stores/settings-store.ts";
|
||||
export type {
|
||||
IndexConfig,
|
||||
IndexedDBConfig,
|
||||
@@ -89,32 +89,32 @@ export type {
|
||||
StorageBackend,
|
||||
StorageTransaction,
|
||||
StoreConfig,
|
||||
} from "./storage/types.js";
|
||||
} from "./storage/types.ts";
|
||||
// Artifacts
|
||||
export { ArtifactElement } from "./tools/artifacts/ArtifactElement.js";
|
||||
export { ArtifactPill } from "./tools/artifacts/ArtifactPill.js";
|
||||
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts.js";
|
||||
export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer.js";
|
||||
export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact.js";
|
||||
export { ImageArtifact } from "./tools/artifacts/ImageArtifact.js";
|
||||
export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact.js";
|
||||
export { SvgArtifact } from "./tools/artifacts/SvgArtifact.js";
|
||||
export { TextArtifact } from "./tools/artifacts/TextArtifact.js";
|
||||
export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document.js";
|
||||
export { ArtifactElement } from "./tools/artifacts/ArtifactElement.ts";
|
||||
export { ArtifactPill } from "./tools/artifacts/ArtifactPill.ts";
|
||||
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts.ts";
|
||||
export { ArtifactsToolRenderer } from "./tools/artifacts/artifacts-tool-renderer.ts";
|
||||
export { HtmlArtifact } from "./tools/artifacts/HtmlArtifact.ts";
|
||||
export { ImageArtifact } from "./tools/artifacts/ImageArtifact.ts";
|
||||
export { MarkdownArtifact } from "./tools/artifacts/MarkdownArtifact.ts";
|
||||
export { SvgArtifact } from "./tools/artifacts/SvgArtifact.ts";
|
||||
export { TextArtifact } from "./tools/artifacts/TextArtifact.ts";
|
||||
export { createExtractDocumentTool, extractDocumentTool } from "./tools/extract-document.ts";
|
||||
// Tools
|
||||
export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index.js";
|
||||
export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl.js";
|
||||
export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry.js";
|
||||
export { BashRenderer } from "./tools/renderers/BashRenderer.js";
|
||||
export { CalculateRenderer } from "./tools/renderers/CalculateRenderer.js";
|
||||
export { getToolRenderer, registerToolRenderer, renderTool, setShowJsonMode } from "./tools/index.ts";
|
||||
export { createJavaScriptReplTool, javascriptReplTool } from "./tools/javascript-repl.ts";
|
||||
export { renderCollapsibleHeader, renderHeader } from "./tools/renderer-registry.ts";
|
||||
export { BashRenderer } from "./tools/renderers/BashRenderer.ts";
|
||||
export { CalculateRenderer } from "./tools/renderers/CalculateRenderer.ts";
|
||||
// Tool renderers
|
||||
export { DefaultRenderer } from "./tools/renderers/DefaultRenderer.js";
|
||||
export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer.js";
|
||||
export type { ToolRenderer, ToolRenderResult } from "./tools/types.js";
|
||||
export type { Attachment } from "./utils/attachment-utils.js";
|
||||
export { DefaultRenderer } from "./tools/renderers/DefaultRenderer.ts";
|
||||
export { GetCurrentTimeRenderer } from "./tools/renderers/GetCurrentTimeRenderer.ts";
|
||||
export type { ToolRenderer, ToolRenderResult } from "./tools/types.ts";
|
||||
export type { Attachment } from "./utils/attachment-utils.ts";
|
||||
// Utils
|
||||
export { loadAttachment } from "./utils/attachment-utils.js";
|
||||
export { clearAuthToken, getAuthToken } from "./utils/auth-token.js";
|
||||
export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format.js";
|
||||
export { i18n, setLanguage, translations } from "./utils/i18n.js";
|
||||
export { applyProxyIfNeeded, createStreamFn, isCorsError, shouldUseProxyForProvider } from "./utils/proxy-utils.js";
|
||||
export { loadAttachment } from "./utils/attachment-utils.ts";
|
||||
export { clearAuthToken, getAuthToken } from "./utils/auth-token.ts";
|
||||
export { formatCost, formatModelCost, formatTokenCount, formatUsage } from "./utils/format.ts";
|
||||
export { i18n, setLanguage, translations } from "./utils/i18n.ts";
|
||||
export { applyProxyIfNeeded, createStreamFn, isCorsError, shouldUseProxyForProvider } from "./utils/proxy-utils.ts";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { CustomProvidersStore } from "./stores/custom-providers-store.js";
|
||||
import type { ProviderKeysStore } from "./stores/provider-keys-store.js";
|
||||
import type { SessionsStore } from "./stores/sessions-store.js";
|
||||
import type { SettingsStore } from "./stores/settings-store.js";
|
||||
import type { StorageBackend } from "./types.js";
|
||||
import type { CustomProvidersStore } from "./stores/custom-providers-store.ts";
|
||||
import type { ProviderKeysStore } from "./stores/provider-keys-store.ts";
|
||||
import type { SessionsStore } from "./stores/sessions-store.ts";
|
||||
import type { SettingsStore } from "./stores/settings-store.ts";
|
||||
import type { StorageBackend } from "./types.ts";
|
||||
|
||||
/**
|
||||
* High-level storage API providing access to all storage operations.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IndexedDBConfig, StorageBackend, StorageTransaction } from "../types.js";
|
||||
import type { IndexedDBConfig, StorageBackend, StorageTransaction } from "../types.ts";
|
||||
|
||||
/**
|
||||
* IndexedDB implementation of StorageBackend.
|
||||
@@ -6,8 +6,11 @@ import type { IndexedDBConfig, StorageBackend, StorageTransaction } from "../typ
|
||||
*/
|
||||
export class IndexedDBStorageBackend implements StorageBackend {
|
||||
private dbPromise: Promise<IDBDatabase> | null = null;
|
||||
private config: IndexedDBConfig;
|
||||
|
||||
constructor(private config: IndexedDBConfig) {}
|
||||
constructor(config: IndexedDBConfig) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
private async getDB(): Promise<IDBDatabase> {
|
||||
if (!this.dbPromise) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { StorageBackend, StoreConfig } from "./types.js";
|
||||
import type { StorageBackend, StoreConfig } from "./types.ts";
|
||||
|
||||
/**
|
||||
* Base class for all storage stores.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Model } from "@earendil-works/pi-ai";
|
||||
import { Store } from "../store.js";
|
||||
import type { StoreConfig } from "../types.js";
|
||||
import { Store } from "../store.ts";
|
||||
import type { StoreConfig } from "../types.ts";
|
||||
|
||||
export type AutoDiscoveryProviderType = "ollama" | "llama.cpp" | "vllm" | "lmstudio";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Store } from "../store.js";
|
||||
import type { StoreConfig } from "../types.js";
|
||||
import { Store } from "../store.ts";
|
||||
import type { StoreConfig } from "../types.ts";
|
||||
|
||||
/**
|
||||
* Store for LLM provider API keys (Anthropic, OpenAI, etc.).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentState } from "@earendil-works/pi-agent-core";
|
||||
import { Store } from "../store.js";
|
||||
import type { SessionData, SessionMetadata, StoreConfig } from "../types.js";
|
||||
import { Store } from "../store.ts";
|
||||
import type { SessionData, SessionMetadata, StoreConfig } from "../types.ts";
|
||||
|
||||
/**
|
||||
* Store for chat sessions (data and metadata).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Store } from "../store.js";
|
||||
import type { StoreConfig } from "../types.js";
|
||||
import { Store } from "../store.ts";
|
||||
import type { StoreConfig } from "../types.ts";
|
||||
|
||||
/**
|
||||
* Store for application settings (theme, proxy config, etc.).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { icon } from "@mariozechner/mini-lit";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { FileCode2 } from "lucide";
|
||||
import type { ArtifactsPanel } from "./artifacts.js";
|
||||
import type { ArtifactsPanel } from "./artifacts.ts";
|
||||
|
||||
export function ArtifactPill(filename: string, artifactsPanel?: ArtifactsPanel): TemplateResult {
|
||||
const handleClick = (e: Event) => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { customElement, property, state } from "lit/decorators.js";
|
||||
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
||||
import { repeat } from "lit/directives/repeat.js";
|
||||
import { ChevronDown, ChevronRight, ChevronsDown, Lock } from "lucide";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
|
||||
interface LogEntry {
|
||||
type: "log" | "error";
|
||||
|
||||
@@ -2,8 +2,8 @@ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
import { renderAsync } from "docx-preview";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
@customElement("docx-artifact")
|
||||
export class DocxArtifact extends ArtifactElement {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import * as XLSX from "xlsx";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
@customElement("excel-artifact")
|
||||
export class ExcelArtifact extends ArtifactElement {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
@customElement("generic-artifact")
|
||||
export class GenericArtifact extends ArtifactElement {
|
||||
|
||||
@@ -4,14 +4,14 @@ import { customElement, property, state } from "lit/decorators.js";
|
||||
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
||||
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
||||
import { RefreshCw } from "lucide";
|
||||
import type { SandboxIframe } from "../../components/SandboxedIframe.js";
|
||||
import { type MessageConsumer, RUNTIME_MESSAGE_ROUTER } from "../../components/sandbox/RuntimeMessageRouter.js";
|
||||
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import "../../components/SandboxedIframe.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import type { Console } from "./Console.js";
|
||||
import "./Console.js";
|
||||
import type { SandboxIframe } from "../../components/SandboxedIframe.ts";
|
||||
import { type MessageConsumer, RUNTIME_MESSAGE_ROUTER } from "../../components/sandbox/RuntimeMessageRouter.ts";
|
||||
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider.ts";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import "../../components/SandboxedIframe.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
import type { Console } from "./Console.ts";
|
||||
import "./Console.ts";
|
||||
import { icon } from "@mariozechner/mini-lit";
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
@customElement("image-artifact")
|
||||
export class ImageArtifact extends ArtifactElement {
|
||||
|
||||
@@ -2,12 +2,12 @@ import hljs from "highlight.js";
|
||||
import { html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import "@mariozechner/mini-lit/dist/MarkdownBlock.js";
|
||||
import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js";
|
||||
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
import { PreviewCodeToggle } from "@mariozechner/mini-lit/dist/PreviewCodeToggle.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
@customElement("markdown-artifact")
|
||||
export class MarkdownArtifact extends ArtifactElement {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import * as pdfjsLib from "pdfjs-dist";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
// Configure PDF.js worker
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString();
|
||||
|
||||
@@ -5,8 +5,8 @@ import hljs from "highlight.js";
|
||||
import { html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
@customElement("svg-artifact")
|
||||
export class SvgArtifact extends ArtifactElement {
|
||||
|
||||
@@ -4,8 +4,8 @@ import hljs from "highlight.js";
|
||||
import { html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { ArtifactElement } from "./ArtifactElement.ts";
|
||||
|
||||
// Known code file extensions for highlighting
|
||||
const CODE_EXTENSIONS = [
|
||||
|
||||
@@ -2,14 +2,14 @@ import "@mariozechner/mini-lit/dist/CodeBlock.js";
|
||||
import type { ToolResultMessage } from "@earendil-works/pi-ai";
|
||||
import { createRef, ref } from "lit/directives/ref.js";
|
||||
import { FileCode2 } from "lucide";
|
||||
import "../../components/ConsoleBlock.js";
|
||||
import "../../components/ConsoleBlock.ts";
|
||||
import { Diff } from "@mariozechner/mini-lit/dist/Diff.js";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { renderCollapsibleHeader, renderHeader } from "../renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.js";
|
||||
import { ArtifactPill } from "./ArtifactPill.js";
|
||||
import type { ArtifactsPanel, ArtifactsParams } from "./artifacts.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { renderCollapsibleHeader, renderHeader } from "../renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.ts";
|
||||
import { ArtifactPill } from "./ArtifactPill.ts";
|
||||
import type { ArtifactsPanel, ArtifactsParams } from "./artifacts.ts";
|
||||
|
||||
// Helper to extract text from content blocks
|
||||
function getTextOutput(result: ToolResultMessage<any> | undefined): string {
|
||||
@@ -60,7 +60,11 @@ function getLanguageFromFilename(filename?: string): string {
|
||||
}
|
||||
|
||||
export class ArtifactsToolRenderer implements ToolRenderer<ArtifactsParams, undefined> {
|
||||
constructor(public artifactsPanel?: ArtifactsPanel) {}
|
||||
artifactsPanel?: ArtifactsPanel;
|
||||
|
||||
constructor(artifactsPanel?: ArtifactsPanel) {
|
||||
this.artifactsPanel = artifactsPanel;
|
||||
}
|
||||
|
||||
render(
|
||||
params: ArtifactsParams | undefined,
|
||||
|
||||
@@ -8,27 +8,27 @@ import { customElement, property, state } from "lit/decorators.js";
|
||||
import { createRef, type Ref, ref } from "lit/directives/ref.js";
|
||||
import { X } from "lucide";
|
||||
import { type Static, Type } from "typebox";
|
||||
import type { ArtifactMessage } from "../../components/Messages.js";
|
||||
import { ArtifactsRuntimeProvider } from "../../components/sandbox/ArtifactsRuntimeProvider.js";
|
||||
import { AttachmentsRuntimeProvider } from "../../components/sandbox/AttachmentsRuntimeProvider.js";
|
||||
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider.js";
|
||||
import type { ArtifactMessage } from "../../components/Messages.ts";
|
||||
import { ArtifactsRuntimeProvider } from "../../components/sandbox/ArtifactsRuntimeProvider.ts";
|
||||
import { AttachmentsRuntimeProvider } from "../../components/sandbox/AttachmentsRuntimeProvider.ts";
|
||||
import type { SandboxRuntimeProvider } from "../../components/sandbox/SandboxRuntimeProvider.ts";
|
||||
import {
|
||||
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO,
|
||||
ARTIFACTS_TOOL_DESCRIPTION,
|
||||
ATTACHMENTS_RUNTIME_DESCRIPTION,
|
||||
} from "../../prompts/prompts.js";
|
||||
import type { Attachment } from "../../utils/attachment-utils.js";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import type { ArtifactElement } from "./ArtifactElement.js";
|
||||
import { DocxArtifact } from "./DocxArtifact.js";
|
||||
import { ExcelArtifact } from "./ExcelArtifact.js";
|
||||
import { GenericArtifact } from "./GenericArtifact.js";
|
||||
import { HtmlArtifact } from "./HtmlArtifact.js";
|
||||
import { ImageArtifact } from "./ImageArtifact.js";
|
||||
import { MarkdownArtifact } from "./MarkdownArtifact.js";
|
||||
import { PdfArtifact } from "./PdfArtifact.js";
|
||||
import { SvgArtifact } from "./SvgArtifact.js";
|
||||
import { TextArtifact } from "./TextArtifact.js";
|
||||
} from "../../prompts/prompts.ts";
|
||||
import type { Attachment } from "../../utils/attachment-utils.ts";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import type { ArtifactElement } from "./ArtifactElement.ts";
|
||||
import { DocxArtifact } from "./DocxArtifact.ts";
|
||||
import { ExcelArtifact } from "./ExcelArtifact.ts";
|
||||
import { GenericArtifact } from "./GenericArtifact.ts";
|
||||
import { HtmlArtifact } from "./HtmlArtifact.ts";
|
||||
import { ImageArtifact } from "./ImageArtifact.ts";
|
||||
import { MarkdownArtifact } from "./MarkdownArtifact.ts";
|
||||
import { PdfArtifact } from "./PdfArtifact.ts";
|
||||
import { SvgArtifact } from "./SvgArtifact.ts";
|
||||
import { TextArtifact } from "./TextArtifact.ts";
|
||||
|
||||
// Simple artifact model
|
||||
export interface Artifact {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export { ArtifactElement } from "./ArtifactElement.js";
|
||||
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./artifacts.js";
|
||||
export { ArtifactsToolRenderer } from "./artifacts-tool-renderer.js";
|
||||
export { HtmlArtifact } from "./HtmlArtifact.js";
|
||||
export { MarkdownArtifact } from "./MarkdownArtifact.js";
|
||||
export { SvgArtifact } from "./SvgArtifact.js";
|
||||
export { TextArtifact } from "./TextArtifact.js";
|
||||
export { ArtifactElement } from "./ArtifactElement.ts";
|
||||
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./artifacts.ts";
|
||||
export { ArtifactsToolRenderer } from "./artifacts-tool-renderer.ts";
|
||||
export { HtmlArtifact } from "./HtmlArtifact.ts";
|
||||
export { MarkdownArtifact } from "./MarkdownArtifact.ts";
|
||||
export { SvgArtifact } from "./SvgArtifact.ts";
|
||||
export { TextArtifact } from "./TextArtifact.ts";
|
||||
|
||||
@@ -4,11 +4,11 @@ import { html } from "lit";
|
||||
import { createRef, ref } from "lit/directives/ref.js";
|
||||
import { FileText } from "lucide";
|
||||
import { type Static, Type } from "typebox";
|
||||
import { EXTRACT_DOCUMENT_DESCRIPTION } from "../prompts/prompts.js";
|
||||
import { loadAttachment } from "../utils/attachment-utils.js";
|
||||
import { isCorsError } from "../utils/proxy-utils.js";
|
||||
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "./types.js";
|
||||
import { EXTRACT_DOCUMENT_DESCRIPTION } from "../prompts/prompts.ts";
|
||||
import { loadAttachment } from "../utils/attachment-utils.ts";
|
||||
import { isCorsError } from "../utils/proxy-utils.ts";
|
||||
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "./types.ts";
|
||||
|
||||
// ============================================================================
|
||||
// TYPES
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { ToolResultMessage } from "@earendil-works/pi-ai";
|
||||
import "./javascript-repl.js"; // Auto-registers the renderer
|
||||
import "./extract-document.js"; // Auto-registers the renderer
|
||||
import { getToolRenderer, registerToolRenderer } from "./renderer-registry.js";
|
||||
import { BashRenderer } from "./renderers/BashRenderer.js";
|
||||
import { DefaultRenderer } from "./renderers/DefaultRenderer.js";
|
||||
import type { ToolRenderResult } from "./types.js";
|
||||
import "./javascript-repl.ts"; // Auto-registers the renderer
|
||||
import "./extract-document.ts"; // Auto-registers the renderer
|
||||
import { getToolRenderer, registerToolRenderer } from "./renderer-registry.ts";
|
||||
import { BashRenderer } from "./renderers/BashRenderer.ts";
|
||||
import { DefaultRenderer } from "./renderers/DefaultRenderer.ts";
|
||||
import type { ToolRenderResult } from "./types.ts";
|
||||
|
||||
// Register all built-in tool renderers
|
||||
registerToolRenderer("bash", new BashRenderer());
|
||||
|
||||
@@ -5,12 +5,12 @@ import { html } from "lit";
|
||||
import { createRef, ref } from "lit/directives/ref.js";
|
||||
import { Code } from "lucide";
|
||||
import { type Static, Type } from "typebox";
|
||||
import { type SandboxFile, SandboxIframe, type SandboxResult } from "../components/SandboxedIframe.js";
|
||||
import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider.js";
|
||||
import { JAVASCRIPT_REPL_TOOL_DESCRIPTION } from "../prompts/prompts.js";
|
||||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "./types.js";
|
||||
import { type SandboxFile, SandboxIframe, type SandboxResult } from "../components/SandboxedIframe.ts";
|
||||
import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider.ts";
|
||||
import { JAVASCRIPT_REPL_TOOL_DESCRIPTION } from "../prompts/prompts.ts";
|
||||
import type { Attachment } from "../utils/attachment-utils.ts";
|
||||
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "./types.ts";
|
||||
|
||||
// Execute JavaScript code with attachments using SandboxedIframe
|
||||
export async function executeJavaScript(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { html, type TemplateResult } from "lit";
|
||||
import type { Ref } from "lit/directives/ref.js";
|
||||
import { ref } from "lit/directives/ref.js";
|
||||
import { ChevronsUpDown, ChevronUp, Loader } from "lucide";
|
||||
import type { ToolRenderer } from "./types.js";
|
||||
import type { ToolRenderer } from "./types.ts";
|
||||
|
||||
// Registry of tool renderers
|
||||
export const toolRenderers = new Map<string, ToolRenderer>();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ToolResultMessage } from "@earendil-works/pi-ai";
|
||||
import { html } from "lit";
|
||||
import { SquareTerminal } from "lucide";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { renderHeader } from "../renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { renderHeader } from "../renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.ts";
|
||||
|
||||
interface BashParams {
|
||||
command: string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ToolResultMessage } from "@earendil-works/pi-ai";
|
||||
import { html } from "lit";
|
||||
import { Calculator } from "lucide";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { renderHeader } from "../renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { renderHeader } from "../renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.ts";
|
||||
|
||||
interface CalculateParams {
|
||||
expression: string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ToolResultMessage } from "@earendil-works/pi-ai";
|
||||
import { html } from "lit";
|
||||
import { Code } from "lucide";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { renderHeader } from "../renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { renderHeader } from "../renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.ts";
|
||||
|
||||
export class DefaultRenderer implements ToolRenderer {
|
||||
render(params: any | undefined, result: ToolResultMessage | undefined, isStreaming?: boolean): ToolRenderResult {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ToolResultMessage } from "@earendil-works/pi-ai";
|
||||
import { html } from "lit";
|
||||
import { Clock } from "lucide";
|
||||
import { i18n } from "../../utils/i18n.js";
|
||||
import { renderHeader } from "../renderer-registry.js";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.js";
|
||||
import { i18n } from "../../utils/i18n.ts";
|
||||
import { renderHeader } from "../renderer-registry.ts";
|
||||
import type { ToolRenderer, ToolRenderResult } from "../types.ts";
|
||||
|
||||
interface GetCurrentTimeParams {
|
||||
timezone?: string;
|
||||
|
||||
@@ -3,7 +3,7 @@ import JSZip from "jszip";
|
||||
import type { PDFDocumentProxy } from "pdfjs-dist";
|
||||
import * as pdfjsLib from "pdfjs-dist";
|
||||
import * as XLSX from "xlsx";
|
||||
import { i18n } from "./i18n.js";
|
||||
import { i18n } from "./i18n.ts";
|
||||
|
||||
// Configure PDF.js worker - we'll need to bundle this
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import PromptDialog from "@mariozechner/mini-lit/dist/PromptDialog.js";
|
||||
import { i18n } from "./i18n.js";
|
||||
import { i18n } from "./i18n.ts";
|
||||
|
||||
export async function getAuthToken(): Promise<string | undefined> {
|
||||
let authToken: string | undefined = localStorage.getItem(`auth-token`) || "";
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"rewriteRelativeImportExtensions": true,
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"rootDir": "./src",
|
||||
|
||||
Reference in New Issue
Block a user