@agimon-ai/po-config 0.0.0-alpha.72 → 0.0.0-alpha.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_settingsApi = require("../settingsApi-DMNAPMIe.cjs");
6
- const require_sessionConfig = require("../sessionConfig-Bo7xJ8Hp.cjs");
6
+ const require_sessionConfig = require("../sessionConfig-CRgjesgD.cjs");
7
7
  let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
8
8
  let _agimon_ai_po_core_mcpProjection = require("@agimon-ai/po-core/mcpProjection");
9
9
  let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
@@ -1,5 +1,5 @@
1
1
  import { t as createSettingsApi } from "../settingsApi-BbDdtEWq.mjs";
2
- import { d as providePoConfigContext, o as createNativePoConfigContext } from "../sessionConfig-oQ24DO-4.mjs";
2
+ import { d as providePoConfigContext, o as createNativePoConfigContext } from "../sessionConfig-eC7B43xB.mjs";
3
3
  import { BACKGROUND_CONTEXT, requirePoFs, withAbortSignal } from "@agimon-ai/po-core/platform";
4
4
  import { PO_MCP_PROJECTION_SERVICE, createDisabledPoMcpProjection, createPoMcpProjectionService, isPoMcpProjection } from "@agimon-ai/po-core/mcpProjection";
5
5
  import { composeServerProviderOverrides, defineServerPlugin, packageResourcePath, readPackageResource } from "@agimon-ai/po-core/serverPlugin";
@@ -1 +1 @@
1
- {"version":3,"file":"index-DLt5gipX.d.mts","names":["ConfigSelection"],"sources":["../src/services/sessionConfig/index.ts"],"mappings":";;;;;;;KAqBK,YAAY,WAAW;KAIhB,oBAAoBA;iBAkHhB,sBAAsB,KAAK,KAAK,sCAAsC;iBAyCtE,sBAAsB,KAAK,KAAK,8CAA8C;;iBAMxE,2BACpB,KAAK,KAAK,6CACV,IAAI,YACJ,UAAS,YACR,QAAQ;iBAgCK,wBAAwB,IAAI,KAAK,8BAA8B,WAAW;;iBAK1E,wBACd,IAAI,KAAK,8BACT;WACW;WACA;WACA;WACA;;iBAYG,yBACd,IAAI,KAAK,8BACT,YAAY;iBAKE,4BACd,IAAI,KAAK,8BACT,YAAY;;iBAME,8BACd,IAAI,KAAK,8BACT,KAAK,KAAK,qCACV,SAAS;iBAUK,6BACd,KAAK,KAAK,sCACT;iBASa,uBACd,KAAK,SACL,SAAS,iBACT,sBACC;;iBAKa,8BAA8B,KAAK;;iBAKnC,sBAAsB,SAAS,kBAAkB;;iBAKjD,uBAAuB,KAAK,SAAS,SAAS,kBAAkB;iBAehE,uBAAuB,KAAK,UAAU"}
1
+ {"version":3,"file":"index-DLt5gipX.d.mts","names":["ConfigSelection"],"sources":["../src/services/sessionConfig/index.ts"],"mappings":";;;;;;;KAqBK,YAAY,WAAW;KAIhB,oBAAoBA;iBAkHhB,sBAAsB,KAAK,KAAK,sCAAsC;iBAyCtE,sBAAsB,KAAK,KAAK,8CAA8C;;iBAMxE,2BACpB,KAAK,KAAK,6CACV,IAAI,YACJ,UAAS,YACR,QAAQ;iBAoCK,wBAAwB,IAAI,KAAK,8BAA8B,WAAW;;iBAK1E,wBACd,IAAI,KAAK,8BACT;WACW;WACA;WACA;WACA;;iBAYG,yBACd,IAAI,KAAK,8BACT,YAAY;iBAKE,4BACd,IAAI,KAAK,8BACT,YAAY;;iBAME,8BACd,IAAI,KAAK,8BACT,KAAK,KAAK,qCACV,SAAS;iBAUK,6BACd,KAAK,KAAK,sCACT;iBASa,uBACd,KAAK,SACL,SAAS,iBACT,sBACC;;iBAKa,8BAA8B,KAAK;;iBAKnC,sBAAsB,SAAS,kBAAkB;;iBAKjD,uBAAuB,KAAK,SAAS,SAAS,kBAAkB;iBAehE,uBAAuB,KAAK,UAAU"}
package/dist/index.cjs CHANGED
@@ -15,7 +15,7 @@ const require_majorModes = require("./majorModes-BkVSvdF4.cjs");
15
15
  const require_profiles = require("./profiles-Bwkq759J.cjs");
16
16
  const require_init = require("./init-4E4W_fl1.cjs");
17
17
  require("./config-zZz80Mh5.cjs");
18
- const require_sessionConfig = require("./sessionConfig-Bo7xJ8Hp.cjs");
18
+ const require_sessionConfig = require("./sessionConfig-CRgjesgD.cjs");
19
19
  let _agimon_ai_po_core_contextProjection = require("@agimon-ai/po-core/contextProjection");
20
20
  let _agimon_ai_po_core_config = require("@agimon-ai/po-core/config");
21
21
  exports.DEFAULT_IMAGE_MAX_DIMENSION = require_piConfig.DEFAULT_IMAGE_MAX_DIMENSION;
