openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
29 lines (28 loc) • 1.13 kB
JavaScript
import { t as createSubsystemLogger } from "../../subsystem-4NzR43uz.mjs";
import { a as isAgentBootstrapEvent } from "../../internal-hooks-eyE9vom5.mjs";
import { t as loadDeclaredExtraBootstrapFiles } from "../../declared-files-CjMyHgTB.mjs";
//#region src/hooks/bundled/bootstrap-extra-files/handler.ts
const log = createSubsystemLogger("bootstrap-extra-files");
const bootstrapExtraFilesHook = async (event) => {
if (!isAgentBootstrapEvent(event)) return;
const context = event.context;
try {
const { files: extras, diagnostics } = await loadDeclaredExtraBootstrapFiles({
config: context.cfg,
workspaceDir: context.workspaceDir
});
if (diagnostics.length > 0) log.debug("skipped extra bootstrap candidates", {
skipped: diagnostics.length,
reasons: diagnostics.reduce((counts, item) => {
counts[item.reason] = (counts[item.reason] ?? 0) + 1;
return counts;
}, {})
});
if (extras.length === 0) return;
context.bootstrapFiles = [...context.bootstrapFiles, ...extras];
} catch (err) {
log.warn(`failed: ${String(err)}`);
}
};
//#endregion
export { bootstrapExtraFilesHook as default };