@malloy-publisher/server 0.0.225 → 0.0.227
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 +2 -11
- package/dist/app/api-doc.yaml +29 -24
- package/dist/app/assets/{EnvironmentPage-DYTeXDll.js → EnvironmentPage-DvOJ7L_b.js} +1 -1
- package/dist/app/assets/{HomePage-pDK2BPJY.js → HomePage-CXguJsXS.js} +1 -1
- package/dist/app/assets/{LightMode-C2bwGPY1.js → LightMode-ZsshUznu.js} +1 -1
- package/dist/app/assets/{MainPage-WtBulMH_.js → MainPage-BIe0VwBa.js} +2 -2
- package/dist/app/assets/{MaterializationsPage-hMgOtflG.js → MaterializationsPage-BuZ6UJVx.js} +1 -1
- package/dist/app/assets/{ModelPage-B2N5kYII.js → ModelPage-DsPf-s8B.js} +1 -1
- package/dist/app/assets/{PackagePage-CEN90nQG.js → PackagePage-CEVNAKZa.js} +1 -1
- package/dist/app/assets/{RouteError-BG2c5Zf0.js → RouteError-Chn7lL96.js} +1 -1
- package/dist/app/assets/{ThemeEditorPage-DNfeUwEZ.js → ThemeEditorPage-DWC_FdNU.js} +1 -1
- package/dist/app/assets/{WorkbookPage-NKI1BhFS.js → WorkbookPage-CGrsFz8p.js} +1 -1
- package/dist/app/assets/{core-C6anj5c0.es-DDLHqpzt.js → core-vVgoO8IR.es-BD_THWs_.js} +1 -1
- package/dist/app/assets/{index-DMQtnaf4.js → index-BioohWQj.js} +1 -1
- package/dist/app/assets/{index-CzNqKMVl.js → index-D6YtyiJ0.js} +1 -1
- package/dist/app/assets/{index-C6gZ6sSY.js → index-DNUZpnaa.js} +4 -4
- package/dist/app/assets/{index-JXgvyZna.js → index-gEWxu09x.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/instrumentation.mjs +71 -15
- package/dist/package_load_worker.mjs +169 -40
- package/dist/server.mjs +782 -7050
- package/package.json +1 -4
- package/src/controller/package.controller.spec.ts +17 -17
- package/src/controller/package.controller.ts +7 -6
- package/src/health.ts +3 -8
- package/src/logger.spec.ts +193 -0
- package/src/logger.ts +115 -18
- package/src/mcp/error_messages.ts +8 -37
- package/src/mcp/handler_utils.ts +10 -129
- package/src/mcp/mcp_constants.ts +0 -16
- package/src/mcp/{agent_server.protocol.spec.ts → server.protocol.spec.ts} +14 -12
- package/src/mcp/server.ts +29 -37
- package/src/mcp/skills/build_skills_bundle.ts +1 -1
- package/src/mcp/skills/skills_bundle.json +1 -1
- package/src/mcp/tools/docs_search_tool.ts +1 -1
- package/src/mcp/tools/execute_query_tool.ts +2 -2
- package/src/mcp/tools/get_context_eval.ts +3 -3
- package/src/mcp/tools/get_context_tool.spec.ts +196 -1
- package/src/mcp/tools/get_context_tool.ts +165 -67
- package/src/package_load/package_load_pool.ts +8 -1
- package/src/package_load/package_load_worker.ts +75 -24
- package/src/package_load/protocol.ts +21 -1
- package/src/package_load/rpc_wait_accountant.spec.ts +109 -0
- package/src/package_load/rpc_wait_accountant.ts +76 -0
- package/src/package_load_metrics.spec.ts +114 -0
- package/src/package_load_metrics.ts +127 -0
- package/src/pg_helpers.spec.ts +2 -206
- package/src/pg_helpers.ts +4 -120
- package/src/server.ts +0 -16
- package/src/service/build_plan.spec.ts +42 -60
- package/src/service/build_plan.ts +37 -61
- package/src/service/environment.ts +5 -1
- package/src/service/materialization_test_fixtures.ts +6 -8
- package/src/service/package.ts +165 -86
- package/src/service/package_manifest.spec.ts +22 -1
- package/src/service/package_manifest.ts +29 -0
- package/src/service/persistence_policy.spec.ts +234 -0
- package/src/test_helpers/metrics_harness.ts +40 -0
- package/tests/harness/mcp_test_setup.ts +1 -1
- package/tests/integration/mcp/mcp_transport.integration.spec.ts +7 -31
- package/tests/integration/watch-mode/watch_mode.integration.spec.ts +0 -6
- package/dxt/malloy_bridge.py +0 -354
- package/dxt/manifest.json +0 -22
- package/src/dto/connection.dto.spec.ts +0 -186
- package/src/dto/connection.dto.ts +0 -308
- package/src/dto/index.ts +0 -2
- package/src/dto/package.dto.spec.ts +0 -42
- package/src/dto/package.dto.ts +0 -27
- package/src/dto/validate.spec.ts +0 -76
- package/src/dto/validate.ts +0 -31
- package/src/ducklake_version.spec.ts +0 -43
- package/src/ducklake_version.ts +0 -26
- package/src/mcp/agent_server.spec.ts +0 -18
- package/src/mcp/agent_server.ts +0 -144
- package/src/mcp/prompts/handlers.ts +0 -84
- package/src/mcp/prompts/index.ts +0 -11
- package/src/mcp/prompts/prompt_definitions.ts +0 -160
- package/src/mcp/prompts/prompt_service.ts +0 -67
- package/src/mcp/prompts/utils.ts +0 -62
- package/src/mcp/resource_metadata.ts +0 -47
- package/src/mcp/resources/environment_resource.ts +0 -187
- package/src/mcp/resources/model_resource.ts +0 -155
- package/src/mcp/resources/notebook_resource.ts +0 -137
- package/src/mcp/resources/package_resource.ts +0 -373
- package/src/mcp/resources/query_resource.ts +0 -122
- package/src/mcp/resources/source_resource.ts +0 -141
- package/src/mcp/resources/view_resource.ts +0 -136
- package/src/mcp/tools/discovery_tools.ts +0 -280
- package/src/service/materialization_cron_gate.spec.ts +0 -181
- package/src/storage/BaseRepository.ts +0 -31
- package/src/storage/StorageManager.mock.ts +0 -50
- package/tests/harness/e2e.ts +0 -96
- package/tests/harness/mocks.ts +0 -39
- package/tests/harness/uris.ts +0 -31
- package/tests/integration/mcp/mcp_resource.integration.spec.ts +0 -655
- package/tests/integration/mcp/setup.spec.ts +0 -5
- package/tests/unit/mcp/prompt_definitions.test.ts +0 -102
- package/tests/unit/mcp/prompt_happy.test.ts +0 -51
package/tests/harness/e2e.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
3
|
-
import type {
|
|
4
|
-
Notification,
|
|
5
|
-
Request,
|
|
6
|
-
Result,
|
|
7
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
-
import http from "http";
|
|
9
|
-
import path from "path";
|
|
10
|
-
import { fileURLToPath } from "url";
|
|
11
|
-
import { URL } from "url";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* E2E environment descriptor returned by {@link startE2E}.
|
|
15
|
-
*/
|
|
16
|
-
export interface E2EEnv {
|
|
17
|
-
httpServer: http.Server;
|
|
18
|
-
serverUrl: string;
|
|
19
|
-
mcpClient: Client<Request, Notification, Result>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let originalServerRoot: string | undefined;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Spin-up the real Express app (via mcp/server.ts), expose its base URL and
|
|
26
|
-
* return a fully-connected MCP client. The caller **must** invoke {@link stop}
|
|
27
|
-
* once its suite finishes.
|
|
28
|
-
*/
|
|
29
|
-
export async function startE2E(): Promise<E2EEnv & { stop(): Promise<void> }> {
|
|
30
|
-
//--------------------------------------------------------------------------
|
|
31
|
-
// 1. Set SERVER_ROOT so EnvironmentStore loader finds publisher.config.json
|
|
32
|
-
//--------------------------------------------------------------------------
|
|
33
|
-
originalServerRoot = process.env.SERVER_ROOT;
|
|
34
|
-
// Use import.meta.url for cross-platform compatibility (works on Windows)
|
|
35
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
36
|
-
const __dirname = path.dirname(__filename);
|
|
37
|
-
const serverPackageDir = path.resolve(__dirname, "../../../"); // packages/server
|
|
38
|
-
process.env.SERVER_ROOT = serverPackageDir;
|
|
39
|
-
|
|
40
|
-
//--------------------------------------------------------------------------
|
|
41
|
-
// 2. Dynamically import the configured Express app AFTER env var mutation
|
|
42
|
-
//--------------------------------------------------------------------------
|
|
43
|
-
const { mcpApp } = await import("../../src/server");
|
|
44
|
-
|
|
45
|
-
//--------------------------------------------------------------------------
|
|
46
|
-
// 3. Start HTTP server on a predictable high port (4042 by default)
|
|
47
|
-
//--------------------------------------------------------------------------
|
|
48
|
-
const TEST_PORT = Number(process.env.MCP_PORT || 4040) + 2;
|
|
49
|
-
|
|
50
|
-
const httpServer: http.Server = await new Promise<http.Server>(
|
|
51
|
-
(resolve, reject) => {
|
|
52
|
-
const srv = http
|
|
53
|
-
.createServer(mcpApp)
|
|
54
|
-
.listen(TEST_PORT, "127.0.0.1", () => resolve(srv));
|
|
55
|
-
|
|
56
|
-
srv.on("error", (err: NodeJS.ErrnoException) => {
|
|
57
|
-
/* c8 ignore next 3 */
|
|
58
|
-
console.error("[E2E] server listen error", err);
|
|
59
|
-
reject(err);
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const serverUrl = `http://127.0.0.1:${TEST_PORT}`;
|
|
65
|
-
|
|
66
|
-
//--------------------------------------------------------------------------
|
|
67
|
-
// 4. Connect MCP client over HTTP streaming bridge
|
|
68
|
-
//--------------------------------------------------------------------------
|
|
69
|
-
const mcpClient = new Client<Request, Notification, Result>({
|
|
70
|
-
name: "mcp-e2e-client",
|
|
71
|
-
version: "1.0",
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const transport = new StreamableHTTPClientTransport(
|
|
75
|
-
new URL(`${serverUrl}/mcp`),
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
await mcpClient.connect(transport);
|
|
79
|
-
|
|
80
|
-
//--------------------------------------------------------------------------
|
|
81
|
-
// 5. Return env + graceful stop helper
|
|
82
|
-
//--------------------------------------------------------------------------
|
|
83
|
-
const stop = async (): Promise<void> => {
|
|
84
|
-
try {
|
|
85
|
-
await mcpClient.close();
|
|
86
|
-
} finally {
|
|
87
|
-
httpServer.closeAllConnections?.();
|
|
88
|
-
await new Promise<void>((r) => httpServer.close(() => r()));
|
|
89
|
-
// Restore SERVER_ROOT
|
|
90
|
-
if (originalServerRoot === undefined) delete process.env.SERVER_ROOT;
|
|
91
|
-
else process.env.SERVER_ROOT = originalServerRoot;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return { httpServer, serverUrl, mcpClient, stop };
|
|
96
|
-
}
|
package/tests/harness/mocks.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import sinon from "sinon";
|
|
2
|
-
import { EnvironmentStore } from "../../src/service/environment_store";
|
|
3
|
-
|
|
4
|
-
/** Return a stubbed EnvironmentStore where every lookup throws or returns minimal objects. */
|
|
5
|
-
export function fakeEnvironmentStore(): sinon.SinonStubbedInstance<EnvironmentStore> {
|
|
6
|
-
const es = sinon.createStubInstance(EnvironmentStore);
|
|
7
|
-
// For now just have getEnvironment reject; suites can stub more.
|
|
8
|
-
es.getEnvironment.rejects(
|
|
9
|
-
new Error("fakeEnvironmentStore: getEnvironment not stubbed"),
|
|
10
|
-
);
|
|
11
|
-
return es;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// The runtime implementation of `McpServer` lives in the MCP SDK package, which
|
|
15
|
-
// is **not** required for unit/integration tests that only need a stubbed
|
|
16
|
-
// instance. Importing it at runtime would fail when the dependency is not
|
|
17
|
-
// present in the local workspace. Instead we define a minimal dummy class that
|
|
18
|
-
// satisfies Sinon while keeping the public type surface the same for tests.
|
|
19
|
-
//
|
|
20
|
-
// NOTE: If we later add the real SDK as a dependency we can simply replace this
|
|
21
|
-
// dummy class with:
|
|
22
|
-
// import { McpServer } from "@modelcontextprotocol/sdk";
|
|
23
|
-
class DummyMcpServer {}
|
|
24
|
-
|
|
25
|
-
// Re-export the symbol so downstream test files can continue to refer to the
|
|
26
|
-
// name `McpServer` without changes.
|
|
27
|
-
export type McpServer = DummyMcpServer;
|
|
28
|
-
|
|
29
|
-
/** Convenience helper mimicking the old mocks used in integration specs. */
|
|
30
|
-
export function createMalloyServiceMocks() {
|
|
31
|
-
return {
|
|
32
|
-
environmentStore: fakeEnvironmentStore(),
|
|
33
|
-
} as const;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Create a Sinon spy wrapper around a new DummyMcpServer instance. */
|
|
37
|
-
export function spyMcpServer(): sinon.SinonStubbedInstance<DummyMcpServer> {
|
|
38
|
-
return sinon.createStubInstance(DummyMcpServer);
|
|
39
|
-
}
|
package/tests/harness/uris.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface FixtureUris {
|
|
2
|
-
project: string;
|
|
3
|
-
package: string;
|
|
4
|
-
flightsModel: string;
|
|
5
|
-
source: string;
|
|
6
|
-
view: string;
|
|
7
|
-
query: string;
|
|
8
|
-
notebook: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Return canonical URIs used across integration tests, parametrised by project
|
|
13
|
-
* and package. Most suites will call this with defaults.
|
|
14
|
-
*/
|
|
15
|
-
export function malloyUris(
|
|
16
|
-
project = "malloy-samples",
|
|
17
|
-
pkg = "faa",
|
|
18
|
-
): FixtureUris {
|
|
19
|
-
const base = `malloy://project/${project}`;
|
|
20
|
-
const pkgUri = `${base}/package/${pkg}`;
|
|
21
|
-
const model = `${pkgUri}/models/flights.malloy`;
|
|
22
|
-
return {
|
|
23
|
-
project: base,
|
|
24
|
-
package: pkgUri,
|
|
25
|
-
flightsModel: model,
|
|
26
|
-
source: `${model}/sources/flights`,
|
|
27
|
-
view: `${model}/sources/flights/views/flights_by_month`,
|
|
28
|
-
query: `${model}/queries/flights_by_carrier`,
|
|
29
|
-
notebook: `${pkgUri}/notebooks/overview.malloynb`,
|
|
30
|
-
};
|
|
31
|
-
}
|