@vybestack/llxprt-code-core 0.1.23-nightly.250829.6bacfcba → 0.1.23-nightly.250902.c3d3686d

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.
Files changed (51) hide show
  1. package/dist/src/code_assist/codeAssist.js +17 -6
  2. package/dist/src/code_assist/codeAssist.js.map +1 -1
  3. package/dist/src/code_assist/server.js +15 -4
  4. package/dist/src/code_assist/server.js.map +1 -1
  5. package/dist/src/code_assist/setup.js +7 -0
  6. package/dist/src/code_assist/setup.js.map +1 -1
  7. package/dist/src/core/ContentGeneratorAdapter.d.ts +37 -0
  8. package/dist/src/core/ContentGeneratorAdapter.js +58 -0
  9. package/dist/src/core/ContentGeneratorAdapter.js.map +1 -0
  10. package/dist/src/core/client.d.ts +9 -2
  11. package/dist/src/core/client.js +111 -36
  12. package/dist/src/core/client.js.map +1 -1
  13. package/dist/src/core/compression-config.d.ts +10 -0
  14. package/dist/src/core/compression-config.js +18 -0
  15. package/dist/src/core/compression-config.js.map +1 -0
  16. package/dist/src/core/geminiChat.d.ts +8 -2
  17. package/dist/src/core/geminiChat.js +148 -32
  18. package/dist/src/core/geminiChat.js.map +1 -1
  19. package/dist/src/core/prompts.js +4 -2
  20. package/dist/src/core/prompts.js.map +1 -1
  21. package/dist/src/index.d.ts +2 -0
  22. package/dist/src/index.js +2 -0
  23. package/dist/src/index.js.map +1 -1
  24. package/dist/src/providers/BaseProvider.d.ts +1 -1
  25. package/dist/src/providers/BaseProvider.js.map +1 -1
  26. package/dist/src/providers/anthropic/AnthropicProvider.js +1 -1
  27. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  28. package/dist/src/providers/gemini/GeminiProvider.js +100 -36
  29. package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
  30. package/dist/src/providers/openai/OpenAIProvider.d.ts +54 -25
  31. package/dist/src/providers/openai/OpenAIProvider.js +528 -984
  32. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  33. package/dist/src/providers/openai-responses/OpenAIResponsesProvider.d.ts +91 -0
  34. package/dist/src/providers/openai-responses/OpenAIResponsesProvider.js +440 -0
  35. package/dist/src/providers/openai-responses/OpenAIResponsesProvider.js.map +1 -0
  36. package/dist/src/providers/openai-responses/index.d.ts +1 -0
  37. package/dist/src/providers/openai-responses/index.js +2 -0
  38. package/dist/src/providers/openai-responses/index.js.map +1 -0
  39. package/dist/src/services/history/ContentConverters.d.ts +38 -0
  40. package/dist/src/services/history/ContentConverters.js +188 -0
  41. package/dist/src/services/history/ContentConverters.js.map +1 -0
  42. package/dist/src/services/history/HistoryEvents.d.ts +32 -0
  43. package/dist/src/services/history/HistoryEvents.js +17 -0
  44. package/dist/src/services/history/HistoryEvents.js.map +1 -0
  45. package/dist/src/services/history/HistoryService.d.ts +168 -0
  46. package/dist/src/services/history/HistoryService.js +521 -0
  47. package/dist/src/services/history/HistoryService.js.map +1 -0
  48. package/dist/src/services/history/IContent.d.ts +179 -0
  49. package/dist/src/services/history/IContent.js +104 -0
  50. package/dist/src/services/history/IContent.js.map +1 -0
  51. package/package.json +1 -1
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Copyright 2025 Vybestack LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Universal content representation that is provider-agnostic.
18
+ * All conversation content is represented as blocks within a speaker's turn.
19
+ */
20
+ export interface IContent {
21
+ /**
22
+ * Who is speaking in this content
23
+ * - 'human': The user
24
+ * - 'ai': The AI assistant
25
+ * - 'tool': A tool/function response
26
+ */
27
+ speaker: 'human' | 'ai' | 'tool';
28
+ /**
29
+ * Array of content blocks that make up this message.
30
+ * A message can contain multiple blocks of different types.
31
+ */
32
+ blocks: ContentBlock[];
33
+ /**
34
+ * Optional metadata for the content
35
+ */
36
+ metadata?: ContentMetadata;
37
+ }
38
+ /**
39
+ * Metadata associated with content
40
+ */
41
+ export interface ContentMetadata {
42
+ /** When this content was created */
43
+ timestamp?: number;
44
+ /** Which model generated this (for AI responses) */
45
+ model?: string;
46
+ /** Token usage statistics */
47
+ usage?: UsageStats;
48
+ /** Unique identifier for this content */
49
+ id?: string;
50
+ /** Provider that generated this content */
51
+ provider?: string;
52
+ /** Whether this is a summary of previous messages */
53
+ isSummary?: boolean;
54
+ /** Additional provider-specific metadata */
55
+ providerMetadata?: Record<string, unknown>;
56
+ }
57
+ /**
58
+ * Token usage statistics
59
+ */
60
+ export interface UsageStats {
61
+ promptTokens: number;
62
+ completionTokens: number;
63
+ totalTokens: number;
64
+ }
65
+ /**
66
+ * Union type of all possible content blocks
67
+ */
68
+ export type ContentBlock = TextBlock | ToolCallBlock | ToolResponseBlock | MediaBlock | ThinkingBlock | CodeBlock;
69
+ /**
70
+ * Regular text content
71
+ */
72
+ export interface TextBlock {
73
+ type: 'text';
74
+ text: string;
75
+ }
76
+ /**
77
+ * AI calling a tool/function
78
+ */
79
+ export interface ToolCallBlock {
80
+ type: 'tool_call';
81
+ /** Unique identifier for this tool call */
82
+ id: string;
83
+ /** Name of the tool being called */
84
+ name: string;
85
+ /** Parameters passed to the tool (must be JSON-serializable) */
86
+ parameters: unknown;
87
+ /** Optional description of what this tool call is intended to do */
88
+ description?: string;
89
+ }
90
+ /**
91
+ * Response from a tool/function call
92
+ */
93
+ export interface ToolResponseBlock {
94
+ type: 'tool_response';
95
+ /** References the ToolCallBlock.id this is responding to */
96
+ callId: string;
97
+ /** The tool that generated this response */
98
+ toolName: string;
99
+ /** Result from the tool (must be JSON-serializable) */
100
+ result: unknown;
101
+ /** Error message if the tool call failed */
102
+ error?: string;
103
+ /** Whether this response completes the tool call */
104
+ isComplete?: boolean;
105
+ }
106
+ /**
107
+ * Media content (images, files, etc.)
108
+ */
109
+ export interface MediaBlock {
110
+ type: 'media';
111
+ /** MIME type of the media */
112
+ mimeType: string;
113
+ /** Either a URL or base64-encoded data */
114
+ data: string;
115
+ /** Whether data is a URL or base64 */
116
+ encoding: 'url' | 'base64';
117
+ /** Optional caption or alt text */
118
+ caption?: string;
119
+ /** Original filename if applicable */
120
+ filename?: string;
121
+ }
122
+ /**
123
+ * Thinking/reasoning content (for models that support it)
124
+ */
125
+ export interface ThinkingBlock {
126
+ type: 'thinking';
127
+ /** The thinking/reasoning text */
128
+ thought: string;
129
+ /** Whether this thinking should be hidden from the user */
130
+ isHidden?: boolean;
131
+ }
132
+ /**
133
+ * Code content with syntax highlighting support
134
+ */
135
+ export interface CodeBlock {
136
+ type: 'code';
137
+ /** The code content */
138
+ code: string;
139
+ /** Programming language for syntax highlighting */
140
+ language?: string;
141
+ /** Optional filename this code is from/for */
142
+ filename?: string;
143
+ /** Whether this code was executed */
144
+ executed?: boolean;
145
+ /** Execution result if executed */
146
+ executionResult?: unknown;
147
+ }
148
+ /**
149
+ * Helper type guards for content blocks
150
+ */
151
+ export declare const ContentBlockGuards: {
152
+ isTextBlock: (block: ContentBlock) => block is TextBlock;
153
+ isToolCallBlock: (block: ContentBlock) => block is ToolCallBlock;
154
+ isToolResponseBlock: (block: ContentBlock) => block is ToolResponseBlock;
155
+ isMediaBlock: (block: ContentBlock) => block is MediaBlock;
156
+ isThinkingBlock: (block: ContentBlock) => block is ThinkingBlock;
157
+ isCodeBlock: (block: ContentBlock) => block is CodeBlock;
158
+ };
159
+ /**
160
+ * Helper to create IContent instances
161
+ */
162
+ export declare const ContentFactory: {
163
+ createUserMessage: (text: string, metadata?: ContentMetadata) => IContent;
164
+ createAIMessage: (blocks: ContentBlock[], metadata?: ContentMetadata) => IContent;
165
+ createToolResponse: (callId: string, toolName: string, result: unknown, error?: string, metadata?: ContentMetadata) => IContent;
166
+ };
167
+ /**
168
+ * Validation helpers
169
+ */
170
+ export declare const ContentValidation: {
171
+ /**
172
+ * Check if content has meaningful content (not empty)
173
+ */
174
+ hasContent: (content: IContent) => boolean;
175
+ /**
176
+ * Check if content is valid for inclusion in history
177
+ */
178
+ isValid: (content: IContent) => boolean;
179
+ };
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Copyright 2025 Vybestack LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Helper type guards for content blocks
18
+ */
19
+ export const ContentBlockGuards = {
20
+ isTextBlock: (block) => block.type === 'text',
21
+ isToolCallBlock: (block) => block.type === 'tool_call',
22
+ isToolResponseBlock: (block) => block.type === 'tool_response',
23
+ isMediaBlock: (block) => block.type === 'media',
24
+ isThinkingBlock: (block) => block.type === 'thinking',
25
+ isCodeBlock: (block) => block.type === 'code',
26
+ };
27
+ /**
28
+ * Helper to create IContent instances
29
+ */
30
+ export const ContentFactory = {
31
+ createUserMessage: (text, metadata) => ({
32
+ speaker: 'human',
33
+ blocks: [{ type: 'text', text }],
34
+ metadata,
35
+ }),
36
+ createAIMessage: (blocks, metadata) => ({
37
+ speaker: 'ai',
38
+ blocks,
39
+ metadata,
40
+ }),
41
+ createToolResponse: (callId, toolName, result, error, metadata) => ({
42
+ speaker: 'tool',
43
+ blocks: [
44
+ {
45
+ type: 'tool_response',
46
+ callId,
47
+ toolName,
48
+ result,
49
+ error,
50
+ },
51
+ ],
52
+ metadata,
53
+ }),
54
+ };
55
+ /**
56
+ * Validation helpers
57
+ */
58
+ export const ContentValidation = {
59
+ /**
60
+ * Check if content has meaningful content (not empty)
61
+ */
62
+ hasContent: (content) => {
63
+ if (!content.blocks || content.blocks.length === 0) {
64
+ return false;
65
+ }
66
+ return content.blocks.some((block) => {
67
+ switch (block.type) {
68
+ case 'text':
69
+ return block.text.trim().length > 0;
70
+ case 'tool_call':
71
+ case 'tool_response':
72
+ case 'media':
73
+ case 'code':
74
+ return true;
75
+ case 'thinking':
76
+ return block.thought.trim().length > 0;
77
+ default:
78
+ return false;
79
+ }
80
+ });
81
+ },
82
+ /**
83
+ * Check if content is valid for inclusion in history
84
+ */
85
+ isValid: (content) => {
86
+ // Must have a valid speaker
87
+ if (!['human', 'ai', 'tool'].includes(content.speaker)) {
88
+ return false;
89
+ }
90
+ // Must have at least one block
91
+ if (!content.blocks || content.blocks.length === 0) {
92
+ return false;
93
+ }
94
+ // Tool responses must have tool_response blocks
95
+ if (content.speaker === 'tool') {
96
+ const hasToolResponse = content.blocks.some((b) => b.type === 'tool_response');
97
+ if (!hasToolResponse) {
98
+ return false;
99
+ }
100
+ }
101
+ return true;
102
+ },
103
+ };
104
+ //# sourceMappingURL=IContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IContent.js","sourceRoot":"","sources":["../../../../src/services/history/IContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmLH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,CAAC,KAAmB,EAAsB,EAAE,CACvD,KAAK,CAAC,IAAI,KAAK,MAAM;IAEvB,eAAe,EAAE,CAAC,KAAmB,EAA0B,EAAE,CAC/D,KAAK,CAAC,IAAI,KAAK,WAAW;IAE5B,mBAAmB,EAAE,CAAC,KAAmB,EAA8B,EAAE,CACvE,KAAK,CAAC,IAAI,KAAK,eAAe;IAEhC,YAAY,EAAE,CAAC,KAAmB,EAAuB,EAAE,CACzD,KAAK,CAAC,IAAI,KAAK,O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AAC,MAAM,GAAG,CAAC,CAAC;gBACtC,KAAK,WAAW,CAAC;gBACjB,KAAK,eAAe,CAAC;gBACrB,KAAK,OAAO,CAAC;gBACb,KAAK,MAAM;oBACT,OAAO,IAAI,CAAC;gBACd,KAAK,UAAU;oBACb,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;gBACzC;oBACE,OAAO,KAAK,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,OAAO,EAAE,CAAC,OAAiB,EAAW,EAAE;QACtC,4BAA4B;QAC5B,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,gDAAgD;QAChD,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC/B,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CACzC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAClC,CAAC;YACF,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vybestack/llxprt-code-core",
3
- "version": "0.1.23-nightly.250829.6bacfcba",
3
+ "version": "0.1.23-nightly.250902.c3d3686d",
4
4
  "description": "LLxprt Code Core",
5
5
  "repository": {
6
6
  "type": "git",