@jingyi0605/codingns 1.0.0-beta.2 → 1.0.0-beta.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/public/assets/{AdaptiveButlerPage-BHUAx_24.js → AdaptiveButlerPage-CLHLiZSY.js} +1 -1
- package/dist/public/assets/{App-D5hc6KuU.js → App-FYuZfAoO.js} +3 -3
- package/dist/public/assets/{BootstrapPage-C2sMZMJa.js → BootstrapPage-3xpnsG-A.js} +1 -1
- package/dist/public/assets/ConversationPage-C5_ZqhU3.js +9 -0
- package/dist/public/assets/{DesktopDetachPreviewPage-D9Abm5NU.js → DesktopDetachPreviewPage-B77MG82y.js} +1 -1
- package/dist/public/assets/{DesktopModal-BCVZq_PQ.js → DesktopModal-K5bEcj38.js} +1 -1
- package/dist/public/assets/{DesktopWindowPage-Cotl5fte.js → DesktopWindowPage-DbG-RBAf.js} +1 -1
- package/dist/public/assets/{FileContextPanel-DbPOq5w-.js → FileContextPanel-C-1yOton.js} +1 -1
- package/dist/public/assets/{GitSidebar-Cuxi2R93.js → GitSidebar-DFHAPT3S.js} +1 -1
- package/dist/public/assets/{MobileCreateSessionSheet-DYqarJqO.js → MobileCreateSessionSheet-gOyAZ857.js} +1 -1
- package/dist/public/assets/{MobileSheet-DPYtp5Ze.js → MobileSheet-D0MfNkTv.js} +1 -1
- package/dist/public/assets/{PluginAccessOverview-CiVzb_NI.js → PluginAccessOverview-IrYIPLg3.js} +1 -1
- package/dist/public/assets/{PluginContainerPage-BfZ3E41c.js → PluginContainerPage-b9LQVuqG.js} +1 -1
- package/dist/public/assets/{PluginDetailPage-DQQAg_ba.js → PluginDetailPage-BX7gohai.js} +1 -1
- package/dist/public/assets/{PluginsListPage-bF1NmA_r.js → PluginsListPage-R0SibHMi.js} +1 -1
- package/dist/public/assets/{PureConversationPage-CWji-ARJ.js → PureConversationPage-CcakFvo0.js} +1 -1
- package/dist/public/assets/{RelayConnectEntryPage-D4-3Fher.js → RelayConnectEntryPage-cAVq_kNM.js} +1 -1
- package/dist/public/assets/{ServerSettingsModal-BUY1Y3g6.js → ServerSettingsModal-BJwYHdKD.js} +1 -1
- package/dist/public/assets/{SessionIndexPage-zVB9jnzP.js → SessionIndexPage-CJKRHB_F.js} +1 -1
- package/dist/public/assets/{SettingsPage-DeqR2p7d.js → SettingsPage-Csp7wEBC.js} +1 -1
- package/dist/public/assets/{TerminalManagerPanel-BjnC70ga.js → TerminalManagerPanel-2HG-NyfR.js} +1 -1
- package/dist/public/assets/{ToolFilesPage-BZseQqvZ.js → ToolFilesPage-BAZdjNaF.js} +1 -1
- package/dist/public/assets/{ToolGitPage-SrOO8Ftz.js → ToolGitPage-CGkPmgsz.js} +1 -1
- package/dist/public/assets/{ToolProcessesPage-Dbzlqjdy.js → ToolProcessesPage-BHpS7-VH.js} +1 -1
- package/dist/public/assets/{ToolsHomePage-BBilUc0P.js → ToolsHomePage-DDGqYwYU.js} +1 -1
- package/dist/public/assets/{WorkbenchLandingPage-FdsBC8WN.js → WorkbenchLandingPage-B4aooEYJ.js} +1 -1
- package/dist/public/assets/{WorkbenchLayout-yGxGKcG1.js → WorkbenchLayout-DrAvGjGK.js} +81 -79
- package/dist/public/assets/{WorkbenchModal-Cm-ciXO9.js → WorkbenchModal-BK5ix8YI.js} +1 -1
- package/dist/public/assets/WorkbenchShellRoute-p1FvkoPN.js +1 -0
- package/dist/public/assets/{WorkspaceDebugDetailPage-CZtpOiY0.js → WorkspaceDebugDetailPage-CPgAe8dd.js} +1 -1
- package/dist/public/assets/{WorkspaceDetailPage-CbbgUz1H.js → WorkspaceDetailPage-YM85dTGg.js} +1 -1
- package/dist/public/assets/{WorkspaceHomePage-DMNJKAYe.js → WorkspaceHomePage-DPPvwM93.js} +1 -1
- package/dist/public/assets/{client-runtime-manager-tsFkLtO_.js → client-runtime-manager-Clq-8rWh.js} +1 -1
- package/dist/public/assets/{host-alias-df5bYDlE.js → host-alias-BxzpRYrt.js} +1 -1
- package/dist/public/assets/{index-CILPuSCp.js → index-BArTKWXk.js} +3 -3
- package/dist/public/assets/index-CqKepLbu.css +1 -0
- package/dist/public/assets/{login-direct-candidate-resolver-pkfXrMJy.js → login-direct-candidate-resolver-BiWwFKnk.js} +1 -1
- package/dist/public/assets/{peer-host-config-sync-nS_66OLg.js → peer-host-config-sync-kTom1_pp.js} +1 -1
- package/dist/public/assets/{plugin-permission-copy-LDy-lW7h.js → plugin-permission-copy-1_1wViri.js} +1 -1
- package/dist/public/assets/{plugins-api-BGF9OybZ.js → plugins-api-C0JqR2-W.js} +1 -1
- package/dist/public/assets/{preferences-service-BC25oxA_.js → preferences-service-DWeLWZST.js} +1 -1
- package/dist/public/assets/{relay-entry-ErQKnI7B.js → relay-entry-ClEd3cjN.js} +1 -1
- package/dist/public/assets/{useRegisteredDebugTemplates-BTr3ATCZ.js → useRegisteredDebugTemplates-wJGOYam9.js} +1 -1
- package/dist/public/assets/{workbench-navigation-hwM28xIb.js → workbench-navigation-vIWt3Rv_.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +84 -20
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.js +2 -1
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +14 -0
- package/dist/server/modules/sessions/session-live-runtime-service.js +103 -4
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-permission-request-service.d.ts +1 -0
- package/dist/server/modules/sessions/session-permission-request-service.js +27 -5
- package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-config-service.js +1 -0
- package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -1
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +5 -1
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
- package/dist/server/storage/repositories/session-send-queue-repository.d.ts +1 -0
- package/dist/server/storage/repositories/session-send-queue-repository.js +23 -0
- package/dist/server/storage/repositories/session-send-queue-repository.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/index.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/index.js +1 -0
- package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +27 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +48 -4
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +53 -15
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/package.json +2 -1
- package/scripts/claude-hook-bridge.cjs +167 -0
- package/dist/public/assets/ConversationPage-CDpyEOUA.js +0 -9
- package/dist/public/assets/WorkbenchShellRoute-CijuAd9-.js +0 -1
- package/dist/public/assets/index-CSlwKnM4.css +0 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const http = require("node:http");
|
|
4
|
+
const https = require("node:https");
|
|
5
|
+
const fs = require("node:fs");
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
const args = {
|
|
9
|
+
url: "",
|
|
10
|
+
token: "",
|
|
11
|
+
debugLog: ""
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
for (let index = 2; index < argv.length; index += 1) {
|
|
15
|
+
const current = argv[index];
|
|
16
|
+
const next = argv[index + 1];
|
|
17
|
+
|
|
18
|
+
if (current === "--url" && typeof next === "string") {
|
|
19
|
+
args.url = next.trim();
|
|
20
|
+
index += 1;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (current === "--token" && typeof next === "string") {
|
|
25
|
+
args.token = next.trim();
|
|
26
|
+
index += 1;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (current === "--debug-log" && typeof next === "string") {
|
|
31
|
+
args.debugLog = next.trim();
|
|
32
|
+
index += 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return args;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function readStdin() {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const chunks = [];
|
|
42
|
+
|
|
43
|
+
process.stdin.on("data", (chunk) => {
|
|
44
|
+
chunks.push(Buffer.from(chunk));
|
|
45
|
+
});
|
|
46
|
+
process.stdin.on("end", () => {
|
|
47
|
+
resolve(Buffer.concat(chunks).toString("utf8"));
|
|
48
|
+
});
|
|
49
|
+
process.stdin.on("error", reject);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function appendDebugLog(debugLogPath, message) {
|
|
54
|
+
if (!debugLogPath) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
fs.appendFileSync(debugLogPath, `[bridge] ${new Date().toISOString()} ${message}\n`, "utf8");
|
|
60
|
+
} catch {
|
|
61
|
+
// ignore debug logging failure
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function resolveRequestTimeoutMs(body) {
|
|
66
|
+
try {
|
|
67
|
+
const parsed = JSON.parse(body);
|
|
68
|
+
const hookEventName =
|
|
69
|
+
parsed && typeof parsed === "object" && typeof parsed.hook_event_name === "string"
|
|
70
|
+
? parsed.hook_event_name.trim()
|
|
71
|
+
: "";
|
|
72
|
+
|
|
73
|
+
if (hookEventName === "PreToolUse") {
|
|
74
|
+
// 权限申请需要等用户操作,不能再用原来的 1.5 秒超时。
|
|
75
|
+
return 95_000;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return 5_000;
|
|
79
|
+
} catch {
|
|
80
|
+
return 5_000;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function main() {
|
|
85
|
+
const args = parseArgs(process.argv);
|
|
86
|
+
appendDebugLog(args.debugLog, `start pid=${process.pid} argv=${JSON.stringify(process.argv.slice(2))}`);
|
|
87
|
+
|
|
88
|
+
if (!args.url || !args.token) {
|
|
89
|
+
appendDebugLog(args.debugLog, "missing url or token");
|
|
90
|
+
process.exit(0);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const body = (await readStdin()).trim();
|
|
95
|
+
appendDebugLog(
|
|
96
|
+
args.debugLog,
|
|
97
|
+
`stdin.length=${body.length} stdin=${body.length > 2000 ? `${body.slice(0, 2000)}...` : body}`
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (!body) {
|
|
101
|
+
appendDebugLog(args.debugLog, "empty stdin body");
|
|
102
|
+
process.exit(0);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let targetUrl;
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
targetUrl = new URL(args.url);
|
|
110
|
+
} catch {
|
|
111
|
+
appendDebugLog(args.debugLog, `invalid url=${args.url}`);
|
|
112
|
+
process.exit(0);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const transport = targetUrl.protocol === "https:" ? https : http;
|
|
117
|
+
const timeoutMs = resolveRequestTimeoutMs(body);
|
|
118
|
+
const request = transport.request(
|
|
119
|
+
targetUrl,
|
|
120
|
+
{
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: {
|
|
123
|
+
"content-type": "application/json",
|
|
124
|
+
"content-length": Buffer.byteLength(body),
|
|
125
|
+
"x-codingns-hook-token": args.token
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
(response) => {
|
|
129
|
+
const chunks = [];
|
|
130
|
+
response.on("data", (chunk) => {
|
|
131
|
+
chunks.push(Buffer.from(chunk));
|
|
132
|
+
});
|
|
133
|
+
response.on("end", () => {
|
|
134
|
+
const responseBody = Buffer.concat(chunks).toString("utf8").trim();
|
|
135
|
+
appendDebugLog(
|
|
136
|
+
args.debugLog,
|
|
137
|
+
`response.status=${response.statusCode ?? 0} body=${responseBody.length > 2000 ? `${responseBody.slice(0, 2000)}...` : responseBody}`
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
if (responseBody) {
|
|
141
|
+
process.stdout.write(responseBody);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
process.exit(0);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
request.setTimeout(timeoutMs, () => {
|
|
150
|
+
appendDebugLog(args.debugLog, `request.timeout timeoutMs=${timeoutMs}`);
|
|
151
|
+
request.destroy();
|
|
152
|
+
process.exit(0);
|
|
153
|
+
});
|
|
154
|
+
request.on("error", (error) => {
|
|
155
|
+
appendDebugLog(
|
|
156
|
+
args.debugLog,
|
|
157
|
+
`request.error message=${error instanceof Error ? error.message : String(error)}`
|
|
158
|
+
);
|
|
159
|
+
process.exit(0);
|
|
160
|
+
});
|
|
161
|
+
request.write(body);
|
|
162
|
+
request.end();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
void main().catch(() => {
|
|
166
|
+
process.exit(0);
|
|
167
|
+
});
|