openclaw-codex-feishu 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.
Files changed (38) hide show
  1. package/README.md +49 -0
  2. package/dist/commands/codex.schema.d.ts +103 -0
  3. package/dist/commands/codex.schema.js +42 -0
  4. package/dist/config.d.ts +24 -0
  5. package/dist/config.js +24 -0
  6. package/dist/index.d.ts +8 -0
  7. package/dist/index.js +66 -0
  8. package/dist/render/rawChunkRenderer.d.ts +12 -0
  9. package/dist/render/rawChunkRenderer.js +37 -0
  10. package/dist/render/transcriptNormalizer.d.ts +1 -0
  11. package/dist/render/transcriptNormalizer.js +12 -0
  12. package/dist/runtime/bridgeRuntime.d.ts +40 -0
  13. package/dist/runtime/bridgeRuntime.js +303 -0
  14. package/dist/state/bindingStore.d.ts +19 -0
  15. package/dist/state/bindingStore.js +58 -0
  16. package/dist/state/journalStore.d.ts +8 -0
  17. package/dist/state/journalStore.js +21 -0
  18. package/dist/state/schemas.d.ts +30 -0
  19. package/dist/state/schemas.js +1 -0
  20. package/dist/transport/appServerClient.d.ts +20 -0
  21. package/dist/transport/appServerClient.js +46 -0
  22. package/dist/transport/protocol.d.ts +22 -0
  23. package/dist/transport/protocol.js +1 -0
  24. package/dist/transport/stdioTransport.d.ts +17 -0
  25. package/dist/transport/stdioTransport.js +97 -0
  26. package/dist/utils/ids.d.ts +1 -0
  27. package/dist/utils/ids.js +4 -0
  28. package/dist/utils/keyedQueue.d.ts +4 -0
  29. package/dist/utils/keyedQueue.js +16 -0
  30. package/dist/utils/logger.d.ts +7 -0
  31. package/dist/utils/logger.js +6 -0
  32. package/docs/cards/approval-card.json +21 -0
  33. package/docs/cards/control-card.json +26 -0
  34. package/docs/cards/turn-live-card.json +15 -0
  35. package/openclaw.plugin.json +122 -0
  36. package/package.json +49 -0
  37. package/scripts/install.mjs +34 -0
  38. package/skills/codex-bridge/SKILL.md +14 -0
