@ckanner/dsh-plugin-flywheel 0.0.0-stage → 0.27.3

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/worker.js ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ import { runWorker } from './bridge.js';
3
+ import { BridgeError, MAX_FRAME_BYTES, normalizedError } from './protocol.js';
4
+
5
+ const controller = new AbortController();
6
+ process.once('SIGTERM', () => controller.abort());
7
+ process.once('SIGINT', () => controller.abort());
8
+ // The engine writes exactly one request then closes stdin. EOF after admission
9
+ // is normal and must not cancel an in-flight model turn.
10
+ async function readInput() {
11
+ const chunks = [];
12
+ let bytes = 0;
13
+ const admission = setTimeout(() => process.stdin.destroy(new BridgeError('TIMEOUT', 'no complete worker request within 10 seconds')), 10000);
14
+ try {
15
+ for await (const chunk of process.stdin) {
16
+ bytes += chunk.length;
17
+ if (bytes > MAX_FRAME_BYTES) throw new BridgeError('INVALID_REQUEST', 'worker request exceeds 8 MiB');
18
+ chunks.push(chunk);
19
+ }
20
+ const lines = Buffer.concat(chunks).toString('utf8').trim().split('\n');
21
+ if (lines.length !== 1 || !lines[0]) throw new BridgeError('INVALID_REQUEST', 'expected exactly one JSON line then EOF');
22
+ try { return JSON.parse(lines[0]); } catch {
23
+ throw new BridgeError('INVALID_REQUEST', 'worker request is not valid JSON');
24
+ }
25
+ } finally {
26
+ clearTimeout(admission);
27
+ }
28
+ }
29
+
30
+ const emit = value => process.stdout.write(JSON.stringify(value) + '\n');
31
+ try {
32
+ if (process.argv.slice(2).some(arg => arg !== '--doctor') || process.argv.length > 3) {
33
+ throw new BridgeError('INVALID_REQUEST', 'worker accepts only optional --doctor');
34
+ }
35
+ const request = await readInput();
36
+ const result = await runWorker(request, {
37
+ emit, signal: controller.signal, doctor: process.argv.includes('--doctor'),
38
+ stderr: chunk => process.stderr.write(chunk),
39
+ });
40
+ process.exitCode = result.status === 'ok' ? 0 : result.status === 'cancelled' ? 143 : 1;
41
+ } catch (error) {
42
+ emit({ protocol: 1, requestId: 'invalid-request', type: 'result', status: 'error', settled: true,
43
+ text: '', usage: null, costUsd: null, error: normalizedError(error) });
44
+ process.exitCode = 1;
45
+ }
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@ckanner/dsh-plugin-flywheel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.27.3",
4
+ "description": "Flywheel engine controls and an owned native DSH SDK worker",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "engines": {
8
+ "node": ">=22.0.0",
9
+ "dsh": "0.2.1-rc.5"
10
+ },
11
+ "exports": {
12
+ ".": "./dist/index.js",
13
+ "./client": "./dist/client.js",
14
+ "./worker-policy": "./dist/policy.js",
15
+ "./worker": "./dist/worker.js",
16
+ "./package.json": "./package.json"
17
+ },
18
+ "bin": {
19
+ "flywheel-dsh-worker": "./dist/worker.js"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "cordis.patch.yml",
24
+ "README.md",
25
+ "PROTOCOL.md"
26
+ ],
27
+ "dsh": {
28
+ "bundle": {
29
+ "patch": "./cordis.patch.yml"
30
+ },
31
+ "client": {
32
+ "inject": [
33
+ "@deepseek-ai/dsh-client-ui-chat",
34
+ "@deepseek-ai/dsh-client-ui-commands",
35
+ "@deepseek-ai/dsh-api-remotes"
36
+ ],
37
+ "platform": "web"
38
+ }
39
+ },
40
+ "peerDependencies": {
41
+ "@deepseek-ai/cordis": "~4.0.5",
42
+ "@deepseek-ai/dsh-commands": "0.2.1-rc.5",
43
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.5"
44
+ },
45
+ "peerDependenciesMeta": {
46
+ "@deepseek-ai/cordis": {
47
+ "optional": true
48
+ },
49
+ "@deepseek-ai/dsh-commands": {
50
+ "optional": true
51
+ },
52
+ "@deepseek-ai/dsh-tools": {
53
+ "optional": true
54
+ }
55
+ },
56
+ "scripts": {
57
+ "build": "node scripts/build.mjs",
58
+ "test": "npm run build && node --test test/*.test.js",
59
+ "check": "npm test",
60
+ "prepack": "npm run build"
61
+ },
62
+ "devDependencies": {
63
+ "jsdom": "26.1.0",
64
+ "react": "18.3.1",
65
+ "react-dom": "18.3.1"
66
+ },
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "git+https://github.com/ckanner/flywheel.git",
70
+ "directory": "plugins/dsh"
71
+ }
72
+ }