fix continuity clean-room install verification
This commit is contained in:
@@ -394,14 +394,37 @@ const continuityAdapterModuleCache = new Map<string, Promise<ForceRecallContinui
|
||||
|
||||
async function loadForceRecallContinuityAdapterModule(workspaceDir: string): Promise<ForceRecallContinuityAdapterModule | null> {
|
||||
const adapterPath = path.join(workspaceDir, "plugins", "continuity", "src", "index.mjs");
|
||||
let modulePromise = continuityAdapterModuleCache.get(adapterPath);
|
||||
|
||||
if (!modulePromise) {
|
||||
modulePromise = import(pathToFileURL(adapterPath).href).catch(() => null);
|
||||
continuityAdapterModuleCache.set(adapterPath, modulePromise);
|
||||
try {
|
||||
const stat = await fs.stat(adapterPath);
|
||||
const cacheKey = `${adapterPath}?mtimeMs=${stat.mtimeMs}`;
|
||||
let modulePromise = continuityAdapterModuleCache.get(cacheKey);
|
||||
|
||||
if (!modulePromise) {
|
||||
modulePromise = import(pathToFileURL(adapterPath).href + `?mtimeMs=${stat.mtimeMs}`).catch(() => null);
|
||||
continuityAdapterModuleCache.set(cacheKey, modulePromise);
|
||||
}
|
||||
|
||||
return modulePromise;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return modulePromise;
|
||||
async function readContinuityPluginConfigOverrides(workspaceDir: string): Promise<Record<string, unknown>> {
|
||||
const defaultsPath = path.join(workspaceDir, "plugins", "continuity", "src", "config", "defaults.mjs");
|
||||
const source = await safeReadText(defaultsPath);
|
||||
if (!source) return {};
|
||||
|
||||
const forceRecallLabel = source.match(/forceRecall:\s*\{[\s\S]*?injectBlockLabel:\s*['"]([^'"]+)['"]/);
|
||||
const genericPreflightLabel = source.match(/genericPreflight:\s*\{[\s\S]*?injectBlockLabel:\s*['"]([^'"]+)['"]/);
|
||||
|
||||
return {
|
||||
adapter: {
|
||||
forceRecall: forceRecallLabel ? { injectBlockLabel: forceRecallLabel[1] } : {},
|
||||
genericPreflight: genericPreflightLabel ? { injectBlockLabel: genericPreflightLabel[1] } : {},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function evaluateApprovedPlanContinuityViaPlugin(workspaceDir: string, wrapperResult: any, autoChainPlanResult: AutoChainPlanResult | null): Promise<{ input: Record<string, unknown> | null; result: ApprovedPlanContinuityResult | null; block: string; } | null> {
|
||||
@@ -409,10 +432,27 @@ async function evaluateApprovedPlanContinuityViaPlugin(workspaceDir: string, wra
|
||||
const runAdapter = adapterModule?.runForceRecallContinuityAdapter;
|
||||
if (typeof runAdapter !== "function") return null;
|
||||
|
||||
const configOverrides = await readContinuityPluginConfigOverrides(workspaceDir);
|
||||
|
||||
return runAdapter({
|
||||
wrapperResult,
|
||||
autoChainPlanResult,
|
||||
config: adapterModule?.defaultConfig ?? {},
|
||||
config: {
|
||||
...(adapterModule?.defaultConfig ?? {}),
|
||||
...configOverrides,
|
||||
adapter: {
|
||||
...(((adapterModule?.defaultConfig ?? {}) as any)?.adapter ?? {}),
|
||||
...((configOverrides as any)?.adapter ?? {}),
|
||||
forceRecall: {
|
||||
...((((adapterModule?.defaultConfig ?? {}) as any)?.adapter?.forceRecall) ?? {}),
|
||||
...(((configOverrides as any)?.adapter?.forceRecall) ?? {}),
|
||||
},
|
||||
genericPreflight: {
|
||||
...((((adapterModule?.defaultConfig ?? {}) as any)?.adapter?.genericPreflight) ?? {}),
|
||||
...(((configOverrides as any)?.adapter?.genericPreflight) ?? {}),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -444,6 +484,8 @@ async function buildApprovedPlanContinuityBlock(workspaceDir: string, wrapperRes
|
||||
if (result.reason === 'missing_auto_next_dispatch') {
|
||||
lines.push("- HARD_GATE: Do not stop at this completed-task boundary.");
|
||||
lines.push("- HARD_GATE: Auto-dispatch the next task in the same approved plan, unless waiting_user, blocked, pending_verification, or high-risk stop applies.");
|
||||
lines.push("- HARD_GATE: Do not hand control back to the user with an ordinary progress update while auto-next is still obligatory.");
|
||||
lines.push("- HARD_GATE: If you cannot prove the next dispatch, convert this into an explicit continuity failure instead of a normal status report.");
|
||||
} else {
|
||||
lines.push("- HARD_GATE: Route back to continuity failure until a real next dispatch receipt exists, unless closure state is waiting_user, blocked, or pending_verification.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user