summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/testing/prompt.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/testing/prompt.ts')
-rw-r--r--packages/app/src/testing/prompt.ts83
1 files changed, 0 insertions, 83 deletions
diff --git a/packages/app/src/testing/prompt.ts b/packages/app/src/testing/prompt.ts
deleted file mode 100644
index 5102ed825..000000000
--- a/packages/app/src/testing/prompt.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-import type { E2EWindow } from "./terminal"
-
-export type PromptProbeState = {
- popover: "at" | "slash" | null
- slash: {
- active: string | null
- ids: string[]
- }
- selected: string | null
- selects: number
-}
-
-export type PromptSendState = {
- started: number
- count: number
- sessionID?: string
- directory?: string
-}
-
-export const promptEnabled = () => {
- if (typeof window === "undefined") return false
- return (window as E2EWindow).__opencode_e2e?.prompt?.enabled === true
-}
-
-const root = () => {
- if (!promptEnabled()) return
- return (window as E2EWindow).__opencode_e2e?.prompt
-}
-
-export const promptProbe = {
- set(input: Omit<PromptProbeState, "selected" | "selects">) {
- const state = root()
- if (!state) return
- state.current = {
- popover: input.popover,
- slash: {
- active: input.slash.active,
- ids: [...input.slash.ids],
- },
- selected: state.current?.selected ?? null,
- selects: state.current?.selects ?? 0,
- }
- },
- select(id: string) {
- const state = root()
- if (!state) return
- const prev = state.current
- state.current = {
- popover: prev?.popover ?? null,
- slash: {
- active: prev?.slash.active ?? null,
- ids: [...(prev?.slash.ids ?? [])],
- },
- selected: id,
- selects: (prev?.selects ?? 0) + 1,
- }
- },
- clear() {
- const state = root()
- if (!state) return
- state.current = undefined
- },
- start() {
- const state = root()
- if (!state) return
- state.sent = {
- started: (state.sent?.started ?? 0) + 1,
- count: state.sent?.count ?? 0,
- sessionID: state.sent?.sessionID,
- directory: state.sent?.directory,
- }
- },
- submit(input: { sessionID: string; directory: string }) {
- const state = root()
- if (!state) return
- state.sent = {
- started: state.sent?.started ?? 0,
- count: (state.sent?.count ?? 0) + 1,
- sessionID: input.sessionID,
- directory: input.directory,
- }
- },
-}