@agentxjs/devtools 1.9.5-dev ā 1.9.6-dev
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/chunk-6OHXS7LW.js +297 -0
- package/dist/chunk-6OHXS7LW.js.map +1 -0
- package/dist/chunk-SQDCFUA3.js +293 -0
- package/dist/chunk-SQDCFUA3.js.map +1 -0
- package/dist/chunk-YRTTCKHM.js +152 -0
- package/dist/chunk-YRTTCKHM.js.map +1 -0
- package/dist/fixtures/index.d.ts +49 -0
- package/dist/fixtures/index.js +21 -0
- package/dist/fixtures/index.js.map +1 -0
- package/dist/index.d.ts +207 -0
- package/dist/index.js +273 -0
- package/dist/index.js.map +1 -0
- package/dist/mock/index.d.ts +115 -0
- package/dist/mock/index.js +10 -0
- package/dist/mock/index.js.map +1 -0
- package/dist/recorder/index.d.ts +120 -0
- package/dist/recorder/index.js +9 -0
- package/dist/recorder/index.js.map +1 -0
- package/dist/types-C6Lf3vz2.d.ts +78 -0
- package/package.json +40 -7
- package/scripts/record-fixture.ts +0 -148
- package/tsconfig.json +0 -10
package/package.json
CHANGED
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentxjs/devtools",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6-dev",
|
|
4
4
|
"description": "Development tools for AgentX - MockDriver, RecordingDriver, Fixtures",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
6
8
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./mock": {
|
|
15
|
+
"types": "./dist/mock/index.d.ts",
|
|
16
|
+
"import": "./dist/mock/index.js",
|
|
17
|
+
"default": "./dist/mock/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./recorder": {
|
|
20
|
+
"types": "./dist/recorder/index.d.ts",
|
|
21
|
+
"import": "./dist/recorder/index.js",
|
|
22
|
+
"default": "./dist/recorder/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./fixtures": {
|
|
25
|
+
"types": "./dist/fixtures/index.d.ts",
|
|
26
|
+
"import": "./dist/fixtures/index.js",
|
|
27
|
+
"default": "./dist/fixtures/index.js"
|
|
28
|
+
}
|
|
11
29
|
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"src",
|
|
33
|
+
"fixtures"
|
|
34
|
+
],
|
|
12
35
|
"scripts": {
|
|
36
|
+
"build": "tsup",
|
|
13
37
|
"typecheck": "tsc --noEmit",
|
|
14
38
|
"test": "bun test"
|
|
15
39
|
},
|
|
16
40
|
"dependencies": {
|
|
17
|
-
"@agentxjs/core": "1.9.
|
|
18
|
-
"commonxjs": "^0.1.
|
|
41
|
+
"@agentxjs/core": "1.9.6-dev",
|
|
42
|
+
"commonxjs": "^0.1.1"
|
|
19
43
|
},
|
|
20
44
|
"devDependencies": {
|
|
45
|
+
"@agentxjs/claude-driver": "1.9.6-dev",
|
|
21
46
|
"typescript": "^5.3.3"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@agentxjs/claude-driver": "1.9.6-dev"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@agentxjs/claude-driver": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
22
55
|
}
|
|
23
56
|
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Record Fixture Script
|
|
4
|
-
*
|
|
5
|
-
* Records a real Claude conversation and saves it as a fixture.
|
|
6
|
-
* Environment is auto-loaded from monorepo root .env.local via bunfig.toml preload.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* bun run scripts/record-fixture.ts "Hello, how are you?" my-greeting
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { createRecordingDriver } from "../src/recorder/RecordingDriver";
|
|
13
|
-
import { createClaudeDriverFactory } from "@agentxjs/claude-driver";
|
|
14
|
-
import { EventBusImpl } from "@agentxjs/core/event";
|
|
15
|
-
import { dirname, join } from "node:path";
|
|
16
|
-
import { fileURLToPath } from "node:url";
|
|
17
|
-
|
|
18
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
|
|
20
|
-
// Parse args
|
|
21
|
-
const message = process.argv[2] || "Hello!";
|
|
22
|
-
const fixtureName = process.argv[3] || `fixture-${Date.now()}`;
|
|
23
|
-
|
|
24
|
-
// Get config from env
|
|
25
|
-
const apiKey = process.env.DEEPRACTICE_API_KEY;
|
|
26
|
-
const baseUrl = process.env.DEEPRACTICE_BASE_URL;
|
|
27
|
-
const model = process.env.DEEPRACTICE_MODEL || "claude-haiku-4-5-20251001";
|
|
28
|
-
|
|
29
|
-
if (!apiKey) {
|
|
30
|
-
console.error("Error: DEEPRACTICE_API_KEY is required");
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.log(`\nš¬ Recording fixture: ${fixtureName}`);
|
|
35
|
-
console.log(`š Message: "${message}"`);
|
|
36
|
-
console.log(`š API Key: ${apiKey.substring(0, 10)}...`);
|
|
37
|
-
if (baseUrl) console.log(`š Base URL: ${baseUrl}`);
|
|
38
|
-
|
|
39
|
-
async function main() {
|
|
40
|
-
// Create EventBus
|
|
41
|
-
const bus = new EventBusImpl();
|
|
42
|
-
|
|
43
|
-
// Create real Claude driver
|
|
44
|
-
const claudeFactory = createClaudeDriverFactory();
|
|
45
|
-
const realDriver = claudeFactory.createDriver({
|
|
46
|
-
agentId: "recording-agent",
|
|
47
|
-
config: {
|
|
48
|
-
apiKey: apiKey!,
|
|
49
|
-
baseUrl,
|
|
50
|
-
model,
|
|
51
|
-
systemPrompt: "You are a helpful assistant. Keep responses brief.",
|
|
52
|
-
cwd: process.cwd(), // Enable Bash tool execution
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Wrap with recorder
|
|
57
|
-
const recorder = createRecordingDriver({
|
|
58
|
-
driver: realDriver,
|
|
59
|
-
name: fixtureName,
|
|
60
|
-
description: `Recording of: "${message}"`,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Connect
|
|
64
|
-
recorder.connect(bus.asConsumer(), bus.asProducer());
|
|
65
|
-
|
|
66
|
-
// Track when we get message_stop with end_turn (not tool_use)
|
|
67
|
-
let completed = false;
|
|
68
|
-
bus.on("message_stop", (evt) => {
|
|
69
|
-
const data = evt.data as { stopReason?: string };
|
|
70
|
-
// Only finish when it's truly done, not when waiting for tool result
|
|
71
|
-
if (data.stopReason === "end_turn") {
|
|
72
|
-
completed = true;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Track text deltas
|
|
77
|
-
let fullText = "";
|
|
78
|
-
bus.on("text_delta", (evt) => {
|
|
79
|
-
const text = (evt.data as { text: string }).text;
|
|
80
|
-
fullText += text;
|
|
81
|
-
process.stdout.write(text);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Track tool calls
|
|
85
|
-
bus.on("tool_use_content_block_start", (evt) => {
|
|
86
|
-
const data = evt.data as { name?: string };
|
|
87
|
-
console.log(`\nš§ Tool call: ${data.name || "unknown"}`);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
bus.on("tool_result", (evt) => {
|
|
91
|
-
const data = evt.data as { isError?: boolean };
|
|
92
|
-
console.log(`š¤ Tool result ${data.isError ? "(error)" : "(success)"}`);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
console.log("\n\nš¤ Sending message...\n");
|
|
96
|
-
console.log("------- Response -------");
|
|
97
|
-
|
|
98
|
-
// Send user message
|
|
99
|
-
bus.emit({
|
|
100
|
-
type: "user_message",
|
|
101
|
-
timestamp: Date.now(),
|
|
102
|
-
source: "test",
|
|
103
|
-
category: "message",
|
|
104
|
-
intent: "request",
|
|
105
|
-
data: {
|
|
106
|
-
id: `msg_${Date.now()}`,
|
|
107
|
-
role: "user",
|
|
108
|
-
subtype: "user",
|
|
109
|
-
content: message,
|
|
110
|
-
timestamp: Date.now(),
|
|
111
|
-
},
|
|
112
|
-
context: {
|
|
113
|
-
agentId: "recording-agent",
|
|
114
|
-
sessionId: "recording-session",
|
|
115
|
-
},
|
|
116
|
-
} as never);
|
|
117
|
-
|
|
118
|
-
// Wait for completion (longer timeout for tool calls)
|
|
119
|
-
const timeout = 120000; // 2 minutes
|
|
120
|
-
const start = Date.now();
|
|
121
|
-
while (!completed && Date.now() - start < timeout) {
|
|
122
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
console.log("\n------------------------\n");
|
|
126
|
-
|
|
127
|
-
if (!completed) {
|
|
128
|
-
console.error("ā ļø Timeout waiting for response");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Save fixture
|
|
132
|
-
const outputPath = join(__dirname, "..", "fixtures", `${fixtureName}.json`);
|
|
133
|
-
await recorder.saveFixture(outputPath);
|
|
134
|
-
|
|
135
|
-
console.log(`ā
Fixture saved: ${outputPath}`);
|
|
136
|
-
console.log(`š Events recorded: ${recorder.eventCount}`);
|
|
137
|
-
console.log(`š Response length: ${fullText.length} chars`);
|
|
138
|
-
|
|
139
|
-
// Cleanup
|
|
140
|
-
recorder.dispose();
|
|
141
|
-
|
|
142
|
-
process.exit(0);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
main().catch((err) => {
|
|
146
|
-
console.error("Error:", err);
|
|
147
|
-
process.exit(1);
|
|
148
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"rootDir": ".",
|
|
6
|
-
"types": ["bun-types"]
|
|
7
|
-
},
|
|
8
|
-
"include": ["src/**/*", "fixtures/**/*"],
|
|
9
|
-
"exclude": ["src/**/__tests__/**/*", "src/**/*.test.ts", "src/**/*.spec.ts", "scripts/**/*"]
|
|
10
|
-
}
|