@northflare/runner 0.0.12 → 0.0.13
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 -3
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/coverage-final.json +0 -12
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -176
- package/coverage/lib/index.html +0 -116
- package/coverage/lib/preload-script.js.html +0 -964
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/src/collections/index.html +0 -116
- package/coverage/src/collections/runner-messages.ts.html +0 -312
- package/coverage/src/components/claude-manager.ts.html +0 -1290
- package/coverage/src/components/index.html +0 -146
- package/coverage/src/components/message-handler.ts.html +0 -730
- package/coverage/src/components/repository-manager.ts.html +0 -841
- package/coverage/src/index.html +0 -131
- package/coverage/src/index.ts.html +0 -448
- package/coverage/src/runner.ts.html +0 -1239
- package/coverage/src/utils/config.ts.html +0 -780
- package/coverage/src/utils/console.ts.html +0 -121
- package/coverage/src/utils/index.html +0 -161
- package/coverage/src/utils/logger.ts.html +0 -475
- package/coverage/src/utils/status-line.ts.html +0 -445
- package/exceptions.log +0 -24
- package/lib/codex-sdk/src/codex.ts +0 -38
- package/lib/codex-sdk/src/codexOptions.ts +0 -10
- package/lib/codex-sdk/src/events.ts +0 -80
- package/lib/codex-sdk/src/exec.ts +0 -336
- package/lib/codex-sdk/src/index.ts +0 -39
- package/lib/codex-sdk/src/items.ts +0 -127
- package/lib/codex-sdk/src/outputSchemaFile.ts +0 -40
- package/lib/codex-sdk/src/thread.ts +0 -155
- package/lib/codex-sdk/src/threadOptions.ts +0 -18
- package/lib/codex-sdk/src/turnOptions.ts +0 -6
- package/lib/codex-sdk/tests/abort.test.ts +0 -165
- package/lib/codex-sdk/tests/codexExecSpy.ts +0 -37
- package/lib/codex-sdk/tests/responsesProxy.ts +0 -225
- package/lib/codex-sdk/tests/run.test.ts +0 -687
- package/lib/codex-sdk/tests/runStreamed.test.ts +0 -211
- package/lib/codex-sdk/tsconfig.json +0 -24
- package/rejections.log +0 -68
- package/runner.log +0 -488
- package/src/components/claude-sdk-manager.ts +0 -1425
- package/src/components/codex-sdk-manager.ts +0 -1358
- package/src/components/enhanced-repository-manager.ts +0 -823
- package/src/components/message-handler-sse.ts +0 -1097
- package/src/components/repository-manager.ts +0 -337
- package/src/index.ts +0 -168
- package/src/runner-sse.ts +0 -917
- package/src/services/RunnerAPIClient.ts +0 -175
- package/src/services/SSEClient.ts +0 -258
- package/src/types/claude.ts +0 -66
- package/src/types/computer-name.d.ts +0 -4
- package/src/types/index.ts +0 -64
- package/src/types/messages.ts +0 -39
- package/src/types/runner-interface.ts +0 -36
- package/src/utils/StateManager.ts +0 -187
- package/src/utils/config.ts +0 -327
- package/src/utils/console.ts +0 -15
- package/src/utils/debug.ts +0 -18
- package/src/utils/expand-env.ts +0 -22
- package/src/utils/logger.ts +0 -134
- package/src/utils/model.ts +0 -29
- package/src/utils/status-line.ts +0 -122
- package/src/utils/tool-response-sanitizer.ts +0 -160
- package/test-debug.sh +0 -26
- package/tests/retry-strategies.test.ts +0 -410
- package/tests/sdk-integration.test.ts +0 -329
- package/tests/sdk-streaming.test.ts +0 -1180
- package/tests/setup.ts +0 -5
- package/tests/test-claude-manager.ts +0 -120
- package/tests/tool-response-sanitizer.test.ts +0 -63
- package/tsconfig.json +0 -36
- package/vitest.config.ts +0 -27
package/tests/setup.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test script for ClaudeManager integration
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { RunnerApp } from "../src/runner";
|
|
6
|
-
import { ClaudeManager } from "../src/components/claude-manager";
|
|
7
|
-
import { RepositoryManager } from "../src/components/repository-manager";
|
|
8
|
-
import { ConversationConfig, ConversationContext } from "../src/types";
|
|
9
|
-
|
|
10
|
-
// Mock runner app for testing
|
|
11
|
-
const mockRunner = {
|
|
12
|
-
config_: {
|
|
13
|
-
orchestratorUrl: "https://example.com",
|
|
14
|
-
runnerId: "test-runner",
|
|
15
|
-
},
|
|
16
|
-
activeConversations_: new Map<string, ConversationContext>(),
|
|
17
|
-
getConversationContext: function (taskId: string): ConversationContext {
|
|
18
|
-
const context = this.activeConversations_.get(taskId);
|
|
19
|
-
if (!context) {
|
|
20
|
-
throw new Error(`No conversation context for task ${taskId}`);
|
|
21
|
-
}
|
|
22
|
-
return context;
|
|
23
|
-
},
|
|
24
|
-
notify: async function (method: string, params: any) {
|
|
25
|
-
console.log(`NOTIFY: ${method}`, params);
|
|
26
|
-
},
|
|
27
|
-
} as unknown as RunnerApp;
|
|
28
|
-
|
|
29
|
-
// Create test instances
|
|
30
|
-
const repositoryManager = new RepositoryManager(mockRunner);
|
|
31
|
-
const claudeManager = new ClaudeManager(mockRunner, repositoryManager);
|
|
32
|
-
|
|
33
|
-
async function testClaudeManager() {
|
|
34
|
-
console.log("Testing ClaudeManager integration...\n");
|
|
35
|
-
|
|
36
|
-
const taskId = "test-task-123";
|
|
37
|
-
const workspaceId = "test-workspace-456";
|
|
38
|
-
|
|
39
|
-
// Create test conversation config
|
|
40
|
-
const config: ConversationConfig = {
|
|
41
|
-
model: "sonnet",
|
|
42
|
-
systemPrompt: "You are a helpful assistant.",
|
|
43
|
-
instructions: "Help the user with their coding tasks.",
|
|
44
|
-
permissionsMode: "all",
|
|
45
|
-
accessKey: "test-access-key",
|
|
46
|
-
workspaceId: workspaceId,
|
|
47
|
-
mcpServers: {
|
|
48
|
-
// Test MCP configuration from orchestrator
|
|
49
|
-
"test-server": {
|
|
50
|
-
command: "test-mcp-server",
|
|
51
|
-
args: ["--test"],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Create conversation context
|
|
57
|
-
const context: ConversationContext = {
|
|
58
|
-
taskId,
|
|
59
|
-
workspaceId,
|
|
60
|
-
status: "starting",
|
|
61
|
-
config,
|
|
62
|
-
startedAt: new Date(),
|
|
63
|
-
lastActivityAt: new Date(),
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
mockRunner.activeConversations_.set(taskId, context);
|
|
67
|
-
|
|
68
|
-
// Test 1: Start conversation
|
|
69
|
-
console.log("Test 1: Starting conversation...");
|
|
70
|
-
try {
|
|
71
|
-
await claudeManager.startConversation(taskId, config, [
|
|
72
|
-
{ content: "Hello, Claude!" },
|
|
73
|
-
]);
|
|
74
|
-
console.log("✅ Conversation start initiated\n");
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error("❌ Failed to start conversation:", error);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Test 2: Send user message
|
|
80
|
-
console.log("Test 2: Sending user message...");
|
|
81
|
-
try {
|
|
82
|
-
// Simulate conversation being active
|
|
83
|
-
context.status = "active";
|
|
84
|
-
context.sessionId = "test-session-123";
|
|
85
|
-
|
|
86
|
-
await claudeManager.sendUserMessage(
|
|
87
|
-
taskId,
|
|
88
|
-
"test-session-123",
|
|
89
|
-
"How are you?"
|
|
90
|
-
);
|
|
91
|
-
console.log("✅ User message sent\n");
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error("❌ Failed to send user message:", error);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Test 3: Resume conversation
|
|
97
|
-
console.log("Test 3: Resuming conversation...");
|
|
98
|
-
try {
|
|
99
|
-
await claudeManager.resumeConversation(taskId, "test-session-123", config);
|
|
100
|
-
console.log("✅ Conversation resume initiated\n");
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error("❌ Failed to resume conversation:", error);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Test 4: Stop conversation
|
|
106
|
-
console.log("Test 4: Stopping conversation...");
|
|
107
|
-
try {
|
|
108
|
-
await claudeManager.stopConversation(taskId, "test-session-123");
|
|
109
|
-
console.log("✅ Conversation stopped\n");
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.error("❌ Failed to stop conversation:", error);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
console.log("Testing complete!");
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Run tests if this is the main module
|
|
118
|
-
if (require.main === module) {
|
|
119
|
-
testClaudeManager().catch(console.error);
|
|
120
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
sanitizeToolResponsePayload,
|
|
4
|
-
TOOL_RESPONSE_BYTE_LIMIT,
|
|
5
|
-
TOOL_RESPONSE_SUFFIX,
|
|
6
|
-
} from "../src/utils/tool-response-sanitizer";
|
|
7
|
-
|
|
8
|
-
describe("sanitizeToolResponsePayload", () => {
|
|
9
|
-
it("returns original params for non message.agent notifications", () => {
|
|
10
|
-
const payload = { type: "tool_result", content: [] };
|
|
11
|
-
const result = sanitizeToolResponsePayload("runner.heartbeat", payload);
|
|
12
|
-
expect(result.truncated).toBe(false);
|
|
13
|
-
expect(result.params).toBe(payload);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("truncates oversized tool_result strings", () => {
|
|
17
|
-
const longText = "x".repeat(TOOL_RESPONSE_BYTE_LIMIT + 128);
|
|
18
|
-
const payload = {
|
|
19
|
-
type: "tool_result",
|
|
20
|
-
tool_use_id: "tool-123",
|
|
21
|
-
content: [{ type: "text", text: longText }],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const result = sanitizeToolResponsePayload("message.agent", payload);
|
|
25
|
-
expect(result.truncated).toBe(true);
|
|
26
|
-
expect(result.toolUseId).toBe("tool-123");
|
|
27
|
-
|
|
28
|
-
const sanitizedText = result.params.content[0].text as string;
|
|
29
|
-
expect(sanitizedText.endsWith(TOOL_RESPONSE_SUFFIX)).toBe(true);
|
|
30
|
-
expect(Buffer.byteLength(sanitizedText, "utf8")).toBeLessThanOrEqual(
|
|
31
|
-
TOOL_RESPONSE_BYTE_LIMIT + Buffer.byteLength(TOOL_RESPONSE_SUFFIX, "utf8")
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// Ensure original payload was not mutated
|
|
35
|
-
expect(payload.content[0].text).toBe(longText);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("enforces the byte budget across multiple string blocks", () => {
|
|
39
|
-
const firstBlockBytes = 400 * 1024;
|
|
40
|
-
const secondBlockBytes = 200 * 1024;
|
|
41
|
-
const payload = {
|
|
42
|
-
type: "tool_result",
|
|
43
|
-
content: [
|
|
44
|
-
{ type: "text", text: "a".repeat(firstBlockBytes) },
|
|
45
|
-
{ type: "text", text: "b".repeat(secondBlockBytes) },
|
|
46
|
-
],
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const result = sanitizeToolResponsePayload("message.agent", payload);
|
|
50
|
-
expect(result.truncated).toBe(true);
|
|
51
|
-
|
|
52
|
-
const first = result.params.content[0].text as string;
|
|
53
|
-
const second = result.params.content[1].text as string;
|
|
54
|
-
|
|
55
|
-
expect(Buffer.byteLength(first, "utf8")).toBe(firstBlockBytes);
|
|
56
|
-
expect(second.endsWith(TOOL_RESPONSE_SUFFIX)).toBe(true);
|
|
57
|
-
const combinedBytes =
|
|
58
|
-
Buffer.byteLength(first, "utf8") + Buffer.byteLength(second, "utf8");
|
|
59
|
-
expect(combinedBytes).toBeLessThanOrEqual(
|
|
60
|
-
TOOL_RESPONSE_BYTE_LIMIT + Buffer.byteLength(TOOL_RESPONSE_SUFFIX, "utf8")
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2022"],
|
|
6
|
-
"rootDir": "./src",
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"baseUrl": "./src",
|
|
18
|
-
"paths": {
|
|
19
|
-
"@/*": ["*"],
|
|
20
|
-
"@components/*": ["components/*"],
|
|
21
|
-
"@utils/*": ["utils/*"],
|
|
22
|
-
"@types/*": ["types/*"]
|
|
23
|
-
},
|
|
24
|
-
"noUnusedLocals": false,
|
|
25
|
-
"noUnusedParameters": false,
|
|
26
|
-
"noImplicitReturns": true,
|
|
27
|
-
"noFallthroughCasesInSwitch": true,
|
|
28
|
-
"noUncheckedIndexedAccess": true,
|
|
29
|
-
"noImplicitOverride": true,
|
|
30
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
31
|
-
"allowUnusedLabels": false,
|
|
32
|
-
"allowUnreachableCode": false
|
|
33
|
-
},
|
|
34
|
-
"include": ["src/**/*"],
|
|
35
|
-
"exclude": ["node_modules", "dist", "tests"]
|
|
36
|
-
}
|
package/vitest.config.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
globals: true,
|
|
7
|
-
environment: 'node',
|
|
8
|
-
setupFiles: ['./tests/setup.ts'],
|
|
9
|
-
testTimeout: 10000,
|
|
10
|
-
coverage: {
|
|
11
|
-
provider: 'v8',
|
|
12
|
-
reporter: ['text', 'json', 'html'],
|
|
13
|
-
exclude: [
|
|
14
|
-
'node_modules/',
|
|
15
|
-
'dist/',
|
|
16
|
-
'**/*.d.ts',
|
|
17
|
-
'**/types/**',
|
|
18
|
-
'tests/**'
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
resolve: {
|
|
23
|
-
alias: {
|
|
24
|
-
'@': path.resolve(__dirname, './src')
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|