@kkeve/suite 0.0.1 → 0.0.2

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 (152) hide show
  1. package/README.md +53 -0
  2. package/dist/bin/keve.d.ts +13 -0
  3. package/dist/bin/keve.js +164 -0
  4. package/dist/commands/auth-update.d.ts +16 -0
  5. package/dist/commands/auth-update.js +88 -0
  6. package/dist/commands/clean.d.ts +10 -0
  7. package/dist/commands/clean.js +78 -0
  8. package/dist/commands/config.d.ts +17 -0
  9. package/dist/commands/config.js +99 -0
  10. package/dist/commands/init.d.ts +15 -0
  11. package/dist/commands/init.js +292 -0
  12. package/dist/commands/report.d.ts +12 -0
  13. package/dist/commands/report.js +159 -0
  14. package/dist/commands/run.d.ts +29 -0
  15. package/dist/commands/run.js +417 -0
  16. package/dist/commands/test.d.ts +12 -0
  17. package/dist/commands/test.js +102 -0
  18. package/dist/commands/vitest.d.ts +14 -0
  19. package/dist/commands/vitest.js +166 -0
  20. package/dist/config.d.ts +109 -0
  21. package/dist/config.js +291 -0
  22. package/dist/core/action-log-writer.d.ts +47 -0
  23. package/dist/{tools/write-file.js → core/action-log-writer.js} +42 -26
  24. package/dist/core/auth.d.ts +17 -0
  25. package/dist/core/auth.js +224 -0
  26. package/dist/core/cdp-resolver.d.ts +5 -0
  27. package/dist/core/cdp-resolver.js +93 -0
  28. package/dist/core/generateReport/report.d.ts +19 -0
  29. package/dist/core/generateReport/report.js +91 -0
  30. package/dist/core/generateReport/reportData.d.ts +215 -0
  31. package/dist/core/generateReport/reportData.js +735 -0
  32. package/dist/core/global-setup.d.ts +6 -0
  33. package/dist/core/global-setup.js +113 -0
  34. package/dist/core/keve-aspect.d.ts +54 -0
  35. package/dist/core/keve-aspect.js +52 -0
  36. package/dist/core/keve-decorators.d.ts +51 -0
  37. package/dist/core/keve-decorators.js +95 -0
  38. package/dist/core/keve-registry.d.ts +38 -0
  39. package/dist/core/keve-registry.js +25 -0
  40. package/dist/core/keve-report.d.ts +27 -0
  41. package/dist/core/keve-report.js +357 -0
  42. package/dist/core/keve-test.d.ts +36 -0
  43. package/dist/core/keve-test.js +364 -0
  44. package/dist/core/learned-actions.d.ts +24 -0
  45. package/dist/core/learned-actions.js +65 -0
  46. package/dist/core/pw-config.d.ts +19 -0
  47. package/dist/core/pw-config.js +180 -0
  48. package/dist/index.d.ts +8 -23
  49. package/dist/index.js +36 -43
  50. package/dist/page-agent/agent.d.ts +129 -0
  51. package/dist/page-agent/agent.js +585 -0
  52. package/dist/page-agent/hooks.d.ts +13 -0
  53. package/dist/page-agent/hooks.js +218 -0
  54. package/dist/page-agent/tools.d.ts +29 -0
  55. package/dist/page-agent/tools.js +297 -0
  56. package/doc/README.md +124 -0
  57. package/doc/agents/keve-dev-test-agent.md +140 -0
  58. package/doc/agents/keve-test-agent.md +178 -0
  59. package/doc/asserts//346/265/213/350/257/225/345/220/204/351/230/266/346/256/265/350/257/264/346/230/216.png +0 -0
  60. package/doc/keve-agent-demo.html +370 -0
  61. package/doc/skills/keve-bddcase-gen/SKILL.md +332 -0
  62. package/doc/skills/keve-bddcase-gen/references/test-case-rules.md +91 -0
  63. package/doc/skills/keve-bddcase-gen/references/test-cases-example.md +103 -0
  64. package/doc/skills/keve-component-gen/SKILL.md +255 -0
  65. package/doc/skills/keve-component-gen/references/component-mock-strategy.md +74 -0
  66. package/doc/skills/keve-component-gen/references/component-model-template.md +98 -0
  67. package/doc/skills/keve-component-gen/references/component-test-template.md +100 -0
  68. package/doc/skills/keve-component-gen/references/vue-test-utils-guide.md +91 -0
  69. package/doc/skills/keve-e2e-gen/SKILL.md +179 -0
  70. package/doc/skills/keve-e2e-gen/references/code-analysis-guide.md +208 -0
  71. package/doc/skills/keve-e2e-gen/references/decisions.md +36 -0
  72. package/doc/skills/keve-e2e-gen/references/pom-generation-guide.md +140 -0
  73. package/doc/skills/keve-e2e-gen/references/script-generation-guide.md +236 -0
  74. package/doc/skills/keve-e2e-gen/references/test-auditor-guide.md +189 -0
  75. package/doc/skills/keve-e2e-gen/scripts/extract-components.sh +85 -0
  76. package/doc/skills/keve-e2e-gen/scripts/inject-testids.sh +95 -0
  77. package/doc/skills/keve-static-analysis/SKILL.md +362 -0
  78. package/doc/skills/keve-static-analysis/references/codegraph-analysis-guide.md +108 -0
  79. package/doc/skills/keve-static-analysis/references/git-impact-analysis.md +81 -0
  80. package/doc/skills/keve-static-analysis/references/lint-fix-guide.md +69 -0
  81. package/doc/skills/keve-static-analysis/references/runtime-risk-patterns.md +92 -0
  82. package/doc/skills/keve-static-analysis/references/security-scan-guide.md +32 -0
  83. package/doc/skills/keve-static-analysis/references/ts-error-patterns.md +98 -0
  84. package/doc/skills/keve-static-analysis/references/vue-security-guide.md +72 -0
  85. package/doc/skills/keve-test-eval/SKILL.md +78 -0
  86. package/doc/skills/keve-test-eval/references/common-fix-guide.md +166 -0
  87. package/doc/skills/keve-test-eval/references/confidence-data-guide.md +78 -0
  88. package/doc/skills/keve-test-eval/references/fix-loop-guide.md +67 -0
  89. package/doc/skills/keve-unit-gen/SKILL.md +203 -0
  90. package/doc/skills/keve-unit-gen/references/boundary-conditions.md +78 -0
  91. package/doc/skills/keve-unit-gen/references/unit-mock-strategy.md +71 -0
  92. package/doc/skills/keve-unit-gen/references/unit-test-template.md +105 -0
  93. package/package.json +47 -25
  94. package/dist/agent/factory.d.ts +0 -25
  95. package/dist/agent/factory.js +0 -99
  96. package/dist/agent/index.d.ts +0 -3
  97. package/dist/agent/index.js +0 -7
  98. package/dist/agent/loader.d.ts +0 -22
  99. package/dist/agent/loader.js +0 -117
  100. package/dist/agent/types.d.ts +0 -9
  101. package/dist/agent/types.js +0 -2
  102. package/dist/agent-loop/complete-task.d.ts +0 -28
  103. package/dist/agent-loop/complete-task.js +0 -70
  104. package/dist/agent-loop/index.d.ts +0 -16
  105. package/dist/agent-loop/index.js +0 -26
  106. package/dist/agent-loop/loop.d.ts +0 -42
  107. package/dist/agent-loop/loop.js +0 -282
  108. package/dist/agent-loop/runtime.d.ts +0 -40
  109. package/dist/agent-loop/runtime.js +0 -163
  110. package/dist/agent-loop/types.d.ts +0 -161
  111. package/dist/agent-loop/types.js +0 -105
  112. package/dist/context/index.d.ts +0 -8
  113. package/dist/context/index.js +0 -29
  114. package/dist/context/tokenCalculation.d.ts +0 -55
  115. package/dist/context/tokenCalculation.js +0 -95
  116. package/dist/context/truncation.d.ts +0 -67
  117. package/dist/context/truncation.js +0 -142
  118. package/dist/context/types.d.ts +0 -7
  119. package/dist/context/types.js +0 -27
  120. package/dist/llm/OpenAIClient.d.ts +0 -31
  121. package/dist/llm/OpenAIClient.js +0 -455
  122. package/dist/llm/constants.d.ts +0 -2
  123. package/dist/llm/constants.js +0 -6
  124. package/dist/llm/errors.d.ts +0 -25
  125. package/dist/llm/errors.js +0 -51
  126. package/dist/llm/index.d.ts +0 -49
  127. package/dist/llm/index.js +0 -158
  128. package/dist/llm/types.d.ts +0 -124
  129. package/dist/llm/types.js +0 -2
  130. package/dist/llm/utils.d.ts +0 -29
  131. package/dist/llm/utils.js +0 -284
  132. package/dist/skill/frontmatter-parser.d.ts +0 -50
  133. package/dist/skill/frontmatter-parser.js +0 -152
  134. package/dist/skill/index.d.ts +0 -12
  135. package/dist/skill/index.js +0 -17
  136. package/dist/skill/loader.d.ts +0 -96
  137. package/dist/skill/loader.js +0 -256
  138. package/dist/tools/ask-user.d.ts +0 -8
  139. package/dist/tools/ask-user.js +0 -47
  140. package/dist/tools/bash.d.ts +0 -47
  141. package/dist/tools/bash.js +0 -213
  142. package/dist/tools/edit-file.d.ts +0 -9
  143. package/dist/tools/edit-file.js +0 -76
  144. package/dist/tools/glob.d.ts +0 -8
  145. package/dist/tools/glob.js +0 -101
  146. package/dist/tools/grep.d.ts +0 -10
  147. package/dist/tools/grep.js +0 -76
  148. package/dist/tools/index.d.ts +0 -24
  149. package/dist/tools/index.js +0 -47
  150. package/dist/tools/read-files.d.ts +0 -8
  151. package/dist/tools/read-files.js +0 -81
  152. package/dist/tools/write-file.d.ts +0 -8