package/dist/index.mjs CHANGED
@@ -14,5 +14,5 @@ import { a as loadMajorModesConfigLenient, c as resolveLayers, i as loadMajorMod
14
14
  import { d as PERSONA_FILES, f as applyProfileEnvironment, l as loadProfiles, m as replaceProfileEnvironment, o as buildPersonaPrompt, s as listProfileNames, u as resolveProfile } from "./profiles-BKJckZka.mjs";
15
15
  import { a as GLOBAL_PO_SEED_FILES, i as initializeRepositoryPoConfig, o as PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as REPOSITORY_PO_CONFIG_TEMPLATES } from "./init-BlopOLXb.mjs";
16
16
  import { t as PO_CONFIG_SERVICE } from "./config-BBvn_ZLP.mjs";
17
- import { _ as supersedePoConfigTransition, a as appendPoConfigTransition, c as createPoConfigContextAsync, d as providePoConfigContext, f as readPoConfigContextGeneration, g as requirePoConfigContext, h as replacePoConfigContext, i as appendPoConfigSelection, l as freezePoConfigContext, m as readPoConfigSelection, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, p as readPoConfigPendingSelection, r as acknowledgePoConfigTransition, s as createPoConfigContext, t as PO_CONFIG_ENTRY_TYPE } from "./sessionConfig-oQ24DO-4.mjs";
17
+ import { _ as supersedePoConfigTransition, a as appendPoConfigTransition, c as createPoConfigContextAsync, d as providePoConfigContext, f as readPoConfigContextGeneration, g as requirePoConfigContext, h as replacePoConfigContext, i as appendPoConfigSelection, l as freezePoConfigContext, m as readPoConfigSelection, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, p as readPoConfigPendingSelection, r as acknowledgePoConfigTransition, s as createPoConfigContext, t as PO_CONFIG_ENTRY_TYPE } from "./sessionConfig-eC7B43xB.mjs";
18
18
  export { DEFAULT_IMAGE_MAX_DIMENSION, FILE_ONLY_STATE_FIELDS, GLOBAL_PO_SEED_FILES, HARNESS_STATE_KEYS, HARNESS_STATE_POINTER, MARKETPLACE_MANIFEST_RELATIVE_PATHS, MIN_IMAGE_MAX_DIMENSION, PERSONA_FILES, PO_CONFIG_ENTRY_TYPE, PO_CONFIG_SERVICE, PO_CONFIG_TEMPLATES, PO_CONFIG_TRANSITION_ENTRY_TYPE, PO_DIR, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, REPOSITORY_PO_CONFIG_TEMPLATES, acknowledgePoConfigTransition, appendPoConfigSelection, appendPoConfigTransition, applyProfileEnvironment, buildPersonaPrompt, clampImageMaxDimension, configLeafKeys, configRootKeys, configScopeOf, createHarnessSession, createPoConfigContext, createPoConfigContextAsync, createSettingsApi, disposeHarnessState, domainCompletionItems, domainCompletionPrefix, expandDomainNames, findPluginManifestPath, findPluginManifestPathAsync, freezePoConfigContext, getHarnessState, getSessionHarnessState, globalPoConfigDirectory, globalPoConfigPath, harnessRoot, initializeGlobalPoConfig, initializeRepositoryPoConfig, isLocalPackageSpecifier, isRemotePluginSource, layerEntries, listDomainNames, listProfileNames, loadDomains, loadHarnessState, loadMajorModesConfig, loadMajorModesConfigLenient, loadPiConfig, loadPiConfigAsync, loadPiImageSettings, loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient, loadProfiles, mergePoConfigs, parseAutocompactModeConfig, parsePiImageSettings, parsePlanningModeConfig, parsePoConfig, piConfigPaths, piImageSettingsPath, pluginDirectoryForSource, projectHarnessEnvironment, providePoConfigContext, readHarnessState, readPackageConfigurations, readPoConfig, readPoConfigContextGeneration, readPoConfigLayers, readPoConfigLenient, readPoConfigPendingSelection, readPoConfigSelection, replacePoConfigContext, replaceProfileEnvironment, repositoryPoConfigPath, requireHarnessPaths, requireHarnessRoot, requirePoConfigContext, resetHarnessStore, resolveLayers, resolvePackageConfigurations, resolvePlanningPlansDirectory, resolvePluginDirectories, resolvePluginEntries, resolveProfile, resolveSharedSkills, resolveVoiceConfig, restoreHarnessStateSnapshot, savePiImageSettings, setPoConfigValue, setPoConfigValueAsync, snapshotHarnessState, supersedePoConfigTransition, unsetPoConfigValue, unsetPoConfigValueAsync, updateHarnessState, valueAtKeyPath, writePoConfigValues, writePoConfigValuesAsync, writePrivateAtomicJson, writePrivateAtomicJsonAsync };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sessionConfig = require("./sessionConfig-Bo7xJ8Hp.cjs");
2
+ const require_sessionConfig = require("./sessionConfig-CRgjesgD.cjs");
3
3
  let _agimon_ai_po_core_contextProjection = require("@agimon-ai/po-core/contextProjection");
4
4
  Object.defineProperty(exports, "PO_CONFIG_ENTRY_TYPE", {
5
5
  enumerable: true,
@@ -1 +1 @@
1
- export { t as PO_CONFIG_ENTRY_TYPE, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, r as acknowledgePoConfigTransition, i as appendPoConfigSelection, a as appendPoConfigTransition, s as createPoConfigContext, c as createPoConfigContextAsync, l as freezePoConfigContext, u as persistHarnessSelection, d as providePoConfigContext, f as readPoConfigContextGeneration, p as readPoConfigPendingSelection, m as readPoConfigSelection, h as replacePoConfigContext, g as requirePoConfigContext, _ as supersedePoConfigTransition } from "./sessionConfig-oQ24DO-4.mjs";
1
+ export { t as PO_CONFIG_ENTRY_TYPE, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, r as acknowledgePoConfigTransition, i as appendPoConfigSelection, a as appendPoConfigTransition, s as createPoConfigContext, c as createPoConfigContextAsync, l as freezePoConfigContext, u as persistHarnessSelection, d as providePoConfigContext, f as readPoConfigContextGeneration, p as readPoConfigPendingSelection, m as readPoConfigSelection, h as replacePoConfigContext, g as requirePoConfigContext, _ as supersedePoConfigTransition } from "./sessionConfig-eC7B43xB.mjs";
@@ -144,17 +144,17 @@ async function createPoConfigContextAsync(ctx, fs, context = _agimon_ai_po_core_
144
144
  async function createNativePoConfigContext(execution, fs, context = _agimon_ai_po_core_platform.BACKGROUND_CONTEXT) {
145
145
  const bootstrap = require_harnessStore.getSessionHarnessState(execution.sessionId);
146
146
  const branch = [];
147
- for (const customType of [_agimon_ai_po_core_contextProjection.PO_CONFIG_ENTRY_TYPE, _agimon_ai_po_core_contextProjection.PO_CONFIG_TRANSITION_ENTRY_TYPE]) for await (const entry of execution.session.entriesNewestFirst({
148
- type: "custom",
149
- customType
150
- })) {
151
- if (customType === _agimon_ai_po_core_contextProjection.PO_CONFIG_ENTRY_TYPE ? !isSelection(entry.data) : !isTransition(entry.data)) continue;
152
- branch.push({
147
+ for (const customType of [_agimon_ai_po_core_contextProjection.PO_CONFIG_ENTRY_TYPE, _agimon_ai_po_core_contextProjection.PO_CONFIG_TRANSITION_ENTRY_TYPE]) {
148
+ const accepts = customType === _agimon_ai_po_core_contextProjection.PO_CONFIG_ENTRY_TYPE ? isSelection : isTransition;
149
+ const snapshot = await execution.session.customSnapshot?.(customType, {
150
+ schemaId: `${customType}:valid:v1`,
151
+ accepts
152
+ });
153
+ if (snapshot?.available && snapshot.entry && accepts(snapshot.entry.data)) branch.push({
153
154
  type: "custom",
154
155
  customType,
155
- data: entry.data
156
+ data: snapshot.entry.data
156
157
  });
157
- break;
158
158
  }
159
159
  const transition = branchTransition(branch);
160
160
  if (transition?.phase === "pending" && isActiveTransitionTarget(transition.target, bootstrap)) {
@@ -336,4 +336,4 @@ Object.defineProperty(exports, "supersedePoConfigTransition", {
336
336
  }
337
337
  });
338
338
 
339
- //# sourceMappingURL=sessionConfig-Bo7xJ8Hp.cjs.map
339
+ //# sourceMappingURL=sessionConfig-CRgjesgD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionConfig-CRgjesgD.cjs","names":["deepFreeze","Service","PO_CONFIG_SERVICE","PO_CONFIG_ENTRY_TYPE","PO_CONFIG_TRANSITION_ENTRY_TYPE","getSessionHarnessState","loadPoConfig","BACKGROUND_CONTEXT","readPoConfig","getHarnessState","PO_CONFIG_SERVICE"],"sources":["../src/services/poConfigService/index.ts","../src/services/sessionConfig/index.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\n\nimport {\n PO_CONFIG_SERVICE,\n type DeepReadonly,\n type PoConfig,\n type PoConfigContext,\n type PoConfigLoader,\n type IPoConfigService,\n} from '../../types/config';\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\n/**\n * Po configuration published on the shared cordis Context.\n *\n * Every extension resolves the same instance by name, so configuration stays\n * one read per session instead of one per consumer, and the registration is\n * removed with the fiber that created it. The loader is injected so this stays\n * free of filesystem access.\n */\nexport class PoConfigService extends Service implements IPoConfigService {\n readonly generation: string;\n private snapshot: PoConfigContext;\n\n constructor(\n ctx: Context,\n snapshot: PoConfigContext,\n private readonly loadConfig: PoConfigLoader,\n generation = `po-config:${crypto.randomUUID()}`,\n ) {\n super(ctx, PO_CONFIG_SERVICE);\n this.snapshot = deepFreeze(snapshot) as PoConfigContext;\n this.generation = generation;\n }\n\n getSnapshot(): PoConfigContext {\n return this.snapshot;\n }\n\n replaceSnapshot(context: PoConfigContext): PoConfigContext {\n this.snapshot = deepFreeze(context) as PoConfigContext;\n return this.snapshot;\n }\n\n load(repoRoot: string, homeDirectory?: string): PoConfig {\n return this.loadConfig(repoRoot, homeDirectory);\n }\n}\n","import { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport { BACKGROUND_CONTEXT, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type {\n PoConfigSelection as ConfigSelection,\n DeepReadonly,\n PoConfigContext,\n PoConfigPendingSelection,\n PoConfigTransitionRecord,\n PoConfigTransitionStrategy,\n HarnessState,\n IPoConfigService,\n} from '../../types/config';\nimport { PO_CONFIG_SERVICE } from '../../types/config';\nimport { loadPoConfig, readPoConfig } from '../config';\nimport { getHarnessState, getSessionHarnessState } from '../harnessStore';\nimport { PoConfigService } from '../poConfigService';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\n\nexport type PoConfigSelection = ConfigSelection;\n\ntype PoConfigTransitionEntry = PoConfigTransitionRecord;\n\nfunction isSelection(value: unknown): value is PoConfigSelection {\n if (typeof value !== 'object' || value === null) return false;\n const selection = value as Partial<PoConfigSelection>;\n return (\n selection.version === 1 &&\n typeof selection.majorMode === 'string' &&\n Array.isArray(selection.domains) &&\n selection.domains.every((domain) => typeof domain === 'string') &&\n (selection.profile === undefined || typeof selection.profile === 'string') &&\n (selection.compositionFingerprint === undefined || typeof selection.compositionFingerprint === 'string')\n );\n}\n\nfunction branchSelection(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigSelection | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_ENTRY_TYPE && isSelection(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction isTransitionStrategy(value: unknown): value is PoConfigTransitionStrategy {\n return value === 'pi-reload' || value === 'process-relaunch';\n}\n\nfunction isTransition(value: unknown): value is PoConfigTransitionEntry {\n if (typeof value !== 'object' || value === null) return false;\n const transition = value as Partial<PoConfigTransitionEntry>;\n return (\n transition.version === 1 &&\n typeof transition.operationId === 'string' &&\n isSelection(transition.active) &&\n isSelection(transition.target) &&\n isTransitionStrategy(transition.strategy) &&\n (transition.phase === 'pending' ||\n transition.phase === 'applied' ||\n transition.phase === 'aborted' ||\n transition.phase === 'superseded')\n );\n}\n\nfunction branchTransition(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigTransitionEntry | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_TRANSITION_ENTRY_TYPE && isTransition(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction sameSelection(left: PoConfigSelection, state: HarnessState): boolean {\n return (\n left.majorMode === state.majorMode &&\n left.profile === state.profile &&\n (left.compositionFingerprint === undefined || left.compositionFingerprint === state.compositionFingerprint) &&\n left.domains.length === state.domains.length &&\n left.domains.every((domain, index) => domain === state.domains[index])\n );\n}\n\nfunction isActiveTransitionTarget(target: PoConfigSelection, state: HarnessState): boolean {\n return (\n target.compositionFingerprint !== undefined &&\n target.compositionFingerprint === state.compositionFingerprint &&\n sameSelection(target, state)\n );\n}\n\nfunction pendingFromTransition(transition: PoConfigTransitionEntry): PoConfigPendingSelection | undefined {\n if (transition.phase !== 'pending') return undefined;\n return { ...transition, phase: 'pending' };\n}\n\nfunction pendingFromLegacySelection(\n selection: PoConfigSelection,\n bootstrap: HarnessState,\n): PoConfigPendingSelection | undefined {\n if (sameSelection(selection, bootstrap)) return undefined;\n const active: PoConfigSelection = {\n version: 1,\n majorMode: bootstrap.majorMode,\n domains: [...bootstrap.domains],\n profile: bootstrap.profile,\n compositionFingerprint: bootstrap.compositionFingerprint,\n };\n return {\n version: 1,\n operationId: 'legacy-config-selection',\n active,\n target: selection,\n strategy: 'process-relaunch',\n phase: 'pending',\n };\n}\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\nexport function readPoConfigSelection(ctx: Pick<ExtensionContext, 'sessionManager'>): PoConfigSelection | undefined {\n return branchSelection(ctx.sessionManager.getBranch());\n}\n\nfunction resolveContextState(ctx: Pick<ExtensionContext, 'sessionManager'>): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);\n}\n\nfunction resolveBranchState(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n bootstrap: HarnessState,\n): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const selection = branchSelection(entries);\n const transition = branchTransition(entries);\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n const pendingSelection = transition\n ? transitionPending\n : selection\n ? pendingFromLegacySelection(selection, bootstrap)\n : undefined;\n return {\n harness: bootstrap,\n pendingSelection,\n requiresRelaunch:\n pendingSelection !== undefined &&\n (transitionPending === undefined || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),\n root: bootstrap.root,\n };\n}\n\nexport function createPoConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): PoConfigContext {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n return deepFreeze({ settings: loadPoConfig(root ?? ctx.cwd), harness, pendingSelection, requiresRelaunch });\n}\n\n/** Reads the settings through the host's FileSystem, so it runs wherever the session does. */\nexport async function createPoConfigContextAsync(\n ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n const settings = await readPoConfig(fs, root ?? ctx.cwd, context);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\n/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */\nexport async function createNativePoConfigContext(\n execution: PoHeadlessExecutionContext,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const bootstrap = getSessionHarnessState(execution.sessionId);\n const branch: { type: string; customType: string; data: unknown }[] = [];\n for (const customType of [PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE]) {\n // Bump schemaId whenever these pure acceptance semantics change.\n const accepts = customType === PO_CONFIG_ENTRY_TYPE ? isSelection : isTransition;\n const snapshot = await execution.session.customSnapshot?.(customType, {\n schemaId: `${customType}:valid:v1`,\n accepts,\n });\n if (snapshot?.available && snapshot.entry && accepts(snapshot.entry.data)) {\n branch.push({ type: 'custom', customType, data: snapshot.entry.data });\n }\n }\n const transition = branchTransition(branch);\n if (transition?.phase === 'pending' && isActiveTransitionTarget(transition.target, bootstrap)) {\n const data = { ...transition, phase: 'applied' as const };\n await execution.session.appendCustomEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, data);\n branch.push({ type: 'custom', customType: PO_CONFIG_TRANSITION_ENTRY_TYPE, data });\n }\n const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);\n const settings = await readPoConfig(fs, root ?? execution.cwd, context, { environment: execution.environment });\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\nexport function appendPoConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: PoConfigSelection): void {\n pi.appendEntry(PO_CONFIG_ENTRY_TYPE, selection);\n}\n\n/** Journals the live selection, defaulting to whatever the harness store holds. */\nexport function persistHarnessSelection(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n state: {\n readonly majorMode: string;\n readonly domains: readonly string[];\n readonly profile?: string;\n readonly compositionFingerprint?: string;\n } = getHarnessState(),\n): void {\n appendPoConfigSelection(pi, {\n version: 1,\n majorMode: state.majorMode,\n domains: state.domains,\n profile: state.profile,\n compositionFingerprint: state.compositionFingerprint,\n });\n}\n\nexport function appendPoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigTransitionRecord,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, transition);\n}\n\nexport function supersedePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigPendingSelection,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, { ...transition, phase: 'superseded' });\n}\n\n/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */\nexport function acknowledgePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n harness: HarnessState,\n): boolean {\n const transition = branchTransition(ctx.sessionManager.getBranch());\n if (!transition || transition.phase !== 'pending' || !isActiveTransitionTarget(transition.target, harness)) {\n return false;\n }\n appendPoConfigTransition(pi, { ...transition, phase: 'applied' });\n return true;\n}\n\nexport function readPoConfigPendingSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): PoConfigPendingSelection | undefined {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n const transition = branchTransition(ctx.sessionManager.getBranch());\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n if (transition) return transitionPending;\n const selection = branchSelection(ctx.sessionManager.getBranch());\n return selection ? pendingFromLegacySelection(selection, bootstrap) : undefined;\n}\n\nexport function providePoConfigContext(\n ctx: Context,\n context: PoConfigContext,\n generation = `po-config:${crypto.randomUUID()}`,\n): IPoConfigService {\n return new PoConfigService(ctx, deepFreeze(context) as PoConfigContext, loadPoConfig, generation);\n}\n\n/** Returns the binding identity used to fence in-flight transitions. */\nexport function readPoConfigContextGeneration(ctx: Context): string | undefined {\n return readPoConfigService(ctx)?.generation;\n}\n\n/** Precomputes an immutable context before a transaction reaches publication. */\nexport function freezePoConfigContext(context: PoConfigContext): PoConfigContext {\n return deepFreeze(context);\n}\n\n/** Replaces a live binding with a deeply frozen context after publication. */\nexport function replacePoConfigContext(ctx: Context, context: PoConfigContext): PoConfigContext {\n const next = deepFreeze(context);\n return requirePoConfigService(ctx).replaceSnapshot(next as PoConfigContext);\n}\n\nexport function readPoConfigService(ctx: Context): IPoConfigService | undefined {\n return ctx.get(PO_CONFIG_SERVICE) as IPoConfigService | undefined;\n}\n\nexport function requirePoConfigService(ctx: Context): IPoConfigService {\n const service = readPoConfigService(ctx);\n if (!service) throw new Error('Po config service is unavailable. Load @agimon-ai/po-config/extensions/server.');\n return service;\n}\n\nexport function requirePoConfigContext(ctx: Context): PoConfigContext {\n return requirePoConfigService(ctx).getSnapshot();\n}\n"],"mappings":";;;;;;;;AAWA,SAASA,aAAmB,OAAqC;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GACtE,OAAO;CAET,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,aAAW,KAAK;CAC1D,OAAO,OAAO,OAAO,KAAK;AAC5B;;;;;;;;;AAUA,IAAa,kBAAb,cAAqCC,oBAAAA,QAAoC;CAOpD;CANnB;CACA;CAEA,YACE,KACA,UACA,YACA,aAAa,aAAa,OAAO,WAAW,KAC5C;EACA,MAAM,KAAKC,0BAAAA,iBAAiB;EAHX,KAAA,aAAA;EAIjB,KAAK,WAAWF,aAAW,QAAQ;EACnC,KAAK,aAAa;CACpB;CAEA,cAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,gBAAgB,SAA2C;EACzD,KAAK,WAAWA,aAAW,OAAO;EAClC,OAAO,KAAK;CACd;CAEA,KAAK,UAAkB,eAAkC;EACvD,OAAO,KAAK,WAAW,UAAU,aAAa;CAChD;AACF;;;ACzBA,SAAS,YAAY,OA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,CAAC;CAClE,MAAM,oBAAoB,aAAa,sBAAsB,UAAU,IAAI,KAAA;CAC3E,IAAI,YAAY,OAAO;CACvB,MAAM,YAAY,gBAAgB,IAAI,eAAe,UAAU,CAAC;CAChE,OAAO,YAAY,2BAA2B,WAAW,SAAS,IAAI,KAAA;AACxE;AAEA,SAAgB,uBACd,KACA,SACA,aAAa,aAAa,OAAO,WAAW,KAC1B;CAClB,OAAO,IAAI,gBAAgB,KAAK,WAAW,OAAO,GAAsBC,eAAAA,cAAc,UAAU;AAClG;;AAGA,SAAgB,8BAA8B,KAAkC;CAC9E,OAAO,oBAAoB,GAAG,CAAC,EAAE;AACnC;;AAGA,SAAgB,sBAAsB,SAA2C;CAC/E,OAAO,WAAW,OAAO;AAC3B;;AAGA,SAAgB,uBAAuB,KAAc,SAA2C;CAC9F,MAAM,OAAO,WAAW,OAAO;CAC/B,OAAO,uBAAuB,GAAG,CAAC,CAAC,gBAAgB,IAAuB;AAC5E;AAEA,SAAgB,oBAAoB,KAA4C;CAC9E,OAAO,IAAI,IAAII,0BAAAA,iBAAiB;AAClC;AAEA,SAAgB,uBAAuB,KAAgC;CACrE,MAAM,UAAU,oBAAoB,GAAG;CACvC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,gFAAgF;CAC9G,OAAO;AACT;AAEA,SAAgB,uBAAuB,KAA+B;CACpE,OAAO,uBAAuB,GAAG,CAAC,CAAC,YAAY;AACjD"}
@@ -143,17 +143,17 @@ async function createPoConfigContextAsync(ctx, fs, context = BACKGROUND_CONTEXT)
143
143
  async function createNativePoConfigContext(execution, fs, context = BACKGROUND_CONTEXT) {
144
144
  const bootstrap = getSessionHarnessState(execution.sessionId);
145
145
  const branch = [];
146
- for (const customType of [PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE]) for await (const entry of execution.session.entriesNewestFirst({
147
- type: "custom",
148
- customType
149
- })) {
150
- if (customType === PO_CONFIG_ENTRY_TYPE ? !isSelection(entry.data) : !isTransition(entry.data)) continue;
151
- branch.push({
146
+ for (const customType of [PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE]) {
147
+ const accepts = customType === PO_CONFIG_ENTRY_TYPE ? isSelection : isTransition;
148
+ const snapshot = await execution.session.customSnapshot?.(customType, {
149
+ schemaId: `${customType}:valid:v1`,
150
+ accepts
151
+ });
152
+ if (snapshot?.available && snapshot.entry && accepts(snapshot.entry.data)) branch.push({
152
153
  type: "custom",
153
154
  customType,
154
- data: entry.data
155
+ data: snapshot.entry.data
155
156
  });
156
- break;
157
157
  }
158
158
  const transition = branchTransition(branch);
159
159
  if (transition?.phase === "pending" && isActiveTransitionTarget(transition.target, bootstrap)) {
@@ -246,4 +246,4 @@ function requirePoConfigContext(ctx) {
246
246
  //#endregion
247
247
  export { supersedePoConfigTransition as _, appendPoConfigTransition as a, createPoConfigContextAsync as c, providePoConfigContext as d, readPoConfigContextGeneration as f, requirePoConfigContext as g, replacePoConfigContext as h, appendPoConfigSelection as i, freezePoConfigContext as l, readPoConfigSelection as m, PO_CONFIG_TRANSITION_ENTRY_TYPE$1 as n, createNativePoConfigContext as o, readPoConfigPendingSelection as p, acknowledgePoConfigTransition as r, createPoConfigContext as s, PO_CONFIG_ENTRY_TYPE$1 as t, persistHarnessSelection as u };
248
248
 
249
- //# sourceMappingURL=sessionConfig-oQ24DO-4.mjs.map
249
+ //# sourceMappingURL=sessionConfig-eC7B43xB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionConfig-eC7B43xB.mjs","names":["deepFreeze"],"sources":["../src/services/poConfigService/index.ts","../src/services/sessionConfig/index.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\n\nimport {\n PO_CONFIG_SERVICE,\n type DeepReadonly,\n type PoConfig,\n type PoConfigContext,\n type PoConfigLoader,\n type IPoConfigService,\n} from '../../types/config';\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\n/**\n * Po configuration published on the shared cordis Context.\n *\n * Every extension resolves the same instance by name, so configuration stays\n * one read per session instead of one per consumer, and the registration is\n * removed with the fiber that created it. The loader is injected so this stays\n * free of filesystem access.\n */\nexport class PoConfigService extends Service implements IPoConfigService {\n readonly generation: string;\n private snapshot: PoConfigContext;\n\n constructor(\n ctx: Context,\n snapshot: PoConfigContext,\n private readonly loadConfig: PoConfigLoader,\n generation = `po-config:${crypto.randomUUID()}`,\n ) {\n super(ctx, PO_CONFIG_SERVICE);\n this.snapshot = deepFreeze(snapshot) as PoConfigContext;\n this.generation = generation;\n }\n\n getSnapshot(): PoConfigContext {\n return this.snapshot;\n }\n\n replaceSnapshot(context: PoConfigContext): PoConfigContext {\n this.snapshot = deepFreeze(context) as PoConfigContext;\n return this.snapshot;\n }\n\n load(repoRoot: string, homeDirectory?: string): PoConfig {\n return this.loadConfig(repoRoot, homeDirectory);\n }\n}\n","import { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport { BACKGROUND_CONTEXT, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type {\n PoConfigSelection as ConfigSelection,\n DeepReadonly,\n PoConfigContext,\n PoConfigPendingSelection,\n PoConfigTransitionRecord,\n PoConfigTransitionStrategy,\n HarnessState,\n IPoConfigService,\n} from '../../types/config';\nimport { PO_CONFIG_SERVICE } from '../../types/config';\nimport { loadPoConfig, readPoConfig } from '../config';\nimport { getHarnessState, getSessionHarnessState } from '../harnessStore';\nimport { PoConfigService } from '../poConfigService';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\n\nexport type PoConfigSelection = ConfigSelection;\n\ntype PoConfigTransitionEntry = PoConfigTransitionRecord;\n\nfunction isSelection(value: unknown): value is PoConfigSelection {\n if (typeof value !== 'object' || value === null) return false;\n const selection = value as Partial<PoConfigSelection>;\n return (\n selection.version === 1 &&\n typeof selection.majorMode === 'string' &&\n Array.isArray(selection.domains) &&\n selection.domains.every((domain) => typeof domain === 'string') &&\n (selection.profile === undefined || typeof selection.profile === 'string') &&\n (selection.compositionFingerprint === undefined || typeof selection.compositionFingerprint === 'string')\n );\n}\n\nfunction branchSelection(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigSelection | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_ENTRY_TYPE && isSelection(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction isTransitionStrategy(value: unknown): value is PoConfigTransitionStrategy {\n return value === 'pi-reload' || value === 'process-relaunch';\n}\n\nfunction isTransition(value: unknown): value is PoConfigTransitionEntry {\n if (typeof value !== 'object' || value === null) return false;\n const transition = value as Partial<PoConfigTransitionEntry>;\n return (\n transition.version === 1 &&\n typeof transition.operationId === 'string' &&\n isSelection(transition.active) &&\n isSelection(transition.target) &&\n isTransitionStrategy(transition.strategy) &&\n (transition.phase === 'pending' ||\n transition.phase === 'applied' ||\n transition.phase === 'aborted' ||\n transition.phase === 'superseded')\n );\n}\n\nfunction branchTransition(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigTransitionEntry | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_TRANSITION_ENTRY_TYPE && isTransition(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction sameSelection(left: PoConfigSelection, state: HarnessState): boolean {\n return (\n left.majorMode === state.majorMode &&\n left.profile === state.profile &&\n (left.compositionFingerprint === undefined || left.compositionFingerprint === state.compositionFingerprint) &&\n left.domains.length === state.domains.length &&\n left.domains.every((domain, index) => domain === state.domains[index])\n );\n}\n\nfunction isActiveTransitionTarget(target: PoConfigSelection, state: HarnessState): boolean {\n return (\n target.compositionFingerprint !== undefined &&\n target.compositionFingerprint === state.compositionFingerprint &&\n sameSelection(target, state)\n );\n}\n\nfunction pendingFromTransition(transition: PoConfigTransitionEntry): PoConfigPendingSelection | undefined {\n if (transition.phase !== 'pending') return undefined;\n return { ...transition, phase: 'pending' };\n}\n\nfunction pendingFromLegacySelection(\n selection: PoConfigSelection,\n bootstrap: HarnessState,\n): PoConfigPendingSelection | undefined {\n if (sameSelection(selection, bootstrap)) return undefined;\n const active: PoConfigSelection = {\n version: 1,\n majorMode: bootstrap.majorMode,\n domains: [...bootstrap.domains],\n profile: bootstrap.profile,\n compositionFingerprint: bootstrap.compositionFingerprint,\n };\n return {\n version: 1,\n operationId: 'legacy-config-selection',\n active,\n target: selection,\n strategy: 'process-relaunch',\n phase: 'pending',\n };\n}\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\nexport function readPoConfigSelection(ctx: Pick<ExtensionContext, 'sessionManager'>): PoConfigSelection | undefined {\n return branchSelection(ctx.sessionManager.getBranch());\n}\n\nfunction resolveContextState(ctx: Pick<ExtensionContext, 'sessionManager'>): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);\n}\n\nfunction resolveBranchState(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n bootstrap: HarnessState,\n): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const selection = branchSelection(entries);\n const transition = branchTransition(entries);\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n const pendingSelection = transition\n ? transitionPending\n : selection\n ? pendingFromLegacySelection(selection, bootstrap)\n : undefined;\n return {\n harness: bootstrap,\n pendingSelection,\n requiresRelaunch:\n pendingSelection !== undefined &&\n (transitionPending === undefined || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),\n root: bootstrap.root,\n };\n}\n\nexport function createPoConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): PoConfigContext {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n return deepFreeze({ settings: loadPoConfig(root ?? ctx.cwd), harness, pendingSelection, requiresRelaunch });\n}\n\n/** Reads the settings through the host's FileSystem, so it runs wherever the session does. */\nexport async function createPoConfigContextAsync(\n ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n const settings = await readPoConfig(fs, root ?? ctx.cwd, context);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\n/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */\nexport async function createNativePoConfigContext(\n execution: PoHeadlessExecutionContext,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const bootstrap = getSessionHarnessState(execution.sessionId);\n const branch: { type: string; customType: string; data: unknown }[] = [];\n for (const customType of [PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE]) {\n // Bump schemaId whenever these pure acceptance semantics change.\n const accepts = customType === PO_CONFIG_ENTRY_TYPE ? isSelection : isTransition;\n const snapshot = await execution.session.customSnapshot?.(customType, {\n schemaId: `${customType}:valid:v1`,\n accepts,\n });\n if (snapshot?.available && snapshot.entry && accepts(snapshot.entry.data)) {\n branch.push({ type: 'custom', customType, data: snapshot.entry.data });\n }\n }\n const transition = branchTransition(branch);\n if (transition?.phase === 'pending' && isActiveTransitionTarget(transition.target, bootstrap)) {\n const data = { ...transition, phase: 'applied' as const };\n await execution.session.appendCustomEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, data);\n branch.push({ type: 'custom', customType: PO_CONFIG_TRANSITION_ENTRY_TYPE, data });\n }\n const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);\n const settings = await readPoConfig(fs, root ?? execution.cwd, context, { environment: execution.environment });\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\nexport function appendPoConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: PoConfigSelection): void {\n pi.appendEntry(PO_CONFIG_ENTRY_TYPE, selection);\n}\n\n/** Journals the live selection, defaulting to whatever the harness store holds. */\nexport function persistHarnessSelection(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n state: {\n readonly majorMode: string;\n readonly domains: readonly string[];\n readonly profile?: string;\n readonly compositionFingerprint?: string;\n } = getHarnessState(),\n): void {\n appendPoConfigSelection(pi, {\n version: 1,\n majorMode: state.majorMode,\n domains: state.domains,\n profile: state.profile,\n compositionFingerprint: state.compositionFingerprint,\n });\n}\n\nexport function appendPoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigTransitionRecord,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, transition);\n}\n\nexport function supersedePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigPendingSelection,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, { ...transition, phase: 'superseded' });\n}\n\n/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */\nexport function acknowledgePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n harness: HarnessState,\n): boolean {\n const transition = branchTransition(ctx.sessionManager.getBranch());\n if (!transition || transition.phase !== 'pending' || !isActiveTransitionTarget(transition.target, harness)) {\n return false;\n }\n appendPoConfigTransition(pi, { ...transition, phase: 'applied' });\n return true;\n}\n\nexport function readPoConfigPendingSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): PoConfigPendingSelection | undefined {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n const transition = branchTransition(ctx.sessionManager.getBranch());\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n if (transition) return transitionPending;\n const selection = branchSelection(ctx.sessionManager.getBranch());\n return selection ? pendingFromLegacySelection(selection, bootstrap) : undefined;\n}\n\nexport function providePoConfigContext(\n ctx: Context,\n context: PoConfigContext,\n generation = `po-config:${crypto.randomUUID()}`,\n): IPoConfigService {\n return new PoConfigService(ctx, deepFreeze(context) as PoConfigContext, loadPoConfig, generation);\n}\n\n/** Returns the binding identity used to fence in-flight transitions. */\nexport function readPoConfigContextGeneration(ctx: Context): string | undefined {\n return readPoConfigService(ctx)?.generation;\n}\n\n/** Precomputes an immutable context before a transaction reaches publication. */\nexport function freezePoConfigContext(context: PoConfigContext): PoConfigContext {\n return deepFreeze(context);\n}\n\n/** Replaces a live binding with a deeply frozen context after publication. */\nexport function replacePoConfigContext(ctx: Context, context: PoConfigContext): PoConfigContext {\n const next = deepFreeze(context);\n return requirePoConfigService(ctx).replaceSnapshot(next as PoConfigContext);\n}\n\nexport function readPoConfigService(ctx: Context): IPoConfigService | undefined {\n return ctx.get(PO_CONFIG_SERVICE) as IPoConfigService | undefined;\n}\n\nexport function requirePoConfigService(ctx: Context): IPoConfigService {\n const service = readPoConfigService(ctx);\n if (!service) throw new Error('Po config service is unavailable. Load @agimon-ai/po-config/extensions/server.');\n return service;\n}\n\nexport function requirePoConfigContext(ctx: Context): PoConfigContext {\n return requirePoConfigService(ctx).getSnapshot();\n}\n"],"mappings":";;;;;;;AAWA,SAASA,aAAmB,OAAqC;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GACtE,OAAO;CAET,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,aAAW,KAAK;CAC1D,OAAO,OAAO,OAAO,KAAK;AAC5B;;;;;;;;;AAUA,IAAa,kBAAb,cAAqC,QAAoC;CAOpD;CANnB;CACA;CAEA,YACE,KACA,UACA,YACA,aAAa,aAAa,OAAO,WAAW,KAC5C;EACA,MAAM,KAAK,iBAAiB;EAHX,KAAA,aAAA;EAIjB,KAAK,WAAWA,aAAW,QAAQ;EACnC,KAAK,aAAa;CACpB;CAEA,cAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,gBAAgB,SAA2C;EACzD,KAAK,WAAWA,aAAW,OAAO;EAClC,OAAO,KAAK;CACd;CAEA,KAAK,UAAkB,eAAkC;EACvD,OAAO,KAAK,WAAW,UAAU,aAAa;CAChD;AACF;;;ACzBA,SAAS,YAAY,OAA4C;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,YAAY;CAClB,OACE,UAAU,YAAY,KACtB,OAAO,UAAU,cAAc,YAC/B,MAAM,QAAQ,UAAU,OAAO,KAC/B,UAAU,QAAQ,OAAO,WAAW,OAAO,WAAW,QAAQ,MAC7D,UAAU,YAAY,KAAA,KAAa,OAAO,UAAU,YAAY,cAChE,UAAU,2BAA2B,KAAA,KAAa,OAAO,UAAU,2BAA2B;AAEnG;AAEA,SAAS,gBACP,SAC+B;CAC/B,KAAK,IAAI,QAAQ,QAAQ,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG;EAC3D,MAAM,QAAQ,QAAQ;EACtB,IAAI,OAAO,SAAS,YAAY,MAAM,eAAe,wBAAwB,YAAY,M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,uBAAuB,KAAgC;CACrE,MAAM,UAAU,oBAAoB,GAAG;CACvC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,gFAAgF;CAC9G,OAAO;AACT;AAEA,SAAgB,uBAAuB,KAA+B;CACpE,OAAO,uBAAuB,GAAG,CAAC,CAAC,YAAY;AACjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-config",
3
- "version": "0.0.0-alpha.72",
3
+ "version": "0.0.0-alpha.74",
4
4
  "description": "Typed configuration loading, validation, and host services for composing Po sessions.",
5
5
  "keywords": [
6
6
  "agent-configuration",
@@ -139,14 +139,14 @@
139
139
  "registry": "https://registry.npmjs.org/"
140
140
  },
141
141
  "dependencies": {
142
- "@agimon-ai/po-core": "0.0.0-alpha.72",
143
- "@agimon-ai/po-web-components": "0.0.0-alpha.72",
142
+ "@agimon-ai/po-core": "0.0.0-alpha.74",
143
+ "@agimon-ai/po-web-components": "0.0.0-alpha.74",
144
144
  "@deepseek-ai/cordis": "4.0.5",
145
145
  "typebox": "1.4.2",
146
146
  "yaml": "2.9.1"
147
147
  },
148
148
  "devDependencies": {
149
- "@agimon-ai/po-build": "0.0.0-alpha.72",
149
+ "@agimon-ai/po-build": "0.0.0-alpha.74",
150
150
  "@earendil-works/pi-coding-agent": "1.4.0",
151
151
  "@modelcontextprotocol/ext-apps": "2.0.3",
152
152
  "@modelcontextprotocol/server": "2.3.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionConfig-Bo7xJ8Hp.cjs","names":["deepFreeze","Service","PO_CONFIG_SERVICE","PO_CONFIG_ENTRY_TYPE","PO_CONFIG_TRANSITION_ENTRY_TYPE","getSessionHarnessState","loadPoConfig","BACKGROUND_CONTEXT","readPoConfig","getHarnessState","PO_CONFIG_SERVICE"],"sources":["../src/services/poConfigService/index.ts","../src/services/sessionConfig/index.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\n\nimport {\n PO_CONFIG_SERVICE,\n type DeepReadonly,\n type PoConfig,\n type PoConfigContext,\n type PoConfigLoader,\n type IPoConfigService,\n} from '../../types/config';\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\n/**\n * Po configuration published on the shared cordis Context.\n *\n * Every extension resolves the same instance by name, so configuration stays\n * one read per session instead of one per consumer, and the registration is\n * removed with the fiber that created it. The loader is injected so this stays\n * free of filesystem access.\n */\nexport class PoConfigService extends Service implements IPoConfigService {\n readonly generation: string;\n private snapshot: PoConfigContext;\n\n constructor(\n ctx: Context,\n snapshot: PoConfigContext,\n private readonly loadConfig: PoConfigLoader,\n generation = `po-config:${crypto.randomUUID()}`,\n ) {\n super(ctx, PO_CONFIG_SERVICE);\n this.snapshot = deepFreeze(snapshot) as PoConfigContext;\n this.generation = generation;\n }\n\n getSnapshot(): PoConfigContext {\n return this.snapshot;\n }\n\n replaceSnapshot(context: PoConfigContext): PoConfigContext {\n this.snapshot = deepFreeze(context) as PoConfigContext;\n return this.snapshot;\n }\n\n load(repoRoot: string, homeDirectory?: string): PoConfig {\n return this.loadConfig(repoRoot, homeDirectory);\n }\n}\n","import { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport { BACKGROUND_CONTEXT, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type {\n PoConfigSelection as ConfigSelection,\n DeepReadonly,\n PoConfigContext,\n PoConfigPendingSelection,\n PoConfigTransitionRecord,\n PoConfigTransitionStrategy,\n HarnessState,\n IPoConfigService,\n} from '../../types/config';\nimport { PO_CONFIG_SERVICE } from '../../types/config';\nimport { loadPoConfig, readPoConfig } from '../config';\nimport { getHarnessState, getSessionHarnessState } from '../harnessStore';\nimport { PoConfigService } from '../poConfigService';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\n\nexport type PoConfigSelection = ConfigSelection;\n\ntype PoConfigTransitionEntry = PoConfigTransitionRecord;\n\nfunction isSelection(value: unknown): value is PoConfigSelection {\n if (typeof value !== 'object' || value === null) return false;\n const selection = value as Partial<PoConfigSelection>;\n return (\n selection.version === 1 &&\n typeof selection.majorMode === 'string' &&\n Array.isArray(selection.domains) &&\n selection.domains.every((domain) => typeof domain === 'string') &&\n (selection.profile === undefined || typeof selection.profile === 'string') &&\n (selection.compositionFingerprint === undefined || typeof selection.compositionFingerprint === 'string')\n );\n}\n\nfunction branchSelection(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigSelection | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_ENTRY_TYPE && isSelection(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction isTransitionStrategy(value: unknown): value is PoConfigTransitionStrategy {\n return value === 'pi-reload' || value === 'process-relaunch';\n}\n\nfunction isTransition(value: unknown): value is PoConfigTransitionEntry {\n if (typeof value !== 'object' || value === null) return false;\n const transition = value as Partial<PoConfigTransitionEntry>;\n return (\n transition.version === 1 &&\n typeof transition.operationId === 'string' &&\n isSelection(transition.active) &&\n isSelection(transition.target) &&\n isTransitionStrategy(transition.strategy) &&\n (transition.phase === 'pending' ||\n transition.phase === 'applied' ||\n transition.phase === 'aborted' ||\n transition.phase === 'superseded')\n );\n}\n\nfunction branchTransition(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigTransitionEntry | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_TRANSITION_ENTRY_TYPE && isTransition(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction sameSelection(left: PoConfigSelection, state: HarnessState): boolean {\n return (\n left.majorMode === state.majorMode &&\n left.profile === state.profile &&\n (left.compositionFingerprint === undefined || left.compositionFingerprint === state.compositionFingerprint) &&\n left.domains.length === state.domains.length &&\n left.domains.every((domain, index) => domain === state.domains[index])\n );\n}\n\nfunction isActiveTransitionTarget(target: PoConfigSelection, state: HarnessState): boolean {\n return (\n target.compositionFingerprint !== undefined &&\n target.compositionFingerprint === state.compositionFingerprint &&\n sameSelection(target, state)\n );\n}\n\nfunction pendingFromTransition(transition: PoConfigTransitionEntry): PoConfigPendingSelection | undefined {\n if (transition.phase !== 'pending') return undefined;\n return { ...transition, phase: 'pending' };\n}\n\nfunction pendingFromLegacySelection(\n selection: PoConfigSelection,\n bootstrap: HarnessState,\n): PoConfigPendingSelection | undefined {\n if (sameSelection(selection, bootstrap)) return undefined;\n const active: PoConfigSelection = {\n version: 1,\n majorMode: bootstrap.majorMode,\n domains: [...bootstrap.domains],\n profile: bootstrap.profile,\n compositionFingerprint: bootstrap.compositionFingerprint,\n };\n return {\n version: 1,\n operationId: 'legacy-config-selection',\n active,\n target: selection,\n strategy: 'process-relaunch',\n phase: 'pending',\n };\n}\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\nexport function readPoConfigSelection(ctx: Pick<ExtensionContext, 'sessionManager'>): PoConfigSelection | undefined {\n return branchSelection(ctx.sessionManager.getBranch());\n}\n\nfunction resolveContextState(ctx: Pick<ExtensionContext, 'sessionManager'>): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);\n}\n\nfunction resolveBranchState(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n bootstrap: HarnessState,\n): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const selection = branchSelection(entries);\n const transition = branchTransition(entries);\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n const pendingSelection = transition\n ? transitionPending\n : selection\n ? pendingFromLegacySelection(selection, bootstrap)\n : undefined;\n return {\n harness: bootstrap,\n pendingSelection,\n requiresRelaunch:\n pendingSelection !== undefined &&\n (transitionPending === undefined || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),\n root: bootstrap.root,\n };\n}\n\nexport function createPoConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): PoConfigContext {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n return deepFreeze({ settings: loadPoConfig(root ?? ctx.cwd), harness, pendingSelection, requiresRelaunch });\n}\n\n/** Reads the settings through the host's FileSystem, so it runs wherever the session does. */\nexport async function createPoConfigContextAsync(\n ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n const settings = await readPoConfig(fs, root ?? ctx.cwd, context);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\n/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */\nexport async function createNativePoConfigContext(\n execution: PoHeadlessExecutionContext,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const bootstrap = getSessionHarnessState(execution.sessionId);\n const branch: { type: string; customType: string; data: unknown }[] = [];\n for (const customType of [PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE]) {\n for await (const entry of execution.session.entriesNewestFirst({ type: 'custom', customType })) {\n if (customType === PO_CONFIG_ENTRY_TYPE ? !isSelection(entry.data) : !isTransition(entry.data)) continue;\n branch.push({ type: 'custom', customType, data: entry.data });\n break;\n }\n }\n const transition = branchTransition(branch);\n if (transition?.phase === 'pending' && isActiveTransitionTarget(transition.target, bootstrap)) {\n const data = { ...transition, phase: 'applied' as const };\n await execution.session.appendCustomEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, data);\n branch.push({ type: 'custom', customType: PO_CONFIG_TRANSITION_ENTRY_TYPE, data });\n }\n const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);\n const settings = await readPoConfig(fs, root ?? execution.cwd, context, { environment: execution.environment });\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\nexport function appendPoConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: PoConfigSelection): void {\n pi.appendEntry(PO_CONFIG_ENTRY_TYPE, selection);\n}\n\n/** Journals the live selection, defaulting to whatever the harness store holds. */\nexport function persistHarnessSelection(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n state: {\n readonly majorMode: string;\n readonly domains: readonly string[];\n readonly profile?: string;\n readonly compositionFingerprint?: string;\n } = getHarnessState(),\n): void {\n appendPoConfigSelection(pi, {\n version: 1,\n majorMode: state.majorMode,\n domains: state.domains,\n profile: state.profile,\n compositionFingerprint: state.compositionFingerprint,\n });\n}\n\nexport function appendPoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigTransitionRecord,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, transition);\n}\n\nexport function supersedePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigPendingSelection,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, { ...transition, phase: 'superseded' });\n}\n\n/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */\nexport function acknowledgePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n harness: HarnessState,\n): boolean {\n const transition = branchTransition(ctx.sessionManager.getBranch());\n if (!transition || transition.phase !== 'pending' || !isActiveTransitionTarget(transition.target, harness)) {\n return false;\n }\n appendPoConfigTransition(pi, { ...transition, phase: 'applied' });\n return true;\n}\n\nexport function readPoConfigPendingSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): PoConfigPendingSelection | undefined {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n const transition = branchTransition(ctx.sessionManager.getBranch());\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n if (transition) return transitionPending;\n const selection = branchSelection(ctx.sessionManager.getBranch());\n return selection ? pendingFromLegacySelection(selection, bootstrap) : undefined;\n}\n\nexport function providePoConfigContext(\n ctx: Context,\n context: PoConfigContext,\n generation = `po-config:${crypto.randomUUID()}`,\n): IPoConfigService {\n return new PoConfigService(ctx, deepFreeze(context) as PoConfigContext, loadPoConfig, generation);\n}\n\n/** Returns the binding identity used to fence in-flight transitions. */\nexport function readPoConfigContextGeneration(ctx: Context): string | undefined {\n return readPoConfigService(ctx)?.generation;\n}\n\n/** Precomputes an immutable context before a transaction reaches publication. */\nexport function freezePoConfigContext(context: PoConfigContext): PoConfigContext {\n return deepFreeze(context);\n}\n\n/** Replaces a live binding with a deeply frozen context after publication. */\nexport function replacePoConfigContext(ctx: Context, context: PoConfigContext): PoConfigContext {\n const next = deepFreeze(context);\n return requirePoConfigService(ctx).replaceSnapshot(next as PoConfigContext);\n}\n\nexport function readPoConfigService(ctx: Context): IPoConfigService | undefined {\n return ctx.get(PO_CONFIG_SERVICE) as IPoConfigService | undefined;\n}\n\nexport function requirePoConfigService(ctx: Context): IPoConfigService {\n const service = readPoConfigService(ctx);\n if (!service) throw new Error('Po config service is unavailable. Load @agimon-ai/po-config/extensions/server.');\n return service;\n}\n\nexport function requirePoConfigContext(ctx: Context): PoConfigContext {\n return requirePoConfigService(ctx).getSnapshot();\n}\n"],"mappings":";;;;;;;;AAWA,SAASA,aAAmB,OAAqC;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GACtE,OAAO;CAET,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,aAAW,KAAK;CAC1D,OAAO,OAAO,OAAO,KAAK;AAC5B;;;;;;;;;AAUA,IAAa,kBAAb,cAAqCC,oBAAAA,QAAoC;CAOpD;CANnB;CACA;CAEA,YACE,KACA,UACA,YACA,aAAa,aAAa,OAAO,WAAW,KAC5C;EACA,MAAM,KAAKC,0BAAAA,iBAAiB;EAHX,KAAA,aAAA;EAIjB,KAAK,WAAWF,aAAW,QAAQ;EACnC,KAAK,aAAa;CACpB;CAEA,cAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,gBAAgB,SAA2C;EACzD,KAAK,WAAWA,aAAW,OAAO;EAClC,OAAO,KAAK;CACd;CAEA,KAAK,UAAkB,eAAkC;EACvD,OAAO,KAAK,WAAW,UAAU,aAAa;CAChD;AACF;;;ACzBA,SAAS,YAAY,OAA4C;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,YAAY;CAClB,OACE,UAAU,YAAY,KACtB,OAAO,UAAU,cAAc,YAC/B,MAAM,QAAQ,UAAU,OAAO,KAC/B,UAAU,QAAQ,OAAO,WAAW,OAAO,WAAW,QAAQ,MAC7D,UAAU,YAAY,KAAA,KAAa,OAAO,UAAU,YAAY,cAChE,UAAU,2BAA2B,KAAA,KAAa,OAAO,UAAU,2BAA2B;AAEnG;AAEA,SAAS,gBACP,SAC+B;CAC/B,KAAK,IAAI,QAAQ,QAAQ,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG;E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CAC/E,OAAO,WAAW,OAAO;AAC3B;;AAGA,SAAgB,uBAAuB,KAAc,SAA2C;CAC9F,MAAM,OAAO,WAAW,OAAO;CAC/B,OAAO,uBAAuB,GAAG,CAAC,CAAC,gBAAgB,IAAuB;AAC5E;AAEA,SAAgB,oBAAoB,KAA4C;CAC9E,OAAO,IAAI,IAAII,0BAAAA,iBAAiB;AAClC;AAEA,SAAgB,uBAAuB,KAAgC;CACrE,MAAM,UAAU,oBAAoB,GAAG;CACvC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,gFAAgF;CAC9G,OAAO;AACT;AAEA,SAAgB,uBAAuB,KAA+B;CACpE,OAAO,uBAAuB,GAAG,CAAC,CAAC,YAAY;AACjD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionConfig-oQ24DO-4.mjs","names":["deepFreeze"],"sources":["../src/services/poConfigService/index.ts","../src/services/sessionConfig/index.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\n\nimport {\n PO_CONFIG_SERVICE,\n type DeepReadonly,\n type PoConfig,\n type PoConfigContext,\n type PoConfigLoader,\n type IPoConfigService,\n} from '../../types/config';\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\n/**\n * Po configuration published on the shared cordis Context.\n *\n * Every extension resolves the same instance by name, so configuration stays\n * one read per session instead of one per consumer, and the registration is\n * removed with the fiber that created it. The loader is injected so this stays\n * free of filesystem access.\n */\nexport class PoConfigService extends Service implements IPoConfigService {\n readonly generation: string;\n private snapshot: PoConfigContext;\n\n constructor(\n ctx: Context,\n snapshot: PoConfigContext,\n private readonly loadConfig: PoConfigLoader,\n generation = `po-config:${crypto.randomUUID()}`,\n ) {\n super(ctx, PO_CONFIG_SERVICE);\n this.snapshot = deepFreeze(snapshot) as PoConfigContext;\n this.generation = generation;\n }\n\n getSnapshot(): PoConfigContext {\n return this.snapshot;\n }\n\n replaceSnapshot(context: PoConfigContext): PoConfigContext {\n this.snapshot = deepFreeze(context) as PoConfigContext;\n return this.snapshot;\n }\n\n load(repoRoot: string, homeDirectory?: string): PoConfig {\n return this.loadConfig(repoRoot, homeDirectory);\n }\n}\n","import { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport { BACKGROUND_CONTEXT, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type {\n PoConfigSelection as ConfigSelection,\n DeepReadonly,\n PoConfigContext,\n PoConfigPendingSelection,\n PoConfigTransitionRecord,\n PoConfigTransitionStrategy,\n HarnessState,\n IPoConfigService,\n} from '../../types/config';\nimport { PO_CONFIG_SERVICE } from '../../types/config';\nimport { loadPoConfig, readPoConfig } from '../config';\nimport { getHarnessState, getSessionHarnessState } from '../harnessStore';\nimport { PoConfigService } from '../poConfigService';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport { PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE } from '@agimon-ai/po-core/contextProjection';\n\nexport type PoConfigSelection = ConfigSelection;\n\ntype PoConfigTransitionEntry = PoConfigTransitionRecord;\n\nfunction isSelection(value: unknown): value is PoConfigSelection {\n if (typeof value !== 'object' || value === null) return false;\n const selection = value as Partial<PoConfigSelection>;\n return (\n selection.version === 1 &&\n typeof selection.majorMode === 'string' &&\n Array.isArray(selection.domains) &&\n selection.domains.every((domain) => typeof domain === 'string') &&\n (selection.profile === undefined || typeof selection.profile === 'string') &&\n (selection.compositionFingerprint === undefined || typeof selection.compositionFingerprint === 'string')\n );\n}\n\nfunction branchSelection(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigSelection | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_ENTRY_TYPE && isSelection(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction isTransitionStrategy(value: unknown): value is PoConfigTransitionStrategy {\n return value === 'pi-reload' || value === 'process-relaunch';\n}\n\nfunction isTransition(value: unknown): value is PoConfigTransitionEntry {\n if (typeof value !== 'object' || value === null) return false;\n const transition = value as Partial<PoConfigTransitionEntry>;\n return (\n transition.version === 1 &&\n typeof transition.operationId === 'string' &&\n isSelection(transition.active) &&\n isSelection(transition.target) &&\n isTransitionStrategy(transition.strategy) &&\n (transition.phase === 'pending' ||\n transition.phase === 'applied' ||\n transition.phase === 'aborted' ||\n transition.phase === 'superseded')\n );\n}\n\nfunction branchTransition(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): PoConfigTransitionEntry | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === PO_CONFIG_TRANSITION_ENTRY_TYPE && isTransition(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction sameSelection(left: PoConfigSelection, state: HarnessState): boolean {\n return (\n left.majorMode === state.majorMode &&\n left.profile === state.profile &&\n (left.compositionFingerprint === undefined || left.compositionFingerprint === state.compositionFingerprint) &&\n left.domains.length === state.domains.length &&\n left.domains.every((domain, index) => domain === state.domains[index])\n );\n}\n\nfunction isActiveTransitionTarget(target: PoConfigSelection, state: HarnessState): boolean {\n return (\n target.compositionFingerprint !== undefined &&\n target.compositionFingerprint === state.compositionFingerprint &&\n sameSelection(target, state)\n );\n}\n\nfunction pendingFromTransition(transition: PoConfigTransitionEntry): PoConfigPendingSelection | undefined {\n if (transition.phase !== 'pending') return undefined;\n return { ...transition, phase: 'pending' };\n}\n\nfunction pendingFromLegacySelection(\n selection: PoConfigSelection,\n bootstrap: HarnessState,\n): PoConfigPendingSelection | undefined {\n if (sameSelection(selection, bootstrap)) return undefined;\n const active: PoConfigSelection = {\n version: 1,\n majorMode: bootstrap.majorMode,\n domains: [...bootstrap.domains],\n profile: bootstrap.profile,\n compositionFingerprint: bootstrap.compositionFingerprint,\n };\n return {\n version: 1,\n operationId: 'legacy-config-selection',\n active,\n target: selection,\n strategy: 'process-relaunch',\n phase: 'pending',\n };\n}\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\nexport function readPoConfigSelection(ctx: Pick<ExtensionContext, 'sessionManager'>): PoConfigSelection | undefined {\n return branchSelection(ctx.sessionManager.getBranch());\n}\n\nfunction resolveContextState(ctx: Pick<ExtensionContext, 'sessionManager'>): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);\n}\n\nfunction resolveBranchState(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n bootstrap: HarnessState,\n): {\n harness: HarnessState;\n pendingSelection: PoConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const selection = branchSelection(entries);\n const transition = branchTransition(entries);\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n const pendingSelection = transition\n ? transitionPending\n : selection\n ? pendingFromLegacySelection(selection, bootstrap)\n : undefined;\n return {\n harness: bootstrap,\n pendingSelection,\n requiresRelaunch:\n pendingSelection !== undefined &&\n (transitionPending === undefined || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),\n root: bootstrap.root,\n };\n}\n\nexport function createPoConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): PoConfigContext {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n return deepFreeze({ settings: loadPoConfig(root ?? ctx.cwd), harness, pendingSelection, requiresRelaunch });\n}\n\n/** Reads the settings through the host's FileSystem, so it runs wherever the session does. */\nexport async function createPoConfigContextAsync(\n ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n const settings = await readPoConfig(fs, root ?? ctx.cwd, context);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\n/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */\nexport async function createNativePoConfigContext(\n execution: PoHeadlessExecutionContext,\n fs: FileSystem,\n context: IoContext = BACKGROUND_CONTEXT,\n): Promise<PoConfigContext> {\n const bootstrap = getSessionHarnessState(execution.sessionId);\n const branch: { type: string; customType: string; data: unknown }[] = [];\n for (const customType of [PO_CONFIG_ENTRY_TYPE, PO_CONFIG_TRANSITION_ENTRY_TYPE]) {\n for await (const entry of execution.session.entriesNewestFirst({ type: 'custom', customType })) {\n if (customType === PO_CONFIG_ENTRY_TYPE ? !isSelection(entry.data) : !isTransition(entry.data)) continue;\n branch.push({ type: 'custom', customType, data: entry.data });\n break;\n }\n }\n const transition = branchTransition(branch);\n if (transition?.phase === 'pending' && isActiveTransitionTarget(transition.target, bootstrap)) {\n const data = { ...transition, phase: 'applied' as const };\n await execution.session.appendCustomEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, data);\n branch.push({ type: 'custom', customType: PO_CONFIG_TRANSITION_ENTRY_TYPE, data });\n }\n const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);\n const settings = await readPoConfig(fs, root ?? execution.cwd, context, { environment: execution.environment });\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\nexport function appendPoConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: PoConfigSelection): void {\n pi.appendEntry(PO_CONFIG_ENTRY_TYPE, selection);\n}\n\n/** Journals the live selection, defaulting to whatever the harness store holds. */\nexport function persistHarnessSelection(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n state: {\n readonly majorMode: string;\n readonly domains: readonly string[];\n readonly profile?: string;\n readonly compositionFingerprint?: string;\n } = getHarnessState(),\n): void {\n appendPoConfigSelection(pi, {\n version: 1,\n majorMode: state.majorMode,\n domains: state.domains,\n profile: state.profile,\n compositionFingerprint: state.compositionFingerprint,\n });\n}\n\nexport function appendPoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigTransitionRecord,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, transition);\n}\n\nexport function supersedePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: PoConfigPendingSelection,\n): void {\n pi.appendEntry(PO_CONFIG_TRANSITION_ENTRY_TYPE, { ...transition, phase: 'superseded' });\n}\n\n/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */\nexport function acknowledgePoConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n harness: HarnessState,\n): boolean {\n const transition = branchTransition(ctx.sessionManager.getBranch());\n if (!transition || transition.phase !== 'pending' || !isActiveTransitionTarget(transition.target, harness)) {\n return false;\n }\n appendPoConfigTransition(pi, { ...transition, phase: 'applied' });\n return true;\n}\n\nexport function readPoConfigPendingSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): PoConfigPendingSelection | undefined {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n const transition = branchTransition(ctx.sessionManager.getBranch());\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n if (transition) return transitionPending;\n const selection = branchSelection(ctx.sessionManager.getBranch());\n return selection ? pendingFromLegacySelection(selection, bootstrap) : undefined;\n}\n\nexport function providePoConfigContext(\n ctx: Context,\n context: PoConfigContext,\n generation = `po-config:${crypto.randomUUID()}`,\n): IPoConfigService {\n return new PoConfigService(ctx, deepFreeze(context) as PoConfigContext, loadPoConfig, generation);\n}\n\n/** Returns the binding identity used to fence in-flight transitions. */\nexport function readPoConfigContextGeneration(ctx: Context): string | undefined {\n return readPoConfigService(ctx)?.generation;\n}\n\n/** Precomputes an immutable context before a transaction reaches publication. */\nexport function freezePoConfigContext(context: PoConfigContext): PoConfigContext {\n return deepFreeze(context);\n}\n\n/** Replaces a live binding with a deeply frozen context after publication. */\nexport function replacePoConfigContext(ctx: Context, context: PoConfigContext): PoConfigContext {\n const next = deepFreeze(context);\n return requirePoConfigService(ctx).replaceSnapshot(next as PoConfigContext);\n}\n\nexport function readPoConfigService(ctx: Context): IPoConfigService | undefined {\n return ctx.get(PO_CONFIG_SERVICE) as IPoConfigService | undefined;\n}\n\nexport function requirePoConfigService(ctx: Context): IPoConfigService {\n const service = readPoConfigService(ctx);\n if (!service) throw new Error('Po config service is unavailable. Load @agimon-ai/po-config/extensions/server.');\n return service;\n}\n\nexport function requirePoConfigContext(ctx: Context): PoConfigContext {\n return requirePoConfigService(ctx).getSnapshot();\n}\n"],"mappings":";;;;;;;AAWA,SAASA,aAAmB,OAAqC;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GACtE,OAAO;CAET,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,aAAW,KAAK;CAC1D,OAAO,OAAO,OAAO,KAAK;AAC5B;;;;;;;;;AAUA,IAAa,kBAAb,cAAqC,QAAoC;CAOpD;CANnB;CACA;CAEA,YACE,KACA,UACA,YACA,aAAa,aAAa,OAAO,WAAW,KAC5C;EACA,MAAM,KAAK,iBAAiB;EAHX,KAAA,aAAA;EAIjB,KAAK,WAAWA,aAAW,QAAQ;EACnC,KAAK,aAAa;CACpB;CAEA,c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