@a2a-exposed/control-core 0.0.0-stage → 0.7.33
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 +21 -0
- package/README.md +64 -2
- package/control/migrations/.gitkeep +0 -0
- package/control/migrations/0001_auth.sql +56 -0
- package/control/migrations/0002_tenants.sql +25 -0
- package/control/migrations/0003_oidc.sql +30 -0
- package/control/migrations/0004_device.sql +14 -0
- package/control/migrations/0005_agent_limit.sql +11 -0
- package/control/migrations/0006_agent_limit_account.sql +28 -0
- package/control/migrations/0007_outbox_lock.sql +10 -0
- package/control/migrations/0008_account_provider.sql +18 -0
- package/control/migrations/0009_feedback_rate.sql +8 -0
- package/control/migrations/0010_cloudflare_grant.sql +14 -0
- package/control/migrations/0011_cloudflare_inbox.sql +16 -0
- package/control/migrations/0012_cloudflare_inbox_tag.sql +4 -0
- package/control/migrations/0013_cloudflare_inbox_wizard.sql +7 -0
- package/control/migrations/0014_cloudflare_inbox_agent.sql +38 -0
- package/dist/index.js +2768 -0
- package/dist/types/control/src/auth/cloudflare-setup.d.ts +78 -0
- package/dist/types/control/src/auth/invites.d.ts +38 -0
- package/dist/types/control/src/core/index.d.ts +29 -0
- package/dist/types/control/src/core/migrations.d.ts +7 -0
- package/dist/types/control/src/core/routes.d.ts +5 -0
- package/dist/types/control/src/env.d.ts +53 -0
- package/dist/types/control/src/provision/cloudflare-api.d.ts +230 -0
- package/dist/types/control/src/provision/inbox-migrations.d.ts +3 -0
- package/dist/types/control/src/provision/inbox-row.d.ts +33 -0
- package/dist/types/control/src/provision/inbox.d.ts +142 -0
- package/dist/types/control/src/provision/names.d.ts +15 -0
- package/dist/types/control/src/provision/permission-wait.d.ts +2 -0
- package/dist/types/control/src/provision/remove.d.ts +36 -0
- package/dist/types/control/src/provision/statements.d.ts +2 -0
- package/dist/types/control/src/routing.d.ts +1 -0
- package/dist/types/control/src/tenants/create.d.ts +43 -0
- package/dist/types/control/src/tenants/delete.d.ts +20 -0
- package/dist/types/control/src/tenants/push.d.ts +102 -0
- package/dist/types/control/src/tenants/reserved.d.ts +5 -0
- package/dist/types/control/src/tenants/rotate.d.ts +24 -0
- package/dist/types/control/src/tenants/wake-secrets.d.ts +20 -0
- package/dist/types/control/src/tenants/wake.d.ts +43 -0
- package/package.json +33 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Telegraphic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# a2a-exposed
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/a2a-exposed) [](https://github.com/telegraphic-dev/a2a-exposed/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
a2a-exposed gives an AI agent a public [A2A](https://a2a-protocol.org) address. A Cloudflare Worker serves the agent card and the JSON-RPC endpoint. Inbound messages become tasks in an inbox. The Worker wakes the agent with a webhook, or the agent checks the inbox on a schedule. The agent reads the inbox and replies with `npx -y a2a-exposed@latest`. The same command sends messages to other A2A agents (1.0 or 0.3).
|
|
6
|
+
|
|
7
|
+
## Who it's for
|
|
8
|
+
|
|
9
|
+
Agents that can call out over HTTP and cannot run a public server: hosted assistants, coding agents, routines, and chat bots. Peers discover the card at `https://<host>/.well-known/agent-card.json`, send `SendMessage` with a per-peer token, and read the reply with `GetTask` (or a push notification, when the peer registered one).
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
Requires Node 22.18+. The skills are installed into the project the agent works in. They do not install the CLI. Every command runs through npx.
|
|
14
|
+
|
|
15
|
+
1. **Add the skills to the project**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y skills add telegraphic-dev/a2a-exposed
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Deploy an inbox** in your Cloudflare account
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx cf auth login --no-browser
|
|
25
|
+
npx -y a2a-exposed@latest init --hostname agent.example.com --agent-name "My Agent"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Omit `--hostname` to serve on `*.workers.dev`. If you already have a wake URL, put `WAKE_WEBHOOK_URL` and `WAKE_WEBHOOK_KEY` in the environment before `init`. Never pass secrets on the command line.
|
|
29
|
+
|
|
30
|
+
3. **Check the deployment, then let peers connect**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx -y a2a-exposed@latest status
|
|
34
|
+
npx -y a2a-exposed@latest pair set-password --web
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`status` is read-only and prints the next step. Open the one-time link and choose the approval password yourself. Another agent then runs `npx -y a2a-exposed@latest connect https://agent.example.com`. You approve that request on the `/device` page.
|
|
38
|
+
|
|
39
|
+
After the skill is in the project, you can ask the agent to set this up. It follows the setup skill. Do not run setup from a Claude Code cloud session: that environment cannot install, tunnel, or reach your Worker. [Getting started](docs/getting-started.md) has Node, skills for other agents, and what to do if setup stops halfway.
|
|
40
|
+
|
|
41
|
+
## Hosted
|
|
42
|
+
|
|
43
|
+
[a2a.exposed](https://a2a.exposed) runs the inbox for you. It is free during beta. Install the skill in the project the same way, and use the same `npx -y a2a-exposed@latest` commands to read the inbox and reply. Self-hosting on your own Cloudflare account is the quick start above.
|
|
44
|
+
|
|
45
|
+
## Docs
|
|
46
|
+
|
|
47
|
+
| | |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| [Getting started](docs/getting-started.md) | Skills, Node, first deploy, pairing |
|
|
50
|
+
| [Receiving messages](docs/receiving-messages.md) | Webhooks (main path) and polling (fallback) |
|
|
51
|
+
| [Self-hosting](docs/self-hosting.md) | Cloudflare inbox, workers.dev, tunnel, public façade |
|
|
52
|
+
| [CLI](docs/cli.md) | Commands, flags, config |
|
|
53
|
+
| [MCP](docs/mcp.md) | Remote connector at `/mcp` |
|
|
54
|
+
| [Feedback](docs/feedback.md) | Report a bug or an idea |
|
|
55
|
+
| [Security](docs/security.md) | Tokens, pairing, wakes, façade |
|
|
56
|
+
| [Troubleshooting](docs/troubleshooting.md) | FAQ and common failures |
|
|
57
|
+
| [Upgrading](docs/upgrading.md) | Move an existing inbox forward |
|
|
58
|
+
| [Protocol](docs/protocol.md) | A2A 1.0 and 0.3, OAuth, endpoints |
|
|
59
|
+
| [Control plane](docs/control-plane.md) | Hosted accounts, sign-in, multi-tenant settings |
|
|
60
|
+
|
|
61
|
+
Changes are listed in [CHANGELOG.md](CHANGELOG.md). Agent workflows live in [`skills/`](skills/a2a-exposed/SKILL.md).
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT, see [LICENSE](LICENSE). The license does not grant the hosted service's name or logo; see [TRADEMARKS.md](TRADEMARKS.md).
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
-- Better Auth 1.7.7 (SQLite) plus invite codes. Append-only: do not edit this file.
|
|
2
|
+
CREATE TABLE IF NOT EXISTS "user" (
|
|
3
|
+
"id" text not null primary key,
|
|
4
|
+
"name" text not null,
|
|
5
|
+
"email" text not null unique,
|
|
6
|
+
"emailVerified" integer not null,
|
|
7
|
+
"image" text,
|
|
8
|
+
"createdAt" date not null,
|
|
9
|
+
"updatedAt" date not null
|
|
10
|
+
);
|
|
11
|
+
CREATE TABLE IF NOT EXISTS "session" (
|
|
12
|
+
"id" text not null primary key,
|
|
13
|
+
"expiresAt" date not null,
|
|
14
|
+
"token" text not null unique,
|
|
15
|
+
"createdAt" date not null,
|
|
16
|
+
"updatedAt" date not null,
|
|
17
|
+
"ipAddress" text,
|
|
18
|
+
"userAgent" text,
|
|
19
|
+
"userId" text not null references "user" ("id") on delete cascade
|
|
20
|
+
);
|
|
21
|
+
CREATE TABLE IF NOT EXISTS "account" (
|
|
22
|
+
"id" text not null primary key,
|
|
23
|
+
"accountId" text not null,
|
|
24
|
+
"providerId" text not null,
|
|
25
|
+
"userId" text not null references "user" ("id") on delete cascade,
|
|
26
|
+
"accessToken" text,
|
|
27
|
+
"refreshToken" text,
|
|
28
|
+
"idToken" text,
|
|
29
|
+
"accessTokenExpiresAt" date,
|
|
30
|
+
"refreshTokenExpiresAt" date,
|
|
31
|
+
"scope" text,
|
|
32
|
+
"password" text,
|
|
33
|
+
"createdAt" date not null,
|
|
34
|
+
"updatedAt" date not null
|
|
35
|
+
);
|
|
36
|
+
CREATE TABLE IF NOT EXISTS "verification" (
|
|
37
|
+
"id" text not null primary key,
|
|
38
|
+
"identifier" text not null,
|
|
39
|
+
"value" text not null,
|
|
40
|
+
"expiresAt" date not null,
|
|
41
|
+
"createdAt" date not null,
|
|
42
|
+
"updatedAt" date not null
|
|
43
|
+
);
|
|
44
|
+
CREATE INDEX IF NOT EXISTS "session_userId_idx" ON "session" ("userId");
|
|
45
|
+
CREATE INDEX IF NOT EXISTS "account_userId_idx" ON "account" ("userId");
|
|
46
|
+
CREATE INDEX IF NOT EXISTS "verification_identifier_idx" ON "verification" ("identifier");
|
|
47
|
+
|
|
48
|
+
-- Invite codes for an invite-only deployment. Unused unless INVITES_REQUIRED=1.
|
|
49
|
+
CREATE TABLE IF NOT EXISTS invites (
|
|
50
|
+
code TEXT PRIMARY KEY,
|
|
51
|
+
email TEXT,
|
|
52
|
+
created_at TEXT NOT NULL,
|
|
53
|
+
expires_at TEXT,
|
|
54
|
+
used_at TEXT,
|
|
55
|
+
used_email TEXT
|
|
56
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Tenants and the config outbox. Append-only: do not edit this file.
|
|
2
|
+
-- Control D1 is the only writer. The data plane receives a copy through pushConfig.
|
|
3
|
+
CREATE TABLE IF NOT EXISTS tenants (
|
|
4
|
+
id TEXT PRIMARY KEY,
|
|
5
|
+
name TEXT NOT NULL UNIQUE,
|
|
6
|
+
owner_account_id TEXT NOT NULL,
|
|
7
|
+
status TEXT NOT NULL,
|
|
8
|
+
region TEXT NOT NULL,
|
|
9
|
+
config_json TEXT NOT NULL,
|
|
10
|
+
limits_json TEXT NOT NULL,
|
|
11
|
+
approval_json TEXT NOT NULL,
|
|
12
|
+
owner_token_hash TEXT NOT NULL,
|
|
13
|
+
secrets_enc TEXT,
|
|
14
|
+
config_version INTEGER NOT NULL,
|
|
15
|
+
created_at TEXT NOT NULL,
|
|
16
|
+
updated_at TEXT NOT NULL
|
|
17
|
+
);
|
|
18
|
+
CREATE INDEX IF NOT EXISTS tenants_owner_idx ON tenants (owner_account_id);
|
|
19
|
+
|
|
20
|
+
CREATE TABLE IF NOT EXISTS config_outbox (
|
|
21
|
+
tenant_id TEXT NOT NULL,
|
|
22
|
+
version INTEGER NOT NULL,
|
|
23
|
+
created_at TEXT NOT NULL,
|
|
24
|
+
PRIMARY KEY (tenant_id, version)
|
|
25
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- OpenID Connect issuer keys and per-tenant clients. Append-only: do not edit this file.
|
|
2
|
+
-- `jwks` matches Better Auth's JWT plugin (RS256). The private key is encrypted by that plugin.
|
|
3
|
+
CREATE TABLE IF NOT EXISTS "jwks" (
|
|
4
|
+
"id" text not null primary key,
|
|
5
|
+
"publicKey" text not null,
|
|
6
|
+
"privateKey" text not null,
|
|
7
|
+
"createdAt" date not null,
|
|
8
|
+
"expiresAt" date,
|
|
9
|
+
"alg" text,
|
|
10
|
+
"crv" text
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE TABLE IF NOT EXISTS oauth_client (
|
|
14
|
+
id TEXT PRIMARY KEY,
|
|
15
|
+
secret_hash TEXT NOT NULL,
|
|
16
|
+
owner_account_id TEXT NOT NULL,
|
|
17
|
+
redirect_uris TEXT NOT NULL,
|
|
18
|
+
created_at TEXT NOT NULL
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
CREATE TABLE IF NOT EXISTS oauth_code (
|
|
22
|
+
code_hash TEXT PRIMARY KEY,
|
|
23
|
+
client_id TEXT NOT NULL,
|
|
24
|
+
user_id TEXT NOT NULL,
|
|
25
|
+
redirect_uri TEXT NOT NULL,
|
|
26
|
+
nonce TEXT NOT NULL,
|
|
27
|
+
challenge TEXT NOT NULL,
|
|
28
|
+
expires_at TEXT NOT NULL,
|
|
29
|
+
used_at TEXT
|
|
30
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- Device authorization codes for CLI sign-in (Better Auth device-authorization plugin).
|
|
2
|
+
-- Append-only: do not edit this file.
|
|
3
|
+
CREATE TABLE IF NOT EXISTS "deviceCode" (
|
|
4
|
+
"id" text not null primary key,
|
|
5
|
+
"deviceCode" text not null unique,
|
|
6
|
+
"userCode" text not null unique,
|
|
7
|
+
"userId" text,
|
|
8
|
+
"expiresAt" date not null,
|
|
9
|
+
"status" text not null,
|
|
10
|
+
"lastPolledAt" date,
|
|
11
|
+
"pollingInterval" integer,
|
|
12
|
+
"clientId" text,
|
|
13
|
+
"scope" text
|
|
14
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Free plan: two agents per account. The check runs inside the insert, so two
|
|
2
|
+
-- creates cannot both pass a count taken before either write.
|
|
3
|
+
-- Keep the bound in step with AGENT_LIMIT in src/tenants/create.ts.
|
|
4
|
+
-- Append-only: do not edit this file.
|
|
5
|
+
CREATE TRIGGER IF NOT EXISTS tenants_agent_limit
|
|
6
|
+
BEFORE INSERT ON tenants
|
|
7
|
+
FOR EACH ROW
|
|
8
|
+
WHEN (SELECT COUNT(*) FROM tenants WHERE owner_account_id = NEW.owner_account_id) >= 2
|
|
9
|
+
BEGIN
|
|
10
|
+
SELECT RAISE(ABORT, 'agent_limit');
|
|
11
|
+
END;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-- Per-account agent limit. Null uses control_settings.free_agent_limit, which the
|
|
2
|
+
-- app sets from FREE_AGENT_LIMIT. Both null means no limit. Replaces the constant
|
|
3
|
+
-- check in 0005 so a higher plan can raise one account without another migration.
|
|
4
|
+
-- Append-only: do not edit this file.
|
|
5
|
+
ALTER TABLE "user" ADD COLUMN agent_limit INTEGER;
|
|
6
|
+
|
|
7
|
+
CREATE TABLE IF NOT EXISTS control_settings (
|
|
8
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
9
|
+
free_agent_limit INTEGER
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
DROP TRIGGER IF EXISTS tenants_agent_limit;
|
|
13
|
+
CREATE TRIGGER tenants_agent_limit
|
|
14
|
+
BEFORE INSERT ON tenants
|
|
15
|
+
FOR EACH ROW
|
|
16
|
+
WHEN COALESCE(
|
|
17
|
+
(SELECT agent_limit FROM "user" WHERE id = NEW.owner_account_id),
|
|
18
|
+
(SELECT free_agent_limit FROM control_settings WHERE id = 1)
|
|
19
|
+
) IS NOT NULL
|
|
20
|
+
AND (
|
|
21
|
+
SELECT COUNT(*) FROM tenants WHERE owner_account_id = NEW.owner_account_id
|
|
22
|
+
) >= COALESCE(
|
|
23
|
+
(SELECT agent_limit FROM "user" WHERE id = NEW.owner_account_id),
|
|
24
|
+
(SELECT free_agent_limit FROM control_settings WHERE id = 1)
|
|
25
|
+
)
|
|
26
|
+
BEGIN
|
|
27
|
+
SELECT RAISE(ABORT, 'agent_limit');
|
|
28
|
+
END;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- One lock for config delivery and agent delete. A flush that already loaded a row must not
|
|
2
|
+
-- write the directory or the tenant object while delete is wiping them, and delete must not
|
|
3
|
+
-- start that wipe while a delivery is still writing. Append-only: do not edit this file.
|
|
4
|
+
CREATE TABLE IF NOT EXISTS control_locks (
|
|
5
|
+
name TEXT PRIMARY KEY,
|
|
6
|
+
holder TEXT NOT NULL,
|
|
7
|
+
expires_ms INTEGER NOT NULL
|
|
8
|
+
);
|
|
9
|
+
INSERT INTO control_locks (name, holder, expires_ms) VALUES ('outbox', '', 0)
|
|
10
|
+
ON CONFLICT(name) DO NOTHING;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- One external account identity belongs to one user. Two connect callbacks can
|
|
2
|
+
-- both insert the same providerId and accountId. Those rows have to go before
|
|
3
|
+
-- the unique index, or this migration fails and deploy stops. Keep the earliest
|
|
4
|
+
-- row (then the lowest id). The user row stays. Append-only: do not edit this file.
|
|
5
|
+
DELETE FROM "account"
|
|
6
|
+
WHERE "id" NOT IN (
|
|
7
|
+
SELECT "id" FROM "account" AS "candidate"
|
|
8
|
+
WHERE NOT EXISTS (
|
|
9
|
+
SELECT 1 FROM "account" AS "earlier"
|
|
10
|
+
WHERE "earlier"."providerId" = "candidate"."providerId"
|
|
11
|
+
AND "earlier"."accountId" = "candidate"."accountId"
|
|
12
|
+
AND (
|
|
13
|
+
"earlier"."createdAt" < "candidate"."createdAt"
|
|
14
|
+
OR ("earlier"."createdAt" = "candidate"."createdAt" AND "earlier"."id" < "candidate"."id")
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "account_provider_account_idx" ON "account" ("providerId", "accountId");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Per-address and per-owner-token counters for POST /api/feedback.
|
|
2
|
+
-- Append-only: do not edit this file.
|
|
3
|
+
CREATE TABLE IF NOT EXISTS feedback_rate (
|
|
4
|
+
bucket TEXT NOT NULL,
|
|
5
|
+
window_start INTEGER NOT NULL,
|
|
6
|
+
count INTEGER NOT NULL,
|
|
7
|
+
PRIMARY KEY (bucket, window_start)
|
|
8
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- Setup consent for "Set me up on Cloudflare". refresh_enc is the sealed
|
|
2
|
+
-- refresh token. The access token is not stored. Append-only: do not edit this file.
|
|
3
|
+
CREATE TABLE IF NOT EXISTS cloudflare_grant (
|
|
4
|
+
"userId" TEXT NOT NULL PRIMARY KEY REFERENCES "user" ("id") ON DELETE CASCADE,
|
|
5
|
+
"accountId" TEXT NOT NULL,
|
|
6
|
+
choice TEXT NOT NULL,
|
|
7
|
+
host TEXT NOT NULL,
|
|
8
|
+
requested_scope TEXT NOT NULL,
|
|
9
|
+
granted_scope TEXT,
|
|
10
|
+
refresh_enc TEXT,
|
|
11
|
+
access_expires_at TEXT,
|
|
12
|
+
created_at TEXT NOT NULL,
|
|
13
|
+
updated_at TEXT NOT NULL
|
|
14
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- An inbox this dashboard created in the user's Cloudflare account.
|
|
2
|
+
-- The owner token is stored only as a SHA-256 hash. Append-only: do not edit this file.
|
|
3
|
+
CREATE TABLE IF NOT EXISTS cloudflare_inbox (
|
|
4
|
+
"userId" TEXT NOT NULL PRIMARY KEY REFERENCES "user" ("id") ON DELETE CASCADE,
|
|
5
|
+
cf_account_id TEXT NOT NULL,
|
|
6
|
+
worker_name TEXT NOT NULL,
|
|
7
|
+
d1_name TEXT NOT NULL,
|
|
8
|
+
d1_id TEXT,
|
|
9
|
+
public_url TEXT,
|
|
10
|
+
owner_token_hash TEXT,
|
|
11
|
+
host TEXT NOT NULL,
|
|
12
|
+
hostname TEXT,
|
|
13
|
+
status TEXT NOT NULL,
|
|
14
|
+
created_at TEXT NOT NULL,
|
|
15
|
+
updated_at TEXT NOT NULL
|
|
16
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Wizard progress for an inbox this page creates.
|
|
2
|
+
-- wizard_step is the last step that passed. step_error is a short sanitised note.
|
|
3
|
+
-- workers_subdomain is the account workers.dev name once it is known.
|
|
4
|
+
-- Append-only: do not edit this file.
|
|
5
|
+
ALTER TABLE cloudflare_inbox ADD COLUMN wizard_step TEXT;
|
|
6
|
+
ALTER TABLE cloudflare_inbox ADD COLUMN workers_subdomain TEXT;
|
|
7
|
+
ALTER TABLE cloudflare_inbox ADD COLUMN step_error TEXT;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- An account can have more than one Cloudflare agent. The old primary key was userId.
|
|
2
|
+
-- Those rows keep that value as id. zone_id is the domain this setup attached, when it did.
|
|
3
|
+
-- Append-only: do not edit this file.
|
|
4
|
+
CREATE TABLE cloudflare_inbox_agent (
|
|
5
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"userId" TEXT NOT NULL REFERENCES "user" ("id") ON DELETE CASCADE,
|
|
7
|
+
cf_account_id TEXT NOT NULL,
|
|
8
|
+
worker_name TEXT NOT NULL,
|
|
9
|
+
d1_name TEXT NOT NULL,
|
|
10
|
+
d1_id TEXT,
|
|
11
|
+
public_url TEXT,
|
|
12
|
+
owner_token_hash TEXT,
|
|
13
|
+
host TEXT NOT NULL,
|
|
14
|
+
hostname TEXT,
|
|
15
|
+
status TEXT NOT NULL,
|
|
16
|
+
script_tag TEXT,
|
|
17
|
+
wizard_step TEXT,
|
|
18
|
+
workers_subdomain TEXT,
|
|
19
|
+
step_error TEXT,
|
|
20
|
+
zone_id TEXT,
|
|
21
|
+
created_at TEXT NOT NULL,
|
|
22
|
+
updated_at TEXT NOT NULL
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
INSERT INTO cloudflare_inbox_agent (
|
|
26
|
+
id, "userId", cf_account_id, worker_name, d1_name, d1_id, public_url, owner_token_hash,
|
|
27
|
+
host, hostname, status, script_tag, wizard_step, workers_subdomain, step_error, zone_id,
|
|
28
|
+
created_at, updated_at
|
|
29
|
+
)
|
|
30
|
+
SELECT
|
|
31
|
+
"userId", "userId", cf_account_id, worker_name, d1_name, d1_id, public_url, owner_token_hash,
|
|
32
|
+
host, hostname, status, script_tag, wizard_step, workers_subdomain, step_error, NULL,
|
|
33
|
+
created_at, updated_at
|
|
34
|
+
FROM cloudflare_inbox;
|
|
35
|
+
|
|
36
|
+
DROP TABLE cloudflare_inbox;
|
|
37
|
+
ALTER TABLE cloudflare_inbox_agent RENAME TO cloudflare_inbox;
|
|
38
|
+
CREATE INDEX IF NOT EXISTS cloudflare_inbox_user_idx ON cloudflare_inbox ("userId", created_at);
|