@flanksource/clicky-ui 0.3.24 → 0.3.25
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/dist/data/chat/Chat.cjs +8 -4
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.js +8 -4
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.cjs +11 -7
- package/dist/data/chat/ChatRuntimeToolbar.cjs.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.d.ts.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.js +11 -7
- package/dist/data/chat/ChatRuntimeToolbar.js.map +1 -1
- package/dist/data/chat/ContextMeter.cjs +64 -27
- package/dist/data/chat/ContextMeter.cjs.map +1 -1
- package/dist/data/chat/ContextMeter.d.ts +11 -4
- package/dist/data/chat/ContextMeter.d.ts.map +1 -1
- package/dist/data/chat/ContextMeter.js +64 -27
- package/dist/data/chat/ContextMeter.js.map +1 -1
- package/dist/data/chat/types.cjs.map +1 -1
- package/dist/data/chat/types.d.ts +19 -0
- package/dist/data/chat/types.d.ts.map +1 -1
- package/dist/data/chat/types.js.map +1 -1
- package/dist/data/chat/usage-snapshot.cjs +10 -1
- package/dist/data/chat/usage-snapshot.cjs.map +1 -1
- package/dist/data/chat/usage-snapshot.d.ts.map +1 -1
- package/dist/data/chat/usage-snapshot.js +10 -1
- package/dist/data/chat/usage-snapshot.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\nimport type { ReactNode } from \"react\";\nimport type {\n JsonSchemaObject,\n JsonSchemaProperty as FormJsonSchemaProperty,\n} from \"../../components/json-schema-form-types\";\n\nexport type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n};\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModelRuntime {\n model?: string;\n id?: string;\n backend?: string;\n mode?: string;\n temperature?: number;\n effort?: string;\n noCache?: boolean;\n fallbacks?: ChatModelRuntime[];\n}\n\nexport type RuntimeAvailabilityState =\n | \"available\"\n | \"disabled\"\n | \"missing_credentials\"\n | \"not_authenticated\"\n | \"missing_executable\"\n | \"missing_dependency\"\n | \"unsupported\"\n | \"unavailable\";\n\nexport interface RuntimeAvailability {\n state: RuntimeAvailabilityState;\n reason?: string;\n remediation?: string;\n}\n\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n /** Exact Captain Model wire value submitted when this display row is selected. */\n runtime?: ChatModelRuntime;\n reasoning: boolean;\n /** True when backend metadata is authoritative, including explicit unsupported values. */\n capabilitiesKnown?: boolean;\n /** Ordered reasoning-effort tiers accepted by this exact model. */\n supportedEfforts?: string[];\n /** Backend-recommended effort used when the current selection is invalid. */\n defaultEffort?: string;\n /** Whether the model honours the temperature sampling control. */\n temperature?: boolean;\n configured?: boolean;\n availability?: RuntimeAvailability;\n /**\n * The catalog's own declared default — the row a picker seeds with when the\n * caller names no model. At most one row carries it, and a catalog that\n * declares none (or whose default is unconfigured) falls back to the first\n * configured row.\n */\n default?: boolean;\n /** Concrete runtime backends that advertised this model. Empty/omitted means provider-wide. */\n backends?: string[];\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n /** MIME patterns accepted as model inputs, e.g. image/* or application/pdf. */\n inputMediaTypes?: string[];\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n messageCount: number;\n modelLabel?: string;\n}\n\nexport interface ChatBudgetConfig {\n /** Per-thread/request cost cap in USD. */\n cost?: number;\n /** Max output tokens for one model call. */\n maxTokens?: number;\n}\n\nexport interface ChatUsageBreakdown {\n inputTokens?: number;\n outputTokens?: number;\n reasoningTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n totalTokens?: number;\n}\n\nexport interface ChatCostBreakdown {\n model?: string;\n inputUsd?: number;\n outputUsd?: number;\n reasoningUsd?: number;\n cacheReadUsd?: number;\n cacheWriteUsd?: number;\n totalUsd?: number;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: {\n type: string;\n}): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Claude Agent SDK permission modes accepted by `permissionMode`. */\nexport const CLAUDE_PERMISSION_MODES = [\n \"default\",\n \"acceptEdits\",\n \"bypassPermissions\",\n \"plan\",\n \"dontAsk\",\n \"auto\",\n] as const;\n\nexport type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];\n\nexport type ClaudePermissionModeOption = {\n value: ClaudePermissionMode;\n label: string;\n description: string;\n};\n\nexport const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[] = [\n {\n value: \"default\",\n label: \"Default\",\n description:\n \"Prompt for dangerous operations using standard Claude behavior.\",\n },\n {\n value: \"auto\",\n label: \"Auto\",\n description:\n \"Use Claude's classifier to approve or deny permission prompts.\",\n },\n {\n value: \"acceptEdits\",\n label: \"Accept edits\",\n description: \"Automatically accept file edit operations.\",\n },\n {\n value: \"dontAsk\",\n label: \"Don't ask\",\n description: \"Do not prompt; deny actions that are not pre-approved.\",\n },\n {\n value: \"plan\",\n label: \"Plan\",\n description: \"Planning mode with no tool execution.\",\n },\n {\n value: \"bypassPermissions\",\n label: \"Bypass\",\n description:\n \"Bypass permission checks when explicitly allowed by the host.\",\n },\n];\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\nexport type ToolMode = \"on\" | \"ask\" | \"off\" | \"auto\";\n\nexport interface ToolAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Display title of the tool's parent surface/entity (e.g. \"Xero Accounts\").\n * Used to nest tools under their entity within a group, and as the\n * disambiguating prefix in flat lists so sibling verbs (\"List\", \"Get\") stay\n * distinguishable. Resolved from the operation's `x-clicky.surface`. */\n parent?: string;\n /** Raw entity name of the tool's surface (e.g. \"accounts\"), when known. */\n entity?: string;\n /** Preference key sent to the backend. Defaults to `name`; group-backed\n * clicky tools set this to the backend tool group. */\n preferenceKey?: string;\n /** Initial backend-owned permission when the chat window first sees this tool. */\n defaultPermission?: ToolMode;\n /** Opaque icon name emitted by the backend, resolved by the host UI. */\n icon?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** Short usage hints shown in the tool browser. */\n hints?: string[];\n source?: \"clicky\" | \"custom\" | \"mcp\" | string;\n server?: string;\n method?: string;\n path?: string;\n operationName?: string;\n title?: string;\n /** Whether the runtime should treat the tool input schema as strict/closed. */\n strict?: boolean;\n /** Runtime tool annotations/hints, e.g. MCP/Genkit well-known hints. */\n annotations?: ToolAnnotations;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n outputSchema?: ChatToolInputSchema;\n}\n\nexport type ChatToolInputSchema = JsonSchemaObject;\nexport type JsonSchemaProperty = FormJsonSchemaProperty;\nexport type JSONSchemaProperty = FormJsonSchemaProperty;\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: {\n type: string;\n}): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n\nexport interface ToolResultRenderArgs {\n part: AnyToolPart;\n toolName: string;\n output: unknown;\n}\n\nexport type ToolResultRenderer = (args: ToolResultRenderArgs) => ReactNode;\n"],"names":[],"mappings":"AA4IO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAEJ;AAC1B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAQO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,iCAA+D;AAAA,EAC1E;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAEN;AAgEO,SAAS,kBAAkB,MAEJ;AAC5B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\nimport type { ReactNode } from \"react\";\nimport type {\n JsonSchemaObject,\n JsonSchemaProperty as FormJsonSchemaProperty,\n} from \"../../components/json-schema-form-types\";\n\nexport type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n};\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModelRuntime {\n model?: string;\n id?: string;\n backend?: string;\n mode?: string;\n temperature?: number;\n effort?: string;\n noCache?: boolean;\n fallbacks?: ChatModelRuntime[];\n}\n\nexport type RuntimeAvailabilityState =\n | \"available\"\n | \"disabled\"\n | \"missing_credentials\"\n | \"not_authenticated\"\n | \"missing_executable\"\n | \"missing_dependency\"\n | \"unsupported\"\n | \"unavailable\";\n\nexport interface RuntimeAvailability {\n state: RuntimeAvailabilityState;\n reason?: string;\n remediation?: string;\n}\n\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n /** Exact Captain Model wire value submitted when this display row is selected. */\n runtime?: ChatModelRuntime;\n reasoning: boolean;\n /** True when backend metadata is authoritative, including explicit unsupported values. */\n capabilitiesKnown?: boolean;\n /** Ordered reasoning-effort tiers accepted by this exact model. */\n supportedEfforts?: string[];\n /** Backend-recommended effort used when the current selection is invalid. */\n defaultEffort?: string;\n /** Whether the model honours the temperature sampling control. */\n temperature?: boolean;\n configured?: boolean;\n availability?: RuntimeAvailability;\n /**\n * The catalog's own declared default — the row a picker seeds with when the\n * caller names no model. At most one row carries it, and a catalog that\n * declares none (or whose default is unconfigured) falls back to the first\n * configured row.\n */\n default?: boolean;\n /** Concrete runtime backends that advertised this model. Empty/omitted means provider-wide. */\n backends?: string[];\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n /** MIME patterns accepted as model inputs, e.g. image/* or application/pdf. */\n inputMediaTypes?: string[];\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n messageCount: number;\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n /** @deprecated Use `model`; retained for compatibility with existing consumers. */\n modelLabel?: string;\n}\n\nexport interface ChatBudgetConfig {\n /** Per-thread/request cost cap in USD. */\n cost?: number;\n /** Max output tokens for one model call. */\n maxTokens?: number;\n}\n\nexport interface ChatUsageBreakdown {\n inputTokens?: number;\n outputTokens?: number;\n reasoningTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n totalTokens?: number;\n}\n\nexport interface ChatCostBreakdown {\n model?: string;\n inputUsd?: number;\n outputUsd?: number;\n reasoningUsd?: number;\n cacheReadUsd?: number;\n cacheWriteUsd?: number;\n totalUsd?: number;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: {\n type: string;\n}): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Claude Agent SDK permission modes accepted by `permissionMode`. */\nexport const CLAUDE_PERMISSION_MODES = [\n \"default\",\n \"acceptEdits\",\n \"bypassPermissions\",\n \"plan\",\n \"dontAsk\",\n \"auto\",\n] as const;\n\nexport type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];\n\nexport type ClaudePermissionModeOption = {\n value: ClaudePermissionMode;\n label: string;\n description: string;\n};\n\nexport const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[] = [\n {\n value: \"default\",\n label: \"Default\",\n description:\n \"Prompt for dangerous operations using standard Claude behavior.\",\n },\n {\n value: \"auto\",\n label: \"Auto\",\n description:\n \"Use Claude's classifier to approve or deny permission prompts.\",\n },\n {\n value: \"acceptEdits\",\n label: \"Accept edits\",\n description: \"Automatically accept file edit operations.\",\n },\n {\n value: \"dontAsk\",\n label: \"Don't ask\",\n description: \"Do not prompt; deny actions that are not pre-approved.\",\n },\n {\n value: \"plan\",\n label: \"Plan\",\n description: \"Planning mode with no tool execution.\",\n },\n {\n value: \"bypassPermissions\",\n label: \"Bypass\",\n description:\n \"Bypass permission checks when explicitly allowed by the host.\",\n },\n];\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\nexport type ToolMode = \"on\" | \"ask\" | \"off\" | \"auto\";\n\nexport interface ToolAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Display title of the tool's parent surface/entity (e.g. \"Xero Accounts\").\n * Used to nest tools under their entity within a group, and as the\n * disambiguating prefix in flat lists so sibling verbs (\"List\", \"Get\") stay\n * distinguishable. Resolved from the operation's `x-clicky.surface`. */\n parent?: string;\n /** Raw entity name of the tool's surface (e.g. \"accounts\"), when known. */\n entity?: string;\n /** Preference key sent to the backend. Defaults to `name`; group-backed\n * clicky tools set this to the backend tool group. */\n preferenceKey?: string;\n /** Initial backend-owned permission when the chat window first sees this tool. */\n defaultPermission?: ToolMode;\n /** Opaque icon name emitted by the backend, resolved by the host UI. */\n icon?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** Short usage hints shown in the tool browser. */\n hints?: string[];\n source?: \"clicky\" | \"custom\" | \"mcp\" | string;\n server?: string;\n method?: string;\n path?: string;\n operationName?: string;\n title?: string;\n /** Whether the runtime should treat the tool input schema as strict/closed. */\n strict?: boolean;\n /** Runtime tool annotations/hints, e.g. MCP/Genkit well-known hints. */\n annotations?: ToolAnnotations;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n outputSchema?: ChatToolInputSchema;\n}\n\nexport type ChatToolInputSchema = JsonSchemaObject;\nexport type JsonSchemaProperty = FormJsonSchemaProperty;\nexport type JSONSchemaProperty = FormJsonSchemaProperty;\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: {\n type: string;\n}): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n\nexport interface ToolResultRenderArgs {\n part: AnyToolPart;\n toolName: string;\n output: unknown;\n}\n\nexport type ToolResultRenderer = (args: ToolResultRenderArgs) => ReactNode;\n"],"names":[],"mappings":"AA+JO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAEJ;AAC1B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAQO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,iCAA+D;AAAA,EAC1E;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAEN;AAgEO,SAAS,kBAAkB,MAEJ;AAC5B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;"}
|
|
@@ -10,7 +10,16 @@ function usageSnapshotFromMetadata(metadata, options) {
|
|
|
10
10
|
...cost != null ? { cost } : {},
|
|
11
11
|
...metadata.usage ? { usage: metadata.usage } : {},
|
|
12
12
|
...metadata.costBreakdown ? { costBreakdown: metadata.costBreakdown } : {},
|
|
13
|
-
...
|
|
13
|
+
...metadata.backend !== void 0 ? { backend: metadata.backend } : {},
|
|
14
|
+
...metadata.executionMode !== void 0 ? { executionMode: metadata.executionMode } : {},
|
|
15
|
+
...metadata.model !== void 0 ? { model: metadata.model } : {},
|
|
16
|
+
...metadata.model !== void 0 && options.modelLabel ? { modelLabel: options.modelLabel } : {},
|
|
17
|
+
...metadata.captainSessionId !== void 0 ? { captainSessionId: metadata.captainSessionId } : {},
|
|
18
|
+
...metadata.providerSessionId !== void 0 ? { providerSessionId: metadata.providerSessionId } : {},
|
|
19
|
+
...metadata.threadId !== void 0 ? { threadId: metadata.threadId } : {},
|
|
20
|
+
...metadata.turnId !== void 0 ? { turnId: metadata.turnId } : {},
|
|
21
|
+
...metadata.success !== void 0 ? { success: metadata.success } : {},
|
|
22
|
+
...metadata.interrupted !== void 0 ? { interrupted: metadata.interrupted } : {}
|
|
14
23
|
};
|
|
15
24
|
}
|
|
16
25
|
exports.usageSnapshotFromMetadata = usageSnapshotFromMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-snapshot.cjs","sources":["../../../src/data/chat/usage-snapshot.ts"],"sourcesContent":["import type { ChatMessageMetadata, ChatUsageSummary } from \"./types\";\n\n/**\n * Builds the usage snapshot a chat surfaces (gauge, hover card, config panel)\n * from the last settled assistant turn's metadata.\n *\n * The cost precedence matters: `threadCostUsd` is the conversation's running\n * total, while `cost` is only the turn that just finished. Preferring the\n * cumulative figure is what makes the meter report what the conversation has\n * actually spent — on a multi-turn thread the two differ by roughly the number\n * of turns taken. Backends that do not report a thread total still degrade to\n * the per-turn value rather than showing nothing.\n *\n * Token fields stay per-turn; the whole-conversation breakdown is served\n * separately by the thread costs endpoint.\n */\nexport function usageSnapshotFromMetadata(\n metadata: ChatMessageMetadata,\n options: {
|
|
1
|
+
{"version":3,"file":"usage-snapshot.cjs","sources":["../../../src/data/chat/usage-snapshot.ts"],"sourcesContent":["import type { ChatMessageMetadata, ChatUsageSummary } from \"./types\";\n\n/**\n * Builds the usage snapshot a chat surfaces (gauge, hover card, config panel)\n * from the last settled assistant turn's metadata.\n *\n * The cost precedence matters: `threadCostUsd` is the conversation's running\n * total, while `cost` is only the turn that just finished. Preferring the\n * cumulative figure is what makes the meter report what the conversation has\n * actually spent — on a multi-turn thread the two differ by roughly the number\n * of turns taken. Backends that do not report a thread total still degrade to\n * the per-turn value rather than showing nothing.\n *\n * Token fields stay per-turn; the whole-conversation breakdown is served\n * separately by the thread costs endpoint.\n */\nexport function usageSnapshotFromMetadata(\n metadata: ChatMessageMetadata,\n options: {\n contextWindow?: number | undefined;\n modelLabel?: string | undefined;\n messageCount: number;\n },\n): ChatUsageSummary {\n const cost =\n metadata.threadCostUsd ?? metadata.costBreakdown?.totalUsd ?? metadata.cost;\n return {\n usedTokens: metadata.contextTokens ?? metadata.usage?.totalTokens ?? 0,\n maxTokens: options.contextWindow ?? 0,\n messageCount: options.messageCount,\n ...(cost != null ? { cost } : {}),\n ...(metadata.usage ? { usage: metadata.usage } : {}),\n ...(metadata.costBreakdown ? { costBreakdown: metadata.costBreakdown } : {}),\n ...(metadata.backend !== undefined ? { backend: metadata.backend } : {}),\n ...(metadata.executionMode !== undefined\n ? { executionMode: metadata.executionMode }\n : {}),\n ...(metadata.model !== undefined ? { model: metadata.model } : {}),\n ...(metadata.model !== undefined && options.modelLabel\n ? { modelLabel: options.modelLabel }\n : {}),\n ...(metadata.captainSessionId !== undefined\n ? { captainSessionId: metadata.captainSessionId }\n : {}),\n ...(metadata.providerSessionId !== undefined\n ? { providerSessionId: metadata.providerSessionId }\n : {}),\n ...(metadata.threadId !== undefined ? { threadId: metadata.threadId } : {}),\n ...(metadata.turnId !== undefined ? { turnId: metadata.turnId } : {}),\n ...(metadata.success !== undefined ? { success: metadata.success } : {}),\n ...(metadata.interrupted !== undefined\n ? { interrupted: metadata.interrupted }\n : {}),\n };\n}\n"],"names":[],"mappings":";;AAgBO,SAAS,0BACd,UACA,SAKkB;;AAClB,QAAM,OACJ,SAAS,mBAAiB,cAAS,kBAAT,mBAAwB,aAAY,SAAS;AACzE,SAAO;AAAA,IACL,YAAY,SAAS,mBAAiB,cAAS,UAAT,mBAAgB,gBAAe;AAAA,IACrE,WAAW,QAAQ,iBAAiB;AAAA,IACpC,cAAc,QAAQ;AAAA,IACtB,GAAI,QAAQ,OAAO,EAAE,KAAA,IAAS,CAAA;AAAA,IAC9B,GAAI,SAAS,QAAQ,EAAE,OAAO,SAAS,MAAA,IAAU,CAAA;AAAA,IACjD,GAAI,SAAS,gBAAgB,EAAE,eAAe,SAAS,cAAA,IAAkB,CAAA;AAAA,IACzE,GAAI,SAAS,YAAY,SAAY,EAAE,SAAS,SAAS,QAAA,IAAY,CAAA;AAAA,IACrE,GAAI,SAAS,kBAAkB,SAC3B,EAAE,eAAe,SAAS,cAAA,IAC1B,CAAA;AAAA,IACJ,GAAI,SAAS,UAAU,SAAY,EAAE,OAAO,SAAS,MAAA,IAAU,CAAA;AAAA,IAC/D,GAAI,SAAS,UAAU,UAAa,QAAQ,aACxC,EAAE,YAAY,QAAQ,WAAA,IACtB,CAAA;AAAA,IACJ,GAAI,SAAS,qBAAqB,SAC9B,EAAE,kBAAkB,SAAS,iBAAA,IAC7B,CAAA;AAAA,IACJ,GAAI,SAAS,sBAAsB,SAC/B,EAAE,mBAAmB,SAAS,kBAAA,IAC9B,CAAA;AAAA,IACJ,GAAI,SAAS,aAAa,SAAY,EAAE,UAAU,SAAS,SAAA,IAAa,CAAA;AAAA,IACxE,GAAI,SAAS,WAAW,SAAY,EAAE,QAAQ,SAAS,OAAA,IAAW,CAAA;AAAA,IAClE,GAAI,SAAS,YAAY,SAAY,EAAE,SAAS,SAAS,QAAA,IAAY,CAAA;AAAA,IACrE,GAAI,SAAS,gBAAgB,SACzB,EAAE,aAAa,SAAS,gBACxB,CAAA;AAAA,EAAC;AAET;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-snapshot.d.ts","sourceRoot":"","sources":["../../../src/data/chat/usage-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"usage-snapshot.d.ts","sourceRoot":"","sources":["../../../src/data/chat/usage-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE;IACP,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;CACtB,GACA,gBAAgB,CA+BlB"}
|
|
@@ -8,7 +8,16 @@ function usageSnapshotFromMetadata(metadata, options) {
|
|
|
8
8
|
...cost != null ? { cost } : {},
|
|
9
9
|
...metadata.usage ? { usage: metadata.usage } : {},
|
|
10
10
|
...metadata.costBreakdown ? { costBreakdown: metadata.costBreakdown } : {},
|
|
11
|
-
...
|
|
11
|
+
...metadata.backend !== void 0 ? { backend: metadata.backend } : {},
|
|
12
|
+
...metadata.executionMode !== void 0 ? { executionMode: metadata.executionMode } : {},
|
|
13
|
+
...metadata.model !== void 0 ? { model: metadata.model } : {},
|
|
14
|
+
...metadata.model !== void 0 && options.modelLabel ? { modelLabel: options.modelLabel } : {},
|
|
15
|
+
...metadata.captainSessionId !== void 0 ? { captainSessionId: metadata.captainSessionId } : {},
|
|
16
|
+
...metadata.providerSessionId !== void 0 ? { providerSessionId: metadata.providerSessionId } : {},
|
|
17
|
+
...metadata.threadId !== void 0 ? { threadId: metadata.threadId } : {},
|
|
18
|
+
...metadata.turnId !== void 0 ? { turnId: metadata.turnId } : {},
|
|
19
|
+
...metadata.success !== void 0 ? { success: metadata.success } : {},
|
|
20
|
+
...metadata.interrupted !== void 0 ? { interrupted: metadata.interrupted } : {}
|
|
12
21
|
};
|
|
13
22
|
}
|
|
14
23
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-snapshot.js","sources":["../../../src/data/chat/usage-snapshot.ts"],"sourcesContent":["import type { ChatMessageMetadata, ChatUsageSummary } from \"./types\";\n\n/**\n * Builds the usage snapshot a chat surfaces (gauge, hover card, config panel)\n * from the last settled assistant turn's metadata.\n *\n * The cost precedence matters: `threadCostUsd` is the conversation's running\n * total, while `cost` is only the turn that just finished. Preferring the\n * cumulative figure is what makes the meter report what the conversation has\n * actually spent — on a multi-turn thread the two differ by roughly the number\n * of turns taken. Backends that do not report a thread total still degrade to\n * the per-turn value rather than showing nothing.\n *\n * Token fields stay per-turn; the whole-conversation breakdown is served\n * separately by the thread costs endpoint.\n */\nexport function usageSnapshotFromMetadata(\n metadata: ChatMessageMetadata,\n options: {
|
|
1
|
+
{"version":3,"file":"usage-snapshot.js","sources":["../../../src/data/chat/usage-snapshot.ts"],"sourcesContent":["import type { ChatMessageMetadata, ChatUsageSummary } from \"./types\";\n\n/**\n * Builds the usage snapshot a chat surfaces (gauge, hover card, config panel)\n * from the last settled assistant turn's metadata.\n *\n * The cost precedence matters: `threadCostUsd` is the conversation's running\n * total, while `cost` is only the turn that just finished. Preferring the\n * cumulative figure is what makes the meter report what the conversation has\n * actually spent — on a multi-turn thread the two differ by roughly the number\n * of turns taken. Backends that do not report a thread total still degrade to\n * the per-turn value rather than showing nothing.\n *\n * Token fields stay per-turn; the whole-conversation breakdown is served\n * separately by the thread costs endpoint.\n */\nexport function usageSnapshotFromMetadata(\n metadata: ChatMessageMetadata,\n options: {\n contextWindow?: number | undefined;\n modelLabel?: string | undefined;\n messageCount: number;\n },\n): ChatUsageSummary {\n const cost =\n metadata.threadCostUsd ?? metadata.costBreakdown?.totalUsd ?? metadata.cost;\n return {\n usedTokens: metadata.contextTokens ?? metadata.usage?.totalTokens ?? 0,\n maxTokens: options.contextWindow ?? 0,\n messageCount: options.messageCount,\n ...(cost != null ? { cost } : {}),\n ...(metadata.usage ? { usage: metadata.usage } : {}),\n ...(metadata.costBreakdown ? { costBreakdown: metadata.costBreakdown } : {}),\n ...(metadata.backend !== undefined ? { backend: metadata.backend } : {}),\n ...(metadata.executionMode !== undefined\n ? { executionMode: metadata.executionMode }\n : {}),\n ...(metadata.model !== undefined ? { model: metadata.model } : {}),\n ...(metadata.model !== undefined && options.modelLabel\n ? { modelLabel: options.modelLabel }\n : {}),\n ...(metadata.captainSessionId !== undefined\n ? { captainSessionId: metadata.captainSessionId }\n : {}),\n ...(metadata.providerSessionId !== undefined\n ? { providerSessionId: metadata.providerSessionId }\n : {}),\n ...(metadata.threadId !== undefined ? { threadId: metadata.threadId } : {}),\n ...(metadata.turnId !== undefined ? { turnId: metadata.turnId } : {}),\n ...(metadata.success !== undefined ? { success: metadata.success } : {}),\n ...(metadata.interrupted !== undefined\n ? { interrupted: metadata.interrupted }\n : {}),\n };\n}\n"],"names":[],"mappings":"AAgBO,SAAS,0BACd,UACA,SAKkB;AAPb;AAQL,QAAM,OACJ,SAAS,mBAAiB,cAAS,kBAAT,mBAAwB,aAAY,SAAS;AACzE,SAAO;AAAA,IACL,YAAY,SAAS,mBAAiB,cAAS,UAAT,mBAAgB,gBAAe;AAAA,IACrE,WAAW,QAAQ,iBAAiB;AAAA,IACpC,cAAc,QAAQ;AAAA,IACtB,GAAI,QAAQ,OAAO,EAAE,KAAA,IAAS,CAAA;AAAA,IAC9B,GAAI,SAAS,QAAQ,EAAE,OAAO,SAAS,MAAA,IAAU,CAAA;AAAA,IACjD,GAAI,SAAS,gBAAgB,EAAE,eAAe,SAAS,cAAA,IAAkB,CAAA;AAAA,IACzE,GAAI,SAAS,YAAY,SAAY,EAAE,SAAS,SAAS,QAAA,IAAY,CAAA;AAAA,IACrE,GAAI,SAAS,kBAAkB,SAC3B,EAAE,eAAe,SAAS,cAAA,IAC1B,CAAA;AAAA,IACJ,GAAI,SAAS,UAAU,SAAY,EAAE,OAAO,SAAS,MAAA,IAAU,CAAA;AAAA,IAC/D,GAAI,SAAS,UAAU,UAAa,QAAQ,aACxC,EAAE,YAAY,QAAQ,WAAA,IACtB,CAAA;AAAA,IACJ,GAAI,SAAS,qBAAqB,SAC9B,EAAE,kBAAkB,SAAS,iBAAA,IAC7B,CAAA;AAAA,IACJ,GAAI,SAAS,sBAAsB,SAC/B,EAAE,mBAAmB,SAAS,kBAAA,IAC9B,CAAA;AAAA,IACJ,GAAI,SAAS,aAAa,SAAY,EAAE,UAAU,SAAS,SAAA,IAAa,CAAA;AAAA,IACxE,GAAI,SAAS,WAAW,SAAY,EAAE,QAAQ,SAAS,OAAA,IAAW,CAAA;AAAA,IAClE,GAAI,SAAS,YAAY,SAAY,EAAE,SAAS,SAAS,QAAA,IAAY,CAAA;AAAA,IACrE,GAAI,SAAS,gBAAgB,SACzB,EAAE,aAAa,SAAS,gBACxB,CAAA;AAAA,EAAC;AAET;"}
|
|
@@ -15,9 +15,9 @@ function detectMode() {
|
|
|
15
15
|
}
|
|
16
16
|
function getVersionInfo() {
|
|
17
17
|
return {
|
|
18
|
-
commit: read(() => "
|
|
19
|
-
tag: read(() => "clicky-ui@0.3.
|
|
20
|
-
date: read(() => "2026-08-
|
|
18
|
+
commit: read(() => "a382bd66", ""),
|
|
19
|
+
tag: read(() => "clicky-ui@0.3.24", ""),
|
|
20
|
+
date: read(() => "2026-08-21T13:51:46.739Z", ""),
|
|
21
21
|
dirty: read(() => true, false),
|
|
22
22
|
mode: detectMode()
|
|
23
23
|
};
|
|
@@ -13,9 +13,9 @@ function detectMode() {
|
|
|
13
13
|
}
|
|
14
14
|
function getVersionInfo() {
|
|
15
15
|
return {
|
|
16
|
-
commit: read(() => "
|
|
17
|
-
tag: read(() => "clicky-ui@0.3.
|
|
18
|
-
date: read(() => "2026-08-
|
|
16
|
+
commit: read(() => "a382bd66", ""),
|
|
17
|
+
tag: read(() => "clicky-ui@0.3.24", ""),
|
|
18
|
+
date: read(() => "2026-08-21T13:51:23.496Z", ""),
|
|
19
19
|
dirty: read(() => true, false),
|
|
20
20
|
mode: detectMode()
|
|
21
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flanksource/clicky-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"description": "Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.",
|
|
5
5
|
"homepage": "https://github.com/flanksource/clicky-ui#readme",
|
|
6
6
|
"bugs": "https://github.com/flanksource/clicky-ui/issues",
|