feat(FN-2614): merge fusion/fn-2614 (auto-resolved)
- fix(FN-2614): restore workspace green verification gates
This commit is contained in:
@@ -25,7 +25,7 @@ import { EventEmitter } from "node:events";
|
||||
import { join, resolve, relative } from "node:path";
|
||||
import { SessionEventBuffer } from "./sse-buffer.js";
|
||||
|
||||
import * as engine from "@fusion/engine";
|
||||
import { createFnAgent as engineCreateFnAgent } from "@fusion/engine";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type AgentResult = any;
|
||||
@@ -33,13 +33,7 @@ const engineExports = engine as Record<string, unknown>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let createFnAgent: any = engine.createFnAgent;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const defaultBuildAgentChatPromptFn: any =
|
||||
"buildAgentChatPrompt" in engineExports &&
|
||||
typeof engineExports["buildAgentChatPrompt"] === "function"
|
||||
? engineExports["buildAgentChatPrompt"]
|
||||
: undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let buildAgentChatPromptFn: any = defaultBuildAgentChatPromptFn;
|
||||
let buildAgentChatPromptFn: any;
|
||||
|
||||
/**
|
||||
* Diagnostics logger for the chat module.
|
||||
@@ -904,7 +898,7 @@ export function __setBuildAgentChatPrompt(mock: typeof buildAgentChatPromptFn):
|
||||
export function __resetChatState(): void {
|
||||
chatStreamManager.reset();
|
||||
rateLimits.clear();
|
||||
buildAgentChatPromptFn = defaultBuildAgentChatPromptFn;
|
||||
buildAgentChatPromptFn = undefined;
|
||||
|
||||
// Reset diagnostics logger to default
|
||||
__setChatDiagnostics(null);
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
resetDiagnosticsSink,
|
||||
nonfatal,
|
||||
} from "./ai-session-diagnostics.js";
|
||||
import * as engine from "@fusion/engine";
|
||||
import { createFnAgent as engineCreateFnAgent } from "@fusion/engine";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type AgentResult = any;
|
||||
@@ -95,29 +95,7 @@ interface PlanningNtfyHelpers {
|
||||
}) => Promise<void>;
|
||||
}
|
||||
|
||||
function buildDefaultPlanningNtfyHelpers(): PlanningNtfyHelpers {
|
||||
const isNtfyEventEnabled =
|
||||
"isNtfyEventEnabled" in engine
|
||||
? engine.isNtfyEventEnabled
|
||||
: (events: NtfyNotificationEvent[] | undefined, event: NtfyNotificationEvent) =>
|
||||
Array.isArray(events) ? events.includes(event) : false;
|
||||
|
||||
const buildNtfyClickUrl = "buildNtfyClickUrl" in engine
|
||||
? engine.buildNtfyClickUrl
|
||||
: () => undefined;
|
||||
|
||||
const sendNtfyNotification = "sendNtfyNotification" in engine
|
||||
? engine.sendNtfyNotification
|
||||
: async () => {};
|
||||
|
||||
return {
|
||||
isNtfyEventEnabled,
|
||||
buildNtfyClickUrl,
|
||||
sendNtfyNotification,
|
||||
};
|
||||
}
|
||||
|
||||
let planningNtfyHelpers: PlanningNtfyHelpers | undefined = buildDefaultPlanningNtfyHelpers();
|
||||
let planningNtfyHelpers: PlanningNtfyHelpers | undefined;
|
||||
|
||||
/**
|
||||
* Shared diagnostics helper for the planning module.
|
||||
@@ -1768,7 +1746,7 @@ export function __resetPlanningState(): void {
|
||||
_aiSessionDeletedListener = undefined;
|
||||
_aiSessionStore = undefined;
|
||||
|
||||
planningNtfyHelpers = buildDefaultPlanningNtfyHelpers();
|
||||
planningNtfyHelpers = undefined;
|
||||
|
||||
// Reset diagnostics sink to default
|
||||
resetDiagnosticsSink();
|
||||
|
||||
@@ -22,17 +22,16 @@ export { createFnAgent, promptWithFallback, describeModel, setHostExtensionPaths
|
||||
// Register createFnAgent into core's loader so consumers in @fusion/core
|
||||
// (e.g. ai-summarize, memory-compaction) can resolve it without a circular
|
||||
// static import. Runs once at engine module load.
|
||||
import * as fusionCore from "@fusion/core";
|
||||
import { createFnAgent as _createFnAgentForCore } from "./pi.js";
|
||||
const fusionCoreExports = fusionCore as Record<string, unknown>;
|
||||
if (
|
||||
"setCreateFnAgent" in fusionCoreExports &&
|
||||
typeof fusionCoreExports["setCreateFnAgent"] === "function"
|
||||
) {
|
||||
(fusionCoreExports["setCreateFnAgent"] as (factory: typeof _createFnAgentForCore) => void)(
|
||||
_createFnAgentForCore
|
||||
);
|
||||
}
|
||||
void import("@fusion/core")
|
||||
.then((core) => {
|
||||
if ("setCreateFnAgent" in core && typeof core.setCreateFnAgent === "function") {
|
||||
core.setCreateFnAgent(_createFnAgentForCore);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// Ignore loader registration failures in constrained test/mocked environments.
|
||||
});
|
||||
export {
|
||||
resolveSessionSkills,
|
||||
createSkillsOverrideFromSelection,
|
||||
|
||||
Reference in New Issue
Block a user