expandai 0.0.1 → 0.0.3
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/README.md +42 -5
- package/build/dts/ApiClient.d.ts +128 -185
- package/build/dts/ApiClient.d.ts.map +1 -1
- package/build/dts/Auth/Domain.d.ts +95 -0
- package/build/dts/Auth/Domain.d.ts.map +1 -0
- package/build/dts/Auth/ManualAuthorization.d.ts +107 -0
- package/build/dts/Auth/ManualAuthorization.d.ts.map +1 -0
- package/build/dts/Auth/PendingInit.d.ts +35 -0
- package/build/dts/Auth/PendingInit.d.ts.map +1 -0
- package/build/dts/Auth/Pkce.d.ts +10 -0
- package/build/dts/Auth/Pkce.d.ts.map +1 -0
- package/build/dts/Auth/SetupGrantAuthorization.d.ts +34 -0
- package/build/dts/Auth/SetupGrantAuthorization.d.ts.map +1 -0
- package/build/dts/Authentication.d.ts +10 -9
- package/build/dts/Authentication.d.ts.map +1 -1
- package/build/dts/BrowserOAuth.d.ts +8 -8
- package/build/dts/BrowserOAuth.d.ts.map +1 -1
- package/build/dts/CommandPath.d.ts +2 -0
- package/build/dts/CommandPath.d.ts.map +1 -0
- package/build/dts/Commands/Fetch.d.ts.map +1 -1
- package/build/dts/Commands/Hook.d.ts +5 -5
- package/build/dts/Commands/Init.d.ts +55 -0
- package/build/dts/Commands/Init.d.ts.map +1 -0
- package/build/dts/Commands/Mcp.d.ts +6 -6
- package/build/dts/Commands/Search.d.ts.map +1 -1
- package/build/dts/Commands/Skill.d.ts +4 -4
- package/build/dts/Commands/Status.d.ts +27 -0
- package/build/dts/Commands/Status.d.ts.map +1 -0
- package/build/dts/Commands/Telemetry.d.ts +7 -0
- package/build/dts/Commands/Telemetry.d.ts.map +1 -0
- package/build/dts/Commands/Uninstall.d.ts +4 -4
- package/build/dts/Config.d.ts +106 -15
- package/build/dts/Config.d.ts.map +1 -1
- package/build/dts/Hook/SnapshotNote.d.ts +8 -4
- package/build/dts/Hook/SnapshotNote.d.ts.map +1 -1
- package/build/dts/Init/ClaudeAdapter.d.ts +61 -0
- package/build/dts/Init/ClaudeAdapter.d.ts.map +1 -0
- package/build/dts/Init/ClaudeProfile.d.ts +78 -0
- package/build/dts/Init/ClaudeProfile.d.ts.map +1 -0
- package/build/dts/Init/Domain.d.ts +139 -0
- package/build/dts/Init/Domain.d.ts.map +1 -0
- package/build/dts/Init/HarnessAdapter.d.ts +33 -0
- package/build/dts/Init/HarnessAdapter.d.ts.map +1 -0
- package/build/dts/Init/HarnessDetector.d.ts +19 -0
- package/build/dts/Init/HarnessDetector.d.ts.map +1 -0
- package/build/dts/Init/HarnessRegistry.d.ts +50 -0
- package/build/dts/Init/HarnessRegistry.d.ts.map +1 -0
- package/build/dts/Init/MutationTransaction.d.ts +96 -0
- package/build/dts/Init/MutationTransaction.d.ts.map +1 -0
- package/build/dts/Init/Service.d.ts +72 -0
- package/build/dts/Init/Service.d.ts.map +1 -0
- package/build/dts/Init/StandardAdapters.d.ts +42 -0
- package/build/dts/Init/StandardAdapters.d.ts.map +1 -0
- package/build/dts/Init/Status.d.ts +149 -0
- package/build/dts/Init/Status.d.ts.map +1 -0
- package/build/dts/Install/Claude/Hook.d.ts +85 -25
- package/build/dts/Install/Claude/Hook.d.ts.map +1 -1
- package/build/dts/Install/Claude/Mcp.d.ts +21 -18
- package/build/dts/Install/Claude/Mcp.d.ts.map +1 -1
- package/build/dts/Install/Claude/Skill.d.ts +14 -15
- package/build/dts/Install/Claude/Skill.d.ts.map +1 -1
- package/build/dts/Install/Codex/Mcp.d.ts +14 -8
- package/build/dts/Install/Codex/Mcp.d.ts.map +1 -1
- package/build/dts/Install/Codex/Skill.d.ts +4 -2
- package/build/dts/Install/Codex/Skill.d.ts.map +1 -1
- package/build/dts/Install/Cursor/Mcp.d.ts +13 -13
- package/build/dts/Install/Cursor/Mcp.d.ts.map +1 -1
- package/build/dts/Install/Cursor/Skill.d.ts +4 -2
- package/build/dts/Install/Cursor/Skill.d.ts.map +1 -1
- package/build/dts/Install/Domain.d.ts +35 -5
- package/build/dts/Install/Domain.d.ts.map +1 -1
- package/build/dts/Install/Hook.d.ts +4 -4
- package/build/dts/Install/Hook.d.ts.map +1 -1
- package/build/dts/Install/Mcp.d.ts +5 -5
- package/build/dts/Install/Mcp.d.ts.map +1 -1
- package/build/dts/Install/Opencode/Hook.d.ts +4 -3
- package/build/dts/Install/Opencode/Hook.d.ts.map +1 -1
- package/build/dts/Install/Opencode/Mcp.d.ts +11 -11
- package/build/dts/Install/Opencode/Mcp.d.ts.map +1 -1
- package/build/dts/Install/Opencode/Skill.d.ts +4 -2
- package/build/dts/Install/Opencode/Skill.d.ts.map +1 -1
- package/build/dts/Install/Skill.d.ts +3 -3
- package/build/dts/Install/Uninstall.d.ts +6 -6
- package/build/dts/Install/Uninstall.d.ts.map +1 -1
- package/build/dts/MarkdownAnsi.d.ts +29 -0
- package/build/dts/MarkdownAnsi.d.ts.map +1 -0
- package/build/dts/Mcp/ExpandDocs.d.ts +17 -5
- package/build/dts/Mcp/ExpandDocs.d.ts.map +1 -1
- package/build/dts/Mcp/Server.d.ts +1 -1
- package/build/dts/Mcp/Server.d.ts.map +1 -1
- package/build/dts/Mcp/tools/Citations.d.ts +105 -77
- package/build/dts/Mcp/tools/Citations.d.ts.map +1 -1
- package/build/dts/Mcp/tools/Fetch.d.ts +16 -15
- package/build/dts/Mcp/tools/Fetch.d.ts.map +1 -1
- package/build/dts/SecureFile.d.ts +23 -0
- package/build/dts/SecureFile.d.ts.map +1 -0
- package/build/dts/Snippets.d.ts +11 -12
- package/build/dts/Snippets.d.ts.map +1 -1
- package/build/dts/Telemetry.d.ts +30 -0
- package/build/dts/Telemetry.d.ts.map +1 -0
- package/build/dts/Version.d.ts +2 -0
- package/build/dts/Version.d.ts.map +1 -0
- package/build/dts/Xdg.d.ts +11 -0
- package/build/dts/Xdg.d.ts.map +1 -0
- package/build/esm/ApiClient.js +133 -10
- package/build/esm/ApiClient.js.map +1 -1
- package/build/esm/Auth/Domain.js +56 -0
- package/build/esm/Auth/Domain.js.map +1 -0
- package/build/esm/Auth/ManualAuthorization.js +253 -0
- package/build/esm/Auth/ManualAuthorization.js.map +1 -0
- package/build/esm/Auth/PendingInit.js +267 -0
- package/build/esm/Auth/PendingInit.js.map +1 -0
- package/build/esm/Auth/Pkce.js +23 -0
- package/build/esm/Auth/Pkce.js.map +1 -0
- package/build/esm/Auth/SetupGrantAuthorization.js +91 -0
- package/build/esm/Auth/SetupGrantAuthorization.js.map +1 -0
- package/build/esm/Authentication.js +38 -7
- package/build/esm/Authentication.js.map +1 -1
- package/build/esm/BrowserOAuth.js +7 -10
- package/build/esm/BrowserOAuth.js.map +1 -1
- package/build/esm/CommandPath.js +31 -0
- package/build/esm/CommandPath.js.map +1 -0
- package/build/esm/Commands/Fetch.js +30 -6
- package/build/esm/Commands/Fetch.js.map +1 -1
- package/build/esm/Commands/Init.js +371 -0
- package/build/esm/Commands/Init.js.map +1 -0
- package/build/esm/Commands/Search.js +6 -3
- package/build/esm/Commands/Search.js.map +1 -1
- package/build/esm/Commands/Status.js +186 -0
- package/build/esm/Commands/Status.js.map +1 -0
- package/build/esm/Commands/Telemetry.js +23 -0
- package/build/esm/Commands/Telemetry.js.map +1 -0
- package/build/esm/Config.js +502 -28
- package/build/esm/Config.js.map +1 -1
- package/build/esm/Hook/Claude.js +1 -1
- package/build/esm/Hook/Claude.js.map +1 -1
- package/build/esm/Hook/SnapshotNote.js +54 -7
- package/build/esm/Hook/SnapshotNote.js.map +1 -1
- package/build/esm/Init/ClaudeAdapter.js +137 -0
- package/build/esm/Init/ClaudeAdapter.js.map +1 -0
- package/build/esm/Init/ClaudeProfile.js +380 -0
- package/build/esm/Init/ClaudeProfile.js.map +1 -0
- package/build/esm/Init/Domain.js +118 -0
- package/build/esm/Init/Domain.js.map +1 -0
- package/build/esm/Init/HarnessAdapter.js +21 -0
- package/build/esm/Init/HarnessAdapter.js.map +1 -0
- package/build/esm/Init/HarnessDetector.js +65 -0
- package/build/esm/Init/HarnessDetector.js.map +1 -0
- package/build/esm/Init/HarnessRegistry.js +58 -0
- package/build/esm/Init/HarnessRegistry.js.map +1 -0
- package/build/esm/Init/MutationTransaction.js +494 -0
- package/build/esm/Init/MutationTransaction.js.map +1 -0
- package/build/esm/Init/Service.js +319 -0
- package/build/esm/Init/Service.js.map +1 -0
- package/build/esm/Init/StandardAdapters.js +116 -0
- package/build/esm/Init/StandardAdapters.js.map +1 -0
- package/build/esm/Init/Status.js +215 -0
- package/build/esm/Init/Status.js.map +1 -0
- package/build/esm/Install/Claude/Hook.js +182 -50
- package/build/esm/Install/Claude/Hook.js.map +1 -1
- package/build/esm/Install/Claude/Mcp.js +56 -26
- package/build/esm/Install/Claude/Mcp.js.map +1 -1
- package/build/esm/Install/Claude/Skill.js +49 -27
- package/build/esm/Install/Claude/Skill.js.map +1 -1
- package/build/esm/Install/Codex/Mcp.js +9 -4
- package/build/esm/Install/Codex/Mcp.js.map +1 -1
- package/build/esm/Install/Codex/Skill.js +4 -1
- package/build/esm/Install/Codex/Skill.js.map +1 -1
- package/build/esm/Install/Cursor/Mcp.js +7 -4
- package/build/esm/Install/Cursor/Mcp.js.map +1 -1
- package/build/esm/Install/Cursor/Skill.js +4 -1
- package/build/esm/Install/Cursor/Skill.js.map +1 -1
- package/build/esm/Install/Domain.js +60 -3
- package/build/esm/Install/Domain.js.map +1 -1
- package/build/esm/Install/Hook.js.map +1 -1
- package/build/esm/Install/Mcp.js +1 -1
- package/build/esm/Install/Mcp.js.map +1 -1
- package/build/esm/Install/Opencode/Hook.js +1 -1
- package/build/esm/Install/Opencode/Hook.js.map +1 -1
- package/build/esm/Install/Opencode/Mcp.js +6 -3
- package/build/esm/Install/Opencode/Mcp.js.map +1 -1
- package/build/esm/Install/Opencode/Skill.js +4 -1
- package/build/esm/Install/Opencode/Skill.js.map +1 -1
- package/build/esm/Install/Opencode/expandai-webfetch.js +27 -9
- package/build/esm/Install/Skill.js.map +1 -1
- package/build/esm/Install/Uninstall.js +2 -2
- package/build/esm/Install/Uninstall.js.map +1 -1
- package/build/esm/MarkdownAnsi.js +142 -0
- package/build/esm/MarkdownAnsi.js.map +1 -0
- package/build/esm/Mcp/ExpandDocs.js +44 -52
- package/build/esm/Mcp/ExpandDocs.js.map +1 -1
- package/build/esm/Mcp/RequestHeaders.js.map +1 -1
- package/build/esm/Mcp/Server.js +2 -1
- package/build/esm/Mcp/Server.js.map +1 -1
- package/build/esm/Mcp/tools/Citations.js +109 -8
- package/build/esm/Mcp/tools/Citations.js.map +1 -1
- package/build/esm/Mcp/tools/Fetch.js +36 -12
- package/build/esm/Mcp/tools/Fetch.js.map +1 -1
- package/build/esm/SecureFile.js +36 -0
- package/build/esm/SecureFile.js.map +1 -0
- package/build/esm/Snippets.js +12 -1
- package/build/esm/Snippets.js.map +1 -1
- package/build/esm/Telemetry.js +157 -0
- package/build/esm/Telemetry.js.map +1 -0
- package/build/esm/Version.js +4 -0
- package/build/esm/Version.js.map +1 -0
- package/build/esm/Xdg.js +15 -0
- package/build/esm/Xdg.js.map +1 -0
- package/build/esm/main.js +122 -14
- package/build/esm/main.js.map +1 -1
- package/build/skills/expandai/SKILL.md +26 -3
- package/package.json +7 -4
- package/src/ApiClient.ts +206 -13
- package/src/Auth/Domain.ts +63 -0
- package/src/Auth/ManualAuthorization.ts +296 -0
- package/src/Auth/PendingInit.ts +338 -0
- package/src/Auth/Pkce.ts +26 -0
- package/src/Auth/SetupGrantAuthorization.ts +116 -0
- package/src/Authentication.ts +49 -11
- package/src/BrowserOAuth.ts +10 -12
- package/src/CommandPath.ts +30 -0
- package/src/Commands/Fetch.ts +42 -11
- package/src/Commands/Init.ts +489 -0
- package/src/Commands/Search.ts +8 -3
- package/src/Commands/Status.ts +228 -0
- package/src/Commands/Telemetry.ts +42 -0
- package/src/Config.ts +695 -50
- package/src/Hook/Claude.ts +1 -1
- package/src/Hook/SnapshotNote.ts +55 -7
- package/src/Init/ClaudeAdapter.ts +191 -0
- package/src/Init/ClaudeProfile.ts +496 -0
- package/src/Init/Domain.ts +153 -0
- package/src/Init/HarnessAdapter.ts +35 -0
- package/src/Init/HarnessDetector.ts +77 -0
- package/src/Init/HarnessRegistry.ts +87 -0
- package/src/Init/MutationTransaction.ts +747 -0
- package/src/Init/Service.ts +385 -0
- package/src/Init/StandardAdapters.ts +141 -0
- package/src/Init/Status.ts +253 -0
- package/src/Install/Claude/Hook.ts +234 -81
- package/src/Install/Claude/Mcp.ts +80 -33
- package/src/Install/Claude/Skill.ts +70 -37
- package/src/Install/Codex/Mcp.ts +14 -9
- package/src/Install/Codex/Skill.ts +9 -5
- package/src/Install/Cursor/Mcp.ts +12 -9
- package/src/Install/Cursor/Skill.ts +9 -5
- package/src/Install/Domain.ts +77 -4
- package/src/Install/Hook.ts +3 -3
- package/src/Install/Mcp.ts +6 -6
- package/src/Install/Opencode/Hook.ts +5 -5
- package/src/Install/Opencode/Mcp.ts +11 -8
- package/src/Install/Opencode/Skill.ts +9 -5
- package/src/Install/Opencode/expandai-webfetch.js +27 -9
- package/src/Install/Skill.ts +3 -3
- package/src/Install/Uninstall.ts +3 -3
- package/src/MarkdownAnsi.ts +162 -0
- package/src/Mcp/ExpandDocs.ts +46 -55
- package/src/Mcp/Server.ts +2 -1
- package/src/Mcp/tools/Citations.ts +117 -8
- package/src/Mcp/tools/Fetch.ts +40 -14
- package/src/SecureFile.ts +70 -0
- package/src/Snippets.ts +19 -12
- package/src/Telemetry.ts +186 -0
- package/src/Version.ts +3 -0
- package/src/Xdg.ts +18 -0
- package/src/main.ts +171 -12
- package/build/dts/DeviceAuth.d.ts +0 -87
- package/build/dts/DeviceAuth.d.ts.map +0 -1
- package/build/esm/DeviceAuth.js +0 -127
- package/build/esm/DeviceAuth.js.map +0 -1
- package/src/DeviceAuth.ts +0 -193
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ npm install -g expandai
|
|
|
15
15
|
The binary is published as `expandai`. One-off use without install:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
+
npx -y expandai fetch https://example.com
|
|
19
|
+
# or
|
|
18
20
|
bunx expandai fetch https://example.com
|
|
19
21
|
```
|
|
20
22
|
|
|
@@ -43,11 +45,29 @@ environment.
|
|
|
43
45
|
## Quick start
|
|
44
46
|
|
|
45
47
|
```bash
|
|
46
|
-
expandai
|
|
48
|
+
expandai init # authorize and configure detected agents
|
|
47
49
|
expandai fetch https://docs.example.com/api # full markdown
|
|
48
50
|
expandai fetch https://docs.example.com/api --search auth # semantic snippets
|
|
49
51
|
```
|
|
50
52
|
|
|
53
|
+
Human terminal use may omit the harness and scope; init detects supported
|
|
54
|
+
harnesses, asks for scope, completes loopback browser authorization when
|
|
55
|
+
needed, and configures every detected harness. Pass `--harness` to ensure the
|
|
56
|
+
agent running the command is included even when it has no config directory yet.
|
|
57
|
+
|
|
58
|
+
Agents and non-interactive VMs use the explicit machine form:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
expandai init --harness <current-harness> --scope project --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If authorization is required, the JSON result contains a browser URL and a
|
|
65
|
+
`userCode`. Put both in front of the user: they open the page, type the code in,
|
|
66
|
+
and approve — nothing comes back to paste. After they approve, run the **same
|
|
67
|
+
command again**; the CLI polls the approval up itself (RFC 8628). Machine mode
|
|
68
|
+
writes exactly one JSON result to stdout or one structured error to stderr, so
|
|
69
|
+
agents never need to answer an interactive CLI prompt.
|
|
70
|
+
|
|
51
71
|
## Supported harnesses
|
|
52
72
|
|
|
53
73
|
| Harness | MCP server | Webfetch hook | Skill |
|
|
@@ -57,7 +77,9 @@ expandai fetch https://docs.example.com/api --search auth # semantic snippets
|
|
|
57
77
|
| Cursor | ✓ | — | ✓ |
|
|
58
78
|
| Codex | ✓ | — | ✓ |
|
|
59
79
|
|
|
60
|
-
|
|
80
|
+
`expandai init` is the recommended path because it configures the current
|
|
81
|
+
harness plus every other supported harness detected on the machine. The
|
|
82
|
+
component commands below remain expert tools for migrations and targeted repair:
|
|
61
83
|
|
|
62
84
|
1. **Hook** (Claude Code, OpenCode). `expandai hook install <host> <scope>`
|
|
63
85
|
— best invisible upgrade: every native web fetch the agent issues comes
|
|
@@ -86,7 +108,9 @@ or `project`.
|
|
|
86
108
|
when the harness is launched from inside that directory (or a
|
|
87
109
|
subdirectory). Pick this when you want different projects to opt in
|
|
88
110
|
independently, or when the integration should live in version control
|
|
89
|
-
alongside the project.
|
|
111
|
+
alongside the project. The installed Claude profile uses the stable
|
|
112
|
+
`expandai` command when it is on `PATH` and `npx -y expandai` otherwise;
|
|
113
|
+
restart the harness if it has not inherited the global npm `PATH` yet.
|
|
90
114
|
|
|
91
115
|
The exact files each scope touches differ per harness and per integration —
|
|
92
116
|
see the path comment next to each `install` line in the sections below.
|
|
@@ -94,7 +118,7 @@ see the path comment next to each `install` line in the sections below.
|
|
|
94
118
|
## Authentication
|
|
95
119
|
|
|
96
120
|
```bash
|
|
97
|
-
expandai login # OAuth (browser
|
|
121
|
+
expandai login # OAuth (loopback browser flow) or API key
|
|
98
122
|
expandai whoami # show current auth state
|
|
99
123
|
expandai logout # clear credentials and optionally remove installed integrations
|
|
100
124
|
```
|
|
@@ -150,6 +174,11 @@ machine. `project` writes to per-directory equivalents
|
|
|
150
174
|
(`<cwd>/.claude/settings.json`, `<cwd>/.opencode/plugins/`) — the
|
|
151
175
|
substitution only fires when the harness is launched from that directory.
|
|
152
176
|
|
|
177
|
+
Claude Code hook entries use the portable `expandai` command when it resolves on
|
|
178
|
+
`PATH`, and `npx -y expandai` otherwise. Install the package globally before
|
|
179
|
+
sharing a project-scoped profile, and restart Claude Code if the current session
|
|
180
|
+
has not inherited the updated `PATH`.
|
|
181
|
+
|
|
153
182
|
### Why both, not just one
|
|
154
183
|
|
|
155
184
|
- The **runtime hook** makes the agent's native fetch path return ExpandAI
|
|
@@ -176,7 +205,8 @@ substitution only fires when the harness is launched from that directory.
|
|
|
176
205
|
- **OpenCode** — `expandai hook install opencode <scope>` copies an
|
|
177
206
|
`expandai-webfetch.js` plugin into `.opencode/plugins/`. The plugin hooks
|
|
178
207
|
`tool.execute.after` on `webfetch`, shells out to `expandai hook opencode`
|
|
179
|
-
with the URL
|
|
208
|
+
with the URL (retrying through `npx -y expandai` when the binary is not
|
|
209
|
+
installed), and overwrites `output.output` with the returned markdown.
|
|
180
210
|
(`tool.execute.before` can only mutate args, not replace results, which is
|
|
181
211
|
why we run in `after`.)
|
|
182
212
|
|
|
@@ -230,6 +260,13 @@ user-level MCP config — the server is discoverable in every session.
|
|
|
230
260
|
discoverable when the harness is launched from that directory, and the
|
|
231
261
|
config file is well-suited for checking into version control.
|
|
232
262
|
|
|
263
|
+
Profiles created by `expandai init` invoke the `expandai` command directly when
|
|
264
|
+
it is on `PATH`, and fall back to `npx -y expandai` when it is not — so
|
|
265
|
+
`npx expandai init` produces a working profile without a global install.
|
|
266
|
+
Re-running init after a global install rewrites the entry to the direct command.
|
|
267
|
+
For the fastest startup, install the package globally and make sure its bin
|
|
268
|
+
directory is on `PATH` before starting or restarting the harness.
|
|
269
|
+
|
|
233
270
|
`expandai mcp uninstall <host> <scope>` removes the entry without touching
|
|
234
271
|
other servers in the same config file.
|
|
235
272
|
|
package/build/dts/ApiClient.d.ts
CHANGED
|
@@ -1,8 +1,83 @@
|
|
|
1
1
|
import { HttpClient } from '@effect/platform';
|
|
2
2
|
import * as Generated from '@expandai/sdk/Generated';
|
|
3
|
-
import { Effect, Schema } from 'effect';
|
|
3
|
+
import { Effect, Redacted, Schema } from 'effect';
|
|
4
4
|
import { BrowserOAuthService } from './BrowserOAuth.js';
|
|
5
5
|
import { ConfigManager, OAuthTokenExpired } from './Config.js';
|
|
6
|
+
declare const DeviceAuthorizationCreated_base: Schema.Class<DeviceAuthorizationCreated, {
|
|
7
|
+
deviceCode: Schema.Redacted<typeof Schema.NonEmptyString>;
|
|
8
|
+
userCode: typeof Schema.NonEmptyString;
|
|
9
|
+
verificationUri: typeof Schema.URL;
|
|
10
|
+
expiresIn: Schema.filter<typeof Schema.Int>;
|
|
11
|
+
interval: Schema.filter<typeof Schema.Int>;
|
|
12
|
+
}, Schema.Struct.Encoded<{
|
|
13
|
+
deviceCode: Schema.Redacted<typeof Schema.NonEmptyString>;
|
|
14
|
+
userCode: typeof Schema.NonEmptyString;
|
|
15
|
+
verificationUri: typeof Schema.URL;
|
|
16
|
+
expiresIn: Schema.filter<typeof Schema.Int>;
|
|
17
|
+
interval: Schema.filter<typeof Schema.Int>;
|
|
18
|
+
}>, never, {
|
|
19
|
+
readonly deviceCode: Redacted.Redacted<string>;
|
|
20
|
+
} & {
|
|
21
|
+
readonly expiresIn: number;
|
|
22
|
+
} & {
|
|
23
|
+
readonly interval: number;
|
|
24
|
+
} & {
|
|
25
|
+
readonly userCode: string;
|
|
26
|
+
} & {
|
|
27
|
+
readonly verificationUri: URL;
|
|
28
|
+
}, {}, {}>;
|
|
29
|
+
export declare class DeviceAuthorizationCreated extends DeviceAuthorizationCreated_base {
|
|
30
|
+
}
|
|
31
|
+
declare const ManualAuthorizationTokenResponse: Schema.Struct<{
|
|
32
|
+
access_token: Schema.Redacted<typeof Schema.NonEmptyString>;
|
|
33
|
+
refresh_token: Schema.Redacted<typeof Schema.NonEmptyString>;
|
|
34
|
+
token_type: typeof Schema.NonEmptyString;
|
|
35
|
+
expires_in: Schema.filter<typeof Schema.Number>;
|
|
36
|
+
scope: Schema.optional<typeof Schema.String>;
|
|
37
|
+
}>;
|
|
38
|
+
export type ManualAuthorizationTokenResponse = typeof ManualAuthorizationTokenResponse.Type;
|
|
39
|
+
/**
|
|
40
|
+
* RFC 8628 §3.5 poll outcomes. These are results, not errors: an agent-driven
|
|
41
|
+
* CLI returns immediately on every one of them, and only a transport failure
|
|
42
|
+
* is exceptional.
|
|
43
|
+
*/
|
|
44
|
+
export type DevicePollOutcome = {
|
|
45
|
+
readonly _tag: 'Tokens';
|
|
46
|
+
readonly token: ManualAuthorizationTokenResponse;
|
|
47
|
+
} | {
|
|
48
|
+
readonly _tag: 'Pending';
|
|
49
|
+
} | {
|
|
50
|
+
readonly _tag: 'SlowDown';
|
|
51
|
+
} | {
|
|
52
|
+
readonly _tag: 'Denied';
|
|
53
|
+
} | {
|
|
54
|
+
readonly _tag: 'Expired';
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: 'Invalid';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The server refused for a reason a fresh code cannot fix — a misconfigured
|
|
60
|
+
* client, resource, or scope. Distinct from `Invalid` because the recovery is
|
|
61
|
+
* opposite: `Invalid` means start over, this means stop and report. Carries
|
|
62
|
+
* the server's own `error` so the message names the actual cause instead of
|
|
63
|
+
* guessing.
|
|
64
|
+
*/
|
|
65
|
+
| {
|
|
66
|
+
readonly _tag: 'Refused';
|
|
67
|
+
readonly error: string;
|
|
68
|
+
readonly description?: string;
|
|
69
|
+
};
|
|
70
|
+
declare const ManualAuthorizationApiError_base: Schema.TaggedErrorClass<ManualAuthorizationApiError, "ManualAuthorizationApiError", {
|
|
71
|
+
readonly _tag: Schema.tag<"ManualAuthorizationApiError">;
|
|
72
|
+
} & {
|
|
73
|
+
operation: Schema.Literal<["create", "poll"]>;
|
|
74
|
+
kind: Schema.Literal<["request_failed", "rejected", "invalid_response"]>;
|
|
75
|
+
status: Schema.optional<typeof Schema.Number>;
|
|
76
|
+
recoverable: typeof Schema.Boolean;
|
|
77
|
+
}>;
|
|
78
|
+
export declare class ManualAuthorizationApiError extends ManualAuthorizationApiError_base {
|
|
79
|
+
get message(): string;
|
|
80
|
+
}
|
|
6
81
|
declare const ApiRequestFailed_base: Schema.TaggedErrorClass<ApiRequestFailed, "ApiRequestFailed", {
|
|
7
82
|
readonly _tag: Schema.tag<"ApiRequestFailed">;
|
|
8
83
|
} & {
|
|
@@ -23,193 +98,61 @@ declare const OAuthAuthMethodChanged_base: new <A extends Record<string, any> =
|
|
|
23
98
|
} & Readonly<A>;
|
|
24
99
|
declare class OAuthAuthMethodChanged extends OAuthAuthMethodChanged_base<Record<string, never>> {
|
|
25
100
|
}
|
|
101
|
+
declare const ManualAuthorizationApiClient_base: Effect.Service.Class<ManualAuthorizationApiClient, "@expandai/cli/ManualAuthorizationApiClient", {
|
|
102
|
+
readonly dependencies: readonly [import("effect/Layer").Layer<HttpClient.HttpClient, never, never>, import("effect/Layer").Layer<ConfigManager, import("effect/ConfigError").ConfigError, never>];
|
|
103
|
+
readonly effect: Effect.Effect<{
|
|
104
|
+
readonly create: (input: {
|
|
105
|
+
readonly harness: 'agent-harnesses';
|
|
106
|
+
readonly scope: 'project' | 'global';
|
|
107
|
+
readonly platform: string;
|
|
108
|
+
readonly machineLabel: string;
|
|
109
|
+
readonly cliVersion: string;
|
|
110
|
+
}) => Effect.Effect<DeviceAuthorizationCreated, import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | ManualAuthorizationApiError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
111
|
+
readonly poll: (deviceCode: Redacted.Redacted<string>) => Effect.Effect<{
|
|
112
|
+
_tag: "Tokens";
|
|
113
|
+
token: {
|
|
114
|
+
readonly access_token: Redacted.Redacted<string>;
|
|
115
|
+
readonly refresh_token: Redacted.Redacted<string>;
|
|
116
|
+
readonly token_type: string;
|
|
117
|
+
readonly expires_in: number;
|
|
118
|
+
readonly scope?: string | undefined;
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
token?: undefined;
|
|
122
|
+
_tag: "Pending";
|
|
123
|
+
} | {
|
|
124
|
+
token?: undefined;
|
|
125
|
+
_tag: "SlowDown";
|
|
126
|
+
} | {
|
|
127
|
+
token?: undefined;
|
|
128
|
+
_tag: "Denied";
|
|
129
|
+
} | {
|
|
130
|
+
token?: undefined;
|
|
131
|
+
_tag: "Expired";
|
|
132
|
+
} | {
|
|
133
|
+
token?: undefined;
|
|
134
|
+
_tag: "Refused";
|
|
135
|
+
error: string;
|
|
136
|
+
description?: string | undefined;
|
|
137
|
+
} | {
|
|
138
|
+
token?: undefined;
|
|
139
|
+
_tag: "Invalid";
|
|
140
|
+
}, import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | ManualAuthorizationApiError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
141
|
+
}, never, ConfigManager | HttpClient.HttpClient>;
|
|
142
|
+
}>;
|
|
143
|
+
/** Public, unauthenticated HTTP boundary for device-flow CLI authorization. */
|
|
144
|
+
export declare class ManualAuthorizationApiClient extends ManualAuthorizationApiClient_base {
|
|
145
|
+
}
|
|
26
146
|
declare const ApiClient_base: Effect.Service.Class<ApiClient, "@expandai/cli/ApiClient", {
|
|
27
147
|
readonly dependencies: readonly [import("effect/Layer").Layer<HttpClient.HttpClient, never, never>, import("effect/Layer").Layer<ConfigManager, import("effect/ConfigError").ConfigError, never>, import("effect/Layer").Layer<BrowserOAuthService, import("effect/ConfigError").ConfigError, never>];
|
|
28
148
|
readonly scoped: Effect.Effect<{
|
|
29
|
-
readonly fetchFetch: (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly html?: boolean | {
|
|
37
|
-
readonly [x: string]: unknown;
|
|
38
|
-
} | null | undefined;
|
|
39
|
-
readonly markdown?: boolean | {
|
|
40
|
-
readonly [x: string]: unknown;
|
|
41
|
-
} | null | undefined;
|
|
42
|
-
readonly screenshot?: boolean | {
|
|
43
|
-
readonly fullPage?: boolean | null | undefined;
|
|
44
|
-
} | null | undefined;
|
|
45
|
-
readonly summary?: boolean | {
|
|
46
|
-
readonly prompt?: string | null | undefined;
|
|
47
|
-
} | null | undefined;
|
|
48
|
-
readonly links?: boolean | {
|
|
49
|
-
readonly skipEmptyText?: boolean | null | undefined;
|
|
50
|
-
readonly includeNavigation?: boolean | null | undefined;
|
|
51
|
-
} | null | undefined;
|
|
52
|
-
readonly meta?: boolean | null | undefined;
|
|
53
|
-
readonly response?: boolean | null | undefined;
|
|
54
|
-
readonly json?: boolean | null | undefined;
|
|
55
|
-
readonly appendix?: boolean | null | undefined;
|
|
56
|
-
} | null | undefined;
|
|
57
|
-
readonly search?: {
|
|
58
|
-
readonly query: string;
|
|
59
|
-
readonly maxResults?: number | null | undefined;
|
|
60
|
-
readonly minScore?: number | null | undefined;
|
|
61
|
-
} | null | undefined;
|
|
62
|
-
readonly browserConfig?: {
|
|
63
|
-
readonly scrollFullPage?: boolean | null | undefined;
|
|
64
|
-
} | null | undefined;
|
|
65
|
-
};
|
|
66
|
-
}) => Effect.Effect<string, import("effect/ParseResult").ParseError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").NotAuthenticated | OAuthTokenExpired | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | ApiRequestFailed | OAuthAuthMethodChanged, never>;
|
|
67
|
-
readonly fetchFetchResult: (options: {
|
|
68
|
-
readonly params: {
|
|
69
|
-
readonly include?: string | null | undefined;
|
|
70
|
-
};
|
|
71
|
-
readonly payload: {
|
|
72
|
-
readonly url: string;
|
|
73
|
-
readonly include?: {
|
|
74
|
-
readonly html?: boolean | {
|
|
75
|
-
readonly [x: string]: unknown;
|
|
76
|
-
} | null | undefined;
|
|
77
|
-
readonly markdown?: boolean | {
|
|
78
|
-
readonly [x: string]: unknown;
|
|
79
|
-
} | null | undefined;
|
|
80
|
-
readonly screenshot?: boolean | {
|
|
81
|
-
readonly fullPage?: boolean | null | undefined;
|
|
82
|
-
} | null | undefined;
|
|
83
|
-
readonly summary?: boolean | {
|
|
84
|
-
readonly prompt?: string | null | undefined;
|
|
85
|
-
} | null | undefined;
|
|
86
|
-
readonly links?: boolean | {
|
|
87
|
-
readonly skipEmptyText?: boolean | null | undefined;
|
|
88
|
-
readonly includeNavigation?: boolean | null | undefined;
|
|
89
|
-
} | null | undefined;
|
|
90
|
-
readonly meta?: boolean | null | undefined;
|
|
91
|
-
readonly response?: boolean | null | undefined;
|
|
92
|
-
readonly json?: boolean | null | undefined;
|
|
93
|
-
readonly appendix?: boolean | null | undefined;
|
|
94
|
-
} | null | undefined;
|
|
95
|
-
readonly search?: {
|
|
96
|
-
readonly query: string;
|
|
97
|
-
readonly maxResults?: number | null | undefined;
|
|
98
|
-
readonly minScore?: number | null | undefined;
|
|
99
|
-
} | null | undefined;
|
|
100
|
-
readonly browserConfig?: {
|
|
101
|
-
readonly scrollFullPage?: boolean | null | undefined;
|
|
102
|
-
} | null | undefined;
|
|
103
|
-
};
|
|
104
|
-
}) => Effect.Effect<import("@expandai/sdk/FetchJson").FetchObjectModeResultWithJson, import("effect/ParseResult").ParseError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").NotAuthenticated | OAuthTokenExpired | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | ApiRequestFailed | OAuthAuthMethodChanged, never>;
|
|
105
|
-
readonly fetchFetchJson: (options: {
|
|
106
|
-
readonly params: {
|
|
107
|
-
readonly include?: string | null | undefined;
|
|
108
|
-
};
|
|
109
|
-
readonly payload: {
|
|
110
|
-
readonly url: string;
|
|
111
|
-
readonly include?: {
|
|
112
|
-
readonly html?: boolean | {
|
|
113
|
-
readonly [x: string]: unknown;
|
|
114
|
-
} | null | undefined;
|
|
115
|
-
readonly markdown?: boolean | {
|
|
116
|
-
readonly [x: string]: unknown;
|
|
117
|
-
} | null | undefined;
|
|
118
|
-
readonly screenshot?: boolean | {
|
|
119
|
-
readonly fullPage?: boolean | null | undefined;
|
|
120
|
-
} | null | undefined;
|
|
121
|
-
readonly summary?: boolean | {
|
|
122
|
-
readonly prompt?: string | null | undefined;
|
|
123
|
-
} | null | undefined;
|
|
124
|
-
readonly links?: boolean | {
|
|
125
|
-
readonly skipEmptyText?: boolean | null | undefined;
|
|
126
|
-
readonly includeNavigation?: boolean | null | undefined;
|
|
127
|
-
} | null | undefined;
|
|
128
|
-
readonly meta?: boolean | null | undefined;
|
|
129
|
-
readonly response?: boolean | null | undefined;
|
|
130
|
-
readonly json?: boolean | null | undefined;
|
|
131
|
-
readonly appendix?: boolean | null | undefined;
|
|
132
|
-
} | null | undefined;
|
|
133
|
-
readonly search?: {
|
|
134
|
-
readonly query: string;
|
|
135
|
-
readonly maxResults?: number | null | undefined;
|
|
136
|
-
readonly minScore?: number | null | undefined;
|
|
137
|
-
} | null | undefined;
|
|
138
|
-
readonly browserConfig?: {
|
|
139
|
-
readonly scrollFullPage?: boolean | null | undefined;
|
|
140
|
-
} | null | undefined;
|
|
141
|
-
};
|
|
142
|
-
}) => Effect.Effect<import("@expandai/sdk/FetchJson").FetchObjectModeResultWithJson, import("effect/ParseResult").ParseError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").NotAuthenticated | OAuthTokenExpired | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | ApiRequestFailed | OAuthAuthMethodChanged, never>;
|
|
143
|
-
readonly fetchFetchSearch: (options: {
|
|
144
|
-
readonly search: {
|
|
145
|
-
readonly query: string;
|
|
146
|
-
readonly maxResults?: number | null | undefined;
|
|
147
|
-
readonly minScore?: number | null | undefined;
|
|
148
|
-
};
|
|
149
|
-
readonly snapshotId: string;
|
|
150
|
-
readonly include?: {
|
|
151
|
-
readonly html?: boolean | {
|
|
152
|
-
readonly [x: string]: unknown;
|
|
153
|
-
} | null | undefined;
|
|
154
|
-
readonly markdown?: boolean | {
|
|
155
|
-
readonly [x: string]: unknown;
|
|
156
|
-
} | null | undefined;
|
|
157
|
-
readonly screenshot?: boolean | {
|
|
158
|
-
readonly fullPage?: boolean | null | undefined;
|
|
159
|
-
} | null | undefined;
|
|
160
|
-
readonly summary?: boolean | {
|
|
161
|
-
readonly prompt?: string | null | undefined;
|
|
162
|
-
} | null | undefined;
|
|
163
|
-
readonly links?: boolean | {
|
|
164
|
-
readonly sameDomainOnly?: boolean | null | undefined;
|
|
165
|
-
readonly includePatterns?: readonly string[] | null | undefined;
|
|
166
|
-
readonly excludePatterns?: readonly string[] | null | undefined;
|
|
167
|
-
} | null | undefined;
|
|
168
|
-
readonly meta?: boolean | null | undefined;
|
|
169
|
-
readonly response?: {
|
|
170
|
-
readonly includeHeaders?: boolean | null | undefined;
|
|
171
|
-
} | null | undefined;
|
|
172
|
-
readonly json?: boolean | null | undefined;
|
|
173
|
-
readonly appendix?: boolean | null | undefined;
|
|
174
|
-
} | null | undefined;
|
|
175
|
-
}) => Effect.Effect<import("@expandai/sdk/FetchJson").FetchSnapshotSearchResultWithJson, import("effect/ParseResult").ParseError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").NotAuthenticated | OAuthTokenExpired | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | ApiRequestFailed | OAuthAuthMethodChanged, never>;
|
|
176
|
-
readonly fetchBatched: (options: {
|
|
177
|
-
readonly urls: readonly [string, ...string[]];
|
|
178
|
-
readonly include?: {
|
|
179
|
-
readonly html?: boolean | {
|
|
180
|
-
readonly [x: string]: unknown;
|
|
181
|
-
} | null | undefined;
|
|
182
|
-
readonly markdown?: boolean | {
|
|
183
|
-
readonly [x: string]: unknown;
|
|
184
|
-
} | null | undefined;
|
|
185
|
-
readonly screenshot?: boolean | {
|
|
186
|
-
readonly fullPage?: boolean | null | undefined;
|
|
187
|
-
} | null | undefined;
|
|
188
|
-
readonly summary?: boolean | {
|
|
189
|
-
readonly prompt?: string | null | undefined;
|
|
190
|
-
} | null | undefined;
|
|
191
|
-
readonly links?: boolean | {
|
|
192
|
-
readonly sameDomainOnly?: boolean | null | undefined;
|
|
193
|
-
readonly includePatterns?: readonly string[] | null | undefined;
|
|
194
|
-
readonly excludePatterns?: readonly string[] | null | undefined;
|
|
195
|
-
} | null | undefined;
|
|
196
|
-
readonly meta?: boolean | null | undefined;
|
|
197
|
-
readonly response?: {
|
|
198
|
-
readonly includeHeaders?: boolean | null | undefined;
|
|
199
|
-
} | null | undefined;
|
|
200
|
-
readonly json?: boolean | null | undefined;
|
|
201
|
-
readonly appendix?: boolean | null | undefined;
|
|
202
|
-
} | null | undefined;
|
|
203
|
-
readonly browserConfig?: {
|
|
204
|
-
readonly scrollFullPage?: boolean | null | undefined;
|
|
205
|
-
} | null | undefined;
|
|
206
|
-
}) => Effect.Effect<Generated.BatchedRun, import("effect/ParseResult").ParseError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").NotAuthenticated | OAuthTokenExpired | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | ApiRequestFailed | OAuthAuthMethodChanged, never>;
|
|
207
|
-
readonly fetchGetBatched: (id: string, options: {
|
|
208
|
-
readonly include?: string | null | undefined;
|
|
209
|
-
readonly limit?: string | null | undefined;
|
|
210
|
-
readonly offset?: string | null | undefined;
|
|
211
|
-
}) => Effect.Effect<Generated.BatchedStatus, import("effect/ParseResult").ParseError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").NotAuthenticated | OAuthTokenExpired | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | ApiRequestFailed | OAuthAuthMethodChanged, never>;
|
|
212
|
-
}, never, HttpClient.HttpClient | ConfigManager | BrowserOAuthService>;
|
|
149
|
+
readonly fetchFetch: (...args: Parameters<Generated.Client['fetchFetch']>) => Effect.Effect<string, ApiRequestFailed | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | import("./Config.js").ConfigCleanupError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | import("./Config.js").NotAuthenticated | OAuthAuthMethodChanged | OAuthTokenExpired | import("effect/ParseResult").ParseError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
150
|
+
readonly fetchFetchResult: (...args: Parameters<Generated.Client['fetchFetchJson']>) => Effect.Effect<import("@expandai/sdk/FetchJson").FetchObjectModeResultWithJson, ApiRequestFailed | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | import("./Config.js").ConfigCleanupError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | import("./Config.js").NotAuthenticated | OAuthAuthMethodChanged | OAuthTokenExpired | import("effect/ParseResult").ParseError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
151
|
+
readonly fetchFetchJson: (...args: Parameters<Generated.Client['fetchFetchJson']>) => Effect.Effect<import("@expandai/sdk/FetchJson").FetchObjectModeResultWithJson, ApiRequestFailed | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | import("./Config.js").ConfigCleanupError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | import("./Config.js").NotAuthenticated | OAuthAuthMethodChanged | OAuthTokenExpired | import("effect/ParseResult").ParseError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
152
|
+
readonly fetchFetchSearch: (...args: Parameters<Generated.Client['fetchFetchSearch']>) => Effect.Effect<import("@expandai/sdk/FetchJson").FetchSnapshotSearchResultWithJson, ApiRequestFailed | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | import("./Config.js").ConfigCleanupError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | import("./Config.js").NotAuthenticated | OAuthAuthMethodChanged | OAuthTokenExpired | import("effect/ParseResult").ParseError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
153
|
+
readonly fetchBatched: (...args: Parameters<Generated.Client['fetchBatched']>) => Effect.Effect<Generated.BatchedRun, ApiRequestFailed | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | import("./Config.js").ConfigCleanupError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | import("./Config.js").NotAuthenticated | OAuthAuthMethodChanged | OAuthTokenExpired | import("effect/ParseResult").ParseError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
154
|
+
readonly fetchGetBatched: (...args: Parameters<Generated.Client['fetchGetBatched']>) => Effect.Effect<Generated.BatchedStatus, ApiRequestFailed | import("./BrowserOAuth.js").BrowserOAuthRequestFailed | import("./Config.js").ConfigCleanupError | import("./Config.js").ConfigNotWritable | import("./Config.js").ConfigParseError | import("./Config.js").CredentialStoreInsecure | import("./Config.js").NotAuthenticated | OAuthAuthMethodChanged | OAuthTokenExpired | import("effect/ParseResult").ParseError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
155
|
+
}, never, BrowserOAuthService | ConfigManager | HttpClient.HttpClient>;
|
|
213
156
|
}>;
|
|
214
157
|
/**
|
|
215
158
|
* Resolves outgoing API auth per call. When the current request scope carries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiClient.d.ts","sourceRoot":"","sources":["../../src/ApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,kBAAkB,CAAA;AAGpF,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAA4B,MAAM,
|
|
1
|
+
{"version":3,"file":"ApiClient.d.ts","sourceRoot":"","sources":["../../src/ApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,kBAAkB,CAAA;AAGpF,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAA4B,MAAM,EAAuB,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAe,iBAAiB,EAAE,MAAM,aAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AAG3E,qBAAa,0BAA2B,SAAQ,+BAc9C;CAAG;AAEL,QAAA,MAAM,gCAAgC;;;;;;EAMpC,CAAA;AAEF,MAAM,MAAM,gCAAgC,GAAG,OAAO,gCAAgC,CAAC,IAAI,CAAA;AAE3F;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,gCAAgC,CAAA;CAAE,GAC7E;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE;AAC9B;;;;;;GAMG;GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;;;;;;;;;AAItF,qBAAa,2BAA4B,SAAQ,gCAQhD;IACA,IAAI,OAAO,WAIV;CACD;;;;;;AAED;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,qBAEpC;IACD,IAAI,OAAO,WAEV;CACD;;;;AAcD,cAAM,sBAAuB,SAAQ,4BAA2C,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAAG;;;;;8BAgFnF,iBAAiB;4BACnB,SAAS,GAAG,QAAQ;+BACjB,MAAM;mCACF,MAAM;iCACR,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA1B/B,+EAA+E;AAC/E,qBAAa,4BAA6B,SAAQ,iCA8HjD;CAAG;;;;uCAmJqB,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;6CAEpC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;2CAEhD,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;6CAE5C,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;yCAEpD,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;4CAEzC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;;;AA3J7E;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,cA0J7B;CAAG"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
/**
|
|
3
|
+
* The OAuth client for browser-approved CLI setup. Distinct from the
|
|
4
|
+
* `expandai-cli` client that `expandai login` uses: that one keeps loopback
|
|
5
|
+
* redirect URIs and must keep showing a consent screen, because Better Auth
|
|
6
|
+
* matches loopback URIs without comparing the port.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CLI_AUTHORIZATION_CLIENT_ID = "expandai-cli-browser";
|
|
9
|
+
export declare const PendingInitKey: Schema.Struct<{
|
|
10
|
+
apiOrigin: typeof Schema.String;
|
|
11
|
+
clientId: Schema.Literal<["expandai-cli-browser"]>;
|
|
12
|
+
harness: Schema.Literal<["agent-harnesses"]>;
|
|
13
|
+
scope: Schema.Literal<["project", "global"]>;
|
|
14
|
+
canonicalScopeRoot: typeof Schema.String;
|
|
15
|
+
}>;
|
|
16
|
+
export type PendingInitKey = typeof PendingInitKey.Type;
|
|
17
|
+
declare const PendingInitRecord_base: Schema.Class<PendingInitRecord, {
|
|
18
|
+
key: Schema.Struct<{
|
|
19
|
+
apiOrigin: typeof Schema.String;
|
|
20
|
+
clientId: Schema.Literal<["expandai-cli-browser"]>;
|
|
21
|
+
harness: Schema.Literal<["agent-harnesses"]>;
|
|
22
|
+
scope: Schema.Literal<["project", "global"]>;
|
|
23
|
+
canonicalScopeRoot: typeof Schema.String;
|
|
24
|
+
}>;
|
|
25
|
+
deviceCode: Schema.Redacted<typeof Schema.String>;
|
|
26
|
+
userCode: typeof Schema.String;
|
|
27
|
+
verificationUri: typeof Schema.String;
|
|
28
|
+
intervalSeconds: typeof Schema.Number;
|
|
29
|
+
nextPollAt: typeof Schema.DateTimeUtc;
|
|
30
|
+
approvalExpiresAt: typeof Schema.DateTimeUtc;
|
|
31
|
+
}, Schema.Struct.Encoded<{
|
|
32
|
+
key: Schema.Struct<{
|
|
33
|
+
apiOrigin: typeof Schema.String;
|
|
34
|
+
clientId: Schema.Literal<["expandai-cli-browser"]>;
|
|
35
|
+
harness: Schema.Literal<["agent-harnesses"]>;
|
|
36
|
+
scope: Schema.Literal<["project", "global"]>;
|
|
37
|
+
canonicalScopeRoot: typeof Schema.String;
|
|
38
|
+
}>;
|
|
39
|
+
deviceCode: Schema.Redacted<typeof Schema.String>;
|
|
40
|
+
userCode: typeof Schema.String;
|
|
41
|
+
verificationUri: typeof Schema.String;
|
|
42
|
+
intervalSeconds: typeof Schema.Number;
|
|
43
|
+
nextPollAt: typeof Schema.DateTimeUtc;
|
|
44
|
+
approvalExpiresAt: typeof Schema.DateTimeUtc;
|
|
45
|
+
}>, never, {
|
|
46
|
+
readonly approvalExpiresAt: import("effect/DateTime").Utc;
|
|
47
|
+
} & {
|
|
48
|
+
readonly deviceCode: import("effect/Redacted").Redacted<string>;
|
|
49
|
+
} & {
|
|
50
|
+
readonly intervalSeconds: number;
|
|
51
|
+
} & {
|
|
52
|
+
readonly key: {
|
|
53
|
+
readonly apiOrigin: string;
|
|
54
|
+
readonly clientId: "expandai-cli-browser";
|
|
55
|
+
readonly harness: "agent-harnesses";
|
|
56
|
+
readonly scope: "global" | "project";
|
|
57
|
+
readonly canonicalScopeRoot: string;
|
|
58
|
+
};
|
|
59
|
+
} & {
|
|
60
|
+
readonly nextPollAt: import("effect/DateTime").Utc;
|
|
61
|
+
} & {
|
|
62
|
+
readonly userCode: string;
|
|
63
|
+
} & {
|
|
64
|
+
readonly verificationUri: string;
|
|
65
|
+
}, {}, {}>;
|
|
66
|
+
/**
|
|
67
|
+
* One pending RFC 8628 device authorization. The `deviceCode` is the whole
|
|
68
|
+
* credential — better-auth binds it to our client id server-side and it never
|
|
69
|
+
* leaves this machine — so the record keeps the same 0600/no-symlink storage
|
|
70
|
+
* discipline the PKCE verifier had.
|
|
71
|
+
*/
|
|
72
|
+
export declare class PendingInitRecord extends PendingInitRecord_base {
|
|
73
|
+
}
|
|
74
|
+
declare const PendingInitCorrupt_base: Schema.TaggedErrorClass<PendingInitCorrupt, "PendingInitCorrupt", {
|
|
75
|
+
readonly _tag: Schema.tag<"PendingInitCorrupt">;
|
|
76
|
+
} & {
|
|
77
|
+
path: typeof Schema.String;
|
|
78
|
+
error: typeof Schema.Defect;
|
|
79
|
+
}>;
|
|
80
|
+
export declare class PendingInitCorrupt extends PendingInitCorrupt_base {
|
|
81
|
+
readonly recoverable = true;
|
|
82
|
+
get message(): string;
|
|
83
|
+
}
|
|
84
|
+
declare const PendingInitStorageError_base: Schema.TaggedErrorClass<PendingInitStorageError, "PendingInitStorageError", {
|
|
85
|
+
readonly _tag: Schema.tag<"PendingInitStorageError">;
|
|
86
|
+
} & {
|
|
87
|
+
path: typeof Schema.String;
|
|
88
|
+
error: typeof Schema.Defect;
|
|
89
|
+
}>;
|
|
90
|
+
export declare class PendingInitStorageError extends PendingInitStorageError_base {
|
|
91
|
+
readonly recoverable = true;
|
|
92
|
+
get message(): string;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=Domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Domain.d.ts","sourceRoot":"","sources":["../../../src/Auth/Domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,yBAAyB,CAAA;AAEjE,eAAO,MAAM,cAAc;;;;;;EAMzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,sBAcrC;CAAG;;;;;;;AAEL,qBAAa,kBAAmB,SAAQ,uBAGtC;IACD,QAAQ,CAAC,WAAW,QAAO;IAE3B,IAAI,OAAO,WAEV;CACD;;;;;;;AAED,qBAAa,uBAAwB,SAAQ,4BAG3C;IACD,QAAQ,CAAC,WAAW,QAAO;IAE3B,IAAI,OAAO,WAEV;CACD"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { DateTime, Effect, Schema } from 'effect';
|
|
2
|
+
import { ManualAuthorizationApiClient, ManualAuthorizationApiError } from '../ApiClient.js';
|
|
3
|
+
import { ConfigManager } from '../Config.js';
|
|
4
|
+
import { PendingInitStore } from './PendingInit.js';
|
|
5
|
+
export { ALREADY_AUTHENTICATED_MESSAGE, AUTHORIZATION_CONSUMED_MESSAGE, AUTHORIZATION_REQUIRED_MESSAGE, } from '../Init/Domain.js';
|
|
6
|
+
declare const ManualAuthorizationInput_base: Schema.Class<ManualAuthorizationInput, {
|
|
7
|
+
harness: Schema.Literal<["agent-harnesses"]>;
|
|
8
|
+
scope: Schema.Literal<["project", "global"]>;
|
|
9
|
+
cwd: Schema.optional<typeof Schema.String>;
|
|
10
|
+
platform: Schema.optional<typeof Schema.String>;
|
|
11
|
+
}, Schema.Struct.Encoded<{
|
|
12
|
+
harness: Schema.Literal<["agent-harnesses"]>;
|
|
13
|
+
scope: Schema.Literal<["project", "global"]>;
|
|
14
|
+
cwd: Schema.optional<typeof Schema.String>;
|
|
15
|
+
platform: Schema.optional<typeof Schema.String>;
|
|
16
|
+
}>, never, {
|
|
17
|
+
readonly cwd?: string | undefined;
|
|
18
|
+
} & {
|
|
19
|
+
readonly platform?: string | undefined;
|
|
20
|
+
} & {
|
|
21
|
+
readonly harness: "agent-harnesses";
|
|
22
|
+
} & {
|
|
23
|
+
readonly scope: "global" | "project";
|
|
24
|
+
}, {}, {}>;
|
|
25
|
+
export declare class ManualAuthorizationInput extends ManualAuthorizationInput_base {
|
|
26
|
+
}
|
|
27
|
+
declare const ManualAuthorizationRequired_base: Schema.Class<ManualAuthorizationRequired, {
|
|
28
|
+
verificationUri: typeof Schema.String;
|
|
29
|
+
userCode: typeof Schema.NonEmptyString;
|
|
30
|
+
approvalExpiresAt: typeof Schema.DateTimeUtc;
|
|
31
|
+
}, Schema.Struct.Encoded<{
|
|
32
|
+
verificationUri: typeof Schema.String;
|
|
33
|
+
userCode: typeof Schema.NonEmptyString;
|
|
34
|
+
approvalExpiresAt: typeof Schema.DateTimeUtc;
|
|
35
|
+
}>, never, {
|
|
36
|
+
readonly approvalExpiresAt: DateTime.Utc;
|
|
37
|
+
} & {
|
|
38
|
+
readonly userCode: string;
|
|
39
|
+
} & {
|
|
40
|
+
readonly verificationUri: string;
|
|
41
|
+
}, {}, {}>;
|
|
42
|
+
/** What the agent relays: where to approve, and the code to type there. */
|
|
43
|
+
export declare class ManualAuthorizationRequired extends ManualAuthorizationRequired_base {
|
|
44
|
+
}
|
|
45
|
+
declare const TokensSaved_base: Schema.TaggedClass<TokensSaved, "TokensSaved", {
|
|
46
|
+
readonly _tag: Schema.tag<"TokensSaved">;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* One `advance` call moves the flow as far as it can without blocking, then
|
|
50
|
+
* returns. RFC 8628's polling loop is inverted: the agent re-invokes the CLI,
|
|
51
|
+
* and each invocation polls the token endpoint at most once — or not at all,
|
|
52
|
+
* when the persisted interval says the server would answer `slow_down`.
|
|
53
|
+
*/
|
|
54
|
+
export declare class TokensSaved extends TokensSaved_base {
|
|
55
|
+
}
|
|
56
|
+
declare const AuthorizationPending_base: Schema.TaggedClass<AuthorizationPending, "AuthorizationPending", {
|
|
57
|
+
readonly _tag: Schema.tag<"AuthorizationPending">;
|
|
58
|
+
} & {
|
|
59
|
+
pending: typeof ManualAuthorizationRequired;
|
|
60
|
+
}>;
|
|
61
|
+
export declare class AuthorizationPending extends AuthorizationPending_base {
|
|
62
|
+
}
|
|
63
|
+
export declare const ManualAuthorizationOutcome: Schema.Union<[typeof TokensSaved, typeof AuthorizationPending]>;
|
|
64
|
+
export type ManualAuthorizationOutcome = typeof ManualAuthorizationOutcome.Type;
|
|
65
|
+
declare const ManualAuthorizationDenied_base: Schema.TaggedErrorClass<ManualAuthorizationDenied, "ManualAuthorizationDenied", {
|
|
66
|
+
readonly _tag: Schema.tag<"ManualAuthorizationDenied">;
|
|
67
|
+
} & {
|
|
68
|
+
recoverable: Schema.Literal<[true]>;
|
|
69
|
+
}>;
|
|
70
|
+
export declare class ManualAuthorizationDenied extends ManualAuthorizationDenied_base {
|
|
71
|
+
get message(): string;
|
|
72
|
+
}
|
|
73
|
+
declare const ManualAuthorizationRefused_base: Schema.TaggedErrorClass<ManualAuthorizationRefused, "ManualAuthorizationRefused", {
|
|
74
|
+
readonly _tag: Schema.tag<"ManualAuthorizationRefused">;
|
|
75
|
+
} & {
|
|
76
|
+
error: typeof Schema.String;
|
|
77
|
+
description: Schema.optional<typeof Schema.String>;
|
|
78
|
+
recoverable: Schema.Literal<[false]>;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* The server refused redemption for a reason a fresh code cannot fix. Kept
|
|
82
|
+
* separate from every other failure because the correct response is the
|
|
83
|
+
* opposite of the usual one: do not start over, stop and report. Re-minting
|
|
84
|
+
* here is what produced an endless approve loop — each new code is approved by
|
|
85
|
+
* the user and then refused identically, with nothing surfaced.
|
|
86
|
+
*/
|
|
87
|
+
export declare class ManualAuthorizationRefused extends ManualAuthorizationRefused_base {
|
|
88
|
+
get message(): string;
|
|
89
|
+
}
|
|
90
|
+
declare const ManualAuthorizationCredentialSaveFailed_base: Schema.TaggedErrorClass<ManualAuthorizationCredentialSaveFailed, "ManualAuthorizationCredentialSaveFailed", {
|
|
91
|
+
readonly _tag: Schema.tag<"ManualAuthorizationCredentialSaveFailed">;
|
|
92
|
+
} & {
|
|
93
|
+
recoverable: Schema.Literal<[false]>;
|
|
94
|
+
}>;
|
|
95
|
+
export declare class ManualAuthorizationCredentialSaveFailed extends ManualAuthorizationCredentialSaveFailed_base {
|
|
96
|
+
get message(): string;
|
|
97
|
+
}
|
|
98
|
+
declare const ManualAuthorization_base: Effect.Service.Class<ManualAuthorization, "@expandai/cli/Auth/ManualAuthorization", {
|
|
99
|
+
readonly dependencies: readonly [import("effect/Layer").Layer<ConfigManager, import("effect/ConfigError").ConfigError, never>, import("effect/Layer").Layer<PendingInitStore, import("effect/ConfigError").ConfigError, never>, import("effect/Layer").Layer<ManualAuthorizationApiClient, import("effect/ConfigError").ConfigError, never>];
|
|
100
|
+
readonly effect: Effect.Effect<{
|
|
101
|
+
readonly advance: (input: ManualAuthorizationInput) => Effect.Effect<AuthorizationPending | TokensSaved, import("../Config.js").ConfigParseError | import("../Config.js").CredentialStoreInsecure | ManualAuthorizationApiError | ManualAuthorizationCredentialSaveFailed | ManualAuthorizationDenied | ManualAuthorizationRefused | import("./Domain.js").PendingInitCorrupt | import("./Domain.js").PendingInitStorageError | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
102
|
+
readonly redeemPreApproved: (deviceCode: import("effect/Redacted").Redacted<string>) => Effect.Effect<undefined, import("../Config.js").ConfigParseError | import("../Config.js").CredentialStoreInsecure | ManualAuthorizationApiError | ManualAuthorizationCredentialSaveFailed | ManualAuthorizationDenied | ManualAuthorizationRefused | import("effect/ConfigError").ConfigError | import("@effect/platform/Error").PlatformError, never>;
|
|
103
|
+
}, never, ConfigManager | ManualAuthorizationApiClient | PendingInitStore>;
|
|
104
|
+
}>;
|
|
105
|
+
export declare class ManualAuthorization extends ManualAuthorization_base {
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=ManualAuthorization.d.ts.map
|