Decouple bundled UI from runtime API and add remote instance tooling (#1228)
Add a packaged-client runtime boundary so the shared UI can talk to local, desktop, remote, and VS Code runtimes through the right transport instead of assuming one same-origin web server. Centralize OpenChamber-owned API access behind RuntimeAPIs, runtimeFetch, and runtime URL helpers, while keeping official OpenCode traffic on the SDK path. Support runtime switching, remote host selection, desktop client credentials, and headless connection links for pairing packaged clients with remote OpenChamber servers. Harden the new auth model by moving long-lived client tokens out of browser URLs, introducing short-lived scoped URL tokens for browser-owned transports, restricting URL-token access to explicit readable/realtime routes, and making client-token management session-scoped or self-scoped as appropriate. Update browser-owned assets and preview proxy flows to work with the split runtime model, including authenticated project icons, preview token propagation, CSP-safe preview bridge injection, and preview proxy auth that survives short-lived URL-token expiry. Tighten Electron security boundaries for packaged clients by gating privileged preload state to trusted origins and requiring explicit confirmation before connect deep-links import or switch remote runtimes. Also refresh agent guidance and project skills so future runtime/API, auth, preview, UI, CLI, settings, locale, and drag-to-reorder work follows the new architecture.
This commit is contained in:
committed by
GitHub
parent
a4314c189b
commit
2031e3b4a8
@@ -10,6 +10,68 @@ describe('cli args', () => {
|
||||
expect(parseArgs(['serve', '--daemon']).removedFlagErrors).toEqual([]);
|
||||
expect(parseArgs(['serve', '-d']).removedFlagErrors).toEqual([]);
|
||||
});
|
||||
|
||||
it('parses explicit connect-url server overrides', () => {
|
||||
const parsed = parseArgs(['connect-url', '--server', 'https://openchamber.example.com', '--port', '3002']);
|
||||
|
||||
expect(parsed.command).toBe('connect-url');
|
||||
expect(parsed.options.server).toBe('https://openchamber.example.com');
|
||||
expect(parsed.options.port).toBe(3002);
|
||||
});
|
||||
|
||||
it('parses connect-url server-url alias', () => {
|
||||
const parsed = parseArgs(['connect-url', '--server-url=http://homebridge:3002']);
|
||||
|
||||
expect(parsed.options.server).toBe('http://homebridge:3002');
|
||||
});
|
||||
|
||||
it('parses connect-url api-only help', () => {
|
||||
const parsed = parseArgs(['connect-url', '--api-only', '--help']);
|
||||
|
||||
expect(parsed.command).toBe('connect-url');
|
||||
expect(parsed.options.apiOnly).toBe(true);
|
||||
expect(parsed.helpRequested).toBe(true);
|
||||
});
|
||||
|
||||
it('parses startup api-only option', () => {
|
||||
const parsed = parseArgs(['startup', 'enable', '--api-only', '--port', '3002']);
|
||||
|
||||
expect(parsed.command).toBe('startup');
|
||||
expect(parsed.startupAction).toBe('enable');
|
||||
expect(parsed.options.apiOnly).toBe(true);
|
||||
expect(parsed.options.port).toBe(3002);
|
||||
});
|
||||
|
||||
it('parses tunnel auto-start server options', () => {
|
||||
const parsed = parseArgs(['tunnel', 'start', '--port', '3002', '--api-only', '--lan', '--ui-password', 'secret']);
|
||||
|
||||
expect(parsed.command).toBe('tunnel');
|
||||
expect(parsed.subcommand).toBe('start');
|
||||
expect(parsed.options.port).toBe(3002);
|
||||
expect(parsed.options.apiOnly).toBe(true);
|
||||
expect(parsed.options.host).toBe('0.0.0.0');
|
||||
expect(parsed.options.uiPassword).toBe('secret');
|
||||
});
|
||||
|
||||
it('maps --lan to wildcard bind host', () => {
|
||||
const parsed = parseArgs(['serve', '--lan', '--port', '3002']);
|
||||
|
||||
expect(parsed.options.host).toBe('0.0.0.0');
|
||||
expect(parsed.options.lan).toBe(true);
|
||||
});
|
||||
|
||||
it('supports --hostname as top-level bind alias', () => {
|
||||
const parsed = parseArgs(['serve', '--hostname', '0.0.0.0']);
|
||||
|
||||
expect(parsed.options.host).toBe('0.0.0.0');
|
||||
});
|
||||
|
||||
it('keeps --hostname for tunnel commands', () => {
|
||||
const parsed = parseArgs(['tunnel', 'start', '--hostname', 'app.example.com']);
|
||||
|
||||
expect(parsed.options.hostname).toBe('app.example.com');
|
||||
expect(parsed.options.host).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('cli entry detection', () => {
|
||||
|
||||
Reference in New Issue
Block a user