@@ -1,67 +0,0 @@
1
- /**
2
- * Truncation utilities — ported from gemini-cli (Apache-2.0), adapted for
3
- * our project's message format (OpenAI-compatible instead of Gemini Part).
4
- *
5
- * Key differences from the original:
6
- * - No `Part` type from `@google/genai` → use `TokenEstimationPart` from tokenCalculation
7
- * - `normalizeFunctionResponse` works on plain JSON objects instead of Gemini's Part structure
8
- */
9
- /** Minimum target tokens to preserve when truncating. */
10
- export declare const MIN_TARGET_TOKENS = 10;
11
- /** Minimum character count before truncation is applied. */
12
- export declare const MIN_CHARS_FOR_TRUNCATION = 100;
13
- /** Prefix marker for truncated text content. */
14
- export declare const TEXT_TRUNCATION_PREFIX = "[Message Normalized: Exceeded size limit]";
15
- /** Prefix marker for truncated tool output. */
16
- export declare const TOOL_TRUNCATION_PREFIX = "[Message Normalized: Tool output exceeded size limit]";
17
- /**
18
- * Estimates the character limit for a target token count, accounting for ASCII vs Non-ASCII.
19
- * Uses a weighted average based on the provided text to decide how many characters
20
- * fit into the target token budget.
21
- *
22
- * Ported from gemini-cli's `estimateCharsFromTokens`.
23
- */
24
- export declare function estimateCharsFromTokens(text: string, targetTokens: number): number;
25
- /**
26
- * Truncates a string to a target length, keeping a proportional amount of the head and tail,
27
- * and prepending a prefix marker.
28
- *
29
- * By default, 20% of the budget goes to the head (beginning) and 80% to the tail (end),
30
- * which preserves recent context while keeping some original context.
31
- *
32
- * Ported from gemini-cli's `truncateProportionally`.
33
- */
34
- export declare function truncateProportionally(str: string, targetChars: number, prefix?: string, headRatio?: number): string;
35
- /**
36
- * Safely normalizes a function/tool response by truncating large string values
37
- * within the response object while maintaining its JSON structure (preserving keys
38
- * like stdout, stderr, etc.).
39
- *
40
- * This is the OpenAI-compatible adaptation of gemini-cli's `normalizeFunctionResponse`.
41
- * Instead of operating on Gemini's `Part.functionResponse`, it operates on plain
42
- * JSON objects (the `result` field of OpenAI tool_call responses).
43
- *
44
- * @param responseObj - The tool response object (e.g., { stdout: "...", stderr: "..." })
45
- * @param ratio - Retention ratio (e.g., 0.3 means keep ~30% of tokens)
46
- * @param headRatio - Proportion of head content to keep (default 0.2)
47
- * @param savedPath - Optional path where full output was saved (added as footer)
48
- * @param intentSummary - Optional LLM-generated summary appended after truncation
49
- * @returns The normalized response object with large values truncated
50
- */
51
- export declare function normalizeFunctionResponse(responseObj: Record<string, unknown>, ratio: number, headRatio?: number, savedPath?: string, intentSummary?: string): Record<string, unknown>;
52
- /**
53
- * Truncate a text string to fit within a token budget.
54
- * Converts the token budget to a character budget using `estimateCharsFromTokens`,
55
- * then applies `truncateProportionally`.
56
- *
57
- * This is a convenience function combining token estimation + truncation,
58
- * useful for truncating LLM input (a11y tree snapshots, PRD content, etc.)
59
- * to fit within the model's token limit.
60
- *
61
- * @param text - The text to potentially truncate
62
- * @param maxTokens - Maximum token budget
63
- * @param prefix - Prefix marker for truncated text
64
- * @param headRatio - Proportion of head to keep
65
- * @returns Truncated text if exceeding budget, original text otherwise
66
- */
67
- export declare function truncateToTokenBudget(text: string, maxTokens: number, prefix?: string, headRatio?: number): string;
@@ -1,142 +0,0 @@
1
- "use strict";
2
- /**
3
- * Truncation utilities — ported from gemini-cli (Apache-2.0), adapted for
4
- * our project's message format (OpenAI-compatible instead of Gemini Part).
5
- *
6
- * Key differences from the original:
7
- * - No `Part` type from `@google/genai` → use `TokenEstimationPart` from tokenCalculation
8
- * - `normalizeFunctionResponse` works on plain JSON objects instead of Gemini's Part structure
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.TOOL_TRUNCATION_PREFIX = exports.TEXT_TRUNCATION_PREFIX = exports.MIN_CHARS_FOR_TRUNCATION = exports.MIN_TARGET_TOKENS = void 0;
12
- exports.estimateCharsFromTokens = estimateCharsFromTokens;
13
- exports.truncateProportionally = truncateProportionally;
14
- exports.normalizeFunctionResponse = normalizeFunctionResponse;
15
- exports.truncateToTokenBudget = truncateToTokenBudget;
16
- const tokenCalculation_1 = require("./tokenCalculation");
17
- /** Minimum target tokens to preserve when truncating. */
18
- exports.MIN_TARGET_TOKENS = 10;
19
- /** Minimum character count before truncation is applied. */
20
- exports.MIN_CHARS_FOR_TRUNCATION = 100;
21
- /** Prefix marker for truncated text content. */
22
- exports.TEXT_TRUNCATION_PREFIX = '[Message Normalized: Exceeded size limit]';
23
- /** Prefix marker for truncated tool output. */
24
- exports.TOOL_TRUNCATION_PREFIX = '[Message Normalized: Tool output exceeded size limit]';
25
- /**
26
- * Estimates the character limit for a target token count, accounting for ASCII vs Non-ASCII.
27
- * Uses a weighted average based on the provided text to decide how many characters
28
- * fit into the target token budget.
29
- *
30
- * Ported from gemini-cli's `estimateCharsFromTokens`.
31
- */
32
- function estimateCharsFromTokens(text, targetTokens) {
33
- if (text.length === 0)
34
- return 0;
35
- // Count ASCII vs Non-ASCII in a sample of the text.
36
- let asciiCount = 0;
37
- const sampleLen = Math.min(text.length, 1000);
38
- for (let i = 0; i < sampleLen; i++) {
39
- if (text.charCodeAt(i) <= 127) {
40
- asciiCount++;
41
- }
42
- }
43
- const asciiRatio = asciiCount / sampleLen;
44
- // Weighted tokens per character:
45
- const avgTokensPerChar = asciiRatio * 0.33 + (1 - asciiRatio) * 1.5; // ASCII_TOKENS_PER_CHAR + NON_ASCII_TOKENS_PER_CHAR
46
- // Characters = Tokens / (Tokens per Character)
47
- return Math.floor(targetTokens / avgTokensPerChar);
48
- }
49
- /**
50
- * Truncates a string to a target length, keeping a proportional amount of the head and tail,
51
- * and prepending a prefix marker.
52
- *
53
- * By default, 20% of the budget goes to the head (beginning) and 80% to the tail (end),
54
- * which preserves recent context while keeping some original context.
55
- *
56
- * Ported from gemini-cli's `truncateProportionally`.
57
- */
58
- function truncateProportionally(str, targetChars, prefix = exports.TEXT_TRUNCATION_PREFIX, headRatio = 0.2) {
59
- if (str.length <= targetChars)
60
- return str;
61
- const ellipsis = '\n...\n';
62
- const overhead = prefix.length + ellipsis.length + 1; // +1 for newline after prefix
63
- const availableChars = Math.max(0, targetChars - overhead);
64
- if (availableChars <= 0) {
65
- return prefix; // Safe fallback if target is extremely small
66
- }
67
- const headChars = Math.floor(availableChars * headRatio);
68
- const tailChars = availableChars - headChars;
69
- return `${prefix}\n${str.substring(0, headChars)}${ellipsis}${str.substring(str.length - tailChars)}`;
70
- }
71
- /**
72
- * Safely normalizes a function/tool response by truncating large string values
73
- * within the response object while maintaining its JSON structure (preserving keys
74
- * like stdout, stderr, etc.).
75
- *
76
- * This is the OpenAI-compatible adaptation of gemini-cli's `normalizeFunctionResponse`.
77
- * Instead of operating on Gemini's `Part.functionResponse`, it operates on plain
78
- * JSON objects (the `result` field of OpenAI tool_call responses).
79
- *
80
- * @param responseObj - The tool response object (e.g., { stdout: "...", stderr: "..." })
81
- * @param ratio - Retention ratio (e.g., 0.3 means keep ~30% of tokens)
82
- * @param headRatio - Proportion of head content to keep (default 0.2)
83
- * @param savedPath - Optional path where full output was saved (added as footer)
84
- * @param intentSummary - Optional LLM-generated summary appended after truncation
85
- * @returns The normalized response object with large values truncated
86
- */
87
- function normalizeFunctionResponse(responseObj, ratio, headRatio = 0.2, savedPath, intentSummary) {
88
- if (typeof responseObj !== 'object' || responseObj === null) {
89
- return responseObj;
90
- }
91
- let hasChanges = false;
92
- const newResponse = {};
93
- for (const [key, value] of Object.entries(responseObj)) {
94
- if (typeof value === 'string' && value.length > exports.MIN_CHARS_FOR_TRUNCATION) {
95
- const valueTokens = (0, tokenCalculation_1.estimateTokenCountSync)([{ text: value }]);
96
- const targetValueTokens = Math.max(exports.MIN_TARGET_TOKENS, Math.floor(valueTokens * ratio));
97
- const targetChars = estimateCharsFromTokens(value, targetValueTokens);
98
- if (value.length > targetChars) {
99
- let truncated = truncateProportionally(value, targetChars, exports.TOOL_TRUNCATION_PREFIX, headRatio);
100
- if (savedPath) {
101
- truncated += `\n\nFull output saved to: ${savedPath}`;
102
- }
103
- if (intentSummary) {
104
- truncated += intentSummary;
105
- }
106
- newResponse[key] = truncated;
107
- hasChanges = true;
108
- }
109
- else {
110
- newResponse[key] = value;
111
- }
112
- }
113
- else {
114
- newResponse[key] = value;
115
- }
116
- }
117
- return hasChanges ? newResponse : responseObj;
118
- }
119
- /**
120
- * Truncate a text string to fit within a token budget.
121
- * Converts the token budget to a character budget using `estimateCharsFromTokens`,
122
- * then applies `truncateProportionally`.
123
- *
124
- * This is a convenience function combining token estimation + truncation,
125
- * useful for truncating LLM input (a11y tree snapshots, PRD content, etc.)
126
- * to fit within the model's token limit.
127
- *
128
- * @param text - The text to potentially truncate
129
- * @param maxTokens - Maximum token budget
130
- * @param prefix - Prefix marker for truncated text
131
- * @param headRatio - Proportion of head to keep
132
- * @returns Truncated text if exceeding budget, original text otherwise
133
- */
134
- function truncateToTokenBudget(text, maxTokens, prefix = exports.TEXT_TRUNCATION_PREFIX, headRatio = 0.2) {
135
- if (text.length <= exports.MIN_CHARS_FOR_TRUNCATION)
136
- return text;
137
- const estimatedTokens = (0, tokenCalculation_1.estimateTokenCountSync)([{ text }]);
138
- if (estimatedTokens <= maxTokens)
139
- return text;
140
- const targetChars = estimateCharsFromTokens(text, maxTokens);
141
- return truncateProportionally(text, targetChars, prefix, headRatio);
142
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Core context module types — shared between truncation, token calculation,
3
- * and future context manager/compression modules.
4
- */
5
- export type { TokenEstimationPart, } from './tokenCalculation';
6
- export { ASCII_TOKENS_PER_CHAR, NON_ASCII_TOKENS_PER_CHAR, MSG_OVERHEAD_TOKENS, DEFAULT_CHARS_PER_TOKEN, estimateTextTokens, estimateTokenCountSync, estimateTokenCountForText, calculateTokenCount, } from './tokenCalculation';
7
- export { MIN_TARGET_TOKENS, MIN_CHARS_FOR_TRUNCATION, TEXT_TRUNCATION_PREFIX, TOOL_TRUNCATION_PREFIX, estimateCharsFromTokens, truncateProportionally, normalizeFunctionResponse, truncateToTokenBudget, } from './truncation';
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /**
3
- * Core context module types — shared between truncation, token calculation,
4
- * and future context manager/compression modules.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.truncateToTokenBudget = exports.normalizeFunctionResponse = exports.truncateProportionally = exports.estimateCharsFromTokens = exports.TOOL_TRUNCATION_PREFIX = exports.TEXT_TRUNCATION_PREFIX = exports.MIN_CHARS_FOR_TRUNCATION = exports.MIN_TARGET_TOKENS = exports.calculateTokenCount = exports.estimateTokenCountForText = exports.estimateTokenCountSync = exports.estimateTextTokens = exports.DEFAULT_CHARS_PER_TOKEN = exports.MSG_OVERHEAD_TOKENS = exports.NON_ASCII_TOKENS_PER_CHAR = exports.ASCII_TOKENS_PER_CHAR = void 0;
8
- var tokenCalculation_1 = require("./tokenCalculation");
9
- // Token calculation
10
- Object.defineProperty(exports, "ASCII_TOKENS_PER_CHAR", { enumerable: true, get: function () { return tokenCalculation_1.ASCII_TOKENS_PER_CHAR; } });
11
- Object.defineProperty(exports, "NON_ASCII_TOKENS_PER_CHAR", { enumerable: true, get: function () { return tokenCalculation_1.NON_ASCII_TOKENS_PER_CHAR; } });
12
- Object.defineProperty(exports, "MSG_OVERHEAD_TOKENS", { enumerable: true, get: function () { return tokenCalculation_1.MSG_OVERHEAD_TOKENS; } });
13
- Object.defineProperty(exports, "DEFAULT_CHARS_PER_TOKEN", { enumerable: true, get: function () { return tokenCalculation_1.DEFAULT_CHARS_PER_TOKEN; } });
14
- Object.defineProperty(exports, "estimateTextTokens", { enumerable: true, get: function () { return tokenCalculation_1.estimateTextTokens; } });
15
- Object.defineProperty(exports, "estimateTokenCountSync", { enumerable: true, get: function () { return tokenCalculation_1.estimateTokenCountSync; } });
16
- Object.defineProperty(exports, "estimateTokenCountForText", { enumerable: true, get: function () { return tokenCalculation_1.estimateTokenCountForText; } });
17
- Object.defineProperty(exports, "calculateTokenCount", { enumerable: true, get: function () { return tokenCalculation_1.calculateTokenCount; } });
18
- var truncation_1 = require("./truncation");
19
- // Truncation
20
- Object.defineProperty(exports, "MIN_TARGET_TOKENS", { enumerable: true, get: function () { return truncation_1.MIN_TARGET_TOKENS; } });
21
- Object.defineProperty(exports, "MIN_CHARS_FOR_TRUNCATION", { enumerable: true, get: function () { return truncation_1.MIN_CHARS_FOR_TRUNCATION; } });
22
- Object.defineProperty(exports, "TEXT_TRUNCATION_PREFIX", { enumerable: true, get: function () { return truncation_1.TEXT_TRUNCATION_PREFIX; } });
23
- Object.defineProperty(exports, "TOOL_TRUNCATION_PREFIX", { enumerable: true, get: function () { return truncation_1.TOOL_TRUNCATION_PREFIX; } });
24
- Object.defineProperty(exports, "estimateCharsFromTokens", { enumerable: true, get: function () { return truncation_1.estimateCharsFromTokens; } });
25
- Object.defineProperty(exports, "truncateProportionally", { enumerable: true, get: function () { return truncation_1.truncateProportionally; } });
26
- Object.defineProperty(exports, "normalizeFunctionResponse", { enumerable: true, get: function () { return truncation_1.normalizeFunctionResponse; } });
27
- Object.defineProperty(exports, "truncateToTokenBudget", { enumerable: true, get: function () { return truncation_1.truncateToTokenBudget; } });
@@ -1,31 +0,0 @@
1
- import type { ChatResult, InvokeOptions, InvokeResult, LLMClient, LLMConfig, Message, Tool } from './types';
2
- /**
3
- * Client for OpenAI compatible APIs
4
- */
5
- export declare class OpenAIClient implements LLMClient {
6
- config: Required<LLMConfig>;
7
- private fetch;
8
- constructor(config: Required<LLMConfig>);
9
- invoke(messages: Message[], tools: Record<string, Tool>, abortSignal?: AbortSignal, options?: InvokeOptions): Promise<InvokeResult>;
10
- /**
11
- * Attempt to recover a valid JSON object from a malformed LLM response.
12
- * Handles common LLM JSON errors:
13
- * 1. Extra text after closing brace (e.g. "...}{extra")
14
- * 2. Trailing commas inside objects
15
- * 3. Unbalanced braces — find the deepest matching pair
16
- * 4. Mixed quote styles (single quotes instead of double quotes)
17
- */
18
- private tryRecoverJSON;
19
- /**
20
- * Call the LLM and return the full assistant message without executing any tools.
21
- * Used by the agent loop to get the LLM's response and process tool_calls separately.
22
- *
23
- * This method:
24
- * 1. Sends messages + tools to the OpenAI-compatible API
25
- * 2. Returns the full assistant Message (with content + tool_calls)
26
- * 3. Does NOT execute any tools or validate tool args
27
- *
28
- * The agent loop handles tool execution via its own ToolRegistry.
29
- */
30
- chat(messages: Message[], tools: Record<string, Tool>, abortSignal?: AbortSignal, options?: InvokeOptions): Promise<ChatResult>;
31
- }