@causyne/agent 1.20.112 → 1.20.116
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/ARCHITECTURE.md +29 -0
- package/package.json +1 -1
- package/src/agentLoop.js +72 -37
- package/src/agentLoop.ts +70 -38
- package/src/browser/browserRuntime.js +13 -8
- package/src/browser/browserRuntime.ts +16 -8
- package/src/browser/causyneBrowser.js +7 -2
- package/src/browser/causyneBrowser.ts +8 -2
- package/src/browser/searchProviders.js +18 -7
- package/src/browser/searchProviders.ts +17 -5
- package/src/browser/snapshotWindow.js +1 -1
- package/src/browser/snapshotWindow.ts +1 -1
- package/src/browser/urlPolicy.js +21 -10
- package/src/browser/urlPolicy.ts +19 -10
- package/src/browser/workspacePreview.js +13 -1
- package/src/browser/workspacePreview.ts +11 -1
- package/src/computerUse/visionGrounding.js +31 -27
- package/src/computerUse/visionGrounding.ts +27 -27
- package/src/continuum/ui/continuumPicker.js +14 -6
- package/src/continuum/ui/continuumPicker.ts +13 -6
- package/src/continuum/ui/continuumPickerView.js +24 -15
- package/src/continuum/ui/continuumPickerView.ts +24 -16
- package/src/observer/advisory.js +32 -22
- package/src/observer/advisory.ts +30 -18
- package/src/observer/coldObserver.js +21 -33
- package/src/observer/coldObserver.ts +20 -33
- package/src/observer/evidence.js +20 -13
- package/src/observer/evidence.ts +21 -13
- package/src/observer.js +47 -12
- package/src/observer.ts +50 -18
- package/src/pluginsFactory/discovery.js +28 -16
- package/src/pluginsFactory/discovery.ts +29 -16
- package/src/pluginsFactory/pluginsFactory.js +213 -38
- package/src/pluginsFactory/pluginsFactory.ts +218 -39
- package/src/pluginsFactory/strategy.js +26 -16
- package/src/pluginsFactory/strategy.ts +34 -19
- package/src/pluginsFactory/templates.js +183 -62
- package/src/pluginsFactory/templates.ts +174 -54
- package/src/timeMachine.js +43 -22
- package/src/timeMachine.ts +44 -22
- package/src/tool-scripts/desktop_act.applescript +1 -0
- package/src/tools/computerUse.js +23 -10
- package/src/tools/computerUse.ts +19 -8
- package/src/tools/desktopAct.js +12 -1
- package/src/tools/pluginsFactory.js +108 -5
- package/src/tools/pluginsFactory.ts +115 -5
- package/src/tui/CausyneRotor.js +24 -10
- package/src/tui/CausyneRotor.ts +25 -10
- package/src/tui/activityLayout.js +9 -5
- package/src/tui/activityLayout.ts +9 -5
- package/src/tui/ask.js +34 -14
- package/src/tui/banner.js +55 -18
- package/src/tui/banner.ts +52 -17
- package/src/tui/block.js +47 -20
- package/src/tui/block.ts +54 -27
- package/src/tui/chatRenderer.js +135 -83
- package/src/tui/chatboxClipboard.js +12 -5
- package/src/tui/chatboxClipboard.ts +10 -4
- package/src/tui/clipboardImage.js +52 -42
- package/src/tui/clipboardImage.ts +50 -39
- package/src/tui/clipboardSync.js +12 -1
- package/src/tui/clipboardSync.ts +9 -1
- package/src/tui/codeProgress.js +57 -26
- package/src/tui/codeProgress.ts +57 -25
- package/src/tui/codeStreamRenderer.js +59 -14
- package/src/tui/codeStreamRenderer.ts +58 -14
- package/src/tui/commandPresentation.js +9 -2
- package/src/tui/commandPresentation.ts +9 -2
- package/src/tui/completion.js +45 -23
- package/src/tui/composerControls.js +21 -10
- package/src/tui/composerControls.ts +18 -10
- package/src/tui/composerGeometry.js +6 -4
- package/src/tui/composerGeometry.ts +6 -4
- package/src/tui/consoleGuard.js +29 -7
- package/src/tui/consoleGuard.ts +28 -7
- package/src/tui/dialogs.js +134 -71
- package/src/tui/diff.js +8 -4
- package/src/tui/history.js +6 -5
- package/src/tui/home.js +25 -13
- package/src/tui/homeView.js +37 -18
- package/src/tui/homeView.ts +38 -18
- package/src/tui/inlineSlash.js +6 -5
- package/src/tui/inlineSlash.ts +6 -5
- package/src/tui/keys.js +33 -17
- package/src/tui/layout.js +27 -9
- package/src/tui/layout.ts +26 -9
- package/src/tui/lineEditor.js +49 -23
- package/src/tui/markdownMath.js +64 -14
- package/src/tui/markdownMath.ts +69 -13
- package/src/tui/messageActionPlacement.js +28 -13
- package/src/tui/messageActionPlacement.ts +28 -13
- package/src/tui/messageInteraction.js +111 -46
- package/src/tui/messageInteraction.ts +115 -47
- package/src/tui/modelPicker.js +44 -15
- package/src/tui/modelPicker.ts +48 -15
- package/src/tui/observerPicker.js +56 -13
- package/src/tui/observerPicker.ts +73 -30
- package/src/tui/overlay.js +79 -35
- package/src/tui/overlay.ts +81 -34
- package/src/tui/prompt.js +162 -94
- package/src/tui/runningLight.js +1 -1
- package/src/tui/runningLight.ts +1 -1
- package/src/tui/scrollInteraction.js +64 -36
- package/src/tui/scrollInteraction.ts +70 -37
- package/src/tui/selectList.js +60 -32
- package/src/tui/sessionLayout.js +11 -3
- package/src/tui/sessionLayout.ts +10 -3
- package/src/tui/sessionPicker.js +74 -46
- package/src/tui/sessionPicker.ts +73 -48
- package/src/tui/sessionPickerView.js +32 -19
- package/src/tui/sessionPickerView.ts +31 -18
- package/src/tui/sessionSidebar.js +87 -57
- package/src/tui/sessionSidebar.ts +90 -54
- package/src/tui/setup.js +28 -3
- package/src/tui/setup.ts +27 -3
- package/src/tui/skillAuthoring.js +11 -5
- package/src/tui/skillAuthoring.ts +11 -5
- package/src/tui/smartLinkClick.js +75 -23
- package/src/tui/smartLinkClick.ts +86 -26
- package/src/tui/stage.js +47 -16
- package/src/tui/stage.ts +53 -18
- package/src/tui/stageSurface.js +120 -49
- package/src/tui/statusLine.js +85 -53
- package/src/tui/statusLine.ts +82 -46
- package/src/tui/terminalInputFramer.js +5 -2
- package/src/tui/text.js +117 -46
- package/src/tui/text.ts +113 -43
- package/src/tui/textLayout.js +6 -4
- package/src/tui/textLayout.ts +11 -5
- package/src/tui/theme.js +17 -8
- package/src/tui/thinkingBox.js +95 -95
- package/src/tui/thinkingBox.ts +105 -80
- package/src/tui/toolActivityPolicy.js +8 -1
- package/src/tui/toolActivityPolicy.ts +7 -1
- package/src/tui/toolDisplay.js +15 -6
- package/src/tui/toolDisplay.ts +16 -6
- package/src/tui/toolOutputNormalizer.js +16 -3
- package/src/tui/toolOutputNormalizer.ts +13 -3
- package/src/tui/transcript.js +15 -9
- package/src/tui/turnRail.js +156 -67
- package/src/tui/turnRail.ts +155 -58
- package/src/tui/usageCard.js +80 -45
- package/src/tui/usageCard.ts +81 -46
- package/src/tui/viewport.js +48 -23
- package/src/tui/viewport.ts +48 -27
- package/src/tui/viewportAnchor.js +2 -2
- package/src/tui/viewportAnchor.ts +2 -2
- package/src/tui/workspaceFileIndex.js +8 -6
- package/src/tui/workspaceFileIndex.ts +8 -6
- package/src/tui/workspaceSwitch.js +13 -10
- package/src/tui/workspaceSwitch.ts +11 -7
package/src/tui/viewport.ts
CHANGED
|
@@ -57,9 +57,9 @@ export class ScrollAcceleration {
|
|
|
57
57
|
lastTick: number;
|
|
58
58
|
|
|
59
59
|
constructor({ history = 3, streakTimeout = 150, minTickInterval = 6 }: ScrollAccelerationOptions = {}) {
|
|
60
|
-
this.historySize = history;
|
|
61
|
-
this.streakTimeout = streakTimeout;
|
|
62
|
-
this.minTickInterval = minTickInterval;
|
|
60
|
+
this.historySize = Number.isFinite(history) ? Math.max(0, Math.floor(history)) : 3;
|
|
61
|
+
this.streakTimeout = Number.isFinite(streakTimeout) && streakTimeout >= 0 ? streakTimeout : 150;
|
|
62
|
+
this.minTickInterval = Number.isFinite(minTickInterval) && minTickInterval >= 0 ? minTickInterval : 6;
|
|
63
63
|
this.intervals = [];
|
|
64
64
|
this.lastTick = 0;
|
|
65
65
|
}
|
|
@@ -70,6 +70,7 @@ export class ScrollAcceleration {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
tick(now: number = Date.now()): number {
|
|
73
|
+
if (!Number.isFinite(now)) return 1;
|
|
73
74
|
const A = 0.8;
|
|
74
75
|
const tau = 3;
|
|
75
76
|
const maxMultiplier = 6;
|
|
@@ -80,11 +81,14 @@ export class ScrollAcceleration {
|
|
|
80
81
|
this.intervals = [];
|
|
81
82
|
return 1;
|
|
82
83
|
}
|
|
83
|
-
if (gap < this.minTickInterval) return 1;
|
|
84
|
+
if (gap < Math.max(0, this.minTickInterval)) return 1;
|
|
84
85
|
|
|
85
86
|
this.lastTick = now;
|
|
86
|
-
this.
|
|
87
|
-
|
|
87
|
+
if (this.historySize > 0) {
|
|
88
|
+
this.intervals.push(gap);
|
|
89
|
+
while (this.intervals.length > this.historySize) this.intervals.shift();
|
|
90
|
+
}
|
|
91
|
+
if (this.intervals.length === 0) return 1;
|
|
88
92
|
|
|
89
93
|
const average = this.intervals.reduce((sum, v) => sum + v, 0) / this.intervals.length;
|
|
90
94
|
const velocity = 100 / average;
|
|
@@ -146,17 +150,18 @@ export class Viewport {
|
|
|
146
150
|
lastWheelMoved: boolean;
|
|
147
151
|
lastWheelDirection: 'up' | 'down' | null;
|
|
148
152
|
|
|
149
|
-
constructor({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
constructor(options: ViewportOptions | null = {}) {
|
|
154
|
+
const {
|
|
155
|
+
transcript = null,
|
|
156
|
+
height = 20,
|
|
157
|
+
width = 80,
|
|
158
|
+
speed = DEFAULT_SCROLL_SPEED,
|
|
159
|
+
acceleration = null
|
|
160
|
+
} = options || {};
|
|
156
161
|
this.transcript = transcript;
|
|
157
|
-
this.viewHeight = Math.max(1, Math.floor(height));
|
|
158
|
-
this.viewWidth = Math.max(1, Math.floor(width));
|
|
159
|
-
this.speed = speed > 0 ? speed : DEFAULT_SCROLL_SPEED;
|
|
162
|
+
this.viewHeight = Number.isFinite(height) ? Math.max(1, Math.floor(height)) : 20;
|
|
163
|
+
this.viewWidth = Number.isFinite(width) ? Math.max(1, Math.floor(width)) : 80;
|
|
164
|
+
this.speed = Number.isFinite(speed) && speed > 0 ? speed : DEFAULT_SCROLL_SPEED;
|
|
160
165
|
this.acceleration = acceleration || null;
|
|
161
166
|
|
|
162
167
|
this.scrollTop = 0;
|
|
@@ -174,11 +179,12 @@ export class Viewport {
|
|
|
174
179
|
/**
|
|
175
180
|
* Geometry changed — a resize, or the input box growing under the viewport.
|
|
176
181
|
*/
|
|
177
|
-
resize(
|
|
182
|
+
resize(options: { height?: number; width?: number } | null = {}): void {
|
|
183
|
+
const { height, width } = options || {};
|
|
178
184
|
const nextHeight = height !== undefined && Number.isFinite(height) && height > 0
|
|
179
|
-
? Math.floor(height) : this.viewHeight;
|
|
185
|
+
? Math.max(1, Math.floor(height)) : this.viewHeight;
|
|
180
186
|
const nextWidth = width !== undefined && Number.isFinite(width) && width > 0
|
|
181
|
-
? Math.floor(width) : this.viewWidth;
|
|
187
|
+
? Math.max(1, Math.floor(width)) : this.viewWidth;
|
|
182
188
|
const reflow = nextWidth !== this.viewWidth;
|
|
183
189
|
const anchor = reflow && this.manual && this.transcript?.markers
|
|
184
190
|
? captureReadingAnchor(this.transcript.markers(this.viewWidth), this.scrollTop,
|
|
@@ -187,9 +193,10 @@ export class Viewport {
|
|
|
187
193
|
this.viewHeight = nextHeight;
|
|
188
194
|
this.viewWidth = nextWidth;
|
|
189
195
|
if (anchor && this.transcript?.markers) {
|
|
190
|
-
|
|
196
|
+
const restored = restoreReadingAnchor(anchor, this.transcript.markers(nextWidth),
|
|
191
197
|
this.transcript.height(nextWidth), nextHeight);
|
|
192
198
|
const max = this.maxScrollTop();
|
|
199
|
+
this.scrollTop = Number.isFinite(restored) ? Math.max(0, Math.min(max, Math.floor(restored))) : max;
|
|
193
200
|
// A deliberate scroll must not suddenly become follow-mode just because
|
|
194
201
|
// a paragraph gained or lost wrapped rows during resize.
|
|
195
202
|
this.manual = max > 0 && this.scrollTop < max;
|
|
@@ -200,7 +207,8 @@ export class Viewport {
|
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
contentHeight(): number {
|
|
203
|
-
|
|
210
|
+
const measured = this.transcript ? this.transcript.height(this.viewWidth) : 0;
|
|
211
|
+
return Number.isFinite(measured) ? Math.max(0, Math.floor(measured)) : 0;
|
|
204
212
|
}
|
|
205
213
|
|
|
206
214
|
maxScrollTop(): number {
|
|
@@ -240,29 +248,33 @@ export class Viewport {
|
|
|
240
248
|
* evicted. This is where auto-scroll actually happens.
|
|
241
249
|
*/
|
|
242
250
|
refresh(grownBy: number = 0): void {
|
|
251
|
+
const safeGrownBy = Number.isFinite(grownBy) && grownBy > 0 ? grownBy : 0;
|
|
243
252
|
const wasApplying = this.applyingSticky;
|
|
244
253
|
this.applyingSticky = true;
|
|
245
254
|
try {
|
|
246
255
|
const max = this.maxScrollTop();
|
|
247
|
-
const tolerance =
|
|
256
|
+
const tolerance = safeGrownBy > 0 ? REENGAGE_TOLERANCE : 0;
|
|
248
257
|
|
|
249
|
-
if (!this.manual) {
|
|
258
|
+
if (!this.manual || max <= 0) {
|
|
259
|
+
this.manual = false;
|
|
250
260
|
this.scrollTop = max;
|
|
251
261
|
this.unseen = 0;
|
|
252
|
-
} else if (
|
|
262
|
+
} else if (this.scrollTop >= max - tolerance) {
|
|
253
263
|
this.manual = false;
|
|
254
264
|
this.scrollTop = max;
|
|
255
265
|
this.unseen = 0;
|
|
256
266
|
} else {
|
|
257
267
|
this.scrollTop = Math.min(this.scrollTop, max);
|
|
258
|
-
if (
|
|
268
|
+
if (safeGrownBy > 0) this.unseen += safeGrownBy;
|
|
259
269
|
}
|
|
260
270
|
} finally {
|
|
261
271
|
this.applyingSticky = wasApplying;
|
|
262
272
|
}
|
|
263
273
|
}
|
|
264
274
|
|
|
265
|
-
scrollTo(position: number,
|
|
275
|
+
scrollTo(position: number, options: { snap?: boolean } | null = {}): number {
|
|
276
|
+
const { snap = false } = options || {};
|
|
277
|
+
if (!Number.isFinite(position)) return this.scrollTop;
|
|
266
278
|
const max = this.maxScrollTop();
|
|
267
279
|
let next = Math.max(0, Math.min(Math.round(position), max));
|
|
268
280
|
|
|
@@ -284,6 +296,10 @@ export class Viewport {
|
|
|
284
296
|
* quietly round to 1 or 2 forever.
|
|
285
297
|
*/
|
|
286
298
|
wheel(direction: 'up' | 'down', notches: number = 1, now: number = Date.now()): number {
|
|
299
|
+
if (!Number.isFinite(notches) || !Number.isFinite(now)) {
|
|
300
|
+
this.lastWheelMoved = false;
|
|
301
|
+
return this.scrollTop;
|
|
302
|
+
}
|
|
287
303
|
const before = this.scrollTop;
|
|
288
304
|
if (this.lastWheelDirection && this.lastWheelDirection !== direction) {
|
|
289
305
|
this.accumulator = 0;
|
|
@@ -292,6 +308,10 @@ export class Viewport {
|
|
|
292
308
|
|
|
293
309
|
const multiplier = this.acceleration ? this.acceleration.tick(now) : 1;
|
|
294
310
|
const amount = Math.abs(notches) * this.speed * multiplier;
|
|
311
|
+
if (!Number.isFinite(amount)) {
|
|
312
|
+
this.lastWheelMoved = false;
|
|
313
|
+
return this.scrollTop;
|
|
314
|
+
}
|
|
295
315
|
this.accumulator += direction === 'up' ? -amount : amount;
|
|
296
316
|
const whole = Math.trunc(this.accumulator);
|
|
297
317
|
if (whole !== 0) {
|
|
@@ -318,9 +338,10 @@ export class Viewport {
|
|
|
318
338
|
}
|
|
319
339
|
|
|
320
340
|
jump(direction: number, kinds: string[] | null = null): number {
|
|
341
|
+
if (!Number.isFinite(direction) || direction === 0) return this.scrollTop;
|
|
321
342
|
if (!this.transcript || typeof this.transcript.markers !== 'function') return this.scrollTop;
|
|
322
343
|
const markers = this.transcript.markers(this.viewWidth)
|
|
323
|
-
.filter((m) => !kinds || kinds.includes(m.kind));
|
|
344
|
+
.filter((m) => Boolean(m && Number.isFinite(m.row) && (!kinds || kinds.includes(m.kind))));
|
|
324
345
|
if (markers.length === 0) return this.scrollTop;
|
|
325
346
|
|
|
326
347
|
if (direction < 0) {
|
|
@@ -59,8 +59,8 @@ export function restoreReadingAnchor(anchor, markers, totalHeight, viewportHeigh
|
|
|
59
59
|
let selected = anchor.id == null
|
|
60
60
|
? -1
|
|
61
61
|
: entries.findIndex(marker => marker.id === anchor.id);
|
|
62
|
-
if (selected < 0 && anchor.id == null
|
|
63
|
-
selected = anchor.index;
|
|
62
|
+
if (selected < 0 && anchor.id == null) {
|
|
63
|
+
selected = entries.findIndex(marker => marker.originalIndex === anchor.index);
|
|
64
64
|
}
|
|
65
65
|
if (selected < 0) {
|
|
66
66
|
// When the anchored frame was evicted, recover in the surviving transcript.
|
|
@@ -86,8 +86,8 @@ export function restoreReadingAnchor(
|
|
|
86
86
|
let selected = anchor.id == null
|
|
87
87
|
? -1
|
|
88
88
|
: entries.findIndex(marker => marker.id === anchor.id);
|
|
89
|
-
if (selected < 0 && anchor.id == null
|
|
90
|
-
selected = anchor.index;
|
|
89
|
+
if (selected < 0 && anchor.id == null) {
|
|
90
|
+
selected = entries.findIndex(marker => marker.originalIndex === anchor.index);
|
|
91
91
|
}
|
|
92
92
|
if (selected < 0) {
|
|
93
93
|
// When the anchored frame was evicted, recover in the surviving transcript.
|
|
@@ -38,11 +38,13 @@ export class WorkspaceFileIndex {
|
|
|
38
38
|
maxDepth;
|
|
39
39
|
refreshMs;
|
|
40
40
|
constructor(root, options = {}) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
41
|
+
const safeRoot = typeof root === 'string' && root.length > 0 ? root : '.';
|
|
42
|
+
const safeOptions = options && typeof options === 'object' ? options : {};
|
|
43
|
+
this.root = path.resolve(safeRoot);
|
|
44
|
+
this.maxEntries = finiteInt(safeOptions.maxEntries, DEFAULT_MAX_ENTRIES);
|
|
45
|
+
this.maxDirs = finiteInt(safeOptions.maxDirs, DEFAULT_MAX_DIRS);
|
|
46
|
+
this.maxDepth = finiteInt(safeOptions.maxDepth, DEFAULT_MAX_DEPTH);
|
|
47
|
+
this.refreshMs = finiteInt(safeOptions.refreshMs, DEFAULT_REFRESH_MS, 0);
|
|
46
48
|
}
|
|
47
49
|
get isReady() { return this.entries !== null; }
|
|
48
50
|
get isBuilding() { return this.building !== null; }
|
|
@@ -108,7 +110,7 @@ export class WorkspaceFileIndex {
|
|
|
108
110
|
}
|
|
109
111
|
/** Contiguous matches take priority; fuzzy matching remains the JS fallback. */
|
|
110
112
|
candidates(query) {
|
|
111
|
-
if (!query)
|
|
113
|
+
if (typeof query !== 'string' || !query)
|
|
112
114
|
return this.entries ?? [];
|
|
113
115
|
const needle = query.toLocaleLowerCase();
|
|
114
116
|
const direct = this.indexed.filter(entry => entry.folded.includes(needle));
|
|
@@ -55,11 +55,13 @@ export class WorkspaceFileIndex {
|
|
|
55
55
|
private readonly refreshMs: number;
|
|
56
56
|
|
|
57
57
|
constructor(root: string, options: WorkspaceFileIndexOptions = {}) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
58
|
+
const safeRoot = typeof root === 'string' && root.length > 0 ? root : '.';
|
|
59
|
+
const safeOptions = options && typeof options === 'object' ? options : {};
|
|
60
|
+
this.root = path.resolve(safeRoot);
|
|
61
|
+
this.maxEntries = finiteInt(safeOptions.maxEntries, DEFAULT_MAX_ENTRIES);
|
|
62
|
+
this.maxDirs = finiteInt(safeOptions.maxDirs, DEFAULT_MAX_DIRS);
|
|
63
|
+
this.maxDepth = finiteInt(safeOptions.maxDepth, DEFAULT_MAX_DEPTH);
|
|
64
|
+
this.refreshMs = finiteInt(safeOptions.refreshMs, DEFAULT_REFRESH_MS, 0);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
get isReady(): boolean { return this.entries !== null; }
|
|
@@ -120,7 +122,7 @@ export class WorkspaceFileIndex {
|
|
|
120
122
|
|
|
121
123
|
/** Contiguous matches take priority; fuzzy matching remains the JS fallback. */
|
|
122
124
|
candidates(query: string): string[] {
|
|
123
|
-
if (!query) return this.entries ?? [];
|
|
125
|
+
if (typeof query !== 'string' || !query) return this.entries ?? [];
|
|
124
126
|
const needle = query.toLocaleLowerCase();
|
|
125
127
|
const direct = this.indexed.filter(entry => entry.folded.includes(needle));
|
|
126
128
|
return (direct.length > 0 ? direct.map(entry => entry.value) : this.entries ?? []);
|
|
@@ -26,7 +26,8 @@ export function switchChatWorkspace({ workspaceRoot, createLoop, prompt = null,
|
|
|
26
26
|
replacement.waitForApproval = approvalHandler;
|
|
27
27
|
replacement.waitForDecision = decisionHandler;
|
|
28
28
|
if (prompt) {
|
|
29
|
-
prompt.setWorkingRoot
|
|
29
|
+
if (typeof prompt.setWorkingRoot === 'function')
|
|
30
|
+
prompt.setWorkingRoot(workspaceRoot);
|
|
30
31
|
prompt.messageActionLoop = replacement;
|
|
31
32
|
// A workspace switch is also a change of task context. Do not transfer
|
|
32
33
|
// queued attachments or active skills from the previous workspace.
|
|
@@ -35,18 +36,20 @@ export function switchChatWorkspace({ workspaceRoot, createLoop, prompt = null,
|
|
|
35
36
|
if (typeof prompt.scheduleDraw === 'function')
|
|
36
37
|
prompt.scheduleDraw();
|
|
37
38
|
}
|
|
39
|
+
const workspaceLabel = replacement.sandbox?.grantAllAccess
|
|
40
|
+
? 'ALL ACCESS'
|
|
41
|
+
: (Array.isArray(replacement.sandbox?.workspacePaths) ? replacement.sandbox.workspacePaths.join(', ') : '');
|
|
38
42
|
if (headerInfo) {
|
|
39
43
|
headerInfo.cwd = workspaceRoot;
|
|
40
|
-
headerInfo.workspace =
|
|
41
|
-
|
|
42
|
-
: replacement.sandbox?.workspacePaths?.join(', ') ?? '';
|
|
43
|
-
if (renderer?.status?.setSession)
|
|
44
|
+
headerInfo.workspace = workspaceLabel;
|
|
45
|
+
if (typeof renderer?.status?.setSession === 'function')
|
|
44
46
|
renderer.status.setSession(headerInfo);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
}
|
|
48
|
+
if (typeof surface?.setSessionInfo === 'function') {
|
|
49
|
+
surface.setSessionInfo({
|
|
50
|
+
...(headerInfo || { cwd: workspaceRoot, workspace: workspaceLabel }),
|
|
51
|
+
activeSkill: null
|
|
52
|
+
});
|
|
50
53
|
}
|
|
51
54
|
return replacement;
|
|
52
55
|
}
|
|
@@ -54,7 +54,7 @@ export function switchChatWorkspace<TLoop extends {
|
|
|
54
54
|
replacement.waitForDecision = decisionHandler;
|
|
55
55
|
|
|
56
56
|
if (prompt) {
|
|
57
|
-
prompt.setWorkingRoot(workspaceRoot);
|
|
57
|
+
if (typeof prompt.setWorkingRoot === 'function') prompt.setWorkingRoot(workspaceRoot);
|
|
58
58
|
prompt.messageActionLoop = replacement;
|
|
59
59
|
// A workspace switch is also a change of task context. Do not transfer
|
|
60
60
|
// queued attachments or active skills from the previous workspace.
|
|
@@ -63,14 +63,18 @@ export function switchChatWorkspace<TLoop extends {
|
|
|
63
63
|
if (typeof prompt.scheduleDraw === 'function') prompt.scheduleDraw();
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
const workspaceLabel = replacement.sandbox?.grantAllAccess
|
|
67
|
+
? 'ALL ACCESS'
|
|
68
|
+
: (Array.isArray(replacement.sandbox?.workspacePaths) ? replacement.sandbox.workspacePaths.join(', ') : '');
|
|
69
|
+
|
|
66
70
|
if (headerInfo) {
|
|
67
71
|
headerInfo.cwd = workspaceRoot;
|
|
68
|
-
headerInfo.workspace =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
...headerInfo,
|
|
72
|
+
headerInfo.workspace = workspaceLabel;
|
|
73
|
+
if (typeof renderer?.status?.setSession === 'function') renderer.status.setSession(headerInfo);
|
|
74
|
+
}
|
|
75
|
+
if (typeof surface?.setSessionInfo === 'function') {
|
|
76
|
+
surface.setSessionInfo({
|
|
77
|
+
...(headerInfo || { cwd: workspaceRoot, workspace: workspaceLabel }),
|
|
74
78
|
activeSkill: null
|
|
75
79
|
});
|
|
76
80
|
}
|