@aiwg/cockpit 2026.7.24 → 2026.8.0
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.md +12 -8
- package/bridge/src/public/index.html +32 -8
- package/bridge/src/server.mjs +133 -23
- package/bridge/src/smoke.mjs +4 -4
- package/desktop/README.md +4 -3
- package/desktop/src-tauri/src/main.rs +45 -8
- package/desktop/src-tauri/tauri.conf.json +1 -1
- package/package.json +1 -1
- package/runtime-docs/README.md +7 -3
- package/shell-core/runtime.mjs +16 -6
- package/shell-core/smoke.mjs +4 -1
- package/vscode/README.md +4 -1
- package/vscode/extension.js +6 -4
- package/vscode/smoke.mjs +16 -2
- package/web/dist/assets/{index-BoRrjczI.js → index-CX4YsqA4.js} +101 -101
- package/web/dist/index.html +1 -2
- package/web/index.html +0 -1
- package/web/package.json +1 -1
- package/web/src/App.test.tsx +0 -1
- package/web/src/App.tsx +23 -11
- package/web/src/api.test.ts +42 -0
- package/web/src/api.ts +51 -11
- package/web/src/components/Inventory.test.tsx +1 -3
- package/web/src/components/LaunchInstanceModal.test.tsx +1 -1
- package/web/src/components/Sessions.test.tsx +0 -1
- package/web/src/components/StartSessionModal.test.tsx +1 -1
- package/web/src/useSession.ts +1 -7
- package/web/src/vite-env.d.ts +1 -0
package/vscode/extension.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// AIWG Cockpit — VS Code shell (#1594).
|
|
2
2
|
// Hosts the registry-bound Bridge UI inside a webview, and exposes contributed
|
|
3
3
|
// actions as command-palette entries. The shell never replaces the CLI or the
|
|
4
|
-
// Bridge — it
|
|
4
|
+
// Bridge — it resolves the native runtime credential, exchanges it for a
|
|
5
|
+
// one-time webview bootstrap, and never places the credential in a URL.
|
|
5
6
|
// CommonJS so it runs with no build step.
|
|
6
7
|
const vscode = require('vscode');
|
|
7
8
|
const os = require('os');
|
|
@@ -35,9 +36,10 @@ function activate(context) {
|
|
|
35
36
|
try { rt = await ensureRuntime(); } catch (e) { return vscode.window.showWarningMessage(e.message); }
|
|
36
37
|
const panel = vscode.window.createWebviewPanel('aiwgCockpit', 'AIWG Cockpit', vscode.ViewColumn.One, { enableScripts: true, retainContextWhenHidden: true });
|
|
37
38
|
const { webviewUrl } = await shellCore();
|
|
38
|
-
const u = webviewUrl(rt);
|
|
39
|
+
const u = await webviewUrl(rt, { audience: 'vscode' });
|
|
40
|
+
const bridgeOrigin = new URL(rt.url).origin;
|
|
39
41
|
panel.webview.html = `<!doctype html><html><head><meta charset="utf-8" />
|
|
40
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; frame-src
|
|
42
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; frame-src ${bridgeOrigin}; style-src 'unsafe-inline';" />
|
|
41
43
|
<style>html,body,iframe{margin:0;height:100vh;width:100%;border:0}</style></head>
|
|
42
44
|
<body><iframe src="${u}" title="AIWG Cockpit"></iframe></body></html>`;
|
|
43
45
|
}),
|
|
@@ -45,7 +47,7 @@ function activate(context) {
|
|
|
45
47
|
let rt;
|
|
46
48
|
try { rt = await ensureRuntime(); } catch (e) { return vscode.window.showWarningMessage(e.message); }
|
|
47
49
|
const { webviewUrl } = await shellCore();
|
|
48
|
-
vscode.env.openExternal(vscode.Uri.parse(
|
|
50
|
+
vscode.env.openExternal(vscode.Uri.parse(await webviewUrl(rt, { audience: 'browser', next: 'actions' })));
|
|
49
51
|
}),
|
|
50
52
|
);
|
|
51
53
|
}
|
package/vscode/smoke.mjs
CHANGED
|
@@ -12,16 +12,24 @@ await writeFile(runtimePath, JSON.stringify({ token: 'vscode-shell-core-token-12
|
|
|
12
12
|
const requests = [];
|
|
13
13
|
globalThis.fetch = async (input, init = {}) => {
|
|
14
14
|
requests.push({ url: String(input), init });
|
|
15
|
+
if (String(input).endsWith('/bootstrap/nonce')) {
|
|
16
|
+
return new Response(JSON.stringify({ nonce: 'vscode-one-time-nonce', expires_in_ms: 60000 }), {
|
|
17
|
+
status: 201,
|
|
18
|
+
headers: { 'Content-Type': 'application/json' },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
15
21
|
return new Response(JSON.stringify({ ok: true }), { status: 200, headers: { 'Content-Type': 'application/json' } });
|
|
16
22
|
};
|
|
17
23
|
|
|
18
24
|
const originalLoad = Module._load;
|
|
25
|
+
const commands = new Map();
|
|
26
|
+
const panel = { webview: { html: '' } };
|
|
19
27
|
Module._load = function patchedLoad(request, parent, isMain) {
|
|
20
28
|
if (request === 'vscode') {
|
|
21
29
|
return {
|
|
22
30
|
workspace: { getConfiguration: () => ({ get: () => runtimePath }) },
|
|
23
|
-
window: { showWarningMessage: () => undefined, createWebviewPanel: () =>
|
|
24
|
-
commands: { registerCommand: () => ({ dispose: () => undefined }
|
|
31
|
+
window: { showWarningMessage: () => undefined, createWebviewPanel: () => panel },
|
|
32
|
+
commands: { registerCommand: (name, callback) => { commands.set(name, callback); return { dispose: () => undefined }; } },
|
|
25
33
|
env: { openExternal: () => undefined },
|
|
26
34
|
Uri: { parse: (value) => ({ value }) },
|
|
27
35
|
ViewColumn: { One: 1 },
|
|
@@ -40,6 +48,12 @@ try {
|
|
|
40
48
|
requests.some((r) => r.url.endsWith('/api/health') && r.init.headers?.authorization === `Bearer ${rt.token}`),
|
|
41
49
|
'shell-core performs the authenticated Bridge health check',
|
|
42
50
|
);
|
|
51
|
+
extension.activate({ subscriptions: [] });
|
|
52
|
+
await commands.get('aiwg-cockpit.open')();
|
|
53
|
+
assert.match(panel.webview.html, /frame-src http:\/\/127\.0\.0\.1:8159;/, 'webview CSP permits only the resolved Bridge origin');
|
|
54
|
+
assert.doesNotMatch(panel.webview.html, /localhost:\*|127\.0\.0\.1:\*/, 'webview CSP has no wildcard local port');
|
|
55
|
+
assert.match(panel.webview.html, /#bootstrap=vscode-one-time-nonce&audience=vscode|#bootstrap=vscode-one-time-nonce&audience=vscode/, 'webview uses one-time fragment bootstrap');
|
|
56
|
+
assert.ok(!panel.webview.html.includes(rt.token), 'webview HTML does not contain the reusable token');
|
|
43
57
|
console.log('SMOKE OK - VS Code shell delegates runtime resolution to shell-core');
|
|
44
58
|
} finally {
|
|
45
59
|
Module._load = originalLoad;
|