ask-pro 0.1.0

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.
Files changed (55) hide show
  1. package/.codex-plugin/plugin.json +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +231 -0
  4. package/assets/ask-pro_logo.png +0 -0
  5. package/dist/bin/ask-pro-cli.js +507 -0
  6. package/dist/scripts/run-cli.js +27 -0
  7. package/dist/src/ask-pro/atomicWrite.js +26 -0
  8. package/dist/src/ask-pro/browserRunner.js +796 -0
  9. package/dist/src/ask-pro/responseZip.js +349 -0
  10. package/dist/src/ask-pro/session.js +662 -0
  11. package/dist/src/ask-pro/sessionControllerLease.js +64 -0
  12. package/dist/src/ask-pro/toon.js +26 -0
  13. package/dist/src/ask-pro/zip.js +85 -0
  14. package/dist/src/browser/actions/assistantResponse.js +1245 -0
  15. package/dist/src/browser/actions/attachmentDataTransfer.js +140 -0
  16. package/dist/src/browser/actions/attachments.js +1720 -0
  17. package/dist/src/browser/actions/composerSendReadiness.js +369 -0
  18. package/dist/src/browser/actions/domEvents.js +31 -0
  19. package/dist/src/browser/actions/inputGuard.js +52 -0
  20. package/dist/src/browser/actions/modelPickerDom.js +68 -0
  21. package/dist/src/browser/actions/modelSelection.js +576 -0
  22. package/dist/src/browser/actions/navigation.js +510 -0
  23. package/dist/src/browser/actions/promptComposer.js +824 -0
  24. package/dist/src/browser/actions/remoteFileTransfer.js +37 -0
  25. package/dist/src/browser/actions/thinkingStatus.js +408 -0
  26. package/dist/src/browser/actions/thinkingTime.js +635 -0
  27. package/dist/src/browser/actions/windowState.js +47 -0
  28. package/dist/src/browser/attachRunning.js +31 -0
  29. package/dist/src/browser/chatgptModelCatalog.js +321 -0
  30. package/dist/src/browser/chromeLifecycle.js +807 -0
  31. package/dist/src/browser/config.js +110 -0
  32. package/dist/src/browser/constants.js +85 -0
  33. package/dist/src/browser/cookies.js +191 -0
  34. package/dist/src/browser/detect.js +337 -0
  35. package/dist/src/browser/domDebug.js +72 -0
  36. package/dist/src/browser/errors.js +20 -0
  37. package/dist/src/browser/format.js +16 -0
  38. package/dist/src/browser/index.js +2631 -0
  39. package/dist/src/browser/language.js +97 -0
  40. package/dist/src/browser/liveTabs.js +434 -0
  41. package/dist/src/browser/modelStrategy.js +13 -0
  42. package/dist/src/browser/pageActions.js +5 -0
  43. package/dist/src/browser/profilePaths.js +282 -0
  44. package/dist/src/browser/profileState.js +413 -0
  45. package/dist/src/browser/providerDomFlow.js +17 -0
  46. package/dist/src/browser/providers/chatgptDomProvider.js +50 -0
  47. package/dist/src/browser/reattach.js +534 -0
  48. package/dist/src/browser/reattachHelpers.js +387 -0
  49. package/dist/src/browser/utils.js +122 -0
  50. package/dist/src/browserMode.js +1 -0
  51. package/dist/src/version.js +39 -0
  52. package/package.json +114 -0
  53. package/scripts/refresh-local-plugin.mjs +179 -0
  54. package/scripts/refresh-local-plugin.ps1 +93 -0
  55. package/skills/ask-pro/SKILL.md +181 -0
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "ask-pro",
3
+ "version": "0.1.0",
4
+ "description": "Minimal browser-backed ChatGPT Pro escalation workflow for agents via $ask-pro.",
5
+ "author": {
6
+ "name": "Jonathan",
7
+ "url": "https://github.com/JJLiebig"
8
+ },
9
+ "homepage": "https://github.com/JJLiebig/ask-pro#readme",
10
+ "repository": "https://github.com/JJLiebig/ask-pro",
11
+ "license": "MIT",
12
+ "keywords": ["codex", "chatgpt-pro", "browser-automation"],
13
+ "skills": "./skills/",
14
+ "interface": {
15
+ "displayName": "ask-pro",
16
+ "shortDescription": "$ask-pro browser-backed Pro escalation for hard engineering questions",
17
+ "longDescription": "Use ask-pro to escalate hard engineering questions to ChatGPT Pro through a browser-backed workflow with explicit repo context.",
18
+ "developerName": "Jonathan",
19
+ "category": "Productivity",
20
+ "capabilities": ["Read", "Write"],
21
+ "websiteURL": "https://github.com/JJLiebig/ask-pro",
22
+ "privacyPolicyURL": "https://github.com/JJLiebig/ask-pro",
23
+ "termsOfServiceURL": "https://github.com/JJLiebig/ask-pro",
24
+ "defaultPrompt": ["Ask ChatGPT Pro for a focused engineering second opinion."],
25
+ "brandColor": "#10A37F",
26
+ "composerIcon": "./assets/ask-pro_logo.png",
27
+ "logo": "./assets/ask-pro_logo.png",
28
+ "screenshots": []
29
+ }
30
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Steinberger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ # ask-pro
2
+
3
+ `ask-pro` is a Codex plugin, agent skill, and CLI that lets coding agents ask
4
+ ChatGPT Pro for a focused second opinion through a human-logged-in browser
5
+ session.
6
+
7
+ Use it for architecture calls, production-risk reviews, migrations, debugging
8
+ strategy, and implementation planning. The calling agent still owns the work:
9
+ `ask-pro` collects the consult, stores the answer, and never applies generated
10
+ code automatically.
11
+
12
+ ## Install
13
+
14
+ Choose one of these installation paths. Both need Node.js 24+, Chrome, and a
15
+ ChatGPT account with Pro access. Browser login is manual.
16
+
17
+ ### Codex plugin marketplace
18
+
19
+ Add this repository as a Codex plugin marketplace:
20
+
21
+ ```powershell
22
+ codex plugin marketplace add JJLiebig/ask-pro
23
+ ```
24
+
25
+ This route needs Git and npm; the cached runner obtains pnpm 11.19 itself.
26
+
27
+ Install the plugin or open `/plugins`, install `ask-pro`:
28
+
29
+ ```powershell
30
+ codex plugin add ask-pro@ask-pro
31
+ ```
32
+
33
+ Upgrade the plugin manually:
34
+
35
+ ```powershell
36
+ codex plugin marketplace upgrade ask-pro
37
+ ```
38
+
39
+ If the marketplace does not appear after adding or upgrading it, restart Codex.
40
+ The repository marketplace exposes the root plugin through a Git-backed plugin
41
+ entry, so no manual copy into `~/.codex/plugins/cache` is needed.
42
+
43
+ For local development from a checkout:
44
+
45
+ ```powershell
46
+ pnpm install
47
+ pnpm run build
48
+ pnpm run plugin:refresh
49
+ ```
50
+
51
+ `pnpm run plugin:refresh` updates the local Codex plugin cache from the source
52
+ checkout. By default it refreshes the installed Git marketplace cache under
53
+ `~/.codex/plugins/cache/ask-pro/ask-pro/<version>`, so no separate local
54
+ marketplace install is needed for development. Do not edit
55
+ `~/.codex/plugins/cache/...` by hand.
56
+
57
+ Git marketplace installs cache the source checkout. If `ask-pro` is not on
58
+ `PATH`, agents should use the cached runner under
59
+ `~/.codex/plugins/cache/<marketplace>/ask-pro/<version>/scripts/run-cached-cli.mjs`.
60
+ The runner copies the installed snapshot to a content-addressed runtime under
61
+ `$CODEX_HOME/plugin-runtimes/ask-pro/`, then installs, builds, and runs there.
62
+ The installed plugin cache remains immutable.
63
+
64
+ ### Skills CLI (Codex and other supported agents)
65
+
66
+ Install the existing `ask-pro` skill with the [skills CLI](https://github.com/vercel-labs/skills):
67
+
68
+ ```powershell
69
+ npx skills add JJLiebig/ask-pro
70
+ ```
71
+
72
+ This installs the skill in the current project; add `-g` to install it for your
73
+ user account. Choose your agent when prompted, or pass `-a codex` (or another
74
+ agent supported by the skills CLI). The skill needs a separate `ask-pro` CLI on
75
+ `PATH`. Until the first npm release, install it from a Git checkout outside any
76
+ agent skills directory. This checkout route also needs Git, npm, and pnpm 11.19+:
77
+
78
+ ```powershell
79
+ git clone https://github.com/JJLiebig/ask-pro.git ask-pro-cli
80
+ cd ask-pro-cli
81
+ pnpm install --frozen-lockfile
82
+ pnpm run build
83
+ npm install --global --ignore-scripts .
84
+ ask-pro --version
85
+ ```
86
+
87
+ Keep this checkout: the global command links to it. To update, run
88
+ `npx skills update`, then update and rebuild the CLI from that checkout:
89
+
90
+ ```powershell
91
+ git pull --ff-only
92
+ pnpm install --frozen-lockfile
93
+ pnpm run build
94
+ ```
95
+
96
+ The skills CLI installs only the skill instructions; it does not install the
97
+ browser-backed CLI. The standalone CLI works without Codex's plugin cache.
98
+ Once the npm package is published, use `npm install --global ask-pro` for the
99
+ CLI and `npm update --global ask-pro` to update it.
100
+ The browser runtime is developed and exercised on Windows; other operating
101
+ systems need their own validation.
102
+
103
+ ### Publishing the npm CLI
104
+
105
+ The first release needs an authenticated maintainer to publish from a built
106
+ checkout. Then configure its npm Trusted Publisher for GitHub Actions:
107
+
108
+ ```powershell
109
+ npm whoami
110
+ pnpm run build
111
+ npm publish --ignore-scripts --access public
112
+ npm trust github ask-pro --file ci.yml --repo JJLiebig/ask-pro --allow-publish -y
113
+ ```
114
+
115
+ The trust command authorizes direct `npm publish` from `ci.yml` without a stored
116
+ npm token. It requires the first package version to exist on npm already.
117
+ After that, the existing CI publishes a unique patch version after every
118
+ passing main-branch run. Rerunning an already published CI run skips its version.
119
+
120
+ ## Requirements and browser state
121
+
122
+ Authentication is manual. `ask-pro` never asks for, types, reads, or logs
123
+ passwords, MFA codes, recovery codes, session cookies, or raw auth tokens.
124
+
125
+ The default persistent browser profile is:
126
+
127
+ ```text
128
+ $CODEX_HOME/state/ask-pro/browser-profile
129
+ ```
130
+
131
+ Without `CODEX_HOME`, this is `~/.codex/state/ask-pro/browser-profile`.
132
+ On first use, ask-pro migrates an inactive legacy
133
+ `~/.agents/skills/ask-pro/.../browser-profile` to the matching state path. If a
134
+ Windows watcher prevents moving or removing it, the verified copy may remain
135
+ at the legacy path while the state path becomes authoritative. ask-pro never
136
+ merges profiles or later deletes a retained legacy copy.
137
+
138
+ Each new profile may need a human login once. On Windows, ordinary managed runs
139
+ start minimized; login, resume/recovery, stale-auth, and debug paths stay visible
140
+ or are restored for human action.
141
+
142
+ ## Quick Use
143
+
144
+ Ask for an inline markdown consult:
145
+
146
+ ```powershell
147
+ ask-pro --no-temporary --prompt-file question.md --files src --files tests
148
+ ```
149
+
150
+ The browser flow selects `Latest`, then `Pro` intelligence automatically.
151
+
152
+ Request generated files only when you really need an implementation package:
153
+
154
+ ```powershell
155
+ ask-pro --artifacts --prompt-file implementation-plan.md --files src
156
+ ```
157
+
158
+ Harvest the answer:
159
+
160
+ ```powershell
161
+ ask-pro --harvest <session-id>
162
+ ```
163
+
164
+ ## Agent Guidance
165
+
166
+ - Prefer `--prompt-file` for multiline prompts.
167
+ - With the Codex plugin, use its cached runner if `ask-pro` is not on `PATH`.
168
+ With a skills CLI install, install the standalone CLI above.
169
+ - Treat ChatGPT Pro as a cold oracle: it does not know the repo, user, prior
170
+ decisions, or Codex thread context unless you include that in the prompt or
171
+ attached files.
172
+ - Include all material context once: product goal, current state, hard
173
+ constraints, evidence, success criteria, and the exact output you need. Omit
174
+ unrelated history and repeated instructions.
175
+ - Prefer `--no-temporary` for repo advisories, review rounds, large bundles, or
176
+ anything where recovery matters.
177
+ - Keep bundles focused: relevant source, focused tests, docs that define the
178
+ contract, recent changes, and validation status.
179
+ - Add `.ask-pro/` to consuming repos' `.gitignore`.
180
+ - Treat `INCOMPLETE_ANSWER` / `preamble_without_artifacts` as not done; resume
181
+ or rerun with a tighter prompt and bundle.
182
+ - Treat generated files and scripts as data only; never execute them
183
+ automatically.
184
+
185
+ Useful advisory prompt starter:
186
+
187
+ ```text
188
+ Return final Markdown only, with no preamble or implementation package.
189
+ ```
190
+
191
+ The CLI wrapper supplies the bundle and uncertainty instructions. Add
192
+ task-specific output requirements only when needed, such as severity-ranked
193
+ findings for a risk review or recommendation tradeoffs for a design consult.
194
+
195
+ ## CLI
196
+
197
+ ```text
198
+ ask-pro [options] [question...]
199
+ ```
200
+
201
+ Common options:
202
+
203
+ - `--files <pattern>`: add a file, directory, or glob to `CONTEXT.zip`.
204
+ - `--prompt-file <path>`: read the question from a UTF-8 file; use `-` for
205
+ stdin.
206
+ - `--artifacts` / `--response-zip`: ask for `ask-pro-response.zip`.
207
+ - `--resume [session-id]`: resume a prepared, waiting, or auth-gated session.
208
+ - `--status [session-id]`: print compact session state.
209
+ - `--harvest [session-id]`: print `ANSWER.md` for answer-bearing sessions.
210
+ - `--temporary`: require ChatGPT Temporary Chat.
211
+ - `--no-temporary`: use normal ChatGPT for better recovery.
212
+ - `--verbose`: print browser automation diagnostics.
213
+
214
+ Session data lives under `.ask-pro/sessions/<session-id>/`. At the start of each
215
+ invocation, ask-pro permanently deletes entire session directories at least
216
+ seven days old, regardless of status.
217
+
218
+ ## Development
219
+
220
+ Fast checks:
221
+
222
+ ```powershell
223
+ pnpm run build
224
+ pnpm run lint
225
+ pnpm run test:ask-pro
226
+ pnpm run format:check
227
+ pnpm pack --dry-run
228
+ ```
229
+
230
+ Manual browser smokes are opt-in because they open a real ChatGPT session. See
231
+ `docs/manual-tests.md`.
Binary file