@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,117 @@
|
|
|
1
|
+
import type { CatamorphicCore, Identity } from "@catamorphic/core";
|
|
2
|
+
import type { FastifyReply } from "fastify";
|
|
3
|
+
/**
|
|
4
|
+
* The JSON-RPC / MCP plumbing shared by the plugin's MCP endpoints — the
|
|
5
|
+
* apps server (`/projects/:id/apps-mcp`), the workflow-tools server
|
|
6
|
+
* (`/projects/:id/mcp`) and the connection broker (`/connection-mcp`) —
|
|
7
|
+
* and by hosts that forward MCP servers of their own. All are stateless
|
|
8
|
+
* Streamable-HTTP handlers speaking the `initialize`-handshake protocol era
|
|
9
|
+
* (≤2025-11-25): requests are independent, no sessions, notifications
|
|
10
|
+
* answered with a bare 202.
|
|
11
|
+
*/
|
|
12
|
+
export interface JsonRpcMessage {
|
|
13
|
+
jsonrpc?: string;
|
|
14
|
+
id?: number | string | null;
|
|
15
|
+
method?: string;
|
|
16
|
+
params?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export declare const SUPPORTED_PROTOCOL_VERSIONS: Set<string>;
|
|
19
|
+
export declare const DEFAULT_PROTOCOL_VERSION = "2025-06-18";
|
|
20
|
+
/** The requested revision when supported, our default otherwise. */
|
|
21
|
+
export declare function negotiateProtocolVersion(requested: unknown): string;
|
|
22
|
+
/** A dispatch failure that should ride a specific JSON-RPC error code. */
|
|
23
|
+
export declare class McpRequestError extends Error {
|
|
24
|
+
readonly code: number;
|
|
25
|
+
constructor(code: number, message: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The stateless request shell the endpoints share: body-shape validation,
|
|
29
|
+
* the notification 202, missing-method rejection, and error mapping.
|
|
30
|
+
* `dispatch` returns the JSON-RPC result for a method; it throws
|
|
31
|
+
* {@link McpRequestError} for coded failures (-32601 method-not-found,
|
|
32
|
+
* -32602 bad params) and anything else becomes -32603.
|
|
33
|
+
*/
|
|
34
|
+
export declare function handleMcpPost(reply: FastifyReply, body: unknown, dispatch: (method: string, params: Record<string, unknown>) => Promise<unknown>): Promise<FastifyReply>;
|
|
35
|
+
export declare function rpcResult(reply: FastifyReply, id: number | string, result: unknown): FastifyReply;
|
|
36
|
+
export declare function rpcError(reply: FastifyReply, id: number | string | null, code: number, message: string): FastifyReply;
|
|
37
|
+
/**
|
|
38
|
+
* Tool result: JSON text for model readability plus `structuredContent`
|
|
39
|
+
* for structured consumers. MCP defines structured content as a JSON
|
|
40
|
+
* object, and clients such as Claude Code reject anything else, so arrays
|
|
41
|
+
* and primitives ride the text channel alone.
|
|
42
|
+
*/
|
|
43
|
+
export declare function toolValue(value: unknown): Record<string, unknown>;
|
|
44
|
+
export declare function toolError(message: string): Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Another MCP server's tool, listed as that server declared it (ADR 0225).
|
|
47
|
+
* These endpoints speak revisions where an output schema describes an
|
|
48
|
+
* object, so any other is left out: advertising it would make clients
|
|
49
|
+
* reject the results it describes.
|
|
50
|
+
*/
|
|
51
|
+
export declare function forwardedTool(tool: {
|
|
52
|
+
name: string;
|
|
53
|
+
title?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
inputSchema: unknown;
|
|
56
|
+
outputSchema?: unknown;
|
|
57
|
+
annotations?: unknown;
|
|
58
|
+
}): Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Another MCP server's tool result, forwarded as it was sent: content,
|
|
61
|
+
* structured content, `isError` and `_meta` unchanged (ADR 0225). These
|
|
62
|
+
* revisions require structured content to be an object, so any other
|
|
63
|
+
* (which newer revisions allow) is left out, and becomes the text when the
|
|
64
|
+
* server sent none. Anything that is not a tool result answers as a value,
|
|
65
|
+
* never as a failure: the call has already run.
|
|
66
|
+
*/
|
|
67
|
+
export declare function forwardedToolResult(result: unknown): Record<string, unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* Shared contract with `@catamorphic/app`'s MCP-host guest adapter (which
|
|
70
|
+
* duplicates the name — it cannot depend on core).
|
|
71
|
+
*/
|
|
72
|
+
export declare const POLL_RUN_TOOL = "catamorphic_poll_run";
|
|
73
|
+
/** The poll tool served beside the real tools on both MCP endpoints. */
|
|
74
|
+
export declare const POLL_RUN_TOOL_DEFINITION: Record<string, unknown>;
|
|
75
|
+
/** The poll tool's shared implementation, same on both endpoints. */
|
|
76
|
+
export declare function callPollRunTool(core: CatamorphicCore, identity: Identity, args: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
77
|
+
export interface RunSnapshotShape {
|
|
78
|
+
runId: string;
|
|
79
|
+
status: string;
|
|
80
|
+
output: unknown;
|
|
81
|
+
error: string | null;
|
|
82
|
+
progress?: {
|
|
83
|
+
discovered: number;
|
|
84
|
+
succeeded: number;
|
|
85
|
+
failed: number;
|
|
86
|
+
skipped: number;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** Mirrors the in-product broker's run snapshot (AppMount's shape). */
|
|
90
|
+
export declare function fetchRunSnapshot(core: CatamorphicCore, identity: Identity, runId: string): Promise<RunSnapshotShape>;
|
|
91
|
+
/** A tool another MCP server declared, as a forwarding endpoint lists it. */
|
|
92
|
+
export interface ForwardedToolDefinition {
|
|
93
|
+
name: string;
|
|
94
|
+
title?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
inputSchema: unknown;
|
|
97
|
+
outputSchema?: unknown;
|
|
98
|
+
annotations?: unknown;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A stateless MCP endpoint serving another server's tools: tools listed
|
|
102
|
+
* and results returned as that server declared and sent them (ADR 0225).
|
|
103
|
+
* `callTool` answers with the server's own result (any tool result, such
|
|
104
|
+
* as {@link toolError}, passes through), or throws {@link McpRequestError}
|
|
105
|
+
* for a refusal at the protocol boundary.
|
|
106
|
+
*/
|
|
107
|
+
export declare function serveForwardedTools(args: {
|
|
108
|
+
reply: FastifyReply;
|
|
109
|
+
body: unknown;
|
|
110
|
+
serverName: string;
|
|
111
|
+
listTools(): Promise<readonly ForwardedToolDefinition[]>;
|
|
112
|
+
callTool(call: {
|
|
113
|
+
name: string;
|
|
114
|
+
arguments: Record<string, unknown>;
|
|
115
|
+
}): Promise<unknown>;
|
|
116
|
+
}): Promise<FastifyReply>;
|
|
117
|
+
//# sourceMappingURL=mcp-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-shared.d.ts","sourceRoot":"","sources":["../src/mcp-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;;;;;;GAQG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG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EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAOD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,IAAI,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,IAAI,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtB,GAAG,OAAO,CAAC,YAAY,CAAC,CAuBxB"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP serving for hosts: an endpoint that forwards another MCP server's
|
|
3
|
+
* tools the way the plugin's own connection endpoint does (ADR 0225).
|
|
4
|
+
*/
|
|
5
|
+
export { type ForwardedToolDefinition, McpRequestError, serveForwardedTools, toolError, } from "./mcp-shared.js";
|
|
6
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,KAAK,uBAAuB,EAC5B,eAAe,EACf,mBAAmB,EACnB,SAAS,GACV,MAAM,iBAAiB,CAAC"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
McpRequestError2,
|
|
3
|
+
toolError2,
|
|
4
|
+
serveForwardedTools2
|
|
5
|
+
} from "./chunk-baagvvm3.js";
|
|
6
|
+
export {
|
|
7
|
+
McpRequestError2 as McpRequestError,
|
|
8
|
+
serveForwardedTools2 as serveForwardedTools,
|
|
9
|
+
toolError2 as toolError
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//# debugId=8061829D6A9EECAB64756E2164756E21
|
|
13
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { CatamorphicCore, Identity } from "@catamorphic/core";
|
|
2
|
+
import type { FastifyPluginAsync } from "fastify";
|
|
3
|
+
import { type IdentityResolver } from "./http-identity.js";
|
|
4
|
+
export interface CatamorphicPluginOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Wired catamorphic services (build them with `@catamorphic/server-sdk` or
|
|
7
|
+
* `createCatamorphicCore`). Required for any non-trivial route; when
|
|
8
|
+
* omitted, project / run / workflow endpoints respond 503.
|
|
9
|
+
*/
|
|
10
|
+
core?: CatamorphicCore;
|
|
11
|
+
/**
|
|
12
|
+
* Who is calling. Runs on every request before any route; returns the root
|
|
13
|
+
* identity for the host itself, a scoped identity with project permissions
|
|
14
|
+
* for a member (an admin, an app user, a customer), or `null` for 401. Typically a few lines that read the host's
|
|
15
|
+
* own session and its entitlement table:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* identity: async (req) => {
|
|
19
|
+
* const session = await verifySession(req);
|
|
20
|
+
* if (!session) return null;
|
|
21
|
+
* const base = { tenantId: session.orgId, externalUserId: session.userId };
|
|
22
|
+
* if (session.isEmployee) return base;
|
|
23
|
+
* return { ...base, scope: await entitlementsFor(session.userId) };
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Hosts whose auth terminates in front of the plugin pass
|
|
28
|
+
* `identityFromHeaders()`.
|
|
29
|
+
*/
|
|
30
|
+
identity: IdentityResolver;
|
|
31
|
+
/**
|
|
32
|
+
* Coarse host feature switches (ADR 0055). Enforced server-side by the
|
|
33
|
+
* routes concerned AND advertised on `GET /me`, so a client (the desktop,
|
|
34
|
+
* a member's own agent) can show what is possible instead of discovering
|
|
35
|
+
* it by 403. Scope stays the mechanism for "may not"; these are the few
|
|
36
|
+
* things a host decides for everyone.
|
|
37
|
+
*/
|
|
38
|
+
features?: Partial<HostFeatures>;
|
|
39
|
+
/**
|
|
40
|
+
* The API base outsiders reach this plugin at (e.g.
|
|
41
|
+
* `https://brain.acme.com/api`), for URLs handed to other services such
|
|
42
|
+
* as webhook URLs. Defaults to the request's own origin and mount prefix.
|
|
43
|
+
*/
|
|
44
|
+
publicApiBase?: string;
|
|
45
|
+
/** Host additions to the project MCP endpoint (ADR 0166). */
|
|
46
|
+
projectMcp?: ProjectMcpHost;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What a host adds to `POST /projects/:projectId/mcp`: the name a client
|
|
50
|
+
* shows, a paragraph appended to the orientation every client receives at
|
|
51
|
+
* `initialize`, and tools the host owns (the Work server's shares). Host
|
|
52
|
+
* tools see the caller's identity and enforce their own permissions.
|
|
53
|
+
*/
|
|
54
|
+
export interface ProjectMcpHost {
|
|
55
|
+
serverInfo?: {
|
|
56
|
+
name: string;
|
|
57
|
+
title: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
};
|
|
60
|
+
instructions?: string;
|
|
61
|
+
tools?: (args: {
|
|
62
|
+
identity: Identity;
|
|
63
|
+
projectId: string;
|
|
64
|
+
}) => ProjectMcpHostTool[];
|
|
65
|
+
}
|
|
66
|
+
export interface ProjectMcpHostTool {
|
|
67
|
+
definition: {
|
|
68
|
+
name: string;
|
|
69
|
+
description: string;
|
|
70
|
+
inputSchema: Record<string, unknown>;
|
|
71
|
+
annotations?: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
/** Returns the tool's result; a thrown error becomes a tool error. */
|
|
74
|
+
call: (args: Record<string, unknown>) => Promise<unknown>;
|
|
75
|
+
}
|
|
76
|
+
/** What a host enables for all callers; defaults are the most permissive. */
|
|
77
|
+
export interface HostFeatures {
|
|
78
|
+
/** Which publication audiences may be created: both, members only, or none. */
|
|
79
|
+
publications: "public" | "members" | false;
|
|
80
|
+
/** Whether members may propose program changes. */
|
|
81
|
+
proposals: boolean;
|
|
82
|
+
/** Whether the project MCP endpoint is served. */
|
|
83
|
+
mcp: boolean;
|
|
84
|
+
/** Largest store document accepted (bytes). */
|
|
85
|
+
storeUploadMaxBytes: number;
|
|
86
|
+
}
|
|
87
|
+
export declare const DEFAULT_HOST_FEATURES: HostFeatures;
|
|
88
|
+
export interface RouteContext {
|
|
89
|
+
core?: CatamorphicCore;
|
|
90
|
+
features: HostFeatures;
|
|
91
|
+
publicApiBase?: string;
|
|
92
|
+
projectMcp?: ProjectMcpHost;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Mountable Fastify plugin exposing the catamorphic HTTP API. Hosts register
|
|
96
|
+
* it on their own Fastify instance:
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* app.register(catamorphicPlugin, { core, prefix: "/api" });
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* The generated api-client (`@catamorphic/api-client`) expects the routes
|
|
103
|
+
* under `/api`, so mount with that prefix unless you also change the client's
|
|
104
|
+
* `baseUrl`. The plugin is fully encapsulated: it sets Zod validator /
|
|
105
|
+
* serializer compilers and an error handler for its own scope only, and it
|
|
106
|
+
* registers no CORS — the host owns cross-origin policy.
|
|
107
|
+
*
|
|
108
|
+
* Identity comes from the host's `identity` resolver — the only identity
|
|
109
|
+
* mechanism; there is no header fallback unless the host opts into
|
|
110
|
+
* `identityFromHeaders()` explicitly.
|
|
111
|
+
*/
|
|
112
|
+
export declare const catamorphicPlugin: FastifyPluginAsync<CatamorphicPluginOptions>;
|
|
113
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AAED,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,YAAY,EAAE,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC;IAC3C,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,GAAG,EAAE,OAAO,CAAC;IACb,+CAA+C;IAC/C,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,qBAAqB,EAAE,YAKnC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAChD,wBAAwB,CAmJzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AgentCapability, type AgentCapabilityContext, type AgentCapabilityInvocation, type CatamorphicCore } from "@catamorphic/core";
|
|
2
|
+
import { type SurfaceFeatures } from "./project-mcp-surface.js";
|
|
3
|
+
/** Internal projection of the public project tools. Both call the same services. */
|
|
4
|
+
export declare function projectToolCapabilities(args: {
|
|
5
|
+
core: CatamorphicCore;
|
|
6
|
+
context: AgentCapabilityContext;
|
|
7
|
+
features?: SurfaceFeatures;
|
|
8
|
+
/** Host execution version, composed with the project tool definition. */
|
|
9
|
+
revision?: string;
|
|
10
|
+
consent?: (tool: {
|
|
11
|
+
name: string;
|
|
12
|
+
effect: "read" | "write";
|
|
13
|
+
}) => string | undefined;
|
|
14
|
+
allow?: (tool: {
|
|
15
|
+
name: string;
|
|
16
|
+
effect: "read" | "write";
|
|
17
|
+
}) => boolean;
|
|
18
|
+
beforeCall?: (tool: {
|
|
19
|
+
name: string;
|
|
20
|
+
effect: "read" | "write";
|
|
21
|
+
input: unknown;
|
|
22
|
+
invocation: AgentCapabilityInvocation;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
}): Promise<AgentCapability[]>;
|
|
25
|
+
//# sourceMappingURL=project-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-capabilities.d.ts","sourceRoot":"","sources":["../src/project-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EAErB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,eAAe,EAAgB,MAAM,0BAA0B,CAAC;AA8B9E,oFAAoF;AACpF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,sBAAsB,CAAC;IAChC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;KAC1B,KAAK,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;IACtE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC;QACf,UAAU,EAAE,yBAAyB,CAAC;KACvC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA+F7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CatamorphicCore, Identity } from "@catamorphic/core";
|
|
2
|
+
import type { SurfaceTool } from "./project-mcp-surface.js";
|
|
3
|
+
export declare function programTools(core: CatamorphicCore, identity: Identity, projectId: string): SurfaceTool[];
|
|
4
|
+
/**
|
|
5
|
+
* The orientation a client receives at `initialize`: what this endpoint is
|
|
6
|
+
* and the member's working loop, naming only tools this caller has.
|
|
7
|
+
*/
|
|
8
|
+
export declare function projectInstructions(args: {
|
|
9
|
+
core: CatamorphicCore;
|
|
10
|
+
identity: Identity;
|
|
11
|
+
projectId: string;
|
|
12
|
+
toolNames: ReadonlySet<string>;
|
|
13
|
+
host?: string;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=project-mcp-program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-mcp-program.d.ts","sourceRoot":"","sources":["../src/project-mcp-program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EACf,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAkB3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAoB5D,wBAAgB,YAAY,CAC1B,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,GAChB,WAAW,EAAE,CAiPf;AA+QD;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAsClB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CatamorphicCore, Identity } from "@catamorphic/core";
|
|
2
|
+
import { mayUseProject } from "@catamorphic/core";
|
|
3
|
+
export interface SurfaceTool {
|
|
4
|
+
definition: Record<string, unknown>;
|
|
5
|
+
call: (args: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
6
|
+
}
|
|
7
|
+
export { mayUseProject };
|
|
8
|
+
/** Workflow names a scoped caller may see on the tools list; null = all. */
|
|
9
|
+
export declare function allowedWorkflowNames(core: CatamorphicCore, identity: Identity, projectId: string): Promise<ReadonlySet<string> | null>;
|
|
10
|
+
export interface SurfaceFeatures {
|
|
11
|
+
publications: "public" | "members" | false;
|
|
12
|
+
proposals: boolean;
|
|
13
|
+
storeUploadMaxBytes?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function surfaceTools(core: CatamorphicCore, identity: Identity, projectId: string, features?: SurfaceFeatures, currentSessionId?: string): SurfaceTool[];
|
|
16
|
+
//# sourceMappingURL=project-mcp-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-mcp-surface.d.ts","sourceRoot":"","sources":["../src/project-mcp-surface.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAIL,aAAa,EAMd,MAAM,mBAAmB,CAAC;AAwB3B,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3E;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,4EAA4E;AAC5E,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAQrC;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,eAA6D,EACvE,gBAAgB,CAAC,EAAE,MAAM,GACxB,WAAW,EAAE,CAsyBf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FastifyReply, FastifyRequest } from "fastify";
|
|
2
|
+
/** URLs can carry OAuth codes, bearer state and webhook tokens. */
|
|
3
|
+
export declare function requestLogFields(request: FastifyRequest): {
|
|
4
|
+
method: string;
|
|
5
|
+
route: string;
|
|
6
|
+
remoteAddress: string;
|
|
7
|
+
};
|
|
8
|
+
/** Provider and database exception messages can repeat credential material. */
|
|
9
|
+
export declare function errorLogFields(_error: unknown): {
|
|
10
|
+
type: string;
|
|
11
|
+
message: string;
|
|
12
|
+
stack: string;
|
|
13
|
+
};
|
|
14
|
+
/** Sending an Error invokes Fastify's raw-message logger; send safe data. */
|
|
15
|
+
export declare function apiErrorResponse(error: unknown, request: FastifyRequest, reply: FastifyReply): FastifyReply<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
|
|
16
|
+
/** Fastify's default 404 logs the credential-bearing raw URL as its message. */
|
|
17
|
+
export declare function apiNotFoundResponse(_request: FastifyRequest, reply: FastifyReply): FastifyReply<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
|
|
18
|
+
//# sourceMappingURL=request-logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-logging.d.ts","sourceRoot":"","sources":["../src/request-logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc;IAEpD,MAAM;IACN,KAAK;IACL,aAAa;EAEhB;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO;IACnC,IAAI;IAAW,OAAO;IAAoB,KAAK;EACzD;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,4SAkBpB;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,YAAY,4SAGpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-capabilities.d.ts","sourceRoot":"","sources":["../../src/routes/agent-capabilities.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CA+EN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/routes/agent.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAqD9C,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,QAi5C1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps-mcp.d.ts","sourceRoot":"","sources":["../../src/routes/apps-mcp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAmD9C,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,QAiF5E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* Every viewer-facing app route narrows whoever arrives to this one app
|
|
5
|
+
* (ADR 0053, 0158): an admin's identity is confined to the app while inside
|
|
6
|
+
* it (the untrusted bundle never inherits project access or permissions) and a viewer's
|
|
7
|
+
* scoped identity must cover the app or ends up with an empty scope. The
|
|
8
|
+
* narrowing is structural (it is the route, not a header the client sends),
|
|
9
|
+
* so there is no claim to validate and nothing to forge.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerAppRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
12
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/routes/apps.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,SAAS,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAsB9C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,QAioBxE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* A member's This machine runner (ADRs 0098, 0187). It registers the public
|
|
5
|
+
* key its operations are sealed to, and poll hands them out sealed (ADR
|
|
6
|
+
* 0207). Poll long-polls; a 409 from poll or renew means the lease moved on
|
|
7
|
+
* and the runner registers again, a 409 from complete refuses only that
|
|
8
|
+
* receipt, and a 403 means the member may no longer serve this Environment.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerClientRunnerRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
11
|
+
//# sourceMappingURL=client-runners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-runners.d.ts","sourceRoot":"","sources":["../../src/routes/client-runners.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAO9C;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,QA+NlB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* Code hosts over connections (ADR 0177): the caller's personal connection
|
|
5
|
+
* to a code host's provider, the repositories it reaches, repository import,
|
|
6
|
+
* and publishing a project. A personal authorization completes through
|
|
7
|
+
* `/connection-authorizations/complete` (or the provider's callback) and is
|
|
8
|
+
* revoked with `DELETE /connections/:id`, like any connection.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerCodeHostRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
11
|
+
//# sourceMappingURL=code-hosts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-hosts.d.ts","sourceRoot":"","sources":["../../src/routes/code-hosts.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAe9C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CAkLN"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* One brokered connection as an agent's MCP server (`connection_<alias>`).
|
|
5
|
+
* An MCP connection's tools and results pass through as its server
|
|
6
|
+
* declared and sent them; other connections' actions answer as JSON tool
|
|
7
|
+
* results and declare no output schema (ADR 0225).
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerConnectionMcpRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
10
|
+
//# sourceMappingURL=connection-mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-mcp.d.ts","sourceRoot":"","sources":["../../src/routes/connection-mcp.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAQ9C;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CAuGN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/routes/connections.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAG7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA8B9C,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CA8aN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* The documents surface (ADR 0055): one path namespace — the program (git,
|
|
5
|
+
* read-only here) and the project store (`store/…`, versioned, caller-
|
|
6
|
+
* stamped) — filtered by the caller's document refs. JSON for metadata,
|
|
7
|
+
* text and writes (text or base64); `/documents/raw` streams bytes for
|
|
8
|
+
* downloads and binaries.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerDocumentRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
11
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/routes/documents.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAoB9C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,QAiflB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../src/routes/environments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAS9C,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CAwDN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GitGatewayOperation } from "@catamorphic/core";
|
|
2
|
+
import type { FastifyInstance } from "fastify";
|
|
3
|
+
import type { RouteContext } from "../app.js";
|
|
4
|
+
/**
|
|
5
|
+
* Git smart HTTP through the gateway (ADR 0175), for sandboxes' `git`:
|
|
6
|
+
* `<prefix>/gateway/git/<alias>/<repository>/info/refs`,
|
|
7
|
+
* `.../git-upload-pack`, and `.../git-receive-pack`. The password (or a
|
|
8
|
+
* bearer) is the session's grant; bodies stream both ways and are never
|
|
9
|
+
* parsed by Fastify. Hidden from the API spec: Git clients speak it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerGitGatewayRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
12
|
+
/** The operation and repository a smart-HTTP path names. */
|
|
13
|
+
export declare function gitTarget(input: {
|
|
14
|
+
method: "GET" | "POST";
|
|
15
|
+
path: string;
|
|
16
|
+
service: string | undefined;
|
|
17
|
+
}): {
|
|
18
|
+
repositoryPath: string;
|
|
19
|
+
operation: GitGatewayOperation;
|
|
20
|
+
} | null;
|
|
21
|
+
//# sourceMappingURL=git-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-gateway.d.ts","sourceRoot":"","sources":["../../src/routes/git-gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CAeN;AA8CD,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,GAAG;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,mBAAmB,CAAA;CAAE,GAAG,IAAI,CAwBpE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* HTTP APIs through the gateway (ADR 0212), for code in sandboxes:
|
|
5
|
+
* `<prefix>/gateway/http/<alias>` and anything below it, the API's own
|
|
6
|
+
* requests below the connection's base URL with the session's grant as a
|
|
7
|
+
* bearer, the Basic password, or `x-work-grant`. The grant is checked
|
|
8
|
+
* before the body is read; the body travels byte for byte and answers
|
|
9
|
+
* stream back as the API sent them. Hidden from the API spec: the API's
|
|
10
|
+
* own clients speak it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerHttpGatewayRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
13
|
+
//# sourceMappingURL=http-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-gateway.d.ts","sourceRoot":"","sources":["../../src/routes/http-gateway.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CAuBN"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* Introspection (ADR 0055): what THIS caller may do, and what THIS host
|
|
5
|
+
* enables — so a client shows the possible instead of discovering it by
|
|
6
|
+
* 403. Two halves: the identity as resolved (root or scope), summarised
|
|
7
|
+
* per project (which permissions? which agents? which store subtrees?), and
|
|
8
|
+
* the host's feature switches. Versioned so an older host degrades to
|
|
9
|
+
* "assume everything" on a newer client.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerMeRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
12
|
+
//# sourceMappingURL=me.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/routes/me.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAkB9C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,QAsFvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* Roles and memberships (ADR 0055). Roles are committed files
|
|
5
|
+
* (`.work/roles/<slug>.json`) — read here, edited through the project file
|
|
6
|
+
* routes like any other file. Memberships are the stock `user → roles +
|
|
7
|
+
* grants` table: what a host's invite writes and its identity resolver
|
|
8
|
+
* reads (`core.memberships.identityFor`). Reads need `memberships:read`
|
|
9
|
+
* (a member may read their own row); changes `memberships:write`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerMembershipRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
12
|
+
//# sourceMappingURL=memberships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/routes/memberships.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAW9C;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,QA2IlB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { RouteContext } from "../app.js";
|
|
3
|
+
/**
|
|
4
|
+
* Models through the gateway (ADR 0180), for harnesses in sandboxes:
|
|
5
|
+
* `<prefix>/gateway/model/<alias>/<any path below the provider's base URL>`,
|
|
6
|
+
* the provider's own HTTP API with the session's grant as its key, any
|
|
7
|
+
* method. The grant is checked before the body is read; the body travels
|
|
8
|
+
* byte for byte and answers stream back as the provider sent them. Hidden
|
|
9
|
+
* from the API spec: model clients speak it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerModelGatewayRoutes(app: FastifyInstance, ctx: RouteContext): void;
|
|
12
|
+
//# sourceMappingURL=model-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-gateway.d.ts","sourceRoot":"","sources":["../../src/routes/model-gateway.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,GAChB,IAAI,CAoBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/routes/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAiB9C,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,YAAY,QA8ElB"}
|