codex-chatgpt-control 0.2.0-alpha.1 → 0.5.0-alpha.1
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/CHANGELOG.md +15 -0
- package/README.md +42 -2
- package/contracts/v1/fixtures/backend-capabilities.json +11 -0
- package/contracts/v1/fixtures/command-descriptors.json +289 -7
- package/contracts/v1/fixtures/describe-runner-run.json +5 -2
- package/contracts/v1/fixtures/doctor-scenario-preflight.json +45 -2
- package/contracts/v1/fixtures/help-root.json +1 -1
- package/contracts/v1/fixtures/output-json-parse-success.json +9 -0
- package/contracts/v1/fixtures/reports-create-redacted.json +1 -1
- package/contracts/v1/fixtures/run-timeout-partial.json +15 -4
- package/contracts/v1/fixtures/stream-in-progress.ndjson +3 -0
- package/contracts/v1/fixtures/stream-submitted-completed.ndjson +1 -1
- package/contracts/v1/fixtures/surface-chat-legacy.json +35 -0
- package/contracts/v1/fixtures/surface-chat-simplified.json +37 -0
- package/contracts/v1/fixtures/surface-sidebar-false-positive.json +29 -0
- package/contracts/v1/fixtures/surface-work-advanced.json +45 -0
- package/contracts/v1/fixtures/surface-work-basic.json +38 -0
- package/contracts/v1/fixtures/workflow-ask-success.json +8 -0
- package/contracts/v1/manifest.json +32 -1
- package/contracts/v1/parity-suite.json +121 -1
- package/contracts/v1/schemas/backend-request.schema.json +15 -0
- package/contracts/v1/schemas/manifest.schema.json +6 -3
- package/contracts/v1/schemas/surface-profile.schema.json +166 -0
- package/dist/codex-chatgpt-control-backend.mjs +3198 -340
- package/dist/codex-chatgpt-control.bundle.mjs +4454 -1555
- package/dist/src/backend/client.d.ts +26 -1
- package/dist/src/backend/client.js +23 -1
- package/dist/src/backend/protocol.d.ts +1 -1
- package/dist/src/backend/protocol.js +11 -0
- package/dist/src/backend/session.js +22 -0
- package/dist/src/browser/attach.d.ts +1 -0
- package/dist/src/browser/attach.js +3 -3
- package/dist/src/browser/clipboard.d.ts +11 -0
- package/dist/src/browser/clipboard.js +34 -7
- package/dist/src/browser/page-state.js +17 -4
- package/dist/src/client.d.ts +32 -1
- package/dist/src/client.js +72 -16
- package/dist/src/commands/artifacts.js +1 -7
- package/dist/src/commands/configuration.d.ts +15 -0
- package/dist/src/commands/configuration.js +674 -0
- package/dist/src/commands/context.js +3 -1
- package/dist/src/commands/conversation.d.ts +15 -0
- package/dist/src/commands/conversation.js +44 -0
- package/dist/src/commands/deadline.d.ts +8 -0
- package/dist/src/commands/deadline.js +14 -0
- package/dist/src/commands/doctor.js +47 -3
- package/dist/src/commands/experience.d.ts +12 -0
- package/dist/src/commands/experience.js +288 -0
- package/dist/src/commands/files.js +61 -13
- package/dist/src/commands/messages.d.ts +2 -1
- package/dist/src/commands/messages.js +349 -87
- package/dist/src/commands/modes.d.ts +4 -1
- package/dist/src/commands/modes.js +243 -44
- package/dist/src/commands/probes.d.ts +15 -0
- package/dist/src/commands/probes.js +64 -0
- package/dist/src/commands/registry.js +102 -8
- package/dist/src/commands/reports.js +1 -1
- package/dist/src/commands/response-actions.js +1 -7
- package/dist/src/commands/sequence.js +24 -1
- package/dist/src/commands/session.d.ts +2 -0
- package/dist/src/commands/session.js +50 -1
- package/dist/src/commands/threads.js +3 -31
- package/dist/src/commands/work.d.ts +6 -0
- package/dist/src/commands/work.js +338 -0
- package/dist/src/dom/generation-state.d.ts +7 -0
- package/dist/src/dom/generation-state.js +7 -1
- package/dist/src/dom/label-match.d.ts +3 -0
- package/dist/src/dom/label-match.js +25 -0
- package/dist/src/dom/locale/am.d.ts +8 -1
- package/dist/src/dom/locale/am.js +8 -1
- package/dist/src/dom/locale/ar.d.ts +9 -1
- package/dist/src/dom/locale/ar.js +9 -1
- package/dist/src/dom/locale/bg.d.ts +9 -1
- package/dist/src/dom/locale/bg.js +9 -1
- package/dist/src/dom/locale/bn.d.ts +9 -1
- package/dist/src/dom/locale/bn.js +9 -1
- package/dist/src/dom/locale/bs.d.ts +8 -1
- package/dist/src/dom/locale/bs.js +8 -1
- package/dist/src/dom/locale/ca.d.ts +8 -1
- package/dist/src/dom/locale/ca.js +8 -1
- package/dist/src/dom/locale/cs.d.ts +8 -1
- package/dist/src/dom/locale/cs.js +8 -1
- package/dist/src/dom/locale/da.d.ts +7 -1
- package/dist/src/dom/locale/da.js +7 -1
- package/dist/src/dom/locale/de.d.ts +10 -3
- package/dist/src/dom/locale/de.js +10 -3
- package/dist/src/dom/locale/el.d.ts +8 -1
- package/dist/src/dom/locale/el.js +8 -1
- package/dist/src/dom/locale/en.d.ts +40 -1
- package/dist/src/dom/locale/en.js +42 -1
- package/dist/src/dom/locale/es-419.d.ts +8 -1
- package/dist/src/dom/locale/es-419.js +8 -1
- package/dist/src/dom/locale/es-ES.d.ts +8 -1
- package/dist/src/dom/locale/es-ES.js +8 -1
- package/dist/src/dom/locale/et.d.ts +8 -1
- package/dist/src/dom/locale/et.js +8 -1
- package/dist/src/dom/locale/fa.d.ts +9 -1
- package/dist/src/dom/locale/fa.js +9 -1
- package/dist/src/dom/locale/fi.d.ts +8 -1
- package/dist/src/dom/locale/fi.js +8 -1
- package/dist/src/dom/locale/fr-CA.d.ts +8 -1
- package/dist/src/dom/locale/fr-CA.js +8 -1
- package/dist/src/dom/locale/fr-FR.d.ts +8 -3
- package/dist/src/dom/locale/fr-FR.js +8 -3
- package/dist/src/dom/locale/gu.d.ts +8 -1
- package/dist/src/dom/locale/gu.js +8 -1
- package/dist/src/dom/locale/hi.d.ts +8 -1
- package/dist/src/dom/locale/hi.js +8 -1
- package/dist/src/dom/locale/hr.d.ts +7 -1
- package/dist/src/dom/locale/hr.js +7 -1
- package/dist/src/dom/locale/hu.d.ts +8 -1
- package/dist/src/dom/locale/hu.js +8 -1
- package/dist/src/dom/locale/hy.d.ts +9 -1
- package/dist/src/dom/locale/hy.js +9 -1
- package/dist/src/dom/locale/id.d.ts +8 -1
- package/dist/src/dom/locale/id.js +8 -1
- package/dist/src/dom/locale/index.d.ts +20 -1
- package/dist/src/dom/locale/index.js +102 -0
- package/dist/src/dom/locale/is.d.ts +8 -1
- package/dist/src/dom/locale/is.js +8 -1
- package/dist/src/dom/locale/it.d.ts +8 -1
- package/dist/src/dom/locale/it.js +8 -1
- package/dist/src/dom/locale/ja.d.ts +8 -1
- package/dist/src/dom/locale/ja.js +8 -1
- package/dist/src/dom/locale/ka.d.ts +8 -1
- package/dist/src/dom/locale/ka.js +8 -1
- package/dist/src/dom/locale/kk.d.ts +8 -1
- package/dist/src/dom/locale/kk.js +8 -1
- package/dist/src/dom/locale/kn.d.ts +9 -1
- package/dist/src/dom/locale/kn.js +9 -1
- package/dist/src/dom/locale/ko.d.ts +8 -1
- package/dist/src/dom/locale/ko.js +8 -1
- package/dist/src/dom/locale/lt.d.ts +9 -1
- package/dist/src/dom/locale/lt.js +9 -1
- package/dist/src/dom/locale/lv.d.ts +8 -1
- package/dist/src/dom/locale/lv.js +8 -1
- package/dist/src/dom/locale/mk.d.ts +7 -1
- package/dist/src/dom/locale/mk.js +7 -1
- package/dist/src/dom/locale/ml.d.ts +9 -1
- package/dist/src/dom/locale/ml.js +9 -1
- package/dist/src/dom/locale/mn.d.ts +9 -1
- package/dist/src/dom/locale/mn.js +9 -1
- package/dist/src/dom/locale/mr.d.ts +9 -1
- package/dist/src/dom/locale/mr.js +9 -1
- package/dist/src/dom/locale/ms.d.ts +8 -1
- package/dist/src/dom/locale/ms.js +8 -1
- package/dist/src/dom/locale/my.d.ts +8 -1
- package/dist/src/dom/locale/my.js +8 -1
- package/dist/src/dom/locale/nb.d.ts +8 -1
- package/dist/src/dom/locale/nb.js +8 -1
- package/dist/src/dom/locale/nl.d.ts +8 -1
- package/dist/src/dom/locale/nl.js +8 -1
- package/dist/src/dom/locale/pa.d.ts +9 -1
- package/dist/src/dom/locale/pa.js +9 -1
- package/dist/src/dom/locale/pl.d.ts +8 -1
- package/dist/src/dom/locale/pl.js +8 -1
- package/dist/src/dom/locale/pt-BR.d.ts +8 -1
- package/dist/src/dom/locale/pt-BR.js +8 -1
- package/dist/src/dom/locale/pt-PT.d.ts +8 -1
- package/dist/src/dom/locale/pt-PT.js +8 -1
- package/dist/src/dom/locale/ro.d.ts +7 -1
- package/dist/src/dom/locale/ro.js +7 -1
- package/dist/src/dom/locale/ru.d.ts +5 -1
- package/dist/src/dom/locale/ru.js +5 -1
- package/dist/src/dom/locale/sk.d.ts +8 -1
- package/dist/src/dom/locale/sk.js +8 -1
- package/dist/src/dom/locale/sl.d.ts +8 -1
- package/dist/src/dom/locale/sl.js +8 -1
- package/dist/src/dom/locale/so.d.ts +8 -1
- package/dist/src/dom/locale/so.js +8 -1
- package/dist/src/dom/locale/sq.d.ts +8 -1
- package/dist/src/dom/locale/sq.js +8 -1
- package/dist/src/dom/locale/sr.d.ts +5 -1
- package/dist/src/dom/locale/sr.js +5 -1
- package/dist/src/dom/locale/sv.d.ts +8 -1
- package/dist/src/dom/locale/sv.js +8 -1
- package/dist/src/dom/locale/sw.d.ts +8 -1
- package/dist/src/dom/locale/sw.js +8 -1
- package/dist/src/dom/locale/ta.d.ts +9 -1
- package/dist/src/dom/locale/ta.js +9 -1
- package/dist/src/dom/locale/te.d.ts +9 -1
- package/dist/src/dom/locale/te.js +9 -1
- package/dist/src/dom/locale/th.d.ts +8 -1
- package/dist/src/dom/locale/th.js +8 -1
- package/dist/src/dom/locale/tl.d.ts +4 -5
- package/dist/src/dom/locale/tl.js +4 -5
- package/dist/src/dom/locale/tr.d.ts +8 -1
- package/dist/src/dom/locale/tr.js +8 -1
- package/dist/src/dom/locale/types.d.ts +25 -1
- package/dist/src/dom/locale/uk.d.ts +8 -1
- package/dist/src/dom/locale/uk.js +8 -1
- package/dist/src/dom/locale/ur.d.ts +8 -1
- package/dist/src/dom/locale/ur.js +8 -1
- package/dist/src/dom/locale/vi.d.ts +8 -1
- package/dist/src/dom/locale/vi.js +8 -1
- package/dist/src/dom/locale/zh-HK.d.ts +9 -1
- package/dist/src/dom/locale/zh-HK.js +10 -2
- package/dist/src/dom/locale/zh-Hans.d.ts +9 -1
- package/dist/src/dom/locale/zh-Hans.js +9 -1
- package/dist/src/dom/locale/zh-TW.d.ts +9 -1
- package/dist/src/dom/locale/zh-TW.js +9 -1
- package/dist/src/dom/menus.js +13 -2
- package/dist/src/dom/selectors.js +6 -1
- package/dist/src/dom/wait-snapshot.d.ts +43 -0
- package/dist/src/dom/wait-snapshot.js +127 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/runner/responses.d.ts +3 -1
- package/dist/src/runner/responses.js +16 -1
- package/dist/src/runner/result.js +129 -4
- package/dist/src/runner/stream.d.ts +1 -1
- package/dist/src/runner/stream.js +6 -0
- package/dist/src/runner/types.d.ts +35 -1
- package/dist/src/safety/risk.d.ts +11 -0
- package/dist/src/safety/risk.js +11 -0
- package/dist/src/scripts/apply-intelligence-locale-captures.d.ts +6 -0
- package/dist/src/scripts/apply-intelligence-locale-captures.js +147 -15
- package/dist/src/scripts/capture-intelligence-locales.d.ts +3 -0
- package/dist/src/scripts/capture-intelligence-locales.js +372 -3
- package/dist/src/scripts/capture-surface-profile.d.ts +23 -0
- package/dist/src/scripts/capture-surface-profile.js +304 -0
- package/dist/src/scripts/live-smoke/scenarios.js +34 -1
- package/dist/src/scripts/live-smoke.js +1 -0
- package/dist/src/types.d.ts +273 -2
- package/package.json +4 -3
- package/references/2026-07-16-chat-work-surfaces.md +87 -0
- package/references/agents-runner.md +13 -2
- package/references/backend-protocol.md +19 -7
- package/references/language-coverage.md +40 -3
- package/references/localization.md +48 -10
- package/references/python-parity.md +16 -4
- package/references/responses-adapter.md +12 -1
- package/references/troubleshooting.md +49 -6
|
@@ -8,8 +8,22 @@
|
|
|
8
8
|
* `tools` is keyed by logical tool id (stable API keys — callers pass `tool: "web_search"`).
|
|
9
9
|
* A locale only needs to list the tools whose display text differs from English.
|
|
10
10
|
*/
|
|
11
|
+
export type ModeOptionId = "latest" | "instant" | "thinking" | "extended" | "medium" | "high" | "extraHigh" | "pro";
|
|
12
|
+
export type ModeOptionLabels = Record<ModeOptionId, string | readonly string[]>;
|
|
13
|
+
export type ModeOptionContribution = Partial<ModeOptionLabels>;
|
|
14
|
+
export type ExperienceOptionId = "chat" | "work";
|
|
15
|
+
export type ExperienceOptionLabels = Record<ExperienceOptionId, string | readonly string[]>;
|
|
16
|
+
export type ExperienceOptionContribution = Partial<ExperienceOptionLabels>;
|
|
17
|
+
export type ConfigurationAxisLabelId = "model" | "intelligence" | "effort" | "speed" | "advanced";
|
|
18
|
+
export type ConfigurationAxisLabels = Record<ConfigurationAxisLabelId, string | readonly string[]>;
|
|
19
|
+
export type ConfigurationAxisContribution = Partial<ConfigurationAxisLabels>;
|
|
20
|
+
export type ConfigurationOptionId = "instant" | "light" | "medium" | "high" | "extraHigh" | "max" | "ultra" | "pro" | "standard" | "fast";
|
|
21
|
+
export type ConfigurationOptionLabels = Record<ConfigurationOptionId, string | readonly string[]>;
|
|
22
|
+
export type ConfigurationOptionContribution = Partial<ConfigurationOptionLabels>;
|
|
11
23
|
export type LocaleStrings = {
|
|
12
24
|
composerTextbox: string | readonly string[];
|
|
25
|
+
workComposerTextbox: string | readonly string[];
|
|
26
|
+
newWork: string | readonly string[];
|
|
13
27
|
sendButton: string | readonly string[];
|
|
14
28
|
searchChatsButton: string | readonly string[];
|
|
15
29
|
searchChatsPlaceholder: string | readonly string[];
|
|
@@ -25,7 +39,13 @@ export type LocaleStrings = {
|
|
|
25
39
|
downloadImage: string | readonly string[];
|
|
26
40
|
imageContainerHint: string | readonly string[];
|
|
27
41
|
modeLabels: string | readonly string[];
|
|
42
|
+
modeOptions: ModeOptionLabels;
|
|
28
43
|
modeOpenerExtra: string | readonly string[];
|
|
44
|
+
experienceOptions: ExperienceOptionLabels;
|
|
45
|
+
configurationAxes: ConfigurationAxisLabels;
|
|
46
|
+
configurationOptions: ConfigurationOptionLabels;
|
|
47
|
+
threadActionMenuItems: string | readonly string[];
|
|
48
|
+
threadActionPrefixes: string | readonly string[];
|
|
29
49
|
tools: Record<"web_search" | "deep_research" | "create_image", string | readonly string[]>;
|
|
30
50
|
signedInMarkers: string | readonly string[];
|
|
31
51
|
transientAssistant: string | readonly string[];
|
|
@@ -40,6 +60,10 @@ export type LocaleStrings = {
|
|
|
40
60
|
* The type for non-English locale files. Every key is optional so a contributor only
|
|
41
61
|
* needs to supply the strings that differ from English. `tools` is also partial.
|
|
42
62
|
*/
|
|
43
|
-
export type LocaleContribution = Partial<Omit<LocaleStrings, "tools">> & {
|
|
63
|
+
export type LocaleContribution = Partial<Omit<LocaleStrings, "tools" | "modeOptions" | "experienceOptions" | "configurationAxes" | "configurationOptions">> & {
|
|
64
|
+
modeOptions?: ModeOptionContribution;
|
|
65
|
+
experienceOptions?: ExperienceOptionContribution;
|
|
66
|
+
configurationAxes?: ConfigurationAxisContribution;
|
|
67
|
+
configurationOptions?: ConfigurationOptionContribution;
|
|
44
68
|
tools?: Partial<Record<"web_search" | "deep_research" | "create_image", string | readonly string[]>>;
|
|
45
69
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export declare const uk: {
|
|
10
10
|
composerTextbox: string[];
|
|
@@ -17,6 +17,12 @@ export declare const uk: {
|
|
|
17
17
|
addPhotosFilesMenuItem: string[];
|
|
18
18
|
copyResponse: string[];
|
|
19
19
|
modeLabels: string[];
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: string[];
|
|
22
|
+
medium: string[];
|
|
23
|
+
high: string[];
|
|
24
|
+
extraHigh: string[];
|
|
25
|
+
};
|
|
20
26
|
modeOpenerExtra: string[];
|
|
21
27
|
tools: {
|
|
22
28
|
web_search: string[];
|
|
@@ -25,4 +31,5 @@ export declare const uk: {
|
|
|
25
31
|
};
|
|
26
32
|
signedInMarkers: string[];
|
|
27
33
|
responseActions: string[];
|
|
34
|
+
stopControl: string[];
|
|
28
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export const uk = {
|
|
10
10
|
composerTextbox: ["Запитайте будь-що"],
|
|
@@ -17,6 +17,12 @@ export const uk = {
|
|
|
17
17
|
addPhotosFilesMenuItem: ["Додати світлини та файли"],
|
|
18
18
|
copyResponse: ["Копіювати відповідь"],
|
|
19
19
|
modeLabels: ["Миттєвий", "Середній", "Високий", "Дуже високий"],
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: ["Миттєвий"],
|
|
22
|
+
medium: ["Середній"],
|
|
23
|
+
high: ["Високий"],
|
|
24
|
+
extraHigh: ["Дуже високий"],
|
|
25
|
+
},
|
|
20
26
|
modeOpenerExtra: ["Налаштувати…"],
|
|
21
27
|
tools: {
|
|
22
28
|
web_search: ["Пошук в Інтернеті"],
|
|
@@ -25,4 +31,5 @@ export const uk = {
|
|
|
25
31
|
},
|
|
26
32
|
signedInMarkers: ["Новий чат", "Пошук чатів", "Нещодавні", "Історія чатів", "Проєкти", "Запитайте будь-що"],
|
|
27
33
|
responseActions: ["Копіювати відповідь"],
|
|
34
|
+
stopControl: ["Зупинити відповідь"],
|
|
28
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export declare const ur: {
|
|
10
10
|
composerTextbox: string[];
|
|
@@ -17,6 +17,12 @@ export declare const ur: {
|
|
|
17
17
|
addPhotosFilesMenuItem: string[];
|
|
18
18
|
copyResponse: string[];
|
|
19
19
|
modeLabels: string[];
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: string[];
|
|
22
|
+
medium: string[];
|
|
23
|
+
high: string[];
|
|
24
|
+
extraHigh: string[];
|
|
25
|
+
};
|
|
20
26
|
modeOpenerExtra: string[];
|
|
21
27
|
tools: {
|
|
22
28
|
web_search: string[];
|
|
@@ -25,4 +31,5 @@ export declare const ur: {
|
|
|
25
31
|
};
|
|
26
32
|
signedInMarkers: string[];
|
|
27
33
|
responseActions: string[];
|
|
34
|
+
stopControl: string[];
|
|
28
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export const ur = {
|
|
10
10
|
composerTextbox: ["کوئی بھی چیز پوچھیں۔۔۔"],
|
|
@@ -17,6 +17,12 @@ export const ur = {
|
|
|
17
17
|
addPhotosFilesMenuItem: ["تصویریں اور فائلیں شامل کریں"],
|
|
18
18
|
copyResponse: ["جواب کاپی کریں"],
|
|
19
19
|
modeLabels: ["فوری", "اوسط", "اعلیٰ", "انتہائی اعلیٰ"],
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: ["فوری"],
|
|
22
|
+
medium: ["اوسط"],
|
|
23
|
+
high: ["اعلیٰ"],
|
|
24
|
+
extraHigh: ["انتہائی اعلیٰ"],
|
|
25
|
+
},
|
|
20
26
|
modeOpenerExtra: ["کنفیگر کریں..."],
|
|
21
27
|
tools: {
|
|
22
28
|
web_search: ["ویب پر تلاش"],
|
|
@@ -25,4 +31,5 @@ export const ur = {
|
|
|
25
31
|
},
|
|
26
32
|
signedInMarkers: ["نئی چیٹ", "چیٹس تلاش کریں", "حالیہ", "چیٹ ہسٹری", "پراجیکٹس", "کوئی بھی چیز پوچھیں۔۔۔"],
|
|
27
33
|
responseActions: ["جواب کاپی کریں"],
|
|
34
|
+
stopControl: ["جواب روکیں"],
|
|
28
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export declare const vi: {
|
|
10
10
|
composerTextbox: string[];
|
|
@@ -17,6 +17,12 @@ export declare const vi: {
|
|
|
17
17
|
addPhotosFilesMenuItem: string[];
|
|
18
18
|
copyResponse: string[];
|
|
19
19
|
modeLabels: string[];
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: string[];
|
|
22
|
+
medium: string[];
|
|
23
|
+
high: string[];
|
|
24
|
+
extraHigh: string[];
|
|
25
|
+
};
|
|
20
26
|
modeOpenerExtra: string[];
|
|
21
27
|
tools: {
|
|
22
28
|
web_search: string[];
|
|
@@ -25,4 +31,5 @@ export declare const vi: {
|
|
|
25
31
|
};
|
|
26
32
|
signedInMarkers: string[];
|
|
27
33
|
responseActions: string[];
|
|
34
|
+
stopControl: string[];
|
|
28
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export const vi = {
|
|
10
10
|
composerTextbox: ["Trò chuyện với ChatGPT"],
|
|
@@ -17,6 +17,12 @@ export const vi = {
|
|
|
17
17
|
addPhotosFilesMenuItem: ["Thêm ảnh và tệp"],
|
|
18
18
|
copyResponse: ["Sao chép phản hồi"],
|
|
19
19
|
modeLabels: ["Tức thì", "Trung bình", "Cao", "Rất cao"],
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: ["Tức thì"],
|
|
22
|
+
medium: ["Trung bình"],
|
|
23
|
+
high: ["Cao"],
|
|
24
|
+
extraHigh: ["Rất cao"],
|
|
25
|
+
},
|
|
20
26
|
modeOpenerExtra: ["Định cấu hình"],
|
|
21
27
|
tools: {
|
|
22
28
|
web_search: ["Tìm kiếm trên mạng"],
|
|
@@ -25,4 +31,5 @@ export const vi = {
|
|
|
25
31
|
},
|
|
26
32
|
signedInMarkers: ["Đoạn chat mới", "Tìm kiếm đoạn chat", "Gần đây", "Thư viện", "Dự án", "Trò chuyện với ChatGPT"],
|
|
27
33
|
responseActions: ["Sao chép phản hồi"],
|
|
34
|
+
stopControl: ["Dừng trả lời"],
|
|
28
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export declare const zhHK: {
|
|
10
10
|
composerTextbox: string[];
|
|
@@ -17,6 +17,13 @@ export declare const zhHK: {
|
|
|
17
17
|
addPhotosFilesMenuItem: string[];
|
|
18
18
|
copyResponse: string[];
|
|
19
19
|
modeLabels: string[];
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: string[];
|
|
22
|
+
medium: string[];
|
|
23
|
+
high: string[];
|
|
24
|
+
extraHigh: string[];
|
|
25
|
+
pro: string[];
|
|
26
|
+
};
|
|
20
27
|
modeOpenerExtra: string[];
|
|
21
28
|
tools: {
|
|
22
29
|
web_search: string[];
|
|
@@ -25,4 +32,5 @@ export declare const zhHK: {
|
|
|
25
32
|
};
|
|
26
33
|
signedInMarkers: string[];
|
|
27
34
|
responseActions: string[];
|
|
35
|
+
stopControl: string[];
|
|
28
36
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export const zhHK = {
|
|
10
10
|
composerTextbox: ["與 ChatGPT 對話"],
|
|
@@ -16,7 +16,14 @@ export const zhHK = {
|
|
|
16
16
|
addFilesOpenerCandidates: ["上載檔案和其他内容"],
|
|
17
17
|
addPhotosFilesMenuItem: ["加入相片和檔案"],
|
|
18
18
|
copyResponse: ["複製回覆"],
|
|
19
|
-
modeLabels: ["即時", "均衡", "高", "極高", "專業"],
|
|
19
|
+
modeLabels: ["即時", "均衡", "高", "極高", "專業", "中等"],
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: ["即時"],
|
|
22
|
+
medium: ["均衡", "中等"],
|
|
23
|
+
high: ["高"],
|
|
24
|
+
extraHigh: ["極高"],
|
|
25
|
+
pro: ["專業"],
|
|
26
|
+
},
|
|
20
27
|
modeOpenerExtra: ["設定"],
|
|
21
28
|
tools: {
|
|
22
29
|
web_search: ["網絡搜尋"],
|
|
@@ -25,4 +32,5 @@ export const zhHK = {
|
|
|
25
32
|
},
|
|
26
33
|
signedInMarkers: ["新對話", "搜尋對話", "最近對話", "圖庫", "項目", "與 ChatGPT 對話"],
|
|
27
34
|
responseActions: ["複製回覆"],
|
|
35
|
+
stopControl: ["停止回應"],
|
|
28
36
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export declare const zhHans: {
|
|
10
10
|
composerTextbox: string[];
|
|
@@ -17,6 +17,13 @@ export declare const zhHans: {
|
|
|
17
17
|
addPhotosFilesMenuItem: string[];
|
|
18
18
|
copyResponse: string[];
|
|
19
19
|
modeLabels: string[];
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: string[];
|
|
22
|
+
medium: string[];
|
|
23
|
+
high: string[];
|
|
24
|
+
extraHigh: string[];
|
|
25
|
+
pro: string[];
|
|
26
|
+
};
|
|
20
27
|
modeOpenerExtra: string[];
|
|
21
28
|
tools: {
|
|
22
29
|
web_search: string[];
|
|
@@ -25,4 +32,5 @@ export declare const zhHans: {
|
|
|
25
32
|
};
|
|
26
33
|
signedInMarkers: string[];
|
|
27
34
|
responseActions: string[];
|
|
35
|
+
stopControl: string[];
|
|
28
36
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
6
6
|
*
|
|
7
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
7
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
8
8
|
*/
|
|
9
9
|
export const zhHans = {
|
|
10
10
|
composerTextbox: ["有问题,尽管问"],
|
|
@@ -17,6 +17,13 @@ export const zhHans = {
|
|
|
17
17
|
addPhotosFilesMenuItem: ["添加照片和文件"],
|
|
18
18
|
copyResponse: ["复制回复"],
|
|
19
19
|
modeLabels: ["极速", "均衡", "高级", "超高", "专业"],
|
|
20
|
+
modeOptions: {
|
|
21
|
+
instant: ["极速"],
|
|
22
|
+
medium: ["均衡"],
|
|
23
|
+
high: ["高级"],
|
|
24
|
+
extraHigh: ["超高"],
|
|
25
|
+
pro: ["专业"],
|
|
26
|
+
},
|
|
20
27
|
modeOpenerExtra: ["配置…"],
|
|
21
28
|
tools: {
|
|
22
29
|
web_search: ["网页搜索"],
|
|
@@ -25,4 +32,5 @@ export const zhHans = {
|
|
|
25
32
|
},
|
|
26
33
|
signedInMarkers: ["新聊天", "搜索聊天", "最近", "历史聊天记录", "项目", "有问题,尽管问"],
|
|
27
34
|
responseActions: ["复制回复"],
|
|
35
|
+
stopControl: ["停止回答"],
|
|
28
36
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
7
7
|
*
|
|
8
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
8
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
9
9
|
*/
|
|
10
10
|
export declare const zhTW: {
|
|
11
11
|
composerTextbox: string[];
|
|
@@ -18,6 +18,13 @@ export declare const zhTW: {
|
|
|
18
18
|
addPhotosFilesMenuItem: string[];
|
|
19
19
|
copyResponse: string[];
|
|
20
20
|
modeLabels: string[];
|
|
21
|
+
modeOptions: {
|
|
22
|
+
instant: string[];
|
|
23
|
+
medium: string[];
|
|
24
|
+
high: string[];
|
|
25
|
+
extraHigh: string[];
|
|
26
|
+
pro: string[];
|
|
27
|
+
};
|
|
21
28
|
modeOpenerExtra: string[];
|
|
22
29
|
tools: {
|
|
23
30
|
web_search: string[];
|
|
@@ -26,4 +33,5 @@ export declare const zhTW: {
|
|
|
26
33
|
};
|
|
27
34
|
signedInMarkers: string[];
|
|
28
35
|
responseActions: string[];
|
|
36
|
+
stopControl: string[];
|
|
29
37
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Some non-Intelligence surfaces may still fall back to English + `selector_drift`.
|
|
7
7
|
*
|
|
8
|
-
* Intelligence picker labels updated 2026-06-10 from
|
|
8
|
+
* Intelligence picker labels updated 2026-06-10 and stop-control labels updated 2026-06-15 from visible ChatGPT Pro sessions.
|
|
9
9
|
*/
|
|
10
10
|
export const zhTW = {
|
|
11
11
|
composerTextbox: ["與 ChatGPT 對話"],
|
|
@@ -18,6 +18,13 @@ export const zhTW = {
|
|
|
18
18
|
addPhotosFilesMenuItem: ["新增照片和檔案"],
|
|
19
19
|
copyResponse: ["複製回應"],
|
|
20
20
|
modeLabels: ["即時", "中等", "高", "超高", "專業"],
|
|
21
|
+
modeOptions: {
|
|
22
|
+
instant: ["即時"],
|
|
23
|
+
medium: ["中等"],
|
|
24
|
+
high: ["高"],
|
|
25
|
+
extraHigh: ["超高"],
|
|
26
|
+
pro: ["專業"],
|
|
27
|
+
},
|
|
21
28
|
modeOpenerExtra: ["設定"],
|
|
22
29
|
tools: {
|
|
23
30
|
web_search: ["網頁搜尋"],
|
|
@@ -26,4 +33,5 @@ export const zhTW = {
|
|
|
26
33
|
},
|
|
27
34
|
signedInMarkers: ["新對話", "搜尋對話", "最近的對話", "圖庫", "專案", "與 ChatGPT 對話"],
|
|
28
35
|
responseActions: ["複製回應"],
|
|
36
|
+
stopControl: ["停止回應"],
|
|
29
37
|
};
|
package/dist/src/dom/menus.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { visibleLabelMatches } from "./label-match.js";
|
|
1
2
|
import { normalizeLabel, normalizeWhitespace } from "./visible-text.js";
|
|
2
3
|
export function extractMenuItemsFromText(text) {
|
|
3
4
|
return text
|
|
@@ -36,7 +37,17 @@ export async function enumerateVisibleMenuItems(page) {
|
|
|
36
37
|
item.ariaLabel = ariaLabel;
|
|
37
38
|
return item;
|
|
38
39
|
};
|
|
39
|
-
const
|
|
40
|
+
const allRoleNodes = Array.from(document.querySelectorAll("[role='menuitem'], [role='menuitemradio'], [role='option']"));
|
|
41
|
+
// Scope to open menu containers when any exist, so stray role items elsewhere on
|
|
42
|
+
// the page (sidebar rows, decorative listboxes) cannot contaminate menu matching.
|
|
43
|
+
// An empty scoped set falls back to the unscoped list: real menus keep their items
|
|
44
|
+
// inside the container, so an empty intersection means the container heuristic failed.
|
|
45
|
+
const containers = Array.from(document.querySelectorAll("[role='menu'], [role='listbox'], [data-radix-popper-content-wrapper]"))
|
|
46
|
+
.filter(container => typeof container.contains === "function");
|
|
47
|
+
const scopedRoleNodes = containers.length > 0
|
|
48
|
+
? allRoleNodes.filter(node => containers.some(container => container.contains(node)))
|
|
49
|
+
: allRoleNodes;
|
|
50
|
+
const roleItems = (scopedRoleNodes.length > 0 ? scopedRoleNodes : allRoleNodes)
|
|
40
51
|
.map(toItem)
|
|
41
52
|
.filter(item => item.label.length > 0);
|
|
42
53
|
if (roleItems.length > 0) {
|
|
@@ -61,6 +72,6 @@ export function findUniqueMenuItem(items, wanted) {
|
|
|
61
72
|
if (exact.length === 1) {
|
|
62
73
|
return exact[0];
|
|
63
74
|
}
|
|
64
|
-
const fuzzy = items.filter(item => item.
|
|
75
|
+
const fuzzy = items.filter(item => visibleLabelMatches(item.label, wanted));
|
|
65
76
|
return fuzzy.length === 1 ? fuzzy[0] : undefined;
|
|
66
77
|
}
|
|
@@ -44,7 +44,12 @@ export function composerTextbox(page) {
|
|
|
44
44
|
if (typeof page.getByRole !== "function") {
|
|
45
45
|
return requiredLocator(page, "[contenteditable='true'], textarea");
|
|
46
46
|
}
|
|
47
|
-
return page.getByRole("textbox", {
|
|
47
|
+
return page.getByRole("textbox", {
|
|
48
|
+
name: anyLabelPattern([
|
|
49
|
+
...localeLabels.composerTextbox,
|
|
50
|
+
...localeLabels.workComposerTextbox
|
|
51
|
+
])
|
|
52
|
+
});
|
|
48
53
|
}
|
|
49
54
|
export function sendButton(page) {
|
|
50
55
|
if (typeof page.getByRole !== "function") {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { PageLike } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* One-evaluate DOM snapshot for the messages.wait polling loop.
|
|
4
|
+
*
|
|
5
|
+
* The previous loop ran four separate DOM probes per poll and transferred the entire
|
|
6
|
+
* latest assistant text across the browser bridge every iteration, even though the loop
|
|
7
|
+
* only needs change detection until completion. This snapshot returns fixed-size text
|
|
8
|
+
* metadata (normalized length + hash + transient flag) plus generation state and
|
|
9
|
+
* response-action evidence in a single round trip, sampled atomically from the same DOM
|
|
10
|
+
* instant. The full text is fetched once, at loop exit, by the caller.
|
|
11
|
+
*/
|
|
12
|
+
export type WaitDomSnapshot = {
|
|
13
|
+
turnCount: number;
|
|
14
|
+
assistantTurnCount: number;
|
|
15
|
+
latestAssistantTurnIndex?: number;
|
|
16
|
+
text: WaitTextMetadata;
|
|
17
|
+
generation: {
|
|
18
|
+
active: boolean;
|
|
19
|
+
stopped: boolean;
|
|
20
|
+
signals: string[];
|
|
21
|
+
};
|
|
22
|
+
/** undefined means no conversation-turn markers were found; callers fall back to the copy-button locator. */
|
|
23
|
+
hasResponseActions?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type WaitTextMetadata = {
|
|
26
|
+
/** Length of the whitespace-normalized latest assistant text. */
|
|
27
|
+
length: number;
|
|
28
|
+
/** FNV-1a 32-bit hash (hex) of the whitespace-normalized latest assistant text. */
|
|
29
|
+
hash: string;
|
|
30
|
+
/** Whether the text is a transient placeholder such as "Thinking". */
|
|
31
|
+
transient: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* SDK-side twin of the in-page metadata computation. The transient check delegates to
|
|
35
|
+
* dom/messages.ts isTransientAssistantText — the ground truth used by isResponseComplete —
|
|
36
|
+
* so only the in-page copy below is a true duplicate. The evaluate callback inlines the
|
|
37
|
+
* same normalization, hash, and transient rules because serialized callbacks cannot close
|
|
38
|
+
* over imports; `wait-snapshot.test.ts` pins the in-page copy to this helper (and thereby,
|
|
39
|
+
* transitively, to the ground truth).
|
|
40
|
+
*/
|
|
41
|
+
export declare function waitTextMetadata(rawText: string | undefined): WaitTextMetadata;
|
|
42
|
+
export declare function fnv1a32Hex(text: string): string;
|
|
43
|
+
export declare function readWaitDomSnapshot(page: PageLike): Promise<WaitDomSnapshot | undefined>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { localeLabels } from "./locale-labels.js";
|
|
2
|
+
import { isTransientAssistantText } from "./messages.js";
|
|
3
|
+
import { normalizeWhitespace } from "./visible-text.js";
|
|
4
|
+
/**
|
|
5
|
+
* SDK-side twin of the in-page metadata computation. The transient check delegates to
|
|
6
|
+
* dom/messages.ts isTransientAssistantText — the ground truth used by isResponseComplete —
|
|
7
|
+
* so only the in-page copy below is a true duplicate. The evaluate callback inlines the
|
|
8
|
+
* same normalization, hash, and transient rules because serialized callbacks cannot close
|
|
9
|
+
* over imports; `wait-snapshot.test.ts` pins the in-page copy to this helper (and thereby,
|
|
10
|
+
* transitively, to the ground truth).
|
|
11
|
+
*/
|
|
12
|
+
export function waitTextMetadata(rawText) {
|
|
13
|
+
const normalized = normalizeWhitespace(rawText ?? "");
|
|
14
|
+
return {
|
|
15
|
+
length: normalized.length,
|
|
16
|
+
hash: fnv1a32Hex(normalized),
|
|
17
|
+
transient: isTransientAssistantText(normalized)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function fnv1a32Hex(text) {
|
|
21
|
+
let hash = 0x811c9dc5;
|
|
22
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
23
|
+
hash ^= text.charCodeAt(index);
|
|
24
|
+
hash = Math.imul(hash, 0x01000193);
|
|
25
|
+
}
|
|
26
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27
|
+
}
|
|
28
|
+
export async function readWaitDomSnapshot(page) {
|
|
29
|
+
if (typeof page.evaluate !== "function") {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return page.evaluate((args) => {
|
|
33
|
+
const __combinedWaitSnapshot = true;
|
|
34
|
+
void __combinedWaitSnapshot;
|
|
35
|
+
const normalizeWs = (value) => value.replace(/\s+/g, " ").trim();
|
|
36
|
+
const normalizeLower = (value) => (value ?? "").trim().toLowerCase();
|
|
37
|
+
// --- Progress: turn counts and latest assistant text metadata (no text transfer) ---
|
|
38
|
+
const nodes = Array.from(document.querySelectorAll("[data-message-author-role]"));
|
|
39
|
+
const assistantNodes = nodes.filter(node => node.getAttribute("data-message-author-role") === "assistant");
|
|
40
|
+
const latestAssistant = assistantNodes.at(-1);
|
|
41
|
+
const latestAssistantTurnIndex = latestAssistant === undefined ? undefined : nodes.indexOf(latestAssistant) + 1;
|
|
42
|
+
const normalizedText = normalizeWs(latestAssistant?.innerText ?? latestAssistant?.textContent ?? "");
|
|
43
|
+
let hash = 0x811c9dc5;
|
|
44
|
+
for (let index = 0; index < normalizedText.length; index += 1) {
|
|
45
|
+
hash ^= normalizedText.charCodeAt(index);
|
|
46
|
+
hash = Math.imul(hash, 0x01000193);
|
|
47
|
+
}
|
|
48
|
+
const textHash = (hash >>> 0).toString(16).padStart(8, "0");
|
|
49
|
+
const trimmedForTransient = normalizedText.replace(/[.。…]+$/g, "").trim().toLowerCase();
|
|
50
|
+
const transient = args.transient.some(phrase => trimmedForTransient === phrase.toLowerCase())
|
|
51
|
+
|| /^analyzing (?:the )?images?$/.test(trimmedForTransient)
|
|
52
|
+
|| /^processing (?:the )?images?$/.test(trimmedForTransient)
|
|
53
|
+
|| /^reading (?:the )?images?$/.test(trimmedForTransient);
|
|
54
|
+
// --- Generation state: mirrors dom/generation-state.ts readAssistantGenerationState ---
|
|
55
|
+
const isVisible = (element) => {
|
|
56
|
+
const style = window.getComputedStyle(element);
|
|
57
|
+
return style.display !== "none"
|
|
58
|
+
&& style.visibility !== "hidden"
|
|
59
|
+
&& style.opacity !== "0"
|
|
60
|
+
&& element.getAttribute("aria-hidden") !== "true";
|
|
61
|
+
};
|
|
62
|
+
const visibleButtons = Array.from(document.querySelectorAll("button"))
|
|
63
|
+
.filter((button) => isVisible(button)
|
|
64
|
+
&& button.disabled !== true
|
|
65
|
+
&& button.getAttribute("aria-disabled") !== "true");
|
|
66
|
+
const buttonTexts = visibleButtons
|
|
67
|
+
.map(button => [
|
|
68
|
+
button.innerText,
|
|
69
|
+
button.textContent,
|
|
70
|
+
button.getAttribute("aria-label"),
|
|
71
|
+
button.getAttribute("title")
|
|
72
|
+
].map(normalizeLower).filter(Boolean).join(" "))
|
|
73
|
+
.filter(Boolean);
|
|
74
|
+
const bodyText = normalizeLower(document.body?.innerText);
|
|
75
|
+
const haystacks = [bodyText, ...buttonTexts];
|
|
76
|
+
const matchingSignals = (phrases) => haystacks.flatMap(text => phrases
|
|
77
|
+
.map(phrase => phrase.toLowerCase())
|
|
78
|
+
.filter(phrase => text.includes(phrase)));
|
|
79
|
+
const activeSignals = matchingSignals(args.stop);
|
|
80
|
+
const stoppedSignals = matchingSignals(args.stopped);
|
|
81
|
+
const generation = {
|
|
82
|
+
active: activeSignals.length > 0,
|
|
83
|
+
stopped: stoppedSignals.length > 0,
|
|
84
|
+
signals: [...new Set([...activeSignals, ...stoppedSignals, ...buttonTexts.filter(text => /stop|cancel|stopped|answering|thinking/i.test(text))])].slice(0, 5)
|
|
85
|
+
};
|
|
86
|
+
// --- Response actions: mirrors dom/generation-state.ts latestAssistantTurnHasResponseActions ---
|
|
87
|
+
const turns = Array.from(document.querySelectorAll("[data-testid^='conversation-turn']"));
|
|
88
|
+
let hasResponseActions;
|
|
89
|
+
if (turns.length === 0) {
|
|
90
|
+
hasResponseActions = undefined;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const latestTurn = [...turns].reverse().find(turn => turn.querySelector("[data-message-author-role='assistant']") !== null);
|
|
94
|
+
if (latestTurn === undefined) {
|
|
95
|
+
hasResponseActions = false;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const actionText = Array.from(latestTurn.querySelectorAll("button"))
|
|
99
|
+
.map(button => [
|
|
100
|
+
button.innerText,
|
|
101
|
+
button.textContent,
|
|
102
|
+
button.getAttribute("aria-label"),
|
|
103
|
+
button.getAttribute("title")
|
|
104
|
+
].filter(Boolean).join(" "))
|
|
105
|
+
.join(" ")
|
|
106
|
+
.toLowerCase();
|
|
107
|
+
hasResponseActions = args.actions.some(phrase => actionText.includes(phrase.toLowerCase()));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const snapshot = {
|
|
111
|
+
turnCount: nodes.length,
|
|
112
|
+
assistantTurnCount: assistantNodes.length,
|
|
113
|
+
text: { length: normalizedText.length, hash: textHash, transient },
|
|
114
|
+
generation
|
|
115
|
+
};
|
|
116
|
+
if (latestAssistantTurnIndex !== undefined)
|
|
117
|
+
snapshot.latestAssistantTurnIndex = latestAssistantTurnIndex;
|
|
118
|
+
if (hasResponseActions !== undefined)
|
|
119
|
+
snapshot.hasResponseActions = hasResponseActions;
|
|
120
|
+
return snapshot;
|
|
121
|
+
}, {
|
|
122
|
+
transient: [...localeLabels.transientAssistant],
|
|
123
|
+
stop: [...localeLabels.stopControl],
|
|
124
|
+
stopped: [...localeLabels.stoppedAssistant],
|
|
125
|
+
actions: [...localeLabels.responseActions]
|
|
126
|
+
});
|
|
127
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export * from "./commands/sequence.js";
|
|
|
23
23
|
export * from "./commands/files.js";
|
|
24
24
|
export * from "./commands/project-sources.js";
|
|
25
25
|
export * from "./commands/modes.js";
|
|
26
|
+
export * from "./commands/experience.js";
|
|
27
|
+
export * from "./commands/configuration.js";
|
|
28
|
+
export * from "./commands/work.js";
|
|
26
29
|
export * from "./commands/response-actions.js";
|
|
27
30
|
export * from "./commands/confirmations.js";
|
|
28
31
|
export * from "./commands/helpers.js";
|
package/dist/src/index.js
CHANGED
|
@@ -23,6 +23,9 @@ export * from "./commands/sequence.js";
|
|
|
23
23
|
export * from "./commands/files.js";
|
|
24
24
|
export * from "./commands/project-sources.js";
|
|
25
25
|
export * from "./commands/modes.js";
|
|
26
|
+
export * from "./commands/experience.js";
|
|
27
|
+
export * from "./commands/configuration.js";
|
|
28
|
+
export * from "./commands/work.js";
|
|
26
29
|
export * from "./commands/response-actions.js";
|
|
27
30
|
export * from "./commands/confirmations.js";
|
|
28
31
|
export * from "./commands/helpers.js";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { RunReportOptions } from "../commands/reports.js";
|
|
2
|
-
import type { BootstrapArgs, ResponseFormat } from "../types.js";
|
|
2
|
+
import type { BootstrapArgs, ChatGPTExperience, ConfigurationSelection, ResponseFormat } from "../types.js";
|
|
3
3
|
import type { ChatGPTAttachmentInput, ChatGPTInputItem, ChatGPTResponse, ChatGPTRunInput, ChatGPTRunResult, ChatGPTThreadSelector, ChatGPTVisibleModePreference, ChatGPTVisibleToolPreference, UnsupportedField } from "./types.js";
|
|
4
4
|
export type ChatGPTResponsesCreateArgs = {
|
|
5
5
|
input: string | ChatGPTInputItem[];
|
|
6
6
|
thread?: ChatGPTThreadSelector;
|
|
7
7
|
existingTab?: BootstrapArgs["existingTab"];
|
|
8
8
|
preferExistingTab?: boolean;
|
|
9
|
+
experience?: Exclude<ChatGPTExperience, "unknown">;
|
|
10
|
+
configuration?: ConfigurationSelection;
|
|
9
11
|
attachments?: ChatGPTAttachmentInput[];
|
|
10
12
|
mode?: ChatGPTVisibleModePreference;
|
|
11
13
|
tools?: ChatGPTVisibleToolPreference[];
|