@crewx/shared 0.0.5 → 0.0.6-rc.1
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/package.json +2 -2
- package/test-tracer.js +17 -17
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-rc.1",
|
|
4
4
|
"main": "skill-tracer.js",
|
|
5
5
|
"description": "Shared utilities for CrewX built-in packages",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@crewx/sdk": "0.8.
|
|
7
|
+
"@crewx/sdk": "0.8.9-rc.14"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo no tests"
|
package/test-tracer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* skill-tracer
|
|
2
|
+
* skill-tracer test
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const { trace, run, getDbPath } = require('./skill-tracer');
|
|
@@ -7,33 +7,33 @@ const { trace, run, getDbPath } = require('./skill-tracer');
|
|
|
7
7
|
console.log('=== skill-tracer PoC Test ===\n');
|
|
8
8
|
console.log('crewx.db path:', getDbPath());
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
console.log('\n[Test 1] trace()
|
|
10
|
+
// Test 1: manual trace() use
|
|
11
|
+
console.log('\n[Test 1] manual trace() use');
|
|
12
12
|
const t = trace('test-skill', 'manual test command', 'test-agent');
|
|
13
13
|
console.log('taskId:', t.taskId);
|
|
14
14
|
console.log('skipped:', t._skipped);
|
|
15
15
|
t.ok('test result');
|
|
16
|
-
console.log('->
|
|
16
|
+
console.log('-> done\n');
|
|
17
17
|
|
|
18
|
-
//
|
|
19
|
-
console.log('[Test 2] run()
|
|
18
|
+
// Test 2: run() wrapper success
|
|
19
|
+
console.log('[Test 2] run() wrapper - success case');
|
|
20
20
|
run('test-skill', async () => {
|
|
21
|
-
console.log('->
|
|
21
|
+
console.log('-> function running...');
|
|
22
22
|
return { status: 'success', data: 123 };
|
|
23
23
|
}).then(() => {
|
|
24
|
-
console.log('->
|
|
24
|
+
console.log('-> done\n');
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
console.log('[Test 3] run()
|
|
26
|
+
// Test 3: run() wrapper failure
|
|
27
|
+
console.log('[Test 3] run() wrapper - failure case');
|
|
28
28
|
return run('test-skill', async () => {
|
|
29
|
-
throw new Error('
|
|
29
|
+
throw new Error('intentional error');
|
|
30
30
|
}).catch(e => {
|
|
31
|
-
console.log('->
|
|
32
|
-
console.log('->
|
|
31
|
+
console.log('-> error captured:', e.message);
|
|
32
|
+
console.log('-> done\n');
|
|
33
33
|
});
|
|
34
34
|
}).then(() => {
|
|
35
|
-
//
|
|
36
|
-
console.log('=== crewx.db
|
|
35
|
+
// Verify results
|
|
36
|
+
console.log('=== crewx.db check ===');
|
|
37
37
|
const Database = require('better-sqlite3');
|
|
38
38
|
const db = new Database(getDbPath());
|
|
39
39
|
const rows = db.prepare(`
|
|
@@ -44,11 +44,11 @@ run('test-skill', async () => {
|
|
|
44
44
|
LIMIT 5
|
|
45
45
|
`).all();
|
|
46
46
|
|
|
47
|
-
console.log('\
|
|
47
|
+
console.log('\nRecent test-skill records:');
|
|
48
48
|
rows.forEach(r => {
|
|
49
49
|
console.log(` [${r.status}] ${r.prompt.substring(0, 50)}... (${r.duration_ms}ms)`);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
db.close();
|
|
53
|
-
console.log('\n===
|
|
53
|
+
console.log('\n=== test complete ===');
|
|
54
54
|
});
|