@agimon-ai/po-config 0.0.0-alpha.166 → 0.0.0-alpha.167
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.
- package/dist/{config-BiPUYMvx.d.mts → config-BL7daXyO.d.mts} +3 -1
- package/dist/config-BL7daXyO.d.mts.map +1 -0
- package/dist/{config-BHj0bPoT.mjs → config-jHFempl7.mjs} +3 -3
- package/dist/{config-BHj0bPoT.mjs.map → config-jHFempl7.mjs.map} +1 -1
- package/dist/{config-2GEw5hpG.cjs → config-oQXrtc0y.cjs} +3 -3
- package/dist/{config-2GEw5hpG.cjs.map → config-oQXrtc0y.cjs.map} +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/{configPolicy-DZXp-brn.mjs → configPolicy-Bgi7V9Eq.mjs} +30 -7
- package/dist/configPolicy-Bgi7V9Eq.mjs.map +1 -0
- package/dist/{configPolicy-CxWA-uFk.cjs → configPolicy-kI8z4SbJ.cjs} +30 -7
- package/dist/configPolicy-kI8z4SbJ.cjs.map +1 -0
- package/dist/{configWriter-C5zpNm2T.mjs → configWriter-De3xXSQ9.mjs} +2 -2
- package/dist/{configWriter-C5zpNm2T.mjs.map → configWriter-De3xXSQ9.mjs.map} +1 -1
- package/dist/{configWriter-DmTxZ9-m.cjs → configWriter-xpEinb2T.cjs} +2 -2
- package/dist/{configWriter-DmTxZ9-m.cjs.map → configWriter-xpEinb2T.cjs.map} +1 -1
- package/dist/configWriter.cjs +1 -1
- package/dist/configWriter.mjs +1 -1
- package/dist/{core-Dya2ZUdt.mjs → core-0MU_ZzVL.mjs} +2 -2
- package/dist/{core-Dya2ZUdt.mjs.map → core-0MU_ZzVL.mjs.map} +1 -1
- package/dist/{core-nuX9t102.cjs → core-ByHycT-P.cjs} +2 -2
- package/dist/{core-nuX9t102.cjs.map → core-ByHycT-P.cjs.map} +1 -1
- package/dist/{domains-B4a9NDuw.mjs → domains-8fO4hpHL.mjs} +4 -4
- package/dist/{domains-B4a9NDuw.mjs.map → domains-8fO4hpHL.mjs.map} +1 -1
- package/dist/{domains-BkSL8WIC.cjs → domains-RrDelsTr.cjs} +4 -4
- package/dist/{domains-BkSL8WIC.cjs.map → domains-RrDelsTr.cjs.map} +1 -1
- package/dist/domains.cjs +2 -2
- package/dist/domains.mjs +2 -2
- package/dist/extensions/server.cjs +2 -2
- package/dist/extensions/server.mjs +2 -2
- package/dist/harnessState.d.mts +1 -1
- package/dist/harnessStore.d.mts +1 -1
- package/dist/{index-DcCd-SB4.d.mts → index-B1L7hLXD.d.mts} +2 -2
- package/dist/{index-DcCd-SB4.d.mts.map → index-B1L7hLXD.d.mts.map} +1 -1
- package/dist/index-B2r4kUcO.d.mts.map +1 -1
- package/dist/{index-D9-NRdbb.d.mts → index-CeBtfNDR.d.mts} +2 -2
- package/dist/{index-D9-NRdbb.d.mts.map → index-CeBtfNDR.d.mts.map} +1 -1
- package/dist/{index-CQ--ttkb.d.mts → index-DJA5DU-w.d.mts} +3 -3
- package/dist/{index-CQ--ttkb.d.mts.map → index-DJA5DU-w.d.mts.map} +1 -1
- package/dist/{index-Bai7osxe.d.mts → index-DoKh7Qsx.d.mts} +2 -2
- package/dist/{index-Bai7osxe.d.mts.map → index-DoKh7Qsx.d.mts.map} +1 -1
- package/dist/{index-zZDOaoJU.d.mts → index-aXYCsazr.d.mts} +2 -2
- package/dist/{index-zZDOaoJU.d.mts.map → index-aXYCsazr.d.mts.map} +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +11 -11
- package/dist/{init-DwQEouLI.mjs → init-BBWtHJkp.mjs} +3 -5
- package/dist/init-BBWtHJkp.mjs.map +1 -0
- package/dist/{init-B94H-XTo.cjs → init-BGKSbsHa.cjs} +3 -5
- package/dist/init-BGKSbsHa.cjs.map +1 -0
- package/dist/init.cjs +1 -1
- package/dist/init.mjs +1 -1
- package/dist/{layeredConfig-BF6LjOze.cjs → layeredConfig-BZBuRNes.cjs} +2 -2
- package/dist/{layeredConfig-BF6LjOze.cjs.map → layeredConfig-BZBuRNes.cjs.map} +1 -1
- package/dist/{layeredConfig-C8lVXsB8.mjs → layeredConfig-f2B0sWgo.mjs} +2 -2
- package/dist/{layeredConfig-C8lVXsB8.mjs.map → layeredConfig-f2B0sWgo.mjs.map} +1 -1
- package/dist/layeredConfig.cjs +1 -1
- package/dist/layeredConfig.mjs +1 -1
- package/dist/piContext.cjs +1 -1
- package/dist/piContext.d.mts +2 -2
- package/dist/piContext.mjs +1 -1
- package/dist/{presetConfig-IGEGDSo6.mjs → presetConfig-DJ0qW2dy.mjs} +2 -2
- package/dist/{presetConfig-IGEGDSo6.mjs.map → presetConfig-DJ0qW2dy.mjs.map} +1 -1
- package/dist/{presetConfig-BwqPXTdg.cjs → presetConfig-DjiKkydr.cjs} +2 -2
- package/dist/{presetConfig-BwqPXTdg.cjs.map → presetConfig-DjiKkydr.cjs.map} +1 -1
- package/dist/{presets-CaBSxp8d.mjs → presets-BsQwEERh.mjs} +5 -5
- package/dist/{presets-CaBSxp8d.mjs.map → presets-BsQwEERh.mjs.map} +1 -1
- package/dist/{presets-FfPdEodt.cjs → presets-DAV_J-II.cjs} +5 -5
- package/dist/{presets-FfPdEodt.cjs.map → presets-DAV_J-II.cjs.map} +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +2 -2
- package/dist/{profiles-BwunwHdU.cjs → profiles-CTRwnQos.cjs} +2 -2
- package/dist/{profiles-BwunwHdU.cjs.map → profiles-CTRwnQos.cjs.map} +1 -1
- package/dist/{profiles-Cq8C9AlY.mjs → profiles-DMvBh7xw.mjs} +2 -2
- package/dist/{profiles-Cq8C9AlY.mjs.map → profiles-DMvBh7xw.mjs.map} +1 -1
- package/dist/profiles.cjs +1 -1
- package/dist/profiles.mjs +1 -1
- package/dist/selectionSwitch.cjs +2 -2
- package/dist/selectionSwitch.d.mts +2 -2
- package/dist/selectionSwitch.mjs +2 -2
- package/dist/{sessionConfig-C27RUnf_.mjs → sessionConfig-DESgYj-q.mjs} +2 -2
- package/dist/{sessionConfig-C27RUnf_.mjs.map → sessionConfig-DESgYj-q.mjs.map} +1 -1
- package/dist/{sessionConfig-COzNuRVR.cjs → sessionConfig-eVi5n0vv.cjs} +2 -2
- package/dist/{sessionConfig-COzNuRVR.cjs.map → sessionConfig-eVi5n0vv.cjs.map} +1 -1
- package/dist/{settingsApi-CE2BMALd.mjs → settingsApi-8YnFRNRz.mjs} +9 -9
- package/dist/{settingsApi-CE2BMALd.mjs.map → settingsApi-8YnFRNRz.mjs.map} +1 -1
- package/dist/{settingsApi-BvRnhMCj.cjs → settingsApi-CNtG7pWk.cjs} +9 -9
- package/dist/{settingsApi-BvRnhMCj.cjs.map → settingsApi-CNtG7pWk.cjs.map} +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +4 -4
- package/dist/config-BiPUYMvx.d.mts.map +0 -1
- package/dist/configPolicy-CxWA-uFk.cjs.map +0 -1
- package/dist/configPolicy-DZXp-brn.mjs.map +0 -1
- package/dist/init-B94H-XTo.cjs.map +0 -1
- package/dist/init-DwQEouLI.mjs.map +0 -1
|
@@ -72,6 +72,8 @@ interface SubagentsConfig {
|
|
|
72
72
|
thinking?: PlanningThinkingLevel;
|
|
73
73
|
fallbackModels?: string[];
|
|
74
74
|
excludeTools?: string[];
|
|
75
|
+
/** One named agent's model and thinking. They win over its file's frontmatter and the defaults above. */
|
|
76
|
+
agents?: Record<string, PlanningAgentConfig>;
|
|
75
77
|
}
|
|
76
78
|
interface ComputerUseConfig {
|
|
77
79
|
enabled?: boolean;
|
|
@@ -397,4 +399,4 @@ interface LenientParseResult {
|
|
|
397
399
|
}
|
|
398
400
|
//#endregion
|
|
399
401
|
export { PoSelectionConfig as A, VoiceTtsConfig as B, PoConfigLayers as C, PoConfigTransitionRecord as D, PoConfigTransitionPhase as E, VoiceAutoCaptureConfig as F, WorkspaceDeclaration as H, VoiceConfig as I, VoiceEngine as L, ResolvedVoiceAutoCaptureConfig as M, ResolvedVoiceConfig as N, PoConfigTransitionStrategy as O, VoiceAdapterConfig as P, VoiceMode as R, PoConfigLayer as S, PoConfigSelection as T, VoiceTtsEngine as V, PlanningAgentConfig as _, ConfigDiagnostic as a, PoConfig as b, DesktopEnvironmentConfig as c, IPoConfigLoader as d, IPoConfigService$1 as f, PackageAttribution$1 as g, PO_CONFIG_SERVICE as h, AutocompactTokenConfig as i, ProjectTrust as j, PoHarnessContext as k, EditorConfig as l, LenientParseResult as m, AutocompactOverrideConfig as n, ConfigValueOrigin as o, LenientParseOptions as p, AutocompactThresholdConfig as r, DeepReadonly as s, AutocompactModeConfig as t, HarnessState as u, PlanningModeConfig as v, PoConfigPendingSelection as w, PoConfigContext as x, PlanningThinkingLevel as y, VoiceModelConfig as z };
|
|
400
|
-
//# sourceMappingURL=config-
|
|
402
|
+
//# sourceMappingURL=config-BL7daXyO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-BL7daXyO.d.mts","names":["IPoConfigService","PoConfigServiceContract"],"sources":["../src/types/config.ts"],"mappings":";;;;;KAOY;KACA;KACA;KACA;KACA;UAEK;EACf;EACA,WAAW;;UAEI;EACf,OAAO;EACP,YAAY;EACZ;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA,QAAQ;;UAEO;EACf;EACA;EACA,WAAW;EACX,aAAa;EACb,YAAY;;;UAGG;EACf;;;;;;UAMe;EACf;EACA,WAAW;EACX;EACA;;EAEA,SAAS,eAAe;;UAET;EACf;;;;;;;UAOe;;EAEf;;EAEA;;EAEA;;EAEA,MAAM;;UAGS;EACf;;;UAGe;;EAEf;;EAEA;;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAGe;EACf,OAAO;;EAEP;EACA;;IAEE;;IAEA,eAAe;;;U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ACf,KAAK,kBAAkB,yBAAyB;;;UAIjCA,2BAAyBC,iBAAwB,iBAAiB;;YAGvE;IACR,aAAaD;;;;KAQL;;UAGK;EACf;EACA;;;;;;EAMA;;EAEA;;;;;;;;;;UAWe;;EAEf,YAAY;EACZ,gBAAgB;EAChB,WAAW;;EAEX,SAAS,6BAA6B;;EAEtC,QAAQ;;;;;;;;;UAUO;EACf;;EAEA;EACA;;;UAIe;EACf;;;UAIe;EACf,QAAQ;EACR,aAAa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as parsePoConfig } from "./configPolicy-
|
|
2
|
-
import { S as withGlobalLayer, _ as mergeLenientLayers, a as defaultPoConfig, c as globalSettingsCachePath, d as globalSettingsRecords, g as mergeConfigLayers, h as lenientConfigFromText, i as configFromText, l as globalSettingsMember, m as layerFromText, n as absentRepositoryLayer, p as isGlobalSettingsBinding, r as composeConfigLayers, s as globalPoConfigPath, u as globalSettingsOwnerPath, v as repositoryConfigFor, x as sameGlobalSettingsBinding } from "./core-
|
|
1
|
+
import { g as parsePoConfig } from "./configPolicy-Bgi7V9Eq.mjs";
|
|
2
|
+
import { S as withGlobalLayer, _ as mergeLenientLayers, a as defaultPoConfig, c as globalSettingsCachePath, d as globalSettingsRecords, g as mergeConfigLayers, h as lenientConfigFromText, i as configFromText, l as globalSettingsMember, m as layerFromText, n as absentRepositoryLayer, p as isGlobalSettingsBinding, r as composeConfigLayers, s as globalPoConfigPath, u as globalSettingsOwnerPath, v as repositoryConfigFor, x as sameGlobalSettingsBinding } from "./core-0MU_ZzVL.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { nodeHost, readTextIfExists, writeFileAtomic } from "@agimon-ai/po-core/platform";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -220,4 +220,4 @@ async function readPoConfigLayers(fs, repoRoot, context, options = {}) {
|
|
|
220
220
|
//#endregion
|
|
221
221
|
export { refreshGlobalSettingsCache as a, loadPoConfigLayers as c, readWorkspaceDeclarations as i, loadPoConfigLenient as l, readPoConfigLayers as n, loadPoConfig as o, readPoConfigLenient as r, loadPoConfigAsync as s, readPoConfig as t };
|
|
222
222
|
|
|
223
|
-
//# sourceMappingURL=config-
|
|
223
|
+
//# sourceMappingURL=config-jHFempl7.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-BHj0bPoT.mjs","names":["readText","parseYaml"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAO,GAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeA,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAM,GAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;;AAGA,SAAgB,aACd,UACA,gBAAgB,SAAS,cAAc,GACvC,cAAiC,QAAQ,KAC/B;CACV,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,oBAAoB,UAAU,eAAe,WAAW;CAC/E,OAAO,kBACL,eACE,gBACE,aAAa,wBAAwB,eAAe,WAAW,CAAC,GAChE,aAAa,UAAU,GACvB,qBAAqB,aAAa,aAAa,wBAAwB,eAAe,WAAW,CAAC,CAAC,CACrG,GACA,UACF,GACA,mBAAmB,KAAA,IAAY,gBAAgB,IAAI,eAAe,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
1
|
+
{"version":3,"file":"config-jHFempl7.mjs","names":["readText","parseYaml"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAO,GAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeA,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAM,GAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;;AAGA,SAAgB,aACd,UACA,gBAAgB,SAAS,cAAc,GACvC,cAAiC,QAAQ,KAC/B;CACV,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,oBAAoB,UAAU,eAAe,WAAW;CAC/E,OAAO,kBACL,eACE,gBACE,aAAa,wBAAwB,eAAe,WAAW,CAAC,GAChE,aAAa,UAAU,GACvB,qBAAqB,aAAa,aAAa,wBAAwB,eAAe,WAAW,CAAC,CAAC,CACrG,GACA,UACF,GACA,mBAAmB,KAAA,IAAY,gBAAgB,IAAI,eAAe,aAAa,cAAc,GAAG,cAAc,GAC9G,WACF;AACF;;;;;;;;;;;AAYA,SAAgB,oBACd,UACA,gBAAgB,SAAS,cAAc,GACvC,cAAiC,QAAQ,KACrB;CACpB,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,oBAAoB,UAAU,eAA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,IACA,UACA,SACA,UAA+B,CAAC,GACH;CAC7B,MAAM,EAAE,eAAe,gBAAgB,SAAS,OAAO;CACvD,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,oBAAoB,UAAU,eAAe,WAAW;CAC/E,MAAM,eAAe,sBAAsB,MAAM,SAAS,IAAI,YAAY,OAAO,GAAG,UAAU;CAC9F,MAAM,mBACJ,mBAAmB,KAAA,IACf,sBAAsB,KAAA,GAAW,EAAE,IACnC,sBAAsB,MAAM,SAAS,IAAI,gBAAgB,OAAO,GAAG,cAAc;CACvF,OAAO,mBAAmB,cAAc,kBAAkB,WAAW;AACvE;;;;;;;AAQA,eAAsB,mBACpB,IACA,UACA,SACA,UAA+B,CAAC,GACP;CACzB,MAAM,EAAE,eAAe,gBAAgB,SAAS,OAAO;CACvD,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,aAAa,KAAA,IAAY,KAAA,IAAY,oBAAoB,UAAU,eAAe,WAAW;CACpH,MAAM,aAAa,MAAM,SAAS,IAAI,YAAY,OAAO;CACzD,MAAM,iBAAiB,MAAM,SAAS,IAAI,gBAAgB,OAAO;CACjE,MAAM,cAAc,cAAc,YAAY,UAAU;CACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAY,sBAAsB,IAAI,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAY,gBAAgB,IAAI,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAY,kBAAkB,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAO,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
2
|
-
const require_configPolicy = require("./configPolicy-
|
|
3
|
-
const require_core = require("./core-
|
|
2
|
+
const require_configPolicy = require("./configPolicy-kI8z4SbJ.cjs");
|
|
3
|
+
const require_core = require("./core-ByHycT-P.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
6
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
@@ -276,4 +276,4 @@ Object.defineProperty(exports, "refreshGlobalSettingsCache", {
|
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
-
//# sourceMappingURL=config-
|
|
279
|
+
//# sourceMappingURL=config-oQXrtc0y.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-2GEw5hpG.cjs","names":["fs","readText","nodeHost","globalPoConfigPath","repositoryConfigFor","mergeConfigLayers","configFromText","withGlobalLayer","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","defaultPoConfig","mergeLenientLayers","lenientConfigFromText","composeConfigLayers","layerFromText","absentRepositoryLayer","path","readTextIfExists","configFromText","parseYaml","parsePoConfig","nodeHost","globalPoConfigPath","repositoryConfigFor","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","withGlobalLayer","defaultPoConfig","mergeConfigLayers","GLOBAL_SETTINGS_READ_OPERATION","globalSettingsRecords","isGlobalSettingsBinding","sameGlobalSettingsBinding","writeFileAtomic","lenientConfigFromText","mergeLenientLayers","layerFromText","absentRepositoryLayer","composeConfigLayers"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAOA,QAAAA,QAAG,aAAa,UAAU,MA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;CAClG,MAAM,YAAYW,aAAAA,kBAAkBX,aAAAA,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAOqB,aAAAA,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
|
|
1
|
+
{"version":3,"file":"config-oQXrtc0y.cjs","names":["fs","readText","nodeHost","globalPoConfigPath","repositoryConfigFor","mergeConfigLayers","configFromText","withGlobalLayer","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","defaultPoConfig","mergeLenientLayers","lenientConfigFromText","composeConfigLayers","layerFromText","absentRepositoryLayer","path","readTextIfExists","configFromText","parseYaml","parsePoConfig","nodeHost","globalPoConfigPath","repositoryConfigFor","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","withGlobalLayer","defaultPoConfig","mergeConfigLayers","GLOBAL_SETTINGS_READ_OPERATION","globalSettingsRecords","isGlobalSettingsBinding","sameGlobalSettingsBinding","writeFileAtomic","lenientConfigFromText","mergeLenientLayers","layerFromText","absentRepositoryLayer","composeConfigLayers"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAOA,QAAAA,QAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeC,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAMD,QAAAA,QAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAA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ports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_configPolicy = require("./configPolicy-
|
|
3
|
-
const require_core = require("./core-
|
|
4
|
-
const require_config = require("./config-
|
|
2
|
+
const require_configPolicy = require("./configPolicy-kI8z4SbJ.cjs");
|
|
3
|
+
const require_core = require("./core-ByHycT-P.cjs");
|
|
4
|
+
const require_config = require("./config-oQXrtc0y.cjs");
|
|
5
5
|
let _agimon_ai_po_core = require("@agimon-ai/po-core");
|
|
6
6
|
exports.PO_PLANNING_THINKING_LEVELS = require_configPolicy.PO_PLANNING_THINKING_LEVELS;
|
|
7
7
|
exports.PO_VOICE_ENGINES = require_configPolicy.PO_VOICE_ENGINES;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as PoConfigLayers, S as PoConfigLayer, a as ConfigDiagnostic, m as LenientParseResult, o as ConfigValueOrigin, p as LenientParseOptions } from "./config-
|
|
2
|
-
import { A as loadPoConfigLayers, C as readPoConfig, D as refreshGlobalSettingsCache, E as readWorkspaceDeclarations, F as globalSettingsCachePath, I as repositoryPoConfigPath, L as resolvePlanningPlansDirectory, M as SESSION_MEMBER_ENVIRONMENT, N as globalPoConfigDirectory, O as loadPoConfig, P as globalPoConfigPath, S as WorkspaceDeclarationsResult, T as readPoConfigLenient, _ as parsePoConfig, a as PO_VOICE_MODES, b as ReadPoConfigOptions, c as configRootKeys, d as mergeGlobalConfigLayer, f as mergePoConfigs, g as parsePlanningModeConfig, h as parseAutocompactModeConfig, i as PO_VOICE_LIVE_VOICES, j as loadPoConfigLenient, k as loadPoConfigAsync, l as configScopeOf, m as nonPortableConfigText, n as PO_PLANNING_THINKING_LEVELS, o as PO_VOICE_TTS_ENGINES, p as nonPortableConfigKeys, r as PO_VOICE_ENGINES, s as configLeafKeys, t as ConfigKeyScope, u as isPortableConfigKey, v as resolveVoiceConfig, w as readPoConfigLayers, x as ReadWorkspaceDeclarationsOptions, y as valueAtKeyPath } from "./index-
|
|
1
|
+
import { C as PoConfigLayers, S as PoConfigLayer, a as ConfigDiagnostic, m as LenientParseResult, o as ConfigValueOrigin, p as LenientParseOptions } from "./config-BL7daXyO.mjs";
|
|
2
|
+
import { A as loadPoConfigLayers, C as readPoConfig, D as refreshGlobalSettingsCache, E as readWorkspaceDeclarations, F as globalSettingsCachePath, I as repositoryPoConfigPath, L as resolvePlanningPlansDirectory, M as SESSION_MEMBER_ENVIRONMENT, N as globalPoConfigDirectory, O as loadPoConfig, P as globalPoConfigPath, S as WorkspaceDeclarationsResult, T as readPoConfigLenient, _ as parsePoConfig, a as PO_VOICE_MODES, b as ReadPoConfigOptions, c as configRootKeys, d as mergeGlobalConfigLayer, f as mergePoConfigs, g as parsePlanningModeConfig, h as parseAutocompactModeConfig, i as PO_VOICE_LIVE_VOICES, j as loadPoConfigLenient, k as loadPoConfigAsync, l as configScopeOf, m as nonPortableConfigText, n as PO_PLANNING_THINKING_LEVELS, o as PO_VOICE_TTS_ENGINES, p as nonPortableConfigKeys, r as PO_VOICE_ENGINES, s as configLeafKeys, t as ConfigKeyScope, u as isPortableConfigKey, v as resolveVoiceConfig, w as readPoConfigLayers, x as ReadWorkspaceDeclarationsOptions, y as valueAtKeyPath } from "./index-B1L7hLXD.mjs";
|
|
3
3
|
export { type ConfigDiagnostic, type ConfigKeyScope, type ConfigValueOrigin, type LenientParseOptions, type LenientParseResult, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, type PoConfigLayer, type PoConfigLayers, type ReadPoConfigOptions, type ReadWorkspaceDeclarationsOptions, SESSION_MEMBER_ENVIRONMENT, type WorkspaceDeclarationsResult, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, globalSettingsCachePath, isPortableConfigKey, loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient, mergeGlobalConfigLayer, mergePoConfigs, nonPortableConfigKeys, nonPortableConfigText, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, refreshGlobalSettingsCache, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
|
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as resolveVoiceConfig, a as PO_VOICE_TTS_ENGINES, c as configScopeOf, d as mergePoConfigs, f as nonPortableConfigKeys, g as parsePoConfig, h as parsePlanningModeConfig, i as PO_VOICE_MODES, l as isPortableConfigKey, m as parseAutocompactModeConfig, n as PO_VOICE_ENGINES, o as configLeafKeys, p as nonPortableConfigText, r as PO_VOICE_LIVE_VOICES, s as configRootKeys, t as PO_PLANNING_THINKING_LEVELS, u as mergeGlobalConfigLayer, v as valueAtKeyPath } from "./configPolicy-
|
|
2
|
-
import { b as resolvePlanningPlansDirectory, c as globalSettingsCachePath, o as globalPoConfigDirectory, s as globalPoConfigPath, t as SESSION_MEMBER_ENVIRONMENT, y as repositoryPoConfigPath } from "./core-
|
|
3
|
-
import { a as refreshGlobalSettingsCache, c as loadPoConfigLayers, i as readWorkspaceDeclarations, l as loadPoConfigLenient, n as readPoConfigLayers, o as loadPoConfig, r as readPoConfigLenient, s as loadPoConfigAsync, t as readPoConfig } from "./config-
|
|
1
|
+
import { _ as resolveVoiceConfig, a as PO_VOICE_TTS_ENGINES, c as configScopeOf, d as mergePoConfigs, f as nonPortableConfigKeys, g as parsePoConfig, h as parsePlanningModeConfig, i as PO_VOICE_MODES, l as isPortableConfigKey, m as parseAutocompactModeConfig, n as PO_VOICE_ENGINES, o as configLeafKeys, p as nonPortableConfigText, r as PO_VOICE_LIVE_VOICES, s as configRootKeys, t as PO_PLANNING_THINKING_LEVELS, u as mergeGlobalConfigLayer, v as valueAtKeyPath } from "./configPolicy-Bgi7V9Eq.mjs";
|
|
2
|
+
import { b as resolvePlanningPlansDirectory, c as globalSettingsCachePath, o as globalPoConfigDirectory, s as globalPoConfigPath, t as SESSION_MEMBER_ENVIRONMENT, y as repositoryPoConfigPath } from "./core-0MU_ZzVL.mjs";
|
|
3
|
+
import { a as refreshGlobalSettingsCache, c as loadPoConfigLayers, i as readWorkspaceDeclarations, l as loadPoConfigLenient, n as readPoConfigLayers, o as loadPoConfig, r as readPoConfigLenient, s as loadPoConfigAsync, t as readPoConfig } from "./config-jHFempl7.mjs";
|
|
4
4
|
export { PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, SESSION_MEMBER_ENVIRONMENT, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, globalSettingsCachePath, isPortableConfigKey, loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient, mergeGlobalConfigLayer, mergePoConfigs, nonPortableConfigKeys, nonPortableConfigText, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, refreshGlobalSettingsCache, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
|
|
@@ -79,7 +79,8 @@ const SUBAGENTS_KEYS = [
|
|
|
79
79
|
"model",
|
|
80
80
|
"thinking",
|
|
81
81
|
"fallbackModels",
|
|
82
|
-
"excludeTools"
|
|
82
|
+
"excludeTools",
|
|
83
|
+
"agents"
|
|
83
84
|
];
|
|
84
85
|
/** A pass that fires below this is noise; one above it never fires before Pi compacts natively. */
|
|
85
86
|
const MIN_AUTOCOMPACT_RATIO = .05;
|
|
@@ -687,6 +688,19 @@ function parseFlexibleList(value, location, filePath) {
|
|
|
687
688
|
if (!Array.isArray(entries) || entries.some((entry) => typeof entry !== "string")) throw new Error(`Po config at ${filePath} requires ${location} to be a list of strings`);
|
|
688
689
|
return [...new Set(entries.map((entry) => entry.trim()).filter(Boolean))];
|
|
689
690
|
}
|
|
691
|
+
/** An agent's runtime name: its file's `name`, qualified by its package with a dot. */
|
|
692
|
+
const SUBAGENT_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u;
|
|
693
|
+
function parseSubagentAgents(value, filePath) {
|
|
694
|
+
if (value === void 0) return void 0;
|
|
695
|
+
if (!isObject(value)) throw new Error(`Po config at ${filePath} requires subagents.agents to be an object`);
|
|
696
|
+
const agents = {};
|
|
697
|
+
for (const [name, entry] of Object.entries(value)) {
|
|
698
|
+
if (!SUBAGENT_NAME.test(name)) throw new Error(`Po config at ${filePath} has an invalid agent name in subagents.agents: ${name}`);
|
|
699
|
+
const agent = parseAgent(entry, `subagents.agents.${name}`, filePath);
|
|
700
|
+
if (agent && Object.keys(agent).length > 0) agents[name] = agent;
|
|
701
|
+
}
|
|
702
|
+
return Object.keys(agents).length > 0 ? agents : void 0;
|
|
703
|
+
}
|
|
690
704
|
function parseSubagents(value, filePath) {
|
|
691
705
|
if (value === void 0) return void 0;
|
|
692
706
|
if (!isObject(value)) throw new Error(`Po config at ${filePath} requires subagents to be an object`);
|
|
@@ -695,11 +709,13 @@ function parseSubagents(value, filePath) {
|
|
|
695
709
|
const thinking = parseThinking(value.thinking, "subagents", filePath);
|
|
696
710
|
const fallbackModels = parseFlexibleList(value.fallbackModels, "subagents.fallbackModels", filePath);
|
|
697
711
|
const excludeTools = parseFlexibleList(value.excludeTools, "subagents.excludeTools", filePath);
|
|
712
|
+
const agents = parseSubagentAgents(value.agents, filePath);
|
|
698
713
|
return {
|
|
699
714
|
...model ? { model } : {},
|
|
700
715
|
...thinking ? { thinking } : {},
|
|
701
716
|
...fallbackModels ? { fallbackModels } : {},
|
|
702
|
-
...excludeTools ? { excludeTools } : {}
|
|
717
|
+
...excludeTools ? { excludeTools } : {},
|
|
718
|
+
...agents ? { agents } : {}
|
|
703
719
|
};
|
|
704
720
|
}
|
|
705
721
|
function parseDesktopEnvironment(value, filePath) {
|
|
@@ -794,6 +810,16 @@ function mergeAgent(globalValue, repositoryValue) {
|
|
|
794
810
|
...repositoryValue
|
|
795
811
|
} : void 0;
|
|
796
812
|
}
|
|
813
|
+
function mergeSubagents(globalValue, repositoryValue) {
|
|
814
|
+
if (!globalValue && !repositoryValue) return void 0;
|
|
815
|
+
const names = /* @__PURE__ */ new Set([...Object.keys(globalValue?.agents ?? {}), ...Object.keys(repositoryValue?.agents ?? {})]);
|
|
816
|
+
const agents = Object.fromEntries([...names].map((name) => [name, mergeAgent(globalValue?.agents?.[name], repositoryValue?.agents?.[name])]));
|
|
817
|
+
return {
|
|
818
|
+
...globalValue,
|
|
819
|
+
...repositoryValue,
|
|
820
|
+
...names.size > 0 ? { agents } : {}
|
|
821
|
+
};
|
|
822
|
+
}
|
|
797
823
|
function mergePoConfigs(globalConfig, repositoryConfig) {
|
|
798
824
|
if (repositoryConfig.voice?.mode) throw new Error("Repository Po config voice.mode is global-only; configure it in ~/.po/config.yaml");
|
|
799
825
|
if (repositoryConfig.voice?.autoCapture) throw new Error("Repository Po config voice.autoCapture is global-only; configure it in ~/.po/config.yaml");
|
|
@@ -829,10 +855,7 @@ function mergePoConfigs(globalConfig, repositoryConfig) {
|
|
|
829
855
|
computerUse: globalConfig.computerUse,
|
|
830
856
|
desktopEnvironment: globalConfig.desktopEnvironment,
|
|
831
857
|
profileMemory: globalConfig.profileMemory,
|
|
832
|
-
subagents: globalConfig.subagents
|
|
833
|
-
...globalConfig.subagents,
|
|
834
|
-
...repositoryConfig.subagents
|
|
835
|
-
} : void 0,
|
|
858
|
+
subagents: mergeSubagents(globalConfig.subagents, repositoryConfig.subagents),
|
|
836
859
|
projectTrust: repositoryConfig.projectTrust,
|
|
837
860
|
workspaces: repositoryConfig.workspaces,
|
|
838
861
|
editor: globalConfig.editor,
|
|
@@ -1024,4 +1047,4 @@ function valueAtKeyPath(value, keyPath) {
|
|
|
1024
1047
|
//#endregion
|
|
1025
1048
|
export { resolveVoiceConfig as _, PO_VOICE_TTS_ENGINES as a, configScopeOf as c, mergePoConfigs as d, nonPortableConfigKeys$1 as f, parsePoConfig as g, parsePlanningModeConfig as h, PO_VOICE_MODES as i, isPortableConfigKey$1 as l, parseAutocompactModeConfig as m, PO_VOICE_ENGINES as n, configLeafKeys as o, nonPortableConfigText as p, PO_VOICE_LIVE_VOICES as r, configRootKeys as s, PO_PLANNING_THINKING_LEVELS as t, mergeGlobalConfigLayer as u, valueAtKeyPath as v };
|
|
1026
1049
|
|
|
1027
|
-
//# sourceMappingURL=configPolicy-
|
|
1050
|
+
//# sourceMappingURL=configPolicy-Bgi7V9Eq.mjs.map
|