{"version":3,"file":"config-DUC5fzxP.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 { marketplaceOrigin } from '@agimon-ai/po-core/verifiedArchive';\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  /** Admitted environment for locating Po home and member overrides. Defaults to empty. */\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 ?? {},\n  };\n}\n\n/** Reads only the machine owner's config, never repository or org-member preferences. */\nexport async function readHostMarketplaceOrigin(\n  fs: FileSystem,\n  homeDirectory: string,\n  environment: ConfigEnvironment,\n  context: IoContext,\n): Promise<string> {\n  const file = globalPoConfigPath(homeDirectory, environment);\n  const config = configFromText(await readTextIfExists(fs, file, context), file);\n  return marketplaceOrigin(config.marketplace?.url);\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  globalSettingsPeople,\n  isGlobalPoConfigRoot,\n  SESSION_MEMBER_ENVIRONMENT,\n  repositoryPoConfigPath,\n  resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment, GlobalSettingsPerson } 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,S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