@@ -0,0 +1,16 @@
1
+ export class KeyedQueue {
2
+ tails = new Map();
3
+ enqueue(key, task) {
4
+ const tail = this.tails.get(key) ?? Promise.resolve();
5
+ const next = tail
6
+ .catch(() => undefined)
7
+ .then(task)
8
+ .finally(() => {
9
+ if (this.tails.get(key) === next) {
10
+ this.tails.delete(key);
11
+ }
12
+ });
13
+ this.tails.set(key, next);
14
+ return next;
15
+ }
16
+ }
@@ -0,0 +1,7 @@
1
+ export interface LoggerLike {
2
+ info(message: string, ...meta: unknown[]): void;
3
+ warn(message: string, ...meta: unknown[]): void;
4
+ error(message: string, ...meta: unknown[]): void;
5
+ debug?(message: string, ...meta: unknown[]): void;
6
+ }
7
+ export declare const noopLogger: LoggerLike;
@@ -0,0 +1,6 @@
1
+ export const noopLogger = {
2
+ info: () => undefined,
3
+ warn: () => undefined,
4
+ error: () => undefined,
5
+ debug: () => undefined
6
+ };
@@ -0,0 +1,21 @@
1
+ {
2
+ "schema": "2.0",
3
+ "header": {
4
+ "title": { "tag": "plain_text", "content": "Codex 审批请求" },
5
+ "template": "orange"
6
+ },
7
+ "body": {
8
+ "elements": [
9
+ { "tag": "markdown", "content": "**RequestId**: `apr_001`\n**类型**: shell\n**命令**: `git push origin feat/codex`\n**原因**: 需要将修复提交到远端仓库" },
10
+ {
11
+ "tag": "action",
12
+ "actions": [
13
+ { "tag": "button", "text": { "tag": "plain_text", "content": "允许一次" }, "type": "primary", "value": { "a": "allow-once", "id": "apr_001" } },
14
+ { "tag": "button", "text": { "tag": "plain_text", "content": "本会话总是允许" }, "type": "default", "value": { "a": "allow-always", "id": "apr_001" } },
15
+ { "tag": "button", "text": { "tag": "plain_text", "content": "拒绝" }, "type": "danger", "value": { "a": "deny", "id": "apr_001" } },
16
+ { "tag": "button", "text": { "tag": "plain_text", "content": "取消" }, "type": "default", "value": { "a": "cancel", "id": "apr_001" } }
17
+ ]
18
+ }
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "schema": "2.0",
3
+ "config": { "wide_screen_mode": true },
4
+ "header": {
5
+ "title": { "tag": "plain_text", "content": "Codex 控制台" },
6
+ "template": "blue"
7
+ },
8
+ "body": {
9
+ "elements": [
10
+ { "tag": "markdown", "content": "**状态**: 运行中\n**Thread**: `thr_123`\n**工作目录**: `/Users/me/work`\n**模型**: `gpt-5.4`\n**Raw**: `cli`" },
11
+ { "tag": "hr" },
12
+ { "tag": "markdown", "content": "**最近命令**: `pnpm test`\n**Todo**: 2/5 完成\n**待审批**: 1" },
13
+ {
14
+ "tag": "action",
15
+ "actions": [
16
+ { "tag": "button", "text": { "tag": "plain_text", "content": "新建" }, "type": "default", "value": { "a": "new" } },
17
+ { "tag": "button", "text": { "tag": "plain_text", "content": "继续" }, "type": "default", "value": { "a": "resume" } },
18
+ { "tag": "button", "text": { "tag": "plain_text", "content": "停止" }, "type": "danger", "value": { "a": "stop" } },
19
+ { "tag": "button", "text": { "tag": "plain_text", "content": "Review" }, "type": "default", "value": { "a": "review" } },
20
+ { "tag": "button", "text": { "tag": "plain_text", "content": "日志" }, "type": "default", "value": { "a": "log" } },
21
+ { "tag": "button", "text": { "tag": "plain_text", "content": "Detach" }, "type": "default", "value": { "a": "detach" } }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "schema": "2.0",
3
+ "header": {
4
+ "title": { "tag": "plain_text", "content": "Codex 当前 Turn 实时流" },
5
+ "template": "wathet"
6
+ },
7
+ "body": {
8
+ "elements": [
9
+ { "tag": "markdown", "content": "**Turn**: `turn_456`\n**阶段**: 执行中" },
10
+ { "tag": "markdown", "content": "**Agent Tail**\n```\n已定位到错误来源,正在修复并补充测试。\n```" },
11
+ { "tag": "markdown", "content": "**CLI Tail**\n```\n$ pnpm test\n PASS src/state/schemas.test.ts\n```" },
12
+ { "tag": "markdown", "content": "**Plan**\n1. 定位问题 ✅\n2. 修改实现 ⏳\n3. 增加回归测试 ⏳" }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "id": "codex-feishu",
3
+ "name": "OpenClaw Codex Feishu Bridge",
4
+ "version": "0.1.1",
5
+ "description": "Feishu-first Codex app-server bridge plugin with control cards, raw chunk streaming, and JSONL journaling.",
6
+ "skills": [
7
+ "skills/codex-bridge"
8
+ ],
9
+ "uiHints": {
10
+ "adminLabel": "Codex × Feishu",
11
+ "category": "automation",
12
+ "tags": [
13
+ "codex",
14
+ "feishu",
15
+ "bridge"
16
+ ]
17
+ },
18
+ "configSchema": {
19
+ "type": "object",
20
+ "properties": {
21
+ "transport": {
22
+ "type": "string",
23
+ "enum": [
24
+ "stdio"
25
+ ],
26
+ "default": "stdio"
27
+ },
28
+ "command": {
29
+ "type": "string",
30
+ "default": "codex"
31
+ },
32
+ "args": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "string"
36
+ },
37
+ "default": [
38
+ "app-server",
39
+ "--listen",
40
+ "stdio://"
41
+ ]
42
+ },
43
+ "defaultWorkspaceDir": {
44
+ "type": "string"
45
+ },
46
+ "defaultModel": {
47
+ "type": "string",
48
+ "default": "gpt-5.4"
49
+ },
50
+ "attachModeDefault": {
51
+ "type": "string",
52
+ "enum": [
53
+ "attached",
54
+ "toolOnly"
55
+ ],
56
+ "default": "attached"
57
+ },
58
+ "rawModeDefault": {
59
+ "type": "string",
60
+ "enum": [
61
+ "off",
62
+ "cli",
63
+ "all"
64
+ ],
65
+ "default": "cli"
66
+ },
67
+ "feishu": {
68
+ "type": "object",
69
+ "properties": {
70
+ "pinControlCard": {
71
+ "type": "boolean",
72
+ "default": true
73
+ },
74
+ "rotateControlCardAfterDays": {
75
+ "type": "integer",
76
+ "minimum": 1,
77
+ "default": 12
78
+ },
79
+ "controlCardEditMinIntervalMs": {
80
+ "type": "integer",
81
+ "minimum": 250,
82
+ "default": 1000
83
+ },
84
+ "streamFlushMs": {
85
+ "type": "integer",
86
+ "minimum": 100,
87
+ "default": 750
88
+ },
89
+ "streamChunkChars": {
90
+ "type": "integer",
91
+ "minimum": 400,
92
+ "default": 1500
93
+ },
94
+ "liveTailChars": {
95
+ "type": "integer",
96
+ "minimum": 400,
97
+ "default": 1200
98
+ },
99
+ "sendJsonlOnTurnComplete": {
100
+ "type": "boolean",
101
+ "default": true
102
+ },
103
+ "sendReadableTranscriptOnTurnComplete": {
104
+ "type": "boolean",
105
+ "default": false
106
+ },
107
+ "buttonsOnly": {
108
+ "type": "boolean",
109
+ "default": true
110
+ }
111
+ },
112
+ "additionalProperties": false
113
+ }
114
+ },
115
+ "required": [
116
+ "transport",
117
+ "command",
118
+ "args"
119
+ ],
120
+ "additionalProperties": false
121
+ }
122
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "openclaw-codex-feishu",
3
+ "version": "0.1.1",
4
+ "description": "OpenClaw native plugin scaffold for bridging Codex app-server with Feishu-first rendering.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "openclaw-codex-feishu": "./scripts/install.mjs"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "openclaw.plugin.json",
13
+ "skills",
14
+ "docs/cards",
15
+ "scripts/install.mjs"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc -p tsconfig.json",
19
+ "typecheck": "tsc -p tsconfig.json --noEmit",
20
+ "validate:json": "python -m json.tool openclaw.plugin.json >/dev/null && python -m json.tool docs/cards/control-card.json >/dev/null && python -m json.tool docs/cards/approval-card.json >/dev/null && python -m json.tool docs/cards/turn-live-card.json >/dev/null"
21
+ },
22
+ "keywords": [
23
+ "openclaw",
24
+ "plugin",
25
+ "codex",
26
+ "feishu"
27
+ ],
28
+ "license": "MIT",
29
+ "openclaw": {
30
+ "extensions": [
31
+ "./dist/index.js"
32
+ ],
33
+ "compat": {
34
+ "pluginApi": ">=2026.3.24-beta.2",
35
+ "minGatewayVersion": "2026.3.24-beta.2"
36
+ },
37
+ "build": {
38
+ "openclawVersion": "2026.3.24-beta.2",
39
+ "pluginSdkVersion": "2026.3.24-beta.2"
40
+ }
41
+ },
42
+ "dependencies": {
43
+ "@sinclair/typebox": "^0.34.41"
44
+ },
45
+ "devDependencies": {
46
+ "openclaw": "^2026.3.24-beta.2",
47
+ "typescript": "^5.8.3"
48
+ }
49
+ }
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import { fileURLToPath } from "node:url";
5
+ import path from "node:path";
6
+
7
+ const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
8
+ const pluginId = "codex-feishu";
9
+ const command = process.argv[2];
10
+
11
+ function printHelp() {
12
+ console.log("用法: npx openclaw-codex-feishu install");
13
+ }
14
+
15
+ function runOrThrow(args) {
16
+ const result = spawnSync("npx", ["-y", "openclaw", ...args], {
17
+ stdio: "inherit",
18
+ env: process.env
19
+ });
20
+
21
+ if (result.status !== 0) {
22
+ process.exit(result.status ?? 1);
23
+ }
24
+ }
25
+
26
+ if (command !== "install") {
27
+ printHelp();
28
+ process.exit(command ? 1 : 0);
29
+ }
30
+
31
+ runOrThrow(["plugins", "install", pluginRoot]);
32
+ runOrThrow(["plugins", "enable", pluginId]);
33
+
34
+ console.log(`✅ 已安装并启用插件: ${pluginId}`);
@@ -0,0 +1,14 @@
1
+ # codex-bridge
2
+
3
+ ## 目的
4
+ 将“把任务交给 Codex”的自然语言意图路由到 `codex_bridge.send` 工具,避免主 agent 转述长输出。
5
+
6
+ ## 工作流
7
+ 1. 识别用户意图(例如“用 codex 做这个”)。
8
+ 2. 调用 `codex_bridge.send`,仅传入任务目标与上下文。
9
+ 3. 返回简短确认:`Codex 已接管,输出将直接回流到当前 Feishu 聊天。`
10
+ 4. 不在主 agent 中复述 Codex 的持续流式输出。
11
+
12
+ ## 约束
13
+ - 长输出由插件直发 Feishu。
14
+ - skill 不负责会话生命周期或审批逻辑。