@catamorphic/work-server 0.1.0-alpha.32 → 0.1.0-alpha.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/README.md +10 -0
- package/dist/auth/fastify-auth.d.ts.map +1 -1
- package/dist/index.js +2 -15
- package/dist/index.js.map +3 -3
- package/package.json +18 -18
- package/src/auth/fastify-auth.ts +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catamorphic/work-server",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,23 +27,23 @@
|
|
|
27
27
|
"@ai-sdk/openai": "^4.0.65",
|
|
28
28
|
"@better-auth/mcp": "1.7.14",
|
|
29
29
|
"@better-auth/oauth-provider": "1.7.14",
|
|
30
|
-
"@catamorphic/agent-protocol": "0.1.0-alpha.
|
|
31
|
-
"@catamorphic/agent-runner": "0.1.0-alpha.
|
|
32
|
-
"@catamorphic/ai-sdk": "0.1.0-alpha.
|
|
33
|
-
"@catamorphic/app": "0.1.0-alpha.
|
|
34
|
-
"@catamorphic/container": "0.1.0-alpha.
|
|
35
|
-
"@catamorphic/core": "0.1.0-alpha.
|
|
36
|
-
"@catamorphic/db": "0.1.0-alpha.
|
|
37
|
-
"@catamorphic/fastify-plugin": "0.1.0-alpha.
|
|
38
|
-
"@catamorphic/hetzner": "0.1.0-alpha.
|
|
39
|
-
"@catamorphic/local-process": "0.1.0-alpha.
|
|
40
|
-
"@catamorphic/mcp": "0.1.0-alpha.
|
|
41
|
-
"@catamorphic/microsandbox": "0.1.0-alpha.
|
|
42
|
-
"@catamorphic/otel": "0.1.0-alpha.
|
|
43
|
-
"@catamorphic/registry": "0.1.0-alpha.
|
|
44
|
-
"@catamorphic/sandbox": "0.1.0-alpha.
|
|
45
|
-
"@catamorphic/server-sdk": "0.1.0-alpha.
|
|
46
|
-
"@catamorphic/workflow": "0.1.0-alpha.
|
|
30
|
+
"@catamorphic/agent-protocol": "0.1.0-alpha.33",
|
|
31
|
+
"@catamorphic/agent-runner": "0.1.0-alpha.33",
|
|
32
|
+
"@catamorphic/ai-sdk": "0.1.0-alpha.33",
|
|
33
|
+
"@catamorphic/app": "0.1.0-alpha.33",
|
|
34
|
+
"@catamorphic/container": "0.1.0-alpha.33",
|
|
35
|
+
"@catamorphic/core": "0.1.0-alpha.33",
|
|
36
|
+
"@catamorphic/db": "0.1.0-alpha.33",
|
|
37
|
+
"@catamorphic/fastify-plugin": "0.1.0-alpha.33",
|
|
38
|
+
"@catamorphic/hetzner": "0.1.0-alpha.33",
|
|
39
|
+
"@catamorphic/local-process": "0.1.0-alpha.33",
|
|
40
|
+
"@catamorphic/mcp": "0.1.0-alpha.33",
|
|
41
|
+
"@catamorphic/microsandbox": "0.1.0-alpha.33",
|
|
42
|
+
"@catamorphic/otel": "0.1.0-alpha.33",
|
|
43
|
+
"@catamorphic/registry": "0.1.0-alpha.33",
|
|
44
|
+
"@catamorphic/sandbox": "0.1.0-alpha.33",
|
|
45
|
+
"@catamorphic/server-sdk": "0.1.0-alpha.33",
|
|
46
|
+
"@catamorphic/workflow": "0.1.0-alpha.33",
|
|
47
47
|
"@electric-sql/pglite": "^0.5.4",
|
|
48
48
|
"@openai/codex": "0.164.0",
|
|
49
49
|
"better-auth": "1.7.14",
|
package/src/auth/fastify-auth.ts
CHANGED
|
@@ -157,29 +157,8 @@ export function registerWorkAuthRoutes(
|
|
|
157
157
|
});
|
|
158
158
|
if (decision && !decision.allow) return sendTokenError(reply, decision);
|
|
159
159
|
}
|
|
160
|
-
// The old endpoint accepted confidential client secrets in either Basic
|
|
161
|
-
// auth or the form body without persisting that choice. Normalize that
|
|
162
|
-
// existing public contract to the migrated client's Basic registration.
|
|
163
|
-
const legacySecret =
|
|
164
|
-
request.url.split("?")[0] === "/api/auth/mcp/token" &&
|
|
165
|
-
!request.headers.authorization
|
|
166
|
-
? form.get("client_secret")
|
|
167
|
-
: null;
|
|
168
|
-
const legacyClient = form.get("client_id");
|
|
169
|
-
const legacyAuthorization =
|
|
170
|
-
legacySecret && legacyClient
|
|
171
|
-
? `Basic ${Buffer.from(`${encodeURIComponent(legacyClient)}:${encodeURIComponent(legacySecret)}`).toString("base64")}`
|
|
172
|
-
: undefined;
|
|
173
|
-
if (legacyAuthorization) form.delete("client_secret");
|
|
174
160
|
const response = await callBetterAuth(routed, request, {
|
|
175
161
|
pathname: "/api/auth/oauth2/token",
|
|
176
|
-
...(legacyAuthorization
|
|
177
|
-
? {
|
|
178
|
-
authorization: legacyAuthorization,
|
|
179
|
-
body: form.toString(),
|
|
180
|
-
contentType: "application/x-www-form-urlencoded",
|
|
181
|
-
}
|
|
182
|
-
: {}),
|
|
183
162
|
});
|
|
184
163
|
if (!response.ok || !gate) return sendResponse(response, reply);
|
|
185
164
|
const body: unknown = await response
|
|
@@ -198,9 +177,6 @@ export function registerWorkAuthRoutes(
|
|
|
198
177
|
return sendResponse(response, reply);
|
|
199
178
|
};
|
|
200
179
|
app.post("/api/auth/oauth2/token", token);
|
|
201
|
-
// Saved server connections still hold this URL. Both paths run the same
|
|
202
|
-
// lifecycle gate and the same Better Auth token implementation.
|
|
203
|
-
app.post("/api/auth/mcp/token", token);
|
|
204
180
|
app.get("/.well-known/oauth-authorization-server", (request, reply) =>
|
|
205
181
|
forward(request, reply, "/api/auth/.well-known/oauth-authorization-server"),
|
|
206
182
|
);
|
|
@@ -425,7 +401,6 @@ async function callBetterAuth(
|
|
|
425
401
|
pathname?: string;
|
|
426
402
|
body?: string;
|
|
427
403
|
contentType?: string;
|
|
428
|
-
authorization?: string;
|
|
429
404
|
},
|
|
430
405
|
): Promise<Response> {
|
|
431
406
|
const incoming = new URL(request.raw.url ?? "/", options.baseURL);
|
|
@@ -446,8 +421,6 @@ async function callBetterAuth(
|
|
|
446
421
|
if (overrides.contentType) {
|
|
447
422
|
headers.set("content-type", overrides.contentType);
|
|
448
423
|
}
|
|
449
|
-
if (overrides.authorization)
|
|
450
|
-
headers.set("authorization", overrides.authorization);
|
|
451
424
|
if (overrides.body !== undefined) {
|
|
452
425
|
headers.delete("content-length");
|
|
453
426
|
headers.delete("content-encoding");
|