Retain inspection file owners before a target lease exists and gate replacement on cleanup. Reuse the streaming string inventory owner and the same installation adapter in native profiling. Validate 80 related tests, real SSH value/source parity in both MCP adapters, injected descriptor/native cleanup retries, zlib SDK immutability and native profiling. Keep historical model costs pinned to their measured runtime. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
// Both the session and diagnostic profiler keep descriptor ownership on failed open.
|
|
import {
|
|
createKunaFileCloseScope,
|
|
inspectKunaInstallation,
|
|
} from "../../dist/kuna/KunaInstallation.js";
|
|
import { kunaFileCleanupError } from "../../dist/kuna/KunaCommand.js";
|
|
import { RegularFileCleanupFailure } from "../../dist/filesystem/OwnedRegularFile.js";
|
|
import { requireResult } from "./fact-error.mjs";
|
|
|
|
export const inspectNativeInstallation = async (
|
|
environment,
|
|
resources,
|
|
signal,
|
|
) => {
|
|
const files = createKunaFileCloseScope({
|
|
retain: (owner, resource) =>
|
|
resources.retain({
|
|
kind: "lease",
|
|
resource,
|
|
lease: { release: () => owner.close() },
|
|
}),
|
|
run: (operation) => resources.run(operation),
|
|
});
|
|
try {
|
|
return requireResult(
|
|
await inspectKunaInstallation(environment, {
|
|
signal,
|
|
fileCloseResources: files.owner,
|
|
}),
|
|
"provider_unavailable",
|
|
);
|
|
} catch (cause) {
|
|
if (!(cause instanceof RegularFileCleanupFailure)) throw cause;
|
|
const error = kunaFileCleanupError(cause, "experiment:atomic-open", signal);
|
|
files.bindFailure(cause, error);
|
|
return requireResult({ ok: false, error });
|
|
}
|
|
};
|