@mrc2204/opencode-bridge 0.1.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/README.en.md +115 -0
- package/README.md +117 -0
- package/dist/chunk-6NIQKNRA.js +176 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +814 -0
- package/dist/observability.d.ts +52 -0
- package/dist/observability.js +16 -0
- package/openclaw.plugin.json +56 -0
- package/package.json +49 -0
- package/skills/opencode-orchestration/SKILL.md +658 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
type OpenCodeEventKind = "task.started" | "task.progress" | "permission.requested" | "task.stalled" | "task.failed" | "task.completed";
|
|
2
|
+
type EventScope = "session" | "global";
|
|
3
|
+
type SseFrame = {
|
|
4
|
+
event?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
retry?: number;
|
|
7
|
+
data: string;
|
|
8
|
+
raw: string;
|
|
9
|
+
};
|
|
10
|
+
type TypedEventV1 = {
|
|
11
|
+
schema: "opencode.event.v1";
|
|
12
|
+
scope: EventScope;
|
|
13
|
+
eventName?: string;
|
|
14
|
+
eventId?: string;
|
|
15
|
+
kind: OpenCodeEventKind | null;
|
|
16
|
+
summary?: string;
|
|
17
|
+
runId?: string;
|
|
18
|
+
taskId?: string;
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
wrappers: string[];
|
|
22
|
+
payload: any;
|
|
23
|
+
};
|
|
24
|
+
declare function parseSseFramesFromBuffer(input: string): {
|
|
25
|
+
frames: SseFrame[];
|
|
26
|
+
remainder: string;
|
|
27
|
+
};
|
|
28
|
+
declare function parseSseData(data: string): any;
|
|
29
|
+
declare function unwrapGlobalPayload(raw: any): {
|
|
30
|
+
payload: any;
|
|
31
|
+
wrappers: string[];
|
|
32
|
+
};
|
|
33
|
+
declare function normalizeOpenCodeEvent(raw: any): {
|
|
34
|
+
kind: OpenCodeEventKind | null;
|
|
35
|
+
summary?: string;
|
|
36
|
+
raw: any;
|
|
37
|
+
};
|
|
38
|
+
declare function normalizeTypedEventV1(frame: SseFrame, scope: EventScope): TypedEventV1;
|
|
39
|
+
declare function resolveSessionId(input: {
|
|
40
|
+
explicitSessionId?: string;
|
|
41
|
+
runId?: string;
|
|
42
|
+
taskId?: string;
|
|
43
|
+
sessionKey?: string;
|
|
44
|
+
artifactSessionId?: string;
|
|
45
|
+
sessionList?: any[];
|
|
46
|
+
}): {
|
|
47
|
+
sessionId?: string;
|
|
48
|
+
strategy: "explicit" | "artifact" | "scored_fallback" | "latest" | "none";
|
|
49
|
+
score?: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { type EventScope, type OpenCodeEventKind, type SseFrame, type TypedEventV1, normalizeOpenCodeEvent, normalizeTypedEventV1, parseSseData, parseSseFramesFromBuffer, resolveSessionId, unwrapGlobalPayload };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeOpenCodeEvent,
|
|
3
|
+
normalizeTypedEventV1,
|
|
4
|
+
parseSseData,
|
|
5
|
+
parseSseFramesFromBuffer,
|
|
6
|
+
resolveSessionId,
|
|
7
|
+
unwrapGlobalPayload
|
|
8
|
+
} from "./chunk-6NIQKNRA.js";
|
|
9
|
+
export {
|
|
10
|
+
normalizeOpenCodeEvent,
|
|
11
|
+
normalizeTypedEventV1,
|
|
12
|
+
parseSseData,
|
|
13
|
+
parseSseFramesFromBuffer,
|
|
14
|
+
resolveSessionId,
|
|
15
|
+
unwrapGlobalPayload
|
|
16
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "opencode-bridge",
|
|
3
|
+
"name": "OpenCode Bridge",
|
|
4
|
+
"description": "Bridge plugin scaffold for OpenClaw ↔ OpenCode orchestration.",
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"configSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"opencodeServerUrl": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Base URL of the OpenCode serve instance for this bridge."
|
|
13
|
+
},
|
|
14
|
+
"projectRegistry": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"description": "Optional project-to-server registry entries.",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"properties": {
|
|
21
|
+
"projectId": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"repoRoot": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"serverUrl": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"idleTimeoutMs": {
|
|
31
|
+
"type": "number"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"projectId",
|
|
36
|
+
"repoRoot",
|
|
37
|
+
"serverUrl"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"uiHints": {
|
|
44
|
+
"opencodeServerUrl": {
|
|
45
|
+
"label": "OpenCode Server URL",
|
|
46
|
+
"placeholder": "http://127.0.0.1:4096"
|
|
47
|
+
},
|
|
48
|
+
"hookBaseUrl": {
|
|
49
|
+
"label": "OpenClaw Hook Base URL",
|
|
50
|
+
"placeholder": "http://127.0.0.1:18789"
|
|
51
|
+
},
|
|
52
|
+
"hookToken": {
|
|
53
|
+
"label": "OpenClaw Hook Token"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mrc2204/opencode-bridge",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "OpenClaw ↔ OpenCode bridge plugin for routing, callback, SSE probing, and runtime-ops scaffolding.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"private": false,
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/cong91/openclaw-opencode-bridge.git"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rm -rf dist",
|
|
26
|
+
"build": "tsup src/index.ts src/observability.ts --format esm --dts --clean",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "tsx test/run-tests.ts",
|
|
29
|
+
"prepublishOnly": "npm run build && npm run test"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.14.1",
|
|
33
|
+
"tsup": "^8.4.0",
|
|
34
|
+
"tsx": "^4.19.3",
|
|
35
|
+
"typescript": "^5.8.2"
|
|
36
|
+
},
|
|
37
|
+
"openclaw": {
|
|
38
|
+
"extensions": [
|
|
39
|
+
"./dist/index.js"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist/",
|
|
44
|
+
"skills/",
|
|
45
|
+
"README.md",
|
|
46
|
+
"README.en.md",
|
|
47
|
+
"openclaw.plugin.json"
|
|
48
|
+
]
|
|
49
|
+
}
|