@tyvm/knowhow 0.0.100 → 0.0.101
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/jest.manual.config.js +19 -0
- package/package.json +2 -1
- package/src/agents/base/base.ts +32 -0
- package/src/cli.ts +22 -1
- package/src/clients/contextLimits.ts +0 -2
- package/src/clients/pricing/anthropic.ts +0 -6
- package/src/clients/pricing/google.ts +0 -4
- package/src/clients/pricing/xai.ts +11 -0
- package/src/login.ts +1 -4
- package/src/services/Mcp.ts +17 -3
- package/src/types.ts +17 -17
- package/tests/manual/clients/completions.json +454 -0
- package/tests/manual/clients/completions.test.ts +166 -0
- package/ts_build/package.json +2 -1
- package/ts_build/src/agents/base/base.js +15 -0
- package/ts_build/src/agents/base/base.js.map +1 -1
- package/ts_build/src/cli.js +11 -1
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/anthropic.d.ts +0 -6
- package/ts_build/src/clients/contextLimits.js +0 -2
- package/ts_build/src/clients/contextLimits.js.map +1 -1
- package/ts_build/src/clients/pricing/anthropic.d.ts +0 -6
- package/ts_build/src/clients/pricing/anthropic.js +0 -6
- package/ts_build/src/clients/pricing/anthropic.js.map +1 -1
- package/ts_build/src/clients/pricing/google.js +0 -4
- package/ts_build/src/clients/pricing/google.js.map +1 -1
- package/ts_build/src/clients/pricing/xai.d.ts +10 -0
- package/ts_build/src/clients/pricing/xai.js +10 -0
- package/ts_build/src/clients/pricing/xai.js.map +1 -1
- package/ts_build/src/clients/xai.d.ts +13 -4
- package/ts_build/src/login.js +1 -4
- package/ts_build/src/login.js.map +1 -1
- package/ts_build/src/services/Mcp.js +11 -3
- package/ts_build/src/services/Mcp.js.map +1 -1
- package/ts_build/src/types.d.ts +2 -2
- package/ts_build/src/types.js +12 -13
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/tests/manual/clients/completions.test.d.ts +1 -0
- package/ts_build/tests/manual/clients/completions.test.js +135 -0
- package/ts_build/tests/manual/clients/completions.test.js.map +1 -0
- package/test-ai-completion.ts +0 -39
- package/test-mcp-args.ts +0 -71
- package/test-tools-service.ts +0 -45
package/ts_build/src/types.js
CHANGED
|
@@ -7,19 +7,20 @@ exports.Models = {
|
|
|
7
7
|
anthropic: {
|
|
8
8
|
Opus4_6: "claude-opus-4-6",
|
|
9
9
|
Sonnet4_6: "claude-sonnet-4-6",
|
|
10
|
-
Opus4_5: "claude-opus-4-5
|
|
11
|
-
Opus4: "claude-opus-4
|
|
12
|
-
Opus4_1: "claude-opus-4-1
|
|
13
|
-
Sonnet4_5: "claude-sonnet-4-5
|
|
14
|
-
Haiku4_5: "claude-haiku-4-5
|
|
15
|
-
Sonnet4: "claude-sonnet-4
|
|
16
|
-
Sonnet3_7: "claude-3-7-sonnet
|
|
17
|
-
Sonnet3_5: "claude-3-5-sonnet
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Haiku3: "claude-3-haiku-20240307",
|
|
10
|
+
Opus4_5: "claude-opus-4-5",
|
|
11
|
+
Opus4: "claude-opus-4",
|
|
12
|
+
Opus4_1: "claude-opus-4-1",
|
|
13
|
+
Sonnet4_5: "claude-sonnet-4-5",
|
|
14
|
+
Haiku4_5: "claude-haiku-4-5",
|
|
15
|
+
Sonnet4: "claude-sonnet-4",
|
|
16
|
+
Sonnet3_7: "claude-3-7-sonnet",
|
|
17
|
+
Sonnet3_5: "claude-3-5-sonnet",
|
|
18
|
+
Opus3: "claude-3-opus",
|
|
19
|
+
Haiku3: "claude-3-haiku",
|
|
21
20
|
},
|
|
22
21
|
xai: {
|
|
22
|
+
Grok_4_20_Reasoning: "grok-4.20-0309-reasoning",
|
|
23
|
+
Grok_4_20_NonReasoning: "grok-4.20-0309-non-reasoning",
|
|
23
24
|
Grok4_1_Fast_Reasoning: "grok-4-1-fast-reasoning",
|
|
24
25
|
Grok4_1_Fast_NonReasoning: "grok-4-1-fast-non-reasoning",
|
|
25
26
|
GrokCodeFast: "grok-code-fast-1",
|
|
@@ -96,7 +97,6 @@ exports.Models = {
|
|
|
96
97
|
Gemini_25_Pro_TTS: "gemini-2.5-pro-preview-tts",
|
|
97
98
|
Gemini_20_Flash: "gemini-2.0-flash",
|
|
98
99
|
Gemini_20_Flash_Preview_Image_Generation: "gemini-2.0-flash-exp-image-generation",
|
|
99
|
-
Gemini_20_Flash_Lite: "gemini-2.0-flash-lite",
|
|
100
100
|
Gemini_15_Flash: "gemini-1.5-flash",
|
|
101
101
|
Gemini_15_Flash_8B: "gemini-1.5-flash-8b",
|
|
102
102
|
Gemini_15_Pro: "gemini-1.5-pro",
|
|
@@ -179,7 +179,6 @@ exports.GoogleReasoningModels = [
|
|
|
179
179
|
exports.Models.google.Gemini_25_Flash_Preview,
|
|
180
180
|
exports.Models.google.Gemini_25_Pro_Preview,
|
|
181
181
|
exports.Models.google.Gemini_20_Flash,
|
|
182
|
-
exports.Models.google.Gemini_20_Flash_Lite,
|
|
183
182
|
exports.Models.google.Gemini_15_Flash,
|
|
184
183
|
exports.Models.google.Gemini_15_Flash_8B,
|
|
185
184
|
exports.Models.google.Gemini_15_Pro,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AA+TA,8CAKC;AAED,gDAKC;AAlJY,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,OAAO,EAAE,iBAAiB;QAC1B,SAAS,EAAE,mBAAmB;QAC9B,OAAO,EAAE,iBAAiB;QAC1B,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,iBAAiB;QAC1B,SAAS,EAAE,mBAAmB;QAC9B,QAAQ,EAAE,kBAAkB;QAC5B,OAAO,EAAE,iBAAiB;QAC1B,SAAS,EAAE,mBAAmB;QAC9B,SAAS,EAAE,mBAAmB;QAC9B,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,gBA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KAAK;IACnB,cAAM,CAAC,MAAM,CAAC,KAAK;IACnB,cAAM,CAAC,MAAM,CAAC,UAAU;IACxB,cAAM,CAAC,MAAM,CAAC,OAAO;IACrB,cAAM,CAAC,MAAM,CAAC,YAAY;CAC3B,CAAC;AAEW,QAAA,qBAAqB,GAAG;IACnC,uBAAe,CAAC,MAAM,CAAC,gBAAgB;IACvC,uBAAe,CAAC,MAAM,CAAC,oBAAoB;CAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const clients_1 = require("../../../src/clients");
|
|
39
|
+
const types_1 = require("../../../src/types");
|
|
40
|
+
const OUTPUT_FILE = path.join(__dirname, "completions.json");
|
|
41
|
+
const PROMPT = "Say hello in 5 words.";
|
|
42
|
+
const TEST_MODELS = [
|
|
43
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_4o_Mini, envKey: "OPENAI_KEY" },
|
|
44
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_41_Nano, envKey: "OPENAI_KEY" },
|
|
45
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_54, envKey: "OPENAI_KEY" },
|
|
46
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_54_Pro, envKey: "OPENAI_KEY" },
|
|
47
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_54_Mini, envKey: "OPENAI_KEY" },
|
|
48
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_54_Nano, envKey: "OPENAI_KEY" },
|
|
49
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_53_Chat, envKey: "OPENAI_KEY" },
|
|
50
|
+
{ provider: "openai", model: types_1.Models.openai.GPT_53_Codex, envKey: "OPENAI_KEY" },
|
|
51
|
+
{ provider: "anthropic", model: types_1.Models.anthropic.Haiku4_5, envKey: "ANTHROPIC_API_KEY" },
|
|
52
|
+
{ provider: "anthropic", model: types_1.Models.anthropic.Sonnet4_6, envKey: "ANTHROPIC_API_KEY" },
|
|
53
|
+
{ provider: "anthropic", model: types_1.Models.anthropic.Opus4_6, envKey: "ANTHROPIC_API_KEY" },
|
|
54
|
+
{ provider: "google", model: types_1.Models.google.Gemini_25_Flash, envKey: "GEMINI_API_KEY" },
|
|
55
|
+
{ provider: "google", model: types_1.Models.google.Gemini_31_Flash_Lite_Preview, envKey: "GEMINI_API_KEY" },
|
|
56
|
+
{ provider: "google", model: types_1.Models.google.Gemini_31_Flash_Image_Preview, envKey: "GEMINI_API_KEY" },
|
|
57
|
+
{ provider: "google", model: types_1.Models.google.Gemini_31_Pro_Preview, envKey: "GEMINI_API_KEY" },
|
|
58
|
+
{ provider: "xai", model: types_1.Models.xai.Grok3MiniFastBeta, envKey: "XAI_API_KEY" },
|
|
59
|
+
{ provider: "xai", model: types_1.Models.xai.Grok3MiniBeta, envKey: "XAI_API_KEY" },
|
|
60
|
+
{ provider: "xai", model: types_1.Models.xai.Grok4, envKey: "XAI_API_KEY" },
|
|
61
|
+
{ provider: "xai", model: types_1.Models.xai.Grok4_1_Fast_NonReasoning, envKey: "XAI_API_KEY" },
|
|
62
|
+
{ provider: "xai", model: types_1.Models.xai.Grok4_1_Fast_NonReasoning, envKey: "XAI_API_KEY" },
|
|
63
|
+
{ provider: "xai", model: types_1.Models.xai.Grok_4_20_NonReasoning, envKey: "XAI_API_KEY" },
|
|
64
|
+
{ provider: "xai", model: types_1.Models.xai.Grok_4_20_Reasoning, envKey: "XAI_API_KEY" },
|
|
65
|
+
];
|
|
66
|
+
function loadResults() {
|
|
67
|
+
if (fs.existsSync(OUTPUT_FILE)) {
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(fs.readFileSync(OUTPUT_FILE, "utf-8"));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
function saveResults(results) {
|
|
78
|
+
fs.writeFileSync(OUTPUT_FILE, JSON.stringify(results, null, 2), "utf-8");
|
|
79
|
+
}
|
|
80
|
+
function recordKey(provider, model) {
|
|
81
|
+
return `${provider}::${model}`;
|
|
82
|
+
}
|
|
83
|
+
describe("Text Completions – multi-provider model verification", () => {
|
|
84
|
+
let client;
|
|
85
|
+
let results;
|
|
86
|
+
beforeAll(() => {
|
|
87
|
+
client = new clients_1.AIClient();
|
|
88
|
+
results = loadResults();
|
|
89
|
+
});
|
|
90
|
+
afterAll(() => {
|
|
91
|
+
saveResults(results);
|
|
92
|
+
console.log(`\n📄 Results saved to: ${OUTPUT_FILE}`);
|
|
93
|
+
console.log(` Total records: ${Object.keys(results).length}`);
|
|
94
|
+
});
|
|
95
|
+
for (const { provider, model, envKey } of TEST_MODELS) {
|
|
96
|
+
const key = recordKey(provider, model);
|
|
97
|
+
test(`${provider} / ${model}`, async () => {
|
|
98
|
+
if (results[key]) {
|
|
99
|
+
const rec = results[key];
|
|
100
|
+
console.log(`⏭ Skipping (already tested on ${rec.testedAt})`);
|
|
101
|
+
console.log(` Response : "${rec.response}"`);
|
|
102
|
+
console.log(` Cost : $${rec.usd_cost?.toFixed(8) ?? "unknown"}`);
|
|
103
|
+
expect(rec.response).toBeTruthy();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!process.env[envKey]) {
|
|
107
|
+
console.log(`⏭ Skipping: ${envKey} not set`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const response = await client.createCompletion(provider, {
|
|
111
|
+
model,
|
|
112
|
+
messages: [{ role: "user", content: PROMPT }],
|
|
113
|
+
max_tokens: 50,
|
|
114
|
+
});
|
|
115
|
+
const text = response.choices[0]?.message?.content ?? "";
|
|
116
|
+
expect(text).toBeTruthy();
|
|
117
|
+
const record = {
|
|
118
|
+
provider,
|
|
119
|
+
model,
|
|
120
|
+
prompt: PROMPT,
|
|
121
|
+
response: text,
|
|
122
|
+
usage: response.usage ?? {},
|
|
123
|
+
usd_cost: response.usd_cost,
|
|
124
|
+
testedAt: new Date().toISOString(),
|
|
125
|
+
};
|
|
126
|
+
results[key] = record;
|
|
127
|
+
saveResults(results);
|
|
128
|
+
console.log(`✅ ${provider} / ${model}`);
|
|
129
|
+
console.log(` Response : "${text}"`);
|
|
130
|
+
console.log(` Tokens : ${JSON.stringify(response.usage)}`);
|
|
131
|
+
console.log(` Cost : $${response.usd_cost?.toFixed(8) ?? "unknown"}`);
|
|
132
|
+
}, 60_000);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=completions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completions.test.js","sourceRoot":"","sources":["../../../../tests/manual/clients/completions.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,uCAAyB;AACzB,2CAA6B;AAC7B,kDAAgD;AAChD,8CAA4C;AAE5C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,uBAAuB,CAAC;AAWvC,MAAM,WAAW,GAAiB;IAEhC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAM,CAAC,MAAM,CAAC,WAAW,EAAG,MAAM,EAAE,YAAY,EAAE;IAC/E,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAM,CAAC,MAAM,CAAC,WAAW,EAAG,MAAM,EAAE,YAAY,EAAE;IAC/E,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAM,CAAC,MAAM,CAAC,MAAM,EAAG,MAAM,EAAE,YAAY,EAAE;IAC1E,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAM,CAAC,MAAM,CAAC,UAAU,EAAG,MAAM,EAAE,YAAY,EAAE;IAC9E,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAM,CAAC,MAAM,CAAC,WAAW,EAAG,MAAM,EAAE,YAAY,EAAE;IAC/E,EAAE,QAAQ,EAA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,EAAE,MAAM,CAAC,CAAC;IACb,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/test-ai-completion.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Direct test of createAiCompletion outside the script sandbox
|
|
3
|
-
*/
|
|
4
|
-
import { createAiCompletion } from './src/agents/tools/aiClient';
|
|
5
|
-
import { services } from './src/services';
|
|
6
|
-
|
|
7
|
-
async function main() {
|
|
8
|
-
// Initialize services
|
|
9
|
-
const svc = services();
|
|
10
|
-
|
|
11
|
-
// Wait for clients to initialize
|
|
12
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
13
|
-
|
|
14
|
-
console.log('Testing createAiCompletion directly...');
|
|
15
|
-
|
|
16
|
-
// Test with anthropic (empty provider - auto-detect from model)
|
|
17
|
-
try {
|
|
18
|
-
const result = await createAiCompletion.call(svc.Tools, 'anthropic', {
|
|
19
|
-
model: 'claude-3-5-haiku-20241022',
|
|
20
|
-
messages: [{ role: 'user', content: 'Say hello in 5 words' }]
|
|
21
|
-
});
|
|
22
|
-
console.log('Direct call result:', result?.choices?.[0]?.message?.content);
|
|
23
|
-
} catch(e) {
|
|
24
|
-
console.error('Direct call error:', e.message);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Test with empty provider
|
|
28
|
-
try {
|
|
29
|
-
const result2 = await createAiCompletion.call(svc.Tools, '', {
|
|
30
|
-
model: 'claude-3-5-haiku-20241022',
|
|
31
|
-
messages: [{ role: 'user', content: 'Say hello in 5 words' }]
|
|
32
|
-
});
|
|
33
|
-
console.log('Empty provider result:', result2?.choices?.[0]?.message?.content);
|
|
34
|
-
} catch(e) {
|
|
35
|
-
console.error('Empty provider error:', e.message);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
main().catch(console.error).finally(() => process.exit(0));
|
package/test-mcp-args.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test how McpServer's toZodSchema + Object.values parses createAiCompletion args
|
|
3
|
-
*/
|
|
4
|
-
import { McpServerService } from './src/services/McpServer';
|
|
5
|
-
import { ToolsService } from './src/services/Tools';
|
|
6
|
-
import { services } from './src/services';
|
|
7
|
-
|
|
8
|
-
// Simulate the properties from createAiCompletion tool definition
|
|
9
|
-
const createAiCompletionProps = {
|
|
10
|
-
provider: {
|
|
11
|
-
type: "string",
|
|
12
|
-
description: "The AI provider to use",
|
|
13
|
-
},
|
|
14
|
-
options: {
|
|
15
|
-
type: "object",
|
|
16
|
-
description: "Provider-specific completion options",
|
|
17
|
-
properties: {
|
|
18
|
-
model: { type: "string", description: "The model to use" },
|
|
19
|
-
messages: {
|
|
20
|
-
type: "array",
|
|
21
|
-
description: "The chat history",
|
|
22
|
-
items: {
|
|
23
|
-
type: "object",
|
|
24
|
-
properties: {
|
|
25
|
-
role: { type: "string" },
|
|
26
|
-
content: { type: "string" },
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
max_tokens: { type: "number" },
|
|
31
|
-
},
|
|
32
|
-
required: ["model", "messages"],
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const outerRequired = ["provider"];
|
|
37
|
-
|
|
38
|
-
async function main() {
|
|
39
|
-
const svc = services();
|
|
40
|
-
const mcpServer = new McpServerService(svc.Tools);
|
|
41
|
-
|
|
42
|
-
// Simulate toZodSchema
|
|
43
|
-
const zodSchema = mcpServer.toZodSchema(createAiCompletionProps as any, outerRequired);
|
|
44
|
-
|
|
45
|
-
// Simulate what MCP SDK passes as args after zod parsing
|
|
46
|
-
const incomingArgs = {
|
|
47
|
-
provider: "",
|
|
48
|
-
options: {
|
|
49
|
-
model: "gpt-5-nano",
|
|
50
|
-
messages: [{ role: "user", content: "hello" }],
|
|
51
|
-
max_tokens: 5000
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
const parsed = zodSchema.parse(incomingArgs);
|
|
57
|
-
console.log('Parsed args:', JSON.stringify(parsed, null, 2));
|
|
58
|
-
console.log('Object.values(parsed):', JSON.stringify(Object.values(parsed), null, 2));
|
|
59
|
-
console.log('Keys order:', Object.keys(parsed));
|
|
60
|
-
|
|
61
|
-
// Simulate what McpServer does
|
|
62
|
-
const [providerArg, optionsArg] = Object.values(parsed) as any[];
|
|
63
|
-
console.log('provider arg:', JSON.stringify(providerArg));
|
|
64
|
-
console.log('options arg:', JSON.stringify(optionsArg));
|
|
65
|
-
console.log('options.model:', optionsArg?.model);
|
|
66
|
-
} catch(e) {
|
|
67
|
-
console.error('Zod parse error:', e.message);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
main().catch(console.error).finally(() => process.exit(0));
|
package/test-tools-service.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test ToolsService.callTool for createAiCompletion directly
|
|
3
|
-
*/
|
|
4
|
-
import { services } from './src/services';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
const svc = services();
|
|
8
|
-
|
|
9
|
-
// Wait for services to init
|
|
10
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
11
|
-
|
|
12
|
-
const toolsService = svc.Tools;
|
|
13
|
-
|
|
14
|
-
// Check tool definition
|
|
15
|
-
const toolDef = toolsService.getTool('createAiCompletion');
|
|
16
|
-
console.log('Tool found:', !!toolDef);
|
|
17
|
-
console.log('positional:', toolDef?.function?.parameters?.positional);
|
|
18
|
-
console.log('properties keys:', Object.keys(toolDef?.function?.parameters?.properties || {}));
|
|
19
|
-
|
|
20
|
-
// Simulate what SandboxContext.callTool does
|
|
21
|
-
const toolCall = {
|
|
22
|
-
id: 'test-123',
|
|
23
|
-
type: 'function' as const,
|
|
24
|
-
function: {
|
|
25
|
-
name: 'createAiCompletion',
|
|
26
|
-
arguments: JSON.stringify({
|
|
27
|
-
provider: '',
|
|
28
|
-
options: {
|
|
29
|
-
model: 'claude-3-haiku-20240307',
|
|
30
|
-
messages: [{ role: 'user', content: 'Say hello in 5 words' }]
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
const result = await toolsService.callTool(toolCall);
|
|
38
|
-
console.log('Result functionResp:', JSON.stringify(result?.functionResp)?.substring(0, 200));
|
|
39
|
-
console.log('Tool messages content:', result?.toolMessages?.[0]?.content?.substring(0, 200));
|
|
40
|
-
} catch(e) {
|
|
41
|
-
console.error('Error:', e.message);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
main().catch(console.error).finally(() => process.exit(0));
|