@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
|
@@ -17,10 +17,12 @@ The lockfile contained 47 dependency entries in total. Development and
|
|
|
17
17
|
platform-specific optional entries account for most of the graph.
|
|
18
18
|
|
|
19
19
|
The direct runtime dependencies are `@modelcontextprotocol/client`,
|
|
20
|
-
`acorn-walk`, and `commander`. Direct development dependencies are
|
|
20
|
+
`@xterm/addon-fit`, `@xterm/xterm`, `acorn-walk`, and `commander`. Direct development dependencies are
|
|
21
21
|
`@babel/parser`, `@modelcontextprotocol/node`, `@modelcontextprotocol/server`,
|
|
22
22
|
`@types/node`, `acorn`, `typescript`, and `zod`. The three direct MCP packages
|
|
23
|
-
are licensed under Apache-2.0
|
|
23
|
+
are licensed under Apache-2.0, and `@xterm/xterm` (6.0.0) and `@xterm/addon-fit`
|
|
24
|
+
(0.11.0) are licensed under MIT with zero transitive dependencies and zero
|
|
25
|
+
install scripts. Exact versions, transitive dependencies, license
|
|
24
26
|
identifiers, and integrity hashes are recorded in `package-lock.json`.
|
|
25
27
|
|
|
26
28
|
No dependency in the reviewed main lockfile was marked with an install script.
|
|
@@ -143,6 +145,38 @@ Tool contracts and headless substrate bindings are adapted under the terms of th
|
|
|
143
145
|
> SOFTWARE.
|
|
144
146
|
|
|
145
147
|
|
|
148
|
+
The interactive workspace terminal UI in `src/web/client/terminalTheme.ts` and
|
|
149
|
+
`src/web/client/terminalPanel.ts` integrates `@xterm/xterm` and `@xterm/addon-fit`
|
|
150
|
+
under the MIT License, and incorporates OSC color tracking, contrast-aware cursor
|
|
151
|
+
rendering, and side-panel dock interaction patterns adapted from MIT-licensed
|
|
152
|
+
open-source terminal and dock UI implementations:
|
|
153
|
+
|
|
154
|
+
> MIT License
|
|
155
|
+
>
|
|
156
|
+
> Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
157
|
+
> Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
158
|
+
> Copyright (c) Microsoft Corporation. All rights reserved.
|
|
159
|
+
> Copyright (c) 2026 DeepSeek
|
|
160
|
+
>
|
|
161
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
162
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
163
|
+
> in the Software without restriction, including without limitation the rights
|
|
164
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
165
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
166
|
+
> furnished to do so, subject to the following conditions:
|
|
167
|
+
>
|
|
168
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
169
|
+
> copies or substantial portions of the Software.
|
|
170
|
+
>
|
|
171
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
172
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
173
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
174
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
175
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
176
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
177
|
+
> SOFTWARE.
|
|
178
|
+
|
|
179
|
+
|
|
146
180
|
Repository scanning found no third-party copyright header or license marker in
|
|
147
181
|
the project-authored source and skill files. That negative scan alone cannot
|
|
148
182
|
establish authorship or permission. On 2026-10-19, the licensor confirmed that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causyne/agent",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.128",
|
|
4
4
|
"description": "Agentic AI for software, tools, and computer workflows",
|
|
5
5
|
"main": "bin/causyne.js",
|
|
6
6
|
"type": "module",
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@modelcontextprotocol/client": "^2.4.0",
|
|
63
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
64
|
+
"@xterm/xterm": "^6.0.0",
|
|
63
65
|
"acorn-walk": "^8.3.5",
|
|
64
66
|
"commander": "^11.1.0"
|
|
65
67
|
},
|
package/src/agentLoop.js
CHANGED
|
@@ -49,6 +49,7 @@ import { isWholeFileDeletion, requiresToolApproval, withToolAutonomyMode } from
|
|
|
49
49
|
import { evaluateEnterprisePolicy } from './enterprisePolicy.js';
|
|
50
50
|
import { isZeroCostFailoverEligible, normalizeZeroCostId, selectNextZeroCostRoute } from './zeroCostFailover.js';
|
|
51
51
|
import { formatProjectInstructionsPrompt, loadProjectInstructions } from './projectInstructions.js';
|
|
52
|
+
import { isExternalToolAssistedToolName, resolveEffectiveMemoryPolicy } from './personalization.js';
|
|
52
53
|
import { AGENT_USER_POLICY } from './agentPolicy.js';
|
|
53
54
|
import { VFETracker } from './vfeTracker.js';
|
|
54
55
|
import { coldObserver } from './observer/coldObserver.js';
|
|
@@ -129,6 +130,11 @@ ${PEER_COLLABORATION_POLICY}
|
|
|
129
130
|
|
|
130
131
|
${AGENT_USER_POLICY}
|
|
131
132
|
|
|
133
|
+
# Personalization & Project Instructions (HIGH-PRIORITY DIRECTIVE)
|
|
134
|
+
- **Treat Project Personalization as a Big Deal**: Developers configure per-project Personalization (\`.causyne/personalization.md\`), repository rules (\`CAUSYNE.md\`, \`AGENTS.md\`, \`.causyne/rules/*.md\`), and global instructions (\`~/.causyne/CAUSYNE.md\`) to encode their project's vision, mission, architectural standards, coding taste, and working comfort.
|
|
135
|
+
- **Strict Obedience Under Core Safety**: Whenever Personalization or Project Instructions are provided in this session, treat them as a **binding high-priority operational contract**. Actively honor every detail—communication style, language, conventions, constraints, and engineering rules—over generic habits or defaults. Only Causyne's Absolute Ethical Safety Net, active permission preset, and workspace/sandbox security boundaries supersede Personalization.
|
|
136
|
+
- **Per-Project Precedence**: Project-scoped Personalization (\`.causyne/personalization.md\`) and repository rules apply specifically to the active project and take precedence over general global preferences if they differ.
|
|
137
|
+
|
|
132
138
|
# Operational Guidelines & Engineering Discipline
|
|
133
139
|
- **Language & Communication**: Communicate clearly in the user's language by default unless repository instructions (such as \`AGENTS.md\` or \`CAUSYNE.md\`) specify a required language.
|
|
134
140
|
- **Conciseness & Output**: Keep replies concise (<4 lines unless detail is requested). No preambles or postambles. Output exact file paths for files created or modified. Answer greetings or pure questions directly without tools.
|
|
@@ -512,6 +518,7 @@ export class AgentLoop {
|
|
|
512
518
|
// be recomputed on every single step (cortex retrieval, skills index,
|
|
513
519
|
// design detection, workspace domain scan).
|
|
514
520
|
this.staticContext = null;
|
|
521
|
+
this._memoryPollutedByExternalTools = false;
|
|
515
522
|
this.vfeTracker = new VFETracker();
|
|
516
523
|
this._lessonSimilarity = 0;
|
|
517
524
|
this._paradigmShiftPending = false;
|
|
@@ -796,7 +803,8 @@ export class AgentLoop {
|
|
|
796
803
|
async buildStaticContext() {
|
|
797
804
|
let lessonsLearned = '';
|
|
798
805
|
this._lessonSimilarity = 0;
|
|
799
|
-
const
|
|
806
|
+
const startupMemoryPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
807
|
+
const cortexEnabled = Boolean(this.config?.cortex?.enabled) && startupMemoryPolicy.enabled;
|
|
800
808
|
if (cortexEnabled && this.currentTaskPrompt && isSearchablePrompt(this.currentTaskPrompt)) {
|
|
801
809
|
try {
|
|
802
810
|
const matches = await cortexDb.search(this.currentTaskPrompt, 2, { workspace: this.workspaceRoot });
|
|
@@ -863,11 +871,13 @@ export class AgentLoop {
|
|
|
863
871
|
this.debugLog(`plan cache hint skipped: ${e.message}`);
|
|
864
872
|
}
|
|
865
873
|
let episodicContext = '';
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
874
|
+
if (startupMemoryPolicy.enabled) {
|
|
875
|
+
try {
|
|
876
|
+
episodicContext = episodicStore.buildStartupEpisodicContext(this.workspaceRoot);
|
|
877
|
+
}
|
|
878
|
+
catch (e) {
|
|
879
|
+
this.debugLog(`episodic context build skipped: ${e.message}`);
|
|
880
|
+
}
|
|
871
881
|
}
|
|
872
882
|
let projectInstructions = '';
|
|
873
883
|
try {
|
|
@@ -878,6 +888,9 @@ export class AgentLoop {
|
|
|
878
888
|
}
|
|
879
889
|
return { lessonsLearned, designContext, antiRepeatDirective, universalSkillsContext, planHint, episodicContext, projectInstructions };
|
|
880
890
|
}
|
|
891
|
+
isMemoryPollutedByExternalTools() {
|
|
892
|
+
return Boolean(this._memoryPollutedByExternalTools);
|
|
893
|
+
}
|
|
881
894
|
rearmAbortController() {
|
|
882
895
|
this.abortController = new AbortController();
|
|
883
896
|
}
|
|
@@ -1841,6 +1854,7 @@ export class AgentLoop {
|
|
|
1841
1854
|
this.slopReviewAttempts = 0;
|
|
1842
1855
|
this.slopLastAuditHash = '';
|
|
1843
1856
|
this.staticContext = null;
|
|
1857
|
+
this._memoryPollutedByExternalTools = false;
|
|
1844
1858
|
// Plan cache: the procedure THIS task follows, and the template (if any)
|
|
1845
1859
|
// that was offered to it. Both reset per task — a plan is a property of one
|
|
1846
1860
|
// request, not of the session.
|
|
@@ -2372,7 +2386,10 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
2372
2386
|
isVisualOrWebTask ? WEB_VERIFICATION_PROMPT : ''
|
|
2373
2387
|
].join('');
|
|
2374
2388
|
const providerPrompt = `${baseProviderPrompt}${sensoryAwareness}${domainPrompts}`;
|
|
2375
|
-
const
|
|
2389
|
+
const turnMemoryPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
2390
|
+
const memoryContext = turnMemoryPolicy.enabled
|
|
2391
|
+
? getMemoryContextString({ workspaceRoot: this.workspaceRoot })
|
|
2392
|
+
: '';
|
|
2376
2393
|
// --- PER-TASK STATIC CONTEXT (computed once, not once per step) ---
|
|
2377
2394
|
// Cortex retrieval, design detection, creative-pattern lookup and the
|
|
2378
2395
|
// workspace domain scan are all constant for the duration of a task, but
|
|
@@ -2816,16 +2833,22 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
2816
2833
|
...(isFailed ? { error: action.detail || `${action.name} failed` } : {})
|
|
2817
2834
|
};
|
|
2818
2835
|
coldObserver.recordToolOutcome(this.taskId, action.name, actionArgs, actionOutcome);
|
|
2836
|
+
if (isExternalToolAssistedToolName(action.name)) {
|
|
2837
|
+
this._memoryPollutedByExternalTools = true;
|
|
2838
|
+
}
|
|
2819
2839
|
try {
|
|
2820
|
-
const
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2840
|
+
const memPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
2841
|
+
if (memPolicy.enabled && (memPolicy.allowToolAssisted || !this._memoryPollutedByExternalTools)) {
|
|
2842
|
+
const compiledObs = compileToolObservation({
|
|
2843
|
+
taskId: this.taskId,
|
|
2844
|
+
workspace: this.workspaceRoot,
|
|
2845
|
+
toolName: action.name,
|
|
2846
|
+
args: actionArgs,
|
|
2847
|
+
result: actionOutcome
|
|
2848
|
+
});
|
|
2849
|
+
if (compiledObs)
|
|
2850
|
+
episodicStore.recordObservation(compiledObs);
|
|
2851
|
+
}
|
|
2829
2852
|
}
|
|
2830
2853
|
catch { /* never block peer action on episodic recording */ }
|
|
2831
2854
|
const recovery = this.timeMachine.observe(action.name, actionArgs, actionOutcome, coldObserver.getToolOutcomes(this.taskId));
|
|
@@ -3976,9 +3999,13 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
3976
3999
|
this.debugLog(`plan cache write skipped: ${e.message}`);
|
|
3977
4000
|
}
|
|
3978
4001
|
try {
|
|
4002
|
+
const memPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
3979
4003
|
const reqText = String(this.currentTaskPrompt || this.userPrompt || '').trim();
|
|
3980
4004
|
const completedText = String(response.content || 'Completed task execution.').replace(/\s+/g, ' ').trim();
|
|
3981
|
-
if (
|
|
4005
|
+
if (memPolicy.enabled
|
|
4006
|
+
&& (memPolicy.allowToolAssisted || !this._memoryPollutedByExternalTools)
|
|
4007
|
+
&& reqText
|
|
4008
|
+
&& (this.stepsCompleted > 0 || completedNativeActionIds.size > 0)) {
|
|
3982
4009
|
episodicStore.recordSessionSummary({
|
|
3983
4010
|
taskId: this.taskId,
|
|
3984
4011
|
workspace: this.workspaceRoot,
|
|
@@ -4655,16 +4682,22 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
4655
4682
|
? { success: true, _is_image_marker: true, visionDelivered: imageCanReachModel, filename: result.filename, mimeType: result.mimeType }
|
|
4656
4683
|
: result;
|
|
4657
4684
|
coldObserver.recordToolOutcome(this.taskId, functionName, args, observedResult);
|
|
4685
|
+
if (isExternalToolAssistedToolName(functionName)) {
|
|
4686
|
+
this._memoryPollutedByExternalTools = true;
|
|
4687
|
+
}
|
|
4658
4688
|
try {
|
|
4659
|
-
const
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4689
|
+
const memPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
4690
|
+
if (memPolicy.enabled && (memPolicy.allowToolAssisted || !this._memoryPollutedByExternalTools)) {
|
|
4691
|
+
const compiledObs = compileToolObservation({
|
|
4692
|
+
taskId: this.taskId,
|
|
4693
|
+
workspace: this.workspaceRoot,
|
|
4694
|
+
toolName: functionName,
|
|
4695
|
+
args: args || {},
|
|
4696
|
+
result: observedResult && typeof observedResult === 'object' ? observedResult : { success: true }
|
|
4697
|
+
});
|
|
4698
|
+
if (compiledObs)
|
|
4699
|
+
episodicStore.recordObservation(compiledObs);
|
|
4700
|
+
}
|
|
4668
4701
|
}
|
|
4669
4702
|
catch { /* never block tool execution on episodic recording */ }
|
|
4670
4703
|
const recovery = this.timeMachine.observe(functionName, args, observedResult, coldObserver.getToolOutcomes(this.taskId));
|
package/src/agentLoop.ts
CHANGED
|
@@ -75,6 +75,7 @@ import {
|
|
|
75
75
|
selectNextZeroCostRoute
|
|
76
76
|
} from './zeroCostFailover.js';
|
|
77
77
|
import { formatProjectInstructionsPrompt, loadProjectInstructions } from './projectInstructions.js';
|
|
78
|
+
import { isExternalToolAssistedToolName, resolveEffectiveMemoryPolicy } from './personalization.js';
|
|
78
79
|
import { AGENT_USER_POLICY } from './agentPolicy.js';
|
|
79
80
|
import { VFETracker } from './vfeTracker.js';
|
|
80
81
|
import { coldObserver } from './observer/coldObserver.js';
|
|
@@ -248,6 +249,11 @@ ${PEER_COLLABORATION_POLICY}
|
|
|
248
249
|
|
|
249
250
|
${AGENT_USER_POLICY}
|
|
250
251
|
|
|
252
|
+
# Personalization & Project Instructions (HIGH-PRIORITY DIRECTIVE)
|
|
253
|
+
- **Treat Project Personalization as a Big Deal**: Developers configure per-project Personalization (\`.causyne/personalization.md\`), repository rules (\`CAUSYNE.md\`, \`AGENTS.md\`, \`.causyne/rules/*.md\`), and global instructions (\`~/.causyne/CAUSYNE.md\`) to encode their project's vision, mission, architectural standards, coding taste, and working comfort.
|
|
254
|
+
- **Strict Obedience Under Core Safety**: Whenever Personalization or Project Instructions are provided in this session, treat them as a **binding high-priority operational contract**. Actively honor every detail—communication style, language, conventions, constraints, and engineering rules—over generic habits or defaults. Only Causyne's Absolute Ethical Safety Net, active permission preset, and workspace/sandbox security boundaries supersede Personalization.
|
|
255
|
+
- **Per-Project Precedence**: Project-scoped Personalization (\`.causyne/personalization.md\`) and repository rules apply specifically to the active project and take precedence over general global preferences if they differ.
|
|
256
|
+
|
|
251
257
|
# Operational Guidelines & Engineering Discipline
|
|
252
258
|
- **Language & Communication**: Communicate clearly in the user's language by default unless repository instructions (such as \`AGENTS.md\` or \`CAUSYNE.md\`) specify a required language.
|
|
253
259
|
- **Conciseness & Output**: Keep replies concise (<4 lines unless detail is requested). No preambles or postambles. Output exact file paths for files created or modified. Answer greetings or pure questions directly without tools.
|
|
@@ -664,6 +670,7 @@ export class AgentLoop {
|
|
|
664
670
|
// be recomputed on every single step (cortex retrieval, skills index,
|
|
665
671
|
// design detection, workspace domain scan).
|
|
666
672
|
this.staticContext = null;
|
|
673
|
+
this._memoryPollutedByExternalTools = false;
|
|
667
674
|
this.vfeTracker = new VFETracker();
|
|
668
675
|
this._lessonSimilarity = 0;
|
|
669
676
|
this._paradigmShiftPending = false;
|
|
@@ -960,7 +967,8 @@ export class AgentLoop {
|
|
|
960
967
|
async buildStaticContext() {
|
|
961
968
|
let lessonsLearned = '';
|
|
962
969
|
this._lessonSimilarity = 0;
|
|
963
|
-
const
|
|
970
|
+
const startupMemoryPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
971
|
+
const cortexEnabled = Boolean(this.config?.cortex?.enabled) && startupMemoryPolicy.enabled;
|
|
964
972
|
if (cortexEnabled && this.currentTaskPrompt && isSearchablePrompt(this.currentTaskPrompt)) {
|
|
965
973
|
try {
|
|
966
974
|
const matches = await cortexDb.search(this.currentTaskPrompt, 2, { workspace: this.workspaceRoot });
|
|
@@ -1027,10 +1035,12 @@ export class AgentLoop {
|
|
|
1027
1035
|
}
|
|
1028
1036
|
|
|
1029
1037
|
let episodicContext = '';
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1038
|
+
if (startupMemoryPolicy.enabled) {
|
|
1039
|
+
try {
|
|
1040
|
+
episodicContext = episodicStore.buildStartupEpisodicContext(this.workspaceRoot);
|
|
1041
|
+
} catch (e: any) {
|
|
1042
|
+
this.debugLog(`episodic context build skipped: ${e.message}`);
|
|
1043
|
+
}
|
|
1034
1044
|
}
|
|
1035
1045
|
|
|
1036
1046
|
let projectInstructions = '';
|
|
@@ -1043,7 +1053,10 @@ export class AgentLoop {
|
|
|
1043
1053
|
return { lessonsLearned, designContext, antiRepeatDirective, universalSkillsContext, planHint, episodicContext, projectInstructions };
|
|
1044
1054
|
}
|
|
1045
1055
|
|
|
1046
|
-
|
|
1056
|
+
isMemoryPollutedByExternalTools(): boolean {
|
|
1057
|
+
return Boolean(this._memoryPollutedByExternalTools);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1047
1060
|
rearmAbortController() {
|
|
1048
1061
|
this.abortController = new AbortController();
|
|
1049
1062
|
}
|
|
@@ -1941,6 +1954,7 @@ export class AgentLoop {
|
|
|
1941
1954
|
this.slopReviewAttempts = 0;
|
|
1942
1955
|
this.slopLastAuditHash = '';
|
|
1943
1956
|
this.staticContext = null;
|
|
1957
|
+
this._memoryPollutedByExternalTools = false;
|
|
1944
1958
|
// Plan cache: the procedure THIS task follows, and the template (if any)
|
|
1945
1959
|
// that was offered to it. Both reset per task — a plan is a property of one
|
|
1946
1960
|
// request, not of the session.
|
|
@@ -2495,7 +2509,10 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
2495
2509
|
isVisualOrWebTask ? WEB_VERIFICATION_PROMPT : ''
|
|
2496
2510
|
].join('');
|
|
2497
2511
|
const providerPrompt = `${baseProviderPrompt}${sensoryAwareness}${domainPrompts}`;
|
|
2498
|
-
const
|
|
2512
|
+
const turnMemoryPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
2513
|
+
const memoryContext = turnMemoryPolicy.enabled
|
|
2514
|
+
? getMemoryContextString({ workspaceRoot: this.workspaceRoot })
|
|
2515
|
+
: '';
|
|
2499
2516
|
|
|
2500
2517
|
// --- PER-TASK STATIC CONTEXT (computed once, not once per step) ---
|
|
2501
2518
|
// Cortex retrieval, design detection, creative-pattern lookup and the
|
|
@@ -2953,15 +2970,21 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
2953
2970
|
...(isFailed ? { error: action.detail || `${action.name} failed` } : {})
|
|
2954
2971
|
};
|
|
2955
2972
|
coldObserver.recordToolOutcome(this.taskId, action.name, actionArgs, actionOutcome);
|
|
2973
|
+
if (isExternalToolAssistedToolName(action.name)) {
|
|
2974
|
+
this._memoryPollutedByExternalTools = true;
|
|
2975
|
+
}
|
|
2956
2976
|
try {
|
|
2957
|
-
const
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2977
|
+
const memPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
2978
|
+
if (memPolicy.enabled && (memPolicy.allowToolAssisted || !this._memoryPollutedByExternalTools)) {
|
|
2979
|
+
const compiledObs = compileToolObservation({
|
|
2980
|
+
taskId: this.taskId,
|
|
2981
|
+
workspace: this.workspaceRoot,
|
|
2982
|
+
toolName: action.name,
|
|
2983
|
+
args: actionArgs,
|
|
2984
|
+
result: actionOutcome
|
|
2985
|
+
});
|
|
2986
|
+
if (compiledObs) episodicStore.recordObservation(compiledObs);
|
|
2987
|
+
}
|
|
2965
2988
|
} catch { /* never block peer action on episodic recording */ }
|
|
2966
2989
|
const recovery = this.timeMachine.observe(
|
|
2967
2990
|
action.name, actionArgs, actionOutcome, coldObserver.getToolOutcomes(this.taskId)
|
|
@@ -4185,9 +4208,15 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
4185
4208
|
}
|
|
4186
4209
|
|
|
4187
4210
|
try {
|
|
4211
|
+
const memPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
4188
4212
|
const reqText = String(this.currentTaskPrompt || this.userPrompt || '').trim();
|
|
4189
4213
|
const completedText = String(response.content || 'Completed task execution.').replace(/\s+/g, ' ').trim();
|
|
4190
|
-
if (
|
|
4214
|
+
if (
|
|
4215
|
+
memPolicy.enabled
|
|
4216
|
+
&& (memPolicy.allowToolAssisted || !this._memoryPollutedByExternalTools)
|
|
4217
|
+
&& reqText
|
|
4218
|
+
&& (this.stepsCompleted > 0 || completedNativeActionIds.size > 0)
|
|
4219
|
+
) {
|
|
4191
4220
|
episodicStore.recordSessionSummary({
|
|
4192
4221
|
taskId: this.taskId,
|
|
4193
4222
|
workspace: this.workspaceRoot,
|
|
@@ -4915,15 +4944,21 @@ Verify Web/UI/3D work programmatically via browser_act (DOM snapshot + runtimeEr
|
|
|
4915
4944
|
? { success: true, _is_image_marker: true, visionDelivered: imageCanReachModel, filename: result.filename, mimeType: result.mimeType }
|
|
4916
4945
|
: result;
|
|
4917
4946
|
coldObserver.recordToolOutcome(this.taskId, functionName, args, observedResult);
|
|
4947
|
+
if (isExternalToolAssistedToolName(functionName)) {
|
|
4948
|
+
this._memoryPollutedByExternalTools = true;
|
|
4949
|
+
}
|
|
4918
4950
|
try {
|
|
4919
|
-
const
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4951
|
+
const memPolicy = resolveEffectiveMemoryPolicy(this.workspaceRoot);
|
|
4952
|
+
if (memPolicy.enabled && (memPolicy.allowToolAssisted || !this._memoryPollutedByExternalTools)) {
|
|
4953
|
+
const compiledObs = compileToolObservation({
|
|
4954
|
+
taskId: this.taskId,
|
|
4955
|
+
workspace: this.workspaceRoot,
|
|
4956
|
+
toolName: functionName,
|
|
4957
|
+
args: args || {},
|
|
4958
|
+
result: observedResult && typeof observedResult === 'object' ? observedResult : { success: true }
|
|
4959
|
+
});
|
|
4960
|
+
if (compiledObs) episodicStore.recordObservation(compiledObs);
|
|
4961
|
+
}
|
|
4927
4962
|
} catch { /* never block tool execution on episodic recording */ }
|
|
4928
4963
|
const recovery = this.timeMachine.observe(
|
|
4929
4964
|
functionName, args, observedResult, coldObserver.getToolOutcomes(this.taskId)
|
|
@@ -1488,6 +1488,37 @@ export class CausyneBrowser {
|
|
|
1488
1488
|
async captureLiveFrame(options = {}) {
|
|
1489
1489
|
return this.enqueueOperation(() => this.captureLiveFrameUnlocked(options));
|
|
1490
1490
|
}
|
|
1491
|
+
async closeLiveSession() {
|
|
1492
|
+
return this.enqueueOperation(async () => {
|
|
1493
|
+
await this.close();
|
|
1494
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
async closeLiveTab(tabId) {
|
|
1498
|
+
return this.enqueueOperation(async () => {
|
|
1499
|
+
if (!this.isSessionHealthy()) {
|
|
1500
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1501
|
+
}
|
|
1502
|
+
const target = this.tabs.get(tabId);
|
|
1503
|
+
if (target) {
|
|
1504
|
+
if (!target.page.isClosed()) {
|
|
1505
|
+
await target.page.close().catch(() => { });
|
|
1506
|
+
}
|
|
1507
|
+
this.tabs.delete(tabId);
|
|
1508
|
+
if (this.activeTabId === tabId)
|
|
1509
|
+
this.activeTabId = null;
|
|
1510
|
+
}
|
|
1511
|
+
const liveTabs = [...this.tabs.values()].filter((t) => !t.page.isClosed() && !t.crashed);
|
|
1512
|
+
if (liveTabs.length === 0) {
|
|
1513
|
+
await this.close();
|
|
1514
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1515
|
+
}
|
|
1516
|
+
if (!this.activeTabId || !this.tabs.has(this.activeTabId)) {
|
|
1517
|
+
this.activeTabId = liveTabs[liveTabs.length - 1].id;
|
|
1518
|
+
}
|
|
1519
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1491
1522
|
async captureLiveFrameUnlocked(options = {}) {
|
|
1492
1523
|
const status = this.getRuntimeStatus();
|
|
1493
1524
|
if (!this.isSessionHealthy()) {
|
|
@@ -1913,6 +1913,38 @@ export class CausyneBrowser {
|
|
|
1913
1913
|
return this.enqueueOperation(() => this.captureLiveFrameUnlocked(options));
|
|
1914
1914
|
}
|
|
1915
1915
|
|
|
1916
|
+
async closeLiveSession(): Promise<LiveBrowserFrame> {
|
|
1917
|
+
return this.enqueueOperation(async () => {
|
|
1918
|
+
await this.close();
|
|
1919
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
async closeLiveTab(tabId: string): Promise<LiveBrowserFrame> {
|
|
1924
|
+
return this.enqueueOperation(async () => {
|
|
1925
|
+
if (!this.isSessionHealthy()) {
|
|
1926
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1927
|
+
}
|
|
1928
|
+
const target = this.tabs.get(tabId);
|
|
1929
|
+
if (target) {
|
|
1930
|
+
if (!target.page.isClosed()) {
|
|
1931
|
+
await target.page.close().catch(() => {});
|
|
1932
|
+
}
|
|
1933
|
+
this.tabs.delete(tabId);
|
|
1934
|
+
if (this.activeTabId === tabId) this.activeTabId = null;
|
|
1935
|
+
}
|
|
1936
|
+
const liveTabs = [...this.tabs.values()].filter((t) => !t.page.isClosed() && !t.crashed);
|
|
1937
|
+
if (liveTabs.length === 0) {
|
|
1938
|
+
await this.close();
|
|
1939
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1940
|
+
}
|
|
1941
|
+
if (!this.activeTabId || !this.tabs.has(this.activeTabId)) {
|
|
1942
|
+
this.activeTabId = liveTabs[liveTabs.length - 1]!.id;
|
|
1943
|
+
}
|
|
1944
|
+
return this.captureLiveFrameUnlocked({ ensureStarted: false });
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1916
1948
|
private async captureLiveFrameUnlocked(options: { ensureStarted?: boolean | undefined } = {}): Promise<LiveBrowserFrame> {
|
|
1917
1949
|
const status = this.getRuntimeStatus();
|
|
1918
1950
|
if (!this.isSessionHealthy()) {
|