import { r as resolveProjectContext } from './project-context-D0JIm5Ed.js';
import { l as loadExplorerBundle } from './explorer-loader-B_Iv2bTD.js';
import './dist4-CiQ5cizO.js';
import 'node:module';
import './dual-scope-db-ATrwq0LH.js';
import './paths-2M_UxD_H.js';
import 'node:fs';
import 'node:path';
import 'node:os';
import 'node:events';
import 'node:diagnostics_channel';
import 'fs';
import 'events';
import 'util';
import 'path';
import 'assert';
import 'worker_threads';
import 'module';
import 'node:url';
import 'url';
import 'buffer';
import 'node:child_process';
import 'node:crypto';
import 'node:process';
import 'node:async_hooks';
import './indexes-aYlULWG3.js';
import './utils-BvHPJOVk.js';
import './adapters-D2gEs_5L.js';
import './registry2-BSyCTA3q.js';
import './data-accessor-CVbz8X_7.js';
import './tasks-CnwUAUXf.js';
import './conduit-Ca_OFWR_.js';
import './unique-constraint-BM-Apx1H.js';
import './chunk-DDP5xfzh.js';
import './sqlite-Dsbe0wec.js';
import './memory-schema-Bi7cChwo.js';
import './agent-registry-BtE5uhMO.js';
import './nexus-sqlite2-DgTuv9BQ.js';
import './nexus-schema2-BEd-ol6e.js';
import './logger-ChCwlV5k.js';
import 'node:sqlite';
import './lock-BoHF25mx.js';
import './index-IVoIz4D5.js';
import 'constants';
import 'stream';
import 'node:fs/promises';
import 'jsonc-parser';
import '@cleocode/cant';
import 'node:util';
import 'node:buffer';
import 'child_process';
import './branch-lock-qP1EkZ7p.js';
import './src2-DK8DKufK.js';
import 'llmtxt/identity';
import './sessions-j73dkbCI.js';
import './index-Ca4C2M45.js';
import './mvi-helpers-BNsJ8ZpQ.js';
import './session-store-OwQWMSf_.js';
import './session-manifest-ZHrj54LR.js';
import './storage-B9UA3BHR.js';
import './config-B0nEjgSh.js';
import './json-DXl7iDYg.js';
import './data-safety-central-vmfu_Y4J.js';
import './sqlite-data-accessor-C59wZ0zp.js';
import './cross-db-cleanup-C_FLyd-6.js';
import './query-ops-BDMaTdYw.js';
import 'node:net';
import './src3-CMSGYxDI.js';
import './local-model-fit2-J1xCIhC_.js';
import './credential-pool-B04qO8at.js';
import './catalog-model-resolver2-Cexk2TN0.js';
import './role-resolver-DF9BQ_U6.js';
import './identity2-DeAB5RXE.js';
import './role-executor-C4-3bmgC.js';
import 'node:stream';
import 'crypto';
import 'os';
import 'node:http2';
import 'fs/promises';
import './models-catalog-DG3aPok8.js';
import './catalog-resolver2-c0qfF34B.js';
import './providers-CmIcBfg-.js';
import './brain-maintenance-bSR6GwAG.js';
import './graph-auto-populate2-DYsUNGSL.js';
import './temporal-supersession-BZ46j30w.js';
import './typed-query-l1D_QElt.js';
import './llm-backend-resolver-BPbvttS4.js';
import '@ai-sdk/provider-utils';
import './observer-reflector2-D8nxuglX.js';
import './learnings2-2m2p7lzT.js';
import './memory-accessor2-BzlgmY-Z.js';
import './quality-scoring-CCPuRQmJ.js';
import './patterns2-DYKfsbwN.js';
import './graph-memory-bridge2-C7Y32Mk4.js';
import './sigil2-DftKm7Um.js';
import './services-Dlf3Gefq.js';
import './audit4-S87oN-BC.js';
import 'process';
import './open-cleo-db-Ba2LY1h4.js';
import './cleo-home-BCqJ5rg1.js';
import './connections2-D22b0xbS.js';

//#region src/routes/studio/[projectId]/[sagaId]/+page.server.ts
var load = async ({ params, locals }) => {
	const { projectId, sagaId } = params;
	const ctx = locals.projectCtx.projectId === projectId ? locals.projectCtx : resolveProjectContext(projectId) ?? null;
	if (!ctx?.tasksDbExists) return {
		projectId,
		projectName: ctx?.name ?? projectId,
		sagaId,
		saga: null,
		explorer: null,
		error: `Project "${projectId}" is not registered or has no tasks database.`
	};
	try {
		const explorer = await loadExplorerBundle({ projectCtx: ctx });
		const sagaTask = explorer.tasks.find((t) => t.id === sagaId) ?? null;
		return {
			projectId,
			projectName: ctx.name,
			sagaId,
			saga: sagaTask ? {
				id: sagaTask.id,
				title: sagaTask.title,
				type: sagaTask.type,
				status: sagaTask.status
			} : null,
			explorer
		};
	} catch (e) {
		return {
			projectId,
			projectName: ctx.name,
			sagaId,
			saga: null,
			explorer: null,
			error: e instanceof Error ? e.message : "Failed to load the saga workgraph bundle."
		};
	}
};

var _page_server_ts = /*#__PURE__*/Object.freeze({
	__proto__: null,
	load: load
});

const index = 24;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-DxDS2zHS.js')).default;
const server_id = "src/routes/studio/[projectId]/[sagaId]/+page.server.ts";
const imports = ["_app/immutable/nodes/24.CYGI8_4I.js","_app/immutable/chunks/CQQRJ2Hr.js","_app/immutable/chunks/DyGQ_VXC.js","_app/immutable/chunks/DrKWWDpL.js","_app/immutable/chunks/DKX-2-1g.js","_app/immutable/chunks/CorFgzUk.js","_app/immutable/chunks/BgPpRtmk.js","_app/immutable/chunks/BrUKpZTl.js","_app/immutable/chunks/DsQIgu-4.js","_app/immutable/chunks/Bcuvp8aL.js","_app/immutable/chunks/DnOaYask.js","_app/immutable/chunks/Cjus22ap.js","_app/immutable/chunks/DOqzs8kl2.js","_app/immutable/chunks/DTkg6Mnx.js","_app/immutable/chunks/DIQmuJJZ.js","_app/immutable/chunks/D7w7HllH.js","_app/immutable/chunks/DB5ifLM-.js","_app/immutable/chunks/CxlOpib82.js","_app/immutable/chunks/BKc98lKx.js","_app/immutable/chunks/DsanjglN.js","_app/immutable/chunks/CbGRcr-D.js","_app/immutable/chunks/CX8DOZuw2.js","_app/immutable/chunks/djL6V-tr.js","_app/immutable/chunks/CQCxd1p9.js","_app/immutable/chunks/JPJd4fEI.js","_app/immutable/chunks/RptFUp2P.js","_app/immutable/chunks/CEqOYim7.js","_app/immutable/chunks/CqF5Lomf.js","_app/immutable/chunks/v8nUY1ct.js"];
const stylesheets = ["_app/immutable/assets/StatBlock.DX6OXz7z.css","_app/immutable/assets/no-face-up.BlswZ73M.css","_app/immutable/assets/Tabs.CU9_rsWl.css","_app/immutable/assets/ui.CH-9N9-0.css","_app/immutable/assets/tasks.BZWJL4jq.css","_app/immutable/assets/saga-board.XH0XIkul.css","_app/immutable/assets/24.BWCeO61w.css"];
const fonts = [];

export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=24-jHkNR1fX.js.map
