@qwanyx/stack 0.2.74 → 0.2.76

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.
@@ -0,0 +1,86 @@
1
+ /**
2
+ * LLMClient - AI/LLM Communication Layer
3
+ *
4
+ * Provides a type-safe interface to the qwanyx-brain LLM coprocessor.
5
+ * All operations communicate through the unified `/spu/invoke` endpoint.
6
+ */
7
+ export type QwanyxModel = 'xlm' | 'mlm' | 'nlm';
8
+ export interface LLMClientConfig {
9
+ baseUrl: string;
10
+ system_id: string;
11
+ }
12
+ export interface ChatMessage {
13
+ role: 'system' | 'user' | 'assistant';
14
+ content: string;
15
+ }
16
+ export interface AnalyzeDocumentFile {
17
+ filename: string;
18
+ data: string;
19
+ content_type: string;
20
+ }
21
+ export declare class LLMClient {
22
+ private config;
23
+ constructor(config: LLMClientConfig);
24
+ /**
25
+ * Call the LLM coprocessor
26
+ */
27
+ private callLLM;
28
+ /**
29
+ * Get auth token from localStorage (browser) or return empty string
30
+ */
31
+ private getToken;
32
+ /**
33
+ * Simple text completion
34
+ */
35
+ complete(prompt: string, options?: {
36
+ model?: QwanyxModel;
37
+ systemPrompt?: string;
38
+ temperature?: number;
39
+ maxTokens?: number;
40
+ }): Promise<string>;
41
+ /**
42
+ * Chat completion with messages
43
+ */
44
+ chat(messages: ChatMessage[], options?: {
45
+ model?: QwanyxModel;
46
+ temperature?: number;
47
+ maxTokens?: number;
48
+ }): Promise<string>;
49
+ /**
50
+ * Chat completion with JSON response
51
+ * Automatically parses the response and strips markdown code blocks
52
+ */
53
+ chatJson<T>(systemPrompt: string, userPrompt: string, options?: {
54
+ model?: QwanyxModel;
55
+ temperature?: number;
56
+ }): Promise<T>;
57
+ /**
58
+ * Analyze documents (PDF, images, text files) via base64 encoding
59
+ */
60
+ analyzeDocuments(prompt: string, files: AnalyzeDocumentFile[], options?: {
61
+ model?: QwanyxModel;
62
+ temperature?: number;
63
+ maxTokens?: number;
64
+ }): Promise<string>;
65
+ /**
66
+ * Transcribe audio to text
67
+ */
68
+ transcribe(audioData: string, // base64 encoded
69
+ options?: {
70
+ filename?: string;
71
+ language?: string;
72
+ }): Promise<string>;
73
+ private promptCache;
74
+ /**
75
+ * Get a prompt template from the server
76
+ */
77
+ getPrompt(name: string): Promise<string>;
78
+ /**
79
+ * Clear prompt cache (useful when prompts are updated)
80
+ */
81
+ clearPromptCache(): void;
82
+ /**
83
+ * Replace {{placeholders}} in a prompt template
84
+ */
85
+ buildPrompt(template: string, context: Record<string, string>): string;
86
+ }
@@ -11,4 +11,4 @@
11
11
  */
12
12
  import { GraphNode } from '../../types';
13
13
  import type { QMapProps } from './types';
14
- export declare function QMap<T extends GraphNode = GraphNode>({ viewNode, nodes, edges, renderNode, defaultNodeWidth, defaultNodeHeight, onNodeMove, onNodeClick, onNodeDoubleClick, onNodeContextMenu, onSelectionChange, onEdgeClick, onViewChange, onTransformChange, minZoom, maxZoom, initialTransform, defaultEdgeStyle, defaultEdgeColor, defaultEdgeWidth, draggable, selectable, zoomable, pannable, className, style, background, showGrid, gridSize }: QMapProps<T>): import("react/jsx-runtime").JSX.Element;
14
+ export declare function QMap<T extends GraphNode = GraphNode>({ viewNode, nodes, edges, renderNode, defaultNodeWidth, defaultNodeHeight, onNodeMove, onNodeClick, onNodeDoubleClick, onNodeContextMenu, selectedIds: controlledSelectedIds, onSelectionChange, onEdgeClick, onViewChange, onTransformChange, minZoom, maxZoom, initialTransform, defaultEdgeStyle, defaultEdgeColor, defaultEdgeWidth, draggable, selectable, zoomable, pannable, className, style, background, showGrid, gridSize }: QMapProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -12,6 +12,8 @@ export interface UseSelectionOptions {
12
12
  transform: QMapTransform;
13
13
  nodePositions: Map<string, QMapNodePosition>;
14
14
  disabled?: boolean;
15
+ /** Controlled selection - if provided, uses this instead of internal state */
16
+ controlledSelectedIds?: string[];
15
17
  onSelectionChange?: (selectedIds: string[]) => void;
16
18
  }
17
19
  export declare function useSelection(options: UseSelectionOptions): UseSelectionReturn;
@@ -50,6 +50,8 @@ export interface QMapProps<T extends GraphNode = GraphNode> {
50
50
  onNodeClick?: (node: T, event: React.MouseEvent) => void;
51
51
  onNodeDoubleClick?: (node: T, event: React.MouseEvent) => void;
52
52
  onNodeContextMenu?: (node: T, event: React.MouseEvent) => void;
53
+ /** Controlled selection - if provided, component uses this instead of internal state */
54
+ selectedIds?: string[];
53
55
  onSelectionChange?: (selectedIds: string[]) => void;
54
56
  onEdgeClick?: (edge: QMapEdge, event: React.MouseEvent) => void;
55
57
  onViewChange?: (viewData: QMapViewData) => void;