@causyne/agent 1.20.127 → 1.20.128
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/docs/THIRD_PARTY_NOTICES.md +36 -2
- package/package.json +3 -1
- package/src/agentLoop.js +59 -26
- package/src/agentLoop.ts +59 -24
- package/src/browser/causyneBrowser.js +31 -0
- package/src/browser/causyneBrowser.ts +32 -0
- package/src/commands.js +177 -13
- package/src/commands.ts +194 -13
- package/src/memory/episodicStore.js +40 -0
- package/src/memory/episodicStore.ts +46 -0
- package/src/memory.js +67 -0
- package/src/memory.ts +65 -0
- package/src/personalization.js +365 -0
- package/src/personalization.ts +471 -0
- package/src/projectInstructions.js +30 -10
- package/src/projectInstructions.ts +31 -12
- package/src/providers/acp.js +3 -2
- package/src/providers/acp.ts +3 -2
- package/src/providers/antigravity.js +2 -0
- package/src/providers/antigravity.ts +2 -0
- package/src/tools/memoryWrite.js +15 -1
- package/src/tools/memoryWrite.ts +16 -1
- package/src/tools/osSandbox.js +1 -1
- package/src/tools/osSandbox.ts +1 -1
- package/src/tools/ptyTerminal.js +17 -5
- package/src/tools/ptyTerminal.ts +19 -5
- package/src/web/client/browserPanel.js +234 -31
- package/src/web/client/browserPanel.ts +240 -31
- package/src/web/client/chatStream.js +19 -7
- package/src/web/client/chatStream.ts +17 -9
- package/src/web/client/cliPanel.js +3 -3
- package/src/web/client/cliPanel.ts +3 -3
- package/src/web/client/dom.js +53 -2
- package/src/web/client/dom.ts +54 -3
- package/src/web/client/filesAndCanvas.js +3 -1
- package/src/web/client/filesAndCanvas.ts +3 -1
- package/src/web/client/main.js +28 -13
- package/src/web/client/main.ts +35 -12
- package/src/web/client/settingsModal.js +641 -8
- package/src/web/client/settingsModal.ts +791 -8
- package/src/web/client/state.js +31 -1
- package/src/web/client/state.ts +27 -1
- package/src/web/client/studioLayout.js +39 -4
- package/src/web/client/studioLayout.ts +47 -4
- package/src/web/client/studioShell.js +370 -37
- package/src/web/client/studioShell.ts +368 -36
- package/src/web/client/terminalPanel.js +378 -129
- package/src/web/client/terminalPanel.ts +394 -107
- package/src/web/client/terminalTheme.js +249 -0
- package/src/web/client/terminalTheme.ts +258 -0
- package/src/web/client/types.ts +3 -0
- package/src/web/client/validators.js +51 -10
- package/src/web/client/validators.ts +54 -10
- package/src/web/server/routesBrowser.js +64 -10
- package/src/web/server/routesBrowser.ts +62 -13
- package/src/web/server/routesSettings.js +344 -0
- package/src/web/server/routesSettings.ts +397 -0
- package/src/web/server/staticAssets.js +24 -0
- package/src/web/server/staticAssets.ts +25 -0
- package/src/web/skybridgeServer.js +3 -0
- package/src/web/skybridgeServer.ts +2 -0
- package/src/web/skybridgeUi.js +5 -1
- package/src/web/skybridgeUi.ts +8 -1
- package/src/web/styles/overlays.css +499 -0
- package/src/web/styles/studio.css +274 -46
- package/src/web/ui/modalsTemplate.js +320 -71
- package/src/web/ui/modalsTemplate.ts +320 -71
- package/src/web/ui/studioTemplate.js +19 -21
- package/src/web/ui/studioTemplate.ts +19 -21
package/src/web/client/state.js
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { dom, maybeById } from './dom.js';
|
|
2
2
|
export const DRAFT_KEY = 'causyne/web/composerDraft/v1';
|
|
3
3
|
export const THEME_KEY = 'causyne/web/theme/v1';
|
|
4
|
+
export const DENSITY_KEY = 'causyne/web/density/v1';
|
|
5
|
+
export const AUTOSCROLL_KEY = 'causyne/web/autoScroll/v1';
|
|
4
6
|
export const PERMISSION_PRESET_KEY = 'causyne/web/permissionPreset/v1';
|
|
5
7
|
export const LEGACY_MODE_KEY = 'causyne/web/autonomyMode/v1';
|
|
6
8
|
export const STUDIO_WIDTH_KEY = 'causyne/web/studioWidth/v1';
|
|
7
9
|
export const DEFAULT_STUDIO_W = 480;
|
|
10
|
+
let autoScrollEnabled = true;
|
|
11
|
+
export function isAutoScrollEnabled() {
|
|
12
|
+
return autoScrollEnabled;
|
|
13
|
+
}
|
|
14
|
+
export function applyDensity(density) {
|
|
15
|
+
const next = density === 'compact' ? 'compact' : 'comfortable';
|
|
16
|
+
document.documentElement.setAttribute('data-density', next);
|
|
17
|
+
try {
|
|
18
|
+
window.localStorage.setItem(DENSITY_KEY, next);
|
|
19
|
+
}
|
|
20
|
+
catch { /* ignore */ }
|
|
21
|
+
}
|
|
22
|
+
export function applyAutoScrollPref(enabled) {
|
|
23
|
+
autoScrollEnabled = Boolean(enabled);
|
|
24
|
+
try {
|
|
25
|
+
window.localStorage.setItem(AUTOSCROLL_KEY, autoScrollEnabled ? '1' : '0');
|
|
26
|
+
}
|
|
27
|
+
catch { /* ignore */ }
|
|
28
|
+
}
|
|
8
29
|
const hashParams = new URLSearchParams((window.location.hash || '').replace(/^#/, ''));
|
|
9
30
|
export const TOKEN_STORE_KEY = `causyne/web/token:${window.location.origin}`;
|
|
10
31
|
let sessionToken = hashParams.get('token') || '';
|
|
@@ -66,8 +87,10 @@ export const state = {
|
|
|
66
87
|
currentDir: '',
|
|
67
88
|
parentDir: '',
|
|
68
89
|
studioTab: 'start',
|
|
90
|
+
studioOpenTabs: ['start'],
|
|
69
91
|
studioSplit: false,
|
|
70
92
|
studioSecondaryTab: 'terminal',
|
|
93
|
+
studioSplitRatio: 0.5,
|
|
71
94
|
studioExpanded: false,
|
|
72
95
|
studioWidth: DEFAULT_STUDIO_W,
|
|
73
96
|
terminalSessions: [],
|
|
@@ -85,6 +108,7 @@ export const state = {
|
|
|
85
108
|
browserUrl: '',
|
|
86
109
|
browserSrcdoc: '',
|
|
87
110
|
browserViewport: 'desktop',
|
|
111
|
+
browserFrameStrictSandbox: false,
|
|
88
112
|
liveBrowserActive: false,
|
|
89
113
|
liveBrowserVisible: false,
|
|
90
114
|
liveBrowserRuntime: null,
|
|
@@ -192,7 +216,7 @@ export function updateComposerMetrics() {
|
|
|
192
216
|
export function scrollToBottom(force, smooth = false) {
|
|
193
217
|
if (!dom.threadWrapEl)
|
|
194
218
|
return;
|
|
195
|
-
if (force || state.stickToBottom) {
|
|
219
|
+
if (force || (autoScrollEnabled && state.stickToBottom)) {
|
|
196
220
|
if (smooth && typeof dom.threadWrapEl.scrollTo === 'function') {
|
|
197
221
|
dom.threadWrapEl.scrollTo({ top: dom.threadWrapEl.scrollHeight, behavior: 'smooth' });
|
|
198
222
|
}
|
|
@@ -222,6 +246,12 @@ export function restorePersistedPreferences() {
|
|
|
222
246
|
const savedTheme = window.localStorage.getItem(THEME_KEY);
|
|
223
247
|
if (savedTheme === 'light' || savedTheme === 'dark')
|
|
224
248
|
applyTheme(savedTheme);
|
|
249
|
+
const savedDensity = window.localStorage.getItem(DENSITY_KEY);
|
|
250
|
+
if (savedDensity === 'compact' || savedDensity === 'comfortable')
|
|
251
|
+
applyDensity(savedDensity);
|
|
252
|
+
const savedAutoScroll = window.localStorage.getItem(AUTOSCROLL_KEY);
|
|
253
|
+
if (savedAutoScroll === '0' || savedAutoScroll === '1')
|
|
254
|
+
applyAutoScrollPref(savedAutoScroll === '1');
|
|
225
255
|
const savedPreset = window.localStorage.getItem(PERMISSION_PRESET_KEY);
|
|
226
256
|
if (savedPreset === 'read-only' || savedPreset === 'workspace-write' || savedPreset === 'danger-full-access') {
|
|
227
257
|
state.permissionPreset = savedPreset;
|
package/src/web/client/state.ts
CHANGED
|
@@ -3,11 +3,30 @@ import type { AppState } from './types.js';
|
|
|
3
3
|
|
|
4
4
|
export const DRAFT_KEY = 'causyne/web/composerDraft/v1';
|
|
5
5
|
export const THEME_KEY = 'causyne/web/theme/v1';
|
|
6
|
+
export const DENSITY_KEY = 'causyne/web/density/v1';
|
|
7
|
+
export const AUTOSCROLL_KEY = 'causyne/web/autoScroll/v1';
|
|
6
8
|
export const PERMISSION_PRESET_KEY = 'causyne/web/permissionPreset/v1';
|
|
7
9
|
export const LEGACY_MODE_KEY = 'causyne/web/autonomyMode/v1';
|
|
8
10
|
export const STUDIO_WIDTH_KEY = 'causyne/web/studioWidth/v1';
|
|
9
11
|
export const DEFAULT_STUDIO_W = 480;
|
|
10
12
|
|
|
13
|
+
let autoScrollEnabled = true;
|
|
14
|
+
|
|
15
|
+
export function isAutoScrollEnabled(): boolean {
|
|
16
|
+
return autoScrollEnabled;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function applyDensity(density: string): void {
|
|
20
|
+
const next = density === 'compact' ? 'compact' : 'comfortable';
|
|
21
|
+
document.documentElement.setAttribute('data-density', next);
|
|
22
|
+
try { window.localStorage.setItem(DENSITY_KEY, next); } catch { /* ignore */ }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function applyAutoScrollPref(enabled: boolean): void {
|
|
26
|
+
autoScrollEnabled = Boolean(enabled);
|
|
27
|
+
try { window.localStorage.setItem(AUTOSCROLL_KEY, autoScrollEnabled ? '1' : '0'); } catch { /* ignore */ }
|
|
28
|
+
}
|
|
29
|
+
|
|
11
30
|
const hashParams = new URLSearchParams((window.location.hash || '').replace(/^#/, ''));
|
|
12
31
|
export const TOKEN_STORE_KEY = `causyne/web/token:${window.location.origin}`;
|
|
13
32
|
|
|
@@ -63,8 +82,10 @@ export const state: AppState = {
|
|
|
63
82
|
currentDir: '',
|
|
64
83
|
parentDir: '',
|
|
65
84
|
studioTab: 'start',
|
|
85
|
+
studioOpenTabs: ['start'],
|
|
66
86
|
studioSplit: false,
|
|
67
87
|
studioSecondaryTab: 'terminal',
|
|
88
|
+
studioSplitRatio: 0.5,
|
|
68
89
|
studioExpanded: false,
|
|
69
90
|
studioWidth: DEFAULT_STUDIO_W,
|
|
70
91
|
terminalSessions: [],
|
|
@@ -82,6 +103,7 @@ export const state: AppState = {
|
|
|
82
103
|
browserUrl: '',
|
|
83
104
|
browserSrcdoc: '',
|
|
84
105
|
browserViewport: 'desktop',
|
|
106
|
+
browserFrameStrictSandbox: false,
|
|
85
107
|
liveBrowserActive: false,
|
|
86
108
|
liveBrowserVisible: false,
|
|
87
109
|
liveBrowserRuntime: null,
|
|
@@ -183,7 +205,7 @@ export function updateComposerMetrics(): void {
|
|
|
183
205
|
|
|
184
206
|
export function scrollToBottom(force: boolean, smooth = false): void {
|
|
185
207
|
if (!dom.threadWrapEl) return;
|
|
186
|
-
if (force || state.stickToBottom) {
|
|
208
|
+
if (force || (autoScrollEnabled && state.stickToBottom)) {
|
|
187
209
|
if (smooth && typeof dom.threadWrapEl.scrollTo === 'function') {
|
|
188
210
|
dom.threadWrapEl.scrollTo({ top: dom.threadWrapEl.scrollHeight, behavior: 'smooth' });
|
|
189
211
|
} else {
|
|
@@ -212,6 +234,10 @@ export function restorePersistedPreferences(): void {
|
|
|
212
234
|
try {
|
|
213
235
|
const savedTheme = window.localStorage.getItem(THEME_KEY);
|
|
214
236
|
if (savedTheme === 'light' || savedTheme === 'dark') applyTheme(savedTheme);
|
|
237
|
+
const savedDensity = window.localStorage.getItem(DENSITY_KEY);
|
|
238
|
+
if (savedDensity === 'compact' || savedDensity === 'comfortable') applyDensity(savedDensity);
|
|
239
|
+
const savedAutoScroll = window.localStorage.getItem(AUTOSCROLL_KEY);
|
|
240
|
+
if (savedAutoScroll === '0' || savedAutoScroll === '1') applyAutoScrollPref(savedAutoScroll === '1');
|
|
215
241
|
const savedPreset = window.localStorage.getItem(PERMISSION_PRESET_KEY);
|
|
216
242
|
if (savedPreset === 'read-only' || savedPreset === 'workspace-write' || savedPreset === 'danger-full-access') {
|
|
217
243
|
state.permissionPreset = savedPreset;
|
|
@@ -4,6 +4,12 @@ const MIN_SPLIT_PANE_WIDTH_PX = 280;
|
|
|
4
4
|
export function isValidStudioTab(tab) {
|
|
5
5
|
return typeof tab === 'string' && VALID_STUDIO_TABS.has(tab);
|
|
6
6
|
}
|
|
7
|
+
export function clampSplitRatio(raw) {
|
|
8
|
+
const n = Number(raw);
|
|
9
|
+
if (!Number.isFinite(n))
|
|
10
|
+
return 0.5;
|
|
11
|
+
return Math.max(0.25, Math.min(0.75, n));
|
|
12
|
+
}
|
|
7
13
|
export function pickDistinctSecondaryTab(primaryTab, preferred) {
|
|
8
14
|
if (preferred && isValidStudioTab(preferred) && preferred !== primaryTab)
|
|
9
15
|
return preferred;
|
|
@@ -17,11 +23,34 @@ export function pickDistinctSecondaryTab(primaryTab, preferred) {
|
|
|
17
23
|
export function halvesFitWidth(containerWidthPx) {
|
|
18
24
|
return Number.isFinite(containerWidthPx) && containerWidthPx >= MIN_SPLIT_PANE_WIDTH_PX * 2;
|
|
19
25
|
}
|
|
26
|
+
export function normalizeOpenTabs(rawTabs, primaryTab, splitActive, secondaryTab) {
|
|
27
|
+
const out = [];
|
|
28
|
+
const seen = new Set();
|
|
29
|
+
if (Array.isArray(rawTabs)) {
|
|
30
|
+
for (const item of rawTabs) {
|
|
31
|
+
if (isValidStudioTab(item) && !seen.has(item)) {
|
|
32
|
+
seen.add(item);
|
|
33
|
+
out.push(item);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!seen.has(primaryTab)) {
|
|
38
|
+
seen.add(primaryTab);
|
|
39
|
+
out.push(primaryTab);
|
|
40
|
+
}
|
|
41
|
+
if (splitActive && isValidStudioTab(secondaryTab) && !seen.has(secondaryTab)) {
|
|
42
|
+
seen.add(secondaryTab);
|
|
43
|
+
out.push(secondaryTab);
|
|
44
|
+
}
|
|
45
|
+
return out.length > 0 ? out : ['start'];
|
|
46
|
+
}
|
|
20
47
|
export function loadPersistedStudioLayout() {
|
|
21
48
|
const defaults = {
|
|
49
|
+
openTabs: ['start'],
|
|
22
50
|
primaryTab: 'start',
|
|
23
51
|
splitActive: false,
|
|
24
|
-
secondaryTab: 'terminal'
|
|
52
|
+
secondaryTab: 'terminal',
|
|
53
|
+
splitRatio: 0.5
|
|
25
54
|
};
|
|
26
55
|
try {
|
|
27
56
|
const raw = window.localStorage.getItem(STUDIO_LAYOUT_KEY);
|
|
@@ -29,11 +58,15 @@ export function loadPersistedStudioLayout() {
|
|
|
29
58
|
return defaults;
|
|
30
59
|
const parsed = JSON.parse(raw);
|
|
31
60
|
const primaryTab = isValidStudioTab(parsed.primaryTab) ? parsed.primaryTab : defaults.primaryTab;
|
|
61
|
+
const splitActive = Boolean(parsed.splitActive);
|
|
32
62
|
const secondaryTab = pickDistinctSecondaryTab(primaryTab, parsed.secondaryTab);
|
|
63
|
+
const openTabs = normalizeOpenTabs(parsed.openTabs, primaryTab, splitActive, secondaryTab);
|
|
33
64
|
return {
|
|
65
|
+
openTabs,
|
|
34
66
|
primaryTab,
|
|
35
|
-
splitActive
|
|
36
|
-
secondaryTab
|
|
67
|
+
splitActive,
|
|
68
|
+
secondaryTab,
|
|
69
|
+
splitRatio: clampSplitRatio(parsed.splitRatio)
|
|
37
70
|
};
|
|
38
71
|
}
|
|
39
72
|
catch {
|
|
@@ -43,9 +76,11 @@ export function loadPersistedStudioLayout() {
|
|
|
43
76
|
export function persistStudioLayout(layout) {
|
|
44
77
|
try {
|
|
45
78
|
window.localStorage.setItem(STUDIO_LAYOUT_KEY, JSON.stringify({
|
|
79
|
+
openTabs: layout.openTabs,
|
|
46
80
|
primaryTab: layout.primaryTab,
|
|
47
81
|
splitActive: layout.splitActive,
|
|
48
|
-
secondaryTab: layout.secondaryTab
|
|
82
|
+
secondaryTab: layout.secondaryTab,
|
|
83
|
+
splitRatio: clampSplitRatio(layout.splitRatio)
|
|
49
84
|
}));
|
|
50
85
|
}
|
|
51
86
|
catch {
|
|
@@ -3,15 +3,23 @@ export const VALID_STUDIO_TABS = new Set(['start', 'files', 'canvas', 'terminal'
|
|
|
3
3
|
const MIN_SPLIT_PANE_WIDTH_PX = 280;
|
|
4
4
|
|
|
5
5
|
export interface StudioLayoutState {
|
|
6
|
+
openTabs: string[];
|
|
6
7
|
primaryTab: string;
|
|
7
8
|
splitActive: boolean;
|
|
8
9
|
secondaryTab: string;
|
|
10
|
+
splitRatio: number;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export function isValidStudioTab(tab: unknown): tab is string {
|
|
12
14
|
return typeof tab === 'string' && VALID_STUDIO_TABS.has(tab);
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
export function clampSplitRatio(raw: unknown): number {
|
|
18
|
+
const n = Number(raw);
|
|
19
|
+
if (!Number.isFinite(n)) return 0.5;
|
|
20
|
+
return Math.max(0.25, Math.min(0.75, n));
|
|
21
|
+
}
|
|
22
|
+
|
|
15
23
|
export function pickDistinctSecondaryTab(primaryTab: string, preferred?: string): string {
|
|
16
24
|
if (preferred && isValidStudioTab(preferred) && preferred !== primaryTab) return preferred;
|
|
17
25
|
const fallbacks = ['terminal', 'browser', 'files', 'canvas', 'diff', 'cli', 'start'];
|
|
@@ -25,22 +33,55 @@ export function halvesFitWidth(containerWidthPx: number): boolean {
|
|
|
25
33
|
return Number.isFinite(containerWidthPx) && containerWidthPx >= MIN_SPLIT_PANE_WIDTH_PX * 2;
|
|
26
34
|
}
|
|
27
35
|
|
|
36
|
+
export function normalizeOpenTabs(
|
|
37
|
+
rawTabs: unknown,
|
|
38
|
+
primaryTab: string,
|
|
39
|
+
splitActive: boolean,
|
|
40
|
+
secondaryTab: string
|
|
41
|
+
): string[] {
|
|
42
|
+
const out: string[] = [];
|
|
43
|
+
const seen = new Set<string>();
|
|
44
|
+
if (Array.isArray(rawTabs)) {
|
|
45
|
+
for (const item of rawTabs) {
|
|
46
|
+
if (isValidStudioTab(item) && !seen.has(item)) {
|
|
47
|
+
seen.add(item);
|
|
48
|
+
out.push(item);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!seen.has(primaryTab)) {
|
|
53
|
+
seen.add(primaryTab);
|
|
54
|
+
out.push(primaryTab);
|
|
55
|
+
}
|
|
56
|
+
if (splitActive && isValidStudioTab(secondaryTab) && !seen.has(secondaryTab)) {
|
|
57
|
+
seen.add(secondaryTab);
|
|
58
|
+
out.push(secondaryTab);
|
|
59
|
+
}
|
|
60
|
+
return out.length > 0 ? out : ['start'];
|
|
61
|
+
}
|
|
62
|
+
|
|
28
63
|
export function loadPersistedStudioLayout(): StudioLayoutState {
|
|
29
64
|
const defaults: StudioLayoutState = {
|
|
65
|
+
openTabs: ['start'],
|
|
30
66
|
primaryTab: 'start',
|
|
31
67
|
splitActive: false,
|
|
32
|
-
secondaryTab: 'terminal'
|
|
68
|
+
secondaryTab: 'terminal',
|
|
69
|
+
splitRatio: 0.5
|
|
33
70
|
};
|
|
34
71
|
try {
|
|
35
72
|
const raw = window.localStorage.getItem(STUDIO_LAYOUT_KEY);
|
|
36
73
|
if (!raw) return defaults;
|
|
37
74
|
const parsed = JSON.parse(raw) as Partial<StudioLayoutState>;
|
|
38
75
|
const primaryTab = isValidStudioTab(parsed.primaryTab) ? parsed.primaryTab : defaults.primaryTab;
|
|
76
|
+
const splitActive = Boolean(parsed.splitActive);
|
|
39
77
|
const secondaryTab = pickDistinctSecondaryTab(primaryTab, parsed.secondaryTab);
|
|
78
|
+
const openTabs = normalizeOpenTabs(parsed.openTabs, primaryTab, splitActive, secondaryTab);
|
|
40
79
|
return {
|
|
80
|
+
openTabs,
|
|
41
81
|
primaryTab,
|
|
42
|
-
splitActive
|
|
43
|
-
secondaryTab
|
|
82
|
+
splitActive,
|
|
83
|
+
secondaryTab,
|
|
84
|
+
splitRatio: clampSplitRatio(parsed.splitRatio)
|
|
44
85
|
};
|
|
45
86
|
} catch {
|
|
46
87
|
return defaults;
|
|
@@ -50,9 +91,11 @@ export function loadPersistedStudioLayout(): StudioLayoutState {
|
|
|
50
91
|
export function persistStudioLayout(layout: StudioLayoutState): void {
|
|
51
92
|
try {
|
|
52
93
|
window.localStorage.setItem(STUDIO_LAYOUT_KEY, JSON.stringify({
|
|
94
|
+
openTabs: layout.openTabs,
|
|
53
95
|
primaryTab: layout.primaryTab,
|
|
54
96
|
splitActive: layout.splitActive,
|
|
55
|
-
secondaryTab: layout.secondaryTab
|
|
97
|
+
secondaryTab: layout.secondaryTab,
|
|
98
|
+
splitRatio: clampSplitRatio(layout.splitRatio)
|
|
56
99
|
}));
|
|
57
100
|
} catch {
|
|
58
101
|
// Ignore storage unavailability
|