@caelo-cms/provisioning 0.12.7 → 0.12.9
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/dist/agent-db.js
CHANGED
|
@@ -9261,6 +9261,26 @@ var LIVE_TOPICS = [
|
|
|
9261
9261
|
var TOPIC_SET = new Set(LIVE_TOPICS);
|
|
9262
9262
|
// ../shared/src/markup-structure.ts
|
|
9263
9263
|
var LEAF_TAGS = new Set(["svg", "math", "script", "style", "noscript", "iframe"]);
|
|
9264
|
+
// ../shared/src/mcp-access.ts
|
|
9265
|
+
var MCP_SURFACE_NAMES = ["chat", "power"];
|
|
9266
|
+
var LEGACY_POWER_SURFACE_NAME = "admin";
|
|
9267
|
+
var MCP_ADDRESS_NAMES = [
|
|
9268
|
+
...MCP_SURFACE_NAMES,
|
|
9269
|
+
LEGACY_POWER_SURFACE_NAME
|
|
9270
|
+
];
|
|
9271
|
+
var AI_WORK_PERMISSION = "content.write";
|
|
9272
|
+
var MCP_SURFACE_COPY = {
|
|
9273
|
+
chat: {
|
|
9274
|
+
title: "Chat with this site's AI",
|
|
9275
|
+
does: "The AI tool sends requests to Caelo's own AI, which builds and edits the site like the Live Edit chat does.",
|
|
9276
|
+
who: `Everyone who may edit content (${AI_WORK_PERMISSION}).`
|
|
9277
|
+
},
|
|
9278
|
+
power: {
|
|
9279
|
+
title: "Power-MCP: your AI tool does the work",
|
|
9280
|
+
does: "The AI tool gets every tool Caelo's AI has and does the work itself, on its own AI subscription, in the site's draft. Approval-gated actions still wait for a click in Caelo from someone whose role allows that change.",
|
|
9281
|
+
who: `Everyone who may edit content (${AI_WORK_PERMISSION}).`
|
|
9282
|
+
}
|
|
9283
|
+
};
|
|
9264
9284
|
// ../shared/src/owner-setup-token.ts
|
|
9265
9285
|
var OwnerBootstrapTokenSchema = object({
|
|
9266
9286
|
token: string2().regex(/^[0-9a-f]{64}$/),
|
|
@@ -19485,15 +19505,19 @@ function provisionedSchemaName(caller, ddl) {
|
|
|
19485
19505
|
async function provisionPluginSchemaInTx(tx, caller, opts) {
|
|
19486
19506
|
const schemaName = provisionedSchemaName(caller, opts.sql);
|
|
19487
19507
|
const digest = createHash("sha256").update(opts.sql).digest("hex");
|
|
19488
|
-
await tx.execute(sql
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
const recorded = await tx.execute(sql`
|
|
19492
|
-
SELECT 1 FROM plugin_schema_provisions
|
|
19493
|
-
WHERE schema_name = ${schemaName} AND sql_digest = ${digest}
|
|
19494
|
-
AND to_regnamespace(${schemaName}) IS NOT NULL
|
|
19508
|
+
await tx.execute(sql`
|
|
19509
|
+
SELECT set_config('caelo.actor_kind', 'system', true),
|
|
19510
|
+
set_config('caelo.plugin_id', ${opts.pluginId}, true)
|
|
19495
19511
|
`);
|
|
19496
|
-
|
|
19512
|
+
const provisioned = async () => (await tx.execute(sql`
|
|
19513
|
+
SELECT 1 FROM plugin_schema_provisions
|
|
19514
|
+
WHERE schema_name = ${schemaName} AND sql_digest = ${digest}
|
|
19515
|
+
AND to_regnamespace(${schemaName}) IS NOT NULL
|
|
19516
|
+
`)).length > 0;
|
|
19517
|
+
if (await provisioned())
|
|
19518
|
+
return { schemaName, droppedColumns: [] };
|
|
19519
|
+
await tx.execute(sql`SELECT pg_advisory_xact_lock(hashtextextended(${`caelo:plugin-schema:${schemaName}`}, 0))`);
|
|
19520
|
+
if (await provisioned())
|
|
19497
19521
|
return { schemaName, droppedColumns: [] };
|
|
19498
19522
|
await tx.execute(sql.raw(opts.sql));
|
|
19499
19523
|
const dropped = await tx.execute(sql.raw(`SELECT coalesce(current_setting('${DROPPED_COLUMNS_SETTING}', true), '') AS v`));
|
|
@@ -36,8 +36,16 @@
|
|
|
36
36
|
*/
|
|
37
37
|
/**
|
|
38
38
|
* The paths the MCP rule covers, as an anchored RE2 pattern (Cloud Armor's
|
|
39
|
-
* `matches`): the
|
|
40
|
-
*
|
|
39
|
+
* `matches`): the MCP endpoints (`chat`, `power`, and `admin`, the Power
|
|
40
|
+
* surface's address before #1636) and the broker's `oauth/<name>` and
|
|
41
|
+
* `oauth/<name>/<address>` routes — lowercase letters and hyphens only.
|
|
42
|
+
*
|
|
43
|
+
* A path the pattern does not name is still served: the proxy's policy has
|
|
44
|
+
* no other rule, so it falls to the default (allow) and meets the proxy's
|
|
45
|
+
* own rate limit (apps/mcp-auth-proxy rate-limit.ts), which is the same
|
|
46
|
+
* 600 a minute. That is why #1636 could add `power` without a contract
|
|
47
|
+
* bump: an install gets the edge throttle for it with its next converge,
|
|
48
|
+
* and nothing depends on it until then (epic #763, decision E3).
|
|
41
49
|
*
|
|
42
50
|
* Deliberately not a prefix match. A `startsWith('/api/mcp/')` rule also
|
|
43
51
|
* matches `/api/mcp/../forms/submit` or `/api/mcp/%2e%2e/comments`, which
|
|
@@ -48,7 +56,7 @@
|
|
|
48
56
|
* The dotted metadata aliases (`/.well-known/…`, `oauth/.well-known/…`) are
|
|
49
57
|
* one-off GETs per connection and stay under the general rules.
|
|
50
58
|
*/
|
|
51
|
-
export declare const MCP_ARMOR_PATH_PATTERN = "^/api/mcp/(?:chat|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$";
|
|
59
|
+
export declare const MCP_ARMOR_PATH_PATTERN = "^/api/mcp/(?:chat|power|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$";
|
|
52
60
|
/** The general per-IP ban rule and the OWASP rule packs the MCP rule must precede. */
|
|
53
61
|
export declare const GENERAL_RATE_LIMIT_PRIORITY = 1000;
|
|
54
62
|
export declare const OWASP_RULE_PRIORITIES: readonly number[];
|
|
@@ -56,7 +64,7 @@ export declare const OWASP_RULE_PRIORITIES: readonly number[];
|
|
|
56
64
|
export declare const MCP_ARMOR_RULE: {
|
|
57
65
|
readonly priority: 900;
|
|
58
66
|
readonly description: "Caelo remote MCP: per-IP throttle sized for agent traffic; skips the OWASP packs";
|
|
59
|
-
readonly expression: "request.path.matches('^/api/mcp/(?:chat|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$')";
|
|
67
|
+
readonly expression: "request.path.matches('^/api/mcp/(?:chat|power|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$')";
|
|
60
68
|
readonly action: "throttle";
|
|
61
69
|
/** Requests per {@link MCP_ARMOR_RULE.intervalSec} per source IP. */
|
|
62
70
|
readonly count: 600;
|
|
@@ -72,7 +80,7 @@ export declare function mcpArmorRuleArgs(): {
|
|
|
72
80
|
description: "Caelo remote MCP: per-IP throttle sized for agent traffic; skips the OWASP packs";
|
|
73
81
|
match: {
|
|
74
82
|
expr: {
|
|
75
|
-
expression: "request.path.matches('^/api/mcp/(?:chat|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$')";
|
|
83
|
+
expression: "request.path.matches('^/api/mcp/(?:chat|power|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$')";
|
|
76
84
|
};
|
|
77
85
|
};
|
|
78
86
|
rateLimitOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-mcp-edge.d.ts","sourceRoot":"","sources":["../src/remote-mcp-edge.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH
|
|
1
|
+
{"version":3,"file":"remote-mcp-edge.d.ts","sourceRoot":"","sources":["../src/remote-mcp-edge.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,sBAAsB,+DAA+D,CAAC;AAEnG,sFAAsF;AACtF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAChD,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAiB,CAAC;AAErE,0FAA0F;AAC1F,eAAO,MAAM,cAAc;;;;;IAKzB,qEAAqE;;;;;;CAM7D,CAAC;AAEX,qFAAqF;AACrF,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;EAc/B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAa5C;AAED,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACtE,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAC1B,QAAQ,CAAC,kBAAkB,CAAC,EAAE;YAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAa3D"}
|
package/dist/remote-mcp-edge.js
CHANGED
|
@@ -37,8 +37,16 @@
|
|
|
37
37
|
*/
|
|
38
38
|
/**
|
|
39
39
|
* The paths the MCP rule covers, as an anchored RE2 pattern (Cloud Armor's
|
|
40
|
-
* `matches`): the
|
|
41
|
-
*
|
|
40
|
+
* `matches`): the MCP endpoints (`chat`, `power`, and `admin`, the Power
|
|
41
|
+
* surface's address before #1636) and the broker's `oauth/<name>` and
|
|
42
|
+
* `oauth/<name>/<address>` routes — lowercase letters and hyphens only.
|
|
43
|
+
*
|
|
44
|
+
* A path the pattern does not name is still served: the proxy's policy has
|
|
45
|
+
* no other rule, so it falls to the default (allow) and meets the proxy's
|
|
46
|
+
* own rate limit (apps/mcp-auth-proxy rate-limit.ts), which is the same
|
|
47
|
+
* 600 a minute. That is why #1636 could add `power` without a contract
|
|
48
|
+
* bump: an install gets the edge throttle for it with its next converge,
|
|
49
|
+
* and nothing depends on it until then (epic #763, decision E3).
|
|
42
50
|
*
|
|
43
51
|
* Deliberately not a prefix match. A `startsWith('/api/mcp/')` rule also
|
|
44
52
|
* matches `/api/mcp/../forms/submit` or `/api/mcp/%2e%2e/comments`, which
|
|
@@ -49,7 +57,7 @@
|
|
|
49
57
|
* The dotted metadata aliases (`/.well-known/…`, `oauth/.well-known/…`) are
|
|
50
58
|
* one-off GETs per connection and stay under the general rules.
|
|
51
59
|
*/
|
|
52
|
-
export const MCP_ARMOR_PATH_PATTERN = "^/api/mcp/(?:chat|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$";
|
|
60
|
+
export const MCP_ARMOR_PATH_PATTERN = "^/api/mcp/(?:chat|power|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$";
|
|
53
61
|
/** The general per-IP ban rule and the OWASP rule packs the MCP rule must precede. */
|
|
54
62
|
export const GENERAL_RATE_LIMIT_PRIORITY = 1000;
|
|
55
63
|
export const OWASP_RULE_PRIORITIES = [2000, 2001];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-mcp-edge.js","sourceRoot":"","sources":["../src/remote-mcp-edge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH
|
|
1
|
+
{"version":3,"file":"remote-mcp-edge.js","sourceRoot":"","sources":["../src/remote-mcp-edge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,4DAA4D,CAAC;AAEnG,sFAAsF;AACtF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;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C,CAAC,aAAa,EAAE;QACrC,uCAAuC;QACvC,0BAA0B;QAC1B,oBAAoB,CAAC,CAAC,YAAY,EAAE;KACrC,CAAC;AACJ,CAAC;AAeD,6DAA6D;AAC7D,MAAM,UAAU,cAAc,CAAC,IAAmB;IAChD,MAAM,CAAC,GAAG,cAAc,CAAC;IACzB,MAAM,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC;IAChC,OAAO,CACL,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;QAC5B,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACxB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,KAAK,CAAC,CAAC,UAAU;QAC7C,CAAC,EAAE,kBAAkB,EAAE,KAAK,KAAK,CAAC,CAAC,KAAK;QACxC,CAAC,EAAE,kBAAkB,EAAE,WAAW,KAAK,CAAC,CAAC,WAAW;QACpD,CAAC,EAAE,aAAa,KAAK,CAAC,CAAC,aAAa;QACpC,CAAC,EAAE,YAAY,KAAK,CAAC,CAAC,YAAY;QAClC,CAAC,CAAC,EAAE,YAAY,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,YAAY,CAC9C,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caelo-cms/provisioning",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "Pulumi-driven provisioning for Caelo CMS — `bunx @caelo-cms/provisioning --provider <self-hosted|gcp|aws|azure>` brings up a TLS-served install with Postgres + storage + secrets manager + the admin + the API gateway.",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepublishOnly": "tsc -b --force && bun build ../platform-updater/src/agent-db.ts --target=bun --outfile=dist/agent-db.js && tsc --project stacks/gcp/tsconfig.json && tsc --project stacks/gcp-firebase/tsconfig.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@caelo-cms/shared": "^0.12.
|
|
43
|
+
"@caelo-cms/shared": "^0.12.9",
|
|
44
44
|
"@clack/prompts": "1.9.0",
|
|
45
45
|
"@pulumi/command": "^1",
|
|
46
46
|
"@pulumi/gcp": "^10",
|
package/src/remote-mcp-edge.ts
CHANGED
|
@@ -39,8 +39,16 @@
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The paths the MCP rule covers, as an anchored RE2 pattern (Cloud Armor's
|
|
42
|
-
* `matches`): the
|
|
43
|
-
*
|
|
42
|
+
* `matches`): the MCP endpoints (`chat`, `power`, and `admin`, the Power
|
|
43
|
+
* surface's address before #1636) and the broker's `oauth/<name>` and
|
|
44
|
+
* `oauth/<name>/<address>` routes — lowercase letters and hyphens only.
|
|
45
|
+
*
|
|
46
|
+
* A path the pattern does not name is still served: the proxy's policy has
|
|
47
|
+
* no other rule, so it falls to the default (allow) and meets the proxy's
|
|
48
|
+
* own rate limit (apps/mcp-auth-proxy rate-limit.ts), which is the same
|
|
49
|
+
* 600 a minute. That is why #1636 could add `power` without a contract
|
|
50
|
+
* bump: an install gets the edge throttle for it with its next converge,
|
|
51
|
+
* and nothing depends on it until then (epic #763, decision E3).
|
|
44
52
|
*
|
|
45
53
|
* Deliberately not a prefix match. A `startsWith('/api/mcp/')` rule also
|
|
46
54
|
* matches `/api/mcp/../forms/submit` or `/api/mcp/%2e%2e/comments`, which
|
|
@@ -51,7 +59,7 @@
|
|
|
51
59
|
* The dotted metadata aliases (`/.well-known/…`, `oauth/.well-known/…`) are
|
|
52
60
|
* one-off GETs per connection and stay under the general rules.
|
|
53
61
|
*/
|
|
54
|
-
export const MCP_ARMOR_PATH_PATTERN = "^/api/mcp/(?:chat|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$";
|
|
62
|
+
export const MCP_ARMOR_PATH_PATTERN = "^/api/mcp/(?:chat|power|admin|oauth/[a-z-]+(?:/[a-z-]+)?)$";
|
|
55
63
|
|
|
56
64
|
/** The general per-IP ban rule and the OWASP rule packs the MCP rule must precede. */
|
|
57
65
|
export const GENERAL_RATE_LIMIT_PRIORITY = 1000;
|
package/src/remote-mcp.test.ts
CHANGED
|
@@ -649,6 +649,8 @@ describe("gcp load balancer (remote-mcp-edge)", () => {
|
|
|
649
649
|
const re = new RegExp(MCP_ARMOR_PATH_PATTERN);
|
|
650
650
|
for (const p of [
|
|
651
651
|
"/api/mcp/chat",
|
|
652
|
+
"/api/mcp/power",
|
|
653
|
+
// The Power surface's address before #1636; connectors still use it.
|
|
652
654
|
"/api/mcp/admin",
|
|
653
655
|
"/api/mcp/oauth/authorize",
|
|
654
656
|
"/api/mcp/oauth/google-callback",
|
|
@@ -678,7 +680,9 @@ describe("gcp load balancer (remote-mcp-edge)", () => {
|
|
|
678
680
|
const documented = [...routes.matchAll(/^ \* {3}[A-Z|]+ +(\/api\/mcp\/[^\s]+)/gm)]
|
|
679
681
|
.map((m) => m[1] as string)
|
|
680
682
|
.flatMap((p) =>
|
|
681
|
-
p.includes("{")
|
|
683
|
+
p.includes("{")
|
|
684
|
+
? ["chat", "power", "admin"].map((s) => p.replace(/\{(chat,power,admin|s)\}/, s))
|
|
685
|
+
: [p],
|
|
682
686
|
);
|
|
683
687
|
expect(documented).toContain("/api/mcp/oauth/authorize");
|
|
684
688
|
expect(documented.length).toBeGreaterThanOrEqual(8);
|