@ggui-ai/cli 0.1.0-rc.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/LICENSE +201 -0
- package/README.md +96 -0
- package/dist/agent-resolution.d.ts +41 -0
- package/dist/agent-resolution.d.ts.map +1 -0
- package/dist/agent-resolution.js +80 -0
- package/dist/api-client.d.ts +59 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +145 -0
- package/dist/auth-keys.d.ts +10 -0
- package/dist/auth-keys.d.ts.map +1 -0
- package/dist/auth-keys.js +382 -0
- package/dist/auth-login.d.ts +11 -0
- package/dist/auth-login.d.ts.map +1 -0
- package/dist/auth-login.js +231 -0
- package/dist/auth-logout.d.ts +3 -0
- package/dist/auth-logout.d.ts.map +1 -0
- package/dist/auth-logout.js +32 -0
- package/dist/auth-store.d.ts +67 -0
- package/dist/auth-store.d.ts.map +1 -0
- package/dist/auth-store.js +150 -0
- package/dist/auth-whoami.d.ts +3 -0
- package/dist/auth-whoami.d.ts.map +1 -0
- package/dist/auth-whoami.js +52 -0
- package/dist/blueprint-command.d.ts +3 -0
- package/dist/blueprint-command.d.ts.map +1 -0
- package/dist/blueprint-command.js +203 -0
- package/dist/blueprint-create.d.ts +71 -0
- package/dist/blueprint-create.d.ts.map +1 -0
- package/dist/blueprint-create.js +377 -0
- package/dist/byok-resolver.d.ts +141 -0
- package/dist/byok-resolver.d.ts.map +1 -0
- package/dist/byok-resolver.js +89 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1066 -0
- package/dist/dev-command.d.ts +169 -0
- package/dist/dev-command.d.ts.map +1 -0
- package/dist/dev-command.js +222 -0
- package/dist/gadget-command.d.ts +3 -0
- package/dist/gadget-command.d.ts.map +1 -0
- package/dist/gadget-command.js +181 -0
- package/dist/gadget-create.d.ts +106 -0
- package/dist/gadget-create.d.ts.map +1 -0
- package/dist/gadget-create.js +492 -0
- package/dist/generation-probe.d.ts +135 -0
- package/dist/generation-probe.d.ts.map +1 -0
- package/dist/generation-probe.js +132 -0
- package/dist/internal/artifact-install.d.ts +150 -0
- package/dist/internal/artifact-install.d.ts.map +1 -0
- package/dist/internal/artifact-install.js +1019 -0
- package/dist/internal/artifact-publish.d.ts +204 -0
- package/dist/internal/artifact-publish.d.ts.map +1 -0
- package/dist/internal/artifact-publish.js +1141 -0
- package/dist/internal/artifact-search.d.ts +155 -0
- package/dist/internal/artifact-search.d.ts.map +1 -0
- package/dist/internal/artifact-search.js +539 -0
- package/dist/internal/artifact-uninstall.d.ts +30 -0
- package/dist/internal/artifact-uninstall.d.ts.map +1 -0
- package/dist/internal/artifact-uninstall.js +205 -0
- package/dist/internal/auth-cache.d.ts +40 -0
- package/dist/internal/auth-cache.d.ts.map +1 -0
- package/dist/internal/auth-cache.js +133 -0
- package/dist/internal/auth-strategy.d.ts +89 -0
- package/dist/internal/auth-strategy.d.ts.map +1 -0
- package/dist/internal/auth-strategy.js +132 -0
- package/dist/internal/ggui-json.d.ts +53 -0
- package/dist/internal/ggui-json.d.ts.map +1 -0
- package/dist/internal/ggui-json.js +92 -0
- package/dist/internal/key-store.d.ts +43 -0
- package/dist/internal/key-store.d.ts.map +1 -0
- package/dist/internal/key-store.js +128 -0
- package/dist/internal/oidc-token.d.ts +52 -0
- package/dist/internal/oidc-token.d.ts.map +1 -0
- package/dist/internal/oidc-token.js +351 -0
- package/dist/internal/register-author-key.d.ts +44 -0
- package/dist/internal/register-author-key.d.ts.map +1 -0
- package/dist/internal/register-author-key.js +212 -0
- package/dist/local-keys.d.ts +47 -0
- package/dist/local-keys.d.ts.map +1 -0
- package/dist/local-keys.js +115 -0
- package/dist/mcp-backend.d.ts +356 -0
- package/dist/mcp-backend.d.ts.map +1 -0
- package/dist/mcp-backend.js +668 -0
- package/dist/paths.d.ts +77 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +119 -0
- package/dist/persistent-secrets.d.ts +28 -0
- package/dist/persistent-secrets.d.ts.map +1 -0
- package/dist/persistent-secrets.js +94 -0
- package/dist/persistent-short-code-index.d.ts +14 -0
- package/dist/persistent-short-code-index.d.ts.map +1 -0
- package/dist/persistent-short-code-index.js +39 -0
- package/dist/persistent-stores.d.ts +12 -0
- package/dist/persistent-stores.d.ts.map +1 -0
- package/dist/persistent-stores.js +42 -0
- package/dist/serve-command.d.ts +500 -0
- package/dist/serve-command.d.ts.map +1 -0
- package/dist/serve-command.js +616 -0
- package/dist/serve-fallback.d.ts +64 -0
- package/dist/serve-fallback.d.ts.map +1 -0
- package/dist/serve-fallback.js +122 -0
- package/dist/spawn-cloudflared.d.ts +61 -0
- package/dist/spawn-cloudflared.d.ts.map +1 -0
- package/dist/spawn-cloudflared.js +167 -0
- package/dist/theme-command.d.ts +4 -0
- package/dist/theme-command.d.ts.map +1 -0
- package/dist/theme-command.js +154 -0
- package/dist/theme-file-uploader.d.ts +8 -0
- package/dist/theme-file-uploader.d.ts.map +1 -0
- package/dist/theme-file-uploader.js +58 -0
- package/dist/theme-writer.d.ts +8 -0
- package/dist/theme-writer.d.ts.map +1 -0
- package/dist/theme-writer.js +103 -0
- package/dist/tunnel-provider.d.ts +273 -0
- package/dist/tunnel-provider.d.ts.map +1 -0
- package/dist/tunnel-provider.js +142 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Loqu, Inc. (Guuey)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @ggui-ai/cli
|
|
2
|
+
|
|
3
|
+
> Open `ggui` CLI — the local dev + serve + pair + bench binary for the `ggui` protocol. OSS and self-hosted workflows end-to-end. **No account required.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@ggui-ai/cli)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
This package ships the `ggui` binary. It's a thin shell over `@ggui-ai/dev-stack` (shared dev engine), `@ggui-ai/mcp-server` (OSS MCP runtime), and `@ggui-ai/agent-runtime` (agent-framework adapter seam).
|
|
9
|
+
|
|
10
|
+
`ggui` is the **protocol**. `Guuey` is the **hosted platform** built on top of it. The closed `guuey` binary (shipped as `@guuey/cli`) handles hosted-control-plane commands like `guuey login` / `guuey deploy`. This binary handles everything you need to run the protocol on your own machine.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @ggui-ai/cli
|
|
16
|
+
# or, without global install:
|
|
17
|
+
npx @ggui-ai/cli --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For a new project, install this package and start `ggui serve` with `--mcp-only` (no `ggui.json` required) to get a server you can pair against:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
mkdir my-app && cd my-app
|
|
24
|
+
npm init -y
|
|
25
|
+
npm install @ggui-ai/cli
|
|
26
|
+
npx ggui serve --mcp-only # boots http://127.0.0.1:6781
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To declare a project (blueprints, primitives, theme, agent entry), drop a `ggui.json` at the project root — see the [samples](https://github.com/ggui-ai/ggui/tree/main/samples/gguis) for runnable shapes.
|
|
30
|
+
|
|
31
|
+
## Commands
|
|
32
|
+
|
|
33
|
+
### `ggui serve`
|
|
34
|
+
|
|
35
|
+
Run the OSS self-hosted personal-mode server: MCP at `/mcp`, session viewer at `/s/<shortCode>`, pairing endpoints, and a live-channel WebSocket. Supervises the agent declared in `ggui.json#agent.entry`.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ggui serve # default: http://127.0.0.1:6781
|
|
39
|
+
ggui serve --port 0 # OS-assigned free port
|
|
40
|
+
ggui serve --host 0.0.0.0 # bind all interfaces
|
|
41
|
+
ggui serve --mcp-only # skip agent supervision
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Scope today:**
|
|
45
|
+
|
|
46
|
+
- ✅ Local server, viewer, cookie-authenticated WebSocket subscribe/ack all work end-to-end.
|
|
47
|
+
- ✅ `ggui_push` mints shortCodes and lands on the same-origin viewer.
|
|
48
|
+
- ✅ Component-code generation is wired on the OSS path via `createUiGenerator()` from `@ggui-ai/ui-gen` — the same harness the hosted runtime uses. `ggui_push` returns `codeReady: false` only when no BYOK credentials resolve (no `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / etc.); supply a key to get full generation locally.
|
|
49
|
+
- 🔒 Default auth is dev-mode (any bearer → `builder`). Swap in a real `AuthAdapter` via `createGguiServer({ auth })` before exposing beyond `127.0.0.1`.
|
|
50
|
+
|
|
51
|
+
### `ggui dev`
|
|
52
|
+
|
|
53
|
+
Start the local UI registry + compile-on-demand dev hub, optionally supervising a local agent runtime. See `ggui dev --help` for the full flag list (agent adapter, tunnel provider, browser auto-open).
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
`ggui.json` is the single source of truth. Minimum shape:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"schema": "1",
|
|
62
|
+
"protocol": "<current PROTOCOL_VERSION>",
|
|
63
|
+
"app": { "slug": "my-app", "name": "My App" },
|
|
64
|
+
"agent": { "entry": "./agent.ts" }
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Set `protocol` to the value of `PROTOCOL_VERSION` exported by `@ggui-ai/protocol` in the version you install (or omit the field — the CLI will fall back to the installed protocol version).
|
|
69
|
+
|
|
70
|
+
Optional blocks include `storage` (sessions / vectors / threads via `memory` or `sqlite`), `primitives`, `theme`, `adapters`, and `blueprints`. See [`@ggui-ai/project-config`](../project-config) for the full schema.
|
|
71
|
+
|
|
72
|
+
## MCP config for your agent runtime
|
|
73
|
+
|
|
74
|
+
Point any MCP-compatible agent at the local endpoint `ggui serve` exposes:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mcpServers": {
|
|
79
|
+
"ggui": {
|
|
80
|
+
"url": "http://127.0.0.1:6781/mcp",
|
|
81
|
+
"headers": { "Authorization": "Bearer dev" }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Links
|
|
88
|
+
|
|
89
|
+
- [Repo](https://github.com/ggui-ai/ggui) — source, examples, issue tracker
|
|
90
|
+
- [OSS Quickstart](https://github.com/ggui-ai/ggui#oss-quickstart--run-the-protocol-locally)
|
|
91
|
+
- [`@ggui-ai/mcp-server`](https://www.npmjs.com/package/@ggui-ai/mcp-server) — OSS MCP runtime library
|
|
92
|
+
- [`@ggui-ai/protocol`](https://www.npmjs.com/package/@ggui-ai/protocol) — wire-type contracts
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
Apache 2.0
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type NodeProcessAgentRuntimeOptions } from '@ggui-ai/agent-runtime/process';
|
|
2
|
+
import type { AgentRuntimeAdapter } from '@ggui-ai/agent-runtime';
|
|
3
|
+
/** Narrow discriminated result of the entry-to-command mapper. */
|
|
4
|
+
export type AgentCommandResolution = {
|
|
5
|
+
ok: true;
|
|
6
|
+
command: string;
|
|
7
|
+
args: string[];
|
|
8
|
+
entry: string;
|
|
9
|
+
language: 'js' | 'ts';
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
error: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Map a user-supplied agent entry path to `{ command, args }` for
|
|
16
|
+
* the subprocess adapter. The mapping is narrow on purpose:
|
|
17
|
+
*
|
|
18
|
+
* - `.js` / `.mjs` / `.cjs` → `node <entry>`
|
|
19
|
+
* - `.ts` / `.tsx` / `.mts` → `node --import=tsx <entry>`
|
|
20
|
+
* (the user must have `tsx` resolvable — the adapter will
|
|
21
|
+
* surface the boot failure if not)
|
|
22
|
+
*
|
|
23
|
+
* Anything else is rejected with an actionable error. We deliberately
|
|
24
|
+
* do NOT try to be clever with Deno / Bun / bundlers — the reference
|
|
25
|
+
* adapter is exactly "run a Node process." Framework-specific
|
|
26
|
+
* adapters (`@ggui-ai/agent-runtime/<adapter>`) own their own entry
|
|
27
|
+
* policy.
|
|
28
|
+
*
|
|
29
|
+
* `entry` resolves against `cwd` when relative so the spawn receives
|
|
30
|
+
* an absolute path regardless of where the command was invoked.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveAgentCommand(entry: string, cwd: string): AgentCommandResolution;
|
|
33
|
+
/**
|
|
34
|
+
* Construct a node-process adapter for a resolved entry. Separate
|
|
35
|
+
* from {@link resolveAgentCommand} so tests can branch on the
|
|
36
|
+
* mapping without constructing an actual adapter.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildAgentRuntime(resolution: Extract<AgentCommandResolution, {
|
|
39
|
+
ok: true;
|
|
40
|
+
}>, extra?: Partial<Omit<NodeProcessAgentRuntimeOptions, 'command' | 'args'>>): AgentRuntimeAdapter;
|
|
41
|
+
//# sourceMappingURL=agent-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-resolution.d.ts","sourceRoot":"","sources":["../src/agent-resolution.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,kEAAkE;AAClE,MAAM,MAAM,sBAAsB,GAC9B;IACE,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CACvB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,sBAAsB,CAqCxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,CAAC,sBAAsB,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,EACzD,KAAK,GAAE,OAAO,CACZ,IAAI,CAAC,8BAA8B,EAAE,SAAS,GAAG,MAAM,CAAC,CACpD,GACL,mBAAmB,CAOrB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared agent-entry resolution helpers.
|
|
3
|
+
*
|
|
4
|
+
* Consumed by both `ggui dev --agent <entry>` and `ggui serve`. Pure
|
|
5
|
+
* functions over a path string + a working directory; no I/O, no
|
|
6
|
+
* subprocess spawn (construction of the adapter does NOT spawn —
|
|
7
|
+
* `@ggui-ai/agent-runtime/process` starts the process only when
|
|
8
|
+
* `adapter.start()` is called).
|
|
9
|
+
*
|
|
10
|
+
* Command-neutral: error messages reference "agent entry" generically.
|
|
11
|
+
* Callers wrap in command-specific prefixes (`ggui dev: …` /
|
|
12
|
+
* `ggui serve: …`) when rendering.
|
|
13
|
+
*/
|
|
14
|
+
import { extname, isAbsolute, resolve } from 'node:path';
|
|
15
|
+
import { createNodeProcessAgentRuntime, } from '@ggui-ai/agent-runtime/process';
|
|
16
|
+
/**
|
|
17
|
+
* Map a user-supplied agent entry path to `{ command, args }` for
|
|
18
|
+
* the subprocess adapter. The mapping is narrow on purpose:
|
|
19
|
+
*
|
|
20
|
+
* - `.js` / `.mjs` / `.cjs` → `node <entry>`
|
|
21
|
+
* - `.ts` / `.tsx` / `.mts` → `node --import=tsx <entry>`
|
|
22
|
+
* (the user must have `tsx` resolvable — the adapter will
|
|
23
|
+
* surface the boot failure if not)
|
|
24
|
+
*
|
|
25
|
+
* Anything else is rejected with an actionable error. We deliberately
|
|
26
|
+
* do NOT try to be clever with Deno / Bun / bundlers — the reference
|
|
27
|
+
* adapter is exactly "run a Node process." Framework-specific
|
|
28
|
+
* adapters (`@ggui-ai/agent-runtime/<adapter>`) own their own entry
|
|
29
|
+
* policy.
|
|
30
|
+
*
|
|
31
|
+
* `entry` resolves against `cwd` when relative so the spawn receives
|
|
32
|
+
* an absolute path regardless of where the command was invoked.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveAgentCommand(entry, cwd) {
|
|
35
|
+
if (!entry || entry.length === 0) {
|
|
36
|
+
return { ok: false, error: 'agent entry was empty' };
|
|
37
|
+
}
|
|
38
|
+
const absolute = isAbsolute(entry) ? entry : resolve(cwd, entry);
|
|
39
|
+
const ext = extname(absolute).toLowerCase();
|
|
40
|
+
const jsExts = new Set(['.js', '.mjs', '.cjs']);
|
|
41
|
+
const tsExts = new Set(['.ts', '.tsx', '.mts']);
|
|
42
|
+
if (jsExts.has(ext)) {
|
|
43
|
+
return {
|
|
44
|
+
ok: true,
|
|
45
|
+
command: process.execPath,
|
|
46
|
+
args: [absolute],
|
|
47
|
+
entry: absolute,
|
|
48
|
+
language: 'js',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (tsExts.has(ext)) {
|
|
52
|
+
return {
|
|
53
|
+
ok: true,
|
|
54
|
+
command: process.execPath,
|
|
55
|
+
args: ['--import=tsx', absolute],
|
|
56
|
+
entry: absolute,
|
|
57
|
+
language: 'ts',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
error: `agent entry "${entry}" has an unsupported extension "${ext || '(none)'}". ` +
|
|
63
|
+
`Supported: .js / .mjs / .cjs / .ts / .tsx / .mts. ` +
|
|
64
|
+
`For other runtimes, the reference adapter is not the right tool — ` +
|
|
65
|
+
`ship a framework-specific adapter under @ggui-ai/agent-runtime/<name>.`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Construct a node-process adapter for a resolved entry. Separate
|
|
70
|
+
* from {@link resolveAgentCommand} so tests can branch on the
|
|
71
|
+
* mapping without constructing an actual adapter.
|
|
72
|
+
*/
|
|
73
|
+
export function buildAgentRuntime(resolution, extra = {}) {
|
|
74
|
+
return createNodeProcessAgentRuntime({
|
|
75
|
+
name: 'node-process',
|
|
76
|
+
command: resolution.command,
|
|
77
|
+
args: resolution.args,
|
|
78
|
+
...extra,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface DeviceCodeResponse {
|
|
2
|
+
device_code: string;
|
|
3
|
+
user_code: string;
|
|
4
|
+
verification_uri: string;
|
|
5
|
+
verification_uri_complete: string;
|
|
6
|
+
expires_in: number;
|
|
7
|
+
interval: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TokenResponse {
|
|
10
|
+
access_token: string;
|
|
11
|
+
refresh_token: string;
|
|
12
|
+
token_type: 'Bearer';
|
|
13
|
+
expires_in: number;
|
|
14
|
+
session_id: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MeResponse {
|
|
17
|
+
userId: string;
|
|
18
|
+
sessionId: string;
|
|
19
|
+
clientName: string | null;
|
|
20
|
+
accessExpiresAt: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ApiKeySummary {
|
|
23
|
+
id: string;
|
|
24
|
+
apiKeyPrefix: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
status: string;
|
|
27
|
+
createdAt?: string;
|
|
28
|
+
expiresAt?: string;
|
|
29
|
+
lastUsedAt?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface KeysListResponse {
|
|
32
|
+
keys: ApiKeySummary[];
|
|
33
|
+
}
|
|
34
|
+
export interface KeysCreateResponse {
|
|
35
|
+
apiKey: string;
|
|
36
|
+
id: string;
|
|
37
|
+
prefix: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ServerErrorBody {
|
|
41
|
+
error: string;
|
|
42
|
+
error_description?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare class ApiError extends Error {
|
|
45
|
+
readonly status: number;
|
|
46
|
+
readonly code: string;
|
|
47
|
+
constructor(status: number, code: string, message: string);
|
|
48
|
+
}
|
|
49
|
+
export declare function postAuthDevice(endpoint: string, clientName: string): Promise<DeviceCodeResponse>;
|
|
50
|
+
export declare function postAuthPoll(endpoint: string, deviceCode: string): Promise<TokenResponse>;
|
|
51
|
+
export declare function postAuthRefresh(endpoint: string, refreshToken: string): Promise<TokenResponse>;
|
|
52
|
+
export declare function getMe(): Promise<MeResponse>;
|
|
53
|
+
export declare function listKeys(): Promise<KeysListResponse>;
|
|
54
|
+
export declare function createKey(args: {
|
|
55
|
+
name?: string;
|
|
56
|
+
expiresAt?: string;
|
|
57
|
+
}): Promise<KeysCreateResponse>;
|
|
58
|
+
export declare function revokeKey(id: string): Promise<void>;
|
|
59
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,yBAAyB,EAAE,MAAM,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAM1D;AAqBD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAQ7B;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,CAAC,CAQxB;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,CAAC,CAQxB;AA0ED,wBAAsB,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC,CAKjD;AAED,wBAAsB,QAAQ,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAK1D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAa9B;AAED,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASzD"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed `fetch` wrapper for the api.ggui.ai REST endpoints (S2 + S3).
|
|
3
|
+
*
|
|
4
|
+
* Two layers:
|
|
5
|
+
*
|
|
6
|
+
* 1. Unauthenticated calls used by `ggui login` (`/v1/auth/device`,
|
|
7
|
+
* `/v1/auth/poll`, `/v1/auth/refresh`).
|
|
8
|
+
* 2. Authenticated calls used by every other command — they take a
|
|
9
|
+
* `cli_at_*` access token and surface a 401 → callers either
|
|
10
|
+
* retry-with-refresh (handled by {@link withAuthRetry}) or
|
|
11
|
+
* bubble up "session expired".
|
|
12
|
+
*
|
|
13
|
+
* No retry / backoff loops here for transient network errors — let
|
|
14
|
+
* the operator hit C-c and rerun. Only the 401-refresh-once flow is
|
|
15
|
+
* automatic.
|
|
16
|
+
*/
|
|
17
|
+
import { loadAuthSession, saveAuthSession, } from './auth-store.js';
|
|
18
|
+
export class ApiError extends Error {
|
|
19
|
+
status;
|
|
20
|
+
code;
|
|
21
|
+
constructor(status, code, message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.name = 'ApiError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function parseError(res) {
|
|
29
|
+
let body;
|
|
30
|
+
try {
|
|
31
|
+
body = await res.json();
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return new ApiError(res.status, 'http_error', `HTTP ${res.status}`);
|
|
35
|
+
}
|
|
36
|
+
const err = body;
|
|
37
|
+
return new ApiError(res.status, err.error ?? 'http_error', err.error_description ?? err.error ?? `HTTP ${res.status}`);
|
|
38
|
+
}
|
|
39
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
40
|
+
// Unauthenticated calls (login flow).
|
|
41
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
42
|
+
export async function postAuthDevice(endpoint, clientName) {
|
|
43
|
+
const res = await fetch(`${endpoint}/v1/auth/device`, {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
headers: { 'Content-Type': 'application/json' },
|
|
46
|
+
body: JSON.stringify({ client_name: clientName }),
|
|
47
|
+
});
|
|
48
|
+
if (!res.ok)
|
|
49
|
+
throw await parseError(res);
|
|
50
|
+
return (await res.json());
|
|
51
|
+
}
|
|
52
|
+
export async function postAuthPoll(endpoint, deviceCode) {
|
|
53
|
+
const res = await fetch(`${endpoint}/v1/auth/poll`, {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: { 'Content-Type': 'application/json' },
|
|
56
|
+
body: JSON.stringify({ device_code: deviceCode }),
|
|
57
|
+
});
|
|
58
|
+
if (!res.ok)
|
|
59
|
+
throw await parseError(res);
|
|
60
|
+
return (await res.json());
|
|
61
|
+
}
|
|
62
|
+
export async function postAuthRefresh(endpoint, refreshToken) {
|
|
63
|
+
const res = await fetch(`${endpoint}/v1/auth/refresh`, {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers: { 'Content-Type': 'application/json' },
|
|
66
|
+
body: JSON.stringify({ refresh_token: refreshToken }),
|
|
67
|
+
});
|
|
68
|
+
if (!res.ok)
|
|
69
|
+
throw await parseError(res);
|
|
70
|
+
return (await res.json());
|
|
71
|
+
}
|
|
72
|
+
async function authedFetch(session, opts) {
|
|
73
|
+
const headers = {
|
|
74
|
+
Authorization: `Bearer ${session.accessToken}`,
|
|
75
|
+
};
|
|
76
|
+
if (opts.body !== undefined) {
|
|
77
|
+
headers['Content-Type'] = 'application/json';
|
|
78
|
+
}
|
|
79
|
+
return fetch(`${session.endpoint}${opts.path}`, {
|
|
80
|
+
method: opts.method,
|
|
81
|
+
headers,
|
|
82
|
+
...(opts.body !== undefined ? { body: JSON.stringify(opts.body) } : {}),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Run an authenticated fetch with one transparent refresh on 401.
|
|
87
|
+
* On success the (possibly updated) session is returned alongside
|
|
88
|
+
* the parsed response — callers persist via `saveAuthSession`.
|
|
89
|
+
*/
|
|
90
|
+
async function withAuthRetry(call, parse) {
|
|
91
|
+
let session = loadAuthSession();
|
|
92
|
+
let res = await call(session);
|
|
93
|
+
if (res.status === 401) {
|
|
94
|
+
// Try refresh once.
|
|
95
|
+
let tokens;
|
|
96
|
+
try {
|
|
97
|
+
tokens = await postAuthRefresh(session.endpoint, session.refreshToken);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
if (err instanceof ApiError && err.status === 401) {
|
|
101
|
+
throw new ApiError(401, 'session_expired', 'Session expired. Run `ggui login` again.');
|
|
102
|
+
}
|
|
103
|
+
throw err;
|
|
104
|
+
}
|
|
105
|
+
const now = Math.floor(Date.now() / 1000);
|
|
106
|
+
session = {
|
|
107
|
+
...session,
|
|
108
|
+
accessToken: tokens.access_token,
|
|
109
|
+
accessExpiresAt: now + tokens.expires_in,
|
|
110
|
+
refreshToken: tokens.refresh_token,
|
|
111
|
+
// refresh response carries token_type + session_id only — refresh
|
|
112
|
+
// expiry stays the same (server-side refresh-token rotation isn't
|
|
113
|
+
// implemented at v1). If the refresh-token call returned a new
|
|
114
|
+
// refreshExpiresAt we'd update it here.
|
|
115
|
+
writtenAt: new Date().toISOString(),
|
|
116
|
+
};
|
|
117
|
+
saveAuthSession(session);
|
|
118
|
+
res = await call(session);
|
|
119
|
+
}
|
|
120
|
+
if (!res.ok)
|
|
121
|
+
throw await parseError(res);
|
|
122
|
+
return parse(res);
|
|
123
|
+
}
|
|
124
|
+
export async function getMe() {
|
|
125
|
+
return withAuthRetry((s) => authedFetch(s, { method: 'GET', path: '/v1/me' }), (r) => r.json());
|
|
126
|
+
}
|
|
127
|
+
export async function listKeys() {
|
|
128
|
+
return withAuthRetry((s) => authedFetch(s, { method: 'GET', path: '/v1/keys' }), (r) => r.json());
|
|
129
|
+
}
|
|
130
|
+
export async function createKey(args) {
|
|
131
|
+
return withAuthRetry((s) => authedFetch(s, {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
path: '/v1/keys',
|
|
134
|
+
body: {
|
|
135
|
+
...(args.name ? { name: args.name } : {}),
|
|
136
|
+
...(args.expiresAt ? { expires_at: args.expiresAt } : {}),
|
|
137
|
+
},
|
|
138
|
+
}), (r) => r.json());
|
|
139
|
+
}
|
|
140
|
+
export async function revokeKey(id) {
|
|
141
|
+
await withAuthRetry((s) => authedFetch(s, {
|
|
142
|
+
method: 'DELETE',
|
|
143
|
+
path: `/v1/keys/${encodeURIComponent(id)}`,
|
|
144
|
+
}), async () => undefined);
|
|
145
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const KEYS_HELP = "ggui keys \u2014 manage CLI keys\n\nUsage:\n ggui keys list [--keys-file <path>]\n ggui keys create [--name <label>] [--expires-at <iso8601>] [--keys-file <path>]\n ggui keys revoke <id> [--keys-file <path>]\n ggui keys register --scope <@scope> [--registry <url>]\n\nlist Print the caller's keys (id, prefix, name, status, dates).\ncreate Mint a new connector key. The full secret is printed ONCE \u2014 copy it.\nrevoke Soft-revoke a connector key by id (the row stays for audit).\nregister Register a per-scope Ed25519 PUBLISHER key with the marketplace\n registry so future `ggui gadget publish` / `ggui blueprint publish`\n signed by the matching private key validate. The keypair is\n auto-generated on first publish under\n ~/.ggui/keys/<scope>/{private,public}.key \u2014 this verb ships\n the public half to the registry's POST /author-keys.\n\nPass --keys-file <path> to operate on the LOCAL JSON file instead of\nthe cloud (api.ggui.ai). The file format is the one written by\n`ggui serve --keys-file` \u2014 the two commands share the same store, so\nyou can mint a bearer here and have `ggui serve` accept it on next\nboot. Use this for self-host / personal-mode workflows. --keys-file\napplies to list/create/revoke only; `register` always talks to the\nmarketplace registry.\n";
|
|
2
|
+
export declare function runKeysCommand(args: readonly string[]): Promise<number>;
|
|
3
|
+
export interface RegisterFlags {
|
|
4
|
+
readonly scope?: string;
|
|
5
|
+
readonly registry?: string;
|
|
6
|
+
readonly help: boolean;
|
|
7
|
+
readonly error?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseRegisterFlags(args: readonly string[]): RegisterFlags;
|
|
10
|
+
//# sourceMappingURL=auth-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-keys.d.ts","sourceRoot":"","sources":["../src/auth-keys.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,SAAS,43CAyBrB,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB7E;AA6PD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CA2CzE"}
|