@catamorphic/fastify-plugin 0.0.0-stage → 0.1.0-alpha.30
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.txt +202 -0
- package/NOTICE.txt +32 -0
- package/README.md +143 -2
- package/dist/app-presentation-tools.d.ts +4 -0
- package/dist/app-presentation-tools.d.ts.map +1 -0
- package/dist/app.d.ts +27 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/chunk-baagvvm3.js +164 -0
- package/dist/chunk-baagvvm3.js.map +10 -0
- package/dist/http-identity.d.ts +52 -0
- package/dist/http-identity.d.ts.map +1 -0
- package/dist/hung-up.d.ts +7 -0
- package/dist/hung-up.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10884 -0
- package/dist/index.js.map +56 -0
- package/dist/mcp-shared.d.ts +117 -0
- package/dist/mcp-shared.d.ts.map +1 -0
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +13 -0
- package/dist/mcp.js.map +9 -0
- package/dist/plugin.d.ts +113 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/project-capabilities.d.ts +25 -0
- package/dist/project-capabilities.d.ts.map +1 -0
- package/dist/project-mcp-program.d.ts +15 -0
- package/dist/project-mcp-program.d.ts.map +1 -0
- package/dist/project-mcp-surface.d.ts +16 -0
- package/dist/project-mcp-surface.d.ts.map +1 -0
- package/dist/request-logging.d.ts +18 -0
- package/dist/request-logging.d.ts.map +1 -0
- package/dist/routes/agent-capabilities.d.ts +4 -0
- package/dist/routes/agent-capabilities.d.ts.map +1 -0
- package/dist/routes/agent.d.ts +4 -0
- package/dist/routes/agent.d.ts.map +1 -0
- package/dist/routes/apps-mcp.d.ts +4 -0
- package/dist/routes/apps-mcp.d.ts.map +1 -0
- package/dist/routes/apps.d.ts +12 -0
- package/dist/routes/apps.d.ts.map +1 -0
- package/dist/routes/client-runners.d.ts +11 -0
- package/dist/routes/client-runners.d.ts.map +1 -0
- package/dist/routes/code-hosts.d.ts +11 -0
- package/dist/routes/code-hosts.d.ts.map +1 -0
- package/dist/routes/connection-mcp.d.ts +10 -0
- package/dist/routes/connection-mcp.d.ts.map +1 -0
- package/dist/routes/connections.d.ts +4 -0
- package/dist/routes/connections.d.ts.map +1 -0
- package/dist/routes/documents.d.ts +11 -0
- package/dist/routes/documents.d.ts.map +1 -0
- package/dist/routes/environments.d.ts +4 -0
- package/dist/routes/environments.d.ts.map +1 -0
- package/dist/routes/git-gateway.d.ts +21 -0
- package/dist/routes/git-gateway.d.ts.map +1 -0
- package/dist/routes/http-gateway.d.ts +13 -0
- package/dist/routes/http-gateway.d.ts.map +1 -0
- package/dist/routes/me.d.ts +12 -0
- package/dist/routes/me.d.ts.map +1 -0
- package/dist/routes/memberships.d.ts +12 -0
- package/dist/routes/memberships.d.ts.map +1 -0
- package/dist/routes/model-gateway.d.ts +12 -0
- package/dist/routes/model-gateway.d.ts.map +1 -0
- package/dist/routes/notifications.d.ts +4 -0
- package/dist/routes/notifications.d.ts.map +1 -0
- package/dist/routes/parse.d.ts +5 -0
- package/dist/routes/parse.d.ts.map +1 -0
- package/dist/routes/personal-environment.d.ts +13 -0
- package/dist/routes/personal-environment.d.ts.map +1 -0
- package/dist/routes/plugins.d.ts +4 -0
- package/dist/routes/plugins.d.ts.map +1 -0
- package/dist/routes/project-mcp.d.ts +25 -0
- package/dist/routes/project-mcp.d.ts.map +1 -0
- package/dist/routes/projects.d.ts +4 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/publications.d.ts +15 -0
- package/dist/routes/publications.d.ts.map +1 -0
- package/dist/routes/run-errors.d.ts +8 -0
- package/dist/routes/run-errors.d.ts.map +1 -0
- package/dist/routes/runs.d.ts +4 -0
- package/dist/routes/runs.d.ts.map +1 -0
- package/dist/routes/session-artifacts.d.ts +27 -0
- package/dist/routes/session-artifacts.d.ts.map +1 -0
- package/dist/routes/session-mailboxes.d.ts +4 -0
- package/dist/routes/session-mailboxes.d.ts.map +1 -0
- package/dist/routes/session-previews.d.ts +40 -0
- package/dist/routes/session-previews.d.ts.map +1 -0
- package/dist/routes/session-terminals.d.ts +15 -0
- package/dist/routes/session-terminals.d.ts.map +1 -0
- package/dist/routes/triggers.d.ts +20 -0
- package/dist/routes/triggers.d.ts.map +1 -0
- package/dist/routes/watchers.d.ts +4 -0
- package/dist/routes/watchers.d.ts.map +1 -0
- package/dist/routes/webhooks.d.ts +11 -0
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/workflow-enablements.d.ts +4 -0
- package/dist/routes/workflow-enablements.d.ts.map +1 -0
- package/dist/routes/workflows.d.ts +4 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/schemas.d.ts +17776 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/session-artifact-tools.d.ts +5 -0
- package/dist/session-artifact-tools.d.ts.map +1 -0
- package/dist/session-event-stream.d.ts +45 -0
- package/dist/session-event-stream.d.ts.map +1 -0
- package/dist/spa.d.ts +24 -0
- package/dist/spa.d.ts.map +1 -0
- package/dist/telemetry.d.ts +4 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/package.json +73 -4
- package/src/app-presentation-tools.ts +46 -0
- package/src/app.ts +115 -0
- package/src/http-identity.ts +145 -0
- package/src/hung-up.ts +13 -0
- package/src/index.ts +25 -0
- package/src/mcp-shared.ts +331 -0
- package/src/mcp.ts +10 -0
- package/src/plugin.ts +332 -0
- package/src/project-capabilities.ts +153 -0
- package/src/project-mcp-program.ts +607 -0
- package/src/project-mcp-surface.ts +881 -0
- package/src/request-logging.ts +47 -0
- package/src/routes/agent-capabilities.ts +109 -0
- package/src/routes/agent.ts +1566 -0
- package/src/routes/apps-mcp.ts +303 -0
- package/src/routes/apps.ts +692 -0
- package/src/routes/client-runners.ts +251 -0
- package/src/routes/code-hosts.ts +247 -0
- package/src/routes/connection-mcp.ts +135 -0
- package/src/routes/connections.ts +494 -0
- package/src/routes/documents.ts +538 -0
- package/src/routes/environments.ts +72 -0
- package/src/routes/git-gateway.ts +106 -0
- package/src/routes/http-gateway.ts +141 -0
- package/src/routes/me.ts +122 -0
- package/src/routes/memberships.ts +173 -0
- package/src/routes/model-gateway.ts +134 -0
- package/src/routes/notifications.ts +101 -0
- package/src/routes/parse.ts +32 -0
- package/src/routes/personal-environment.ts +146 -0
- package/src/routes/plugins.ts +341 -0
- package/src/routes/project-mcp.ts +394 -0
- package/src/routes/projects.ts +708 -0
- package/src/routes/publications.ts +222 -0
- package/src/routes/run-errors.ts +86 -0
- package/src/routes/runs.ts +253 -0
- package/src/routes/session-artifacts.ts +293 -0
- package/src/routes/session-mailboxes.ts +80 -0
- package/src/routes/session-previews.ts +224 -0
- package/src/routes/session-terminals.ts +209 -0
- package/src/routes/triggers.ts +241 -0
- package/src/routes/watchers.ts +94 -0
- package/src/routes/webhooks.ts +171 -0
- package/src/routes/workflow-enablements.ts +331 -0
- package/src/routes/workflows.ts +323 -0
- package/src/schemas.ts +2735 -0
- package/src/session-artifact-tools.ts +170 -0
- package/src/session-event-stream.ts +122 -0
- package/src/spa.ts +135 -0
- package/src/telemetry.ts +93 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAwDA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;iBAEhC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;iBAEnC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAElC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;iBAE/B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;iBAErC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;iBAE9B,CAAC;AAGH,eAAO,MAAM,cAAc;;iBAE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C;AAGH,eAAO,MAAM,WAAW;;iBAEtB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;iBAIhC,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B;;;;;;mBAGvC,CAAC;AAEH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,QAAQ,CAAC;;;iBAItD,CAAC;AAEL,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB7B,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;;;kBAyBtC,CAAC;AAEJ,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAkBpC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;iBAI3C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CatamorphicCore, Identity } from "@catamorphic/core";
|
|
2
|
+
import type { SurfaceTool } from "./project-mcp-surface.js";
|
|
3
|
+
/** The same source lifecycle is available to every harness through project MCP. */
|
|
4
|
+
export declare function sessionArtifactTool(core: CatamorphicCore, identity: Identity, projectId: string, currentSessionId?: string): SurfaceTool;
|
|
5
|
+
//# sourceMappingURL=session-artifact-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-artifact-tools.d.ts","sourceRoot":"","sources":["../src/session-artifact-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAiB5D,mFAAmF;AACnF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,MAAM,GACxB,WAAW,CA8Ib"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ServerResponse } from "node:http";
|
|
2
|
+
import type { SessionStreamMessage } from "@catamorphic/agent-protocol";
|
|
3
|
+
/** How often an idle stream says it is still there. */
|
|
4
|
+
export declare const SESSION_STREAM_HEARTBEAT_MS = 15000;
|
|
5
|
+
/**
|
|
6
|
+
* One session's event stream as server-sent events (ADR 0197). Each
|
|
7
|
+
* {@link SessionStreamMessage} is one SSE message, `data: <JSON>`, whose
|
|
8
|
+
* `id:` is the stream's sequence after it, so a reconnecting EventSource
|
|
9
|
+
* resumes from `Last-Event-ID`.
|
|
10
|
+
*
|
|
11
|
+
* The core subscription starts sending (the gap after the cursor) before
|
|
12
|
+
* the route knows the caller may read the session, so frames wait here
|
|
13
|
+
* until {@link open} writes the response head; a refusal is then still an
|
|
14
|
+
* ordinary HTTP error.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SessionEventStream {
|
|
17
|
+
private readonly raw;
|
|
18
|
+
private readonly heartbeatMs;
|
|
19
|
+
private sequence;
|
|
20
|
+
/** Frames sent before the response opened; null once it has. */
|
|
21
|
+
private buffered;
|
|
22
|
+
private unsubscribe;
|
|
23
|
+
private heartbeat;
|
|
24
|
+
private ended;
|
|
25
|
+
constructor(input: {
|
|
26
|
+
raw: ServerResponse;
|
|
27
|
+
/** The cursor the stream starts after. */
|
|
28
|
+
sequence: number;
|
|
29
|
+
heartbeatMs?: number;
|
|
30
|
+
});
|
|
31
|
+
/** Hold the core subscription; a stream that already ended releases it. */
|
|
32
|
+
attach(unsubscribe: () => void): void;
|
|
33
|
+
/**
|
|
34
|
+
* Write one message. False when the socket is buffering: the core
|
|
35
|
+
* subscription counts what waits and closes a reader that falls too far
|
|
36
|
+
* behind (it resumes from its cursor).
|
|
37
|
+
*/
|
|
38
|
+
send(message: SessionStreamMessage): boolean;
|
|
39
|
+
/** Write the response head (with the reply's own headers) and what waited. */
|
|
40
|
+
open(headers: Record<string, string | number | string[] | undefined>): void;
|
|
41
|
+
/** End the stream: release the subscription and close the response. */
|
|
42
|
+
end(): void;
|
|
43
|
+
private frame;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=session-event-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-event-stream.d.ts","sourceRoot":"","sources":["../src/session-event-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,uDAAuD;AACvD,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiB;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAS;IACzB,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,SAAS,CAA6C;IAC9D,OAAO,CAAC,KAAK,CAAS;IAEtB,YAAY,KAAK,EAAE;QACjB,GAAG,EAAE,cAAc,CAAC;QACpB,0CAA0C;QAC1C,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,EAMA;IAED,2EAA2E;IAC3E,MAAM,CAAC,WAAW,EAAE,MAAM,IAAI,GAAG,IAAI,CAGpC;IAED;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAQ3C;IAED,8EAA8E;IAC9E,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAmC1E;IAED,uEAAuE;IACvE,GAAG,IAAI,IAAI,CAQV;IAED,OAAO,CAAC,KAAK;CAWd"}
|
package/dist/spa.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
/**
|
|
3
|
+
* Serve a built single-page app (the mobile PWA) from a dist directory:
|
|
4
|
+
* static assets by path, `index.html` for everything else (hash-routed
|
|
5
|
+
* SPA). Shared by the stock server's root and the desktop's LAN pairing
|
|
6
|
+
* listener, so path handling and headers stay identical on both origins.
|
|
7
|
+
*
|
|
8
|
+
* Registered as a catch-all `GET /*`; register AFTER every specific
|
|
9
|
+
* route. `fallback` renders when the dist has no index.html (e.g. the
|
|
10
|
+
* stock server's landing page).
|
|
11
|
+
*/
|
|
12
|
+
export declare function serveSpaDist(app: FastifyInstance, resolveDist: () => string, fallback?: (reply: SpaReply) => unknown): void;
|
|
13
|
+
/**
|
|
14
|
+
* Carry a credential-free connection locator into an installed PWA without
|
|
15
|
+
* allowing a manifest query to turn the app into an open redirect.
|
|
16
|
+
*/
|
|
17
|
+
export declare function pwaManifestWithLaunch(manifest: Record<string, unknown>, rawLaunch: string | undefined): Record<string, unknown>;
|
|
18
|
+
type SpaReply = {
|
|
19
|
+
status: (code: number) => SpaReply;
|
|
20
|
+
type: (contentType: string) => SpaReply;
|
|
21
|
+
send: (payload: unknown) => unknown;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=spa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spa.d.ts","sourceRoot":"","sources":["../src/spa.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,MAAM,MAAM,EACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,GACtC,IAAI,CAyDN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB;AAED,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,CAAC;IACnC,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,QAAQ,CAAC;IACxC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;CACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAiF/D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catamorphic/fastify-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-alpha.30",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./mcp": {
|
|
13
|
+
"import": "./dist/mcp.js",
|
|
14
|
+
"types": "./dist/mcp.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "bun ../../scripts/build-package.ts && tsc --project tsconfig.json --noEmit false --emitDeclarationOnly",
|
|
19
|
+
"test": "bun ../../scripts/tool-runtime.ts vitest --tool-cwd packages/fastify-plugin --config ../../vitest.config.ts",
|
|
20
|
+
"typecheck": "bun check --project ./tsconfig.json",
|
|
21
|
+
"generate-spec": "bun run scripts/generate-spec.ts && biome format --write ../api-client/openapi.json"
|
|
22
|
+
},
|
|
23
|
+
"bundle": {
|
|
24
|
+
"entry": [
|
|
25
|
+
"src/index.ts",
|
|
26
|
+
"src/mcp.ts"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@catamorphic/app": "0.1.0-alpha.30",
|
|
31
|
+
"@catamorphic/core": "0.1.0-alpha.30",
|
|
32
|
+
"@catamorphic/db": "0.1.0-alpha.30",
|
|
33
|
+
"@catamorphic/git": "0.1.0-alpha.30",
|
|
34
|
+
"@catamorphic/parser": "0.1.0-alpha.30",
|
|
35
|
+
"@catamorphic/plugins": "0.1.0-alpha.30",
|
|
36
|
+
"@catamorphic/sandbox": "0.1.0-alpha.30",
|
|
37
|
+
"@fastify/cors": "^11.3.0",
|
|
38
|
+
"@fastify/swagger": "^9.8.0",
|
|
39
|
+
"@fastify/swagger-ui": "^6.1.0",
|
|
40
|
+
"fastify": "^5.12.7",
|
|
41
|
+
"fastify-type-provider-zod": "^7.0.0",
|
|
42
|
+
"kysely": "^0.29.3",
|
|
43
|
+
"zod": "^4.6.7",
|
|
44
|
+
"@catamorphic/otel": "0.1.0-alpha.30",
|
|
45
|
+
"@catamorphic/workflow": "0.1.0-alpha.30",
|
|
46
|
+
"@opentelemetry/api": "^1.9.1",
|
|
47
|
+
"@catamorphic/agent-protocol": "0.1.0-alpha.30"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@opentelemetry/sdk-trace-node": "^2.9.0",
|
|
51
|
+
"@catamorphic/agent-runner": "0.1.0-alpha.30",
|
|
52
|
+
"@electric-sql/pglite": "^0.5.4"
|
|
53
|
+
},
|
|
54
|
+
"license": "Apache-2.0",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/opencx-labs/catamorphic.git",
|
|
58
|
+
"directory": "packages/fastify-plugin"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public",
|
|
62
|
+
"registry": "https://registry.npmjs.org"
|
|
63
|
+
},
|
|
64
|
+
"files": [
|
|
65
|
+
"dist",
|
|
66
|
+
"src",
|
|
67
|
+
"LICENSE.txt",
|
|
68
|
+
"NOTICE.txt",
|
|
69
|
+
"!**/*.test.*",
|
|
70
|
+
"!**/*.spec.*",
|
|
71
|
+
"!**/__tests__/**",
|
|
72
|
+
"!**/__fixtures__/**",
|
|
73
|
+
"!**/fixtures/**"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { APP_ICON_DESCRIPTIONS, APP_ICON_NAMES } from "@catamorphic/app";
|
|
2
|
+
import type { CatamorphicCore, Identity } from "@catamorphic/core";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { toolError, toolValue } from "./mcp-shared.js";
|
|
5
|
+
import type { SurfaceTool } from "./project-mcp-surface.js";
|
|
6
|
+
|
|
7
|
+
const Input = z
|
|
8
|
+
.object({
|
|
9
|
+
appName: z.string().min(1),
|
|
10
|
+
icon: z.enum(APP_ICON_NAMES).optional(),
|
|
11
|
+
title: z.string().trim().min(1).max(200).optional(),
|
|
12
|
+
})
|
|
13
|
+
.refine(
|
|
14
|
+
(value) => value.icon !== undefined || value.title !== undefined,
|
|
15
|
+
"Supply a title or icon",
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export function appPresentationTool(
|
|
19
|
+
core: CatamorphicCore,
|
|
20
|
+
identity: Identity,
|
|
21
|
+
projectId: string,
|
|
22
|
+
): SurfaceTool {
|
|
23
|
+
return {
|
|
24
|
+
definition: {
|
|
25
|
+
name: "set_app_presentation",
|
|
26
|
+
description: `Set an app's title and/or canonical icon without rebuilding or publishing. Use a short, descriptive title that names what the app does or contains. Match the language of the task, avoid generic labels like Session app, and keep the title stable through revisions. There is no required title template. Use the returned appName for temporary apps, not their display title. All reviews use review. Choose default when in doubt; never infer a specialized type just from a filename. Choices: ${APP_ICON_NAMES.map((name) => `${name}: ${APP_ICON_DESCRIPTIONS[name]}`).join("; ")}.`,
|
|
27
|
+
inputSchema: z.toJSONSchema(Input),
|
|
28
|
+
},
|
|
29
|
+
call: async (raw) => {
|
|
30
|
+
try {
|
|
31
|
+
if (!core.apps) throw new Error("Apps are unavailable");
|
|
32
|
+
return toolValue(
|
|
33
|
+
await core.apps.updatePresentation({
|
|
34
|
+
...Input.parse(raw),
|
|
35
|
+
identity,
|
|
36
|
+
projectId,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
return toolError(
|
|
41
|
+
error instanceof Error ? error.message : String(error),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
package/src/app.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { CatamorphicCore } from "@catamorphic/core";
|
|
2
|
+
import fastifyCors from "@fastify/cors";
|
|
3
|
+
import fastifySwagger from "@fastify/swagger";
|
|
4
|
+
import fastifySwaggerUi from "@fastify/swagger-ui";
|
|
5
|
+
import Fastify from "fastify";
|
|
6
|
+
import {
|
|
7
|
+
jsonSchemaTransform,
|
|
8
|
+
jsonSchemaTransformObject,
|
|
9
|
+
} from "fastify-type-provider-zod";
|
|
10
|
+
import type { IdentityResolver } from "./http-identity.js";
|
|
11
|
+
import { type CatamorphicPluginOptions, catamorphicPlugin } from "./plugin.js";
|
|
12
|
+
import {
|
|
13
|
+
apiErrorResponse,
|
|
14
|
+
apiNotFoundResponse,
|
|
15
|
+
errorLogFields,
|
|
16
|
+
requestLogFields,
|
|
17
|
+
} from "./request-logging.js";
|
|
18
|
+
|
|
19
|
+
export type { RouteContext } from "./plugin.js";
|
|
20
|
+
|
|
21
|
+
export interface AppConfig {
|
|
22
|
+
/**
|
|
23
|
+
* Wired catamorphic services. Required for any non-trivial route. When
|
|
24
|
+
* omitted (e.g. unit tests that only hit stub routes), project / run /
|
|
25
|
+
* workflow endpoints respond 503.
|
|
26
|
+
*/
|
|
27
|
+
core?: CatamorphicCore;
|
|
28
|
+
/**
|
|
29
|
+
* Who is calling — see `CatamorphicPluginOptions.identity`. A sidecar that
|
|
30
|
+
* sits behind the host's own auth typically passes `identityFromHeaders()`.
|
|
31
|
+
*/
|
|
32
|
+
identity: IdentityResolver;
|
|
33
|
+
/** Host feature switches; see `CatamorphicPluginOptions.features`. */
|
|
34
|
+
features?: CatamorphicPluginOptions["features"];
|
|
35
|
+
/** See `CatamorphicPluginOptions.publicApiBase`. */
|
|
36
|
+
publicApiBase?: string;
|
|
37
|
+
/** See `CatamorphicPluginOptions.projectMcp`. */
|
|
38
|
+
projectMcp?: CatamorphicPluginOptions["projectMcp"];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Standalone app factory: a full Fastify instance with CORS, Swagger UI at
|
|
43
|
+
* `/docs`, and the catamorphic plugin mounted at `/api`. Use this to run the
|
|
44
|
+
* API as a sidecar process (or in tests / spec generation). Hosts embedding
|
|
45
|
+
* catamorphic into an existing Fastify app should register
|
|
46
|
+
* `catamorphicPlugin` directly instead.
|
|
47
|
+
*/
|
|
48
|
+
/** A recursive JSON value as an OpenAPI 3.0 component named `id`. */
|
|
49
|
+
function jsonValueComponent(id: string) {
|
|
50
|
+
const self = { $ref: `#/components/schemas/${id}` };
|
|
51
|
+
return {
|
|
52
|
+
anyOf: [
|
|
53
|
+
{ type: "string" as const },
|
|
54
|
+
{ type: "number" as const },
|
|
55
|
+
{ type: "boolean" as const },
|
|
56
|
+
{ type: "string" as const, nullable: true, enum: [null] },
|
|
57
|
+
{ type: "array" as const, items: self },
|
|
58
|
+
{ type: "object" as const, additionalProperties: self },
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function createApp(config: AppConfig) {
|
|
64
|
+
const app = Fastify({
|
|
65
|
+
logger: { serializers: { req: requestLogFields, err: errorLogFields } },
|
|
66
|
+
forceCloseConnections: true,
|
|
67
|
+
});
|
|
68
|
+
app.setErrorHandler(apiErrorResponse);
|
|
69
|
+
app.setNotFoundHandler(apiNotFoundResponse);
|
|
70
|
+
|
|
71
|
+
app.register(fastifyCors, {
|
|
72
|
+
origin: true,
|
|
73
|
+
methods: ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
app.register(fastifySwagger, {
|
|
77
|
+
openapi: {
|
|
78
|
+
info: {
|
|
79
|
+
title: "Catamorphic API",
|
|
80
|
+
version: "0.0.1",
|
|
81
|
+
description: "Code-first workflow builder API",
|
|
82
|
+
},
|
|
83
|
+
servers: [{ url: "/" }],
|
|
84
|
+
},
|
|
85
|
+
transform: jsonSchemaTransform,
|
|
86
|
+
transformObject: (document) => {
|
|
87
|
+
const object = jsonSchemaTransformObject(document);
|
|
88
|
+
// Zod writes its recursive JSON value as a `__shared` definition that
|
|
89
|
+
// OpenAPI cannot reference; name the JSON value by hand instead.
|
|
90
|
+
const schemas =
|
|
91
|
+
"components" in object ? object.components?.schemas : undefined;
|
|
92
|
+
if (schemas) {
|
|
93
|
+
Reflect.deleteProperty(schemas, "__shared");
|
|
94
|
+
schemas.JsonValue = jsonValueComponent("JsonValue");
|
|
95
|
+
schemas.JsonValueInput = jsonValueComponent("JsonValueInput");
|
|
96
|
+
}
|
|
97
|
+
return object;
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
app.register(fastifySwaggerUi, {
|
|
102
|
+
routePrefix: "/docs",
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
app.register(catamorphicPlugin, {
|
|
106
|
+
core: config.core,
|
|
107
|
+
identity: config.identity,
|
|
108
|
+
...(config.features ? { features: config.features } : {}),
|
|
109
|
+
...(config.projectMcp ? { projectMcp: config.projectMcp } : {}),
|
|
110
|
+
...(config.publicApiBase ? { publicApiBase: config.publicApiBase } : {}),
|
|
111
|
+
prefix: "/api",
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return app;
|
|
115
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Identity } from "@catamorphic/core";
|
|
2
|
+
import { setSpanCorrelation } from "@catamorphic/otel";
|
|
3
|
+
import { trace } from "@opentelemetry/api";
|
|
4
|
+
import type { FastifyRequest } from "fastify";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The one identity mechanism of the HTTP surface. The host supplies a
|
|
8
|
+
* resolver when it registers the plugin; it runs on every request (including
|
|
9
|
+
* iframe navigations to served app documents, which carry the host's own
|
|
10
|
+
* session cookie) and returns the caller's {@link Identity} — root for the
|
|
11
|
+
* host itself, scoped for a member — or `null` for "not authenticated" (401).
|
|
12
|
+
*
|
|
13
|
+
* There is no default: catamorphic is embed-only and never guesses who is
|
|
14
|
+
* calling. Hosts that terminate auth elsewhere (a proxy, a sidecar behind
|
|
15
|
+
* the host's gateway) pass {@link identityFromHeaders}; everyone else writes
|
|
16
|
+
* the few lines that turn their verified session into an identity.
|
|
17
|
+
*/
|
|
18
|
+
export type IdentityResolver = (
|
|
19
|
+
request: FastifyRequest,
|
|
20
|
+
) => Identity | null | Promise<Identity | null>;
|
|
21
|
+
|
|
22
|
+
const TENANT_HEADER = "x-catamorphic-tenant-id";
|
|
23
|
+
const EXTERNAL_USER_HEADER = "x-external-user-id";
|
|
24
|
+
|
|
25
|
+
const USER_ID_RE = /^[A-Za-z0-9._-]+$/;
|
|
26
|
+
const TENANT_ID_RE = /^[A-Za-z0-9._-]+$/;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A stock resolver reading `X-Catamorphic-Tenant-Id` and `X-External-User-Id`.
|
|
30
|
+
* Only for hosts whose auth layer sits *in front of* the plugin and sets these
|
|
31
|
+
* headers itself from a verified session (a proxy route, a gateway); never
|
|
32
|
+
* expose a plugin using this resolver directly to browsers, since anyone
|
|
33
|
+
* could then claim any identity. Both headers are required and yield full
|
|
34
|
+
* identities — a header-terminated host that wants scoped viewers wraps this
|
|
35
|
+
* in its own resolver.
|
|
36
|
+
*/
|
|
37
|
+
export function identityFromHeaders(): IdentityResolver {
|
|
38
|
+
return (request) => ({
|
|
39
|
+
tenantId: getTenantId(request),
|
|
40
|
+
externalUserId: getExternalUserId(request),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A stock resolver for hosts whose members arrive with a bearer token the
|
|
46
|
+
* host itself issued — the desktop's remote projects, a member's own agent
|
|
47
|
+
* on the project MCP endpoint, a connect link (ADR 0055). `verify` is the
|
|
48
|
+
* host's: it turns the token into who is calling (and, typically, hands
|
|
49
|
+
* that to `core.memberships.identityFor` or `resolveRoles`), or `null` for
|
|
50
|
+
* an unknown/expired token. A missing or malformed header is `null` too —
|
|
51
|
+
* 401, never a guess. Revocation is instant by construction: every request
|
|
52
|
+
* re-verifies.
|
|
53
|
+
*/
|
|
54
|
+
export function identityFromBearer(
|
|
55
|
+
verify: (
|
|
56
|
+
token: string,
|
|
57
|
+
request: FastifyRequest,
|
|
58
|
+
) => Identity | null | Promise<Identity | null>,
|
|
59
|
+
): IdentityResolver {
|
|
60
|
+
return async (request) => {
|
|
61
|
+
const raw = request.headers.authorization;
|
|
62
|
+
const header = Array.isArray(raw) ? raw[0] : raw;
|
|
63
|
+
if (!header) return null;
|
|
64
|
+
const match = /^Bearer\s+(\S+)$/i.exec(header.trim());
|
|
65
|
+
if (!match?.[1]) return null;
|
|
66
|
+
return verify(match[1], request);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const IDENTITY_KEY = Symbol.for("catamorphic.identity");
|
|
71
|
+
|
|
72
|
+
interface IdentityCarrier {
|
|
73
|
+
[IDENTITY_KEY]?: Identity;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Stores the resolved identity on the request (plugin-internal). */
|
|
77
|
+
export function attachIdentity(request: FastifyRequest, identity: Identity) {
|
|
78
|
+
(request as unknown as IdentityCarrier)[IDENTITY_KEY] = identity;
|
|
79
|
+
const span = trace.getActiveSpan();
|
|
80
|
+
if (span)
|
|
81
|
+
setSpanCorrelation({
|
|
82
|
+
span,
|
|
83
|
+
attributes: {
|
|
84
|
+
"catamorphic.tenant.id": identity.tenantId,
|
|
85
|
+
"user.id": identity.externalUserId,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The attached identity, or null on a public route with no session. */
|
|
91
|
+
export function optionalIdentity(request: FastifyRequest): Identity | null {
|
|
92
|
+
return (request as unknown as IdentityCarrier)[IDENTITY_KEY] ?? null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The identity the plugin's resolver attached to this request. Routes call
|
|
97
|
+
* this; it never reads headers itself.
|
|
98
|
+
*/
|
|
99
|
+
export function resolveIdentity(request: FastifyRequest): Identity {
|
|
100
|
+
const identity = (request as unknown as IdentityCarrier)[IDENTITY_KEY];
|
|
101
|
+
if (!identity) {
|
|
102
|
+
throw new HttpIdentityError(
|
|
103
|
+
"No identity on request: the catamorphic plugin's identity resolver did not run",
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return identity;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function getExternalUserId(request: FastifyRequest): string {
|
|
110
|
+
const raw = request.headers[EXTERNAL_USER_HEADER];
|
|
111
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
112
|
+
if (!value?.trim()) {
|
|
113
|
+
throw new HttpIdentityError(
|
|
114
|
+
"Missing X-External-User-Id header. Hosts using identityFromHeaders() must set the host user id on every request.",
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
const trimmed = value.trim();
|
|
118
|
+
if (!USER_ID_RE.test(trimmed) || trimmed.length > 128) {
|
|
119
|
+
throw new HttpIdentityError("Invalid X-External-User-Id header");
|
|
120
|
+
}
|
|
121
|
+
return trimmed;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function getTenantId(request: FastifyRequest): string {
|
|
125
|
+
const raw = request.headers[TENANT_HEADER];
|
|
126
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
127
|
+
if (!value?.trim()) {
|
|
128
|
+
throw new HttpIdentityError(
|
|
129
|
+
"Missing X-Catamorphic-Tenant-Id header. Hosts using identityFromHeaders() must set the host org id on every request.",
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const trimmed = value.trim();
|
|
133
|
+
if (!TENANT_ID_RE.test(trimmed) || trimmed.length > 128) {
|
|
134
|
+
throw new HttpIdentityError("Invalid X-Catamorphic-Tenant-Id header");
|
|
135
|
+
}
|
|
136
|
+
return trimmed;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** A malformed identity claim from the host (400), distinct from 401. */
|
|
140
|
+
export class HttpIdentityError extends Error {
|
|
141
|
+
constructor(message: string) {
|
|
142
|
+
super(message);
|
|
143
|
+
this.name = "HttpIdentityError";
|
|
144
|
+
}
|
|
145
|
+
}
|
package/src/hung-up.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FastifyReply } from "fastify";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Aborts when the caller hangs up before the answer is sent, so a long
|
|
5
|
+
* poll or wait nobody is listening to any more ends.
|
|
6
|
+
*/
|
|
7
|
+
export function hungUp(reply: FastifyReply): AbortSignal {
|
|
8
|
+
const controller = new AbortController();
|
|
9
|
+
reply.raw.once("close", () => {
|
|
10
|
+
if (!reply.raw.writableFinished) controller.abort();
|
|
11
|
+
});
|
|
12
|
+
return controller.signal;
|
|
13
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type { AppConfig } from "./app.js";
|
|
2
|
+
export { createApp } from "./app.js";
|
|
3
|
+
export {
|
|
4
|
+
HttpIdentityError,
|
|
5
|
+
type IdentityResolver,
|
|
6
|
+
identityFromBearer,
|
|
7
|
+
identityFromHeaders,
|
|
8
|
+
} from "./http-identity.js";
|
|
9
|
+
export type {
|
|
10
|
+
CatamorphicPluginOptions,
|
|
11
|
+
ProjectMcpHost,
|
|
12
|
+
ProjectMcpHostTool,
|
|
13
|
+
RouteContext,
|
|
14
|
+
} from "./plugin.js";
|
|
15
|
+
export { catamorphicPlugin } from "./plugin.js";
|
|
16
|
+
export { projectToolCapabilities } from "./project-capabilities.js";
|
|
17
|
+
export {
|
|
18
|
+
apiErrorResponse,
|
|
19
|
+
apiNotFoundResponse,
|
|
20
|
+
errorLogFields,
|
|
21
|
+
requestLogFields,
|
|
22
|
+
} from "./request-logging.js";
|
|
23
|
+
export { PREVIEW_REFUSAL_HEADER } from "./routes/session-previews.js";
|
|
24
|
+
export { pwaManifestWithLaunch, serveSpaDist } from "./spa.js";
|
|
25
|
+
export { instrumentHttpServer } from "./telemetry.js";
|