@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/providers/acp.ts
CHANGED
|
@@ -168,7 +168,7 @@ export class AcpProvider extends LLMProvider {
|
|
|
168
168
|
' - Bundled Causyne skills must be read via the host tool `fs_read_skill`. Do NOT call peer-native `skill` or functions for Causyne skills. To read a skill, write `<tool_call>{"name": "fs_read_skill", "arguments": {"skill_id": "domain/name"}}</tool_call>` directly in your assistant text response.\n' +
|
|
169
169
|
' - To invoke a Causyne host tool, write `<tool_call>{"name": "tool_name", "arguments": { ... }}</tool_call>` directly in your assistant text response with NO native function call in that step; Causyne will execute the host tool and return the result on the next turn.\n' +
|
|
170
170
|
'2. WORKSPACE PATH BOUNDARY (NO /tmp):\n' +
|
|
171
|
-
' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.\n\n[Language & Communication Directive]\nDynamically reflect and match the exact language used by the user in their prompt. Respond naturally in that same language.'
|
|
171
|
+
' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.\n\n[Personalization Directive]\nStrictly honor any Project Personalization (`.causyne/personalization.md`) and workspace instructions included in system context as a high-priority binding contract for this project (subordinate only to safety and sandbox boundaries).\n\n[Language & Communication Directive]\nDynamically reflect and match the exact language used by the user in their prompt. Respond naturally in that same language.'
|
|
172
172
|
);
|
|
173
173
|
|
|
174
174
|
if (tools && tools.length > 0) {
|
|
@@ -243,7 +243,8 @@ export class AcpProvider extends LLMProvider {
|
|
|
243
243
|
' - Bundled Causyne skills must be read via the host tool `fs_read_skill`. Do NOT call peer-native `skill` or functions for Causyne skills. To read a skill, write `<tool_call>{"name": "fs_read_skill", "arguments": {"skill_id": "domain/name"}}</tool_call>` directly in your assistant text response.\n' +
|
|
244
244
|
' - To invoke a Causyne host tool, write `<tool_call>{"name": "tool_name", "arguments": { ... }}</tool_call>` directly in your assistant text response with NO native function call in that step; Causyne will execute the host tool and return the result on the next turn.\n' +
|
|
245
245
|
'2. WORKSPACE PATH BOUNDARY (NO /tmp):\n' +
|
|
246
|
-
' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access
|
|
246
|
+
' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.\n\n' +
|
|
247
|
+
'[Personalization Directive]\nStrictly honor any Project Personalization (`.causyne/personalization.md`) and workspace instructions included in system context as a high-priority binding contract for this project (subordinate only to safety and sandbox boundaries).'
|
|
247
248
|
);
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -913,6 +913,8 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
913
913
|
'Follow the task scope and execute directly with your native tools (or Causyne host tools when needed). ' +
|
|
914
914
|
'When target files and verification commands are specified, read those files, apply minimal accurate edits, and verify with the project test/build command — avoid redundant git log, find, or throwaway scratch probes. ' +
|
|
915
915
|
'Put file contents directly in edit/write arguments, NEVER reply with conversational pleasantries, and report verified outcomes or blockers concisely.\n\n' +
|
|
916
|
+
'[Personalization Directive]\n' +
|
|
917
|
+
'Strictly obey any Project Personalization (`.causyne/personalization.md`) and workspace instructions provided in the system messages—treat them as a high-priority binding operational contract for this project (vision, conventions, language, and style), subordinate only to safety and permission boundaries.\n\n' +
|
|
916
918
|
'[Language & Communication Directive]\n' +
|
|
917
919
|
'Communicate concisely and strictly in English with zero canned greetings.');
|
|
918
920
|
if (tools && tools.length > 0) {
|
|
@@ -933,6 +933,8 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
933
933
|
'Follow the task scope and execute directly with your native tools (or Causyne host tools when needed). ' +
|
|
934
934
|
'When target files and verification commands are specified, read those files, apply minimal accurate edits, and verify with the project test/build command — avoid redundant git log, find, or throwaway scratch probes. ' +
|
|
935
935
|
'Put file contents directly in edit/write arguments, NEVER reply with conversational pleasantries, and report verified outcomes or blockers concisely.\n\n' +
|
|
936
|
+
'[Personalization Directive]\n' +
|
|
937
|
+
'Strictly obey any Project Personalization (`.causyne/personalization.md`) and workspace instructions provided in the system messages—treat them as a high-priority binding operational contract for this project (vision, conventions, language, and style), subordinate only to safety and permission boundaries.\n\n' +
|
|
936
938
|
'[Language & Communication Directive]\n' +
|
|
937
939
|
'Communicate concisely and strictly in English with zero canned greetings.'
|
|
938
940
|
);
|
package/src/tools/memoryWrite.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getMemory, saveMemory } from '../memory.js';
|
|
2
2
|
import { recordScopedFact } from '../memory/scopedFacts.js';
|
|
3
3
|
import { cortexDb } from '../cortex/vectorDb.js';
|
|
4
|
+
import { resolveEffectiveMemoryPolicy } from '../personalization.js';
|
|
4
5
|
const MAX_FACTS = 100;
|
|
5
6
|
export const memoryWrite = {
|
|
6
7
|
schema: {
|
|
@@ -54,8 +55,21 @@ export const memoryWrite = {
|
|
|
54
55
|
return { success: false, error: "Missing non-empty 'fact' or 'creativePattern' parameter." };
|
|
55
56
|
}
|
|
56
57
|
try {
|
|
57
|
-
const memory = getMemory();
|
|
58
58
|
const workspace = dependencies?.parentLoop?.workspaceRoot || dependencies?.workspaceRoot;
|
|
59
|
+
const memPolicy = resolveEffectiveMemoryPolicy(workspace);
|
|
60
|
+
if (!memPolicy.enabled) {
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
error: 'Causyne memories are disabled in Personalization settings for this workspace/device. Enable memories to save facts.'
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (!memPolicy.allowToolAssisted && dependencies?.parentLoop?.isMemoryPollutedByExternalTools?.()) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: 'Saving memories from tool-assisted chats (MCP/web tools) is disabled in Personalization settings.'
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const memory = getMemory();
|
|
59
73
|
const { memory: updated, alreadyKnown } = recordScopedFact(memory, fact, {
|
|
60
74
|
workspace,
|
|
61
75
|
maxFacts: MAX_FACTS
|
package/src/tools/memoryWrite.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getMemory, saveMemory } from '../memory.js';
|
|
2
2
|
import { recordScopedFact } from '../memory/scopedFacts.js';
|
|
3
3
|
import { cortexDb } from '../cortex/vectorDb.js';
|
|
4
|
+
import { resolveEffectiveMemoryPolicy } from '../personalization.js';
|
|
4
5
|
|
|
5
6
|
const MAX_FACTS = 100;
|
|
6
7
|
|
|
@@ -20,6 +21,7 @@ export interface MemoryWriteDependencies {
|
|
|
20
21
|
workspaceRoot?: string | undefined;
|
|
21
22
|
parentLoop?: {
|
|
22
23
|
workspaceRoot?: string | undefined;
|
|
24
|
+
isMemoryPollutedByExternalTools?: () => boolean;
|
|
23
25
|
} | undefined;
|
|
24
26
|
broadcast?: (event: { type: string; content: string }) => void;
|
|
25
27
|
}
|
|
@@ -86,8 +88,21 @@ export const memoryWrite = {
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
try {
|
|
89
|
-
const memory = getMemory();
|
|
90
91
|
const workspace = dependencies?.parentLoop?.workspaceRoot || dependencies?.workspaceRoot;
|
|
92
|
+
const memPolicy = resolveEffectiveMemoryPolicy(workspace);
|
|
93
|
+
if (!memPolicy.enabled) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
error: 'Causyne memories are disabled in Personalization settings for this workspace/device. Enable memories to save facts.'
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (!memPolicy.allowToolAssisted && dependencies?.parentLoop?.isMemoryPollutedByExternalTools?.()) {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
error: 'Saving memories from tool-assisted chats (MCP/web tools) is disabled in Personalization settings.'
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const memory = getMemory();
|
|
91
106
|
const { memory: updated, alreadyKnown } = recordScopedFact(memory, fact, {
|
|
92
107
|
workspace,
|
|
93
108
|
maxFacts: MAX_FACTS
|
package/src/tools/osSandbox.js
CHANGED
|
@@ -377,7 +377,7 @@ export function buildSeatbeltProfile(options) {
|
|
|
377
377
|
'/dev/stdout',
|
|
378
378
|
'/dev/stderr'
|
|
379
379
|
];
|
|
380
|
-
lines.push(`(allow file-write* ${safeDeviceLiterals.map(p => `(literal "${p}")`).join(' ')})`);
|
|
380
|
+
lines.push(`(allow file-write* ${safeDeviceLiterals.map(p => `(literal "${p}")`).join(' ')} (prefix "/dev/ttys"))`);
|
|
381
381
|
if (mode === 'workspace-write') {
|
|
382
382
|
const writableSubpaths = new Set();
|
|
383
383
|
const addWritable = (rawPath) => {
|
package/src/tools/osSandbox.ts
CHANGED
|
@@ -433,7 +433,7 @@ export function buildSeatbeltProfile(options: OsSandboxWrapOptions): string {
|
|
|
433
433
|
'/dev/stderr'
|
|
434
434
|
];
|
|
435
435
|
lines.push(
|
|
436
|
-
`(allow file-write* ${safeDeviceLiterals.map(p => `(literal "${p}")`).join(' ')})`
|
|
436
|
+
`(allow file-write* ${safeDeviceLiterals.map(p => `(literal "${p}")`).join(' ')} (prefix "/dev/ttys"))`
|
|
437
437
|
);
|
|
438
438
|
|
|
439
439
|
if (mode === 'workspace-write') {
|
package/src/tools/ptyTerminal.js
CHANGED
|
@@ -528,6 +528,8 @@ export class PtyTerminalManager {
|
|
|
528
528
|
COLUMNS: String(cols),
|
|
529
529
|
LINES: String(rows),
|
|
530
530
|
CAUSYNE_TERMINAL: '1',
|
|
531
|
+
// Avoid noisy ~/.zsh_history lock warnings inside OS sandboxes while keeping in-memory history
|
|
532
|
+
...(wrapped.sandboxed ? { HISTFILE: '' } : {}),
|
|
531
533
|
// OSC 133;D marker for exact prompt-completion readiness in bash/zsh
|
|
532
534
|
PROMPT_COMMAND: 'printf "\\033]133;D;%s\\007" "$?"'
|
|
533
535
|
};
|
|
@@ -560,25 +562,31 @@ export class PtyTerminalManager {
|
|
|
560
562
|
createdAt: now,
|
|
561
563
|
lastActivityAt: now,
|
|
562
564
|
scrollback: '',
|
|
565
|
+
rawScrollback: '',
|
|
563
566
|
sanitizer: new TerminalSanitizer(),
|
|
564
567
|
promptMarkerCount: 0,
|
|
565
568
|
stdoutLineBuf: '',
|
|
566
569
|
subscribers: new Set()
|
|
567
570
|
};
|
|
568
571
|
const appendOutput = (rawChunk) => {
|
|
572
|
+
if (!rawChunk)
|
|
573
|
+
return;
|
|
569
574
|
const cleaned = session.sanitizer.process(rawChunk);
|
|
570
575
|
if (cleaned.promptMarkers > 0) {
|
|
571
576
|
session.promptMarkerCount += cleaned.promptMarkers;
|
|
572
577
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
|
|
578
|
+
const redactedRaw = redactTextSecrets(rawChunk, [], { sanitizeTerminal: false });
|
|
579
|
+
session.rawScrollback = trimScrollback(session.rawScrollback + redactedRaw);
|
|
580
|
+
const redactedClean = cleaned.text ? redactTextSecrets(cleaned.text) : '';
|
|
581
|
+
if (redactedClean) {
|
|
582
|
+
session.scrollback = trimScrollback(session.scrollback + redactedClean);
|
|
583
|
+
}
|
|
577
584
|
session.lastActivityAt = Date.now();
|
|
578
585
|
this.broadcast(session, {
|
|
579
586
|
type: 'output',
|
|
580
587
|
sessionId: session.id,
|
|
581
|
-
data:
|
|
588
|
+
data: redactedClean,
|
|
589
|
+
rawData: redactedRaw,
|
|
582
590
|
ts: session.lastActivityAt
|
|
583
591
|
});
|
|
584
592
|
};
|
|
@@ -594,6 +602,9 @@ export class PtyTerminalManager {
|
|
|
594
602
|
const msg = JSON.parse(line);
|
|
595
603
|
if (msg.t === 'ready' && typeof msg.pid === 'number') {
|
|
596
604
|
session.childPid = msg.pid;
|
|
605
|
+
if (msg.mode === 'pipe' || msg.mode === 'pty') {
|
|
606
|
+
session.transport = msg.mode;
|
|
607
|
+
}
|
|
597
608
|
}
|
|
598
609
|
else if (msg.t === 'out' && typeof msg.b === 'string') {
|
|
599
610
|
const decoded = Buffer.from(msg.b, 'base64').toString('utf8');
|
|
@@ -882,6 +893,7 @@ export class PtyTerminalManager {
|
|
|
882
893
|
type: 'snapshot',
|
|
883
894
|
sessionId: session.id,
|
|
884
895
|
data: session.scrollback,
|
|
896
|
+
rawData: session.rawScrollback,
|
|
885
897
|
control: session.control,
|
|
886
898
|
status: session.status,
|
|
887
899
|
exitCode: session.exitCode,
|
package/src/tools/ptyTerminal.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface TerminalStreamEvent {
|
|
|
57
57
|
type: 'snapshot' | 'output' | 'control' | 'exit' | 'meta';
|
|
58
58
|
sessionId: string;
|
|
59
59
|
data?: string | undefined;
|
|
60
|
+
rawData?: string | undefined;
|
|
60
61
|
control?: TerminalControlOwner | undefined;
|
|
61
62
|
status?: 'running' | 'exited' | undefined;
|
|
62
63
|
exitCode?: number | null | undefined;
|
|
@@ -485,6 +486,7 @@ interface LivePtySession {
|
|
|
485
486
|
createdAt: number;
|
|
486
487
|
lastActivityAt: number;
|
|
487
488
|
scrollback: string;
|
|
489
|
+
rawScrollback: string;
|
|
488
490
|
sanitizer: TerminalSanitizer;
|
|
489
491
|
promptMarkerCount: number;
|
|
490
492
|
stdoutLineBuf: string;
|
|
@@ -614,6 +616,8 @@ export class PtyTerminalManager {
|
|
|
614
616
|
COLUMNS: String(cols),
|
|
615
617
|
LINES: String(rows),
|
|
616
618
|
CAUSYNE_TERMINAL: '1',
|
|
619
|
+
// Avoid noisy ~/.zsh_history lock warnings inside OS sandboxes while keeping in-memory history
|
|
620
|
+
...(wrapped.sandboxed ? { HISTFILE: '' } : {}),
|
|
617
621
|
// OSC 133;D marker for exact prompt-completion readiness in bash/zsh
|
|
618
622
|
PROMPT_COMMAND: 'printf "\\033]133;D;%s\\007" "$?"'
|
|
619
623
|
};
|
|
@@ -648,6 +652,7 @@ export class PtyTerminalManager {
|
|
|
648
652
|
createdAt: now,
|
|
649
653
|
lastActivityAt: now,
|
|
650
654
|
scrollback: '',
|
|
655
|
+
rawScrollback: '',
|
|
651
656
|
sanitizer: new TerminalSanitizer(),
|
|
652
657
|
promptMarkerCount: 0,
|
|
653
658
|
stdoutLineBuf: '',
|
|
@@ -655,18 +660,23 @@ export class PtyTerminalManager {
|
|
|
655
660
|
};
|
|
656
661
|
|
|
657
662
|
const appendOutput = (rawChunk: string): void => {
|
|
663
|
+
if (!rawChunk) return;
|
|
658
664
|
const cleaned = session.sanitizer.process(rawChunk);
|
|
659
665
|
if (cleaned.promptMarkers > 0) {
|
|
660
666
|
session.promptMarkerCount += cleaned.promptMarkers;
|
|
661
667
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
668
|
+
const redactedRaw = redactTextSecrets(rawChunk, [], { sanitizeTerminal: false });
|
|
669
|
+
session.rawScrollback = trimScrollback(session.rawScrollback + redactedRaw);
|
|
670
|
+
const redactedClean = cleaned.text ? redactTextSecrets(cleaned.text) : '';
|
|
671
|
+
if (redactedClean) {
|
|
672
|
+
session.scrollback = trimScrollback(session.scrollback + redactedClean);
|
|
673
|
+
}
|
|
665
674
|
session.lastActivityAt = Date.now();
|
|
666
675
|
this.broadcast(session, {
|
|
667
676
|
type: 'output',
|
|
668
677
|
sessionId: session.id,
|
|
669
|
-
data:
|
|
678
|
+
data: redactedClean,
|
|
679
|
+
rawData: redactedRaw,
|
|
670
680
|
ts: session.lastActivityAt
|
|
671
681
|
});
|
|
672
682
|
};
|
|
@@ -680,9 +690,12 @@ export class PtyTerminalManager {
|
|
|
680
690
|
session.stdoutLineBuf = session.stdoutLineBuf.slice(nl + 1);
|
|
681
691
|
if (line) {
|
|
682
692
|
try {
|
|
683
|
-
const msg = JSON.parse(line) as { t?: string; b?: string; pid?: number; code?: number };
|
|
693
|
+
const msg = JSON.parse(line) as { t?: string; b?: string; pid?: number; code?: number; mode?: string };
|
|
684
694
|
if (msg.t === 'ready' && typeof msg.pid === 'number') {
|
|
685
695
|
session.childPid = msg.pid;
|
|
696
|
+
if (msg.mode === 'pipe' || msg.mode === 'pty') {
|
|
697
|
+
session.transport = msg.mode;
|
|
698
|
+
}
|
|
686
699
|
} else if (msg.t === 'out' && typeof msg.b === 'string') {
|
|
687
700
|
const decoded = Buffer.from(msg.b, 'base64').toString('utf8');
|
|
688
701
|
appendOutput(decoded);
|
|
@@ -995,6 +1008,7 @@ export class PtyTerminalManager {
|
|
|
995
1008
|
type: 'snapshot',
|
|
996
1009
|
sessionId: session.id,
|
|
997
1010
|
data: session.scrollback,
|
|
1011
|
+
rawData: session.rawScrollback,
|
|
998
1012
|
control: session.control,
|
|
999
1013
|
status: session.status,
|
|
1000
1014
|
exitCode: session.exitCode,
|