@ory/antigravity 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -0
- package/dist/cli/assets.d.ts +29 -0
- package/dist/cli/assets.js +182 -0
- package/dist/cli/main.d.ts +12 -0
- package/dist/cli/main.js +214 -0
- package/dist/cli/setup.d.ts +16 -0
- package/dist/cli/setup.js +83 -0
- package/dist/handlers.d.ts +16 -0
- package/dist/handlers.js +321 -0
- package/dist/hook.d.ts +18 -0
- package/dist/hook.js +87 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.js +16 -0
- package/package.json +92 -0
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Ory Agent Plugin: Google Antigravity
|
|
2
|
+
|
|
3
|
+
[Ory](https://ory.com) bundled into [Google Antigravity](https://antigravity.google): skills and slash commands that scaffold Ory authentication into your codebase, a local Ory stack you can spin up in one command, and (when pointed at an Ory project) authentication, authorization, and audit for every tool Antigravity's agent runs.
|
|
4
|
+
|
|
5
|
+
You don't need an Ory account or any prior Ory experience to start.
|
|
6
|
+
|
|
7
|
+
> **Antigravity is the successor to Gemini CLI.** If you used the Ory Gemini CLI extension, this is its counterpart for the `agy` CLI and the Antigravity IDE. Your existing skills and commands carry over.
|
|
8
|
+
|
|
9
|
+
## New to Ory?
|
|
10
|
+
|
|
11
|
+
[Ory](https://www.ory.com/docs/) is an open-source identity and access platform — it provides login, registration, sessions, social sign-in, multi-factor auth, and fine-grained permissions, so you don't have to build any of that yourself. Two things make it easy to try with no prior experience:
|
|
12
|
+
|
|
13
|
+
- **Ory Elements** are prebuilt, themeable UI components for the auth pages (login, registration, recovery, settings). The scaffolding skills wire them into your app for you.
|
|
14
|
+
- **The local Ory stack** is a complete Ory running on your laptop in Docker — no account, no signup, no API key. Everything in the Quickstart below works against it, fully offline.
|
|
15
|
+
|
|
16
|
+
This plugin does two independent things, and you can use either on its own:
|
|
17
|
+
|
|
18
|
+
1. **Build auth into your app.** Have Antigravity scaffold Ory login, registration, social sign-in, and permissions into the project you're working on, backed by the local stack. This is the Quickstart below — it needs nothing but Docker.
|
|
19
|
+
2. **Govern the agent itself.** Authenticate the agent's session and authorize every tool it runs against Ory Permissions, with a full audit trail. See [Agent security](#agent-security).
|
|
20
|
+
|
|
21
|
+
If you're just exploring, do the Quickstart first.
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
- [Google Antigravity](https://antigravity.google) installed (the `agy` CLI and/or the IDE)
|
|
26
|
+
- Node.js **≥ 22**
|
|
27
|
+
- [Docker](https://docs.docker.com/get-docker/) (only needed for the local Ory stack)
|
|
28
|
+
- macOS or Linux. Windows works via WSL2.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx -y -p @ory/antigravity ory-antigravity install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This materializes the Ory plugin bundle (skills, commands, hooks, and MCP server) and registers it with Antigravity via `agy plugin install`. Then confirm everything landed:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx -y -p @ory/antigravity ory-antigravity status
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`status` is the single source of truth — it prints configuration, user and agent identity, per-tool permission coverage, plugin + skill registration, and a tail of recent debug logs. Unconfigured fields show inline as `(unset)`.
|
|
43
|
+
|
|
44
|
+
<details>
|
|
45
|
+
<summary>Alternative install paths</summary>
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx -y -p @ory/antigravity ory-antigravity uninstall
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If the `agy` binary isn't on your `PATH`, `npx -y -p @ory/antigravity ory-antigravity-setup` writes the plugin bundle directly into your project's `.agents/` directory (`plugin.json`, `hooks.json`, `mcp_config.json`, `skills/`, `commands/`).
|
|
52
|
+
|
|
53
|
+
</details>
|
|
54
|
+
|
|
55
|
+
## Quickstart (≈ 3 minutes)
|
|
56
|
+
|
|
57
|
+
From any project where you'd like Ory authentication, inside Antigravity:
|
|
58
|
+
|
|
59
|
+
1. **Start a local Ory instance.** Ask Antigravity *"start the local Ory stack"* or run:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/ory:local-up
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A banner prints the seeded test user's email and password. Note them — you'll log in with them in step 3.
|
|
66
|
+
|
|
67
|
+
2. **Scaffold Ory into your project.** Ask Antigravity *"add Ory auth to this app"* or invoke the `ory-auth-setup` skill.
|
|
68
|
+
|
|
69
|
+
Antigravity installs Ory Elements, wires the SDK, generates the login / registration / recovery / verification / settings pages, and sets up session middleware. It targets the local stack from step 1, so no signup or API key is needed.
|
|
70
|
+
|
|
71
|
+
3. **Sign in.** Start your app, visit the login page Antigravity added, and sign in with the seeded credentials. You now have a real Ory session backed by a real Ory stack — locally, offline, with zero configuration.
|
|
72
|
+
|
|
73
|
+
4. **Turn on Ory login for the agent session itself.** *(Optional but recommended.)* Out of the box the plugin only governs your *app*. To also attach an Ory identity to the *agent's* session — so every tool call is attributed to you, not a fallback `session:<id>` subject — opt in to the user-login flow:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export ORY_USER_LOGIN=true
|
|
77
|
+
export ORY_OAUTH2_CLIENT_ID=<value printed by `local up`>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
User login is off by default. Both exports above are printed in the `local up` banner — copy them straight from there. `ORY_OAUTH2_CLIENT_ID` is required whenever `ORY_USER_LOGIN` is on: it identifies the public OAuth2 client the PKCE browser flow exchanges for a token. With both set, the next session opens an Ory login in your browser; sign in with the same seeded credentials from step 1, and the token is reused on subsequent sessions until it expires. This is what makes `permissions enforce` (see [Agent security](#agent-security)) deny on the right identity later.
|
|
81
|
+
|
|
82
|
+
That's the full Ory DX path. Stop here if you're just evaluating the plugin. Continue to [Agent security](#agent-security) when you're ready to enforce.
|
|
83
|
+
|
|
84
|
+
## What's included
|
|
85
|
+
|
|
86
|
+
### Skills for scaffolding Ory into your application
|
|
87
|
+
|
|
88
|
+
The plugin bundles a catalog of skills that Antigravity auto-invokes by description. Ask in natural language or invoke a skill directly:
|
|
89
|
+
|
|
90
|
+
**Start here — add Ory auth to your app:**
|
|
91
|
+
|
|
92
|
+
- **`ory-auth-setup`** — full project setup. Install the Ory CLI, create an Ory Network project (or use the local one), add Ory Elements, configure the SDK, build the auth pages, wire session middleware.
|
|
93
|
+
- **`ory-login-flow`** — login, registration, recovery, verification, and settings pages with Ory Elements. Next.js App Router and React SPA variants.
|
|
94
|
+
- **`ory-social-login`** — Google, GitHub, Apple, Microsoft, Discord, and other OIDC providers with Jsonnet data mappers.
|
|
95
|
+
- **`ory-local-dev`** — drive the local Ory stack from within Antigravity to prototype and test without a remote project.
|
|
96
|
+
|
|
97
|
+
**Going further:**
|
|
98
|
+
|
|
99
|
+
- **`ory-permissions-onboarding`** — bootstrap permissions for built-in tools, switch between observe and enforce mode, troubleshoot denials.
|
|
100
|
+
- **`ory-build-integration`** — pull the runnable subset of an `ory/integrates` template (webhook / config / http-event) into your own app and wire it to your Ory project.
|
|
101
|
+
- **`ory-contribute-integration`** — author a brand-new integration as a contribution to `ory/integrates`.
|
|
102
|
+
- **`ory-e2b-sandbox`** — scaffold an [E2B](https://e2b.dev) sandbox template that boots with this plugin preinstalled and registered.
|
|
103
|
+
- **`ory-build-agent`** — drop `@ory/argus` directly into a custom agent you own (Claude Agent SDK, OpenAI Agents SDK, Mastra, Vercel AI SDK, PydanticAI, LangGraph, Mistral AI, or Salesforce Agentforce).
|
|
104
|
+
- **`ory-temporal-worker`** — scaffold a [Temporal](https://temporal.io) TypeScript worker with every Activity gated by an Ory permission check.
|
|
105
|
+
|
|
106
|
+
### Ory MCP server
|
|
107
|
+
|
|
108
|
+
Bundled and registered automatically via `mcp_config.json`. Exposes the Ory CLI and the Ory Network REST API as MCP tools so the agent can manage identities, OAuth2 clients, projects, permissions, and configuration without ever leaving the chat.
|
|
109
|
+
|
|
110
|
+
### Local Ory stack
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
/ory:local-up # start a local Ory instance in Docker
|
|
114
|
+
/ory:local-down # tear it all down
|
|
115
|
+
/ory:temporal-up # start a local Temporal dev server (for ory-temporal-worker)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`local-up` runs a complete Ory on your laptop: the Ory APIs (Identities, OAuth2, Permissions) at `http://localhost:4000`, a login UI on `:4455` (not :3000, to avoid Next.js port conflicts), and Jaeger (the trace viewer) on `:16686`. A test user identity is seeded and its credentials are printed for you.
|
|
119
|
+
|
|
120
|
+
## Pointing at a real Ory project
|
|
121
|
+
|
|
122
|
+
The Quickstart uses the local stack. If you have a hosted [Ory Network](https://console.ory.sh) project, point the plugin at it with a single configure command. **The plugin requires `--oauth2-client-id` whenever `--project-url` is provided** — register the client first (see [Register the user OAuth2 client](#register-the-user-oauth2-client)), then run:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npx -y -p @ory/antigravity ory-antigravity configure \
|
|
126
|
+
--project-url https://<id>.projects.oryapis.com \
|
|
127
|
+
--oauth2-client-id <public OAuth2 client id>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- **`--project-url`** points the plugin at your project. The **agent identity** (machine credentials for the agent's outgoing Ory API calls) is created automatically on first run via OAuth2 Dynamic Client Registration ([RFC 7591](https://datatracker.ietf.org/doc/html/rfc7591)) — no manual step required.
|
|
131
|
+
- **`--oauth2-client-id`** is required because the **user** PKCE browser flow (triggered by `ORY_USER_LOGIN=true`) cannot self-register. See [Register the user OAuth2 client](#register-the-user-oauth2-client).
|
|
132
|
+
- **`--api-key ory_pat_...`** is optional — pass it only to override the auto-registered agent identity with a static personal access token.
|
|
133
|
+
|
|
134
|
+
If you only want audit logging (no auth or permission checks), substitute `--audit-only`:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npx -y -p @ory/antigravity ory-antigravity configure --audit-only
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The same settings can be supplied via environment variables (`ORY_PROJECT_URL`, `ORY_OAUTH2_CLIENT_ID`, `ORY_AGENT_API_KEY`) — env vars take precedence over the config file when both are set.
|
|
141
|
+
|
|
142
|
+
Config is saved to `~/.config/ory-agent-plugins/config.json` and shared across every Ory agent plugin on the machine.
|
|
143
|
+
|
|
144
|
+
Without configuration the plugin still loads cleanly and runs in **pass-through mode**: skills and commands work, but nothing is blocked.
|
|
145
|
+
|
|
146
|
+
### Register the user OAuth2 client
|
|
147
|
+
|
|
148
|
+
If you plan to turn on `ORY_USER_LOGIN=true` (recommended), your hosted Ory project needs a **public** OAuth2 client (no client secret) registered ahead of time. The local stack provisions this for you automatically; against a hosted project you register it once yourself.
|
|
149
|
+
|
|
150
|
+
The client must list **all four** loopback ports as redirect URIs:
|
|
151
|
+
|
|
152
|
+
- `http://127.0.0.1:47823/callback`
|
|
153
|
+
- `http://127.0.0.1:47824/callback`
|
|
154
|
+
- `http://127.0.0.1:47825/callback`
|
|
155
|
+
- `http://127.0.0.1:47826/callback`
|
|
156
|
+
|
|
157
|
+
The plugin walks the four ports at runtime so login survives any one of them being occupied. Create the client with the [Ory CLI](https://www.ory.com/docs/guides/cli/installation):
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
ory create oauth2-client --project <project-id> \
|
|
161
|
+
--name "ory-agent-plugin" \
|
|
162
|
+
--grant-type authorization_code,refresh_token \
|
|
163
|
+
--response-type code \
|
|
164
|
+
--scope openid,offline_access \
|
|
165
|
+
--token-endpoint-auth-method none \
|
|
166
|
+
--redirect-uri http://127.0.0.1:47823/callback \
|
|
167
|
+
--redirect-uri http://127.0.0.1:47824/callback \
|
|
168
|
+
--redirect-uri http://127.0.0.1:47825/callback \
|
|
169
|
+
--redirect-uri http://127.0.0.1:47826/callback
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
…then persist the issued id with `configure --oauth2-client-id`, or set `ORY_OAUTH2_CLIENT_ID` in the environment alongside `ORY_USER_LOGIN`. Headless / CI runs that already hold a session token can skip this by setting `ORY_USER_SESSION_TOKEN` instead.
|
|
173
|
+
|
|
174
|
+
## Agent security
|
|
175
|
+
|
|
176
|
+
Once the plugin is pointed at an Ory project (local or hosted), the agent's session and every tool call can be governed by Ory.
|
|
177
|
+
|
|
178
|
+
- **Authentication.** Two identities. The human at the keyboard (the **user**) authenticates interactively via Ory Identities when user login is enabled (`ORY_USER_LOGIN=true`, off by default). The agent process gets its own OAuth2 identity, self-registered via [Dynamic Client Registration (RFC 7591)](https://datatracker.ietf.org/doc/html/rfc7591) on first run.
|
|
179
|
+
- **Authorization.** Before any tool runs, the plugin's `PreToolUse` hook checks [Ory Permissions](https://www.ory.com/docs/keto) against the user's subject and blocks the call on `deny`.
|
|
180
|
+
- **Audit.** Every decision (allow, deny, fallback) is recorded as a structured trace span: NDJSON file output and/or OTLP/HTTP export to Jaeger, Honeycomb, Grafana, and similar collectors. The user → agent delegation is written to Ory as a relation so *"agent X acting on behalf of user Y"* stays queryable after tokens expire.
|
|
181
|
+
|
|
182
|
+
The plugin hooks into these Antigravity lifecycle events: `SessionStart` (verify identities), `PreToolUse` (authorize), `PostToolUse` (audit), `Notification`, and `SessionEnd`.
|
|
183
|
+
|
|
184
|
+
> **Fail-open on a fail-closed harness.** Antigravity blocks a tool unless the `PreToolUse` hook explicitly returns `{ allow_tool: true }` — a crash, timeout, or missing response *blocks* the tool. To preserve Ory's never-get-in-the-way contract, the plugin **always returns "allow" on any internal or network error**, so a transient Ory outage never wedges your tools. Enforcement is therefore only as strong as your permission grants — grant explicit `use` on the tools each user should be able to run.
|
|
185
|
+
|
|
186
|
+
### Enable enforcement
|
|
187
|
+
|
|
188
|
+
After install the plugin runs in **observe mode**: every tool call is checked against Ory Permissions, but a deny is recorded as a `permission.observe_deny` audit span and the tool runs anyway. This lets you see what *would* be blocked before turning on hard blocking.
|
|
189
|
+
|
|
190
|
+
1. **Turn on user login.** It's off by default:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
export ORY_USER_LOGIN=true
|
|
194
|
+
export ORY_OAUTH2_CLIENT_ID=<public OAuth2 client id>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
2. **Bootstrap permissions for the built-in tools.** One idempotent command grants the current user `use` on every tool Antigravity ships with (run_command, view_file, write_to_file, …):
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npx -y -p @ory/antigravity ory-antigravity permissions bootstrap
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
3. **Check coverage.** `permissions status` probes every tool in the harness's catalog and prints allowed / denied per tool:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npx -y -p @ory/antigravity ory-antigravity permissions status
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
4. **Promote to enforce.** Once the observe-mode logs look right:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
npx -y -p @ory/antigravity ory-antigravity permissions enforce
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Denies now block the tool call; Antigravity shows the `deny_reason` and the decision is recorded as a `tool.block` trace span with `blocked: true`. Switch back any time with `permissions observe`.
|
|
216
|
+
|
|
217
|
+
## CLI reference
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
npx -y -p @ory/antigravity ory-antigravity install
|
|
221
|
+
npx -y -p @ory/antigravity ory-antigravity uninstall
|
|
222
|
+
npx -y -p @ory/antigravity ory-antigravity configure [--project-url <url> --oauth2-client-id <id>] [--api-key <key>] [--audit-only]
|
|
223
|
+
npx -y -p @ory/antigravity ory-antigravity agent <status|unregister>
|
|
224
|
+
npx -y -p @ory/antigravity ory-antigravity permissions <status|bootstrap|observe|enforce>
|
|
225
|
+
npx -y -p @ory/antigravity ory-antigravity local <up|down|status|seed|logs|env|configure|reset>
|
|
226
|
+
npx -y -p @ory/antigravity ory-antigravity setup [--project-dir <path>] # .agents fallback
|
|
227
|
+
npx -y -p @ory/antigravity ory-antigravity status
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Troubleshooting
|
|
231
|
+
|
|
232
|
+
- **`/ory:local-up` fails.** Make sure Docker is running and ports `4455` (login UI), `4000`, `4100`, and `16686` are free.
|
|
233
|
+
- **PKCE login loops.** Clear persisted state with `npx -y -p @ory/antigravity ory-antigravity agent unregister` and retry.
|
|
234
|
+
- **`npx` fetches an old version.** Force a fresh fetch: `npx -y -p @ory/antigravity@latest ory-antigravity …`.
|
|
235
|
+
- **A tool was unexpectedly blocked.** Because Antigravity fails closed, confirm the hook is returning JSON — set `ORY_AGENT_DEBUG=true` and `ORY_AGENT_LOG_FILE=/tmp/ory.log` and check for hook errors. Then verify the user has `use` on the tool (`permissions status`).
|
|
236
|
+
|
|
237
|
+
## Links
|
|
238
|
+
|
|
239
|
+
- [Ory documentation](https://www.ory.com/docs/)
|
|
240
|
+
- [Ory Network console](https://console.ory.sh)
|
|
241
|
+
- [Ory Elements](https://github.com/ory/elements)
|
|
242
|
+
- [Google Antigravity](https://antigravity.google)
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
Apache-2.0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Materialize / clean the Ory plugin bundle for Google Antigravity.
|
|
3
|
+
*
|
|
4
|
+
* Antigravity plugins are the rebrand of Gemini CLI extensions. A bundle
|
|
5
|
+
* is a directory containing:
|
|
6
|
+
*
|
|
7
|
+
* plugin.json required manifest: { name, version, description }
|
|
8
|
+
* hooks.json lifecycle hook registrations (verified schema below)
|
|
9
|
+
* mcp_config.json MCP server registrations
|
|
10
|
+
* skills/ Ory skill playbooks (SKILL.md trees)
|
|
11
|
+
* commands/<ns>/ TOML slash commands
|
|
12
|
+
*
|
|
13
|
+
* Verified against `agy 1.0.13`: `agy plugin validate <dir>` accepts this
|
|
14
|
+
* layout and reports `hooks`, `mcpServers`, `skills`, and `commands` as
|
|
15
|
+
* recognized components.
|
|
16
|
+
*
|
|
17
|
+
* hooks.json shape (verified): top-level rule id → event name → array of
|
|
18
|
+
* `{ matcher, hooks: [{ type, command, timeout }] }`.
|
|
19
|
+
*/
|
|
20
|
+
/** Plugin / rule / MCP-server id. */
|
|
21
|
+
export declare const PLUGIN_NAME = "ory";
|
|
22
|
+
/**
|
|
23
|
+
* Write the full Ory plugin bundle under `root`. Used both for the
|
|
24
|
+
* bundle handed to `agy plugin install` and for the manual `.agents`
|
|
25
|
+
* fallback.
|
|
26
|
+
*/
|
|
27
|
+
export declare function installAntigravityOryAssets(root: string): void;
|
|
28
|
+
/** Remove every Ory skill, command, and bundle file written under `root`. */
|
|
29
|
+
export declare function uninstallAntigravityOryAssets(root: string): void;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Materialize / clean the Ory plugin bundle for Google Antigravity.
|
|
4
|
+
*
|
|
5
|
+
* Antigravity plugins are the rebrand of Gemini CLI extensions. A bundle
|
|
6
|
+
* is a directory containing:
|
|
7
|
+
*
|
|
8
|
+
* plugin.json required manifest: { name, version, description }
|
|
9
|
+
* hooks.json lifecycle hook registrations (verified schema below)
|
|
10
|
+
* mcp_config.json MCP server registrations
|
|
11
|
+
* skills/ Ory skill playbooks (SKILL.md trees)
|
|
12
|
+
* commands/<ns>/ TOML slash commands
|
|
13
|
+
*
|
|
14
|
+
* Verified against `agy 1.0.13`: `agy plugin validate <dir>` accepts this
|
|
15
|
+
* layout and reports `hooks`, `mcpServers`, `skills`, and `commands` as
|
|
16
|
+
* recognized components.
|
|
17
|
+
*
|
|
18
|
+
* hooks.json shape (verified): top-level rule id → event name → array of
|
|
19
|
+
* `{ matcher, hooks: [{ type, command, timeout }] }`.
|
|
20
|
+
*/
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
38
|
+
var ownKeys = function(o) {
|
|
39
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
40
|
+
var ar = [];
|
|
41
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
42
|
+
return ar;
|
|
43
|
+
};
|
|
44
|
+
return ownKeys(o);
|
|
45
|
+
};
|
|
46
|
+
return function (mod) {
|
|
47
|
+
if (mod && mod.__esModule) return mod;
|
|
48
|
+
var result = {};
|
|
49
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
50
|
+
__setModuleDefault(result, mod);
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.PLUGIN_NAME = void 0;
|
|
56
|
+
exports.installAntigravityOryAssets = installAntigravityOryAssets;
|
|
57
|
+
exports.uninstallAntigravityOryAssets = uninstallAntigravityOryAssets;
|
|
58
|
+
const fs = __importStar(require("node:fs"));
|
|
59
|
+
const path = __importStar(require("node:path"));
|
|
60
|
+
const argus_1 = require("@ory/argus");
|
|
61
|
+
const PACKAGE_NAME = "@ory/antigravity";
|
|
62
|
+
const HOOK_BIN_NAME = "ory-antigravity-hook";
|
|
63
|
+
const MCP_PACKAGE_NAME = "@ory/mcp-server";
|
|
64
|
+
const MCP_BIN_NAME = "ory-mcp-server";
|
|
65
|
+
/** Plugin / rule / MCP-server id. */
|
|
66
|
+
exports.PLUGIN_NAME = "ory";
|
|
67
|
+
const RENDER_OPTS = {
|
|
68
|
+
binName: "ory-antigravity",
|
|
69
|
+
packageName: PACKAGE_NAME,
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Subdir under `commands/`. The folder name becomes the slash-command
|
|
73
|
+
* namespace, so `commands/ory/local-up.toml` is exposed as `/ory:local-up`.
|
|
74
|
+
*/
|
|
75
|
+
const CMD_SUBDIR = "ory";
|
|
76
|
+
/** Read the plugin's own version, walking up from dist/cli to the root. */
|
|
77
|
+
function readPackageVersion() {
|
|
78
|
+
const pkgPath = path.resolve(__dirname, "..", "..", "package.json");
|
|
79
|
+
const parsed = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
80
|
+
if (!parsed.version)
|
|
81
|
+
throw new Error(`Could not read version from ${pkgPath}`);
|
|
82
|
+
return parsed.version;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Render hooks.json. The hook command is a self-contained
|
|
86
|
+
* `npx -y -p @ory/antigravity@<version> ory-antigravity-hook` so the
|
|
87
|
+
* binary need not be on PATH after install. `matcher: ".*"` matches every
|
|
88
|
+
* tool name on the tool events.
|
|
89
|
+
*/
|
|
90
|
+
function renderHooks(version) {
|
|
91
|
+
const command = `npx -y -p ${PACKAGE_NAME}@${version} ${HOOK_BIN_NAME}`;
|
|
92
|
+
const entry = (matcher, timeout) => [
|
|
93
|
+
{ matcher, hooks: [{ type: "command", command, timeout }] },
|
|
94
|
+
];
|
|
95
|
+
return {
|
|
96
|
+
[exports.PLUGIN_NAME]: {
|
|
97
|
+
SessionStart: entry(".*", 10000),
|
|
98
|
+
SessionEnd: entry(".*", 5000),
|
|
99
|
+
PreToolUse: entry(".*", 5000),
|
|
100
|
+
PostToolUse: entry(".*", 5000),
|
|
101
|
+
Notification: entry(".*", 5000),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Render plugin.json (required manifest). */
|
|
106
|
+
function renderManifest(version) {
|
|
107
|
+
return {
|
|
108
|
+
name: exports.PLUGIN_NAME,
|
|
109
|
+
version,
|
|
110
|
+
description: "Ory authentication, authorization, and distributed tracing for Google Antigravity",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Render mcp_config.json. Antigravity uses the standard `mcpServers` map;
|
|
115
|
+
* stdio servers use `command` + `args` (remote servers would use
|
|
116
|
+
* `serverUrl`). The Ory MCP server is resolved via npx for the same
|
|
117
|
+
* reason as the hook command.
|
|
118
|
+
*/
|
|
119
|
+
function renderMcpConfig(version) {
|
|
120
|
+
return {
|
|
121
|
+
mcpServers: {
|
|
122
|
+
[exports.PLUGIN_NAME]: {
|
|
123
|
+
command: "npx",
|
|
124
|
+
args: ["-y", "-p", `${MCP_PACKAGE_NAME}@${version}`, MCP_BIN_NAME],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Write the full Ory plugin bundle under `root`. Used both for the
|
|
131
|
+
* bundle handed to `agy plugin install` and for the manual `.agents`
|
|
132
|
+
* fallback.
|
|
133
|
+
*/
|
|
134
|
+
function installAntigravityOryAssets(root) {
|
|
135
|
+
const version = readPackageVersion();
|
|
136
|
+
fs.mkdirSync(root, { recursive: true });
|
|
137
|
+
const skillsDir = path.join(root, "skills");
|
|
138
|
+
fs.rmSync(skillsDir, { recursive: true, force: true });
|
|
139
|
+
(0, argus_1.writeSkillTree)(skillsDir, (0, argus_1.renderOrySkills)("antigravity", RENDER_OPTS));
|
|
140
|
+
const cmdDir = path.join(root, "commands", CMD_SUBDIR);
|
|
141
|
+
fs.rmSync(cmdDir, { recursive: true, force: true });
|
|
142
|
+
fs.mkdirSync(cmdDir, { recursive: true });
|
|
143
|
+
for (const cmd of (0, argus_1.renderOryCommands)("antigravity", RENDER_OPTS)) {
|
|
144
|
+
fs.writeFileSync(path.join(cmdDir, `${cmd.slug}.toml`), (0, argus_1.commandToToml)(cmd));
|
|
145
|
+
}
|
|
146
|
+
fs.writeFileSync(path.join(root, "hooks.json"), JSON.stringify(renderHooks(version), null, 2) + "\n");
|
|
147
|
+
fs.writeFileSync(path.join(root, "mcp_config.json"), JSON.stringify(renderMcpConfig(version), null, 2) + "\n");
|
|
148
|
+
fs.writeFileSync(path.join(root, "plugin.json"), JSON.stringify(renderManifest(version), null, 2) + "\n");
|
|
149
|
+
}
|
|
150
|
+
function safeRmEmpty(dir) {
|
|
151
|
+
try {
|
|
152
|
+
if (fs.existsSync(dir) && fs.readdirSync(dir).length === 0) {
|
|
153
|
+
fs.rmdirSync(dir);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
/* leave the dir if removal fails */
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Remove every Ory skill, command, and bundle file written under `root`. */
|
|
161
|
+
function uninstallAntigravityOryAssets(root) {
|
|
162
|
+
const skillsDir = path.join(root, "skills");
|
|
163
|
+
if (fs.existsSync(skillsDir)) {
|
|
164
|
+
(0, argus_1.removeSkillDirs)(skillsDir, argus_1.ORY_SKILL_NAMES);
|
|
165
|
+
safeRmEmpty(skillsDir);
|
|
166
|
+
}
|
|
167
|
+
const cmdDir = path.join(root, "commands", CMD_SUBDIR);
|
|
168
|
+
if (fs.existsSync(cmdDir)) {
|
|
169
|
+
for (const slug of argus_1.ORY_COMMAND_SLUGS) {
|
|
170
|
+
const f = path.join(cmdDir, `${slug}.toml`);
|
|
171
|
+
if (fs.existsSync(f))
|
|
172
|
+
fs.unlinkSync(f);
|
|
173
|
+
}
|
|
174
|
+
safeRmEmpty(cmdDir);
|
|
175
|
+
safeRmEmpty(path.join(root, "commands"));
|
|
176
|
+
}
|
|
177
|
+
for (const f of ["hooks.json", "mcp_config.json", "plugin.json"]) {
|
|
178
|
+
const p = path.join(root, f);
|
|
179
|
+
if (fs.existsSync(p))
|
|
180
|
+
fs.unlinkSync(p);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Main CLI for @ory/antigravity.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx ory-antigravity install Install the Ory plugin into Antigravity
|
|
7
|
+
* npx ory-antigravity uninstall Remove the plugin
|
|
8
|
+
* npx ory-antigravity configure Set or view Ory credentials
|
|
9
|
+
* npx ory-antigravity setup [--project-dir] Write the bundle into .agents (fallback)
|
|
10
|
+
* npx ory-antigravity status Show plugin status
|
|
11
|
+
*/
|
|
12
|
+
export {};
|