Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(composer): prevent caret jumping to end during external state sync\n\nThe chat composer caret jumped to the document end whenever the Redux\nstore echoed back text the user had just typed. The subscriber callback\nin @assistant-ui/react-lexical's SyncPlugin was calling\napplyRuntimeText(runtimeText, void 0), which made parserOnly = false,\nwhich triggered root.selectEnd() on every store-sync cycle.\n\nPassing lastAppliedParserRef.current (instead of undefined) keeps\nparserOnly = true when the parser hasn't changed, suppressing the\nselectEnd() call and leaving the caret where the user placed it.\n\nApplied via pnpm patch. Removes test.fail() marker from the\ncaret-position Playwright spec (issue #5893).\n

shanu90e5b0b62bf6
diff --git a/app/patches/@[email protected] b/app/patches/@[email protected]
new file mode 100644
index 0000000000..53e92d8567
--- /dev/null
+++ b/app/patches/@[email protected]
@@ -0,0 +1,13 @@
+diff --git a/dist/plugins/SyncPlugin.js b/dist/plugins/SyncPlugin.js
+index 579658dba..ee276a8e9 100644
+--- a/dist/plugins/SyncPlugin.js
++++ b/dist/plugins/SyncPlugin.js
+@@ -371,7 +371,7 @@ function SyncPlugin({ formatter: propFormatter } = {}) {
+ if (isSyncingFromLexicalRef.current) return;
+ const runtimeText = composerRuntime.getState().text;
+ if (runtimeText === lastSyncedTextRef.current) return;
+- applyRuntimeText(runtimeText, void 0);
++ applyRuntimeText(runtimeText, lastAppliedParserRef.current);
+ });
+ }, [
+ editor,
diff --git a/app/test/playwright/specs/chat-composer-caret.spec.ts b/app/test/playwright/specs/chat-composer-caret.spec.ts
index 1caec50f8c..c4d5a5d919 100644
--- a/app/test/playwright/specs/chat-composer-caret.spec.ts
+++ b/app/test/playwright/specs/chat-composer-caret.spec.ts
@@ -181,8 +181,6 @@ test.describe('Chat composer — caret on mid-string edits', () => {
* "expected to fail but passed", and the marker has to be removed here.
*/
test('typing mid-string leaves the caret after the inserted character', async ({ page }) => {
- test.fail();
-
const input = await openChat(page);
await seed(page, input, 'hello world');
diff --git a/package.json b/package.json
index 9113f54aa8..5b47c8a668 100644
--- a/package.json
+++ b/package.json
@@ -76,5 +76,10 @@
},
"dependencies": {
"@tauri-apps/api": "2.11.1"
+ },
+ "pnpm": {
+ "patchedDependencies": {
+ "@assistant-ui/[email protected]": "app/patches/@[email protected]"
+ }
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e3d5827675..430cd29882 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -7,6 +7,11 @@ settings:
overrides:
'@tauri-apps/api': 2.11.1
+patchedDependencies:
+ '@assistant-ui/[email protected]':
+ hash: d57b1feffe8c1dbf9359c98eaa00a72f6fd7f92cc4686f1517e1e7b5b03f0054
+ path: app/patches/@[email protected]
+
importers:
.:
@@ -35,7 +40,7 @@ importers:
'@assistant-ui/react-lexical':
specifier: ^0.2.10
'@assistant-ui/react-markdown':
specifier: ^0.14.12
@@ -7205,7 +7210,7 @@ snapshots:
- ioredis
- redis
dependencies: