feat: migrate todo note to nc01 github storage

This commit is contained in:
Codex
2026-07-10 03:47:30 +02:00
parent e11c140b09
commit 0184bd7334
57 changed files with 3738 additions and 350 deletions
+30 -5
View File
@@ -4,7 +4,14 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { type UniDeskConfig } from "./config";
import { type DebugDispatchCommand, isDebugDispatchCommand } from "./debug";
import { summarizeMicroserviceHealthResponse, summarizeMicroserviceObservation, summarizeMicroserviceProxyResponse } from "./microservices";
import {
parseMicroserviceProxyRequest,
rewriteTodoNoteMisleadingRouteNotFound,
runTodoNoteCheckPath,
summarizeMicroserviceHealthResponse,
summarizeMicroserviceObservation,
summarizeMicroserviceProxyResponse,
} from "./microservices";
import { parseNetworkPerfOptions, runNetworkPerf } from "./network-perf";
import {
buildWindowsPowerShellInvocation,
@@ -742,19 +749,35 @@ async function remoteMicroservice(session: FrontendSession, args: string[]): Pro
};
}
if (action === "proxy" && id !== undefined && path !== undefined && path.startsWith("/")) {
const request = parseMicroserviceProxyRequest(args);
if (request.checkPath) {
if (id !== "todo-note") throw new Error(`--check-path currently only supports service=todo-note; got ${id}`);
return { transport: "frontend", response: runTodoNoteCheckPath(request.method, path) };
}
const full = args.includes("--full");
const raw = args.includes("--raw");
const maxBodyBytes = full ? numberOption(args, "--max-body-bytes", 5_000_000) : cappedNumberOption(args, "--max-body-bytes", raw ? 120_000 : 60_000, 500_000);
const maxResponseBytes = full ? Math.min(Math.max(maxBodyBytes, 120_000), 5_000_000) : Math.min(Math.max(maxBodyBytes * 3, 240_000), 1_500_000);
const response = await frontendJson(session, `/api/microservices/${encodeURIComponent(id)}/proxy${path}`, undefined, 24_000, maxResponseBytes);
const response = await frontendJson(session, `/api/microservices/${encodeURIComponent(id)}/proxy${path}`, {
method: request.method,
body: request.body === undefined ? undefined : JSON.stringify(request.body),
}, 30_000, maxResponseBytes);
const rewritten = rewriteTodoNoteMisleadingRouteNotFound(id, request.method, path, response);
return {
transport: "frontend",
response: summarizeMicroserviceProxyResponse(response, args),
response: summarizeMicroserviceProxyResponse(rewritten, args),
};
}
throw new Error("remote microservice command must be: microservice list | status <id> | health <id> | diagnostics <id> | tunnel-self-test <id> | proxy <id> <path>");
}
function remoteMicroserviceOk(result: unknown): boolean {
if (typeof result !== "object" || result === null || Array.isArray(result)) return true;
const response = (result as { response?: unknown }).response;
if (typeof response !== "object" || response === null || Array.isArray(response)) return true;
return (response as { ok?: unknown }).ok !== false;
}
function commandResultFromFrontendTask(command: string[], task: { status?: string; result?: Record<string, unknown> } | undefined) {
const result = task?.result ?? {};
const stdout = typeof result.stdout === "string" ? result.stdout : "";
@@ -1615,8 +1638,10 @@ async function runRemoteCliOverFrontend(options: RemoteCliOptions, config: UniDe
return 0;
}
if (top === "microservice") {
emitRemoteJson(name, await remoteMicroservice(session, args));
return 0;
const result = await remoteMicroservice(session, args);
const ok = remoteMicroserviceOk(result);
emitRemoteJson(name, result, ok);
return ok ? 0 : 1;
}
if (top === "artifact-registry") {
emitRemoteJson(name, await remoteArtifactRegistry(session, args));