forked from pingdotgg/t3code
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: sync with upstream pingdotgg/t3code main #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1826fb5
feat(web): sweep sidebar buttons to settle, un-settle, and wake threa…
argofowl 7379933
feat: retry a failed workspace preparation (#15326)
juliusmarminge 8fb068c
fix(server): registry test stubs no longer outlive the test run (#15457)
yordis 60a56f1
test(server): the registry's fake Claude CLI is a fixture file, not a…
yordis 845ddd9
refactor(clients): share opening a machine's No project folder (#14759)
bmdavis419 070127c
test(server): the git-ssh wrapper's fake SSH script is a fixture file…
yordis 1508552
test(server): the ACP registry's fake npm is a fixture file, not a ge…
yordis f870c41
test(server): the ACP registry's fake uv is a fixture file, not a gen…
yordis c5a0c78
feat(clients): step a new thread to the next machine from the keyboar…
juliusmarminge d073c26
fix(web): promoting a draft thread no longer logs a React key warning…
yordis ee7b49d
test(server): the text generation's fake Claude CLI is a fixture file…
yordis bf5c146
fix(mobile): keep dictation running across navigation behind an edge …
juliusmarminge a92c43b
fix(client-runtime): relay disconnects no longer show as thread error…
juliusmarminge fad003a
Merge remote-tracking branch 'upstream/main' into yordis/chore-sync-u…
yordis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
apps/mobile/src/features/settings/scheduled-task-editor-state.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { EnvironmentId } from "@t3tools/contracts"; | ||
| import { afterEach, describe, expect, it } from "vite-plus/test"; | ||
|
|
||
| import { appAtomRegistry } from "../../state/atom-registry"; | ||
| import { createDraft } from "./scheduledTaskDraft"; | ||
| import { | ||
| readScheduledTaskEditor, | ||
| scheduledTaskEditorSessionAtom, | ||
| startScheduledTaskEditor, | ||
| updateScheduledTaskEditor, | ||
| } from "./scheduled-task-editor-state"; | ||
|
|
||
| afterEach(() => appAtomRegistry.set(scheduledTaskEditorSessionAtom, null)); | ||
|
|
||
| describe("scheduled task voice draft", () => { | ||
| const editor = { | ||
| environmentId: EnvironmentId.make("environment"), | ||
| environmentLabel: "Environment", | ||
| draft: createDraft(null, null), | ||
| }; | ||
|
|
||
| it("keeps the prompt outside the screen and retains its original change baseline", () => { | ||
| startScheduledTaskEditor(editor); | ||
| const original = appAtomRegistry.get(scheduledTaskEditorSessionAtom)!; | ||
| const ownerKey = `scheduled-task:${original.id}`; | ||
| updateScheduledTaskEditor( | ||
| (current) => | ||
| current && { | ||
| ...current, | ||
| draft: { ...current.draft, prompt: "spoken prompt" }, | ||
| }, | ||
| null, | ||
| ); | ||
|
|
||
| expect(readScheduledTaskEditor(ownerKey, null)?.draft.prompt).toBe("spoken prompt"); | ||
| expect(appAtomRegistry.get(scheduledTaskEditorSessionAtom)?.initial).toBe(editor); | ||
| }); | ||
|
|
||
| it("rejects an old voice target when another task opens in the same environment", () => { | ||
| startScheduledTaskEditor(editor); | ||
| const original = appAtomRegistry.get(scheduledTaskEditorSessionAtom)!; | ||
| startScheduledTaskEditor({ ...editor, draft: { ...editor.draft, prompt: "other task" } }); | ||
|
|
||
| expect(readScheduledTaskEditor(`scheduled-task:${original.id}`, editor)).toBeNull(); | ||
| expect(appAtomRegistry.get(scheduledTaskEditorSessionAtom)?.current?.draft.prompt).toBe( | ||
| "other task", | ||
| ); | ||
| }); | ||
|
|
||
| it("does not restore the default prompt after the editor is discarded", () => { | ||
| startScheduledTaskEditor(null); | ||
| const session = appAtomRegistry.get(scheduledTaskEditorSessionAtom)!; | ||
| expect(readScheduledTaskEditor(`scheduled-task:${session.id}`, editor)).toBeNull(); | ||
| updateScheduledTaskEditor((current) => current, editor); | ||
| expect(appAtomRegistry.get(scheduledTaskEditorSessionAtom)?.current).toBeNull(); | ||
| }); | ||
| }); |
55 changes: 55 additions & 0 deletions
55
apps/mobile/src/features/settings/scheduled-task-editor-state.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import type { EnvironmentId } from "@t3tools/contracts"; | ||
| import { Atom } from "effect/unstable/reactivity"; | ||
|
|
||
| import { appAtomRegistry } from "../../state/atom-registry"; | ||
| import type { ScheduledTaskDraft } from "./scheduledTaskDraft"; | ||
|
|
||
| export type ScheduledTaskEditor = { | ||
| readonly environmentId: EnvironmentId; | ||
| readonly environmentLabel: string; | ||
| readonly draft: ScheduledTaskDraft; | ||
| }; | ||
|
|
||
| type ScheduledTaskEditorSession = { | ||
| readonly id: number; | ||
| readonly initial: ScheduledTaskEditor | null; | ||
| readonly current: ScheduledTaskEditor | null; | ||
| }; | ||
|
|
||
| export const scheduledTaskEditorSessionAtom = Atom.make<ScheduledTaskEditorSession | null>( | ||
| null, | ||
| ).pipe(Atom.keepAlive); | ||
| let nextEditorId = 0; | ||
|
|
||
| export function startScheduledTaskEditor(next: ScheduledTaskEditor | null): void { | ||
| appAtomRegistry.set(scheduledTaskEditorSessionAtom, { | ||
| id: ++nextEditorId, | ||
| initial: next, | ||
| current: next, | ||
| }); | ||
| } | ||
|
|
||
| export function updateScheduledTaskEditor( | ||
| update: | ||
| | ScheduledTaskEditor | ||
| | null | ||
| | ((current: ScheduledTaskEditor | null) => ScheduledTaskEditor | null), | ||
| defaultEditor: ScheduledTaskEditor | null, | ||
| ): void { | ||
| const session = appAtomRegistry.get(scheduledTaskEditorSessionAtom); | ||
| const previous = session ? session.current : defaultEditor; | ||
| appAtomRegistry.set(scheduledTaskEditorSessionAtom, { | ||
| id: session?.id ?? 0, | ||
| initial: session ? session.initial : previous, | ||
| current: typeof update === "function" ? update(previous) : update, | ||
| }); | ||
| } | ||
|
|
||
| export function readScheduledTaskEditor( | ||
| voiceOwnerKey: string, | ||
| defaultEditor: ScheduledTaskEditor | null, | ||
| ): ScheduledTaskEditor | null { | ||
| const session = appAtomRegistry.get(scheduledTaskEditorSessionAtom); | ||
| if (`scheduled-task:${session?.id ?? 0}` !== voiceOwnerKey) return null; | ||
| return session ? session.current : defaultEditor; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dictation survives an invalid task target
Medium Severity
Changing the scheduled-task environment or starting a new editor session leaves the global dictation running against a target that
readDraftMessagenow treats as gone, so the mic stays on and the transcript is dropped. The controller no longer cancels whenownerKeychanges, andstartScheduledTaskEditoronly bumps the session id.Additional Locations (2)
apps/mobile/src/features/voice-input/useVoiceInputController.ts#L36-L44apps/mobile/src/features/settings/scheduled-task-editor-state.ts#L23-L30Reviewed by Cursor Bugbot for commit fad003a. Configure here.