mirror of
https://github.com/morluto/rea
synced 2026-10-27 22:45:19 -04:00
187f113f79
Capture the current entrypoint once without inventing a path. Preserve unknown registration ownership through setup and doctor, refuse unsafe registration plans, and retain exact pinned-launcher readiness checks. Hash the same full or compact schema projection advertised by each MCP server and use that identity in doctor comparisons. BREAKING CHANGE: server.command_path may be null when the invocation path is unavailable. Registration and setup statuses, and doctor classifications, may report unknown. Reviewed-PR: #3230, #3015 Co-authored-by: qorvr <330186599+qorvr@users.noreply.github.com> Co-authored-by: Hemang Varshney <218273197+hemv-857@users.noreply.github.com>
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
import { jsonObjectSchema, type JsonValue } from "../domain/jsonValue.js";
|
|
import { createServerIdentity } from "../serverIdentity.js";
|
|
import { silentLogger } from "../logger.js";
|
|
import type { Logger } from "pino";
|
|
import type { DirectAnalysisDependencies } from "./DirectAnalysisDependencies.js";
|
|
import { providerCapabilitySet } from "../contracts/toolOutputSchemaPrimitives.js";
|
|
import { providerCapabilitySets } from "./binary/BinarySessionStatus.js";
|
|
import { sqliteDatabaseCapability } from "./sqlite/SqliteDatabaseCapability.js";
|
|
import { CURRENT_ENTRYPOINT_PATH } from "../process/CurrentEntrypointPath.js";
|
|
|
|
/** Read target-free provider status and operation availability. */
|
|
export const runSessionStatus = async (
|
|
dependencies: Pick<
|
|
DirectAnalysisDependencies,
|
|
"createBinarySession" | "readConfiguration"
|
|
>,
|
|
logger: Logger = silentLogger,
|
|
): Promise<JsonValue> => {
|
|
const config = dependencies.readConfiguration();
|
|
if (!config.ok) return { error: projectAnalysisError(config.error) };
|
|
const session = await dependencies.createBinarySession(config.value, logger);
|
|
try {
|
|
const status = jsonObjectSchema.parse(session.status());
|
|
return {
|
|
...status,
|
|
capabilities: [
|
|
...providerCapabilitySet.array().parse(status.capabilities),
|
|
...providerCapabilitySets([
|
|
sqliteDatabaseCapability(process.versions.node),
|
|
]),
|
|
],
|
|
server_identity: createServerIdentity({
|
|
startedAt: new Date().toISOString(),
|
|
commandPath: CURRENT_ENTRYPOINT_PATH,
|
|
}),
|
|
};
|
|
} finally {
|
|
await session.close();
|
|
}
|
|
};
|